Skip to content

Instantly share code, notes, and snippets.

@dovy
Last active December 23, 2015 14:59
Show Gist options
  • Save dovy/6652106 to your computer and use it in GitHub Desktop.
Save dovy/6652106 to your computer and use it in GitHub Desktop.
sdfds
<?
private function __construct() {
$this->_actionsCommon();
if ( is_admin() ) {
$this->_actionsAdmin();
}
}
/**
* Runs the intitilization actions needed for both public and admin
*
* @since 1.0.0
*/
public function _actionsCommon() {
// Load plugin text domain
add_action( 'wp_loaded', array( $this, 'load_plugin_textdomain' ) );
if ( !class_exists( 'Redux_Framework' ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/framework.php' ) ) {
require_once( dirname( __FILE__ ) . '/ReduxFramework/framework.php' );
}
$this->demo = get_option( 'REDUX_FRAMEWORK_DEMO');
if ($this->demo && file_exists( dirname( __FILE__ ) . '/ReduxFramework/sample/sample-config.php' ) ) {
require_once( dirname( __FILE__ ) . '/ReduxFramework/sample/sample-config.php' );
}
}
/**
* Runs the intitilization actions needed only for the admin side
*
* @since 1.0.0
*/
public function _actionsAdmin() {
// Activate plugin when new blog is added
add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
add_action('admin_notices', array( $this, 'admin_notices' ) );
// Add the options page and menu item.
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
// Add an action link pointing to the options page.
$plugin_basename = plugin_basename( dirname( __FILE__ ) . 'redux-framework.php' );
add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) );
add_filter( 'plugin_row_meta', array($this, 'ts_plugin_meta_links'), 10, 2 );
// Load admin style sheet and JavaScript.
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment