function add_page_hooks()
 {
     $memory_usage = memory_get_peak_usage() / 1024 / 1024;
     if ($memory_usage > 32) {
         unset($this->default_options['memory_limit']['initial_options']['32M']);
         if ($memory_usage > 64) {
             unset($this->default_options['memory_limit']['initial_options']['64M']);
         }
         if ($memory_usage > 128) {
             unset($this->default_options['memory_limit']['initial_options']['128M']);
         }
         if ($memory_usage > 256) {
             unset($this->default_options['memory_limit']['initial_options']['256M']);
         }
     }
     $this->update_options();
     parent::add_page_hooks();
 }
 function add_page_hooks()
 {
     $post_objs = get_post_types('', 'objects');
     $pt = array_keys($post_objs);
     $rempost = array('revision', 'nav_menu_item');
     $pt = array_diff($pt, $rempost);
     $post_types = array();
     foreach ($pt as $p) {
         if (!empty($post_objs[$p]->label)) {
             $post_types[$p] = $post_objs[$p]->label;
         } else {
             $post_types[$p] = $p;
         }
     }
     $this->default_options["posttypecolumns"]['initial_options'] = $post_types;
     $this->default_options["cpostactive"]['initial_options'] = $post_types;
     $this->default_options["cpostnoindex"]['initial_options'] = $post_types;
     $this->default_options["cpostnofollow"]['initial_options'] = $post_types;
     foreach ($post_types as $p => $pt) {
         $field = $p . "_title_format";
         $name = $post_objs[$p]->labels->singular_name;
         if (!isset($this->default_options[$field])) {
             $this->default_options[$field] = array('name' => "{$name} " . __('Title Format:', 'all_in_one_seo_pack') . "<br />({$p})", 'help_text' => __('The following macros are supported:', 'all_in_one_seo_pack') . '<ul><li>' . __('%blog_title% - Your blog title', 'all_in_one_seo_pack') . '</li><li>' . __('%blog_description% - Your blog description', 'all_in_one_seo_pack') . '</li><li>' . __('%post_title% - The original title of the post', 'all_in_one_seo_pack') . '</li><li>' . __('%category_title% - The (main) category of the post', 'all_in_one_seo_pack') . '</li><li>' . __('%category% - Alias for %category_title%', 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_login% - This post's author' login", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_nicename% - This post's author' nicename", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_firstname% - This post's author' first name (capitalized)", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_lastname% - This post's author' last name (capitalized)", 'all_in_one_seo_pack') . '</li>' . '</ul>', 'type' => 'text', 'default' => '%post_title% | %blog_title%', 'condshow' => array('aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on', 'aiosp_cpostactive\\[\\]' => $p));
             $this->layout['cpt']['options'][] = $field;
         }
     }
     $this->setting_options();
     add_filter("{$this->prefix}display_options", array($this, 'filter_options'), 10, 2);
     parent::add_page_hooks();
 }
Example #3
0
 /** Set up settings, checking for sitemap conflicts, on settings page. **/
 function add_page_hooks()
 {
     $this->flush_rules_hook();
     $this->add_post_types();
     parent::add_page_hooks();
     add_action($this->prefix . 'settings_header', array($this, 'do_sitemap_scan'), 5);
     add_filter("{$this->prefix}submit_options", array($this, 'filter_submit'));
 }
 function add_page_hooks()
 {
     global $aioseop_options;
     $post_objs = get_post_types('', 'objects');
     $pt = array_keys($post_objs);
     $rempost = array('revision', 'nav_menu_item');
     $pt = array_diff($pt, $rempost);
     $post_types = array();
     $aiosp_enablecpost = '';
     if (isset($_REQUEST['aiosp_enablecpost'])) {
         $aiosp_enablecpost = $_REQUEST['aiosp_enablecpost'];
     }
     foreach ($pt as $p) {
         if (!empty($post_objs[$p]->label)) {
             if ($post_objs[$p]->_builtin && empty($aioseop_options['aiosp_enablecpost'])) {
                 $post_types[$p] = $post_objs[$p]->label;
             } elseif (!empty($aioseop_options['aiosp_enablecpost']) || $aiosp_enablecpost == 'on') {
                 $post_types[$p] = $post_objs[$p]->label;
             }
         } else {
             $post_types[$p] = $p;
         }
     }
     foreach ($pt as $p) {
         if (!empty($post_objs[$p]->label)) {
             $all_post_types[$p] = $post_objs[$p]->label;
         }
     }
     $taxes = get_taxonomies('', 'objects');
     $tx = array_keys($taxes);
     $remtax = array('nav_menu', 'link_category', 'post_format');
     $tx = array_diff($tx, $remtax);
     $tax_types = array();
     foreach ($tx as $t) {
         if (!empty($taxes[$t]->label)) {
             $tax_types[$t] = $taxes[$t]->label;
         } else {
             $taxes[$t] = $t;
         }
     }
     $this->default_options['posttypecolumns']['initial_options'] = $post_types;
     $this->default_options['cpostactive']['initial_options'] = $all_post_types;
     $this->default_options['cpostnoindex']['initial_options'] = $post_types;
     $this->default_options['cpostnofollow']['initial_options'] = $post_types;
     $this->default_options['cpostnoodp']['initial_options'] = $post_types;
     $this->default_options['cpostnoydir']['initial_options'] = $post_types;
     if (AIOSEOPPRO) {
         $this->default_options['taxactive']['initial_options'] = $tax_types;
     }
     $this->default_options['google_author_location']['initial_options'] = $post_types;
     $this->default_options['google_author_location']['initial_options'] = array_merge(array('front' => __('Front Page', 'all-in-one-seo-pack')), $post_types, array('all' => __('Everywhere Else', 'all-in-one-seo-pack')));
     $this->default_options['google_author_location']['default'] = array_keys($this->default_options['google_author_location']['initial_options']);
     foreach ($post_types as $p => $pt) {
         $field = $p . '_title_format';
         $name = $post_objs[$p]->labels->singular_name;
         if (!isset($this->default_options[$field])) {
             $this->default_options[$field] = array('name' => "{$name} " . __('Title Format:', 'all-in-one-seo-pack') . "<br />({$p})", 'type' => 'text', 'default' => '%post_title% | %blog_title%', 'condshow' => array('aiosp_rewrite_titles' => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on', 'aiosp_cpostactive\\[\\]' => $p));
             $this->help_text[$field] = __('The following macros are supported:', 'all-in-one-seo-pack') . '<ul><li>' . __('%blog_title% - Your blog title', 'all-in-one-seo-pack') . '</li><li>' . __('%blog_description% - Your blog description', 'all-in-one-seo-pack') . '</li><li>' . __('%post_title% - The original title of the post.', 'all-in-one-seo-pack') . '</li><li>';
             $taxes = get_object_taxonomies($p, 'objects');
             if (!empty($taxes)) {
                 foreach ($taxes as $n => $t) {
                     $this->help_text[$field] .= sprintf(__("%%tax_%s%% - This post's associated %s taxonomy title", 'all-in-one-seo-pack'), $n, $t->label) . '</li><li>';
                 }
             }
             $this->help_text[$field] .= __("%post_author_login% - This post's author' login", 'all-in-one-seo-pack') . '</li><li>' . __("%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack') . '</li><li>' . __("%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack') . '</li><li>' . __("%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack') . '</li>' . '</ul>';
             $this->help_anchors[$field] = '#custom-titles';
             $this->layout['cpt']['options'][] = $field;
         }
     }
     global $wp_roles;
     if (!isset($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $role_names = $wp_roles->get_names();
     ksort($role_names);
     $this->default_options['ga_exclude_users']['initial_options'] = $role_names;
     unset($tax_types['category']);
     unset($tax_types['post_tag']);
     $this->default_options['tax_noindex']['initial_options'] = $tax_types;
     if (empty($tax_types)) {
         unset($this->default_options['tax_noindex']);
     }
     if (AIOSEOPPRO) {
         foreach ($tax_types as $p => $pt) {
             $field = $p . '_tax_title_format';
             $name = $pt;
             if (!isset($this->default_options[$field])) {
                 $this->default_options[$field] = array('name' => "{$name} " . __('Taxonomy Title Format:', 'all-in-one-seo-pack'), 'type' => 'text', 'default' => '%taxonomy_title% | %blog_title%', 'condshow' => array('aiosp_rewrite_titles' => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on', 'aiosp_taxactive\\[\\]' => $p));
                 $this->help_text[$field] = __('The following macros are supported:', 'all-in-one-seo-pack') . '<ul><li>' . __('%blog_title% - Your blog title', 'all-in-one-seo-pack') . '</li><li>' . __('%blog_description% - Your blog description', 'all-in-one-seo-pack') . '</li><li>' . __('%taxonomy_title% - The original title of the taxonomy', 'all-in-one-seo-pack') . '</li><li>' . __('%taxonomy_description% - The description of the taxonomy', 'all-in-one-seo-pack') . '</li></ul>';
                 $this->help_anchors[$field] = '#custom-titles';
                 $this->layout['cpt']['options'][] = $field;
             }
         }
     }
     $this->setting_options();
     $this->add_help_text_links();
     if (AIOSEOPPRO) {
         global $aioseop_update_checker;
         add_action("{$this->prefix}update_options", array($aioseop_update_checker, 'license_change_check'), 10, 2);
         add_action("{$this->prefix}settings_update", array($aioseop_update_checker, 'update_check'), 10, 2);
     }
     add_filter("{$this->prefix}display_options", array($this, 'filter_options'), 10, 2);
     parent::add_page_hooks();
 }
 function add_page_hooks()
 {
     $this->oauth_init();
     $post_objs = get_post_types('', 'objects');
     $pt = array_keys($post_objs);
     $rempost = array('revision', 'nav_menu_item');
     $pt = array_diff($pt, $rempost);
     $post_types = array();
     foreach ($pt as $p) {
         if (!empty($post_objs[$p]->label)) {
             $post_types[$p] = $post_objs[$p]->label;
         } else {
             $post_types[$p] = $p;
         }
     }
     $this->default_options["posttypecolumns"]['initial_options'] = $post_types;
     $this->default_options["cpostactive"]['initial_options'] = $post_types;
     $this->default_options["cpostnoindex"]['initial_options'] = $post_types;
     $this->default_options["cpostnofollow"]['initial_options'] = $post_types;
     $this->default_options["cpostnoodp"]['initial_options'] = $post_types;
     $this->default_options["cpostnoydir"]['initial_options'] = $post_types;
     $this->default_options["google_author_location"]['initial_options'] = $post_types;
     $this->default_options['google_author_location']['initial_options'] = array_merge(array('front' => __('Front Page', 'all_in_one_seo_pack')), $post_types, array('all' => __('Everywhere Else', 'all_in_one_seo_pack')));
     $this->default_options["google_author_location"]['default'] = array_keys($this->default_options["google_author_location"]['initial_options']);
     foreach ($post_types as $p => $pt) {
         $field = $p . "_title_format";
         $name = $post_objs[$p]->labels->singular_name;
         if (!isset($this->default_options[$field])) {
             $this->default_options[$field] = array('name' => "{$name} " . __('Title Format:', 'all_in_one_seo_pack') . "<br />({$p})", 'type' => 'text', 'default' => '%post_title% | %blog_title%', 'condshow' => array('aiosp_rewrite_titles' => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on', 'aiosp_cpostactive\\[\\]' => $p));
             $this->help_text[$field] = __('The following macros are supported:', 'all_in_one_seo_pack') . '<ul><li>' . __('%blog_title% - Your blog title', 'all_in_one_seo_pack') . '</li><li>' . __('%blog_description% - Your blog description', 'all_in_one_seo_pack') . '</li><li>' . __('%post_title% - The original title of the post', 'all_in_one_seo_pack') . '</li><li>' . __('%category_title% - The (main) category of the post', 'all_in_one_seo_pack') . '</li><li>' . __('%category% - Alias for %category_title%', 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_login% - This post's author' login", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_nicename% - This post's author' nicename", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_firstname% - This post's author' first name (capitalized)", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_lastname% - This post's author' last name (capitalized)", 'all_in_one_seo_pack') . '</li>' . '</ul>';
             $this->help_anchors[$field] = '#custom-titles';
             $this->layout['cpt']['options'][] = $field;
         }
     }
     global $wp_roles;
     if (!isset($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $role_names = $wp_roles->get_names();
     ksort($role_names);
     $this->default_options["ga_exclude_users"]['initial_options'] = $role_names;
     $this->setting_options();
     $this->add_help_text_links();
     add_filter("{$this->prefix}display_options", array($this, 'filter_options'), 10, 2);
     parent::add_page_hooks();
 }
 function add_page_hooks()
 {
     parent::add_page_hooks();
     add_action($this->prefix . 'settings_update', array($this, 'do_file_editor'), 10, 2);
 }
Example #7
0
 function add_page_hooks()
 {
     $post_objs = get_post_types('', 'objects');
     $pt = array_keys($post_objs);
     $rempost = array('attachment', 'revision', 'nav_menu_item');
     $pt = array_diff($pt, $rempost);
     $post_types = array();
     foreach ($pt as $p) {
         if (!empty($post_objs[$p]->label)) {
             $post_types[$p] = $post_objs[$p]->label;
         } else {
             $post_types[$p] = $p;
         }
     }
     $this->default_options["posttypecolumns"]['initial_options'] = $post_types;
     $this->default_options["cpostactive"]['initial_options'] = $post_types;
     foreach ($post_types as $p => $pt) {
         $field = $p . "_title_format";
         $name = $post_objs[$p]->labels->singular_name;
         if (!isset($this->default_options[$field])) {
             $this->default_options[$field] = array('name' => "{$name} " . __('Title Format:', 'all_in_one_seo_pack') . "<br />({$p})", 'help_text' => __('The following macros are supported:', 'all_in_one_seo_pack') . '<ul><li>' . __('%blog_title% - Your blog title', 'all_in_one_seo_pack') . '</li><li>' . __('%blog_description% - Your blog description', 'all_in_one_seo_pack') . '</li><li>' . __('%post_title% - The original title of the post', 'all_in_one_seo_pack') . '</li><li>' . __('%category_title% - The (main) category of the post', 'all_in_one_seo_pack') . '</li><li>' . __('%category% - Alias for %category_title%', 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_login% - This post's author' login", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_nicename% - This post's author' nicename", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_firstname% - This post's author' first name (capitalized)", 'all_in_one_seo_pack') . '</li><li>' . __("%post_author_lastname% - This post's author' last name (capitalized)", 'all_in_one_seo_pack') . '</li>' . '</ul>', 'type' => 'text', 'default' => '%post_title% | %blog_title%', 'condshow' => array('aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on'));
             $this->layout['cpt']['options'][] = $field;
         }
     }
     $this->pointers['aioseop_welcome_201'] = array('pointer_target' => '#aiosp_settings_form', 'pointer_text' => '<h3>' . sprintf(__('Welcome to Version %s!', 'all_in_one_seo_pack'), AIOSEOP_VERSION) . '</h3><p>' . __('Thank you for running the latest and greatest All in One SEO Pack ever! New in 2.0: manage your performance with our Performance module; enable it from our new feature manager! And please review your settings, we have added some new ones!', 'all_in_one_seo_pack') . '</p>');
     $this->setting_options();
     add_filter("{$this->prefix}display_options", array($this, 'filter_options'), 10, 3);
     parent::add_page_hooks();
 }