Ejemplo n.º 1
0
 function opts_update_prebk(&$opts)
 {
     //Add custom post types
     breadcrumb_navxt::find_posttypes($this->opt);
     //Add custom taxonomy types
     breadcrumb_navxt::find_taxonomies($this->opt);
     //Let others hook into our settings
     $this->opt = apply_filters($this->unique_prefix . '_settings_init', $this->opt);
 }
Ejemplo n.º 2
0
 function opts_update_prebk(&$opts)
 {
     //Add custom post types
     breadcrumb_navxt::find_posttypes($this->opt);
     //Add custom taxonomy types
     breadcrumb_navxt::find_taxonomies($this->opt);
 }
Ejemplo n.º 3
0
 /**
  * Sets up the extended options for any CPTs, taxonomies or extensions
  * 
  * @param array $opt The options array, passed by reference
  */
 public static function setup_options(&$opt)
 {
     //Add custom post types
     breadcrumb_navxt::find_posttypes($opt);
     //Add custom taxonomy types
     breadcrumb_navxt::find_taxonomies($opt);
     //Let others hook into our settings
     $opt = apply_filters('bcn_settings_init', $opt);
 }
Ejemplo n.º 4
0
 /**
  * Upgrades input options array, sets to $this->opt
  * 
  * @param array $opts
  * @param string $version the version of the passed in options
  */
 function opts_upgrade($opts, $version)
 {
     global $wp_post_types;
     //If our version is not the same as in the db, time to update
     if (version_compare($version, $this->version, '<')) {
         //Upgrading to 3.8.1
         if (version_compare($version, '3.8.1', '<')) {
             $opts['post_page_root'] = get_option('page_on_front');
             $opts['post_post_root'] = get_option('page_for_posts');
         }
         //Upgrading to 4.0
         if (version_compare($version, '4.0.0', '<')) {
             //Only migrate if we haven't migrated yet
             if (isset($opts['current_item_linked'])) {
                 //Loop through the old options, migrate some of them
                 foreach ($opts as $option => $value) {
                     //Handle all of our boolean options first, they're real easy, just add a 'b'
                     if (strpos($option, 'display') > 0 || $option == 'current_item_linked') {
                         $this->breadcrumb_trail->opt['b' . $option] = $value;
                     } else {
                         if (strpos($option, 'anchor') > 0) {
                             $parts = explode('_', $option);
                             //Do excess slash removal sanitation
                             $this->breadcrumb_trail->opt['H' . $parts[0] . '_template'] = $value . '%htitle%</a>';
                         } else {
                             if ($option == 'max_title_length' || $option == 'post_post_root' || $option == 'post_page_root') {
                                 $this->breadcrumb_trail->opt['a' . $option] = $value;
                             } else {
                                 if (strpos($option, 'prefix') === false && strpos($option, 'suffix') === false) {
                                     $this->breadcrumb_trail->opt['S' . $option] = $value;
                                 }
                             }
                         }
                     }
                 }
             }
             //Add in the new settings for CPTs introduced in 4.0
             foreach ($wp_post_types as $post_type) {
                 //We only want custom post types
                 if (!$post_type->_builtin) {
                     //Add in the archive_display option
                     $this->breadcrumb_trail->opt['bpost_' . $post_type->name . '_archive_display'] = $post_type->has_archive;
                 }
             }
             $opts = $this->breadcrumb_trail->opt;
         }
         if (version_compare($version, '4.0.1', '<')) {
             if (isset($opts['Hcurrent_item_template_no_anchor'])) {
                 unset($opts['Hcurrent_item_template_no_anchor']);
             }
             if (isset($opts['Hcurrent_item_template'])) {
                 unset($opts['Hcurrent_item_template']);
             }
         }
         //Upgrading to 4.3.0
         if (version_compare($version, '4.3.0', '<')) {
             //Removed home_title
             if (isset($opts['Shome_title'])) {
                 unset($opts['Shome_title']);
             }
             //Removed mainsite_title
             if (isset($opts['Smainsite_title'])) {
                 unset($opts['Smainsite_title']);
             }
         }
         //Upgrading to 5.1.0
         if (version_compare($version, '5.1.0', '<')) {
             global $wp_taxonomies;
             foreach ($wp_taxonomies as $taxonomy) {
                 //If we have the old options style for it, update
                 if ($taxonomy->name !== 'post_format' && isset($opts['H' . $taxonomy->name . '_template'])) {
                     //Migrate to the new setting name
                     $opts['Htax_' . $taxonomy->name . '_template'] = $opts['H' . $taxonomy->name . '_template'];
                     $opts['Htax_' . $taxonomy->name . '_template_no_anchor'] = $opts['H' . $taxonomy->name . '_template_no_anchor'];
                     //Clean up old settings
                     unset($opts['H' . $taxonomy->name . '_template']);
                     unset($opts['H' . $taxonomy->name . '_template_no_anchor']);
                 }
             }
         }
         //Add custom post types
         breadcrumb_navxt::find_posttypes($opts);
         //Add custom taxonomy types
         breadcrumb_navxt::find_taxonomies($opts);
         //Set the max title length to 20 if we are not limiting the title and the length was 0
         if (!$opts['blimit_title'] && $opts['amax_title_length'] == 0) {
             $opts['amax_title_length'] = 20;
         }
     }
     //Save the passed in opts to the object's option array
     $this->opt = $opts;
 }