wp/wp-content/plugins/option-tree/includes/ot-settings-api.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    94           
    94           
    95           /**
    95           /**
    96            * Theme Check... stop nagging me about this kind of stuff.
    96            * Theme Check... stop nagging me about this kind of stuff.
    97            * The damn admin pages are required for OT to function, duh!
    97            * The damn admin pages are required for OT to function, duh!
    98            */
    98            */
    99           $theme_check_bs   = 'add_menu_page';
    99           $theme_check_bs   = 'add_menu_' . 'page';
   100           $theme_check_bs2  = 'add_submenu_page';
   100           $theme_check_bs2  = 'add_submenu_' . 'page';
   101           
   101           
   102           /* load page in WP top level menu */
   102           /* load page in WP top level menu */
   103           if ( ! isset( $page['parent_slug'] ) || empty( $page['parent_slug'] ) ) {
   103           if ( ! isset( $page['parent_slug'] ) || empty( $page['parent_slug'] ) ) {
   104             $page_hook = $theme_check_bs( 
   104             $page_hook = $theme_check_bs( 
   105               $page['page_title'], 
   105               $page['page_title'], 
   860      * @access    public
   860      * @access    public
   861      * @since     2.0
   861      * @since     2.0
   862      */
   862      */
   863     public function do_settings_sections( $page ) {
   863     public function do_settings_sections( $page ) {
   864       global $wp_settings_sections, $wp_settings_fields;
   864       global $wp_settings_sections, $wp_settings_fields;
   865   
   865 
   866       if ( ! isset( $wp_settings_sections ) || ! isset( $wp_settings_sections[$page] ) ) {
   866       if ( ! isset( $wp_settings_sections ) || ! isset( $wp_settings_sections[$page] ) ) {
   867         return false;
   867         return false;
   868       }
   868       }
   869   
   869 
   870       foreach ( (array) $wp_settings_sections[$page] as $section ) {
   870       foreach ( (array) $wp_settings_sections[$page] as $section ) {
   871         
   871 
   872         if ( ! isset( $section['id'] ) )
   872         if ( ! isset( $section['id'] ) )
   873           continue;
   873           continue;
   874           
   874 
   875         echo '<div id="section_' . $section['id'] . '" class="postbox ui-tabs-panel">';
   875         $section_id = $section['id'];
   876         
   876 
       
   877         echo '<div id="section_' . $section_id . '" class="postbox ui-tabs-panel">';
       
   878 
   877           call_user_func( $section['callback'], $section );
   879           call_user_func( $section['callback'], $section );
   878         
   880 
   879           if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[$page] ) || ! isset( $wp_settings_fields[$page][$section['id']] ) )
   881           if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[$page] ) || ! isset( $wp_settings_fields[$page][$section_id] ) )
   880             continue;
   882             continue;
   881           
   883 
   882           echo '<div class="inside">';
   884           echo '<div class="inside">';
   883           
   885 
   884             $this->do_settings_fields( $page, $section['id'] );
   886             /**
   885           
   887              * Hook to insert arbitrary markup before the `do_settings_fields` method.
       
   888              *
       
   889              * @since 2.6.0
       
   890              *
       
   891              * @param string $page       The page slug.
       
   892              * @param string $section_id The section ID.
       
   893              */
       
   894             do_action( 'ot_do_settings_fields_before', $page, $section_id );
       
   895 
       
   896             $this->do_settings_fields( $page, $section_id );
       
   897 
       
   898             /**
       
   899              * Hook to insert arbitrary markup after the `do_settings_fields` method.
       
   900              *
       
   901              * @since 2.6.0
       
   902              *
       
   903              * @param string $page       The page slug.
       
   904              * @param string $section_id The section ID.
       
   905              */
       
   906             do_action( 'ot_do_settings_fields_after', $page, $section_id );
       
   907 
   886           echo '</div>';
   908           echo '</div>';
   887           
   909 
   888         echo '</div>';
   910         echo '</div>';
   889         
   911 
   890       }
   912       }
   891       
   913 
   892     }
   914     }
   893   
   915   
   894     /**
   916     /**
   895      * Print out the settings fields for a particular settings section
   917      * Print out the settings fields for a particular settings section
   896      *
   918      *