Beispiel #1
0
 public function hookMenu()
 {
     $this->upgradeRedirect();
     ABH_Classes_Tools::checkErrorSettings(true);
     /* add the plugin menu in admin */
     if (current_user_can('administrator')) {
         $this->model->addSubmenu(array('options-general.php', __('StarBox Settings', _ABH_PLUGIN_NAME_), __('StarBox', _ABH_PLUGIN_NAME_) . ABH_Classes_Tools::showNotices(ABH_Classes_Tools::$errors_count, 'errors_count'), 'edit_posts', 'abh_settings', array($this, 'showMenu')));
     }
     add_action('edit_user_profile', array(ABH_Classes_ObjController::getBlock('ABH_Core_UserSettings'), 'init'));
     add_action('show_user_profile', array(ABH_Classes_ObjController::getBlock('ABH_Core_UserSettings'), 'init'));
     add_action('personal_options_update', array(ABH_Classes_ObjController::getBlock('ABH_Core_UserSettings'), 'action'));
     add_action('edit_user_profile_update', array(ABH_Classes_ObjController::getBlock('ABH_Core_UserSettings'), 'action'));
 }
Beispiel #2
0
 /**
  * Get all core classes from config.xml in core directory
  *
  * @param string $for
  */
 public function getBlocks($for)
 {
     /* if config allready in cache */
     if (!isset(self::$config)) {
         $config_file = _ABH_CORE_DIR_ . 'config.xml';
         if (!file_exists($config_file)) {
             return;
         }
         /* load configuration blocks data from core config files */
         $data = file_get_contents($config_file);
         self::$config = json_decode(json_encode((array) simplexml_load_string($data)), 1);
     }
     //print_r(self::$config);
     if (is_array(self::$config)) {
         foreach (self::$config['block'] as $block) {
             if (isset($block['active']) && $block['active'] == 1) {
                 if (isset($block['controllers']['controller'])) {
                     if (!is_array($block['controllers']['controller'])) {
                         /* if the block should load for the current controller */
                         if ($for == $block['controllers']['controller']) {
                             ABH_Classes_ObjController::getBlock($block['name'])->init();
                         }
                     } else {
                         foreach ($block['controllers']['controller'] as $controller) {
                             /* if the block should load for the current controller */
                             if ($for == $controller) {
                                 ABH_Classes_ObjController::getBlock($block['name'])->init();
                             }
                         }
                     }
                 }
             }
         }
     }
 }