static function add_meta_boxes($page) { $i = 1; add_meta_box($page . '-contentbox-' . $i++, MainWP_Right_Now::getName(), array(MainWP_Right_Now::getClassName(), 'render'), $page, 'normal', 'core'); if (mainwp_current_user_can('dashboard', 'manage_posts')) { add_meta_box($page . '-contentbox-' . $i++, MainWP_Recent_Posts::getName(), array(MainWP_Recent_Posts::getClassName(), 'render'), $page, 'normal', 'core'); } if (mainwp_current_user_can('dashboard', 'manage_pages')) { add_meta_box($page . '-contentbox-' . $i++, MainWP_Recent_Pages::getName(), array(MainWP_Recent_Pages::getClassName(), 'render'), $page, 'normal', 'core'); } if (mainwp_current_user_can('dashboard', 'manage_security_issues')) { add_meta_box($page . '-contentbox-' . $i++, MainWP_Security_Issues::getMetaboxName(), array(MainWP_Security_Issues::getClassName(), 'renderMetabox'), $page, 'normal', 'core'); } global $mainwpUseExternalPrimaryBackupsMethod; if (empty($mainwpUseExternalPrimaryBackupsMethod)) { add_meta_box($page . '-contentbox-' . $i++, MainWP_Backup_Tasks::getName(), array(MainWP_Backup_Tasks::getClassName(), 'render'), $page, 'normal', 'core'); } if (mainwp_current_user_can('dashboard', 'see_seo_statistics')) { if (get_option('mainwp_seo') == 1) { add_meta_box($page . '-contentbox-' . $i++, MainWP_SEO::getName(), array(MainWP_SEO::getClassName(), 'render'), $page, 'normal', 'core'); } } add_meta_box($page . '-contentbox-' . $i++, MainWP_Extensions_Widget::getName(), array(MainWP_Extensions_Widget::getClassName(), 'render'), $page, 'normal', 'core'); add_meta_box($page . '-contentbox-' . $i++, MainWP_Help::getName(), array(MainWP_Help::getClassName(), 'render'), $page, 'normal', 'core'); add_meta_box($page . '-contentbox-' . $i++, MainWP_How_To::getName(), array(MainWP_How_To::getClassName(), 'render'), $page, 'normal', 'core'); $extMetaBoxs = MainWP_System::Instance()->apply_filter('mainwp-getmetaboxes', array()); $extMetaBoxs = apply_filters('mainwp-getmetaboxs', $extMetaBoxs); foreach ($extMetaBoxs as $metaBox) { add_meta_box($page . '-contentbox-' . $i++, $metaBox['metabox_title'], $metaBox['callback'], $page, 'normal', 'core'); } }
public static function initMetaBoxes() { add_filter('postbox_classes_bulkpost_select-sites-div', array('MainWP_Meta_Boxes', 'add_metabox_classes')); add_filter('postbox_classes_bulkpage_select-sites-div', array('MainWP_Meta_Boxes', 'add_metabox_classes')); //Add metaboxes to bulkpost add_meta_box('select-sites-div', __('Select sites', 'mainwp') . '<div class="mainwp_sites_selectcount toggle">0</div>', array(&MainWP_System::Instance()->metaboxes, 'select_sites'), 'bulkpost', 'side', 'default'); add_meta_box('add-categories-div', __('Categories', 'mainwp'), array(&MainWP_System::Instance()->metaboxes, 'add_categories'), 'bulkpost', 'side', 'default'); add_meta_box('add-tags-div', __('Tags', 'mainwp'), array(&MainWP_System::Instance()->metaboxes, 'add_tags'), 'bulkpost', 'side', 'default'); add_meta_box('add-slug-div', __('Slug', 'mainwp'), array(&MainWP_System::Instance()->metaboxes, 'add_slug'), 'bulkpost', 'side', 'default'); //Add metaboxes to bulkpage add_meta_box('select-sites-div', __('Select sites', 'mainwp') . '<div class="mainwp_sites_selectcount toggle">0</div>', array(&MainWP_System::Instance()->metaboxes, 'select_sites'), 'bulkpage', 'side', 'default'); add_meta_box('add-slug-div', __('Slug', 'mainwp'), array(&MainWP_System::Instance()->metaboxes, 'add_slug'), 'bulkpage', 'side', 'default'); }
function getMetaBoxes() { return MainWP_System::Instance()->metaboxes; }
public static function performAllChecks() { $websites = MainWP_DB::Instance()->getOfflineChecks(); foreach ($websites as $website) { if ($website->sync_errors != '') { try { //Add if (function_exists('openssl_pkey_new')) { $conf = array('private_key_bits' => 384); $conf_loc = MainWP_System::get_openssl_conf(); if (!empty($conf_loc)) { $conf['config'] = $conf_loc; } $res = openssl_pkey_new($conf); @openssl_pkey_export($res, $privkey, null, $conf); $pubkey = openssl_pkey_get_details($res); $pubkey = $pubkey['key']; } else { $privkey = '-1'; $pubkey = '-1'; } $information = MainWP_Utility::fetchUrlNotAuthed($website->url, $website->adminname, 'register', array('pubkey' => $pubkey, 'server' => get_admin_url(), 'uniqueId' => $website->uniqueId), false, $website->verify_certificate, $website->http_user, $website->http_pass, $website->ssl_version); if (!isset($information['error']) || $information['error'] == '') { if (isset($information['register']) && $information['register'] == 'OK') { //Update website MainWP_DB::Instance()->updateWebsiteValues($website->id, array('pubkey' => base64_encode($pubkey), 'privkey' => base64_encode($privkey), 'nossl' => $information['nossl'], 'nosslkey' => isset($information['nosslkey']) ? $information['nosslkey'] : '', 'uniqueId' => isset($information['uniqueId']) ? $information['uniqueId'] : '')); $message = 'Site successfully reconnected'; MainWP_Sync::syncInformationArray($website, $information); } } } catch (Exception $e) { } } self::performCheck($website); } }
public function __construct($mainwp_plugin_file) { MainWP_System::$instance = $this; $this->update(); $this->plugin_slug = plugin_basename($mainwp_plugin_file); list($t1, $t2) = explode('/', $this->plugin_slug); $this->slug = str_replace('.php', '', $t2); if (is_admin()) { include_once ABSPATH . 'wp-admin' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'plugin.php'; //Version information from wordpress $pluginData = get_plugin_data($mainwp_plugin_file); $this->current_version = $pluginData['Version']; $currentVersion = get_option('mainwp_plugin_version'); if (version_compare($currentVersion, $this->current_version, '<')) { update_option('mainwp_reset_user_tips', array()); MainWP_Utility::update_option('mainwp_reset_user_cookies', array()); //delete_option('mainwp_api_sslVerifyCertificate'); } MainWP_Utility::update_option('mainwp_plugin_version', $this->current_version); } if (!defined('MAINWP_VERSION')) { define('MAINWP_VERSION', $this->current_version); } if (get_option('mainwp_upgradeVersionInfo') != '' && get_option('mainwp_upgradeVersionInfo') != null) { $this->upgradeVersionInfo = unserialize(get_option('mainwp_upgradeVersionInfo')); } else { $this->upgradeVersionInfo = null; } $this->handleSettingsPost(); $ssl_api_verifyhost = get_option('mainwp_api_sslVerifyCertificate') === false || get_option('mainwp_api_sslVerifyCertificate') == 1 ? 1 : 0; if ($ssl_api_verifyhost == 0) { add_filter('http_request_args', array(MainWP_Extensions::getClassName(), 'noSSLFilterExtensionUpgrade'), 99, 2); } MainWP_Extensions::init(); add_action('in_plugin_update_message-' . $this->plugin_slug, array($this, 'in_plugin_update_message'), 10, 2); add_action('init', array(&$this, 'localization')); // define the alternative API for updating checking add_filter('site_transient_update_plugins', array(&$this, 'check_update_custom')); // Define the alternative response for information checking add_filter('pre_set_site_transient_update_plugins', array(&$this, 'pre_check_update_custom')); add_filter('plugins_api', array(&$this, 'check_info'), 10, 3); $this->metaboxes = new MainWP_Meta_Boxes(); MainWP_Main::get(); //init main dashboard MainWP_Manage_Sites::init(); new MainWP_Hooks(); //Init the hooks //Change menu & widgets add_action('admin_menu', array(&$this, 'new_menus')); //Change footer add_filter('update_footer', array(&$this, 'update_footer'), 15); //Add js add_action('admin_head', array(&$this, 'admin_head')); add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_styles')); add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts')); //Add body class add_action('admin_body_class', array(&$this, 'admin_body_class')); //Handle the bulkpost add_action('publish_bulkpost', array(&$this, 'publish_bulkpost')); add_action('save_post', array(&$this, 'save_bulkpost')); add_action('save_post', array(&$this, 'save_bulkpage')); add_action('add_meta_boxes_bulkpost', array('MainWP_Post', 'addStickyOption')); //Handle the bulkpage add_action('publish_bulkpage', array(&$this, 'publish_bulkpage')); //Add meta boxes for the bulkpost add_action('admin_init', array(&$this, 'admin_init')); //Create the post types for bulkpost/... add_action('init', array(&$this, 'create_post_type')); add_action('init', array(&$this, 'parse_init')); add_action('init', array(&$this, 'init'), 9999); add_action('admin_init', array($this, 'admin_redirects')); //Remove the pages from the menu which I use in AJAX add_action('admin_menu', array(&$this, 'admin_menu')); add_action('admin_menu', array(&$this, 'remove_wp_menus')); //Add custom error messages add_filter('post_updated_messages', array(&$this, 'post_updated_messages')); add_action('login_form', array(&$this, 'login_form')); add_action('admin_print_styles', array(&$this, 'admin_print_styles')); add_filter('admin_footer', array($this, 'admin_footer')); MainWP_Install_Bulk::init(); do_action('mainwp_cronload_action'); //Cron every 5 minutes add_action('mainwp_cronstats_action', array($this, 'mainwp_cronstats_action')); add_action('mainwp_cronbackups_action', array($this, 'mainwp_cronbackups_action')); add_action('mainwp_cronbackups_continue_action', array($this, 'mainwp_cronbackups_continue_action')); add_action('mainwp_cronupdatescheck_action', array($this, 'mainwp_cronupdatescheck_action')); add_action('mainwp_cronpingchilds_action', array($this, 'mainwp_cronpingchilds_action')); add_filter('cron_schedules', array('MainWP_Utility', 'getCronSchedules')); $useWPCron = get_option('mainwp_wp_cron') === false || get_option('mainwp_wp_cron') == 1; //todo: remove in next version if (($sched = wp_next_scheduled('mainwp_cronofflinecheck_action')) != false) { wp_unschedule_event($sched, 'mainwp_cronofflinecheck_action'); } if (($sched = wp_next_scheduled('mainwp_cronstats_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'hourly', 'mainwp_cronstats_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronstats_action'); } } if (($sched = wp_next_scheduled('mainwp_cronbackups_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'hourly', 'mainwp_cronbackups_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronbackups_action'); } } if (($sched = wp_next_scheduled('mainwp_cronbackups_continue_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), '5minutely', 'mainwp_cronbackups_continue_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronbackups_continue_action'); } } if (($sched = wp_next_scheduled('mainwp_cronremotedestinationcheck_action')) != false) { wp_unschedule_event($sched, 'mainwp_cronremotedestinationcheck_action'); } if (($sched = wp_next_scheduled('mainwp_cronpingchilds_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'daily', 'mainwp_cronpingchilds_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronpingchilds_action'); } } if (($sched = wp_next_scheduled('mainwp_cronupdatescheck_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'minutely', 'mainwp_cronupdatescheck_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronupdatescheck_action'); } } add_action('admin_notices', array(&$this, 'admin_notices')); add_filter('mainwp-activated-check', array(&$this, 'activated_check')); add_filter('mainwp-activated-sub-check', array(&$this, 'activated_sub_check')); add_filter('mainwp-extension-enabled-check', array(MainWP_Extensions::getClassName(), 'isExtensionEnabled')); /** * This hook allows you to get a list of sites via the 'mainwp-getsites' filter. * @link http://codex.mainwp.com/#mainwp-getsites * * @see \MainWP_Extensions::hookGetSites */ add_filter('mainwp-getsites', array(MainWP_Extensions::getClassName(), 'hookGetSites'), 10, 4); add_filter('mainwp-getdbsites', array(MainWP_Extensions::getClassName(), 'hookGetDBSites'), 10, 5); /** * This hook allows you to get a information about groups via the 'mainwp-getgroups' filter. * @link http://codex.mainwp.com/#mainwp-getgroups * * @see \MainWP_Extensions::hookGetGroups */ add_filter('mainwp-getgroups', array(MainWP_Extensions::getClassName(), 'hookGetGroups'), 10, 4); add_action('mainwp_fetchurlsauthed', array(&$this, 'filter_fetchUrlsAuthed'), 10, 7); add_filter('mainwp_fetchurlauthed', array(&$this, 'filter_fetchUrlAuthed'), 10, 5); add_filter('mainwp_getdashboardsites', array(MainWP_Extensions::getClassName(), 'hookGetDashboardSites'), 10, 7); add_filter('mainwp-manager-getextensions', array(MainWP_Extensions::getClassName(), 'hookManagerGetExtensions')); add_action('mainwp_bulkpost_metabox_handle', array($this, 'hookBulkPostMetaboxHandle')); add_action('mainwp_bulkpage_metabox_handle', array($this, 'hookBulkPageMetaboxHandle')); $this->posthandler = new MainWP_Post_Handler(); do_action('mainwp-activated'); MainWP_Post::init(); MainWP_Settings::init(); MainWP_Manage_Backups::init(); MainWP_User::init(); MainWP_Page::init(); MainWP_Themes::init(); MainWP_Plugins::init(); MainWP_Right_Now::init(); MainWP_Setup_Wizard::init(); if (defined('WP_CLI') && WP_CLI) { MainWP_WP_CLI_Command::init(); } //WP-Cron if (defined('DOING_CRON') && DOING_CRON) { if (isset($_GET['mainwp_run']) && !empty($_GET['mainwp_run'])) { add_action('init', array($this, 'cron_active'), PHP_INT_MAX); } } }
public static function addSite($website) { $error = ''; $message = ''; if ($website) { $error = __('Your site is already added to MainWP', 'mainwp'); } else { try { //Add if (function_exists('openssl_pkey_new')) { $conf = array('private_key_bits' => 384); $conf_loc = MainWP_System::get_openssl_conf(); if (!empty($conf_loc)) { $conf['config'] = $conf_loc; } $res = openssl_pkey_new($conf); @openssl_pkey_export($res, $privkey, null, $conf); $pubkey = openssl_pkey_get_details($res); $pubkey = $pubkey['key']; } else { $privkey = '-1'; $pubkey = '-1'; } $url = $_POST['managesites_add_wpurl']; $pluginConflicts = get_option('mainwp_pluginConflicts'); if ($pluginConflicts !== false) { $pluginConflicts = array_keys($pluginConflicts); } $themeConflicts = get_option('mainwp_themeConflicts'); if ($themeConflicts !== false) { $themeConflicts = array_keys($themeConflicts); } // to fix bug if (is_array($pluginConflicts)) { $pluginConflicts = array_filter($pluginConflicts); } if (is_array($themeConflicts)) { $themeConflicts = array_filter($themeConflicts); } $verifyCertificate = !isset($_POST['verify_certificate']) || empty($_POST['verify_certificate']) ? null : $_POST['verify_certificate']; $sslVersion = MainWP_Utility::getCURLSSLVersion(!isset($_POST['ssl_version']) || empty($_POST['ssl_version']) ? null : $_POST['ssl_version']); $addUniqueId = isset($_POST['managesites_add_uniqueId']) ? $_POST['managesites_add_uniqueId'] : ''; $http_user = isset($_POST['managesites_add_http_user']) ? $_POST['managesites_add_http_user'] : ''; $http_pass = isset($_POST['managesites_add_http_pass']) ? $_POST['managesites_add_http_pass'] : ''; $information = MainWP_Utility::fetchUrlNotAuthed($url, $_POST['managesites_add_wpadmin'], 'register', array('pubkey' => $pubkey, 'server' => get_admin_url(), 'uniqueId' => $addUniqueId, 'pluginConflicts' => json_encode($pluginConflicts), 'themeConflicts' => json_encode($themeConflicts)), false, $verifyCertificate, $http_user, $http_pass, $sslVersion); if (isset($information['error']) && $information['error'] != '') { $error = $information['error']; } else { if (isset($information['register']) && $information['register'] == 'OK') { //Add website to database $groupids = array(); $groupnames = array(); if (isset($_POST['groupids'])) { foreach ($_POST['groupids'] as $group) { $groupids[] = $group; } } if (isset($_POST['groupnames']) && $_POST['groupnames'] != '' || isset($_POST['groupnames_import']) && $_POST['groupnames_import'] != '') { if ($_POST['groupnames']) { $tmpArr = explode(',', $_POST['groupnames']); } else { if ($_POST['groupnames_import']) { $tmpArr = explode(';', $_POST['groupnames_import']); } } foreach ($tmpArr as $tmp) { $group = MainWP_DB::Instance()->getGroupByNameForUser(trim($tmp)); if ($group) { if (!in_array($group->id, $groupids)) { $groupids[] = $group->id; } } else { $groupnames[] = trim($tmp); } } } if (!isset($information['uniqueId']) || empty($information['uniqueId'])) { $addUniqueId = ''; } $http_user = isset($_POST['managesites_add_http_user']) ? $_POST['managesites_add_http_user'] : ''; $http_pass = isset($_POST['managesites_add_http_pass']) ? $_POST['managesites_add_http_pass'] : ''; global $current_user; $id = MainWP_DB::Instance()->addWebsite($current_user->ID, $_POST['managesites_add_wpname'], $_POST['managesites_add_wpurl'], $_POST['managesites_add_wpadmin'], base64_encode($pubkey), base64_encode($privkey), $information['nossl'], isset($information['nosslkey']) ? $information['nosslkey'] : null, $groupids, $groupnames, $verifyCertificate, $addUniqueId, $http_user, $http_pass, $sslVersion); $message = sprintf(__('Site successfully added - Visit the Site\'s %sDashboard%s now.', 'mainwp'), '<a href="admin.php?page=managesites&dashboard=' . $id . '" style="text-decoration: none;" title="' . __('Dashboard', 'mainwp') . '">', '</a>'); $website = MainWP_DB::Instance()->getWebsiteById($id); MainWP_Sync::syncInformationArray($website, $information); } else { $error = __('Undefined error.', 'mainwp'); } } } catch (MainWP_Exception $e) { if ($e->getMessage() == 'HTTPERROR') { $error = 'HTTP error' . ($e->getMessageExtra() != null ? ' - ' . $e->getMessageExtra() : ''); } else { if ($e->getMessage() == 'NOMAINWP') { $error = __('No MainWP Child plugin detected, first install and activate the plugin and add your site to MainWP afterwards. If you continue experiencing this issue please ', 'mainwp'); if ($e->getMessageExtra() != null) { $error .= sprintf(__('test your connection %shere%s or ', 'mainwp'), '<a href="' . admin_url('admin.php?page=managesites&do=test&site=' . urlencode($e->getMessageExtra())) . '">', '</a>'); } $error .= sprintf(__('post as much information as possible on the error in the %ssupport forum%s.', 'mainwp'), '<a href="https://mainwp.com/forum/">', '</a>'); } else { $error = $e->getMessage(); } } } } return array($message, $error); }
protected static function getSSLWarning() { $conf = array('private_key_bits' => 384); $conf_loc = MainWP_System::get_openssl_conf(); if (!empty($conf_loc)) { $conf['config'] = $conf_loc; } $res = @openssl_pkey_new($conf); @openssl_pkey_export($res, $privkey); $str = openssl_error_string(); return stristr($str, 'NCONF_get_string:no value') ? '' : $str; }
public function updateUserExtension($userExtension) { $userid = $userExtension->userid; if ($userid == null) { if (MainWP_System::Instance()->isSingleUser()) { $userid = '0'; } else { global $current_user; $userid = $current_user->ID; } } $row = $this->wpdb->get_row('SELECT * FROM ' . $this->tableName('users') . ' WHERE userid= ' . $userid, OBJECT); if ($row == null) { $this->createUserExtension($userid); } $fields = array(); foreach ($userExtension as $field => $value) { if ($value != $row->{$field}) { $fields[$field] = $value; } } if (count($fields) > 0) { $this->wpdb->update($this->tableName('users'), $fields, array('userid' => $userid)); } $row = $this->wpdb->get_row('SELECT * FROM ' . $this->tableName('users') . ' WHERE userid= ' . $userid, OBJECT); return $row; }
public static function can_edit_backuptask(&$task) { if ($task == null) { return false; } if (MainWP_System::Instance()->isSingleUser()) { return true; } global $current_user; return $task->userid == $current_user->ID; }
public static function on_load_page_dashboard() { wp_enqueue_script('common'); wp_enqueue_script('wp-lists'); wp_enqueue_script('postbox'); wp_enqueue_script('dashboard'); wp_enqueue_script('widgets'); $i = 1; add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Right_Now::getName(), array(MainWP_Right_Now::getClassName(), 'render'), self::$page, 'normal', 'core'); if (mainwp_current_user_can('dashboard', 'manage_posts')) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Recent_Posts::getName(), array(MainWP_Recent_Posts::getClassName(), 'render'), self::$page, 'normal', 'core'); } if (mainwp_current_user_can('dashboard', 'manage_pages')) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Recent_Pages::getName(), array(MainWP_Recent_Pages::getClassName(), 'render'), self::$page, 'normal', 'core'); } add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Shortcuts::getName(), array(MainWP_Shortcuts::getClassName(), 'render'), self::$page, 'normal', 'core'); if (mainwp_current_user_can('dashboard', 'manage_security_issues')) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Security_Issues::getMetaboxName(), array(MainWP_Security_Issues::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } if (get_option('mainwp_seo') == 1) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Manage_Sites::getMetaboxName(), array(MainWP_Manage_Sites::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } global $mainwpUseExternalPrimaryBackupsMethod; if (empty($mainwpUseExternalPrimaryBackupsMethod)) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Manage_Backups::getMetaboxName(), array(MainWP_Manage_Backups::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Widget_Plugins::getName(), array(MainWP_Widget_Plugins::getClassName(), 'render'), self::$page, 'normal', 'core'); add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Widget_Themes::getName(), array(MainWP_Widget_Themes::getClassName(), 'render'), self::$page, 'normal', 'core'); add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Notes::getName(), array(MainWP_Notes::getClassName(), 'render'), self::$page, 'normal', 'core'); /** * This hook allows you to add extra metaboxes to the dashboard via the 'mainwp-getmetaboxes' filter. * @link http://codex.mainwp.com/#mainwp-getmetaboxes */ $extMetaBoxs = MainWP_System::Instance()->apply_filter('mainwp-getmetaboxes', array()); $extMetaBoxs = apply_filters('mainwp-getmetaboxs', $extMetaBoxs); foreach ($extMetaBoxs as $metaBox) { add_meta_box(self::$page . '-contentbox-' . $i++, $metaBox['metabox_title'], $metaBox['callback'], self::$page, 'normal', 'core'); } }