예제 #1
0
 public static function isFieldInUse($parent, $field)
 {
     foreach ($parent->sections as $k => $section) {
         if (!isset($section['title'])) {
             continue;
         }
         if (isset($section['fields']) && !empty($section['fields'])) {
             if (Redux_Helpers::recursive_array_search($field, $section['fields'])) {
                 return true;
                 continue;
             }
         }
     }
 }
예제 #2
0
 public function in_field()
 {
     foreach ($this->parent->sections as $k => $section) {
         if (!isset($section['title'])) {
             continue;
         }
         if (false == $this->is_field && isset($section['fields']) && !empty($section['fields'])) {
             $this->is_field = Redux_Helpers::recursive_array_search('import_export', $section['fields']);
         }
     }
 }
예제 #3
0
 /**
  * Class Options Page Function, creates main options page.
  * @since       1.0.0
  * @access      public
  * @return void
  */
 function _options_page()
 {
     if ($this->args['menu_type'] == 'submenu') {
         $this->page = add_submenu_page($this->args['page_parent'], $this->args['page_title'], $this->args['menu_title'], $this->args['page_permissions'], $this->args['page_slug'], array(&$this, '_options_page_html'));
     } else {
         $this->page = add_menu_page($this->args['page_title'], $this->args['menu_title'], $this->args['page_permissions'], $this->args['page_slug'], array(&$this, '_options_page_html'), $this->args['menu_icon'], $this->args['page_priority']);
         if (true === $this->args['allow_sub_menu']) {
             if (!isset($section['type']) || $section['type'] != 'divide') {
                 foreach ($this->sections as $k => $section) {
                     if (!isset($section['title'])) {
                         continue;
                     }
                     if (false == $this->import_export->is_field) {
                         $this->import_export->is_field = Redux_Helpers::recursive_array_search('import_export', $section['fields']);
                     }
                     if (isset($section['submenu']) && $section['submenu'] == false) {
                         continue;
                     }
                     add_submenu_page($this->args['page_slug'], $section['title'], $section['title'], $this->args['page_permissions'], $this->args['page_slug'] . '&tab=' . $k, '__return_null');
                 }
                 // Remove parent submenu item instead of adding null item.
                 remove_submenu_page($this->args['page_slug'], $this->args['page_slug']);
             }
             if (true === $this->args['show_import_export'] && false == $this->import_export->is_field) {
                 $this->import_export->add_submenu();
             }
             if (true === $this->args['dev_mode']) {
                 $this->debug->add_submenu();
             }
             if (true === $this->args['system_info']) {
                 add_submenu_page($this->args['page_slug'], __('System Info', 'redux-framework'), __('System Info', 'redux-framework'), $this->args['page_permissions'], $this->args['page_slug'] . '&tab=system_info_default', '__return_null');
             }
         }
     }
     add_action("load-{$this->page}", array(&$this, '_load_page'));
 }