diff --git a/wp-content/plugins/all-in-one-seo-pack/CONTRIBUTING.md b/wp-content/plugins/all-in-one-seo-pack/CONTRIBUTING.md deleted file mode 100755 index 76c13c9419..0000000000 --- a/wp-content/plugins/all-in-one-seo-pack/CONTRIBUTING.md +++ /dev/null @@ -1,154 +0,0 @@ -# Contributing to All in One SEO Pack - -So you'd like to contribute to an open source project? You're awesome! - -- [Reporting bugs](#reporting-bugs) -- [Feature ideas](#feature-ideas) -- [Contributing code](#contributing-code) -- [Translating](#translating) - - -## Reporting bugs - -1. Support issues (white screen of death, plugin/theme conflict, post meta or titles not showing up, etc.) should go to the [**support forums**](http://semperplugins.com/support/). Make sure you're reporting a true AIOSEOP issue here. First do some [basic debugging](http://semperplugins.com/faqs/how-to-troubleshoot-issues-with-our-plugins/). -2. [**Search** the issues](https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues) first. -3. [Open a new issue](https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/new). - -What makes the issue really helpful: - -- You articulate the problem clearly and provide **steps to reproduce** the problem. -- **Screenshots or GIFs** are appreciated. - - -## Feature ideas - -Ideas are great. All in One SEO Pack needs them. There are so many difficult problems still to solve, and so many opportunities to make the project better. :bulb: :bulb: :bulb: - -[Submit a new feature request](https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/new) and start a discussion. - - -## Contributing code - -Generally: - -1. Open a new issue / pick an existing one -2. Fork the repo, create a branch, commit to it -3. Push the branch, open a pull request -4. The core team will review it and work with you if necessary -5. Someone from the core team will merge the PR -6. :tada: - -Smaller changes like updating README's etc. don't need to use the full workflow, a direct PR or sometimes even a commit into `master` is fine. However, most code changes undergo the suggested workflow which is described in more detail [below](#development-workflow). - -The following discusses some of the important details if you want to contribute. - -### Core values - -- **We care about user / dev experience**. Everything that is outward-facing, be it a user interface, developer API or a file format, must be carefully designed for usability and usefulness. We invest our energy to save it for the others. -- **We care about code quality**. Bad code is a liability, not an asset. We value tests, review each other's code and try to make it good and clean. -- **We try to be pragmatic**. While we care about quality, the main thing for All in One SEO Pack and its users is to move forward. We're always looking for the right balance. - - -### Our development process - -**Major versions** (2.0, 2.1 etc.) are released every few months. Each major version has a [corresponding milestone](https://github.com/semperfiwebdesign/all-in-one-seo-pack/milestones/) and issues are assigned to it by the core team. Issues not assigned to any milestone are in a backlog – we want to do them one day but there's no immediate plans yet. - -**Issues** are the most important tool to plan and manage almost everything around VersionPress: - -- We create them for new features, bugs, improvements or even larger things like planning documents. **We strongly prefer issues over wiki** or other documents as they are actionable and time-framed. -- [This set of **labels**](https://github.com/semperfiwebdesign/all-in-one-seo-pack/wiki/Issues#labels) is used to categorize issues. -- Issues go through **four states**: 'open', 'in progress', 'in review' and 'closed'. There's an [**overv.io board**](https://overv.io/workspace/JanVoracek/cautious-tarsier/) board to visualize that. Also, overv.io helps us set priorities – tickets higher up will be worked on first. - -Regarding **branches**, the current release being worked on is **`development`**. It is hence inherently unsafe, even though we do our best to keep it in a good shape. **`Master`** is typically relatively stable. - - -### Development workflow - -For small / "safe" changes like updating a README or other Markdown files, quick pull request or even commit into `master` is acceptable. However, for most new code, we use the [GitHub flow](https://guides.github.com/introduction/flow/): - -![GitHub Flow](https://guides.github.com/activities/hello-world/branching.png) - -Here are the details: - - -1. When you start working on an issue, **move it to the 'in progress' state** (either visually on the [overv.io board](https://overv.io/workspace/JanVoracek/cautious-tarsier/) or by assigning the `in progress` label to the issue) and **create a new feature branch** for it. Name it `-`, e.g., `123-row-filtering`. - - - **Every feature branch should branch off of master**, not another feature branch, even if it depends on it. For dependent feature branches, simply merge between them. This is mainly because when you're going to open a PR for it, you will need to select the target branch (GitHub doesn't let you to change this later) and `master` is the only sensible choice there. - -2. **Commit to this branch**. We appreciate good commits, here are some tips: - - - **Keep commits small and focused**. There are many articles on version control best practices, e.g., [this one](http://www.git-tower.com/learn/git/ebook/command-line/appendix/best-practices) is good. To sum it up, commit small logical changes, prefer smaller commits over large ones and keep project in a workable state at all times. - - **Write good commit messages**. We don't have strict rules like [this](http://chris.beams.io/posts/git-commit/), e.g., we don't enforce short subject lines. The main thing for us is that the commit messages are *useful*. Do they make it clear what happened in a commit? Do they reference related commits, if applicable? Good. - - We most commonly use past tense ("Added tests") or present tense describing the new situation ("IniSerializer now has tests") but we're not religious about it. - - **Link to an issue from the commit message**. Most of the commit messages look like this: - - ``` - [#123] Implemented xyz - ``` - - It means that the commit belongs to issue `#123`. It makes looking up issues from commits easier. - - -3. When ready, push the branch, **open a pull request** for it and **move the issue to the 'in review' state** (again, either visually in [overv.io](https://overv.io/workspace/JanVoracek/cautious-tarsier/) or by removing the `in progress` label and adding the `in review` one). You can open a PR early to gather feedback, no worries, you can always add commits to it later. The branch can be push-forced if necessary, it is a "sandbox" to make it great. - - This is an example of a good pull request: [versionpress/versionpress#744](https://github.com/versionpress/versionpress/pull/744). The body usually contains something like: - - Resolves #123. - - Some notes on the implementation here if it's not obvious from the code - or the list of commits. - - Reviewers: - - - [ ] @JanVoracek - - [ ] @borekb - - It will be pre-filled for you automatically via GitHub templates, just with a different reviewer (`@versionpress/core-devs` will be there by default, someone from the core team will update it to the actual list of people). - -4. **Core team reviews the PR**. Expect feedback – it is uncommon to receive none – and be open to it. The team will happily work with you to make the code contribution great. - - All checkboxes checked means that the PR is OK to merge. - - > This is an important nuance because the checkbox can have two meanings: "PR is OK to merge" or "I am done with the review (regardless of whether I still see issues with the code or not)". The former is useful for the one who will eventually perform the merge, the latter is more convenient for a reviewer. We use the first meaning which means that I, as a reviewer, will only check the checkbox after I reported some issues with the code **and they have been fixed**. - -5. Someone from the core team **merges the pull request**, issue is closed and the branch can be deleted. - -A couple of notes: - -- As noted above, small / safe changes don't need to undergo this whole process. For example, Markdown files can be **committed directly into `master`** if the changes don't need to be reviewed. -- We used to use **rebasing** in the past – you can still see that in commits before April 2015 – but left it in favor of merging which is much more natural on GitHub. Plus, rebases [have their own issues](http://geekblog.oneandoneis2.org/index.php/2013/04/30/please-stay-away-from-rebase). -- **Issues vs. pull requests**: most of the new improvements and features start as issues as they are quick to create and don't require a Git branch. Then there's usually a single PR against the issue (sometimes more but that's relatively rare). However, issues and pull requests are almost the same thing on GitHub and it's not a problem to start something (possibly simpler) directly as a PR. - - -### Style guides - -All in Code should follow the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) and [WordPress Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/). - -#### PHP style guide - -[WordPress PHP Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/) - -[WordPress PHP Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/) - -There are tools out there for apps like Netbeans and PHPStorm to apply WordPress Coding Standards. - - -#### JavaScript style guide - -[WordPress Javascript Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/) - -[WordPress Javascript Documentation](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/) - - - -## Translating - -We would love your help translating the project into your language. [Translations](https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack) - - -*more instructions coming soon - - ---- - -Other ideas of how to contribute? [Tell us](http://semperplugins.com/contact). diff --git a/wp-content/plugins/all-in-one-seo-pack/admin/aioseop_module_class.php b/wp-content/plugins/all-in-one-seo-pack/admin/aioseop_module_class.php index c10ca5bbdf..9f1cd0f7d9 100644 --- a/wp-content/plugins/all-in-one-seo-pack/admin/aioseop_module_class.php +++ b/wp-content/plugins/all-in-one-seo-pack/admin/aioseop_module_class.php @@ -5,7 +5,7 @@ /** * The module base class; handles settings, options, menus, metaboxes, etc. */ -if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) { +if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) { abstract class All_in_One_SEO_Pack_Module { public static $instance = null; protected $plugin_name; @@ -16,59 +16,65 @@ abstract class All_in_One_SEO_Pack_Module { protected $options; protected $option_name; protected $default_options; - protected $help_text = Array(); - protected $help_anchors = Array(); - protected $locations = null; // organize settings into settings pages with a menu items and/or metaboxes on post types edit screen; optional - protected $layout = null; // organize settings on a settings page into multiple, separate metaboxes; optional - protected $tabs = null; // organize layouts on a settings page into multiple, separate tabs; optional - protected $current_tab = null; // the current tab - protected $pagehook = null; // the current page hook + protected $help_text = array(); + protected $help_anchors = array(); + protected $locations = null; // organize settings into settings pages with a menu items and/or metaboxes on post types edit screen; optional + protected $layout = null; // organize settings on a settings page into multiple, separate metaboxes; optional + protected $tabs = null; // organize layouts on a settings page into multiple, separate tabs; optional + protected $current_tab = null; // the current tab + protected $pagehook = null; // the current page hook protected $store_option = false; protected $parent_option = 'aioseop_options'; - protected $post_metaboxes = Array(); + protected $post_metaboxes = array(); protected $tabbed_metaboxes = true; protected $credentials = false; // used for WP Filesystem - protected $script_data = null; // used for passing data to JavaScript + protected $script_data = null; // used for passing data to JavaScript protected $plugin_path = null; - protected $pointers = Array(); + protected $pointers = array(); protected $form = 'dofollow'; - + /** * Handles calls to display_settings_page_{$location}, does error checking. */ function __call( $name, $arguments ) { - if ( $this->strpos( $name, "display_settings_page_" ) === 0 ) + if ( $this->strpos( $name, 'display_settings_page_' ) === 0 ) { return $this->display_settings_page( $this->substr( $name, 22 ) ); + } $error = __( sprintf( "Method %s doesn't exist", $name ), 'all-in-one-seo-pack' ); - if ( class_exists( 'BadMethodCallException' ) ) + if ( class_exists( 'BadMethodCallException' ) ) { throw new BadMethodCallException( $error ); + } throw new Exception( $error ); } - + function __construct() { - if ( empty( $this->file ) ) $this->file = __FILE__; + if ( empty( $this->file ) ) { + $this->file = __FILE__; + } $this->plugin_name = AIOSEOP_PLUGIN_NAME; - $this->plugin_path = Array(); + $this->plugin_path = array(); // $this->plugin_path['dir'] = plugin_dir_path( $this->file ); - $this->plugin_path['basename'] = plugin_basename( $this->file ); - $this->plugin_path['dirname'] = dirname( $this->plugin_path['basename'] ); - $this->plugin_path['url'] = plugin_dir_url( $this->file ); - $this->plugin_path['images_url'] = $this->plugin_path['url'] . 'images'; + $this->plugin_path['basename'] = plugin_basename( $this->file ); + $this->plugin_path['dirname'] = dirname( $this->plugin_path['basename'] ); + $this->plugin_path['url'] = plugin_dir_url( $this->file ); + $this->plugin_path['images_url'] = $this->plugin_path['url'] . 'images'; $this->script_data['plugin_path'] = $this->plugin_path; } /** * Get options for module, stored individually or together. */ - function get_class_option( ) { + function get_class_option() { $option_name = $this->get_option_name(); if ( $this->store_option || $option_name == $this->parent_option ) { return get_option( $option_name ); } else { $option = get_option( $this->parent_option ); - if ( isset( $option['modules'] ) && isset( $option['modules'][$option_name] ) ) - return $option['modules'][$option_name]; + if ( isset( $option['modules'] ) && isset( $option['modules'][ $option_name ] ) ) { + return $option['modules'][ $option_name ]; + } } + return false; } @@ -76,18 +82,22 @@ function get_class_option( ) { * Update options for module, stored individually or together. */ function update_class_option( $option_data, $option_name = false ) { - if ( $option_name == false ) + if ( $option_name == false ) { $option_name = $this->get_option_name(); + } if ( $this->store_option || $option_name == $this->parent_option ) { return update_option( $option_name, $option_data ); } else { $option = get_option( $this->parent_option ); - if ( !isset( $option['modules'] ) ) $option['modules'] = Array(); - $option['modules'][$option_name] = $option_data; + if ( ! isset( $option['modules'] ) ) { + $option['modules'] = array(); + } + $option['modules'][ $option_name ] = $option_data; + return update_option( $this->parent_option, $option ); } } - + /** * Delete options for module, stored individually or together. */ @@ -97,11 +107,13 @@ function delete_class_option( $delete = false ) { delete_option( $option_name ); } else { $option = get_option( $this->parent_option ); - if ( isset( $option['modules'] ) && isset( $option['modules'][$option_name] ) ) { - unset( $option['modules'][$option_name] ); + if ( isset( $option['modules'] ) && isset( $option['modules'][ $option_name ] ) ) { + unset( $option['modules'][ $option_name ] ); + return update_option( $this->parent_option, $option ); } } + return false; } @@ -109,8 +121,10 @@ function delete_class_option( $delete = false ) { * Get the option name with prefix. */ function get_option_name() { - if ( !isset( $this->option_name ) || empty( $this->option_name ) ) + if ( ! isset( $this->option_name ) || empty( $this->option_name ) ) { $this->option_name = $this->prefix . 'options'; + } + return $this->option_name; } @@ -119,50 +133,60 @@ function get_option_name() { */ function option_isset( $option, $location = null ) { $prefix = $this->get_prefix( $location ); - $opt = $prefix . $option; - return ( ( isset( $this->options[$opt] ) ) && $this->options[$opt] ); + $opt = $prefix . $option; + + return ( isset( $this->options[ $opt ] ) && $this->options[ $opt ] ); } - + /*** Case conversion; handle non UTF-8 encodings and fallback ***/ function convert_case( $str, $mode = 'upper' ) { static $charset = null; - if ( $charset == null ) $charset = get_bloginfo( 'charset' ); - $str = (string)$str; + if ( $charset == null ) { + $charset = get_bloginfo( 'charset' ); + } + $str = (string) $str; if ( $mode == 'title' ) { - if ( function_exists( 'mb_convert_case' ) ) + if ( function_exists( 'mb_convert_case' ) ) { return mb_convert_case( $str, MB_CASE_TITLE, $charset ); - else + } else { return ucwords( $str ); + } } - + if ( $charset == 'UTF-8' ) { global $UTF8_TABLES; include_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_UTF8.php' ); if ( is_array( $UTF8_TABLES ) ) { - if ( $mode == 'upper' ) return strtr( $str, $UTF8_TABLES['strtoupper'] ); - if ( $mode == 'lower' ) return strtr( $str, $UTF8_TABLES['strtolower'] ); + if ( $mode == 'upper' ) { + return strtr( $str, $UTF8_TABLES['strtoupper'] ); + } + if ( $mode == 'lower' ) { + return strtr( $str, $UTF8_TABLES['strtolower'] ); + } } } - + if ( $mode == 'upper' ) { - if ( function_exists( 'mb_strtoupper' ) ) + if ( function_exists( 'mb_strtoupper' ) ) { return mb_strtoupper( $str, $charset ); - else + } else { return strtoupper( $str ); + } } if ( $mode == 'lower' ) { - if ( function_exists( 'mb_strtolower' ) ) + if ( function_exists( 'mb_strtolower' ) ) { return mb_strtolower( $str, $charset ); - else + } else { return strtolower( $str ); + } } - + return $str; } - /** + /** * Convert a string to lower case * Compatible with mb_strtolower(), an UTF-8 friendly replacement for strtolower() */ @@ -170,7 +194,7 @@ function strtolower( $str ) { return $this->convert_case( $str, 'lower' ); } - /** + /** * Convert a string to upper case * Compatible with mb_strtoupper(), an UTF-8 friendly replacement for strtoupper() */ @@ -178,20 +202,22 @@ function strtoupper( $str ) { return $this->convert_case( $str, 'upper' ); } - /** + /** * Convert a string to title case * Compatible with mb_convert_case(), an UTF-8 friendly replacement for ucwords() */ function ucwords( $str ) { return $this->convert_case( $str, 'title' ); } - + /** * Wrapper for strlen() - uses mb_strlen() if possible. - */ + */ function strlen( $string ) { - if ( function_exists( 'mb_strlen' ) ) + if ( function_exists( 'mb_strlen' ) ) { return mb_strlen( $string ); + } + return strlen( $string ); } @@ -200,118 +226,146 @@ function strlen( $string ) { */ function substr( $string, $start = 0, $length = 2147483647 ) { $args = func_get_args(); - if ( function_exists( 'mb_substr' ) ) + if ( function_exists( 'mb_substr' ) ) { return call_user_func_array( 'mb_substr', $args ); + } + return call_user_func_array( 'substr', $args ); } - + /** * Wrapper for strpos() - uses mb_strpos() if possible. */ function strpos( $haystack, $needle, $offset = 0 ) { - if ( function_exists( 'mb_strpos' ) ) + if ( function_exists( 'mb_strpos' ) ) { return mb_strpos( $haystack, $needle, $offset ); + } + return strpos( $haystack, $needle, $offset ); } - + /** * Wrapper for strrpos() - uses mb_strrpos() if possible. */ function strrpos( $haystack, $needle, $offset = 0 ) { - if ( function_exists( 'mb_strrpos' ) ) + if ( function_exists( 'mb_strrpos' ) ) { return mb_strrpos( $haystack, $needle, $offset ); + } + return strrpos( $haystack, $needle, $offset ); } /** - * convert xml string to php array - useful to get a serializable value - * - * @param string $xmlstr - * @return array - * - * @author Adrien aka Gaarf & contributors - * @see http://gaarf.info/2009/08/13/xml-string-to-php-array/ - */ + * convert xml string to php array - useful to get a serializable value + * + * @param string $xmlstr + * + * @return array + * + * @author Adrien aka Gaarf & contributors + * @see http://gaarf.info/2009/08/13/xml-string-to-php-array/ + */ function html_string_to_array( $xmlstr ) { - if ( !class_exists( 'DOMDocument' ) ) { - return Array(); - } else { - $doc = new DOMDocument(); - $doc->loadHTML( $xmlstr ); - return $this->domnode_to_array( $doc->documentElement ); - } + if ( ! class_exists( 'DOMDocument' ) ) { + return array(); + } else { + $doc = new DOMDocument(); + $doc->loadHTML( $xmlstr ); + + return $this->domnode_to_array( $doc->documentElement ); + } } function xml_string_to_array( $xmlstr ) { - if ( !class_exists( 'DOMDocument' ) ) { - return Array(); - } else { - $doc = new DOMDocument(); - $doc->loadXML( $xmlstr ); - return $this->domnode_to_array( $doc->documentElement ); - } + if ( ! class_exists( 'DOMDocument' ) ) { + return array(); + } else { + $doc = new DOMDocument(); + $doc->loadXML( $xmlstr ); + + return $this->domnode_to_array( $doc->documentElement ); + } } function domnode_to_array( $node ) { - switch ( $node->nodeType ) { - case XML_CDATA_SECTION_NODE: - case XML_TEXT_NODE: - return trim( $node->textContent ); - break; - case XML_ELEMENT_NODE: - $output = array(); - for ($i=0, $m=$node->childNodes->length; $i<$m; $i++) { - $child = $node->childNodes->item($i); - $v = $this->domnode_to_array($child); - if(isset($child->tagName)) { - $t = $child->tagName; - if(!isset($output[$t])) - $output[$t] = array(); - if ( is_array($output) ) - $output[$t][] = $v; - } - elseif($v || $v === '0') - $output = (string) $v; - } - if($node->attributes->length && !is_array($output)) //Has attributes but isn't an array - $output = array('@content'=>$output); //Change output into an array. - if(is_array($output)) { - if($node->attributes->length) { - $a = array(); - foreach($node->attributes as $attrName => $attrNode) - $a[$attrName] = (string) $attrNode->value; - $output['@attributes'] = $a; - } - foreach ($output as $t => $v) - if(is_array($v) && count($v)==1 && $t!='@attributes') - $output[$t] = $v[0]; - } - } - if ( empty( $output ) ) return ''; - return $output; - } - + switch ( $node->nodeType ) { + case XML_CDATA_SECTION_NODE: + case XML_TEXT_NODE: + return trim( $node->textContent ); + break; + case XML_ELEMENT_NODE: + $output = array(); + for ( $i = 0, $m = $node->childNodes->length; $i < $m; $i ++ ) { + $child = $node->childNodes->item( $i ); + $v = $this->domnode_to_array( $child ); + if ( isset( $child->tagName ) ) { + $t = $child->tagName; + if ( ! isset( $output[ $t ] ) ) { + $output[ $t ] = array(); + } + if ( is_array( $output ) ) { + $output[ $t ][] = $v; + } + } elseif ( $v || $v === '0' ) { + $output = (string) $v; + } + } + if ( $node->attributes->length && ! is_array( $output ) ) //Has attributes but isn't an array + { + $output = array( '@content' => $output ); + } //Change output into an array. + if ( is_array( $output ) ) { + if ( $node->attributes->length ) { + $a = array(); + foreach ( $node->attributes as $attrName => $attrNode ) { + $a[ $attrName ] = (string) $attrNode->value; + } + $output['@attributes'] = $a; + } + foreach ( $output as $t => $v ) { + if ( is_array( $v ) && count( $v ) == 1 && $t != '@attributes' ) { + $output[ $t ] = $v[0]; + } + } + } + } + if ( empty( $output ) ) { + return ''; + } + + return $output; + } + /*** adds support for using %cf_(name of field)% for using custom fields / Advanced Custom Fields in titles / descriptions etc. ***/ function apply_cf_fields( $format ) { - return preg_replace_callback( '/%cf_([^%]*?)%/', Array( $this, 'cf_field_replace' ), $format ); + return preg_replace_callback( '/%cf_([^%]*?)%/', array( $this, 'cf_field_replace' ), $format ); } function cf_field_replace( $matches ) { $result = ''; - if ( !empty( $matches ) ) { - if ( !empty( $matches[1] ) ) { - if ( function_exists( 'get_field' ) ) $result = get_field( $matches[1] ); + if ( ! empty( $matches ) ) { + if ( ! empty( $matches[1] ) ) { + if ( function_exists( 'get_field' ) ) { + $result = get_field( $matches[1] ); + } if ( empty( $result ) ) { global $post; - if ( !empty( $post ) ) $result = get_post_meta( $post->ID, $matches[1], true ); + if ( ! empty( $post ) ) { + $result = get_post_meta( $post->ID, $matches[1], true ); + } + } + if ( empty( $result ) ) { + $result = $matches[0]; } - if ( empty( $result ) ) $result = $matches[0]; - } else $result = $matches[0]; + } else { + $result = $matches[0]; + } } $result = strip_tags( $result ); + return $result; } - + /** * Returns child blogs of parent in a multisite. */ @@ -319,198 +373,215 @@ function get_child_blogs() { global $wpdb, $blog_id; $site_id = $wpdb->siteid; if ( is_multisite() ) { - if ( $site_id != $blog_id ) return false; + if ( $site_id != $blog_id ) { + return false; + } + return $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = {$blog_id} AND site_id != blog_id" ); } + return false; } - + /** * Checks if the plugin is active on a given blog by blogid on a multisite. */ function is_aioseop_active_on_blog( $bid = false ) { global $blog_id; - if ( empty( $bid ) || ( $bid == $blog_id ) || !is_multisite() ) return true; - if ( ! function_exists( 'is_plugin_active_for_network' ) ) - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); - if ( is_plugin_active_for_network( AIOSEOP_PLUGIN_BASENAME ) ) return true; + if ( empty( $bid ) || ( $bid == $blog_id ) || ! is_multisite() ) { + return true; + } + if ( ! function_exists( 'is_plugin_active_for_network' ) ) { + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); + } + if ( is_plugin_active_for_network( AIOSEOP_PLUGIN_BASENAME ) ) { + return true; + } + return in_array( AIOSEOP_PLUGIN_BASENAME, (array) get_blog_option( $bid, 'active_plugins', array() ) ); } - + function quote_list_for_regex( $list, $quote = '/' ) { $regex = ''; - $cont = 0; - foreach( $list as $l ) { - if ( $cont ) { - $regex .= '|'; - } - $cont = 1; - $regex .= preg_quote( trim( $l ), $quote ); + $cont = 0; + foreach ( $list as $l ) { + if ( $cont ) { + $regex .= '|'; + } + $cont = 1; + $regex .= preg_quote( trim( $l ), $quote ); } + return $regex; } - + // original code thanks to Sean M. Brown -- http://smbrown.wordpress.com/2009/04/29/verify-googlebot-forward-reverse-dns/ function is_good_bot() { - $botlist = Array( - "Yahoo! Slurp" => "crawl.yahoo.net", - "googlebot" => ".googlebot.com", - "msnbot" => "search.msn.com" + $botlist = array( + 'Yahoo! Slurp' => 'crawl.yahoo.net', + 'googlebot' => '.googlebot.com', + 'msnbot' => 'search.msn.com' ); - $botlist = apply_filters( $this->prefix . "botlist", $botlist ); - if ( !empty( $botlist ) ) { - $ua = $_SERVER['HTTP_USER_AGENT']; + $botlist = apply_filters( $this->prefix . 'botlist', $botlist ); + if ( ! empty( $botlist ) ) { + if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) { + return false; + } + $ua = $_SERVER['HTTP_USER_AGENT']; $uas = $this->quote_list_for_regex( $botlist ); - if ( preg_match( '/' . $uas . '/i', $ua ) ) { - $ip = $_SERVER['REMOTE_ADDR']; - $hostname = gethostbyaddr( $ip ); + if ( preg_match( '/' . $uas . '/i', $ua ) ) { + $ip = $_SERVER['REMOTE_ADDR']; + $hostname = gethostbyaddr( $ip ); $ip_by_hostname = gethostbyname( $hostname ); - if ( $ip_by_hostname == $ip ) { + if ( $ip_by_hostname == $ip ) { $hosts = array_values( $botlist ); - foreach( $hosts as $k => $h ) - $hosts[$k] = preg_quote( $h ) . '$'; + foreach ( $hosts as $k => $h ) { + $hosts[ $k ] = preg_quote( $h ) . '$'; + } $hosts = join( '|', $hosts ); - if ( preg_match( '/' . $hosts . '/i', $hostname ) ) + if ( preg_match( '/' . $hosts . '/i', $hostname ) ) { return true; + } } } + return false; } } - + function default_bad_bots() { - $botlist = Array( - "Abonti", - "aggregator", - "AhrefsBot", - "asterias", - "BDCbot", - "BLEXBot", - "BuiltBotTough", - "Bullseye", - "BunnySlippers", - "ca-crawler", - "CCBot", - "Cegbfeieh", - "CheeseBot", - "CherryPicker", - "CopyRightCheck", - "cosmos", - "Crescent", - "discobot", - "DittoSpyder", - "DotBot", - "Download Ninja", - "EasouSpider", - "EmailCollector", - "EmailSiphon", - "EmailWolf", - "EroCrawler", - "Exabot", - "ExtractorPro", - "Fasterfox", - "FeedBooster", - "Foobot", - "Genieo", - "grub-client", - "Harvest", - "hloader", - "httplib", - "HTTrack", - "humanlinks", - "ieautodiscovery", - "InfoNaviRobot", - "IstellaBot", - "Java/1.", - "JennyBot", - "k2spider", - "Kenjin Spider", - "Keyword Density/0.9", - "larbin", - "LexiBot", - "libWeb", - "libwww", - "LinkextractorPro", - "linko", - "LinkScan/8.1a Unix", - "LinkWalker", - "LNSpiderguy", - "lwp-trivial", - "magpie", - "Mata Hari", + $botlist = array( + 'Abonti', + 'aggregator', + 'AhrefsBot', + 'asterias', + 'BDCbot', + 'BLEXBot', + 'BuiltBotTough', + 'Bullseye', + 'BunnySlippers', + 'ca-crawler', + 'CCBot', + 'Cegbfeieh', + 'CheeseBot', + 'CherryPicker', + 'CopyRightCheck', + 'cosmos', + 'Crescent', + 'discobot', + 'DittoSpyder', + 'DotBot', + 'Download Ninja', + 'EasouSpider', + 'EmailCollector', + 'EmailSiphon', + 'EmailWolf', + 'EroCrawler', + 'Exabot', + 'ExtractorPro', + 'Fasterfox', + 'FeedBooster', + 'Foobot', + 'Genieo', + 'grub-client', + 'Harvest', + 'hloader', + 'httplib', + 'HTTrack', + 'humanlinks', + 'ieautodiscovery', + 'InfoNaviRobot', + 'IstellaBot', + 'Java/1.', + 'JennyBot', + 'k2spider', + 'Kenjin Spider', + 'Keyword Density/0.9', + 'larbin', + 'LexiBot', + 'libWeb', + 'libwww', + 'LinkextractorPro', + 'linko', + 'LinkScan/8.1a Unix', + 'LinkWalker', + 'LNSpiderguy', + 'lwp-trivial', + 'magpie', + 'Mata Hari', 'MaxPointCrawler', 'MegaIndex', - "Microsoft URL Control", - "MIIxpc", - "Mippin", - "Missigua Locator", - "Mister PiX", - "MJ12bot", - "moget", - "MSIECrawler", - "NetAnts", - "NICErsPRO", - "Niki-Bot", - "NPBot", - "Nutch", - "Offline Explorer", - "Openfind", + 'Microsoft URL Control', + 'MIIxpc', + 'Mippin', + 'Missigua Locator', + 'Mister PiX', + 'MJ12bot', + 'moget', + 'MSIECrawler', + 'NetAnts', + 'NICErsPRO', + 'Niki-Bot', + 'NPBot', + 'Nutch', + 'Offline Explorer', + 'Openfind', 'panscient.com', - "PHP/5.{", - "ProPowerBot/2.14", - "ProWebWalker", - "Python-urllib", - "QueryN Metasearch", - "RepoMonkey", - "RMA", + 'PHP/5.{', + 'ProPowerBot/2.14', + 'ProWebWalker', + 'Python-urllib', + 'QueryN Metasearch', + 'RepoMonkey', + 'RMA', 'SemrushBot', - "SeznamBot", - "SISTRIX", - "sitecheck.Internetseer.com", - "SiteSnagger", - "SnapPreviewBot", - "Sogou", - "SpankBot", - "spanner", - "spbot", - "Spinn3r", - "suzuran", - "Szukacz/1.4", - "Teleport", - "Telesoft", - "The Intraformant", - "TheNomad", - "TightTwatBot", - "Titan", - "toCrawl/UrlDispatcher", - "True_Robot", - "turingos", - "TurnitinBot", - "UbiCrawler", - "UnisterBot", - "URLy Warning", - "VCI", - "WBSearchBot", - "Web Downloader/6.9", - "Web Image Collector", - "WebAuto", - "WebBandit", - "WebCopier", - "WebEnhancer", - "WebmasterWorldForumBot", - "WebReaper", - "WebSauger", - "Website Quester", - "Webster Pro", - "WebStripper", - "WebZip", - "Wotbox", - "wsr-agent", - "WWW-Collector-E", - "Xenu", - "Zao", - "Zeus", - "ZyBORG", + 'SeznamBot', + 'SISTRIX', + 'sitecheck.Internetseer.com', + 'SiteSnagger', + 'SnapPreviewBot', + 'Sogou', + 'SpankBot', + 'spanner', + 'spbot', + 'Spinn3r', + 'suzuran', + 'Szukacz/1.4', + 'Teleport', + 'Telesoft', + 'The Intraformant', + 'TheNomad', + 'TightTwatBot', + 'Titan', + 'toCrawl/UrlDispatcher', + 'True_Robot', + 'turingos', + 'TurnitinBot', + 'UbiCrawler', + 'UnisterBot', + 'URLy Warning', + 'VCI', + 'WBSearchBot', + 'Web Downloader/6.9', + 'Web Image Collector', + 'WebAuto', + 'WebBandit', + 'WebCopier', + 'WebEnhancer', + 'WebmasterWorldForumBot', + 'WebReaper', + 'WebSauger', + 'Website Quester', + 'Webster Pro', + 'WebStripper', + 'WebZip', + 'Wotbox', + 'wsr-agent', + 'WWW-Collector-E', + 'Xenu', + 'Zao', + 'Zeus', + 'ZyBORG', 'coccoc', 'Incutio', 'lmspider', @@ -520,24 +591,29 @@ function default_bad_bots() { 'Unknown', 'uptime files' ); + return $botlist; } - + function is_bad_bot() { $botlist = $this->default_bad_bots(); - $botlist = apply_filters( $this->prefix . "badbotlist", $botlist ); - if ( !empty( $botlist ) ) { - $ua = $_SERVER['HTTP_USER_AGENT']; + $botlist = apply_filters( $this->prefix . 'badbotlist', $botlist ); + if ( ! empty( $botlist ) ) { + if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) { + return false; + } + $ua = $_SERVER['HTTP_USER_AGENT']; $uas = $this->quote_list_for_regex( $botlist ); - if ( preg_match( '/' . $uas . '/i', $ua ) ) { + if ( preg_match( '/' . $uas . '/i', $ua ) ) { return true; } } + return false; } - + function default_bad_referers() { - $referlist = Array( + $referlist = array( 'semalt.com', 'kambasoft.com', 'savetubevideo.com', @@ -564,247 +640,304 @@ function default_bad_referers() { 'site3.free-share-buttons.com', 'webmaster-traffic.com' ); + return $referlist; } function is_bad_referer() { $referlist = $this->default_bad_referers(); - $referlist = apply_filters( $this->prefix . "badreferlist", $referlist ); + $referlist = apply_filters( $this->prefix . 'badreferlist', $referlist ); - if ( !empty( $referlist ) && !empty( $_SERVER ) && !empty( $_SERVER['HTTP_REFERER'] ) ) { - $ref = $_SERVER['HTTP_REFERER']; + if ( ! empty( $referlist ) && ! empty( $_SERVER ) && ! empty( $_SERVER['HTTP_REFERER'] ) ) { + $ref = $_SERVER['HTTP_REFERER']; $regex = $this->quote_list_for_regex( $referlist ); - if ( preg_match( '/' . $regex . '/i', $ref ) ) { + if ( preg_match( '/' . $regex . '/i', $ref ) ) { return true; } } + return false; } - + function allow_bot() { $allow_bot = true; - if ( ( !$this->is_good_bot() ) && ( $this->is_bad_bot() ) && !is_user_logged_in() ) + if ( ( ! $this->is_good_bot() ) && $this->is_bad_bot() && ! is_user_logged_in() ) { $allow_bot = false; - return apply_filters( $this->prefix . "allow_bot", $allow_bot ); + } + + return apply_filters( $this->prefix . 'allow_bot', $allow_bot ); } /** * Displays tabs for tabbed locations on a settings page. */ function display_tabs( $location ) { - if ( ( $location != null ) && isset( $locations[$location]['tabs'] ) ) + if ( ( $location != null ) && isset( $locations[ $location ]['tabs'] ) ) { $tabs = $locations['location']['tabs']; - else + } else { $tabs = $this->tabs; - if ( !empty( $tabs ) ) { - ?>
\n
\n"; - const DISPLAY_ROW_TEMPLATE = '
%s
%s
%s

'; - + + const DISPLAY_HELP_START = ''; + const DISPLAY_HELP_END = ''; + const DISPLAY_LABEL_FORMAT = '%s'; + const DISPLAY_TOP_LABEL = "
\n
\n"; + const DISPLAY_ROW_TEMPLATE = '
%s
%s
%s

'; + /** * Format a row for an option on a settings page. */ function get_option_row( $name, $opts, $args ) { $label_text = $input_attr = $help_text_2 = $id_attr = ''; - if ( $opts['label'] == 'top' ) - $align = 'left'; - else + if ( $opts['label'] == 'top' ) { + $align = 'left'; + } else { $align = 'right'; - if ( isset( $opts['id'] ) ) $id_attr .= " id=\"{$opts['id']}_div\" "; - if ( $opts['label'] != 'none' ) { + } + if ( isset( $opts['id'] ) ) { + $id_attr .= " id=\"{$opts['id']}_div\" "; + } + if ( $opts['label'] != 'none' ) { if ( isset( $opts['help_text'] ) ) { - $help_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_START, __( 'Click for Help!', 'all-in-one-seo-pack' ), $name, $opts['name'] ); - $help_text_2 = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_END, $name, $opts['help_text'] ); - } else $help_text = $opts['name']; + $help_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_START, __( 'Click for Help!', 'all-in-one-seo-pack' ), $name, $opts['name'] ); + $help_text_2 = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_END, $name, $opts['help_text'] ); + } else { + $help_text = $opts['name']; + } $label_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_LABEL_FORMAT, $align, $help_text ); - } else $input_attr .= ' aioseop_no_label '; - if ( $opts['label'] == 'top' ) $label_text .= All_in_One_SEO_Pack_Module::DISPLAY_TOP_LABEL; + } else { + $input_attr .= ' aioseop_no_label '; + } + if ( $opts['label'] == 'top' ) { + $label_text .= All_in_One_SEO_Pack_Module::DISPLAY_TOP_LABEL; + } $input_attr .= " aioseop_{$opts['type']}_type"; + return sprintf( All_in_One_SEO_Pack_Module::DISPLAY_ROW_TEMPLATE, $input_attr, $name, $label_text, $id_attr, $this->get_option_html( $args ), $help_text_2 ); } - + /** * Display options for settings pages and metaboxes, allows for filtering settings, custom display options. */ function display_options( $location = null, $meta_args = null ) { - static $location_settings = Array(); - $defaults = null; - $prefix = $this->get_prefix( $location ); - $help_link = ''; - if ( is_array( $meta_args['args'] ) && !empty( $meta_args['args']['default_options'] ) ) { - $defaults = $meta_args['args']['default_options']; - } - if ( !empty( $meta_args['callback_args'] ) ) { - if ( !empty( $meta_args['callback_args']['help_link'] ) ) { - $help_link = $meta_args['callback_args']['help_link']; - } - } - if ( !empty( $help_link ) ) - echo "" . __( 'Help', 'all-in-one-seo-pack' ) . ""; - - if ( !isset( $location_settings[$prefix] ) ) { - $current_options = apply_filters( "{$this->prefix}display_options", $this->get_current_options( Array(), $location, $defaults ), $location ); - $settings = apply_filters( "{$this->prefix}display_settings", $this->setting_options( $location, $defaults ), $location, $current_options ); - $current_options = apply_filters( "{$this->prefix}override_options", $current_options, $location, $settings ); - $location_settings[$prefix]['current_options'] = $current_options; - $location_settings[$prefix]['settings'] = $settings; - } else { - $current_options = $location_settings[$prefix]['current_options']; - $settings = $location_settings[$prefix]['settings']; - } - // $opts["snippet"]["default"] = sprintf( $opts["snippet"]["default"], "foo", "bar", "moby" ); - $container = "
"; - if ( is_array( $meta_args['args'] ) && !empty( $meta_args['args']['options'] ) ) { - $args = Array(); - $arg_keys = Array(); - foreach ( $meta_args['args']['options'] as $a ) { - if ( !empty($location) ) { - $key = $prefix . $location . '_' . $a; - if ( !isset( $settings[$key] ) ) $key = $a; - } else $key = $prefix . $a; - if ( isset( $settings[$key] ) ) $arg_keys[$key] = 1; - elseif ( isset( $settings[$a] ) ) $arg_keys[$a] = 1; - } - $setting_keys = array_keys( $settings ); - foreach ( $setting_keys as $s ) - if ( !empty( $arg_keys[$s] ) ) $args[$s] = $settings[$s]; - } else $args = $settings; - foreach ( $args as $name => $opts ) { - $attr_list = Array( 'class', 'style', 'readonly', 'disabled', 'size', 'placeholder' ); - if ( $opts['type'] == 'textarea' ) $attr_list = array_merge( $attr_list, Array('rows', 'cols') ); - $attr = ''; - foreach ( $attr_list as $a ) - if ( isset( $opts[$a] ) ) $attr .= ' ' . $a . '="' . esc_attr( $opts[$a] ) . '" '; - $opt = ''; - if ( isset( $current_options[$name] ) ) $opt = $current_options[$name]; - if ( $opts['label'] == 'none' && $opts['type'] == 'submit' && $opts['save'] == false ) $opt = $opts['name']; - if ( $opts['type'] == 'html' && empty( $opt ) && $opts['save'] == false ) $opt = $opts['default']; - - $args = Array( 'name' => $name, 'options' => $opts, 'attr' => $attr, 'value' => $opt, 'prefix' => $prefix ); - if ( !empty( $opts['nowrap'] ) ) - echo $this->get_option_html( $args ); - else { - if ( $container ) { - echo $container; - $container = ''; + static $location_settings = array(); + $defaults = null; + $prefix = $this->get_prefix( $location ); + $help_link = ''; + if ( is_array( $meta_args['args'] ) && ! empty( $meta_args['args']['default_options'] ) ) { + $defaults = $meta_args['args']['default_options']; + } + if ( ! empty( $meta_args['callback_args'] ) && ! empty( $meta_args['callback_args']['help_link'] ) ) { + $help_link = $meta_args['callback_args']['help_link']; + } + if ( ! empty( $help_link ) ) { + echo "" . __( 'Help', 'all-in-one-seo-pack' ) . ''; + } + + if ( ! isset( $location_settings[ $prefix ] ) ) { + $current_options = apply_filters( "{$this->prefix}display_options", $this->get_current_options( array(), $location, $defaults ), $location ); + $settings = apply_filters( "{$this->prefix}display_settings", $this->setting_options( $location, $defaults ), $location, $current_options ); + $current_options = apply_filters( "{$this->prefix}override_options", $current_options, $location, $settings ); + $location_settings[ $prefix ]['current_options'] = $current_options; + $location_settings[ $prefix ]['settings'] = $settings; + } else { + $current_options = $location_settings[ $prefix ]['current_options']; + $settings = $location_settings[ $prefix ]['settings']; + } + // $opts["snippet"]["default"] = sprintf( $opts["snippet"]["default"], "foo", "bar", "moby" ); + $container = "
"; + if ( is_array( $meta_args['args'] ) && ! empty( $meta_args['args']['options'] ) ) { + $args = array(); + $arg_keys = array(); + foreach ( $meta_args['args']['options'] as $a ) { + if ( ! empty( $location ) ) { + $key = $prefix . $location . '_' . $a; + if ( ! isset( $settings[ $key ] ) ) { + $key = $a; } - echo $this->get_option_row( $name, $opts, $args ); + } else { + $key = $prefix . $a; + } + if ( isset( $settings[ $key ] ) ) { + $arg_keys[ $key ] = 1; + } elseif ( isset( $settings[ $a ] ) ) { + $arg_keys[ $a ] = 1; + } + } + $setting_keys = array_keys( $settings ); + foreach ( $setting_keys as $s ) { + if ( ! empty( $arg_keys[ $s ] ) ) { + $args[ $s ] = $settings[ $s ]; + } + } + } else { + $args = $settings; + } + foreach ( $args as $name => $opts ) { + $attr_list = array( 'class', 'style', 'readonly', 'disabled', 'size', 'placeholder' ); + if ( $opts['type'] == 'textarea' ) { + $attr_list = array_merge( $attr_list, array( 'rows', 'cols' ) ); + } + $attr = ''; + foreach ( $attr_list as $a ) { + if ( isset( $opts[ $a ] ) ) { + $attr .= ' ' . $a . '="' . esc_attr( $opts[ $a ] ) . '" '; } } - if ( !$container ) echo "
"; + $opt = ''; + if ( isset( $current_options[ $name ] ) ) { + $opt = $current_options[ $name ]; + } + if ( $opts['label'] == 'none' && $opts['type'] == 'submit' && $opts['save'] == false ) { + $opt = $opts['name']; + } + if ( $opts['type'] == 'html' && empty( $opt ) && $opts['save'] == false ) { + $opt = $opts['default']; + } + + $args = array( + 'name' => $name, + 'options' => $opts, + 'attr' => $attr, + 'value' => $opt, + 'prefix' => $prefix + ); + if ( ! empty( $opts['nowrap'] ) ) { + echo $this->get_option_html( $args ); + } else { + if ( $container ) { + echo $container; + $container = ''; + } + echo $this->get_option_row( $name, $opts, $args ); + } + } + if ( ! $container ) { + echo '
'; + } } - + function sanitize_domain( $domain ) { $domain = trim( $domain ); $domain = $this->strtolower( $domain ); - if ( $this->strpos( $domain, "http://" ) === 0 ) $domain = $this->substr( $domain, 7 ); - elseif ( $this->strpos( $domain, "https://" ) === 0 ) $domain = $this->substr( $domain, 8 ); + if ( $this->strpos( $domain, 'http://' ) === 0 ) { + $domain = $this->substr( $domain, 7 ); + } elseif ( $this->strpos( $domain, 'https://' ) === 0 ) { + $domain = $this->substr( $domain, 8 ); + } $domain = untrailingslashit( $domain ); + return $domain; } /** Sanitize options */ function sanitize_options( $location = null ) { foreach ( $this->setting_options( $location ) as $k => $v ) { - if ( isset( $this->options[$k] ) ) { - if ( !empty( $v['sanitize'] ) ) + if ( isset( $this->options[ $k ] ) ) { + if ( ! empty( $v['sanitize'] ) ) { $type = $v['sanitize']; - else + } else { $type = $v['type']; + } switch ( $type ) { case 'multiselect': - case 'multicheckbox': $this->options[$k] = urlencode_deep( $this->options[$k] ); - break; - case 'textarea': $this->options[$k] = wp_kses_post( $this->options[$k] ); - $this->options[$k] = htmlspecialchars( $this->options[$k], ENT_QUOTES ); - break; - case 'filename': $this->options[$k] = sanitize_file_name( $this->options[$k] ); - break; - case 'text': $this->options[$k] = wp_kses_post( $this->options[$k] ); + case 'multicheckbox': + $this->options[ $k ] = urlencode_deep( $this->options[ $k ] ); + break; + case 'textarea': + $this->options[ $k ] = wp_kses_post( $this->options[ $k ] ); + $this->options[ $k ] = htmlspecialchars( $this->options[ $k ], ENT_QUOTES ); + break; + case 'filename': + $this->options[ $k ] = sanitize_file_name( $this->options[ $k ] ); + break; + case 'text': + $this->options[ $k ] = wp_kses_post( $this->options[ $k ] ); case 'checkbox': case 'radio': case 'select': - default: if ( !is_array( $this->options[$k] ) ) $this->options[$k] = esc_attr( $this->options[$k] ); + default: + if ( ! is_array( $this->options[ $k ] ) ) { + $this->options[ $k ] = esc_attr( $this->options[ $k ] ); + } } } } @@ -1739,39 +2124,43 @@ function display_metabox( $post, $metabox ) { function reset_options( $location = null, $delete = false ) { if ( $delete === true ) { $this->delete_class_option( $delete ); - $this->options = Array(); + $this->options = array(); } $default_options = $this->default_options( $location ); foreach ( $default_options as $k => $v ) { - $this->options[$k] = $v; + $this->options[ $k ] = $v; } $this->update_class_option( $this->options ); } - + /** handle option resetting and updating */ function handle_settings_updates( $location = null ) { $message = ''; - if ( (isset($_POST['action']) && $_POST['action'] == 'aiosp_update_module' && - ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) || !empty( $_POST['Submit'] ) ) ) ) { + if ( ( isset( $_POST['action'] ) && $_POST['action'] == 'aiosp_update_module' && + ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) || ! empty( $_POST['Submit'] ) ) ) + ) { $nonce = $_POST['nonce-aioseop']; - if (!wp_verify_nonce($nonce, 'aioseop-nonce')) die ( __( 'Security Check - If you receive this in error, log out and back in to WordPress', 'all-in-one-seo-pack' ) ); + if ( ! wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) { + die ( __( 'Security Check - If you receive this in error, log out and back in to WordPress', 'all-in-one-seo-pack' ) ); + } if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) { - $message = __( "Options Reset.", 'all-in-one-seo-pack' ); - if ( isset($_POST['Submit_All_Default']) ) { + $message = __( 'Options Reset.', 'all-in-one-seo-pack' ); + if ( isset( $_POST['Submit_All_Default'] ) ) { $this->reset_options( $location, true ); do_action( 'aioseop_options_reset' ); } else { $this->reset_options( $location ); } } - if ( !empty( $_POST['Submit'] ) ) { - $message = __("All in One SEO Options Updated.", 'all-in-one-seo-pack'); + if ( ! empty( $_POST['Submit'] ) ) { + $message = __( 'All in One SEO Options Updated.', 'all-in-one-seo-pack' ); $default_options = $this->default_options( $location ); - foreach( $default_options as $k => $v ) { - if ( isset( $_POST[$k] ) ) - $this->options[$k] = stripslashes_deep( $_POST[$k] ); - else - $this->options[$k] = ''; + foreach ( $default_options as $k => $v ) { + if ( isset( $_POST[ $k ] ) ) { + $this->options[ $k ] = stripslashes_deep( $_POST[ $k ] ); + } else { + $this->options[ $k ] = ''; + } } $this->sanitize_options( $location ); $this->options = apply_filters( $this->prefix . 'update_options', $this->options, $location ); @@ -1780,202 +2169,312 @@ function handle_settings_updates( $location = null ) { } do_action( $this->prefix . 'settings_update', $this->options, $location ); } + return $message; } /** Update / reset settings, printing options, sanitizing, posting back */ function display_settings_page( $location = null ) { - if ( $location != null ) $location_info = $this->locations[$location]; - $name = null; - if ( ( $location ) && ( isset( $location_info['name'] ) ) ) $name = $location_info['name']; - if ( !$name ) $name = $this->name; - $message = $this->handle_settings_updates( $location ); - $this->settings_page_init(); - ?> -
-
-

$message

"; ?> -

- + if ( $location != null ) { + $location_info = $this->locations[ $location ]; + } + $name = null; + if ( $location && isset( $location_info['name'] ) ) { + $name = $location_info['name']; + } + if ( ! $name ) { + $name = $this->name; + } + $message = $this->handle_settings_updates( $location ); + $this->settings_page_init(); + ?> +
+
+

$message

"; + } ?> +

+

+ +
+ prefix . 'settings_header', $location ); + ?> +
+
+
+ array( 'type' => 'hidden', 'value' => 'aiosp_update_module' ), + 'module' => array( 'type' => 'hidden', 'value' => get_class( $this ) ), + 'location' => array( 'type' => 'hidden', 'value' => $location ), + 'nonce-aioseop' => array( + 'type' => 'hidden', + 'value' => wp_create_nonce( 'aioseop-nonce' ) + ), + 'page_options' => array( 'type' => 'hidden', 'value' => 'aiosp_home_description' ), + 'Submit' => array( + 'type' => 'submit', + 'class' => 'button-primary', + 'value' => __( 'Update Options', 'all-in-one-seo-pack' ) . ' »' + ), + 'Submit_Default' => array( + 'type' => 'submit', + 'class' => 'button-secondary', + 'value' => __( sprintf( 'Reset %s Settings to Defaults', $name ), 'all-in-one-seo-pack' ) . ' »' + ) + ); + $submit_options = apply_filters( "{$this->prefix}submit_options", $submit_options, $location ); + foreach ( $submit_options as $k => $s ) { + if ( $s['type'] == 'submit' && $k != 'Submit' ) { + continue; + } + $class = ''; + if ( isset( $s['class'] ) ) { + $class = " class='{$s['class']}' "; + } + echo $this->get_option_html( array( + 'name' => $k, + 'options' => $s, + 'attr' => $class, + 'value' => $s['value'] + ) ); + } + ?>
-prefix . 'settings_header', $location ); -?> -
-
- Array( 'type' => 'hidden', 'value' => 'aiosp_update_module' ), - 'module' => Array( 'type' => 'hidden', 'value' => get_class( $this ) ), - 'location' => Array( 'type' => 'hidden', 'value' => $location ), - 'nonce-aioseop' => Array( 'type' => 'hidden', 'value' => wp_create_nonce('aioseop-nonce') ), - 'page_options' => Array( 'type' => 'hidden', 'value' => 'aiosp_home_description' ), - 'Submit' => Array( 'type' => 'submit', 'class' => 'button-primary', 'value' => __('Update Options', 'all-in-one-seo-pack') . ' »' ), - 'Submit_Default'=> Array( 'type' => 'submit', 'class' => 'button-secondary', 'value' => __( sprintf( 'Reset %s Settings to Defaults', $name ), 'all-in-one-seo-pack') . ' »' ) - ); - $submit_options = apply_filters( "{$this->prefix}submit_options", $submit_options, $location ); - foreach ( $submit_options as $k => $s ) { - if ( $s['type'] == 'submit' && $k != 'Submit' ) continue; - $class = ''; - if ( isset( $s['class'] ) ) $class = " class='{$s['class']}' "; - echo $this->get_option_html( Array( 'name' => $k, 'options' => $s, 'attr' => $class, 'value' => $s['value'] ) ); - } -?> -
- get_class_option(); - if ($opts !== FALSE) $this->options = $opts; + get_class_option(); + if ( $opts !== false ) { + $this->options = $opts; + } if ( is_array( $this->layout ) ) { - foreach( $this->layout as $l => $lopts ) { - if ( !isset( $lopts['tab'] ) || ( $this->current_tab == $lopts['tab'] ) ) { + foreach ( $this->layout as $l => $lopts ) { + if ( ! isset( $lopts['tab'] ) || ( $this->current_tab == $lopts['tab'] ) ) { $title = $lopts['name']; - if ( !empty( $lopts['help_link'] ) ) - $title .= "" . __( 'Help', 'all-in-one-seo-pack' ) . ""; - add_meta_box( $this->get_prefix( $location ) . $l . "_metabox", $title, array($this, 'display_options' ), - "{$this->prefix}settings", 'advanced', 'default', $lopts ); + if ( ! empty( $lopts['help_link'] ) ) { + $title .= "" . __( 'Help', 'all-in-one-seo-pack' ) . ''; + } + add_meta_box( $this->get_prefix( $location ) . $l . '_metabox', $title, array( + $this, + 'display_options' + ), + "{$this->prefix}settings", 'advanced', 'default', $lopts ); } } - } else add_meta_box( $this->get_prefix( $location ) . "metabox", $name, array($this, 'display_options'), "{$this->prefix}settings", 'advanced'); + } else { + add_meta_box( $this->get_prefix( $location ) . 'metabox', $name, array( + $this, + 'display_options' + ), "{$this->prefix}settings", 'advanced' ); + } do_meta_boxes( "{$this->prefix}settings", 'advanced', $location ); -?>

$s ) { - $class = ''; - if ( isset( $s['class'] ) ) $class = " class='{$s['class']}' "; - echo $this->get_option_html( Array( 'name' => $k, 'options' => $s, 'attr' => $class, 'value' => $s['value'] ) ); - } -?>

-
+ ?>

$s ) { + $class = ''; + if ( isset( $s['class'] ) ) { + $class = " class='{$s['class']}' "; + } + echo $this->get_option_html( array( + 'name' => $k, + 'options' => $s, + 'attr' => $class, + 'value' => $s['value'] + ) ); + } + ?>

+
- prefix . 'settings_footer', $location ); - do_action( 'aioseop_global_settings_footer', $location ); ?> -
prefix . 'settings_footer', $location ); + do_action( 'aioseop_global_settings_footer', $location ); ?> + locations[$location]['prefix'] ) ) - return $this->locations[$location]['prefix']; + if ( ( $location != null ) && isset( $this->locations[ $location ]['prefix'] ) ) { + return $this->locations[ $location ]['prefix']; + } + return $this->prefix; } /** Sets up initial settings */ function setting_options( $location = null, $defaults = null ) { - if ( $defaults === null ) + if ( $defaults === null ) { $defaults = $this->default_options; + } $prefix = $this->get_prefix( $location ); - $opts = Array(); - if ( $location == null || $this->locations[$location]['options'] === null ) + $opts = array(); + if ( $location == null || $this->locations[ $location ]['options'] === null ) { $options = $defaults; - else { - $options = Array(); - $prefix = "{$prefix}{$location}_"; - if ( !empty( $this->locations[$location]['default_options'] ) ) - $options = $this->locations[$location]['default_options']; - foreach( $this->locations[$location]['options'] as $opt ) { - if ( isset( $defaults[$opt] ) ) - $options[$opt] = $defaults[$opt]; - } - } - if ( !$prefix ) $prefix = $this->prefix; - if ( !empty( $options ) ) - foreach ($options as $k => $v) { - if ( !isset( $v['name'] ) ) $v['name'] = $this->ucwords( strtr( $k, '_', ' ' ) ); - if ( !isset( $v['type'] ) ) $v['type'] = 'checkbox'; - if ( !isset( $v['default'] ) ) $v['default'] = null; - if ( !isset( $v['initial_options'] ) ) $v['initial_options'] = $v['default']; - if ( $v['type'] == 'custom' && ( !isset( $v['nowrap'] ) ) ) $v['nowrap'] = true; - elseif ( !isset( $v['nowrap'] ) ) $v['nowrap'] = null; + } else { + $options = array(); + $prefix = "{$prefix}{$location}_"; + if ( ! empty( $this->locations[ $location ]['default_options'] ) ) { + $options = $this->locations[ $location ]['default_options']; + } + foreach ( $this->locations[ $location ]['options'] as $opt ) { + if ( isset( $defaults[ $opt ] ) ) { + $options[ $opt ] = $defaults[ $opt ]; + } + } + } + if ( ! $prefix ) { + $prefix = $this->prefix; + } + if ( ! empty( $options ) ) { + foreach ( $options as $k => $v ) { + if ( ! isset( $v['name'] ) ) { + $v['name'] = $this->ucwords( strtr( $k, '_', ' ' ) ); + } + if ( ! isset( $v['type'] ) ) { + $v['type'] = 'checkbox'; + } + if ( ! isset( $v['default'] ) ) { + $v['default'] = null; + } + if ( ! isset( $v['initial_options'] ) ) { + $v['initial_options'] = $v['default']; + } + if ( $v['type'] == 'custom' && ( ! isset( $v['nowrap'] ) ) ) { + $v['nowrap'] = true; + } elseif ( ! isset( $v['nowrap'] ) ) { + $v['nowrap'] = null; + } if ( isset( $v['condshow'] ) ) { - if ( !is_array( $this->script_data ) ) $this->script_data = Array(); - if ( !isset( $this->script_data['condshow'] ) ) $this->script_data['condshow'] = Array(); - $this->script_data['condshow'][$prefix . $k] = $v['condshow']; + if ( ! is_array( $this->script_data ) ) { + $this->script_data = array(); + } + if ( ! isset( $this->script_data['condshow'] ) ) { + $this->script_data['condshow'] = array(); + } + $this->script_data['condshow'][ $prefix . $k ] = $v['condshow']; } if ( $v['type'] == 'submit' ) { - if ( !isset($v['save'] ) ) $v['save'] = false; - if ( !isset($v['label'] ) ) $v['label'] = 'none'; - if ( !isset($v['prefix'] ) ) $v['prefix'] = false; + if ( ! isset( $v['save'] ) ) { + $v['save'] = false; + } + if ( ! isset( $v['label'] ) ) { + $v['label'] = 'none'; + } + if ( ! isset( $v['prefix'] ) ) { + $v['prefix'] = false; + } } else { - if ( !isset($v['label'] ) ) $v['label'] = null; + if ( ! isset( $v['label'] ) ) { + $v['label'] = null; + } } if ( $v['type'] == 'hidden' ) { - if ( !isset($v['label']) ) $v['label'] = 'none'; - if ( !isset($v['prefix']) ) $v['prefix'] = false; + if ( ! isset( $v['label'] ) ) { + $v['label'] = 'none'; + } + if ( ! isset( $v['prefix'] ) ) { + $v['prefix'] = false; + } + } + if ( ( $v['type'] == 'text' ) && ( ! isset( $v['size'] ) ) ) { + $v['size'] = 57; } - if ( ( $v['type'] == 'text' ) && ( !isset( $v['size'] ) ) ) $v['size'] = 57; if ( $v['type'] == 'textarea' ) { - if ( !isset($v['cols'])) $v['cols'] = 57; - if ( !isset($v['rows'])) $v['rows'] = 2; + if ( ! isset( $v['cols'] ) ) { + $v['cols'] = 57; + } + if ( ! isset( $v['rows'] ) ) { + $v['rows'] = 2; + } + } + if ( ! isset( $v['save'] ) ) { + $v['save'] = true; + } + if ( ! isset( $v['prefix'] ) ) { + $v['prefix'] = true; + } + if ( $v['prefix'] ) { + $opts[ $prefix . $k ] = $v; + } else { + $opts[ $k ] = $v; } - if ( !isset($v['save']) ) $v['save'] = true; - if ( !isset($v['prefix']) ) $v['prefix'] = true; - if ( $v['prefix'] ) - $opts[$prefix . $k] = $v; - else - $opts[$k] = $v; } + } + return $opts; } /** Generates just the default option names and values */ function default_options( $location = null, $defaults = null ) { $options = $this->setting_options( $location, $defaults ); - $opts = Array(); - foreach ( $options as $k => $v ) if ( $v['save'] ) $opts[$k] = $v['default']; + $opts = array(); + foreach ( $options as $k => $v ) { + if ( $v['save'] ) { + $opts[ $k ] = $v['default']; + } + } + return $opts; } - + /** Gets the current options stored for a given location. */ - function get_current_options( $opts = Array(), $location = null, $defaults = null, $post = null ) { - $prefix = $this->get_prefix( $location ); + function get_current_options( $opts = array(), $location = null, $defaults = null, $post = null ) { + $prefix = $this->get_prefix( $location ); $get_opts = ''; - if ( empty( $location ) ) + if ( empty( $location ) ) { $type = 'settings'; - else - $type = $this->locations[$location]['type']; + } else { + $type = $this->locations[ $location ]['type']; + } if ( $type === 'settings' ) { $get_opts = $this->get_class_option(); } elseif ( $type == 'metabox' ) { if ( $post == null ) { global $post; } - + if ( ( isset( $_GET['taxonomy'] ) && isset( $_GET['tag_ID'] ) ) || is_category() || is_tag() || is_tax() ) { if ( AIOSEOPPRO ) { $get_opts = AIO_ProGeneral::getprotax( $get_opts ); } - + } elseif ( isset( $post ) ) { $get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true ); } } $defs = $this->default_options( $location, $defaults ); - if ($get_opts == '') + if ( $get_opts == '' ) { $get_opts = $defs; - else + } else { $get_opts = wp_parse_args( $get_opts, $defs ); + } $opts = wp_parse_args( $opts, $get_opts ); + return $opts; } /** Updates the options array in the module; loads saved settings with get_option() or uses defaults */ - function update_options( $opts = Array(), $location = null, $defaults = null ) { - if ($location === null ) + function update_options( $opts = array(), $location = null, $defaults = null ) { + if ( $location === null ) { $type = 'settings'; - else - $type = $this->locations[$location][$type]; + } else { + $type = $this->locations[ $location ][ $type ]; + } if ( $type === 'settings' ) { $get_opts = $this->get_class_option(); } - if ($get_opts === FALSE) + if ( $get_opts === false ) { $get_opts = $this->default_options( $location, $defaults ); - else - $this->setting_options( $location, $defaults ); // hack -- make sure this runs anyhow, for now -- pdb + } else { + $this->setting_options( $location, $defaults ); + } // hack -- make sure this runs anyhow, for now -- pdb $this->options = wp_parse_args( $opts, $get_opts ); } } diff --git a/wp-content/plugins/all-in-one-seo-pack/admin/aioseop_module_manager.php b/wp-content/plugins/all-in-one-seo-pack/admin/aioseop_module_manager.php index 859c7a0696..3f3c50dbee 100644 --- a/wp-content/plugins/all-in-one-seo-pack/admin/aioseop_module_manager.php +++ b/wp-content/plugins/all-in-one-seo-pack/admin/aioseop_module_manager.php @@ -1,124 +1,208 @@ modules['feature_manager'] = null; - foreach ( $mod as $m ) $this->modules[$m] = null; - $reset = false; - $reset_all = ( isset( $_POST['Submit_All_Default'] ) && $_POST['Submit_All_Default']!='' ); - $reset = ( ( isset( $_POST['Submit_Default'] ) && $_POST['Submit_Default']!='' ) || $reset_all ); - $update = ( isset($_POST['action']) && $_POST['action'] - && ( ( isset( $_POST['Submit'] ) && $_POST['Submit']!='' ) || $reset ) - ); + foreach ( $mod as $m ) { + $this->modules[ $m ] = null; + } + $reset = false; + $reset_all = ( isset( $_POST['Submit_All_Default'] ) && '' !== $_POST['Submit_All_Default'] ); + $reset = ( ( isset( $_POST['Submit_Default'] ) && '' !== $_POST['Submit_Default'] ) || $reset_all ); + $update = ( isset( $_POST['action'] ) && $_POST['action'] + && ( ( isset( $_POST['Submit'] ) && '' !== $_POST['Submit'] ) || $reset ) + ); if ( $update ) { - if ( $reset ) $this->settings_reset = true; - if ( $reset_all ) $this->settings_reset_all = true; - if ( $_POST['action'] == 'aiosp_update' ) $this->settings_update = true; - if ( $_POST['action'] == 'aiosp_update_module' ) $this->module_settings_update = true; + if ( $reset ) { + $this->settings_reset = true; + } + if ( $reset_all ) { + $this->settings_reset_all = true; + } + if ( 'aiosp_update' === $_POST['action'] ) { + $this->settings_update = true; + } + if ( 'aiosp_update_module' === $_POST['action'] ) { + $this->module_settings_update = true; + } } $this->do_load_module( 'feature_manager', $mod ); } + /** + * Return module. + * + * @param $class + * + * @return $this|bool|mixed + */ function return_module( $class ) { global $aiosp; - if ( $class == get_class( $aiosp ) ) return $aiosp; - if ( $class == get_class( $this ) ) return $this; - foreach( $this->modules as $m ) - if ( is_object( $m ) && ( $class == get_class( $m ) ) ) + if ( get_class( $aiosp ) === $class ) { + return $aiosp; + } + if ( get_class( $aiosp ) === $class ) { + return $this; + } + foreach ( $this->modules as $m ) { + if ( is_object( $m ) && ( get_class( $m ) === $class ) ) { return $m; + } + } + return false; } - + + /** + * @return array + */ function get_loaded_module_list() { - $module_list = Array(); - if ( !empty( $this->modules ) ) { - foreach( $this->modules as $k => $v ) - if ( !empty( $v ) ) - $module_list[$k] = get_class( $v ); + $module_list = array(); + if ( ! empty( $this->modules ) ) { + foreach ( $this->modules as $k => $v ) { + if ( ! empty( $v ) ) { + $module_list[ $k ] = get_class( $v ); + } + } } + return $module_list; } - // Module name is used for these automatic settings: - // The aiosp_enable_$module settings - whether each plugin is active or not - // The name of the .php file containing the module - aioseop_$module.php - // The name of the class - All_in_One_SEO_Pack_$Module - // The global $aioseop_$module - // $this->modules[$module] + /** + * @param $mod Module. + * @param null $args + * + * @return bool + */ function do_load_module( $mod, $args = null ) { + // Module name is used for these automatic settings: + // The aiosp_enable_$module settings - whether each plugin is active or not. + // The name of the .php file containing the module - aioseop_$module.php. + // The name of the class - All_in_One_SEO_Pack_$Module. + // The global $aioseop_$module. + // $this->modules[$module]. + $mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "modules/aioseop_$mod.php" ); - if ( !empty( $mod_path ) ) + if ( ! empty( $mod_path ) ) { require_once( $mod_path ); - $ref = "aioseop_$mod"; - $classname = "All_in_One_SEO_Pack_" . strtr( ucwords( strtr( $mod, '_', ' ' ) ), ' ', '_' ); - $classname = apply_filters( "aioseop_class_$mod", $classname ); - $module_class = new $classname( $args ); - $GLOBALS[$ref] = $module_class; - $this->modules[$mod] = $module_class; - if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) - add_action( 'admin_bar_menu', array( $module_class, 'add_admin_bar_submenu' ), 1001 + $module_class->menu_order() ); + } + $ref = "aioseop_$mod"; + $classname = 'All_in_One_SEO_Pack_' . strtr( ucwords( strtr( $mod, '_', ' ' ) ), ' ', '_' ); + $classname = apply_filters( "aioseop_class_$mod", $classname ); + $module_class = new $classname( $args ); + $GLOBALS[ $ref ] = $module_class; + $this->modules[ $mod ] = $module_class; + if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) { + add_action( 'admin_bar_menu', array( + $module_class, + 'add_admin_bar_submenu', + ), 1001 + $module_class->menu_order() ); + } if ( is_admin() ) { - add_action( 'aioseop_modules_add_menus', Array( $module_class, 'add_menu' ), $module_class->menu_order() ); - add_action( 'aiosoep_options_reset', Array( $module_class, 'reset_options' ) ); - add_filter( 'aioseop_export_settings', Array( $module_class, 'settings_export' ) ); + add_action( 'aioseop_modules_add_menus', array( + $module_class, + 'add_menu', + ), $module_class->menu_order() ); + add_action( 'aiosoep_options_reset', array( $module_class, 'reset_options' ) ); + add_filter( 'aioseop_export_settings', array( $module_class, 'settings_export' ) ); } + return true; } + /** + * @param $mod + * + * @return bool + */ function load_module( $mod ) { static $feature_options = null; static $feature_prefix = null; - if ( !is_array( $this->modules ) ) return false; + if ( ! is_array( $this->modules ) ) { + return false; + } $v = $this->modules[ $mod ]; - if ( $v !== null ) return false; // already loaded - if ( $mod == 'performance' && !is_super_admin() ) return false; - if ( ( $mod == 'file_editor' || $mod == 'robots' ) - && ( ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) - || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) - || !is_super_admin() ) ) ) + if ( null !== $v ) { + return false; + } // Already loaded. + if ( 'performance' === $mod && ! is_super_admin() ) { + return false; + } + if ( ( 'file_editor' === $mod || 'robots' === $mod ) + && ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) + || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) + || ! is_super_admin() ) + ) { return false; + } $mod_enable = false; - $fm_page = ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) && - isset($_REQUEST['page']) && $_REQUEST['page'] == trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . 'modules/aioseop_feature_manager.php' ); - if ( $fm_page && !$this->settings_reset ) { - if ( isset( $_POST["aiosp_feature_manager_enable_$mod"] ) ) - $mod_enable = $_POST["aiosp_feature_manager_enable_$mod"]; - else - $mod_enable = false; + $fm_page = ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) && + isset( $_REQUEST['page'] ) && trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . 'modules/aioseop_feature_manager.php' === $_REQUEST['page'] ); + if ( $fm_page && ! $this->settings_reset ) { + if ( isset( $_POST["aiosp_feature_manager_enable_$mod"] ) ) { + $mod_enable = $_POST["aiosp_feature_manager_enable_$mod"]; + } else { + $mod_enable = false; + } } else { - if ( $feature_prefix == null ) + if ( null === $feature_prefix ) { $feature_prefix = $this->modules['feature_manager']->get_prefix(); - if ( $fm_page && $this->settings_reset ) + } + if ( $fm_page && $this->settings_reset ) { $feature_options = $this->modules['feature_manager']->default_options(); - if ( $feature_options == null ) { - if ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) && $this->settings_reset_all ) + } + if ( null === $feature_options ) { + if ( $this->module_settings_update && $this->settings_reset_all && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) { $feature_options = $this->modules['feature_manager']->default_options(); - else + } else { $feature_options = $this->modules['feature_manager']->get_current_options(); + } } - if ( isset( $feature_options["{$feature_prefix}enable_$mod"] ) ) + if ( isset( $feature_options["{$feature_prefix}enable_$mod"] ) ) { $mod_enable = $feature_options["{$feature_prefix}enable_$mod"]; + } } - if ( $mod_enable ) return $this->do_load_module( $mod ); + if ( $mod_enable ) { + return $this->do_load_module( $mod ); + } + return false; } function load_modules() { - if ( is_array( $this->modules ) ) - foreach( $this->modules as $k => $v ) + if ( is_array( $this->modules ) ) { + foreach ( $this->modules as $k => $v ) { $this->load_module( $k ); + } + } } } } diff --git a/wp-content/plugins/all-in-one-seo-pack/admin/display/general-metaboxes.php b/wp-content/plugins/all-in-one-seo-pack/admin/display/general-metaboxes.php index 7a58775d78..7dc830cf4c 100644 --- a/wp-content/plugins/all-in-one-seo-pack/admin/display/general-metaboxes.php +++ b/wp-content/plugins/all-in-one-seo-pack/admin/display/general-metaboxes.php @@ -3,117 +3,166 @@ /** * @package All-in-One-SEO-Pack */ - class aiosp_metaboxes { - + + /** + * aiosp_metaboxes constructor. + */ function __construct() { //construct } - - - - - - + + /** + * @param $add + * @param $meta + */ static function display_extra_metaboxes( $add, $meta ) { echo "
"; switch ( $meta['id'] ) { - case "aioseop-about": - ?>
-

+
+

Semper Fi Web Design' ); ?>.

- ID; - $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' ); - if ( !empty( $ignore ) ) { - $qa = Array(); - wp_parse_str( $_SERVER["QUERY_STRING"], $qa ); - $qa['aioseop_reset_notices'] = 1; - $url = '?' . build_query( $qa ); - echo '

' . __( "Reset Dismissed Notices", 'all-in-one-seo-pack' ) . '

'; - } - if ( !AIOSEOPPRO ) { - ?> -

-

- -
+ ID; + $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' ); + if ( ! empty( $ignore ) ) { + $qa = Array(); + wp_parse_str( $_SERVER['QUERY_STRING'], $qa ); + $qa['aioseop_reset_notices'] = 1; + $url = '?' . build_query( $qa ); + echo '

' . __( 'Reset Dismissed Notices', 'all-in-one-seo-pack' ) . '

'; + } + if ( ! AIOSEOPPRO ) { + ?> +

+ +

+ +
+ case 'aioseop-donate': + ?>
- -
-

If you like this plugin and find it useful, help keep this plugin free and actively developed by clicking the donate button or send me a gift from my - Amazon wishlist. Also, don't forget to follow me on Twitter. -

-
- + +
+

If you like this plugin and find it useful, help keep this plugin free and actively + developed by clicking the donate button or send me a gift from my + Amazon wishlist. Also, don't forget to follow me on Twitter. +

+
+
- - - <?php _e('Donate with Paypal', 'all-in-one-seo-pack' ); ?> - - <?php _e('My Amazon Wish List', 'all-in-one-seo-pack' ); ?> - - - - -
-
- - - -
+ + + <?php _e( 'Donate with Paypal', 'all-in-one-seo-pack' ); ?> + + <?php _e( 'My Amazon Wish List', 'all-in-one-seo-pack' ); ?> + + + + +
+
+ percent_translated < 100 ) { + + /* translators: %1$s expands to the number of languages All in One SEO Pack has been translated into. $2%s to the percentage translated of the current language, $3%s to the language name, %4$s and %5$s to anchor tags with link to translation page at translate.wordpress.org */ + printf( __( + 'All in One SEO Pack has been translated into %1$s languages, but currently the %3$s translation is only %2$s percent complete. %4$s Click here %5$s to help get it to 100 percent.', 'all-in-one-seo-pack' ), + $aiosp_trans->translated_count, + $aiosp_trans->percent_translated, + $aiosp_trans->name, + "translation_url\" target=\"_BLANK\">", + '' ); + } + + ?> +
- +
-
+

-

-

-

-
+

+ +

+

+

+
-
-

-

-

-

-

+ case 'aioseop-support': + ?> +
+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

- "; + echo '
'; } - - - - - - - - - -} \ No newline at end of file + + +} diff --git a/wp-content/plugins/all-in-one-seo-pack/admin/display/index.php b/wp-content/plugins/all-in-one-seo-pack/admin/display/index.php index e71af0ef21..3c379e1835 100644 --- a/wp-content/plugins/all-in-one-seo-pack/admin/display/index.php +++ b/wp-content/plugins/all-in-one-seo-pack/admin/display/index.php @@ -1 +1,4 @@ - wp_create_nonce( 'wpseo-import' ) ), admin_url( 'admin.php?page=wpseo_tools&tool=import-export&import=1&importaioseo=1#top#import-seo' ) ); + $aiourl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'aiosp-import' ) ), admin_url( 'tools.php?page=aiosp_import' ) ); - - $yoasturl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'wpseo-import' ) ), admin_url( 'admin.php?page=wpseo_tools&tool=import-export&import=1&importaioseo=1#top#import-seo' ) ); - $aiourl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'aiosp-import' ) ), admin_url( 'tools.php?page=aiosp_import' ) ); + $aioseop_yst_detected_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true ); + if ( empty( $aioseop_yst_detected_notice_dismissed ) ) { - $aioseop_yst_detected_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true ); + echo '

', sprintf( esc_html__( 'The plugin Yoast SEO has been detected. Do you want to %simport its settings%s into All in One SEO Pack?', 'all-in-one-seo-pack' ), sprintf( '', esc_url( $aiourl ) ), '' ), '

'; - if ( empty( $aioseop_yst_detected_notice_dismissed ) ) { + } - echo '

', sprintf( esc_html__( 'The plugin Yoast SEO has been detected. Do you want to %simport its settings%s into All in One SEO Pack?', 'all-in-one-seo-pack' ), sprintf( '', esc_url( $aiourl ) ), '' ), '

'; + echo '

', sprintf( esc_html__( 'The plugin All-In-One-SEO has been detected. Do you want to %simport its settings%s?', 'wordpress-seo' ), sprintf( '', esc_url( $yoasturl ) ), '' ), '

'; } - - - echo '

', sprintf( esc_html__( 'The plugin All-In-One-SEO has been detected. Do you want to %simport its settings%s?', 'wordpress-seo' ), sprintf( '', esc_url( $yoasturl ) ), '' ), '

'; - - - - } - public function show_deactivate_notice() { - echo '

', esc_html__( 'All in One SEO has been deactivated', 'all-in-one-seo-pack' ), '

'; + public function show_deactivate_notice() { + echo '

', esc_html__( 'All in One SEO has been deactivated', 'all-in-one-seo-pack' ), '

'; + } } +} else { + add_action( 'init', 'mi_aioseop_yst_detected_notice_dismissed' ); } -}else{ + +/** + * Deletes the stored dismissal of the notice. + * + * This should only happen after reactivating after being deactivated. + */ +function mi_aioseop_yst_detected_notice_dismissed() { delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' ); } /** - * Register the admin menu page + * Init for settings import class. + * + * At the moment we just register the admin menu page. */ -add_action('admin_menu', 'aiosp_seometa_settings_init'); function aiosp_seometa_settings_init() { global $_aiosp_seometa_admin_pagehook; - - // Add submenu page link - $_aiosp_seometa_admin_pagehook = add_submenu_page('tools.php', __('Import SEO Data','all-in-one-seo-pack'), __('SEO Data Import','all-in-one-seo-pack'), 'manage_options', 'aiosp_import', 'aiosp_seometa_admin'); + + // TODO Put this in with the rest of the import/export stuff. + $_aiosp_seometa_admin_pagehook = add_submenu_page( 'tools.php', __( 'Import SEO Data', 'all-in-one-seo-pack' ), __( 'SEO Data Import', 'all-in-one-seo-pack' ), 'manage_options', 'aiosp_import', 'aiosp_seometa_admin' ); } +add_action( 'admin_menu', 'aiosp_seometa_settings_init' ); + /** - * This function intercepts POST data from the form submission, and uses that - * data to convert values in the postmeta table from one platform to another. + * Intercept POST data from the form submission. + * + * Use the intercepted data to convert values in the postmeta table from one platform to another. */ function aiosp_seometa_action() { - - //print_r($_REQUEST); - - if ( empty( $_REQUEST['_wpnonce'] ) ) + + if ( empty( $_REQUEST['_wpnonce'] ) ) { return; - + } + if ( empty( $_REQUEST['platform_old'] ) ) { - printf( '

%s

', __('Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.') ); + printf( '

%s

', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) ); + return; } - - if ( $_REQUEST['platform_old'] == 'All in One SEO Pack' ) { - printf( '

%s

', __('Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.') ); + + if ( 'All in One SEO Pack' === $_REQUEST['platform_old'] ) { + printf( '

%s

', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) ); + return; } - - check_admin_referer('aiosp_nonce'); // Verify nonce - - if ( !empty( $_REQUEST['analyze'] ) ) { - - printf( '

%s

', __('Analysis Results', 'all-in-one-seo-pack') ); - + + check_admin_referer( 'aiosp_nonce' ); // Verify nonce. TODO We should make this better. + + if ( ! empty( $_REQUEST['analyze'] ) ) { + + printf( '

%s

', __( 'Analysis Results', 'all-in-one-seo-pack' ) ); + $response = aiosp_seometa_post_meta_analyze( $_REQUEST['platform_old'], 'All in One SEO Pack' ); if ( is_wp_error( $response ) ) { - printf( '

%s

', __('Sorry, something went wrong. Please try again') ); + printf( '

%s

', __( 'Sorry, something went wrong. Please try again' ) ); + return; } - - printf( __('

Analyzing records in a %s to %s conversion…', 'all-in-one-seo-pack'), esc_html( $_POST['platform_old'] ), 'All in One SEO Pack' ); + + printf( __( '

Analyzing records in a %s to %s conversion…', 'all-in-one-seo-pack' ), esc_html( $_POST['platform_old'] ), 'All in One SEO Pack' ); printf( '

%d Compatible Records were identified

', $response->update ); -// printf( '

%d Compatible Records will be ignored

', $response->ignore ); - - printf( '

%s

', __('Compatible data:', 'all-in-one-seo-pack') ); + // printf( '

%d Compatible Records will be ignored

', $response->ignore ); + + printf( '

%s

', __( 'Compatible data:', 'all-in-one-seo-pack' ) ); echo '
    '; - foreach ( (array)$response->elements as $element ) { + foreach ( (array) $response->elements as $element ) { printf( '
  1. %s
  2. ', $element ); } echo '
'; - + return; } - - printf( '

%s

', __('Conversion Results', 'all-in-one-seo-pack') ); - - $result = aiosp_seometa_post_meta_convert( stripslashes($_REQUEST['platform_old']), 'All in One SEO Pack' ); + + printf( '

%s

', __( 'Conversion Results', 'all-in-one-seo-pack' ) ); + + $result = aiosp_seometa_post_meta_convert( stripslashes( $_REQUEST['platform_old'] ), 'All in One SEO Pack' ); if ( is_wp_error( $result ) ) { - printf( '

%s

', __('Sorry, something went wrong. Please try again') ); + printf( '

%s

', __( 'Sorry, something went wrong. Please try again' ) ); + return; } - + printf( '

%d Records were updated

', isset( $result->updated ) ? $result->updated : 0 ); printf( '

%d Records were ignored

', isset( $result->ignored ) ? $result->ignored : 0 ); - - return; - + } /** @@ -122,457 +138,472 @@ function aiosp_seometa_action() { */ function aiosp_seometa_admin() { global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms; -?> + ?>
- - -

- -

- -

- -

- -

- -

', esc_url( 'http://semperfiwebdesign.com/backupbuddy/' ) ), '' ); ?>

- - - -
- '; - printf( '', __('Choose platform:', 'all-in-one-seo-pack') ); - - printf( '', __('Plugins', 'all-in-one-seo-pack') ); - foreach ( $_aiosp_seometa_plugins as $platform => $data ) { - if($platform != "All in One SEO Pack") printf( '', $platform, selected($platform, $platform_old, 0), $platform ); - } - printf( '' ); - - printf( '', __('Themes', 'all-in-one-seo-pack') ); - foreach ( $_aiosp_seometa_themes as $platform => $data ) { - printf( '', $platform, selected($platform, $platform_old, 0), $platform ); - } - printf( '' ); - - - echo '' . "\n\n"; - ?> - - - - -
- - - -
+

- +

+

+

+

+

-//////////////////FUNCTIONS////////////////// +

+

- /** - * This function converts $old meta_key entries in the postmeta table into $new entries. - * - * It first checks to see what records for the $new meta_key already exist, - * storing the corresponding post_id values in an array. When the conversion - * happens, rows that contain a post_id in that array will be ignored, to - * avoid duplicate $new meta_key entries. - * - * The $old entries will be left as-is if $delete_old is left false. If set - * to true, the $old entries will be deleted, rather than retained. - * - * The function returns an object for error detection, and the number of affected rows. - */ - function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = false ) { +

', esc_url( 'http://semperfiwebdesign.com/backupbuddy/' ) ), '' ); ?> +

- do_action( 'pre_aiosp_seometa_meta_key_convert_before', $old, $new, $delete_old ); - global $wpdb; +
+ WP_Error = 1; - return $output; - } + _e( 'Import SEO data from:', 'all-in-one-seo-pack' ); + echo '' . "\n\n"; - } - // Else, do a more complex UPDATE and DELETE - else { + ?> - foreach ( (array)$exclude as $key => $value ) { - $not_in[] = $value->post_id; - } - $not_in = implode(', ', (array)$not_in ); + + - $output->updated = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_key = %s WHERE meta_key = %s AND post_id NOT IN ($not_in)", $new, $old ) ); - $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0; - $output->ignored = count( $exclude ); +
- } + - do_action( 'aiosp_seometa_meta_key_convert', $output, $old, $new, $delete_old ); + - return $output; + WP_Error = 1; - if ( empty( $_aiosp_seometa_platforms[$old_platform] ) || empty( $_aiosp_seometa_platforms[$new_platform] ) ) { - $output->WP_Error = 1; - return $output; - } + return $output; + } + + // See which records we need to ignore, if any. + $exclude = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $new ) ); - $output->updated = 0; - $output->deleted = 0; + // If no records to ignore, we'll do a basic UPDATE and DELETE. + if ( ! $exclude ) { + + $output->updated = $wpdb->update( $wpdb->postmeta, array( 'meta_key' => $new ), array( 'meta_key' => $old ) ); + $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0; $output->ignored = 0; - foreach ( (array)$_aiosp_seometa_platforms[$old_platform] as $label => $meta_key ) { + } // Else, do a more complex UPDATE and DELETE. + else { - // skip iterations where no $new analog exists - if ( empty( $_aiosp_seometa_platforms[$new_platform][$label] ) ) - continue; + foreach ( (array) $exclude as $key => $value ) { + $not_in[] = $value->post_id; + } + $not_in = implode( ', ', (array) $not_in ); - // set $old and $new meta_key values - $old = $_aiosp_seometa_platforms[$old_platform][$label]; - $new = $_aiosp_seometa_platforms[$new_platform][$label]; + $output->updated = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_key = %s WHERE meta_key = %s AND post_id NOT IN ($not_in)", $new, $old ) ); + $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0; + $output->ignored = count( $exclude ); - // convert - $result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old ); + } - // error check - if ( is_wp_error( $result ) ) - continue; + do_action( 'aiosp_seometa_meta_key_convert', $output, $old, $new, $delete_old ); - // update total updated/ignored count - $output->updated = $output->updated + (int)$result->updated; - $output->ignored = $output->ignored + (int)$result->ignored; + return $output; - } +} - do_action( 'aiosp_seometa_post_meta_convert', $output, $old_platform, $new_platform, $delete_old ); +/** + * Convert old to new postmeta. + * + * Cycle through all compatible SEO entries of two platforms and aiosp_seometa_meta_key_convert conversion for each key. + * + * @param string $old_platform + * @param string $new_platform + * @param bool $delete_old + * + * @return stdClass Results object. + */ +function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'All in One SEO Pack', $delete_old = false ) { - return $output; + do_action( 'pre_aiosp_seometa_post_meta_convert', $old_platform, $new_platform, $delete_old ); - } + global $_aiosp_seometa_platforms; - /** - * This function analyzes two platforms to see what Compatible elements they share, - * what data can be converted from one to the other, and which elements to ignore (future). - */ - function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) { + $output = new stdClass; + + if ( empty( $_aiosp_seometa_platforms[ $old_platform ] ) || empty( $_aiosp_seometa_platforms[ $new_platform ] ) ) { + $output->WP_Error = 1; - do_action( 'pre_aiosp_seometa_post_meta_analyze', $old_platform, $new_platform ); + return $output; + } - global $wpdb, $_aiosp_seometa_platforms; + $output->updated = 0; + $output->deleted = 0; + $output->ignored = 0; - $output = new stdClass; + foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) { - if ( empty( $_aiosp_seometa_platforms[$old_platform] ) || empty( $_aiosp_seometa_platforms[$new_platform] ) ) { - $output->WP_Error = 1; - return $output; + // Skip iterations where no $new analog exists. + if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) { + continue; } - $output->update = 0; - $output->ignore = 0; - $output->elements = ''; + // Set $old and $new meta_key values. + $old = $_aiosp_seometa_platforms[ $old_platform ][ $label ]; + $new = $_aiosp_seometa_platforms[ $new_platform ][ $label ]; - foreach ( (array)$_aiosp_seometa_platforms[$old_platform] as $label => $meta_key ) { + // Convert. + $result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old ); - // skip iterations where no $new analog exists - if ( empty( $_aiosp_seometa_platforms[$new_platform][$label] ) ) - continue; + // Error check. + if ( is_wp_error( $result ) ) { + continue; + } - $elements[] = $label; + // Update total updated/ignored count. + $output->updated += (int) $result->updated; + $output->ignored += (int) $result->ignored; - // see which records to ignore, if any - $ignore = 0; - // $ignore = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) ); + } - // see which records to update, if any - $update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) ); + do_action( 'aiosp_seometa_post_meta_convert', $output, $old_platform, $new_platform, $delete_old ); - // count items in returned arrays - // $ignore = count( (array)$ignore ); - $update = count( (array)$update ); + return $output; - // calculate update/ignore by comparison - // $update = ( (int)$update > (int)$ignore ) ? ( (int)$update - (int)$ignore ) : 0; +} - // update output numbers - $output->update = $output->update + (int)$update; - $output->ignore = $output->ignore + (int)$ignore; +/** + * Analyze two platforms to find shared and compatible elements. + * + * See what data can be converted from one to the other. + * + * @param string $old_platform + * @param string $new_platform + * + * @return stdClass + */ +function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) { + // TODO Figure out which elements to ignore. + do_action( 'pre_aiosp_seometa_post_meta_analyze', $old_platform, $new_platform ); - } // endforeach + global $wpdb, $_aiosp_seometa_platforms; - $output->elements = $elements; + $output = new stdClass; - do_action( 'aiosp_seometa_post_meta_analyze', $output, $old_platform, $new_platform ); + if ( empty( $_aiosp_seometa_platforms[ $old_platform ] ) || empty( $_aiosp_seometa_platforms[ $new_platform ] ) ) { + $output->WP_Error = 1; return $output; - } - - - -////////////PLUGIN///////// + $output->update = 0; + $output->ignore = 0; + $output->elements = ''; -// define('aiosp_seometa_PLUGIN_DIR', dirname(__FILE__)); + foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) { - //add_action( 'plugins_loaded', 'aiosp_seometa_import' ); - /** - * Initialize the SEO Data Transporter plugin - */ - function aiosp_seometa_import() { + // Skip iterations where no $new analog exists. + if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) { + continue; + } - global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms; + $elements[] = $label; - /** - * The associative array of supported themes. - */ - $_aiosp_seometa_themes = array( - // alphabatized - 'Builder' => array( - 'Custom Doctitle' => '_builder_seo_title', - 'META Description' => '_builder_seo_description', - 'META Keywords' => '_builder_seo_keywords', - ), - 'Catalyst' => array( - 'Custom Doctitle' => '_catalyst_title', - 'META Description' => '_catalyst_description', - 'META Keywords' => '_catalyst_keywords', - 'noindex' => '_catalyst_noindex', - 'nofollow' => '_catalyst_nofollow', - 'noarchive' => '_catalyst_noarchive', - ), - 'Frugal' => array( - 'Custom Doctitle' => '_title', - 'META Description' => '_description', - 'META Keywords' => '_keywords', - 'noindex' => '_noindex', - 'nofollow' => '_nofollow', - ), - 'Genesis' => array( - 'Custom Doctitle' => '_genesis_title', - 'META Description' => '_genesis_description', - 'META Keywords' => '_genesis_keywords', - 'noindex' => '_genesis_noindex', - 'nofollow' => '_genesis_nofollow', - 'noarchive' => '_genesis_noarchive', - 'Canonical URI' => '_genesis_canonical_uri', - 'Custom Scripts' => '_genesis_scripts', - 'Redirect URI' => 'redirect', - ), - 'Headway' => array( - 'Custom Doctitle' => '_title', - 'META Description' => '_description', - 'META Keywords' => '_keywords', - ), - 'Hybrid' => array( - 'Custom Doctitle' => 'Title', - 'META Description' => 'Description', - 'META Keywords' => 'Keywords', - ), - 'Thesis 1.x' => array( - 'Custom Doctitle' => 'thesis_title', - 'META Description' => 'thesis_description', - 'META Keywords' => 'thesis_keywords', - 'Custom Scripts' => 'thesis_javascript_scripts', - 'Redirect URI' => 'thesis_redirect', - ), - /* - 'Thesis 2.x' => array( - 'Custom Doctitle' => '_thesis_title_tag', - 'META Description' => '_thesis_meta_description', - 'META Keywords' => '_thesis_meta_keywords', - 'Custom Scripts' => '_thesis_javascript_scripts', - 'Canonical URI' => '_thesis_canonical_link', - 'Redirect URI' => '_thesis_redirect', - ), - */ - 'WooFramework' => array( - 'Custom Doctitle' => 'seo_title', - 'META Description' => 'seo_description', - 'META Keywords' => 'seo_keywords', - ) - ); + // See which records to ignore, if any. + $ignore = 0; + // $ignore = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) ); - /** - * The associative array of supported plugins. - */ - $_aiosp_seometa_plugins = array( - // alphabatized - 'Add Meta Tags' => array( - 'META Description' => 'description', - 'META Keywords' => 'keywords', - ), - 'All in One SEO Pack' => array( - 'Custom Doctitle' => '_aioseop_title', - 'META Description' => '_aioseop_description', - 'META Keywords' => '_aioseop_keywords', - ), - 'Greg\'s High Performance SEO' => array( - 'Custom Doctitle' => '_ghpseo_secondary_title', - 'META Description' => '_ghpseo_alternative_description', - 'META Keywords' => '_ghpseo_keywords', - ), - 'Headspace2' => array( - 'Custom Doctitle' => '_headspace_page_title', - 'META Description' => '_headspace_description', - 'META Keywords' => '_headspace_keywords', - 'Custom Scripts' => '_headspace_scripts', - ), - 'Infinite SEO' => array( - 'Custom Doctitle' => '_wds_title', - 'META Description' => '_wds_metadesc', - 'META Keywords' => '_wds_keywords', - 'noindex' => '_wds_meta-robots-noindex', - 'nofollow' => '_wds_meta-robots-nofollow', - 'Canonical URI' => '_wds_canonical', - 'Redirect URI' => '_wds_redirect', - ), - 'Meta SEO Pack' => array( - 'META Description' => '_msp_description', - 'META Keywords' => '_msp_keywords', - ), - 'Platinum SEO' => array( - 'Custom Doctitle' => 'title', - 'META Description' => 'description', - 'META Keywords' => 'keywords', - ), - 'SEO Title Tag' => array( - 'Custom Doctitle' => 'title_tag', - 'META Description' => 'meta_description', - ), - 'SEO Ultimate' => array( - 'Custom Doctitle' => '_su_title', - 'META Description' => '_su_description', - 'META Keywords' => '_su_keywords', - 'noindex' => '_su_meta_robots_noindex', - 'nofollow' => '_su_meta_robots_nofollow', - ), - 'Yoast SEO' => array( - 'Custom Doctitle' => '_yoast_wpseo_title', - 'META Description' => '_yoast_wpseo_metadesc', - 'META Keywords' => '_yoast_wpseo_metakeywords', - 'noindex' => '_yoast_wpseo_meta-robots-noindex', - 'nofollow' => '_yoast_wpseo_meta-robots-nofollow', - 'Canonical URI' => '_yoast_wpseo_canonical', - 'Redirect URI' => '_yoast_wpseo_redirect', - ) - ); + // See which records to update, if any. + $update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) ); - /** - * The combined array of supported platforms. - */ - $_aiosp_seometa_platforms = array_merge( $_aiosp_seometa_themes, $_aiosp_seometa_plugins ); + // Count items in returned arrays. + // $ignore = count( (array)$ignore ); + $update = count( (array) $update ); - /** - * Include the other elements of the plugin. - */ - // require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' ); -// require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' ); + // Calculate update/ignore by comparison. + // $update = ( (int)$update > (int)$ignore ) ? ( (int)$update - (int)$ignore ) : 0; - /** - * Init hook. - * - * Hook fires after plugin functions are loaded. - * - * @since 0.9.10 - * - */ - do_action( 'aiosp_seometa_import' ); + // update output numbers + $output->update += (int) $update; + $output->ignore += (int) $ignore; } - /** - * Activation Hook - * @since 0.9.4 - */ - register_activation_hook( __FILE__, 'aiosp_seometa_activation_hook' ); - function aiosp_seometa_activation_hook() { + $output->elements = $elements; - // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' ); + do_action( 'aiosp_seometa_post_meta_analyze', $output, $old_platform, $new_platform ); - aiosp_seometa_meta_key_convert( '_yoast_seo_title', 'yoast_wpseo_title', true ); - aiosp_seometa_meta_key_convert( '_yoast_seo_metadesc', 'yoast_wpseo_metadesc', true ); + return $output; - } +} + + +// define('aiosp_seometa_PLUGIN_DIR', dirname(__FILE__)); + +//add_action( 'plugins_loaded', 'aiosp_seometa_import' ); +/** + * Initialize the SEO Data Transporter plugin + */ +function aiosp_seometa_import() { + + global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms; /** - * Manual conversion test + * The associative array of supported themes. */ - /* - $aiosp_seometa_convert = aiosp_seometa_post_meta_convert( 'All in One SEO Pack', 'Genesis', false ); - printf( '%d records were updated', $aiosp_seometa_convert->updated ); - /**/ + $_aiosp_seometa_themes = array( + // alphabatized + 'Builder' => array( + 'Custom Doctitle' => '_builder_seo_title', + 'META Description' => '_builder_seo_description', + 'META Keywords' => '_builder_seo_keywords', + ), + 'Catalyst' => array( + 'Custom Doctitle' => '_catalyst_title', + 'META Description' => '_catalyst_description', + 'META Keywords' => '_catalyst_keywords', + 'noindex' => '_catalyst_noindex', + 'nofollow' => '_catalyst_nofollow', + 'noarchive' => '_catalyst_noarchive', + ), + 'Frugal' => array( + 'Custom Doctitle' => '_title', + 'META Description' => '_description', + 'META Keywords' => '_keywords', + 'noindex' => '_noindex', + 'nofollow' => '_nofollow', + ), + 'Genesis' => array( + 'Custom Doctitle' => '_genesis_title', + 'META Description' => '_genesis_description', + 'META Keywords' => '_genesis_keywords', + 'noindex' => '_genesis_noindex', + 'nofollow' => '_genesis_nofollow', + 'noarchive' => '_genesis_noarchive', + 'Canonical URI' => '_genesis_canonical_uri', + 'Custom Scripts' => '_genesis_scripts', + 'Redirect URI' => 'redirect', + ), + 'Headway' => array( + 'Custom Doctitle' => '_title', + 'META Description' => '_description', + 'META Keywords' => '_keywords', + ), + 'Hybrid' => array( + 'Custom Doctitle' => 'Title', + 'META Description' => 'Description', + 'META Keywords' => 'Keywords', + ), + 'Thesis 1.x' => array( + 'Custom Doctitle' => 'thesis_title', + 'META Description' => 'thesis_description', + 'META Keywords' => 'thesis_keywords', + 'Custom Scripts' => 'thesis_javascript_scripts', + 'Redirect URI' => 'thesis_redirect', + ), + /* + 'Thesis 2.x' => array( + 'Custom Doctitle' => '_thesis_title_tag', + 'META Description' => '_thesis_meta_description', + 'META Keywords' => '_thesis_meta_keywords', + 'Custom Scripts' => '_thesis_javascript_scripts', + 'Canonical URI' => '_thesis_canonical_link', + 'Redirect URI' => '_thesis_redirect', + ), + */ + 'WooFramework' => array( + 'Custom Doctitle' => 'seo_title', + 'META Description' => 'seo_description', + 'META Keywords' => 'seo_keywords', + ), + ); /** - * Manual analysis test + * The associative array of supported plugins. */ - /* - $aiosp_seometa_analyze = aiosp_seometa_post_meta_analyze( 'All in One SEO Pack', 'Genesis' ); - printf( '

%d Compatible Records were identified

', $aiosp_seometa_analyze->update ); - /**/ + $_aiosp_seometa_plugins = array( + // alphabatized + 'Add Meta Tags' => array( + 'META Description' => 'description', + 'META Keywords' => 'keywords', + ), + 'All in One SEO Pack' => array( + 'Custom Doctitle' => '_aioseop_title', + 'META Description' => '_aioseop_description', + 'META Keywords' => '_aioseop_keywords', + ), + 'Greg\'s High Performance SEO' => array( + 'Custom Doctitle' => '_ghpseo_secondary_title', + 'META Description' => '_ghpseo_alternative_description', + 'META Keywords' => '_ghpseo_keywords', + ), + 'Headspace2' => array( + 'Custom Doctitle' => '_headspace_page_title', + 'META Description' => '_headspace_description', + 'META Keywords' => '_headspace_keywords', + 'Custom Scripts' => '_headspace_scripts', + ), + 'Infinite SEO' => array( + 'Custom Doctitle' => '_wds_title', + 'META Description' => '_wds_metadesc', + 'META Keywords' => '_wds_keywords', + 'noindex' => '_wds_meta-robots-noindex', + 'nofollow' => '_wds_meta-robots-nofollow', + 'Canonical URI' => '_wds_canonical', + 'Redirect URI' => '_wds_redirect', + ), + 'Meta SEO Pack' => array( + 'META Description' => '_msp_description', + 'META Keywords' => '_msp_keywords', + ), + 'Platinum SEO' => array( + 'Custom Doctitle' => 'title', + 'META Description' => 'description', + 'META Keywords' => 'keywords', + ), + 'SEO Title Tag' => array( + 'Custom Doctitle' => 'title_tag', + 'META Description' => 'meta_description', + ), + 'SEO Ultimate' => array( + 'Custom Doctitle' => '_su_title', + 'META Description' => '_su_description', + 'META Keywords' => '_su_keywords', + 'noindex' => '_su_meta_robots_noindex', + 'nofollow' => '_su_meta_robots_nofollow', + ), + 'Yoast SEO' => array( + 'Custom Doctitle' => '_yoast_wpseo_title', + 'META Description' => '_yoast_wpseo_metadesc', + 'META Keywords' => '_yoast_wpseo_metakeywords', + 'noindex' => '_yoast_wpseo_meta-robots-noindex', + 'nofollow' => '_yoast_wpseo_meta-robots-nofollow', + 'Canonical URI' => '_yoast_wpseo_canonical', + 'Redirect URI' => '_yoast_wpseo_redirect', + ), + ); /** - * Delete all SEO data, from every platform + * The combined array of supported platforms. */ - /* - foreach ( $_aiosp_seometa_platforms as $platform => $data ) { + $_aiosp_seometa_platforms = array_merge( $_aiosp_seometa_themes, $_aiosp_seometa_plugins ); - foreach ( $data as $field ) { - $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $field ) ); - printf( '%d %s records deleted
', $deleted, $field ); - } - - } - /**/ + /** + * Include the other elements of the plugin. + */ + // require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' ); + // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' ); /** - * Query all SEO data to find the number of records to change + * Init hook. + * + * Hook fires after plugin functions are loaded. + * + * @since 0.9.10 + * */ + do_action( 'aiosp_seometa_import' ); + +} + +/** + * Activation Hook + * @since 0.9.4 + */ +register_activation_hook( __FILE__, 'aiosp_seometa_activation_hook' ); +function aiosp_seometa_activation_hook() { + + // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' ); + + aiosp_seometa_meta_key_convert( '_yoast_seo_title', 'yoast_wpseo_title', true ); + aiosp_seometa_meta_key_convert( '_yoast_seo_metadesc', 'yoast_wpseo_metadesc', true ); + +} + +/** + * Manual conversion test + */ +/* +$aiosp_seometa_convert = aiosp_seometa_post_meta_convert( 'All in One SEO Pack', 'Genesis', false ); +printf( '%d records were updated', $aiosp_seometa_convert->updated ); +/**/ + +/** + * Manual analysis test + */ +/* +$aiosp_seometa_analyze = aiosp_seometa_post_meta_analyze( 'All in One SEO Pack', 'Genesis' ); +printf( '

%d Compatible Records were identified

', $aiosp_seometa_analyze->update ); +/**/ + +/** + * Delete all SEO data, from every platform + */ +/* +foreach ( $_aiosp_seometa_platforms as $platform => $data ) { + + foreach ( $data as $field ) { + $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $field ) ); + printf( '%d %s records deleted
', $deleted, $field ); + } + +} +/**/ + +/** + * Query all SEO data to find the number of records to change + */ diff --git a/wp-content/plugins/all-in-one-seo-pack/aioseop-init.php b/wp-content/plugins/all-in-one-seo-pack/aioseop-init.php new file mode 100755 index 0000000000..8e205b8236 --- /dev/null +++ b/wp-content/plugins/all-in-one-seo-pack/aioseop-init.php @@ -0,0 +1,7 @@ +log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log'; + $this->log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log'; // PHP <5.3 compatibility, once we drop support we can use __DIR___. - if ( !empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] ) + if ( ! empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] ) { $this->do_log = true; - else + } else { $this->do_log = false; + } - $this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ); + $this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ); $this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' ); - $this->prefix = 'aiosp_'; // option prefix - $this->option_name = 'aioseop_options'; + $this->prefix = 'aiosp_'; // Option prefix. + $this->option_name = 'aioseop_options'; $this->store_option = true; - $this->file = __FILE__; // the current file - $blog_name = esc_attr( get_bloginfo( 'name' ) ); + $this->file = __FILE__; // The current file. + $blog_name = esc_attr( get_bloginfo( 'name' ) ); parent::__construct(); - $this->help_text = Array( - "donate" => __( "All donations support continued development of this free software.", 'all-in-one-seo-pack'), - "license_key" => __( "This will be the license key received when the product was purchased. This is used for automatic upgrades.", 'all-in-one-seo-pack'), - "can" => __( "This option will automatically generate Canonical URLs for your entire WordPress installation. This will help to prevent duplicate content penalties by Google.", 'all-in-one-seo-pack'), - "no_paged_canonical_links"=> __( "Checking this option will set the Canonical URL for all paginated content to the first page.", 'all-in-one-seo-pack'), - "customize_canonical_links"=> __( "Checking this option will allow you to customize Canonical URLs for specific posts.", 'all-in-one-seo-pack'), - "can_set_protocol" => __( "Set protocol for canonical URLs.", 'all-in-one-seo-pack' ), - "use_original_title" => __( "Use wp_title to get the title used by the theme; this is disabled by default. If you use this option, set your title formats appropriately, as your theme might try to do its own title SEO as well.", 'all-in-one-seo-pack' ), - "do_log" => __( "Check this and All in One SEO Pack will create a log of important events (all-in-one-seo-pack.log) in its plugin directory which might help debugging. Make sure this directory is writable.", 'all-in-one-seo-pack' ), - "home_title" => __( "As the name implies, this will be the Meta Title of your homepage. This is independent of any other option. If not set, the default Site Title (found in WordPress under Settings, General, Site Title) will be used.", 'all-in-one-seo-pack' ), - "home_description" => __( "This will be the Meta Description for your homepage. This is independent of any other option. The default is no Meta Description at all if this is not set.", 'all-in-one-seo-pack' ), - "home_keywords" => __( "Enter a comma separated list of your most important keywords for your site that will be written as Meta Keywords on your homepage. Don\'t stuff everything in here.", 'all-in-one-seo-pack' ), - "use_static_home_info" => __( "Checking this option uses the title, description, and keywords set on your static Front Page.", 'all-in-one-seo-pack' ), - "togglekeywords" => __( "This option allows you to toggle the use of Meta Keywords throughout the whole of the site.", 'all-in-one-seo-pack' ), - "use_categories" => __( "Check this if you want your categories for a given post used as the Meta Keywords for this post (in addition to any keywords you specify on the Edit Post screen).", 'all-in-one-seo-pack' ), - "use_tags_as_keywords" => __( "Check this if you want your tags for a given post used as the Meta Keywords for this post (in addition to any keywords you specify on the Edit Post screen).", 'all-in-one-seo-pack' ), - "dynamic_postspage_keywords"=> __( "Check this if you want your keywords on your Posts page (set in WordPress under Settings, Reading, Front Page Displays) and your archive pages to be dynamically generated from the keywords of the posts showing on that page. If unchecked, it will use the keywords set in the edit page screen for the posts page.", 'all-in-one-seo-pack'), - "rewrite_titles" => __( "Note that this is all about the title tag. This is what you see in your browser's window title bar. This is NOT visible on a page, only in the title bar and in the source code. If enabled, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: Using the default post title format below, Rewrite Titles will write all post titles as 'Post Title | Blog Name'. If you have manually defined a title using All in One SEO Pack, this will become the title of your post in the format string.", 'all-in-one-seo-pack' ), - "cap_titles" => __( "Check this and Search Page Titles and Tag Page Titles will have the first letter of each word capitalized.", 'all-in-one-seo-pack' ), - "cap_cats" => __( "Check this and Category Titles will have the first letter of each word capitalized.", 'all-in-one-seo-pack'), - "home_page_title_format" => - __( "This controls the format of the title tag for your Home Page.
The following macros are supported:", 'all-in-one-seo-pack' ) + $this->help_text = array( + 'donate' => __( 'All donations support continued development of this free software.', 'all-in-one-seo-pack' ), + 'license_key' => __( 'This will be the license key received when the product was purchased. This is used for automatic upgrades.', 'all-in-one-seo-pack' ), + 'can' => __( "This option will automatically generate Canonical URLs for your entire WordPress installation. This will help to prevent duplicate content penalties by Google.", 'all-in-one-seo-pack' ), + 'no_paged_canonical_links' => __( 'Checking this option will set the Canonical URL for all paginated content to the first page.', 'all-in-one-seo-pack' ), + 'customize_canonical_links' => __( 'Checking this option will allow you to customize Canonical URLs for specific posts.', 'all-in-one-seo-pack' ), + 'can_set_protocol' => __( 'Set protocol for canonical URLs.', 'all-in-one-seo-pack' ), + 'use_original_title' => __( 'Use wp_title to get the title used by the theme; this is disabled by default. If you use this option, set your title formats appropriately, as your theme might try to do its own title SEO as well.', 'all-in-one-seo-pack' ), + 'do_log' => __( 'Check this and All in One SEO Pack will create a log of important events (all-in-one-seo-pack.log) in its plugin directory which might help debugging. Make sure this directory is writable.', 'all-in-one-seo-pack' ), + 'home_title' => __( 'As the name implies, this will be the Meta Title of your homepage. This is independent of any other option. If not set, the default Site Title (found in WordPress under Settings, General, Site Title) will be used.', 'all-in-one-seo-pack' ), + 'home_description' => __( 'This will be the Meta Description for your homepage. This is independent of any other option. The default is no Meta Description at all if this is not set.', 'all-in-one-seo-pack' ), + 'home_keywords' => __( 'Enter a comma separated list of your most important keywords for your site that will be written as Meta Keywords on your homepage. Do not stuff everything in here.', 'all-in-one-seo-pack' ), + 'use_static_home_info' => __( 'Checking this option uses the title, description, and keywords set on your static Front Page.', 'all-in-one-seo-pack' ), + 'togglekeywords' => __( 'This option allows you to toggle the use of Meta Keywords throughout the whole of the site.', 'all-in-one-seo-pack' ), + 'use_categories' => __( 'Check this if you want your categories for a given post used as the Meta Keywords for this post (in addition to any keywords you specify on the Edit Post screen).', 'all-in-one-seo-pack' ), + 'use_tags_as_keywords' => __( 'Check this if you want your tags for a given post used as the Meta Keywords for this post (in addition to any keywords you specify on the Edit Post screen).', 'all-in-one-seo-pack' ), + 'dynamic_postspage_keywords' => __( 'Check this if you want your keywords on your Posts page (set in WordPress under Settings, Reading, Front Page Displays) and your archive pages to be dynamically generated from the keywords of the posts showing on that page. If unchecked, it will use the keywords set in the edit page screen for the posts page.', 'all-in-one-seo-pack' ), + 'rewrite_titles' => __( "Note that this is all about the title tag. This is what you see in your browser's window title bar. This is NOT visible on a page, only in the title bar and in the source code. If enabled, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: Using the default post title format below, Rewrite Titles will write all post titles as 'Post Title | Blog Name'. If you have manually defined a title using All in One SEO Pack, this will become the title of your post in the format string.", 'all-in-one-seo-pack' ), + 'cap_titles' => __( 'Check this and Search Page Titles and Tag Page Titles will have the first letter of each word capitalized.', 'all-in-one-seo-pack' ), + 'cap_cats' => __( 'Check this and Category Titles will have the first letter of each word capitalized.', 'all-in-one-seo-pack' ), + 'home_page_title_format' => + __( 'This controls the format of the title tag for your Home Page.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "page_title_format" => - __( "This controls the format of the title tag for Pages.
The following macros are supported:", 'all-in-one-seo-pack' ) + __( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '', + 'page_title_format' => + __( 'This controls the format of the title tag for Pages.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "post_title_format" => - __( "This controls the format of the title tag for Posts.
The following macros are supported:", 'all-in-one-seo-pack' ) + __( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '', + 'post_title_format' => + __( 'This controls the format of the title tag for Posts.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "category_title_format" => - __( "This controls the format of the title tag for Category Archives.
The following macros are supported:", 'all-in-one-seo-pack' ) . + __( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '', + 'category_title_format' => + __( 'This controls the format of the title tag for Category Archives.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "archive_title_format" => - __( "This controls the format of the title tag for Custom Post Archives.
The following macros are supported:", 'all-in-one-seo-pack' ) . + 'archive_title_format' => + __( 'This controls the format of the title tag for Custom Post Archives.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "date_title_format" => - __( "This controls the format of the title tag for Date Archives.
The following macros are supported:", 'all-in-one-seo-pack' ) . + 'date_title_format' => + __( 'This controls the format of the title tag for Date Archives.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "author_title_format" => - __( "This controls the format of the title tag for Author Archives.
The following macros are supported:", 'all-in-one-seo-pack' ) . + 'author_title_format' => + __( 'This controls the format of the title tag for Author Archives.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "tag_title_format" => - __( "This controls the format of the title tag for Tag Archives.
The following macros are supported:", 'all-in-one-seo-pack' ) . + 'tag_title_format' => + __( 'This controls the format of the title tag for Tag Archives.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "search_title_format" => - __( "This controls the format of the title tag for the Search page.
The following macros are supported:", 'all-in-one-seo-pack' ) . + 'search_title_format' => + __( 'This controls the format of the title tag for the Search page.
The following macros are supported:', 'all-in-one-seo-pack' ) . '', - "description_format" => __( "This controls the format of Meta Descriptions.The following macros are supported:", 'all-in-one-seo-pack' ) . - '', - "404_title_format" => __( "This controls the format of the title tag for the 404 page.
The following macros are supported:", 'all-in-one-seo-pack' ) . - '', - "paged_format" => __( "This string gets appended/prepended to titles of paged index pages (like home or archive pages).", 'all-in-one-seo-pack' ) - . __( 'The following macros are supported:', 'all-in-one-seo-pack' ) - . '', - "enablecpost" => __( "Check this if you want to use All in One SEO Pack with any Custom Post Types on this site.", 'all-in-one-seo-pack' ), - "cpostadvanced" => __( "This will show or hide the advanced options for SEO for Custom Post Types.", 'all-in-one-seo-pack' ), - "cpostactive" => __( "Use these checkboxes to select which Post Types you want to use All in One SEO Pack with.", 'all-in-one-seo-pack' ), - "taxactive" => __( "Use these checkboxes to select which Taxonomies you want to use All in One SEO Pack with.", 'all-in-one-seo-pack' ), - "cposttitles" => __( "This allows you to set the title tags for each Custom Post Type.", 'all-in-one-seo-pack' ), - "posttypecolumns" => __( "This lets you select which screens display the SEO Title, SEO Keywords and SEO Description columns.", 'all-in-one-seo-pack' ), - "admin_bar" => __( "Check this to add All in One SEO Pack to the Admin Bar for easy access to your SEO settings.", 'all-in-one-seo-pack' ), - "custom_menu_order" => __( "Check this to move the All in One SEO Pack menu item to the top of your WordPress Dashboard menu.", 'all-in-one-seo-pack' ), - "google_verify" => __( "Enter your verification code here to verify your site with Google Webmaster Tools.
Click here for documentation on this setting", 'all-in-one-seo-pack' ), - "bing_verify" => __( "Enter your verification code here to verify your site with Bing Webmaster Tools.
Click here for documentation on this setting", 'all-in-one-seo-pack' ), - "pinterest_verify" => __( "Enter your verification code here to verify your site with Pinterest.
Click here for documentation on this setting", 'all-in-one-seo-pack' ), - "google_publisher" => __( "Enter your Google+ Profile URL here to add the rel=“author” tag to your site for Google authorship. It is recommended that the URL you enter here should be your personal Google+ profile. Use the Advanced Authorship Options below if you want greater control over the use of authorship.", 'all-in-one-seo-pack' ), - "google_disable_profile"=> __( "Check this to remove the Google Plus field from the user profile screen.", 'all-in-one-seo-pack' ), - "google_author_advanced"=> __( "Enable this to display advanced options for controlling Google Plus authorship information on your website.", 'all-in-one-seo-pack' ), - "google_author_location"=> __( "This option allows you to control which types of pages you want to display rel=\"author\" on for Google authorship. The options include the Front Page (the homepage of your site), Posts, Pages, and any Custom Post Types. The Everywhere Else option includes 404, search, categories, tags, custom taxonomies, date archives, author archives and any other page template.", 'all-in-one-seo-pack' ), - "google_enable_publisher"=> __( "This option allows you to control whether rel=\"publisher\" is displayed on the homepage of your site. Google recommends using this if the site is a business website.", 'all-in-one-seo-pack' ), - "google_specify_publisher"=> __( "The Google+ profile you enter here will appear on your homepage only as the rel=\"publisher\" tag. It is recommended that the URL you enter here should be the Google+ profile for your business.", 'all-in-one-seo-pack' ), - "google_sitelinks_search"=> __( "Add markup to display the Google Sitelinks Search Box next to your search results in Google.", 'all-in-one-seo-pack' ), - "google_set_site_name" => __( "Add markup to tell Google the preferred name for your website.", 'all-in-one-seo-pack' ), - "google_connect" => __( "Press the connect button to connect with Google Analytics; or if already connected, press the disconnect button to disable and remove any stored analytics credentials.", 'all-in-one-seo-pack' ), - "google_analytics_id" => __( "Enter your Google Analytics ID here to track visitor behavior on your site using Google Analytics.", 'all-in-one-seo-pack' ), - "ga_use_universal_analytics" => __( "Use the new Universal Analytics tracking code for Google Analytics.", 'all-in-one-seo-pack' ), - "ga_advanced_options" => __( "Check to use advanced Google Analytics options.", 'all-in-one-seo-pack' ), - "ga_domain" => __( "Enter your domain name without the http:// to set your cookie domain.", 'all-in-one-seo-pack' ), - "ga_multi_domain" => __( "Use this option to enable tracking of multiple or additional domains.", 'all-in-one-seo-pack' ), - "ga_addl_domains" => __( "Add a list of additional domains to track here. Enter one domain name per line without the http://.", 'all-in-one-seo-pack' ), - "ga_anonymize_ip" => __( "This enables support for IP Anonymization in Google Analytics.", 'all-in-one-seo-pack' ), - "ga_display_advertising"=> __( "This enables support for the Display Advertiser Features in Google Analytics.", 'all-in-one-seo-pack' ), - "ga_exclude_users" => __( "Exclude logged-in users from Google Analytics tracking by role.", 'all-in-one-seo-pack' ), - "ga_track_outbound_links"=> __( "Check this if you want to track outbound links with Google Analytics.", 'all-in-one-seo-pack' ), - "ga_link_attribution"=> __( "This enables support for the Enhanced Link Attribution in Google Analytics.", 'all-in-one-seo-pack' ), - "ga_enhanced_ecommerce" => __( "This enables support for the Enhanced Ecommerce in Google Analytics.", 'all-in-one-seo-pack' ), - "cpostnoindex" => __( "Set the default NOINDEX setting for each Post Type.", 'all-in-one-seo-pack' ), - "cpostnofollow" => __( "Set the default NOFOLLOW setting for each Post Type.", 'all-in-one-seo-pack' ), - "category_noindex" => __( "Check this to ask search engines not to index Category Archives. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ), - "archive_date_noindex" => __( "Check this to ask search engines not to index Date Archives. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ), - "archive_author_noindex"=> __( "Check this to ask search engines not to index Author Archives. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ), - "tags_noindex" => __( "Check this to ask search engines not to index Tag Archives. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ), - "search_noindex" => __( "Check this to ask search engines not to index the Search page. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ), - "404_noindex" => __( "Check this to ask search engines not to index the 404 page.", 'all-in-one-seo-pack' ), - "tax_noindex" => __( "Check this to ask search engines not to index custom Taxonomy archive pages. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ), - "paginated_noindex" => __( "Check this to ask search engines not to index paginated pages/posts. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ), - "paginated_nofollow" => __( "Check this to ask search engines not to follow links from paginated pages/posts. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ), - 'noodp' => __( 'Check this box to ask search engines not to use descriptions from the Open Directory Project for your entire site.', 'all-in-one-seo-pack' ), - 'cpostnoodp' => __( "Set the default noodp setting for each Post Type.", 'all-in-one-seo-pack' ), - 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for your entire site.', 'all-in-one-seo-pack' ), - 'cpostnoydir' => __( "Set the default noydir setting for each Post Type.", 'all-in-one-seo-pack' ), - "skip_excerpt" => __( "Check this and your Meta Descriptions won't be generated from the excerpt.", 'all-in-one-seo-pack' ), - "generate_descriptions" => __( "Check this and your Meta Descriptions will be auto-generated from your excerpt or content.", 'all-in-one-seo-pack' ), - "run_shortcodes" => __( "Check this and shortcodes will get executed for descriptions auto-generated from content.", 'all-in-one-seo-pack' ), - "hide_paginated_descriptions"=> __( "Check this and your Meta Descriptions will be removed from page 2 or later of paginated content.", 'all-in-one-seo-pack' ), - "dont_truncate_descriptions"=> __( "Check this to prevent your Description from being truncated regardless of its length.", 'all-in-one-seo-pack' ), - "schema_markup"=> __( "Check this to support Schema.org markup, i.e., itemprop on supported metadata.", 'all-in-one-seo-pack' ), - "unprotect_meta" => __( "Check this to unprotect internal postmeta fields for use with XMLRPC. If you don't know what that is, leave it unchecked.", 'all-in-one-seo-pack' ), - "ex_pages" => __( "Enter a comma separated list of pages here to be excluded by All in One SEO Pack. This is helpful when using plugins which generate their own non-WordPress dynamic pages. Ex: /forum/, /contact/ For instance, if you want to exclude the virtual pages generated by a forum plugin, all you have to do is add forum or /forum or /forum/ or and any URL with the word \"forum\" in it, such as http://mysite.com/forum or http://mysite.com/forum/someforumpage here and it will be excluded from All in One SEO Pack.", 'all-in-one-seo-pack' ), - "post_meta_tags" => __( "What you enter here will be copied verbatim to the header of all Posts. You can enter whatever additional headers you want here, even references to stylesheets.", 'all-in-one-seo-pack' ), - "page_meta_tags" => __( "What you enter here will be copied verbatim to the header of all Pages. You can enter whatever additional headers you want here, even references to stylesheets.", 'all-in-one-seo-pack' ), - "front_meta_tags" => __( "What you enter here will be copied verbatim to the header of the front page if you have set a static page in Settings, Reading, Front Page Displays. You can enter whatever additional headers you want here, even references to stylesheets. This will fall back to using Additional Page Headers if you have them set and nothing is entered here.", 'all-in-one-seo-pack' ), - "home_meta_tags" => __( "What you enter here will be copied verbatim to the header of the home page if you have Front page displays your latest posts selected in Settings, Reading.  It will also be copied verbatim to the header on the Posts page if you have one set in Settings, Reading. You can enter whatever additional headers you want here, even references to stylesheets.", 'all-in-one-seo-pack' ), + 'description_format' => __( 'This controls the format of Meta Descriptions.The following macros are supported:', 'all-in-one-seo-pack' ) . + '', + '404_title_format' => __( 'This controls the format of the title tag for the 404 page.
The following macros are supported:', 'all-in-one-seo-pack' ) . + '', + 'paged_format' => __( 'This string gets appended/prepended to titles of paged index pages (like home or archive pages).', 'all-in-one-seo-pack' ) + . __( 'The following macros are supported:', 'all-in-one-seo-pack' ) + . '', + 'enablecpost' => __( 'Check this if you want to use All in One SEO Pack with any Custom Post Types on this site.', 'all-in-one-seo-pack' ), + 'cpostadvanced' => __( 'This will show or hide the advanced options for SEO for Custom Post Types.', 'all-in-one-seo-pack' ), + 'cpostactive' => __( 'Use these checkboxes to select which Post Types you want to use All in One SEO Pack with.', 'all-in-one-seo-pack' ), + 'taxactive' => __( 'Use these checkboxes to select which Taxonomies you want to use All in One SEO Pack with.', 'all-in-one-seo-pack' ), + 'cposttitles' => __( 'This allows you to set the title tags for each Custom Post Type.', 'all-in-one-seo-pack' ), + 'posttypecolumns' => __( 'This lets you select which screens display the SEO Title, SEO Keywords and SEO Description columns.', 'all-in-one-seo-pack' ), + 'admin_bar' => __( 'Check this to add All in One SEO Pack to the Admin Bar for easy access to your SEO settings.', 'all-in-one-seo-pack' ), + 'custom_menu_order' => __( 'Check this to move the All in One SEO Pack menu item to the top of your WordPress Dashboard menu.', 'all-in-one-seo-pack' ), + 'google_verify' => __( "Enter your verification code here to verify your site with Google Webmaster Tools.
Click here for documentation on this setting", 'all-in-one-seo-pack' ), + 'bing_verify' => __( "Enter your verification code here to verify your site with Bing Webmaster Tools.
Click here for documentation on this setting", 'all-in-one-seo-pack' ), + 'pinterest_verify' => __( "Enter your verification code here to verify your site with Pinterest.
Click here for documentation on this setting", 'all-in-one-seo-pack' ), + 'google_publisher' => __( 'Enter your Google+ Profile URL here to add the rel=“author” tag to your site for Google authorship. It is recommended that the URL you enter here should be your personal Google+ profile. Use the Advanced Authorship Options below if you want greater control over the use of authorship.', 'all-in-one-seo-pack' ), + 'google_disable_profile' => __( 'Check this to remove the Google Plus field from the user profile screen.', 'all-in-one-seo-pack' ), + 'google_author_advanced' => __( 'Enable this to display advanced options for controlling Google Plus authorship information on your website.', 'all-in-one-seo-pack' ), + 'google_author_location' => __( 'This option allows you to control which types of pages you want to display rel=\"author\" on for Google authorship. The options include the Front Page (the homepage of your site), Posts, Pages, and any Custom Post Types. The Everywhere Else option includes 404, search, categories, tags, custom taxonomies, date archives, author archives and any other page template.', 'all-in-one-seo-pack' ), + 'google_enable_publisher' => __( 'This option allows you to control whether rel=\"publisher\" is displayed on the homepage of your site. Google recommends using this if the site is a business website.', 'all-in-one-seo-pack' ), + 'google_specify_publisher' => __( 'The Google+ profile you enter here will appear on your homepage only as the rel=\"publisher\" tag. It is recommended that the URL you enter here should be the Google+ profile for your business.', 'all-in-one-seo-pack' ), + 'google_sitelinks_search' => __( 'Add markup to display the Google Sitelinks Search Box next to your search results in Google.', 'all-in-one-seo-pack' ), + 'google_set_site_name' => __( 'Add markup to tell Google the preferred name for your website.', 'all-in-one-seo-pack' ), + 'google_connect' => __( 'Press the connect button to connect with Google Analytics; or if already connected, press the disconnect button to disable and remove any stored analytics credentials.', 'all-in-one-seo-pack' ), + 'google_analytics_id' => __( 'Enter your Google Analytics ID here to track visitor behavior on your site using Google Analytics.', 'all-in-one-seo-pack' ), + 'ga_use_universal_analytics' => __( 'Use the new Universal Analytics tracking code for Google Analytics.', 'all-in-one-seo-pack' ), + 'ga_advanced_options' => __( 'Check to use advanced Google Analytics options.', 'all-in-one-seo-pack' ), + 'ga_domain' => __( 'Enter your domain name without the http:// to set your cookie domain.', 'all-in-one-seo-pack' ), + 'ga_multi_domain' => __( 'Use this option to enable tracking of multiple or additional domains.', 'all-in-one-seo-pack' ), + 'ga_addl_domains' => __( 'Add a list of additional domains to track here. Enter one domain name per line without the http://.', 'all-in-one-seo-pack' ), + 'ga_anonymize_ip' => __( 'This enables support for IP Anonymization in Google Analytics.', 'all-in-one-seo-pack' ), + 'ga_display_advertising' => __( 'This enables support for the Display Advertiser Features in Google Analytics.', 'all-in-one-seo-pack' ), + 'ga_exclude_users' => __( 'Exclude logged-in users from Google Analytics tracking by role.', 'all-in-one-seo-pack' ), + 'ga_track_outbound_links' => __( 'Check this if you want to track outbound links with Google Analytics.', 'all-in-one-seo-pack' ), + 'ga_link_attribution' => __( 'This enables support for the Enhanced Link Attribution in Google Analytics.', 'all-in-one-seo-pack' ), + 'ga_enhanced_ecommerce' => __( 'This enables support for the Enhanced Ecommerce in Google Analytics.', 'all-in-one-seo-pack' ), + 'cpostnoindex' => __( 'Set the default NOINDEX setting for each Post Type.', 'all-in-one-seo-pack' ), + 'cpostnofollow' => __( 'Set the default NOFOLLOW setting for each Post Type.', 'all-in-one-seo-pack' ), + + 'category_noindex' => __( 'Check this to ask search engines not to index Category Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ), + 'archive_date_noindex' => __( 'Check this to ask search engines not to index Date Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ), + 'archive_author_noindex' => __( 'Check this to ask search engines not to index Author Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ), + 'tags_noindex' => __( 'Check this to ask search engines not to index Tag Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ), + 'search_noindex' => __( 'Check this to ask search engines not to index the Search page. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ), + '404_noindex' => __( 'Check this to ask search engines not to index the 404 page.', 'all-in-one-seo-pack' ), + 'tax_noindex' => __( 'Check this to ask search engines not to index custom Taxonomy archive pages. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ), + 'paginated_noindex' => __( 'Check this to ask search engines not to index paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ), + 'paginated_nofollow' => __( 'Check this to ask search engines not to follow links from paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ), + 'noodp' => __( 'Check this box to ask search engines not to use descriptions from the Open Directory Project for your entire site.', 'all-in-one-seo-pack' ), + 'cpostnoodp' => __( 'Set the default noodp setting for each Post Type.', 'all-in-one-seo-pack' ), + 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for your entire site.', 'all-in-one-seo-pack' ), + 'cpostnoydir' => __( 'Set the default noydir setting for each Post Type.', 'all-in-one-seo-pack' ), + 'skip_excerpt' => __( "Check this and your Meta Descriptions won't be generated from the excerpt.", 'all-in-one-seo-pack' ), + 'generate_descriptions' => __( 'Check this and your Meta Descriptions will be auto-generated from your excerpt or content.', 'all-in-one-seo-pack' ), + 'run_shortcodes' => __( 'Check this and shortcodes will get executed for descriptions auto-generated from content.', 'all-in-one-seo-pack' ), + 'hide_paginated_descriptions' => __( 'Check this and your Meta Descriptions will be removed from page 2 or later of paginated content.', 'all-in-one-seo-pack' ), + 'dont_truncate_descriptions' => __( 'Check this to prevent your Description from being truncated regardless of its length.', 'all-in-one-seo-pack' ), + 'schema_markup' => __( 'Check this to support Schema.org markup, i.e., itemprop on supported metadata.', 'all-in-one-seo-pack' ), + 'unprotect_meta' => __( "Check this to unprotect internal postmeta fields for use with XMLRPC. If you don't know what that is, leave it unchecked.", 'all-in-one-seo-pack' ), + 'ex_pages' => __( 'Enter a comma separated list of pages here to be excluded by All in One SEO Pack. This is helpful when using plugins which generate their own non-WordPress dynamic pages. Ex: /forum/, /contact/ For instance, if you want to exclude the virtual pages generated by a forum plugin, all you have to do is add forum or /forum or /forum/ or and any URL with the word \"forum\" in it, such as http://mysite.com/forum or http://mysite.com/forum/someforumpage here and it will be excluded from All in One SEO Pack.', 'all-in-one-seo-pack' ), + 'post_meta_tags' => __( 'What you enter here will be copied verbatim to the header of all Posts. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ), + 'page_meta_tags' => __( 'What you enter here will be copied verbatim to the header of all Pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ), + 'front_meta_tags' => __( 'What you enter here will be copied verbatim to the header of the front page if you have set a static page in Settings, Reading, Front Page Displays. You can enter whatever additional headers you want here, even references to stylesheets. This will fall back to using Additional Page Headers if you have them set and nothing is entered here.', 'all-in-one-seo-pack' ), + 'home_meta_tags' => __( 'What you enter here will be copied verbatim to the header of the home page if you have Front page displays your latest posts selected in Settings, Reading.  It will also be copied verbatim to the header on the Posts page if you have one set in Settings, Reading. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ), ); - $this->help_anchors = Array( - 'license_key' => '#license-key', - 'can' => '#canonical-urls', - 'no_paged_canonical_links' => '#no-pagination-for-canonical-urls', - 'customize_canonical_links' => '#enable-custom-canonical-urls', - 'use_original_title' => '#use-original-title', - 'schema_markup' => '#use-schema-markup', - 'do_log' => '#log-important-events', - 'home_title' => '#home-title', - 'home_description' => '#home-description', - 'home_keywords' => '#home-keywords', - 'togglekeywords' => '#use-keywords', - 'use_categories' => '#use-categories-for-meta-keywords', - 'use_tags_as_keywords' => '#use-tags-for-meta-keywords', - 'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page', - 'rewrite_titles' => '#rewrite-titles', - 'cap_titles' => '#capitalize-titles', - 'home_page_title_format' => '#title-format-fields', - 'page_title_format' => '#title-format-fields', - 'post_title_format' => '#title-format-fields', - 'category_title_format' => '#title-format-fields', - 'archive_title_format' => '#title-format-fields', - 'date_title_format' => '#title-format-fields', - 'author_title_format' => '#title-format-fields', - 'tag_title_format' => '#title-format-fields', - 'search_title_format' => '#title-format-fields', - '404_title_format' => '#title-format-fields', - 'enablecpost' => '#seo-for-custom-post-types', - 'cpostadvanced' => '#enable-advanced-options', - 'cpostactive' => '#seo-on-only-these-post-types', - 'taxactive' => '#seo-on-only-these-taxonomies', - 'cposttitles' => '#custom-titles', - 'posttypecolumns' => '#show-column-labels-for-custom-post-types', - 'admin_bar' => '#display-menu-in-admin-bar', - 'custom_menu_order' => '#display-menu-at-the-top', - 'google_verify' => '', - 'bing_verify' => '', - 'pinterest_verify' => '', - 'google_publisher' => '#google-plus-default-profile', - 'google_disable_profile' => '#disable-google-plus-profile', - 'google_author_advanced' => '#advanced-authorship-options', - 'google_author_location' => '#display-google-authorship', - 'google_enable_publisher' => '#display-publisher-meta-on-front-page', - 'google_specify_publisher' => '#specify-publisher-url', - 'google_analytics_id' => 'http://semperplugins.com/documentation/setting-up-google-analytics/', - 'ga_use_universal_analytics' => '#use-universal-analytics', - 'ga_domain' => '#tracking-domain', - 'ga_multi_domain' => '#track-multiple-domains-additional-domains', - 'ga_addl_domains' => '#track-multiple-domains-additional-domains', - 'ga_anonymize_ip' => '#anonymize-ip-addresses', - 'ga_display_advertising' => '#display-advertiser-tracking', - 'ga_exclude_users' => '#exclude-users-from-tracking', - 'ga_track_outbound_links' => '#track-outbound-links', - 'ga_link_attribution' => '#enhanced-link-attribution', - 'ga_enhanced_ecommerce' => '#enhanced-ecommerce', - 'cpostnoindex' => '#use-noindex-for-paginated-pages-posts', - 'cpostnofollow' => '#use-nofollow-for-paginated-pages-posts', - 'noodp' => '#exclude-site-from-the-open-directory-project', - 'noydir' => '#exclude-site-from-yahoo-directory', - 'generate_descriptions' => '#autogenerate-descriptions', - 'run_shortcodes' => '#run-shortcodes-in-autogenerated-descriptions', + $this->help_anchors = array( + 'license_key' => '#license-key', + 'can' => '#canonical-urls', + 'no_paged_canonical_links' => '#no-pagination-for-canonical-urls', + 'customize_canonical_links' => '#enable-custom-canonical-urls', + 'can_set_protocol' => '#set-protocol-for-canonical-urls', + 'use_original_title' => '#use-original-title', + 'schema_markup' => '#use-schema-markup', + 'do_log' => '#log-important-events', + 'home_title' => '#home-title', + 'home_description' => '#home-description', + 'home_keywords' => '#home-keywords', + 'use_static_home_info' => '#use-static-front-page-instead', + 'togglekeywords' => '#use-keywords', + 'use_categories' => '#use-categories-for-meta-keywords', + 'use_tags_as_keywords' => '#use-tags-for-meta-keywords', + 'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page', + 'rewrite_titles' => '#rewrite-titles', + 'cap_titles' => '#capitalize-titles', + 'cap_cats' => '#capitalize-titles', + 'home_page_title_format' => '#title-format-fields', + 'page_title_format' => '#title-format-fields', + 'post_title_format' => '#title-format-fields', + 'category_title_format' => '#title-format-fields', + 'archive_title_format' => '#title-format-fields', + 'date_title_format' => '#title-format-fields', + 'author_title_format' => '#title-format-fields', + 'tag_title_format' => '#title-format-fields', + 'search_title_format' => '#title-format-fields', + 'description_format' => '#title-format-fields', + '404_title_format' => '#title-format-fields', + 'paged_format' => '#title-format-fields', + 'enablecpost' => '#seo-for-custom-post-types', + 'cpostadvanced' => '#enable-advanced-options', + 'cpostactive' => '#seo-on-only-these-post-types', + 'taxactive' => '#seo-on-only-these-taxonomies', + 'cposttitles' => '#custom-titles', + 'posttypecolumns' => '#show-column-labels-for-custom-post-types', + 'admin_bar' => '#display-menu-in-admin-bar', + 'custom_menu_order' => '#display-menu-at-the-top', + 'google_verify' => '', + 'bing_verify' => '', + 'pinterest_verify' => '', + 'google_publisher' => '#google-plus-default-profile', + 'google_disable_profile' => '#disable-google-plus-profile', + 'google_sitelinks_search' => '#display-sitelinks-search-box', + 'google_set_site_name' => '#set-preferred-site-name', + 'google_author_advanced' => '#advanced-authorship-options', + 'google_author_location' => '#display-google-authorship', + 'google_enable_publisher' => '#display-publisher-meta-on-front-page', + 'google_specify_publisher' => '#specify-publisher-url', + 'google_analytics_id' => 'http://semperplugins.com/documentation/setting-up-google-analytics/', + 'ga_use_universal_analytics' => '#use-universal-analytics', + 'ga_domain' => '#tracking-domain', + 'ga_multi_domain' => '#track-multiple-domains-additional-domains', + 'ga_addl_domains' => '#track-multiple-domains-additional-domains', + 'ga_anonymize_ip' => '#anonymize-ip-addresses', + 'ga_display_advertising' => '#display-advertiser-tracking', + 'ga_exclude_users' => '#exclude-users-from-tracking', + 'ga_track_outbound_links' => '#track-outbound-links', + 'ga_link_attribution' => '#enhanced-link-attribution', + 'ga_enhanced_ecommerce' => '#enhanced-ecommerce', + 'cpostnoindex' => '#noindex', + 'cpostnofollow' => '#nofollow', + 'cpostnoodp' => '#noodp', + 'cpostnoydir' => '#noydir', + 'category_noindex' => '#noindex-settings', + 'archive_date_noindex' => '#noindex-settings', + 'archive_author_noindex' => '#noindex-settings', + 'tags_noindex' => '#noindex-settings', + 'search_noindex' => '#use-noindex-for-the-search-page', + '404_noindex' => '#use-noindex-for-the-404-page', + 'tax_noindex' => '#use-noindex-for-the-taxonomy-archives', + 'paginated_noindex' => '#use-noindex-for-paginated-pages-posts', + 'paginated_nofollow' => '#use-nofollow-for-paginated-pages-posts', + 'noodp' => '#exclude-site-from-the-open-directory-project', + 'noydir' => '#exclude-site-from-yahoo-directory', + 'skip_excerpt' => '#avoid-using-the-excerpt-in-descriptions', + 'generate_descriptions' => '#autogenerate-descriptions', + 'run_shortcodes' => '#run-shortcodes-in-autogenerated-descriptions', 'hide_paginated_descriptions' => '#remove-descriptions-for-paginated-pages', - 'dont_truncate_descriptions' => '#never-shorten-long-descriptions', - 'unprotect_meta' => '#unprotect-post-meta-fields', - 'ex_pages' => '#exclude-pages', - 'post_meta_tags' => '#additional-post-headers', - 'page_meta_tags' => '#additional-page-headers', - 'front_meta_tags' => '#additional-front-page-headers', - 'home_meta_tags' => '#additional-blog-page-headers' + 'dont_truncate_descriptions' => '#never-shorten-long-descriptions', + 'unprotect_meta' => '#unprotect-post-meta-fields', + 'ex_pages' => '#exclude-pages', + 'post_meta_tags' => '#additional-post-headers', + 'page_meta_tags' => '#additional-page-headers', + 'front_meta_tags' => '#additional-front-page-headers', + 'home_meta_tags' => '#additional-blog-page-headers', ); - $meta_help_text = Array( - 'snippet' => __( 'A preview of what this page might look like in search engine results.', 'all-in-one-seo-pack' ), - 'title' => __( 'A custom title that shows up in the title tag for this page.', 'all-in-one-seo-pack' ), - 'description' => __( 'The META description for this page. This will override any autogenerated descriptions.', 'all-in-one-seo-pack' ), - 'keywords' => __( 'A comma separated list of your most important keywords for this page that will be written as META keywords.', 'all-in-one-seo-pack' ), - 'custom_link' => __( "Override the canonical URLs for this post.", 'all-in-one-seo-pack'), - 'noindex' => __( 'Check this box to ask search engines not to index this page.', 'all-in-one-seo-pack' ), - 'nofollow' => __( 'Check this box to ask search engines not to follow links from this page.', 'all-in-one-seo-pack' ), - 'noodp' => __( 'Check this box to ask search engines not to use descriptions from the Open Directory Project for this page.', 'all-in-one-seo-pack' ), - 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for this page.', 'all-in-one-seo-pack' ), - 'titleatr' => __( 'Set the title attribute for menu links.', 'all-in-one-seo-pack' ), - 'menulabel' => __( 'Set the label for this page menu item.', 'all-in-one-seo-pack' ), - 'sitemap_exclude' => __( "Don't display this page in the sitemap.", 'all-in-one-seo-pack' ), - 'disable' => __( 'Disable SEO on this page.', 'all-in-one-seo-pack' ), - 'disable_analytics' => __( 'Disable Google Analytics on this page.', 'all-in-one-seo-pack' ) + $meta_help_text = array( + 'snippet' => __( 'A preview of what this page might look like in search engine results.', 'all-in-one-seo-pack' ), + 'title' => __( 'A custom title that shows up in the title tag for this page.', 'all-in-one-seo-pack' ), + 'description' => __( 'The META description for this page. This will override any autogenerated descriptions.', 'all-in-one-seo-pack' ), + 'keywords' => __( 'A comma separated list of your most important keywords for this page that will be written as META keywords.', 'all-in-one-seo-pack' ), + 'custom_link' => __( 'Override the canonical URLs for this post.', 'all-in-one-seo-pack' ), + 'noindex' => __( 'Check this box to ask search engines not to index this page.', 'all-in-one-seo-pack' ), + 'nofollow' => __( 'Check this box to ask search engines not to follow links from this page.', 'all-in-one-seo-pack' ), + 'noodp' => __( 'Check this box to ask search engines not to use descriptions from the Open Directory Project for this page.', 'all-in-one-seo-pack' ), + 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for this page.', 'all-in-one-seo-pack' ), + 'titleatr' => __( 'Set the title attribute for menu links.', 'all-in-one-seo-pack' ), + 'menulabel' => __( 'Set the label for this page menu item.', 'all-in-one-seo-pack' ), + 'sitemap_exclude' => __( "Don't display this page in the sitemap.", 'all-in-one-seo-pack' ), + 'disable' => __( 'Disable SEO on this page.', 'all-in-one-seo-pack' ), + 'disable_analytics' => __( 'Disable Google Analytics on this page.', 'all-in-one-seo-pack' ), ); $this->default_options = array( - "license_key" => Array( + 'license_key' => array( 'name' => __( 'License Key:', 'all-in-one-seo-pack' ), - 'type' => 'text' ), - "donate" => Array( - 'name' => __( 'I enjoy this plugin and have made a donation:', 'all-in-one-seo-pack' ) ), - "home_title"=> Array( - 'name' => __( 'Home Title:', 'all-in-one-seo-pack' ), - 'default' => null, 'type' => 'textarea', 'sanitize' => 'text', - 'count' => true, 'rows' => 1, 'cols' => 60, - 'condshow' => Array( "aiosp_use_static_home_info" => 0 ) ), - "home_description"=> Array( - 'name' => __( 'Home Description:', 'all-in-one-seo-pack' ), - 'default' => '', 'type' => 'textarea', 'sanitize' => 'text', - 'count' => true, 'cols' => 80, 'rows' => 2, - 'condshow' => Array( "aiosp_use_static_home_info" => 0 ) ), - "togglekeywords" => Array( - 'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ), - 'default' => 1, - 'type' => 'radio', - 'initial_options' => Array( 0 => __( 'Enabled', 'all-in-one-seo-pack' ), - 1 => __( 'Disabled', 'all-in-one-seo-pack' ) ) - ), - "home_keywords"=> Array( - 'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ), - 'default' => null, 'type' => 'textarea', 'sanitize' => 'text', - 'condshow' => Array( "aiosp_togglekeywords" => 0, "aiosp_use_static_home_info" => 0 ) ), - "use_static_home_info" => Array( - 'name' => __( "Use Static Front Page Instead", 'all-in-one-seo-pack' ), - 'default' => 0, - 'type' => 'radio', - 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ) - ), - "can"=> Array( - 'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ), - 'default' => 1), - "no_paged_canonical_links"=> Array( - 'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ), - 'default' => 0, - 'condshow' => Array( "aiosp_can" => 'on' ) ), - "customize_canonical_links" => Array( - 'name' => __( 'Enable Custom Canonical URLs:', 'all-in-one-seo-pack' ), - 'default' => 0, - 'condshow' => Array( "aiosp_can" => 'on' ) ), - "can_set_protocol" => Array( - 'name' => __( 'Set Protocol For Canonical URLs:', 'all-in-one-seo-pack' ), - 'type' => 'radio', - 'default' => 'auto', - 'initial_options' => Array( 'auto' => __( 'Auto', 'all-in-one-seo-pack' ), - 'http' => __( 'HTTP', 'all-in-one-seo-pack' ), - 'https' => __( 'HTTPS', 'all-in-one-seo-pack' ) ), - 'condshow' => Array( "aiosp_can" => 'on' ) + 'type' => 'text', + ), + 'donate' => array( + 'name' => __( 'I enjoy this plugin and have made a donation:', 'all-in-one-seo-pack' ), + ), + 'home_title' => array( + 'name' => __( 'Home Title:', 'all-in-one-seo-pack' ), + 'default' => null, + 'type' => 'textarea', + 'sanitize' => 'text', + 'count' => true, + 'rows' => 1, + 'cols' => 60, + 'condshow' => array( 'aiosp_use_static_home_info' => 0 ), + ), + 'home_description' => array( + 'name' => __( 'Home Description:', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'sanitize' => 'text', + 'count' => true, + 'cols' => 80, + 'rows' => 2, + 'condshow' => array( 'aiosp_use_static_home_info' => 0 ), + ), + 'togglekeywords' => array( + 'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ), + 'default' => 1, + 'type' => 'radio', + 'initial_options' => array( + 0 => __( 'Enabled', 'all-in-one-seo-pack' ), + 1 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "rewrite_titles"=> Array( - 'name' => __( 'Rewrite Titles:', 'all-in-one-seo-pack' ), - 'default' => 1, - 'type' => 'radio', - 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ) + ), + 'home_keywords' => array( + 'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ), + 'default' => null, + 'type' => 'textarea', + 'sanitize' => 'text', + 'condshow' => array( 'aiosp_togglekeywords' => 0, 'aiosp_use_static_home_info' => 0 ), + ), + 'use_static_home_info' => array( + 'name' => __( 'Use Static Front Page Instead', 'all-in-one-seo-pack' ), + 'default' => 0, + 'type' => 'radio', + 'initial_options' => array( + 1 => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "force_rewrites"=> Array( - 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ), + ), + 'can' => array( + 'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ), 'default' => 1, - 'type' => 'hidden', - 'prefix' => $this->prefix, - 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ) + ), + 'no_paged_canonical_links' => array( + 'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( 'aiosp_can' => 'on' ), + ), + 'customize_canonical_links' => array( + 'name' => __( 'Enable Custom Canonical URLs:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( 'aiosp_can' => 'on' ), + ), + 'can_set_protocol' => array( + 'name' => __( 'Set Protocol For Canonical URLs:', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'default' => 'auto', + 'initial_options' => array( + 'auto' => __( 'Auto', 'all-in-one-seo-pack' ), + 'http' => __( 'HTTP', 'all-in-one-seo-pack' ), + 'https' => __( 'HTTPS', 'all-in-one-seo-pack' ), ), - "use_original_title"=> Array( - 'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ), - 'type' => 'radio', - 'default' => 0, - 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ) + 'condshow' => array( 'aiosp_can' => 'on' ), + ), + 'rewrite_titles' => array( + 'name' => __( 'Rewrite Titles:', 'all-in-one-seo-pack' ), + 'default' => 1, + 'type' => 'radio', + 'initial_options' => array( + 1 => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "cap_titles"=> Array( - 'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ), 'default' => 1), - "cap_cats"=> Array( - 'name' => __( 'Capitalize Category Titles:', 'all-in-one-seo-pack' ), 'default' => 1), - "home_page_title_format"=> Array( - 'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%page_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "page_title_format"=> Array( - 'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%page_title% | %blog_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "post_title_format"=> Array( - 'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%post_title% | %blog_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "category_title_format"=> Array( - 'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%category_title% | %blog_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "archive_title_format"=> Array( - 'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%archive_title% | %blog_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "date_title_format"=> Array( - 'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%date% | %blog_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "author_title_format"=> Array( - 'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%author% | %blog_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "tag_title_format"=> Array( - 'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%tag% | %blog_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "search_title_format"=> Array( - 'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%search% | %blog_title%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "description_format"=> Array( - 'name' => __( 'Description Format', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '%description%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "404_title_format"=> Array( - 'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => 'Nothing found for %request_words%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "paged_format"=> Array( - 'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => ' - Part %page%', - 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ), - "enablecpost"=> Array( - 'name' => __( 'SEO for Custom Post Types:', 'all-in-one-seo-pack' ), - 'default' => 'on', - 'type' => 'radio', - 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ) + ), + 'force_rewrites' => array( + 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ), + 'default' => 1, + 'type' => 'hidden', + 'prefix' => $this->prefix, + 'initial_options' => array( + 1 => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "cpostactive" => Array( - 'name' => __( 'SEO on only these post types:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => array('post', 'page'), - 'condshow' => Array( 'aiosp_enablecpost' => 'on' ) + ), + 'use_original_title' => array( + 'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'default' => 0, + 'initial_options' => array( + 1 => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "taxactive" => Array( - 'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => array('category', 'post_tag'), - 'condshow' => Array( 'aiosp_enablecpost' => 'on' ) + ), + 'cap_titles' => array( + 'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ), + 'default' => 1, + ), + 'cap_cats' => array( + 'name' => __( 'Capitalize Category Titles:', 'all-in-one-seo-pack' ), + 'default' => 1, + ), + 'home_page_title_format' => array( + 'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%page_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'page_title_format' => array( + 'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%page_title% | %blog_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'post_title_format' => array( + 'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%post_title% | %blog_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'category_title_format' => array( + 'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%category_title% | %blog_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'archive_title_format' => array( + 'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%archive_title% | %blog_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'date_title_format' => array( + 'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%date% | %blog_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'author_title_format' => array( + 'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%author% | %blog_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'tag_title_format' => array( + 'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%tag% | %blog_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'search_title_format' => array( + 'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%search% | %blog_title%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'description_format' => array( + 'name' => __( 'Description Format', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '%description%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + '404_title_format' => array( + 'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => 'Nothing found for %request_words%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'paged_format' => array( + 'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => ' - Part %page%', + 'condshow' => array( 'aiosp_rewrite_titles' => 1 ), + ), + 'enablecpost' => array( + 'name' => __( 'SEO for Custom Post Types:', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'type' => 'radio', + 'initial_options' => array( + 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "cpostadvanced" => Array( - 'name' => __( 'Enable Advanced Options:', 'all-in-one-seo-pack' ), - 'default' => 0, 'type' => 'radio', - 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ), - 'label' => null, - 'condshow' => Array( "aiosp_enablecpost" => 'on' ) + ), + 'cpostactive' => array( + 'name' => __( 'SEO on only these post types:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array( 'post', 'page' ), + 'condshow' => array( 'aiosp_enablecpost' => 'on' ), + ), + 'taxactive' => array( + 'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array( 'category', 'post_tag' ), + 'condshow' => array( 'aiosp_enablecpost' => 'on' ), + ), + 'cpostadvanced' => array( + 'name' => __( 'Enable Advanced Options:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'type' => 'radio', + 'initial_options' => array( + 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "cpostnoindex" => Array( - 'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => array(), + 'label' => null, + 'condshow' => array( 'aiosp_enablecpost' => 'on' ), + ), + 'cpostnoindex' => array( + 'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array(), + ), + 'cpostnofollow' => array( + 'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array(), + ), + 'cpostnoodp' => array( + 'name' => __( 'Default to NOODP:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array(), + ), + 'cpostnoydir' => array( + 'name' => __( 'Default to NOYDIR:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array(), + ), + 'cposttitles' => array( + 'name' => __( 'Custom titles:', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + 'default' => 0, + 'condshow' => array( + 'aiosp_rewrite_titles' => 1, + 'aiosp_enablecpost' => 'on', + 'aiosp_cpostadvanced' => 'on', ), - "cpostnofollow" => Array( - 'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => array(), + ), + 'posttypecolumns' => array( + 'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array( 'post', 'page' ), + 'condshow' => array( 'aiosp_enablecpost' => 'on' ), + ), + 'admin_bar' => array( + 'name' => __( 'Display Menu In Admin Bar:', 'all-in-one-seo-pack' ), + 'default' => 'on', + ), + 'custom_menu_order' => array( + 'name' => __( 'Display Menu At The Top:', 'all-in-one-seo-pack' ), + 'default' => 'on', + ), + 'google_verify' => array( + 'name' => __( 'Google Webmaster Tools:', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'bing_verify' => array( + 'name' => __( 'Bing Webmaster Center:', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'pinterest_verify' => array( + 'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'google_publisher' => array( + 'name' => __( 'Google Plus Default Profile:', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'google_disable_profile' => array( + 'name' => __( 'Disable Google Plus Profile:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'type' => 'checkbox', + ), + 'google_sitelinks_search' => array( + 'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' ), + ), + 'google_set_site_name' => array( + 'name' => __( 'Set Preferred Site Name:', 'all-in-one-seo-pack' ), + ), + 'google_specify_site_name' => array( + 'name' => __( 'Specify A Preferred Name:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'placeholder' => $blog_name, + 'condshow' => array( 'aiosp_google_set_site_name' => 'on' ), + ), + 'google_author_advanced' => array( + 'name' => __( 'Advanced Authorship Options:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'type' => 'radio', + 'initial_options' => array( + 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "cpostnoodp"=> Array( - 'name' => __( 'Default to NOODP:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => array(), + 'label' => null, + ), + 'google_author_location' => array( + 'name' => __( 'Display Google Authorship:', 'all-in-one-seo-pack' ), + 'default' => array( 'all' ), + 'type' => 'multicheckbox', + 'condshow' => array( 'aiosp_google_author_advanced' => 'on' ), + ), + 'google_enable_publisher' => array( + 'name' => __( 'Display Publisher Meta on Front Page:', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'type' => 'radio', + 'initial_options' => array( + 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "cpostnoydir"=> Array( - 'name' => __( 'Default to NOYDIR:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => array(), + 'condshow' => array( 'aiosp_google_author_advanced' => 'on' ), + ), + 'google_specify_publisher' => array( + 'name' => __( 'Specify Publisher URL:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'condshow' => array( 'aiosp_google_author_advanced' => 'on', 'aiosp_google_enable_publisher' => 'on' ), + ), + // "google_connect"=>array( 'name' => __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ), ), + 'google_analytics_id' => array( + 'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ), + 'default' => null, + 'type' => 'text', + 'placeholder' => 'UA-########-#', + ), + 'ga_use_universal_analytics' => array( + 'name' => __( 'Use Universal Analytics:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), ), - "cposttitles" => Array( - 'name' => __( 'Custom titles:', 'all-in-one-seo-pack' ), - 'type' => 'checkbox', 'default' => 0, - 'condshow' => Array( "aiosp_rewrite_titles" => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' ) + ), + 'ga_advanced_options' => array( + 'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'type' => 'radio', + 'initial_options' => array( + 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), ), - "posttypecolumns" => Array( - 'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => array('post', 'page'), - 'condshow' => Array( 'aiosp_enablecpost' => 'on' ) ), - "admin_bar" => Array( - 'name' => __( 'Display Menu In Admin Bar:', 'all-in-one-seo-pack' ), 'default' => 'on', + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), ), - "custom_menu_order" => Array( - 'name' => __( 'Display Menu At The Top:', 'all-in-one-seo-pack' ), 'default' => 'on', + ), + 'ga_domain' => array( + 'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), + 'aiosp_ga_advanced_options' => 'on', ), - "google_verify" => Array( - 'name' => __( 'Google Webmaster Tools:', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'text' + ), + 'ga_multi_domain' => array( + 'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), + 'aiosp_ga_advanced_options' => 'on', ), - "bing_verify" => Array( - 'name' => __( 'Bing Webmaster Center:', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'text' + ), + 'ga_addl_domains' => array( + 'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), + 'aiosp_ga_advanced_options' => 'on', + 'aiosp_ga_multi_domain' => 'on', ), - "pinterest_verify" => Array( - 'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'text' + ), + 'ga_anonymize_ip' => array( + 'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), + 'aiosp_ga_advanced_options' => 'on', ), - "google_publisher"=> Array( - 'name' => __( 'Google Plus Default Profile:', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'text' + ), + 'ga_display_advertising' => array( + 'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), + 'aiosp_ga_advanced_options' => 'on', ), - "google_disable_profile"=> Array( - 'name' => __( 'Disable Google Plus Profile:', 'all-in-one-seo-pack' ), 'default' => 0, 'type' => 'checkbox' + ), + 'ga_exclude_users' => array( + 'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), + 'aiosp_ga_advanced_options' => 'on', ), - "google_sitelinks_search" => Array( - 'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' ) - ), - "google_set_site_name" => Array( - 'name' => __( 'Set Preferred Site Name:', 'all-in-one-seo-pack' ) - ), - "google_specify_site_name" => Array( - 'name' => __( 'Specify A Preferred Name:', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'placeholder' => $blog_name, - 'condshow' => Array( 'aiosp_google_set_site_name' => 'on' ) - ), - "google_author_advanced" => Array( - 'name' => __( 'Advanced Authorship Options:', 'all-in-one-seo-pack' ), - 'default' => 0, 'type' => 'radio', - 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ), - 'label' => null + ), + 'ga_track_outbound_links' => array( + 'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', ), - "google_author_location"=> Array( - 'name' => __( 'Display Google Authorship:', 'all-in-one-seo-pack' ), 'default' => array( 'all' ), 'type' => 'multicheckbox', - 'condshow' => Array( 'aiosp_google_author_advanced' => 'on' ) + 'aiosp_ga_advanced_options' => 'on', ), - "google_enable_publisher" => Array( - 'name' => __( 'Display Publisher Meta on Front Page:', 'all-in-one-seo-pack' ), - 'default' => 'on', 'type' => 'radio', - 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ), - 'condshow' => Array( 'aiosp_google_author_advanced' => 'on' ) + ), + 'ga_link_attribution' => array( + 'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), + 'aiosp_ga_advanced_options' => 'on', ), - "google_specify_publisher" => Array( - 'name' => __( 'Specify Publisher URL:', 'all-in-one-seo-pack' ), 'type' => 'text', - 'condshow' => Array( 'aiosp_google_author_advanced' => 'on', 'aiosp_google_enable_publisher' => 'on' ) + ), + 'ga_enhanced_ecommerce' => array( + 'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( + 'aiosp_google_analytics_id' => array( + 'lhs' => 'aiosp_google_analytics_id', + 'op' => '!=', + 'rhs' => '', + ), + 'aiosp_ga_use_universal_analytics' => 'on', + 'aiosp_ga_advanced_options' => 'on', ), -// "google_connect"=>Array( 'name' => __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ), ), - "google_analytics_id"=> Array( - 'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ), - 'default' => null, 'type' => 'text', 'placeholder' => 'UA-########-#' ), - "ga_use_universal_analytics" => Array( - 'name' => __( 'Use Universal Analytics:', 'all-in-one-seo-pack' ), + ), + 'use_categories' => array( + 'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( 'aiosp_togglekeywords' => 0 ), + ), + 'use_tags_as_keywords' => array( + 'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ), + 'default' => 1, + 'condshow' => array( 'aiosp_togglekeywords' => 0 ), + ), + 'dynamic_postspage_keywords' => array( + 'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ), + 'default' => 1, + 'condshow' => array( 'aiosp_togglekeywords' => 0 ), + ), + 'category_noindex' => array( + 'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ), + 'default' => 1, + ), + 'archive_date_noindex' => array( + 'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ), + 'default' => 1, + ), + 'archive_author_noindex' => array( + 'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ), + 'default' => 1, + ), + 'tags_noindex' => array( + 'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ), 'default' => 0, - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ) ) ), - "ga_advanced_options"=> Array( - 'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ), - 'default' => 'on', - 'type' => 'radio', - 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ), - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ) ) ), - "ga_domain"=> Array( - 'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on') ), - "ga_multi_domain"=> Array( - 'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ), + ), + 'search_noindex' => array( + 'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ), + 'default' => 0, + ), + '404_noindex' => array( + 'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ), + 'default' => 0, + ), + 'tax_noindex' => array( + 'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array(), + 'condshow' => array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' ), + ), + 'paginated_noindex' => array( + 'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ), 'default' => 0, - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ), - "ga_addl_domains" => Array( - 'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ), - 'type' => 'textarea', - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on', 'aiosp_ga_multi_domain' => 'on' ) ), - "ga_anonymize_ip"=> Array( - 'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ), - 'type' => 'checkbox', - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ), - "ga_display_advertising"=> Array( - 'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ), - 'type' => 'checkbox', - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ), - "ga_exclude_users"=> Array( - 'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ), - "ga_track_outbound_links"=> Array( - 'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ), + ), + 'paginated_nofollow' => array( + 'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ), 'default' => 0, - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ), - "ga_link_attribution"=> Array( - 'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ), + ), + 'noodp' => array( + 'name' => __( 'Exclude site from the Open Directory Project:', 'all-in-one-seo-pack' ), 'default' => 0, - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ), - "ga_enhanced_ecommerce"=> Array( - 'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ), + ), + 'noydir' => array( + 'name' => __( 'Exclude site from Yahoo! Directory:', 'all-in-one-seo-pack' ), 'default' => 0, - 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_use_universal_analytics' => 'on', 'aiosp_ga_advanced_options' => 'on' ) ), - "use_categories"=> Array( - 'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ), + ), + 'skip_excerpt' => array( + 'name' => __( 'Avoid Using The Excerpt In Descriptions:', 'all-in-one-seo-pack' ), 'default' => 0, - 'condshow' => Array( "aiosp_togglekeywords" => 0 ) ), - "use_tags_as_keywords" => Array( - 'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ), + ), + 'generate_descriptions' => array( + 'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ), 'default' => 1, - 'condshow' => Array( "aiosp_togglekeywords" => 0 ) ), - "dynamic_postspage_keywords"=> Array( - 'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ), + ), + 'run_shortcodes' => array( + 'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ), + 'default' => 0, + 'condshow' => array( 'aiosp_generate_descriptions' => 'on' ), + ), + 'hide_paginated_descriptions' => array( + 'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ), + 'default' => 0, + ), + 'dont_truncate_descriptions' => array( + 'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ), + 'default' => 0, + ), + 'schema_markup' => array( + 'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ), 'default' => 1, - 'condshow' => Array( "aiosp_togglekeywords" => 0 ) ), - "category_noindex"=> Array( - 'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ), - 'default' => 1), - "archive_date_noindex"=> Array( - 'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ), - 'default' => 1), - "archive_author_noindex"=> Array( - 'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ), - 'default' => 1), - "tags_noindex"=> Array( - 'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ), - 'default' => 0), - "search_noindex"=> Array( - 'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ), - 'default' => 0), - "404_noindex"=> Array( - 'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ), - 'default' => 0), - "tax_noindex"=> Array( - 'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => array(), - 'condshow' => Array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' ) - ), - "paginated_noindex" => Array( - 'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ), - 'default' => 0), - "paginated_nofollow"=> Array( - 'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ), - 'default' => 0), - "noodp"=> Array( - 'name' => __( 'Exclude site from the Open Directory Project:', 'all-in-one-seo-pack' ), - 'default' => 0), - "noydir"=> Array( - 'name' => __( 'Exclude site from Yahoo! Directory:', 'all-in-one-seo-pack' ), - 'default' => 0), - "skip_excerpt"=> Array( - 'name' => __( 'Avoid Using The Excerpt In Descriptions:', 'all-in-one-seo-pack' ), - 'default' => 0 ), - "generate_descriptions"=> Array( - 'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ), - 'default' => 1), - "run_shortcodes"=> Array( - 'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ), + ), + 'unprotect_meta' => array( + 'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ), 'default' => 0, - 'condshow' => Array( 'aiosp_generate_descriptions' => 'on' ) ), - "hide_paginated_descriptions"=> Array( - 'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ), - 'default' => 0), - "dont_truncate_descriptions"=> Array( - 'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ), - 'default' => 0), - "schema_markup"=> Array( - 'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ), - 'default' => 1), - "unprotect_meta"=> Array( - 'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ), - 'default' => 0), - "ex_pages" => Array( - 'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ), - 'type' => 'textarea', 'default' => '' ), - "post_meta_tags"=> Array( - 'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ), - 'type' => 'textarea', 'default' => '', 'sanitize' => 'default' ), - "page_meta_tags"=> Array( - 'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ), - 'type' => 'textarea', 'default' => '', 'sanitize' => 'default' ), - "front_meta_tags"=> Array( - 'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ), - 'type' => 'textarea', 'default' => '', 'sanitize' => 'default' ), - "home_meta_tags"=> Array( - 'name' => __( 'Additional Blog Page Headers:', 'all-in-one-seo-pack' ), - 'type' => 'textarea', 'default' => '', 'sanitize' => 'default' ), - "do_log"=> Array( - 'name' => __( 'Log important events:', 'all-in-one-seo-pack' ), - 'default' => null ), - ); + ), + 'ex_pages' => array( + 'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'default' => '', + ), + 'post_meta_tags' => array( + 'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'default' => '', + 'sanitize' => 'default', + ), + 'page_meta_tags' => array( + 'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'default' => '', + 'sanitize' => 'default', + ), + 'front_meta_tags' => array( + 'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'default' => '', + 'sanitize' => 'default', + ), + 'home_meta_tags' => array( + 'name' => __( 'Additional Blog Page Headers:', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'default' => '', + 'sanitize' => 'default', + ), + 'do_log' => array( + 'name' => __( 'Log important events:', 'all-in-one-seo-pack' ), + 'default' => null, + ), + ); - if ( AIOSEOPPRO ) { - unset($this->default_options['donate']); - } else { - unset($this->default_options['license_key']); - unset($this->default_options['taxactive']); - } - - $this->locations = Array( - 'default' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings', 'options' => null ), - 'aiosp' => Array( 'name' => $this->plugin_name, 'type' => 'metabox', 'prefix' => '', 'help_link' => 'http://semperplugins.com/sections/postpage-settings/', - 'options' => Array( 'edit', 'nonce-aioseop-edit', AIOSEOPPRO ? 'support' : 'upgrade' , 'snippet', 'title', 'description', 'keywords', 'custom_link', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel', 'sitemap_exclude', 'disable', 'disable_analytics' ), - 'default_options' => Array( - 'edit' => Array( 'type' => 'hidden', 'default' => 'aiosp_edit', 'prefix' => true, 'nowrap' => 1 ), - 'nonce-aioseop-edit' => Array( 'type' => 'hidden', 'default' => null, 'prefix' => false, 'nowrap' => 1 ), - 'upgrade' => Array( 'type' => 'html', 'label' => 'none', - 'default' => aiosp_common::get_upgrade_hyperlink( 'meta', __('Upgrade to All in One SEO Pack Pro Version', 'all-in-one-seo-pack'), __('UPGRADE TO PRO VERSION', 'all-in-one-seo-pack'), '_blank' ) - ), - 'support' => Array( 'type' => 'html', 'label' => 'none', - 'default' => '' - . __( 'Support Forum', 'all-in-one-seo-pack' ) . '' - ), - 'snippet' => Array( 'name' => __( 'Preview Snippet', 'all-in-one-seo-pack' ), 'type' => 'custom', 'label' => 'top', - 'default' => ' + if ( AIOSEOPPRO ) { + unset( $this->default_options['donate'] ); + } else { + unset( $this->default_options['license_key'] ); + unset( $this->default_options['taxactive'] ); + } + + $this->locations = array( + 'default' => array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings', 'options' => null ), + 'aiosp' => array( + 'name' => $this->plugin_name, + 'type' => 'metabox', + 'prefix' => '', + 'help_link' => 'http://semperplugins.com/sections/postpage-settings/', + 'options' => array( + 'edit', + 'nonce-aioseop-edit', + AIOSEOPPRO ? 'support' : 'upgrade', + 'snippet', + 'title', + 'description', + 'keywords', + 'custom_link', + 'noindex', + 'nofollow', + 'noodp', + 'noydir', + 'titleatr', + 'menulabel', + 'sitemap_exclude', + 'disable', + 'disable_analytics', + ), + 'default_options' => array( + 'edit' => array( + 'type' => 'hidden', + 'default' => 'aiosp_edit', + 'prefix' => true, + 'nowrap' => 1, + ), + 'nonce-aioseop-edit' => array( + 'type' => 'hidden', + 'default' => null, + 'prefix' => false, + 'nowrap' => 1, + ), + 'upgrade' => array( + 'type' => 'html', + 'label' => 'none', + 'default' => aiosp_common::get_upgrade_hyperlink( 'meta', __( 'Upgrade to All in One SEO Pack Pro Version', 'all-in-one-seo-pack' ), __( 'UPGRADE TO PRO VERSION', 'all-in-one-seo-pack' ), '_blank' ), + ), + 'support' => array( + 'type' => 'html', + 'label' => 'none', + 'default' => '' + . __( 'Support Forum', 'all-in-one-seo-pack' ) . '', + ), + 'snippet' => array( + 'name' => __( 'Preview Snippet', 'all-in-one-seo-pack' ), + 'type' => 'custom', + 'label' => 'top', + 'default' => ' -

%s

%s
%s
' ), - 'title' => Array( 'name' => __( 'Title', 'all-in-one-seo-pack' ), 'type' => 'text', 'count' => true, 'size' => 60 ), - 'description' => Array( 'name' => __( 'Description', 'all-in-one-seo-pack' ), 'type' => 'textarea', 'count' => true, 'cols' => 80, 'rows' => 2 ), - - 'keywords' => Array( 'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ), 'type' => 'text' ), - 'custom_link' => Array( 'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ), - 'noindex' => Array( 'name' => __( "Robots Meta NOINDEX", 'all-in-one-seo-pack' ), 'default' => '' ), - 'nofollow' => Array( 'name' => __( "Robots Meta NOFOLLOW", 'all-in-one-seo-pack' ), 'default' => '' ), - 'noodp' => Array( 'name' => __( "Robots Meta NOODP", 'all-in-one-seo-pack' ) ), - 'noydir' => Array( 'name' => __( "Robots Meta NOYDIR", 'all-in-one-seo-pack' ) ), - 'titleatr' => Array( 'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ), - 'menulabel' => Array( 'name' => __( 'Menu Label', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ), - 'sitemap_exclude' => Array( 'name' => __( 'Exclude From Sitemap', 'all-in-one-seo-pack' ) ), - 'disable' => Array( 'name' => __( 'Disable on this page/post', 'all-in-one-seo-pack' ) ), - 'disable_analytics' => Array( 'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ), 'condshow' => Array( 'aiosp_disable' => 'on' ) ) ), - 'display' => null ) - ); - - if ( !empty( $meta_help_text ) ) - foreach( $meta_help_text as $k => $v ) - $this->locations['aiosp']['default_options'][$k]['help_text'] = $v; - - $this->layout = Array( - 'default' => Array( - 'name' => __( 'General Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/general-settings/', - 'options' => Array() // this is set below, to the remaining options -- pdb +

%s

%s
%s
', ), - 'home' => Array( - 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/home-page-settings/', - 'options' => Array( 'home_title', 'home_description', 'home_keywords', 'use_static_home_info' ) + 'title' => array( + 'name' => __( 'Title', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'count' => true, + 'size' => 60, ), - 'title' => Array( - 'name' => __( 'Title Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/title-settings/', - 'options' => Array( "rewrite_titles", "force_rewrites", "cap_titles", "cap_cats", "home_page_title_format", "page_title_format", "post_title_format", "category_title_format", "archive_title_format", "date_title_format", "author_title_format", - "tag_title_format", "search_title_format", "description_format", "404_title_format", "paged_format" ) + 'description' => array( + 'name' => __( 'Description', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'count' => true, + 'cols' => 80, + 'rows' => 2, ), - 'cpt' => Array( - 'name' => __( 'Custom Post Type Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/custom-post-type-settings/', - 'options' => Array( "enablecpost", "cpostadvanced", "taxactive","cpostactive", "cposttitles" ) + + 'keywords' => array( + 'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ), + 'type' => 'text', + ), + 'custom_link' => array( + 'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'size' => 60, ), - 'display' => Array( - 'name' => __( 'Display Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/display-settings/', - 'options' => Array( "posttypecolumns", "admin_bar", "custom_menu_order" ) + 'noindex' => array( + 'name' => __( 'Robots Meta NOINDEX', 'all-in-one-seo-pack' ), + 'default' => '', ), - 'webmaster' => Array( - 'name' => __( 'Webmaster Verification', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/sections/webmaster-verification/', - 'options' => Array( "google_verify", "bing_verify", "pinterest_verify" ) + 'nofollow' => array( + 'name' => __( 'Robots Meta NOFOLLOW', 'all-in-one-seo-pack' ), + 'default' => '', ), - 'google' => Array( - 'name' => __( 'Google Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/google-settings/', - 'options' => Array( "google_publisher", "google_disable_profile", "google_sitelinks_search", "google_set_site_name", "google_specify_site_name", "google_author_advanced", "google_author_location", "google_enable_publisher" , "google_specify_publisher", - // "google_connect", - "google_analytics_id", "ga_use_universal_analytics", "ga_advanced_options", "ga_domain", "ga_multi_domain", "ga_addl_domains", "ga_anonymize_ip", "ga_display_advertising", "ga_exclude_users", "ga_track_outbound_links", "ga_link_attribution", "ga_enhanced_ecommerce" ) + 'noodp' => array( 'name' => __( 'Robots Meta NOODP', 'all-in-one-seo-pack' ) ), + 'noydir' => array( 'name' => __( 'Robots Meta NOYDIR', 'all-in-one-seo-pack' ) ), + 'titleatr' => array( + 'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'size' => 60, ), - 'noindex' => Array( - 'name' => __( 'Noindex Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/noindex-settings/', - 'options' => Array( 'cpostnoindex', 'cpostnofollow', 'cpostnoodp', 'cpostnoydir', 'category_noindex', 'archive_date_noindex', 'archive_author_noindex', 'tags_noindex', 'search_noindex', '404_noindex', 'tax_noindex', 'paginated_noindex', 'paginated_nofollow', 'noodp', 'noydir' ) + 'menulabel' => array( + 'name' => __( 'Menu Label', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'size' => 60, ), - 'advanced' => Array( - 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/advanced-settings/', - 'options' => Array( 'generate_descriptions', 'skip_excerpt', 'run_shortcodes', 'hide_paginated_descriptions', 'dont_truncate_descriptions', 'unprotect_meta', 'ex_pages', 'post_meta_tags', 'page_meta_tags', 'front_meta_tags', 'home_meta_tags' ) + 'sitemap_exclude' => array( 'name' => __( 'Exclude From Sitemap', 'all-in-one-seo-pack' ) ), + 'disable' => array( 'name' => __( 'Disable on this page/post', 'all-in-one-seo-pack' ) ), + 'disable_analytics' => array( + 'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ), + 'condshow' => array( 'aiosp_disable' => 'on' ), ), - 'keywords' => Array( - 'name' => __( 'Keyword Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/keyword-settings/', - 'options' => Array( "togglekeywords", "use_categories", "use_tags_as_keywords", "dynamic_postspage_keywords" ) - ) - ); + ), + 'display' => null, + ), + ); - if(!AIOSEOPPRO){ - unset($this->layout['cpt']['options']['2']); - } + if ( ! empty( $meta_help_text ) ) { + foreach ( $meta_help_text as $k => $v ) { + $this->locations['aiosp']['default_options'][ $k ]['help_text'] = $v; + } + } + + $this->layout = array( + 'default' => array( + 'name' => __( 'General Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/general-settings/', + 'options' => array(), // This is set below, to the remaining options -- pdb. + ), + 'home' => array( + 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/home-page-settings/', + 'options' => array( 'home_title', 'home_description', 'home_keywords', 'use_static_home_info' ), + ), + 'title' => array( + 'name' => __( 'Title Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/title-settings/', + 'options' => array( + 'rewrite_titles', + 'force_rewrites', + 'cap_titles', + 'cap_cats', + 'home_page_title_format', + 'page_title_format', + 'post_title_format', + 'category_title_format', + 'archive_title_format', + 'date_title_format', + 'author_title_format', + 'tag_title_format', + 'search_title_format', + 'description_format', + '404_title_format', + 'paged_format', + ), + ), + 'cpt' => array( + 'name' => __( 'Custom Post Type Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/custom-post-type-settings/', + 'options' => array( 'enablecpost', 'cpostadvanced', 'taxactive', 'cpostactive', 'cposttitles' ), + ), + 'display' => array( + 'name' => __( 'Display Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/display-settings/', + 'options' => array( 'posttypecolumns', 'admin_bar', 'custom_menu_order' ), + ), + 'webmaster' => array( + 'name' => __( 'Webmaster Verification', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/sections/webmaster-verification/', + 'options' => array( 'google_verify', 'bing_verify', 'pinterest_verify' ), + ), + 'google' => array( + 'name' => __( 'Google Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/google-settings/', + 'options' => array( + 'google_publisher', + 'google_disable_profile', + 'google_sitelinks_search', + 'google_set_site_name', + 'google_specify_site_name', + 'google_author_advanced', + 'google_author_location', + 'google_enable_publisher', + 'google_specify_publisher', + // "google_connect", + 'google_analytics_id', + 'ga_use_universal_analytics', + 'ga_advanced_options', + 'ga_domain', + 'ga_multi_domain', + 'ga_addl_domains', + 'ga_anonymize_ip', + 'ga_display_advertising', + 'ga_exclude_users', + 'ga_track_outbound_links', + 'ga_link_attribution', + 'ga_enhanced_ecommerce', + ), + ), + 'noindex' => array( + 'name' => __( 'Noindex Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/noindex-settings/', + 'options' => array( + 'cpostnoindex', + 'cpostnofollow', + 'cpostnoodp', + 'cpostnoydir', + 'category_noindex', + 'archive_date_noindex', + 'archive_author_noindex', + 'tags_noindex', + 'search_noindex', + '404_noindex', + 'tax_noindex', + 'paginated_noindex', + 'paginated_nofollow', + 'noodp', + 'noydir', + ), + ), + 'advanced' => array( + 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/advanced-settings/', + 'options' => array( + 'generate_descriptions', + 'skip_excerpt', + 'run_shortcodes', + 'hide_paginated_descriptions', + 'dont_truncate_descriptions', + 'unprotect_meta', + 'ex_pages', + 'post_meta_tags', + 'page_meta_tags', + 'front_meta_tags', + 'home_meta_tags', + ), + ), + 'keywords' => array( + 'name' => __( 'Keyword Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/keyword-settings/', + 'options' => array( + 'togglekeywords', + 'use_categories', + 'use_tags_as_keywords', + 'dynamic_postspage_keywords', + ), + ), + ); + + if ( ! AIOSEOPPRO ) { + unset( $this->layout['cpt']['options']['2'] ); + } - $other_options = Array(); - foreach( $this->layout as $k => $v ) - $other_options = array_merge( $other_options, $v['options'] ); + $other_options = array(); + foreach ( $this->layout as $k => $v ) { + $other_options = array_merge( $other_options, $v['options'] ); + } + + $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options ); - $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options ); + if ( is_admin() ) { + $this->add_help_text_links(); + add_action( 'aioseop_global_settings_header', array( $this, 'display_right_sidebar' ) ); + add_action( 'aioseop_global_settings_footer', array( $this, 'display_settings_footer' ) ); + add_action( 'output_option', array( $this, 'custom_output_option' ), 10, 2 ); + add_action( 'all_admin_notices', array( $this, 'visibility_warning' ) ); - if ( is_admin() ) { - $this->add_help_text_links(); - add_action( "aioseop_global_settings_header", Array( $this, 'display_right_sidebar' ) ); - add_action( "aioseop_global_settings_footer", Array( $this, 'display_settings_footer' ) ); - add_action( "output_option", Array( $this, 'custom_output_option' ), 10, 2 ); - add_action('all_admin_notices', array( $this, 'visibility_warning')); - - if(!AIOSEOPPRO){ + if ( ! AIOSEOPPRO ) { // add_action('all_admin_notices', array( $this, 'woo_upgrade_notice')); - } - } - if(AIOSEOPPRO){ - add_action( 'split_shared_term', Array( $this, 'split_shared_term' ), 10, 4 ); - } - } + } + } + if ( AIOSEOPPRO ) { + add_action( 'split_shared_term', array( $this, 'split_shared_term' ), 10, 4 ); + } + } -//good candidate for pro dir - function get_all_term_data( $term_id ) { - $terms = Array(); - $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' ); - foreach( $optlist as $f ) { - $meta = get_term_meta( $term_id, '_aioseop_' . $f, true ); - if ( !empty( $meta ) ) { - $terms['_aioseop_' . $f] = $meta; + //good candidate for pro dir + + /** + * Use custom callback for outputting snippet + * + * @param $buf + * @param $args + * + * @return string + */ + function custom_output_option( $buf, $args ) { + if ( 'aiosp_snippet' === $args['name'] ) { + $args['options']['type'] = 'html'; + $args['options']['nowrap'] = false; + $args['options']['save'] = false; + $info = $this->get_page_snippet_info(); + extract( $info ); + } else { + return ''; + } + + if ( $this->strlen( $title ) > 70 ) { + $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...'; + } + if ( $this->strlen( $description ) > 156 ) { + $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...'; + } + $extra_title_len = 0; + if ( empty( $title_format ) ) { + $title = '' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . ''; + } else { + if ( strpos( $title_format, '%blog_title%' ) !== false ) { + $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format ); + } + $title_format = $this->apply_cf_fields( $title_format ); + $replace_title = '' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . ''; + if ( strpos( $title_format, '%post_title%' ) !== false ) { + $title_format = str_replace( '%post_title%', $replace_title, $title_format ); + } + if ( strpos( $title_format, '%page_title%' ) !== false ) { + $title_format = str_replace( '%page_title%', $replace_title, $title_format ); + } + if ( $w->is_category || $w->is_tag || $w->is_tax ) { + if ( AIOSEOPPRO && ! empty( $_GET ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) { + $term_id = intval( $_GET['tag_ID'] ); + $was_split = get_term_meta( $term_id, '_aioseop_term_was_split', true ); + if ( ! $was_split ) { + $split_terms = wp_get_split_terms( $term_id, $_GET['taxonomy'] ); + if ( ! empty( $split_terms ) ) { + foreach ( $split_terms as $new_tax => $new_term ) { + $this->split_shared_term( $term_id, $new_term ); + } } } - return $terms; } - -//good candidate for pro dir - function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id = '', $taxonomy = '' ) { - $terms = $this->get_all_term_data( $term_id ); - if ( !empty( $terms ) ) { - $new_terms = $this->get_all_term_data( $new_term_id ); - if ( empty( $new_terms ) ) { - foreach( $terms as $k => $v ) { - add_term_meta( $new_term_id, $k, $v, true ); + if ( strpos( $title_format, '%category_title%' ) !== false ) { + $title_format = str_replace( '%category_title%', $replace_title, $title_format ); + } + if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) { + $title_format = str_replace( '%taxonomy_title%', $replace_title, $title_format ); + } + } else { + if ( strpos( $title_format, '%category%' ) !== false ) { + $title_format = str_replace( '%category%', $category, $title_format ); + } + if ( strpos( $title_format, '%category_title%' ) !== false ) { + $title_format = str_replace( '%category_title%', $category, $title_format ); + } + if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) { + $title_format = str_replace( '%taxonomy_title%', $category, $title_format ); + } + if ( AIOSEOPPRO ) { + if ( strpos( $title_format, '%tax_' ) && ! empty( $p ) ) { + $taxes = get_object_taxonomies( $p, 'objects' ); + if ( ! empty( $taxes ) ) { + foreach ( $taxes as $t ) { + if ( strpos( $title_format, "%tax_{$t->name}%" ) ) { + $terms = $this->get_all_terms( $p->ID, $t->name ); + $term = ''; + if ( count( $terms ) > 0 ) { + $term = $terms[0]; + } + $title_format = str_replace( "%tax_{$t->name}%", $term, $title_format ); + } } - add_term_meta( $term_id, '_aioseop_term_was_split', true, true ); } } + } } + if ( strpos( $title_format, '%taxonomy_description%' ) !== false ) { + $title_format = str_replace( '%taxonomy_description%', $description, $title_format ); + } + + $title_format = preg_replace( '/%([^%]*?)%/', '', $title_format ); + $title = $title_format; + $extra_title_len = strlen( str_replace( $replace_title, '', $title_format ) ); + } + + $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( wp_strip_all_tags( $description ) ) ); + $extra_title_len = (int) $extra_title_len; + $args['value'] .= ""; + $buf = $this->get_option_row( $args['name'], $args['options'], $args ); + + return $buf; + } +//good candidate for pro dir + + /** + * @return array + */ function get_page_snippet_info() { - static $info = Array(); - if ( !empty( $info ) ) + static $info = array(); + if ( ! empty( $info ) ) { return $info; + } global $post, $aioseop_options, $wp_query; $title = $url = $description = $term = $category = ''; - $p = $post; $w = $wp_query; - if ( !is_object( $post ) ) $post = $this->get_queried_object(); - if ( empty( $this->meta_opts ) ) - $this->meta_opts = $this->get_current_options( Array(), 'aiosp' ); - if ( !is_object( $post ) && is_admin() && !empty( $_GET ) && !empty( $_GET['post_type'] ) && !empty( $_GET['taxonomy'] ) && !empty( $_GET['tag_ID'] ) ) { + $p = $post; + $w = $wp_query; + if ( ! is_object( $post ) ) { + $post = $this->get_queried_object(); + } + if ( empty( $this->meta_opts ) ) { + $this->meta_opts = $this->get_current_options( array(), 'aiosp' ); + } + if ( ! is_object( $post ) && is_admin() && ! empty( $_GET ) && ! empty( $_GET['post_type'] ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) ) { $term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] ); } if ( is_object( $post ) ) { - $opts = $this->meta_opts; + $opts = $this->meta_opts; $post_id = $p->ID; - if ( empty( $post->post_modified_gmt ) ) + if ( empty( $post->post_modified_gmt ) ) { $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) ); - if ( $post->post_type == 'page' ) + } + if ( 'page' === $post->post_type ) { $wp_query->is_page = true; - elseif ( $post->post_type == 'attachment' ) + } elseif ( 'attachment' === $post->post_type ) { $wp_query->is_attachment = true; - else + } else { $wp_query->is_single = true; - if ( empty( $this->is_front_page ) ) $this->is_front_page = false; - if ( get_option( 'show_on_front' ) == 'page' ) { - if ( is_page() && $post->ID == get_option( 'page_on_front' ) ) + } + if ( empty( $this->is_front_page ) ) { + $this->is_front_page = false; + } + if ( 'page' === get_option( 'show_on_front' ) ) { + if ( is_page() && $post->ID == get_option( 'page_on_front' ) ) { $this->is_front_page = true; - elseif ( $post->ID == get_option( 'page_for_posts' ) ) + } elseif ( $post->ID == get_option( 'page_for_posts' ) ) { $wp_query->is_home = true; + } } $wp_query->queried_object = $post; - if ( !empty( $post ) && !$wp_query->is_home && !$this->is_front_page ) { - $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) ); - if ( empty( $title ) ) $title = $post->post_title; + if ( ! empty( $post ) && ! $wp_query->is_home && ! $this->is_front_page ) { + $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) ); + if ( empty( $title ) ) { + $title = $post->post_title; + } } $title_format = ''; if ( empty( $title ) ) { @@ -897,47 +1393,65 @@ function get_page_snippet_info() { } $description = $this->get_main_description( $post ); if ( empty( $title_format ) ) { - if ( is_page() ) + if ( is_page() ) { $title_format = $aioseop_options['aiosp_page_title_format']; - elseif ( is_single() || is_attachment() ) + } elseif ( is_single() || is_attachment() ) { $title_format = $this->get_post_title_format( 'post', $post ); + } } if ( empty( $title_format ) ) { $title_format = '%post_title%'; } $categories = $this->get_all_categories( $post_id ); - $category = ''; - if ( count( $categories ) > 0 ) + $category = ''; + if ( count( $categories ) > 0 ) { $category = $categories[0]; + } } else if ( is_object( $term ) ) { - if ( $_GET['taxonomy'] == 'category' ) { - query_posts( Array( 'cat' => $_GET['tag_ID'] ) ); - } else if ( $_GET['taxonomy'] == 'post_tag' ) { - query_posts( Array( 'tag' => $term->slug ) ); + if ( 'category' === $_GET['taxonomy'] ) { + query_posts( array( 'cat' => $_GET['tag_ID'] ) ); + } else if ( 'post_tag' === $_GET['taxonomy'] ) { + query_posts( array( 'tag' => $term->slug ) ); } else { - query_posts( Array( 'page' => '', $_GET['taxonomy'] => $term->slug, 'post_type' => $_GET['post_type'] ) ); + query_posts( array( + 'page' => '', + $_GET['taxonomy'] => $term->slug, + 'post_type' => $_GET['post_type'], + ) ); } - if ( empty( $this->meta_opts ) ) - $this->meta_opts = $this->get_current_options( Array(), 'aiosp' ); - $title = $this->get_tax_name( $_GET['taxonomy'] ); + if ( empty( $this->meta_opts ) ) { + $this->meta_opts = $this->get_current_options( array(), 'aiosp' ); + } + $title = $this->get_tax_name( $_GET['taxonomy'] ); $title_format = $this->get_tax_title_format(); - $opts = $this->meta_opts; - if ( !empty( $opts ) ) $description = $opts['aiosp_description']; - if ( empty( $description ) ) $description = term_description(); + $opts = $this->meta_opts; + if ( ! empty( $opts ) ) { + $description = $opts['aiosp_description']; + } + if ( empty( $description ) ) { + $description = term_description(); + } $description = $this->internationalize( $description ); } $show_page = true; - if ( !empty( $aioseop_options["aiosp_no_paged_canonical_links"] ) ) $show_page = false; + if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) { + $show_page = false; + } if ( $aioseop_options['aiosp_can'] ) { - if ( !empty( $aioseop_options['aiosp_customize_canonical_links'] ) && !empty( $opts['aiosp_custom_link'] ) ) $url = $opts['aiosp_custom_link']; - if ( empty( $url ) ) + if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) { + $url = $opts['aiosp_custom_link']; + } + if ( empty( $url ) ) { $url = $this->aiosp_mrt_get_url( $wp_query, $show_page ); + } $url = apply_filters( 'aioseop_canonical_url', $url ); } - if ( !$url ) $url = get_permalink(); + if ( ! $url ) { + $url = get_permalink(); + } - $title = $this->apply_cf_fields( $title ); + $title = $this->apply_cf_fields( $title ); $description = $this->apply_cf_fields( $description ); $description = apply_filters( 'aioseop_description', $description ); @@ -945,376 +1459,82 @@ function get_page_snippet_info() { $keywords = $this->apply_cf_fields( $keywords ); $keywords = apply_filters( 'aioseop_keywords', $keywords ); - $info = Array( 'title' => $title, 'description' => $description, 'keywords' => $keywords, 'url' => $url, - 'title_format' => $title_format, 'category' => $category, 'w' => $wp_query, 'p' => $post ); + $info = array( + 'title' => $title, + 'description' => $description, + 'keywords' => $keywords, + 'url' => $url, + 'title_format' => $title_format, + 'category' => $category, + 'w' => $wp_query, + 'p' => $post, + ); wp_reset_postdata(); - $wp_query = $w; $post = $p; - return $info; - } - - /*** Use custom callback for outputting snippet ***/ - function custom_output_option( $buf, $args ) { - if ( $args['name'] == 'aiosp_snippet' ) { - $args['options']['type'] = 'html'; - $args['options']['nowrap'] = false; - $args['options']['save'] = false; - $info = $this->get_page_snippet_info(); - extract( $info ); - } else return ''; - - if ( $this->strlen( $title ) > 70 ) $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...'; - if ( $this->strlen( $description ) > 156 ) $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...'; - $extra_title_len = 0; - if ( empty( $title_format ) ) { - $title = '' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . ''; - } else { - if ( strpos( $title_format, '%blog_title%' ) !== false ) $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format ); - $title_format = $this->apply_cf_fields( $title_format ); - $replace_title = '' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . ''; - if ( strpos( $title_format, '%post_title%' ) !== false ) $title_format = str_replace( '%post_title%', $replace_title, $title_format ); - if ( strpos( $title_format, '%page_title%' ) !== false ) $title_format = str_replace( '%page_title%', $replace_title, $title_format ); - if ( $w->is_category || $w->is_tag || $w->is_tax ) { - if(AIOSEOPPRO){ - if ( !empty( $_GET ) && !empty( $_GET['taxonomy'] ) && !empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) { - $term_id = intval( $_GET['tag_ID'] ); - $was_split = get_term_meta( $term_id, '_aioseop_term_was_split', true ); - if ( !$was_split ) { - $split_terms = wp_get_split_terms( $term_id, $_GET['taxonomy'] ); - if ( !empty( $split_terms ) ) { - foreach ( $split_terms as $new_tax => $new_term ) { - $this->split_shared_term( $term_id, $new_term ); - } - } - } - } - } - if ( strpos( $title_format, '%category_title%' ) !== false ) $title_format = str_replace( '%category_title%', $replace_title, $title_format ); - if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) $title_format = str_replace( '%taxonomy_title%', $replace_title, $title_format ); - } else { - if ( strpos( $title_format, '%category%' ) !== false ) $title_format = str_replace( '%category%', $category, $title_format ); - if ( strpos( $title_format, '%category_title%' ) !== false ) $title_format = str_replace( '%category_title%', $category, $title_format ); - if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) $title_format = str_replace( '%taxonomy_title%', $category, $title_format ); - if(AIOSEOPPRO){ - if ( strpos( $title_format, "%tax_" ) && !empty( $p ) ) { - $taxes = get_object_taxonomies( $p, 'objects' ); - if ( !empty( $taxes ) ) - foreach( $taxes as $t ) - if ( strpos( $title_format, "%tax_{$t->name}%" ) ) { - $terms = $this->get_all_terms( $p->ID, $t->name ); - $term = ''; - if ( count( $terms ) > 0 ) - $term = $terms[0]; - $title_format = str_replace( "%tax_{$t->name}%", $term, $title_format ); - } - } - } - } - if ( strpos( $title_format, '%taxonomy_description%' ) !== false ) $title_format = str_replace( '%taxonomy_description%', $description, $title_format ); - - $title_format = preg_replace( '/%([^%]*?)%/', '', $title_format ); - $title = $title_format; - $extra_title_len = strlen( str_replace( $replace_title, '', $title_format ) ); - } - - $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( wp_strip_all_tags( $description ) ) ); - $extra_title_len = (int)$extra_title_len; - $args['value'] .= ""; - $buf = $this->get_option_row( $args['name'], $args['options'], $args ); - - return $buf; - } - - function add_page_icon() { - wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) ); - wp_enqueue_style( 'wp-pointer' ); - $this->add_admin_pointers(); - - - wp_enqueue_style( 'aiosp_admin_style' , AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css' ); -?> - - 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' ) . "
($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' ) - . ''; - $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' ) . - ''; - $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(); - } + $wp_query = $w; + $post = $p; - function add_admin_pointers() { - if ( AIOSEOPPRO ) { - $this->pointers['aioseop_menu_236'] = Array( 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-pro-aioseop_class', - 'pointer_text' => '

' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION ) - . '

' . __( 'Thank you for running the latest and greatest All in One SEO Pack Pro ever! Please review your settings, as we\'re always adding new features for you!', 'all-in-one-seo-pack' ) . '

', - 'pointer_edge' => 'top', - 'pointer_align' => 'left', - 'pointer_scope' => 'global' - ); - $this->pointers['aioseop_welcome_230'] = Array( 'pointer_target' => '#aioseop_top_button', - 'pointer_text' => '

' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION ) - . '

' . __( 'New in 2.4: Improved support for taxonomies, Woocommerce and massive performance improvements under the hood! Please review your settings on each options page!', 'all-in-one-seo-pack' ) . '

', - 'pointer_edge' => 'bottom', - 'pointer_align' => 'left', - 'pointer_scope' => 'local' - ); - $this->filter_pointers(); - } - else { - $this->pointers['aioseop_menu_220'] = Array( 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class', - 'pointer_text' => '

' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION ) - . '

' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! Please review your settings, as we\'re always adding new features for you!', 'all-in-one-seo-pack' ) . '

', - 'pointer_edge' => 'top', - 'pointer_align' => 'left', - 'pointer_scope' => 'global' - ); - $this->pointers['aioseop_welcome_220'] = Array( 'pointer_target' => '#aioseop_top_button', - 'pointer_text' => '

' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION ) - . '

' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! New since 2.2: Control who accesses your site with the new Robots.txt Editor and File Editor modules! Enable them from the Feature Manager. Remember to review your settings, we have added some new ones!', 'all-in-one-seo-pack' ) . '

', - 'pointer_edge' => 'bottom', - 'pointer_align' => 'left', - 'pointer_scope' => 'local' - ); - $this->filter_pointers(); - } - } - - function settings_page_init() { - add_filter( "{$this->prefix}submit_options", Array( $this, 'filter_submit' ) ); - } - - function enqueue_scripts() { - add_filter( "{$this->prefix}display_settings", Array( $this, 'filter_settings' ), 10, 3 ); - add_filter( "{$this->prefix}display_options", Array( $this, 'filter_options' ), 10, 2 ); - parent::enqueue_scripts(); - } - - function filter_submit( $submit ) { - $submit['Submit_Default']['value'] = __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' »'; - $submit['Submit_All_Default'] = Array( 'type' => 'submit', 'class' => 'button-secondary', 'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' »' ); - return $submit; + return $info; } /** - * Handle resetting options to defaults, but preserve the license key if pro. + * @return null|object|WP_Post */ - function reset_options( $location = null, $delete = false ) { - if ( AIOSEOPPRO) { - global $aioseop_update_checker; + function get_queried_object() { + static $p = null; + global $wp_query, $post; + if ( null !== $p ) { + return $p; } - if ( $delete === true ) { - - if ( AIOSEOPPRO ) { - $license_key = ''; - if ( isset( $this->options ) && isset( $this->options['aiosp_license_key'] ) ) - $license_key = $this->options['aiosp_license_key']; - } - - $this->delete_class_option( $delete ); - - if ( AIOSEOPPRO ) { - $this->options = Array( 'aiosp_license_key' => $license_key ); - } else { - $this->options = Array(); + if ( is_object( $post ) ) { + $p = $post; + } else { + if ( ! $wp_query ) { + return null; } + $p = $wp_query->get_queried_object(); } - $default_options = $this->default_options( $location ); - if ( AIOSEOPPRO ) { - foreach ( $default_options as $k => $v ) - if ( $k != 'aiosp_license_key' ) - $this->options[$k] = $v; - $aioseop_update_checker->license_key = $this->options['aiosp_license_key']; - } else { - foreach ( $default_options as $k => $v ) - $this->options[$k] = $v; - } - $this->update_class_option( $this->options ); + return $p; } - function get_current_options( $opts = Array(), $location = null, $defaults = null, $post = null ) { - if ( ( $location === 'aiosp' ) && ( $this->locations[$location]['type'] == 'metabox' ) ) { - if ( $post == null ) { + /** + * @param array $opts + * @param null $location + * @param null $defaults + * @param null $post + * + * @return array + */ + function get_current_options( $opts = array(), $location = null, $defaults = null, $post = null ) { + if ( ( 'aiosp' === $location) && ( 'metabox' == $this->locations[ $location ]['type'] ) ) { + if ( null === $post ) { global $post; } $post_id = $post; - if ( is_object( $post_id ) ) + if ( is_object( $post_id ) ) { $post_id = $post_id->ID; + } $get_opts = $this->default_options( $location ); - $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' ); - if ( !( !empty( $this->options['aiosp_can'] ) ) && ( !empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { - unset( $optlist["custom_link"] ); + $optlist = array( + 'keywords', + 'description', + 'title', + 'custom_link', + 'sitemap_exclude', + 'disable', + 'disable_analytics', + 'noindex', + 'nofollow', + 'noodp', + 'noydir', + 'titleatr', + 'menulabel', + ); + if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { + unset( $optlist['custom_link'] ); } foreach ( $optlist as $f ) { - $meta = ''; + $meta = ''; $field = "aiosp_$f"; if ( AIOSEOPPRO ) { @@ -1323,1977 +1543,3147 @@ function get_current_options( $opts = Array(), $location = null, $defaults = nul $meta = get_term_meta( $_GET['tag_ID'], '_aioseop_' . $f, true ); } else { $queried_object = get_queried_object(); - if ( !empty( $queried_object ) && !empty( $queried_object->term_id ) ) { + if ( ! empty( $queried_object ) && ! empty( $queried_object->term_id ) ) { $meta = get_term_meta( $queried_object->term_id, '_aioseop_' . $f, true ); } } - } else + } else { $meta = get_post_meta( $post_id, '_aioseop_' . $f, true ); + } if ( 'title' === $f || 'description' === $f ) { - $get_opts[$field] = htmlspecialchars( ( $meta ) ); + $get_opts[ $field ] = htmlspecialchars( $meta ); } else { - $get_opts[$field] = htmlspecialchars( stripslashes( $meta ) ); + $get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) ); } } else { $field = "aiosp_$f"; - $meta = get_post_meta( $post_id, '_aioseop_' . $f, true ); + $meta = get_post_meta( $post_id, '_aioseop_' . $f, true ); if ( 'title' === $f || 'description' === $f ) { - $get_opts[$field] = htmlspecialchars( ( $meta ) ); + $get_opts[ $field ] = htmlspecialchars( $meta ); } else { - $get_opts[$field] = htmlspecialchars( stripslashes( $meta ) ); + $get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) ); } } } $opts = wp_parse_args( $opts, $get_opts ); + return $opts; } else { $options = parent::get_current_options( $opts, $location, $defaults ); + return $options; } } - function filter_settings( $settings, $location, $current ) { - if ( $location == null ) { - $prefix = $this->prefix; - - foreach ( Array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt ) - unset( $settings["{$prefix}$opt"] ); - - if ( !class_exists( 'DOMDocument' ) ) { - unset( $settings["{prefix}google_connect"] ); - } - if ( AIOSEOPPRO ) { - if ( !empty( $this->options['aiosp_license_key'] ) ) { - $settings['aiosp_license_key']['type'] = 'password'; - $settings['aiosp_license_key']['size'] = 38; - } - } - } elseif ( $location == 'aiosp' ) { - global $post, $aioseop_sitemap; - $prefix = $this->get_prefix( $location ) . $location . '_'; - if ( !empty( $post ) ) { - $post_type = get_post_type( $post ); - if ( !empty( $this->options['aiosp_cpostnoindex'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoindex'] ) ) ) { - $settings["{$prefix}noindex"]['type'] = 'select'; - $settings["{$prefix}noindex"]['initial_options'] = Array( '' => __( 'Default - noindex', 'all-in-one-seo-pack' ), 'off' => __( 'index', 'all-in-one-seo-pack' ), 'on' => __( 'noindex', 'all-in-one-seo-pack' ) ); - } - if ( !empty( $this->options['aiosp_cpostnofollow'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnofollow'] ) ) ) { - $settings["{$prefix}nofollow"]['type'] = 'select'; - $settings["{$prefix}nofollow"]['initial_options'] = Array( '' => __( 'Default - nofollow', 'all-in-one-seo-pack' ), 'off' => __( 'follow', 'all-in-one-seo-pack' ), 'on' => __( 'nofollow', 'all-in-one-seo-pack' ) ); - } - if ( !empty( $this->options['aiosp_cpostnoodp'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoodp'] ) ) ) { - $settings["{$prefix}noodp"]['type'] = 'select'; - $settings["{$prefix}noodp"]['initial_options'] = Array( '' => __( 'Default - noodp', 'all-in-one-seo-pack' ), 'off' => __( 'odp', 'all-in-one-seo-pack' ), 'on' => __( 'noodp', 'all-in-one-seo-pack' ) ); - } - if ( !empty( $this->options['aiosp_cpostnoydir'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoydir'] ) ) ) { - $settings["{$prefix}noydir"]['type'] = 'select'; - $settings["{$prefix}noydir"]['initial_options'] = Array( '' => __( 'Default - noydir', 'all-in-one-seo-pack' ), 'off' => __( 'ydir', 'all-in-one-seo-pack' ), 'on' => __( 'noydir', 'all-in-one-seo-pack' ) ); - } - global $post; - $info = $this->get_page_snippet_info(); - extract( $info ); - $settings["{$prefix}title"]['placeholder'] = $title; - $settings["{$prefix}description"]['placeholder'] = $description; - $settings["{$prefix}keywords"]['placeholder'] = $keywords; - } + /** + * @param $in + * + * @return mixed|void + */ + function internationalize( $in ) { + if ( function_exists( 'langswitch_filter_langs_with_message' ) ) { + $in = langswitch_filter_langs_with_message( $in ); + } - if ( !AIOSEOPPRO ){ - if ( !current_user_can( 'update_plugins' ) ) - unset( $settings["{$prefix}upgrade"] ); - } + if ( function_exists( 'polyglot_filter' ) ) { + $in = polyglot_filter( $in ); + } - if ( !is_object( $aioseop_sitemap ) ) - unset( $settings['aiosp_sitemap_exclude'] ); - if ( is_object( $post ) ) { - if ( $post->post_type != 'page' ) { - unset( $settings["{$prefix}titleatr"] ); - unset( $settings["{$prefix}menulabel"] ); - } - } - if ( !empty( $this->options[$this->prefix . 'togglekeywords'] ) ) { - unset( $settings["{$prefix}keywords"] ); - unset( $settings["{$prefix}togglekeywords"] ); - } elseif ( !empty( $current["{$prefix}togglekeywords"] ) ) { - unset( $settings["{$prefix}keywords"] ); - } - if ( empty( $this->options['aiosp_can'] ) || ( empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { - unset( $settings["{$prefix}custom_link"] ); - } + if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) { + $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in ); + } elseif ( function_exists( 'ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) { + $in = ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in ); + } elseif ( function_exists( 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) { + $in = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in ); } - return $settings; + + return apply_filters( 'localization', $in ); } - function filter_options( $options, $location ) { - if ( $location == 'aiosp' ) { - global $post; - if ( !empty( $post ) ) { - $prefix = $this->prefix; - $post_type = get_post_type( $post ); - foreach( Array( 'noindex', 'nofollow', 'noodp', 'noydir' ) as $no ) { - if ( empty( $this->options['aiosp_cpost' . $no] ) || ( !in_array( $post_type, $this->options['aiosp_cpost' . $no] ) ) ) - if ( isset( $options["{$prefix}{$no}"] ) && ( $options["{$prefix}{$no}"] != 'on' ) ) - unset( $options["{$prefix}{$no}"] ); - } - } - } - if ( $location == null ) { - $prefix = $this->prefix; - if ( isset( $options["{$prefix}rewrite_titles"] ) && ( !empty( $options["{$prefix}rewrite_titles"] ) ) ) - $options["{$prefix}rewrite_titles"] = 1; - if ( ( isset( $options["{$prefix}enablecpost"] ) ) && ( $options["{$prefix}enablecpost"] === '' ) ) - $options["{$prefix}enablecpost"] = 0; - if ( ( isset( $options["{$prefix}use_original_title"] ) ) && ( $options["{$prefix}use_original_title"] === '' ) ) - $options["{$prefix}use_original_title"] = 0; + /*** Used to filter wp_title(), get our title. ***/ + function wp_title() { + global $aioseop_options; + $title = false; + $post = $this->get_queried_object(); + if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) ) { + $title = $this->get_aioseop_title( $post ); + $title = $this->apply_cf_fields( $title ); } - return $options; - } - + if ( false === $title ) { + $title = $this->get_original_title(); + } - function get_queried_object() { - static $p = null; - global $wp_query, $post; - if ( $p !== null ) return $p; - if ( is_object( $post ) ) - $p = $post; - else { - if ( !$wp_query ) return null; - $p = $wp_query->get_queried_object(); + // If we're going to have this here, which seems logical, we should probably take it out of other places... do all titles pass through here? + // The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums + // if ( !empty( $aioseop_options['aiosp_cap_titles'] ) ) + // $title = $this->capitalize( $title ); + + return apply_filters( 'aioseop_title', $title ); + } + + /** + * Gets the title that will be used by AIOSEOP for title rewrites or returns false. + * + * @param $post + * + * @return bool|string + */ + function get_aioseop_title( $post ) { + global $aioseop_options; + // the_search_query() is not suitable, it cannot just return. + global $s, $STagging; + $opts = $this->meta_opts; + if ( is_front_page() ) { + if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) { + global $post; + if ( get_option( 'show_on_front' ) == 'page' && is_page() && $post->ID == get_option( 'page_on_front' ) ) { + $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) ); + if ( ! $title ) { + $title = $this->internationalize( $post->post_title ); + } + if ( ! $title ) { + $title = $this->internationalize( $this->get_original_title( '', false ) ); + } + if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) { + $title = $this->apply_page_title_format( $title, $post, $aioseop_options['aiosp_home_page_title_format'] ); + } + $title = $this->paged_title( $title ); + $title = apply_filters( 'aioseop_home_page_title', $title ); + } + } else { + $title = $this->internationalize( $aioseop_options['aiosp_home_title'] ); + if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) { + $title = $this->apply_page_title_format( $title, null, $aioseop_options['aiosp_home_page_title_format'] ); + } + } + if ( empty( $title ) ) { + $title = $this->internationalize( get_option( 'blogname' ) ) . ' | ' . $this->internationalize( get_bloginfo( 'description' ) ); + } + + global $post; + $post_id = $post->ID; + + if ( is_post_type_archive() && is_post_type_archive( 'product' ) && $post_id = woocommerce_get_page_id( 'shop' ) && $post = get_post( $post_id ) ) { + $frontpage_id = get_option( 'page_on_front' ); + + if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) { + $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) ); + } + // $title = $this->internationalize( $aioseop_options['aiosp_home_title'] ); + if ( ! $title ) { + $title = $this->internationalize( get_post_meta( $frontpage_id, '_aioseop_title', true ) ); + } // This is/was causing the first product to come through. + if ( ! $title ) { + $title = $this->internationalize( $post->post_title ); + } + if ( ! $title ) { + $title = $this->internationalize( $this->get_original_title( '', false ) ); + } + + $title = $this->apply_page_title_format( $title, $post ); + $title = $this->paged_title( $title ); + $title = apply_filters( 'aioseop_title_page', $title ); + + return $title; + + } + + return $this->paged_title( $title ); //this is returned for woo + } else if ( is_attachment() ) { + if ( null === $post ) { + return false; + } + $title = get_post_meta( $post->ID, '_aioseop_title', true ); + if ( empty( $title ) ) { + $title = $post->post_title; + } + if ( empty( $title ) ) { + $title = $this->get_original_title( '', false ); + } + if ( empty( $title ) ) { + $title = get_the_title( $post->post_parent ); + } + $title = apply_filters( 'aioseop_attachment_title', $this->internationalize( $this->apply_post_title_format( $title, '', $post ) ) ); + + return $title; + } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && ! $this->is_static_posts_page() ) ) { + if ( null === $post ) { + return false; + } + if ( $this->is_static_front_page() && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) { + if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) { + $home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] ); + } + + // Home title filter. + return apply_filters( 'aioseop_home_page_title', $home_title ); + } else { + $page_for_posts = ''; + if ( is_home() ) { + $page_for_posts = get_option( 'page_for_posts' ); + } + if ( $page_for_posts ) { + $title = $this->internationalize( get_post_meta( $page_for_posts, '_aioseop_title', true ) ); + if ( ! $title ) { + $post_page = get_post( $page_for_posts ); + $title = $this->internationalize( $post_page->post_title ); + } + } else { + $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) ); + if ( ! $title ) { + $title = $this->internationalize( $post->post_title ); + } + } + if ( ! $title ) { + $title = $this->internationalize( $this->get_original_title( '', false ) ); + } + + $title = $this->apply_page_title_format( $title, $post ); + $title = $this->paged_title( $title ); + $title = apply_filters( 'aioseop_title_page', $title ); + if ( $this->is_static_posts_page() ) { + $title = apply_filters( 'single_post_title', $title ); + } + + return $title; + } + } else if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) { + // Too far down? -mrt. + $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) ); + if ( ! $title ) { + $title = $this->internationalize( $post->post_title ); + } + if ( ! $title ) { + $title = $this->internationalize( $this->get_original_title( '', false ) ); + } + $title = $this->apply_page_title_format( $title, $post ); + $title = $this->paged_title( $title ); + $title = apply_filters( 'aioseop_title_page', $title ); + + return $title; + } else if ( is_single() ) { + // We're not in the loop :(. + if ( null === $post ) { + return false; + } + $categories = $this->get_all_categories(); + $category = ''; + if ( count( $categories ) > 0 ) { + $category = $categories[0]; + } + $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) ); + if ( ! $title ) { + $title = $this->internationalize( get_post_meta( $post->ID, 'title_tag', true ) ); + if ( ! $title ) { + $title = $this->internationalize( $this->get_original_title( '', false ) ); + } + } + if ( empty( $title ) ) { + $title = $post->post_title; + } + if ( ! empty( $title ) ) { + $title = $this->apply_post_title_format( $title, $category, $post ); + } + $title = $this->paged_title( $title ); + + return apply_filters( 'aioseop_title_single', $title ); + } else if ( is_search() && isset( $s ) && ! empty( $s ) ) { + $search = esc_attr( stripslashes( $s ) ); + if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) { + $search = $this->capitalize( $search ); + } + $title_format = $aioseop_options['aiosp_search_title_format']; + $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); + if ( strpos( $title, '%blog_description%' ) !== false ) { + $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title ); + } + if ( strpos( $title, '%search%' ) !== false ) { + $title = str_replace( '%search%', $search, $title ); + } + $title = $this->paged_title( $title ); + + return $title; + } else if ( is_tag() ) { + global $utw; + $tag = $tag_description = ''; + if ( $utw ) { + $tags = $utw->GetCurrentTagSet(); + $tag = $tags[0]->tag; + $tag = str_replace( '-', ' ', $tag ); + } else { + if ( AIOSEOPPRO ) { + if ( ! empty( $opts ) && ! empty( $opts['aiosp_title'] ) ) { + $tag = $opts['aiosp_title']; + } + if ( ! empty( $opts ) ) { + if ( ! empty( $opts['aiosp_title'] ) ) { + $tag = $opts['aiosp_title']; + } + if ( ! empty( $opts['aiosp_description'] ) ) { + $tag_description = $opts['aiosp_description']; + } + } + } + if ( empty( $tag ) ) { + $tag = $this->get_original_title( '', false ); + } + if ( empty( $tag_description ) ) { + $tag_description = tag_description(); + } + $tag = $this->internationalize( $tag ); + $tag_description = $this->internationalize( $tag_description ); + } + if ( $tag ) { + if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) { + $tag = $this->capitalize( $tag ); + } + $title_format = $aioseop_options['aiosp_tag_title_format']; + $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); + if ( strpos( $title, '%blog_description%' ) !== false ) { + $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title ); + } + if ( strpos( $title, '%tag%' ) !== false ) { + $title = str_replace( '%tag%', $tag, $title ); + } + if ( strpos( $title, '%tag_description%' ) !== false ) { + $title = str_replace( '%tag_description%', $tag_description, $title ); + } + if ( strpos( $title, '%taxonomy_description%' ) !== false ) { + $title = str_replace( '%taxonomy_description%', $tag_description, $title ); + } + $title = trim( wp_strip_all_tags( $title ) ); + $title = str_replace( array( '"', "\r\n", "\n" ), array( '"', ' ', ' ' ), $title ); + $title = $this->paged_title( $title ); + + return $title; + } + } else if ( ( is_tax() || is_category() ) && ! is_feed() ) { + return $this->get_tax_title(); + } else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // Simple tagging support. + $tag = $STagging->search_tag; + if ( $tag ) { + if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) { + $tag = $this->capitalize( $tag ); + } + $title_format = $aioseop_options['aiosp_tag_title_format']; + $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); + if ( strpos( $title, '%blog_description%' ) !== false ) { + $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title ); + } + if ( strpos( $title, '%tag%' ) !== false ) { + $title = str_replace( '%tag%', $tag, $title ); + } + $title = $this->paged_title( $title ); + + return $title; + } + } else if ( is_archive() || is_post_type_archive() ) { + if ( is_author() ) { + $author = $this->internationalize( $this->get_original_title( '', false ) ); + $title_format = $aioseop_options['aiosp_author_title_format']; + $new_title = str_replace( '%author%', $author, $title_format ); + } else if ( is_date() ) { + global $wp_query; + $date = $this->internationalize( $this->get_original_title( '', false ) ); + $title_format = $aioseop_options['aiosp_date_title_format']; + $new_title = str_replace( '%date%', $date, $title_format ); + $day = get_query_var( 'day' ); + if ( empty( $day ) ) { + $day = ''; + } + $new_title = str_replace( '%day%', $day, $new_title ); + $monthnum = get_query_var( 'monthnum' ); + $year = get_query_var( 'year' ); + if ( empty( $monthnum ) || is_year() ) { + $month = ''; + $monthnum = 0; + } + $month = date( 'F', mktime( 0, 0, 0, (int) $monthnum, 1, (int) $year ) ); + $new_title = str_replace( '%monthnum%', $monthnum, $new_title ); + if ( strpos( $new_title, '%month%' ) !== false ) { + $new_title = str_replace( '%month%', $month, $new_title ); + } + if ( strpos( $new_title, '%year%' ) !== false ) { + $new_title = str_replace( '%year%', get_query_var( 'year' ), $new_title ); + } + } else if ( is_post_type_archive() ) { + if ( empty( $title ) ) { + $title = $this->get_original_title( '', false ); + } + $new_title = apply_filters( 'aioseop_archive_title', $this->apply_archive_title_format( $title ) ); + } else { + return false; + } + $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $new_title ); + if ( strpos( $new_title, '%blog_description%' ) !== false ) { + $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title ); + } + $title = trim( $new_title ); + $title = $this->paged_title( $title ); + + return $title; + } else if ( is_404() ) { + $title_format = $aioseop_options['aiosp_404_title_format']; + $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); + if ( strpos( $new_title, '%blog_description%' ) !== false ) { + $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title ); + } + if ( strpos( $new_title, '%request_url%' ) !== false ) { + $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title ); + } + if ( strpos( $new_title, '%request_words%' ) !== false ) { + $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title ); + } + if ( strpos( $new_title, '%404_title%' ) !== false ) { + $new_title = str_replace( '%404_title%', $this->internationalize( $this->get_original_title( '', false ) ), $new_title ); + } + + return $new_title; + } + + return false; + } + + /** + * @param string $sep + * @param bool $echo + * @param string $seplocation + * + * @return The original title as delivered by WP (well, in most cases). + */ + function get_original_title( $sep = '|', $echo = false, $seplocation = '' ) { + global $aioseop_options; + if ( ! empty( $aioseop_options['aiosp_use_original_title'] ) ) { + $has_filter = has_filter( 'wp_title', array( $this, 'wp_title' ) ); + if ( false !== $has_filter ) { + remove_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter ); + } + if ( current_theme_supports( 'title-tag' ) ) { + $sep = '|'; + $echo = false; + $seplocation = 'right'; + } + $title = wp_title( $sep, $echo, $seplocation ); + if ( false !== $has_filter ) { + add_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter ); + } + if ( $title && ( $title = trim( $title ) ) ) { + return trim( $title ); + } + } + + // the_search_query() is not suitable, it cannot just return. + global $s; + + $title = null; + + if ( is_home() ) { + $title = get_option( 'blogname' ); + } else if ( is_single() ) { + $title = $this->internationalize( single_post_title( '', false ) ); + } else if ( is_search() && isset( $s ) && ! empty( $s ) ) { + $search = esc_attr( stripslashes( $s ) ); + if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) { + $search = $this->capitalize( $search ); + } + $title = $search; + } else if ( ( is_tax() || is_category() ) && ! is_feed() ) { + $category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) ); + $title = $category_name; + } else if ( is_page() ) { + $title = $this->internationalize( single_post_title( '', false ) ); + } else if ( is_tag() ) { + global $utw; + if ( $utw ) { + $tags = $utw->GetCurrentTagSet(); + $tag = $tags[0]->tag; + $tag = str_replace( '-', ' ', $tag ); + } else { + // For WordPress > 2.3. + $tag = $this->internationalize( single_term_title( '', false ) ); + } + if ( $tag ) { + $title = $tag; + } + } else if ( is_author() ) { + $author = get_userdata( get_query_var( 'author' ) ); + if ( $author === false ) { + global $wp_query; + $author = $wp_query->get_queried_object(); + } + if ( $author !== false ) { + $title = $author->display_name; + } + } else if ( is_day() ) { + $title = get_the_date(); + } else if ( is_month() ) { + $title = get_the_date( 'F, Y' ); + } else if ( is_year() ) { + $title = get_the_date( 'Y' ); + } else if ( is_archive() ) { + $title = $this->internationalize( post_type_archive_title( '', false ) ); + } else if ( is_404() ) { + $title_format = $aioseop_options['aiosp_404_title_format']; + $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); + if ( strpos( $new_title, '%blog_description%' ) !== false ) { + $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title ); + } + if ( strpos( $new_title, '%request_url%' ) !== false ) { + $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title ); + } + if ( strpos( $new_title, '%request_words%' ) !== false ) { + $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title ); + } + $title = $new_title; + } + + return trim( $title ); + } + + /** + * @param $s + * + * @return string + */ + function capitalize( $s ) { + $s = trim( $s ); + $tokens = explode( ' ', $s ); + while ( list( $key, $val ) = each( $tokens ) ) { + $tokens[ $key ] = trim( $tokens[ $key ] ); + $tokens[ $key ] = $this->strtoupper( $this->substr( $tokens[ $key ], 0, 1 ) ) . $this->substr( $tokens[ $key ], 1 ); + } + $s = implode( ' ', $tokens ); + + return $s; + } + + /** + * @param $request + * + * @return User -readable nice words for a given request. + */ + function request_as_words( $request ) { + $request = htmlspecialchars( $request ); + $request = str_replace( '.html', ' ', $request ); + $request = str_replace( '.htm', ' ', $request ); + $request = str_replace( '.', ' ', $request ); + $request = str_replace( '/', ' ', $request ); + $request = str_replace( '-', ' ', $request ); + $request_a = explode( ' ', $request ); + $request_new = array(); + foreach ( $request_a as $token ) { + $request_new[] = $this->ucwords( trim( $token ) ); + } + $request = implode( ' ', $request_new ); + + return $request; + } + + /** + * @param $title + * @param null $p + * @param string $title_format + * + * @return string + */ + function apply_page_title_format( $title, $p = null, $title_format = '' ) { + global $aioseop_options; + if ( $p === null ) { + global $post; + } else { + $post = $p; + } + if ( empty( $title_format ) ) { + $title_format = $aioseop_options['aiosp_page_title_format']; + } + + return $this->title_placeholder_helper( $title, $post, 'page', $title_format ); + } + + /** + * @param $title + * @param $post + * @param string $type + * @param string $title_format + * @param string $category + * + * @return string + */ + function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) { + if ( ! empty( $post ) ) { + $authordata = get_userdata( $post->post_author ); + } else { + $authordata = new WP_User(); + } + $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); + if ( strpos( $new_title, '%blog_description%' ) !== false ) { + $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title ); + } + if ( strpos( $new_title, "%{$type}_title%" ) !== false ) { + $new_title = str_replace( "%{$type}_title%", $title, $new_title ); + } + if ( $type == 'post' ) { + if ( strpos( $new_title, '%category%' ) !== false ) { + $new_title = str_replace( '%category%', $category, $new_title ); + } + if ( strpos( $new_title, '%category_title%' ) !== false ) { + $new_title = str_replace( '%category_title%', $category, $new_title ); + } + if ( strpos( $new_title, '%tax_' ) && ! empty( $post ) ) { + $taxes = get_object_taxonomies( $post, 'objects' ); + if ( ! empty( $taxes ) ) { + foreach ( $taxes as $t ) { + if ( strpos( $new_title, "%tax_{$t->name}%" ) ) { + $terms = $this->get_all_terms( $post->ID, $t->name ); + $term = ''; + if ( count( $terms ) > 0 ) { + $term = $terms[0]; + } + $new_title = str_replace( "%tax_{$t->name}%", $term, $new_title ); + } + } + } + } + } + if ( strpos( $new_title, "%{$type}_author_login%" ) !== false ) { + $new_title = str_replace( "%{$type}_author_login%", $authordata->user_login, $new_title ); + } + if ( strpos( $new_title, "%{$type}_author_nicename%" ) !== false ) { + $new_title = str_replace( "%{$type}_author_nicename%", $authordata->user_nicename, $new_title ); + } + if ( strpos( $new_title, "%{$type}_author_firstname%" ) !== false ) { + $new_title = str_replace( "%{$type}_author_firstname%", $this->ucwords( $authordata->first_name ), $new_title ); + } + if ( strpos( $new_title, "%{$type}_author_lastname%" ) !== false ) { + $new_title = str_replace( "%{$type}_author_lastname%", $this->ucwords( $authordata->last_name ), $new_title ); + } + $title = trim( $new_title ); + + return $title; + } + + /** + * @param $id + * @param $taxonomy + * + * @return array + */ + function get_all_terms( $id, $taxonomy ) { + $keywords = array(); + $terms = get_the_terms( $id, $taxonomy ); + if ( ! empty( $terms ) ) { + foreach ( $terms as $term ) { + $keywords[] = $this->internationalize( $term->name ); + } + } + + return $keywords; + } + + /** + * @param $title + * + * @return string + */ + function paged_title( $title ) { + // The page number if paged. + global $paged; + global $aioseop_options; + // Simple tagging support. + global $STagging; + $page = get_query_var( 'page' ); + if ( $paged > $page ) { + $page = $paged; + } + if ( is_paged() || ( isset( $STagging ) && $STagging->is_tag_view() && $paged ) || ( $page > 1 ) ) { + $part = $this->internationalize( $aioseop_options['aiosp_paged_format'] ); + if ( isset( $part ) || ! empty( $part ) ) { + $part = ' ' . trim( $part ); + $part = str_replace( '%page%', $page, $part ); + $this->log( "paged_title() [$title] [$part]" ); + $title .= $part; + } + } + + return $title; + } + + /** + * @param $message + */ + function log( $message ) { + if ( $this->do_log ) { + @error_log( date( 'Y-m-d H:i:s' ) . ' ' . $message . "\n", 3, $this->log_file ); + } + } + + /** + * @param $title + * @param string $category + * @param null $p + * + * @return string + */ + function apply_post_title_format( $title, $category = '', $p = null ) { + if ( $p === null ) { + global $post; + } else { + $post = $p; + } + $title_format = $this->get_post_title_format( 'post', $post ); + + return $this->title_placeholder_helper( $title, $post, 'post', $title_format, $category ); + } + + /** + * @param string $title_type + * @param null $p + * + * @return bool|string + */ + function get_post_title_format( $title_type = 'post', $p = null ) { + global $aioseop_options; + if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) { + return false; + } + $title_format = "%{$title_type}_title% | %blog_title%"; + if ( isset( $aioseop_options["aiosp_{$title_type}_title_format"] ) ) { + $title_format = $aioseop_options["aiosp_{$title_type}_title_format"]; + } + if ( ! empty( $aioseop_options['aiosp_enablecpost'] ) && ! empty( $aioseop_options['aiosp_cpostactive'] ) ) { + $wp_post_types = $aioseop_options['aiosp_cpostactive']; + if ( ! empty( $aioseop_options['aiosp_cposttitles'] ) ) { + if ( ( ( $title_type == 'archive' ) && is_post_type_archive( $wp_post_types ) && $prefix = "aiosp_{$title_type}_" ) || + ( ( $title_type == 'post' ) && $this->is_singular( $wp_post_types, $p ) && $prefix = 'aiosp_' ) + ) { + $post_type = get_post_type( $p ); + if ( ! empty( $aioseop_options["{$prefix}{$post_type}_title_format"] ) ) { + $title_format = $aioseop_options["{$prefix}{$post_type}_title_format"]; + } + } + } + } + + return $title_format; + } + + /** + * @param array $post_types + * @param null $post + * + * @return bool + */ + function is_singular( $post_types = array(), $post = null ) { + if ( ! empty( $post_types ) && is_object( $post ) ) { + return in_array( $post->post_type, (array) $post_types ); + } else { + return is_singular( $post_types ); + } + } + + /** + * @return bool|null + */ + function is_static_posts_page() { + static $is_posts_page = null; + if ( $is_posts_page !== null ) { + return $is_posts_page; + } + $post = $this->get_queried_object(); + $is_posts_page = ( get_option( 'show_on_front' ) == 'page' && is_home() && ! empty( $post ) && $post->ID == get_option( 'page_for_posts' ) ); + + return $is_posts_page; + } + + /** + * @return bool|null + */ + function is_static_front_page() { + if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) { + return $this->is_front_page; + } + $post = $this->get_queried_object(); + $this->is_front_page = ( get_option( 'show_on_front' ) == 'page' && is_page() && ! empty( $post ) && $post->ID == get_option( 'page_on_front' ) ); + + return $this->is_front_page; + } + + /** + * @param int $id + * + * @return array + */ + function get_all_categories( $id = 0 ) { + $keywords = array(); + $categories = get_the_category( $id ); + if ( ! empty( $categories ) ) { + foreach ( $categories as $category ) { + $keywords[] = $this->internationalize( $category->cat_name ); + } + } + + return $keywords; + } + + /** + * @param string $tax + * + * @return string + */ + function get_tax_title( $tax = '' ) { + if ( AIOSEOPPRO ) { + if ( empty( $this->meta_opts ) ) { + $this->meta_opts = $this->get_current_options( array(), 'aiosp' ); + } } - return $p; + if ( empty( $tax ) ) { + if ( is_category() ) { + $tax = 'category'; + } else { + $tax = get_query_var( 'taxonomy' ); + } + } + $name = $this->get_tax_name( $tax ); + $desc = $this->get_tax_desc( $tax ); + + return $this->apply_tax_title_format( $name, $desc, $tax ); } - function is_page_included() { + // Handle prev / next links. + + /** + * @param $tax + * + * @return mixed|void + */ + function get_tax_name( $tax ) { global $aioseop_options; - if ( is_feed() ) return false; - if ( aioseop_mrt_exclude_this_page() ) return false; - $post = $this->get_queried_object(); - $post_type = ''; - if ( !empty( $post ) && !empty( $post->post_type ) ) - $post_type = $post->post_type; - if ( empty( $aioseop_options['aiosp_enablecpost'] ) ) { - $wp_post_types = get_post_types( Array( '_builtin' => true ) ); // don't display meta if SEO isn't enabled on custom post types -- pdb - if( is_singular() && !in_array( $post_type, $wp_post_types ) && !is_front_page() ) return false; + if ( AIOSEOPPRO ) { + $opts = $this->meta_opts; + if ( ! empty( $opts ) ) { + $name = $opts['aiosp_title']; + } } else { - $wp_post_types = $aioseop_options['aiosp_cpostactive']; - if ( empty( $wp_post_types ) ) $wp_post_types = Array(); - if ( AIOSEOPPRO ) { - if ( is_tax() ) { - if ( empty( $aioseop_options['aiosp_taxactive'] ) || !is_tax( $aioseop_options['aiosp_taxactive'] ) ) return false; - } elseif ( is_category() ) { - if ( empty( $aioseop_options['aiosp_taxactive'] ) || !in_array( 'category', $aioseop_options['aiosp_taxactive'] ) ) return false; - } elseif ( is_tag() ) { - if ( empty( $aioseop_options['aiosp_taxactive'] ) || !in_array( 'post_tag', $aioseop_options['aiosp_taxactive'] ) ) return false; - } else if ( !in_array( $post_type, $wp_post_types ) && !is_front_page() && !is_post_type_archive( $wp_post_types ) && !is_404() ) return false; + $name = ''; + } + if ( empty( $name ) ) { + $name = single_term_title( '', false ); + } + // Apparently we're already ucwordsing this elsewhere, and doing it a second time messes it up... why aren't we just doing this at the end? + // if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) ) + // $name = $this->ucwords( $name ); + + return $this->internationalize( $name ); + } + + /** + * @param $tax + * + * @return mixed|void + */ + function get_tax_desc( $tax ) { + if ( AIOSEOPPRO ) { + $opts = $this->meta_opts; + if ( ! empty( $opts ) ) { + $desc = $opts['aiosp_description']; + } + } else { + $desc = ''; + } + if ( empty( $desc ) ) { + $desc = term_description( '', $tax ); + } + + return $this->internationalize( $desc ); + } + + /** + * @param $category_name + * @param $category_description + * @param string $tax + * + * @return string + */ + function apply_tax_title_format( $category_name, $category_description, $tax = '' ) { + if ( empty( $tax ) ) { + $tax = get_query_var( 'taxonomy' ); + } + $title_format = $this->get_tax_title_format( $tax ); + $title = str_replace( '%taxonomy_title%', $category_name, $title_format ); + if ( strpos( $title, '%taxonomy_description%' ) !== false ) { + $title = str_replace( '%taxonomy_description%', $category_description, $title ); + } + if ( strpos( $title, '%category_title%' ) !== false ) { + $title = str_replace( '%category_title%', $category_name, $title ); + } + if ( strpos( $title, '%category_description%' ) !== false ) { + $title = str_replace( '%category_description%', $category_description, $title ); + } + if ( strpos( $title, '%blog_title%' ) !== false ) { + $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title ); + } + if ( strpos( $title, '%blog_description%' ) !== false ) { + $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title ); + } + $title = wp_strip_all_tags( $title ); + + return $this->paged_title( $title ); + } + + /** + * @param string $tax + * + * @return string + */ + function get_tax_title_format( $tax = '' ) { + global $aioseop_options; + if ( AIOSEOPPRO ) { + $title_format = '%taxonomy_title% | %blog_title%'; + if ( is_category() ) { + $title_format = $aioseop_options['aiosp_category_title_format']; + } else { + $taxes = $aioseop_options['aiosp_taxactive']; + if ( empty( $tax ) ) { + $tax = get_query_var( 'taxonomy' ); + } + if ( ! empty( $aioseop_options["aiosp_{$tax}_tax_title_format"] ) ) { + $title_format = $aioseop_options["aiosp_{$tax}_tax_title_format"]; + } + } + if ( empty( $title_format ) ) { + $title_format = '%category_title% | %blog_title%'; + } + } else { + $title_format = '%category_title% | %blog_title%'; + if ( ! empty( $aioseop_options['aiosp_category_title_format'] ) ) { + $title_format = $aioseop_options['aiosp_category_title_format']; + } + + return $title_format; + } + + return $title_format; + } + + /** + * @param $title + * @param string $category + * + * @return string + */ + function apply_archive_title_format( $title, $category = '' ) { + $title_format = $this->get_archive_title_format(); + $r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' ); + $d_title = array( + $this->internationalize( get_bloginfo( 'name' ) ), + $this->internationalize( get_bloginfo( 'description' ) ), + post_type_archive_title( '', false ), + ); + $title = trim( str_replace( $r_title, $d_title, $title_format ) ); + + return $title; + } + + /** + * @return bool|string + */ + function get_archive_title_format() { + return $this->get_post_title_format( 'archive' ); + } + + /** + * @param null $post + * + * @return mixed|string|void + */ + function get_main_description( $post = null ) { + global $aioseop_options; + $opts = $this->meta_opts; + $description = ''; + if ( is_author() && $this->show_page_description() ) { + $description = $this->internationalize( get_the_author_meta( 'description' ) ); + } else if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) { + // $description = $this->get_post_description( $post ); + // $description = $this->apply_cf_fields( $description ); + if ( ! ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ) { + $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) ); + } else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) { + // $description = $this->get_aioseop_description( $post ); + $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) ); + } else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) { + $description = $this->get_aioseop_description( $post ); + } + } else if ( is_front_page() ) { + $description = $this->get_aioseop_description( $post ); + } else if ( is_single() || is_page() || is_attachment() || is_home() || $this->is_static_posts_page() ) { + $description = $this->get_aioseop_description( $post ); + } else if ( ( is_category() || is_tag() || is_tax() ) && $this->show_page_description() ) { + if ( ! empty( $opts ) && AIOSEOPPRO ) { + $description = $opts['aiosp_description']; + } + if ( empty( $description ) ) { + $description = term_description(); + } + $description = $this->internationalize( $description ); + } + if ( empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) { + $description = $this->trim_excerpt_without_filters( $description ); + } + + return $description; + } + + /** + * @return bool + */ + function show_page_description() { + global $aioseop_options; + if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { + $page = $this->get_page_number(); + if ( ! empty( $page ) && ( $page > 1 ) ) { + return false; + } + } + + return true; + } + + /** + * @return mixed + */ + function get_page_number() { + $page = get_query_var( 'page' ); + if ( empty( $page ) ) { + $page = get_query_var( 'paged' ); + } + + return $page; + } + + /** + * @param null $post + * + * @return mixed|string + */ + function get_aioseop_description( $post = null ) { + global $aioseop_options; + if ( null === $post ) { + $post = $GLOBALS['post']; + } + $blog_page = aiosp_common::get_blog_page(); + $description = ''; + if ( is_front_page() && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) { + $description = trim( $this->internationalize( $aioseop_options['aiosp_home_description'] ) ); + } elseif ( ! empty( $blog_page ) ) { + $description = $this->get_post_description( $blog_page ); + } + if ( empty( $description ) && is_object( $post ) && ! is_archive() && empty( $blog_page ) ) { + $description = $this->get_post_description( $post ); + } + $description = $this->apply_cf_fields( $description ); + + return $description; + } + + /** + * @param $post + * + * @return mixed|string + */ + function get_post_description( $post ) { + global $aioseop_options; + $description = ''; + if ( ! $this->show_page_description() ) { + return ''; + } + $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) ); + if ( ! empty( $post ) && post_password_required( $post ) ) { + return $description; + } + if ( ! $description ) { + if ( empty( $aioseop_options['aiosp_skip_excerpt'] ) ) { + $description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) ); + } + if ( ! $description && isset( $aioseop_options['aiosp_generate_descriptions'] ) && $aioseop_options['aiosp_generate_descriptions'] ) { + $content = $post->post_content; + if ( ! empty( $aioseop_options['aiosp_run_shortcodes'] ) ) { + $content = do_shortcode( $content ); + } + $content = wp_strip_all_tags( $content ); + $description = $this->trim_excerpt_without_filters( $this->internationalize( $content ) ); + } + } + + // Internal whitespace trim. + $description = preg_replace( '/\s\s+/u', ' ', $description ); + + return $description; + } + + /** + * @param $text + * + * @return string + */ + function trim_excerpt_without_filters_full_length( $text ) { + $text = str_replace( ']]>', ']]>', $text ); + $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text ); + $text = wp_strip_all_tags( $text ); + + return trim( $text ); + } + + /** + * @param $text + * @param int $max + * + * @return string + */ + function trim_excerpt_without_filters( $text, $max = 0 ) { + $text = str_replace( ']]>', ']]>', $text ); + $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text ); + $text = wp_strip_all_tags( $text ); + // Treat other common word-break characters like a space. + $text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text ); + if ( ! $max ) { + $max = $this->maximum_description_length; + } + $max_orig = $max; + $len = $this->strlen( $text2 ); + if ( $max < $len ) { + if ( function_exists( 'mb_strrpos' ) ) { + $pos = mb_strrpos( $text2, ' ', - ( $len - $max ) ); + if ( false === $pos ) { + $pos = $max; + } + if ( $pos > $this->minimum_description_length ) { + $max = $pos; + } else { + $max = $this->minimum_description_length; + } + } else { + while ( ' ' != $text2[ $max ] && $max > $this->minimum_description_length ) { + $max --; + } + } + + // Probably no valid chars to break on? + if ( $len > $max_orig && $max < intval( $max_orig / 2 ) ) { + $max = $max_orig; + } + } + $text = $this->substr( $text, 0, $max ); + + return trim( $text ); + } + + /** + * @param $query + * @param bool $show_page + * + * @return bool|false|string + */ + function aiosp_mrt_get_url( $query, $show_page = true ) { + if ( $query->is_404 || $query->is_search ) { + return false; + } + $link = ''; + $haspost = count( $query->posts ) > 0; + if ( get_query_var( 'm' ) ) { + $m = preg_replace( '/[^0-9]/', '', get_query_var( 'm' ) ); + switch ( $this->strlen( $m ) ) { + case 4: + $link = get_year_link( $m ); + break; + case 6: + $link = get_month_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ) ); + break; + case 8: + $link = get_day_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ), $this->substr( $m, 6, 2 ) ); + break; + default: + return false; + } + } elseif ( $query->is_home && ( get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) { + $link = get_permalink( $pageid ); + } elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) { + if ( function_exists( 'icl_get_home_url' ) ) { + $link = icl_get_home_url(); } else { - if ( is_singular() && !in_array( $post_type, $wp_post_types ) && !is_front_page() ) return false; - if ( is_post_type_archive() && !is_post_type_archive( $wp_post_types ) ) return false; + $link = trailingslashit( home_url() ); + } + } elseif ( ( $query->is_single || $query->is_page ) && $haspost ) { + $post = $query->posts[0]; + $link = get_permalink( $post->ID ); + } elseif ( $query->is_author && $haspost ) { + $author = get_userdata( get_query_var( 'author' ) ); + if ( false === $author ) { + return false; + } + $link = get_author_posts_url( $author->ID, $author->user_nicename ); + } elseif ( $query->is_category && $haspost ) { + $link = get_category_link( get_query_var( 'cat' ) ); + } elseif ( $query->is_tag && $haspost ) { + $tag = get_term_by( 'slug', get_query_var( 'tag' ), 'post_tag' ); + if ( ! empty( $tag->term_id ) ) { + $link = get_tag_link( $tag->term_id ); + } + } elseif ( $query->is_day && $haspost ) { + $link = get_day_link( get_query_var( 'year' ), + get_query_var( 'monthnum' ), + get_query_var( 'day' ) ); + } elseif ( $query->is_month && $haspost ) { + $link = get_month_link( get_query_var( 'year' ), + get_query_var( 'monthnum' ) ); + } elseif ( $query->is_year && $haspost ) { + $link = get_year_link( get_query_var( 'year' ) ); + } elseif ( $query->is_tax && $haspost ) { + $taxonomy = get_query_var( 'taxonomy' ); + $term = get_query_var( 'term' ); + if ( ! empty( $term ) ) { + $link = get_term_link( $term, $taxonomy ); + } + } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) { + if ( is_array( $post_type ) ) { + $post_type = reset( $post_type ); } + $link = get_post_type_archive_link( $post_type ); + } else { + return false; } - - $this->meta_opts = $this->get_current_options( Array(), 'aiosp' ); - - $aiosp_disable = $aiosp_disable_analytics = false; - - if ( !empty( $this->meta_opts ) ) { - if ( isset( $this->meta_opts['aiosp_disable'] ) ) $aiosp_disable = $this->meta_opts['aiosp_disable']; - if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) $aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics']; + if ( empty( $link ) || ! is_string( $link ) ) { + return false; } - - if ( $aiosp_disable ) { - if ( !$aiosp_disable_analytics ) { - if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) { - remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) ); - add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) ); + if ( apply_filters( 'aioseop_canonical_url_pagination', $show_page ) ) { + $link = $this->get_paged( $link ); + } + if ( ! empty( $link ) ) { + global $aioseop_options; + if ( isset( $aioseop_options['aiosp_can_set_protocol'] ) && ( 'auto' !== $aioseop_options['aiosp_can_set_protocol'] ) ) { + if ( 'http' === $aioseop_options['aiosp_can_set_protocol'] ) { + $link = preg_replace( '/^https:/i', 'http:', $link ); + } elseif ( 'https' === $aioseop_options['aiosp_can_set_protocol'] ) { + $link = preg_replace( '/^http:/i', 'https:', $link ); } } - return false; } - if ( !empty( $this->meta_opts ) && $this->meta_opts['aiosp_disable'] == true ) return false; - - return true; + return $link; } - function template_redirect() { - global $aioseop_options; - - $post = $this->get_queried_object(); - - if ( !$this->is_page_included() ) return; - - if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) ) { - $force_rewrites = 1; - if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) - $force_rewrites = $aioseop_options['aiosp_force_rewrites']; - if ( $force_rewrites ) - ob_start( array( $this, 'output_callback_for_title' ) ); - else - add_filter( 'wp_title', array( $this, 'wp_title' ), 20 ); + /** + * @param $link + * + * @return string + */ + function get_paged( $link ) { + global $wp_rewrite; + $page = $this->get_page_number(); + $page_name = 'page'; + if ( ! empty( $wp_rewrite ) && ! empty( $wp_rewrite->pagination_base ) ) { + $page_name = $wp_rewrite->pagination_base; + } + if ( ! empty( $page ) && $page > 1 ) { + if ( $page == get_query_var( 'page' ) ) { + $link = trailingslashit( $link ) . "$page"; + } else { + $link = trailingslashit( $link ) . trailingslashit( $page_name ) . $page; + } + $link = user_trailingslashit( $link, 'paged' ); } - } - function output_callback_for_title( $content ) { - return $this->rewrite_title( $content ); + return $link; } - function add_hooks() { - global $aioseop_options, $aioseop_update_checker; - - $role = get_role( 'administrator' ); - if ( is_object( $role ) ) $role->add_cap( 'aiosp_manage_seo' ); - - aioseop_update_settings_check(); - add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' ); - if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) - add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 ); - - if ( is_admin() ) { - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); - add_action( 'admin_head', array( $this, 'add_page_icon' ) ); - add_action( 'admin_init', 'aioseop_addmycolumns', 1 ); - add_action( 'admin_init', 'aioseop_handle_ignore_notice' ); - if ( AIOSEOPPRO ){ - if ( current_user_can( 'update_plugins' ) ) - add_action( 'admin_notices', Array( $aioseop_update_checker, 'key_warning' ) ); - add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, Array( $aioseop_update_checker, 'add_plugin_row' ) ); + /** + * @return comma|string + */ + function get_main_keywords() { + global $aioseop_options; + global $aioseop_keywords; + global $post; + $opts = $this->meta_opts; + if ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && ! $this->is_static_posts_page() ) || $this->is_static_front_page() ) { + if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) { + $keywords = $this->get_all_keywords(); + } else { + $keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) ); } + } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) { + $keywords = stripslashes( $this->internationalize( $opts['aiosp_keywords'] ) ); // And if option = use page set keywords instead of keywords from recent posts. + } elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) { + $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, '_aioseop_keywords', true ) ) ); + } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) { + $keywords = ''; } else { - if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' ) - remove_action( 'wp_head', 'rel_canonical' ); - ////analytics - if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) - add_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) ); - add_filter( 'wp_list_pages', 'aioseop_list_pages' ); - add_action( 'wp_head', array( $this, 'wp_head'), apply_filters( 'aioseop_wp_head_priority', 1 ) ); - add_action( 'template_redirect', array( $this, 'template_redirect' ), 0 ); - add_filter( 'wp_list_pages_excludes', 'aioseop_get_pages_start' ); - add_filter( 'get_pages', 'aioseop_get_pages' ); + $keywords = $this->get_all_keywords(); } - } - - function is_static_front_page() { - if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) return $this->is_front_page; - $post = $this->get_queried_object(); - $this->is_front_page = ( get_option( 'show_on_front' ) == 'page' && is_page() && !empty( $post ) && $post->ID == get_option( 'page_on_front' ) ); - return $this->is_front_page; - } - function is_static_posts_page() { - static $is_posts_page = null; - if ( $is_posts_page !== null ) return $is_posts_page; - $post = $this->get_queried_object(); - $is_posts_page = ( get_option( 'show_on_front' ) == 'page' && is_home() && !empty( $post ) && $post->ID == get_option( 'page_for_posts' ) ); - return $is_posts_page; + return $keywords; } - function check_rewrite_handler() { + /** + * @return comma-separated list of unique keywords + */ + function get_all_keywords() { + global $posts; global $aioseop_options; + if ( is_404() ) { + return null; + } + // If we are on synthetic pages. + if ( ! is_home() && ! is_page() && ! is_single() && ! $this->is_static_front_page() && ! $this->is_static_posts_page() && ! is_archive() && ! is_post_type_archive() && ! is_category() && ! is_tag() && ! is_tax() ) { + return null; + } + $keywords = array(); + $opts = $this->meta_opts; + if ( ! empty( $opts['aiosp_keywords'] ) ) { + $traverse = $this->keyword_string_to_list( $this->internationalize( $opts['aiosp_keywords'] ) ); + if ( ! empty( $traverse ) ) { + foreach ( $traverse as $keyword ) { + $keywords[] = $keyword; + } + } + } + if ( empty( $posts ) ) { + global $post; + $post_arr = array( $post ); + } else { + $post_arr = $posts; + } + if ( is_array( $post_arr ) ) { + $postcount = count( $post_arr ); + foreach ( $post_arr as $p ) { + if ( $p ) { + $id = $p->ID; + if ( 1 == $postcount || ! empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) { + // Custom field keywords. + $keywords_i = null; + $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) ); + if ( is_attachment() ) { + $id = $p->post_parent; + if ( empty( $keywords_i ) ) { + $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) ); + } + } + $traverse = $this->keyword_string_to_list( $keywords_i ); + if ( ! empty( $traverse ) ) { + foreach ( $traverse as $keyword ) { + $keywords[] = $keyword; + } + } + } - $force_rewrites = 1; - if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) - $force_rewrites = $aioseop_options['aiosp_force_rewrites']; + if ( ! empty( $aioseop_options['aiosp_use_tags_as_keywords'] ) ) { + $keywords = array_merge( $keywords, $this->get_all_tags( $id ) ); + } + // Autometa. + $autometa = stripslashes( get_post_meta( $id, 'autometa', true ) ); + if ( isset( $autometa ) && ! empty( $autometa ) ) { + $autometa_array = explode( ' ', $autometa ); + foreach ( $autometa_array as $e ) { + $keywords[] = $e; + } + } - if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) && $force_rewrites ) { - // make the title rewrite as short as possible - if (function_exists( 'ob_list_handlers' ) ) { - $active_handlers = ob_list_handlers(); - } else { - $active_handlers = array(); - } - if (sizeof($active_handlers) > 0 && - $this->strtolower( $active_handlers[sizeof( $active_handlers ) - 1] ) == - $this->strtolower( 'All_in_One_SEO_Pack::output_callback_for_title' ) ) { - ob_end_flush(); - } else { - $this->log( "another plugin interfering?" ); - // if we get here there *could* be trouble with another plugin :( - $this->ob_start_detected = true; - if ( $this->option_isset( "rewrite_titles" ) ) { // try alternate method -- pdb - $aioseop_options['aiosp_rewrite_titles'] = 0; - $force_rewrites = 0; - add_filter( 'wp_title', array( $this, 'wp_title' ), 20 ); - } - if ( function_exists( 'ob_list_handlers' ) ) { - foreach ( ob_list_handlers() as $handler ) { - $this->log( "detected output handler $handler" ); + if ( isset( $aioseop_options['aiosp_use_categories'] ) && $aioseop_options['aiosp_use_categories'] && ! is_page() ) { + $keywords = array_merge( $keywords, $this->get_all_categories( $id ) ); } } } } + + return $this->get_unique_keywords( $keywords ); } - // handle prev / next links - function get_prev_next_links( $post = null ) { - $prev = $next = ''; - $page = $this->get_page_number(); - if ( is_home() || is_archive() || is_paged() ) { - global $wp_query; - $max_page = $wp_query->max_num_pages; - if ( $page > 1 ) - $prev = get_previous_posts_page_link(); - if ( $page < $max_page ) { - $paged = $GLOBALS['paged']; - if ( !is_single() ) { - if ( !$paged ) - $paged = 1; - $nextpage = intval($paged) + 1; - if ( !$max_page || $max_page >= $nextpage ) - $next = get_pagenum_link($nextpage); - } - } - } else if ( is_page() || is_single() ) { - $numpages = 1; - $multipage = 0; - $page = get_query_var('page'); - if ( ! $page ) - $page = 1; - if ( is_single() || is_page() || is_feed() ) - $more = 1; - $content = $post->post_content; - if ( false !== strpos( $content, '' ) ) { - if ( $page > 1 ) - $more = 1; - $content = str_replace( "\n\n", '', $content ); - $content = str_replace( "\n", '', $content ); - $content = str_replace( "\n", '', $content ); - // Ignore nextpage at the beginning of the content. - if ( 0 === strpos( $content, '' ) ) - $content = substr( $content, 15 ); - $pages = explode('', $content); - $numpages = count($pages); - if ( $numpages > 1 ) - $multipage = 1; - } - if ( !empty( $page ) ) { - if ( $page > 1 ) - $prev = _wp_link_page( $page - 1 ); - if ( $page + 1 <= $numpages ) - $next = _wp_link_page( $page + 1 ); - } - if ( !empty( $prev ) ) { - $prev = $this->substr( $prev, 9, -2 ); + /** + * @param $keywords + * + * @return array + */ + function keyword_string_to_list( $keywords ) { + $traverse = array(); + $keywords_i = str_replace( '"', '', $keywords ); + if ( isset( $keywords_i ) && ! empty( $keywords_i ) ) { + $traverse = explode( ',', $keywords_i ); + } + + return $traverse; + } + + /** + * @param int $id + * + * @return array + */ + function get_all_tags( $id = 0 ) { + $keywords = array(); + $tags = get_the_tags( $id ); + if ( ! empty( $tags ) && is_array( $tags ) ) { + foreach ( $tags as $tag ) { + $keywords[] = $this->internationalize( $tag->name ); } - if ( !empty( $next ) ) { - $next = $this->substr( $next, 9, -2 ); + } + // Ultimate Tag Warrior integration. + global $utw; + if ( $utw ) { + $tags = $utw->GetTagsForPost( $p ); + if ( is_array( $tags ) ) { + foreach ( $tags as $tag ) { + $tag = $tag->tag; + $tag = str_replace( '_', ' ', $tag ); + $tag = str_replace( '-', ' ', $tag ); + $tag = stripslashes( $tag ); + $keywords[] = $tag; + } } } - return Array( 'prev' => $prev, 'next' => $next ); - } - function get_google_authorship( $post ) { - global $aioseop_options; - $page = $this->get_page_number(); - // handle authorship - $googleplus = $publisher = $author = ''; + return $keywords; + } - if ( !empty( $post ) && isset( $post->post_author ) && empty( $aioseop_options['aiosp_google_disable_profile'] ) ) - $googleplus = get_the_author_meta( 'googleplus', $post->post_author ); + /** + * @param $keywords + * + * @return string + */ + function get_unique_keywords( $keywords ) { + return implode( ',', $this->clean_keyword_list( $keywords ) ); + } - if ( empty( $googleplus ) && !empty( $aioseop_options['aiosp_google_publisher'] ) ) - $googleplus = $aioseop_options['aiosp_google_publisher']; + /** + * @param $keywords + * + * @return array + */ + function clean_keyword_list( $keywords ) { + $small_keywords = array(); + if ( ! is_array( $keywords ) ) { + $keywords = $this->keyword_string_to_list( $keywords ); + } + if ( ! empty( $keywords ) ) { + foreach ( $keywords as $word ) { + $small_keywords[] = trim( $this->strtolower( $word ) ); + } + } - if ( ( is_front_page() ) && ( $page < 2 ) ) { - if ( !empty( $aioseop_options['aiosp_google_publisher'] ) ) - $publisher = $aioseop_options['aiosp_google_publisher']; + return array_unique( $small_keywords ); + } - if ( !empty( $aioseop_options["aiosp_google_author_advanced"] ) ) { - if ( empty( $aioseop_options["aiosp_google_enable_publisher"] ) ) { - $publisher = ''; - } elseif ( !empty( $aioseop_options["aiosp_google_specify_publisher"] ) ) { - $publisher = $aioseop_options["aiosp_google_specify_publisher"]; + /** + * @param $term_id + * @param $new_term_id + * @param string $term_taxonomy_id + * @param string $taxonomy + */ + function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id = '', $taxonomy = '' ) { + $terms = $this->get_all_term_data( $term_id ); + if ( ! empty( $terms ) ) { + $new_terms = $this->get_all_term_data( $new_term_id ); + if ( empty( $new_terms ) ) { + foreach ( $terms as $k => $v ) { + add_term_meta( $new_term_id, $k, $v, true ); } + add_term_meta( $term_id, '_aioseop_term_was_split', true, true ); } } - if ( is_singular() && ( !empty( $googleplus ) ) ) - $author = $googleplus; - else if ( !empty( $aioseop_options['aiosp_google_publisher'] ) ) - $author = $aioseop_options['aiosp_google_publisher']; + } - if ( !empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) { - if ( empty( $aioseop_options['aiosp_google_author_location'] ) ) - $aioseop_options['aiosp_google_author_location'] = Array(); - if ( is_front_page() && !in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) { - $author = ''; - } else { - if ( in_array( 'all', $aioseop_options['aiosp_google_author_location'] ) ) { - if ( is_singular() && !is_singular( $aioseop_options['aiosp_google_author_location'] ) ) - $author = ''; - } else { - if ( !is_singular( $aioseop_options['aiosp_google_author_location'] ) ) - $author = ''; - } + /** + * @param $term_id + * + * @return array + */ + function get_all_term_data( $term_id ) { + $terms = array(); + $optlist = array( + 'keywords', + 'description', + 'title', + 'custom_link', + 'sitemap_exclude', + 'disable', + 'disable_analytics', + 'noindex', + 'nofollow', + 'noodp', + 'noydir', + 'titleatr', + 'menulabel', + ); + foreach ( $optlist as $f ) { + $meta = get_term_meta( $term_id, '_aioseop_' . $f, true ); + if ( ! empty( $meta ) ) { + $terms[ '_aioseop_' . $f ] = $meta; } } - return Array( 'publisher' => $publisher, 'author' => $author ); + return $terms; } - function visibility_warning() { - - $aioseop_visibility_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true ); - - if ( '0' == get_option('blog_public') && empty( $aioseop_visibility_notice_dismissed ) ) { - - printf( ' -
-

- %1$s - %2$s - -

-
', - __( 'Warning: You\'re blocking access to search engines.', 'all-in-one-seo-pack' ), - sprintf( __( 'You can %s click here%s to go to your reading settings and toggle your blog visibility.', 'all-in-one-seo-pack' ), sprintf( '', esc_url( admin_url( 'options-reading.php' ) ) ), '' )); + function add_page_icon() { + wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) ); + wp_enqueue_style( 'wp-pointer' ); + $this->add_admin_pointers(); - }elseif( '1' == get_option('blog_public') && !empty( $aioseop_visibility_notice_dismissed ) ){ - delete_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed' ); + wp_enqueue_style( 'aiosp_admin_style', AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css' ); + ?> + + pointers['aioseop_menu_236'] = array( + 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-pro-aioseop_class', + 'pointer_text' => '

' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION ) + . '

' . __( 'Thank you for running the latest and greatest All in One SEO Pack Pro ever! Please review your settings, as we\'re always adding new features for you!', 'all-in-one-seo-pack' ) . '

', + 'pointer_edge' => 'top', + 'pointer_align' => 'left', + 'pointer_scope' => 'global', + ); + $this->pointers['aioseop_welcome_230'] = array( + 'pointer_target' => '#aioseop_top_button', + 'pointer_text' => '

' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION ) + . '

' . __( 'New in 2.4: Improved support for taxonomies, Woocommerce and massive performance improvements under the hood! Please review your settings on each options page!', 'all-in-one-seo-pack' ) . '

', + 'pointer_edge' => 'bottom', + 'pointer_align' => 'left', + 'pointer_scope' => 'local', + ); + $this->filter_pointers(); + } else { + $this->pointers['aioseop_menu_220'] = array( + 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class', + 'pointer_text' => '

' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION ) + . '

' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! Please review your settings, as we\'re always adding new features for you!', 'all-in-one-seo-pack' ) . '

', + 'pointer_edge' => 'top', + 'pointer_align' => 'left', + 'pointer_scope' => 'global', + ); + $this->pointers['aioseop_welcome_220'] = array( + 'pointer_target' => '#aioseop_top_button', + 'pointer_text' => '

' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION ) + . '

' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! New since 2.2: Control who accesses your site with the new Robots.txt Editor and File Editor modules! Enable them from the Feature Manager. Remember to review your settings, we have added some new ones!', 'all-in-one-seo-pack' ) . '

', + 'pointer_edge' => 'bottom', + 'pointer_align' => 'left', + 'pointer_scope' => 'local', + ); + $this->filter_pointers(); + } } - function woo_upgrade_notice() { - - $aioseop_woo_upgrade_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true ); + function add_page_hooks() { - if ( class_exists( 'WooCommerce' ) && empty( $aioseop_woo_upgrade_notice_dismissed ) && current_user_can( 'manage_options' ) ) { + global $aioseop_options; - printf( ' -
-

- %1$s - %2$s + $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(); -

-
', - __( 'We\'ve detected you\'re running WooCommerce.', 'all-in-one-seo-pack' ), - sprintf( __( '%s Upgrade%s to All in One SEO Pack Pro for increased SEO compatibility for your products.', 'all-in-one-seo-pack' ), sprintf( '', esc_url( 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=woo' ) ), '' )); + $aiosp_enablecpost = ''; + if ( isset( $_REQUEST['aiosp_enablecpost'] ) ) { + $aiosp_enablecpost = $_REQUEST['aiosp_enablecpost']; + } - }elseif( !class_exists( 'WooCommerce' ) && !empty( $aioseop_woo_upgrade_notice_dismissed ) ){ - delete_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed' ); + 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; } - } + } - function get_robots_meta() { - global $aioseop_options; - $opts = $this->meta_opts; - $page = $this->get_page_number(); - $robots_meta = $tax_noindex = ''; - if ( isset( $aioseop_options['aiosp_tax_noindex'] ) ) $tax_noindex = $aioseop_options['aiosp_tax_noindex']; + foreach ( $pt as $p ) { + if ( ! empty( $post_objs[ $p ]->label ) ) { + $all_post_types[ $p ] = $post_objs[ $p ]->label; + } + } - if ( empty( $tax_noindex ) || !is_array( $tax_noindex) ) $tax_noindex = Array(); + $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'] ); - $aiosp_noindex = $aiosp_nofollow = $aiosp_noodp = $aiosp_noydir = ''; - $noindex = "index"; - $nofollow = "follow"; - if ( ( is_category() && !empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( !is_category() && is_archive() && !is_tag() && !is_tax() - && ( ( is_date() && !empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && !empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) ) - || ( is_tag() && !empty( $aioseop_options['aiosp_tags_noindex'] ) ) - || ( is_search() && !empty( $aioseop_options['aiosp_search_noindex'] ) ) - || ( is_404() && !empty( $aioseop_options['aiosp_404_noindex'] ) ) - || ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) ) ) { - $noindex = 'noindex'; - } elseif ( ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) ) { - $post_type = get_post_type(); - if ( !empty( $opts ) ) { - $aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) ); - $aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) ); - $aiosp_noodp = htmlspecialchars( stripslashes( $opts['aiosp_noodp'] ) ); - $aiosp_noydir = htmlspecialchars( stripslashes( $opts['aiosp_noydir'] ) ); - } - if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || !empty( $aioseop_options['aiosp_cpostnoindex'] ) - || !empty( $aioseop_options['aiosp_cpostnofollow'] ) || !empty( $aioseop_options['aiosp_cpostnoodp'] ) || !empty( $aioseop_options['aiosp_cpostnoydir'] ) - || !empty( $aioseop_options['aiosp_paginated_noindex'] ) || !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) { - if ( ( $aiosp_noindex == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && ( ( $page > 1 ) ) ) || - ( ( $aiosp_noindex == '' ) && ( !empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) ) ) - $noindex = "noindex"; - if ( ( $aiosp_nofollow == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && ( ( $page > 1 ) ) ) || - ( ( $aiosp_nofollow == '' ) && ( !empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) ) ) ) - $nofollow = "nofollow"; - if ( ( $aiosp_noodp == 'on' ) || ( empty( $aiosp_noodp ) && ( !empty( $aioseop_options['aiosp_cpostnoodp'] ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoodp'] ) ) ) ) ) - $aiosp_noodp = true; - else - $aiosp_noodp = false; - if ( ( $aiosp_noydir == 'on' ) || ( empty( $aiosp_noydir ) && ( !empty( $aioseop_options['aiosp_cpostnoydir'] ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoydir'] ) ) ) ) ) - $aiosp_noydir = true; - else - $aiosp_noydir = false; + 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' ) . "
($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' ) + . ''; + $this->help_anchors[ $field ] = '#custom-titles'; + $this->layout['cpt']['options'][] = $field; } } - if ( !empty( $aioseop_options['aiosp_noodp'] ) && $aioseop_options['aiosp_noodp'] ) $aiosp_noodp = true; - if ( !empty( $aioseop_options['aiosp_noydir'] ) && $aioseop_options['aiosp_noydir'] ) $aiosp_noydir = true; - if ( $aiosp_noodp ) $nofollow .= ',noodp'; - if ( $aiosp_noydir ) $nofollow .= ',noydir'; - $robots_meta = $noindex . ',' . $nofollow; - if ( $robots_meta == 'index,follow' ) $robots_meta = ''; - return $robots_meta; - } + 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; - function get_main_description( $post = null ) { - global $aioseop_options; - $opts = $this->meta_opts; - $description = ''; - if ( is_author() && $this->show_page_description() ) { - $description = $this->internationalize( get_the_author_meta( 'description' ) ); - } else if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) { - //$description = $this->get_post_description( $post ); - //$description = $this->apply_cf_fields( $description ); - if ( !(woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ){ - $description = trim( ( $this->internationalize( get_post_meta( $post->ID, "_aioseop_description", true ) ) ) ); - } - else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && !empty( $aioseop_options['aiosp_use_static_home_info'] ) ){ - //$description = $this->get_aioseop_description( $post ); - $description = trim( ( $this->internationalize( get_post_meta( $post->ID, "_aioseop_description", true ) ) ) ); - }else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ){ - $description = $this->get_aioseop_description( $post ); + 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'] ); } - } else if ( is_front_page() ) { - $description = $this->get_aioseop_description( $post ); - } else if ( is_single() || is_page() || is_attachment() || is_home() || $this->is_static_posts_page() ) { - $description = $this->get_aioseop_description( $post ); - } else if ( ( is_category() || is_tag() || is_tax() ) && $this->show_page_description() ) { - if ( !empty( $opts ) && AIOSEOPPRO ) $description = $opts['aiosp_description']; - if ( empty( $description ) ) $description = term_description(); - $description = $this->internationalize( $description ); + + 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' ) . + ''; + $this->help_anchors[ $field ] = '#custom-titles'; + $this->layout['cpt']['options'][] = $field; + } + } } - if ( empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) { - $description = $this->trim_excerpt_without_filters( $description ); + $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 ); } - return $description; - } - function trim_description( $description ) { - $description = trim( wp_strip_all_tags( $description ) ); - $description = str_replace( '"', '"', $description ); - $description = str_replace( "\r\n", ' ', $description ); - $description = str_replace( "\n", ' ', $description ); - return $description; + add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 ); + parent::add_page_hooks(); } - function apply_description_format( $description, $post = null ) { - global $aioseop_options; - $description_format = $aioseop_options['aiosp_description_format']; - if ( !isset( $description_format ) || empty( $description_format ) ) { - $description_format = "%description%"; - } - $description = str_replace( '%description%', apply_filters( 'aioseop_description_override', $description ), $description_format ); - if ( strpos( $description, '%blog_title%' ) !== false ) $description = str_replace( '%blog_title%', get_bloginfo( 'name' ), $description ); - if ( strpos( $description, '%blog_description%' ) !== false ) $description = str_replace( '%blog_description%', get_bloginfo( 'description' ), $description ); - if ( strpos( $description, '%wp_title%' ) !== false ) $description = str_replace( '%wp_title%', $this->get_original_title(), $description ); - if ( strpos( $description, '%post_title%' ) !== false ) $description = str_replace( '%post_title%', $this->get_aioseop_title( $post ), $description ); + function settings_page_init() { + add_filter( "{$this->prefix}submit_options", array( $this, 'filter_submit' ) ); + } + function enqueue_scripts() { + add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 ); + add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 ); + parent::enqueue_scripts(); + } - /*this was intended to make attachment descriptions unique if pulling from the parent... let's remove it and see if there are any problems - *on the roadmap is to have a better hierarchy for attachment description pulling - * if ($aioseop_options['aiosp_can']) $description = $this->make_unique_att_desc($description); - */ + /** + * @param $submit + * + * @return mixed + */ + function filter_submit( $submit ) { + $submit['Submit_Default']['value'] = __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' »'; + $submit['Submit_All_Default'] = array( + 'type' => 'submit', + 'class' => 'button-secondary', + 'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' »', + ); - return $description; + return $submit; } - function make_unique_att_desc($description){ - global $wp_query; - if( is_attachment() ) { - - $url = $this->aiosp_mrt_get_url( $wp_query ); - if ( $url ) { - $matches = Array(); - preg_match_all( '/(\d+)/', $url, $matches ); - if ( is_array( $matches ) ){ - $uniqueDesc = join( '', $matches[0] ); + /** + * Handle resetting options to defaults, but preserve the license key if pro. + * + * @param null $location + * @param bool $delete + */ + function reset_options( $location = null, $delete = false ) { + if ( AIOSEOPPRO ) { + global $aioseop_update_checker; + } + if ( $delete === true ) { + + if ( AIOSEOPPRO ) { + $license_key = ''; + if ( isset( $this->options ) && isset( $this->options['aiosp_license_key'] ) ) { + $license_key = $this->options['aiosp_license_key']; } } - $description .= ' ' . $uniqueDesc; - return $description; - } - } - function get_main_keywords() { - global $aioseop_options; - global $aioseop_keywords; - global $post; - $opts = $this->meta_opts; - if ( ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && !$this->is_static_posts_page() ) || $this->is_static_front_page() ) ) { - if ( !empty( $aioseop_options['aiosp_use_static_home_info'] ) ) { - $keywords = $this->get_all_keywords(); + $this->delete_class_option( $delete ); + + if ( AIOSEOPPRO ) { + $this->options = array( 'aiosp_license_key' => $license_key ); } else { - $keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) ); + $this->options = array(); } - } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) { - $keywords = stripslashes( $this->internationalize( $opts["aiosp_keywords"] ) ); // and if option = use page set keywords instead of keywords from recent posts - } elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) { - $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, "_aioseop_keywords", true ) ) ); - } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) { - $keywords = ""; - } else { - $keywords = $this->get_all_keywords(); } - return $keywords; - } + $default_options = $this->default_options( $location ); - function wp_head() { - if ( !$this->is_page_included() ) return; - $opts = $this->meta_opts; - global $aioseop_update_checker, $wp_query, $aioseop_options, $posts; - static $aioseop_dup_counter = 0; - $aioseop_dup_counter++; - if ( $aioseop_dup_counter > 1 ) { - echo "\n\n"; - return; - } - if ( is_home() && !is_front_page() ) { - $post = aiosp_common::get_blog_page(); - } else { - $post = $this->get_queried_object(); + if ( AIOSEOPPRO ) { + foreach ( $default_options as $k => $v ) { + if ( $k != 'aiosp_license_key' ) { + $this->options[ $k ] = $v; + } } - $meta_string = null; - $description = ''; - // logging - rewrite handler check for output buffering - $this->check_rewrite_handler(); - if ( AIOSEOPPRO ) { - echo "\n\n"; - if ( AIOSEOPPRO ) echo "\n"; - $blog_page = aiosp_common::get_blog_page( $post ); - $save_posts = $posts; - if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) { - global $posts; - $opts = $this->meta_opts = $this->get_current_options( Array(), 'aiosp', null, $post ); - $posts = Array(); - $posts[] = $post; - } - $posts = $save_posts; - $description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) ); // get the description - // handle the description format - if ( isset($description) && ( $this->strlen($description) > $this->minimum_description_length ) && !( is_front_page() && is_paged() ) ) { - $description = $this->trim_description( $description ); - if ( !isset( $meta_string) ) $meta_string = ''; - // description format - $description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) ); - $desc_attr = ''; - if ( !empty( $aioseop_options['aiosp_schema_markup'] ) ) - $desc_attr = 'itemprop="description"'; - $desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr ); - $meta_string .= sprintf( "\n", $desc_attr, $description ); - } - // get the keywords - $togglekeywords = 0; - if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) - $togglekeywords = $aioseop_options['aiosp_togglekeywords']; - if ( $togglekeywords == 0 && !( is_front_page() && is_paged() ) ) { - $keywords = $this->get_main_keywords(); - $keywords = $this->apply_cf_fields( $keywords ); - $keywords = apply_filters( 'aioseop_keywords', $keywords ); - - if ( isset( $keywords ) && !empty( $keywords ) ) { - if ( isset( $meta_string ) ) $meta_string .= "\n"; - $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) ); - $key_attr = ''; - if ( !empty( $aioseop_options['aiosp_schema_markup'] ) ) - $key_attr = 'itemprop="keywords"'; - $key_attr = apply_filters( 'aioseop_keywords_attributes', $key_attr ); - $meta_string .= sprintf( "\n", $key_attr, $keywords ); - } - } - // handle noindex, nofollow - robots meta - $robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() ); - if ( !empty( $robots_meta ) ) - $meta_string .= '' . "\n"; - // handle site verification - if ( is_front_page() ) { - foreach( Array( 'google' => 'google-site-verification', 'bing' => 'msvalidate.01', 'pinterest' => 'p:domain_verify' ) as $k => $v ) - if ( !empty( $aioseop_options["aiosp_{$k}_verify"] ) ) - $meta_string .= '' . "\n"; - - // sitelinks search - if ( !empty( $aioseop_options["aiosp_google_sitelinks_search"] ) || !empty( $aioseop_options["aiosp_google_set_site_name"] ) ) - $meta_string .= $this->sitelinks_search_box() . "\n"; - } - // handle extra meta fields - foreach( Array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) { - if ( !empty( $aioseop_options["aiosp_{$meta}_tags" ] ) ) - $$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags" ] ), ENT_QUOTES ); - else - $$meta = ''; - } - if ( is_page() && isset( $page_meta ) && !empty( $page_meta ) && ( !is_front_page() || empty( $front_meta ) ) ) { - if ( isset( $meta_string ) ) $meta_string .= "\n"; - $meta_string .= $page_meta; - } - if ( is_single() && isset( $post_meta ) && !empty( $post_meta ) ) { - if ( isset( $meta_string ) ) $meta_string .= "\n"; - $meta_string .= $post_meta; - } - // handle authorship - $authorship = $this->get_google_authorship( $post ); - $publisher = apply_filters( 'aioseop_google_publisher', $authorship["publisher"] ); - if ( !empty( $publisher ) ) - $meta_string = '' . "\n" . $meta_string; - $author = apply_filters( 'aioseop_google_author', $authorship["author"] ); - if ( !empty( $author ) ) - $meta_string = '' . "\n" . $meta_string; - - if ( is_front_page() && !empty( $front_meta ) ) { - if ( isset( $meta_string ) ) $meta_string .= "\n"; - $meta_string .= $front_meta; - } else { - if ( is_home() && !empty( $home_meta ) ) { - if ( isset( $meta_string ) ) $meta_string .= "\n"; - $meta_string .= $home_meta; - } - } - $prev_next = $this->get_prev_next_links( $post ); - $prev = apply_filters( 'aioseop_prev_link', $prev_next['prev'] ); - $next = apply_filters( 'aioseop_next_link', $prev_next['next'] ); - if ( !empty( $prev ) ) $meta_string .= "\n"; - if ( !empty( $next ) ) $meta_string .= "\n"; - if ( $meta_string != null ) echo "$meta_string\n"; - // handle canonical links - $show_page = true; - if ( !empty( $aioseop_options["aiosp_no_paged_canonical_links"] ) ) $show_page = false; - - if ( $aioseop_options['aiosp_can'] ) { - $url = ''; - if ( !empty( $aioseop_options['aiosp_customize_canonical_links'] ) && !empty( $opts['aiosp_custom_link'] ) ) $url = $opts['aiosp_custom_link']; - if ( empty( $url ) ) - $url = $this->aiosp_mrt_get_url( $wp_query, $show_page ); - $url = apply_filters( 'aioseop_canonical_url', $url ); - if ( !empty( $url ) ) - echo ''."\n"; - } - do_action( 'aioseop_modules_wp_head' ); - if ( AIOSEOPPRO ) { - echo "\n"; - } else{ - echo "\n"; + $aioseop_update_checker->license_key = $this->options['aiosp_license_key']; + } else { + foreach ( $default_options as $k => $v ) { + $this->options[ $k ] = $v; } - } - - function override_options( $options, $location, $settings ) { - if ( class_exists( 'DOMDocument' ) ) { - $options['aiosp_google_connect'] = $settings['aiosp_google_connect']['default']; } - return $options; + $this->update_class_option( $this->options ); } - function get_analytics_domain() { - global $aioseop_options; - if ( !empty( $aioseop_options['aiosp_ga_domain'] ) ) - return $this->sanitize_domain( $aioseop_options['aiosp_ga_domain'] ); - return ''; - } + /** + * @param $settings + * @param $location + * @param $current + * + * @return mixed + */ + function filter_settings( $settings, $location, $current ) { + if ( $location == null ) { + $prefix = $this->prefix; - function universal_analytics() { - global $aioseop_options; - $analytics = ''; - if ( !empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { - $allow_linker = $cookie_domain = $domain = $addl_domains = $domain_list = ''; - if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) ) - $cookie_domain = $this->get_analytics_domain(); - if ( !empty( $cookie_domain ) ) { - $cookie_domain = esc_js( $cookie_domain ); - $cookie_domain = "'cookieDomain': '{$cookie_domain}'"; + foreach ( array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt ) { + unset( $settings["{$prefix}$opt"] ); } - if ( empty( $cookie_domain ) ) { - $domain = ", 'auto'"; + + if ( ! class_exists( 'DOMDocument' ) ) { + unset( $settings['{prefix}google_connect'] ); } - if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) { - $allow_linker = "'allowLinker': true"; - if ( !empty( $aioseop_options['aiosp_ga_addl_domains'] ) ) { - $addl_domains = trim( $aioseop_options['aiosp_ga_addl_domains'] ); - $addl_domains = preg_split('/[\s,]+/', $addl_domains); - if ( !empty( $addl_domains ) ) { - foreach( $addl_domains as $d ) { - $d = $this->sanitize_domain( $d ); - if ( !empty( $d ) ) { - if ( !empty( $domain_list ) ) - $domain_list .= ", "; - $domain_list .= "'" . $d . "'"; - } - } - } + if ( AIOSEOPPRO ) { + if ( ! empty( $this->options['aiosp_license_key'] ) ) { + $settings['aiosp_license_key']['type'] = 'password'; + $settings['aiosp_license_key']['size'] = 38; } } - $extra_options = ''; - if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) { - $extra_options .= "ga('require', 'displayfeatures');"; + } elseif ( $location == 'aiosp' ) { + global $post, $aioseop_sitemap; + $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( ! empty( $post ) ) { + $post_type = get_post_type( $post ); + if ( ! empty( $this->options['aiosp_cpostnoindex'] ) && in_array( $post_type, $this->options['aiosp_cpostnoindex'] ) ) { + $settings["{$prefix}noindex"]['type'] = 'select'; + $settings["{$prefix}noindex"]['initial_options'] = array( + '' => __( 'Default - noindex', 'all-in-one-seo-pack' ), + 'off' => __( 'index', 'all-in-one-seo-pack' ), + 'on' => __( 'noindex', 'all-in-one-seo-pack' ), + ); + } + if ( ! empty( $this->options['aiosp_cpostnofollow'] ) && in_array( $post_type, $this->options['aiosp_cpostnofollow'] ) ) { + $settings["{$prefix}nofollow"]['type'] = 'select'; + $settings["{$prefix}nofollow"]['initial_options'] = array( + '' => __( 'Default - nofollow', 'all-in-one-seo-pack' ), + 'off' => __( 'follow', 'all-in-one-seo-pack' ), + 'on' => __( 'nofollow', 'all-in-one-seo-pack' ), + ); + } + if ( ! empty( $this->options['aiosp_cpostnoodp'] ) && in_array( $post_type, $this->options['aiosp_cpostnoodp'] ) ) { + $settings["{$prefix}noodp"]['type'] = 'select'; + $settings["{$prefix}noodp"]['initial_options'] = array( + '' => __( 'Default - noodp', 'all-in-one-seo-pack' ), + 'off' => __( 'odp', 'all-in-one-seo-pack' ), + 'on' => __( 'noodp', 'all-in-one-seo-pack' ), + ); + } + if ( ! empty( $this->options['aiosp_cpostnoydir'] ) && in_array( $post_type, $this->options['aiosp_cpostnoydir'] ) ) { + $settings["{$prefix}noydir"]['type'] = 'select'; + $settings["{$prefix}noydir"]['initial_options'] = array( + '' => __( 'Default - noydir', 'all-in-one-seo-pack' ), + 'off' => __( 'ydir', 'all-in-one-seo-pack' ), + 'on' => __( 'noydir', 'all-in-one-seo-pack' ), + ); + } + global $post; + $info = $this->get_page_snippet_info(); + extract( $info ); + $settings["{$prefix}title"]['placeholder'] = $title; + $settings["{$prefix}description"]['placeholder'] = $description; + $settings["{$prefix}keywords"]['placeholder'] = $keywords; } - if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_enhanced_ecommerce'] ) ) { - if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t"; - $extra_options .= "ga('require', 'ec');"; + + if ( ! AIOSEOPPRO ) { + if ( ! current_user_can( 'update_plugins' ) ) { + unset( $settings["{$prefix}upgrade"] ); + } } - if ( !empty( $domain_list ) ) { - if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t"; - $extra_options .= "ga('require', 'linker');\n\t\t\tga('linker:autoLink', [{$domain_list}] );"; + + if ( ! is_object( $aioseop_sitemap ) ) { + unset( $settings['aiosp_sitemap_exclude'] ); } - if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) { - if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t"; - $extra_options .= "ga('require', 'linkid', 'linkid.js');"; + if ( is_object( $post ) ) { + if ( $post->post_type != 'page' ) { + unset( $settings["{$prefix}titleatr"] ); + unset( $settings["{$prefix}menulabel"] ); + } + } + if ( ! empty( $this->options[ $this->prefix . 'togglekeywords' ] ) ) { + unset( $settings["{$prefix}keywords"] ); + unset( $settings["{$prefix}togglekeywords"] ); + } elseif ( ! empty( $current["{$prefix}togglekeywords"] ) ) { + unset( $settings["{$prefix}keywords"] ); + } + if ( empty( $this->options['aiosp_can'] ) || empty( $this->options['aiosp_customize_canonical_links'] ) ) { + unset( $settings["{$prefix}custom_link"] ); } + } - if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) { - if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t"; - $extra_options .= "ga('set', 'anonymizeIp', true);"; + return $settings; + } + + /** + * @param $options + * @param $location + * + * @return mixed + */ + function filter_options( $options, $location ) { + if ( $location == 'aiosp' ) { + global $post; + if ( ! empty( $post ) ) { + $prefix = $this->prefix; + $post_type = get_post_type( $post ); + foreach ( array( 'noindex', 'nofollow', 'noodp', 'noydir' ) as $no ) { + if ( empty( $this->options[ 'aiosp_cpost' . $no ] ) || ( ! in_array( $post_type, $this->options[ 'aiosp_cpost' . $no ] ) ) ) { + if ( isset( $options["{$prefix}{$no}"] ) && ( $options["{$prefix}{$no}"] != 'on' ) ) { + unset( $options["{$prefix}{$no}"] ); + } + } + } + } + } + if ( $location == null ) { + $prefix = $this->prefix; + if ( isset( $options["{$prefix}rewrite_titles"] ) && ( ! empty( $options["{$prefix}rewrite_titles"] ) ) ) { + $options["{$prefix}rewrite_titles"] = 1; } - $js_options = Array(); - foreach( Array( 'cookie_domain', 'allow_linker' ) as $opts ) { - if ( !empty( $$opts ) ) $js_options[] = $$opts; + if ( isset( $options["{$prefix}enablecpost"] ) && ( $options["{$prefix}enablecpost"] === '' ) ) { + $options["{$prefix}enablecpost"] = 0; } - if ( !empty( $js_options ) ) { - $js_options = join( ',', $js_options ); - $js_options = ', { ' . $js_options . ' } '; - } else $js_options = ''; - $analytics_id = esc_js( $aioseop_options["aiosp_google_analytics_id"] ); - $analytics =<< - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + if ( isset( $options["{$prefix}use_original_title"] ) && ( $options["{$prefix}use_original_title"] === '' ) ) { + $options["{$prefix}use_original_title"] = 0; + } + } - ga('create', '{$analytics_id}'{$domain}{$js_options}); - {$extra_options} - ga('send', 'pageview'); - + return $options; + } -EOF; + function template_redirect() { + global $aioseop_options; + + $post = $this->get_queried_object(); + + if ( ! $this->is_page_included() ) { + return; } - return $analytics; - } -function aiosp_google_analytics() { - global $aioseop_options; - $analytics = ''; - if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_exclude_users'] ) ) { - if ( is_user_logged_in() ) { - global $current_user; - if ( empty( $current_user ) ) get_currentuserinfo(); - if ( !empty( $current_user ) ) { - $intersect = array_intersect( $aioseop_options['aiosp_ga_exclude_users'], $current_user->roles ); - if ( !empty( $intersect ) ) return; - } - } - } - if ( !empty( $aioseop_options['aiosp_google_analytics_id'] ) ) { - ob_start(); - $analytics = $this->universal_analytics(); - echo $analytics; - if ( empty( $analytics ) ) { -?> - - -get_queried_object(); + $post_type = ''; + if ( ! empty( $post ) && ! empty( $post->post_type ) ) { + $post_type = $post->post_type; + } + if ( empty( $aioseop_options['aiosp_enablecpost'] ) ) { + $wp_post_types = get_post_types( array( '_builtin' => true ) ); // Don't display meta if SEO isn't enabled on custom post types -- pdb. + if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) { + return false; + } + } else { + $wp_post_types = $aioseop_options['aiosp_cpostactive']; + if ( empty( $wp_post_types ) ) { + $wp_post_types = array(); + } + if ( AIOSEOPPRO ) { + if ( is_tax() ) { + if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! is_tax( $aioseop_options['aiosp_taxactive'] ) ) { + return false; + } + } elseif ( is_category() ) { + if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! in_array( 'category', $aioseop_options['aiosp_taxactive'] ) ) { + return false; + } + } elseif ( is_tag() ) { + if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! in_array( 'post_tag', $aioseop_options['aiosp_taxactive'] ) ) { + return false; + } + } else if ( ! in_array( $post_type, $wp_post_types ) && ! is_front_page() && ! is_post_type_archive( $wp_post_types ) && ! is_404() ) { + return false; + } } else { - $blog_name = get_bloginfo( 'name' ); + if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) { + return false; + } + if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) { + return false; + } } - $blog_name = esc_attr( $blog_name ); - $name_block=<<meta_opts = $this->get_current_options( array(), 'aiosp' ); - $search_box=<< - { - "@context": "http://schema.org", - "@type": "WebSite", -EOF; - if ( !empty( $name_block ) ) $search_box .= $name_block; - if ( !empty( $search_block ) ) $search_box .= $search_block; - $search_box.=<< -EOF; - return apply_filters( 'aiosp_sitelinks_search_box', $search_box ); - } + $aiosp_disable = $aiosp_disable_analytics = false; - function aiosp_mrt_get_url( $query, $show_page = true ) { - if ( $query->is_404 || $query->is_search ) - return false; - $link = ''; - $haspost = count( $query->posts ) > 0; - if ( get_query_var( 'm' ) ) { - $m = preg_replace( '/[^0-9]/', '', get_query_var( 'm' ) ); - switch ( $this->strlen( $m ) ) { - case 4: $link = get_year_link( $m ); break; - case 6: $link = get_month_link( $this->substr( $m, 0, 4), $this->substr($m, 4, 2 ) ); break; - case 8: $link = get_day_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ), $this->substr( $m, 6, 2 ) ); break; - default: - return false; + if ( ! empty( $this->meta_opts ) ) { + if ( isset( $this->meta_opts['aiosp_disable'] ) ) { + $aiosp_disable = $this->meta_opts['aiosp_disable']; } - } elseif ( ( $query->is_home && (get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) ) { - $link = get_permalink( $pageid ); - } elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || !get_option( 'page_for_posts' ) ) ) ) { - if ( function_exists( 'icl_get_home_url' ) ) { - $link = icl_get_home_url(); - } else { - $link = trailingslashit( home_url() ); + if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) { + $aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics']; } - } elseif ( ( $query->is_single || $query->is_page ) && $haspost ) { - $post = $query->posts[0]; - $link = get_permalink( $post->ID ); - } elseif ( $query->is_author && $haspost ) { - $author = get_userdata( get_query_var( 'author' ) ); - if ($author === false) return false; - $link = get_author_posts_url( $author->ID, $author->user_nicename ); - } elseif ( $query->is_category && $haspost ) { - $link = get_category_link( get_query_var( 'cat' ) ); - } elseif ( $query->is_tag && $haspost ) { - $tag = get_term_by( 'slug', get_query_var( 'tag' ), 'post_tag' ); - if ( !empty( $tag->term_id ) ) - $link = get_tag_link( $tag->term_id ); - } elseif ( $query->is_day && $haspost ) { - $link = get_day_link( get_query_var( 'year' ), - get_query_var( 'monthnum' ), - get_query_var( 'day' ) ); - } elseif ( $query->is_month && $haspost ) { - $link = get_month_link( get_query_var( 'year' ), - get_query_var( 'monthnum' ) ); - } elseif ( $query->is_year && $haspost ) { - $link = get_year_link( get_query_var( 'year' ) ); - } elseif ( $query->is_tax && $haspost ) { - $taxonomy = get_query_var( 'taxonomy' ); - $term = get_query_var( 'term' ); - if ( !empty( $term ) ) - $link = get_term_link( $term, $taxonomy ); - } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) { - if ( is_array( $post_type ) ) - $post_type = reset( $post_type ); - $link = get_post_type_archive_link( $post_type ); - } else { - return false; - } - if ( empty( $link ) || !is_string( $link ) ) return false; - if ( apply_filters( 'aioseop_canonical_url_pagination', $show_page ) ) - $link = $this->get_paged( $link ); - if ( !empty( $link ) ) { - global $aioseop_options; - if ( !empty( $aioseop_options['aiosp_can_set_protocol'] ) && ( $aioseop_options['aiosp_can_set_protocol'] != 'auto' ) ) { - if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) { - $link = preg_replace("/^https:/i", "http:", $link ); - } elseif ( $aioseop_options['aiosp_can_set_protocol'] == 'https' ) { - $link = preg_replace("/^http:/i", "https:", $link ); + } + + if ( $aiosp_disable ) { + if ( ! $aiosp_disable_analytics ) { + if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) { + remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) ); + add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) ); } } + + return false; } - return $link; + + if ( ! empty( $this->meta_opts ) && $this->meta_opts['aiosp_disable'] == true ) { + return false; + } + + return true; } - function get_page_number() { - $page = get_query_var( 'page' ); - if ( empty( $page ) ) - $page = get_query_var( 'paged' ); - return $page; + /** + * @param $content + * + * @return mixed|string + */ + function output_callback_for_title( $content ) { + return $this->rewrite_title( $content ); } - function get_paged( $link ) { - global $wp_rewrite; - $page = $this->get_page_number(); - $page_name = 'page'; - if ( !empty( $wp_rewrite ) && !empty( $wp_rewrite->pagination_base ) ) $page_name = $wp_rewrite->pagination_base; - if ( !empty( $page ) && $page > 1 ) { - if ( get_query_var( 'page' ) == $page ) - $link = trailingslashit( $link ) . "$page"; - else - $link = trailingslashit( $link ) . trailingslashit( $page_name ) . $page; - $link = user_trailingslashit( $link, 'paged' ); + /** + * Used for forcing title rewrites. + * + * @param $header + * + * @return mixed|string + */ + function rewrite_title( $header ) { + global $wp_query; + if ( ! $wp_query ) { + $header .= "\n"; + + return $header; + } + $title = $this->wp_title(); + if ( ! empty( $title ) ) { + $header = $this->replace_title( $header, $title ); } - return $link; - } - function is_singular( $post_types = Array(), $post = null ) { - if ( !empty( $post_types ) && is_object( $post ) ) - return in_array( $post->post_type, (array)$post_types ); - else - return is_singular( $post_types ); + return $header; } - function show_page_description() { - global $aioseop_options; - if ( !empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { - $page = $this->get_page_number(); - if ( !empty( $page ) && ( $page > 1 ) ) - return false; - } - return true; + /** + * @param $content + * @param $title + * + * @return mixed + */ + function replace_title( $content, $title ) { + // We can probably improve this... I'm not sure half of this is even being used. + $title = trim( strip_tags( $title ) ); + $title_tag_start = 'strpos( $content, $title_tag_start ); + $end = $this->strpos( $content, $title_tag_end ); + $this->title_start = $start; + $this->title_end = $end; + $this->orig_title = $title; + + return preg_replace( '/]*?)\s*>([^<]*?)<\/title\s*>/is', '' . preg_replace( '/(\$|\\\\)(?=\d)/', '\\\\\1', strip_tags( $title ) ) . '', $content, 1 ); } - function get_post_description( $post ) { - global $aioseop_options; - $description = ''; - if ( !$this->show_page_description() ) { - return ''; - } - $description = trim( ( $this->internationalize( get_post_meta( $post->ID, "_aioseop_description", true ) ) ) ); - if ( !empty( $post ) && post_password_required( $post ) ) { - return $description; + function add_hooks() { + global $aioseop_options, $aioseop_update_checker; + + // MOVED TO MAIN PLUGIN FILE IN ORDER TO FIRE SOONS + //$role = get_role( 'administrator' ); + //if ( is_object( $role ) ) { + // $role->add_cap( 'aiosp_manage_seo' ); + //} + + aioseop_update_settings_check(); + add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' ); + if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) { + add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 ); } - if ( !$description ) { - if ( empty( $aioseop_options["aiosp_skip_excerpt"] ) ) - $description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) ); - if ( !$description && $aioseop_options["aiosp_generate_descriptions"] ) { - $content = $post->post_content; - if ( !empty( $aioseop_options["aiosp_run_shortcodes"] ) ) $content = do_shortcode( $content ); - $content = wp_strip_all_tags( $content ); - $description = $this->trim_excerpt_without_filters( $this->internationalize( $content ) ); + + if ( is_admin() ) { + add_action( 'admin_menu', array( $this, 'admin_menu' ) ); + add_action( 'admin_head', array( $this, 'add_page_icon' ) ); + add_action( 'admin_init', 'aioseop_addmycolumns', 1 ); + add_action( 'admin_init', 'aioseop_handle_ignore_notice' ); + if ( AIOSEOPPRO ) { + if ( current_user_can( 'update_plugins' ) ) { + add_action( 'admin_notices', array( $aioseop_update_checker, 'key_warning' ) ); + } + add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, array( + $aioseop_update_checker, + 'add_plugin_row', + ) ); + } + } else { + if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' ) { + remove_action( 'wp_head', 'rel_canonical' ); + } + // Analytics. + if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) { + add_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) ); } + add_filter( 'wp_list_pages', 'aioseop_list_pages' ); + add_action( 'wp_head', array( $this, 'wp_head' ), apply_filters( 'aioseop_wp_head_priority', 1 ) ); + add_action( 'template_redirect', array( $this, 'template_redirect' ), 0 ); + add_filter( 'wp_list_pages_excludes', 'aioseop_get_pages_start' ); + add_filter( 'get_pages', 'aioseop_get_pages' ); } - - // "internal whitespace trim" - $description = preg_replace( "/\s\s+/u", " ", $description ); - return $description; } + function visibility_warning() { - function get_aioseop_description( $post = null ) { - global $aioseop_options; - if ( $post === null ) - $post = $GLOBALS["post"]; - $blog_page = aiosp_common::get_blog_page(); - $description = ''; - if ( is_front_page() && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) - $description = trim( ( $this->internationalize( $aioseop_options['aiosp_home_description'] ) ) ); - elseif ( !empty( $blog_page ) ) - $description = $this->get_post_description( $blog_page ); - if ( empty( $description ) && is_object( $post ) && !is_archive() && empty( $blog_page ) ) - $description = $this->get_post_description( $post ); - $description = $this->apply_cf_fields( $description ); - return $description; - } + $aioseop_visibility_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true ); - function replace_title( $content, $title ) { - //We can probably improve this... I'm not sure half of this is even being used. - $title = trim( strip_tags( $title ) ); - $title_tag_start = "strpos( $content, $title_tag_start ); - $end = $this->strpos( $content, $title_tag_end ); - $this->title_start = $start; - $this->title_end = $end; - $this->orig_title = $title; + if ( '0' == get_option( 'blog_public' ) && empty( $aioseop_visibility_notice_dismissed ) ) { + + printf( ' +
+

+ %1$s + %2$s + +

+
', + __( 'Warning: You\'re blocking access to search engines.', 'all-in-one-seo-pack' ), + sprintf( __( 'You can %s click here%s to go to your reading settings and toggle your blog visibility.', 'all-in-one-seo-pack' ), sprintf( '', esc_url( admin_url( 'options-reading.php' ) ) ), '' ) ); - return preg_replace( '/]*?)\s*>([^<]*?)<\/title\s*>/is', '' . preg_replace('/(\$|\\\\)(?=\d)/', '\\\\\1', strip_tags( $title ) ) . '', $content, 1 ); + } elseif ( '1' == get_option( 'blog_public' ) && ! empty( $aioseop_visibility_notice_dismissed ) ) { + delete_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed' ); + } } - function internationalize( $in ) { - if ( function_exists( 'langswitch_filter_langs_with_message' ) ) - $in = langswitch_filter_langs_with_message( $in ); + function woo_upgrade_notice() { - if ( function_exists( 'polyglot_filter' ) ) - $in = polyglot_filter( $in ); + $aioseop_woo_upgrade_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true ); - if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) { - $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in ); - } elseif ( function_exists( 'ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) { - $in = ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in ); - } elseif ( function_exists( 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) { - $in = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in ); - } + if ( class_exists( 'WooCommerce' ) && empty( $aioseop_woo_upgrade_notice_dismissed ) && current_user_can( 'manage_options' ) ) { + + printf( ' +
+

+ %1$s + %2$s + +

+
', + __( 'We\'ve detected you\'re running WooCommerce.', 'all-in-one-seo-pack' ), + sprintf( __( '%s Upgrade%s to All in One SEO Pack Pro for increased SEO compatibility for your products.', 'all-in-one-seo-pack' ), sprintf( '', esc_url( 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=woo' ) ), '' ) ); - return apply_filters( 'localization', $in ); + } elseif ( ! class_exists( 'WooCommerce' ) && ! empty( $aioseop_woo_upgrade_notice_dismissed ) ) { + delete_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed' ); + } } - /** @return The original title as delivered by WP (well, in most cases) */ - function get_original_title( $sep = '|', $echo = false, $seplocation = '' ) { - global $aioseop_options; - if ( !empty( $aioseop_options['aiosp_use_original_title'] ) ) { - $has_filter = has_filter( 'wp_title', Array( $this, 'wp_title' ) ); - if ( $has_filter !== false ) - remove_filter( 'wp_title', Array( $this, 'wp_title' ), $has_filter ); - if ( current_theme_supports( 'title-tag' ) ) { - $sep = '|'; - $echo = false; - $seplocation = 'right'; + /** + * @param $description + * + * @return string + */ + function make_unique_att_desc( $description ) { + global $wp_query; + if ( is_attachment() ) { + + $url = $this->aiosp_mrt_get_url( $wp_query ); + if ( $url ) { + $matches = array(); + preg_match_all( '/(\d+)/', $url, $matches ); + if ( is_array( $matches ) ) { + $uniqueDesc = join( '', $matches[0] ); + } } - $title = wp_title( $sep, $echo, $seplocation ); - if ( $has_filter !== false ) - add_filter( 'wp_title', Array( $this, 'wp_title' ), $has_filter ); - if ( $title && ( $title = trim( $title ) ) ) - return trim( $title ); + $description .= ' ' . $uniqueDesc; } - // the_search_query() is not suitable, it cannot just return - global $s; + return $description; + } - $title = null; + function wp_head() { + if ( ! $this->is_page_included() ) { + return; + } + $opts = $this->meta_opts; + global $aioseop_update_checker, $wp_query, $aioseop_options, $posts; + static $aioseop_dup_counter = 0; + $aioseop_dup_counter ++; + if ( $aioseop_dup_counter > 1 ) { + echo "\n\n"; - if ( is_home() ) { - $title = get_option( 'blogname' ); - } else if ( is_single() ) { - $title = $this->internationalize( single_post_title( '', false ) ); - } else if ( is_search() && isset($s) && !empty($s) ) { - $search = esc_attr( stripslashes($s) ); - if ( !empty( $aioseop_options['aiosp_cap_titles'] ) ) - $search = $this->capitalize( $search ); - $title = $search; - } else if ( ( is_tax() || is_category() ) && !is_feed() ) { - $category_name = $this->ucwords($this->internationalize( single_cat_title( '', false ) ) ); - $title = $category_name; - } else if ( is_page() ) { - $title = $this->internationalize( single_post_title( '', false ) ); - } else if ( is_tag() ) { - global $utw; - if ( $utw ) { - $tags = $utw->GetCurrentTagSet(); - $tag = $tags[0]->tag; - $tag = str_replace('-', ' ', $tag); - } else { - // wordpress > 2.3 - $tag = $this->internationalize( single_term_title( '', false ) ); + return; + } + if ( is_home() && ! is_front_page() ) { + $post = aiosp_common::get_blog_page(); + } else { + $post = $this->get_queried_object(); + } + $meta_string = null; + $description = ''; + // Logging - rewrite handler check for output buffering. + $this->check_rewrite_handler(); + if ( AIOSEOPPRO ) { + echo "\n\n"; + if ( AIOSEOPPRO ) { + echo '\n"; + } + $blog_page = aiosp_common::get_blog_page( $post ); + $save_posts = $posts; + if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) { + global $posts; + $opts = $this->meta_opts = $this->get_current_options( array(), 'aiosp', null, $post ); + $posts = array(); + $posts[] = $post; + } + $posts = $save_posts; + $description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) ); // Get the description. + // Handle the description format. + if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) { + $description = $this->trim_description( $description ); + if ( ! isset( $meta_string ) ) { + $meta_string = ''; } - if ( $tag ) $title = $tag; - } else if ( is_author() ) { - $author = get_userdata( get_query_var( 'author' ) ); - if ( $author === false ) { - global $wp_query; - $author = $wp_query->get_queried_object(); + // Description format. + $description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) ); + $desc_attr = ''; + if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { + $desc_attr = 'itemprop="description"'; } - if ($author !== false) - $title = $author->display_name; - } else if ( is_day() ) { - $title = get_the_date(); - } else if ( is_month() ) { - $title = get_the_date( 'F, Y' ); - } else if ( is_year() ) { - $title = get_the_date( 'Y' ); - } else if ( is_archive() ) { - $title = $this->internationalize( post_type_archive_title( '', false) ); - } else if ( is_404() ) { - $title_format = $aioseop_options['aiosp_404_title_format']; - $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); - if ( strpos( $new_title, '%blog_description%' ) !== false ) $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title ); - if ( strpos( $new_title, '%request_url%' ) !== false ) $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title); - if ( strpos( $new_title, '%request_words%' ) !== false ) $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title ); - $title = $new_title; + $desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr ); + $meta_string .= sprintf( "\n", $desc_attr, $description ); } - return trim( $title ); - } + // Get the keywords. + $togglekeywords = 0; + if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) { + $togglekeywords = $aioseop_options['aiosp_togglekeywords']; + } + if ( $togglekeywords == 0 && ! ( is_front_page() && is_paged() ) ) { + $keywords = $this->get_main_keywords(); + $keywords = $this->apply_cf_fields( $keywords ); + $keywords = apply_filters( 'aioseop_keywords', $keywords ); + + if ( isset( $keywords ) && ! empty( $keywords ) ) { + if ( isset( $meta_string ) ) { + $meta_string .= "\n"; + } + $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) ); + $key_attr = ''; + if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { + $key_attr = 'itemprop="keywords"'; + } + $key_attr = apply_filters( 'aioseop_keywords_attributes', $key_attr ); + $meta_string .= sprintf( "\n", $key_attr, $keywords ); + } + } + // Handle noindex, nofollow - robots meta. + $robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() ); + if ( ! empty( $robots_meta ) ) { + $meta_string .= '' . "\n"; + } + // Handle site verification. + if ( is_front_page() ) { + foreach ( + array( + 'google' => 'google-site-verification', + 'bing' => 'msvalidate.01', + 'pinterest' => 'p:domain_verify', + ) as $k => $v + ) { + if ( ! empty( $aioseop_options["aiosp_{$k}_verify"] ) ) { + $meta_string .= '' . "\n"; + } + } - function paged_title( $title ) { - // the page number if paged - global $paged; - global $aioseop_options; - // simple tagging support - global $STagging; - $page = get_query_var( 'page' ); - if ( $paged > $page ) $page = $paged; - if ( is_paged() || ( isset($STagging) && $STagging->is_tag_view() && $paged ) || ( $page > 1 ) ) { - $part = $this->internationalize( $aioseop_options['aiosp_paged_format'] ); - if ( isset( $part ) || !empty( $part ) ) { - $part = " " . trim( $part ); - $part = str_replace( '%page%', $page, $part ); - $this->log( "paged_title() [$title] [$part]" ); - $title .= $part; + // Sitelinks search. + if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) || ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) { + $meta_string .= $this->sitelinks_search_box() . "\n"; } } - return $title; - } + // Handle extra meta fields. + foreach ( array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) { + if ( ! empty( $aioseop_options["aiosp_{$meta}_tags"] ) ) { + $$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags"] ), ENT_QUOTES ); + } else { + $$meta = ''; + } + } + if ( is_page() && isset( $page_meta ) && ! empty( $page_meta ) && ( ! is_front_page() || empty( $front_meta ) ) ) { + if ( isset( $meta_string ) ) { + $meta_string .= "\n"; + } + $meta_string .= $page_meta; + } + if ( is_single() && isset( $post_meta ) && ! empty( $post_meta ) ) { + if ( isset( $meta_string ) ) { + $meta_string .= "\n"; + } + $meta_string .= $post_meta; + } + // Handle authorship. + $authorship = $this->get_google_authorship( $post ); + $publisher = apply_filters( 'aioseop_google_publisher', $authorship['publisher'] ); + if ( ! empty( $publisher ) ) { + $meta_string = '' . "\n" . $meta_string; + } + $author = apply_filters( 'aioseop_google_author', $authorship['author'] ); + if ( ! empty( $author ) ) { + $meta_string = '' . "\n" . $meta_string; + } - function get_tax_title_format( $tax = '' ) { - global $aioseop_options; - if ( AIOSEOPPRO ){ - $title_format = '%taxonomy_title% | %blog_title%'; - if ( is_category() ) { - $title_format = $aioseop_options['aiosp_category_title_format']; + if ( is_front_page() && ! empty( $front_meta ) ) { + if ( isset( $meta_string ) ) { + $meta_string .= "\n"; + } + $meta_string .= $front_meta; } else { - $taxes = $aioseop_options['aiosp_taxactive']; - if ( empty( $tax ) ) - $tax = get_query_var( 'taxonomy' ); - if ( !empty( $aioseop_options["aiosp_{$tax}_tax_title_format"] ) ) - $title_format = $aioseop_options["aiosp_{$tax}_tax_title_format"]; + if ( is_home() && ! empty( $home_meta ) ) { + if ( isset( $meta_string ) ) { + $meta_string .= "\n"; + } + $meta_string .= $home_meta; + } } - if ( empty( $title_format ) ) - $title_format = '%category_title% | %blog_title%'; - } else { - $title_format = '%category_title% | %blog_title%'; - if ( !empty( $aioseop_options['aiosp_category_title_format'] ) ) - $title_format = $aioseop_options['aiosp_category_title_format']; - return $title_format; + $prev_next = $this->get_prev_next_links( $post ); + $prev = apply_filters( 'aioseop_prev_link', $prev_next['prev'] ); + $next = apply_filters( 'aioseop_next_link', $prev_next['next'] ); + if ( ! empty( $prev ) ) { + $meta_string .= "\n"; + } + if ( ! empty( $next ) ) { + $meta_string .= "\n"; + } + if ( $meta_string != null ) { + echo "$meta_string\n"; } - return $title_format; - } - - function apply_tax_title_format( $category_name, $category_description, $tax = '' ) { - if ( empty( $tax ) ) $tax = get_query_var( 'taxonomy' ); - $title_format = $this->get_tax_title_format( $tax ); - $title = str_replace( '%taxonomy_title%', $category_name, $title_format ); - if ( strpos( $title, '%taxonomy_description%' ) !== false ) $title = str_replace( '%taxonomy_description%', $category_description, $title ); - if ( strpos( $title, '%category_title%' ) !== false ) $title = str_replace( '%category_title%', $category_name, $title ); - if ( strpos( $title, '%category_description%' ) !== false ) $title = str_replace( '%category_description%', $category_description, $title ); - if ( strpos( $title, '%blog_title%' ) !== false ) $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title ); - if ( strpos( $title, '%blog_description%' ) !== false ) $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title ); - $title = wp_strip_all_tags( $title ); - return $this->paged_title( $title ); - } - function get_tax_name( $tax ) { - global $aioseop_options; - if ( AIOSEOPPRO ){ - $opts = $this->meta_opts; - if ( !empty( $opts ) ) - $name = $opts['aiosp_title']; - } else { - $name = ''; + // Handle canonical links. + $show_page = true; + if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) { + $show_page = false; } - if ( empty( $name ) ) $name = single_term_title( '', false ); - //apparently we're already ucwordsing this elsewhere, and doing it a second time messes it up... why aren't we just doing this at the end?? - // if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) ) - // $name = $this->ucwords( $name ); - return $this->internationalize( $name ); - } + if ( $aioseop_options['aiosp_can'] ) { + $url = ''; + if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) { + $url = $opts['aiosp_custom_link']; + } + if ( empty( $url ) ) { + $url = $this->aiosp_mrt_get_url( $wp_query, $show_page ); + } - function get_tax_desc( $tax ) { + $url = $this->validate_url_scheme( $url ); + + $url = apply_filters( 'aioseop_canonical_url', $url ); + if ( ! empty( $url ) ) { + echo '' . "\n"; + } + } + do_action( 'aioseop_modules_wp_head' ); if ( AIOSEOPPRO ) { - $opts = $this->meta_opts; - if ( !empty( $opts ) ) - $desc = $opts['aiosp_description']; + echo "\n"; } else { - $desc = ''; + echo "\n"; } - if ( empty( $desc ) ) $desc = term_description( '', $tax ); - return $this->internationalize( $desc ); } - function get_tax_title( $tax = '' ) { - if ( AIOSEOPPRO ){ - if ( empty( $this->meta_opts ) ) - $this->meta_opts = $this->get_current_options( Array(), 'aiosp' ); + /** + * Check rewrite handler. + */ + function check_rewrite_handler() { + global $aioseop_options; + + $force_rewrites = 1; + if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) { + $force_rewrites = $aioseop_options['aiosp_force_rewrites']; } - if ( empty( $tax ) ) - if ( is_category() ) - $tax = 'category'; - else - $tax = get_query_var( 'taxonomy' ); - $name = $this->get_tax_name( $tax ); - $desc = $this->get_tax_desc( $tax ); - return $this->apply_tax_title_format( $name, $desc, $tax ); - } - function get_post_title_format( $title_type = 'post', $p = null ) { - global $aioseop_options; - if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) return false; - $title_format = "%{$title_type}_title% | %blog_title%"; - if ( isset( $aioseop_options["aiosp_{$title_type}_title_format"] ) ) - $title_format = $aioseop_options["aiosp_{$title_type}_title_format"]; - if( !empty( $aioseop_options['aiosp_enablecpost'] ) && !empty( $aioseop_options['aiosp_cpostactive'] ) ) { - $wp_post_types = $aioseop_options['aiosp_cpostactive']; - if ( !empty( $aioseop_options["aiosp_cposttitles"] ) ) { - if ( ( ( $title_type == 'archive' ) && is_post_type_archive( $wp_post_types ) && $prefix = "aiosp_{$title_type}_" ) || - ( ( $title_type == 'post' ) && $this->is_singular( $wp_post_types, $p ) && $prefix = "aiosp_" ) ) { - $post_type = get_post_type( $p ); - if ( !empty( $aioseop_options["{$prefix}{$post_type}_title_format"] ) ) { - $title_format = $aioseop_options["{$prefix}{$post_type}_title_format"]; - } + if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) && $force_rewrites ) { + // Make the title rewrite as short as possible. + if ( function_exists( 'ob_list_handlers' ) ) { + $active_handlers = ob_list_handlers(); + } else { + $active_handlers = array(); + } + if ( sizeof( $active_handlers ) > 0 && + $this->strtolower( $active_handlers[ sizeof( $active_handlers ) - 1 ] ) == + $this->strtolower( 'All_in_One_SEO_Pack::output_callback_for_title' ) + ) { + ob_end_flush(); + } else { + $this->log( 'another plugin interfering?' ); + // If we get here there *could* be trouble with another plugin :(. + $this->ob_start_detected = true; + if ( $this->option_isset( 'rewrite_titles' ) ) { // Try alternate method -- pdb. + $aioseop_options['aiosp_rewrite_titles'] = 0; + $force_rewrites = 0; + add_filter( 'wp_title', array( $this, 'wp_title' ), 20 ); + } + if ( function_exists( 'ob_list_handlers' ) ) { + foreach ( ob_list_handlers() as $handler ) { + $this->log( "detected output handler $handler" ); + } } } } - return $title_format; } - function get_archive_title_format() { - return $this->get_post_title_format( "archive" ); - } + /** + * @param $description + * + * @return mixed|string + */ + function trim_description( $description ) { + $description = trim( wp_strip_all_tags( $description ) ); + $description = str_replace( '"', '"', $description ); + $description = str_replace( "\r\n", ' ', $description ); + $description = str_replace( "\n", ' ', $description ); - function apply_archive_title_format( $title, $category = '' ) { - $title_format = $this->get_archive_title_format(); - $r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' ); - $d_title = array( $this->internationalize( get_bloginfo('name') ), $this->internationalize( get_bloginfo( 'description' ) ), post_type_archive_title( '', false ) ); - $title = trim( str_replace( $r_title, $d_title, $title_format ) ); - return $title; + return $description; } - function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) { - if ( !empty( $post ) ) - $authordata = get_userdata( $post->post_author ); - else - $authordata = new WP_User(); - $new_title = str_replace( "%blog_title%", $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); - if ( strpos( $new_title, "%blog_description%" ) !== false ) $new_title = str_replace( "%blog_description%", $this->internationalize( get_bloginfo( 'description' ) ), $new_title ); - if ( strpos( $new_title, "%{$type}_title%" ) !== false ) $new_title = str_replace( "%{$type}_title%", $title, $new_title ); - if ( $type == 'post' ) { - if ( strpos( $new_title, "%category%" ) !== false ) $new_title = str_replace( "%category%", $category, $new_title ); - if ( strpos( $new_title, "%category_title%" ) !== false ) $new_title = str_replace( "%category_title%", $category, $new_title ); - if ( strpos( $new_title, "%tax_" ) && !empty( $post ) ) { - $taxes = get_object_taxonomies( $post, 'objects' ); - if ( !empty( $taxes ) ) - foreach( $taxes as $t ) - if ( strpos( $new_title, "%tax_{$t->name}%" ) ) { - $terms = $this->get_all_terms( $post->ID, $t->name ); - $term = ''; - if ( count( $terms ) > 0 ) - $term = $terms[0]; - $new_title = str_replace( "%tax_{$t->name}%", $term, $new_title ); - } - } + /** + * @param $description + * @param null $post + * + * @return mixed + */ + function apply_description_format( $description, $post = null ) { + global $aioseop_options; + $description_format = $aioseop_options['aiosp_description_format']; + if ( ! isset( $description_format ) || empty( $description_format ) ) { + $description_format = '%description%'; } - if ( strpos( $new_title, "%{$type}_author_login%" ) !== false ) $new_title = str_replace( "%{$type}_author_login%", $authordata->user_login, $new_title ); - if ( strpos( $new_title, "%{$type}_author_nicename%" ) !== false ) $new_title = str_replace( "%{$type}_author_nicename%", $authordata->user_nicename, $new_title ); - if ( strpos( $new_title, "%{$type}_author_firstname%" ) !== false ) $new_title = str_replace( "%{$type}_author_firstname%", $this->ucwords($authordata->first_name ), $new_title ); - if ( strpos( $new_title, "%{$type}_author_lastname%" ) !== false ) $new_title = str_replace( "%{$type}_author_lastname%", $this->ucwords($authordata->last_name ), $new_title ); - $title = trim( $new_title ); - return $title; - } - - function apply_post_title_format( $title, $category = '', $p = null ) { - if ( $p === null ) { - global $post; - } else { - $post = $p; + $description = str_replace( '%description%', apply_filters( 'aioseop_description_override', $description ), $description_format ); + if ( strpos( $description, '%blog_title%' ) !== false ) { + $description = str_replace( '%blog_title%', get_bloginfo( 'name' ), $description ); } - $title_format = $this->get_post_title_format( 'post', $post ); - return $this->title_placeholder_helper( $title, $post, 'post', $title_format, $category ); + if ( strpos( $description, '%blog_description%' ) !== false ) { + $description = str_replace( '%blog_description%', get_bloginfo( 'description' ), $description ); + } + if ( strpos( $description, '%wp_title%' ) !== false ) { + $description = str_replace( '%wp_title%', $this->get_original_title(), $description ); + } + if ( strpos( $description, '%post_title%' ) !== false ) { + $description = str_replace( '%post_title%', $this->get_aioseop_title( $post ), $description ); + } + + + /*this was intended to make attachment descriptions unique if pulling from the parent... let's remove it and see if there are any problems + *on the roadmap is to have a better hierarchy for attachment description pulling + * if ($aioseop_options['aiosp_can']) $description = $this->make_unique_att_desc($description); + */ + + return $description; } - function apply_page_title_format( $title, $p = null, $title_format = '' ) { + /** + * @return string + */ + function get_robots_meta() { global $aioseop_options; - if ( $p === null ) { - global $post; - } else { - $post = $p; + $opts = $this->meta_opts; + $page = $this->get_page_number(); + $robots_meta = $tax_noindex = ''; + if ( isset( $aioseop_options['aiosp_tax_noindex'] ) ) { + $tax_noindex = $aioseop_options['aiosp_tax_noindex']; + } + + if ( empty( $tax_noindex ) || ! is_array( $tax_noindex ) ) { + $tax_noindex = array(); + } + + $aiosp_noindex = $aiosp_nofollow = $aiosp_noodp = $aiosp_noydir = ''; + $noindex = 'index'; + $nofollow = 'follow'; + if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax() + && ( ( is_date() && ! empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && ! empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) ) + || ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) ) + || ( is_search() && ! empty( $aioseop_options['aiosp_search_noindex'] ) ) + || ( is_404() && ! empty( $aioseop_options['aiosp_404_noindex'] ) ) + || ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) ) + ) { + $noindex = 'noindex'; + } elseif ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) { + $post_type = get_post_type(); + if ( ! empty( $opts ) ) { + $aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) ); + $aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) ); + $aiosp_noodp = htmlspecialchars( stripslashes( $opts['aiosp_noodp'] ) ); + $aiosp_noydir = htmlspecialchars( stripslashes( $opts['aiosp_noydir'] ) ); + } + if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || ! empty( $aioseop_options['aiosp_cpostnoindex'] ) + || ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_cpostnoodp'] ) || ! empty( $aioseop_options['aiosp_cpostnoydir'] ) + || ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) + ) { + if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) || + ( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) + ) { + $noindex = 'noindex'; + } + if ( ( $aiosp_nofollow == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && $page > 1 ) || + ( ( $aiosp_nofollow == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) ) + ) { + $nofollow = 'nofollow'; + } + if ( ( $aiosp_noodp == 'on' ) || ( empty( $aiosp_noodp ) && ( ! empty( $aioseop_options['aiosp_cpostnoodp'] ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoodp'] ) ) ) ) { + $aiosp_noodp = true; + } else { + $aiosp_noodp = false; + } + if ( ( $aiosp_noydir == 'on' ) || ( empty( $aiosp_noydir ) && ( ! empty( $aioseop_options['aiosp_cpostnoydir'] ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoydir'] ) ) ) ) { + $aiosp_noydir = true; + } else { + $aiosp_noydir = false; + } + } + } + if ( ! empty( $aioseop_options['aiosp_noodp'] ) && $aioseop_options['aiosp_noodp'] ) { + $aiosp_noodp = true; } - if ( empty( $title_format ) ) - $title_format = $aioseop_options['aiosp_page_title_format']; - return $this->title_placeholder_helper( $title, $post, 'page', $title_format ); + if ( ! empty( $aioseop_options['aiosp_noydir'] ) && $aioseop_options['aiosp_noydir'] ) { + $aiosp_noydir = true; + } + if ( $aiosp_noodp ) { + $nofollow .= ',noodp'; + } + if ( $aiosp_noydir ) { + $nofollow .= ',noydir'; + } + $robots_meta = $noindex . ',' . $nofollow; + if ( $robots_meta == 'index,follow' ) { + $robots_meta = ''; + } + + return $robots_meta; } - /*** Gets the title that will be used by AIOSEOP for title rewrites or returns false. ***/ - function get_aioseop_title( $post ) { + /** + * @return mixed|void + */ + function sitelinks_search_box() { global $aioseop_options; - // the_search_query() is not suitable, it cannot just return - global $s, $STagging; - $opts = $this->meta_opts; - if ( is_front_page() ) { - if ( !empty( $aioseop_options['aiosp_use_static_home_info'] ) ) { - global $post; - if ( get_option( 'show_on_front' ) == 'page' && is_page() && $post->ID == get_option( 'page_on_front' ) ) { - $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) ); - if ( !$title ) $title = $this->internationalize( $post->post_title ); - if ( !$title ) $title = $this->internationalize( $this->get_original_title( '', false ) ); - if ( !empty( $aioseop_options['aiosp_home_page_title_format'] ) ) - $title = $this->apply_page_title_format( $title, $post, $aioseop_options['aiosp_home_page_title_format'] ); - $title = $this->paged_title( $title ); - $title = apply_filters( 'aioseop_home_page_title', $title ); - } + $home_url = esc_url( get_home_url() ); + $name_block = $search_block = ''; + if ( ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) { + if ( ! empty( $aioseop_options['aiosp_google_specify_site_name'] ) ) { + $blog_name = $aioseop_options['aiosp_google_specify_site_name']; } else { - $title = $this->internationalize( $aioseop_options['aiosp_home_title'] ); - if ( !empty( $aioseop_options['aiosp_home_page_title_format'] ) ) - $title = $this->apply_page_title_format( $title, null, $aioseop_options['aiosp_home_page_title_format'] ); + $blog_name = get_bloginfo( 'name' ); } - if (empty( $title ) ) - $title = $this->internationalize( get_option( 'blogname' ) ) . ' | ' . $this->internationalize( get_bloginfo( 'description' ) ); + $blog_name = esc_attr( $blog_name ); + $name_block = <<ID; + if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) ) { + $search_block = << + { + "@context": "http://schema.org", + "@type": "WebSite", +EOF; + if ( ! empty( $name_block ) ) { + $search_box .= $name_block; + } + if ( ! empty( $search_block ) ) { + $search_box .= $search_block; + } + $search_box .= << +EOF; - if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && !empty( $aioseop_options['aiosp_use_static_home_info'] ) ){ - $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) ); - } - //$title = $this->internationalize( $aioseop_options['aiosp_home_title'] ); - if ( !$title ) $title = $this->internationalize( get_post_meta( $frontpage_id, "_aioseop_title", true ) ); //this is/was causing the first product to come through - if ( !$title ) $title = $this->internationalize( $post->post_title ); - if ( !$title ) $title = $this->internationalize( $this->get_original_title( '', false ) ); + return apply_filters( 'aiosp_sitelinks_search_box', $search_box ); + } + /** + * @param $post + * + * @return array + */ + function get_google_authorship( $post ) { + global $aioseop_options; + $page = $this->get_page_number(); + // Handle authorship. + $googleplus = $publisher = $author = ''; + if ( ! empty( $post ) && isset( $post->post_author ) && empty( $aioseop_options['aiosp_google_disable_profile'] ) ) { + $googleplus = get_the_author_meta( 'googleplus', $post->post_author ); + } - $title = $this->apply_page_title_format( $title, $post ); - $title = $this->paged_title( $title ); - $title = apply_filters( 'aioseop_title_page', $title ); - return $title; + if ( empty( $googleplus ) && ! empty( $aioseop_options['aiosp_google_publisher'] ) ) { + $googleplus = $aioseop_options['aiosp_google_publisher']; + } + if ( is_front_page() && ( $page < 2 ) ) { + if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) { + $publisher = $aioseop_options['aiosp_google_publisher']; } - return $this->paged_title( $title ); //this is returned for woo - } else if ( is_attachment() ) { - if ( $post === null ) return false; - $title = get_post_meta( $post->ID, "_aioseop_title", true ); - if ( empty( $title ) ) $title = $post->post_title; - if ( empty( $title ) ) $title = $this->get_original_title( '', false ); - if ( empty( $title ) ) $title = get_the_title( $post->post_parent ); - $title = apply_filters( 'aioseop_attachment_title', $this->internationalize( $this->apply_post_title_format( $title, '', $post ) ) ); - return $title; - } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && !$this->is_static_posts_page() ) ) { - if ( $post === null ) return false; - if ( ( $this->is_static_front_page() ) && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) { - if ( !empty( $aioseop_options['aiosp_home_page_title_format'] ) ) - $home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] ); - //home title filter - return apply_filters( 'aioseop_home_page_title', $home_title ); - } else { - $page_for_posts = ''; - if ( is_home() ) - $page_for_posts = get_option( 'page_for_posts' ); - if ( $page_for_posts ) { - $title = $this->internationalize( get_post_meta( $page_for_posts, "_aioseop_title", true ) ); - if ( !$title ) { - $post_page = get_post( $page_for_posts ); - $title = $this->internationalize( $post_page->post_title ); - } - } else { - $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) ); - if ( !$title ) - $title = $this->internationalize( $post->post_title ); + if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) ) { + if ( empty( $aioseop_options['aiosp_google_enable_publisher'] ) ) { + $publisher = ''; + } elseif ( ! empty( $aioseop_options['aiosp_google_specify_publisher'] ) ) { + $publisher = $aioseop_options['aiosp_google_specify_publisher']; } - if ( !$title ) - $title = $this->internationalize( $this->get_original_title( '', false ) ); - - $title = $this->apply_page_title_format( $title, $post ); - $title = $this->paged_title( $title ); - $title = apply_filters( 'aioseop_title_page', $title ); - if ( $this->is_static_posts_page() ) - $title = apply_filters( 'single_post_title', $title ); - return $title; } - } else if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) { - //too far down? -mrt - $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) ); - if ( !$title ) $title = $this->internationalize( $post->post_title ); - if ( !$title ) $title = $this->internationalize( $this->get_original_title( '', false ) ); - $title = $this->apply_page_title_format( $title, $post ); - $title = $this->paged_title( $title ); - $title = apply_filters( 'aioseop_title_page', $title ); - return $title; - } else if ( is_single() ) { - // we're not in the loop :( - if ( $post === null ) return false; - $categories = $this->get_all_categories(); - $category = ''; - if ( count( $categories ) > 0 ) - $category = $categories[0]; - $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) ); - if ( !$title ) { - $title = $this->internationalize( get_post_meta( $post->ID, "title_tag", true ) ); - if ( !$title ) $title = $this->internationalize($this->get_original_title( '', false ) ); + } + if ( is_singular() && ( ! empty( $googleplus ) ) ) { + $author = $googleplus; + } else if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) { + $author = $aioseop_options['aiosp_google_publisher']; + } + + if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) { + if ( empty( $aioseop_options['aiosp_google_author_location'] ) ) { + $aioseop_options['aiosp_google_author_location'] = array(); } - if ( empty( $title ) ) $title = $post->post_title; - if ( !empty( $title ) ) - $title = $this->apply_post_title_format( $title, $category, $post ); - $title = $this->paged_title( $title ); - return apply_filters( 'aioseop_title_single', $title ); - } else if ( is_search() && isset( $s ) && !empty( $s ) ) { - $search = esc_attr( stripslashes( $s ) ); - if ( !empty( $aioseop_options['aiosp_cap_titles'] ) ) - $search = $this->capitalize( $search ); - $title_format = $aioseop_options['aiosp_search_title_format']; - $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format ); - if ( strpos( $title, '%blog_description%' ) !== false ) $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title ); - if ( strpos( $title, '%search%' ) !== false ) $title = str_replace( '%search%', $search, $title ); - $title = $this->paged_title( $title ); - return $title; - } else if ( is_tag() ) { - global $utw; - $tag = $tag_description = ''; - if ( $utw ) { - $tags = $utw->GetCurrentTagSet(); - $tag = $tags[0]->tag; - $tag = str_replace('-', ' ', $tag); + if ( is_front_page() && ! in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) { + $author = ''; } else { - if ( AIOSEOPPRO ){ - if ( !empty( $opts ) && !empty( $opts['aiosp_title'] ) ) $tag = $opts['aiosp_title']; - if ( !empty( $opts ) ) { - if ( !empty( $opts['aiosp_title'] ) ) $tag = $opts['aiosp_title']; - if ( !empty( $opts['aiosp_description'] ) ) $tag_description = $opts['aiosp_description']; + if ( in_array( 'all', $aioseop_options['aiosp_google_author_location'] ) ) { + if ( is_singular() && ! is_singular( $aioseop_options['aiosp_google_author_location'] ) ) { + $author = ''; + } + } else { + if ( ! is_singular( $aioseop_options['aiosp_google_author_location'] ) ) { + $author = ''; } } - if ( empty( $tag ) ) $tag = $this->get_original_title( '', false ); - if ( empty( $tag_description ) ) $tag_description = tag_description(); - $tag = $this->internationalize( $tag ); - $tag_description = $this->internationalize( $tag_description ); - } - if ( $tag ) { - if ( !empty( $aioseop_options['aiosp_cap_titles'] ) ) - $tag = $this->capitalize( $tag ); - $title_format = $aioseop_options['aiosp_tag_title_format']; - $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo('name') ), $title_format ); - if ( strpos( $title, '%blog_description%' ) !== false ) $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description') ), $title ); - if ( strpos( $title, '%tag%' ) !== false ) $title = str_replace( '%tag%', $tag, $title ); - if ( strpos( $title, '%tag_description%' ) !== false ) $title = str_replace( '%tag_description%', $tag_description, $title ); - if ( strpos( $title, '%taxonomy_description%' ) !== false ) $title = str_replace( '%taxonomy_description%', $tag_description, $title ); - $title = trim( wp_strip_all_tags( $title ) ); - $title = str_replace( Array( '"', "\r\n", "\n" ), Array( '"', ' ', ' ' ), $title ); - $title = $this->paged_title( $title ); - return $title; - } - } else if ( ( is_tax() || is_category() ) && !is_feed() ) { - return $this->get_tax_title(); - } else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // simple tagging support - $tag = $STagging->search_tag; - if ( $tag ) { - if ( !empty( $aioseop_options['aiosp_cap_titles'] ) ) - $tag = $this->capitalize($tag); - $title_format = $aioseop_options['aiosp_tag_title_format']; - $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name') ), $title_format); - if ( strpos( $title, '%blog_description%' ) !== false ) $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description') ), $title); - if ( strpos( $title, '%tag%' ) !== false ) $title = str_replace( '%tag%', $tag, $title ); - $title = $this->paged_title( $title ); - return $title; } - } else if ( is_archive() || is_post_type_archive() ) { - if ( is_author() ) { - $author = $this->internationalize( $this->get_original_title( '', false ) ); - $title_format = $aioseop_options['aiosp_author_title_format']; - $new_title = str_replace( '%author%', $author, $title_format ); - } else if ( is_date() ) { - global $wp_query; - $date = $this->internationalize( $this->get_original_title( '', false ) ); - $title_format = $aioseop_options['aiosp_date_title_format']; - $new_title = str_replace( '%date%', $date, $title_format ); - $day = get_query_var( 'day' ); - if ( empty( $day ) ) $day = ''; - $new_title = str_replace( '%day%', $day, $new_title ); - $monthnum = get_query_var( 'monthnum' ); - $year = get_query_var( 'year' ); - if ( empty( $monthnum ) || is_year() ) { - $month = ''; - $monthnum = 0; - } - $month = date( "F", mktime( 0,0,0,(int)$monthnum,1,(int)$year ) ); - $new_title = str_replace( '%monthnum%', $monthnum, $new_title ); - if ( strpos( $new_title, '%month%' ) !== false ) $new_title = str_replace( '%month%', $month, $new_title ); - if ( strpos( $new_title, '%year%' ) !== false ) $new_title = str_replace( '%year%', get_query_var( 'year' ), $new_title ); - } else if ( is_post_type_archive() ) { - if ( empty( $title ) ) $title = $this->get_original_title( '', false ); - $new_title = apply_filters( 'aioseop_archive_title', $this->apply_archive_title_format( $title ) ); - } else return false; - $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $new_title ); - if ( strpos( $new_title, '%blog_description%' ) !== false ) $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title ); - $title = trim( $new_title ); - $title = $this->paged_title( $title ); - return $title; - } else if ( is_404() ) { - $title_format = $aioseop_options['aiosp_404_title_format']; - $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name') ), $title_format ); - if ( strpos( $new_title, '%blog_description%' ) !== false ) $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title ); - if ( strpos( $new_title, '%request_url%' ) !== false ) $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title ); - if ( strpos( $new_title, '%request_words%' ) !== false ) $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title ); - if ( strpos( $new_title, '%404_title%' ) !== false ) $new_title = str_replace( '%404_title%', $this->internationalize( $this->get_original_title( '', false ) ), $new_title ); - return $new_title; - } - return false; - } - - /*** Used to filter wp_title(), get our title. ***/ - function wp_title() { - global $aioseop_options; - $title = false; - $post = $this->get_queried_object(); - if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) ) { - $title = $this->get_aioseop_title( $post ); - $title = $this->apply_cf_fields( $title ); } - if ( $title === false ) - $title = $this->get_original_title(); - - //if we're going to have this here, which seems logical, we should probably take it out of other places... do all titles pass through here? - // The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums - // if ( !empty( $aioseop_options['aiosp_cap_titles'] ) ) - // $title = $this->capitalize( $title ); - - return apply_filters( 'aioseop_title', $title ); - } - - /*** Used for forcing title rewrites. ***/ - function rewrite_title($header) { - global $wp_query; - if (!$wp_query) { - $header .= "\n"; - return $header; - } - $title = $this->wp_title(); - if ( !empty( $title ) ) - $header = $this->replace_title( $header, $title ); - return $header; + return array( 'publisher' => $publisher, 'author' => $author ); } /** - * @return User-readable nice words for a given request. + * @param null $post + * + * @return array */ - function request_as_words( $request ) { - $request = htmlspecialchars( $request ); - $request = str_replace( '.html', ' ', $request ); - $request = str_replace( '.htm', ' ', $request ); - $request = str_replace( '.', ' ', $request ); - $request = str_replace( '/', ' ', $request ); - $request = str_replace( '-', ' ', $request ); - $request_a = explode( ' ', $request ); - $request_new = array(); - foreach ( $request_a as $token ) { - $request_new[] = $this->ucwords( trim( $token ) ); - } - $request = implode( ' ', $request_new ); - return $request; - } - - function capitalize( $s ) { - $s = trim( $s ); - $tokens = explode( ' ', $s ); - while ( list( $key, $val ) = each( $tokens ) ) { - $tokens[ $key ] = trim( $tokens[ $key ] ); - $tokens[ $key ] = $this->strtoupper( $this->substr( $tokens[$key], 0, 1 ) ) . $this->substr( $tokens[$key], 1 ); - } - $s = implode( ' ', $tokens ); - return $s; - } - - function trim_excerpt_without_filters( $text, $max = 0 ) { - $text = str_replace( ']]>', ']]>', $text ); - $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text ); - $text = wp_strip_all_tags( $text ); - // Treat other common word-break characters like a space - $text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text ); - if ( !$max ) $max = $this->maximum_description_length; - $max_orig = $max; - $len = $this->strlen( $text2 ); - if ( $max < $len ) { - if ( function_exists( 'mb_strrpos' ) ) { - $pos = mb_strrpos( $text2, ' ', -($len - $max) ); - if ( $pos === false ) $pos = $max; - if ( $pos > $this->minimum_description_length ) { - $max = $pos; - } else { - $max = $this->minimum_description_length; + function get_prev_next_links( $post = null ) { + $prev = $next = ''; + $page = $this->get_page_number(); + if ( is_home() || is_archive() || is_paged() ) { + global $wp_query; + $max_page = $wp_query->max_num_pages; + if ( $page > 1 ) { + $prev = get_previous_posts_page_link(); + } + if ( $page < $max_page ) { + $paged = $GLOBALS['paged']; + if ( ! is_single() ) { + if ( ! $paged ) { + $paged = 1; + } + $nextpage = intval( $paged ) + 1; + if ( ! $max_page || $max_page >= $nextpage ) { + $next = get_pagenum_link( $nextpage ); + } } - } else { - while( $text2[$max] != ' ' && $max > $this->minimum_description_length ) { - $max--; + } + } else if ( is_page() || is_single() ) { + $numpages = 1; + $multipage = 0; + $page = get_query_var( 'page' ); + if ( ! $page ) { + $page = 1; + } + if ( is_single() || is_page() || is_feed() ) { + $more = 1; + } + $content = $post->post_content; + if ( false !== strpos( $content, '' ) ) { + if ( $page > 1 ) { + $more = 1; + } + $content = str_replace( "\n\n", '', $content ); + $content = str_replace( "\n", '', $content ); + $content = str_replace( "\n", '', $content ); + // Ignore nextpage at the beginning of the content. + if ( 0 === strpos( $content, '' ) ) { + $content = substr( $content, 15 ); + } + $pages = explode( '', $content ); + $numpages = count( $pages ); + if ( $numpages > 1 ) { + $multipage = 1; } } - - // probably no valid chars to break on? - if ( $len > $max_orig && $max < intval( $max_orig / 2 ) ) { - $max = $max_orig; + if ( ! empty( $page ) ) { + if ( $page > 1 ) { + $prev = _wp_link_page( $page - 1 ); + } + if ( $page + 1 <= $numpages ) { + $next = _wp_link_page( $page + 1 ); + } + } + if ( ! empty( $prev ) ) { + $prev = $this->substr( $prev, 9, - 2 ); + } + if ( ! empty( $next ) ) { + $next = $this->substr( $next, 9, - 2 ); } } - $text = $this->substr( $text, 0, $max ); - return trim( $text ); - } - function trim_excerpt_without_filters_full_length( $text ) { - $text = str_replace( ']]>', ']]>', $text ); - $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text ); - $text = wp_strip_all_tags( $text ); - return trim( ( $text ) ); + return array( 'prev' => $prev, 'next' => $next ); } - function keyword_string_to_list( $keywords ) { - $traverse = Array(); - $keywords_i = str_replace( '"', '', $keywords ); - if (isset( $keywords_i ) && !empty( $keywords_i ) ) { - $traverse = explode( ',', $keywords_i ); - } - return $traverse; - } + /** + * + * Validates whether the url should be https or http. + * + * Mainly we're just using this for canonical URLS, but eventually it may be useful for other things + * + * @param $url + * + * @return string $url + * + * @since 2.3.5 + */ + function validate_url_scheme( $url ) { - function get_all_categories( $id = 0 ) { - $keywords = Array(); - $categories = get_the_category( $id ); - if ( !empty( $categories ) ) - foreach ( $categories as $category ) - $keywords[] = $this->internationalize( $category->cat_name ); - return $keywords; - } + // TODO we should check for the site setting in the case of auto. - function get_all_tags( $id = 0 ) { - $keywords = Array(); - $tags = get_the_tags( $id ); - if ( !empty( $tags ) && is_array( $tags) ) - foreach ( $tags as $tag ) - $keywords[] = $this->internationalize( $tag->name ); - // Ultimate Tag Warrior integration - global $utw; - if ( $utw ) { - $tags = $utw->GetTagsForPost( $p ); - if ( is_array( $tags ) ) - foreach ( $tags as $tag ) { - $tag = $tag->tag; - $tag = str_replace( '_', ' ', $tag ); - $tag = str_replace( '-', ' ', $tag ); - $tag = stripslashes( $tag ); - $keywords[] = $tag; - } - } - return $keywords; - } + global $aioseop_options; + + if( ! isset( $aioseop_options['aiosp_can_set_protocol'] ) ){ + return $url; // Just send the url back if there's nothing there. + } + + if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) { + $url = preg_replace( '/^https:/i', 'http:', $url ); + } + if ( $aioseop_options['aiosp_can_set_protocol'] == 'https' ) { + $url = preg_replace( '/^http:/i', 'https:', $url ); + } - function get_all_terms( $id, $taxonomy ) { - $keywords = Array(); - $terms = get_the_terms( $id, $taxonomy ); - if ( !empty( $terms ) ) - foreach ( $terms as $term ) - $keywords[] = $this->internationalize( $term->name ); - return $keywords; + return $url; } /** - * @return comma-separated list of unique keywords + * @param $options + * @param $location + * @param $settings + * + * @return mixed */ - function get_all_keywords() { - global $posts; - global $aioseop_options; - if ( is_404() ) return null; - // if we are on synthetic pages - if ( !is_home() && !is_page() && !is_single() && !$this->is_static_front_page() && !$this->is_static_posts_page() && !is_archive() && !is_post_type_archive() &&!is_category() && !is_tag() && !is_tax() ) - return null; - $keywords = array(); - $opts = $this->meta_opts; - if ( !empty( $opts["aiosp_keywords"] ) ) { - $traverse = $this->keyword_string_to_list( $this->internationalize( $opts["aiosp_keywords"] ) ); - if ( !empty( $traverse ) ) - foreach ( $traverse as $keyword ) $keywords[] = $keyword; + function override_options( $options, $location, $settings ) { + if ( class_exists( 'DOMDocument' ) ) { + $options['aiosp_google_connect'] = $settings['aiosp_google_connect']['default']; } - if ( empty( $posts ) ) { - global $post; - $post_arr = Array( $post ); - } else { - $post_arr = $posts; + + return $options; + } + + function aiosp_google_analytics() { + global $aioseop_options; + $analytics = ''; + if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_exclude_users'] ) ) { + if ( is_user_logged_in() ) { + global $current_user; + if ( empty( $current_user ) ) { + wp_get_current_user(); + } + if ( ! empty( $current_user ) ) { + $intersect = array_intersect( $aioseop_options['aiosp_ga_exclude_users'], $current_user->roles ); + if ( ! empty( $intersect ) ) { + return; + } + } + } } - if ( is_array( $post_arr ) ) { - $postcount = count( $post_arr ); - foreach ( $post_arr as $p ) { - if ( $p ) { - $id = $p->ID; - if ( $postcount == 1 || !empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) { - // custom field keywords - $keywords_i = null; - $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, "_aioseop_keywords", true ) ) ); - if ( is_attachment() ) { - $id = $p->post_parent; - if ( empty( $keywords_i ) ) - $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, "_aioseop_keywords", true ) ) ); + if ( ! empty( $aioseop_options['aiosp_google_analytics_id'] ) ) { + ob_start(); + $analytics = $this->universal_analytics(); + echo $analytics; + if ( empty( $analytics ) ) { + ?> + + + + clean_keyword_list( $keywords ) ); + /** + * @return string + */ + function universal_analytics() { + global $aioseop_options; + $analytics = ''; + if ( ! empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { + $allow_linker = $cookie_domain = $domain = $addl_domains = $domain_list = ''; + if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) ) { + $cookie_domain = $this->get_analytics_domain(); + } + if ( ! empty( $cookie_domain ) ) { + $cookie_domain = esc_js( $cookie_domain ); + $cookie_domain = "'cookieDomain': '{$cookie_domain}'"; + } + if ( empty( $cookie_domain ) ) { + $domain = ", 'auto'"; + } + if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) { + $allow_linker = "'allowLinker': true"; + if ( ! empty( $aioseop_options['aiosp_ga_addl_domains'] ) ) { + $addl_domains = trim( $aioseop_options['aiosp_ga_addl_domains'] ); + $addl_domains = preg_split( '/[\s,]+/', $addl_domains ); + if ( ! empty( $addl_domains ) ) { + foreach ( $addl_domains as $d ) { + $d = $this->sanitize_domain( $d ); + if ( ! empty( $d ) ) { + if ( ! empty( $domain_list ) ) { + $domain_list .= ', '; + } + $domain_list .= "'" . $d . "'"; + } + } + } + } + } + $extra_options = ''; + if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) { + $extra_options .= "ga('require', 'displayfeatures');"; + } + if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_enhanced_ecommerce'] ) ) { + if ( ! empty( $extra_options ) ) { + $extra_options .= "\n\t\t\t"; + } + $extra_options .= "ga('require', 'ec');"; + } + if ( ! empty( $domain_list ) ) { + if ( ! empty( $extra_options ) ) { + $extra_options .= "\n\t\t\t"; + } + $extra_options .= "ga('require', 'linker');\n\t\t\tga('linker:autoLink', [{$domain_list}] );"; + } + if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) { + if ( ! empty( $extra_options ) ) { + $extra_options .= "\n\t\t\t"; + } + $extra_options .= "ga('require', 'linkid', 'linkid.js');"; + } + + if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) { + if ( ! empty( $extra_options ) ) { + $extra_options .= "\n\t\t\t"; + } + $extra_options .= "ga('set', 'anonymizeIp', true);"; + } + $js_options = array(); + foreach ( array( 'cookie_domain', 'allow_linker' ) as $opts ) { + if ( ! empty( $$opts ) ) { + $js_options[] = $$opts; + } + } + if ( ! empty( $js_options ) ) { + $js_options = join( ',', $js_options ); + $js_options = ', { ' . $js_options . ' } '; + } else { + $js_options = ''; + } + $analytics_id = esc_js( $aioseop_options['aiosp_google_analytics_id'] ); + $analytics = << + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', '{$analytics_id}'{$domain}{$js_options}); + {$extra_options} + ga('send', 'pageview'); + + +EOF; + } + + return $analytics; } - function log( $message ) { - if ( $this->do_log ) { - @error_log( date( 'Y-m-d H:i:s' ) . " " . $message . "\n", 3, $this->log_file ); + /** + * @return mixed|string + */ + function get_analytics_domain() { + global $aioseop_options; + if ( ! empty( $aioseop_options['aiosp_ga_domain'] ) ) { + return $this->sanitize_domain( $aioseop_options['aiosp_ga_domain'] ); } + + return ''; } + /** + * @param $id + * + * @return bool + */ function save_post_data( $id ) { $awmp_edit = $nonce = null; - if ( empty( $_POST ) ) return false; - if ( isset( $_POST[ 'aiosp_edit' ] ) ) $awmp_edit = $_POST['aiosp_edit']; - if ( isset( $_POST[ 'nonce-aioseop-edit' ] ) ) $nonce = $_POST['nonce-aioseop-edit']; - - if ( isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce') ) { + if ( empty( $_POST ) ) { + return false; + } + if ( isset( $_POST['aiosp_edit'] ) ) { + $awmp_edit = $_POST['aiosp_edit']; + } + if ( isset( $_POST['nonce-aioseop-edit'] ) ) { + $nonce = $_POST['nonce-aioseop-edit']; + } - $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' ); - if ( !( !empty( $this->options['aiosp_can'] ) ) && ( !empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { - unset( $optlist["custom_link"] ); + if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) { + + $optlist = array( + 'keywords', + 'description', + 'title', + 'custom_link', + 'sitemap_exclude', + 'disable', + 'disable_analytics', + 'noindex', + 'nofollow', + 'noodp', + 'noydir', + 'titleatr', + 'menulabel', + ); + if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { + unset( $optlist['custom_link'] ); } - foreach ( $optlist as $f ) { + foreach ( $optlist as $f ) { $field = "aiosp_$f"; - if ( isset( $_POST[$field] ) ) $$field = $_POST[$field]; - } + if ( isset( $_POST[ $field ] ) ) { + $$field = $_POST[ $field ]; + } + } - $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' ); - if ( !( !empty( $this->options['aiosp_can'] ) ) && ( !empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { - unset( $optlist["custom_link"] ); + $optlist = array( + 'keywords', + 'description', + 'title', + 'custom_link', + 'noindex', + 'nofollow', + 'noodp', + 'noydir', + 'titleatr', + 'menulabel', + ); + if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { + unset( $optlist['custom_link'] ); } - foreach ( $optlist as $f ) + foreach ( $optlist as $f ) { delete_post_meta( $id, "_aioseop_{$f}" ); + } - if ( $this->is_admin() ) { - delete_post_meta($id, '_aioseop_sitemap_exclude' ); - delete_post_meta($id, '_aioseop_disable' ); - delete_post_meta($id, '_aioseop_disable_analytics' ); + if ( $this->is_admin() ) { + delete_post_meta( $id, '_aioseop_sitemap_exclude' ); + delete_post_meta( $id, '_aioseop_disable' ); + delete_post_meta( $id, '_aioseop_disable_analytics' ); } foreach ( $optlist as $f ) { - $var = "aiosp_$f"; + $var = "aiosp_$f"; $field = "_aioseop_$f"; - if ( isset( $$var ) && !empty( $$var ) ) - add_post_meta( $id, $field, $$var ); - } - if (isset( $aiosp_sitemap_exclude ) && !empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) - add_post_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude ); - if (isset( $aiosp_disable ) && !empty( $aiosp_disable ) && $this->is_admin() ) { - add_post_meta( $id, '_aioseop_disable', $aiosp_disable ); - if (isset( $aiosp_disable_analytics ) && !empty( $aiosp_disable_analytics ) ) - add_post_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics ); + if ( isset( $$var ) && ! empty( $$var ) ) { + add_post_meta( $id, $field, $$var ); + } } - } + if ( isset( $aiosp_sitemap_exclude ) && ! empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) { + add_post_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude ); + } + if ( isset( $aiosp_disable ) && ! empty( $aiosp_disable ) && $this->is_admin() ) { + add_post_meta( $id, '_aioseop_disable', $aiosp_disable ); + if ( isset( $aiosp_disable_analytics ) && ! empty( $aiosp_disable_analytics ) ) { + add_post_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics ); + } + } + } } + /** + * @param $post + * @param $metabox + */ function display_tabbed_metabox( $post, $metabox ) { $tabs = $metabox['args']; echo '
'; $header = $this->get_metabox_header( $tabs ); echo $header; - $active = ""; - foreach( $tabs as $m ) { - echo '
'; - if ( !$active ) $active = ' style="display:none;"'; + $active = ''; + foreach ( $tabs as $m ) { + echo '
'; + if ( ! $active ) { + $active = ' style="display:none;"'; + } $m['args'] = $m['callback_args']; $m['callback'][0]->{$m['callback'][1]}( $post, $m ); echo '
'; @@ -3301,129 +4691,225 @@ function display_tabbed_metabox( $post, $metabox ) { echo '
'; } + /** + * @param $tabs + * + * @return string + */ + function get_metabox_header( $tabs ) { + $header = '
    '; + $active = ' active'; + foreach ( $tabs as $t ) { + if ( $active ) { + $title = __( 'Main Settings', 'all-in-one-seo-pack' ); + } else { + $title = $t['title']; + } + $header .= '
  • '; + $active = ''; + } + $header .= '
'; + + return $header; + } + function admin_bar_menu() { global $wp_admin_bar, $aioseop_admin_menu, $aioseop_options, $post; $toggle = ''; - if ( isset($_POST['aiosp_use_original_title']) && isset($_POST['aiosp_admin_bar']) ) $toggle = 'on'; - if ( isset($_POST['aiosp_use_original_title']) && !isset($_POST['aiosp_admin_bar']) ) $toggle = 'off'; + if ( isset( $_POST['aiosp_use_original_title'] ) && isset( $_POST['aiosp_admin_bar'] ) ) { + $toggle = 'on'; + } + if ( isset( $_POST['aiosp_use_original_title'] ) && ! isset( $_POST['aiosp_admin_bar'] ) ) { + $toggle = 'off'; + } - if ( !empty( $aioseop_options['aiosp_admin_bar'] ) && $toggle != 'off' || isset($_POST['aiosp_admin_bar']) ) { + if ( ! empty( $aioseop_options['aiosp_admin_bar'] ) && $toggle != 'off' || isset( $_POST['aiosp_admin_bar'] ) ) { $menu_slug = plugin_basename( __FILE__ ); $url = ''; - if ( function_exists( 'menu_page_url' ) ) - $url = menu_page_url( $menu_slug, 0 ); - if ( empty( $url ) ) - $url = esc_url( admin_url( 'admin.php?page=' . $menu_slug ) ); - - $wp_admin_bar->add_menu( array( 'id' => AIOSEOP_PLUGIN_DIRNAME, 'title' => __( 'SEO', 'all-in-one-seo-pack' ), 'href' => $url ) ); + if ( function_exists( 'menu_page_url' ) ) { + $url = menu_page_url( $menu_slug, 0 ); + } + if ( empty( $url ) ) { + $url = esc_url( admin_url( 'admin.php?page=' . $menu_slug ) ); + } - if ( current_user_can( 'update_plugins' ) && !AIOSEOPPRO ){ - $wp_admin_bar->add_menu( array( 'parent' => AIOSEOP_PLUGIN_DIRNAME, 'title' => __( 'Upgrade To Pro', 'all-in-one-seo-pack' ), 'id' => 'aioseop-pro-upgrade', 'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu', 'meta' => Array( 'target' => '_blank' ) ) ); - // add_action( 'admin_bar_menu', array( $this, 'admin_bar_upgrade_menu' ), 1101 ); + $wp_admin_bar->add_menu( array( + 'id' => AIOSEOP_PLUGIN_DIRNAME, + 'title' => __( 'SEO', 'all-in-one-seo-pack' ), + 'href' => $url, + ) ); + + if ( current_user_can( 'update_plugins' ) && ! AIOSEOPPRO ) { + $wp_admin_bar->add_menu( array( + 'parent' => AIOSEOP_PLUGIN_DIRNAME, + 'title' => __( 'Upgrade To Pro', 'all-in-one-seo-pack' ), + 'id' => 'aioseop-pro-upgrade', + 'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu', + 'meta' => array( 'target' => '_blank' ), + ) ); + // add_action( 'admin_bar_menu', array( $this, 'admin_bar_upgrade_menu' ), 1101 ); } $aioseop_admin_menu = 1; - if ( !is_admin() && !empty( $post ) ) { + if ( ! is_admin() && ! empty( $post ) ) { $blog_page = aiosp_common::get_blog_page( $post ); - if ( !empty( $blog_page ) ) $post = $blog_page; - $wp_admin_bar->add_menu( array( 'id' => 'aiosp_edit_' . $post->ID, 'parent' => AIOSEOP_PLUGIN_DIRNAME, 'title' => __( 'Edit SEO', 'all-in-one-seo-pack' ), 'href' => get_edit_post_link( $post->ID ) . '#aiosp' ) ); + if ( ! empty( $blog_page ) ) { + $post = $blog_page; + } + $wp_admin_bar->add_menu( array( + 'id' => 'aiosp_edit_' . $post->ID, + 'parent' => AIOSEOP_PLUGIN_DIRNAME, + 'title' => __( 'Edit SEO', 'all-in-one-seo-pack' ), + 'href' => get_edit_post_link( $post->ID ) . '#aiosp', + ) ); } } } - - + /** + * Order for adding the menus for the aioseop_modules_add_menus hook. + */ function menu_order() { return 5; } + /** + * @param $tax + */ function display_category_metaboxes( $tax ) { $screen = 'edit-' . $tax->taxonomy; - ?>
- -
- +
+ +
+ options['aiosp_can'] ) ) && ( !empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { - unset( $optlist["custom_link"] ); + $optlist = array( + 'keywords', + 'description', + 'title', + 'custom_link', + 'noindex', + 'nofollow', + 'noodp', + 'noydir', + 'titleatr', + 'menulabel', + ); + if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) { + unset( $optlist['custom_link'] ); } - foreach ( $optlist as $f ) + foreach ( $optlist as $f ) { delete_term_meta( $id, "_aioseop_{$f}" ); + } - if ( $this->is_admin() ) { - delete_term_meta($id, '_aioseop_sitemap_exclude' ); - delete_term_meta($id, '_aioseop_disable' ); - delete_term_meta($id, '_aioseop_disable_analytics' ); + if ( $this->is_admin() ) { + delete_term_meta( $id, '_aioseop_sitemap_exclude' ); + delete_term_meta( $id, '_aioseop_disable' ); + delete_term_meta( $id, '_aioseop_disable_analytics' ); } foreach ( $optlist as $f ) { - $var = "aiosp_$f"; + $var = "aiosp_$f"; $field = "_aioseop_$f"; - if ( isset( $$var ) && !empty( $$var ) ) - add_term_meta( $id, $field, $$var ); - } - if (isset( $aiosp_sitemap_exclude ) && !empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) - add_term_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude ); - if (isset( $aiosp_disable ) && !empty( $aiosp_disable ) && $this->is_admin() ) { - add_term_meta( $id, '_aioseop_disable', $aiosp_disable ); - if (isset( $aiosp_disable_analytics ) && !empty( $aiosp_disable_analytics ) ) - add_term_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics ); + if ( isset( $$var ) && ! empty( $$var ) ) { + add_term_meta( $id, $field, $$var ); + } + } + if ( isset( $aiosp_sitemap_exclude ) && ! empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) { + add_term_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude ); + } + if ( isset( $aiosp_disable ) && ! empty( $aiosp_disable ) && $this->is_admin() ) { + add_term_meta( $id, '_aioseop_disable', $aiosp_disable ); + if ( isset( $aiosp_disable_analytics ) && ! empty( $aiosp_disable_analytics ) ) { + add_term_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics ); + } } - } + } } function admin_menu() { - $file = plugin_basename( __FILE__ ); + $file = plugin_basename( __FILE__ ); $menu_name = __( 'All in One SEO', 'all-in-one-seo-pack' ); - $this->locations['aiosp']['default_options']['nonce-aioseop-edit']['default'] = wp_create_nonce('edit-aioseop-nonce'); + $this->locations['aiosp']['default_options']['nonce-aioseop-edit']['default'] = wp_create_nonce( 'edit-aioseop-nonce' ); $custom_menu_order = false; global $aioseop_options; - if ( !isset( $aioseop_options['custom_menu_order'] ) ) + if ( ! isset( $aioseop_options['custom_menu_order'] ) ) { $custom_menu_order = true; + } - $this->update_options( ); + $this->update_options(); $this->add_admin_pointers(); - if ( !empty( $this->pointers ) ) - foreach( $this->pointers as $k => $p ) - if ( !empty( $p["pointer_scope"] ) && ( $p["pointer_scope"] == 'global' ) ) - unset( $this->pointers[$k] ); + if ( ! empty( $this->pointers ) ) { + foreach ( $this->pointers as $k => $p ) { + if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) { + unset( $this->pointers[ $k ] ); + } + } + } $donated = false; - if ( ( isset( $_POST ) ) && ( isset( $_POST['module'] ) ) && ( isset( $_POST['nonce-aioseop'] ) ) && ( $_POST['module'] == 'All_in_One_SEO_Pack' ) && ( wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) ) { - if ( isset( $_POST["aiosp_donate"] ) ) - $donated = $_POST["aiosp_donate"]; - if ( isset($_POST["Submit"] ) ) { - if ( isset( $_POST["aiosp_custom_menu_order"] ) ) - $custom_menu_order = $_POST["aiosp_custom_menu_order"]; - else + if ( isset( $_POST ) && isset( $_POST['module'] ) && isset( $_POST['nonce-aioseop'] ) && ( $_POST['module'] == 'All_in_One_SEO_Pack' ) && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) { + if ( isset( $_POST['aiosp_donate'] ) ) { + $donated = $_POST['aiosp_donate']; + } + if ( isset( $_POST['Submit'] ) ) { + if ( isset( $_POST['aiosp_custom_menu_order'] ) ) { + $custom_menu_order = $_POST['aiosp_custom_menu_order']; + } else { $custom_menu_order = false; - } else if ( ( isset($_POST["Submit_Default"] ) ) || ( ( isset($_POST["Submit_All_Default"] ) ) ) ) { + } + } else if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) { $custom_menu_order = true; } } else { - if ( isset( $this->options["aiosp_donate"] ) ) - $donated = $this->options["aiosp_donate"]; - if ( isset( $this->options["aiosp_custom_menu_order"] ) ) - $custom_menu_order = $this->options["aiosp_custom_menu_order"]; + if ( isset( $this->options['aiosp_donate'] ) ) { + $donated = $this->options['aiosp_donate']; + } + if ( isset( $this->options['aiosp_custom_menu_order'] ) ) { + $custom_menu_order = $this->options['aiosp_custom_menu_order']; + } } if ( $custom_menu_order ) { @@ -3432,140 +4918,166 @@ function admin_menu() { } if ( $donated ) { - // Thank you for your donation - $this->pointers['aioseop_donate'] = Array( 'pointer_target' => '#aiosp_donate_wrapper', - 'pointer_text' => '

' . __( 'Thank you!', 'all-in-one-seo-pack' ) - . '

' . __( 'Thank you for your donation, it helps keep this plugin free and actively developed!', 'all-in-one-seo-pack' ) . '

' - ); + // Thank you for your donation. + $this->pointers['aioseop_donate'] = array( + 'pointer_target' => '#aiosp_donate_wrapper', + 'pointer_text' => '

' . __( 'Thank you!', 'all-in-one-seo-pack' ) + . '

' . __( 'Thank you for your donation, it helps keep this plugin free and actively developed!', 'all-in-one-seo-pack' ) . '

', + ); } - if ( !AIOSEOPPRO ){ - if ( !empty( $this->pointers ) ) - foreach( $this->pointers as $k => $p ) - if ( !empty( $p["pointer_scope"] ) && ( $p["pointer_scope"] == 'global' ) ) - unset( $this->pointers[$k] ); + if ( ! AIOSEOPPRO ) { + if ( ! empty( $this->pointers ) ) { + foreach ( $this->pointers as $k => $p ) { + if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) { + unset( $this->pointers[ $k ] ); + } + } + } - $this->filter_pointers(); + $this->filter_pointers(); } - if ( !empty( $this->options['aiosp_enablecpost'] ) && $this->options['aiosp_enablecpost'] ) { + if ( ! empty( $this->options['aiosp_enablecpost'] ) && $this->options['aiosp_enablecpost'] ) { if ( AIOSEOPPRO ) { - $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive']; - if ( !empty( $this->options['aiosp_taxactive'] ) ) { - foreach( $this->options['aiosp_taxactive'] as $tax ) { - $this->locations['aiosp']['display'][] = 'edit-' . $tax; - add_action( "{$tax}_edit_form", Array( $this, 'display_category_metaboxes' ) ); - add_action( "edited_{$tax}", Array( $this, 'save_category_metaboxes' ) ); + $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive']; + if ( ! empty( $this->options['aiosp_taxactive'] ) ) { + foreach ( $this->options['aiosp_taxactive'] as $tax ) { + $this->locations['aiosp']['display'][] = 'edit-' . $tax; + add_action( "{$tax}_edit_form", array( $this, 'display_category_metaboxes' ) ); + add_action( "edited_{$tax}", array( $this, 'save_category_metaboxes' ) ); + } } - } } else { - if ( !empty( $this->options['aiosp_cpostactive'] ) ) { + if ( ! empty( $this->options['aiosp_cpostactive'] ) ) { $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive']; } else { - $this->locations['aiosp']['display'] = Array(); + $this->locations['aiosp']['display'] = array(); } } } else { - $this->locations['aiosp']['display'] = Array( 'post', 'page' ); + $this->locations['aiosp']['display'] = array( 'post', 'page' ); } - add_menu_page( $menu_name, $menu_name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ) , $file, Array( $this, 'display_settings_page' ) ); + add_menu_page( $menu_name, $menu_name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $file, array( + $this, + 'display_settings_page', + ) ); - add_meta_box('aioseop-list', __( "Join Our Mailing List", 'all-in-one-seo-pack' ), array( 'aiosp_metaboxes', 'display_extra_metaboxes'), 'aioseop_metaboxes', 'normal', 'core'); - if ( AIOSEOPPRO ){ - add_meta_box('aioseop-about', __( "About", 'all-in-one-seo-pack' ), array( 'aiosp_metaboxes', 'display_extra_metaboxes'), 'aioseop_metaboxes', 'side', 'core'); + add_meta_box( 'aioseop-list', __( 'Join Our Mailing List', 'all-in-one-seo-pack' ), array( + 'aiosp_metaboxes', + 'display_extra_metaboxes', + ), 'aioseop_metaboxes', 'normal', 'core' ); + if ( AIOSEOPPRO ) { + add_meta_box( 'aioseop-about', __( 'About', 'all-in-one-seo-pack' ), array( + 'aiosp_metaboxes', + 'display_extra_metaboxes', + ), 'aioseop_metaboxes', 'side', 'core' ); } else { - add_meta_box('aioseop-about', "About Version " . AIOSEOP_VERSION . "", array( 'aiosp_metaboxes', 'display_extra_metaboxes'), 'aioseop_metaboxes', 'side', 'core'); + add_meta_box( 'aioseop-about', "About Version " . AIOSEOP_VERSION . '', array( + 'aiosp_metaboxes', + 'display_extra_metaboxes', + ), 'aioseop_metaboxes', 'side', 'core' ); } - add_meta_box('aioseop-support', __( "Support", 'all-in-one-seo-pack' ) . " " . __( "Version", 'all-in-one-seo-pack' ) . " " . AIOSEOP_VERSION . "", array( 'aiosp_metaboxes', 'display_extra_metaboxes'), 'aioseop_metaboxes', 'side', 'core'); + add_meta_box( 'aioseop-support', __( 'Support', 'all-in-one-seo-pack' ) . " " . __( 'Version', 'all-in-one-seo-pack' ) . ' ' . AIOSEOP_VERSION . '', array( + 'aiosp_metaboxes', + 'display_extra_metaboxes', + ), 'aioseop_metaboxes', 'side', 'core' ); - add_action( 'aioseop_modules_add_menus', Array( $this, 'add_menu' ), 5 ); + add_action( 'aioseop_modules_add_menus', array( $this, 'add_menu' ), 5 ); do_action( 'aioseop_modules_add_menus', $file ); - $metaboxes = apply_filters( 'aioseop_add_post_metabox', Array() ); + $metaboxes = apply_filters( 'aioseop_add_post_metabox', array() ); - if ( !empty( $metaboxes ) ) { + if ( ! empty( $metaboxes ) ) { if ( $this->tabbed_metaboxes ) { - $tabs = Array(); + $tabs = array(); $tab_num = 0; foreach ( $metaboxes as $m ) { - if ( !isset( $tabs[ $m['post_type'] ] ) ) $tabs[ $m['post_type'] ] = Array(); + if ( ! isset( $tabs[ $m['post_type'] ] ) ) { + $tabs[ $m['post_type'] ] = array(); + } $tabs[ $m['post_type'] ][] = $m; } - if ( !empty( $tabs ) ) { - foreach( $tabs as $p => $m ) { + if ( ! empty( $tabs ) ) { + foreach ( $tabs as $p => $m ) { $tab_num = count( $m ); - $title = $m[0]['title']; - if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title; + $title = $m[0]['title']; + if ( $title != $this->plugin_name ) { + $title = $this->plugin_name . ' - ' . $title; + } if ( $tab_num <= 1 ) { - if ( !empty( $m[0]['callback_args']['help_link'] ) ) - $title .= "" . __( 'Help', 'all-in-one-seo-pack' ) . ""; + if ( ! empty( $m[0]['callback_args']['help_link'] ) ) { + $title .= "" . __( 'Help', 'all-in-one-seo-pack' ) . ''; + } add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] ); } elseif ( $tab_num > 1 ) { - add_meta_box( $m[0]['id'] . '_tabbed', $title, Array( $this, 'display_tabbed_metabox' ), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m ); + add_meta_box( $m[0]['id'] . '_tabbed', $title, array( + $this, + 'display_tabbed_metabox', + ), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m ); } } } } else { foreach ( $metaboxes as $m ) { $title = $m['title']; - if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title; - if ( !empty( $m['help_link'] ) ) - $title .= "" . __( 'Help', 'all-in-one-seo-pack' ) . ""; + if ( $title != $this->plugin_name ) { + $title = $this->plugin_name . ' - ' . $title; + } + if ( ! empty( $m['help_link'] ) ) { + $title .= "" . __( 'Help', 'all-in-one-seo-pack' ) . ''; + } add_meta_box( $m['id'], $title, $m['callback'], $m['post_type'], $m['context'], $m['priority'], $m['callback_args'] ); } } } } - function get_metabox_header( $tabs ) { - $header = '
    '; - $active = ' active'; - foreach( $tabs as $t ) { - if ( $active ) - $title = __( 'Main Settings', 'all-in-one-seo-pack' ); - else - $title = $t['title']; - $header .= '
  • '; - $active = ''; - } - $header .= '
'; - return $header; - } - + /** + * @param $menu_order + * + * @return array + */ function set_menu_order( $menu_order ) { $order = array(); - $file = plugin_basename( __FILE__ ); + $file = plugin_basename( __FILE__ ); foreach ( $menu_order as $index => $item ) { - if ( $item != $file ) $order[] = $item; - if ( $index == 0 ) $order[] = $file; + if ( $item != $file ) { + $order[] = $item; + } + if ( $index == 0 ) { + $order[] = $file; + } } + return $order; } function display_settings_header() { } - function display_settings_footer( ) { + + function display_settings_footer() { } - function display_right_sidebar( ) { + function display_right_sidebar() { global $wpdb; - if( !get_option( 'aioseop_options' ) ) { + if ( ! get_option( 'aioseop_options' ) ) { $msg = "

Your database options need to be updated.(Back up your database before updating.)

"; - aioseop_output_dismissable_notice( $msg, "", "error" ); + aioseop_output_dismissable_notice( $msg, '', 'error' ); } -?> + ?>
- +
-
- - - -
-
-
- - - - -
+
+ + + +
+ +
+
+ + + + +
+
-
> -
- -
- -
-
-

Drag and Drop WordPress Design

-

Headway Themes allows you to easily create your own stunning website designs! Stop using premade themes start making your own design with Headway's easy to use Drag and Drop interface. All in One SEO Pack users have an exclusive discount by using coupon code SEMPERFI30 at checkout.

+ +
>
-
-
- -
-
- + +
+
+
+

Drag and Drop WordPress Design

+

Headway Themes + allows you to easily create your own stunning website designs! Stop using premade themes + start making your own design with Headway's easy to use Drag and Drop interface. All in + One SEO Pack users have an exclusive discount by using coupon code + SEMPERFI30 at checkout.

+
+ +
+ +
+
+ add_cap( 'aiosp_manage_seo' ); + } + } +} +add_action( 'plugins_loaded', 'aiosp_add_cap' ); -//register_activation_hook(__FILE__,'aioseop_activate_pl'); +if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) { + define( 'AIOSEOP_PLUGIN_NAME', $aioseop_plugin_name ); +} +// Do we need this? register_activation_hook(__FILE__,'aioseop_activate_pl');. if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) { - define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -} elseif ( AIOSEOP_PLUGIN_DIR != plugin_dir_path( __FILE__ ) ) { - -//this is not a great message -/* - add_action( 'admin_notices', create_function( '', 'echo "' . "
" . sprintf( - __( "%s detected a conflict; please deactivate the plugin located in %s.", 'all-in-one-seo-pack' ), - $aioseop_plugin_name, AIOSEOP_PLUGIN_DIR ) . "
" . '";' ) ); -*/ - - return; + define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); +} elseif ( AIOSEOP_PLUGIN_DIR !== plugin_dir_path( __FILE__ ) ) { + /* + This is not a great message. + add_action( 'admin_notices', create_function( '', 'echo "' . "
" . sprintf( + __( "%s detected a conflict; please deactivate the plugin located in %s.", 'all-in-one-seo-pack' ), + $aioseop_plugin_name, AIOSEOP_PLUGIN_DIR ) . "
" . '";' ) ); + */ + return; } -if ( ! defined( 'AIOSEOP_PLUGIN_BASENAME' ) ) - define( 'AIOSEOP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); -if ( ! defined( 'AIOSEOP_PLUGIN_DIRNAME' ) ) - define( 'AIOSEOP_PLUGIN_DIRNAME', dirname( AIOSEOP_PLUGIN_BASENAME ) ); -if ( ! defined( 'AIOSEOP_PLUGIN_URL' ) ) - define( 'AIOSEOP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); -if ( ! defined( 'AIOSEOP_PLUGIN_IMAGES_URL' ) ) - define( 'AIOSEOP_PLUGIN_IMAGES_URL', AIOSEOP_PLUGIN_URL . 'images/' ); -if ( ! defined( 'AIOSEOP_BASELINE_MEM_LIMIT' ) ) - define( 'AIOSEOP_BASELINE_MEM_LIMIT', 268435456 ); // 256MB -if ( ! defined( 'WP_CONTENT_URL' ) ) - define( 'WP_CONTENT_URL', site_url() . '/wp-content' ); -if ( ! defined( 'WP_ADMIN_URL' ) ) - define( 'WP_ADMIN_URL', site_url() . '/wp-admin' ); -if ( ! defined( 'WP_CONTENT_DIR' ) ) - define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); -if ( ! defined( 'WP_PLUGIN_URL' ) ) - define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' ); -if ( ! defined( 'WP_PLUGIN_DIR' ) ) - define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); +if ( ! defined( 'AIOSEOP_PLUGIN_BASENAME' ) ) { + define( 'AIOSEOP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); +} +if ( ! defined( 'AIOSEOP_PLUGIN_DIRNAME' ) ) { + define( 'AIOSEOP_PLUGIN_DIRNAME', dirname( AIOSEOP_PLUGIN_BASENAME ) ); +} +if ( ! defined( 'AIOSEOP_PLUGIN_URL' ) ) { + define( 'AIOSEOP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); +} +if ( ! defined( 'AIOSEOP_PLUGIN_IMAGES_URL' ) ) { + define( 'AIOSEOP_PLUGIN_IMAGES_URL', AIOSEOP_PLUGIN_URL . 'images/' ); +} +if ( ! defined( 'AIOSEOP_BASELINE_MEM_LIMIT' ) ) { + define( 'AIOSEOP_BASELINE_MEM_LIMIT', 268435456 ); +} // 256MB +if ( ! defined( 'WP_CONTENT_URL' ) ) { + define( 'WP_CONTENT_URL', site_url() . '/wp-content' ); +} +if ( ! defined( 'WP_ADMIN_URL' ) ) { + define( 'WP_ADMIN_URL', site_url() . '/wp-admin' ); +} +if ( ! defined( 'WP_CONTENT_DIR' ) ) { + define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); +} +if ( ! defined( 'WP_PLUGIN_URL' ) ) { + define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); +} +if ( ! defined( 'WP_PLUGIN_DIR' ) ) { + define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); +} global $aiosp, $aioseop_options, $aioseop_modules, $aioseop_module_list, $aiosp_activation, $aioseop_mem_limit, $aioseop_get_pages_start, $aioseop_admin_menu; $aioseop_get_pages_start = $aioseop_admin_menu = 0; @@ -105,253 +135,290 @@ $aioseop_mem_limit = @ini_get( 'memory_limit' ); -if ( !function_exists( 'aioseop_convert_bytestring' ) ) { - function aioseop_convert_bytestring( $byteString ) { +if ( ! function_exists( 'aioseop_convert_bytestring' ) ) { + /** + * @param $byte_string + * + * @return int + */ + function aioseop_convert_bytestring( $byte_string ) { $num = 0; - preg_match( '/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $byteString, $matches ); - if ( !empty( $matches ) ) { - $num = ( float )$matches[1]; + preg_match( '/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $byte_string, $matches ); + if ( ! empty( $matches ) ) { + $num = (float) $matches[1]; switch ( strtoupper( $matches[2] ) ) { - case 'E': $num = $num * 1024; - case 'P': $num = $num * 1024; - case 'T': $num = $num * 1024; - case 'G': $num = $num * 1024; - case 'M': $num = $num * 1024; - case 'K': $num = $num * 1024; + case 'E': + $num *= 1024; + case 'P': + $num *= 1024; + case 'T': + $num *= 1024; + case 'G': + $num *= 1024; + case 'M': + $num *= 1024; + case 'K': + $num *= 1024; } } + return intval( $num ); } } if ( is_array( $aioseop_options ) && isset( $aioseop_options['modules'] ) && isset( $aioseop_options['modules']['aiosp_performance_options'] ) ) { $perf_opts = $aioseop_options['modules']['aiosp_performance_options']; - if ( isset( $perf_opts['aiosp_performance_memory_limit'] ) ) + if ( isset( $perf_opts['aiosp_performance_memory_limit'] ) ) { $aioseop_mem_limit = $perf_opts['aiosp_performance_memory_limit']; - if ( isset( $perf_opts['aiosp_performance_execution_time'] ) && ( $perf_opts['aiosp_performance_execution_time'] !== '' ) ) { - @ini_set( 'max_execution_time', (int)$perf_opts['aiosp_performance_execution_time'] ); - @set_time_limit( (int)$perf_opts['aiosp_performance_execution_time'] ); + } + if ( isset( $perf_opts['aiosp_performance_execution_time'] ) && ( '' !== $perf_opts['aiosp_performance_execution_time'] ) ) { + @ini_set( 'max_execution_time', (int) $perf_opts['aiosp_performance_execution_time'] ); + @set_time_limit( (int) $perf_opts['aiosp_performance_execution_time'] ); } } else { $aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit ); - if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit < AIOSEOP_BASELINE_MEM_LIMIT ) ) + if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit < AIOSEOP_BASELINE_MEM_LIMIT ) ) { $aioseop_mem_limit = AIOSEOP_BASELINE_MEM_LIMIT; + } } -if ( !empty( $aioseop_mem_limit ) ) { - if ( !is_int( $aioseop_mem_limit ) ) +if ( ! empty( $aioseop_mem_limit ) ) { + if ( ! is_int( $aioseop_mem_limit ) ) { $aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit ); - if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit <= AIOSEOP_BASELINE_MEM_LIMIT ) ) + } + if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit <= AIOSEOP_BASELINE_MEM_LIMIT ) ) { @ini_set( 'memory_limit', $aioseop_mem_limit ); + } } -$aiosp_activation = false; -$aioseop_module_list = Array( 'sitemap', 'opengraph', 'robots', 'file_editor', 'importer_exporter', 'bad_robots', 'performance' ); // list all available modules here +$aiosp_activation = false; +$aioseop_module_list = array( + 'sitemap', + 'opengraph', + 'robots', + 'file_editor', + 'importer_exporter', + 'bad_robots', + 'performance', +); // list all available modules here -if (AIOSEOPPRO){ +if ( AIOSEOPPRO ) { $aioseop_module_list[] = 'video_sitemap'; } if ( class_exists( 'All_in_One_SEO_Pack' ) ) { add_action( 'admin_notices', create_function( '', 'echo "
The All In One SEO Pack class is already defined";' - . "if ( class_exists( 'ReflectionClass' ) ) { \$r = new ReflectionClass( 'All_in_One_SEO_Pack' ); echo ' in ' . \$r->getFileName(); } " - . ' echo ", preventing All In One SEO Pack from loading.
";' ) ); - return; + . "if ( class_exists( 'ReflectionClass' ) ) { \$r = new ReflectionClass( 'All_in_One_SEO_Pack' ); echo ' in ' . \$r->getFileName(); } " + . ' echo ", preventing All In One SEO Pack from loading.
";' ) ); + + return; } -if ( AIOSEOPPRO ){ - - require( AIOSEOP_PLUGIN_DIR . 'pro/sfwd_update_checker.php'); +if ( AIOSEOPPRO ) { + + require( AIOSEOP_PLUGIN_DIR . 'pro/sfwd_update_checker.php' ); $aioseop_update_checker = new SFWD_Update_Checker( - 'http://semperplugins.com/upgrade_plugins.php', - __FILE__, - 'aioseop' + 'http://semperplugins.com/upgrade_plugins.php', + __FILE__, + 'aioseop' ); - - -$aioseop_update_checker->plugin_name = AIOSEOP_PLUGIN_NAME; -$aioseop_update_checker->plugin_basename = AIOSEOP_PLUGIN_BASENAME; -if ( !empty( $aioseop_options['aiosp_license_key'] ) ) - $aioseop_update_checker->license_key = $aioseop_options['aiosp_license_key']; -else - $aioseop_update_checker->license_key = ''; -$aioseop_update_checker->options_page = 'all-in-one-seo-pack-pro/aioseop_class.php'; -$aioseop_update_checker->renewal_page = 'http://semperplugins.com/all-in-one-seo-pack-pro-support-updates-renewal/'; -$aioseop_update_checker->addQueryArgFilter( Array( $aioseop_update_checker, 'add_secret_key' ) ); + $aioseop_update_checker->plugin_name = AIOSEOP_PLUGIN_NAME; + $aioseop_update_checker->plugin_basename = AIOSEOP_PLUGIN_BASENAME; + if ( ! empty( $aioseop_options['aiosp_license_key'] ) ) { + $aioseop_update_checker->license_key = $aioseop_options['aiosp_license_key']; + } else { + $aioseop_update_checker->license_key = ''; + } + $aioseop_update_checker->options_page = 'all-in-one-seo-pack-pro/aioseop_class.php'; + $aioseop_update_checker->renewal_page = 'http://semperplugins.com/all-in-one-seo-pack-pro-support-updates-renewal/'; + + $aioseop_update_checker->addQueryArgFilter( array( $aioseop_update_checker, 'add_secret_key' ) ); } -/** - * Check if we just got activated. - */ -if ( !function_exists( 'aioseop_activate' ) ) { +if ( ! function_exists( 'aioseop_activate' ) ) { + function aioseop_activate() { - - global $aiosp_activation; - if ( AIOSEOPPRO ){ - global $aioseop_update_checker; - } - $aiosp_activation = true; - delete_transient( "aioseop_oauth_current" ); + + //Check if we just got activated. + global $aiosp_activation; + if ( AIOSEOPPRO ) { + global $aioseop_update_checker; + } + $aiosp_activation = true; delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' ); - if ( AIOSEOPPRO ){ - $aioseop_update_checker->checkForUpdates(); + if ( AIOSEOPPRO ) { + $aioseop_update_checker->checkForUpdates(); } } } add_action( 'plugins_loaded', 'aioseop_init_class' ); +if ( ! function_exists( 'aiosp_plugin_row_meta' ) ) { + add_filter( 'plugin_row_meta', 'aiosp_plugin_row_meta', 10, 2 ); -if(!function_exists('aiosp_plugin_row_meta')){ + /** + * @param $actions + * @param $plugin_file + * + * @return array + */ + function aiosp_plugin_row_meta( $actions, $plugin_file ) { -add_filter( 'plugin_row_meta', 'aiosp_plugin_row_meta', 10, 2 ); + if ( ! AIOSEOPPRO ) { -function aiosp_plugin_row_meta( $actions, $plugin_file ) { + $action_links = array( + 'donatelink' => array( + 'label' => __( 'Donate', 'all-in-one-seo-pack' ), + 'url' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8', + ), + 'amazon' => array( + 'label' => __( 'Amazon Wishlist', 'all-in-one-seo-pack' ), + 'url' => 'https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web', + ), -if(!AIOSEOPPRO){ + ); - $action_links = array( - 'donatelink' => array( - 'label' => __('Donate', 'all-in-one-seo-pack'), - 'url' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8' - ) -, - 'amazon' => array( - 'label' => __('Amazon Wishlist', 'all-in-one-seo-pack'), - 'url' => 'https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web' - ) - - -); - -}else{ - $action_links = ''; -} + } else { + $action_links = ''; + } - return aiosp_action_links( $actions, $plugin_file, $action_links, 'after'); -} + return aiosp_action_links( $actions, $plugin_file, $action_links, 'after' ); + } } +if ( ! function_exists( 'aiosp_add_action_links' ) ) { + add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'aiosp_add_action_links', 10, 2 ); + /** + * @param $actions + * @param $plugin_file + * + * @return array + */ + function aiosp_add_action_links( $actions, $plugin_file ) { + $aioseop_plugin_dirname = AIOSEOP_PLUGIN_DIRNAME; + $action_links = array(); + $action_links = array( + 'settings' => array( + 'label' => __( 'SEO Settings', 'all-in-one-seo-pack' ), + 'url' => get_admin_url( null, "admin.php?page=$aioseop_plugin_dirname/aioseop_class.php" ), + ), -if(!function_exists('aiosp_add_action_links')) { - - -add_filter( 'plugin_action_links_' . plugin_basename(__FILE__) , 'aiosp_add_action_links', 10, 2 ); - - + 'forum' => array( + 'label' => __( 'Support Forum', 'all-in-one-seo-pack' ), + 'url' => 'http://semperplugins.com/support/', + ), -function aiosp_add_action_links( $actions, $plugin_file ) { - - $aioseop_plugin_dirname = AIOSEOP_PLUGIN_DIRNAME; - $action_links = Array(); - $action_links = array( - 'settings' => array( - 'label' => __('SEO Settings', 'all-in-one-seo-pack'), - 'url' => get_admin_url(null, "admin.php?page=$aioseop_plugin_dirname/aioseop_class.php") - ), - - 'forum' => array( - 'label' => __('Support Forum', 'all-in-one-seo-pack'), - 'url' => 'http://semperplugins.com/support/' + 'docs' => array( + 'label' => __( 'Documentation', 'all-in-one-seo-pack' ), + 'url' => 'http://semperplugins.com/documentation/', ), - 'docs' => array( - 'label' => __('Documentation', 'all-in-one-seo-pack'), - 'url' => 'http://semperplugins.com/documentation/' - ) - - ); + ); -unset( $actions['edit'] ); + unset( $actions['edit'] ); -if(!AIOSEOPPRO){ -$action_links['proupgrade'] = - array( - 'label' => __('Upgrade to Pro', 'all-in-one-seo-pack'), - 'url' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins' + if ( ! AIOSEOPPRO ) { + $action_links['proupgrade'] = + array( + 'label' => __( 'Upgrade to Pro', 'all-in-one-seo-pack' ), + 'url' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins', -); -} + ); + } - return aiosp_action_links( $actions, $plugin_file, $action_links, 'before'); + return aiosp_action_links( $actions, $plugin_file, $action_links, 'before' ); + } } + +if ( ! function_exists( 'aiosp_action_links' ) ) { + + /** + * @param $actions + * @param $plugin_file + * @param array $action_links + * @param string $position + * + * @return array + */ + function aiosp_action_links( $actions, $plugin_file, $action_links = array(), $position = 'after' ) { + static $plugin; + if ( ! isset( $plugin ) ) { + $plugin = plugin_basename( __FILE__ ); + } + if ( $plugin === $plugin_file && ! empty( $action_links ) ) { + foreach ( $action_links as $key => $value ) { + $link = array( $key => '' . $value['label'] . '' ); + if ( 'after' === $position ) { + $actions = array_merge( $actions, $link ); + } else { + $actions = array_merge( $link, $actions ); + } + }//foreach + }// if + return $actions; + } } - if(!function_exists('aiosp_action_links')) { -function aiosp_action_links ( $actions, $plugin_file, $action_links = array(), $position = 'after' ) { - static $plugin; - if( !isset($plugin) ) { - $plugin = plugin_basename( __FILE__ ); - } - if( $plugin == $plugin_file && !empty( $action_links ) ) { - foreach( $action_links as $key => $value ) { - $link = array( $key => '' . $value['label'] . '' ); - if( $position == 'after' ) { - $actions = array_merge( $actions, $link ); - } else { - $actions = array_merge( $link, $actions ); - } - }//foreach - }// if - return $actions; -} -} -if ( !function_exists( 'aioseop_init_class' ) ) { +if ( ! function_exists( 'aioseop_init_class' ) ) { function aioseop_init_class() { global $aiosp; load_plugin_textdomain( 'all-in-one-seo-pack', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n/' ); require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_functions.php' ); require_once( AIOSEOP_PLUGIN_DIR . 'aioseop_class.php' ); - require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_updates_class.php'); - require_once( AIOSEOP_PLUGIN_DIR . 'inc/commonstrings.php'); - require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/postedit.php'); - require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/general-metaboxes.php'); - require_once( AIOSEOP_PLUGIN_DIR . 'inc/aiosp_common.php'); - require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php'); - - if( AIOSEOPPRO ){ + require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_updates_class.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'inc/commonstrings.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/postedit.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/general-metaboxes.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'inc/aiosp_common.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'inc/translations.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'public/opengraph.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/compat-init.php'); + require_once( AIOSEOP_PLUGIN_DIR . 'public/front.php' ); + + if ( AIOSEOPPRO ) { require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_general.php' ); - require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_class.php'); - require_once( AIOSEOP_PLUGIN_DIR . 'pro/aioseop_pro_updates_class.php'); + require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_class.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'pro/aioseop_pro_updates_class.php' ); } aiosp_seometa_import(); // call importer functions... this should be moved somewhere better - + $aiosp = new All_in_One_SEO_Pack(); - + $aioseop_updates = new AIOSEOP_Updates(); - if( AIOSEOPPRO ){ + if ( AIOSEOPPRO ) { $aioseop_pro_updates = new AIOSEOP_Pro_Updates(); add_action( 'admin_init', array( $aioseop_pro_updates, 'version_updates' ), 12 ); } - if ( aioseop_option_isset( 'aiosp_unprotect_meta' ) ) + if ( aioseop_option_isset( 'aiosp_unprotect_meta' ) ) { add_filter( 'is_protected_meta', 'aioseop_unprotect_meta', 10, 3 ); - - - + } add_action( 'init', array( $aiosp, 'add_hooks' ) ); add_action( 'admin_init', array( $aioseop_updates, 'version_updates' ), 11 ); - - if ( defined( 'DOING_AJAX' ) && !empty( $_POST ) && !empty( $_POST['action'] ) && ( $_POST['action'] === 'aioseop_ajax_scan_header' ) ) { + + if ( defined( 'DOING_AJAX' ) && ! empty( $_POST ) && ! empty( $_POST['action'] ) && 'aioseop_ajax_scan_header' === $_POST['action'] ) { remove_action( 'init', array( $aiosp, 'add_hooks' ) ); - add_action('admin_init', 'aioseop_scan_post_header' ); - add_action('shutdown', 'aioseop_ajax_scan_header' ); // if the action doesn't run -- pdb - include_once(ABSPATH . 'wp-admin/includes/screen.php'); + add_action( 'admin_init', 'aioseop_scan_post_header' ); + add_action( 'shutdown', 'aioseop_ajax_scan_header' ); // if the action doesn't run -- pdb + include_once( ABSPATH . 'wp-admin/includes/screen.php' ); global $current_screen; - if ( class_exists( 'WP_Screen' ) ) + if ( class_exists( 'WP_Screen' ) ) { $current_screen = WP_Screen::get( 'front' ); + } } } } @@ -360,47 +427,49 @@ function aioseop_init_class() { //add_action( 'after_setup_theme', 'aioseop_load_modules' ); if ( is_admin() ) { - add_action( 'wp_ajax_aioseop_ajax_save_meta', 'aioseop_ajax_save_meta' ); - add_action( 'wp_ajax_aioseop_ajax_save_url', 'aioseop_ajax_save_url' ); - add_action( 'wp_ajax_aioseop_ajax_delete_url', 'aioseop_ajax_delete_url' ); - add_action( 'wp_ajax_aioseop_ajax_scan_header', 'aioseop_ajax_scan_header' ); - if(AIOSEOPPRO){ + add_action( 'wp_ajax_aioseop_ajax_save_meta', 'aioseop_ajax_save_meta' ); + add_action( 'wp_ajax_aioseop_ajax_save_url', 'aioseop_ajax_save_url' ); + add_action( 'wp_ajax_aioseop_ajax_delete_url', 'aioseop_ajax_delete_url' ); + add_action( 'wp_ajax_aioseop_ajax_scan_header', 'aioseop_ajax_scan_header' ); + if ( AIOSEOPPRO ) { add_action( 'wp_ajax_aioseop_ajax_facebook_debug', 'aioseop_ajax_facebook_debug' ); } - add_action( 'wp_ajax_aioseop_ajax_save_settings', 'aioseop_ajax_save_settings'); - add_action( 'wp_ajax_aioseop_ajax_get_menu_links', 'aioseop_ajax_get_menu_links'); - add_action( 'wp_ajax_aioseo_dismiss_yst_notice' , 'aioseop_update_yst_detected_notice'); - add_action( 'wp_ajax_aioseo_dismiss_visibility_notice' , 'aioseop_update_user_visibilitynotice'); - add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice' , 'aioseop_woo_upgrade_notice_dismissed'); - if(AIOSEOPPRO){ - add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' ); + add_action( 'wp_ajax_aioseop_ajax_save_settings', 'aioseop_ajax_save_settings' ); + add_action( 'wp_ajax_aioseop_ajax_get_menu_links', 'aioseop_ajax_get_menu_links' ); + add_action( 'wp_ajax_aioseo_dismiss_yst_notice', 'aioseop_update_yst_detected_notice' ); + add_action( 'wp_ajax_aioseo_dismiss_visibility_notice', 'aioseop_update_user_visibilitynotice' ); + add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice', 'aioseop_woo_upgrade_notice_dismissed' ); + if ( AIOSEOPPRO ) { + add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' ); } } -if ( !function_exists( 'aioseop_scan_post_header' ) ) { +if ( ! function_exists( 'aioseop_scan_post_header' ) ) { function aioseop_scan_post_header() { require_once( ABSPATH . WPINC . '/default-filters.php' ); global $wp_query; $wp_query->query_vars['paged'] = 0; - query_posts('post_type=post&posts_per_page=1'); - if (have_posts()) the_post(); + query_posts( 'post_type=post&posts_per_page=1' ); + if ( have_posts() ) { + the_post(); + } } } -require_once( AIOSEOP_PLUGIN_DIR . 'aioseop_init.php' ); - +require_once( AIOSEOP_PLUGIN_DIR . 'aioseop-init.php' ); -if(!function_exists('aioseop_install')){ -register_activation_hook( __FILE__, 'aioseop_install' ); +if ( ! function_exists( 'aioseop_install' ) ) { + register_activation_hook( __FILE__, 'aioseop_install' ); -function aioseop_install(){ - aioseop_activate(); -} + function aioseop_install() { + aioseop_activate(); + } } -if(!function_exists('disable_all_in_one_free')){ -function disable_all_in_one_free(){ - if ( AIOSEOPPRO && is_plugin_active( 'all-in-one-seo-pack/all_in_one_seo_pack.php' )){ - deactivate_plugins( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ); +if ( ! function_exists( 'disable_all_in_one_free' ) ) { + function disable_all_in_one_free() { + if ( AIOSEOPPRO && is_plugin_active( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ) ) { + deactivate_plugins( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ); + } } -}} +} diff --git a/wp-content/plugins/all-in-one-seo-pack/css/aiosp_admin.css b/wp-content/plugins/all-in-one-seo-pack/css/aiosp_admin.css index 315264e60a..e10a62098f 100644 --- a/wp-content/plugins/all-in-one-seo-pack/css/aiosp_admin.css +++ b/wp-content/plugins/all-in-one-seo-pack/css/aiosp_admin.css @@ -1,72 +1,76 @@ - #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image { - background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important; - } - #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image { - background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important; - } - #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image img { - display: none; - } - #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image img { - display: none; - } - #adminmenu #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image:before { - content: ''; - } - #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image:before { - content: '' !important; - } - #toplevel_page_all-in-one-seo-pack-pro-aioseop_class:hover .wp-menu-image, #toplevel_page_all-in-one-seo-pack-pro-aioseop_class.wp-has-current-submenu .wp-menu-image { - background-position: 8px -26px !important; - } - #toplevel_page_all-in-one-seo-pack-aioseop_class:hover .wp-menu-image, #toplevel_page_all-in-one-seo-pack-aioseop_class.wp-has-current-submenu .wp-menu-image { - background-position: 8px -26px !important; - } - #icon-aioseop.icon32 { - background: url(../images/shield32.png) no-repeat left top !important; - } - #aioseop_settings_header #message { - padding: 5px 0px 5px 50px; - background-image: url(../images/update32.png); - background-repeat: no-repeat; - background-position: 10px; - font-size: 14px; - min-height: 32px; - clear: none; - } +#toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image { + background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important; +} + +#toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image { + background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important; +} + +#toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image img { + display: none; +} + +#toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image img { + display: none; +} + +#adminmenu #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image:before { + content: ''; +} + +#toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image:before { + content: '' !important; +} - @media - only screen and (-webkit-min-device-pixel-ratio: 1.5), - only screen and ( min--moz-device-pixel-ratio: 1.5), - only screen and ( -o-min-device-pixel-ratio: 3/2), - only screen and ( min-device-pixel-ratio: 1.5), - only screen and ( min-resolution: 1.5dppx) { +#toplevel_page_all-in-one-seo-pack-pro-aioseop_class:hover .wp-menu-image, #toplevel_page_all-in-one-seo-pack-pro-aioseop_class.wp-has-current-submenu .wp-menu-image { + background-position: 8px -26px !important; +} - #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image { - background-image: url('../images/shield-sprite-32.png') !important; - -webkit-background-size: 16px 48px !important; - -moz-background-size: 16px 48px !important; - background-size: 16px 48px !important; - } +#toplevel_page_all-in-one-seo-pack-aioseop_class:hover .wp-menu-image, #toplevel_page_all-in-one-seo-pack-aioseop_class.wp-has-current-submenu .wp-menu-image { + background-position: 8px -26px !important; +} - #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image { - background-image: url('../images/shield-sprite-32.png') !important; - -webkit-background-size: 16px 48px !important; - -moz-background-size: 16px 48px !important; - background-size: 16px 48px !important; - } +#icon-aioseop.icon32 { + background: url(../images/shield32.png) no-repeat left top !important; +} - #icon-aioseop.icon32 { - background-image: url('../images/shield64.png') !important; - -webkit-background-size: 32px 32px !important; - -moz-background-size: 32px 32px !important; - background-size: 32px 32px !important; - } +#aioseop_settings_header #message { + padding: 5px 0px 5px 50px; + background-image: url(../images/update32.png); + background-repeat: no-repeat; + background-position: 10px; + font-size: 14px; + min-height: 32px; + clear: none; +} - #aioseop_settings_header #message { - background-image: url(../images/update64.png) !important; - -webkit-background-size: 32px 32px !important; - -moz-background-size: 32px 32px !important; - background-size: 32px 32px !important; - } - } \ No newline at end of file +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and ( min--moz-device-pixel-ratio: 1.5), only screen and ( -o-min-device-pixel-ratio: 3/2), only screen and ( min-device-pixel-ratio: 1.5), only screen and ( min-resolution: 1.5dppx) { + + #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image { + background-image: url('../images/shield-sprite-32.png') !important; + -webkit-background-size: 16px 48px !important; + -moz-background-size: 16px 48px !important; + background-size: 16px 48px !important; + } + + #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image { + background-image: url('../images/shield-sprite-32.png') !important; + -webkit-background-size: 16px 48px !important; + -moz-background-size: 16px 48px !important; + background-size: 16px 48px !important; + } + + #icon-aioseop.icon32 { + background-image: url('../images/shield64.png') !important; + -webkit-background-size: 32px 32px !important; + -moz-background-size: 32px 32px !important; + background-size: 32px 32px !important; + } + + #aioseop_settings_header #message { + background-image: url(../images/update64.png) !important; + -webkit-background-size: 32px 32px !important; + -moz-background-size: 32px 32px !important; + background-size: 32px 32px !important; + } +} diff --git a/wp-content/plugins/all-in-one-seo-pack/css/modules/aioseop_module-rtl.css b/wp-content/plugins/all-in-one-seo-pack/css/modules/aioseop_module-rtl.css index 5b67097432..e8d0cbb77a 100644 --- a/wp-content/plugins/all-in-one-seo-pack/css/modules/aioseop_module-rtl.css +++ b/wp-content/plugins/all-in-one-seo-pack/css/modules/aioseop_module-rtl.css @@ -1,232 +1,246 @@ * { - direction: rtl !important + direction: rtl !important } .form-table.aioseop { - clear: none + clear: none } .form-table.aioseop th { - padding: 10px 9px 12px 0; - direction: rtl + padding: 10px 9px 12px 0; + direction: rtl } .aioseop_help_text_link, .aioseop_help_text_link:active { - text-align: right; - float: right + text-align: right; + float: right } .aioseop_help_text_link span { - left: -60px; + left: -60px; } .aioseop_meta_box_help > label { - margin-left: 0; - margin-right: 8px + margin-left: 0; + margin-right: 8px } .aioseop_help_text_link img { - float: left + float: left } .aioseop_meta_box_help, .aioseop_meta_box_help:active { - float: left; - padding-left: 0; - margin-right: 0; - margin-left: 64px + float: left; + padding-left: 0; + margin-right: 0; + margin-left: 64px } .aioseop_label { - padding-left: 0; - padding-right: 20px; - text-align: right; - direction: rtl + padding-left: 0; + padding-right: 20px; + text-align: right; + direction: rtl } .aioseop input[type="text"] { - padding: 2px 10px 2px 0 + padding: 2px 10px 2px 0 } .aioseop textarea { - padding: 10px 10px 0 0 + padding: 10px 10px 0 0 } .aioseop_help_text_div { - text-align: right; - margin: 8px 0 10px 0 + text-align: right; + margin: 8px 0 10px 0 } .aioseop_help_text { - float: right; - clear: right + float: right; + clear: right } .aioseop_head_nav { - float: right + float: right } .aioseop_head_nav_tab { - margin: 0 15px 0 0; - float: right + margin: 0 15px 0 0; + float: right } .aioseop_head_nav_tab:first-child { - margin-right: 0 + margin-right: 0 } .aioseop_header { - float: right; - clear: right + float: right; + clear: right } .aioseop_nopad { - padding-right: 0 + padding-right: 0 } .aioseop_adverts { - float: left + float: left } .aioseop_content { - clear: right + clear: right } #aiosp_feature_manager_metabox.postbox { - float: right + float: right } .aioseop_sidebar { - margin-left: 0; - margin-right: 10px + margin-left: 0; + margin-right: 10px } .aioseop_option_label { - float: right !important; - clear: right !important; + float: right !important; + clear: right !important; } .aioseop_settings_left { - float: right; + float: right; } .aioseop_option_input { - float: left; /*clear: right !important;*/ - padding-left: 0; - padding-right: 1px; - margin-bottom: 20px; - width: 60%; - min-width: 160px; + float: left; /*clear: right !important;*/ + padding-left: 0; + padding-right: 1px; + margin-bottom: 20px; + width: 60%; + min-width: 160px; } .aioseop_top { - margin: 10px 0 0 10px + margin: 10px 0 0 10px } .aioseop_right_sidebar { - float: left + float: left } div.aioseop_feature { - float: right + float: right } -.aioseop_feature .feature_button { +.aioseop_feature #free-flag { float: left; margin-right: 0; - margin-left: 10px + background: none repeat scroll 0 0 #D23D46; + color: #FFFFFF; + padding: 5px 12px; + position: relative; +} + +.aioseop_feature #free-flag:before, +.aioseop_feature #free-flag:after { + display: none; +} + +.aioseop_feature .feature_button { + float: left; + margin-right: 0; + margin-left: 10px } .aioseop_follow_button { - margin-right: 0; - margin-left: 5px + margin-right: 0; + margin-left: 5px } .aioseop_wrapper { - padding-left: 0; - padding-right: 5px; - direction: rtl + padding-left: 0; + padding-right: 5px; + direction: rtl } .aioseop_input { - clear: left + clear: left } #aiosp div.preview_snippet { - padding: 15px 7px 20px 15px + padding: 15px 7px 20px 15px } #aiosp_sitemap_addl_pages, #aiosp_video_sitemap_addl_pages { - clear: right; - margin-left: 0px; - margin-right: 20px + clear: right; + margin-left: 0; + margin-right: 20px } .All_in_One_SEO_Pack_Opengraph table.aioseop_table { - border-left: 0 solid #dfdfdf; - border-right: 1px solid #dfdfdf + border-left: 0 solid #dfdfdf; + border-right: 1px solid #dfdfdf } .All_in_One_SEO_Pack_Opengraph table.aioseop_table th { - border-right: 0 solid #dfdfdf; - border-left: 1px solid #dfdfdf + border-right: 0 solid #dfdfdf; + border-left: 1px solid #dfdfdf } .All_in_One_SEO_Pack_Opengraph table.aioseop_table td { - border-right: 0 solid #dfdfdf; - border-left: 1px solid #dfdfdf + border-right: 0 solid #dfdfdf; + border-left: 1px solid #dfdfdf } #aiosp_sitemap_addl_pages_metabox table.aioseop_table td, #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td { - padding-left: 0; - padding-right: 5% + padding-left: 0; + padding-right: 5% } .aioseop_settings_left .postbox { - float: right + float: right } .aioseop_option_setting_label { - padding-left: 0; - padding-right: 1px + padding-left: 0; + padding-right: 1px } .aioseop_settings_left .postbox .inside { - clear: left + clear: left } -.postbox h2 .Taha { - float: left !important; +.postbox h2 .Taha { + float: left !important; } #aiosp_settings_form .aioseop_no_label, .aioseop_no_label { - float: right; - margin: 0 13px 0 23px + float: right; + margin: 0 13px 0 23px } .aioseop_module.error.below-h2 { - margin: 0 0 15px 477px !important + margin: 0 0 15px 477px !important } .robots img { - margin: 0 2px 0 0 + margin: 0 2px 0 0 } /* Robots.txt styling */ #aiosp_robots_generator_robotgen_wrapper .aioseop_option_div, #aiosp_robots_generator_robothtml_wrapper .aioseop_option_div { - margin-top: 10px; + margin-top: 10px; } div.aioseop_notice a.aioseop_dismiss_link { - position: absolute; - top: 10px; - left: 10px; - text-align: left; + position: absolute; + top: 10px; + left: 10px; + text-align: left; } /* @@ -237,65 +251,65 @@ div.aioseop_notice a.aioseop_dismiss_link { }*/ .aioseop_help_text ul { - margin: 15px 20px 0 0 + margin: 15px 20px 0 0 } .aioseop_header_tabs li a.aioseop_header_tab { - margin: 5px 0 0 5px + margin: 5px 0 0 5px } .aioseop_header_tabs li:first-child a.aioseop_header_tab { - border-left: solid 0 #CCC; - border-right: solid 1px #CCC; - margin-left: 0; - margin-right: 5px + border-left: solid 0 #CCC; + border-right: solid 1px #CCC; + margin-left: 0; + margin-right: 5px } .aioseop_tab { - padding-left: 0; - padding-right: 5px + padding-left: 0; + padding-right: 5px } form#aiosp_settings_form, .aioseop_tabs_div { - padding-right: 0; - padding-left: 477px + padding-right: 0; + padding-left: 477px } #aiosp_settings_form ul.sfwd_debug_settings li strong { - float: right; - text-align: left; - margin-right: 0; - margin-left: 8px; - padding-right: 0; - padding-left: 8px + float: right; + text-align: left; + margin-right: 0; + margin-left: 8px; + padding-right: 0; + padding-left: 8px } #aiosp_settings_form ul.sfwd_debug_settings li { - clear: right + clear: right } .aioseop_advert { - direction: rtl; - float: right; - z-index: 999999 + direction: rtl; + float: right; + z-index: 999999 } .aioseop_advert form input { - float: left + float: left } .MRL { - margin-left: 0 !important; - margin-right: 20px !important; + margin-left: 0 !important; + margin-right: 20px !important; } .aioseop_upload_image_label { - clear: right !important; - float: none !important; + clear: right !important; + float: none !important; } .aioseop_upload_image_button { - float: right !important; - margin-bottom: 5px !important; -} \ No newline at end of file + float: right !important; + margin-bottom: 5px !important; +} diff --git a/wp-content/plugins/all-in-one-seo-pack/css/modules/aioseop_module.css b/wp-content/plugins/all-in-one-seo-pack/css/modules/aioseop_module.css index 0ca96a681b..ac9d4449bd 100644 --- a/wp-content/plugins/all-in-one-seo-pack/css/modules/aioseop_module.css +++ b/wp-content/plugins/all-in-one-seo-pack/css/modules/aioseop_module.css @@ -1,1120 +1,1309 @@ -.form-table.aioseop { - clear: none; -} -.form-table.aioseop td { - vertical-align: top; - padding: 16px 0 10px 0; - line-height: 20px; - font-size: 12px; -} -.form-table.aioseop th { - width: 200px; - padding: 10px 0 12px 9px; -} -.aioseop_help_text_link, .aioseop_help_text_link:active { - text-align: left; - float: left; - max-width: 300px; - min-width: 1px; - padding-top: 2px; - outline: none; - color: #888; - border: 2px solid #888; - border-radius: 33px; - width: 22px; - height: 20px; - display: inline-block; - font-family: sans-serif; -} -.aioseop_help_text_link span { - position: absolute; - left: 21px; - font-size: 14px; -} -.aioseop_help_text_link:before { - content: '\a0?'; - color: #888; - font-size: 19px; -} - -#aioseop-support .aioseop_metabox_text, #aioseop-support a { - font-size: 14px; - color: #000; - text-decoration: none; -} - -.aioseop_icon { - display: inline-block; - width: 40px; - height: 40px; - background-repeat: no-repeat; - background-size: 100%; - vertical-align: middle; - margin: 10px; -} - -.aioseop_book_icon { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==); -} - -.aioseop_cog_icon { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAeFBMVEUAAAAAn+MAnOIAn+cAneIAneEAn+MAnuEAneIAnuAAnuAAneEAn+cAn+QAn98AnuEAn98AneAAneEAneAAnOIAnuAAnuEAnuAAneEAn+EAnuEAnuAAneEAneAAneAAn+QAnuEAnuABnuEAneAAn+EAnuIAnuMBnuHeY3dlAAAAJ3RSTlMAQFAAYIAAkADP3wAgMACgEACfrwC/X++PbwAAcODwALDAANAATz8hP00ZAAACHklEQVR4Xq3XbWObIBAHcPAJJRjJVmtso4vL2vv+33AzJO2J/LuE9PfGFyR4HHiAgCQxyRMiYEtGTL5BBGzJiVEviIAtFTH6FRGowdBC/QsQqKGhhebeIdTkqe+LwFbkqew2SGyDftDKz12Q2AXYlhgeA46AD/G5oyD9zJO0zIEhvXd91L0mSPcmnZlek0nPhHu4mKu2ov+q2rZzOWE5kBRBFjNRzDRFqD6X8oGiHK5fo+0oSmcv06goknLfQk3RzHkaWwIGlUhrZaIGAto5iQn6uyw+yAFOpSgUTDEHJqqZc5DR2rgqw8lIa7mbRkkMLOOBoWZlWYrynwzGzx1C/3cdlEcvf7sgL5MTq8rGz22QNwjDP+cGBYBDOC6qcnLTNqQCeRbuYdEU4In47YjL84RSwEk+Tq8qT7xvhMc5eXsj78Buga866O4dQrXs4OEk3jaNTWC1Cfc43nSa0MQ0fCFFLWXL9saWFjQMgFOfEUR+zsl1KWeRBaWr3e7c01q3Lmld+FfiSVFQ/2ehp6B8IzaorGvJ8q8Jl/ViIkDv396tfX/bawKm81J+eGtLH91cX+xIUUZ7XYmPHTBmA0U4feMh6zqVwzTe8ubQvmBoUJeDphoIGtT5tVaq0Ttopvyom4M4xqz8YGXhiCLAnIKhg8N2iA30cLzrxmJH/H4cASejrjzcFHXpwrcukwIiRQZv2QICtjQP352/9fYuC+Qv593CTVvcgwkAAAAASUVORK5CYII=); -} - -.aioseop_file_icon { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==); -} - -.aioseop_help_icon { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAflBMVEUAAAAAn98AnuIAn+EAneAAnuAAnuAAn+QAn+QAneEAnuAAnuAAn+EAnuAAnuEAneAAn+cAneAAnuAAn98AnOIAnuEAneIAn+MAnuEAnuEAn+EAneIAneEAneEAnuEAn+MAneAAneEAnuMAnOIAn+cAneEBnuEAneAAnuMBnuEoGewkAAAAKXRSTlMAEE9/r7/fADCPzwBv718AIPDAAFCwYEAAoAAAn4CQAOAAPwAAcADQAFP96WQAAAMNSURBVHhelZcNc5swDIatBghpoCGEj9Jij2XLMv3/P7glkoNtZJo+d+0lhBOveSXZUjHgZZOkGf4nS5PNC5wiKPFqvnvFgNddvpVQy0tQZCiSFfCEAtiUGKXcwFcB3kpcpXx791HetypFn2NdH9EnrX67KPdL46g/tl3PeqHvWidM2fxyUM7n3fzgof8R0A9zjN3PGTV/HB+6teg66EeIUQqQIGOiSQMGmeRgUQfGPn/Ktyv0k9UQKrCxWzitAq3V6dvYIDG8f8mAROO6ULF/3ecTaHazcvIgjTw/PxfFeVFErCHd31C3fx2v39cKGy6qLKyA1tGr/v8BLWDyb3OLqiw+XGCiq8DFxIvypMKIHqMXvaeLmmyEkn1xSTCAjWcMS7gruFD+eo/QuEC7AYCy+nJXkC1/r5A4Gq2NrQCvjMnL7OZCLggY3KoAI5jMEvKt2hohBYK3wiveuwx8i3qn/uvVf0O2Hh5MnLwOZMTrXgGt4OCi7RuyXNg1F1oDqEZIQh2K6oUALalSWqgiIwUIM4VVqZZvdlkE7QQFFLRVNS3l5NLZarMkgkx6ebWiNPqzSu9nEkM2KDZhjbykh+19KKri3+LkIxLhVlE/E4CaAjsd4AYo9zJkR9huGF7CtPYSX9FyXG4XFHe2UQIt9fIGa6NNJBErX2r35O0wp7KEbZYSNpVtMYngSpbZYoI1G9YClFzOp+vKS6jviLFJ+fWgDralfZO5peW2xX8LKB9NdTtxsQuc7/wV0OTv/YRyiUuIugCls7FwizffsXHgzcRurjEjYgH8zdVKyODZJUDGAuxZubNnt5BIgMQ7YNyowy2c0XfCqyNX6HzE2Ve8A28+nmDDHaJyD9sNChpkxvCYRxgkEjitAkl40AzPjxm7KdNnSAzLgaNFZhcVATtkBmliGaTJSJ6mBnnkMWgpx+XAMZZoMbGZqXEHm6Q4sxA4F4k7DEkjD1PVGJCmGFDLQ5elO+Iqx7B/q88A0FKI+DSlBLMuE4pMF3h6+DZXDLia6PAtA41u67uUqW51E02uf46zvXx+HY4YAAAAAElFTkSuQmCC); -} - -.aioseop_support_icon { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAe1BMVEUAAAAAn98AnuIAn+EAneAAnuAAnuABnuEAn98An+QAneEAnuAAn+QAn+EAnuAAnuEAneAAnuEAneIAn+MAn+cAn+cAnuEAnuEAnOIAneEAneEAnOIAnuAAneEAn+MAneAAneEAneIAnuEAnuIAneAAnuAAneABnuEAnuPdwDkgAAAAKXRSTlMAEE9/r7/f/wAwj88Ab+9f0JBgQCAAALBQcAAAAJ8AAIAAoADgwPAAP4Dl7rAAAALsSURBVHgBtdcBc6I6EAfwRCH/KjUSTCW2eHK8kHff/xM+Dg5NlsTTOu830xmc0BhJdtllKXy1znKBgciz9Yq/JbC3mM22AFFsN+8x7H2B7wSixI4/sAK+lkiSa/63CfbXfy9VddAfA32oVHmdYn8MsaNP55jUhpOFmRqTXH/4mP/BSExOnxEnTKT58jDveouZaCIEZltvWna7POPm8GPhgJtzbIIMnvq4UMOTXWZsvjgjoD8IjcCZrkAh1H4SLUIq3EYDQjSEBGH8XdASVPUzUIGS2jsHORbyJpC8gzWDChGaPsL4ItnwxyUiuuPqnBdAkW9X/3SIkPxPMLWIkZJcL7XTNnKJb5J8XMEJ33YaVyCQYJUZ0tjGKIsE8XsXNuNUFpStvFMQGR4Xvhlyoppi51AjUAcZhdPRIVzr8UCzYzEfS91afxOJDle2Hc9IBaBoGMdg/raq/3s49/NPm/6TGQDl5Up3DoCN5G9uAbjOO6AlAMPa8Zd4JI0kP55k41EAWlaT+w0Ae4mytyAenQDUrCcZsCMr8igydADQM0ECrydf4zEA+uZGAygYBv96ivF4RG3GffNgsJiAfr439v9MUN7/CeXFgwGzrz1Eu9hG9eQ2Rg+SaKJE5CB1y6Ps7h1ld/FMR9mEm6vPEoCIBZMAIM/e8xoTQRjO+5y8fT0ZJvlc5PwJ57fymlDWMloBLKoHsb4mlPLCLnNKyxDIwpRGR72UtsEgUhoKrx7bR4Z3c1J9Tyft7ep3Wl9t04l/rFBefrFwh29y/N7L1TlynXy5JpbQHY3qS6Dslfnq4guYa+UXC4xBj4W+CSTvYFMEuOeLLKf9Ytssd5hw6TJv9FKhOeqeK3W7ZcNRP1Nsd7GOpXu83O/iLY8ij5CwmKlUz2TcIy2PIy2PT/eYZLRV5fsMk542XaHK3VrV/a+p7fu1uzWyjiZs9pPgrUOSa6ONJ8FPFlH2xB9uvlUJolTJ5juOm7buLQa2r1uvkSX+A/xd+1xZLxG0AAAAAElFTkSuQmCC); -} - -.aioseop_youtube_icon { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAARVBMVEUAAAAAn+cAn+EAneAAnuABnuEAn+cAn98AneEAn98AnOIAnuAAnOIAneIAneIAnuEAnuEAneEAnuEBnuEAn+QAneAAneCXjc90AAAAF3RSTlMAIG+vz/8AEJ8AUO8AYACgAHCwADDw0E/SOHoAAAEBSURBVHgB7dbBjsIgGATgH+UvCAso3fL+j7rDYZMerGGZQ5NNv8TrREZLRy47F3O7Wx1m7zezAMjSOa9/5t2jkweEqBNi+ALBJ+mklHOWnINOC/0buKjTokMHRQnlKUYpRl5HBQ32KFXfW783HVDFHgWsrg0EWNEDK4z0+yEAEhuAIsgAFMEFQOECILEBKIIMQBFcABQuABIbgCLIABTBBUBhAzx5BEuWGM/9GT35V7bkwxTPfZw9eaVZ8lKN517rI8NHmr43cPyufXi5Rh1Q+dc7PTAWduI83abTNteHJjvz6KEJYeoU2+/UBVcm+tuNbTCv2nRYq2k/9ylXwL8I+AGj+lzlceKDYQAAAABJRU5ErkJggg==); -} - -.aioseop_help_text_link.aioseop_meta_box_help:before { -font-size: 14px; -} -.aioseop_meta_box_help > label { - position: absolute; - margin-left: 8px; -} -div.aioseop_tip_icon { - font-size: 14px; - border: 1px solid #888; - width: 1em; - text-align: center; - padding: 0px 4px; - -webkit-border-radius: 12px; - -moz-border-radius: 12px; - -webkit-box-shadow: 1px 1px 1px #888; - -moz-box-shadow: 1px 1px 1px #888; - box-shadow: 1px 1px 1px #888; - border-radius: 12px; -} -div.aioseop_tip_icon:before { - content: '?'; -} -.aioseop_help_text_link img { - width: 40px; - float: left; -} -.aioseop_meta_box_help, .aioseop_meta_box_help:active { - float: right; - padding-left: 0px; - width: 16px; - margin-right: 32px; - text-decoration: none; - height: 15px; - padding-top: 1px; - position: relative; -} -.aioseop_label { - color: #5F5F5F; - font-weight: bold; - line-height: 19px; - padding-left: 10px; /*changed from 20px to 10px for certain language support*/ - display: inline-block; - text-align: left; - position: absolute; - font-family: 'Open Sans', sans-serif; - width: 26%; - min-width: 120px; - max-width: 230px; -} -.aioseop_option_div { - max-height: 160px; - min-height: 43px; - width: 95%; - overflow-y: auto; -} -.aioseop_overflowed { - border: 1px solid #e1e1e1; -} -.aioseop input[type="text"] { - color: #515151; - height: 35px; - padding: 10px 0px 10px 10px; - font-size: 14px; - width: 95%; - max-width: 600px; -} -.aioseop textarea { - color: #515151; - padding: 10px 0px 0px 10px; - margin: 0px; - font-size: 14px; - line-height: 25px; - width: 95%; - max-width: 600px; -} -.aioseop_help_text_div { - text-align:left; - width:100%; - margin: 10px 0px 10px 0px; -} -.aioseop_help_text { - font-size: 12px; - float: left; - clear: left; - color: #797979; - line-height: 15px; - font-style: italic; -} -.aioseop_head_tagline { - color: #5F5F5F; - font-size: 13px; -} - -.aioseop_head_nav { - float: left; - font-size: 18px; - margin: 0px 0 16px 0; - font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif; - border-bottom: 1px solid #CCC; - width: 100%; -} -.aioseop_head_nav_tab { - padding: 10px 15px 10px 15px; - margin: 0 0 0 15px; - border-width: 1px 1px 0; - border-radius: 4px 4px 0px 0; - border-style: solid; - border-color: #CCC #CCC white; - float: left; - opacity: 0.5; - color: black; - text-shadow: white 0 1px 0; - text-decoration: none; -} -.aioseop_head_nav_tab.aioseop_head_nav_active { - opacity: 1; - margin-bottom: -1px; - border-width: 1px; -} -.aioseop_head_nav_tab:first-child { - margin-left: 0px; -} -.aioseop_head_nav_tab:hover { - opacity:1; -} -.aioseop_header { - float: left; - clear: left; -} - -.aioseop_advert { - padding: 10px; - margin-bottom: 30px; - border: 1px solid #DDD; - height: 200px; - width: 423px; -} - -.headwaythemes { - background-color: #FFFFFF; - padding-bottom: 110px; - height: 125px; -} - -.aioseop_nopad { - padding-left: 0px; - padding-top: 0px; -} - -.aioseop_nopad_all { - padding: 0px; - height: 220px; - width: 445px; - margin-bottom: 20px; - border: none; -} - -.aioseop_adverts { - float: right; -} - -.wincherad { - width: 100%; - height: 100%; - background-size: 100%; - background-repeat: no-repeat; - margin-bottom: 0px; - border: none; -} -/* -#wincher11 { - background-image: url(images/banner11.png); -} -#wincher12 { - background-image: url(images/banner12.png); -} -#wincher13 { - background-image: url(images/banner13.png); -} -#wincher14 { - background-image: url(images/banner14.png); -} -#wincher15 { - background-image: url(images/banner15.png); -} -*/ -#wincher21 { - background-image: url(../../modules/images/banner21.jpg); -} -#wincher22 { - background-image: url(../../modules/images/banner22.jpg); -} -.aioseop_content { - min-width: 760px; - clear: left; -} -.aioseop_options_wrapper { -} -.aioseop_options_wrapper .hndle { - font-size: 15px; - font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; - font-weight: normal; - padding: 7px 10px; - margin: 0; - line-height: 1; -} -.aioseop_options_wrapper .submit input.button-primary { - margin-bottom: 5px; -} -#aiosp_feature_manager_metabox.postbox { - margin-top: 20px; - float: left; -} -.aioseop_advert p { - margin: 25px 0 25px 0; -} -/* -.widget, #widget-list .widget-top, .postbox, #titlediv, .aioseop_options_wrapper .postarea, .stuffbox { - border-color: #DFDFDF; - -moz-box-shadow: inset 0 1px 0 #fff; - -webkit-box-shadow: inset 0 1px 0 #fff; - box-shadow: inset 0 1px 0 #fff; - -moz-border-radius: 3px; - -khtml-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; -} -*/ -.aioseop_options_wrapper .postarea { - border-color: #DFDFDF; - -moz-box-shadow: inset 0 1px 0 #fff; - -webkit-box-shadow: inset 0 1px 0 #fff; - box-shadow: inset 0 1px 0 #fff; - -moz-border-radius: 3px; - -khtml-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; -} -.aioseop_advert h3 { - padding: 0; - margin-top: 6px; -} -.aioseop_metabox_text p { - margin: 0 0 0px 0; - width: 101%; -} -.aioseop_sidebar { - width: 457px; - margin-left: 10px; -} -.aioseop_metabox_text { - margin-bottom: 0px; -} -.aioseop_metabox_wrapper { - padding: 0px; -} -.aioseop_metabox_text *:last-child { - margin: 0; -} -.aioseop_metabox_feature { - margin-top: 20px; -} - -.aioseop_metabox_feature img { -} - -.aioseop_option_label { - float: left; - margin: 0px; - min-width: 150px; - width: 37%; - max-width: 270px; - padding-top: 3px; - padding-bottom: 3px; - height:67px !important; /*added for certain language support*/ -} -.aioseop_metabox_text h2 { - font-size: 14px; - padding: 0px; - font-weight: bold; - line-height: 29px; -} -#aioseop-about { - width: 443px; - margin-bottom: 20px; -} -#aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 { - font-size: 13px; -} -.aioseop_sidebar #mc-embedded-subscribe-form { - margin: 0 0 10px 0; - background: white; - padding: 10px 10px; - border: 1px solid #DDD; -} -.aioseop input[readonly] { - background-color: #EEE; - margin: 5px 0 5px 0 !important; -} -/* -.aioseop input[type="button"] { - border-radius: 5px; - font-size: 15px; -} -*/ -.aioseop_settings_left { - float: left; - padding: 0px; - margin: 0px; - width: 100%; -} - -body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { - margin-top: 20px; -} - -body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { - margin-top: 20px; -} - -#aioseop_top_button { - margin-top: 5px; - height: 30px; -} - -#aioseop-list #mce-EMAIL { - margin-top: 5px; - width: 250px; -} - -.aioseop_top { - margin: 10px 10px 0px 0px; -/* margin: 10px 477px 0px 0px; */ -} - -.aioseop_top #aioseop-list { - margin-bottom: 0px; -} - -.aioseop_right_sidebar { - float: right; - margin-top: 35px; -} -/* -#wpbody-content { - min-width: 1180px; -} -*/ -#aiosp_settings_form .button-primary.hidden { - display: none; -} -form#edittag div#aiosp_titleatr_wrapper, form#edittag div#aiosp_menulabel_wrapper, form#edittag div#aiosp_sitemap_exclude_wrapper { - display: none; -} -.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button { - height: 5px; -} -.All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper { - margin-top: 10px; -} -div#aiosp_feature_manager_metabox .inside { - padding: 8px; -} -div.aioseop_feature { - position: relative; - display: inline-block; - float: left; - vertical-align: top; - width: 240px; - height: 288px; - margin: 8px; - border: 1px solid #DEDEDE; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - background: white; - padding: 10px 0px 0px; - -webkit-box-shadow: inset 0 1px 0 #fff, inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 ); - -moz-box-shadow: inset 0 1px 0 #fff, inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 ); - box-shadow: inset 0 1px 0 #fff, inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 ); - -webkit-transition-duration: .4s; - -moz-transition-duration: .4s; -} -.aioseop_feature h3 { - font-size: 17px; - margin: 0; - padding: 0px 10px 5px 10px; - font-weight: normal; - font-style: normal; - font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif; -} -.aioseop_feature p { - line-height: 150%; - font-size: 12px; - font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; - margin-bottom: 20px; - color: #666; - padding: 0px 10px; -} -.aioseop_feature p.aioseop_desc { - min-height: 80px; -} -.aioseop_feature .feature_button { - float: right; - margin-bottom: 10px; - margin-right: 10px; - min-width: 80px; - text-align: center; -} -.aioseop_feature .feature_button:before { - content: "Activate"; -} -.aioseop_feature .active.feature_button:before { - content: "Deactivate"; -} -div.aioseop_feature .aioseop_featured_image { - min-height: 100px; - background-repeat: no-repeat; - display: block; - margin: 0 auto; - width: 133px; -} -div.aioseop_feature .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Standard.png); -} -div.aioseop_feature .aioseop_featured_image.active { - background-image: url(../../modules/images/Default-Color-Standard.png); -} -div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png); -} -div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png); -} -div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/VideoSitemap-BW-Standard.png); -} -div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/VideoSitemap-Color-Standard.png); -} -div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { - background-image: url(../../modules/images/SocialMeta-BW-Standard.png); -} -div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { - background-image: url(../../modules/images/SocialMeta-Color-Standard.png); -} -div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { - background-image: url(../../modules/images/Robots-BW-Standard.png); -} -div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { - background-image: url(../../modules/images/Robots-Color-Standard.png); -} -div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { - background-image: url(../../modules/images/FileEditor-BW-Standard.png); -} -div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { - background-image: url(../../modules/images/FileEditor-Color-Standard.png); -} -div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { - background-image: url(../../modules/images/ImporterExporter-BW-Standard.png); -} -div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { - background-image: url(../../modules/images/ImporterExporter-Color-Standard.png); -} -div.aioseop_feature#aioseop_performance .aioseop_featured_image { - background-image: url(../../modules/images/Performance-BW-Standard.png); -} -div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { - background-image: url(../../modules/images/Performance-Color-Standard.png); -} -div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { - background-image: url(../../modules/images/Default-Color-Standard.png); -} -div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { - background-image: url(../../modules/images/Default-Color-Standard.png); -} -.All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table, -.All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table { - max-width: 500px; - clear: none; -} -.aioseop_follow_button { - min-height: 50px; - background-repeat: no-repeat; - display: inline-block; - width: 100px; - background-size: auto 50px !important; - margin-right: 0px; -} -.aioseop_facebook_follow { - background-image: url(../../modules/images/facebook-follow-standard.png); -} -.aioseop_twitter_follow { - background-image: url(../../modules/images/twitter-follow-standard.png); -} -@media -only screen and (-webkit-min-device-pixel-ratio: 1.5), -only screen and ( min--moz-device-pixel-ratio: 1.5), -only screen and ( -o-min-device-pixel-ratio: 3/2), -only screen and ( min-device-pixel-ratio: 1.5), -only screen and ( min-resolution: 1.5dppx) { - div.aioseop_feature .aioseop_featured_image { - background-size: auto 100px !important; - } - div.aioseop_feature .aioseop_featured_image.active { - background-image: url(../../modules/images/Default-Color-Retina.png); - } - div.aioseop_feature .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png); - } - div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png); - } - div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/VideoSitemap-BW-Retina.png); - } - div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/VideoSitemap-Color-Retina.png); - } - div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { - background-image: url(../../modules/images/SocialMeta-BW-Retina.png); - } - div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { - background-image: url(../../modules/images/SocialMeta-Color-Retina.png); - } - div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { - background-image: url(../../modules/images/Robots-BW-Retina.png); - } - div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { - background-image: url(../../modules/images/Robots-Color-Retina.png); - } - div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { - background-image: url(../../modules/images/FileEditor-BW-Retina.png); - } - div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { - background-image: url(../../modules/images/FileEditor-Color-Retina.png); - } - div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { - background-image: url(../../modules/images/ImporterExporter-BW-Retina.png); - } - div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { - background-image: url(../../modules/images/ImporterExporter-Color-Retina.png); - } - div.aioseop_feature#aioseop_performance .aioseop_featured_image { - background-image: url(../../modules/images/Performance-BW-Retina.png); - } - div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { - background-image: url(../../modules/images/Performance-Color-Retina.png); - } - div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - .aioseop_facebook_follow { - background-image: url(../../modules/images/facebook-follow-retina.png); - } - .aioseop_twitter_follow { - background-image: url(../../modules/images/twitter-follow-retina.png); - } -} - -.aioseop_options { - width: 100%; - margin: 18px 0px 10px 0px; -} -.aioseop_wrapper { - width: 100%; - padding-left: 5px; -} -.aioseop_input { - clear: left; - width: 100%; - padding: 5px; - display: inline; -} -.aioseop_option_input { - float: left; - width: 61%; - margin: 0; - padding-left: 1px; - min-width: 160px; -/* max-width: 900px; */ -} -#aiosp div.preview_snippet { - border: 1px solid #ebebeb; - padding: 15px 15px 20px 7px; - background-color: #fff; -} -div#aioseop_snippet { - font-family: arial, sans-serif; - font-size: 13px; -} -div#aioseop_snippet > h3 { - font-size: 16px; - padding: 8px 0; - border: 0px; - background: inherit; -} -div#aioseop_snippet > h3 > a { - color: #12c; - text-decoration: none; - cursor: pointer; -} -div#aioseop_snippet > div { - color: #222; - max-width: 42em; -} -div#aioseop_snippet > div > div { - display: block; - margin-bottom: 1px; -} -div#aioseop_snippet > div > div > cite { - color: #093; - font-style: normal; -} -div#aioseop_snippet > div > span { - margin: 0px; - padding: 0px; - border: 0px; -} -#aiosp_sitemap_addl_pages, -#aiosp_video_sitemap_addl_pages { - clear: left; - margin-left: 20px; - max-width: 1072px; -} -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper { - width: 23%; - min-width: 165px; - display: inline-block; - max-width: 265px; -} -#aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div { - position: absolute; - margin: 5px 0px 10px 0px; -} -#aiosp_sitemap_addl_pages_metabox .aioseop_option_input, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_option_input { - width: 94%; - min-width: 94%; -} -#aiosp_sitemap_addl_pages_metabox table.aioseop_table, -#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table { - width: 96%; - border: 1px solid #CCC; - margin: 5px 0px 10px 0px; -} -table.aioseop_table tr:nth-child(odd) { - background-color: #EEE; -} -.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) { - background-color: rgba( 238, 238, 238, 0.5 ); -} -table.aioseop_table td { - width: 23%; -} -.All_in_One_SEO_Pack_Opengraph table.aioseop_table { - width: 80%; - max-width: 800px; - display: block; - border-top: 1px solid #dfdfdf; - border-left: 1px solid #dfdfdf; -} -.All_in_One_SEO_Pack_Opengraph table.aioseop_table th { - width: 18%; - border-right: 1px solid #dfdfdf; - border-bottom: 1px solid #dfdfdf; -} -.All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info { - margin-top:10px; - border: 1px solid #dfdfdf; - width:80%; - max-width:800px; -} -.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th { - background: #f1f1f1; - background-image: -webkit-gradient(linear,left bottom,left top,from(#ececec),to(#f9f9f9)); - background-image: -webkit-linear-gradient(bottom,#ececec,#f9f9f9); - background-image: -moz-linear-gradient(bottom,#ececec,#f9f9f9); - background-image: -o-linear-gradient(bottom,#ececec,#f9f9f9); - background-image: linear-gradient(to top,#ececec,#f9f9f9); - padding: 5px; - border-bottom-color: #dfdfdf; - text-shadow: #fff 0 1px 0; - -webkit-box-shadow: 0 1px 0 #fff; - -moz-box-shadow: 0 1px 0 #fff; - box-shadow: 0 1px 0 #fff; -} -.All_in_One_SEO_Pack_Opengraph table.aioseop_table td { - border-right: 1px solid #dfdfdf; - border-bottom: 1px solid #dfdfdf; -} -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item { - display: inline-block; - width: 30%; - vertical-align: top; -} -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) { - font-weight: bold; -} -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) { - width: 70%; -} -#aiosp_sitemap_addl_pages_metabox table.aioseop_table td, -#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td { - width: 25%; - padding-left: 5%; -} -table.aioseop_table td, table.aioseop_table th { - padding: 3px; -} -.aioseop_top_label .aioseop_option_input, -.aioseop_no_label .aioseop_option_input { - width: 100%; -} - -#aiosp_settings_form .postbox { - margin: 0px 0px 20px 0px; -} - -.aioseop_settings_left .postbox { - float: left; - width: 100%; -} -.aioseop_option_setting_label { - min-height: 35px; - display: inline-block; - white-space: nowrap; - overflow: hidden; - padding-left: 1px; - max-width: 229px; - min-width: 160px; - width: 33%; -} -.aioseop_settings_left .postbox .inside { - padding: 0; - margin: 0; - clear: right; -} -#aiosp_settings_form .aioseop_no_label, .aioseop_no_label { - float: left; - width: 92%; - max-width: 100%; - margin: 0px 23px 0px 13px; -} -.aioseop_top_label { - width: 96%; - margin: 0 10px; -} -.aioseop_hidden_type { - margin: 0; - padding: 0; - height: 0; -} -.aioseop_module.error.below-h2 { - padding: 5px 0px; - margin: 0px 477px 15px 0px !important; -} -#aioseop_opengraph_settings .inside { - margin: 0; - padding: 0; -} -#aioseop_opengraph_settings_image_wrapper img { - width: auto; - height: 75px; -} -#aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label { - max-width: 160px; - min-width: 100px; - width: 30%; -} -.aioseop_input input[type="checkbox"], -.aioseop_input input[type="radio"] { - vertical-align: text-bottom; - margin-top: 8px; -} -#aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div { - max-height: initial; -} -#aiosp { - width: 100%; -} - -.aioseop_input.aioseop_top_label .aioseop_option_input { - margin: 0 0 10px 0; -} - -.aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div { - max-height: none; -} - -/* Robots.txt styling */ -#aiosp_robots_generator_robotgen_wrapper .aioseop_option_div, -#aiosp_robots_generator_robothtml_wrapper .aioseop_option_div { - max-height: none; -} -.aioseop_option_input .widefat td { - vertical-align: middle; -} -.entry-row.robots.quirks { - font-weight: bold; - opacity: 1; -} -.entry-row.robots { - opacity: 0.8; -} -.entry-row.robots.invalid { - opacity: 1; - font-weight: bold; -} -.invalid .entry_label { - font-weight: bold; -} -.column_label, .entry_label { -} -.aioseop .aioseop_option_input tbody { - background: #FCFCFC; -} -.All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody { - background: transparent; -} -.entry-row.robots div { - height: 20px; - vertical-align: middle; - width: 90%; - margin: 0 0 4px 0; -} -.robots img { - margin: 0 0 0 2px; - opacity: 0.6; -} - -.aioseop_option_docs { - width: 98%; - display: none; - border: 1px solid #D3D3D3; - margin-top: 20px; - padding: 1%; - background-color: #EEE; -} -.aioseop_option_docs h3 { - background:none; -} -div.aioseop_notice { - position: relative; -} -div.aioseop_notice a.aioseop_dismiss_link { - position: absolute; - top: 10px; - right: 10px; -} -.aioseop_error_notice { - color: #f00; - font-weight: bold; -} - -.aioseop_input select { - margin: 7px 0px; -} -.aioseop_help_text ul { - margin: 15px 0 0 20px; -} - -.aioseop_help_text ul li { - line-height: 20px; - margin: 0; -} -.aioseop_sidebar #side-sortables { - width: 98%; -} -#aioseop_opengraph_settings .aioseop_option_label { - width: 30%; -} -.aioseop_tabs { - padding-top: 6px; -} -.aioseop_tabs.hide, .aioseop_header_tabs.hide { - display: block !important; -} -.aioseop_header_tabs li { - display: inline; - padding: 0px; - margin: 0px; -} -.aioseop_header_tabs { - margin: 0px; -} -.aioseop_header_nav { - margin: 0px; -} -.aioseop_header_tabs li a.aioseop_header_tab.active { - background-color: rgb( 255, 255, 255 ); - border-bottom-color: rgba( 255, 255, 255, 0.5 ); - font-weight: bold; -} -.aioseop_header_tabs li a.aioseop_header_tab { - height: 18px; - font: 13px/18px Arial,Helvetica,sans-serif normal; - text-decoration: none; - margin: 5px 5px 0 0; - padding: 4px 5px 2px; - cursor: pointer; - border-width: 1px; - border-style: solid; - -webkit-border-top-right-radius: 3px; - -webkit-border-top-left-radius: 3px; - border-top-right-radius: 3px; - border-top-left-radius: 3px; - background-color: rgb( 255, 255, 255 ); - background-color: rgba( 255, 255, 255, 0.5 ); - border-color: #ccc; - color: #5F5F5F; -} -.aioseop_header_tabs li:first-child a.aioseop_header_tab { - border-left: solid 1px #CCC; - margin-left: 5px; -} -.aioseop_tab { - border: solid 1px #CCC; - background-color: rgb( 255, 255, 255 ); - background-color: rgba( 255, 255, 255, 0.5 ); - padding-left: 5px; -} -.aioseop_loading { - background-image: url('../../images/activity.gif'); - display: inline-block; - width: 24px; - height: 24px; - margin: 0px; - padding: 0px; - vertical-align: bottom; -} -.aiosp_delete_url { - background-image: url('../../images/delete.png'); - display: inline-block; - width: 16px; - height: 16px; - margin: 0px; - padding: 0px; - vertical-align: bottom; -} -form#aiosp_settings_form, .aioseop_tabs_div { - padding-right: 477px; -} -.aioseop_tabs_div { - margin-top: 10px; -} -/* -.wrap > h2 { - padding-bottom: 14px; -} -div.wrap > form table.form-table { - clear: none; - width: 580px; -} -div.wrap > div#message.error { - max-width: 540px; -} -*/ -#aiosp_settings_form ul.sfwd_debug_settings li strong { - display: block; - float: left; - text-align: right; - background-color: #DDD; - margin-right: 8px; - padding: 1px; - padding-right: 8px; - overflow: auto; - width: 200px; - min-height: 16px; -} -#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong { - background-color: #CCC; -} -#aiosp_settings_form ul.sfwd_debug_settings li { - clear: left; - padding: 5px; - margin: 0px; - padding: 0px; - background-color: #EEE; - overflow: auto; - max-width: 75%; - min-width: 800px; -} -#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) { - background-color: #DDD; -} -div.sfwd_debug_mail_sent { - background-color: #080; - border: 1px solid #0A0; - margin: 10px 0px 10px 0px; - width: 598px; - color: #FFF; - text-align: center; -} -div.sfwd_debug_error { - background-color: #F00; - color: #FFF; - border: 1px solid #A00; - margin: 10px 0px 10px 0px; - width: 598px; - text-align: center; - font-weight: bolder; -} -#aiosp_performance_status_wrapper .aioseop_option_div { - max-height: 420px; -} - -#aioseop_coming_soon, #aioseop_coming_soon2 { - padding-top: 40px; - text-align: center; - height: 258px; - font-size: 16px; -} -/* -#aioseop_coming_soon { - text-align: center; - background-color: rgba(255, 255, 255, 0.5); -} -#aioseop_coming_soon p { - padding: 0px; - margin: 0px; - font-size: 16px; - font-family: Arial,Helvetica,sans-serif; -} -#aioseop_coming_soon img { - padding-top: 40%; -} -*/ -.MRL { -margin-left: 20px !important; -margin-bottom: 10px !important; -} +/** + * Controls all the styling of the plugin. + * + * @author Michael Torbert. + * @author Semper Fi Web Design. + * @copyright http://semperplugins.com + * @package All-in-One-SEO-Pack. + */ + +.form-table.aioseop { + clear: none; +} + +.form-table.aioseop td { + vertical-align: top; + padding: 16px 0 10px 0; + line-height: 20px; + font-size: 12px; +} + +.form-table.aioseop th { + width: 200px; + padding: 10px 0 12px 9px; +} + +.aioseop_help_text_link, +.aioseop_help_text_link:active { + text-align: left; + float: left; + max-width: 300px; + min-width: 1px; + padding-top: 2px; + outline: none; + color: #888; + border: 2px solid #888; + border-radius: 33px; + width: 22px; + height: 20px; + font-family: sans-serif; +} + +.aioseop_help_text_link span { + position: absolute; + left: 21px; + font-size: 14px; +} + +.aioseop_help_text_link:before { + content: '\a0?'; + color: #888; + font-size: 19px; +} + +#aioseop-support .aioseop_metabox_text, +#aioseop-support a { + font-size: 14px; + color: #000; + text-decoration: none; +} + +.aioseop_icon { + display: inline-block; + width: 40px; + height: 40px; + background-repeat: no-repeat; + background-size: 100%; + vertical-align: middle; + margin: 10px; +} + +.aioseop_book_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==); +} + +.aioseop_cog_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAeFBMVEUAAAAAn+MAnOIAn+cAneIAneEAn+MAnuEAneIAnuAAnuAAneEAn+cAn+QAn98AnuEAn98AneAAneEAneAAnOIAnuAAnuEAnuAAneEAn+EAnuEAnuAAneEAneAAneAAn+QAnuEAnuABnuEAneAAn+EAnuIAnuMBnuHeY3dlAAAAJ3RSTlMAQFAAYIAAkADP3wAgMACgEACfrwC/X++PbwAAcODwALDAANAATz8hP00ZAAACHklEQVR4Xq3XbWObIBAHcPAJJRjJVmtso4vL2vv+33AzJO2J/LuE9PfGFyR4HHiAgCQxyRMiYEtGTL5BBGzJiVEviIAtFTH6FRGowdBC/QsQqKGhhebeIdTkqe+LwFbkqew2SGyDftDKz12Q2AXYlhgeA46AD/G5oyD9zJO0zIEhvXd91L0mSPcmnZlek0nPhHu4mKu2ov+q2rZzOWE5kBRBFjNRzDRFqD6X8oGiHK5fo+0oSmcv06goknLfQk3RzHkaWwIGlUhrZaIGAto5iQn6uyw+yAFOpSgUTDEHJqqZc5DR2rgqw8lIa7mbRkkMLOOBoWZlWYrynwzGzx1C/3cdlEcvf7sgL5MTq8rGz22QNwjDP+cGBYBDOC6qcnLTNqQCeRbuYdEU4In47YjL84RSwEk+Tq8qT7xvhMc5eXsj78Buga866O4dQrXs4OEk3jaNTWC1Cfc43nSa0MQ0fCFFLWXL9saWFjQMgFOfEUR+zsl1KWeRBaWr3e7c01q3Lmld+FfiSVFQ/2ehp6B8IzaorGvJ8q8Jl/ViIkDv396tfX/bawKm81J+eGtLH91cX+xIUUZ7XYmPHTBmA0U4feMh6zqVwzTe8ubQvmBoUJeDphoIGtT5tVaq0Ttopvyom4M4xqz8YGXhiCLAnIKhg8N2iA30cLzrxmJH/H4cASejrjzcFHXpwrcukwIiRQZv2QICtjQP352/9fYuC+Qv593CTVvcgwkAAAAASUVORK5CYII=); +} + +.aioseop_file_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==); +} + +.aioseop_help_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAflBMVEUAAAAAn98AnuIAn+EAneAAnuAAnuAAn+QAn+QAneEAnuAAnuAAn+EAnuAAnuEAneAAn+cAneAAnuAAn98AnOIAnuEAneIAn+MAnuEAnuEAn+EAneIAneEAneEAnuEAn+MAneAAneEAnuMAnOIAn+cAneEBnuEAneAAnuMBnuEoGewkAAAAKXRSTlMAEE9/r7/fADCPzwBv718AIPDAAFCwYEAAoAAAn4CQAOAAPwAAcADQAFP96WQAAAMNSURBVHhelZcNc5swDIatBghpoCGEj9Jij2XLMv3/P7glkoNtZJo+d+0lhBOveSXZUjHgZZOkGf4nS5PNC5wiKPFqvnvFgNddvpVQy0tQZCiSFfCEAtiUGKXcwFcB3kpcpXx791HetypFn2NdH9EnrX67KPdL46g/tl3PeqHvWidM2fxyUM7n3fzgof8R0A9zjN3PGTV/HB+6teg66EeIUQqQIGOiSQMGmeRgUQfGPn/Ktyv0k9UQKrCxWzitAq3V6dvYIDG8f8mAROO6ULF/3ecTaHazcvIgjTw/PxfFeVFErCHd31C3fx2v39cKGy6qLKyA1tGr/v8BLWDyb3OLqiw+XGCiq8DFxIvypMKIHqMXvaeLmmyEkn1xSTCAjWcMS7gruFD+eo/QuEC7AYCy+nJXkC1/r5A4Gq2NrQCvjMnL7OZCLggY3KoAI5jMEvKt2hohBYK3wiveuwx8i3qn/uvVf0O2Hh5MnLwOZMTrXgGt4OCi7RuyXNg1F1oDqEZIQh2K6oUALalSWqgiIwUIM4VVqZZvdlkE7QQFFLRVNS3l5NLZarMkgkx6ebWiNPqzSu9nEkM2KDZhjbykh+19KKri3+LkIxLhVlE/E4CaAjsd4AYo9zJkR9huGF7CtPYSX9FyXG4XFHe2UQIt9fIGa6NNJBErX2r35O0wp7KEbZYSNpVtMYngSpbZYoI1G9YClFzOp+vKS6jviLFJ+fWgDralfZO5peW2xX8LKB9NdTtxsQuc7/wV0OTv/YRyiUuIugCls7FwizffsXHgzcRurjEjYgH8zdVKyODZJUDGAuxZubNnt5BIgMQ7YNyowy2c0XfCqyNX6HzE2Ve8A28+nmDDHaJyD9sNChpkxvCYRxgkEjitAkl40AzPjxm7KdNnSAzLgaNFZhcVATtkBmliGaTJSJ6mBnnkMWgpx+XAMZZoMbGZqXEHm6Q4sxA4F4k7DEkjD1PVGJCmGFDLQ5elO+Iqx7B/q88A0FKI+DSlBLMuE4pMF3h6+DZXDLia6PAtA41u67uUqW51E02uf46zvXx+HY4YAAAAAElFTkSuQmCC); +} + +.aioseop_support_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAe1BMVEUAAAAAn98AnuIAn+EAneAAnuAAnuABnuEAn98An+QAneEAnuAAn+QAn+EAnuAAnuEAneAAnuEAneIAn+MAn+cAn+cAnuEAnuEAnOIAneEAneEAnOIAnuAAneEAn+MAneAAneEAneIAnuEAnuIAneAAnuAAneABnuEAnuPdwDkgAAAAKXRSTlMAEE9/r7/f/wAwj88Ab+9f0JBgQCAAALBQcAAAAJ8AAIAAoADgwPAAP4Dl7rAAAALsSURBVHgBtdcBc6I6EAfwRCH/KjUSTCW2eHK8kHff/xM+Dg5NlsTTOu830xmc0BhJdtllKXy1znKBgciz9Yq/JbC3mM22AFFsN+8x7H2B7wSixI4/sAK+lkiSa/63CfbXfy9VddAfA32oVHmdYn8MsaNP55jUhpOFmRqTXH/4mP/BSExOnxEnTKT58jDveouZaCIEZltvWna7POPm8GPhgJtzbIIMnvq4UMOTXWZsvjgjoD8IjcCZrkAh1H4SLUIq3EYDQjSEBGH8XdASVPUzUIGS2jsHORbyJpC8gzWDChGaPsL4ItnwxyUiuuPqnBdAkW9X/3SIkPxPMLWIkZJcL7XTNnKJb5J8XMEJ33YaVyCQYJUZ0tjGKIsE8XsXNuNUFpStvFMQGR4Xvhlyoppi51AjUAcZhdPRIVzr8UCzYzEfS91afxOJDle2Hc9IBaBoGMdg/raq/3s49/NPm/6TGQDl5Up3DoCN5G9uAbjOO6AlAMPa8Zd4JI0kP55k41EAWlaT+w0Ae4mytyAenQDUrCcZsCMr8igydADQM0ECrydf4zEA+uZGAygYBv96ivF4RG3GffNgsJiAfr439v9MUN7/CeXFgwGzrz1Eu9hG9eQ2Rg+SaKJE5CB1y6Ps7h1ld/FMR9mEm6vPEoCIBZMAIM/e8xoTQRjO+5y8fT0ZJvlc5PwJ57fymlDWMloBLKoHsb4mlPLCLnNKyxDIwpRGR72UtsEgUhoKrx7bR4Z3c1J9Tyft7ep3Wl9t04l/rFBefrFwh29y/N7L1TlynXy5JpbQHY3qS6Dslfnq4guYa+UXC4xBj4W+CSTvYFMEuOeLLKf9Ytssd5hw6TJv9FKhOeqeK3W7ZcNRP1Nsd7GOpXu83O/iLY8ij5CwmKlUz2TcIy2PIy2PT/eYZLRV5fsMk542XaHK3VrV/a+p7fu1uzWyjiZs9pPgrUOSa6ONJ8FPFlH2xB9uvlUJolTJ5juOm7buLQa2r1uvkSX+A/xd+1xZLxG0AAAAAElFTkSuQmCC); +} + +.aioseop_youtube_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAARVBMVEUAAAAAn+cAn+EAneAAnuABnuEAn+cAn98AneEAn98AnOIAnuAAnOIAneIAneIAnuEAnuEAneEAnuEBnuEAn+QAneAAneCXjc90AAAAF3RSTlMAIG+vz/8AEJ8AUO8AYACgAHCwADDw0E/SOHoAAAEBSURBVHgB7dbBjsIgGATgH+UvCAso3fL+j7rDYZMerGGZQ5NNv8TrREZLRy47F3O7Wx1m7zezAMjSOa9/5t2jkweEqBNi+ALBJ+mklHOWnINOC/0buKjTokMHRQnlKUYpRl5HBQ32KFXfW783HVDFHgWsrg0EWNEDK4z0+yEAEhuAIsgAFMEFQOECILEBKIIMQBFcABQuABIbgCLIABTBBUBhAzx5BEuWGM/9GT35V7bkwxTPfZw9eaVZ8lKN517rI8NHmr43cPyufXi5Rh1Q+dc7PTAWduI83abTNteHJjvz6KEJYeoU2+/UBVcm+tuNbTCv2nRYq2k/9ylXwL8I+AGj+lzlceKDYQAAAABJRU5ErkJggg==); +} + +.aioseop_help_text_link.aioseop_meta_box_help:before { + font-size: 14px; +} + +.aioseop_meta_box_help > label { + position: absolute; + margin-left: 8px; +} + +div.aioseop_tip_icon { + font-size: 14px; + border: 1px solid #888; + width: 1em; + text-align: center; + padding: 0 4px; + -webkit-border-radius: 12px; + -moz-border-radius: 12px; + -webkit-box-shadow: 1px 1px 1px #888; + -moz-box-shadow: 1px 1px 1px #888; + box-shadow: 1px 1px 1px #888; + border-radius: 12px; +} + +div.aioseop_tip_icon:before { + content: '?'; +} + +.aioseop_help_text_link img { + width: 40px; + float: left; +} + +.aioseop_meta_box_help, +.aioseop_meta_box_help:active { + float: right; + padding-left: 0; + width: 16px; + margin-right: 32px; + text-decoration: none; + height: 15px; + padding-top: 1px; + position: relative; +} + +.aioseop_label { + color: #5F5F5F; + font-weight: bold; + line-height: 19px; + padding-left: 10px; /*changed from 20px to 10px for certain language support*/ + display: inline-block; + text-align: left; + position: absolute; + font-family: 'Open Sans', sans-serif; + width: 26%; + min-width: 120px; + max-width: 230px; +} + +.aioseop_option_div { + max-height: 160px; + min-height: 43px; + width: 95%; + overflow-y: auto; +} + +.aioseop_overflowed { + border: 1px solid #e1e1e1; +} + +.aioseop input[type="text"] { + color: #515151; + height: 35px; + padding: 10px 0 10px 10px; + font-size: 14px; + width: 95%; + max-width: 600px; +} + +.aioseop textarea { + color: #515151; + padding: 10px 0 0 10px; + margin: 0; + font-size: 14px; + line-height: 25px; + width: 95%; + max-width: 600px; +} + +.aioseop_help_text_div { + text-align: left; + width: 100%; + margin: 10px 0 10px 0; +} + +.aioseop_help_text { + font-size: 12px; + float: left; + clear: left; + color: #797979; + line-height: 15px; + font-style: italic; +} + +.aioseop_head_tagline { + color: #5F5F5F; + font-size: 13px; +} + +.aioseop_head_nav { + float: left; + font-size: 18px; + margin: 0 0 16px 0; + font-family: "HelveticaNeue-Light", + "Helvetica Neue Light", + "Helvetica Neue", + sans-serif; + border-bottom: 1px solid #CCC; + width: 100%; +} + +.aioseop_head_nav_tab { + padding: 10px 15px 10px 15px; + margin: 0 0 0 15px; + border-radius: 4px 4px 0 0; + border: 1px solid #CCC; + border-bottom: 0 white; + float: left; + opacity: 0.5; + color: black; + text-shadow: white 0 1px 0; + text-decoration: none; +} + +.aioseop_head_nav_tab.aioseop_head_nav_active { + opacity: 1; + margin-bottom: -1px; + border-width: 1px; +} + +.aioseop_head_nav_tab:first-child { + margin-left: 0; +} + +.aioseop_head_nav_tab:hover { + opacity: 1; +} + +.aioseop_header { + float: left; + clear: left; +} + +.aioseop_advert { + padding: 10px; + margin-bottom: 30px; + border: 1px solid #DDD; + height: 200px; + width: 423px; +} + +.headwaythemes { + background-color: #FFFFFF; + padding-bottom: 110px; + height: 125px; +} + +.aioseop_nopad { + padding-left: 0; + padding-top: 0; +} + +.aioseop_nopad_all { + padding: 0; + height: 220px; + width: 445px; + margin-bottom: 20px; + border: none; +} + +.aioseop_adverts { + float: right; +} + +.wincherad { + width: 100%; + height: 100%; + background-size: 100%; + background-repeat: no-repeat; + margin-bottom: 0; + border: none; +} + +#wincher21 { + background-image: url(../../modules/images/banner21.jpg); +} + +#wincher22 { + background-image: url(../../modules/images/banner22.jpg); +} + +.aioseop_content { + min-width: 760px; + clear: left; +} + +.aioseop_options_wrapper { +} + +.aioseop_options_wrapper .hndle { + font-size: 15px; + font-family: Georgia, + "Times New Roman", + "Bitstream Charter", + Times, + serif; + font-weight: normal; + padding: 7px 10px; + margin: 0; + line-height: 1; +} + +.aioseop_options_wrapper .submit input.button-primary { + margin-bottom: 5px; +} + +#aiosp_feature_manager_metabox.postbox { + margin-top: 20px; + float: left; +} + +.aioseop_advert p { + margin: 25px 0 25px 0; +} + +.aioseop_options_wrapper .postarea { + border-color: #DFDFDF; + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.aioseop_advert h3 { + padding: 0; + margin-top: 6px; +} + +.aioseop_metabox_text p { + margin: 0 0 0 0; + width: 101%; +} + +.aioseop_sidebar { + width: 457px; + margin-left: 10px; +} + +.aioseop_metabox_text { + margin-bottom: 0; +} + +.aioseop_metabox_wrapper { + padding: 0; +} + +.aioseop_metabox_text *:last-child { + margin: 0; +} + +.aioseop_metabox_feature { + margin-top: 20px; +} + +.aioseop_option_label { + float: left; + margin: 0; + min-width: 150px; + width: 37%; + max-width: 270px; + padding-top: 3px; + padding-bottom: 3px; + height: 67px !important; /*added for certain language support*/ +} + +.aioseop_metabox_text h2 { + font-size: 14px; + padding: 0; + font-weight: bold; + line-height: 29px; +} + +#aioseop-about { + width: 443px; + margin-bottom: 20px; +} + +#aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 { + font-size: 13px; +} + +.aioseop_sidebar #mc-embedded-subscribe-form { + margin: 0 0 10px 0; + background: white; + padding: 10px 10px; + border: 1px solid #DDD; +} + +.aioseop input[readonly] { + background-color: #EEE; + margin: 5px 0 5px 0 !important; +} + +.aioseop_settings_left { + float: left; + padding: 0; + margin: 0; + width: 100%; +} + +body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { + margin-top: 20px; +} + +body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { + margin-top: 20px; +} + +#aioseop_top_button { + margin-top: 5px; + height: 30px; +} + +#aioseop-list #mce-EMAIL { + margin-top: 5px; + width: 250px; +} + +.aioseop_top { + margin: 10px 10px 0 0; + /* margin: 10px 477px 0px 0px; */ +} + +.aioseop_top #aioseop-list { + margin-bottom: 0; +} + +.aioseop_right_sidebar { + float: right; + margin-top: 35px; +} + +#aiosp_settings_form .button-primary.hidden { + display: none; +} + +form#edittag div#aiosp_titleatr_wrapper, +form#edittag div#aiosp_menulabel_wrapper, +form#edittag div#aiosp_sitemap_exclude_wrapper { + display: none; +} + +.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button { + height: 5px; + position: absolute; + top: 0; + width: 97%; +} + +.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > .aioseop_settings_left { + margin-top: 10px; +} + +.All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper { + margin-top: 10px; +} + +div#aiosp_feature_manager_metabox .inside { + padding: 8px; +} + +div.aioseop_feature { + position: relative; + display: inline-block; + float: left; + vertical-align: top; + width: 240px; + height: 288px; + margin: 8px; + border: 1px solid #DEDEDE; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + background: white; + padding: 10px 0 0; + -webkit-box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + -webkit-transition-duration: .4s; + -moz-transition-duration: .4s; +} + +.aioseop_feature #free-flag { + float: right; + margin-right: -7px; + background: none repeat scroll 0 0 #D23D46; + color: #FFFFFF; + padding: 5px 12px 6px 5px; + position: relative; +} + +.aioseop_feature #free-flag:before { + border-color: #D23D46 #D23D46 #D23D46 transparent; + border-style: solid; + border-width: 14px 4px 15px 10px; + content: ""; + left: -14px; + position: absolute; + top: 0; +} + +.aioseop_feature #free-flag:after { + border-color: #892026 transparent transparent; + border-style: solid; + border-width: 6px 6px 6px 0; + bottom: -12px; + content: ""; + position: absolute; + right: 0; +} + +#aioseop_coming_soon #free-flag { + display: none; +} + +.aioseop_feature h3 { + font-size: 17px; + margin: 0; + padding: 0 10px 5px 10px; + font-weight: normal; + font-style: normal; + font-family: "Helvetica Neue", + Helvetica, + Arial, + "Lucida Grande", + Verdana, + "Bitstream Vera Sans", + sans-serif; +} + +.aioseop_feature p { + line-height: 150%; + font-size: 12px; + font-family: Georgia, + "Times New Roman", + "Bitstream Charter", + Times, serif; + margin-bottom: 20px; + color: #666; + padding: 0 10px; +} + +.aioseop_feature p.aioseop_desc { + min-height: 80px; +} + +.aioseop_feature .feature_button { + float: right; + margin-bottom: 10px; + margin-right: 10px; + min-width: 80px; + text-align: center; +} + +.aioseop_feature .feature_button:before { + content: "Activate"; +} + +.aioseop_feature .active.feature_button:before { + content: "Deactivate"; +} + +div.aioseop_feature .aioseop_featured_image { + min-height: 100px; + background-repeat: no-repeat; + display: block; + margin: 0 auto; + width: 133px; +} + +div.aioseop_feature .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Standard.png); +} + +div.aioseop_feature .aioseop_featured_image.active { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png); +} + +div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png); +} + +div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/VideoSitemap-BW-Standard.png); +} + +div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/VideoSitemap-Color-Standard.png); +} + +div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { + background-image: url(../../modules/images/SocialMeta-BW-Standard.png); +} + +div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { + background-image: url(../../modules/images/SocialMeta-Color-Standard.png); +} + +div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { + background-image: url(../../modules/images/Robots-BW-Standard.png); +} + +div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { + background-image: url(../../modules/images/Robots-Color-Standard.png); +} + +div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { + background-image: url(../../modules/images/FileEditor-BW-Standard.png); +} + +div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { + background-image: url(../../modules/images/FileEditor-Color-Standard.png); +} + +div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { + background-image: url(../../modules/images/ImporterExporter-BW-Standard.png); +} + +div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { + background-image: url(../../modules/images/ImporterExporter-Color-Standard.png); +} + +div.aioseop_feature#aioseop_performance .aioseop_featured_image { + background-image: url(../../modules/images/Performance-BW-Standard.png); +} + +div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { + background-image: url(../../modules/images/Performance-Color-Standard.png); +} + +div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +.All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table, +.All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table { + max-width: 500px; + clear: none; +} + +.aioseop_follow_button { + min-height: 50px; + background-repeat: no-repeat; + display: inline-block; + width: 100px; + background-size: auto 50px !important; + margin-right: 0; +} + +.aioseop_facebook_follow { + background-image: url(../../modules/images/facebook-follow-standard.png); +} + +.aioseop_twitter_follow { + background-image: url(../../modules/images/twitter-follow-standard.png); +} + +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and ( min--moz-device-pixel-ratio: 1.5), only screen and ( -o-min-device-pixel-ratio: 3/2), only screen and ( min-device-pixel-ratio: 1.5), only screen and ( min-resolution: 1.5dppx) { + div.aioseop_feature .aioseop_featured_image { + background-size: auto 100px !important; + } + + div.aioseop_feature .aioseop_featured_image.active { + background-image: url(../../modules/images/Default-Color-Retina.png); + } + + div.aioseop_feature .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png); + } + + div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png); + } + + div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/VideoSitemap-BW-Retina.png); + } + + div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/VideoSitemap-Color-Retina.png); + } + + div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { + background-image: url(../../modules/images/SocialMeta-BW-Retina.png); + } + + div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { + background-image: url(../../modules/images/SocialMeta-Color-Retina.png); + } + + div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { + background-image: url(../../modules/images/Robots-BW-Retina.png); + } + + div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { + background-image: url(../../modules/images/Robots-Color-Retina.png); + } + + div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { + background-image: url(../../modules/images/FileEditor-BW-Retina.png); + } + + div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { + background-image: url(../../modules/images/FileEditor-Color-Retina.png); + } + + div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { + background-image: url(../../modules/images/ImporterExporter-BW-Retina.png); + } + + div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { + background-image: url(../../modules/images/ImporterExporter-Color-Retina.png); + } + + div.aioseop_feature#aioseop_performance .aioseop_featured_image { + background-image: url(../../modules/images/Performance-BW-Retina.png); + } + + div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { + background-image: url(../../modules/images/Performance-Color-Retina.png); + } + + div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + .aioseop_facebook_follow { + background-image: url(../../modules/images/facebook-follow-retina.png); + } + + .aioseop_twitter_follow { + background-image: url(../../modules/images/twitter-follow-retina.png); + } +} + +.aioseop_options { + width: 100%; + margin: 18px 0 10px 0; +} + +.aioseop_wrapper { + width: 100%; + padding-left: 5px; +} + +.aioseop_input { + clear: left; + width: 100%; + padding: 5px; + display: inline; +} + +.aioseop_option_input { + float: left; + width: 61%; + margin: 0; + padding-left: 1px; + min-width: 160px; + /* max-width: 900px; */ +} + +#aiosp div.preview_snippet { + border: 1px solid #ebebeb; + padding: 15px 15px 20px 7px; + background-color: #fff; +} + +div#aioseop_snippet { + font-family: arial, sans-serif; + font-size: 13px; +} + +div#aioseop_snippet > h3 { + font-size: 16px; + padding: 8px 0; + border: 0; + background: inherit; +} + +div#aioseop_snippet > h3 > a { + color: #12c; + text-decoration: none; + cursor: pointer; +} + +div#aioseop_snippet > div { + color: #222; + max-width: 42em; +} + +div#aioseop_snippet > div > div { + display: block; + margin-bottom: 1px; +} + +div#aioseop_snippet > div > div > cite { + color: #093; + font-style: normal; +} + +div#aioseop_snippet > div > span { + margin: 0; + padding: 0; + border: 0; +} + +#aiosp_sitemap_addl_pages, +#aiosp_video_sitemap_addl_pages { + clear: left; + margin-left: 20px; + max-width: 1072px; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper { + width: 23%; + min-width: 165px; + display: inline-block; + max-width: 265px; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div { + position: absolute; + margin: 5px 0 10px 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_option_input, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_option_input { + width: 94%; + min-width: 94%; +} + +#aiosp_sitemap_addl_pages_metabox table.aioseop_table, +#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table { + width: 96%; + border: 1px solid #CCC; + margin: 5px 0 10px 0; +} + +table.aioseop_table tr:nth-child(odd) { + background-color: #EEE; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) { + background-color: rgba(238, 238, 238, 0.5); +} + +table.aioseop_table td { + width: 23%; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table { + width: 80%; + max-width: 800px; + display: block; + border-top: 1px solid #dfdfdf; + border-left: 1px solid #dfdfdf; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table th { + width: 18%; + border-right: 1px solid #dfdfdf; + border-bottom: 1px solid #dfdfdf; +} + +.All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info { + margin-top: 10px; + border: 1px solid #dfdfdf; + width: 80%; + max-width: 800px; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th { + background: #f1f1f1; + background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9)); + background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: linear-gradient(to top, #ececec, #f9f9f9); + padding: 5px; + border-bottom-color: #dfdfdf; + text-shadow: #fff 0 1px 0; + -webkit-box-shadow: 0 1px 0 #fff; + -moz-box-shadow: 0 1px 0 #fff; + box-shadow: 0 1px 0 #fff; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table td { + border-right: 1px solid #dfdfdf; + border-bottom: 1px solid #dfdfdf; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item { + display: inline-block; + width: 30%; + vertical-align: top; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) { + font-weight: bold; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) { + width: 70%; +} + +#aiosp_sitemap_addl_pages_metabox table.aioseop_table td, +#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td { + width: 25%; + padding-left: 5%; +} + +table.aioseop_table td, table.aioseop_table th { + padding: 3px; +} + +.aioseop_top_label .aioseop_option_input, +.aioseop_no_label .aioseop_option_input { + width: 100%; +} + +#aiosp_settings_form .postbox { + margin: 0 0 20px 0; +} + +.aioseop_settings_left .postbox { + float: left; + width: 100%; +} + +.aioseop_option_setting_label { + min-height: 35px; + display: inline-block; + white-space: nowrap; + overflow: hidden; + padding-left: 1px; + max-width: 229px; + min-width: 160px; + width: 33%; +} + +.aioseop_settings_left .postbox .inside { + padding: 0; + margin: 0; + clear: right; +} + +#aiosp_settings_form .aioseop_no_label, .aioseop_no_label { + float: left; + width: 92%; + max-width: 100%; + margin: 0 23px 0 13px; +} + +.aioseop_top_label { + width: 96%; + margin: 0 10px; +} + +.aioseop_hidden_type { + margin: 0; + padding: 0; + height: 0; +} + +.aioseop_module.error.below-h2 { + padding: 5px 0; + margin: 0 477px 15px 0 !important; +} + +#aioseop_opengraph_settings .inside { + margin: 0; + padding: 0; +} + +#aioseop_opengraph_settings_image_wrapper img { + width: auto; + height: 75px; +} + +#aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label { + max-width: 160px; + min-width: 100px; + width: 30%; +} + +.aioseop_input input[type="checkbox"], +.aioseop_input input[type="radio"] { + vertical-align: text-bottom; + margin-top: 8px; +} + +#aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div { + max-height: initial; +} + +#aiosp { + width: 100%; +} + +.aioseop_input.aioseop_top_label .aioseop_option_input { + margin: 0 0 10px 0; +} + +.aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div { + max-height: none; +} + +/* Robots.txt styling */ +#aiosp_robots_generator_robotgen_wrapper .aioseop_option_div, +#aiosp_robots_generator_robothtml_wrapper .aioseop_option_div { + max-height: none; +} + +.aioseop_option_input .widefat td { + vertical-align: middle; +} + +.entry-row.robots.quirks { + font-weight: bold; + opacity: 1; +} + +.entry-row.robots { + opacity: 0.8; +} + +.entry-row.robots.invalid { + opacity: 1; + font-weight: bold; +} + +.invalid .entry_label { + font-weight: bold; +} + +.aioseop .aioseop_option_input tbody { + background: #FCFCFC; +} + +.All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody { + background: transparent; +} + +.entry-row.robots div { + height: 20px; + vertical-align: middle; + width: 90%; + margin: 0 0 4px 0; +} + +.robots img { + margin: 0 0 0 2px; + opacity: 0.6; +} + +.aioseop_option_docs { + width: 98%; + display: none; + border: 1px solid #D3D3D3; + margin-top: 20px; + padding: 1%; + background-color: #EEE; +} + +.aioseop_option_docs h3 { + background: none; +} + +div.aioseop_notice { + position: relative; +} + +div.aioseop_notice a.aioseop_dismiss_link { + position: absolute; + top: 10px; + right: 10px; +} + +.aioseop_error_notice { + color: #f00; + font-weight: bold; +} + +.aioseop_input select { + margin: 7px 0; +} + +.aioseop_help_text ul { + margin: 15px 0 0 20px; +} + +.aioseop_help_text ul li { + line-height: 20px; + margin: 0; +} + +.aioseop_sidebar #side-sortables { + width: 98%; +} + +#aioseop_opengraph_settings .aioseop_option_label { + width: 30%; +} + +.aioseop_tabs { + padding-top: 6px; +} + +.aioseop_tabs.hide, +.aioseop_header_tabs.hide { + display: block !important; +} + +.aioseop_header_tabs li { + display: inline; + padding: 0; + margin: 0; +} + +.aioseop_header_tabs { + margin: 0; +} + +.aioseop_header_nav { + margin: 0; +} + +.aioseop_header_tabs li a.aioseop_header_tab.active { + background-color: rgb(255, 255, 255); + border-bottom-color: rgba(255, 255, 255, 0.5); + font-weight: bold; +} + +.aioseop_header_tabs li a.aioseop_header_tab { + height: 18px; + font: 13px/18px Arial, + Helvetica, + sans-serif normal; + text-decoration: none; + margin: 5px 5px 0 0; + padding: 4px 5px 2px; + cursor: pointer; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + background-color: rgb(255, 255, 255); + background-color: rgba(255, 255, 255, 0.5); + border: 1px solid #ccc; + color: #5F5F5F; +} + +/* Fix for Chrome */ +@media screen and (-webkit-min-device-pixel-ratio:0) { + + .aioseop_header_tabs li a.aioseop_header_tab { + padding-bottom: 0; + } +} + +/* Fix for Safari */ +_:-webkit-full-screen:not(:root:root), .aioseop_header_tabs li a.aioseop_header_tab { + padding-bottom: 2px; +} + +.aioseop_header_tabs li:first-child a.aioseop_header_tab { + border-left: solid 1px #CCC; + margin-left: 5px; +} + +.aioseop_tab { + border: solid 1px #CCC; + background-color: rgb(255, 255, 255); + background-color: rgba(255, 255, 255, 0.5); + padding-left: 5px; +} + +.aioseop_loading { + background-image: url('../../images/activity.gif'); + display: inline-block; + width: 24px; + height: 24px; + margin: 0; + padding: 0; + vertical-align: bottom; +} + +.aiosp_delete_url { + background-image: url('../../images/delete.png'); + display: inline-block; + width: 16px; + height: 16px; + margin: 0; + padding: 0; + vertical-align: bottom; +} + +form#aiosp_settings_form, +.aioseop_tabs_div { + padding-right: 477px; +} + +.aioseop_tabs_div { + margin-top: 10px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li strong { + display: block; + float: left; + text-align: right; + background-color: #DDD; + margin-right: 8px; + padding: 1px 8px 1px 1px; + overflow: auto; + width: 200px; + min-height: 16px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong { + background-color: #CCC; +} + +#aiosp_settings_form ul.sfwd_debug_settings li { + clear: left; + margin: 0; + padding: 0; + background-color: #EEE; + overflow: auto; + max-width: 75%; + min-width: 800px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) { + background-color: #DDD; +} + +div.sfwd_debug_mail_sent { + background-color: #080; + border: 1px solid #0A0; + margin: 10px 0 10px 0; + width: 598px; + color: #FFF; + text-align: center; +} + +div.sfwd_debug_error { + background-color: #F00; + color: #FFF; + border: 1px solid #A00; + margin: 10px 0 10px 0; + width: 598px; + text-align: center; + font-weight: bolder; +} + +#aiosp_performance_status_wrapper .aioseop_option_div { + max-height: 420px; +} + +#aioseop_coming_soon, #aioseop_coming_soon2 { + padding-top: 40px; + text-align: center; + height: 258px; + font-size: 16px; +} + +.MRL { + margin-left: 20px !important; + margin-bottom: 10px !important; +} diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-am.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-am.mo new file mode 100755 index 0000000000..6a7ad3c406 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-am.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ar.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ar.mo deleted file mode 100644 index 558473f73f..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ar.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-art_xemoji.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-art_xemoji.mo new file mode 100755 index 0000000000..c74b596dcf Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-art_xemoji.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ary.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ary.mo deleted file mode 100755 index cd69e2b6fa..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ary.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bg_BG.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bg_BG.mo deleted file mode 100644 index 59f2befeb3..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bg_BG.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bn_BD.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bn_BD.mo new file mode 100755 index 0000000000..2b9a64ab8f Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bn_BD.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bs_BA.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bs_BA.mo new file mode 100755 index 0000000000..e1d383fe8e Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-bs_BA.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ca.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ca.mo deleted file mode 100755 index 85369f3e2a..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ca.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-de_DE.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-de_DE.mo deleted file mode 100644 index feee17fbaa..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-de_DE.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-el.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-el.mo index 5cdcc9615f..ee189b9562 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-el.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-el.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_AU.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_AU.mo deleted file mode 100644 index 351c92e7ec..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_AU.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_CA.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_CA.mo deleted file mode 100644 index 511eab31b5..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_CA.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_GB.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_GB.mo deleted file mode 100644 index c0e6219dfb..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_GB.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_NZ.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_NZ.mo deleted file mode 100755 index 3df83dcb3b..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_NZ.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_ZA.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_ZA.mo index 06604700ad..2c486385bd 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_ZA.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-en_ZA.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_CL.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_CL.mo deleted file mode 100644 index 1eaeb4faf3..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_CL.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_ES.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_ES.mo index f6b28f9452..c254ab2c24 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_ES.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_ES.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_MX.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_MX.mo deleted file mode 100644 index 1eaeb4faf3..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_MX.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_VE.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_VE.mo index 1eaeb4faf3..8b128d98dd 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_VE.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-es_VE.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-et.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-et.mo index 5995354c40..beb48a0ace 100755 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-et.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-et.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fa_IR.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fa_IR.mo deleted file mode 100644 index 56ab2e2464..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fa_IR.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fi.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fi.mo deleted file mode 100755 index 7c48aa9d53..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fi.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fr_CA.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fr_CA.mo index 51c25db938..9b513aec92 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fr_CA.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fr_CA.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fr_FR.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fr_FR.mo index fd81aad34f..b515d4b0ef 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fr_FR.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-fr_FR.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-he_IL.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-he_IL.mo index 74e7de72e4..846068dc00 100755 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-he_IL.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-he_IL.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hi_IN.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hi_IN.mo deleted file mode 100644 index 4fe5d01070..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hi_IN.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hr.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hr.mo deleted file mode 100644 index 5bedb99e27..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hr.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hu_HU.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hu_HU.mo deleted file mode 100644 index 2aab1288ed..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hu_HU.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hy b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hy deleted file mode 100755 index 3664dd8def..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hy and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hy.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hy.mo new file mode 100755 index 0000000000..161f56954a Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-hy.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-id_ID.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-id_ID.mo index f9aad6a2aa..d8246c5092 100755 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-id_ID.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-id_ID.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-it_IT.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-it_IT.mo deleted file mode 100644 index e6f51fd0c1..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-it_IT.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ja.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ja.mo index 62d25f8436..ac6d9aaee9 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ja.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ja.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-jv_ID.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-jv_ID.mo new file mode 100755 index 0000000000..b2227164d4 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-jv_ID.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ko_KR.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ko_KR.mo deleted file mode 100644 index 2bbb46a5ad..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ko_KR.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-lv.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-lv.mo new file mode 100755 index 0000000000..b6ba89cbfb Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-lv.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mk_MK.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mk_MK.mo new file mode 100755 index 0000000000..b103ade4f3 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mk_MK.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mn.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mn.mo new file mode 100755 index 0000000000..a0118a65f4 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mn.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mr.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mr.mo new file mode 100755 index 0000000000..531b172094 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-mr.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ms_MY.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ms_MY.mo new file mode 100755 index 0000000000..175d855f66 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ms_MY.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nb_NO.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nb_NO.mo deleted file mode 100644 index 74326344cf..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nb_NO.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nl.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nl.mo deleted file mode 100755 index a3fc76b278..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nl.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nl_NL.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nl_NL.mo deleted file mode 100644 index b79d869372..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nl_NL.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nn_NO.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nn_NO.mo deleted file mode 100644 index 4b82665100..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-nn_NO.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-oci.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-oci.mo index 098f2d72cc..3daa63d8ee 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-oci.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-oci.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pa_IN.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pa_IN.mo index dca116f20d..007b28c3eb 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pa_IN.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pa_IN.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pl_PL.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pl_PL.mo deleted file mode 100644 index 9323ba6d40..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pl_PL.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ps.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ps.mo new file mode 100755 index 0000000000..20a51537c6 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ps.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pt_BR.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pt_BR.mo deleted file mode 100755 index 6ad592fe5d..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pt_BR.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pt_PT.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pt_PT.mo deleted file mode 100644 index 0d91986774..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-pt_PT.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ro_RO.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ro_RO.mo deleted file mode 100644 index 027a6d9f2b..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ro_RO.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ru_RU.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ru_RU.mo deleted file mode 100644 index d28f00e2db..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ru_RU.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-si_LK.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-si_LK.mo new file mode 100755 index 0000000000..c0aaefccc4 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-si_LK.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sl_SL.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sl_SL.mo deleted file mode 100755 index 59bc0e5869..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sl_SL.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sq.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sq.mo deleted file mode 100644 index 3bb3fbc38e..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sq.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sr_RS.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sr_RS.mo deleted file mode 100644 index 6954ac4bed..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sr_RS.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sv_SE.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sv_SE.mo index d75357525d..0558729702 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sv_SE.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-sv_SE.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ta_IN.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ta_IN.mo new file mode 100755 index 0000000000..c35ad3c5f9 Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ta_IN.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-tg.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-tg.mo new file mode 100755 index 0000000000..93a892904e Binary files /dev/null and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-tg.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-tr_TR.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-tr_TR.mo deleted file mode 100644 index aa5870822e..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-tr_TR.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-uk.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-uk.mo index 87d213c1b6..7f91f696b5 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-uk.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-uk.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ur.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ur.mo index 301b7e3f76..fc6cb7c79d 100755 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ur.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-ur.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-vi.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-vi.mo deleted file mode 100644 index c186356b7c..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-vi.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-zh_CN.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-zh_CN.mo deleted file mode 100644 index fe9abb5445..0000000000 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-zh_CN.mo and /dev/null differ diff --git a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-zh_TW.mo b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-zh_TW.mo index c94a8d05e3..555802e85f 100644 Binary files a/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-zh_TW.mo and b/wp-content/plugins/all-in-one-seo-pack/i18n/all-in-one-seo-pack-zh_TW.mo differ diff --git a/wp-content/plugins/all-in-one-seo-pack/inc/aioseop_functions.php b/wp-content/plugins/all-in-one-seo-pack/inc/aioseop_functions.php index a818d3e5ef..da0b714866 100644 --- a/wp-content/plugins/all-in-one-seo-pack/inc/aioseop_functions.php +++ b/wp-content/plugins/all-in-one-seo-pack/inc/aioseop_functions.php @@ -1,77 +1,91 @@ load_modules(); + require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_manager.php' ); + $aioseop_modules = new All_in_One_SEO_Pack_Module_Manager( apply_filters( 'aioseop_module_list', $aioseop_module_list ) ); + $aioseop_modules->load_modules(); } } -if ( !function_exists( 'aioseop_get_options' ) ) { +if ( ! function_exists( 'aioseop_get_options' ) ) { + /** + * @return mixed|void + */ function aioseop_get_options() { global $aioseop_options; $aioseop_options = get_option( 'aioseop_options' ); $aioseop_options = apply_filters( 'aioseop_get_options', $aioseop_options ); + return $aioseop_options; } } -/** - * Check if settings need to be updated / migrated from old version. - */ -if ( !function_exists( 'aioseop_update_settings_check' ) ) { +if ( ! function_exists( 'aioseop_update_settings_check' ) ) { + /** + * Check if settings need to be updated / migrated from old version. + * + * @TODO See when this is from and if we can move it elsewhere... our new db updates/upgrades class? + */ function aioseop_update_settings_check() { global $aioseop_options; - if ( ( isset( $_POST['aioseop_migrate_options'] ) ) || - ( empty( $aioseop_options ) ) ) + if ( empty( $aioseop_options ) || isset( $_POST['aioseop_migrate_options'] ) ) { aioseop_mrt_mkarry(); - // WPML has now attached to filters, read settings again so they can be translated + } + // WPML has now attached to filters, read settings again so they can be translated. aioseop_get_options(); $update_options = false; - if ( !empty( $aioseop_options ) ) { - if ( !empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // migrate setting for noindex archives + if ( ! empty( $aioseop_options ) ) { + if ( ! empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // Migrate setting for noindex archives. $aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex']; unset( $aioseop_options['aiosp_archive_noindex'] ); $update_options = true; } - if ( !empty( $aioseop_options['aiosp_archive_title_format'] ) && empty( $aioseop_options['aiosp_date_title_format'] ) ) { + if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && empty( $aioseop_options['aiosp_date_title_format'] ) ) { $aioseop_options['aiosp_date_title_format'] = $aioseop_options['aiosp_archive_title_format']; unset( $aioseop_options['aiosp_archive_title_format'] ); $update_options = true; } - if ( !empty( $aioseop_options['aiosp_archive_title_format'] ) && ( $aioseop_options['aiosp_archive_title_format'] == '%date% | %blog_title%' ) ) { + if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && ( $aioseop_options['aiosp_archive_title_format'] === '%date% | %blog_title%' ) ) { $aioseop_options['aiosp_archive_title_format'] = '%archive_title% | %blog_title%'; - $update_options = true; + $update_options = true; } - if ( $update_options ) + if ( $update_options ) { update_option( 'aioseop_options', $aioseop_options ); + } } } } -/** - * Initialize settings to defaults. - */ -if ( !function_exists( 'aioseop_mrt_mkarry' ) ) { +if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) { + /** + * Initialize settings to defaults. + * + * @TODO Should also move. + */ function aioseop_mrt_mkarry() { global $aiosp; global $aioseop_options; $naioseop_options = $aiosp->default_options(); - if( get_option( 'aiosp_post_title_format' ) ) { - foreach( $naioseop_options as $aioseop_opt_name => $value ) { - if( $aioseop_oldval = get_option( $aioseop_opt_name ) ) { - $naioseop_options[$aioseop_opt_name] = $aioseop_oldval; + if ( get_option( 'aiosp_post_title_format' ) ) { + foreach ( $naioseop_options as $aioseop_opt_name => $value ) { + if ( $aioseop_oldval = get_option( $aioseop_opt_name ) ) { + $naioseop_options[ $aioseop_opt_name ] = $aioseop_oldval; } - if( $aioseop_oldval == '' ) { - $naioseop_options[$aioseop_opt_name] = ''; + if ( $aioseop_oldval == '' ) { + $naioseop_options[ $aioseop_opt_name ] = ''; } delete_option( $aioseop_opt_name ); } @@ -81,375 +95,500 @@ function aioseop_mrt_mkarry() { } } -if ( !function_exists( 'aioseop_activate_pl' ) ) { +if ( ! function_exists( 'aioseop_activate_pl' ) ) { + /** + * @TODO see if this still gets used. + */ function aioseop_activate_pl() { - if( $aioseop_options = get_option( 'aioseop_options' ) ) { - $aioseop_options['aiosp_enabled'] = "0"; + if ( $aioseop_options = get_option( 'aioseop_options' ) ) { + $aioseop_options['aiosp_enabled'] = '0'; - if( empty( $aioseop_options['aiosp_posttypecolumns'] ) ) { - $aioseop_options['aiosp_posttypecolumns'] = array('post','page'); + if ( empty( $aioseop_options['aiosp_posttypecolumns'] ) ) { + $aioseop_options['aiosp_posttypecolumns'] = array( 'post', 'page' ); } - update_option('aioseop_options', $aioseop_options); + update_option( 'aioseop_options', $aioseop_options ); } } } -if ( !function_exists( 'aioseop_get_version' ) ) { +if ( ! function_exists( 'aioseop_get_version' ) ) { + /** + * Returns the version. + * + * I'm not sure why we have BOTH a function and a constant for this. -mrt + * + * @return string + */ function aioseop_get_version() { return AIOSEOP_VERSION; } } -if ( !function_exists( 'aioseop_option_isset' ) ) { +if ( ! function_exists( 'aioseop_option_isset' ) ) { + /** + * Checks if an option isset. + * + * @param $option + * + * @return bool + */ function aioseop_option_isset( $option ) { global $aioseop_options; - return ( ( isset( $aioseop_options[$option] ) ) && $aioseop_options[$option] ); + + return ( isset( $aioseop_options[ $option ] ) && $aioseop_options[ $option ] ); } } -if ( !function_exists( 'aioseop_addmycolumns' ) ) { +if ( ! function_exists( 'aioseop_addmycolumns' ) ) { + /** + * Adds posttype columns. + * + * @TODO We should see if this is still being used, and move it either way. + */ function aioseop_addmycolumns() { global $aioseop_options, $pagenow; $aiosp_posttypecolumns = Array(); - if ( !empty( $aioseop_options) && !empty( $aioseop_options['aiosp_posttypecolumns'] ) ) { + if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_posttypecolumns'] ) ) { $aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns']; } - if ( !empty( $pagenow ) && ( $pagenow == 'upload.php' ) ) + if ( ! empty( $pagenow ) && ( $pagenow === 'upload.php' ) ) { $post_type = 'attachment'; - elseif ( !isset( $_REQUEST['post_type'] ) ) + } elseif ( ! isset( $_REQUEST['post_type'] ) ) { $post_type = 'post'; - else + } else { $post_type = $_REQUEST['post_type']; + } - if( is_array( $aiosp_posttypecolumns ) && in_array( $post_type, $aiosp_posttypecolumns ) ) { + if ( is_array( $aiosp_posttypecolumns ) && in_array( $post_type, $aiosp_posttypecolumns ) ) { add_action( 'admin_head', 'aioseop_admin_head' ); - if ( $post_type == 'page' ) + if ( $post_type === 'page' ) { add_filter( 'manage_pages_columns', 'aioseop_mrt_pcolumns' ); - elseif ( $post_type == 'attachment' ) + } elseif ( $post_type === 'attachment' ) { add_filter( 'manage_media_columns', 'aioseop_mrt_pcolumns' ); - else + } else { add_filter( 'manage_posts_columns', 'aioseop_mrt_pcolumns' ); - if ( $post_type == 'attachment' ) + } + if ( $post_type === 'attachment' ) { add_action( 'manage_media_custom_column', 'aioseop_mrt_pccolumn', 10, 2 ); - elseif ( is_post_type_hierarchical( $post_type ) ) + } elseif ( is_post_type_hierarchical( $post_type ) ) { add_action( 'manage_pages_custom_column', 'aioseop_mrt_pccolumn', 10, 2 ); - else + } else { add_action( 'manage_posts_custom_column', 'aioseop_mrt_pccolumn', 10, 2 ); + } } } } -if ( !function_exists( 'aioseop_mrt_pcolumns' ) ) { +if ( ! function_exists( 'aioseop_mrt_pcolumns' ) ) { + + /** + * @param $aioseopc + * + * @return mixed + */ function aioseop_mrt_pcolumns( $aioseopc ) { global $aioseop_options; - $aioseopc['seotitle'] = __( 'SEO Title', 'all-in-one-seo-pack' ); - $aioseopc['seodesc'] = __( 'SEO Description', 'all-in-one-seo-pack' ); - if ( empty( $aioseop_options['aiosp_togglekeywords'] ) ) + $aioseopc['seotitle'] = __( 'SEO Title', 'all-in-one-seo-pack' ); + $aioseopc['seodesc'] = __( 'SEO Description', 'all-in-one-seo-pack' ); + if ( empty( $aioseop_options['aiosp_togglekeywords'] ) ) { $aioseopc['seokeywords'] = __( 'SEO Keywords', 'all-in-one-seo-pack' ); - return $aioseopc; + } + + return $aioseopc; } } -if ( !function_exists( 'aioseop_admin_head' ) ) { +if ( ! function_exists( 'aioseop_admin_head' ) ) { + function aioseop_admin_head() { echo ''; - ?> ID; - if ( !empty( $_GET["aioseop_reset_notices"] ) ) { + if ( ! empty( $_GET['aioseop_reset_notices'] ) ) { delete_user_meta( $user_id, 'aioseop_ignore_notice' ); } - if ( !empty($_GET['aioseop_ignore_notice'] ) ) { + if ( ! empty( $_GET['aioseop_ignore_notice'] ) ) { add_user_meta( $user_id, 'aioseop_ignore_notice', $_GET['aioseop_ignore_notice'], false ); } } } } -if ( !function_exists( 'aioseop_output_notice' ) ) { - function aioseop_output_notice( $message, $id = '', $class = "updated fade" ) { +if ( ! function_exists( 'aioseop_output_notice' ) ) { + + /** + * @param $message + * @param string $id + * @param string $class + * + * @return bool + */ + function aioseop_output_notice( $message, $id = '', $class = 'updated fade' ) { $class = 'aioseop_notice ' . $class; - if ( !empty( $class ) ) $class = ' class="' . esc_attr( $class ) . '"'; - if ( !empty( $id ) ) $class .= ' id="' . esc_attr( $id ) . '"'; + if ( ! empty( $class ) ) { + $class = ' class="' . esc_attr( $class ) . '"'; + } + if ( ! empty( $id ) ) { + $class .= ' id="' . esc_attr( $id ) . '"'; + } $dismiss = ' '; - echo "" . wp_kses_post( $message ) . "
"; + echo "" . wp_kses_post( $message ) . '
'; + return true; } } -if ( !function_exists( 'aioseop_output_dismissable_notice' ) ) { - function aioseop_output_dismissable_notice( $message, $id = "", $class = "updated fade") { +if ( ! function_exists( 'aioseop_output_dismissable_notice' ) ) { + + /** + * @param $message + * @param string $id + * @param string $class + * + * @return bool + */ + function aioseop_output_dismissable_notice( $message, $id = '', $class = 'updated fade' ) { global $current_user; - if ( !empty( $current_user ) ) { + if ( ! empty( $current_user ) ) { $user_id = $current_user->ID; - $msgid = md5( $message ); - $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' ); - if ( !empty( $ignore ) && in_array( $msgid, $ignore ) ) return false; + $msgid = md5( $message ); + $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' ); + if ( ! empty( $ignore ) && in_array( $msgid, $ignore ) ) { + return false; + } global $wp; $qa = Array(); - wp_parse_str( $_SERVER["QUERY_STRING"], $qa ); + wp_parse_str( $_SERVER['QUERY_STRING'], $qa ); $qa['aioseop_ignore_notice'] = $msgid; - $url = '?' . build_query( $qa ); - $message = '

' . $message . '

Dismiss

'; + $url = '?' . build_query( $qa ); + $message = '

' . $message . '

Dismiss

'; } + return aioseop_output_notice( $message, $id, $class ); } } -if ( !function_exists( 'aioseop_ajax_save_meta' ) ) { +if ( ! function_exists( 'aioseop_ajax_save_meta' ) ) { + function aioseop_ajax_save_meta() { - if ( !empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] != 'undefined' ) ) + if ( ! empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] !== 'undefined' ) ) { check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); - $post_id = intval( $_POST['post_id'] ); + } + $post_id = intval( $_POST['post_id'] ); $new_meta = strip_tags( $_POST['new_meta'] ); - $target = $_POST['target_meta']; + $target = $_POST['target_meta']; check_ajax_referer( 'aioseop_meta_' . $target . '_' . $post_id, '_nonce' ); $result = ''; - if ( in_array( $target, Array( 'title', 'description', 'keywords' ) ) && current_user_can( 'edit_post', $post_id ) ) { + if ( in_array( $target, Array( + 'title', + 'description', + 'keywords', + ) ) && current_user_can( 'edit_post', $post_id ) + ) { update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) ); $result = get_post_meta( $post_id, '_aioseop_' . $target, true ); } else { die(); } - if( $result != '' ): + if ( $result != '' ): $label = "'; else: $label = "" . __( 'No', 'all-in-one-seo-pack' ) . ' ' . $target . ''; endif; - $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$post_id}" ); + $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$post_id}" ); $output = '' - . ' ' . $label; - die( "jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . "; - jQuery('div#aioseop_" . $target . "_" . $post_id . "').html(my_label).fadeIn('fast'); + . 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">' + . ' ' . $label; + die( "jQuery('div#aioseop_" . $target . '_' . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . "; + jQuery('div#aioseop_" . $target . '_' . $post_id . "').html(my_label).fadeIn('fast'); });" ); } } -if ( !function_exists( 'aioseop_ajax_init' ) ) { +if ( ! function_exists( 'aioseop_ajax_init' ) ) { + function aioseop_ajax_init() { - if ( !empty( $_POST ) && !empty( $_POST['settings'] ) && (!empty( $_POST['nonce-aioseop'])||(!empty( $_POST['nonce-aioseop-edit']))) && !empty( $_POST['options'] ) ) { - $_POST = stripslashes_deep( $_POST ); + if ( ! empty( $_POST ) && ! empty( $_POST['settings'] ) && ( ! empty( $_POST['nonce-aioseop'] ) || ( ! empty( $_POST['nonce-aioseop-edit'] ) ) ) && ! empty( $_POST['options'] ) ) { + $_POST = stripslashes_deep( $_POST ); $settings = esc_attr( $_POST['settings'] ); - if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) ) - define( 'AIOSEOP_AJAX_MSG_TMPL', "jQuery('div#aiosp_$settings').fadeOut('fast', function(){jQuery('div#aiosp_$settings').html('%s').fadeIn('fast');});" ); + if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) ) { + define( 'AIOSEOP_AJAX_MSG_TMPL', "jQuery('div#aiosp_$settings').fadeOut('fast', function(){jQuery('div#aiosp_$settings').html('%s').fadeIn('fast');});" ); + } - if ( !wp_verify_nonce($_POST['nonce-aioseop'], 'aioseop-nonce') ) - die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __( "Unauthorized access; try reloading the page.", 'all-in-one-seo-pack' ) ) ); + if ( ! wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) { + die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __( 'Unauthorized access; try reloading the page.', 'all-in-one-seo-pack' ) ) ); + } } else { - die(0); + die( 0 ); } } } - function aioseop_embed_handler_html( $return, $url, $attr ) { - return AIO_ProGeneral::aioseop_embed_handler_html(); - } +/** + * @param $return + * @param $url + * @param $attr + * + * @return mixed + */ +function aioseop_embed_handler_html( $return, $url, $attr ) { + return AIO_ProGeneral::aioseop_embed_handler_html(); +} - function aioseop_ajax_update_oembed() { - AIO_ProGeneral::aioseop_ajax_update_oembed(); - } +function aioseop_ajax_update_oembed() { + AIO_ProGeneral::aioseop_ajax_update_oembed(); +} + +if ( ! function_exists( 'aioseop_ajax_save_url' ) ) { -if ( !function_exists( 'aioseop_ajax_save_url' ) ) { function aioseop_ajax_save_url() { aioseop_ajax_init(); $options = Array(); parse_str( $_POST['options'], $options ); - foreach( $options as $k => $v ) $_POST[$k] = $v; + foreach ( $options as $k => $v ) { + $_POST[ $k ] = $v; + } $_POST['action'] = 'aiosp_update_module'; global $aiosp, $aioseop_modules; aioseop_load_modules(); $aiosp->admin_menu(); - if ( !empty( $_POST['settings'] ) && ( $_POST['settings'] == 'video_sitemap_addl_pages' ) ) { - $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Video_Sitemap" ); - } elseif ( !empty( $_POST['settings'] ) && ( $_POST['settings'] == 'news_sitemap_addl_pages' ) ) { - $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_News_Sitemap" ); + if ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'video_sitemap_addl_pages' ) ) { + $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Video_Sitemap' ); + } elseif ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'news_sitemap_addl_pages' ) ) { + $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_News_Sitemap' ); } else { - $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" ); + $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' ); } $_POST['location'] = null; - $_POST['Submit'] = 'ajax'; + $_POST['Submit'] = 'ajax'; $module->add_page_hooks(); $prefix = $module->get_prefix(); - $_POST = $module->get_current_options( $_POST, null ); + $_POST = $module->get_current_options( $_POST, null ); $module->handle_settings_updates( null ); $options = $module->get_current_options( Array(), null ); - $output = $module->display_custom_options( '', Array( 'name' => $prefix . 'addl_pages', 'type' => 'custom', 'save' => true, 'value' => $options[$prefix . 'addl_pages'], 'attr' => '' ) ); - $output = str_replace( "'", "\'", $output ); - $output = str_replace( "\n", '\n', $output ); + $output = $module->display_custom_options( '', Array( + 'name' => $prefix . 'addl_pages', + 'type' => 'custom', + 'save' => true, + 'value' => $options[ $prefix . 'addl_pages' ], + 'attr' => '', + ) ); + $output = str_replace( "'", "\'", $output ); + $output = str_replace( "\n", '\n', $output ); die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) ); } } -if ( !function_exists( 'aioseop_ajax_delete_url' ) ) { +if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) { + function aioseop_ajax_delete_url() { aioseop_ajax_init(); - $options = Array(); - $options = esc_attr( $_POST['options'] ); + $options = Array(); + $options = esc_attr( $_POST['options'] ); $_POST['action'] = 'aiosp_update_module'; global $aiosp, $aioseop_modules; aioseop_load_modules(); $aiosp->admin_menu(); - $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" ); + $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' ); $_POST['location'] = null; - $_POST['Submit'] = 'ajax'; + $_POST['Submit'] = 'ajax'; $module->add_page_hooks(); - $_POST = (Array)$module->get_current_options( $_POST, null ); - if ( !empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( is_object( $_POST['aiosp_sitemap_addl_pages'] ) ) ) - $_POST['aiosp_sitemap_addl_pages'] = (Array)$_POST['aiosp_sitemap_addl_pages']; - if ( !empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( !empty( $_POST['aiosp_sitemap_addl_pages'][ $options ] ) ) ) { + $_POST = (Array) $module->get_current_options( $_POST, null ); + if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && is_object( $_POST['aiosp_sitemap_addl_pages'] ) ) { + $_POST['aiosp_sitemap_addl_pages'] = (Array) $_POST['aiosp_sitemap_addl_pages']; + } + if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( ! empty( $_POST['aiosp_sitemap_addl_pages'][ $options ] ) ) ) { unset( $_POST['aiosp_sitemap_addl_pages'][ $options ] ); - if ( empty( $_POST['aiosp_sitemap_addl_pages'] ) ) + if ( empty( $_POST['aiosp_sitemap_addl_pages'] ) ) { $_POST['aiosp_sitemap_addl_pages'] = ''; - else + } else { $_POST['aiosp_sitemap_addl_pages'] = json_encode( $_POST['aiosp_sitemap_addl_pages'] ); + } $module->handle_settings_updates( null ); $options = $module->get_current_options( Array(), null ); - $output = $module->display_custom_options( '', Array( 'name' => 'aiosp_sitemap_addl_pages', 'type' => 'custom', 'save' => true, 'value' => $options['aiosp_sitemap_addl_pages'], 'attr' => '' ) ); - $output = str_replace( "'", "\'", $output ); - $output = str_replace( "\n", '\n', $output ); + $output = $module->display_custom_options( '', Array( + 'name' => 'aiosp_sitemap_addl_pages', + 'type' => 'custom', + 'save' => true, + 'value' => $options['aiosp_sitemap_addl_pages'], + 'attr' => '', + ) ); + $output = str_replace( "'", "\'", $output ); + $output = str_replace( "\n", '\n', $output ); } else { - $output = sprintf( __( "Row %s not found; no rows were deleted.", 'all-in-one-seo-pack' ), esc_attr( $options ) ); + $output = sprintf( __( 'Row %s not found; no rows were deleted.', 'all-in-one-seo-pack' ), esc_attr( $options ) ); } die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) ); } } -if ( !function_exists( 'aioseop_ajax_scan_header' ) ) { +if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) { function aioseop_ajax_scan_header() { - $_POST["options"] = "foo"; + $_POST['options'] = 'foo'; aioseop_ajax_init(); $options = Array(); parse_str( $_POST['options'], $options ); - foreach( $options as $k => $v ) $_POST[$k] = $v; - $_POST['action'] = 'aiosp_update_module'; + foreach ( $options as $k => $v ) { + $_POST[ $k ] = $v; + } + $_POST['action'] = 'aiosp_update_module'; $_POST['location'] = null; - $_POST['Submit'] = 'ajax'; + $_POST['Submit'] = 'ajax'; ob_start(); - do_action('wp'); + do_action( 'wp' ); global $aioseop_modules; - $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Opengraph" ); + $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' ); wp_head(); $output = ob_get_clean(); global $aiosp; - $output = $aiosp->html_string_to_array( $output ); - $meta = ''; + $output = $aiosp->html_string_to_array( $output ); + $meta = ''; $metatags = Array( - 'facebook' => Array( 'name' => 'property', 'value' => 'content' ), - 'twitter' => Array( 'name' => 'name', 'value' => 'value' ), - 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' ) + 'facebook' => Array( 'name' => 'property', 'value' => 'content' ), + 'twitter' => Array( 'name' => 'name', 'value' => 'value' ), + 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' ), ); $metadata = Array( - 'facebook' => Array( - 'title' => 'og:title', - 'type' => 'og:type', - 'url' => 'og:url', - 'thumbnail' => 'og:image', - 'sitename' => 'og:site_name', - 'key' => 'fb:admins', - 'description' => 'og:description' - ), - 'google+' => Array( - 'thumbnail' => 'image', - 'title' => 'name', - 'description' => 'description' - ), - 'twitter' => Array( - 'card' => 'twitter:card', - 'url' => 'twitter:url', - 'title' => 'twitter:title', - 'description' => 'twitter:description', - 'thumbnail' => 'twitter:image' - ) + 'facebook' => Array( + 'title' => 'og:title', + 'type' => 'og:type', + 'url' => 'og:url', + 'thumbnail' => 'og:image', + 'sitename' => 'og:site_name', + 'key' => 'fb:admins', + 'description' => 'og:description', + ), + 'google+' => Array( + 'thumbnail' => 'image', + 'title' => 'name', + 'description' => 'description', + ), + 'twitter' => Array( + 'card' => 'twitter:card', + 'url' => 'twitter:url', + 'title' => 'twitter:title', + 'description' => 'twitter:description', + 'thumbnail' => 'twitter:image', + ), ); - if ( !empty( $output ) && !empty( $output['head'] ) && !empty( $output['head']['meta'] ) ) - foreach( $output['head']['meta'] as $v ) - if ( !empty( $v['@attributes'] ) ) { + if ( ! empty( $output ) && ! empty( $output['head'] ) && ! empty( $output['head']['meta'] ) ) { + foreach ( $output['head']['meta'] as $v ) { + if ( ! empty( $v['@attributes'] ) ) { $m = $v['@attributes']; - foreach( $metatags as $type => $tags ) - if ( !empty( $m[$tags['name']] ) && !empty( $m[$tags['value']] ) ) - foreach( $metadata[$type] as $tk => $tv ) - if ( $m[$tags['name']] == $tv ) - $meta .= "" . sprintf( __( 'Duplicate %s Meta'), ucwords( $type ) ) . "" . ucwords( $tk ) . "{$m[$tags['name']]}{$m[$tags['value']]}\n"; + foreach ( $metatags as $type => $tags ) { + if ( ! empty( $m[ $tags['name'] ] ) && ! empty( $m[ $tags['value'] ] ) ) { + foreach ( $metadata[ $type ] as $tk => $tv ) { + if ( $m[ $tags['name'] ] == $tv ) { + $meta .= "" . sprintf( __( 'Duplicate %s Meta' ), ucwords( $type ) ) . '' . ucwords( $tk ) . "{$m[$tags['name']]}{$m[$tags['value']]}\n"; + } + } + } + } } - if ( empty( $meta ) ) $meta = '' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . ''; - else { - $meta = "" . $meta . "
Meta For SiteKind of MetaElement NameElement Value
"; + } + } + if ( empty( $meta ) ) { + $meta = '' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . ''; + } else { + $meta = "" . $meta . '
Meta For SiteKind of MetaElement NameElement Value
'; $meta .= "

" . __( 'What Does This Mean?', 'all-in-one-seo-pack' ) . "

" - . "

" . __( 'All in One SEO Pack has detected that a plugin(s) or theme is also outputting social meta tags on your site.  You can view this social meta in the source code of your site (check your browser help for instructions on how to view source code).', 'all-in-one-seo-pack' ) - . "

" . __( 'You may prefer to use the social meta tags that are being output by the other plugin(s) or theme.  If so, then you should deactivate this Social Meta feature in All in One SEO Pack Feature Manager.', 'all-in-one-seo-pack' ) - . "

" . __( 'You should avoid duplicate social meta tags.  You can use these free tools from Facebook, Google and Twitter to validate your social meta and check for errors:', 'all-in-one-seo-pack' ) . "

"; + . '

' . __( 'All in One SEO Pack has detected that a plugin(s) or theme is also outputting social meta tags on your site. You can view this social meta in the source code of your site (check your browser help for instructions on how to view source code).', 'all-in-one-seo-pack' ) + . '

' . __( 'You may prefer to use the social meta tags that are being output by the other plugin(s) or theme. If so, then you should deactivate this Social Meta feature in All in One SEO Pack Feature Manager.', 'all-in-one-seo-pack' ) + . '

' . __( 'You should avoid duplicate social meta tags. You can use these free tools from Facebook, Google and Twitter to validate your social meta and check for errors:', 'all-in-one-seo-pack' ) . '

'; - foreach( Array( 'https://developers.facebook.com/tools/debug', 'http://www.google.com/webmasters/tools/richsnippets', 'https://dev.twitter.com/docs/cards/validation/validator' ) as $link ) { + foreach ( + Array( + 'https://developers.facebook.com/tools/debug', + 'http://www.google.com/webmasters/tools/richsnippets', + 'https://dev.twitter.com/docs/cards/validation/validator', + ) as $link + ) { $meta .= "{$link}
"; } - $meta .= "

" . __( 'Please refer to the document for each tool for help in using these to debug your social meta.', 'all-in-one-seo-pack' ) . "

"; + $meta .= '

' . __( 'Please refer to the document for each tool for help in using these to debug your social meta.', 'all-in-one-seo-pack' ) . ''; } $output = $meta; $output = str_replace( "'", "\'", $output ); @@ -458,188 +597,273 @@ function aioseop_ajax_scan_header() { } } -if (!function_exists('aioseop_ajax_save_settings')) { +if ( ! function_exists( 'aioseop_ajax_save_settings' ) ) { + function aioseop_ajax_save_settings() { aioseop_ajax_init(); $options = Array(); parse_str( $_POST['options'], $options ); - $_POST = $options; + $_POST = $options; $_POST['action'] = 'aiosp_update_module'; global $aiosp, $aioseop_modules; aioseop_load_modules(); $aiosp->admin_menu(); $module = $aioseop_modules->return_module( $_POST['module'] ); unset( $_POST['module'] ); - if ( empty( $_POST['location'] ) ) $_POST['location'] = null; + if ( empty( $_POST['location'] ) ) { + $_POST['location'] = null; + } $_POST['Submit'] = 'ajax'; $module->add_page_hooks(); $output = $module->handle_settings_updates( $_POST['location'] ); - if( AIOSEOPPRO ){ - $output = '

' . $output . '

'; - }else{ - $output = '

' . $output . '

'; - } + if ( AIOSEOPPRO ) { + $output = '

' . $output . '

'; + } else { + $output = '

' . $output . '

'; + } die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) ); } } -if (!function_exists('aioseop_ajax_get_menu_links')) { +if ( ! function_exists( 'aioseop_ajax_get_menu_links' ) ) { + function aioseop_ajax_get_menu_links() { aioseop_ajax_init(); $options = Array(); parse_str( $_POST['options'], $options ); - $_POST = $options; + $_POST = $options; $_POST['action'] = 'aiosp_update_module'; global $aiosp, $aioseop_modules; aioseop_load_modules(); $aiosp->admin_menu(); - if ( empty( $_POST['location'] ) ) $_POST['location'] = null; + if ( empty( $_POST['location'] ) ) { + $_POST['location'] = null; + } $_POST['Submit'] = 'ajax'; - $modlist = $aioseop_modules->get_loaded_module_list(); - $links = Array(); - $link_list = Array(); - $link = $aiosp->get_admin_links(); - if ( !empty( $link ) ) - foreach( $link as $l ) - if ( !empty( $l ) ) { - if ( empty( $link_list[$l['order']] ) ) $link_list[$l['order']] = Array(); - $link_list[$l['order']][$l['title']] = $l['href']; + $modlist = $aioseop_modules->get_loaded_module_list(); + $links = Array(); + $link_list = Array(); + $link = $aiosp->get_admin_links(); + if ( ! empty( $link ) ) { + foreach ( $link as $l ) { + if ( ! empty( $l ) ) { + if ( empty( $link_list[ $l['order'] ] ) ) { + $link_list[ $l['order'] ] = Array(); + } + $link_list[ $l['order'] ][ $l['title'] ] = $l['href']; } - if ( !empty( $modlist ) ) - foreach( $modlist as $k => $v ) { + } + } + if ( ! empty( $modlist ) ) { + foreach ( $modlist as $k => $v ) { $mod = $aioseop_modules->return_module( $v ); if ( is_object( $mod ) ) { $mod->add_page_hooks(); $link = $mod->get_admin_links(); - foreach( $link as $l ) - if ( !empty( $l ) ) { - if ( empty( $link_list[$l['order']] ) ) $link_list[$l['order']] = Array(); - $link_list[$l['order']][$l['title']] = $l['href']; + foreach ( $link as $l ) { + if ( ! empty( $l ) ) { + if ( empty( $link_list[ $l['order'] ] ) ) { + $link_list[ $l['order'] ] = Array(); + } + $link_list[ $l['order'] ][ $l['title'] ] = $l['href']; } + } } } - if ( !empty( $link_list ) ) { + } + if ( ! empty( $link_list ) ) { ksort( $link_list ); - foreach( $link_list as $ll ) - foreach( $ll as $k => $v ) - $links[$k] = $v; - } - $output = "
    "; - if ( !empty( $links ) ) - foreach( $links as $k => $v ) { - if ( $k == "Feature Manager" ) + foreach ( $link_list as $ll ) { + foreach ( $ll as $k => $v ) { + $links[ $k ] = $v; + } + } + } + $output = '
      '; + if ( ! empty( $links ) ) { + foreach ( $links as $k => $v ) { + if ( $k === 'Feature Manager' ) { $current = ' class="current"'; - else + } else { $current = ''; - $output .= "" . esc_attr( $k ) . ""; + } + $output .= "" . esc_attr( $k ) . ''; } - $output .= "
    "; - die( sprintf( "jQuery('{$_POST['target']}').fadeOut('fast', function(){jQuery('{$_POST['target']}').html('%s').fadeIn('fast');});", addslashes( $output ) )); + } + $output .= '
'; + die( sprintf( "jQuery('{$_POST['target']}').fadeOut('fast', function(){jQuery('{$_POST['target']}').html('%s').fadeIn('fast');});", addslashes( $output ) ) ); } } -if ( !function_exists( 'aioseop_mrt_pccolumn' ) ) { - function aioseop_mrt_pccolumn($aioseopcn, $aioseoppi) { - $id = $aioseoppi; +if ( ! function_exists( 'aioseop_mrt_pccolumn' ) ) { + + /** + * @param $aioseopcn + * @param $aioseoppi + */ + function aioseop_mrt_pccolumn( $aioseopcn, $aioseoppi ) { + $id = $aioseoppi; $target = null; - if( $aioseopcn == 'seotitle' ) $target = 'title'; - if( $aioseopcn == 'seokeywords' ) $target = 'keywords'; - if( $aioseopcn == 'seodesc' ) $target = 'description'; - if ( !$target ) return; - if( current_user_can( 'edit_post', $id ) ) { ?> + if ( $aioseopcn === 'seotitle' ) { + $target = 'title'; + } + if ( $aioseopcn === 'seokeywords' ) { + $target = 'keywords'; + } + if ( $aioseopcn === 'seodesc' ) { + $target = 'description'; + } + if ( ! $target ) { + return; + } + if ( current_user_can( 'edit_post', $id ) ) { ?>
-
- " . $content . ''; - else: - $label = "" . __( 'No', 'all-in-one-seo-pack' ) . " " . $target . ''; - endif; +
+ " . $content . ''; + else: + $label = "" . __( 'No', 'all-in-one-seo-pack' ) . ' ' . $target . ''; + endif; $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$id}" ); echo '' - . "' + . " " . $label; - ?> + ?>
$v ) { - $excluded[$k] = trim( $v ); - if ( empty( $excluded[$k] ) ) unset( $excluded[$k] ); + if ( ! empty( $excluded ) ) { + foreach ( $excluded as $k => $v ) { + $excluded[ $k ] = trim( $v ); + if ( empty( $excluded[ $k ] ) ) { + unset( $excluded[ $k ] ); + } } - if ( empty( $excluded ) ) $excluded = null; + } + if ( empty( $excluded ) ) { + $excluded = null; + } } } - if ( !empty( $excluded ) ) { - if ( $url === null ) + if ( ! empty( $excluded ) ) { + if ( $url === null ) { $url = $_SERVER['REQUEST_URI']; - else { + } else { $url = parse_url( $url ); - if ( !empty( $url['path'] ) ) + if ( ! empty( $url['path'] ) ) { $url = $url['path']; - else + } else { return false; + } + } + if ( ! empty( $url ) ) { + foreach ( $excluded as $exedd ) { + if ( $exedd && ( stripos( $url, $exedd ) !== false ) ) { + return true; + } + } } - if ( !empty( $url ) ) - foreach( $excluded as $exedd ) - if ( ( $exedd ) && ( stripos( $url, $exedd ) !== FALSE ) ) - return true; } + return false; } } -if ( !function_exists( 'aioseop_get_pages_start' ) ) { +if ( ! function_exists( 'aioseop_get_pages_start' ) ) { + + /** + * @param $excludes + * + * @return mixed + */ function aioseop_get_pages_start( $excludes ) { global $aioseop_get_pages_start; $aioseop_get_pages_start = 1; + return $excludes; } } -if ( !function_exists( 'aioseop_get_pages' ) ) { +if ( ! function_exists( 'aioseop_get_pages' ) ) { + + /** + * @param $pages + * + * @return mixed + */ function aioseop_get_pages( $pages ) { global $aioseop_get_pages_start; - if ( !$aioseop_get_pages_start ) return $pages; + if ( ! $aioseop_get_pages_start ) { + return $pages; + } foreach ( $pages as $k => $v ) { - $postID = $v->ID; + $postID = $v->ID; $menulabel = stripslashes( get_post_meta( $postID, '_aioseop_menulabel', true ) ); - if ( $menulabel ) $pages[$k]->post_title = $menulabel; + if ( $menulabel ) { + $pages[ $k ]->post_title = $menulabel; + } } $aioseop_get_pages_start = 0; + return $pages; } } // The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/. -if ( !function_exists( 'aioseop_list_pages' ) ) { +if ( ! function_exists( 'aioseop_list_pages' ) ) { + /** + * Adds stuff to the HTML in list_pages. + * @TODO See if we still use, or even want, these functions. + * + * @param $content + * + * @return mixed + */ function aioseop_list_pages( $content ) { global $wp_version; $matches = array(); @@ -651,45 +875,73 @@ function aioseop_list_pages( $content ) { } else { $pattern = '@
  • @is'; } - return preg_replace_callback( $pattern, "aioseop_filter_callback", $content ); + + return preg_replace_callback( $pattern, 'aioseop_filter_callback', $content ); } + return $content; } } -if ( !function_exists( 'aioseop_filter_callback' ) ) { +if ( ! function_exists( 'aioseop_filter_callback' ) ) { + + /** + * @param $matches + * + * @return string + */ function aioseop_filter_callback( $matches ) { - if ( $matches[1] && !empty( $matches[1] ) ) $postID = $matches[1]; - if ( empty( $postID ) ) $postID = get_option( "page_on_front" ); - $title_attrib = stripslashes( get_post_meta($postID, '_aioseop_titleatr', true ) ); - if ( empty( $title_attrib ) && !empty( $matches[4] ) ) $title_attrib = $matches[4]; - if ( !empty( $title_attrib ) ) $title_attrib = ' title="' . strip_tags( $title_attrib ) . '"'; - return '
  • '; + if ( $matches[1] && ! empty( $matches[1] ) ) { + $postID = $matches[1]; + } + if ( empty( $postID ) ) { + $postID = get_option( 'page_on_front' ); + } + $title_attrib = stripslashes( get_post_meta( $postID, '_aioseop_titleatr', true ) ); + if ( empty( $title_attrib ) && ! empty( $matches[4] ) ) { + $title_attrib = $matches[4]; + } + if ( ! empty( $title_attrib ) ) { + $title_attrib = ' title="' . strip_tags( $title_attrib ) . '"'; + } + + return '
  • '; } } -if ( !function_exists( 'aioseop_add_contactmethods' ) ) { +if ( ! function_exists( 'aioseop_add_contactmethods' ) ) { + + /** + * @param $contactmethods + * + * @return mixed + */ function aioseop_add_contactmethods( $contactmethods ) { global $aioseop_options, $aioseop_modules; - if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) ) + if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) ) { $contactmethods['googleplus'] = __( 'Google+', 'all-in-one-seo-pack' ); - if ( !empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) { + } + if ( ! empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) { $m = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' ); if ( ( $m !== false ) && is_object( $m ) ) { - if ( $m->option_isset( 'twitter_creator' ) ) + if ( $m->option_isset( 'twitter_creator' ) ) { $contactmethods['twitter'] = __( 'Twitter', 'all-in-one-seo-pack' ); - if ( $m->option_isset( 'facebook_author' ) ) + } + if ( $m->option_isset( 'facebook_author' ) ) { $contactmethods['facebook'] = __( 'Facebook', 'all-in-one-seo-pack' ); + } } } + return $contactmethods; } } -if ( !function_exists( 'aioseop_localize_script_data' ) ) { +if ( ! function_exists( 'aioseop_localize_script_data' ) ) { + function aioseop_localize_script_data() { static $loaded = 0; - if ( !$loaded ) { + if ( ! $loaded ) { $data = apply_filters( 'aioseop_localize_script_data', Array() ); wp_localize_script( 'aioseop-module-script', 'aiosp_data', $data ); $loaded = 1; @@ -697,98 +949,160 @@ function aioseop_localize_script_data() { } } -/*** - * Utility function for inserting elements into associative arrays by key - */ -if ( !function_exists( 'aioseop_array_insert_after' ) ) { +if ( ! function_exists( 'aioseop_array_insert_after' ) ) { + /** + * Utility function for inserting elements into associative arrays by key. + * + * @param $arr + * @param $insertKey + * @param $newValues + * + * @return array + */ function aioseop_array_insert_after( $arr, $insertKey, $newValues ) { - $keys = array_keys($arr); - $vals = array_values($arr); - $insertAfter = array_search($insertKey, $keys) + 1; - $keys2 = array_splice($keys, $insertAfter); - $vals2 = array_splice($vals, $insertAfter); - foreach( $newValues as $k => $v ) { - $keys[] = $k; - $vals[] = $v; - } - return array_merge(array_combine($keys, $vals), array_combine($keys2, $vals2)); + $keys = array_keys( $arr ); + $vals = array_values( $arr ); + $insertAfter = array_search( $insertKey, $keys ) + 1; + $keys2 = array_splice( $keys, $insertAfter ); + $vals2 = array_splice( $vals, $insertAfter ); + foreach ( $newValues as $k => $v ) { + $keys[] = $k; + $vals[] = $v; + } + + return array_merge( array_combine( $keys, $vals ), array_combine( $keys2, $vals2 ) ); } } -/*** - * JSON support for PHP < 5.2 - */ -if ( !function_exists( 'aioseop_load_json_services' ) ) { +if ( ! function_exists( 'aioseop_load_json_services' ) ) { + /** + * JSON support for PHP < 5.2. + * + * @TODO Do we really need to support < PHP 5.2 with the following functions?? + * @return null|Services_JSON + */ function aioseop_load_json_services() { static $services_json = null; - if ( $services_json ) return $services_json; - if ( !class_exists( 'Services_JSON' ) ) require_once( 'inc/extlib/JSON.php' ); - if ( !$services_json ) $services_json = new Services_JSON(); + if ( $services_json ) { + return $services_json; + } + if ( ! class_exists( 'Services_JSON' ) ) { + require_once( 'inc/extlib/JSON.php' ); + } + if ( ! $services_json ) { + $services_json = new Services_JSON(); + } + return $services_json; } } -if ( !function_exists( 'json_encode' ) ) { +if ( ! function_exists( 'json_encode' ) ) { + + /** + * @param $arg + * + * @return mixed + */ function json_encode( $arg ) { $services_json = aioseop_load_json_services(); + return $services_json->encode( $arg ); } } -if ( !function_exists( 'json_decode' ) ) { +if ( ! function_exists( 'json_decode' ) ) { + + /** + * @param $arg + * + * @return mixed + */ function json_decode( $arg ) { $services_json = aioseop_load_json_services(); + return $services_json->decode( $arg ); } } -/*** - * fnmatch() doesn't exist on Windows pre PHP 5.3 - */ -if( !function_exists( 'fnmatch' ) ) { - function fnmatch( $pattern, $string ) { - return preg_match( "#^" . strtr( preg_quote( $pattern, '#' ), array( '\*' => '.*', '\?' => '.' ) ) . "$#i", $string ); - } +if ( ! function_exists( 'fnmatch' ) ) { + /** + * Support for fnmatch() doesn't exist on Windows pre PHP 5.3. + * + * @param $pattern + * @param $string + * + * @return int + */ + function fnmatch( $pattern, $string ) { + return preg_match( '#^' . strtr( preg_quote( $pattern, '#' ), array( + '\*' => '.*', + '\?' => '.', + ) ) . "$#i", $string ); + } } -/*** - * parse_ini_string() doesn't exist pre PHP 5.3 - */ -if ( !function_exists( 'parse_ini_string' ) ) { +if ( ! function_exists( 'parse_ini_string' ) ) { + /** + * Parse_ini_string() doesn't exist pre PHP 5.3. + * + * @param $string + * @param $process_sections + * + * @return array|bool + */ function parse_ini_string( $string, $process_sections ) { - if ( !class_exists( 'parse_ini_filter' ) ) { - /* Define our filter class */ + + if ( ! class_exists( 'parse_ini_filter' ) ) { + + /** + * Class parse_ini_filter + * + * Define our filter class. + */ class parse_ini_filter extends php_user_filter { static $buf = ''; + + /** + * The actual filter for parsing. + * + * @param $in + * @param $out + * @param $consumed + * @param $closing + * + * @return int + */ function filter( $in, $out, &$consumed, $closing ) { - $bucket = stream_bucket_new( fopen('php://memory', 'wb'), self::$buf ); + $bucket = stream_bucket_new( fopen( 'php://memory', 'wb' ), self::$buf ); stream_bucket_append( $out, $bucket ); + return PSFS_PASS_ON; } } - /* Register our filter with PHP */ - if ( !stream_filter_register("parse_ini", "parse_ini_filter") ) + + // Register our filter with PHP. + if ( ! stream_filter_register( 'parse_ini', 'parse_ini_filter' ) ) { return false; + } } parse_ini_filter::$buf = $string; - return parse_ini_file( "php://filter/read=parse_ini/resource=php://memory", $process_sections ); + + return parse_ini_file( 'php://filter/read=parse_ini/resource=php://memory', $process_sections ); } } -function aioseop_update_user_visibilitynotice(){ +function aioseop_update_user_visibilitynotice() { update_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true ); +} - } - -function aioseop_update_yst_detected_notice(){ +function aioseop_update_yst_detected_notice() { update_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true ); +} - } - -function aioseop_woo_upgrade_notice_dismissed(){ +function aioseop_woo_upgrade_notice_dismissed() { update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true ); - - } \ No newline at end of file +} diff --git a/wp-content/plugins/all-in-one-seo-pack/inc/aioseop_updates_class.php b/wp-content/plugins/all-in-one-seo-pack/inc/aioseop_updates_class.php index 9736a96830..e767e01072 100755 --- a/wp-content/plugins/all-in-one-seo-pack/inc/aioseop_updates_class.php +++ b/wp-content/plugins/all-in-one-seo-pack/inc/aioseop_updates_class.php @@ -1,176 +1,212 @@ -do_version_updates( $last_active_version ); - - // If we're running Pro, let the Pro updater set the version. - if ( !AIOSEOPPRO ) { - // Save the current plugin version as the new last_active_version - $aioseop_options['last_active_version'] = AIOSEOP_VERSION; - $aiosp->update_class_option( $aioseop_options ); - } - } - - /** - * Perform updates that are dependent on external factors, not - * just the plugin version. - */ - $this->do_feature_updates(); - - } - - //TODO: the compare here should be extracted into a function - function do_version_updates( $old_version ) { - global $aioseop_options; - - if ( - ( !AIOSEOPPRO && version_compare( $old_version, '2.3.3', '<' ) ) || - ( AIOSEOPPRO && version_compare( $old_version, '2.4.3', '<' ) ) - ) { - $this->bad_bots_201603(); - } - - if ( - ( !AIOSEOPPRO && version_compare( $old_version, '2.3.4.1', '<' ) ) || - ( AIOSEOPPRO && version_compare( $old_version, '2.4.4.1', '<' ) ) - ) { - $this->bad_bots_remove_yandex_201604(); - } - - - /* - if ( - ( !AIOSEOPPRO && version_compare( $old_version, '2.4', '<' ) ) || - ( AIOSEOPPRO && version_compare( $old_version, '2.5', '<' ) ) - ) { - // Do changes needed for 2.4/2.5... etc - } - */ - } - - function do_feature_updates() { - global $aioseop_options; - - // We don't need to check all the time. Use a transient to limit frequency. - if ( get_site_transient( 'aioseop_update_check_time' ) ) return; - - // If we're running Pro, let the Pro updater set the transient. - if ( !AIOSEOPPRO ) { - // We haven't checked recently. Reset the timestamp, timeout 6 hours. - set_site_transient( 'aioseop_update_check_time', time(), apply_filters( 'aioseop_update_check_time', 3600 * 6 ) ); - } - - /* - if ( ! ( isset( $aioseop_options['version_feature_flags']['FEATURE_NAME'] ) && - $aioseop_options['version_feature_flags']['FEATURE_NAME'] === 'yes' ) ) { - $this->some_feature_update_method(); // sets flag to 'yes' on completion. - } - */ - } - - /* - * Functions for specific version milestones - */ - - /** - * Remove overzealous 'DOC' entry which is causing false-positive bad - * bot blocking. - * - * @since 2.3.3 - * - */ - function bad_bots_201603() { - global $aiosp, $aioseop_options; - // Remove 'DOC' from bad bots list to avoid false positives - if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) { - $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist']; - $list = str_replace(array( "DOC\r\n", "DOC\n"), '', $list); - $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list; - update_option( 'aioseop_options', $aioseop_options ); - $aiosp->update_class_option( $aioseop_options ); - - if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ){ - - if (!class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) { - require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php'); - require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php'); - } - - $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots; - $aiosp_reset_htaccess->generate_htaccess_blocklist(); - } - - if ( !isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ){ - insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' ); - } - } - } - - /** - * Remove 'yandex' entry. This is a major Russian search engine, and no longer needs to be blocked. - * - * @since 2.3.4.1 - * - **/ - - function bad_bots_remove_yandex_201604() { - global $aiosp, $aioseop_options; - // Remove 'yandex' from bad bots list to avoid false positives - if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) { - $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist']; - $list = str_replace(array( "yandex\r\n", "yandex\n"), '', $list); - $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list; - update_option( 'aioseop_options', $aioseop_options ); - $aiosp->update_class_option( $aioseop_options ); - - if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ){ - - if (!class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) { - require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php'); - require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php'); - } - - $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots; - $aiosp_reset_htaccess->generate_htaccess_blocklist(); - } - - if ( !isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ){ - insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' ); - } - } - } - - -} +do_version_updates( $last_active_version ); + do_action( 'after_doing_aioseop_updates' ); + // If we're running Pro, let the Pro updater set the version. + if ( ! AIOSEOPPRO ) { + + // Save the current plugin version as the new last_active_version. + $aioseop_options['last_active_version'] = AIOSEOP_VERSION; + $aiosp->update_class_option( $aioseop_options ); + } + } + + /** + * Perform updates that are dependent on external factors, not + * just the plugin version. + */ + $this->do_feature_updates(); + } + + + /** + * Updates version. + * + * TODO: the compare here should be extracted into a function + * + * @since 1.0.0 + * @global $aioseop_options . + * + * @param String $old_version + */ + function do_version_updates( $old_version ) { + global $aioseop_options; + if ( + ( ! AIOSEOPPRO && version_compare( $old_version, '2.3.3', '<' ) ) || + ( AIOSEOPPRO && version_compare( $old_version, '2.4.3', '<' ) ) + ) { + $this->bad_bots_201603(); + } + + if ( + ( ! AIOSEOPPRO && version_compare( $old_version, '2.3.4.1', '<' ) ) || + ( AIOSEOPPRO && version_compare( $old_version, '2.4.4.1', '<' ) ) + ) { + $this->bad_bots_remove_yandex_201604(); + } + + } + + /** + * Removes overzealous 'DOC' entry which is causing false-positive bad + * bot blocking. + + * @since 2.3.3 + * @global $aiosp , $aioseop_options. + */ + function bad_bots_201603() { + global $aiosp, $aioseop_options; + + // Remove 'DOC' from bad bots list to avoid false positives. + if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) { + $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist']; + $list = str_replace( array( + "DOC\r\n", + "DOC\n", + ), '', $list ); + $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list; + update_option( 'aioseop_options', $aioseop_options ); + $aiosp->update_class_option( $aioseop_options ); + if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) + && 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] + ) { + if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) { + require_once( + AIOSEOP_PLUGIN_DIR . + 'admin/aioseop_module_class.php' + ); + require_once( + AIOSEOP_PLUGIN_DIR . + 'modules/aioseop_bad_robots.php' + ); + } + $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots; + $aiosp_reset_htaccess->generate_htaccess_blocklist(); + } + if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) + && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) + ) { + insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' ); + } + } + } + + /* + * Functions for specific version milestones. + */ + + /** + * Remove 'yandex' entry. This is a major Russian search engine, and no longer needs to be blocked. + * + * @since 2.3.4.1 + * @global $aiosp , $aioseop_options. + */ + function bad_bots_remove_yandex_201604() { + global $aiosp, $aioseop_options; + + // Remove 'yandex' from bad bots list to avoid false positives. + if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) { + $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist']; + $list = str_replace( array( + "yandex\r\n", + "yandex\n", + ), '', $list ); + $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list; + update_option( 'aioseop_options', $aioseop_options ); + $aiosp->update_class_option( $aioseop_options ); + + if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) { + + if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) { + require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' ); + require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php' ); + } + + $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots; + $aiosp_reset_htaccess->generate_htaccess_blocklist(); + } + + if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ) { + insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' ); + } + } + } + + /** + * Updates features. + + * @since 1.0.0 + * @return null + * + * if ( ! ( isset( $aioseop_options['version_feature_flags']['FEATURE_NAME'] ) && + * $aioseop_options['version_feature_flags']['FEATURE_NAME'] === 'yes' ) ) { + * $this->some_feature_update_method(); // sets flag to 'yes' on completion. + */ + public function do_feature_updates() { + global $aioseop_options; + + // We don't need to check all the time. Use a transient to limit frequency. + if ( get_site_transient( 'aioseop_update_check_time' ) ) { + return; + } + + // If we're running Pro, let the Pro updater set the transient. + if ( ! AIOSEOPPRO ) { + + // We haven't checked recently. Reset the timestamp, timeout 6 hours. + set_site_transient( + 'aioseop_update_check_time', + time(), + apply_filters( 'aioseop_update_check_time', 3600 * 6 ) + ); + } + } +} diff --git a/wp-content/plugins/all-in-one-seo-pack/inc/aiosp_common.php b/wp-content/plugins/all-in-one-seo-pack/inc/aiosp_common.php index ab6f4eb1d2..179f970dcd 100644 --- a/wp-content/plugins/all-in-one-seo-pack/inc/aiosp_common.php +++ b/wp-content/plugins/all-in-one-seo-pack/inc/aiosp_common.php @@ -3,55 +3,85 @@ /** * @package All-in-One-SEO-Pack */ - class aiosp_common { - - function __construct(){ + + /** + * aiosp_common constructor. + * + * These are commonly used functions that can be pulled from anywhere. + * (or in some cases they're functions waiting for a home) + * + */ + function __construct() { //construct } - - + + + /** + * @param null $p + * + * @return array|null|string|WP_Post + */ static function get_blog_page( $p = null ) { static $blog_page = ''; static $page_for_posts = ''; - if ( $p === null ) { + if ( null === $p ) { global $post; } else { $post = $p; } - if ( $blog_page === '' ) { - if ( $page_for_posts === '' ) $page_for_posts = get_option( 'page_for_posts' ); - if ( $page_for_posts && is_home() && ( !is_object( $post ) || ( $page_for_posts != $post->ID ) ) ) + if ( '' === $blog_page ) { + if ( '' === $page_for_posts ) { + $page_for_posts = get_option( 'page_for_posts' ); + } + if ( $page_for_posts && is_home() && ( ! is_object( $post ) || ( $page_for_posts !== $post->ID ) ) ) { $blog_page = get_post( $page_for_posts ); + } } + return $blog_page; } - - static function get_upgrade_hyperlink( $location = '', $title = '', $anchor = '', $target = '', $class = '', $id = '' ){ - + + /** + * @param string $location + * @param string $title + * @param string $anchor + * @param string $target + * @param string $class + * @param string $id + * + * @return string + */ + static function get_upgrade_hyperlink( $location = '', $title = '', $anchor = '', $target = '', $class = '', $id = '' ) { + $affiliate_id = ''; - - //call during plugins_loaded - $affiliate_id = apply_filters( 'aiosp_aff_id' , $affiliate_id ); + //call during plugins_loaded + $affiliate_id = apply_filters( 'aiosp_aff_id', $affiliate_id ); //build URL $url = 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/'; - if( $location ) $url .= '?loc=' . $location; - if( $affiliate_id ) $url .= "?ap_id=$affiliate_id"; - - - //build hyperlink + if ( $location ) { + $url .= '?loc=' . $location; + } + if ( $affiliate_id ) { + $url .= "?ap_id=$affiliate_id"; + } + + //build hyperlink $hyperlink = '$title"; + if ( $target ) { + $hyperlink .= "target=\"$target\" "; + } + if ( $title ) { + $hyperlink .= "title=\"$title\" "; + } + $hyperlink .= "href=\"$url\">$anchor"; return $hyperlink; } - - static function get_upgrade_url(){ + + static function get_upgrade_url() { //put build URL stuff in here } - -} \ No newline at end of file +} diff --git a/wp-content/plugins/all-in-one-seo-pack/inc/commonstrings.php b/wp-content/plugins/all-in-one-seo-pack/inc/commonstrings.php index 54c7617faa..510060df45 100644 --- a/wp-content/plugins/all-in-one-seo-pack/inc/commonstrings.php +++ b/wp-content/plugins/all-in-one-seo-pack/inc/commonstrings.php @@ -1,38 +1,41 @@ load_compatibility_classes(); + + } + + /** + * Load Compatibility Hooks. + * + * @since 2.3.6 + */ + public function load_compatibility_hooks() { + // We'll use this until we set up our classes. + if ( class_exists( 'jetpack' ) ) { + add_filter( 'jetpack_get_available_modules', array( $this, 'remove_jetpack_sitemap' ) ); + add_filter( 'jetpack_site_verification_output', array( + $this, + 'filter_jetpack_site_verification_output', + ), 10, 1 ); + } + } + + /** + * Filter Jetpack's site verification. + * + * If we have a value for a particular verification, use ours. + * + * @param $ver_tag + * + * @since 2.3.7 + * + * @return string + */ + function filter_jetpack_site_verification_output( $ver_tag ) { + + global $aioseop_options; + + if ( isset( $aioseop_options['aiosp_pinterest_verify'] ) && ! empty( $aioseop_options['aiosp_pinterest_verify'] ) && strpos( $ver_tag, 'p:domain_verify' ) ) { + return ''; + + } + + if ( isset( $aioseop_options['aiosp_google_verify'] ) && ! empty( $aioseop_options['aiosp_google_verify'] ) && strpos( $ver_tag, 'google-site-verification' ) ) { + return ''; + } + + if ( isset( $aioseop_options['aiosp_bing_verify'] ) && ! empty( $aioseop_options['aiosp_bing_verify'] ) && strpos( $ver_tag, 'msvalidate.01' ) ) { + return ''; + } + + return $ver_tag; + + } + + /** + * Remove Jetpack's sitemap. + * + * @param array $modules All the Jetpack modules. + * + * @since 2.3.6 + * @since 2.3.6.1 Make sure we only disable Jetpack's sitemap if they're using ours. + * + * @return array + */ + public function remove_jetpack_sitemap( $modules ) { + + global $aioseop_options; + // Check if AIOSEOP's sitemap exists. + if ( isset( $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) && $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] === 'on' ) { + unset( $modules['sitemaps'] ); // Remove Jetpack's sitemap. + } + + return $modules; + } + + /** + * Load Compatibility classes. + * + * @since 2.3.6 + */ + public function load_compatibility_classes() { + // Eventually we'll load our other classes from here. + $this->load_compatibility_hooks(); + } + } + +} + +$aiosp_compat = new All_in_One_SEO_Pack_Compatibility(); diff --git a/wp-content/plugins/all-in-one-seo-pack/inc/deprecated.php b/wp-content/plugins/all-in-one-seo-pack/inc/deprecated.php index 9744acb3bc..8abc683006 100644 --- a/wp-content/plugins/all-in-one-seo-pack/inc/deprecated.php +++ b/wp-content/plugins/all-in-one-seo-pack/inc/deprecated.php @@ -1,46 +1,53 @@ token = "anonymous"; - $this->secret = "anonymous"; - $preload = $this->get_class_option(); - $manual_ua = ''; - if ( !empty( $_POST ) ) { - if ( !empty( $_POST["{$this->prefix}google_connect"] ) ) { + if ( ! is_user_logged_in() || ! current_user_can( 'aiosp_manage_seo' ) ) { + return false; + } + $this->token = 'anonymous'; + $this->secret = 'anonymous'; + $preload = $this->get_class_option(); + $manual_ua = ''; + if ( ! empty( $_POST ) ) { + if ( ! empty( $_POST[ "{$this->prefix}google_connect" ] ) ) { $manual_ua = 1; } - } elseif ( !empty( $preload["{$this->prefix}google_connect"] ) ) { + } elseif ( ! empty( $preload[ "{$this->prefix}google_connect" ] ) ) { $manual_ua = 1; } - if ( !empty( $manual_ua ) ) { - foreach ( Array( "token", "secret", "access_token", "ga_token", "account_cache" ) as $v ) { - if ( !empty( $preload["{$this->prefix}{$v}"]) ) { - unset( $preload["{$this->prefix}{$v}"] ); - unset( $this->$v ); - } + if ( ! empty( $manual_ua ) ) { + foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) { + if ( ! empty( $preload[ "{$this->prefix}{$v}" ] ) ) { + unset( $preload[ "{$this->prefix}{$v}" ] ); + unset( $this->$v ); } - $this->update_class_option( $preload ); - $this->update_options( ); -// return; + } + $this->update_class_option( $preload ); + $this->update_options(); + //return; } - foreach ( Array( "token", "secret", "access_token", "ga_token", "account_cache" ) as $v ) { - if ( !empty( $preload["{$this->prefix}{$v}"]) ) { - $this->$v = $preload["{$this->prefix}{$v}"]; + foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) { + if ( ! empty( $preload[ "{$this->prefix}{$v}" ] ) ) { + $this->$v = $preload[ "{$this->prefix}{$v}" ]; } } - $callback_url = NULL; - if ( !empty( $_REQUEST['oauth_verifier'] ) ) { + $callback_url = null; + if ( ! empty( $_REQUEST['oauth_verifier'] ) ) { $this->verifier = $_REQUEST['oauth_verifier']; - if ( !empty( $_REQUEST['oauth_token'] ) ) { - if ( isset( $this->token ) && $this->token == $_REQUEST['oauth_token'] ) { + if ( ! empty( $_REQUEST['oauth_token'] ) ) { + if ( isset( $this->token ) && $this->token === $_REQUEST['oauth_token'] ) { $this->access_token = $this->oauth_get_token( $this->verifier ); - if ( is_array( $this->access_token ) && !empty( $this->access_token['oauth_token'] ) ) { + if ( is_array( $this->access_token ) && ! empty( $this->access_token['oauth_token'] ) ) { unset( $this->token ); unset( $this->secret ); $this->ga_token = $this->access_token['oauth_token']; - foreach ( Array( "token", "secret", "access_token", "ga_token" ) as $v ) { - if ( !empty( $this->$v) ) $preload["{$this->prefix}{$v}"] = $this->$v; + foreach ( array( 'token', 'secret', 'access_token', 'ga_token' ) as $v ) { + if ( ! empty( $this->$v ) ) { + $preload[ "{$this->prefix}{$v}" ] = $this->$v; + } } $this->update_class_option( $preload ); } @@ -49,49 +56,56 @@ function oauth_init() { exit; } } - if ( !empty( $this->ga_token ) ) { - if ( !empty( $this->account_cache ) ) { - $ua = $this->account_cache['ua']; + if ( ! empty( $this->ga_token ) ) { + if ( ! empty( $this->account_cache ) ) { + $ua = $this->account_cache['ua']; $profiles = $this->account_cache['profiles']; } else { - $this->token = $this->access_token['oauth_token']; + $this->token = $this->access_token['oauth_token']; $this->secret = $this->access_token['oauth_token_secret']; - $data = $this->oauth_get_data('https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' ); + $data = $this->oauth_get_data( 'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' ); $http_code = wp_remote_retrieve_response_code( $data ); - if( $http_code == 200 ) { + if ( 200 === $http_code ) { $response = wp_remote_retrieve_body( $data ); - $xml = $this->xml_string_to_array( $response ); - $ua = Array(); - $profiles = Array(); - if ( !empty( $xml["entry"] ) ) { - $rec = Array(); - $results = Array(); - if ( !empty( $xml["entry"][0] ) ) - $results = $xml["entry"]; - else - $results[] = $xml["entry"]; - foreach( $results as $r ) { - foreach( $r as $k => $v ) - switch( $k ) { - case 'id': $rec['id'] = $v; break; - case 'title': $rec['title'] = $v['@content']; break; + $xml = $this->xml_string_to_array( $response ); + $ua = array(); + $profiles = array(); + if ( ! empty( $xml['entry'] ) ) { + $rec = array(); + $results = array(); + if ( ! empty( $xml['entry'][0] ) ) { + $results = $xml['entry']; + } else { + $results[] = $xml['entry']; + } + foreach ( $results as $r ) { + foreach ( $r as $k => $v ) + switch ( $k ) { + case 'id': + $rec['id'] = $v; + break; + case 'title': + $rec['title'] = $v['@content']; + break; case 'dxp:property': - $attr = Array(); - foreach ( $v as $a => $f ) - if ( is_array($f) && !empty($f['@attributes'] ) ) - $rec[$f['@attributes']['name']] = $f['@attributes']['value']; - break; + $attr = array(); + foreach ( $v as $a => $f ) { + if ( is_array( $f ) && ! empty( $f['@attributes'] ) ) { + $rec[ $f['@attributes']['name'] ] = $f['@attributes']['value']; + } + } + break; } - $ua[$rec['title']] = Array( $rec['ga:webPropertyId'] => $rec['ga:webPropertyId'] ); + $ua[ $rec['title'] ] = array( $rec['ga:webPropertyId'] => $rec['ga:webPropertyId'] ); $profiles[ $rec['ga:webPropertyId'] ] = $rec['ga:profileId']; } } - $this->account_cache = Array(); - $this->account_cache['ua'] = $ua; - $this->account_cache['profiles'] = $profiles; + $this->account_cache = array(); + $this->account_cache['ua'] = $ua; + $this->account_cache['profiles'] = $profiles; $preload["{$this->prefix}account_cache"] = $this->account_cache; } else { unset( $this->token ); @@ -99,116 +113,173 @@ function oauth_init() { unset( $this->ga_token ); unset( $preload["{$this->prefix}ga_token"] ); // error condition here -- pdb $response = wp_remote_retrieve_body( $data ); - $xml = $this->xml_string_to_array( $response ); - if ( !empty( $xml ) && !empty( $xml["error"] ) ) { + $xml = $this->xml_string_to_array( $response ); + if ( ! empty( $xml ) && ! empty( $xml['error'] ) ) { $error = 'Error: '; - if ( !empty( $xml["error"]["internalReason"] ) ) { - $error .= $xml["error"]["internalReason"]; + if ( ! empty( $xml['error']['internalReason'] ) ) { + $error .= $xml['error']['internalReason']; } else { - foreach( $xml["error"] as $k => $v ) + foreach ( $xml['error'] as $k => $v ) { $error .= "$k: $v\n"; + } } $this->output_error( $error ); } } } } - if ( !empty( $this->ga_token ) ) { - $this->default_options["google_analytics_id"]['type'] = 'select'; - $this->default_options["google_analytics_id"]['initial_options'] = $ua; - $this->default_options["google_connect"]["type"] = 'html'; - $this->default_options["google_connect"]["nolabel"] = 1; - $this->default_options["google_connect"]["save"] = true; - $this->default_options["google_connect"]["name"] = __( 'Disconnect From Google Analytics', 'all-in-one-seo-pack' ); - $this->default_options["google_connect"]["default"] = ""; + if ( ! empty( $this->ga_token ) ) { + $this->default_options['google_analytics_id']['type'] = 'select'; + $this->default_options['google_analytics_id']['initial_options'] = $ua; + $this->default_options['google_connect']['type'] = 'html'; + $this->default_options['google_connect']['nolabel'] = 1; + $this->default_options['google_connect']['save'] = true; + $this->default_options['google_connect']['name'] = __( 'Disconnect From Google Analytics', 'all-in-one-seo-pack' ); + $this->default_options['google_connect']['default'] = ""; add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 ); } else { - $this->default_options["google_connect"]["type"] = 'html'; - $this->default_options["google_connect"]["nolabel"] = 1; - $this->default_options["google_connect"]["save"] = false; - $url = $this->oauth_connect(); - $this->default_options["google_connect"]["default"] = "" . __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ) . ""; - foreach ( Array( "token", "secret", "access_token", "ga_token", "account_cache" ) as $v ) { - if ( !empty( $this->$v) ) $preload["{$this->prefix}{$v}"] = $this->$v; + $this->default_options['google_connect']['type'] = 'html'; + $this->default_options['google_connect']['nolabel'] = 1; + $this->default_options['google_connect']['save'] = false; + $url = $this->oauth_connect(); + $this->default_options['google_connect']['default'] = "" . __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ) . ''; + foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) { + if ( ! empty( $this->$v ) ) { + $preload["{$this->prefix}{$v}"] = $this->$v; + } } } $this->update_class_option( $preload ); - $this->update_options( ); + $this->update_options(); // $url = $this->report_query(); - if ( !empty( $this->account_cache ) && !empty( $this->options["{$this->prefix}google_analytics_id"] ) && !empty( $this->account_cache["profiles"][ $this->options["{$this->prefix}google_analytics_id"] ] ) ) { - $this->profile_id = $this->account_cache["profiles"][ $this->options["{$this->prefix}google_analytics_id"] ]; + if ( ! empty( $this->account_cache ) && ! empty( $this->options["{$this->prefix}google_analytics_id"] ) && ! empty( $this->account_cache['profiles'][ $this->options["{$this->prefix}google_analytics_id"] ] ) ) { + $this->profile_id = $this->account_cache['profiles'][ $this->options["{$this->prefix}google_analytics_id"] ]; } } +/** + * @param $oauth_url + * @param null $args + * + * @return array|WP_Error + */ function oauth_get_data( $oauth_url, $args = null ) { - if ( !class_exists( 'OAuthConsumer' ) ) require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' ); - if ( $args === null ) $args = Array( 'scope' => 'https://www.googleapis.com/auth/analytics.readonly', 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __('Google Analytics', 'all-in-one-seo-pack' ) ); + if ( ! class_exists( 'OAuthConsumer' ) ) { + require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' ); + } + if ( $args === null ) { + $args = Array( + 'scope' => 'https://www.googleapis.com/auth/analytics.readonly', + 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' ) + ); + } $req_token = new OAuthConsumer( $this->token, $this->secret ); - $req = $this->oauth_get_creds( $oauth_url, $req_token, $args ); + $req = $this->oauth_get_creds( $oauth_url, $req_token, $args ); + return wp_remote_get( $req->to_url() ); } -function oauth_get_creds( $oauth_url, $req_token = NULL, $args = Array(), $callback = null ) { - if ( !class_exists( 'OAuthConsumer' ) ) require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' ); - if ( !empty( $callback ) ) $args['oauth_callback'] = $callback; - if ( empty( $this->sig_method ) ) $this->sig_method = new OAuthSignatureMethod_HMAC_SHA1(); - if ( empty( $this->consumer ) ) $this->consumer = new OAuthCOnsumer( 'anonymous', 'anonymous' ); - $req_req = OAuthRequest::from_consumer_and_token( $this->consumer, $req_token, "GET", $oauth_url, $args ); +/** + * @param $oauth_url + * @param null $req_token + * @param array $args + * @param null $callback + * + * @return OAuthRequest + */ +function oauth_get_creds( $oauth_url, $req_token = null, $args = array(), $callback = null ) { + if ( ! class_exists( 'OAuthConsumer' ) ) { + require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' ); + } + if ( ! empty( $callback ) ) { + $args['oauth_callback'] = $callback; + } + if ( empty( $this->sig_method ) ) { + $this->sig_method = new OAuthSignatureMethod_HMAC_SHA1(); + } + if ( empty( $this->consumer ) ) { + $this->consumer = new OAuthCOnsumer( 'anonymous', 'anonymous' ); + } + $req_req = OAuthRequest::from_consumer_and_token( $this->consumer, $req_token, 'GET', $oauth_url, $args ); $req_req->sign_request( $this->sig_method, $this->consumer, $req_token ); + return $req_req; } +/** + * @param $oauth_verifier + * + * @return array + */ function oauth_get_token( $oauth_verifier ) { - if ( !class_exists( 'OAuthConsumer' ) ) require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' ); - $args = Array( 'scope' => 'https://www.google.com/analytics/feeds/', 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __('Google Analytics', 'all-in-one-seo-pack' ) ); + if ( ! class_exists( 'OAuthConsumer' ) ) { + require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' ); + } + $args = array( + 'scope' => 'https://www.google.com/analytics/feeds/', + 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' ) + ); $args['oauth_verifier'] = $oauth_verifier; - $oauth_access_token = "https://www.google.com/accounts/OAuthGetAccessToken"; - $reqData = $this->oauth_get_data( $oauth_access_token, $args ); - $reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) ); + $oauth_access_token = 'https://www.google.com/accounts/OAuthGetAccessToken'; + $reqData = $this->oauth_get_data( $oauth_access_token, $args ); + $reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) ); + return $reqOAuthData; } +/** + * @param int $count + * + * @return string + */ function oauth_connect( $count = 0 ) { global $aiosp_activation; - if ( !class_exists( 'OAuthConsumer' ) ) require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' ); - $url = ''; - $callback_url = NULL; - $consumer_key = "anonymous"; - $consumer_secret = "anonymous"; - $oauth_request_token = "https://www.google.com/accounts/OAuthGetRequestToken"; - $oauth_authorize = "https://www.google.com/accounts/OAuthAuthorizeToken"; - $oauth_access_token = "https://www.google.com/accounts/OAuthGetAccessToken"; + if ( ! class_exists( 'OAuthConsumer' ) ) { + require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' ); + } + $url = ''; + $callback_url = null; + $consumer_key = 'anonymous'; + $consumer_secret = 'anonymous'; + $oauth_request_token = 'https://www.google.com/accounts/OAuthGetRequestToken'; + $oauth_authorize = 'https://www.google.com/accounts/OAuthAuthorizeToken'; + $oauth_access_token = 'https://www.google.com/accounts/OAuthGetAccessToken'; if ( $aiosp_activation ) { $oauth_current = false; } else { - $oauth_current = get_transient( "aioseop_oauth_current" ); + $oauth_current = get_transient( 'aioseop_oauth_current' ); } - if ( !empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) { + if ( ! empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) { return $oauth_authorize . '?oauth_token=' . $this->token; } else { - set_transient( "aioseop_oauth_current", 1, 3600 ); + set_transient( 'aioseop_oauth_current', 1, 3600 ); unset( $this->token ); unset( $this->secret ); } $args = array( - 'scope' => 'https://www.google.com/analytics/feeds/', - 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __('Google Analytics', 'all-in-one-seo-pack') + 'scope' => 'https://www.google.com/analytics/feeds/', + 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' ) ); if ( AIOSEOPPRO ) { - $req_req = $this->oauth_get_creds( $oauth_request_token, NULL, $args, admin_url( "admin.php?page=all-in-one-seo-pack-pro/aioseop_class.php" ) ); + $req_req = $this->oauth_get_creds( $oauth_request_token, null, $args, admin_url( 'admin.php?page=all-in-one-seo-pack-pro/aioseop_class.php' ) ); } else { - $req_req = $this->oauth_get_creds( $oauth_request_token, NULL, $args, admin_url( "admin.php?page=all-in-one-seo-pack/aioseop_class.php" ) ); + $req_req = $this->oauth_get_creds( $oauth_request_token, null, $args, admin_url( 'admin.php?page=all-in-one-seo-pack/aioseop_class.php' ) ); } - $reqData = wp_remote_get( $req_req->to_url() ); + $reqData = wp_remote_get( $req_req->to_url() ); $reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) ); - if ( !empty( $reqOAuthData['oauth_token'] ) ) $this->token = $reqOAuthData['oauth_token']; - if ( !empty( $reqOAuthData['oauth_token_secret'] ) ) $this->secret = $reqOAuthData['oauth_token_secret']; - if ( !empty( $this->token ) && ( $this->token != 'anonymous' ) && ( $oauth_current ) ) { + if ( ! empty( $reqOAuthData['oauth_token'] ) ) { + $this->token = $reqOAuthData['oauth_token']; + } + if ( ! empty( $reqOAuthData['oauth_token_secret'] ) ) { + $this->secret = $reqOAuthData['oauth_token_secret']; + } + if ( ! empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) { $url = $oauth_authorize . "?oauth_token={$this->token}"; } else { - if ( !$count ) { + if ( ! $count ) { return $this->oauth_connect( 1 ); } } + return $url; -} \ No newline at end of file +} diff --git a/wp-content/plugins/all-in-one-seo-pack/inc/index.php b/wp-content/plugins/all-in-one-seo-pack/inc/index.php index e71af0ef21..3c379e1835 100644 --- a/wp-content/plugins/all-in-one-seo-pack/inc/index.php +++ b/wp-content/plugins/all-in-one-seo-pack/inc/index.php @@ -1 +1,4 @@ -'; +?> + + + + + + Sitemap + SitemapIndex + + + + + + <xsl:choose><xsl:when test="$fileType='Sitemap'">Sitemap</xsl:when> + <xsl:otherwise>Sitemap Index</xsl:otherwise> + </xsl:choose> + + + + + +
    +
    +

    XML Sitemap

    +

    Generated by All in One SEO, this is an XML Sitemap, meant to be consumed by search engines like Google or Bing.
    + You can find more information about XML sitemaps at sitemaps.org.

    +

    + + This sitemap contains URLs + This sitemap index contains sitemaps +

    +
    + + + + + + +
    + + +
    + + + + + + + + + + + + + + + stripe + + + + + + +
    URLLastChange
    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + stripe + + + + + + + + + +
    URLPriorityChange FrequencyLastChange
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +current_locale = get_locale(); + + $this->init(); + + } + + /** + * Fetch locale data from WP. + * + * @since 2.3.5 + * @since 2.3.6 Return FALSE on WP_Error object. + * + * @return mixed + */ + private function get_locale_data() { + $response = wp_remote_get( $this->url ); + + if ( is_wp_error( $response ) ) { + return false; + } + + return $response['body']; + } + + + /** + * + * @since 2.3.5 + * + * @param $locales + */ + private function set_current_locale_data( $locales ) { + + // Some locales are missing the locale code (wp_locale) so we need to check for that. + + foreach ( $locales as $locale ) { + + $wplocale = ''; + + if ( isset( $locale->wp_locale ) ) { + $wplocale = $locale->wp_locale; + } + + if ( $wplocale === $this->current_locale ) { + + $name = ''; + $percent_translated = ''; + + if ( isset( $locale->name ) ) { + $name = $locale->name; + } + + if ( isset( $locale->percent_translated ) ) { + $percent_translated = $locale->percent_translated; + } + + $this->name = $name; + $this->wplocale = $wplocale; + $this->percent_translated = $percent_translated; + $this->slug = $locale->locale; + + } + } + + } + + /** + * + * @since 2.3.5 + * + * @param $locales + * + * @return int + */ + private function count_translated_languages( $locales ) { + + $count = 0; + + foreach ( $locales as $locale ) { + + if ( $locale->percent_translated > 0 ) { + ++ $count; + } + } + + return $count; + } + + /** + * + * + * @since 2.3.5 + */ + private function set_translation_url() { + + if ( null !== $this->wplocale ) { + + $url = "https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack/dev/$this->slug/default"; + + $this->translation_url = $url; + } + + } + + /** + * + * @since 2.3.5 + * @since 2.3.6 Return FALSE on WP_Error object in get_locale_data(). + * + */ + private function init() { + + $json = $this->get_locale_data(); + + if ( $json === false ) { + return false; + } + + $translation_data = json_decode( $json ); + + $locales = $translation_data->translation_sets; + + $this->set_current_locale_data( $locales ); + + $this->translated_count = $this->count_translated_languages( $locales ); + + $this->set_translation_url(); + } + } + +endif; // End class_exists check. diff --git a/wp-content/plugins/all-in-one-seo-pack/index.php b/wp-content/plugins/all-in-one-seo-pack/index.php index e71af0ef21..3c379e1835 100644 --- a/wp-content/plugins/all-in-one-seo-pack/index.php +++ b/wp-content/plugins/all-in-one-seo-pack/index.php @@ -1 +1,4 @@ - field_size ) { - cntfield.style.color = "#fff"; - cntfield.style.backgroundColor = "#f00"; - } else { - if ( cntfield.value > ( field_size - 6 ) ) { - cntfield.style.color = "#515151"; - cntfield.style.backgroundColor = "#ff0"; - } else { - cntfield.style.color = "#515151"; - cntfield.style.backgroundColor = "#eee"; - } - } -} - -function aioseop_get_field_value( field ) { - if ( field.length == 0 ) return field; - cur = jQuery('[name=' + field + ']'); - if ( cur.length == 0 ) return field; - type = cur.attr('type'); - if ( type == "checkbox" || type == "radio" ) - cur = jQuery('input[name=' + field + ']:checked'); - return cur.val(); -} - -function aioseop_get_field_values( field ) { - arr = []; - cur = jQuery('[name=' + field + ']'); - if ( cur.length == 0 ) return field; - type = cur.attr('type'); - if ( type == "checkbox" || type == "radio" ) - jQuery('input[name=' + field + ']:checked').each(function() { - arr.push(jQuery(this).val()); - }); - if ( arr.length <= 0 ) - arr.push(cur.val()); - return arr; -} - -function aioseop_eval_condshow_logic( statement ) { - var lhs, rhs; - if ( ( typeof statement ) == 'object' ) { - lhs = statement['lhs']; - rhs = statement['rhs']; - if ( lhs !== null && ( ( typeof lhs ) == 'object' ) ) - lhs = aioseop_eval_condshow_logic( statement['lhs'] ); - if ( rhs !== null && ( typeof rhs ) == 'object' ) - rhs = aioseop_eval_condshow_logic( statement['rhs'] ); - lhs = aioseop_get_field_value( lhs ); - rhs = aioseop_get_field_value( rhs ); - switch ( statement['op'] ) { - case 'NOT': return ( ! lhs ); - case 'AND': return ( lhs && rhs ); - case 'OR' : return ( lhs || rhs ); - case '==' : return ( lhs == rhs ); - case '!=' : return ( lhs != rhs ); - default : return null; - } - } - return statement; -} - -function aioseop_do_condshow_match( index, value ) { - if ( typeof value != 'undefined' ) { - matches = true; - jQuery.each(value, function(subopt, setting) { - var statement; - if ( ( typeof setting ) == 'object' ) { - statement = aioseop_eval_condshow_logic( setting ); - if ( !statement ) { - matches = false; - } - } else { - if ( subopt.match(/\\\[\\\]/) ) { // special case for these -- pdb - cur = aioseop_get_field_values( subopt ); - if ( jQuery.inArray( setting, cur, 0 ) < 0 ) { - matches = false; - } - } else { - cur = aioseop_get_field_value( subopt ); - if ( cur != setting ) { - matches = false; - } - } - } - }); - if ( matches ) { - jQuery('#' + index + '_wrapper' ).show(); - } else { - jQuery('#' + index + '_wrapper' ).hide(); - } - return matches; - } - return false; -} - -function aioseop_add_condshow_handlers( index, value ) { - if ( typeof value != 'undefined' ) { - jQuery.each(value, function(subopt, setting) { - jQuery('[name=' + subopt + ']').bind( "change keyup", function() { - aioseop_do_condshow_match( index, value ); - }); - }); - } -} - -function aioseop_do_condshow( condshow ) { - if ( typeof aiosp_data.condshow != 'undefined' ) { - jQuery.each(aiosp_data.condshow, function(index, value) { - aioseop_do_condshow_match( index, value ); - aioseop_add_condshow_handlers( index, value ); - }); - } -} - -jQuery(document).ready(function(){ -if (typeof aiosp_data != 'undefined') { - if ( typeof aiosp_data.condshow != 'undefined' ) { - aioseop_do_condshow( aiosp_data.condshow ); - } -} -}); - -jQuery(document).ready(function() { - var image_field; - jQuery('.aioseop_upload_image_button').click(function() { - window.send_to_editor = aioseopNewSendToEditor; - image_field = jQuery(this).next(); - formfield = image_field.attr('name'); - tb_show('', 'media-upload.php?type=image&TB_iframe=true'); - return false; - }); - aioseopStoreSendToEditor = window.send_to_editor; - aioseopNewSendToEditor = function(html) { - imgurl = jQuery('img',html).attr('src'); - if ( typeof(imgurl) !== undefined ) - image_field.val(imgurl); - tb_remove(); - window.send_to_editor = aioseopStoreSendToEditor; - }; -}); - -// props to commentluv for this fix -// workaround for bug that causes radio inputs to lose settings when meta box is dragged. -// http://core.trac.wordpress.org/ticket/16972 -jQuery(document).ready(function(){ - // listen for drag drop of metaboxes , bind mousedown to .hndle so it only fires when starting to drag - jQuery('.hndle').mousedown(function(){ - // set live event listener for mouse up on the content .wrap and wait a tick to give the dragged div time to settle before firing the reclick function - jQuery('.wrap').mouseup(function(){aiosp_store_radio(); setTimeout('aiosp_reclick_radio();',50);}); - }) -}); -/** -* stores object of all radio buttons that are checked for entire form -*/ - - function aiosp_store_radio(){ - var radioshack = {}; - jQuery('input[type="radio"]').each(function(){ - if(jQuery(this).is(':checked')){ - radioshack[jQuery(this).attr('name')] = jQuery(this).val(); - } - jQuery(document).data('radioshack',radioshack); - }); - } - -/** -* detect mouseup and restore all radio buttons that were checked -*/ - - function aiosp_reclick_radio(){ - // get object of checked radio button names and values - var radios = jQuery(document).data('radioshack'); - //step thru each object element and trigger a click on it's corresponding radio button - for(key in radios){ - jQuery('input[name="'+key+'"]').filter('[value="'+radios[key]+'"]').trigger('click'); - } - // unbind the event listener on .wrap (prevents clicks on inputs from triggering function) - jQuery('.wrap').unbind('mouseup'); - } - - -function aioseop_handle_ajax_call( action, settings, options, success) { - var aioseop_sack = new sack(ajaxurl); - aioseop_sack.execute = 1; - aioseop_sack.method = 'POST'; - aioseop_sack.setVar( "action", action ); - aioseop_sack.setVar( "settings", settings ); - aioseop_sack.setVar( "options", options ); - if ( typeof success != 'undefined' ) { - aioseop_sack.onCompletion = success; - } - aioseop_sack.setVar( "nonce-aioseop", jQuery('input[name="nonce-aioseop"]').val() ); - aioseop_sack.setVar( "nonce-aioseop-edit", jQuery('input[name="nonce-aioseop-edit"]').val() ); - - aioseop_sack.onError = function() {alert('Ajax error on saving.'); }; - aioseop_sack.runAJAX(); -} - -function aioseop_handle_post_url( action, settings, options, success) { - jQuery("div#aiosp_"+settings).fadeOut('fast', function() { - var loading = ' Please wait...'; - jQuery("div#aiosp_"+settings).fadeIn('fast', function() { - aioseop_handle_ajax_call( action, settings, options, success); - }); - jQuery("div#aiosp_"+settings).html(loading); - }) -}; - -function aioseop_is_overflowed(element) { - return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth; -} - -function aioseop_overflow_border( el ) { - if ( aioseop_is_overflowed(el) ) { - el.className = 'aioseop_option_div aioseop_overflowed'; - } else { - el.className = 'aioseop_option_div'; - } -} - -jQuery(document).ready(function() { - jQuery("#poststuff .aioseop_radio_type input[type='radio']").on( 'click', function() { - var previousValue = jQuery(this).attr('previousValue'); - var name = jQuery(this).attr('name'); - if ( typeof previousValue == 'undefined' ) { - if ( jQuery(this).prop( "checked" ) ) { - jQuery(this).prop( 'checked', true ); - jQuery(this).attr('previousValue', 'checked' ); - } else { - jQuery(this).prop( 'checked', false ); - jQuery(this).attr('previousValue', false ); - } - return; - } - if (previousValue == 'checked') { - jQuery(this).prop('checked', false); - jQuery(this).attr('previousValue', false); - } else { - jQuery("input[name="+name+"]:radio").attr('previousValue', false); - jQuery(this).attr('previousValue', 'checked'); - } - }); - if ( typeof aiosp_data.pointers != 'undefined' ) { - jQuery.each(aiosp_data.pointers, function(index, value) { - if ( value != 'undefined' && value.pointer_text != '' ) { - aioseop_show_pointer( index, value ); - } - }); - } - jQuery(".all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left").delegate("input[name='Submit']", "click", function(e) { - e.preventDefault(); - return false; - }); - jQuery(".all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager #aiosp_settings_form").delegate("input[name='Submit']", "click", function(e) { - e.preventDefault(); - aioseop_handle_post_url('aioseop_ajax_save_settings', 'ajax_settings_message', jQuery('form#aiosp_settings_form').serialize(), - function() { - jQuery('.wp-has-current-submenu').fadeIn('fast', function() { - aioseop_handle_ajax_call('aioseop_ajax_get_menu_links', 'ajax_settings_message', jQuery.param( {target: '.wp-has-current-submenu > ul'} ) ); - }); - } ); - return false; - }); - var selectors = "div.aioseop_multicheckbox_type div.aioseop_option_div, #aiosp_sitemap_debug div.aioseop_option_div, #aiosp_performance_status div.aioseop_option_div"; - jQuery("div#aiosp_sitemap_addl_pages_metabox").delegate("input[name='Submit']", "click", function() { - aioseop_handle_post_url('aioseop_ajax_save_url', 'sitemap_addl_pages', jQuery('div#aiosp_sitemap_addl_pages_metabox input, div#aiosp_sitemap_addl_pages_metabox select').serialize() ); - return false; - }); - jQuery("div#aiosp_video_sitemap_addl_pages_metabox").delegate("input[name='Submit']", "click", function() { - aioseop_handle_post_url('aioseop_ajax_save_url', 'video_sitemap_addl_pages', jQuery('div#aiosp_video_sitemap_addl_pages_metabox input, div#aiosp_video_sitemap_addl_pages_metabox select').serialize() ); - return false; - }); - jQuery("div#aiosp_sitemap_addl_pages_metabox").delegate("a.aiosp_delete_url", "click", function(e) { - e.preventDefault(); - aioseop_handle_post_url('aioseop_ajax_delete_url', 'sitemap_addl_pages', jQuery(this).attr("title") ); - return false; - }); - jQuery("div#aiosp_video_sitemap_addl_pages_metabox").delegate("a.aiosp_delete_url", "click", function(e) { - e.preventDefault(); - aioseop_handle_post_url('aioseop_ajax_delete_url', 'video_sitemap_addl_pages', jQuery(this).attr("title") ); - return false; - }); - jQuery("div#aiosp_opengraph_scan_header").delegate("input[name='aiosp_opengraph_scan_header']", "click", function(e) { - e.preventDefault(); - aioseop_handle_post_url('aioseop_ajax_scan_header', 'opengraph_scan_header', jQuery('div#aiosp_opengraph_scan_header').serialize() ); - return false; - }); - jQuery( 'input[name="aiosp_sitemap_posttypes[]"][value="all"], input[name="aiosp_video_sitemap_posttypes[]"][value="all"], input[name="aiosp_sitemap_taxonomies[]"][value="all"], input[name="aiosp_video_sitemap_taxonomies[]"][value="all"]' ).click(function () { - jQuery(this).parents('div:eq(0)').find(':checkbox').prop('checked', this.checked); - }); - jQuery( 'input[name="aiosp_sitemap_posttypes[]"][value!="all"], input[name="aiosp_video_sitemap_posttypes[]"][value!="all"], input[name="aiosp_sitemap_taxonomies[]"][value!="all"], input[name="aiosp_video_sitemap_taxonomies[]"][value!="all"]' ).click(function () { - if ( !this.checked ) - jQuery(this).parents('div:eq(0)').find('input[value="all"]:checkbox').prop('checked', this.checked); - }); - - jQuery(".aioseop_tab:not(:first)").hide(); - jQuery(".aioseop_tab:first").show(); - jQuery("a.aioseop_header_tab").click(function(){ - var stringref = jQuery(this).attr("href").split('#')[1]; - jQuery('.aioseop_tab:not(#'+stringref+')').hide('slow'); - jQuery('.aioseop_tab#' + stringref).show('slow'); - jQuery('.aioseop_header_tab[href!="#'+stringref+'"]').removeClass('active'); - jQuery('.aioseop_header_tab[href="#' + stringref+'"]').addClass('active'); - return false; - }); -}); +/** + * Controls all the styling of the plugin. + * + * AIOSEOP Updates class. + * @author Michael Torbert. + * @author Semper Fi Web Design. + * @copyright http://semperplugins.com + * @version 1.0.0 + */ +if ( typeof aiosp_data != 'undefined' ) { + + /** + * @since 1.0.0 + * @param int $index. + * @param $value + */ + jQuery.each( aiosp_data, function( index, value ) { +// aiosp_data[index] = value.json.replace(/"/g, '"'); +// aiosp_data[index] = jQuery.parseJSON( value ); + if ( index == 0 ) { + if ( typeof value.condshow == 'undefined' ) { + aiosp_data[ index ].condshow = []; + } + } else { + if ( typeof value.condshow != 'undefined' ) { + aiosp_data[ 0 ].condshow = + jQuery.merge( aiosp_data[0].condshow, value.condshow ); + } + } + }); + aiosp_data = aiosp_data[0]; +} + +/** + * @summary Changes visibility. + * + * @since 1.0.0 + * @param int $id. + */ +function toggleVisibility( id ) { + var e = document.getElementById( id ); + if ( e.style.display == 'block' ) + e.style.display = 'none'; + else + e.style.display = 'block'; +} + +/** + * @summary Counts characters. + * + * @since 1.0.0 + * @param String $field. + * @param Int $cntfield. + * @return Mixed. + */ +function countChars( field, cntfield ) { + var extra = 0; + var field_size; + if ( ( field.name == 'aiosp_title' ) + && ( typeof aiosp_title_extra !== 'undefined' ) ) { + extra = aiosp_title_extra; + } + cntfield.value = field.value.length + extra; + if ( typeof field.size != 'undefined' ) { + field_size = field.size; + } else { + field_size = field.rows * field.cols; + } + if ( field_size < 10 ) + return; + if ( cntfield.value > field_size ) { + cntfield.style.color = "#fff"; + cntfield.style.backgroundColor = "#f00"; + } else { + if ( cntfield.value > ( field_size - 6 ) ) { + cntfield.style.color = "#515151"; + cntfield.style.backgroundColor = "#ff0"; + } else { + cntfield.style.color = "#515151"; + cntfield.style.backgroundColor = "#eee"; + } + } +} + +/** + * @summary Returns the fields value. + * + * @since 1.0.0 + * @param String $field. + * @return Mixed. + */ +function aioseop_get_field_value( field ) { + if ( field.length == 0 ) + return field; + cur = jQuery('[name=' + field + ']'); + if ( cur.length == 0 ) + return field; + type = cur.attr('type'); + if ( type == "checkbox" || type == "radio" ) + cur = jQuery('input[name=' + field + ']:checked'); + return cur.val(); +} + +/** + * @summary Returns the fields value. + * + * @since 1.0.0 + * @param String $field. + * @return Mixed. + */ +function aioseop_get_field_values( field ) { + arr = []; + cur = jQuery( '[name=' + field + ']' ); + if ( cur.length == 0 ) + return field; + type = cur.attr('type'); + if ( type == "checkbox" || type == "radio" ) + jQuery( 'input[name=' + field + ']:checked' ).each(function() { + arr.push(jQuery(this).val()); + }); + if ( arr.length <= 0 ) + arr.push(cur.val()); + return arr; +} + +/** + * @summary Evaluates condshow logic. + * + * @since 1.0.0 + * @param String $statement. + * @return Mixed. + */ +function aioseop_eval_condshow_logic( statement ) { + var lhs, rhs; + if ( ( typeof statement ) == 'object' ) { + lhs = statement['lhs']; + rhs = statement['rhs']; + if ( lhs !== null && ( ( typeof lhs ) == 'object' ) ) + lhs = aioseop_eval_condshow_logic( statement['lhs'] ); + if ( rhs !== null && ( typeof rhs ) == 'object' ) + rhs = aioseop_eval_condshow_logic( statement['rhs'] ); + lhs = aioseop_get_field_value( lhs ); + rhs = aioseop_get_field_value( rhs ); + switch ( statement['op'] ) { + case 'NOT': + return ( ! lhs ); + case 'AND': + return ( lhs && rhs ); + case 'OR' : + return ( lhs || rhs ); + case '==' : + return ( lhs == rhs ); + case '!=' : + return ( lhs != rhs ); + default : + return null; + } + } + return statement; +} + +/** + * @summary Evaluates condshow logic. + * + * @since 1.0.0 + * @param String $index. + * @param $value. + * @return Mixed. + */ +function aioseop_do_condshow_match( index, value ) { + if ( typeof value != 'undefined' ) { + matches = true; + jQuery.each( value, function(subopt, setting) { + var statement; + if ( ( typeof setting ) == 'object' ) { + statement = aioseop_eval_condshow_logic( setting ); + if ( ! statement ) { + matches = false; + } + } else { + if ( subopt.match( /\\\[\\\]/ ) ) { // special case for these -- pdb + cur = aioseop_get_field_values( subopt ); + if ( jQuery.inArray( setting, cur, 0 ) < 0 ) { + matches = false; + } + } else { + cur = aioseop_get_field_value( subopt ); + if ( cur != setting ) { + matches = false; + } + } + } + }); + if ( matches ) { + jQuery( '#' + index + '_wrapper' ).show(); + } else { + jQuery( '#' + index + '_wrapper' ).hide(); + } + return matches; + } + return false; +} + +/** + * @summary Adds condshow handlers. + * + * @since 1.0.0 + * @param String $index. + * @param $value. + */ +function aioseop_add_condshow_handlers( index, value ) { + if ( typeof value != 'undefined' ) { + jQuery.each(value, function(subopt, setting) { + jQuery('[name=' + subopt + ']').bind( "change keyup", function() { + aioseop_do_condshow_match( index, value ); + }); + }); + } +} + +/** + * @summary Does condshow. + * + * @since 1.0.0 + * @param $condshow. + */ +function aioseop_do_condshow( condshow ) { + if ( typeof aiosp_data.condshow != 'undefined' ) { + jQuery.each( aiosp_data.condshow, function( index, value ) { + aioseop_do_condshow_match( index, value ); + aioseop_add_condshow_handlers( index, value ); + }); + } +} + +/** + * @since 1.0.0 + */ +jQuery( document ).ready(function() { + if ( typeof aiosp_data != 'undefined' ) { + if ( typeof aiosp_data.condshow != 'undefined' ) { + aioseop_do_condshow( aiosp_data.condshow ); + } + } +}); + +/** + * @since 1.0.0 + * @return boolean. + */ +jQuery( document ).ready(function() { + var image_field; + jQuery( '.aioseop_upload_image_button' ).click(function() { + window.send_to_editor = aioseopNewSendToEditor; + image_field = jQuery( this ).next(); + formfield = image_field.attr( 'name' ); + tb_show( '', 'media-upload.php?type=image&TB_iframe=true' ); + return false; + }); + aioseopStoreSendToEditor = window.send_to_editor; + aioseopNewSendToEditor = function(html) { + imgurl = jQuery( 'img',html ).attr( 'src' ); + if ( typeof( imgurl ) !== undefined ) + image_field.val( imgurl ); + tb_remove(); + window.send_to_editor = aioseopStoreSendToEditor; + }; +}); + +/** + * @summary workaround for bug that causes radio inputs to lose settings when meta box is dragged. + * + * props to commentluv for this fix + * @author commentluv. + * @link http://core.trac.wordpress.org/ticket/16972 + * @since 1.0.0 + */ +jQuery( document ).ready(function() { + + // listen for drag drop of metaboxes , bind mousedown to .hndle so it only fires when starting to drag + jQuery( '.hndle' ).mousedown(function() { + + // set live event listener for mouse up on the content .wrap and wait a tick to give the dragged div time to settle before firing the reclick function + jQuery( '.wrap').mouseup(function() { + aiosp_store_radio(); + setTimeout( 'aiosp_reclick_radio();', 50 ); + }); + }) +}); + +/** + * @summary Stores object of all radio buttons that are checked for entire form. + * + * @since 1.0.0 + */ +function aiosp_store_radio() { + var radioshack = {}; + jQuery( 'input[type="radio"]' ).each(function() { + if( jQuery( this ).is( ':checked' ) ) { + radioshack[ jQuery( this ).attr( 'name' ) ] = jQuery( this ).val(); + } + jQuery( document ).data( 'radioshack', radioshack ); + }); +} + +/** + * @summary Detects mouseup and restore all radio buttons that were checked. + * + * @since 1.0.0 + */ +function aiosp_reclick_radio() { + + // gets the object of checked radio button names and values + var radios = jQuery( document ).data( 'radioshack' ); + + //steps thru each object element and trigger a click on it's corresponding radio button + for( key in radios ) { + jQuery( 'input[name="' + key + '"]' ) + .filter( '[value="' + radios[ key ]+ '"]' ) + .trigger( 'click' ); + } + // unbinds the event listener on .wrap (prevents clicks on inputs from triggering function) + jQuery( '.wrap' ).unbind( 'mouseup' ); +} + +/** + * @summary Handdles ajax call. + * + * @since 1.0.0 + * @param $action. + * @param $setting. + * @param $options. + * @param $success. + */ +function aioseop_handle_ajax_call( action, settings, options, success ) { + var aioseop_sack = new sack( ajaxurl ); + aioseop_sack.execute = 1; + aioseop_sack.method = 'POST'; + aioseop_sack.setVar( "action", action ); + aioseop_sack.setVar( "settings", settings ); + aioseop_sack.setVar( "options", options ); + if ( typeof success != 'undefined' ) { + aioseop_sack.onCompletion = success; + } + aioseop_sack.setVar( + "nonce-aioseop", + jQuery( 'input[name="nonce-aioseop"]' ).val() + ); + aioseop_sack.setVar( + "nonce-aioseop-edit", + jQuery( 'input[name="nonce-aioseop-edit"]' ).val() + ); + aioseop_sack.onError = function() { + alert( 'Ajax error on saving.' ); + }; + aioseop_sack.runAJAX(); +} + +/** + * @summary Handdles posts URL. + * + * @since 1.0.0 + * @param $action. + * @param $setting. + * @param $options. + * @param $success. + */ +function aioseop_handle_post_url( action, settings, options, success) { + jQuery("div#aiosp_"+settings).fadeOut('fast', function() { + var loading = ' Please wait...'; + jQuery( "div#aiosp_"+ settings ).fadeIn( 'fast', function() { + aioseop_handle_ajax_call( action, settings, options, success); + }); + jQuery( "div#aiosp_" + settings ).html( loading ); + }) +}; + +/** + * @summary Handles when AIOSEOP is overflowed. + * + * @since 1.0.0 + * @param $element. + * @return mixed. + */ +function aioseop_is_overflowed( element ) { + return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth; +} + +/** + * @summary Handles when overflowed border. + * + * @since 1.0.0 + * @param $el. + */ +function aioseop_overflow_border( el ) { + if ( aioseop_is_overflowed( el ) ) { + el.className = 'aioseop_option_div aioseop_overflowed'; + } else { + el.className = 'aioseop_option_div'; + } +} + +/** + * @since 1.0.0 + * @return mixed. + */ +jQuery( document ).ready(function() { + jQuery( "#poststuff .aioseop_radio_type input[type='radio']" ).on( 'click', function() { + var previousValue = jQuery( this ).attr( 'previousValue' ); + var name = jQuery( this ).attr( 'name' ); + if ( typeof previousValue == 'undefined' ) { + if ( jQuery( this ).prop( "checked" ) ) { + jQuery( this ).prop( 'checked', true ); + jQuery( this ).attr( 'previousValue', 'checked' ); + } else { + jQuery( this ).prop( 'checked', false ); + jQuery( this ).attr( 'previousValue', false ); + } + return; + } + if ( previousValue == 'checked' ) { + jQuery( this ).prop( 'checked', false ); + jQuery( this ).attr( 'previousValue', false ); + } else { + jQuery( "input[name=" + name + "]:radio" ) + .attr( 'previousValue', false ); + jQuery( this ).attr( 'previousValue', 'checked' ); + } + }); + if ( typeof aiosp_data.pointers != 'undefined' ) { + + /** + * @since 1.0.0 + * @param $index. + * @param $value. + * @return mixed. + */ + jQuery.each( aiosp_data.pointers, function( index, value ) { + if ( value != 'undefined' && value.pointer_text != '' ) { + aioseop_show_pointer( index, value ); + } + }); + } + + /** + * @since 1.0.0 + * @param $e. + * @return boolean. + */ + jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-modules-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left" ) + .delegate("input[name='Submit']", "click", function( e ) { + e.preventDefault(); + return false; + }); + + /** + * @since 1.0.0 + * @param $e. + * @return boolean. + */ + jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-modules-aioseop_feature_manager #aiosp_settings_form" ) + .delegate( "input[name='Submit']", "click", function( e ) { + e.preventDefault(); + aioseop_handle_post_url( + 'aioseop_ajax_save_settings', + 'ajax_settings_message', + jQuery( 'form#aiosp_settings_form' ).serialize(), + function() { + jQuery( '.wp-has-current-submenu' ).fadeIn( 'fast', function() { + aioseop_handle_ajax_call( + 'aioseop_ajax_get_menu_links', + 'ajax_settings_message', + jQuery.param( {target: '.wp-has-current-submenu > ul'} ) + ); + }); + } ); + return false; + }); + + /** + * @since 1.0.0 + * @param $e. + * @return boolean. + */ + jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left" ) + .delegate("input[name='Submit']", "click", function( e ) { + e.preventDefault(); + return false; + }); + + /** + * @since 1.0.0 + * @param $e. + * @return boolean. + */ + jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aiosp_settings_form" ) + .delegate( "input[name='Submit']", "click", function( e ) { + e.preventDefault(); + aioseop_handle_post_url( + 'aioseop_ajax_save_settings', + 'ajax_settings_message', + jQuery( 'form#aiosp_settings_form' ).serialize(), + function() { + jQuery( '.wp-has-current-submenu' ).fadeIn( 'fast', function() { + aioseop_handle_ajax_call( + 'aioseop_ajax_get_menu_links', + 'ajax_settings_message', + jQuery.param( {target: '.wp-has-current-submenu > ul'} ) + ); + }); + } ); + return false; + }); + + var selectors = + "div.aioseop_multicheckbox_type div.aioseop_option_div, #aiosp_sitemap_debug div.aioseop_option_div, #aiosp_performance_status div.aioseop_option_div"; + + /** + * @since 1.0.0 + * @return boolean. + */ + jQuery( "div#aiosp_sitemap_addl_pages_metabox" ) + .delegate( "input[name='Submit']", "click", function() { + aioseop_handle_post_url( + 'aioseop_ajax_save_url', + 'sitemap_addl_pages', + jQuery( 'div#aiosp_sitemap_addl_pages_metabox input, div#aiosp_sitemap_addl_pages_metabox select' ) + .serialize() + ); + return false; + }); + + /** + * @since 1.0.0 + * @return boolean. + */ + jQuery( "div#aiosp_video_sitemap_addl_pages_metabox" ) + .delegate( "input[name='Submit']", "click", function() { + aioseop_handle_post_url( + 'aioseop_ajax_save_url', + 'video_sitemap_addl_pages', + jQuery( 'div#aiosp_video_sitemap_addl_pages_metabox input, div#aiosp_video_sitemap_addl_pages_metabox select') + .serialize() + ); + return false; + }); + + /** + * @since 1.0.0 + * @param $e. + * @return boolean. + */ + jQuery( "div#aiosp_sitemap_addl_pages_metabox" ) + .delegate("a.aiosp_delete_url", "click", function( e ) { + e.preventDefault(); + aioseop_handle_post_url( + 'aioseop_ajax_delete_url', + 'sitemap_addl_pages', + jQuery( this ).attr( "title" ) + ); + return false; + }); + + /** + * @since 1.0.0 + * @param $e. + * @return boolean. + */ + jQuery( "div#aiosp_video_sitemap_addl_pages_metabox" ) + .delegate( "a.aiosp_delete_url", "click", function( e ) { + e.preventDefault(); + aioseop_handle_post_url( + 'aioseop_ajax_delete_url', + 'video_sitemap_addl_pages', + jQuery( this ).attr( "title" ) + ); + return false; + }); + + /** + * @since 1.0.0 + * @param $e. + * @return boolean. + */ + jQuery( "div#aiosp_opengraph_scan_header" ) + .delegate( "input[name='aiosp_opengraph_scan_header']", "click", function( e ) { + e.preventDefault(); + aioseop_handle_post_url( + 'aioseop_ajax_scan_header', + 'opengraph_scan_header', + jQuery( 'div#aiosp_opengraph_scan_header' ).serialize() + ); + return false; + }); + + /** + * @since 1.0.0 + */ + jQuery( 'input[name="aiosp_sitemap_posttypes[]"][value="all"], input[name="aiosp_video_sitemap_posttypes[]"][value="all"], input[name="aiosp_sitemap_taxonomies[]"][value="all"], input[name="aiosp_video_sitemap_taxonomies[]"][value="all"]' ) + .click(function() { + jQuery( this ) + .parents( 'div:eq(0)' ) + .find( ':checkbox' ) + .prop( 'checked', this.checked ); + }); + + /** + * @since 1.0.0 + */ + jQuery( 'input[name="aiosp_sitemap_posttypes[]"][value!="all"], input[name="aiosp_video_sitemap_posttypes[]"][value!="all"], input[name="aiosp_sitemap_taxonomies[]"][value!="all"], input[name="aiosp_video_sitemap_taxonomies[]"][value!="all"]' ) + .click(function () { + if ( ! this.checked ) + jQuery( this ) + .parents( 'div:eq(0)' ) + .find( 'input[value="all"]:checkbox' ) + .prop( 'checked', this.checked ); + }); + + /** + * @since 1.0.0 + */ + jQuery( ".aioseop_tab:not(:first)" ).hide(); + + /** + * @since 1.0.0 + */ + jQuery( ".aioseop_tab:first" ).show(); + + /** + * @since 1.0.0 + * @return boolean. + */ + jQuery( "a.aioseop_header_tab" ).click(function() { + var stringref = jQuery( this ).attr( "href" ).split( '#' )[1]; + jQuery( '.aioseop_tab:not(#' + stringref + ')' ).hide( 'slow' ); + jQuery( '.aioseop_tab#' + stringref ).show( 'slow' ); + jQuery( '.aioseop_header_tab[href!="#'+ stringref +'"]' ).removeClass( 'active' ); + jQuery( '.aioseop_header_tab[href="#' + stringref +'"]' ).addClass( 'active' ); + return false; + }); +}); diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_bad_robots.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_bad_robots.php index c9042becdb..975d65335f 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_bad_robots.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_bad_robots.php @@ -1,155 +1,253 @@ name = __('Bad Bot Blocker', 'all-in-one-seo-pack'); // Human-readable name of the plugin - $this->prefix = 'aiosp_bad_robots_'; // option prefix - $this->file = __FILE__; // the current file + + /** + * All_in_One_SEO_Pack_Bad_Robots constructor. + */ + function __construct() { + $this->name = __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ); // Human-readable name of the plugin. + $this->prefix = 'aiosp_bad_robots_'; // Option prefix. + $this->file = __FILE__; // The current file. parent::__construct(); - - $help_text = Array( - 'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ), - 'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ), - 'track_blocks'=> __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ), - 'htaccess_rules'=>__( 'Block bad robots via Apaache .htaccess rules. Warning: this will change your web server configuration, make sure you are able to edit this file manually as well.', 'all-in-one-seo-pack' ), - 'edit_blocks' => __( 'Check this to edit the list of disallowed user agents for blocking bad bots.', 'all-in-one-seo-pack' ), - 'blocklist' => __( 'This is the list of disallowed user agents used for blocking bad bots.', 'all-in-one-seo-pack' ), - 'referlist' => __( 'This is the list of disallowed referers used for blocking bad bots.', 'all-in-one-seo-pack' ), - 'blocked_log' => __( 'Shows log of most recent requests from blocked bots. Note: this will not track any bots that were already blocked at the web server / .htaccess level.', 'all-in-one-seo-pack' ), + + $help_text = array( + 'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ), + 'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ), + 'track_blocks' => __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ), + 'htaccess_rules' => __( 'Block bad robots via Apache .htaccess rules. Warning: this will change your web server configuration, make sure you are able to edit this file manually as well.', 'all-in-one-seo-pack' ), + 'edit_blocks' => __( 'Check this to edit the list of disallowed user agents for blocking bad bots.', 'all-in-one-seo-pack' ), + 'blocklist' => __( 'This is the list of disallowed user agents used for blocking bad bots.', 'all-in-one-seo-pack' ), + 'referlist' => __( 'This is the list of disallowed referers used for blocking bad bots.', 'all-in-one-seo-pack' ), + 'blocked_log' => __( 'Shows log of most recent requests from blocked bots. Note: this will not track any bots that were already blocked at the web server / .htaccess level.', 'all-in-one-seo-pack' ), ); - + $this->default_options = array( - 'block_bots' => Array( 'name' => __( 'Block Bad Bots using HTTP', 'all-in-one-seo-pack' ) ), - 'block_refer' => Array( 'name' => __( 'Block Referral Spam using HTTP', 'all-in-one-seo-pack' ) ), - 'track_blocks' => Array( 'name' => __( 'Track Blocked Bots', 'all-in-one-seo-pack' ) ), - 'htaccess_rules' => Array( 'name' => __( 'Block Bad Bots using .htaccess', 'all-in-one-seo-pack' ) ), - 'edit_blocks' => Array( 'name' => __( 'Use Custom Blocklists', 'all-in-one-seo-pack' ) ), - 'blocklist' => Array( 'name' => __( 'User Agent Blocklist', 'all-in-one-seo-pack' ), 'type' => 'textarea', 'rows' => 5, 'cols' => 120, 'condshow' => Array( "{$this->prefix}edit_blocks" => 'on' ), 'default' => join( "\n", $this->default_bad_bots() ) ), - 'referlist' => Array( 'name' => __( 'Referer Blocklist', 'all-in-one-seo-pack' ), 'type' => 'textarea', 'rows' => 5, 'cols' => 120, 'condshow' => Array( "{$this->prefix}edit_blocks" => 'on', "{$this->prefix}block_refer" => 'on', ), 'default' => join( "\n", $this->default_bad_referers() ) ), - 'blocked_log' => Array( 'name' => __( 'Log Of Blocked Bots', 'all-in-one-seo-pack' ), 'default' => __( 'No requests yet.', 'all-in-one-seo-pack' ), 'type' => 'html', 'disabled' => 'disabled', 'save' => false, 'label' => 'top', 'rows' => 5, 'cols' => 120, 'style' => 'min-width:950px', 'condshow' => Array( "{$this->prefix}track_blocks" => 'on' ) ) + 'block_bots' => array( 'name' => __( 'Block Bad Bots using HTTP', 'all-in-one-seo-pack' ) ), + 'block_refer' => array( 'name' => __( 'Block Referral Spam using HTTP', 'all-in-one-seo-pack' ) ), + 'track_blocks' => array( 'name' => __( 'Track Blocked Bots', 'all-in-one-seo-pack' ) ), + 'htaccess_rules' => array( 'name' => __( 'Block Bad Bots using .htaccess', 'all-in-one-seo-pack' ) ), + 'edit_blocks' => array( 'name' => __( 'Use Custom Blocklists', 'all-in-one-seo-pack' ) ), + 'blocklist' => array( + 'name' => __( 'User Agent Blocklist', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'rows' => 5, + 'cols' => 120, + 'condshow' => array( "{$this->prefix}edit_blocks" => 'on' ), + 'default' => join( "\n", $this->default_bad_bots() ), + ), + 'referlist' => array( + 'name' => __( 'Referer Blocklist', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'rows' => 5, + 'cols' => 120, + 'condshow' => array( + "{$this->prefix}edit_blocks" => 'on', + "{$this->prefix}block_refer" => 'on', + ), + 'default' => join( "\n", $this->default_bad_referers() ), + ), + 'blocked_log' => array( + 'name' => __( 'Log Of Blocked Bots', 'all-in-one-seo-pack' ), + 'default' => __( 'No requests yet.', 'all-in-one-seo-pack' ), + 'type' => 'esc_html', + 'disabled' => 'disabled', + 'save' => false, + 'label' => 'top', + 'rows' => 5, + 'cols' => 120, + 'style' => 'min-width:950px', + 'condshow' => array( "{$this->prefix}track_blocks" => 'on' ), + ), ); - $is_apache = false; - if ( ( !empty($_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) ) { + $is_apache = false; + if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) { $is_apache = true; - add_action( $this->prefix . 'settings_update', Array( $this, 'generate_htaccess_blocklist' ), 10 ); + add_action( $this->prefix . 'settings_update', array( $this, 'generate_htaccess_blocklist' ), 10 ); } else { - unset( $this->default_options["htaccess_rules"] ); - unset( $help_text["htaccess_rules"] ); + unset( $this->default_options['htaccess_rules'] ); + unset( $help_text['htaccess_rules'] ); + } + + if ( ! empty( $help_text ) ) { + foreach ( $help_text as $k => $v ) { + $this->default_options[ $k ]['help_text'] = $v; + } } - - if ( !empty( $help_text ) ) - foreach( $help_text as $k => $v ) - $this->default_options[$k]['help_text'] = $v; - - add_filter( $this->prefix . 'display_options', Array( $this, 'filter_display_options' ) ); - - // load initial options / set defaults - $this->update_options( ); - + + add_filter( $this->prefix . 'display_options', array( $this, 'filter_display_options' ) ); + + // Load initial options / set defaults, + $this->update_options(); + if ( $this->option_isset( 'edit_blocks' ) ) { - add_filter( $this->prefix . 'badbotlist', Array( $this, 'filter_bad_botlist' ) ); + add_filter( $this->prefix . 'badbotlist', array( $this, 'filter_bad_botlist' ) ); if ( $this->option_isset( 'block_refer' ) ) { - add_filter( $this->prefix . 'badreferlist', Array( $this, 'filter_bad_referlist' ) ); + add_filter( $this->prefix . 'badreferlist', array( $this, 'filter_bad_referlist' ) ); } } - + if ( $this->option_isset( 'block_bots' ) ) { - if ( !$this->allow_bot() ) { + if ( ! $this->allow_bot() ) { status_header( 503 ); - $ip = $_SERVER['REMOTE_ADDR']; + $ip = $this->validate_ip( $_SERVER['REMOTE_ADDR'] ); $user_agent = $_SERVER['HTTP_USER_AGENT']; - $this->blocked_message( sprintf( __( "Blocked bot with IP %s -- matched user agent %s found in blocklist.", 'all-in-one-seo-pack' ), $ip, $user_agent ) ); + $this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched user agent %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $user_agent ) ); exit(); } elseif ( $this->option_isset( 'block_refer' ) && $this->is_bad_referer() ) { status_header( 503 ); - $ip = $_SERVER['REMOTE_ADDR']; + $ip = $this->validate_ip( $_SERVER['REMOTE_ADDR'] ); $referer = $_SERVER['HTTP_REFERER']; - $this->blocked_message( sprintf( __( "Blocked bot with IP %s -- matched referer %s found in blocklist.", 'all-in-one-seo-pack' ), $ip, $referer ) ); + $this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched referer %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $referer ) ); } } } - + + /** + * Validate IP. + * + * @param $ip + * + * @since 2.3.7 + * + * @return string + */ + function validate_ip( $ip ) { + + if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) { + // Valid IPV4. + return $ip; + } + + if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) { + // Valid IPV6. + return $ip; + } + + // Doesn't seem to be a valid IP. + return 'invalid IP submitted'; + + } + function generate_htaccess_blocklist() { - if ( !$this->option_isset( 'htaccess_rules' ) ) { + if ( ! $this->option_isset( 'htaccess_rules' ) ) { if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, '' ) ) { - aioseop_output_notice( __( "Updated .htaccess rules.", 'all-in-one-seo-pack' ) ); + aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) ); } else { - aioseop_output_notice( __( "Failed to update .htaccess rules!", 'all-in-one-seo-pack' ), "", "error" ); + aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' ); } - + return; - + } if ( function_exists( 'apache_get_modules' ) ) { $modules = apache_get_modules(); - foreach( Array( 'mod_authz_host', 'mod_setenvif' ) as $m ) { - if ( !in_array( $m, $modules ) ) { - aioseop_output_notice( sprintf( __( "Apache module %s is required!", 'all-in-one-seo-pack' ), $m ), "", "error" ); + foreach ( array( 'mod_authz_host', 'mod_setenvif' ) as $m ) { + if ( ! in_array( $m, $modules ) ) { + aioseop_output_notice( sprintf( __( 'Apache module %s is required!', 'all-in-one-seo-pack' ), $m ), '', 'error' ); } } } $botlist = $this->default_bad_bots(); - $botlist = apply_filters( $this->prefix . "badbotlist", $botlist ); - if ( !empty( $botlist ) ) { - $regex = $this->quote_list_for_regex( $botlist, '"' ); - $htaccess = Array(); + $botlist = apply_filters( $this->prefix . 'badbotlist', $botlist ); + if ( ! empty( $botlist ) ) { + $regex = $this->quote_list_for_regex( $botlist, '"' ); + $htaccess = array(); $htaccess[] = 'SetEnvIfNoCase User-Agent "' . $regex . '" bad_bot'; if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) { $referlist = $this->default_bad_referers(); - $referlist = apply_filters( $this->prefix . "badreferlist", $botlist ); - if ( !empty( $referlist ) ) { - $regex = $this->quote_list_for_regex( $referlist, '"' ); + $referlist = apply_filters( $this->prefix . 'badreferlist', $botlist ); + if ( ! empty( $referlist ) ) { + $regex = $this->quote_list_for_regex( $referlist, '"' ); $htaccess[] = 'SetEnvIfNoCase Referer "' . $regex . '" bad_bot'; } } $htaccess[] = 'Deny from env=bad_bot'; if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, $htaccess ) ) { - aioseop_output_notice( __( "Updated .htaccess rules.", 'all-in-one-seo-pack' ) ); + aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) ); } else { - aioseop_output_notice( __( "Failed to update .htaccess rules!", 'all-in-one-seo-pack' ), "", "error" ); + aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' ); } } else { - aioseop_output_notice( __( "No rules to update!", 'all-in-one-seo-pack' ), "", "error" ); + aioseop_output_notice( __( 'No rules to update!', 'all-in-one-seo-pack' ), '', 'error' ); } } - + + /** + * @param $referlist + * + * @return array + */ function filter_bad_referlist( $referlist ) { if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) { $referlist = explode( "\n", $this->options["{$this->prefix}referlist"] ); } + return $referlist; } - + + /** + * @param $botlist + * + * @return array + */ function filter_bad_botlist( $botlist ) { if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'blocklist' ) ) { $botlist = explode( "\n", $this->options["{$this->prefix}blocklist"] ); } + return $botlist; } - - /** Updates blocked log messages. **/ + + + /** + * Updates blocked message. + * + * @param string $msg + */ function blocked_message( $msg ) { - if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) $this->options["{$this->prefix}blocked_log"] = ''; + if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) { + $this->options["{$this->prefix}blocked_log"] = ''; + } $this->options["{$this->prefix}blocked_log"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}blocked_log"]; if ( $this->strlen( $this->options["{$this->prefix}blocked_log"] ) > 4096 ) { $end = $this->strrpos( $this->options["{$this->prefix}blocked_log"], "\n" ); - if ( $end === false ) $end = 4096; + if ( false === $end ) { + $end = 4096; + } $this->options["{$this->prefix}blocked_log"] = $this->substr( $this->options["{$this->prefix}blocked_log"], 0, $end ); } $this->update_class_option( $this->options ); } - - /** Add in options for status display on settings page, sitemap rewriting on multisite. **/ + + + /** + * Filter display options. + * + * Add in options for status display on settings page, sitemap rewriting on multisite. + * + * @param $options + * + * @return mixed + */ function filter_display_options( $options ) { - if ( $this->option_isset( 'blocked_log' ) ) $options["{$this->prefix}blocked_log"] = '
    ' . $options["{$this->prefix}blocked_log"] . '
    '; + + if ( $this->option_isset( 'blocked_log' ) ) { + if ( preg_match( '/\<(\?php|script)/', $options["{$this->prefix}blocked_log"] ) ) { + $options["{$this->prefix}blocked_log"] = "Probable XSS attempt detected!\n" . $options["{$this->prefix}blocked_log"]; + } + } + return $options; } } diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_feature_manager.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_feature_manager.php index 98b80877bc..2b1080aa20 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_feature_manager.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_feature_manager.php @@ -1,130 +1,191 @@ name = __('Feature Manager', 'all-in-one-seo-pack'); // Human-readable name of the plugin - $this->prefix = 'aiosp_feature_manager_'; // option prefix - $this->file = __FILE__; // the current file + $this->name = __( 'Feature Manager', 'all-in-one-seo-pack' ); // Human-readable name of the plugin. + $this->prefix = 'aiosp_feature_manager_'; // Option prefix. + $this->file = __FILE__; // The current file. parent::__construct(); - $this->module_info = Array( - 'sitemap' => Array( 'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ), - 'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ) ), - 'opengraph' => Array( 'name' => __( 'Social Meta', 'all-in-one-seo-pack' ), - 'description' => __( 'Activate this feature to add Social Meta data to your site to deliver closer integration between your website/blog and Facebook, Twitter, and Google+.', 'all-in-one-seo-pack' ) ), - 'robots' => Array( 'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ), - 'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ) ), - 'file_editor' => Array( 'name' => __( 'File Editor', 'all-in-one-seo-pack' ), - 'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ) ), - 'importer_exporter' => Array( 'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ), - 'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ) ), - 'bad_robots' => Array( 'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ), - 'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ) ), - 'performance' => Array( 'name' => __( 'Performance', 'all-in-one-seo-pack' ), - 'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ), - 'default' => 'on' ) - ); + $this->module_info = array( + 'sitemap' => array( + 'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ), + 'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ), + ), + 'opengraph' => array( + 'name' => __( 'Social Meta', 'all-in-one-seo-pack' ), + 'description' => __( 'Activate this feature to add Social Meta data to your site to deliver closer integration between your website/blog and Facebook, Twitter, and Google+.', 'all-in-one-seo-pack' ), + ), + 'robots' => array( + 'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ), + 'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ), + ), + 'file_editor' => array( + 'name' => __( 'File Editor', 'all-in-one-seo-pack' ), + 'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ), + ), + 'importer_exporter' => array( + 'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ), + 'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ), + ), + 'bad_robots' => array( + 'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ), + 'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ), + ), + 'performance' => array( + 'name' => __( 'Performance', 'all-in-one-seo-pack' ), + 'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ), + 'default' => 'on', + ), + ); + if ( AIOSEOPPRO ) { - if( AIOSEOPPRO ){ + $this->module_info['coming_soon'] = array( + 'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ), + 'description' => __( 'Image SEO', 'all-in-one-seo-pack' ), + 'save' => false, + ); + $this->module_info['video_sitemap'] = array( + 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ), + 'description' => __( 'Create and manage your Video Sitemap using this feature and submit your Video Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ), + ); - $this->module_info['coming_soon'] = Array( 'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ), - 'description' => __( 'Image SEO', 'all-in-one-seo-pack' ), - 'save' => false ); - $this->module_info['video_sitemap'] = Array( 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ), - 'description' => __( 'Create and manage your Video Sitemap using this feature and submit your Video Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ) ); + } else { + $this->module_info['coming_soon'] = array( + 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ), + 'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ), + 'save' => false, + ); - }else{ + } - $this->module_info['coming_soon'] = Array( 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ), - 'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ), - 'save' => false ) ; + // Set up default settings fields. + // Name - Human-readable name of the setting. + // Help_text - Inline documentation for the setting. + // Type - Type of field; this defaults to checkbox; currently supported types are checkbox, text, select, multiselect. + // Default - Default value of the field. + // Initial_options - Initial option list used for selects and multiselects. + // Other supported options: class, id, style -- allows you to set these HTML attributes on the field. - } + $this->default_options = array(); + $this->module_info = apply_filters( 'aioseop_module_info', $this->module_info ); + $mod[] = 'coming_soon'; - // Set up default settings fields - // name - Human-readable name of the setting - // help_text - Inline documentation for the setting - // type - Type of field; this defaults to checkbox; currently supported types are checkbox, text, select, multiselect - // default - Default value of the field - // initial_options - Initial option list used for selects and multiselects - // Other supported options: class, id, style -- allows you to set these HTML attributes on the field + foreach ( $mod as $m ) { + if ( 'performance' === $m && ! is_super_admin() ) { + continue; + } + $this->default_options["enable_$m"] = array( + 'name' => $this->module_info[ $m ]['name'], + 'help_text' => $this->module_info[ $m ]['description'], + 'type' => 'custom', + 'class' => 'aioseop_feature', + 'id' => "aioseop_$m", + 'save' => true, + ); - $this->default_options = array(); - $this->module_info = apply_filters( 'aioseop_module_info', $this->module_info ); - $mod[] = 'coming_soon'; - - foreach ( $mod as $m ) { - if ( $m == 'performance' && !is_super_admin() ) continue; - $this->default_options["enable_$m"] = Array( 'name' => $this->module_info[$m]['name'], - 'help_text' => $this->module_info[$m]['description'], - 'type' => 'custom', - 'class' => 'aioseop_feature', - 'id' => "aioseop_$m", - 'save' => true ); - - if ( !empty( $this->module_info[$m]['image'] ) ) - $this->default_options["enable_$m"]['image'] = $this->module_info[$m]['image']; - if ( !empty( $this->module_info[$m] ) ) - foreach( Array( 'save', 'default' ) as $option ) - if ( isset( $this->module_info[$m][$option] ) ) - $this->default_options["enable_$m"][$option] = $this->module_info[$m][$option]; + if ( ! empty( $this->module_info[ $m ]['image'] ) ) { + $this->default_options["enable_$m"]['image'] = $this->module_info[ $m ]['image']; + } + if ( ! empty( $this->module_info[ $m ] ) ) { + foreach ( array( 'save', 'default' ) as $option ) { + if ( isset( $this->module_info[ $m ][ $option ] ) ) { + $this->default_options["enable_$m"][ $option ] = $this->module_info[ $m ][ $option ]; + } + } + } } - $this->layout = Array( - 'default' => Array( - 'name' => $this->name, - 'help_link' => 'http://semperplugins.com/documentation/feature-manager/', - 'options' => array_keys( $this->default_options ) - ) + $this->layout = array( + 'default' => array( + 'name' => $this->name, + 'help_link' => 'http://semperplugins.com/documentation/feature-manager/', + 'options' => array_keys( $this->default_options ), + ), ); - // load initial options / set defaults - $this->update_options( ); + // Load initial options / set defaults. + $this->update_options(); if ( is_admin() ) { - add_filter( $this->prefix . 'output_option', Array( $this, 'display_option_div' ), 10, 2 ); - add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ) ); + add_filter( $this->prefix . 'output_option', array( $this, 'display_option_div' ), 10, 2 ); + add_filter( $this->prefix . 'submit_options', array( $this, 'filter_submit' ) ); } } + /** + * Determines the menu order. + * + * @return int + */ function menu_order() { return 20; } + /** + * @param $submit + * + * @return mixed + */ function filter_submit( $submit ) { - $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' »'; - $submit['Submit']['class'] .= " hidden"; + $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' »'; + $submit['Submit']['class'] .= ' hidden'; $submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' »'; + return $submit; } + /** + * @param $buf + * @param $args + * + * @return string + */ function display_option_div( $buf, $args ) { $name = $img = $desc = $checkbox = $class = ''; - if ( isset( $args['options']['help_text'] ) && !empty( $args['options']['help_text'] ) ) + if ( isset( $args['options']['help_text'] ) && ! empty( $args['options']['help_text'] ) ) { $desc .= '

    ' . $args['options']['help_text'] . '

    '; - if ($args['value']) $class = ' active'; - if ( isset( $args['options']['image'] ) && !empty( $args['options']['image'] ) ) + } + if ( $args['value'] ) { + $class = ' active'; + } + if ( isset( $args['options']['image'] ) && ! empty( $args['options']['image'] ) ) { $img .= '

    '; - else + } else { $img .= '

    '; + } if ( $args['options']['save'] ) { $name = "

    {$args['options']['name']}

    "; - $checkbox .= ''; } else { $name = "{$args['options']['name']}"; } - if ( !empty( $args['options']['id'] ) ) $args['attr'] .= " id='{$args['options']['id']}'"; - return $buf . "
    "; + if ( ! empty( $args['options']['id'] ) ) { + $args['attr'] .= " id='{$args['options']['id']}'"; + } + + return $buf . "
    "; } } } diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_file_editor.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_file_editor.php index 980260b66c..5d0f41db89 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_file_editor.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_file_editor.php @@ -1,93 +1,145 @@ name = __('File Editor', 'all-in-one-seo-pack'); // Human-readable name of the plugin - $this->prefix = 'aiosp_file_editor_'; // option prefix - $this->file = __FILE__; // the current file + /** + * All_in_One_SEO_Pack_File_Editor constructor. + */ + function __construct() { + $this->name = __( 'File Editor', 'all-in-one-seo-pack' ); // Human-readable name of the plugin + $this->prefix = 'aiosp_file_editor_'; // option prefix + $this->file = __FILE__; // the current file parent::__construct(); - if ( isset($_REQUEST['tab'] ) ) + $this->current_tab = 'robots'; + if ( isset( $_REQUEST['tab'] ) ) { $this->current_tab = $_REQUEST['tab']; - else - $this->current_tab = 'robots'; + } - $help_text = Array( - 'robotfile' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ), - 'htaccfile' => __( '.htaccess editor', 'all-in-one-seo-pack' ) + $help_text = array( + 'robotfile' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ), + 'htaccfile' => __( '.htaccess editor', 'all-in-one-seo-pack' ), ); $this->default_options = array( - 'robotfile' => Array( 'name' => __( 'Edit Robots.txt', 'all-in-one-seo-pack'), - 'save' => false, 'default' => '', 'type' => 'textarea', 'cols' => 70, 'rows' => 25, 'label' => 'top' ), - 'htaccfile' => Array( 'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack'), - 'save' => false, 'default' => '', 'type' => 'textarea', 'cols' => 70, 'rows' => 25, 'label' => 'top' ) + 'robotfile' => array( + 'name' => __( 'Edit Robots.txt', 'all-in-one-seo-pack' ), + 'save' => false, + 'default' => '', + 'type' => 'textarea', + 'cols' => 70, + 'rows' => 25, + 'label' => 'top', + ), + 'htaccfile' => array( + 'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ), + 'save' => false, + 'default' => '', + 'type' => 'textarea', + 'cols' => 70, + 'rows' => 25, + 'label' => 'top', + ), ); - if ( !empty( $help_text ) ) - foreach( $help_text as $k => $v ) - $this->default_options[$k]['help_text'] = $v; - $this->tabs = Array( - 'robots' => Array( 'name' => __( 'robots.txt' ) ), - 'htaccess' => Array( 'name' => __( '.htaccess' ) ) - ); - - $this->layout = Array( - 'robots' => Array( - 'name' => __( 'Edit robots.txt', 'all-in-one-seo-pack' ), - 'options' => Array( 'robotfile' ), - 'tab' => 'robots' - ), - 'htaccess' => Array( - 'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ), - 'options' => Array( 'htaccfile' ), - 'tab' => 'htaccess' - ) - ); - - $this->update_options( ); // load initial options / set defaults + if ( ! empty( $help_text ) ) { + foreach ( $help_text as $k => $v ) { + $this->default_options[ $k ]['help_text'] = $v; + } + } + $this->tabs = array( + 'robots' => array( 'name' => __( 'robots.txt' ) ), + 'htaccess' => array( 'name' => __( '.htaccess' ) ), + ); + + $this->layout = array( + 'robots' => array( + 'name' => __( 'Edit robots.txt', 'all-in-one-seo-pack' ), + 'options' => array( 'robotfile' ), + 'tab' => 'robots', + ), + 'htaccess' => array( + 'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ), + 'options' => array( 'htaccfile' ), + 'tab' => 'htaccess', + ), + ); + + $this->update_options(); // load initial options / set defaults } - + function settings_page_init() { - add_filter($this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 ); - add_filter($this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 ); + add_filter( $this->prefix . 'display_options', array( $this, 'filter_options' ), 10, 2 ); + add_filter( $this->prefix . 'submit_options', array( $this, 'filter_submit' ), 10, 2 ); } - + function add_page_hooks() { parent::add_page_hooks(); - add_action($this->prefix . 'settings_update', Array($this, 'do_file_editor'), 10, 2 ); + add_action( $this->prefix . 'settings_update', array( $this, 'do_file_editor' ), 10, 2 ); } - + + /** + * @param $submit + * @param $location + * + * @return mixed + */ function filter_submit( $submit, $location ) { unset( $submit['Submit_Default'] ); $submit['Submit']['type'] = 'hidden'; - if ( $this->current_tab == 'robots' ) - $submit['Submit_File_Editor'] = Array( 'type' => 'submit', 'class' => 'button-primary', 'value' => __('Update robots.txt', 'all-in-one-seo-pack') . ' »' ); - elseif ( $this->current_tab == 'htaccess' ) - $submit['Submit_htaccess'] = Array( 'type' => 'submit', 'class' => 'button-primary', 'value' => __('Update .htaccess', 'all-in-one-seo-pack') . ' »' ); + if ( 'robots' === $this->current_tab ) { + $submit['Submit_File_Editor'] = array( + 'type' => 'submit', + 'class' => 'button-primary', + 'value' => __( 'Update robots.txt', 'all-in-one-seo-pack' ) . ' »', + ); + } elseif ( 'htaccess' === $this->current_tab ) { + $submit['Submit_htaccess'] = array( + 'type' => 'submit', + 'class' => 'button-primary', + 'value' => __( 'Update .htaccess', 'all-in-one-seo-pack' ) . ' »', + ); + } + return $submit; } - + + /** + * @param $options + * @param $location + * + * @return mixed + */ function filter_options( $options, $location ) { $prefix = $this->get_prefix( $location ); - if ( $this->current_tab == 'robots' ) - $options = $this->load_files( $options, Array( 'robotfile' => 'robots.txt' ), $prefix ); - elseif ( $this->current_tab == 'htaccess' ) - $options = $this->load_files( $options, Array( 'htaccfile' => '.htaccess' ), $prefix ); + if ( 'robots' === $this->current_tab ) { + $options = $this->load_files( $options, array( 'robotfile' => 'robots.txt' ), $prefix ); + } elseif ( 'htaccess' === $this->current_tab ) { + $options = $this->load_files( $options, array( 'htaccfile' => '.htaccess' ), $prefix ); + } + return $options; } + /** + * @param $options This seems to be unused. + * @param $location + */ function do_file_editor( $options, $location ) { $prefix = $this->get_prefix( $location ); - if ( $this->current_tab == 'robots' && isset($_POST['Submit_File_Editor']) && $_POST['Submit_File_Editor'] ) - $this->save_files( Array( 'robotfile' => 'robots.txt' ), $prefix ); - elseif ( $this->current_tab == 'htaccess' && isset($_POST['Submit_htaccess']) && $_POST['Submit_htaccess'] ) - $this->save_files( Array( 'htaccfile' => '.htaccess' ), $prefix ); + if ( 'robots' === $this->current_tab && isset( $_POST['Submit_File_Editor'] ) && $_POST['Submit_File_Editor'] ) { + $this->save_files( array( 'robotfile' => 'robots.txt' ), $prefix ); + } elseif ( 'htaccess' === $this->current_tab && isset( $_POST['Submit_htaccess'] ) && $_POST['Submit_htaccess'] ) { + $this->save_files( array( 'htaccfile' => '.htaccess' ), $prefix ); + } } } -} \ No newline at end of file +} diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_importer_exporter.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_importer_exporter.php index 387d538503..f3ed692d1d 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_importer_exporter.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_importer_exporter.php @@ -1,320 +1,572 @@ name = __( 'Importer & Exporter', 'all-in-one-seo-pack' ); // Human-readable name of the module - $this->prefix = 'aiosp_importer_exporter_'; // option prefix - $this->file = __FILE__; + + /** + * All_in_One_SEO_Pack_Importer_Exporter constructor. + */ + function __construct() { + $this->name = __( 'Importer & Exporter', 'all-in-one-seo-pack' ); // Human-readable name of the module + $this->prefix = 'aiosp_importer_exporter_'; // option prefix + $this->file = __FILE__; parent::__construct(); - $help_text = Array( - "import_submit" => __( "Select a valid All in One SEO Pack ini file and click 'Import' to import options from a previous state or install of All in One SEO Pack.
    Click here for documentation on this setting", 'all-in-one-seo-pack' ), - "export_choices" => __( "You may choose to export settings from active modules, and content from post data.
    Click here for documentation on this setting", 'all-in-one-seo-pack'), - "export_post_types" => __( "Select which Post Types you want to export your All in One SEO Pack meta data for.
    Click here for documentation on this setting", 'all-in-one-seo-pack') + $help_text = Array( + 'import_submit' => __( + "Select a valid All in One SEO Pack ini file and click 'Import' to import options from a previous state or install of All in One SEO Pack.
    Click here for documentation on this setting", + 'all-in-one-seo-pack' + ), + 'export_choices' => __( + "You may choose to export settings from active modules, and content from post data.
    Click here for documentation on this setting", + 'all-in-one-seo-pack' + ), + 'export_post_types' => __( + "Select which Post Types you want to export your All in One SEO Pack meta data for.
    Click here for documentation on this setting", + 'all-in-one-seo-pack' + ), ); - $this->warnings = Array(); + $this->warnings = Array(); $this->default_options = array( - 'import_submit' => Array( 'name' => __( 'Import', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'file', 'save' => false ), - 'export_choices' => Array( 'name' => __( 'Export Settings', 'all-in-one-seo-pack'), - 'type' => 'multicheckbox', - 'initial_options' => Array( 1 => 'General Settings', - 2 => 'Post Data' ) ), - 'export_post_types' => Array( 'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ), - 'default' => Array( 'post' => 'post', 'page' => 'page' ), - 'type' => 'multicheckbox', - 'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ) ), - 'import_export_help' => Array( 'type' => 'html', 'label' => 'none', 'default' => __( "Note: If General Settings is checked, the General Settings, the Feature Manager settings, and the following currently active modules will have their settings data exported:", 'all-in-one-seo-pack') . "
    " ) + 'import_submit' => Array( + 'name' => __( 'Import', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'file', + 'save' => false, + ), + 'export_choices' => Array( + 'name' => __( 'Export Settings', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'initial_options' => Array( + 1 => 'General Settings', + 2 => 'Post Data', + ), + ), + 'export_post_types' => Array( + 'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ), + 'default' => Array( + 'post' => 'post', + 'page' => 'page', + ), + 'type' => 'multicheckbox', + 'initial_options' => $this->get_post_type_titles( + Array( '_builtin' => false ) + ), + ), + 'import_export_help' => Array( + 'type' => 'html', + 'label' => 'none', + 'default' => __( + 'Note: If General Settings is checked, the + General Settings, the Feature Manager settings, + and the following currently active modules will + have their settings data exported:', + 'all-in-one-seo-pack' + ) . '
    ', + ), ); - - if ( !empty( $help_text ) ) - foreach( $help_text as $k => $v ) - $this->default_options[$k]['help_text'] = $v; - + if ( ! empty( $help_text ) ) { + foreach ( $help_text as $k => $v ) { + $this->default_options[ $k ]['help_text'] = $v; + } + } $this->layout = Array( 'default' => Array( - 'name' => $this->name, - 'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/', - 'options' => array_keys( $this->default_options ) - ) + 'name' => $this->name, + 'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/', + 'options' => array_keys( $this->default_options ), + ), ); - - // load initial options / set defaults + // load initial options / set defaults add_action( 'admin_init', Array( $this, 'debug_post_types' ), 5 ); } - + + function settings_page_init() { - add_filter($this->prefix . 'submit_options', Array( $this, 'filter_submit' ) ); + add_filter( + $this->prefix . 'submit_options', + Array( $this, 'filter_submit' ) + ); } - + + + /** + * @param $submit + * + * @return array + */ function filter_submit( $submit ) { - $submit['Submit']['value'] = __('Import', 'all-in-one-seo-pack') . ' »'; - return Array( 'export_submit' => Array( 'type' => 'submit', - 'class' => 'button-primary', - 'value' => __('Export', 'all-in-one-seo-pack') . ' »' ) ) + $submit; + $submit['Submit']['value'] = __( + 'Import', + 'all-in-one-seo-pack' + ) + . ' »'; + + return Array( + 'export_submit' => Array( + 'type' => 'submit', + 'class' => 'button-primary', + 'value' => __( 'Export', 'all-in-one-seo-pack' ) . ' »', + ), + ) + $submit; } - - function debug_post_types( ) { - $post_types = $this->get_post_type_titles( ); - $rempost = array( 'attachment' => 1, 'revision' => 1, 'nav_menu_item' => 1 ); - $this->default_options['export_post_types']['initial_options'] = array_diff_key( $post_types, $rempost ); - + + + function debug_post_types() { + $post_types = $this->get_post_type_titles(); + $rempost = array( + 'attachment' => 1, + 'revision' => 1, + 'nav_menu_item' => 1, + ); + $this->default_options['export_post_types']['initial_options'] = array_diff_key( + $post_types, + $rempost + ); global $aioseop_modules; - if ( !empty( $aioseop_modules ) ) { + if ( ! empty( $aioseop_modules ) ) { $modules = $aioseop_modules->get_loaded_module_list(); - if ( !empty( $modules ) && !empty( $modules['feature_manager'] ) ) + if ( ! empty( $modules ) && ! empty( $modules['feature_manager'] ) ) { unset( $modules['feature_manager'] ); - if ( !empty( $modules ) ) { + } + if ( ! empty( $modules ) ) { $this->default_options['import_export_help']['default'] .= "
      \n"; - foreach( $modules as $m ) { + foreach ( $modules as $m ) { $module = $aioseop_modules->return_module( $m ); - $this->default_options['import_export_help']['default'] .= "\t
    • " . $module->name . "
    • \n"; + $this->default_options['import_export_help']['default'] .= + "\t
    • " . $module->name . "
    • \n"; } - $this->default_options['import_export_help']['default'] .= "\n
    \n"; - } else $this->default_options['import_export_help']['default'] .= "
    " . __( "There are no other modules currently loaded!", 'all-in-one-seo-pack' ); + $this->default_options['import_export_help']['default'] .= "\n\n"; + } else { + $this->default_options['import_export_help']['default'] .= '
    ' + . __( + 'There are no other modules currently loaded!', + 'all-in-one-seo-pack' + ); + } } - $this->default_options['import_export_help']['default'] .= '
    ' . __( "You may change this by activating or deactivating modules in the Feature Manager.", 'all-in-one-seo-pack' ); - $this->update_options( ); - - if ( !empty( $_REQUEST['export_submit'] ) ) + $this->default_options['import_export_help']['default'] .= '
    ' + . __( + 'You may change this by activating or deactivating + modules in the Feature Manager.', + 'all-in-one-seo-pack' + ); + $this->update_options(); + if ( ! empty( $_REQUEST['export_submit'] ) ) { $this->do_importer_exporter(); - else - add_action( $this->prefix . 'settings_update', Array( $this, 'do_importer_exporter' ) ); + } else { + add_action( + $this->prefix . 'settings_update', + Array( $this, 'do_importer_exporter' ) + ); + } } - - function importer_exporter_export( $args ){ - /* Add all settings to settings file */ + + /** + * @param $args + * + * @return string + */ + function importer_exporter_export( $args ) { + + // Adds all settings to settings file $name = $this->get_option_name(); - - $buf = '[' . $this->get_option_name() . "]\n"; - if( !empty( $this->options ) ) { + $buf = '[' . $this->get_option_name() . "]\n"; + if ( ! empty( $this->options ) ) { foreach ( $this->options as $key => $value ) { - $buf .= "$key = '" . str_replace("'", "\'", trim( serialize( $value ) ) ) . "'\n"; + $buf .= "$key = '" . str_replace( + "'", + "\'", + trim( serialize( $value ) ) + ) . "'\n"; } } + return $buf; } - - function show_import_warnings(){ + + + function show_import_warnings() { + echo '
    '; - if( is_array( $this->warnings ) ){ - foreach( $this->warnings as $warning ){ - echo "

    {$warning}

    "; - } + + if ( is_array( $this->warnings ) ) { + foreach ( $this->warnings as $warning ) { + echo "

    " . esc_html( $warning ) . "

    "; } + } echo '
    '; } - + + + /** + * @param $array + * + * @return array + */ function parse_ini_helper( $array ) { - $returnArray = array(); - if (is_array($array)) { - foreach ($array as $key => $value) { - $e = explode(':', $key); - if (!empty($e[1])) { - $x = array(); - foreach ($e as $tk => $tv) { - $x[$tk] = trim($tv); - } - $x = array_reverse($x, true); - foreach ($x as $k => $v) { - $c = $x[0]; - if (empty($returnArray[$c])) { - $returnArray[$c] = array(); - } - if (isset($returnArray[$x[1]])) { - $returnArray[$c] = array_merge($returnArray[$c], $returnArray[$x[1]]); - } - if ($k === 0) { - $returnArray[$c] = array_merge($returnArray[$c], $array[$key]); - } - } - } else { - $returnArray[$key] = $array[$key]; - } - } - } - return $returnArray; + $returnArray = array(); + if ( is_array( $array ) ) { + foreach ( $array as $key => $value ) { + $e = explode( ':', $key ); + if ( ! empty( $e[1] ) ) { + $x = array(); + foreach ( $e as $tk => $tv ) { + $x[ $tk ] = trim( $tv ); + } + $x = array_reverse( $x, true ); + foreach ( $x as $k => $v ) { + $c = $x[0]; + if ( empty( $returnArray[ $c ] ) ) { + $returnArray[ $c ] = array(); + } + if ( isset( $returnArray[ $x[1] ] ) ) { + $returnArray[ $c ] = array_merge( + $returnArray[ $c ], $returnArray[ $x[1] ] + ); + } + if ( $k === 0 ) { + $returnArray[ $c ] = array_merge( + $returnArray[ $c ], $array[ $key ] + ); + } + } + } else { + $returnArray[ $key ] = $array[ $key ]; + } + } + } + + return $returnArray; } - + + + /** + * @param $array + * + * @return array + */ function recursive_parse( $array ) { - $returnArray = array(); - if (is_array($array)) { - foreach ($array as $key => $value) { - if (is_array($value)) { - $array[$key] = $this->recursive_parse( $value ); - } - $x = explode('.', $key); - if (!empty($x[1])) { - $x = array_reverse($x, true); - if (isset($returnArray[$key])) { - unset($returnArray[$key]); - } - if (!isset($returnArray[$x[0]])) { - $returnArray[$x[0]] = array(); - } - $first = true; - foreach ($x as $k => $v) { - if ($first === true) { - $b = $array[$key]; - $first = false; - } - $b = array($v => $b); - } - $returnArray[$x[0]] = array_merge_recursive( $returnArray[$x[0]], $b[$x[0]] ); - } else { - $returnArray[$key] = $array[$key]; - } - } - } - return $returnArray; + $returnArray = array(); + if ( is_array( $array ) ) { + foreach ( $array as $key => $value ) { + if ( is_array( $value ) ) { + $array[ $key ] = $this->recursive_parse( $value ); + } + $x = explode( '.', $key ); + if ( ! empty( $x[1] ) ) { + $x = array_reverse( $x, true ); + if ( isset( $returnArray[ $key ] ) ) { + unset( $returnArray[ $key ] ); + } + if ( ! isset( $returnArray[ $x[0] ] ) ) { + $returnArray[ $x[0] ] = array(); + } + $first = true; + foreach ( $x as $k => $v ) { + if ( $first === true ) { + $b = $array[ $key ]; + $first = false; + } + $b = array( $v => $b ); + } + $returnArray[ $x[0] ] = array_merge_recursive( + $returnArray[ $x[0] ], $b[ $x[0] ] + ); + } else { + $returnArray[ $key ] = $array[ $key ]; + } + } + } + + return $returnArray; } - - function get_ini_file( $assoc_arr, $has_sections=TRUE ) { - $content = ""; - if ($has_sections) { - foreach ($assoc_arr as $key=>$elem) { - $content .= "[".$key."]\n"; - foreach ($elem as $key2=>$elem2) { - if(is_array($elem2)) - { - for($i=0;$i$elem) { - if( is_array( $elem ) ) { - for($i=0;$i $elem ) { + $content .= '[' . $key . "]\n"; + foreach ( $elem as $key2 => $elem2 ) { + if ( is_array( $elem2 ) ) { + for ( $i = 0; $i < count( $elem2 ); $i ++ ) { + $content .= $key2 . "[] = \"" . $elem2[ $i ] . "\"\n"; + } + } else if ( $elem2 == '' ) { + $content .= $key2 . " = \n"; + } else { + $content .= $key2 . " = \"" . $elem2 . "\"\n"; + } + } + } + } else { + foreach ( $assoc_arr as $key => $elem ) { + if ( is_array( $elem ) ) { + for ( $i = 0; $i < count( $elem ); $i ++ ) { + $content .= $key2 . "[] = \"" . $elem[ $i ] . "\"\n"; + } + } else if ( $elem == '' ) { + $content .= $key2 . " = \n"; + } else { + $content .= $key2 . " = \"" . $elem . "\"\n"; + } + } + } + + return $content; } - + + + /** + * @param $string + * + * @return array + */ function parse_ini_advanced( $string ) { - return $this->recursive_parse( $this->parse_ini_helper( parse_ini_string( $string, true ) ) ); + return $this->recursive_parse( + $this->parse_ini_helper( + parse_ini_string( $string, true ) + ) + ); } - - function do_importer_exporter( ) { - $submit = null; $count = 0; $post_exists = null; $post_warning = null; + + + function do_importer_exporter() { + $submit = null; + $count = 0; + $post_exists = null; + $post_warning = null; global $aioseop_options, $aiosp, $aioseop_module_list; - if ( isset( $_REQUEST['nonce-aioseop'] ) ) $nonce = $_REQUEST['nonce-aioseop']; - $post_fields = Array( 'keywords', 'description', 'title', 'meta', 'disable', 'disable', 'disable_analytics', 'titleatr', 'menulabel', 'togglekeywords' ); - if ( !empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) $submit = "Import"; - if ( !empty( $_REQUEST['export_submit'] ) ) $submit = 'Export'; - if ( ($submit != null ) && ( wp_verify_nonce( $nonce, 'aioseop-nonce') ) ) { + if ( isset( $_REQUEST['nonce-aioseop'] ) ) { + $nonce = $_REQUEST['nonce-aioseop']; + } + $post_fields = Array( + 'keywords', + 'description', + 'title', + 'meta', + 'disable', + 'disable', + 'disable_analytics', + 'titleatr', + 'menulabel', + 'togglekeywords', + ); + if ( ! empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) { + $submit = 'Import'; + } + if ( ! empty( $_REQUEST['export_submit'] ) ) { + $submit = 'Export'; + } + if ( ( $submit != null ) && wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) { switch ( $submit ) { case 'Import': - /* Parse export file */ - $file = file( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ); - $section = Array(); $section_label = null; - foreach ( $file as $line_number => $line ) { - $line = trim( $line ); + try { + // Parses export file + $file = $this->get_sanitized_file( + $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] + ); + $section = Array(); + $section_label = null; + foreach ( $file as $line_number => $line ) { + $line = trim( $line ); $matches = Array(); - if ( empty( $line ) ) continue; - if ( $line[0] == ';' ) continue; - if ( preg_match("/^\[(\S+)\]$/", $line, $label ) ) { + if ( empty( $line ) ) { + continue; + } + if ( $line[0] == ';' ) { + continue; + } + if ( preg_match( "/^\[(\S+)\]$/", $line, $label ) ) { $section_label = strval( $label[1] ); - if ( $section_label == 'post_data') $count++; - if ( !isset( $section[ $section_label ] ) ) + if ( $section_label == 'post_data' ) { + $count ++; + } + if ( ! isset( $section[ $section_label ] ) ) { $section[ $section_label ] = Array(); + } } elseif ( preg_match( "/^(\S+)\s*=\s*'(.*)'$/", $line, $matches ) ) { - if ( $section_label == 'post_data') - $section[ $section_label ][$count][ $matches[ 1 ] ] = $matches[ 2 ]; - else - $section[ $section_label ][ $matches[ 1 ] ] = $matches[ 2 ]; + if ( $section_label == 'post_data' ) { + $section[ $section_label ][ $count ][ $matches[1] ] = $matches[2]; + } else { + $section[ $section_label ][ $matches[1] ] = $matches[2]; + } } elseif ( preg_match( "/^(\S+)\s*=\s*NULL$/", $line, $matches ) ) { - if( $section_label == 'post_data' ) - $section[ $section_label ][$count][ $matches[ 1 ] ] = NULL; - else - $section[ $section_label ][ $matches[ 1 ] ] = NULL; + if ( $section_label == 'post_data' ) { + $section[ $section_label ][ $count ][ $matches[1] ] = null; + } else { + $section[ $section_label ][ $matches[1] ] = null; + } } else { - $this->warnings[] = sprintf( __( 'Warning: Line not matched: "%s", On Line: %s', 'all-in-one-seo-pack' ), $line, $line_number ) ; + $this->warnings[] = sprintf( + __( + 'Warning: Line not matched: "%s", On Line: %s', + 'all-in-one-seo-pack' + ), + $line, + $line_number + ); } - } - /* Update Plugin Settings */ - if( is_array( $section ) ) { - foreach( $section as $label => $module_options ) { - if( is_array( $module_options ) ) { - foreach( $module_options as $key => $value ) { - /* Update Post Data */ - if( $label == 'post_data' ) { - $post_exists = post_exists( $module_options[$key]['post_title'], '', $module_options[$key]['post_date'] ); - $target = get_post( $post_exists ); - if( ( !empty( $module_options[$key]['post_type'] ) ) && $post_exists != null ) { - if( is_array($value) ) - foreach ( $value as $field_name => $field_value ) - if ( substr( $field_name, 1, 7) == 'aioseop' ) - if ( $value ) - update_post_meta( $target->ID, $field_name, maybe_unserialize( $field_value ) ); - else - delete_post_meta($target->ID, $field_name ); - $post_exists = null; + } + + // Updates Plugin Settings + if ( is_array( $section ) ) { + foreach ( $section as $label => $module_options ) { + if ( is_array( $module_options ) ) { + foreach ( $module_options as $key => $value ) { + + // Updates Post Data + if ( $label == 'post_data' ) { + $post_exists = post_exists( + $module_options[ $key ]['post_title'], + '', + $module_options[ $key ]['post_date'] + ); + $target = get_post( $post_exists ); + if ( ( ! empty( $module_options[ $key ]['post_type'] ) ) + && $post_exists != null + ) { + if ( is_array( $value ) ) { + foreach ( $value as $field_name => $field_value ) { + if ( substr( $field_name, 1, 7 ) == 'aioseop' ) { + if ( $value ) { + update_post_meta( + $target->ID, + $field_name, + maybe_unserialize( $field_value ) + ); + } else { + delete_post_meta( + $target->ID, + $field_name + ); + } + } + } + } + $post_exists = null; + } else { + $target_title = $module_options[ $key ]['post_title']; + $post_warning = sprintf( + __( + 'Warning: This following post could not be found: "%s"', + 'all-in-one-seo-pack' + ), + $target_title + ); + } + if ( $post_warning != null ) { + $this->warnings[] = $post_warning; + $post_warning = null; + } + + // Updates Module Settings } else { - $target_title = $module_options[$key]['post_title']; - $post_warning = sprintf( __( 'Warning: This following post could not be found: "%s"', 'all-in-one-seo-pack' ), $target_title ); - } - if ( $post_warning != null ) { - $this->warnings[] = $post_warning; - $post_warning = null; + $module_options[ $key ] = str_replace( + Array( "\'", '\n', '\r' ), + Array( "'", "\n", "\r" ), + maybe_unserialize( $value ) + ); } - - /* Update Module Settings */ - } else{ $module_options[$key] = str_replace( Array( "\'", '\n', '\r' ), Array( "'", "\n", "\r" ), maybe_unserialize( $value ) ); } + } + + // Updates Module Settings + $this->update_class_option( + $module_options, + $label + ); } - /* Update Module Settings */ - $this->update_class_option( $module_options, $label ); } } - } - - - - /* Show all errors found */ - if( !empty( $this->warnings ) ) { - add_action( $this->prefix . 'settings_header', Array( $this, 'show_import_warnings' ), 5 ); + } catch ( Exception $e ) { + $this->warnings[] = $e->getMessage(); } - - break; - case 'Export': - - /* Create File Contents */ - $settings_file = "settings_aioseop.ini"; - $buf = "; " . __( 'Settings export file for All in One SEO Pack', 'all-in-one-seo-pack' ) . "\n"; - - /* Add all settings to settings file */ + + // Shows all errors found + if ( ! empty( $this->warnings ) ) { + add_action( + $this->prefix . 'settings_header', + Array( $this, 'show_import_warnings' ), + 5 + ); + } + + break; + case 'Export': + + // Creates Files Contents + $settings_file = 'settings_aioseop.ini'; + $buf = '; ' . __( + 'Settings export file for All in One SEO Pack', ' + all-in-one-seo-pack' + ) . "\n"; + + // Adds all settings to settings file $buf = $aiosp->settings_export( $buf ); $buf = apply_filters( 'aioseop_export_settings', $buf ); - - /* Send File to browser */ - $strlength = strlen($buf); - header("Content-type: application/ini"); - header("Content-Disposition: attachment; filename=$settings_file"); - header("Content-Length: " . $strlength); - + + // Sends File to browser + $strlength = strlen( $buf ); + header( 'Content-type: application/ini' ); + header( + "Content-Disposition: + attachment; filename=$settings_file" + ); + header( 'Content-Length: ' . $strlength ); echo $buf; die(); - break; + break; } - } + } + } + + + function settings_update() { } - - function settings_update( ) { + + /** + * Returns sanitized imported file. + * + * @since + * + * @param string $filename Path to where the uploaded file is located. + * + * @return array Sanitized file as array. + * @throws Exception + */ + private function get_sanitized_file( $filename ) { + $file = file( $filename ); + for ( $i = count( $file ) - 1; $i >= 0; -- $i ) { + // Remove insecured lines + if ( preg_match( '/\<(\?php|script)/', $file[ $i ] ) ) { + throw new Exception( __( + 'Security warning: Your file looks compromised. Please check the file for any script-injection.', + 'all-in-one-seo-pack' + ) ); + } + // Apply security filters + $file[ $i ] = strip_tags( trim( $file[ $i ] ) ); + // Remove empty lines + if ( empty( $file[ $i ] ) ) { + unset( $file[ $i ] ); + } + } + + return $file; } } } diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_opengraph.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_opengraph.php index 71ac508d1f..26e419cf0f 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_opengraph.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_opengraph.php @@ -5,220 +5,393 @@ /** * The Opengraph class. */ -if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) { +if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) { class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module { var $fb_object_types; var $type; - function __construct( ) { - $this->name = __('Social Meta', 'all-in-one-seo-pack'); // Human-readable name of the plugin - $this->prefix = 'aiosp_opengraph_'; // option prefix - $this->file = __FILE__; // the current file + function __construct() { + $this->name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin + $this->prefix = 'aiosp_opengraph_'; // option prefix + $this->file = __FILE__; // the current file $this->fb_object_types = Array( - 'Activities' => Array( + 'Activities' => Array( 'activity' => __( 'Activity', 'all-in-one-seo-pack' ), - 'sport' => __( 'Sport', 'all-in-one-seo-pack' ) + 'sport' => __( 'Sport', 'all-in-one-seo-pack' ) ), - 'Businesses' => Array( - 'bar' => __( 'Bar', 'all-in-one-seo-pack' ), - 'company' => __( 'Company', 'all-in-one-seo-pack' ), - 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ), - 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ), + 'Businesses' => Array( + 'bar' => __( 'Bar', 'all-in-one-seo-pack' ), + 'company' => __( 'Company', 'all-in-one-seo-pack' ), + 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ), + 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ), 'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' ) ), - 'Groups' => Array( - 'cause' => __( 'Cause', 'all-in-one-seo-pack' ), + 'Groups' => Array( + 'cause' => __( 'Cause', 'all-in-one-seo-pack' ), 'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ), - 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ) + 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ) ), - 'Organizations' => Array( - 'band' => __( 'Band', 'all-in-one-seo-pack' ), + 'Organizations' => Array( + 'band' => __( 'Band', 'all-in-one-seo-pack' ), 'government' => __( 'Government', 'all-in-one-seo-pack' ), 'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ), - 'school' => __( 'School', 'all-in-one-seo-pack' ), + 'school' => __( 'School', 'all-in-one-seo-pack' ), 'university' => __( 'University', 'all-in-one-seo-pack' ) ), - 'People' => Array( - 'actor' => __( 'Actor', 'all-in-one-seo-pack' ), - 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ), - 'author' => __( 'Author', 'all-in-one-seo-pack' ), - 'director' => __( 'Director', 'all-in-one-seo-pack' ), - 'musician' => __( 'Musician', 'all-in-one-seo-pack' ), - 'politician' => __( 'Politician', 'all-in-one-seo-pack' ), - 'profile' => __( 'Profile', 'all-in-one-seo-pack' ), + 'People' => Array( + 'actor' => __( 'Actor', 'all-in-one-seo-pack' ), + 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ), + 'author' => __( 'Author', 'all-in-one-seo-pack' ), + 'director' => __( 'Director', 'all-in-one-seo-pack' ), + 'musician' => __( 'Musician', 'all-in-one-seo-pack' ), + 'politician' => __( 'Politician', 'all-in-one-seo-pack' ), + 'profile' => __( 'Profile', 'all-in-one-seo-pack' ), 'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' ) ), - 'Places' => Array( - 'city' => __( 'City', 'all-in-one-seo-pack' ), - 'country' => __( 'Country', 'all-in-one-seo-pack' ), - 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ), + 'Places' => Array( + 'city' => __( 'City', 'all-in-one-seo-pack' ), + 'country' => __( 'Country', 'all-in-one-seo-pack' ), + 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ), 'state_province' => __( 'State Province', 'all-in-one-seo-pack' ) ), 'Products and Entertainment' => Array( - 'album' => __( 'Album', 'all-in-one-seo-pack' ), - 'book' => __( 'Book', 'all-in-one-seo-pack' ), - 'drink' => __( 'Drink', 'all-in-one-seo-pack' ), - 'food' => __( 'Food', 'all-in-one-seo-pack' ), - 'game' => __( 'Game', 'all-in-one-seo-pack' ), - 'movie' => __( 'Movie', 'all-in-one-seo-pack' ), + 'album' => __( 'Album', 'all-in-one-seo-pack' ), + 'book' => __( 'Book', 'all-in-one-seo-pack' ), + 'drink' => __( 'Drink', 'all-in-one-seo-pack' ), + 'food' => __( 'Food', 'all-in-one-seo-pack' ), + 'game' => __( 'Game', 'all-in-one-seo-pack' ), + 'movie' => __( 'Movie', 'all-in-one-seo-pack' ), 'product' => __( 'Product', 'all-in-one-seo-pack' ), - 'song' => __( 'Song', 'all-in-one-seo-pack' ), + 'song' => __( 'Song', 'all-in-one-seo-pack' ), 'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ), 'episode' => __( 'Episode', 'all-in-one-seo-pack' ) - ),'Websites' => Array( + ), + 'Websites' => Array( 'article' => __( 'Article', 'all-in-one-seo-pack' ), - 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), + 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), 'website' => __( 'Website', 'all-in-one-seo-pack' ) ) ); parent::__construct(); - $categories = Array( 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), 'website' => __( 'Website', 'all-in-one-seo-pack' ), 'article' => __( 'Article', 'all-in-one-seo-pack' ) ); + $categories = Array( + 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), + 'website' => __( 'Website', 'all-in-one-seo-pack' ), + 'article' => __( 'Article', 'all-in-one-seo-pack' ) + ); $this->help_text = Array( - "setmeta" => __( "Checking this box will use the Home Title and Home Description set in All in One SEO Pack, General Settings as the Open Graph title and description for your home page.", 'all-in-one-seo-pack' ), - "key" => __( "Enter your Facebook Admin ID here. Information about how to get your Facebook Admin ID can be found at https://developers.facebook.com/docs/platforminsights/domains", 'all-in-one-seo-pack' ), - "appid" => __( "Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/platforminsights/domains", 'all-in-one-seo-pack'), - "title_shortcodes" => __( "Run shortcodes that appear in social title meta tags.", 'all-in-one-seo-pack' ), - "description_shortcodes"=> __( "Run shortcodes that appear in social description meta tags.", 'all-in-one-seo-pack' ), - "sitename" => __( "The Site Name is the name that is used to identify your website.", 'all-in-one-seo-pack' ), - "hometitle" => __( "The Home Title is the Open Graph title for your home page.", 'all-in-one-seo-pack' ), - "description" => __( "The Home Description is the Open Graph description for your home page.", 'all-in-one-seo-pack' ), - "homeimage" => __( "The Home Image is the Open Graph image for your home page.", 'all-in-one-seo-pack' ), - "hometag" => __( "The Home Tag allows you to add a list of keywords that best describe your home page content.", 'all-in-one-seo-pack' ), - "generate_descriptions" => __( "Check this and your Open Graph descriptions will be auto-generated from your content.", 'all-in-one-seo-pack' ), - "defimg" => __( "This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.", 'all-in-one-seo-pack' ), - "fallback" => __( "This option lets you fall back to the default image if no image could be found above.", 'all-in-one-seo-pack' ), - "dimg" => __( "This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.", 'all-in-one-seo-pack' ), - "dimgwidth" => __( "This option lets you set a default width for your images, where unspecified.", 'all-in-one-seo-pack' ), - "dimgheight" => __( "This option lets you set a default height for your images, where unspecified.", 'all-in-one-seo-pack' ), - "meta_key" => __( "Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.", 'all-in-one-seo-pack' ), - "categories" => __( "Set the Open Graph type for your website as either a blog or a website.", 'all-in-one-seo-pack' ), - "image" => __( "This option lets you select the Open Graph image that will be used for this Page or Post, overriding the default settings.", 'all-in-one-seo-pack' ), - "customimg" => __( "This option lets you upload an image to use as the Open Graph image for this Page or Post.", 'all-in-one-seo-pack' ), - "imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ), - "imageheight" => __( "Enter the height for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ), - "video" => __( "This option lets you specify a link to the Open Graph video used on this Page or Post.", 'all-in-one-seo-pack' ), - "videowidth" => __( "Enter the width for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ), - "videoheight" => __( "Enter the height for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ), - "defcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ), - "setcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ), - "twitter_site" => __( "Enter the Twitter username associated with your website here.", 'all-in-one-seo-pack' ), - "twitter_creator" => __( "Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.", 'all-in-one-seo-pack' ), - "twitter_domain" => __( "Enter the name of your website here.", 'all-in-one-seo-pack' ), - "gen_tags" => __( "Automatically generate article tags for Facebook type article when not provided.", 'all-in-one-seo-pack' ), - "gen_keywords" => __( "Use keywords in generated article tags.", 'all-in-one-seo-pack' ), - "gen_categories" => __( "Use catergories in generated article tags.", 'all-in-one-seo-pack' ), - "gen_post_tags" => __( "Use post tags in generated article tags.", 'all-in-one-seo-pack' ), - "types" => __( "Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.", 'all-in-one-seo-pack' ), - "title" => __( "This is the Open Graph title of this Page or Post.", 'all-in-one-seo-pack' ), - "desc" => __( "This is the Open Graph description of this Page or Post.", 'all-in-one-seo-pack' ), - "category" => __( "Select the Open Graph type that best describes the content of this Page or Post.", 'all-in-one-seo-pack' ), - "facebook_debug" => __( "Press this button to have Facebook re-fetch and debug this page.", 'all-in-one-seo-pack' ), - "section" => __( "This Open Graph meta allows you to add a general section name that best describes this content.", 'all-in-one-seo-pack' ), - "tag" => __( "This Open Graph meta allows you to add a list of keywords that best describe this content.", 'all-in-one-seo-pack' ), - "facebook_publisher" => __( "Link articles to the Facebook page associated with your website.", 'all-in-one-seo-pack' ), - "facebook_author" => __( "Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.", 'all-in-one-seo-pack' ), - "person_or_org" => __( "Are the social profile links for your website for a person or an organization?", 'all-in-one-seo-pack' ), - "profile_links" => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ), - "social_name" => __( "Add the name of the person or organization who owns these profiles.", 'all-in-one-seo-pack' ) + "setmeta" => __( "Checking this box will use the Home Title and Home Description set in All in One SEO Pack, General Settings as the Open Graph title and description for your home page.", 'all-in-one-seo-pack' ), + "key" => __( "Enter your Facebook Admin ID here. Information about how to get your Facebook Admin ID can be found at https://developers.facebook.com/docs/platforminsights/domains", 'all-in-one-seo-pack' ), + "appid" => __( "Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/platforminsights/domains", 'all-in-one-seo-pack' ), + "title_shortcodes" => __( "Run shortcodes that appear in social title meta tags.", 'all-in-one-seo-pack' ), + "description_shortcodes" => __( "Run shortcodes that appear in social description meta tags.", 'all-in-one-seo-pack' ), + "sitename" => __( "The Site Name is the name that is used to identify your website.", 'all-in-one-seo-pack' ), + "hometitle" => __( "The Home Title is the Open Graph title for your home page.", 'all-in-one-seo-pack' ), + "description" => __( "The Home Description is the Open Graph description for your home page.", 'all-in-one-seo-pack' ), + "homeimage" => __( "The Home Image is the Open Graph image for your home page.", 'all-in-one-seo-pack' ), + "hometag" => __( "The Home Tag allows you to add a list of keywords that best describe your home page content.", 'all-in-one-seo-pack' ), + "generate_descriptions" => __( "Check this and your Open Graph descriptions will be auto-generated from your content.", 'all-in-one-seo-pack' ), + "defimg" => __( "This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.", 'all-in-one-seo-pack' ), + "fallback" => __( "This option lets you fall back to the default image if no image could be found above.", 'all-in-one-seo-pack' ), + "dimg" => __( "This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.", 'all-in-one-seo-pack' ), + "dimgwidth" => __( "This option lets you set a default width for your images, where unspecified.", 'all-in-one-seo-pack' ), + "dimgheight" => __( "This option lets you set a default height for your images, where unspecified.", 'all-in-one-seo-pack' ), + "meta_key" => __( "Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.", 'all-in-one-seo-pack' ), + "categories" => __( "Set the Open Graph type for your website as either a blog or a website.", 'all-in-one-seo-pack' ), + "image" => __( "This option lets you select the Open Graph image that will be used for this Page or Post, overriding the default settings.", 'all-in-one-seo-pack' ), + "customimg" => __( "This option lets you upload an image to use as the Open Graph image for this Page or Post.", 'all-in-one-seo-pack' ), + "imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ), + "imageheight" => __( "Enter the height for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ), + "video" => __( "This option lets you specify a link to the Open Graph video used on this Page or Post.", 'all-in-one-seo-pack' ), + "videowidth" => __( "Enter the width for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ), + "videoheight" => __( "Enter the height for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ), + "defcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ), + "setcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ), + "twitter_site" => __( "Enter the Twitter username associated with your website here.", 'all-in-one-seo-pack' ), + "twitter_creator" => __( "Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.", 'all-in-one-seo-pack' ), + "twitter_domain" => __( "Enter the name of your website here.", 'all-in-one-seo-pack' ), + "gen_tags" => __( "Automatically generate article tags for Facebook type article when not provided.", 'all-in-one-seo-pack' ), + "gen_keywords" => __( "Use keywords in generated article tags.", 'all-in-one-seo-pack' ), + "gen_categories" => __( "Use catergories in generated article tags.", 'all-in-one-seo-pack' ), + "gen_post_tags" => __( "Use post tags in generated article tags.", 'all-in-one-seo-pack' ), + "types" => __( "Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.", 'all-in-one-seo-pack' ), + "title" => __( "This is the Open Graph title of this Page or Post.", 'all-in-one-seo-pack' ), + "desc" => __( "This is the Open Graph description of this Page or Post.", 'all-in-one-seo-pack' ), + "category" => __( "Select the Open Graph type that best describes the content of this Page or Post.", 'all-in-one-seo-pack' ), + "facebook_debug" => __( "Press this button to have Facebook re-fetch and debug this page.", 'all-in-one-seo-pack' ), + "section" => __( "This Open Graph meta allows you to add a general section name that best describes this content.", 'all-in-one-seo-pack' ), + "tag" => __( "This Open Graph meta allows you to add a list of keywords that best describe this content.", 'all-in-one-seo-pack' ), + "facebook_publisher" => __( "Link articles to the Facebook page associated with your website.", 'all-in-one-seo-pack' ), + "facebook_author" => __( "Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.", 'all-in-one-seo-pack' ), + "person_or_org" => __( "Are the social profile links for your website for a person or an organization?", 'all-in-one-seo-pack' ), + "profile_links" => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ), + "social_name" => __( "Add the name of the person or organization who owns these profiles.", 'all-in-one-seo-pack' ) ); $this->help_anchors = Array( 'generate_descriptions' => '#auto-generate-og-descriptions', - 'setmeta' => '#use-aioseo-title-and-description', - 'sitename' => '#site-name', - 'hometitle' => '#home-title-and-description', - 'description' => '#home-title-and-description', - 'homeimage' => '#home-image', - 'defimg' => '#select-og-image-source', - 'fallback' => '#use-default-if-no-image-found', - 'dimg' => '#default-og-image', - 'meta_key' => '#use-custom-field-for-image', - 'key' => '#facebook-admin-id', - 'appid' => '#facebook-app-id', - 'categories' => '#facebook-object-type', - 'facebook_publisher' => '#show-facebook-publisher-on-articles', - 'facebook_author' => '#show-facebook-author-on-articles', - 'types' => '#enable-facebook-meta-for', - 'defcard' => '#default-twitter-card', - 'setcard' => '#default-twitter-card', - 'twitter_site' => '#twitter-site', - 'twitter_creator' => '#show-twitter-author', - 'twitter_domain' => '#twitter-domain', - 'scan_header' => '#scan-social-meta' + 'setmeta' => '#use-aioseo-title-and-description', + 'sitename' => '#site-name', + 'hometitle' => '#home-title-and-description', + 'description' => '#home-title-and-description', + 'homeimage' => '#home-image', + 'defimg' => '#select-og-image-source', + 'fallback' => '#use-default-if-no-image-found', + 'dimg' => '#default-og-image', + 'meta_key' => '#use-custom-field-for-image', + 'key' => '#facebook-admin-id', + 'appid' => '#facebook-app-id', + 'categories' => '#facebook-object-type', + 'facebook_publisher' => '#show-facebook-publisher-on-articles', + 'facebook_author' => '#show-facebook-author-on-articles', + 'types' => '#enable-facebook-meta-for', + 'defcard' => '#default-twitter-card', + 'setcard' => '#default-twitter-card', + 'twitter_site' => '#twitter-site', + 'twitter_creator' => '#show-twitter-author', + 'twitter_domain' => '#twitter-domain', + 'scan_header' => '#scan-social-meta' ); - $count_desc = __( " characters. Open Graph allows up to a maximum of %s chars for the %s.", 'all-in-one-seo-pack' ); + $count_desc = __( " characters. Open Graph allows up to a maximum of %s chars for the %s.", 'all-in-one-seo-pack' ); $this->default_options = array( - 'scan_header' => Array( 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ), 'type' => 'custom', 'save' => true ), - 'setmeta' => Array( 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack'), 'type' => 'checkbox' ), - 'key' => Array( 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack'), 'default' => '', 'type' => 'text' ), - 'appid' => Array( 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack'), 'default' => '', 'type' => 'text'), - 'title_shortcodes' => Array('name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ) ), - 'description_shortcodes' => Array('name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ) ), - 'sitename' => Array( 'name' => __( 'Site Name', 'all-in-one-seo-pack' ), 'default' => get_bloginfo('name'), 'type' => 'text' ), - 'hometitle' => Array( 'name' => __( 'Home Title', 'all-in-one-seo-pack'), - 'default' => '', 'type' => 'textarea', 'condshow' => Array( 'aiosp_opengraph_setmeta' => Array( 'lhs' => "aiosp_opengraph_setmeta", 'op' => '!=', 'rhs' => 'on' ) ) ), - 'description' => Array( 'name' => __( 'Home Description', 'all-in-one-seo-pack'), - 'default' => '', 'type' => 'textarea', 'condshow' => Array( 'aiosp_opengraph_setmeta' => Array( 'lhs' => "aiosp_opengraph_setmeta", 'op' => '!=', 'rhs' => 'on' ) ) ), - 'homeimage' => Array( 'name' => __( 'Home Image', 'all-in-one-seo-pack' ), - 'type' => 'image' ), - 'hometag' => Array('name' => __( 'Home Article Tags', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '', 'condshow' => Array( 'aiosp_opengraph_categories' => 'article' ) ), - 'generate_descriptions' => Array( 'name' => __( 'Autogenerate OG Descriptions', 'all-in-one-seo-pack' ), 'default' => 1 ), - 'defimg' => Array( 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ), 'type' => 'select', 'initial_options' => Array( '' => __( 'Default Image' ), 'featured' => __( 'Featured Image' ), 'attach' => __( 'First Attached Image' ), 'content' => __( 'First Image In Content' ), 'custom' => __( 'Image From Custom Field' ), 'author' => __( 'Post Author Image' ), 'auto' => __( 'First Available Image' ) ) ), - 'fallback' => Array( 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ), 'type' => 'checkbox' ), - 'dimg' => Array( 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ), 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', 'type' => 'image' ), - 'dimgwidth' => Array( 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '' ), - 'dimgheight' => Array( 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '' ), - 'meta_key' => Array( 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ), 'type' => 'text', 'default' => '' ), - 'categories' => Array( 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack'), - 'type' => 'radio', 'initial_options' => $categories, 'default' => 'blog' ), - 'image' => Array( 'name' => __( 'Image', 'all-in-one-seo-pack' ), - 'type' => 'radio', 'initial_options' => Array( 0 => '' ) ), - 'customimg' => Array( 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ), - 'type' => 'image' ), - 'imagewidth' => Array( 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '' ), - 'imageheight' => Array( 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '' ), - 'video' => Array( 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ), - 'type' => 'text' ), - 'videowidth' => Array( 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '', 'condshow' => Array( 'aioseop_opengraph_settings_video' => Array( 'lhs' => "aioseop_opengraph_settings_video", 'op' => '!=', 'rhs' => '' ) ) ), - 'videoheight' => Array( 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '', 'condshow' => Array( 'aioseop_opengraph_settings_video' => Array( 'lhs' => "aioseop_opengraph_settings_video", 'op' => '!=', 'rhs' => '' ) ) ), - 'defcard' => Array( 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ), - 'type' => 'select', 'initial_options' => Array( 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ) /*, *******REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE****** 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) */ ), 'default' => 'summary' ), - 'setcard' => Array( 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ), - 'type' => 'select', 'initial_options' => Array( 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), 'summary' => __( 'Summary', 'all-in-one-seo-pack' ) /*, *******REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE****** 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) */ ) ), - 'twitter_site' => Array( 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '' ), - 'twitter_creator'=>Array( 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ) ), - 'twitter_domain'=> Array( 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '' ), - 'gen_tags' => Array( 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ) ), - 'gen_keywords' => Array( 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ), 'default' => 'on', 'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' ) ), - 'gen_categories'=> Array( 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ), 'default' => 'on', 'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' ) ), - 'gen_post_tags' => Array( 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ), 'default' => 'on', 'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' ) ), - 'types' => Array( 'name' => __( 'Enable Facebook Meta for', 'all-in-one-seo-pack'), - 'type' => 'multicheckbox', 'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ), - 'default' => Array( 'post' => 'post', 'page' => 'page' ) ), - 'title' => Array( 'name' => __( 'Title', 'all-in-one-seo-pack'), - 'default' => '', 'type' => 'text', 'size' => 95, 'count' => 1, 'count_desc' => $count_desc ), - 'desc' => Array( 'name' => __( 'Description', 'all-in-one-seo-pack'), - 'default' => '', 'type' => 'textarea', 'cols' => 250, 'rows' => 4, 'count' => 1, 'count_desc' => $count_desc ), - 'category' => Array( 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack'), - 'type' => 'select', 'style' => '', - 'initial_options' => $this->fb_object_types, - 'default' => '' - ), - 'facebook_debug'=> Array( 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ), 'type' => 'html', 'save' => false, - 'default' => - ' ' . __( 'Debug This Post', 'all-in-one-seo-pack' ) - . '' ), - - 'section' => Array( 'name' => __( 'Article Section', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '', 'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' ) ), - 'tag' => Array( 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => '', 'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' ) ), - 'facebook_publisher'=>Array('name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ), 'type' => 'text', 'default' => '' ), - 'facebook_author' =>Array('name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ) ), - 'profile_links' =>Array('name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), 'type' => 'textarea', 'cols' => 60, 'rows' => 5 ), - 'person_or_org' =>Array('name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ), - 'type' => 'radio', 'initial_options' => Array( 'person' => __( 'Person', 'all-in-one-seo-pack' ), 'org' => __( 'Organization', 'all-in-one-seo-pack' ) ) ), - 'social_name' =>Array('name' => __( "Associated Name", 'all-in-one-seo-pack' ), 'type' => 'text', 'default' => "" ), + . '' + ), + + 'section' => Array( + 'name' => __( 'Article Section', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' ) + ), + 'tag' => Array( + 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' ) + ), + 'facebook_publisher' => Array( + 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '' + ), + 'facebook_author' => Array( 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ) ), + 'profile_links' => Array( + 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'cols' => 60, + 'rows' => 5 + ), + 'person_or_org' => Array( + 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'initial_options' => Array( + 'person' => __( 'Person', 'all-in-one-seo-pack' ), + 'org' => __( 'Organization', 'all-in-one-seo-pack' ) + ) + ), + 'social_name' => Array( + 'name' => __( "Associated Name", 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => "" + ), ); // load initial options / set defaults - $this->update_options( ); + $this->update_options(); $display = Array(); - if ( isset( $this->options['aiosp_opengraph_types'] ) ) $display = $this->options['aiosp_opengraph_types']; + if ( isset( $this->options['aiosp_opengraph_types'] ) ) { + $display = $this->options['aiosp_opengraph_types']; + } $this->locations = array( - 'opengraph' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings', - 'options' => Array('scan_header', 'setmeta', 'key', 'appid', 'sitename', 'title_shortcodes', 'description_shortcodes', 'hometitle', 'description', 'homeimage', 'hometag', 'generate_descriptions', 'defimg', - 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key', 'categories', 'defcard', 'profile_links', 'person_or_org', 'social_name', 'twitter_site', 'twitter_creator', 'twitter_domain', 'gen_tags', 'gen_keywords', 'gen_categories', - 'gen_post_tags', 'types', 'facebook_publisher', 'facebook_author' ) ), - 'settings' => Array( 'name' => __('Social Settings', 'all-in-one-seo-pack'), - 'type' => 'metabox', 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings', - 'options' => Array( 'title', 'desc', 'image', 'customimg', 'imagewidth', 'imageheight', 'video', 'videowidth', 'videoheight', 'category', 'facebook_debug', 'section', 'tag', 'setcard' ), - 'display' => $display, 'prefix' => 'aioseop_opengraph_' - ) + 'opengraph' => Array( + 'name' => $this->name, + 'prefix' => 'aiosp_', + 'type' => 'settings', + 'options' => Array( + 'scan_header', + 'setmeta', + 'key', + 'appid', + 'sitename', + 'title_shortcodes', + 'description_shortcodes', + 'hometitle', + 'description', + 'homeimage', + 'hometag', + 'generate_descriptions', + 'defimg', + 'fallback', + 'dimg', + 'dimgwidth', + 'dimgheight', + 'meta_key', + 'categories', + 'defcard', + 'profile_links', + 'person_or_org', + 'social_name', + 'twitter_site', + 'twitter_creator', + 'twitter_domain', + 'gen_tags', + 'gen_keywords', + 'gen_categories', + 'gen_post_tags', + 'types', + 'facebook_publisher', + 'facebook_author' + ) + ), + 'settings' => Array( + 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ), + 'type' => 'metabox', + 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings', + 'options' => Array( + 'title', + 'desc', + 'image', + 'customimg', + 'imagewidth', + 'imageheight', + 'video', + 'videowidth', + 'videoheight', + 'category', + 'facebook_debug', + 'section', + 'tag', + 'setcard' + ), + 'display' => $display, + 'prefix' => 'aioseop_opengraph_' + ) ); $this->layout = Array( - 'default' => Array( - 'name' => __( 'General Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', - 'options' => Array() // this is set below, to the remaining options -- pdb - ), - 'home' => Array( - 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', - 'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage', 'hometag' ) - ), - 'image' => Array( - 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', - 'options' => Array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ) - ), - 'links' => Array( - 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', - 'options' => Array( 'profile_links', 'person_or_org', 'social_name' ) - ), - 'facebook' => Array( - 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', - 'options' => Array( 'key', 'appid', 'types', 'gen_tags', 'gen_keywords', 'gen_categories', 'gen_post_tags', 'categories', 'facebook_publisher', 'facebook_author' ) - ), - 'twitter' => Array( - 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', - 'options' => Array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ) - ), - 'scan_meta' => Array( - 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#scan_meta', - 'options' => Array( 'scan_header' ) + 'default' => Array( + 'name' => __( 'General Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', + 'options' => Array() // this is set below, to the remaining options -- pdb + ), + 'home' => Array( + 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', + 'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage', 'hometag' ) + ), + 'image' => Array( + 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', + 'options' => Array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ) + ), + 'links' => Array( + 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', + 'options' => Array( 'profile_links', 'person_or_org', 'social_name' ) + ), + 'facebook' => Array( + 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', + 'options' => Array( + 'key', + 'appid', + 'types', + 'gen_tags', + 'gen_keywords', + 'gen_categories', + 'gen_post_tags', + 'categories', + 'facebook_publisher', + 'facebook_author' ) + ), + 'twitter' => Array( + 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/', + 'options' => Array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ) + ), + 'scan_meta' => Array( + 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#scan_meta', + 'options' => Array( 'scan_header' ) + ) ); $other_options = Array(); - foreach( $this->layout as $k => $v ) + foreach ( $this->layout as $k => $v ) { $other_options = array_merge( $other_options, $v['options'] ); + } $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options ); @@ -312,7 +581,9 @@ function __construct( ) { add_action( 'wp', Array( $this, 'type_setup' ) ); } - if( !is_admin() || defined( 'DOING_AJAX' ) ){ $this->do_opengraph(); } + if ( ! is_admin() || defined( 'DOING_AJAX' ) ) { + $this->do_opengraph(); + } // Avoid having duplicate meta tags add_filter( 'jetpack_enable_open_graph', '__return_false' ); @@ -321,7 +592,7 @@ function __construct( ) { function settings_page_init() { add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 ); $cat = $this->options["{$this->prefix}categories"]; - if ( !empty( $cat ) ) { + if ( ! empty( $cat ) ) { if ( $cat == 'blog' ) { $show_on_front = get_option( 'show_on_front' ); if ( ( $show_on_front == 'page' ) && ( get_option( 'page_on_front' ) ) ) { @@ -329,208 +600,249 @@ function settings_page_init() { } } elseif ( $cat == 'website' ) { $show_on_front = get_option( 'show_on_front' ); - if ( ( $show_on_front == 'posts' ) ) + if ( ( $show_on_front == 'posts' ) ) { $this->output_error( '

    ' . __( "Blog on front page detected, suggested Facebook Object Type is 'blog'.", 'all-in-one-seo-pack' ) . '

    ' ); + } } } } - + function filter_options( $options, $location ) { if ( $location == 'settings' ) { $prefix = $this->get_prefix( $location ) . $location . '_'; list( $legacy, $images ) = $this->get_all_images( $options ); if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) { $thumbnail = $options["{$prefix}image"]; - if ( ctype_digit( (string)$thumbnail ) || ( $thumbnail == 'post' ) ) { - if ( $thumbnail == 'post' ) + if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) { + if ( $thumbnail == 'post' ) { $thumbnail = $images['post1']; - else - if ( !empty( $legacy[$thumbnail] ) ) - $thumbnail = $legacy[$thumbnail]; + } else if ( ! empty( $legacy[ $thumbnail ] ) ) { + $thumbnail = $legacy[ $thumbnail ]; + } } $options["{$prefix}image"] = $thumbnail; } if ( empty( $options[ $prefix . 'image' ] ) ) { $img = array_keys( $images ); - if ( !empty( $img ) && !empty( $img[1] ) ) + if ( ! empty( $img ) && ! empty( $img[1] ) ) { $options[ $prefix . 'image' ] = $img[1]; + } } } + return $options; } - + function filter_settings( $settings, $location, $current ) { if ( $location == 'opengraph' || $location == 'settings' ) { $prefix = $this->get_prefix( $location ) . $location . '_'; - if ( $location == 'opengraph' ) return $settings; - if ( $location == 'settings' ) { + if ( $location == 'opengraph' ) { + return $settings; + } + if ( $location == 'settings' ) { list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current ); - $opts = Array( 'title', 'desc' ); + $opts = Array( 'title', 'desc' ); $current_post_type = get_post_type(); if ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) { $flat_type_list = Array(); - foreach( $this->fb_object_types as $k => $v ) { - if ( is_array( $v ) ) { - $flat_type_list = array_merge( $flat_type_list, $v ); - } else { - $flat_type_list[$k] = $v; - } - } - $settings[$prefix . 'category']['initial_options'] = array_merge( Array( + foreach ( $this->fb_object_types as $k => $v ) { + if ( is_array( $v ) ) { + $flat_type_list = array_merge( $flat_type_list, $v ); + } else { + $flat_type_list[ $k ] = $v; + } + } + $settings[ $prefix . 'category' ]['initial_options'] = array_merge( Array( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - ' - . $flat_type_list[ $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ] ), - $settings[$prefix . 'category']['initial_options'] ); + . $flat_type_list[ $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ] + ), + $settings[ $prefix . 'category' ]['initial_options'] ); } if ( isset( $this->options["aiosp_opengraph_defcard"] ) ) { - $settings[$prefix . 'setcard']['default'] = $this->options["aiosp_opengraph_defcard"]; - } + $settings[ $prefix . 'setcard' ]['default'] = $this->options["aiosp_opengraph_defcard"]; + } global $aiosp; $info = $aiosp->get_page_snippet_info(); extract( $info ); $settings["{$prefix}title"]['placeholder'] = $title; - $settings["{$prefix}desc"]['placeholder'] = $description; + $settings["{$prefix}desc"]['placeholder'] = $description; } - if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) - foreach ( $opts as $opt ) + if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) { + foreach ( $opts as $opt ) { if ( isset( $settings[ $prefix . $opt ] ) ) { - $settings[ $prefix . $opt ]['type'] = 'hidden'; - $settings[ $prefix . $opt ]['label'] = 'none'; + $settings[ $prefix . $opt ]['type'] = 'hidden'; + $settings[ $prefix . $opt ]['label'] = 'none'; $settings[ $prefix . $opt ]['help_text'] = ''; unset( $settings[ $prefix . $opt ]['count'] ); } + } + } } + return $settings; } - + function override_options( $options, $location, $settings ) { $opts = Array(); - foreach ( $settings as $k => $v ) if ( $v['save'] ) $opts[$k] = $v['default']; - foreach( $options as $k => $v ) if ( $v === NULL ) unset( $options[$k] ); + foreach ( $settings as $k => $v ) { + if ( $v['save'] ) { + $opts[ $k ] = $v['default']; + } + } + foreach ( $options as $k => $v ) { + if ( $v === null ) { + unset( $options[ $k ] ); + } + } $options = wp_parse_args( $options, $opts ); + return $options; } - + function filter_metabox_options( $options, $location, $post_id ) { if ( $location == 'settings' ) { $prefix = $this->get_prefix( $location ) . $location; - if ( !empty( $options[$prefix . '_customimg'] ) ) { + if ( ! empty( $options[ $prefix . '_customimg' ] ) ) { $old_options = get_post_meta( $post_id, '_' . $prefix ); $prefix .= '_'; - if ( empty( $old_options[$prefix . 'customimg'] ) || ( $old_options[$prefix . 'customimg'] != $options[$prefix . 'customimg'] ) ) - $options[$prefix . 'image'] = $options[$prefix . 'customimg']; + if ( empty( $old_options[ $prefix . 'customimg' ] ) || ( $old_options[ $prefix . 'customimg' ] != $options[ $prefix . 'customimg' ] ) ) { + $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ]; + } } } + return $options; } - + /** Custom settings **/ function display_custom_options( $buf, $args ) { if ( $args['name'] == 'aiosp_opengraph_scan_header' ) { $buf .= '
    '; $args['options']['type'] = 'submit'; - $args['attr'] = " class='button-primary' "; - $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' ); + $args['attr'] = " class='button-primary' "; + $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' ); $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' ); $buf .= '

    ' . $this->get_option_html( $args ); $buf .= '
    '; } + return $buf; } - + function add_attributes( $output ) { // avoid having duplicate meta tags $type = $this->type; - if ( empty( $type ) ) $type = 'website'; - + if ( empty( $type ) ) { + $type = 'website'; + } + $schema_types = Array( - 'album' => 'MusicAlbum', - 'article' => 'Article', - 'bar' => 'BarOrPub', - 'blog' => 'Blog', - 'book' => 'Book', - 'cafe' => 'CafeOrCoffeeShop', - 'city' => 'City', - 'country' => 'Country', - 'episode' => 'Episode', - 'food' => 'FoodEvent', - 'game' => 'Game', - 'hotel' => 'Hotel', - 'landmark' => 'LandmarksOrHistoricalBuildings', - 'movie' => 'Movie', - 'product' => 'Product', - 'profile' => 'ProfilePage', + 'album' => 'MusicAlbum', + 'article' => 'Article', + 'bar' => 'BarOrPub', + 'blog' => 'Blog', + 'book' => 'Book', + 'cafe' => 'CafeOrCoffeeShop', + 'city' => 'City', + 'country' => 'Country', + 'episode' => 'Episode', + 'food' => 'FoodEvent', + 'game' => 'Game', + 'hotel' => 'Hotel', + 'landmark' => 'LandmarksOrHistoricalBuildings', + 'movie' => 'Movie', + 'product' => 'Product', + 'profile' => 'ProfilePage', 'restaurant' => 'Restaurant', - 'school' => 'School', - 'sport' => 'SportsEvent', - 'website' => 'WebSite' + 'school' => 'School', + 'sport' => 'SportsEvent', + 'website' => 'WebSite' ); - - if ( !empty( $schema_types[$type] ) ) - $type = $schema_types[$type]; - else + + if ( ! empty( $schema_types[ $type ] ) ) { + $type = $schema_types[ $type ]; + } else { $type = 'WebSite'; - - $attributes = apply_filters( $this->prefix . 'attributes', Array( 'itemscope', 'itemtype="http://schema.org/' . ucfirst( $type ) . '"', 'prefix="og: http://ogp.me/ns#"' ) ); - foreach( $attributes as $attr ) { + } + + $attributes = apply_filters( $this->prefix . 'attributes', Array( + 'itemscope', + 'itemtype="http://schema.org/' . ucfirst( $type ) . '"', + 'prefix="og: http://ogp.me/ns#"' + ) ); + foreach ( $attributes as $attr ) { if ( strpos( $output, $attr ) === false ) { $output .= "\n\t$attr "; } } + return $output; } - - function add_meta( ) { + + function add_meta() { global $post, $aiosp, $aioseop_options, $wp_query; - $metabox = $this->get_current_options( Array(), 'settings' ); - $key = $this->options['aiosp_opengraph_key']; - $dimg = $this->options['aiosp_opengraph_dimg']; + $metabox = $this->get_current_options( Array(), 'settings' ); + $key = $this->options['aiosp_opengraph_key']; + $dimg = $this->options['aiosp_opengraph_dimg']; $current_post_type = get_post_type(); - $title = $description = $image = $video = ''; - $type = $this->type; - $sitename = $this->options['aiosp_opengraph_sitename']; - - $appid = isset($this->options['aiosp_opengraph_appid']) ? $this->options['aiosp_opengraph_appid'] : ''; - - if ( !empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { + $title = $description = $image = $video = ''; + $type = $this->type; + $sitename = $this->options['aiosp_opengraph_sitename']; + + $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : ''; + + if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { $first_page = false; - if ( $aiosp->get_page_number() < 2 ) $first_page = true; + if ( $aiosp->get_page_number() < 2 ) { + $first_page = true; + } } else { $first_page = true; } $url = $aiosp->aiosp_mrt_get_url( $wp_query ); $url = apply_filters( 'aioseop_canonical_url', $url ); - - $setmeta = $this->options['aiosp_opengraph_setmeta']; + + $setmeta = $this->options['aiosp_opengraph_setmeta']; $social_links = ''; if ( is_front_page() ) { $title = $this->options['aiosp_opengraph_hometitle']; - if ( $first_page ) + if ( $first_page ) { $description = $this->options['aiosp_opengraph_description']; - if ( !empty( $this->options['aiosp_opengraph_homeimage'] ) ) + } + if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) { $thumbnail = $this->options['aiosp_opengraph_homeimage']; - else + } else { $thumbnail = $this->options['aiosp_opengraph_dimg']; - + } + /* If Use AIOSEO Title and Desc Selected */ - if( $setmeta ) { + if ( $setmeta ) { $title = $aiosp->wp_title(); - if ( $first_page ) + if ( $first_page ) { $description = $aiosp->get_aioseop_description( $post ); + } } - + /* Add some defaults */ - if( empty($title) ) $title = get_bloginfo('name'); - if( empty($sitename) ) $sitename = get_bloginfo('name'); - - if ( empty( $description ) && $first_page && ( !empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) && !empty( $post ) && !empty( $post->post_content ) && !post_password_required( $post ) ) + if ( empty( $title ) ) { + $title = get_bloginfo( 'name' ); + } + if ( empty( $sitename ) ) { + $sitename = get_bloginfo( 'name' ); + } + + if ( empty( $description ) && $first_page && ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) && ! empty( $post ) && ! empty( $post->post_content ) && ! post_password_required( $post ) ) { $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 ); - - if ( empty($description) && $first_page ) $description = get_bloginfo('description'); - if ( $type == 'article' && ( !empty( $this->options['aiosp_opengraph_hometag'] ) ) ) { + } + + if ( empty( $description ) && $first_page ) { + $description = get_bloginfo( 'description' ); + } + if ( $type == 'article' && ( ! empty( $this->options['aiosp_opengraph_hometag'] ) ) ) { $tag = $this->options['aiosp_opengraph_hometag']; } - if ( !empty( $this->options['aiosp_opengraph_profile_links'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) { $social_links = $this->options['aiosp_opengraph_profile_links']; - if ( !empty( $this->options['aiosp_opengraph_social_name'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) { $social_name = $this->options['aiosp_opengraph_social_name']; } if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) { @@ -539,226 +851,265 @@ function add_meta( ) { $social_type = "Organization"; } } - } elseif ( is_singular( ) && $this->option_isset('types') - && is_array( $this->options['aiosp_opengraph_types'] ) - && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { + } elseif ( is_singular() && $this->option_isset( 'types' ) + && is_array( $this->options['aiosp_opengraph_types'] ) + && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) + ) { if ( $type == 'article' ) { - if ( !empty( $metabox['aioseop_opengraph_settings_section'] ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { $section = $metabox['aioseop_opengraph_settings_section']; } - if ( !empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { $tag = $metabox['aioseop_opengraph_settings_tag']; } - if ( !empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { $publisher = $this->options['aiosp_opengraph_facebook_publisher']; } } - - if ( !empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) + + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { $domain = $this->options['aiosp_opengraph_twitter_domain']; - - - if ( $type == 'article' && !empty( $post ) ) { - if ( isset( $post->post_author ) && !empty( $this->options['aiosp_opengraph_facebook_author'] ) ) + } + + + if ( $type == 'article' && ! empty( $post ) ) { + if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { $author = get_the_author_meta( 'facebook', $post->post_author ); - - if ( isset( $post->post_date ) ) - $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date ) ); + } - if ( isset( $post->post_modified ) ) + if ( isset( $post->post_date ) ) { + $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date ) ); + } + + if ( isset( $post->post_modified ) ) { $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified ) ); + } } - $image = $metabox['aioseop_opengraph_settings_image']; - $video = $metabox['aioseop_opengraph_settings_video']; - $title = $metabox['aioseop_opengraph_settings_title']; + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; $description = $metabox['aioseop_opengraph_settings_desc']; - + /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ global $aiosp; - if( empty( $title ) ) + if ( empty( $title ) ) { $title = $aiosp->wp_title(); - if ( empty( $description ) ) + } + if ( empty( $description ) ) { $description = trim( strip_tags( get_post_meta( $post->ID, "_aioseop_description", true ) ) ); - + } + /* Add some defaults */ - if ( empty( $title ) ) $title = get_the_title(); - if ( empty( $description ) && ( $this->options['aiosp_opengraph_generate_descriptions'] ) && !post_password_required( $post ) ) + if ( empty( $title ) ) { + $title = get_the_title(); + } + if ( empty( $description ) && ( $this->options['aiosp_opengraph_generate_descriptions'] ) && ! post_password_required( $post ) ) { $description = $post->post_content; - if ( empty( $type ) ) $type = 'article'; - } else return; - + } + if ( empty( $type ) ) { + $type = 'article'; + } + } else { + return; + } + if ( $type == 'article' ) { - if ( !empty( $this->options['aiosp_opengraph_gen_tags'] ) ) { - if ( !empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) { $keywords = $aiosp->get_main_keywords(); $keywords = $this->apply_cf_fields( $keywords ); $keywords = apply_filters( 'aioseop_keywords', $keywords ); - if ( !empty( $keywords ) && !empty( $tag ) ) { + if ( ! empty( $keywords ) && ! empty( $tag ) ) { $tag .= ',' . $keywords; } elseif ( empty( $tag ) ) { $tag = $keywords; } } $tag = $aiosp->keyword_string_to_list( $tag ); - if ( !empty( $this->options['aiosp_opengraph_gen_categories'] ) ) + if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) { $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) ); - if ( !empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) + } + if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) { $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) ); + } + } + if ( ! empty( $tag ) ) { + $tag = $aiosp->clean_keyword_list( $tag ); } - if ( !empty( $tag ) ) - $tag = $aiosp->clean_keyword_list( $tag ); } - - if ( !empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) { + + if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) { $title = do_shortcode( $title ); } - - if ( !empty( $description ) ) { + + if ( ! empty( $description ) ) { $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) ); - if ( !empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) { $description = do_shortcode( $description ); } - $description = $aiosp->trim_excerpt_without_filters( $description, 1000 ); + $description = $aiosp->trim_excerpt_without_filters( $description, 1000 ); } - - $title = $this->apply_cf_fields( $title ); + + $title = $this->apply_cf_fields( $title ); $description = $this->apply_cf_fields( $description ); - - /* Data Validation */ - $title = strip_tags( esc_attr( $title ) ); - $sitename = strip_tags( esc_attr( $sitename ) ); + + /* Data Validation */ + $title = strip_tags( esc_attr( $title ) ); + $sitename = strip_tags( esc_attr( $sitename ) ); $description = strip_tags( esc_attr( $description ) ); - - if ( empty( $thumbnail ) && !empty( $image ) ) + + if ( empty( $thumbnail ) && ! empty( $image ) ) { $thumbnail = $image; - + } + /* Get the first image attachment on the post */ // if( empty($thumbnail) ) $thumbnail = $this->get_the_image(); - + /* Add user supplied default image */ - if( empty($thumbnail) ) { - if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) + if ( empty( $thumbnail ) ) { + if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) { $thumbnail = $this->options['aiosp_opengraph_dimg']; - else { + } else { switch ( $this->options['aiosp_opengraph_defimg'] ) { - case 'featured' : $thumbnail = $this->get_the_image_by_post_thumbnail( ); - break; - case 'attach' : $thumbnail = $this->get_the_image_by_attachment( ); - break; - case 'content' : $thumbnail = $this->get_the_image_by_scan( ); - break; - case 'custom' : $meta_key = $this->options['aiosp_opengraph_meta_key']; - if ( !empty( $meta_key ) && !empty( $post ) ) { - $meta_key = explode( ',', $meta_key ); - $thumbnail = $this->get_the_image_by_meta_key( Array( 'post_id' => $post->ID, 'meta_key' => $meta_key ) ); - } - break; - case 'auto' : $thumbnail = $this->get_the_image(); - break; - case 'author' : $thumbnail = $this->get_the_image_by_author(); - break; - default : $thumbnail = $this->options['aiosp_opengraph_dimg']; + case 'featured' : + $thumbnail = $this->get_the_image_by_post_thumbnail(); + break; + case 'attach' : + $thumbnail = $this->get_the_image_by_attachment(); + break; + case 'content' : + $thumbnail = $this->get_the_image_by_scan(); + break; + case 'custom' : + $meta_key = $this->options['aiosp_opengraph_meta_key']; + if ( ! empty( $meta_key ) && ! empty( $post ) ) { + $meta_key = explode( ',', $meta_key ); + $thumbnail = $this->get_the_image_by_meta_key( Array( + 'post_id' => $post->ID, + 'meta_key' => $meta_key + ) ); + } + break; + case 'auto' : + $thumbnail = $this->get_the_image(); + break; + case 'author' : + $thumbnail = $this->get_the_image_by_author(); + break; + default : + $thumbnail = $this->options['aiosp_opengraph_dimg']; } } } - - if ( ( empty( $thumbnail ) && !empty( $this->options['aiosp_opengraph_fallback'] ) ) ) + + if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) { $thumbnail = $this->options['aiosp_opengraph_dimg']; + } - if ( !empty( $thumbnail ) ) $thumbnail = esc_url( $thumbnail ); + if ( ! empty( $thumbnail ) ) { + $thumbnail = esc_url( $thumbnail ); + } $width = $height = ''; - if ( !empty( $thumbnail ) ) { - if ( !empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) + if ( ! empty( $thumbnail ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) { $width = $metabox['aioseop_opengraph_settings_imagewidth']; - if ( !empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) + } + if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) { $height = $metabox['aioseop_opengraph_settings_imageheight']; - if ( empty( $width ) && !empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) + } + if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) { $width = $this->options['aiosp_opengraph_dimgwidth']; - if ( empty( $height ) && !empty( $this->options['aiosp_opengraph_dimgheight'] ) ) + } + if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) { $height = $this->options['aiosp_opengraph_dimgheight']; + } } - if ( !empty( $video ) ) { - if ( !empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) + if ( ! empty( $video ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) { $videowidth = $metabox['aioseop_opengraph_settings_videowidth']; - if ( !empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) - $videoheight = $metabox['aioseop_opengraph_settings_videoheight']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) { + $videoheight = $metabox['aioseop_opengraph_settings_videoheight']; + } } $card = 'summary'; - if ( !empty( $this->options['aiosp_opengraph_defcard'] ) ) + if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) { $card = $this->options['aiosp_opengraph_defcard']; - - if ( !empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) + } + + if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) { $card = $metabox['aioseop_opengraph_settings_setcard']; - - + } + + //support for changing legacy twitter cardtype-photo to summary large image - if($card == 'photo'){ + if ( $card == 'photo' ) { $card = 'summary_large_image'; } $site = $domain = $creator = ''; - if ( !empty( $this->options['aiosp_opengraph_twitter_site'] ) ) + if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) { $site = $this->options['aiosp_opengraph_twitter_site']; + $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site ); + } - if ( !empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { $domain = $this->options['aiosp_opengraph_twitter_domain']; - - if ( !empty( $post ) && isset( $post->post_author ) && !empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) - $creator = get_the_author_meta( 'twitter', $post->post_author ); - - if ( !empty( $site ) && $site[0] != '@' ) $site = '@' . $site; + } - if ( !empty( $creator ) && $creator[0] != '@' ) $creator = '@' . $creator; + if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) { + $creator = get_the_author_meta( 'twitter', $post->post_author ); + $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator ); + } $meta = Array( - 'facebook' => Array( - 'title' => 'og:title', - 'type' => 'og:type', - 'url' => 'og:url', - 'thumbnail' => 'og:image', - 'width' => 'og:image:width', - 'height' => 'og:image:height', - 'video' => 'og:video', - 'videowidth' => 'og:video:width', - 'videoheight' => 'og:video:height', - 'sitename' => 'og:site_name', - 'key' => 'fb:admins', - 'appid' => 'fb:app_id', - 'description' => 'og:description', - 'section' => 'article:section', - 'tag' => 'article:tag', - 'publisher' => 'article:publisher', - 'author' => 'article:author', - 'published_time'=> 'article:published_time', - 'modified_time' => 'article:modified_time', - ), - 'twitter' => Array( - 'card' => 'twitter:card', - 'site' => 'twitter:site', - 'creator' => 'twitter:creator', - 'domain' => 'twitter:domain', - 'title' => 'twitter:title', - 'description' => 'twitter:description', - 'thumbnail' => 'twitter:image', - ), + 'facebook' => Array( + 'title' => 'og:title', + 'type' => 'og:type', + 'url' => 'og:url', + 'thumbnail' => 'og:image', + 'width' => 'og:image:width', + 'height' => 'og:image:height', + 'video' => 'og:video', + 'videowidth' => 'og:video:width', + 'videoheight' => 'og:video:height', + 'sitename' => 'og:site_name', + 'key' => 'fb:admins', + 'appid' => 'fb:app_id', + 'description' => 'og:description', + 'section' => 'article:section', + 'tag' => 'article:tag', + 'publisher' => 'article:publisher', + 'author' => 'article:author', + 'published_time' => 'article:published_time', + 'modified_time' => 'article:modified_time', + ), + 'twitter' => Array( + 'card' => 'twitter:card', + 'site' => 'twitter:site', + 'creator' => 'twitter:creator', + 'domain' => 'twitter:domain', + 'title' => 'twitter:title', + 'description' => 'twitter:description', + 'thumbnail' => 'twitter:image', + ), ); - - //Only show if "use schema.org markup is checked" - if(!empty( $aioseop_options['aiosp_schema_markup'] )) - $meta['google+'] = Array('thumbnail' => 'image'); + //Only show if "use schema.org markup is checked" + if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { + $meta['google+'] = Array( 'thumbnail' => 'image' ); + } - // Add links to testing tools - + /* http://developers.facebook.com/tools/debug https://dev.twitter.com/docs/cards/preview @@ -786,45 +1137,49 @@ function add_meta( ) { 'title' => 'twitter:title', 'description' => 'twitter:description', 'thumbnail' => 'twitter:image' - + ) ); */ - + $tags = Array( - 'facebook' => Array( 'name' => 'property', 'value' => 'content' ), - 'twitter' => Array( 'name' => 'name', 'value' => 'content' ), - 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' ) + 'facebook' => Array( 'name' => 'property', 'value' => 'content' ), + 'twitter' => Array( 'name' => 'name', 'value' => 'content' ), + 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' ) ); - - foreach ( $meta as $t => $data ) + + foreach ( $meta as $t => $data ) { foreach ( $data as $k => $v ) { - if ( empty( $$k ) ) $$k = ''; + if ( empty( $$k ) ) { + $$k = ''; + } $filtered_value = $$k; $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k ); - if ( !empty( $filtered_value ) ) { - if ( !is_array( $filtered_value ) ) + if ( ! empty( $filtered_value ) ) { + if ( ! is_array( $filtered_value ) ) { $filtered_value = Array( $filtered_value ); - foreach( $filtered_value as $f ) { - echo '' . "\n"; + } + foreach ( $filtered_value as $f ) { + echo '' . "\n"; } } } + } $social_link_schema = ''; - if ( !empty( $social_links ) ) { - $home_url = esc_url( get_home_url() ); + if ( ! empty( $social_links ) ) { + $home_url = esc_url( get_home_url() ); $social_links = explode( "\n", $social_links ); - foreach( $social_links as $k => $v ) { + foreach ( $social_links as $k => $v ) { $v = trim( $v ); if ( empty( $v ) ) { - unset( $social_links[$k] ); + unset( $social_links[ $k ] ); } else { - $v = esc_url( $v ); - $social_links[$k] = $v; + $v = esc_url( $v ); + $social_links[ $k ] = $v; } } - $social_links = join( '","', $social_links ); -$social_link_schema =<< { "@context" : "http://schema.org", "@type" : "{$social_type}", @@ -838,114 +1193,129 @@ function add_meta( ) { } echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema ); } - - function do_opengraph( ) { + + function do_opengraph() { global $aioseop_options; - if ( !empty( $aioseop_options ) && !empty( $aioseop_options['aiosp_schema_markup'] ) ) + if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { add_filter( 'language_attributes', Array( $this, 'add_attributes' ) ); - if ( !defined( 'DOING_AJAX' ) ) - add_action( 'aioseop_modules_wp_head', Array( $this, 'add_meta' ), 5 ); + } + if ( ! defined( 'DOING_AJAX' ) ) { + add_action( 'aioseop_modules_wp_head', Array( $this, 'add_meta' ), 5 ); + } } - + function type_setup() { global $aiosp, $wp_query; $this->type = ''; if ( $aiosp->is_static_front_page() ) { - if ( !empty( $this->options ) && !empty( $this->options['aiosp_opengraph_categories'] ) ) + if ( ! empty( $this->options ) && ! empty( $this->options['aiosp_opengraph_categories'] ) ) { $this->type = $this->options['aiosp_opengraph_categories']; - } elseif ( is_singular() && $this->option_isset('types') ) { - $metabox = $this->get_current_options( Array(), 'settings' ); + } + } elseif ( is_singular() && $this->option_isset( 'types' ) ) { + $metabox = $this->get_current_options( Array(), 'settings' ); $current_post_type = get_post_type(); - if ( !empty( $metabox['aioseop_opengraph_settings_category'] ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) { $this->type = $metabox['aioseop_opengraph_settings_category']; } elseif ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) { $this->type = $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"]; } } } - - function debug_post_types( ) { + + function debug_post_types() { add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 3 ); add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 ); - add_filter( $this->get_prefix( 'settings' ) . 'filter_metabox_options', Array( $this, 'filter_metabox_options' ), 10, 3 ); - $post_types = $this->get_post_type_titles( ); - $rempost = array( 'revision' => 1, 'nav_menu_item' => 1 ); - $post_types = array_diff_key( $post_types, $rempost ); - $this->default_options['types']['initial_options'] = $post_types; - foreach( $post_types as $slug => $name ) { - $field = $slug . '_fb_object_type'; - $this->default_options[$field] = Array( - 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "
    ($slug)", - 'type' => 'select', - 'style' => '', - 'initial_options' => $this->fb_object_types, - 'default' => 'article', - 'condshow' => Array( 'aiosp_opengraph_types\[\]' => $slug ) + add_filter( $this->get_prefix( 'settings' ) . 'filter_metabox_options', Array( + $this, + 'filter_metabox_options' + ), 10, 3 ); + $post_types = $this->get_post_type_titles(); + $rempost = array( 'revision' => 1, 'nav_menu_item' => 1 ); + $post_types = array_diff_key( $post_types, $rempost ); + $this->default_options['types']['initial_options'] = $post_types; + foreach ( $post_types as $slug => $name ) { + $field = $slug . '_fb_object_type'; + $this->default_options[ $field ] = Array( + 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "
    ($slug)", + 'type' => 'select', + 'style' => '', + 'initial_options' => $this->fb_object_types, + 'default' => 'article', + 'condshow' => Array( 'aiosp_opengraph_types\[\]' => $slug ) ); - $this->help_text[$field] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' ); - $this->help_anchors[$field] = '#content-object-types'; + $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' ); + $this->help_anchors[ $field ] = '#content-object-types'; $this->locations['opengraph']['options'][] = $field; - $this->layout['facebook']['options'][] = $field; + $this->layout['facebook']['options'][] = $field; } $this->setting_options(); $this->add_help_text_links(); - + } - + function get_all_images( $options = null, $p = null ) { static $img = Array(); - if ( !is_array( $options ) ) $options = Array(); - if ( !empty( $this->options['aiosp_opengraph_meta_key'] ) ) + if ( ! is_array( $options ) ) { + $options = Array(); + } + if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) { $options['meta_key'] = $this->options['aiosp_opengraph_meta_key']; + } if ( empty( $img ) ) { - $size = apply_filters( 'post_thumbnail_size', 'large' ); + $size = apply_filters( 'post_thumbnail_size', 'large' ); $default = $this->get_the_image_by_default(); - if ( !empty( $default ) ) - $img[$default] = 0; + if ( ! empty( $default ) ) { + $img[ $default ] = 0; + } $img = array_merge( $img, parent::get_all_images( $options, null ) ); } - if ( !empty( $options ) && !empty( $options['aioseop_opengraph_settings_customimg'] ) ) { - $img[$options['aioseop_opengraph_settings_customimg']] = 'customimg'; + if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { + $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; } if ( $author_img = $this->get_the_image_by_author( $p ) ) { - $image["author"] = $author_img; + $image["author"] = $author_img; } - $image = array_flip( $img ); + $image = array_flip( $img ); $images = Array(); - if ( !empty( $image ) ) - foreach( $image as $k => $v ) - $images[$v] = ''; + if ( ! empty( $image ) ) { + foreach ( $image as $k => $v ) { + $images[ $v ] = ''; + } + } + return Array( $image, $images ); } - + function get_the_image_by_author( $options = null, $p = null ) { if ( $p === null ) { global $post; } else { $post = $p; } - if ( !empty( $post ) && !empty( $post->post_author ) ) { - $matches = Array(); + if ( ! empty( $post ) && ! empty( $post->post_author ) ) { + $matches = Array(); $get_avatar = get_avatar( $post->post_author, 300 ); - if ( preg_match("/src='(.*?)'/i", $get_avatar, $matches) ) { + if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) { return $matches[1]; } } + return false; } - + function get_the_image( $options = null, $p = null ) { $meta_key = $this->options['aiosp_opengraph_meta_key']; + return parent::get_the_image( Array( 'meta_key' => $meta_key ), $p ); } - + function get_the_image_by_default( $args = array() ) { return $this->options['aiosp_opengraph_dimg']; } - - function settings_update( ) { - + + function settings_update() { + } } } diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_performance.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_performance.php index 895825427f..019643db46 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_performance.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_performance.php @@ -1,224 +1,283 @@ name = __('Performance', 'all-in-one-seo-pack'); // Human-readable name of the plugin - $this->prefix = 'aiosp_performance_'; // option prefix - $this->file = __FILE__; // the current file + $this->name = __( 'Performance', 'all-in-one-seo-pack' ); // Human-readable name of the plugin. + $this->prefix = 'aiosp_performance_'; // Option prefix. + $this->file = __FILE__; // The current file. parent::__construct(); - - $this->help_text = Array( - "memory_limit" => __( "This setting allows you to raise your PHP memory limit to a reasonable value. Note: WordPress core and other WordPress plugins may also change the value of the memory limit.", 'all-in-one-seo-pack' ), - "execution_time" => __( "This setting allows you to raise your PHP execution time to a reasonable value.", 'all-in-one-seo-pack' ), - "force_rewrites" => __( "Use output buffering to ensure that the title gets rewritten. Enable this option if you run into issues with the title tag being set by your theme or another plugin.", 'all-in-one-seo-pack' ) + + $this->help_text = array( + 'memory_limit' => __( 'This setting allows you to raise your PHP memory limit to a reasonable value. Note: WordPress core and other WordPress plugins may also change the value of the memory limit.', 'all-in-one-seo-pack' ), + 'execution_time' => __( 'This setting allows you to raise your PHP execution time to a reasonable value.', 'all-in-one-seo-pack' ), + 'force_rewrites' => __( 'Use output buffering to ensure that the title gets rewritten. Enable this option if you run into issues with the title tag being set by your theme or another plugin.', 'all-in-one-seo-pack' ), ); - + $this->default_options = array( - 'memory_limit' => Array( 'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ), - 'default' => '256M', 'type' => 'select', - 'initial_options' => Array( 0 => __( "Use the system default", 'all-in-one-seo-pack' ), '32M' => '32MB', '64M' => '64MB', '128M' => '128MB', '256M' => '256MB' ) ), - 'execution_time' => Array( 'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ), - 'default' => '', 'type' => 'select', - 'initial_options' => Array( '' => __( "Use the system default", 'all-in-one-seo-pack' ), 30 => '30s', 60 => '1m', 120 => '2m', 300 => '5m', 0 => __( 'No limit', 'all-in-one-seo-pack' ) ) ) - ); - - $this->help_anchors = Array( + 'memory_limit' => array( + 'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ), + 'default' => '256M', + 'type' => 'select', + 'initial_options' => array( + 0 => __( 'Use the system default', 'all-in-one-seo-pack' ), + '32M' => '32MB', + '64M' => '64MB', + '128M' => '128MB', + '256M' => '256MB', + ), + ), + 'execution_time' => array( + 'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'select', + 'initial_options' => array( + '' => __( 'Use the system default', 'all-in-one-seo-pack' ), + 30 => '30s', + 60 => '1m', + 120 => '2m', + 300 => '5m', + 0 => __( 'No limit', 'all-in-one-seo-pack' ), + ), + ), + ); + + $this->help_anchors = array( 'memory_limit' => '#raise-memory-limit', 'execution_time' => '#raise-execution-time', - 'force_rewrites' => '#force-rewrites' + 'force_rewrites' => '#force-rewrites', ); - + global $aiosp, $aioseop_options; if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) && $aioseop_options['aiosp_rewrite_titles'] ) { - $this->default_options['force_rewrites'] = Array( - 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ), - 'default' => 1, 'type' => 'radio', - 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ), - 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ) - ); + $this->default_options['force_rewrites'] = array( + 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ), + 'default' => 1, + 'type' => 'radio', + 'initial_options' => array( + 1 => __( 'Enabled', 'all-in-one-seo-pack' ), + 0 => __( 'Disabled', 'all-in-one-seo-pack' ), + ), + ); } - - $this->layout = Array( - 'default' => Array( - 'name' => $this->name, - 'help_link' => 'http://semperplugins.com/documentation/performance-settings/', - 'options' => array_keys( $this->default_options ) - ) + + $this->layout = array( + 'default' => array( + 'name' => $this->name, + 'help_link' => 'http://semperplugins.com/documentation/performance-settings/', + 'options' => array_keys( $this->default_options ), + ), ); - - $system_status = Array( - 'status' => Array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ), + + $system_status = array( + 'status' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ), ); - - $this->layout['system_status'] = Array( - 'name' => __( 'System Status', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/performance-settings/', - 'options' => array_keys( $system_status ) - ); - + + $this->layout['system_status'] = array( + 'name' => __( 'System Status', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/performance-settings/', + 'options' => array_keys( $system_status ), + ); + $this->default_options = array_merge( $this->default_options, $system_status ); - + $this->add_help_text_links(); - - add_filter( $this->prefix . 'display_options', Array( $this, 'display_options_filter' ), 10, 2 ); - add_filter( $this->prefix . 'update_options', Array( $this, 'update_options_filter' ), 10, 2 ); - add_action( $this->prefix . 'settings_update', Array( $this, 'settings_update_action' ), 10, 2 ); + + add_filter( $this->prefix . 'display_options', array( $this, 'display_options_filter' ), 10, 2 ); + add_filter( $this->prefix . 'update_options', array( $this, 'update_options_filter' ), 10, 2 ); + add_action( $this->prefix . 'settings_update', array( $this, 'settings_update_action' ), 10, 2 ); } - + function update_options_filter( $options, $location ) { - if ( $location == null ) { - if ( isset( $options[ $this->prefix . 'force_rewrites' ] ) ) - unset( $options[ $this->prefix . 'force_rewrites' ] ); + if ( $location == null && isset( $options[ $this->prefix . 'force_rewrites' ] ) ) { + unset( $options[ $this->prefix . 'force_rewrites' ] ); } + return $options; } - + function display_options_filter( $options, $location ) { if ( $location == null ) { $options[ $this->prefix . 'force_rewrites' ] = 1; global $aiosp; if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) ) { - $opts = $aiosp->get_current_options( Array(), null ); + $opts = $aiosp->get_current_options( array(), null ); $options[ $this->prefix . 'force_rewrites' ] = $opts['aiosp_force_rewrites']; } } + return $options; } - + function settings_update_action( $options, $location ) { - if ( $location == null ) { - if ( isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) { - $force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ]; - if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) { - global $aiosp; - $opts = $aiosp->get_current_options( Array(), null ); - $opts['aiosp_force_rewrites'] = $force_rewrites; - $aiosp->update_class_option( $opts ); - wp_cache_flush(); - } + if ( $location == null && isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) { + $force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ]; + if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) { + global $aiosp; + $opts = $aiosp->get_current_options( array(), null ); + $opts['aiosp_force_rewrites'] = $force_rewrites; + $aiosp->update_class_option( $opts ); + wp_cache_flush(); } } } - + 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'] ); + 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 settings_page_init() { $this->default_options['status']['default'] = $this->get_serverinfo(); } - + function menu_order() { return 7; } - + function get_serverinfo() { - global $wpdb; + global $wpdb; global $wp_version; - $sqlversion = $wpdb->get_var("SELECT VERSION() AS version"); - $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'"); - if (is_array($mysqlinfo)) $sql_mode = $mysqlinfo[0]->Value; - if (empty($sql_mode)) $sql_mode = __('Not set', 'all-in-one-seo-pack' ); - if(ini_get('safe_mode')) $safe_mode = __('On', 'all-in-one-seo-pack' ); - else $safe_mode = __('Off', 'all-in-one-seo-pack' ); - if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'all-in-one-seo-pack' ); - else $allow_url_fopen = __('Off', 'all-in-one-seo-pack' ); - if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize'); - else $upload_max = __('N/A', 'all-in-one-seo-pack' ); - if(ini_get('post_max_size')) $post_max = ini_get('post_max_size'); - else $post_max = __('N/A', 'all-in-one-seo-pack' ); - if(ini_get('max_execution_time')) $max_execute = ini_get('max_execution_time'); - else $max_execute = __('N/A', 'all-in-one-seo-pack' ); - if(ini_get('memory_limit')) $memory_limit = ini_get('memory_limit'); - else $memory_limit = __('N/A', 'all-in-one-seo-pack' ); - if (function_exists('memory_get_usage')) $memory_usage = round(memory_get_usage() / 1024 / 1024, 2) . __(' MByte', 'all-in-one-seo-pack' ); - else $memory_usage = __('N/A', 'all-in-one-seo-pack' ); - if (is_callable('exif_read_data')) $exif = __('Yes', 'all-in-one-seo-pack' ). " ( V" . $this->substr(phpversion('exif'),0,4) . ")" ; - else $exif = __('No', 'all-in-one-seo-pack' ); - if (is_callable('iptcparse')) $iptc = __('Yes', 'all-in-one-seo-pack' ); - else $iptc = __('No', 'all-in-one-seo-pack' ); - if (is_callable('xml_parser_create')) $xml = __('Yes', 'all-in-one-seo-pack' ); - else $xml = __('No', 'all-in-one-seo-pack' ); - - if ( function_exists( 'wp_get_theme' ) ) { - $theme = wp_get_theme(); + $sqlversion = $wpdb->get_var( "SELECT VERSION() AS version" ); + $mysqlinfo = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" ); + if ( is_array( $mysqlinfo ) ) { + $sql_mode = $mysqlinfo[0]->Value; + } + if ( empty( $sql_mode ) ) { + $sql_mode = __( 'Not set', 'all-in-one-seo-pack' ); + } + if ( ini_get( 'safe_mode' ) ) { + $safe_mode = __( 'On', 'all-in-one-seo-pack' ); + } else { + $safe_mode = __( 'Off', 'all-in-one-seo-pack' ); + } + if ( ini_get( 'allow_url_fopen' ) ) { + $allow_url_fopen = __( 'On', 'all-in-one-seo-pack' ); + } else { + $allow_url_fopen = __( 'Off', 'all-in-one-seo-pack' ); + } + if ( ini_get( 'upload_max_filesize' ) ) { + $upload_max = ini_get( 'upload_max_filesize' ); + } else { + $upload_max = __( 'N/A', 'all-in-one-seo-pack' ); + } + if ( ini_get( 'post_max_size' ) ) { + $post_max = ini_get( 'post_max_size' ); + } else { + $post_max = __( 'N/A', 'all-in-one-seo-pack' ); + } + if ( ini_get( 'max_execution_time' ) ) { + $max_execute = ini_get( 'max_execution_time' ); + } else { + $max_execute = __( 'N/A', 'all-in-one-seo-pack' ); + } + if ( ini_get( 'memory_limit' ) ) { + $memory_limit = ini_get( 'memory_limit' ); + } else { + $memory_limit = __( 'N/A', 'all-in-one-seo-pack' ); + } + if ( function_exists( 'memory_get_usage' ) ) { + $memory_usage = round( memory_get_usage() / 1024 / 1024, 2 ) . __( ' MByte', 'all-in-one-seo-pack' ); + } else { + $memory_usage = __( 'N/A', 'all-in-one-seo-pack' ); + } + if ( is_callable( 'exif_read_data' ) ) { + $exif = __( 'Yes', 'all-in-one-seo-pack' ) . ' ( V' . $this->substr( phpversion( 'exif' ), 0, 4 ) . ')'; + } else { + $exif = __( 'No', 'all-in-one-seo-pack' ); + } + if ( is_callable( 'iptcparse' ) ) { + $iptc = __( 'Yes', 'all-in-one-seo-pack' ); + } else { + $iptc = __( 'No', 'all-in-one-seo-pack' ); + } + if ( is_callable( 'xml_parser_create' ) ) { + $xml = __( 'Yes', 'all-in-one-seo-pack' ); } else { - $theme = get_theme( get_current_theme() ); + $xml = __( 'No', 'all-in-one-seo-pack' ); } + $theme = wp_get_theme(); if ( function_exists( 'is_multisite' ) ) { if ( is_multisite() ) { - $ms = __('Yes', 'all-in-one-seo-pack' ); + $ms = __( 'Yes', 'all-in-one-seo-pack' ); } else { - $ms = __('No', 'all-in-one-seo-pack' ); + $ms = __( 'No', 'all-in-one-seo-pack' ); } - } else $ms = __('N/A', 'all-in-one-seo-pack' ); - - $siteurl = get_option('siteurl'); - $homeurl = get_option('home'); - $db_version = get_option('db_version'); - - $debug_info = Array( - __('Operating System', 'all-in-one-seo-pack' ) => PHP_OS, - __('Server', 'all-in-one-seo-pack' ) => $_SERVER["SERVER_SOFTWARE"], - __('Memory usage', 'all-in-one-seo-pack' ) => $memory_usage, - __('MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion, - __('SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode, - __('PHP Version', 'all-in-one-seo-pack' ) => PHP_VERSION, - __('PHP Safe Mode', 'all-in-one-seo-pack' ) => $safe_mode, - __('PHP Allow URL fopen', 'all-in-one-seo-pack' ) => $allow_url_fopen, - __('PHP Memory Limit', 'all-in-one-seo-pack' ) => $memory_limit, - __('PHP Max Upload Size', 'all-in-one-seo-pack' ) => $upload_max, - __('PHP Max Post Size', 'all-in-one-seo-pack' ) => $post_max, - __('PHP Max Script Execute Time', 'all-in-one-seo-pack' ) => $max_execute, - __('PHP Exif support', 'all-in-one-seo-pack' ) => $exif, - __('PHP IPTC support', 'all-in-one-seo-pack' ) => $iptc, - __('PHP XML support', 'all-in-one-seo-pack' ) => $xml, - __('Site URL', 'all-in-one-seo-pack' ) => $siteurl, - __('Home URL', 'all-in-one-seo-pack' ) => $homeurl, - __('WordPress Version', 'all-in-one-seo-pack' ) => $wp_version, - __('WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version, - __('Multisite', 'all-in-one-seo-pack' ) => $ms, - __('Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'].' '.$theme['Version'] + } else { + $ms = __( 'N/A', 'all-in-one-seo-pack' ); + } + + $siteurl = get_option( 'siteurl' ); + $homeurl = get_option( 'home' ); + $db_version = get_option( 'db_version' ); + + $debug_info = array( + __( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS, + __( 'Server', 'all-in-one-seo-pack' ) => $_SERVER['SERVER_SOFTWARE'], + __( 'Memory usage', 'all-in-one-seo-pack' ) => $memory_usage, + __( 'MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion, + __( 'SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode, + __( 'PHP Version', 'all-in-one-seo-pack' ) => PHP_VERSION, + __( 'PHP Safe Mode', 'all-in-one-seo-pack' ) => $safe_mode, + __( 'PHP Allow URL fopen', 'all-in-one-seo-pack' ) => $allow_url_fopen, + __( 'PHP Memory Limit', 'all-in-one-seo-pack' ) => $memory_limit, + __( 'PHP Max Upload Size', 'all-in-one-seo-pack' ) => $upload_max, + __( 'PHP Max Post Size', 'all-in-one-seo-pack' ) => $post_max, + __( 'PHP Max Script Execute Time', 'all-in-one-seo-pack' ) => $max_execute, + __( 'PHP Exif support', 'all-in-one-seo-pack' ) => $exif, + __( 'PHP IPTC support', 'all-in-one-seo-pack' ) => $iptc, + __( 'PHP XML support', 'all-in-one-seo-pack' ) => $xml, + __( 'Site URL', 'all-in-one-seo-pack' ) => $siteurl, + __( 'Home URL', 'all-in-one-seo-pack' ) => $homeurl, + __( 'WordPress Version', 'all-in-one-seo-pack' ) => $wp_version, + __( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version, + __( 'Multisite', 'all-in-one-seo-pack' ) => $ms, + __( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version'], ); $debug_info['Active Plugins'] = null; - $active_plugins = $inactive_plugins = Array(); - $plugins = get_plugins(); - foreach ($plugins as $path => $plugin) { + $active_plugins = $inactive_plugins = array(); + $plugins = get_plugins(); + foreach ( $plugins as $path => $plugin ) { if ( is_plugin_active( $path ) ) { - $debug_info[$plugin['Name']] = $plugin['Version']; + $debug_info[ $plugin['Name'] ] = $plugin['Version']; } else { - $inactive_plugins[$plugin['Name']] = $plugin['Version']; + $inactive_plugins[ $plugin['Name'] ] = $plugin['Version']; } } $debug_info['Inactive Plugins'] = null; - $debug_info = array_merge( $debug_info, (array)$inactive_plugins ); + $debug_info = array_merge( $debug_info, (array) $inactive_plugins ); - $mail_text = __( "All in One SEO Pack Pro Debug Info", 'all-in-one-seo-pack' ) . "\r\n------------------\r\n\r\n"; - $page_text = ""; - if ( !empty( $debug_info ) ) - foreach($debug_info as $name => $value) { - if ($value !== null) { + $mail_text = __( 'All in One SEO Pack Pro Debug Info', 'all-in-one-seo-pack' ) . "\r\n------------------\r\n\r\n"; + $page_text = ''; + if ( ! empty( $debug_info ) ) { + foreach ( $debug_info as $name => $value ) { + if ( $value !== null ) { $page_text .= "
  • $name $value
  • "; $mail_text .= "$name: $value\r\n"; } else { @@ -226,40 +285,46 @@ function get_serverinfo() { $mail_text .= "\r\n$name\r\n----------\r\n"; } } + } - do if ( !empty( $_REQUEST['sfwd_debug_submit'] ) || !empty( $_REQUEST['sfwd_update_check'] ) ) { - $nonce=$_REQUEST['sfwd_debug_nonce']; - if (! wp_verify_nonce($nonce, 'sfwd-debug-nonce') ) { - echo "
    " . __( "Form submission error: verification check failed.", 'all-in-one-seo-pack' ) . "
    "; - break; - } - if ( !empty( $_REQUEST['sfwd_update_check'] ) && $_REQUEST['sfwd_update_check'] ) { - global $aioseop_update_checker; - $aioseop_update_checker->checkForUpdates(); - echo "
    " . sprintf( __( "%s has checked for updates.", 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ) . "
    "; - break; - } - $email = ''; - if ( !empty( $_REQUEST['sfwd_debug_send_email'] ) ) $email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] ); - if ( $email ) { - if ( wp_mail( $email, sprintf( __( "SFWD Debug Mail From Site %s.", 'all-in-one-seo-pack'), $siteurl), $mail_text ) ) { - echo "
    " . sprintf( __( "Sent to %s.", 'all-in-one-seo-pack' ), $email ) . "
    "; + do { + if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) || ! empty( $_REQUEST['sfwd_update_check'] ) ) { + $nonce = $_REQUEST['sfwd_debug_nonce']; + if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) { + echo "
    " . __( 'Form submission error: verification check failed.', 'all-in-one-seo-pack' ) . '
    '; + break; + } + if ( $_REQUEST['sfwd_update_check'] ) { + global $aioseop_update_checker; + $aioseop_update_checker->checkForUpdates(); + echo "
    " . sprintf( __( '%s has checked for updates.', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ) . '
    '; + break; + } + $email = ''; + if ( ! empty( $_REQUEST['sfwd_debug_send_email'] ) ) { + $email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] ); + } + if ( $email ) { + if ( wp_mail( $email, sprintf( __( 'SFWD Debug Mail From Site %s.', 'all-in-one-seo-pack' ), $siteurl ), $mail_text ) ) { + echo "
    " . sprintf( __( 'Sent to %s.', 'all-in-one-seo-pack' ), $email ) . '
    '; + } else { + echo "
    " . sprintf( __( 'Failed to send to %s.', 'all-in-one-seo-pack' ), $email ) . '
    '; + } } else { - echo "
    " . sprintf( __( "Failed to send to %s.", 'all-in-one-seo-pack' ), $email ) . "
    "; + echo "
    " . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . '
    '; } - } else { - echo "
    " . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . "
    "; } - } while(0); // control structure for use with break - $nonce = wp_create_nonce('sfwd-debug-nonce'); - $buf = "
      \n{$page_text}\n
    \n

    \n" . - ''; - - if ( AIOSEOPPRO ){ - $buf .= '

    '; - } + } while ( 0 ); // Control structure for use with break. + $nonce = wp_create_nonce( 'sfwd-debug-nonce' ); + $buf = "

      \n{$page_text}\n
    \n

    \n" . + ''; + + if ( AIOSEOPPRO ) { + $buf .= '

    '; + } + return $buf; } } -} \ No newline at end of file +} diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_robots.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_robots.php index 2ed2247978..2e18462478 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_robots.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_robots.php @@ -1,83 +1,166 @@ name = __('Robots.txt', 'all-in-one-seo-pack'); // Human-readable name of the plugin - $this->prefix = 'aiosp_robots_'; // option prefix - $this->file = __FILE__; // the current file + function __construct() { + $this->name = __( 'Robots.txt', 'all-in-one-seo-pack' ); // Human-readable name of the plugin + $this->prefix = 'aiosp_robots_'; // option prefix + $this->file = __FILE__; // the current file parent::__construct(); - + $help_text = Array( - 'additional'=> __('Rule Type', 'all-in-one-seo-pack'), - 'useragent' => __('User Agent', 'all-in-one-seo-pack'), - 'path' => __('Directory Path', 'all-in-one-seo-pack'), - 'robotgen' => __('Robots.txt editor', 'all-in-one-seo-pack'), + 'additional' => __( 'Rule Type', 'all-in-one-seo-pack' ), + 'useragent' => __( 'User Agent', 'all-in-one-seo-pack' ), + 'path' => __( 'Directory Path', 'all-in-one-seo-pack' ), + 'robotgen' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ), ); - + $this->default_options = array( - 'usage' => Array( 'type' => 'html', 'label' => 'none', - 'default' => __( 'Use the rule builder below to add rules to create a new Robots.txt file.  If you already have a Robots.txt file you should use the File Editor feature in All in One SEO Pack to edit it or you can delete your current Robots.txt file and start a new one with the rule builder below.', 'all-in-one-seo-pack' ), - 'save' => false ), - 'additional'=> Array( 'name' => __( 'Rule Type', 'all-in-one-seo-pack' ), - 'save' => false, - 'type' => 'select', 'initial_options' => Array( 'allow' => 'Allow', 'block' => 'Block' ) ), - 'useragent' => Array( 'name' => __( 'User Agent', 'all-in-one-seo-pack' ), - 'save' => false, - 'type' => 'text' ), - 'path' => Array( 'name' => __( 'Directory Path', 'all-in-one-seo-pack' ), - 'save' => false, - 'type' => 'text' ), - 'robotgen' => Array( 'name' => __( 'Generate Robots.txt', 'all-in-one-seo-pack'), - 'save' => false, - 'default' => '', 'type' => 'textarea', 'cols' => 57, 'rows' => 20, 'label' => 'none', 'readonly' => 'readonly' ), - 'Submit_Preview' => Array( 'type' => 'submit', 'class' => 'button-primary MRL', 'name' => __( 'Add Rule', 'all-in-one-seo-pack' ) . ' »', 'nowrap' => 1 ), - 'Submit_Update' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Save Robots.txt File', 'all-in-one-seo-pack' ) . ' »', 'nowrap' => 1 ), - 'Submit_Delete' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Delete Robots.txt File', 'all-in-one-seo-pack' ) . ' »', 'nowrap' => 1 ), - 'optusage' => Array( 'type' => 'html', 'label' => 'none', - 'default' => __( 'Click the Optimize button below and All in One SEO Pack will analyze your Robots.txt file to make sure it complies with the standards for Robots.txt files.  The results will be displayed in a table below.', 'all-in-one-seo-pack' ), - 'save' => false ), - 'Submit_Opt_Update' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Update Robots.txt File', 'all-in-one-seo-pack' ) . ' »', 'nowrap' => 1, 'style' => 'margin-left: 20px;' ), - 'Submit_Opt_Preview' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Disregard Changes', 'all-in-one-seo-pack' ) . ' »', 'nowrap' => 1), - 'Submit_Optimize' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __('Optimize', 'all-in-one-seo-pack') . ' »' ) - ); - - if ( !empty( $help_text ) ) - foreach( $help_text as $k => $v ) - $this->default_options[$k]['help_text'] = $v; - - $this->locations = array( 'generator' => Array( 'name' => "Robots.txt", 'type' => 'settings', - 'options' => Array( 'usage', 'additional', 'useragent', 'path', 'Submit_Preview', 'Submit_Update', 'Submit_Delete', 'robotgen', 'optusage', 'Submit_Opt_Update', 'Submit_Opt_Preview', 'Submit_Optimize' ) ), - ); - - $this->layout = Array( + 'usage' => Array( + 'type' => 'html', + 'label' => 'none', + 'default' => __( 'Use the rule builder below to add rules to create a new Robots.txt file.  If you already have a Robots.txt file you should use the File Editor feature in All in One SEO Pack to edit it or you can delete your current Robots.txt file and start a new one with the rule builder below.', 'all-in-one-seo-pack' ), + 'save' => false, + ), + 'additional' => Array( + 'name' => __( 'Rule Type', 'all-in-one-seo-pack' ), + 'save' => false, + 'type' => 'select', + 'initial_options' => Array( 'allow' => 'Allow', 'block' => 'Block' ), + ), + 'useragent' => Array( + 'name' => __( 'User Agent', 'all-in-one-seo-pack' ), + 'save' => false, + 'type' => 'text', + ), + 'path' => Array( + 'name' => __( 'Directory Path', 'all-in-one-seo-pack' ), + 'save' => false, + 'type' => 'text', + ), + 'robotgen' => Array( + 'name' => __( 'Generate Robots.txt', 'all-in-one-seo-pack' ), + 'save' => false, + 'default' => '', + 'type' => 'textarea', + 'cols' => 57, + 'rows' => 20, + 'label' => 'none', + 'readonly' => 'readonly', + ), + 'Submit_Preview' => Array( + 'type' => 'submit', + 'class' => 'button-primary MRL', + 'name' => __( 'Add Rule', 'all-in-one-seo-pack' ) . ' »', + 'nowrap' => 1, + ), + 'Submit_Update' => Array( + 'type' => 'submit', + 'class' => 'button-primary', + 'name' => __( 'Save Robots.txt File', 'all-in-one-seo-pack' ) . ' »', + 'nowrap' => 1, + ), + 'Submit_Delete' => Array( + 'type' => 'submit', + 'class' => 'button-primary', + 'name' => __( 'Delete Robots.txt File', 'all-in-one-seo-pack' ) . ' »', + 'nowrap' => 1, + ), + 'optusage' => Array( + 'type' => 'html', + 'label' => 'none', + 'default' => __( 'Click the Optimize button below and All in One SEO Pack will analyze your Robots.txt file to make sure it complies with the standards for Robots.txt files.  The results will be displayed in a table below.', 'all-in-one-seo-pack' ), + 'save' => false, + ), + 'Submit_Opt_Update' => Array( + 'type' => 'submit', + 'class' => 'button-primary', + 'name' => __( 'Update Robots.txt File', 'all-in-one-seo-pack' ) . ' »', + 'nowrap' => 1, + 'style' => 'margin-left: 20px;', + ), + 'Submit_Opt_Preview' => Array( + 'type' => 'submit', + 'class' => 'button-primary', + 'name' => __( 'Disregard Changes', 'all-in-one-seo-pack' ) . ' »', + 'nowrap' => 1, + ), + 'Submit_Optimize' => Array( + 'type' => 'submit', + 'class' => 'button-primary', + 'name' => __( 'Optimize', 'all-in-one-seo-pack' ) . ' »', + ), + ); + + if ( ! empty( $help_text ) ) { + foreach ( $help_text as $k => $v ) { + $this->default_options[ $k ]['help_text'] = $v; + } + } + + $this->locations = array( + 'generator' => Array( + 'name' => "Robots.txt", + 'type' => 'settings', + 'options' => Array( + 'usage', + 'additional', + 'useragent', + 'path', + 'Submit_Preview', + 'Submit_Update', + 'Submit_Delete', + 'robotgen', + 'optusage', + 'Submit_Opt_Update', + 'Submit_Opt_Preview', + 'Submit_Optimize', + ), + ), + ); + + $this->layout = Array( 'default' => Array( - 'name' => __( 'Create a Robots.txt File', 'all-in-one-seo-pack' ), - 'options' => Array( 'usage', 'additional', 'useragent', 'path', 'Submit_Preview', 'Submit_Update', 'Submit_Delete', 'robotgen' ) // this is set below, to the remaining options -- pdb - ) - ); - $this->layout['optimize'] = Array( - 'name' => __( 'Optimize your Robots.txt File', 'all-in-one-seo-pack' ), - 'options' => Array( 'optusage', 'Submit_Optimize' ) - ); + 'name' => __( 'Create a Robots.txt File', 'all-in-one-seo-pack' ), + 'options' => Array( + 'usage', + 'additional', + 'useragent', + 'path', + 'Submit_Preview', + 'Submit_Update', + 'Submit_Delete', + 'robotgen', + ) // this is set below, to the remaining options -- pdb + ), + ); + $this->layout['optimize'] = Array( + 'name' => __( 'Optimize your Robots.txt File', 'all-in-one-seo-pack' ), + 'options' => Array( 'optusage', 'Submit_Optimize' ), + ); if ( isset( $_POST['Submit_Optimize'] ) ) { - $this->layout['optimize']['options'] = Array( 'optusage', 'Submit_Opt_Update', 'Submit_Opt_Preview', 'robothtml' ); + $this->layout['optimize']['options'] = Array( + 'optusage', + 'Submit_Opt_Update', + 'Submit_Opt_Preview', + 'robothtml', + ); $this->default_options['optusage']['default'] = __( "Your Robots.txt file has been optimized.  Here are the results and recommendations.  Click the Update Robots.txt File button below to write these changes to your Robots.txt file.  Click the Disregard Changes button to ignore these recommendations and keep your current Robots.txt file.", 'all-in-one-seo-pack' ); } - + // load initial options / set defaults - $this->update_options( ); - - add_action( $this->prefix . 'settings_update', Array( $this, 'do_robots' ), 10, 2 ); - add_filter( $this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 ); - add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 ); - add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 2 ); + $this->update_options(); + + add_action( $this->prefix . 'settings_update', Array( $this, 'do_robots' ), 10, 2 ); + add_filter( $this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 ); + add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 ); + add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 2 ); } function filter_settings( $settings, $location ) { @@ -85,93 +168,151 @@ function filter_settings( $settings, $location ) { $prefix = $this->get_prefix( $location ) . $location . '_'; if ( isset( $_POST['Submit_Optimize'] ) ) { if ( isset( $settings[ $prefix . 'robotgen' ] ) ) { - $settings[ $prefix . 'robotgen' ]['type'] = 'hidden'; - $settings[ $prefix . 'robotgen' ]['label'] = 'none'; + $settings[ $prefix . 'robotgen' ]['type'] = 'hidden'; + $settings[ $prefix . 'robotgen' ]['label'] = 'none'; $settings[ $prefix . 'robotgen' ]['help_text'] = ''; - $settings[ $prefix . 'robothtml'] = Array( 'name' => __( 'Robots.txt', 'all-in-one-seo-pack'), - 'save' => false, 'default' => '', 'type' => 'html', 'label' => 'none', 'style' => 'margin-top:10px;' ); + $settings[ $prefix . 'robothtml' ] = Array( + 'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ), + 'save' => false, + 'default' => '', + 'type' => 'html', + 'label' => 'none', + 'style' => 'margin-top:10px;', + ); } } } + return $settings; } - + function filter_submit( $submit, $location ) { if ( $location == 'generator' ) { unset( $submit['Submit_Default'] ); $submit['Submit']['type'] = 'hidden'; } + return $submit; } - + + /** + * Returns the sitemap filename; + * + * @return bool + */ + function get_sitemap_filename() { + + global $aioseop_options; + if ( isset( $aioseop_options['modules']['aiosp_sitemap_options']['aiosp_sitemap_filename'] ) ) { + return $aioseop_options['modules']['aiosp_sitemap_options']['aiosp_sitemap_filename']; + } + + return false; + } + + /** + * Filters the options. + * + * @todo Much of this couldn't be considered filtering options, and should be extracted to other functions. + * @since ?? + * @since 2.3.6 + */ function filter_options( $options, $location ) { - if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( $location ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + } if ( $location === 'generator' ) { - $optimize = false; - $robotgen = ''; - if ( !empty( $_POST[$prefix . 'robotgen'] ) ) $robotgen = str_replace( "\r\n", "\n", $_POST[$prefix . 'robotgen'] ); - if ( isset( $_POST['Submit_Preview'] ) ) $options[$prefix . 'robotgen'] = $robotgen; - if ( !isset( $_POST['Submit_Preview'] ) ) { - if ( isset( $_POST['Submit_Optimize'] ) && !isset( $_POST['Submit_Delete'] ) && !isset( $_POST['Submit_Update'] ) && !isset( $_POST['Submit_Opt_Update'] ) ) - $optimize = true; - if ( !isset( $options[$prefix . 'robotgen'] ) || empty( $options[$prefix . 'robotgen'] ) ) { - if ( $optimize ) $options[$prefix . 'robotgen'] = $robotgen; - if ( empty( $options[$prefix . 'robotgen'] ) ) - $options = $this->load_files( $options, Array( 'robotgen' => 'robots.txt' ), $prefix ); + $optimize = false; + $robotgen = ''; + if ( ! empty( $_POST[ $prefix . 'robotgen' ] ) ) { + $robotgen = str_replace( "\r\n", "\n", $_POST[ $prefix . 'robotgen' ] ); + } + if ( isset( $_POST['Submit_Preview'] ) ) { + $options[ $prefix . 'robotgen' ] = $robotgen; + } + if ( ! isset( $_POST['Submit_Preview'] ) ) { + if ( isset( $_POST['Submit_Optimize'] ) && ! isset( $_POST['Submit_Delete'] ) && ! isset( $_POST['Submit_Update'] ) && ! isset( $_POST['Submit_Opt_Update'] ) ) { + $optimize = true; + } + if ( ! isset( $options[ $prefix . 'robotgen' ] ) || empty( $options[ $prefix . 'robotgen' ] ) ) { + if ( $optimize ) { + $options[ $prefix . 'robotgen' ] = $robotgen; + } + if ( empty( $options[ $prefix . 'robotgen' ] ) ) { + $options = $this->load_files( $options, Array( 'robotgen' => 'robots.txt' ), $prefix ); } } - $access = ( get_option('blog_public') ) ? 'allow' : 'block'; - if ( $access ) { - $allow_rule = "Sitemap: \n\n# global\nUser-agent: *\nDisallow: /xmlrpc.php\n\n"; - $block_rule = "# global\nUser-agent: *\nDisallow: /\n\n"; - if ( empty( $options[$prefix . 'robotgen'] ) ) $options[$prefix . 'robotgen'] = ''; - if ( isset( $_POST['Submit_Preview'] ) && ( ( $options[$prefix . 'robotgen'] == $allow_rule ) || - ( $options[$prefix . 'robotgen'] == $block_rule ) ) ) - $options[$prefix . 'robotgen'] = ''; - if ( $access === 'block' && empty( $options[$prefix . 'robotgen'] ) ) - $options[$prefix . 'robotgen'] .= $block_rule; - elseif ( $access === 'allow' && empty( $options[$prefix . 'robotgen'] ) ) - $options[$prefix . 'robotgen'] .= $allow_rule; + } + $access = ( get_option( 'blog_public' ) ) ? 'allow' : 'block'; + if ( $access ) { + global $aioseop_options; + $sitemap_url = ''; + $sitemap_filename = $this->get_sitemap_filename(); + if ( $sitemap_filename ) { + $sitemapurl = trailingslashit( get_home_url() ) . $sitemap_filename . '.xml'; } - foreach ( Array( 'ad' => 'additional', 'ua' => 'useragent', 'dp' => 'path' ) as $k => $v ) - if ( isset( $_POST[$prefix . $v] ) ) $$k = $_POST[$prefix . $v]; - if ( !empty( $ad ) && !empty( $ua ) && !empty( $dp ) ) { - if ( $ad === 'allow' ) - $ad = "Allow: "; - else - $ad = "Disallow: "; - $options[$prefix . 'robotgen'] .= "User-agent: $ua\n$ad $dp\n\n"; + $allow_rule = "Sitemap: $sitemapurl \n\n# global\nUser-agent: *\nDisallow: /xmlrpc.php\n\n"; + $block_rule = "# global\nUser-agent: *\nDisallow: /\n\n"; + if ( empty( $options[ $prefix . 'robotgen' ] ) ) { + $options[ $prefix . 'robotgen' ] = ''; } - $file = explode("\n", $options[$prefix . 'robotgen'] ); - if ( $optimize ) { - $rules = $this->parse_robots( $file ); - $user_agents = $this->get_robot_user_agents( $rules ); - foreach ($user_agents as $ua => $rules) { - $user_agents[$ua]['disallow'] = $this->opt_robot_rule($rules['disallow']); - $user_agents[$ua]['allow'] = $this->opt_robot_rule($rules['allow']); - } - $rules = $this->flatten_user_agents( $user_agents ); - unset($user_agents); - foreach ($rules as $r) { - $r['disallow'] = $this->opt_robot_rule( $r['disallow'] ); - $r['allow'] = $this->opt_robot_rule( $r['allow'] ); - } - $options[$prefix . 'robotgen'] = $this->output_robots($rules); - $file2 = explode("\n", $options[$prefix . 'robotgen'] ); - $options[$prefix . 'robothtml'] = '
    ' . $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) ) . '' . $this->annotate_robots_html( $file2, true, __( "Proposed Changes", 'all-in-one-seo-pack' ) ) . '
    '; + if ( isset( $_POST['Submit_Preview'] ) && ( ( $options[ $prefix . 'robotgen' ] == $allow_rule ) || + ( $options[ $prefix . 'robotgen' ] == $block_rule ) ) + ) { + $options[ $prefix . 'robotgen' ] = ''; + } + if ( $access === 'block' && empty( $options[ $prefix . 'robotgen' ] ) ) { + $options[ $prefix . 'robotgen' ] .= $block_rule; + } elseif ( $access === 'allow' && empty( $options[ $prefix . 'robotgen' ] ) ) { + $options[ $prefix . 'robotgen' ] .= $allow_rule; + } + } + foreach ( Array( 'ad' => 'additional', 'ua' => 'useragent', 'dp' => 'path' ) as $k => $v ) { + if ( isset( $_POST[ $prefix . $v ] ) ) { + $$k = $_POST[ $prefix . $v ]; + } + } + if ( ! empty( $ad ) && ! empty( $ua ) && ! empty( $dp ) ) { + if ( $ad === 'allow' ) { + $ad = "Allow: "; } else { - $options[$prefix . 'robothtml'] = $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) ); + $ad = "Disallow: "; + } + $options[ $prefix . 'robotgen' ] .= "User-agent: $ua\n$ad $dp\n\n"; + } + $file = explode( "\n", $options[ $prefix . 'robotgen' ] ); + if ( $optimize ) { + $rules = $this->parse_robots( $file ); + $user_agents = $this->get_robot_user_agents( $rules ); + foreach ( $user_agents as $ua => $rules ) { + $user_agents[ $ua ]['disallow'] = $this->opt_robot_rule( $rules['disallow'] ); + $user_agents[ $ua ]['allow'] = $this->opt_robot_rule( $rules['allow'] ); } + $rules = $this->flatten_user_agents( $user_agents ); + unset( $user_agents ); + foreach ( $rules as $r ) { + $r['disallow'] = $this->opt_robot_rule( $r['disallow'] ); + $r['allow'] = $this->opt_robot_rule( $r['allow'] ); + } + $options[ $prefix . 'robotgen' ] = $this->output_robots( $rules ); + $file2 = explode( "\n", $options[ $prefix . 'robotgen' ] ); + $options[ $prefix . 'robothtml' ] = '
    ' . $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) ) . '' . $this->annotate_robots_html( $file2, true, __( "Proposed Changes", 'all-in-one-seo-pack' ) ) . '
    '; + } else { + $options[ $prefix . 'robothtml' ] = $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) ); + } } + return $options; } function do_robots( $options, $location ) { - if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( $location ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + } if ( $location === 'generator' ) { if ( isset( $_POST['Submit_Update'] ) || isset( $_POST['Submit_Opt_Update'] ) ) { $this->save_files( Array( 'robotgen' => 'robots.txt' ), $prefix ); - } elseif (isset( $_POST['Submit_Delete'] ) ) { + } elseif ( isset( $_POST['Submit_Delete'] ) ) { $this->delete_files( Array( 'robotgen' => 'robots.txt' ) ); } } @@ -179,9 +320,9 @@ function do_robots( $options, $location ) { function annotate_robots_html( $file, $show_help = false, $title = '' ) { $robots = $this->annotate_robots( $file ); - if( !empty( $robots ) ){ + if ( ! empty( $robots ) ) { $buf = ''; - if ( !empty( $title ) ) { + if ( ! empty( $title ) ) { $buf .= ""; } $buf .= ''; @@ -190,21 +331,21 @@ function annotate_robots_html( $file, $show_help = false, $title = '' ) { $buf .= ""; foreach ( $robots as $r ) { - $class = 'robots'; + $class = 'robots'; $status = "#9cf975"; - $help = ''; - if ( !$r['valid'] || !$r['strict'] ) { - if ( !$r['strict']) { + $help = ''; + if ( ! $r['valid'] || ! $r['strict'] ) { + if ( ! $r['strict'] ) { $class .= ' quirks'; - $status="yellow"; + $status = "yellow"; } - if ( !$r['valid'] ) { + if ( ! $r['valid'] ) { $class .= ' invalid'; - $status="#f9534a"; + $status = "#f9534a"; } if ( $show_help ) { $help = '' - . '
    '; + . '
    '; } } $buf .= ""; @@ -212,184 +353,289 @@ function annotate_robots_html( $file, $show_help = false, $title = '' ) { $buf .= ''; $buf .= '
    " . $title . "
    {$help}
    '; - if ( $show_help ) { + if ( $show_help ) { $buf .= '

    ' . __( 'Legend', 'all-in-one-seo-pack' ) . '

    • ' . __( 'The yellow indicator means that a non-standard extension was recognized; not all crawlers may recognize it or interpret it the same way. The Allow and Sitemap directives are commonly used by Google and Yahoo.', 'all-in-one-seo-pack' ) . '
    • -
    • ' . __( 'The red indicator means that the syntax is invalid for a robots.txt file.', 'all-in-one-seo-pack') . '
    • +
    • ' . __( 'The red indicator means that the syntax is invalid for a robots.txt file.', 'all-in-one-seo-pack' ) . '
    - ' . __('More Information', 'all-in-one-seo-pack') . ' + ' . __( 'More Information', 'all-in-one-seo-pack' ) . '
    '; } } else { $buf = '

    Your Robots.txt file is either empty, cannot be found, or has invalid data.

    '; } + return $buf; } function annotate_robots( $robots ) { - $state = 0; - $rules = Array(); - foreach ($robots as $l) { - $l = trim($l); - if (empty($l[0])) { - if ( $state > 1 ) { - $rules[] = Array( 'state' => 0, 'type' => 'blank', 'content' => $l, 'valid' => true, 'strict' => true ); - $state = 0; - } - } elseif ($l[0] === '#') { - if ($state < 1) $state = 1; - $rules[] = Array( 'state' => $state, 'type' => 'comment', 'content' => $l, 'valid' => true, 'strict' => true ); - } elseif ( stripos($l, 'sitemap') === 0) { - $state = 2; - $rules[] = Array( 'state' => $state, 'type' => 'sitemap', 'content' => $l, 'valid' => true, 'strict' => false ); - } elseif ( stripos($l, 'crawl-delay') === 0) { - $state = 3; - $rules[] = Array( 'state' => $state, 'type' => 'crawl-delay', 'content' => $l, 'valid' => true, 'strict' => false ); - } elseif ( stripos($l, 'user-agent') === 0) { - $state = 3; - $rules[] = Array( 'state' => $state, 'type' => 'user-agent', 'content' => $l, 'valid' => true, 'strict' => true ); - } elseif ( stripos($l, 'useragent') === 0) { - $state = 3; - $rules[] = Array( 'state' => $state, 'type' => 'user-agent', 'content' => $l, 'valid' => true, 'strict' => false ); - } elseif ( stripos($l, 'disallow') === 0) { - if ($state < 3) { - $rules[] = Array( 'state' => $state, 'type' => 'disallow', 'content' => $l, 'valid' => false, 'strict' => false ); - continue; - } - $state = 3; - $rules[] = Array( 'state' => $state, 'type' => 'disallow', 'content' => $l, 'valid' => true, 'strict' => true ); - } elseif ( stripos($l, 'allow') === 0) { - if ($state < 3) { - $rules[] = Array( 'state' => $state, 'type' => 'allow', 'content' => $l, 'valid' => false, 'strict' => false ); - continue; - } - $state = 3; - $rules[] = Array( 'state' => $state, 'type' => 'allow', 'content' => $l, 'valid' => true, 'strict' => false ); - } else { - $rules[] = Array( 'state' => $state, 'type' => 'unknown', 'content' => $l, 'valid' => false, 'strict' => false ); + $state = 0; + $rules = Array(); + foreach ( $robots as $l ) { + $l = trim( $l ); + if ( empty( $l[0] ) ) { + if ( $state > 1 ) { + $rules[] = Array( + 'state' => 0, + 'type' => 'blank', + 'content' => $l, + 'valid' => true, + 'strict' => true, + ); + $state = 0; } + } elseif ( $l[0] === '#' ) { + if ( $state < 1 ) { + $state = 1; + } + $rules[] = Array( + 'state' => $state, + 'type' => 'comment', + 'content' => $l, + 'valid' => true, + 'strict' => true, + ); + } elseif ( stripos( $l, 'sitemap' ) === 0 ) { + $state = 2; + $rules[] = Array( + 'state' => $state, + 'type' => 'sitemap', + 'content' => $l, + 'valid' => true, + 'strict' => false, + ); + } elseif ( stripos( $l, 'crawl-delay' ) === 0 ) { + $state = 3; + $rules[] = Array( + 'state' => $state, + 'type' => 'crawl-delay', + 'content' => $l, + 'valid' => true, + 'strict' => false, + ); + } elseif ( stripos( $l, 'user-agent' ) === 0 ) { + $state = 3; + $rules[] = Array( + 'state' => $state, + 'type' => 'user-agent', + 'content' => $l, + 'valid' => true, + 'strict' => true, + ); + } elseif ( stripos( $l, 'useragent' ) === 0 ) { + $state = 3; + $rules[] = Array( + 'state' => $state, + 'type' => 'user-agent', + 'content' => $l, + 'valid' => true, + 'strict' => false, + ); + } elseif ( stripos( $l, 'disallow' ) === 0 ) { + if ( $state < 3 ) { + $rules[] = Array( + 'state' => $state, + 'type' => 'disallow', + 'content' => $l, + 'valid' => false, + 'strict' => false, + ); + continue; + } + $state = 3; + $rules[] = Array( + 'state' => $state, + 'type' => 'disallow', + 'content' => $l, + 'valid' => true, + 'strict' => true, + ); + } elseif ( stripos( $l, 'allow' ) === 0 ) { + if ( $state < 3 ) { + $rules[] = Array( + 'state' => $state, + 'type' => 'allow', + 'content' => $l, + 'valid' => false, + 'strict' => false, + ); + continue; + } + $state = 3; + $rules[] = Array( + 'state' => $state, + 'type' => 'allow', + 'content' => $l, + 'valid' => true, + 'strict' => false, + ); + } else { + $rules[] = Array( + 'state' => $state, + 'type' => 'unknown', + 'content' => $l, + 'valid' => false, + 'strict' => false, + ); } - return $rules; + } + + return $rules; } function parse_annotated_robots( $robots ) { - $state = 0; - $rules = Array(); - $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' ); - $rule = Array(); - foreach ( $opts as $o ) $rule[$o] = Array(); - $blank_rule = $rule; - foreach ($robots as $l) { - switch ( $l['type'] ) { - case 'blank': - if ( $state >= 1 ) { - if ( ( $state === 1 ) && ( empty($rule['user-agent'] ) ) ) $rule['user-agent'] = Array( null ); - $rules[] = $rule; - $rule = $blank_rule; + $state = 0; + $rules = Array(); + $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' ); + $rule = Array(); + foreach ( $opts as $o ) { + $rule[ $o ] = Array(); + } + $blank_rule = $rule; + foreach ( $robots as $l ) { + switch ( $l['type'] ) { + case 'blank': + if ( $state >= 1 ) { + if ( ( $state === 1 ) && ( empty( $rule['user-agent'] ) ) ) { + $rule['user-agent'] = Array( null ); } - continue; - case 'comment': - $rule['comment'][] = $l['content']; - continue; - case 'sitemap': - $rule['sitemap'][] = trim( substr($l['content'], 8) ); - break; - case 'crawl-delay': - $rule['crawl-delay'][] = trim( substr($l['content'], 12) ); + $rules[] = $rule; + $rule = $blank_rule; + } + continue; + case 'comment': + $rule['comment'][] = $l['content']; + continue; + case 'sitemap': + $rule['sitemap'][] = trim( substr( $l['content'], 8 ) ); + break; + case 'crawl-delay': + $rule['crawl-delay'][] = trim( substr( $l['content'], 12 ) ); + break; + case 'user-agent': + if ( $l['strict'] ) { + $ua = trim( substr( $l['content'], 11 ) ); + } else { + $ua = trim( substr( $l['content'], 10 ) ); + } + $rule['user-agent'][] = $ua; + break; + case 'disallow': + if ( $l['valid'] ) { + $rule['disallow'][] = trim( substr( $l['content'], 9 ) ); break; - case 'user-agent': - if ($l['strict']) - $ua = trim( substr($l['content'], 11) ); - else - $ua = trim( substr($l['content'], 10) ); - $rule['user-agent'][] = $ua; + } + continue; + case 'allow': + if ( $l['valid'] ) { + $rule['allow'][] = trim( substr( $l['content'], 6 ) ); break; - case 'disallow': - if ($l['valid']) { - $rule['disallow'][] = trim( substr($l['content'], 9) ); - break; - } - continue; - case 'allow': - if ($l['valid']) { - $rule['allow'][] = trim( substr($l['content'], 6) ); - break; - } - continue; - case 'unknown': - default: - } - $state = $l['state']; + } + continue; + case 'unknown': + default: } - if ( ( $state === 1 ) && ( empty($rule['user-agent'] ) ) ) $rule['user-agent'] = Array( null ); - if ($state >= 1) $rules[] = $rule; - return $rules; + $state = $l['state']; + } + if ( ( $state === 1 ) && ( empty( $rule['user-agent'] ) ) ) { + $rule['user-agent'] = Array( null ); + } + if ( $state >= 1 ) { + $rules[] = $rule; + } + + return $rules; } - + function parse_robots( $robots ) { - return $this->parse_annotated_robots ( $this->annotate_robots( $robots ) ); + return $this->parse_annotated_robots( $this->annotate_robots( $robots ) ); } - function get_robot_user_agents($rules) { - $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' ); + function get_robot_user_agents( $rules ) { + $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' ); $user_agents = Array(); - foreach ($rules as $r) { - if ( !empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) $r['user-agent'] = Array( null ); - foreach ($r['user-agent'] as $ua) { - if (!isset($user_agents[$ua])) $user_agents[$ua] = Array(); + foreach ( $rules as $r ) { + if ( ! empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) { + $r['user-agent'] = Array( null ); + } + foreach ( $r['user-agent'] as $ua ) { + if ( ! isset( $user_agents[ $ua ] ) ) { + $user_agents[ $ua ] = Array(); + } foreach ( $opts as $o ) { - if (!isset($user_agents[$ua][$o])) - $user_agents[$ua][$o] = $r[$o]; - else - $user_agents[$ua][$o] = array_merge( $user_agents[$ua][$o], $r[$o] ); + if ( ! isset( $user_agents[ $ua ][ $o ] ) ) { + $user_agents[ $ua ][ $o ] = $r[ $o ]; + } else { + $user_agents[ $ua ][ $o ] = array_merge( $user_agents[ $ua ][ $o ], $r[ $o ] ); + } } } } + return $user_agents; } function flatten_user_agents( $user_agents ) { $rules = Array(); - foreach ($user_agents as $ua => $r) { + foreach ( $user_agents as $ua => $r ) { $r['user-agent'] = Array( $ua ); - $rules[] = $r; + $rules[] = $r; } + return $rules; } - function opt_robot_rule($dis) { - if ( is_array($dis) ) { // unique rules only + function opt_robot_rule( $dis ) { + if ( is_array( $dis ) ) { // unique rules only $dis = array_unique( $dis, SORT_STRING ); - $pd = null; - foreach( $dis as $k => $d ) { - $d = trim($d); - if ( !empty($pd) && !empty($d) ) { - if ( strpos( $d, $pd ) === 0 ) { - unset($dis[$k]); - continue; // get rid of subpaths of $pd - } - } - $l = strlen($d); - if ( ($l > 0) && ($d[$l - 1] !== '/')) continue; - $pd = $d; // only allow directory paths for $pd - } + $pd = null; + foreach ( $dis as $k => $d ) { + $d = trim( $d ); + if ( ! empty( $pd ) && ! empty( $d ) ) { + if ( strpos( $d, $pd ) === 0 ) { + unset( $dis[ $k ] ); + continue; // get rid of subpaths of $pd + } + } + $l = strlen( $d ); + if ( ( $l > 0 ) && ( $d[ $l - 1 ] !== '/' ) ) { + continue; + } + $pd = $d; // only allow directory paths for $pd + } } + return $dis; } - function output_robots($rules) { + function output_robots( $rules ) { $robots = ''; - foreach ($rules as $r) { - foreach ( $r['comment'] as $c) $robots .= "$c\n"; - foreach ( $r['user-agent'] as $u) if ( $u != '' ) $robots .= "User-agent: $u\n"; - foreach ( $r['crawl-delay'] as $c) $robots .= "Crawl-Delay: $c\n"; - foreach ( $r['allow'] as $a) $robots .= "Allow: $a\n"; - foreach ( $r['disallow'] as $d) $robots .= "Disallow: $d\n"; - foreach ( $r['sitemap'] as $s) $robots .= "Sitemap: $s\n"; + foreach ( $rules as $r ) { + foreach ( $r['comment'] as $c ) { + $robots .= "$c\n"; + } + foreach ( $r['user-agent'] as $u ) { + if ( $u != '' ) { + $robots .= "User-agent: $u\n"; + } + } + foreach ( $r['crawl-delay'] as $c ) { + $robots .= "Crawl-Delay: $c\n"; + } + foreach ( $r['allow'] as $a ) { + $robots .= "Allow: $a\n"; + } + foreach ( $r['disallow'] as $d ) { + $robots .= "Disallow: $d\n"; + } + foreach ( $r['sitemap'] as $s ) { + $robots .= "Sitemap: $s\n"; + } $robots .= "\n"; } + return $robots; } } diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_sitemap.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_sitemap.php index 94708e507f..23a2f3a96b 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_sitemap.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_sitemap.php @@ -1,11 +1,15 @@ name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin - $this->prefix = 'aiosp_sitemap_'; // option prefix - $this->file = __FILE__; // the current file - $this->extra_sitemaps = Array(); - $this->extra_sitemaps = apply_filters( $this->prefix . 'extra', $this->extra_sitemaps ); + + /** + * All_in_One_SEO_Pack_Sitemap constructor. + */ + function __construct() { + if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class. + $this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin. + $this->prefix = 'aiosp_sitemap_'; // Option prefix. + $this->file = __FILE__; // The current file. + $this->extra_sitemaps = array(); + $this->extra_sitemaps = apply_filters( $this->prefix . 'extra', $this->extra_sitemaps ); } parent::__construct(); - $this->comment_string = __( "Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s", 'all-in-one-seo-pack' ); - - $this->help_text = Array( - "filename" => __( "Specifies the name of your sitemap file. This will default to 'sitemap'.", 'all-in-one-seo-pack' ), - "google" => __( "Notify Google when you update your sitemap settings.", 'all-in-one-seo-pack' ), - "bing" => __("Notify Bing when you update your sitemap settings.", 'all-in-one-seo-pack' ), - "daily_cron" => __( "Notify search engines daily, and also update static sitemap daily if in use. (this uses WP-Cron, so make sure this is working properly on your server as well)", 'all-in-one-seo-pack' ), - "indexes" => __( "Organize sitemap entries into distinct files in your sitemap. Enable this only if your sitemap contains over 50,000 URLs or the file is over 5MB in size.", 'all-in-one-seo-pack' ), - "paginate" => __( "Split long sitemaps into separate files.", 'all-in-one-seo-pack' ), - "max_posts" => __( "Allows you to specify the maximum number of posts in a sitemap (up to 50,000).", 'all-in-one-seo-pack' ), - "posttypes" => __( "Select which Post Types appear in your sitemap.", 'all-in-one-seo-pack' ), - "taxonomies" => __( "Select which taxonomy archives appear in your sitemap", 'all-in-one-seo-pack' ), - "archive" => __( "Include Date Archives in your sitemap.", 'all-in-one-seo-pack' ), - "author" => __( "Include Author Archives in your sitemap.", 'all-in-one-seo-pack' ), - "gzipped" => __( "Create a compressed sitemap file in .xml.gz format.", 'all-in-one-seo-pack' ), - "robots" => __( "Places a link to your Sitemap.xml into your virtual Robots.txt file.", 'all-in-one-seo-pack' ), - "rewrite" => __( "Places a link to the sitemap file in your virtual Robots.txt file which WordPress creates.", 'all-in-one-seo-pack' ), - "noindex" => __( "Tells search engines not to index the sitemap file itself.", 'all-in-one-seo-pack' ), - "debug" => __( "Use rewrites to generate your sitemap on the fly. NOTE: This is required for WordPress Multisite.", 'all-in-one-seo-pack'), - "addl_url" => __( 'URL to the page.', 'all-in-one-seo-pack' ), - "addl_prio" => __( 'The priority of the page.', 'all-in-one-seo-pack' ), - "addl_freq" => __( 'The frequency of the page.', 'all-in-one-seo-pack' ), - "addl_mod" => __( 'Last modified date of the page.', 'all-in-one-seo-pack' ), - "excl_categories" => __( "Entries from these categories will be excluded from the sitemap.", 'all-in-one-seo-pack' ), - "excl_pages" => __( "Use page slugs or page IDs, seperated by commas, to exclude pages from the sitemap.", 'all-in-one-seo-pack' ) + $this->comment_string = 'Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s'; + + $this->help_text = array( + 'filename' => __( "Specifies the name of your sitemap file. This will default to 'sitemap'.", 'all-in-one-seo-pack' ), + 'google' => __( 'Notify Google when you update your sitemap settings.', 'all-in-one-seo-pack' ), + 'bing' => __( 'Notify Bing when you update your sitemap settings.', 'all-in-one-seo-pack' ), + 'daily_cron' => __( 'Notify search engines based on the selected schedule, and also update static sitemap daily if in use. (this uses WP-Cron, so make sure this is working properly on your server as well)', 'all-in-one-seo-pack' ), + 'indexes' => __( 'Organize sitemap entries into distinct files in your sitemap. Enable this only if your sitemap contains over 50,000 URLs or the file is over 5MB in size.', 'all-in-one-seo-pack' ), + 'paginate' => __( 'Split long sitemaps into separate files.', 'all-in-one-seo-pack' ), + 'max_posts' => __( 'Allows you to specify the maximum number of posts in a sitemap (up to 50,000).', 'all-in-one-seo-pack' ), + 'posttypes' => __( 'Select which Post Types appear in your sitemap.', 'all-in-one-seo-pack' ), + 'taxonomies' => __( 'Select which taxonomy archives appear in your sitemap', 'all-in-one-seo-pack' ), + 'archive' => __( 'Include Date Archives in your sitemap.', 'all-in-one-seo-pack' ), + 'author' => __( 'Include Author Archives in your sitemap.', 'all-in-one-seo-pack' ), + 'gzipped' => __( 'Create a compressed sitemap file in .xml.gz format.', 'all-in-one-seo-pack' ), + 'robots' => __( 'Places a link to your Sitemap.xml into your virtual Robots.txt file.', 'all-in-one-seo-pack' ), + 'rewrite' => __( 'Dynamically creates the XML sitemap instead of using a static file.', 'all-in-one-seo-pack' ), + 'debug' => __( 'Use rewrites to generate your sitemap on the fly. NOTE: This is required for WordPress Multisite.', 'all-in-one-seo-pack' ), + 'addl_url' => __( 'URL to the page.', 'all-in-one-seo-pack' ), + 'addl_prio' => __( 'The priority of the page.', 'all-in-one-seo-pack' ), + 'addl_freq' => __( 'The frequency of the page.', 'all-in-one-seo-pack' ), + 'addl_mod' => __( 'Last modified date of the page.', 'all-in-one-seo-pack' ), + 'excl_categories' => __( 'Entries from these categories will be excluded from the sitemap.', 'all-in-one-seo-pack' ), + 'excl_pages' => __( 'Use page slugs or page IDs, seperated by commas, to exclude pages from the sitemap.', 'all-in-one-seo-pack' ), ); - - $this->help_anchors = Array( - 'filename' => '#filename-prefix', - 'google' => '#notify-google-bing', - 'bing' => '#notify-google-bing', - 'indexes' => '#enable-sitemap-indexes', - 'posttypes' => '#post-types-and-taxonomies', - 'taxonomies' => '#post-types-and-taxonomies', - 'archive' => '#include-archive-pages', - 'author' => '#include-archive-pages', - 'gzipped' => '#create-compressed-sitemap', - 'robots' => '#link-from-virtual-robots', - 'rewrite' => '#dynamically-generate-sitemap', - 'addl_url' => '#additional-pages', - 'addl_prio' => '#additional-pages', - 'addl_freq' => '#additional-pages', - 'addl_mod' => '#additional-pages', + + $this->help_anchors = array( + 'filename' => '#filename-prefix', + 'google' => '#notify-google-bing', + 'bing' => '#notify-google-bing', + 'daily_cron' => '#schedule-updates', + 'indexes' => '#enable-sitemap-indexes', + 'paginate' => '#enable-sitemap-indexes', + 'max_posts' => '#enable-sitemap-indexes', + 'posttypes' => '#post-types-and-taxonomies', + 'taxonomies' => '#post-types-and-taxonomies', + 'archive' => '#include-archive-pages', + 'author' => '#include-archive-pages', + 'gzipped' => '#create-compressed-sitemap', + 'robots' => '#link-from-virtual-robots', + 'rewrite' => '#dynamically-generate-sitemap', + 'addl_url' => '#additional-pages', + 'addl_prio' => '#additional-pages', + 'addl_freq' => '#additional-pages', + 'addl_mod' => '#additional-pages', 'excl_categories' => '#excluded-items', - 'excl_pages' => '#excluded-items', + 'excl_pages' => '#excluded-items', ); $this->default_options = array( - 'filename' => Array( 'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ), - 'default' => 'sitemap', 'type' => 'text', 'sanitize' => 'filename' ), - 'google' => Array( 'name' => __( 'Notify Google', 'all-in-one-seo-pack') ), - 'bing' => Array( 'name' => __( 'Notify Bing', 'all-in-one-seo-pack') ), - 'daily_cron'=> Array( 'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ), 'type' => 'select', - 'initial_options' => Array( 0 => __( 'No Schedule', 'all-in-one-seo-pack' ), - 'daily' => __( 'Daily', 'all-in-one-seo-pack' ), - 'weekly' => __( 'Weekly', 'all-in-one-seo-pack' ), - 'monthly'=> __( 'Monthly', 'all-in-one-seo-pack' ) ), - 'default' => 0 ), - 'indexes' => Array( 'name' => __( 'Enable Sitemap Indexes', 'all-in-one-seo-pack' ) ), - 'paginate' => Array( 'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ), - 'condshow' => Array( "{$this->prefix}indexes" => 'on' ) ), - 'max_posts' => Array( 'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ), - 'type' => 'text', 'default' => 50000, - 'condshow' => Array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ) ), - 'posttypes' => Array( 'name' => __( 'Post Types', 'all-in-one-seo-pack'), - 'type' => 'multicheckbox', 'default' => 'all' ), - 'taxonomies'=> Array( 'name' => __( 'Taxonomies', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', 'default' => 'all' ), - 'archive' => Array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ), - 'author' => Array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ), - 'gzipped' => Array( 'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ), 'default' => 'On' ), - 'robots' => Array( 'name' => __( 'Link From Virtual Robots.txt', 'all-in-one-seo-pack' ), 'default' => 'On' ), - 'rewrite' => Array( 'name' => __( 'Dynamically Generate Sitemap', 'all-in-one-seo-pack' ), 'default' => 'On' ), - 'noindex' => Array( 'name' => __( 'Noindex Sitemap file', 'all-in-one-seo-pack' ), - 'condshow' => Array( "{$this->prefix}rewrite" => true ) ) + 'filename' => array( + 'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ), + 'default' => 'sitemap', + 'type' => 'text', + 'sanitize' => 'filename', + ), + 'google' => array( 'name' => __( 'Notify Google', 'all-in-one-seo-pack' ) ), + 'bing' => array( 'name' => __( 'Notify Bing', 'all-in-one-seo-pack' ) ), + 'daily_cron' => array( + 'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => array( + 0 => __( 'No Schedule', 'all-in-one-seo-pack' ), + 'daily' => __( 'Daily', 'all-in-one-seo-pack' ), + 'weekly' => __( 'Weekly', 'all-in-one-seo-pack' ), + 'monthly' => __( 'Monthly', 'all-in-one-seo-pack' ), + ), + 'default' => 0, + ), + 'indexes' => array( 'name' => __( 'Enable Sitemap Indexes', 'all-in-one-seo-pack' ) ), + 'paginate' => array( + 'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ), + 'condshow' => array( "{$this->prefix}indexes" => 'on' ), + ), + 'max_posts' => array( + 'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => 50000, + 'condshow' => array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ), + ), + 'posttypes' => array( + 'name' => __( 'Post Types', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => 'all', + ), + 'taxonomies' => array( + 'name' => __( 'Taxonomies', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => 'all', + ), + 'archive' => array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ), + 'author' => array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ), + 'gzipped' => array( + 'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ), + 'default' => 'On', + ), + 'robots' => array( + 'name' => __( 'Link From Virtual Robots.txt', 'all-in-one-seo-pack' ), + 'default' => 'On', + ), + 'rewrite' => array( + 'name' => __( 'Dynamically Generate Sitemap', 'all-in-one-seo-pack' ), + 'default' => 'On', + ), ); - - $status_options = Array( - 'link' => Array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ), - 'debug' => Array( 'name' => __( 'Debug Log', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'html', 'disabled' => 'disabled', 'save' => false, 'label' => 'none', 'rows' => 5, 'cols' => 120, 'style' => 'min-width:950px' ) + + $status_options = array( + 'link' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ), + 'debug' => array( + 'name' => __( 'Debug Log', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'html', + 'disabled' => 'disabled', + 'save' => false, + 'label' => 'none', + 'rows' => 5, + 'cols' => 120, + 'style' => 'min-width:950px', + ), ); - - $this->layout = Array( - 'status' => Array( - 'name' => __( 'Sitemap Status', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/', - 'options' => array_keys( $status_options ) ), - 'default' => Array( - 'name' => $this->name, - 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/', - 'options' => array_keys( $this->default_options ) - ) + + $this->layout = array( + 'status' => array( + 'name' => __( 'Sitemap Status', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/', + 'options' => array_keys( $status_options ), + ), + 'default' => array( + 'name' => $this->name, + 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/', + 'options' => array_keys( $this->default_options ), + ), ); - - $prio = Array(); - for( $i = 0; $i <= 10; $i++ ) { - $str = sprintf( "%0.1f", $i / 10.0 ); + + $prio = array(); + for ( $i = 0; $i <= 10; $i ++ ) { + $str = sprintf( '%0.1f', $i / 10.0 ); $prio[ $str ] = $str; } - $arr_no = Array( 'no' => __( 'Do Not Override', 'all-in-one-seo-pack' ) ); - $arr_sel = Array( 'sel' => __( 'Select Individual', 'all-in-one-seo-pack' ) ); + $arr_no = array( 'no' => __( 'Do Not Override', 'all-in-one-seo-pack' ) ); + $arr_sel = array( 'sel' => __( 'Select Individual', 'all-in-one-seo-pack' ) ); $this->prio_sel = array_merge( $arr_no, $arr_sel, $prio ); - $this->prio = array_merge( $arr_no, $prio ); - - $freq = Array(); - foreach ( Array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ) as $f ) $freq[ $f ] = $f; + $this->prio = array_merge( $arr_no, $prio ); + + $freq = array(); + foreach ( array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ) as $f ) { + $freq[ $f ] = $f; + } $this->freq_sel = array_merge( $arr_no, $arr_sel, $freq ); - $this->freq = array_merge( $arr_no, $freq ); - - foreach( Array( 'prio' => __( 'priority', 'all-in-one-seo-pack' ), 'freq' => __( 'frequency', 'all-in-one-seo-pack' ) ) as $k => $v ) { - $s = "{$k}_options"; - $$s = Array(); - foreach( Array( 'homepage' => __( 'homepage', 'all-in-one-seo-pack' ), - 'post' => __( 'posts', 'all-in-one-seo-pack' ), - 'taxonomies' => __( 'taxonomies', 'all-in-one-seo-pack' ), - 'archive' => __( 'archive pages', 'all-in-one-seo-pack' ), - 'author' => __( 'author pages', 'all-in-one-seo-pack' ) ) as $opt => $val ) { + $this->freq = array_merge( $arr_no, $freq ); + + foreach ( + array( + 'prio' => __( 'priority', 'all-in-one-seo-pack' ), + 'freq' => __( 'frequency', 'all-in-one-seo-pack' ), + ) as $k => $v + ) { + $s = "{$k}_options"; + $$s = array(); + foreach ( + array( + 'homepage' => __( 'homepage', 'all-in-one-seo-pack' ), + 'post' => __( 'posts', 'all-in-one-seo-pack' ), + 'taxonomies' => __( 'taxonomies', 'all-in-one-seo-pack' ), + 'archive' => __( 'archive pages', 'all-in-one-seo-pack' ), + 'author' => __( 'author pages', 'all-in-one-seo-pack' ), + ) as $opt => $val + ) { $arr = $$s; - if ( ( $opt == 'post' ) || ( $opt == 'taxonomies' ) ) { + if ( ( 'post' === $opt ) || ( 'taxonomies' === $opt ) ) { $iopts = $this->{"{$k}_sel"}; } else { $iopts = $this->$k; } - - $arr[ $k . '_' . $opt ] = Array( 'name' => $this->ucwords( $val ), 'help_text' => sprintf( __( "Manually set the %s of your %s.", 'all-in-one-seo-pack' ), $v, $val ), 'type' => 'select', 'initial_options' => $iopts, 'default' => 'no' ); - if ( ( $opt == 'archive' ) || ( $opt == 'author' ) ) $arr[ $k . '_' . $opt ][ 'condshow' ] = Array( $this->prefix . $opt => 'on' ); + + $arr[ $k . '_' . $opt ] = array( + 'name' => $this->ucwords( $val ), + 'help_text' => sprintf( __( 'Manually set the %s of your %s.', 'all-in-one-seo-pack' ), $v, $val ), + 'type' => 'select', + 'initial_options' => $iopts, + 'default' => 'no', + ); + if ( ( 'archive' === $opt ) || ( 'author' === $opt ) ) { + $arr[ $k . '_' . $opt ]['condshow'] = array( $this->prefix . $opt => 'on' ); + } $$s = $arr; } } - - $addl_options = Array( - 'addl_instructions' => Array( 'default' => '
    ' . __( 'Enter information below for any additional links for your sitemap not already managed through WordPress.', 'all-in-one-seo-pack' ) . '

    ', 'type' => 'html', 'label' => 'none', 'save' => false ), - 'addl_url' => Array( 'name' => __( 'Page URL', 'all-in-one-seo-pack' ), 'type' => 'text', 'label' => 'top', 'save' => false ), - 'addl_prio' => Array( 'name' => __( 'Page Priority', 'all-in-one-seo-pack' ), 'type' => 'select', 'initial_options' => $prio, 'label' => 'top', 'save' => false ), - 'addl_freq' => Array( 'name' => __( 'Page Frequency', 'all-in-one-seo-pack' ), 'type' => 'select', 'initial_options' => $freq, 'label' => 'top', 'save' => false ), - 'addl_mod' => Array( 'name' => __( 'Last Modified', 'all-in-one-seo-pack' ), 'type' => 'text', 'label' => 'top', 'save' => false ), - 'addl_pages'=> Array( 'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ), 'type' => 'custom', 'save' => true ), - 'Submit' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Add URL', 'all-in-one-seo-pack' ) . ' »', 'style' => 'margin-left: 20px;', 'label' => 'none', 'save' => false, 'value' => 1 ) - ); - - $excl_options = Array( - 'excl_categories' => Array( 'name' => __( 'Excluded Categories', 'all-in-one-seo-pack' ), 'type' => 'multicheckbox', 'initial_options' => '' ), - 'excl_pages' => Array( 'name' => __( 'Excluded Pages', 'all-in-one-seo-pack' ), 'type' => 'text' ) - ); - - $this->layout['addl_pages'] = Array( + + $addl_options = array( + 'addl_instructions' => array( + 'default' => '
    ' . __( 'Enter information below for any additional links for your sitemap not already managed through WordPress.', 'all-in-one-seo-pack' ) . '

    ', + 'type' => 'html', + 'label' => 'none', + 'save' => false, + ), + 'addl_url' => array( + 'name' => __( 'Page URL', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'label' => 'top', + 'save' => false, + ), + 'addl_prio' => array( + 'name' => __( 'Page Priority', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => $prio, + 'label' => 'top', + 'save' => false, + ), + 'addl_freq' => array( + 'name' => __( 'Page Frequency', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => $freq, + 'label' => 'top', + 'save' => false, + ), + 'addl_mod' => array( + 'name' => __( 'Last Modified', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'label' => 'top', + 'save' => false, + ), + 'addl_pages' => array( 'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#additional-pages', - 'options' => array_keys( $addl_options ) - ); - - $this->layout['excl_pages'] = Array( - 'name' => __( 'Excluded Items', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#excluded-items', - 'options' => array_keys( $excl_options ) - ); - - $this->layout['priorities'] = Array( - 'name' => __( 'Priorities', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies', - 'options' => array_keys( $prio_options ) - ); - - $this->layout['frequencies'] = Array( - 'name' => __( 'Frequencies', 'all-in-one-seo-pack' ), - 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies', - 'options' => array_keys( $freq_options ) - ); - + 'type' => 'custom', + 'save' => true, + ), + 'Submit' => array( + 'type' => 'submit', + 'class' => 'button-primary', + 'name' => __( 'Add URL', 'all-in-one-seo-pack' ) . ' »', + 'style' => 'margin-left: 20px;', + 'label' => 'none', + 'save' => false, + 'value' => 1, + ), + ); + + $excl_options = array( + 'excl_categories' => array( + 'name' => __( 'Excluded Categories', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'initial_options' => '', + ), + 'excl_pages' => array( 'name' => __( 'Excluded Pages', 'all-in-one-seo-pack' ), 'type' => 'text' ), + ); + + $this->layout['addl_pages'] = array( + 'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#additional-pages', + 'options' => array_keys( $addl_options ), + ); + + $this->layout['excl_pages'] = array( + 'name' => __( 'Excluded Items', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#excluded-items', + 'options' => array_keys( $excl_options ), + ); + + $this->layout['priorities'] = array( + 'name' => __( 'Priorities', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies', + 'options' => array_keys( $prio_options ), + ); + + $this->layout['frequencies'] = array( + 'name' => __( 'Frequencies', 'all-in-one-seo-pack' ), + 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies', + 'options' => array_keys( $freq_options ), + ); + $this->default_options = array_merge( $status_options, $this->default_options, $addl_options, $excl_options, $prio_options, $freq_options ); $this->add_help_text_links(); - - add_action( 'init', Array( $this, 'load_sitemap_options' ) ); - add_action( $this->prefix . 'settings_update', Array( $this, 'do_sitemaps' ) ); - add_filter( $this->prefix . 'display_settings', Array( $this, 'update_post_data' ) ); - add_filter( $this->prefix . 'display_options', Array( $this, 'filter_display_options' ) ); - add_filter( $this->prefix . 'update_options', Array( $this, 'filter_options' ) ); - add_filter( $this->prefix . 'output_option', Array( $this, 'display_custom_options' ), 10, 2 ); - add_action( $this->prefix . 'daily_update_cron', Array( $this, 'daily_update' ) ); - } - - // Add new intervals of a week and a month - // See http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules + + add_action( 'after_doing_aioseop_updates', array( + $this, + 'do_sitemaps', + ) ); // Update static sitemap when AIOSEOP is upgrade to new version. + add_action( 'init', array( $this, 'load_sitemap_options' ) ); + add_action( $this->prefix . 'settings_update', array( $this, 'do_sitemaps' ) ); + add_filter( $this->prefix . 'display_settings', array( $this, 'update_post_data' ) ); + add_filter( $this->prefix . 'display_options', array( $this, 'filter_display_options' ) ); + add_filter( $this->prefix . 'update_options', array( $this, 'filter_options' ) ); + add_filter( $this->prefix . 'output_option', array( $this, 'display_custom_options' ), 10, 2 ); + add_action( $this->prefix . 'daily_update_cron', array( $this, 'daily_update' ) ); + add_action( 'init', array( $this, 'make_dynamic_xsl' ) ); + add_action( 'transition_post_status', array( $this, 'update_sitemap_from_posts' ), 10, 3 ); + } + + /** + * Update sitemap from posts. + * + * @param $new_status + * @param $old_status + * @param $post + */ + function update_sitemap_from_posts( $new_status, $old_status, $post ) { + + if ( $this->option_isset( 'rewrite' ) ) { + // TODO if dynamic, delete transient (we currently don't do transients). + return; + } + + $posttypes = array(); + if ( ! empty( $this->options["{$this->prefix}posttypes"] ) ) { + $posttypes = $this->options["{$this->prefix}posttypes"]; + } + + if ( ! in_array( $post->post_type, $posttypes, true ) ) { + return; + } + + $statuses_for_updating = array( 'new', 'publish', 'trash' ); + if ( ! in_array( $new_status, $statuses_for_updating, true ) ) { + return; + } + + $this->do_sitemaps(); + } + + /** + * Add cron schedules. + * + * Add new intervals of a week and a month. + * + * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules + * + * @param $schedules + * + * @return mixed + */ function add_cron_schedules( $schedules ) { - $schedules['weekly'] = array( - 'interval' => 604800, // 1 week in seconds - 'display' => __( 'Once Weekly', 'all-in-one-seo-pack' ) - ); - $schedules['monthly'] = array( - 'interval' => 2629740, // 1 month in seconds - 'display' => __( 'Once Monthly', 'all-in-one-seo-pack' ) - ); - return $schedules; - } - + $schedules['weekly'] = array( + 'interval' => 604800, // 1 week in seconds. + 'display' => __( 'Once Weekly', 'all-in-one-seo-pack' ), + ); + $schedules['monthly'] = array( + 'interval' => 2629740, // 1 month in seconds. + 'display' => __( 'Once Monthly', 'all-in-one-seo-pack' ), + ); + + return $schedules; + } + + /** + * Cron update. + */ function cron_update() { - add_filter( 'cron_schedules', Array( $this, 'add_cron_schedules' ) ); - if ( !wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) - wp_schedule_event( time(), $this->options[$this->prefix . 'daily_cron'], $this->prefix . 'daily_update_cron' ); + add_filter( 'cron_schedules', array( $this, 'add_cron_schedules' ) ); + if ( ! wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) { + wp_schedule_event( time(), $this->options[ $this->prefix . 'daily_cron' ], $this->prefix . 'daily_update_cron' ); + } } - + + /** + * Daily update. + */ function daily_update() { $last_run = get_option( $this->prefix . 'cron_last_run' ); - if ( empty( $last_run ) || ( time() - $last_run > 23.5 * 60 * 60 ) ) // sanity check - $this->do_sitemaps( __( "Daily scheduled sitemap check has finished.", 'all-in-one-seo-pack' ) ); + if ( empty( $last_run ) || ( time() - $last_run > 23.5 * 60 * 60 ) ) { + // Sanity check. + $this->do_sitemaps( __( 'Daily scheduled sitemap check has finished.', 'all-in-one-seo-pack' ) ); + } $last_run = time(); update_option( $this->prefix . 'cron_last_run', $last_run ); } - - /** Initialize options, after constructor **/ + + /** + * Initialize options, after constructor. + */ function load_sitemap_options() { - // load initial options / set defaults - $this->update_options( ); - if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) { + // Load initial options / set defaults. + $this->update_options(); + if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) { $this->paginate = true; - if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) + if ( $this->options["{$this->prefix}max_posts"] && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) { $this->max_posts = $this->options["{$this->prefix}max_posts"]; + } } - if ( is_multisite() ) $this->options["{$this->prefix}rewrite"] = 'On'; + if ( is_multisite() ) { + $this->options["{$this->prefix}rewrite"] = 'On'; + } - if ( $this->options["{$this->prefix}rewrite"] ) $this->setup_rewrites(); - - if ( $this->option_isset( 'robots' ) ) - add_action( 'do_robots', Array( $this, 'do_robots' ), 100 ); - - if ( isset( $this->options[$this->prefix . 'daily_cron'] ) && $this->options[$this->prefix . 'daily_cron'] ) { - add_action( 'wp', Array( $this, 'cron_update' ) ); + if ( $this->options["{$this->prefix}rewrite"] ) { + $this->setup_rewrites(); + } + + if ( $this->option_isset( 'robots' ) ) { + add_action( 'do_robots', array( $this, 'do_robots' ), 100 ); + } + + if ( isset( $this->options[ $this->prefix . 'daily_cron' ] ) && $this->options[ $this->prefix . 'daily_cron' ] ) { + add_action( 'wp', array( $this, 'cron_update' ) ); } else { - if ( $time = wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) - wp_unschedule_event( $time, $this->prefix . 'daily_update_cron' ); + if ( $time = wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) { + wp_unschedule_event( $time, $this->prefix . 'daily_update_cron' ); + } } } - - /** Custom settings - displays boxes for add pages to sitemap option. **/ + + /** + * Custom settings. + * + * Displays boxes for add pages to sitemap option. Requires WordPress 4.1. + * + * @param $buf + * @param $args + * + * @return string + */ function display_custom_options( $buf, $args ) { - if ( $args['name'] == "{$this->prefix}addl_pages" ) { + if ( "{$this->prefix}addl_pages" === $args['name'] ) { $buf .= "
    "; - if ( !empty( $args['value'] ) ) { + if ( ! empty( $args['value'] ) ) { $buf .= "\n"; foreach ( $args['value'] as $k => $v ) { - if ( is_object( $v ) ) $v = (Array)$v; + if ( is_object( $v ) ) { + $v = (Array) $v; + } $buf .= "\t\n"; } $buf .= "
    {$k}{$v['prio']}{$v['freq']}{$v['mod']}
    \n"; } } $args['options']['type'] = 'hidden'; - if ( !empty( $args['value'] ) ) - $args['value'] = json_encode( $args['value'] ); - else + if ( ! empty( $args['value'] ) ) { + $args['value'] = wp_json_encode( $args['value'] ); + } else { $args['options']['type'] = 'html'; - if ( empty( $args['value'] ) ) $args['value'] = ''; + } + if ( empty( $args['value'] ) ) { + $args['value'] = ''; + } $buf .= $this->get_option_html( $args ); $buf .= '
    '; + return $buf; } - - /** Add post type details for settings once post types have been registered. **/ + + /** + * Add post type details for settings once post types have been registered. + */ function add_post_types() { - $post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) ); - $taxonomy_titles = $this->get_taxonomy_titles( Array( 'public' => true ) ); - if ( isset( $post_type_titles['attachment'] ) ) $post_type_titles['attachment'] = __( "Media / Attachments", 'all-in-one-seo-pack' ); - $this->default_options['posttypes' ]['initial_options'] = array_merge( Array( 'all' => __( 'All Post Types', 'all-in-one-seo-pack' ) ), $post_type_titles ); - $this->default_options['taxonomies']['initial_options'] = array_merge( Array( 'all' => __( 'All Taxonomies', 'all-in-one-seo-pack' ) ), $taxonomy_titles ); - $this->default_options['posttypes' ]['default'] = array_keys( $this->default_options['posttypes' ]['initial_options'] ); - $this->default_options['taxonomies']['default'] = array_keys( $this->default_options['taxonomies']['initial_options'] ); + $post_type_titles = $this->get_post_type_titles( array( 'public' => true ) ); + $taxonomy_titles = $this->get_taxonomy_titles( array( 'public' => true ) ); + if ( isset( $post_type_titles['attachment'] ) ) { + $post_type_titles['attachment'] = __( 'Media / Attachments', 'all-in-one-seo-pack' ); + } + $this->default_options['posttypes']['initial_options'] = array_merge( array( 'all' => __( 'All Post Types', 'all-in-one-seo-pack' ) ), $post_type_titles ); + $this->default_options['taxonomies']['initial_options'] = array_merge( array( 'all' => __( 'All Taxonomies', 'all-in-one-seo-pack' ) ), $taxonomy_titles ); + $this->default_options['posttypes']['default'] = array_keys( $this->default_options['posttypes']['initial_options'] ); + $this->default_options['taxonomies']['default'] = array_keys( $this->default_options['taxonomies']['initial_options'] ); $this->default_options['excl_categories']['initial_options'] = $this->get_category_titles(); - $prio_help = __( "Manually set the priority for the ", 'all-in-one-seo-pack' ); - $freq_help = __( "Manually set the frequency for the ", 'all-in-one-seo-pack' ); - $post_name = __( " Post Type", 'all-in-one-seo-pack' ); - $tax_name = __( " Taxonomy", 'all-in-one-seo-pack' ); - foreach( $post_type_titles as $k => $v ) { - $key = 'prio_post_' . $k; - $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_post', Array( $key => Array( 'name' => $v . $post_name, 'help_text' => $prio_help . $v . $post_name, 'type' => 'select', 'initial_options' => $this->prio, 'default' => 'no', 'condshow' => Array( "{$this->prefix}prio_post" => 'sel' ) ) ) ); - $this->layout['priorities']['options'][] = $key; - $key = 'freq_post_' . $k; - $this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_post', Array( $key => Array( 'name' => $v . $post_name, 'help_text' => $freq_help . $v . $post_name, 'type' => 'select', 'initial_options' => $this->freq, 'default' => 'no', 'condshow' => Array( "{$this->prefix}freq_post" => 'sel' ) ) ) ); + $prio_help = __( 'Manually set the priority for the ', 'all-in-one-seo-pack' ); + $freq_help = __( 'Manually set the frequency for the ', 'all-in-one-seo-pack' ); + $post_name = __( ' Post Type', 'all-in-one-seo-pack' ); + $tax_name = __( ' Taxonomy', 'all-in-one-seo-pack' ); + foreach ( $post_type_titles as $k => $v ) { + $key = 'prio_post_' . $k; + $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_post', array( + $key => array( + 'name' => $v . $post_name, + 'help_text' => $prio_help . $v . $post_name, + 'type' => 'select', + 'initial_options' => $this->prio, + 'default' => 'no', + 'condshow' => array( "{$this->prefix}prio_post" => 'sel' ), + ), + ) ); + $this->layout['priorities']['options'][] = $key; + $key = 'freq_post_' . $k; + $this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_post', array( + $key => array( + 'name' => $v . $post_name, + 'help_text' => $freq_help . $v . $post_name, + 'type' => 'select', + 'initial_options' => $this->freq, + 'default' => 'no', + 'condshow' => array( "{$this->prefix}freq_post" => 'sel' ), + ), + ) ); $this->layout['frequencies']['options'][] = $key; } - foreach( $taxonomy_titles as $k => $v ) { - $key = 'prio_taxonomies_' . $k; - $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_taxonomies', Array( $key => Array( 'name' => $v . $tax_name, 'help_text' => $prio_help . $v . $tax_name, 'type' => 'select', 'initial_options' => $this->prio, 'default' => 'no', 'condshow' => Array( "{$this->prefix}prio_taxonomies" => 'sel' ) ) ) ); - $this->layout['priorities']['options'][] = $key; - $key = 'freq_taxonomies_' . $k; - $this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_taxonomies', Array( $key => Array( 'name' => $v . $tax_name, 'help_text' => $freq_help . $v . $tax_name, 'type' => 'select', 'initial_options' => $this->freq, 'default' => 'no', 'condshow' => Array( "{$this->prefix}freq_taxonomies" => 'sel' ) ) ) ); + foreach ( $taxonomy_titles as $k => $v ) { + $key = 'prio_taxonomies_' . $k; + $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_taxonomies', array( + $key => array( + 'name' => $v . $tax_name, + 'help_text' => $prio_help . $v . $tax_name, + 'type' => 'select', + 'initial_options' => $this->prio, + 'default' => 'no', + 'condshow' => array( "{$this->prefix}prio_taxonomies" => 'sel' ), + ), + ) ); + $this->layout['priorities']['options'][] = $key; + $key = 'freq_taxonomies_' . $k; + $this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_taxonomies', array( + $key => array( + 'name' => $v . $tax_name, + 'help_text' => $freq_help . $v . $tax_name, + 'type' => 'select', + 'initial_options' => $this->freq, + 'default' => 'no', + 'condshow' => array( "{$this->prefix}freq_taxonomies" => 'sel' ), + ), + ) ); $this->layout['frequencies']['options'][] = $key; } $this->update_options(); } - /** Set up settings, checking for sitemap conflicts, on settings page. **/ + /** + * 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' ) ); + add_action( $this->prefix . 'settings_header', array( $this, 'do_sitemap_scan' ), 5 ); + add_filter( "{$this->prefix}submit_options", array( $this, 'filter_submit' ) ); } - /** Change submit button to read "Update Sitemap". **/ + /** + * Filter submit button. + * + * Change settings page submit button to read "Update Sitemap". + * + * @param $submit + * + * @return mixed + */ function filter_submit( $submit ) { $submit['Submit']['value'] = __( 'Update Sitemap', 'all-in-one-seo-pack' ) . ' »'; + return $submit; } - - /** Disable writing sitemaps to the filesystem for multisite. **/ + + /** + * Updates post data. + * + * Disable writing sitemaps to the filesystem for multisite. + * + * @param $options + * + * @return mixed + */ function update_post_data( $options ) { - if ( is_multisite() ) $options[ $this->prefix . 'rewrite' ]['disabled'] = 'disabled'; + if ( is_multisite() ) { + $options[ $this->prefix . 'rewrite' ]['disabled'] = 'disabled'; + } + return $options; } - + + /** + * @param $url + * + * @return bool + */ function get_rewrite_url( $url ) { global $wp_rewrite; $url = parse_url( esc_url( $url ), PHP_URL_PATH ); $url = ltrim( $url, '/' ); - if ( !empty( $wp_rewrite ) ) { + if ( ! empty( $wp_rewrite ) ) { $rewrite_rules = $wp_rewrite->rewrite_rules(); - foreach( $rewrite_rules as $k => $v ) { - if ( preg_match( "@^$k@", $url ) ) + foreach ( $rewrite_rules as $k => $v ) { + if ( preg_match( "@^$k@", $url ) ) { return $v; + } } } + return false; } - - /** Add in options for status display on settings page, sitemap rewriting on multisite. **/ + + /** + * Filter display options. + * + * Add in options for status display on settings page, sitemap rewriting on multisite. + * + * @param $options + * + * @return mixed + */ function filter_display_options( $options ) { - if ( is_multisite() ) $options[ $this->prefix . 'rewrite'] = 'On'; - if ( isset( $options[ $this->prefix . 'max_posts'] ) && ( ( $options[ $this->prefix . 'max_posts'] <= 0 ) || ( $options[ $this->prefix . 'max_posts'] >= 50000 ) ) ) - $options[ $this->prefix . 'max_posts'] = 50000; - $url = trailingslashit( get_home_url() ) . $options[ $this->prefix . 'filename' ] . '.xml'; - $options[ $this->prefix . 'link' ] = sprintf( __( "Please review your settings below and click %s to build your sitemap; then, %s.", - 'all-in-one-seo-pack' ), sprintf( '%s', - __( 'Update Sitemap', 'all-in-one-seo-pack' ) ), '' . - __( "view your sitemap", 'all-in-one-seo-pack' ) . "" ); + if ( is_multisite() ) { + $options[ $this->prefix . 'rewrite' ] = 'On'; + } + if ( isset( $options[ $this->prefix . 'max_posts' ] ) && ( ( $options[ $this->prefix . 'max_posts' ] <= 0 ) || ( $options[ $this->prefix . 'max_posts' ] >= 50000 ) ) ) { + $options[ $this->prefix . 'max_posts' ] = 50000; + } + $url = trailingslashit( get_home_url() ) . $options[ $this->prefix . 'filename' ] . '.xml'; + $options[ $this->prefix . 'link' ] = sprintf( __( 'Please review your settings below and click %s to build your sitemap; then, %s.', + 'all-in-one-seo-pack' ), sprintf( '%s', + __( 'Update Sitemap', 'all-in-one-seo-pack' ) ), '' . + __( 'view your sitemap', 'all-in-one-seo-pack' ) . '' ); if ( $this->option_isset( 'rewrite' ) ) { - - $options[ $this->prefix . 'link' ] .= '

    ' . __( "Note: you are using dynamic sitemap generation to keep your sitemap current; this will not generate a static sitemap file.", 'all-in-one-seo-pack' ) . '

    '; - $rule = $this->get_rewrite_url( $url ); + + $options[ $this->prefix . 'link' ] .= '

    ' . __( 'Note: you are using dynamic sitemap generation to keep your sitemap current; this will not generate a static sitemap file.', 'all-in-one-seo-pack' ) . '

    '; + $rule = $this->get_rewrite_url( $url ); $rules = $this->get_rewrite_rules(); - if ( in_array( $rule, $rules ) ) - $options[ $this->prefix . 'link' ] .= '

    ' . __( "Dynamic sitemap generation appears to be using the correct rewrite rules.", 'all-in-one-seo-pack' ) . '

    '; - else - $options[ $this->prefix . 'link' ] .= '

    ' . __( "Dynamic sitemap generation does not appear to be using the correct rewrite rules; please disable any other sitemap plugins or functionality on your site and reset your permalinks.", 'all-in-one-seo-pack' ) . '

    '; + if ( in_array( $rule, $rules ) ) { + $options[ $this->prefix . 'link' ] .= '

    ' . __( 'Dynamic sitemap generation appears to be using the correct rewrite rules.', 'all-in-one-seo-pack' ) . '

    '; + } else { + $options[ $this->prefix . 'link' ] .= '

    ' . __( 'Dynamic sitemap generation does not appear to be using the correct rewrite rules; please disable any other sitemap plugins or functionality on your site and reset your permalinks.', 'all-in-one-seo-pack' ) . '

    '; + } } - if ( !get_option( 'blog_public' ) ) { + if ( ! get_option( 'blog_public' ) ) { global $wp_version; - if ( ( version_compare( $wp_version, '3.5.0', '>=' ) ) || ( function_exists( 'set_url_scheme' ) ) ) { + if ( version_compare( $wp_version, '3.5.0', '>=' ) || function_exists( 'set_url_scheme' ) ) { $privacy_link = '' . __( 'Reading Settings', 'all-in-one-seo-pack' ) . ''; } else { $privacy_link = '' . __( 'Privacy Settings', 'all-in-one-seo-pack' ) . ''; } - $options[ $this->prefix . 'link' ] .= '

    ' . sprintf( __( "Warning: your privacy settings are configured to ask search engines to not index your site; you can change this under %s for your blog.", - 'all-in-one-seo-pack' ), $privacy_link ); + $options[ $this->prefix . 'link' ] .= '

    ' . sprintf( __( 'Warning: your privacy settings are configured to ask search engines to not index your site; you can change this under %s for your blog.', 'all-in-one-seo-pack' ), $privacy_link ); } - if ( $this->option_isset( 'debug' ) ) $options["{$this->prefix}debug"] = '

    ' . $options["{$this->prefix}debug"] . '
    '; + if ( $this->option_isset( 'debug' ) ) { + $debug_msg = esc_html( $options["{$this->prefix}debug"] ); + $options["{$this->prefix}debug"] = '
    ' . $debug_msg . '
    '; + } + return $options; } - /** Handle 'all' option for post types / taxonomies, further sanitization of filename, rewrites on for multisite, setting up addl pages option. **/ + /** + * Filter options. + * + * Handle 'all' option for post types / taxonomies, further sanitization of filename, rewrites on for multisite, setting up addl pages option. + * + * @param $options + * + * @return mixed + */ function filter_options( $options ) { - if ( !isset( $this->default_options['posttypes' ]['initial_options'] ) ) $this->add_post_types(); - if ( is_array( $options["{$this->prefix}posttypes"] ) && in_array( 'all', $options["{$this->prefix}posttypes"] ) && is_array( $this->default_options['posttypes' ]['initial_options'] ) ) - $options["{$this->prefix}posttypes"] = array_keys( $this->default_options['posttypes' ]['initial_options'] ); - if ( is_array( $options["{$this->prefix}taxonomies"] ) && in_array( 'all', $options["{$this->prefix}taxonomies"] ) && is_array( $this->default_options['taxonomies' ]['initial_options'] ) ) - $options["{$this->prefix}taxonomies"] = array_keys( $this->default_options['taxonomies' ]['initial_options'] ); + if ( ! isset( $this->default_options['posttypes']['initial_options'] ) ) { + $this->add_post_types(); + } + if ( is_array( $options["{$this->prefix}posttypes"] ) && in_array( 'all', $options["{$this->prefix}posttypes"] ) && is_array( $this->default_options['posttypes']['initial_options'] ) ) { + $options["{$this->prefix}posttypes"] = array_keys( $this->default_options['posttypes']['initial_options'] ); + } + if ( is_array( $options["{$this->prefix}taxonomies"] ) && in_array( 'all', $options["{$this->prefix}taxonomies"] ) && is_array( $this->default_options['taxonomies']['initial_options'] ) ) { + $options["{$this->prefix}taxonomies"] = array_keys( $this->default_options['taxonomies']['initial_options'] ); + } $opt = $this->prefix . 'filename'; - if ( isset( $options[$opt] ) && !empty( $options[$opt] ) ) - $options[$opt] = str_replace( '/', '', $options[$opt] ); - else - $options[$opt] = 'sitemap'; - if ( is_multisite() ) $options[ $this->prefix . 'rewrite'] = 'On'; - if ( !is_array( $options[ $this->prefix . 'addl_pages' ] ) ) { + if ( isset( $options[ $opt ] ) && ! empty( $options[ $opt ] ) ) { + $options[ $opt ] = str_replace( '/', '', $options[ $opt ] ); + } else { + $options[ $opt ] = 'sitemap'; + } + if ( is_multisite() ) { + $options[ $this->prefix . 'rewrite' ] = 'On'; + } + if ( ! is_array( $options[ $this->prefix . 'addl_pages' ] ) ) { $options[ $this->prefix . 'addl_pages' ] = wp_specialchars_decode( stripslashes_deep( $options[ $this->prefix . 'addl_pages' ] ), ENT_QUOTES ); - $decoded = json_decode( $options[ $this->prefix . 'addl_pages' ] ); - if ( $decoded === NULL ) + $decoded = json_decode( $options[ $this->prefix . 'addl_pages' ] ); + if ( null === $decoded ) { $decoded = maybe_unserialize( $options[ $this->prefix . 'addl_pages' ] ); - if ( !is_array( $decoded ) ) $decoded = (Array)$decoded; - if ( $decoded === NULL ) + } + if ( ! is_array( $decoded ) ) { + $decoded = (Array) $decoded; + } + if ( null === $decoded ) { $decoded = $options[ $this->prefix . 'addl_pages' ]; - $options[ $this->prefix . 'addl_pages' ] = $decoded; + } + $options[ $this->prefix . 'addl_pages' ] = $decoded; } if ( is_array( $options[ $this->prefix . 'addl_pages' ] ) ) { - foreach( $options[ $this->prefix . 'addl_pages' ] as $k => $v ) { - if ( is_object( $v ) ) - $options[ $this->prefix . 'addl_pages' ][$k] = (Array)$v; + foreach ( $options[ $this->prefix . 'addl_pages' ] as $k => $v ) { + if ( is_object( $v ) ) { + $options[ $this->prefix . 'addl_pages' ][ $k ] = (Array) $v; + } } } - if ( isset( $options[ $this->prefix . 'addl_pages' ][0] ) ) unset( $options[ $this->prefix . 'addl_pages' ][0] ); - if ( !empty( $_POST[ $this->prefix . 'addl_url' ] ) ) { - foreach( Array( 'addl_url', 'addl_prio', 'addl_freq', 'addl_mod' ) as $field ) { - if ( !empty( $_POST[ $this->prefix . $field ] ) ) { + if ( isset( $options[ $this->prefix . 'addl_pages' ][0] ) ) { + unset( $options[ $this->prefix . 'addl_pages' ][0] ); + } + // TODO Refactor all these... use a nonce, dump the incoming _Post into an array and use that. + if ( ! empty( $_POST[ $this->prefix . 'addl_url' ] ) ) { + foreach ( array( 'addl_url', 'addl_prio', 'addl_freq', 'addl_mod' ) as $field ) { + if ( ! empty( $_POST[ $this->prefix . $field ] ) ) { $_POST[ $this->prefix . $field ] = esc_attr( wp_kses_post( $_POST[ $this->prefix . $field ] ) ); } else { $_POST[ $this->prefix . $field ] = ''; } } - if ( !is_array( $options[ $this->prefix . 'addl_pages' ] ) ) $options[ $this->prefix . 'addl_pages' ] = Array(); - $options[ $this->prefix . 'addl_pages' ][ $_POST[ $this->prefix . 'addl_url' ] ] = Array( - 'prio' => $_POST[ $this->prefix . 'addl_prio' ], - 'freq' => $_POST[ $this->prefix . 'addl_freq' ], - 'mod' => $_POST[ $this->prefix . 'addl_mod' ], - ); + if ( ! is_array( $options[ $this->prefix . 'addl_pages' ] ) ) { + $options[ $this->prefix . 'addl_pages' ] = array(); + } + $options[ $this->prefix . 'addl_pages' ][ $_POST[ $this->prefix . 'addl_url' ] ] = array( + 'prio' => $_POST[ $this->prefix . 'addl_prio' ], + 'freq' => $_POST[ $this->prefix . 'addl_freq' ], + 'mod' => $_POST[ $this->prefix . 'addl_mod' ], + ); } + return $options; } - - /** Get sitemap urls of child blogs, if any. **/ + + /** + * Get sitemap urls of child blogs, if any. + * + * @return mixed|void + */ function get_child_sitemap_urls() { - $siteurls = Array(); - $blogs = $this->get_child_blogs(); - if ( !empty( $blogs ) ) { + $siteurls = array(); + $blogs = $this->get_child_blogs(); + if ( ! empty( $blogs ) ) { $option_name = $this->get_option_name(); - foreach ( $blogs as $blog_id ) + foreach ( $blogs as $blog_id ) { if ( $this->is_aioseop_active_on_blog( $blog_id ) ) { $options = get_blog_option( $blog_id, $this->parent_option ); - if ( !empty( $options ) && !empty($options['modules']) && !empty($options['modules']['aiosp_feature_manager_options']) - && !empty($options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap']) - && !empty($options['modules'][$option_name]) ) { + if ( ! empty( $options ) && ! empty( $options['modules'] ) && ! empty( $options['modules']['aiosp_feature_manager_options'] ) + && ! empty( $options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) + && ! empty( $options['modules'][ $option_name ] ) + ) { global $wpdb; - $sitemap_options = $options['modules'][$option_name]; - $siteurl = ''; - if ( defined( 'SUNRISE' ) && SUNRISE && is_object( $wpdb ) && isset( $wpdb->dmtable ) && !empty( $wpdb->dmtable ) ) { + $sitemap_options = $options['modules'][ $option_name ]; + $siteurl = ''; + if ( defined( 'SUNRISE' ) && SUNRISE && is_object( $wpdb ) && isset( $wpdb->dmtable ) && ! empty( $wpdb->dmtable ) ) { $domain = $wpdb->get_var( "SELECT domain FROM {$wpdb->dmtable} WHERE blog_id = '$blog_id' AND active = 1 LIMIT 1" ); if ( $domain ) { - if ( false == isset( $_SERVER[ 'HTTPS' ] ) ) - $_SERVER[ 'HTTPS' ] = 'Off'; - $protocol = ( 'on' == strtolower( $_SERVER[ 'HTTPS' ] ) ) ? 'https://' : 'http://'; - $siteurl = untrailingslashit( $protocol . $domain ); + if ( false == isset( $_SERVER['HTTPS'] ) ) { + $_SERVER['HTTPS'] = 'Off'; + } + $protocol = ( 'on' == strtolower( $_SERVER['HTTPS'] ) ) ? 'https://' : 'http://'; + $siteurl = untrailingslashit( $protocol . $domain ); } } - if ( !$siteurl ) $siteurl = get_home_url( $blog_id ); + if ( ! $siteurl ) { + $siteurl = get_home_url( $blog_id ); + } $url = $siteurl . '/' . $sitemap_options["{$this->prefix}filename"] . '.xml'; - if ( $sitemap_options["{$this->prefix}gzipped"] ) $url .= '.gz'; + if ( $sitemap_options["{$this->prefix}gzipped"] ) { + $url .= '.gz'; + } $siteurls[] = $url; } } + } } - $siteurls = apply_filters( $this->prefix . 'sitemap_urls', $siteurls ); // legacy + $siteurls = apply_filters( $this->prefix . 'sitemap_urls', $siteurls ); // Legacy. return apply_filters( $this->prefix . 'child_urls', $siteurls ); } - /** Scan for sitemaps on filesystem. **/ + /** + * Gets the home path. + * + * If we're in wp-admin, use the WordPress function, otherwise we user our own version here. + * This only applies to static sitemaps. + * + * @since 2.3.6.1 + * + * @return mixed|string + */ + function get_home_path() { + + if ( function_exists( 'get_home_path' ) ) { + return get_home_path(); + } + + $home = set_url_scheme( get_option( 'home' ), 'http' ); + $siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' ); + if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) { + $wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */ + $pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) ); + $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos ); + $home_path = trailingslashit( $home_path ); + } else { + $home_path = ABSPATH; + } + + return str_replace( '\\', '/', $home_path ); + } + + /** + * Scan for sitemaps on filesystem. + * + * @return array + */ function scan_match_files() { $scan1 = $scan2 = ''; - $files = Array(); - - if ( !empty( $this->options["{$this->prefix}filename"] ) ) { + $files = array(); + + if ( ! empty( $this->options["{$this->prefix}filename"] ) ) { $scan1 = get_home_path() . $this->options["{$this->prefix}filename"] . '*.xml'; - if ( !empty( $this->options["{$this->prefix}gzipped"] ) ) + if ( ! empty( $this->options["{$this->prefix}gzipped"] ) ) { $scan2 .= get_home_path() . $this->options["{$this->prefix}filename"] . '*.xml.gz'; - - if ( empty( $scan1 ) && empty( $scan2 ) ) return $files; + } + + if ( empty( $scan1 ) && empty( $scan2 ) ) { + return $files; + } $home_path = get_home_path(); - $filescan = $this->scandir( $home_path ); - if ( !empty( $filescan ) ) - foreach( $filescan as $f ) { - if ( !empty($scan1) && fnmatch($scan1, $home_path . $f ) ) { - $files[] = $home_path . $f; - continue; - } - if ( !empty($scan2) && fnmatch($scan2, $home_path . $f ) ) + $filescan = $this->scandir( $home_path ); + if ( ! empty( $filescan ) ) { + foreach ( $filescan as $f ) { + if ( ! empty( $scan1 ) && fnmatch( $scan1, $home_path . $f ) ) { $files[] = $home_path . $f; + continue; + } + if ( ! empty( $scan2 ) && fnmatch( $scan2, $home_path . $f ) ) { + $files[] = $home_path . $f; + } + } } - + return $files; } } - - /** Handle deleting / renaming of conflicting sitemap files. **/ + + /** + * Scan for sitemaps. + * + * Handle deleting / renaming of conflicting sitemap files. + */ function do_sitemap_scan() { $msg = ''; - if ( !empty( $this->options["{$this->prefix}rewrite"] ) && ( get_option('permalink_structure') == '' ) ) { + if ( ! empty( $this->options["{$this->prefix}rewrite"] ) && ( get_option( 'permalink_structure' ) === '' ) ) { $msg = '

    ' . __( 'Warning: dynamic sitemap generation must have permalinks enabled.', 'all-in-one-seo-pack' ) . '

    '; } - if ( !empty( $_POST['aioseop_sitemap_rename_files'] ) || !empty( $_POST['aioseop_sitemap_delete_files'] ) ) { + if ( ! empty( $_POST['aioseop_sitemap_rename_files'] ) || ! empty( $_POST['aioseop_sitemap_delete_files'] ) ) { $nonce = $_POST['nonce-aioseop']; - if (!wp_verify_nonce($nonce, 'aioseop-nonce')) die ( __( 'Security Check - If you receive this in error, log out and back in to WordPress', 'all-in-one-seo-pack' ) ); - if ( !empty( $_POST['aioseop_sitemap_conflict'] ) ) { + if ( ! wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) { + die ( __( 'Security Check - If you receive this in error, log out and back in to WordPress', 'all-in-one-seo-pack' ) ); + } + if ( ! empty( $_POST['aioseop_sitemap_conflict'] ) ) { $files = $this->scan_match_files(); - foreach ( $files as $f => $file ) $files[$f] = realpath( $file ); - foreach( $_POST['aioseop_sitemap_conflict'] as $ren_file ) { + foreach ( $files as $f => $file ) { + $files[ $f ] = realpath( $file ); + } + foreach ( $_POST['aioseop_sitemap_conflict'] as $ren_file ) { $ren_file = realpath( get_home_path() . $ren_file ); if ( in_array( $ren_file, $files ) ) { - if ( !empty( $_POST['aioseop_sitemap_delete_files'] ) ) { - if ( $this->delete_file( $ren_file ) ) - $msg .= "

    " . sprintf( __( "Deleted %s.", 'all-in-one-seo-pack' ), $ren_file ) . "

    "; + if ( ! empty( $_POST['aioseop_sitemap_delete_files'] ) ) { + if ( $this->delete_file( $ren_file ) ) { + $msg .= '

    ' . sprintf( __( 'Deleted %s.', 'all-in-one-seo-pack' ), $ren_file ) . '

    '; + } continue; } $count = 0; do { - $ren_to = $ren_file . '._' . sprintf( "%03d", $count ) . ".old"; - $count++; + $ren_to = $ren_file . '._' . sprintf( '%03d', $count ) . '.old'; + $count ++; } while ( $this->file_exists( $ren_to ) && ( $count < 1000 ) ); - if ( $count >= 1000 ) - $msg .= "

    " . sprintf( __( "Couldn't rename file %s!", 'all-in-one-seo-pack' ), $ren_file) . "

    "; - else { + if ( $count >= 1000 ) { + $msg .= '

    ' . sprintf( __( "Couldn't rename file %s!", 'all-in-one-seo-pack' ), $ren_file ) . '

    '; + } else { $ren = $this->rename_file( $ren_file, $ren_to ); - if ( $ren ) - $msg .= "

    " . sprintf( __( "Renamed %s to %s.", 'all-in-one-seo-pack' ), $ren_file, $ren_to) . "

    "; + if ( $ren ) { + $msg .= '

    ' . sprintf( __( 'Renamed %s to %s.', 'all-in-one-seo-pack' ), $ren_file, $ren_to ) . '

    '; + } } - } else $msg .= "

    " . sprintf( __( "Couldn't find file %s!", 'all-in-one-seo-pack' ), $ren_file) . "

    "; + } else { + $msg .= '

    ' . sprintf( __( "Couldn't find file %s!", 'all-in-one-seo-pack' ), $ren_file ) . '

    '; + } } } } else { $msg .= $this->scan_sitemaps(); } - - if ( !empty( $msg ) ) + + if ( ! empty( $msg ) ) { $this->output_error( $msg ); + } } - /** Do the scan, return the results. **/ + /** + * Do the scan, return the results. + * + * @return string + */ function scan_sitemaps() { - $msg = ''; + $msg = ''; $files = $this->scan_match_files(); - if ( !empty( $files ) ) $msg = $this->sitemap_warning( $files ); + if ( ! empty( $files ) ) { + $msg = $this->sitemap_warning( $files ); + } + return $msg; } - - /** Get the list of potentially conflicting sitemap files. **/ + + /** + * Get problem files. + * + * Get the list of potentially conflicting sitemap files. + * + * @param $files + * @param $msg + * + * @return array + */ function get_problem_files( $files, &$msg ) { - $problem_files = Array(); - $use_wpfs = true; - $wpfs = $this->get_filesystem_object(); - if ( !is_object( $wpfs ) ) { + $problem_files = array(); + $use_wpfs = true; + $wpfs = $this->get_filesystem_object(); + if ( ! is_object( $wpfs ) ) { $use_wpfs = false; } else { - if ( $wpfs->method == 'direct' ) $use_wpfs = false; + if ( 'direct' === $wpfs->method ) { + $use_wpfs = false; + } } - + foreach ( $files as $f ) { if ( $this->is_file( $f ) ) { - $fn = $f; + $fn = $f; $compressed = false; - if ( $this->substr( $f, -3 ) == '.gz' ) $compressed = true; + if ( $this->substr( $f, - 3 ) === '.gz' ) { + $compressed = true; + } if ( $use_wpfs ) { - if ( $compressed ) { // inefficient but necessary + if ( $compressed ) { // Inefficient but necessary. $file = $this->load_file( $fn ); - if ( !empty( $file ) ) $file = gzuncompress( $file, 4096 ); + if ( ! empty( $file ) ) { + $file = gzuncompress( $file, 4096 ); + } } else { - $file = $this->load_file( $fn, false, null, -1, 4096 ); + $file = $this->load_file( $fn, false, null, - 1, 4096 ); } + } else { + if ( $compressed ) { + $fn = 'compress.zlib://' . $fn; + } + $file = file_get_contents( $fn, false, null, - 1, 4096 ); } - else { - if ( $compressed ) $fn = 'compress.zlib://' . $fn; - $file = file_get_contents( $fn, false, null, -1, 4096 ); - } - if ( !empty( $file ) ) { - $matches = Array(); - if ( preg_match( "//", - $file, $matches ) ) { - if ( !empty( $this->options["{$this->prefix}rewrite"] ) ) { - $msg .= '

    ' . sprintf( __( "Warning: a static sitemap '%s' generated by All in One SEO Pack %s on %s already exists that may conflict with dynamic sitemap generation.", 'all-in-one-seo-pack' ), - $f, $matches[2], $matches[3] ) . "

    \n"; - $problem_files[] = $f; - } + if ( ! empty( $file ) ) { + $matches = array(); + if ( preg_match( '//', + $file, $matches ) ) { + if ( ! empty( $this->options["{$this->prefix}rewrite"] ) ) { + $msg .= '

    ' . sprintf( __( "Warning: a static sitemap '%s' generated by All in One SEO Pack %s on %s already exists that may conflict with dynamic sitemap generation.", 'all-in-one-seo-pack' ), + $f, $matches[2], $matches[3] ) . "

    \n"; + $problem_files[] = $f; + } } else { - $msg .= '

    ' . sprintf( __( "Potential conflict with unknown file %s.", 'all-in-one-seo-pack' ), $f ) . "

    \n"; + $msg .= '

    ' . sprintf( __( 'Potential conflict with unknown file %s.', 'all-in-one-seo-pack' ), $f ) . "

    \n"; $problem_files[] = $f; } } } } + return $problem_files; } - - /** Display the warning and the form for conflicting sitemap files. **/ + + /** + * Display sitemap warning. + * + * Display the warning and the form for conflicting sitemap files. + * + * @param $files + * + * @return string + */ function sitemap_warning( $files ) { - $msg = ''; - $conflict = false; + $msg = ''; + $conflict = false; $problem_files = $this->get_problem_files( $files, $msg ); - if ( !empty( $problem_files ) ) $conflict = true; + if ( ! empty( $problem_files ) ) { + $conflict = true; + } if ( $conflict ) { - foreach ( $problem_files as $p ) - $msg .= "\n"; - $msg .= "\n"; - $msg .= " "; - $msg .= ""; + foreach ( $problem_files as $p ) { + $msg .= "\n"; + } + $msg .= "\n"; + $msg .= " "; + $msg .= ""; $msg = '
    ' . $msg . '
    '; } + return $msg; } - - /** Updates debug log messages. **/ + + /** + * Updates debug log messages. + * + * @param $msg + */ function debug_message( $msg ) { - if ( empty( $this->options["{$this->prefix}debug"] ) ) $this->options["{$this->prefix}debug"] = ''; + if ( empty( $this->options["{$this->prefix}debug"] ) ) { + $this->options["{$this->prefix}debug"] = ''; + } $this->options["{$this->prefix}debug"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}debug"]; if ( $this->strlen( $this->options["{$this->prefix}debug"] ) > 2048 ) { $end = $this->strrpos( $this->options["{$this->prefix}debug"], "\n" ); - if ( $end === false ) $end = 2048; + if ( false === $end ) { + $end = 2048; + } $this->options["{$this->prefix}debug"] = $this->substr( $this->options["{$this->prefix}debug"], 0, $end ); } $this->update_class_option( $this->options ); } - - /** Set up hooks for rewrite rules for dynamic sitemap generation. **/ + + /** + * Set up hooks for rewrite rules for dynamic sitemap generation. + */ function setup_rewrites() { - add_action( 'rewrite_rules_array', Array( $this, 'rewrite_hook' ) ); - add_filter( 'query_vars', Array( $this, 'query_var_hook' ) ); - add_action( 'parse_query', Array( $this, 'sitemap_output_hook') ); - if ( !get_transient( "{$this->prefix}rules_flushed" ) ) - add_action( 'wp_loaded', Array($this, 'flush_rules_hook' ) ); + add_action( 'rewrite_rules_array', array( $this, 'rewrite_hook' ) ); + add_filter( 'query_vars', array( $this, 'query_var_hook' ) ); + add_action( 'parse_query', array( $this, 'sitemap_output_hook' ) ); + if ( ! get_transient( "{$this->prefix}rules_flushed" ) ) { + add_action( 'wp_loaded', array( $this, 'flush_rules_hook' ) ); + } } - /** Build and return our rewrite rules. **/ + /** + * Build and return our rewrite rules. + * + * @return array + */ function get_rewrite_rules() { - $sitemap_rules_normal = $sitemap_rules_gzipped = Array(); + $sitemap_rules_normal = $sitemap_rules_gzipped = array(); $sitemap_rules_normal = array( - $this->options["{$this->prefix}filename"] . '.xml' => "index.php?{$this->prefix}path=root", - $this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml'=> 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]', - $this->options["{$this->prefix}filename"] . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]' + $this->options["{$this->prefix}filename"] . '.xml' => "index.php?{$this->prefix}path=root", + $this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]', + $this->options["{$this->prefix}filename"] . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]', ); if ( $this->options["{$this->prefix}gzipped"] ) { $sitemap_rules_gzipped = array( - $this->options["{$this->prefix}filename"] . '.xml.gz' => "index.php?{$this->prefix}gzipped=1&{$this->prefix}path=root.gz", - $this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz&' . $this->prefix . 'page=$matches[2]', - $this->options["{$this->prefix}filename"] . '_(.+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz' - ); + $this->options["{$this->prefix}filename"] . '.xml.gz' => "index.php?{$this->prefix}gzipped=1&{$this->prefix}path=root.gz", + $this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz&' . $this->prefix . 'page=$matches[2]', + $this->options["{$this->prefix}filename"] . '_(.+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz', + ); } $sitemap_rules = $sitemap_rules_gzipped + $sitemap_rules_normal; + return $sitemap_rules; } - /** Add in our rewrite rules. **/ + /** + * Add in our rewrite rules. + * + * @param $rules + * + * @return array + */ function rewrite_hook( $rules ) { $sitemap_rules = $this->get_rewrite_rules(); - if ( !empty( $sitemap_rules ) ) + if ( ! empty( $sitemap_rules ) ) { $rules = $sitemap_rules + $rules; + } + return $rules; } - - /** Flush rewrite rules when necessary. **/ + + /** + * Flush rewrite rules when necessary. + */ function flush_rules_hook() { global $wp_rewrite; $sitemap_rules = $this->get_rewrite_rules( $wp_rewrite ); - if ( !empty( $sitemap_rules ) ) { + if ( ! empty( $sitemap_rules ) ) { $rules = get_option( 'rewrite_rules' ); - $rule = key( $sitemap_rules ); - if ( !isset( $rules[ $rule ] ) || ( $rules[ $rule ] != $sitemap_rules[ $rule ] ) ) { - $wp_rewrite->flush_rules(); + $rule = key( $sitemap_rules ); + if ( ! isset( $rules[ $rule ] ) || ( $rules[ $rule ] !== $sitemap_rules[ $rule ] ) ) { + $wp_rewrite->flush_rules(); set_transient( "{$this->prefix}rules_flushed", true, 43200 ); } } } - /** Add our query variable for sitemap generation. **/ - function query_var_hook($vars) { + /** + * Add our query variable for sitemap generation. + * + * @param $vars + * + * @return array + */ + function query_var_hook( $vars ) { $vars[] = "{$this->prefix}path"; - if ( $this->paginate ) + if ( $this->paginate ) { $vars[] = "{$this->prefix}page"; + } + return $vars; } - /** Start timing and get initial memory usage for debug info. **/ + /** + * Start timing and get initial memory usage for debug info. + */ function log_start() { $this->start_memory_usage = memory_get_peak_usage(); timer_start(); } - /** Stop timing and log memory usage for debug info. **/ - function log_stats( $sitemap_type = 'root', $compressed = false, $dynamic = true ) { - $time = timer_stop(); - $end_memory_usage = memory_get_peak_usage(); + + /** + * Stop timing and log memory usage for debug info. + * + * @param string $sitemap_type + * @param bool $compressed + * @param bool $dynamic + */ + function log_stats( $sitemap_type = 'static', $compressed = false, $dynamic = true ) { + $time = timer_stop(); + $end_memory_usage = memory_get_peak_usage(); $sitemap_memory_usage = $end_memory_usage - $this->start_memory_usage; - $end_memory_usage = $end_memory_usage / 1024.0 / 1024.0; + $end_memory_usage = $end_memory_usage / 1024.0 / 1024.0; $sitemap_memory_usage = $sitemap_memory_usage / 1024.0 / 1024.0; - if ( $compressed ) $sitemap_type = __( 'compressed', 'all-in-one-seo-pack' ) . " $sitemap_type"; - if ( $dynamic ) - $sitemap_type = __( 'dynamic', 'all-in-one-seo-pack ') . " $sitemap_type"; - else - $sitemap_type = __( 'static', 'all-in-one-seo-pack ') . " $sitemap_type"; - $this->debug_message( sprintf( " %01.2f MB memory used generating the %s sitemap in %01.3f seconds, %01.2f MB total memory used.", $sitemap_memory_usage, $sitemap_type, $time, $end_memory_usage ) ); + $sitemap_type = __( 'static', 'all-in-one-seo-pack ' ); + if ( $compressed ) { + $sitemap_type = __( 'compressed', 'all-in-one-seo-pack' ); + } + if ( $dynamic ) { + $sitemap_type = __( 'dynamic', 'all-in-one-seo-pack ' ); + } + $this->debug_message( sprintf( ' %01.2f MB memory used generating the %s sitemap in %01.3f seconds, %01.2f MB total memory used.', $sitemap_memory_usage, $sitemap_type, $time, $end_memory_usage ) ); } - /** Handle outputting of dynamic sitemaps, logging. **/ - function sitemap_output_hook($query) { + /** + * Handle outputting of dynamic sitemaps, logging. + * + * @param $query + */ + function sitemap_output_hook( $query ) { $page = 0; - if ( ( $this->options["{$this->prefix}rewrite"] ) ) - if( !empty( $query->query_vars["{$this->prefix}path"] ) ) { - if( !empty( $query->query_vars["{$this->prefix}page"] ) ) - $page = $query->query_vars["{$this->prefix}page"] - 1; - $this->start_memory_usage = memory_get_peak_usage(); - $sitemap_type = $query->query_vars["{$this->prefix}path"]; + if ( $this->options["{$this->prefix}rewrite"] && ! empty( $query->query_vars["{$this->prefix}path"] ) ) { + + // Make dynamic sitemap. + + if ( ! empty( $query->query_vars["{$this->prefix}page"] ) ) { + $page = $query->query_vars["{$this->prefix}page"] - 1; + } + $this->start_memory_usage = memory_get_peak_usage(); + $sitemap_type = $query->query_vars["{$this->prefix}path"]; + $gzipped = false; + if ( $this->substr( $sitemap_type, - 3 ) === '.gz' ) { + $gzipped = true; + $sitemap_type = $this->substr( $sitemap_type, 0, - 3 ); + } + $blog_charset = get_option( 'blog_charset' ); + if ( $this->options["{$this->prefix}gzipped"] && $gzipped ) { + header( "Content-Type: application/x-gzip; charset=$blog_charset", true ); + } else { $gzipped = false; - if ( $this->substr( $sitemap_type, -3 ) === '.gz' ) { - $gzipped = true; - $sitemap_type = $this->substr( $sitemap_type, 0, -3 ); - } - $blog_charset = get_option( 'blog_charset' ); - if ( $this->options["{$this->prefix}gzipped"] && $gzipped ) { - header( "Content-Type: application/x-gzip; charset=$blog_charset", true); - } else { - $gzipped = false; - header( "Content-Type: text/xml; charset=$blog_charset", true ); - } - if ( $this->options["{$this->prefix}noindex"] ) { - header( "X-Robots-Tag: noindex", true ); - } - if ( $gzipped ) ob_start(); - $this->do_rewrite_sitemap( $sitemap_type, $page ); - if ( $gzipped ) echo gzencode( ob_get_clean() ); - $this->log_stats( $sitemap_type, $gzipped ); - exit(); + header( "Content-Type: text/xml; charset=$blog_charset", true ); + } + + // Always follow and noindex the sitemap. + header( 'X-Robots-Tag: noindex, follow', true ); + + if ( $gzipped ) { + ob_start(); + } + $this->do_rewrite_sitemap( $sitemap_type, $page ); + if ( $gzipped ) { + echo gzencode( ob_get_clean() ); } + $this->log_stats( $sitemap_type, $gzipped ); + exit(); + + + } + } + + /** + * Make dynamic xsl. + */ + function make_dynamic_xsl() { + // Make dynamic xsl file. + if ( preg_match( '#(/sitemap\.xsl)$#i', $_SERVER['REQUEST_URI'] ) ) { + $blog_charset = get_option( 'blog_charset' ); + header( "Content-Type: text/xml; charset=$blog_charset", true ); + include_once( AIOSEOP_PLUGIN_DIR . '/inc/sitemap-xsl.php' ); + exit(); + } } - + + /** + * Get sitemap data. + * + * @param $sitemap_type + * @param int $page + * + * @return mixed|void + */ function get_sitemap_data( $sitemap_type, $page = 0 ) { - $sitemap_data = Array(); + $sitemap_data = array(); if ( $this->options["{$this->prefix}indexes"] ) { $posttypes = $this->options["{$this->prefix}posttypes"]; - if ( empty( $posttypes ) ) $posttypes = Array(); + if ( empty( $posttypes ) ) { + $posttypes = array(); + } $taxonomies = $this->options["{$this->prefix}taxonomies"]; - if ( empty( $taxonomies ) ) $taxonomies = Array(); - if ( $sitemap_type === 'root' ) { + if ( empty( $taxonomies ) ) { + $taxonomies = array(); + } + if ( 'root' === $sitemap_type ) { $sitemap_data = array_merge( $this->get_sitemap_index_filenames() ); - } elseif ( $sitemap_type === 'addl' ) { - $sitemap_data = $this->get_addl_pages(); - } elseif ( $sitemap_type === 'archive' && $this->option_isset( 'archive' ) ) { - $sitemap_data = $this->get_archive_prio_data(); - } elseif ( $sitemap_type === 'author' && $this->option_isset( 'author' ) ) { - $sitemap_data = $this->get_author_prio_data(); + } elseif ( 'addl' === $sitemap_type ) { + $sitemap_data = $this->get_addl_pages(); + } elseif ( 'archive' === $sitemap_type && $this->option_isset( 'archive' ) ) { + $sitemap_data = $this->get_archive_prio_data(); + } elseif ( 'author' === $sitemap_type && $this->option_isset( 'author' ) ) { + $sitemap_data = $this->get_author_prio_data(); } elseif ( in_array( $sitemap_type, $posttypes ) ) { $sitemap_data = $this->get_all_post_priority_data( $sitemap_type, 'publish', $page ); } elseif ( in_array( $sitemap_type, $taxonomies ) ) { $sitemap_data = $this->get_term_priority_data( get_terms( $sitemap_type, $this->get_tax_args( $page ) ) ); } else { - if ( is_array( $this->extra_sitemaps ) && in_array( $sitemap_type, $this->extra_sitemaps ) ) + if ( is_array( $this->extra_sitemaps ) && in_array( $sitemap_type, $this->extra_sitemaps ) ) { $sitemap_data = apply_filters( $this->prefix . 'custom_' . $sitemap_type, $sitemap_data, $page, $this_options ); + } } - } elseif ( $sitemap_type === 'root' ) $sitemap_data = $this->get_simple_sitemap(); + } elseif ( 'root' === $sitemap_type ) { + $sitemap_data = $this->get_simple_sitemap(); + } + return apply_filters( $this->prefix . 'data', $sitemap_data, $sitemap_type, $page, $this->options ); } - /** Output sitemaps dynamically based on rewrite rules. **/ + /** + * Rewrite sitemap. + * + * Output sitemaps dynamically based on rewrite rules. + * + * @param $sitemap_type + * @param int $page + */ function do_rewrite_sitemap( $sitemap_type, $page = 0 ) { $this->add_post_types(); - $comment = __( "dynamically", 'all-in-one-seo-pack' ); + $comment = 'dynamically'; echo $this->do_build_sitemap( $sitemap_type, $page, '', $comment ); } - /** Build a url to the sitemap. **/ + /** + * Build a url to the sitemap. + * + * @return string + */ function get_sitemap_url() { $url = get_home_url() . '/' . $this->options["{$this->prefix}filename"] . '.xml'; - if ( $this->options["{$this->prefix}gzipped"] ) $url .= '.gz'; + if ( $this->options["{$this->prefix}gzipped"] ) { + $url .= '.gz'; + } + return $url; } - /** Notify search engines, do logging. **/ + /** + * Notify search engines, do logging. + */ function do_notify() { - $notify_url = Array( 'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=', - 'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap=' - ); + $notify_url = array( + 'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=', + 'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap=', + ); $url = $this->get_sitemap_url(); - if ( !empty( $url ) ) - foreach ( $notify_url as $k => $v ) - if ( isset( $this->options[$this->prefix . $k] ) && $this->options[$this->prefix . $k] ) { - $response = wp_remote_get( $notify_url[$k] . urlencode( $url ) ); - if ( is_array( $response ) && !empty( $response['response'] ) && !empty( $response['response']['code'] ) ) { - if ( $response['response']['code'] == 200 ) { + if ( ! empty( $url ) ) { + foreach ( $notify_url as $k => $v ) { + if ( isset( $this->options[ $this->prefix . $k ] ) && $this->options[ $this->prefix . $k ] ) { + $response = wp_remote_get( $notify_url[ $k ] . urlencode( $url ) ); + if ( is_array( $response ) && ! empty( $response['response'] ) && ! empty( $response['response']['code'] ) ) { + if ( 200 == $response['response']['code'] ) { $this->debug_message( sprintf( __( 'Successfully notified %s about changes to your sitemap at %s.', 'all-in-one-seo-pack' ), $k, $url ) ); } else { $this->debug_message( sprintf( __( 'Failed to notify %s about changes to your sitemap at %s, error code %s.', 'all-in-one-seo-pack' ), $k, $url, $response['response']['code'] ) ); } } else { - $this->debug_message( sprintf( __( 'Failed to notify %s about changes to your sitemap at %s, unable to access via wp_remote_get().', 'all-in-one-seo-pack' ), $k, $url ) ); + $this->debug_message( sprintf( __( 'Failed to notify %s about changes to your sitemap at %s, unable to access via wp_remote_get().', 'all-in-one-seo-pack' ), $k, $url ) ); } } else { $this->debug_message( sprintf( __( 'Did not notify %s about changes to your sitemap.', 'all-in-one-seo-pack' ), $k, $url ) ); } + } + } } - - /** Add Sitemap parameter to virtual robots.txt file. **/ + + /** + * Add Sitemap parameter to virtual robots.txt file. + */ function do_robots() { $url = $this->get_sitemap_url(); echo "\nSitemap: $url\n"; } - /** Build static sitemaps on submit if rewrite rules are not in use, do logging. **/ + /** + * Build static sitemaps. + * + * Build static sitemaps on submit if rewrite rules are not in use, do logging. + * + * @param string $message + */ function do_sitemaps( $message = '' ) { - if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) { + if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) { $this->paginate = true; - if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) + if ( $this->options["{$this->prefix}max_posts"] && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) { $this->max_posts = $this->options["{$this->prefix}max_posts"]; - else - $this->max_posts = 50000; + } else { + $this->max_posts = 50000; + } } else { - $this->paginate = false; + $this->paginate = false; $this->max_posts = 50000; } - if ( !$this->options["{$this->prefix}rewrite"] ) { + if ( ! $this->options["{$this->prefix}rewrite"] ) { if ( $this->options["{$this->prefix}indexes"] ) { $this->do_indexed_sitemaps(); } else { $this->log_start(); - $comment = sprintf( __( "file '%s' statically", 'all-in-one-seo-pack' ), $this->options["{$this->prefix}filename"] ); + $comment = sprintf( "file '%s' statically", $this->options["{$this->prefix}filename"] ); $sitemap = $this->do_simple_sitemap( $comment ); $this->write_sitemaps( $this->options["{$this->prefix}filename"], $sitemap ); $this->log_stats( 'root', $this->options["{$this->prefix}gzipped"], false ); @@ -835,203 +1349,392 @@ function do_sitemaps( $message = '' ) { delete_transient( "{$this->prefix}rules_flushed" ); } $this->do_notify(); - if ( !empty( $message ) && is_string( $message ) ) { + if ( ! empty( $message ) && is_string( $message ) ) { $this->debug_message( $message ); } else { - $this->debug_message( __( 'Updated sitemap settings.', 'all-in-one-seo-pack' ) ); + $this->debug_message( __( 'Updated sitemap settings.', 'all-in-one-seo-pack' ) ); } } + /** + * Add mime type. + * + * @param $mime + * + * @return mixed + */ function add_xml_mime_type( $mime ) { - if ( !empty( $mime ) ) { + if ( ! empty( $mime ) ) { $mime['xml'] = 'text/xml'; } + return $mime; } - /** Write sitemaps (compressed or otherwise) to the filesystem. **/ + /** + * Write multiple sitemaps. + * + * Write sitemaps (compressed or otherwise) to the filesystem. + * + * @param $filename + * @param $contents + */ function write_sitemaps( $filename, $contents ) { - $this->write_sitemap( $filename . ".xml", $contents ); - if ( $this->options["{$this->prefix}gzipped"] ) $this->write_sitemap( $filename . ".xml.gz", $contents, true ); - } - - /** Write a single sitemap to the filesystem, handle compression. **/ - function write_sitemap($filename, $contents, $gzip = false) { - if ( $gzip ) $contents = gzencode( $contents ); - add_filter( 'upload_mimes', Array( $this, 'add_xml_mime_type' ) ); - $filename = get_home_path() . sanitize_file_name( $filename ); - remove_filter( 'upload_mimes', Array( $this, 'add_xml_mime_type' ) ); + $this->write_sitemap( $filename . '.xml', $contents ); + if ( $this->options["{$this->prefix}gzipped"] ) { + $this->write_sitemap( $filename . '.xml.gz', $contents, true ); + } + } + + /** + * Write single sitemap. + * + * Write a single sitemap to the filesystem, handle compression. + * + * @param $filename + * @param $contents + * @param bool $gzip + * + * @return bool + */ + function write_sitemap( $filename, $contents, $gzip = false ) { + if ( $gzip ) { + $contents = gzencode( $contents ); + } + add_filter( 'upload_mimes', array( $this, 'add_xml_mime_type' ) ); + $filename = $this->get_home_path() . sanitize_file_name( $filename ); + remove_filter( 'upload_mimes', array( $this, 'add_xml_mime_type' ) ); + return $this->save_file( $filename, $contents ); } - - /*** Helper function for handling default values ***/ + + /** + * Gets the default values. + * + * Helper function for handling default values. + * + * @param $defaults + * @param $prefix + * @param $cache + * @param $item + * @param bool $nodefaults + * @param string $type + * + * @return bool + */ function get_default_values( $defaults, $prefix, &$cache, $item, $nodefaults = false, $type = '' ) { - if ( !empty( $cache[ $item . $type ] ) ) return $cache[ $item . $type ]; - if ( !empty( $defaults[ $item ] ) ) { + if ( ! empty( $cache[ $item . $type ] ) ) { + return $cache[ $item . $type ]; + } + if ( ! empty( $defaults[ $item ] ) ) { $field = $this->prefix . $prefix . $item; - if ( $this->option_isset( $prefix . $item ) && $this->options[ $field ] != 'no' ) { - if ( ( $this->options[ $field ] == 'sel' ) && !empty( $type ) && ( isset( $this->options[ $this->prefix . $prefix . $item . '_' . $type ] ) ) ) { - if ( $this->options[ $this->prefix . $prefix . $item . '_' . $type ] == 'no' ) return false; - if ( $this->options[ $this->prefix . $prefix . $item . '_' . $type ] == 'sel' ) return false; + if ( $this->option_isset( $prefix . $item ) && 'no' != $this->options[ $field ] ) { + if ( ( 'sel' === $this->options[ $field ] ) && ! empty( $type ) && isset( $this->options[ $this->prefix . $prefix . $item . '_' . $type ] ) ) { + if ( 'no' == $this->options[ $this->prefix . $prefix . $item . '_' . $type ] ) { + return false; + } + if ( 'sel' === $this->options[ $this->prefix . $prefix . $item . '_' . $type ] ) { + return false; + } $cache[ $item . $type ] = $this->options[ $this->prefix . $prefix . $item . '_' . $type ]; } else { - if ( $this->options[ $field ] == 'no' ) return false; - if ( $this->options[ $field ] == 'sel' ) return false; + if ( 'no' == $this->options[ $field ] ) { + return false; + } + if ( 'sel' === $this->options[ $field ] ) { + return false; + } $cache[ $item . $type ] = $this->options[ $field ]; } + return $cache[ $item . $type ]; } - if ( $nodefaults ) return false; + if ( $nodefaults ) { + return false; + } + return $defaults[ $item ]; } + return false; } - /** Get priority settings for sitemap entries. **/ + /** + * Get priority settings for sitemap entries. + * + * @param $item + * @param bool $nodefaults + * @param string $type + * + * @return bool + */ function get_default_priority( $item, $nodefaults = false, $type = '' ) { - $defaults = Array( 'homepage' => '1.0', 'blog' => '0.9', 'sitemap' => '0.8', 'post' => '0.7', 'archive' => '0.5', 'author' => '0.3', 'taxonomies' => '0.3' ); - static $cache = Array(); + $defaults = array( + 'homepage' => '1.0', + 'blog' => '0.9', + 'sitemap' => '0.8', + 'post' => '0.7', + 'archive' => '0.5', + 'author' => '0.3', + 'taxonomies' => '0.3', + ); + static $cache = array(); + return $this->get_default_values( $defaults, 'prio_', $cache, $item, $nodefaults, $type ); } - /** Get frequency settings for sitemap entries. **/ + /** + * Get frequency settings for sitemap entries. + * + * @param $item + * @param bool $nodefaults + * @param string $type + * + * @return bool + */ function get_default_frequency( $item, $nodefaults = false, $type = '' ) { - $defaults = Array( 'homepage' => 'always', 'blog' => 'daily', 'sitemap' => 'hourly', 'post' => 'weekly', 'archive' => 'monthly', 'author' => 'weekly', 'taxonomies' => 'monthly' ); - static $cache = Array(); + $defaults = array( + 'homepage' => 'always', + 'blog' => 'daily', + 'sitemap' => 'hourly', + 'post' => 'weekly', + 'archive' => 'monthly', + 'author' => 'weekly', + 'taxonomies' => 'monthly', + ); + static $cache = array(); + return $this->get_default_values( $defaults, 'freq_', $cache, $item, $nodefaults, $type ); } - - /** Build an index of sitemaps used. **/ + + /** + * Build an index of sitemaps used. + * + * @return array + */ function get_sitemap_index_filenames() { - $files = Array(); + $files = array(); $options = $this->options; - $prefix = $options["{$this->prefix}filename"]; - $suffix = '.xml'; - if ( $options["{$this->prefix}gzipped"] ) $suffix .= '.gz'; - if ( empty( $options["{$this->prefix}posttypes"] ) ) $options["{$this->prefix}posttypes"] = Array(); - if ( empty( $options["{$this->prefix}taxonomies"] ) ) $options["{$this->prefix}taxonomies"] = Array(); - $options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], Array( 'all' ) ); - $options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], Array( 'all' ) ); - $url_base = trailingslashit( get_home_url() ); - $files[] = Array( 'loc' => $url_base . $prefix . '_addl' . $suffix ); - if ( !empty( $options["{$this->prefix}posttypes"] ) ) { - $prio = $this->get_default_priority( 'post' ); - $freq = $this->get_default_frequency( 'post' ); - $post_counts = $this->get_all_post_counts( Array('post_type' => $options["{$this->prefix}posttypes"], 'post_status' => 'publish') ); - if ( !is_array( $post_counts ) && is_array( $options["{$this->prefix}posttypes"] ) && count( $options["{$this->prefix}posttypes"] ) == 1 ) { - $post_counts = Array( $options["{$this->prefix}posttypes"][0] => $post_counts ); - } - foreach( $options["{$this->prefix}posttypes"] as $sm ) { - if ( $post_counts[$sm] == 0 ) continue; + $prefix = $options["{$this->prefix}filename"]; + $suffix = '.xml'; + if ( $options["{$this->prefix}gzipped"] ) { + $suffix .= '.gz'; + } + if ( empty( $options["{$this->prefix}posttypes"] ) ) { + $options["{$this->prefix}posttypes"] = array(); + } + if ( empty( $options["{$this->prefix}taxonomies"] ) ) { + $options["{$this->prefix}taxonomies"] = array(); + } + $options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], array( 'all' ) ); + $options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], array( 'all' ) ); + $url_base = trailingslashit( get_home_url() ); + $files[] = array( 'loc' => $url_base . $prefix . '_addl' . $suffix ); + if ( ! empty( $options["{$this->prefix}posttypes"] ) ) { + $prio = $this->get_default_priority( 'post' ); + $freq = $this->get_default_frequency( 'post' ); + $post_counts = $this->get_all_post_counts( array( + 'post_type' => $options["{$this->prefix}posttypes"], + 'post_status' => 'publish', + ) ); + if ( ! is_array( $post_counts ) && is_array( $options["{$this->prefix}posttypes"] ) && count( $options["{$this->prefix}posttypes"] ) == 1 ) { + $post_counts = array( $options["{$this->prefix}posttypes"][0] => $post_counts ); + } + foreach ( $options["{$this->prefix}posttypes"] as $sm ) { + if ( 0 == $post_counts[ $sm ] ) { + continue; + } if ( $this->paginate ) { - if ( $post_counts[$sm] > $this->max_posts ) { + if ( $post_counts[ $sm ] > $this->max_posts ) { $count = 1; - for( $post_count = 0; $post_count < $post_counts[$sm]; $post_count += $this->max_posts ) { - $files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count++ ) . $suffix, 'priority' => $prio, 'changefreq' => $freq ); + for ( $post_count = 0; $post_count < $post_counts[ $sm ]; $post_count += $this->max_posts ) { + $files[] = array( + 'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count ++ ) . $suffix, + 'priority' => $prio, + 'changefreq' => $freq, + ); } - } else $files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . $suffix, 'priority' => $prio, 'changefreq' => $freq ); - } else - $files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . $suffix, 'priority' => $prio, 'changefreq' => $freq ); - } - } - if ( $this->option_isset( 'archive' ) ) - $files[] = Array( 'loc' => $url_base . $prefix . '_archive' . $suffix, 'priority' => $this->get_default_priority( 'archive' ), 'changefreq' => $this->get_default_frequency( 'archive' ) ); - if ( $this->option_isset( 'author' ) ) - $files[] = Array( 'loc' => $url_base . $prefix . '_author' . $suffix, 'priority' => $this->get_default_priority( 'author' ), 'changefreq' => $this->get_default_frequency( 'author' ) ); - - if ( !empty( $options["{$this->prefix}taxonomies"] ) ) - foreach( $options["{$this->prefix}taxonomies"] as $sm ) { - $term_count = wp_count_terms( $sm, array('hide_empty' => true) ); - if ( !is_wp_error( $term_count ) && ( $term_count > 0 ) ) { + } else { + $files[] = array( + 'loc' => $url_base . $prefix . '_' . $sm . $suffix, + 'priority' => $prio, + 'changefreq' => $freq, + ); + } + } else { + $files[] = array( + 'loc' => $url_base . $prefix . '_' . $sm . $suffix, + 'priority' => $prio, + 'changefreq' => $freq, + ); + } + } + } + if ( $this->option_isset( 'archive' ) ) { + $files[] = array( + 'loc' => $url_base . $prefix . '_archive' . $suffix, + 'priority' => $this->get_default_priority( 'archive' ), + 'changefreq' => $this->get_default_frequency( 'archive' ), + ); + } + if ( $this->option_isset( 'author' ) ) { + $files[] = array( + 'loc' => $url_base . $prefix . '_author' . $suffix, + 'priority' => $this->get_default_priority( 'author' ), + 'changefreq' => $this->get_default_frequency( 'author' ), + ); + } + + if ( ! empty( $options["{$this->prefix}taxonomies"] ) ) { + foreach ( $options["{$this->prefix}taxonomies"] as $sm ) { + $term_count = wp_count_terms( $sm, array( 'hide_empty' => true ) ); + if ( ! is_wp_error( $term_count ) && ( $term_count > 0 ) ) { if ( $this->paginate ) { if ( $term_count > $this->max_posts ) { $count = 1; - for( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) { - $files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count++ ) . $suffix, 'priority' => $this->get_default_priority( 'taxonomies' ), 'changefreq' => $this->get_default_frequency( 'taxonomies' ) ); + for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) { + $files[] = array( + 'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count ++ ) . $suffix, + 'priority' => $this->get_default_priority( 'taxonomies' ), + 'changefreq' => $this->get_default_frequency( 'taxonomies' ), + ); } - } else $files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . $suffix, 'priority' => $this->get_default_priority( 'taxonomies' ), 'changefreq' => $this->get_default_frequency( 'taxonomies' ) ); - } else - $files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . $suffix, 'priority' => $this->get_default_priority( 'taxonomies' ), 'changefreq' => $this->get_default_frequency( 'taxonomies' ) ); + } else { + $files[] = array( + 'loc' => $url_base . $prefix . '_' . $sm . $suffix, + 'priority' => $this->get_default_priority( 'taxonomies' ), + 'changefreq' => $this->get_default_frequency( 'taxonomies' ), + ); + } + } else { + $files[] = array( + 'loc' => $url_base . $prefix . '_' . $sm . $suffix, + 'priority' => $this->get_default_priority( 'taxonomies' ), + 'changefreq' => $this->get_default_frequency( 'taxonomies' ), + ); + } } } - foreach( $this->get_child_sitemap_urls() as $csm ) - $files[] = Array( 'loc' => $csm, 'priority' => $this->get_default_priority( 'sitemap' ), 'changefreq' => $this->get_default_frequency( 'sitemap' ) ); + } + foreach ( $this->get_child_sitemap_urls() as $csm ) { + $files[] = array( + 'loc' => $csm, + 'priority' => $this->get_default_priority( 'sitemap' ), + 'changefreq' => $this->get_default_frequency( 'sitemap' ), + ); + } + return $files; } - + + /** + * Build the sitemap. + * + * @param $sitemap_type + * @param int $page + * @param string $filename + * @param string $comment + * + * @return string + */ function do_build_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) { if ( empty( $filename ) ) { - if ( $sitemap_type == 'root' ) { - $filename = $this->options["{$this->prefix}filename"]; + if ( 'root' === $sitemap_type ) { + $filename = $this->options["{$this->prefix}filename"]; } else { - $filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type; + $filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type; } } - if ( empty( $comment ) ) - $comment = __( "file '%s' statically", 'all-in-one-seo-pack' ); + if ( empty( $comment ) ) { + $comment = "file '%s' statically"; + } $sitemap_data = $this->get_sitemap_data( $sitemap_type, $page ); - if ( ( $sitemap_type == 'root' ) && !empty( $this->options["{$this->prefix}indexes"] ) ) { + if ( ( 'root' === $sitemap_type ) && ! empty( $this->options["{$this->prefix}indexes"] ) ) { return $this->build_sitemap_index( $sitemap_data, sprintf( $comment, $filename ) ); } else { return $this->build_sitemap( $sitemap_data, sprintf( $comment, $filename ) ); } } - + + /** + * Write the sitemap. + * + * @param $sitemap_type + * @param int $page + * @param string $filename + * @param string $comment + */ function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) { if ( empty( $filename ) ) { - if ( $sitemap_type == 'root' ) { - $filename = $this->options["{$this->prefix}filename"]; + if ( 'root' === $sitemap_type ) { + $filename = $this->options["{$this->prefix}filename"]; } else { - $filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type; + $filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type; } } - if ( empty( $comment ) ) - $comment = __( "file '%s' statically", 'all-in-one-seo-pack' ); + if ( empty( $comment ) ) { + $comment = "file '%s' statically"; + } $this->write_sitemaps( $filename, $this->do_build_sitemap( $sitemap_type, $page, $filename, $comment ) ); } - /** Build all the indexes. **/ + /** + * Build all the indexes. + */ function do_indexed_sitemaps() { $this->start_memory_usage = memory_get_peak_usage(); - $options = $this->options; - + $options = $this->options; + $this->do_write_sitemap( 'root' ); $this->do_write_sitemap( 'addl' ); - - if ( $this->option_isset( 'archive' ) ) $this->do_write_sitemap( 'archive' ); - if ( $this->option_isset( 'author' ) ) $this->do_write_sitemap( 'author' ); - if ( ( !isset( $options["{$this->prefix}posttypes"] ) ) || ( !is_array( $options["{$this->prefix}posttypes"] ) ) ) $options["{$this->prefix}posttypes"] = Array(); - if ( ( !isset( $options["{$this->prefix}taxonomies"] ) ) || ( !is_array( $options["{$this->prefix}taxonomies"] ) ) ) $options["{$this->prefix}taxonomies"] = Array(); - $options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], Array( 'all' ) ); - $options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], Array( 'all' ) ); + if ( $this->option_isset( 'archive' ) ) { + $this->do_write_sitemap( 'archive' ); + } + if ( $this->option_isset( 'author' ) ) { + $this->do_write_sitemap( 'author' ); + } + + if ( ( ! isset( $options["{$this->prefix}posttypes"] ) ) || ( ! is_array( $options["{$this->prefix}posttypes"] ) ) ) { + $options["{$this->prefix}posttypes"] = array(); + } + if ( ( ! isset( $options["{$this->prefix}taxonomies"] ) ) || ( ! is_array( $options["{$this->prefix}taxonomies"] ) ) ) { + $options["{$this->prefix}taxonomies"] = array(); + } + $options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], array( 'all' ) ); + $options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], array( 'all' ) ); - if ( !empty( $options["{$this->prefix}posttypes"] ) ) { - $post_counts = $this->get_all_post_counts( Array('post_type' => $options["{$this->prefix}posttypes"], 'post_status' => 'publish') ); + if ( ! empty( $options["{$this->prefix}posttypes"] ) ) { + $post_counts = $this->get_all_post_counts( array( + 'post_type' => $options["{$this->prefix}posttypes"], + 'post_status' => 'publish', + ) ); foreach ( $options["{$this->prefix}posttypes"] as $posttype ) { - if ( $post_counts[$posttype] === 0 ) continue; - if ( $this->paginate && ( $post_counts[$posttype] > $this->max_posts ) ) { - $count = 1; - for( $post_count = 0; $post_count < $post_counts[$posttype]; $post_count += $this->max_posts ) { - $this->do_write_sitemap( $posttype, $count - 1, $options["{$this->prefix}filename"] . "_{$posttype}_{$count}" ); - $count++; - } + if ( 0 === $post_counts[ $posttype ] ) { + continue; + } + if ( $this->paginate && ( $post_counts[ $posttype ] > $this->max_posts ) ) { + $count = 1; + for ( $post_count = 0; $post_count < $post_counts[ $posttype ]; $post_count += $this->max_posts ) { + $this->do_write_sitemap( $posttype, $count - 1, $options["{$this->prefix}filename"] . "_{$posttype}_{$count}" ); + $count ++; + } } else { $this->do_write_sitemap( $posttype ); } } } - - if ( !empty( $options["{$this->prefix}taxonomies"] ) ) - foreach( $options["{$this->prefix}taxonomies"] as $taxonomy ) { - $term_count = wp_count_terms( $taxonomy, array('hide_empty' => true) ); - if ( !is_wp_error( $term_count ) && ( $term_count > 0 ) ) { + + if ( ! empty( $options["{$this->prefix}taxonomies"] ) ) { + foreach ( $options["{$this->prefix}taxonomies"] as $taxonomy ) { + $term_count = wp_count_terms( $taxonomy, array( 'hide_empty' => true ) ); + if ( ! is_wp_error( $term_count ) && ( $term_count > 0 ) ) { if ( $this->paginate ) { if ( $term_count > $this->max_posts ) { $count = 1; - for( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) { + for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) { $this->do_write_sitemap( $taxonomy, $tc, $options["{$this->prefix}filename"] . "_{$taxonomy}_{$count}" ); - $count++; + $count ++; } } else { $this->do_write_sitemap( $taxonomy ); @@ -1041,97 +1744,156 @@ function do_indexed_sitemaps() { } } } + } $this->log_stats( 'indexed', $options["{$this->prefix}gzipped"], false ); } - + + /** + * Get simple sitemap. + * + * @return array + */ function get_simple_sitemap() { - $home = Array( - 'loc' => get_home_url(), - 'priority' => $this->get_default_priority( 'homepage' ), - 'changefreq' => $this->get_default_frequency( 'homepage' ) - ); - $posts = get_option( 'page_for_posts' ); + $home = array( + 'loc' => get_home_url(), + 'priority' => $this->get_default_priority( 'homepage' ), + 'changefreq' => $this->get_default_frequency( 'homepage' ), + ); + $posts = get_option( 'page_for_posts' ); $this->paginate = false; if ( $posts ) { $posts = $this->get_permalink( $posts ); - if ( $posts == $home['loc'] ) + if ( $posts == $home['loc'] ) { $posts = null; - else - $posts = Array( - 'loc' => $posts, - 'priority' => $this->get_default_priority( 'blog' ), - 'changefreq' => $this->get_default_frequency( 'blog' ) - ); - } - $child = $this->get_child_sitemap_urls(); + } else { + $posts = array( + 'loc' => $posts, + 'priority' => $this->get_default_priority( 'blog' ), + 'changefreq' => $this->get_default_frequency( 'blog' ), + ); + } + } + $child = $this->get_child_sitemap_urls(); $options = $this->options; - if ( is_array( $options["{$this->prefix}posttypes"] ) ) - $options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], Array( 'all' ) ); - if ( is_array( $options["{$this->prefix}taxonomies"] ) ) - $options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], Array( 'all' ) ); + if ( is_array( $options["{$this->prefix}posttypes"] ) ) { + $options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], array( 'all' ) ); + } + if ( is_array( $options["{$this->prefix}taxonomies"] ) ) { + $options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], array( 'all' ) ); + } $prio = $this->get_all_post_priority_data( $options["{$this->prefix}posttypes"] ); - if ( $this->option_isset( 'archive' ) ) $prio = array_merge( $prio, $this->get_archive_prio_data() ); - if ( $this->option_isset( 'author' ) ) $prio = array_merge( $prio, $this->get_author_prio_data() ); - foreach ( $prio as $k => $p ) - if ( untrailingslashit( $p['loc'] ) == untrailingslashit( $home['loc'] ) ) { - $prio[$k]['priority'] = '1.0'; - $home = null; + if ( $this->option_isset( 'archive' ) ) { + $prio = array_merge( $prio, $this->get_archive_prio_data() ); + } + if ( $this->option_isset( 'author' ) ) { + $prio = array_merge( $prio, $this->get_author_prio_data() ); + } + foreach ( $prio as $k => $p ) { + if ( untrailingslashit( $p['loc'] ) === untrailingslashit( $home['loc'] ) ) { + $prio[ $k ]['priority'] = '1.0'; + $home = null; break; } - if ( ( $posts != null ) && isset( $posts['loc'] ) ) - foreach ( $prio as $k => $p ) - if ( $p['loc'] == $posts['loc'] ) { - $prio[$k]['priority'] = $this->get_default_priority( 'blog' ); - $prio[$k]['changefreq'] = $this->get_default_frequency( 'blog' ); - $posts = null; + } + if ( ( null != $posts ) && isset( $posts['loc'] ) ) { + foreach ( $prio as $k => $p ) { + if ( $p['loc'] === $posts['loc'] ) { + $prio[ $k ]['priority'] = $this->get_default_priority( 'blog' ); + $prio[ $k ]['changefreq'] = $this->get_default_frequency( 'blog' ); + $posts = null; break; } - if ( is_array( $posts ) ) array_unshift( $prio, $posts ); - if ( is_array( $home ) ) array_unshift( $prio, $home ); + } + } + if ( is_array( $posts ) ) { + array_unshift( $prio, $posts ); + } + if ( is_array( $home ) ) { + array_unshift( $prio, $home ); + } $terms = get_terms( $options["{$this->prefix}taxonomies"], $this->get_tax_args() ); $prio2 = $this->get_term_priority_data( $terms ); $prio3 = $this->get_addl_pages_only(); - $prio = array_merge( $child, $prio, $prio2, $prio3 ); - if ( is_array( $this->extra_sitemaps ) ) - foreach( $this->extra_sitemaps as $sitemap_type ) { - $sitemap_data = Array(); + $prio = array_merge( $child, $prio, $prio2, $prio3 ); + if ( is_array( $this->extra_sitemaps ) ) { + foreach ( $this->extra_sitemaps as $sitemap_type ) { + $sitemap_data = array(); $sitemap_data = apply_filters( $this->prefix . 'custom_' . $sitemap_type, $sitemap_data, $page, $this_options ); - $prio = array_merge( $prio, $sitemap_data ); + $prio = array_merge( $prio, $sitemap_data ); } + } + return $prio; } - /** Build a single, stand-alone sitemap without indexes. **/ + /** + * Build a single, stand-alone sitemap without indexes. + * + * @param string $comment + * + * @return string + */ function do_simple_sitemap( $comment = '' ) { $sitemap_data = $this->get_simple_sitemap(); $sitemap_data = apply_filters( $this->prefix . 'data', $sitemap_data, 'root', 0, $this->options ); + return $this->build_sitemap( $sitemap_data, $comment ); } - - /** Output the XML for a sitemap. **/ + + /** + * Gets the sitemap URL. + * + * Has a filter for using something other than the dynamically generated one. + * Using the filter you need the full path to the custom xsl file. + * + * @see https://semperplugins.com/documentation/aioseop_sitemap_xsl_url/ + * + * @since 2.3.6 + */ + function get_sitemap_xsl() { + + return esc_url( apply_filters( 'aioseop_sitemap_xsl_url', home_url( '/sitemap.xsl' ) ) ); + } + + /** + * Output the XML for a sitemap. + * + * @param $urls + * @param string $comment + * + * @return null + */ function output_sitemap( $urls, $comment = '' ) { $max_items = 50000; - if ( !is_array( $urls ) ) return null; + if ( ! is_array( $urls ) ) { + return null; + } echo '' . "\r\n\r\n"; - echo "\r\n"; - $plugin_path = $this->plugin_path['url']; - $plugin_url = parse_url( $plugin_path ); + echo '\r\n"; + $plugin_path = $this->plugin_path['url']; + $plugin_url = parse_url( $plugin_path ); $current_host = $_SERVER['HTTP_HOST']; - if ( empty( $current_host ) ) $current_host = $_SERVER['SERVER_NAME']; - - if ( !empty( $current_host ) && ( $current_host != $plugin_url['host'] ) ) + if ( empty( $current_host ) ) { + $current_host = $_SERVER['SERVER_NAME']; + } + + if ( ! empty( $current_host ) && ( $current_host !== $plugin_url['host'] ) ) { $plugin_url['host'] = $current_host; - - //unset( $plugin_url['scheme'] ); + } + + // Code unset( $plugin_url['scheme'] );. $plugin_path = $this->unparse_url( $plugin_url ); - - $xml_header = '' . "\r\n" - . 'prefix . 'xml_namespace', Array( 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9' ) ); - if ( !empty( $namespaces ) ) { - $ns = Array(); - foreach( $namespaces as $k => $v ) { - $ns[] = esc_attr( $k ) . '=' . '"' . esc_url( $v, Array( 'http', 'https' ) ) . '"'; + + // Using the filter you need the full path to the custom xsl file. + $xsl_url = $this->get_sitemap_xsl(); + + $xml_header = '' . "\r\n" + . 'prefix . 'xml_namespace', array( 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9' ) ); + if ( ! empty( $namespaces ) ) { + $ns = array(); + foreach ( $namespaces as $k => $v ) { + $ns[] = esc_attr( $k ) . '=' . '"' . esc_url( $v, array( 'http', 'https' ) ) . '"'; } $xml_header .= join( "\r\n\t", $ns ); } @@ -1142,622 +1904,1012 @@ function output_sitemap( $urls, $comment = '' ) { echo "\t\r\n"; if ( is_array( $url ) ) { foreach ( $url as $k => $v ) { - if ( !empty( $v ) ) { - if ( $k == 'loc' ) $v = esc_url( $v ); - if ( is_array( $v ) ) { - $buf = "\t\t\t<$k>\r\n"; - foreach( $v as $ext => $attr ) { - if ( is_array( $attr ) ) { - $buf = ''; - echo "\t\t<$k>\r\n"; - foreach( $attr as $a => $nested ) { - if ( is_array( $nested ) ) { - echo "\t\t\t<$a>\r\n"; - foreach( $nested as $next => $nattr ) { - echo "\t\t\t\t<$next>$nattr\r\n"; - } - echo "\t\t\t\r\n"; - } else echo "\t\t\t<$a>$nested\r\n"; + if ( ! empty( $v ) ) { + if ( 'loc' === $k ) { + $v = esc_url( $v ); + } + if ( is_array( $v ) ) { + $buf = "\t\t\t<$k>\r\n"; + foreach ( $v as $ext => $attr ) { + if ( is_array( $attr ) ) { + $buf = ''; + echo "\t\t<$k>\r\n"; + foreach ( $attr as $a => $nested ) { + if ( is_array( $nested ) ) { + echo "\t\t\t<$a>\r\n"; + foreach ( $nested as $next => $nattr ) { + echo "\t\t\t\t<$next>$nattr\r\n"; + } + echo "\t\t\t\r\n"; + } else { + echo "\t\t\t<$a>$nested\r\n"; } - echo "\t\t\r\n"; - } else $buf .= "\t\t\t<$ext>$attr\r\n"; + } + echo "\t\t\r\n"; + } else { + $buf .= "\t\t\t<$ext>$attr\r\n"; } - if ( !empty( $buf ) ) echo $buf . "\t\t\r\n"; - } else echo "\t\t<$k>$v\r\n"; + } + if ( ! empty( $buf ) ) { + echo $buf . "\t\t\r\n"; + } + } else { + echo "\t\t<$k>$v\r\n"; + } } } } else { echo "\t\t" . esc_url( $url ) . "\r\n"; } echo "\t\r\n"; - if ( $count >= $max_items ) break; + if ( $count >= $max_items ) { + break; + } } echo ''; } - - /** Output the XML for a sitemap index. **/ + + /** + * Output the XML for a sitemap index. + * + * @param $urls + * @param string $comment + * + * @return null + */ function output_sitemap_index( $urls, $comment = '' ) { $max_items = 50000; - if ( !is_array( $urls ) ) return null; + if ( ! is_array( $urls ) ) { + return null; + } echo '' . "\r\n\r\n"; - echo "\r\n"; - echo '' . "\r\n"; + echo '\r\n"; + $xsl_url = $this->get_sitemap_xsl(); + echo '' . "\r\n"; echo '' . "\r\n"; $count = 0; foreach ( $urls as $url ) { echo "\t\r\n"; if ( is_array( $url ) ) { foreach ( $url as $k => $v ) { - if ( $k == 'loc' ) { + if ( 'loc' === $k ) { echo "\t\t<$k>" . esc_url( $v ) . "\r\n"; - } elseif ( $k == 'lastmod' ) { - echo "\t\t<$k>$v\r\n"; + } elseif ( 'lastmod' === $k ) { + echo "\t\t<$k>$v\r\n"; } } } else { echo "\t\t" . esc_url( $url ) . "\r\n"; } echo "\t\r\n"; - $count++; - if ( $count >= $max_items ) break; + $count ++; + if ( $count >= $max_items ) { + break; + } } echo ''; } - - /** Return an XML sitemap index as a string. **/ + + /** + * Return an XML sitemap index as a string. + * + * @param $urls + * @param string $comment + * + * @return string + */ function build_sitemap_index( $urls, $comment = '' ) { ob_start(); $this->output_sitemap_index( $urls, $comment ); + return ob_get_clean(); } - - /** Return an XML sitemap as a string. **/ + + /** + * Return an XML sitemap as a string. + * + * @param $urls + * @param string $comment + * + * @return string + */ function build_sitemap( $urls, $comment = '' ) { ob_start(); $this->output_sitemap( $urls, $comment ); + return ob_get_clean(); } - /** Return sitemap data for an array of terms. **/ + /** + * Return sitemap data for an array of terms. + * + * @param $terms + * + * @return array + */ function get_term_priority_data( $terms ) { - $prio = Array(); - if (is_array( $terms ) ) { + $prio = array(); + if ( is_array( $terms ) ) { $def_prio = $this->get_default_priority( 'taxonomies' ); $def_freq = $this->get_default_frequency( 'taxonomies' ); - foreach ($terms as $term) { - $pr_info = Array(); + foreach ( $terms as $term ) { + $pr_info = array(); $pr_info['loc'] = $this->get_term_link( $term, $term->taxonomy ); - if ( ( $this->options[ $this->prefix . 'prio_taxonomies' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] ) ) && ( $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] != 'no' ) ) { - $pr_info['priority'] = $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ]; - } else $pr_info['priority'] = $def_prio; - if ( ( $this->options[ $this->prefix . 'freq_taxonomies' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] ) ) && ( $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] != 'no' ) ) { - $pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ]; - } else $pr_info['changefreq'] = $def_freq; + if ( ( 'sel' === $this->options[ $this->prefix . 'prio_taxonomies' ] ) && isset( $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] ) && ( 'no' != $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] ) ) { + $pr_info['priority'] = $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ]; + } else { + $pr_info['priority'] = $def_prio; + } + if ( ( 'sel' === $this->options[ $this->prefix . 'freq_taxonomies' ] ) && isset( $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] ) && ( 'no' != $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] ) ) { + $pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ]; + } else { + $pr_info['changefreq'] = $def_freq; + } $prio[] = $pr_info; } } + return $prio; } - /** Return a list of permalinks for an array of terms. **/ + /** + * Return a list of permalinks for an array of terms. + * + * @param $terms + * + * @return array + */ function get_term_permalinks( $terms ) { - $links = Array(); - if (is_array($terms)) { - foreach ($terms as $term) { - $url = $this->get_term_link( $term ); + $links = array(); + if ( is_array( $terms ) ) { + foreach ( $terms as $term ) { + $url = $this->get_term_link( $term ); $links[] = $url; } } + return $links; } - - /** Return permalinks for archives. **/ + + /** + * Return permalinks for archives. + * + * @param $posts + * + * @return array + */ function get_archive_permalinks( $posts ) { - $links = Array(); - $archives = Array(); - if (is_array( $posts) ) + $links = array(); + $archives = array(); + if ( is_array( $posts ) ) { foreach ( $posts as $post ) { - $date = mysql2date( 'U', $post->post_date ); - $year = date( 'Y', $date ); - $month = date( 'm', $date ); - $archives[ $year . '-' . $month ] = Array( $year, $month ); - } + $date = mysql2date( 'U', $post->post_date ); + $year = date( 'Y', $date ); + $month = date( 'm', $date ); + $archives[ $year . '-' . $month ] = array( $year, $month ); + } + } $archives = array_keys( $archives ); - foreach( $archives as $d ) $links[] = get_month_link( $d[0], $d[1] ); + foreach ( $archives as $d ) { + $links[] = get_month_link( $d[0], $d[1] ); + } + return $links; } - - /** Return permalinks for authors. **/ + + /** + * Return permalinks for authors. + * + * @param $posts + * + * @return array + */ function get_author_permalinks( $posts ) { - $links = Array(); - $authors = Array(); - if (is_array( $posts) ) - foreach ( $posts as $post ) + $links = array(); + $authors = array(); + if ( is_array( $posts ) ) { + foreach ( $posts as $post ) { $authors[ $post->author_id ] = 1; + } + } $authors = array_keys( $authors ); - foreach( $authors as $auth_id ) $links[] = get_author_posts_url( $auth_id ); + foreach ( $authors as $auth_id ) { + $links[] = get_author_posts_url( $auth_id ); + } + return $links; } - /** Return permalinks for posts. **/ + /** + * Return permalinks for posts. + * + * @param $posts + * + * @return array + */ function get_post_permalinks( $posts ) { - $links = Array(); - if (is_array( $posts) ) + $links = array(); + if ( is_array( $posts ) ) { foreach ( $posts as $post ) { - $post->filter = "sample"; - $url = $this->get_permalink( $post ); - $links[] = $url; + $post->filter = 'sample'; + $url = $this->get_permalink( $post ); + $links[] = $url; } + } + return $links; } - - /** Convert back from parse_url -- props to thomas at gielfeldt dot com, http://www.php.net/manual/en/function.parse-url.php#106731 **/ - function unparse_url($parsed_url) { - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; - $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; - if ( !empty( $host ) && empty( $scheme ) ) $scheme = '//'; - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; - $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; - $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; - $pass = ($user || $pass) ? "$pass@" : ''; - $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; - $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; - $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; - return "$scheme$user$pass$host$port$path$query$fragment"; - } - - /** Return data for user entered additional pages. **/ + + /** + * Convert back from parse_url. + * + * Props to thomas at gielfeldt dot com. + * + * @link http://www.php.net/manual/en/function.parse-url.php#106731 + * + * @param $parsed_url + * + * @return string + */ + function unparse_url( $parsed_url ) { + $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : ''; + $host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : ''; + if ( ! empty( $host ) && empty( $scheme ) ) { + $scheme = '//'; + } + $port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : ''; + $user = isset( $parsed_url['user'] ) ? $parsed_url['user'] : ''; + $pass = isset( $parsed_url['pass'] ) ? ':' . $parsed_url['pass'] : ''; + $pass = ( $user || $pass ) ? "$pass@" : ''; + $path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : ''; + $query = isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : ''; + $fragment = isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : ''; + + return "$scheme$user$pass$host$port$path$query$fragment"; + } + + /** + * Gets additional pages. + * + * Return data for user entered additional pages. + * + * @return array|mixed|void + */ function get_addl_pages_only() { - $pages = Array(); - if ( !empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) { + $pages = array(); + if ( ! empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) { $siteurl = parse_url( get_home_url() ); - foreach( $this->options[ $this->prefix . 'addl_pages' ] as $k => $v ) { + foreach ( $this->options[ $this->prefix . 'addl_pages' ] as $k => $v ) { $url = parse_url( $k ); - if ( empty( $url['scheme'] ) ) $url['scheme'] = $siteurl['scheme']; - if ( empty( $url['host'] ) ) $url['host'] = $siteurl['host']; + if ( empty( $url['scheme'] ) ) { + $url['scheme'] = $siteurl['scheme']; + } + if ( empty( $url['host'] ) ) { + $url['host'] = $siteurl['host']; + } + if ( ! empty( $url['path'] ) && substr( $url['path'], 0, 1 ) !== '/' ) { + $url['path'] = '/' . $url['path']; + } $freq = $prio = $mod = ''; - if ( !empty( $v['mod'] ) ) $mod = $v['mod']; - if ( !empty( $v['freq'] ) ) $freq = $v['freq']; - if ( !empty( $v['prio'] ) ) $prio = $v['prio']; - if ( $freq == 'no' ) $freq = ''; - if ( $prio == 'no' ) $prio = ''; - $mod = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $mod ) ); - $pages[] = Array( 'loc' => $this->unparse_url( $url ), 'lastmod' => $mod, 'changefreq' => $freq, 'priority' => $prio ); + if ( ! empty( $v['mod'] ) ) { + $mod = $v['mod']; + } + if ( ! empty( $v['freq'] ) ) { + $freq = $v['freq']; + } + if ( ! empty( $v['prio'] ) ) { + $prio = $v['prio']; + } + if ( 'no' == $freq ) { + $freq = ''; + } + if ( 'no' == $prio ) { + $prio = ''; + } + $mod = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $mod ) ); + $pages[] = array( + 'loc' => $this->unparse_url( $url ), + 'lastmod' => $mod, + 'changefreq' => $freq, + 'priority' => $prio, + ); } } $pages = apply_filters( $this->prefix . 'addl_pages_only', $pages ); + return $pages; } - /** Return data for user entered additional pages and extra pages. **/ + /** + * Return data for user entered additional pages and extra pages. + * + * @return array|mixed|void + */ function get_addl_pages() { - $home = Array(); - $home = Array( - 'loc' => get_home_url(), - 'priority' => $this->get_default_priority( 'homepage' ), - 'changefreq' => $this->get_default_frequency( 'homepage' ) - ); + $home = array(); + $home = array( + 'loc' => get_home_url(), + 'priority' => $this->get_default_priority( 'homepage' ), + 'changefreq' => $this->get_default_frequency( 'homepage' ), + ); $posts = get_option( 'page_for_posts' ); if ( $posts ) { $posts = $this->get_permalink( $posts ); - if ( $posts == $home['loc'] ) - $posts = Array(); - else - $posts = Array( - 'loc' => $posts, - 'priority' => $this->get_default_priority( 'blog' ), - 'changefreq' => $this->get_default_frequency( 'blog' ) - ); - } else $posts = Array(); + if ( $posts == $home['loc'] ) { + $posts = array(); + } else { + $posts = array( + 'loc' => $posts, + 'priority' => $this->get_default_priority( 'blog' ), + 'changefreq' => $this->get_default_frequency( 'blog' ), + ); + } + } else { + $posts = array(); + } $pages = $this->get_addl_pages_only(); - if ( !empty( $home ) ) + if ( ! empty( $home ) ) { $pages[] = $home; - if ( !empty( $posts ) ) + } + if ( ! empty( $posts ) ) { $pages[] = $posts; + } $pages = apply_filters( $this->prefix . 'addl_pages', $pages ); + return $pages; } - - /** Return links for user entered additional pages. **/ + + /** + * Return links for user entered additional pages. + * + * @return array + */ function get_addl_page_links() { - if ( !empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) + if ( ! empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) { return array_keys( $this->options[ $this->prefix . 'addl_pages' ] ); - return Array(); + } + + return array(); } - - /** Scores posts based on date and relative comment count, if any. **/ + + /** + * Scores posts based on date and relative comment count, if any. + * + * @param $date + * @param int $stats + * + * @return array + */ function get_prio_calc( $date, $stats = 0 ) { static $cur_time = null; - if ($cur_time === null) $cur_time = time(); + if ( null === $cur_time ) { + $cur_time = time(); + } $time = $cur_time - mysql2date( 'U', $date ); - if ( !empty( $stats ) && isset( $stats['max'] ) && ( $stats['max'] ) ) { + if ( ! empty( $stats ) && isset( $stats['max'] ) && $stats['max'] ) { $minadj = $time >> 3; $maxadj = $time >> 1; - $avg = $stats['count'] / $stats['total']; - $calc = ( $stats['comment_count'] - $stats['min'] ) / $stats['max']; - $calc = $maxadj * $calc; - if ( $avg < $stats['comment_count'] ) + $avg = $stats['count'] / $stats['total']; + $calc = ( $stats['comment_count'] - $stats['min'] ) / $stats['max']; + $calc = $maxadj * $calc; + if ( $avg < $stats['comment_count'] ) { $minadj = $time >> 2; - else + } else { $maxadj = $time >> 2; - if ( $calc > $maxadj ) $calc = $maxadj; - if ( $calc < $minadj ) $calc = $minadj; + } + if ( $calc > $maxadj ) { + $calc = $maxadj; + } + if ( $calc < $minadj ) { + $calc = $minadj; + } $time -= $calc; } - $days = $time / ( 60 * 60 * 24 ); - $prio_table = Array( - 'daily' => 7, - 'weekly' => 30, + $days = $time / ( 60 * 60 * 24 ); + $prio_table = array( + 'daily' => 7, + 'weekly' => 30, 'monthly' => 210, - 'yearly' => null + 'yearly' => null, ); - $interval = 1.0; - $prev_days = 0; - foreach ($prio_table as $change => $max_days) { - $interval -= 0.3; - if ( $max_days === null) { - $changefreq = $change; - $prio = 0.1; - break; - } - if ($days < $max_days) { - $int_days_max = $max_days - $prev_days; - $int_days = $days - $prev_days; - $prio = $interval + ( ( int ) ( 3 * ( ( $max_days - $int_days ) / $int_days_max ) ) / 10.0 ); - $changefreq = $change; - break; - } - $prev_days = $max_days; + $interval = 1.0; + $prev_days = 0; + foreach ( $prio_table as $change => $max_days ) { + $interval -= 0.3; + if ( null === $max_days ) { + $changefreq = $change; + $prio = 0.1; + break; + } + if ( $days < $max_days ) { + $int_days_max = $max_days - $prev_days; + $int_days = $days - $prev_days; + $prio = $interval + ( ( int ) ( 3 * ( ( $max_days - $int_days ) / $int_days_max ) ) / 10.0 ); + $changefreq = $change; + break; + } + $prev_days = $max_days; } - return Array( 'lastmod' => $date, 'changefreq' => $changefreq, 'priority' => $prio ); + + return array( 'lastmod' => $date, 'changefreq' => $changefreq, 'priority' => $prio ); } - - /** Generate sitemap priority data for archives from an array of posts. **/ + + /** + * Generate sitemap priority data for archives from an array of posts. + * + * @param $posts + * + * @return array + */ function get_archive_prio_from_posts( $posts ) { - $archives = Array(); - if ( is_array( $posts ) ) - foreach( $posts as $p ) { - if ( $p->post_type != 'post' ) continue; + $archives = array(); + if ( is_array( $posts ) ) { + foreach ( $posts as $p ) { + if ( 'post' !== $p->post_type ) { + continue; + } $date = date( 'Y-m', mysql2date( 'U', $p->post_date ) ); if ( empty( $archives[ $date ] ) ) { $archives[ $date ] = $p; } else { - if ( $p->post_modified > $archives[ $date ]->post_modified ) + if ( $p->post_modified > $archives[ $date ]->post_modified ) { $archives[ $date ] = $p; + } } } - if ( !empty( $archives ) ) - return $this->get_prio_from_posts( $archives, $this->get_default_priority( 'archive', true ), $this->get_default_frequency( 'archive', true ), Array( $this, 'get_archive_link_from_post' ) ); + } + if ( ! empty( $archives ) ) { + return $this->get_prio_from_posts( $archives, $this->get_default_priority( 'archive', true ), $this->get_default_frequency( 'archive', true ), array( + $this, + 'get_archive_link_from_post', + ) ); + } + return $archives; } - - /** Return an archive link from a post. **/ + + /** + * Return an archive link from a post. + * + * @param $post + * + * @return bool|string + */ function get_archive_link_from_post( $post ) { - if ( $post->post_type != 'post' ) return false; + if ( 'post' !== $post->post_type ) { + return false; + } $date = mysql2date( 'U', $post->post_date ); + return get_month_link( date( 'Y', $date ), date( 'm', $date ) ); } - - /** Generate sitemap priority data for authors from an array of posts. **/ + + /** + * Generate sitemap priority data for authors from an array of posts. + * + * @param $posts + * + * @return array + */ function get_author_prio_from_posts( $posts ) { - $authors = Array(); - if ( is_array( $posts ) ) - foreach( $posts as $p ) { - if ( $p->post_type != 'post' ) continue; + $authors = array(); + if ( is_array( $posts ) ) { + foreach ( $posts as $p ) { + if ( 'post' !== $p->post_type ) { + continue; + } if ( empty( $authors[ $p->post_author ] ) ) { $authors[ $p->post_author ] = $p; } else { - if ( $p->post_modified > $authors[ $p->post_author ]->post_modified ) + if ( $p->post_modified > $authors[ $p->post_author ]->post_modified ) { $authors[ $p->post_author ] = $p; + } } + } } - return $this->get_prio_from_posts( $authors, $this->get_default_priority( 'author', true ), $this->get_default_frequency( 'author', true ), Array( $this, 'get_author_link_from_post' ) ); + + return $this->get_prio_from_posts( $authors, $this->get_default_priority( 'author', true ), $this->get_default_frequency( 'author', true ), array( + $this, + 'get_author_link_from_post', + ) ); } - - /** Return an author link from a post. **/ + + /** + * Return an author link from a post. + * + * @param $post + * + * @return string + */ function get_author_link_from_post( $post ) { return get_author_posts_url( $post->post_author ); } - - /** Return comment statistics on an array of posts. **/ + + /** + * Return comment statistics on an array of posts. + * + * @param $posts + * + * @return array|int + */ function get_comment_count_stats( $posts ) { $count = 0; $total = 0.0; - $min = null; - $max = 0; - if ( is_array( $posts ) ) - foreach ( $posts as $post ) - if ( !empty( $post->comment_count ) ) { + $min = null; + $max = 0; + if ( is_array( $posts ) ) { + foreach ( $posts as $post ) { + if ( ! empty( $post->comment_count ) ) { $cnt = $post->comment_count; - $count++; + $count ++; $total += $cnt; - if ( $min === null ) $min = $cnt; - if ( $max < $cnt ) $max = $cnt; - if ( $min > $cnt ) $min = $cnt; + if ( null === $min ) { + $min = $cnt; + } + if ( $max < $cnt ) { + $max = $cnt; + } + if ( $min > $cnt ) { + $min = $cnt; + } } - if ( $count ) - return Array( 'max' => $max, 'min' => $min, 'total' => $total, 'count' => $cnt ); - else + } + } + if ( $count ) { + return array( 'max' => $max, 'min' => $min, 'total' => $total, 'count' => $cnt ); + } else { return 0; + } } - - /** Generate sitemap priority data from an array of posts. **/ + + /** + * Generate sitemap priority data from an array of posts. + * + * @param $posts + * @param bool $prio_override + * @param bool $freq_override + * @param string $linkfunc + * + * @return array + */ function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) { - $prio = Array(); - $args = Array( 'prio_override' => $prio_override, 'freq_override' => $freq_override, 'linkfunc' => $linkfunc ); - if ( ( $prio_override ) && ( $freq_override ) ) + $prio = array(); + $args = array( + 'prio_override' => $prio_override, + 'freq_override' => $freq_override, + 'linkfunc' => $linkfunc, + ); + if ( $prio_override && $freq_override ) { $stats = 0; - else + } else { $stats = $this->get_comment_count_stats( $posts ); + } if ( is_array( $posts ) ) { foreach ( $posts as $post ) { - $url = ''; - $post->filter = "sample"; - if ( $linkfunc == 'get_permalink' ) + $url = ''; + $post->filter = 'sample'; + if ( 'get_permalink' === $linkfunc ) { $url = $this->get_permalink( $post ); - else + } else { $url = call_user_func( $linkfunc, $post ); + } $date = $post->post_modified; - if ( '0000-00-00 00:00:00' === $date ) + if ( '0000-00-00 00:00:00' === $date ) { $date = $post->post_date; - if ( '0000-00-00 00:00:00' !== $date ) + } + if ( '0000-00-00 00:00:00' !== $date ) { $date = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $date ) ); - else + } else { $date = 0; - if ( ( $prio_override ) && ( $freq_override ) ) - $pr_info = Array( 'lastmod' => $date, 'changefreq' => null, 'priority' => null ); - else { - if ( empty( $post->comment_count ) ) + } + if ( $prio_override && $freq_override ) { + $pr_info = array( 'lastmod' => $date, 'changefreq' => null, 'priority' => null ); + } else { + if ( empty( $post->comment_count ) ) { $stat = 0; - else + } else { $stat = $stats; - if ( !empty( $stat ) ) $stat['comment_count'] = $post->comment_count; + } + if ( ! empty( $stat ) ) { + $stat['comment_count'] = $post->comment_count; + } $pr_info = $this->get_prio_calc( $date, $stat ); } - if ( $prio_override ) - $pr_info[ 'priority' ] = $prio_override; - if ( $freq_override ) - $pr_info[ 'changefreq' ] = $freq_override; - if ( ( $this->options[ $this->prefix . 'prio_post' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) ) ) { - if ( ( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] != 'no' ) && ( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] != 'sel' ) ) - $pr_info[ 'priority' ] = $this->options[ $this->prefix . 'prio_post_' . $post->post_type ]; + if ( $prio_override ) { + $pr_info['priority'] = $prio_override; + } + if ( $freq_override ) { + $pr_info['changefreq'] = $freq_override; + } + if ( ( 'sel' === $this->options[ $this->prefix . 'prio_post' ] ) && isset( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) ) { + if ( ( 'no' != $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) && ( 'sel' !== $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) ) { + $pr_info['priority'] = $this->options[ $this->prefix . 'prio_post_' . $post->post_type ]; + } + } + if ( ( 'sel' === $this->options[ $this->prefix . 'freq_post' ] ) && isset( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) ) { + if ( ( 'no' != $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) && ( 'sel' !== $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) ) { + $pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_post_' . $post->post_type ]; + } } - if ( ( $this->options[ $this->prefix . 'freq_post' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) ) ) { - if ( ( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] != 'no' ) && ( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] != 'sel' ) ) - $pr_info[ 'changefreq' ] = $this->options[ $this->prefix . 'freq_post_' . $post->post_type ]; + $pr_info = array( 'loc' => $url ) + $pr_info; // Prepend loc to the array. + if ( is_float( $pr_info['priority'] ) ) { + $pr_info['priority'] = sprintf( '%0.1F', $pr_info['priority'] ); } - $pr_info['loc'] = $url; - if ( is_float( $pr_info['priority'] ) ) $pr_info['priority'] = sprintf( "%0.1F", $pr_info['priority'] ); $pr_info = apply_filters( $this->prefix . 'prio_item_filter', $pr_info, $post, $args ); - if ( !empty( $pr_info ) ) + if ( ! empty( $pr_info ) ) { $prio[] = $pr_info; + } } } + return $prio; } - /** Return excluded categories for taxonomy queries. **/ + /** + * Return excluded categories for taxonomy queries. + * + * @param int $page + * + * @return array + */ function get_tax_args( $page = 0 ) { - $args = Array(); - if ( $this->option_isset( 'excl_categories' ) ) - $args['exclude'] = $this->options[ $this->prefix . 'excl_categories']; + $args = array(); + if ( $this->option_isset( 'excl_categories' ) ) { + $args['exclude'] = $this->options[ $this->prefix . 'excl_categories' ]; + } if ( $this->paginate ) { $args['number'] = $this->max_posts; $args['offset'] = $page * $this->max_posts; - + } + return $args; } - /** Return excluded categories and pages for post queries. **/ + /** + * Return excluded categories and pages for post queries. + * + * @param $args + * + * @return mixed + */ function set_post_args( $args ) { if ( $this->option_isset( 'excl_categories' ) ) { - $cats = Array(); - foreach( $this->options[ $this->prefix . 'excl_categories'] as $c ) $cats[] = -$c; + $cats = array(); + foreach ( $this->options[ $this->prefix . 'excl_categories' ] as $c ) { + $cats[] = - $c; + } $args['category'] = implode( ',', $cats ); } - if ( $this->option_isset( 'excl_pages' ) ) + if ( $this->option_isset( 'excl_pages' ) ) { $args['exclude'] = $this->options[ $this->prefix . 'excl_pages' ]; + } + return $args; } - - /** Return sitemap data for archives. **/ + + /** + * Return sitemap data for archives. + * + * @return array + */ function get_archive_prio_data() { - $args = Array( 'numberposts' => 50000, 'post_type' => 'post' ); - $args = $this->set_post_args( $args ); + $args = array( 'numberposts' => 50000, 'post_type' => 'post' ); + $args = $this->set_post_args( $args ); $posts = $this->get_all_post_type_data( $args ); + return $this->get_archive_prio_from_posts( $posts ); } - - /** Return sitemap data for authors. **/ + + /** + * Return sitemap data for authors. + * + * @return array + */ function get_author_prio_data() { - $args = Array( 'numberposts' => 50000, 'post_type' => 'post' ); - $args = $this->set_post_args( $args ); + $args = array( 'numberposts' => 50000, 'post_type' => 'post' ); + $args = $this->set_post_args( $args ); $posts = $this->get_all_post_type_data( $args ); + return $this->get_author_prio_from_posts( $posts ); } - /** Return sitemap data for posts. **/ + /** + * Return sitemap data for posts. + * + * @param string $include + * @param string $status + * @param int $page + * + * @return array + */ function get_all_post_priority_data( $include = 'any', $status = 'publish', $page = 0 ) { - $posts = $page_query = Array(); - if ( $this->paginate ) - $page_query = Array( 'offset' => $page * $this->max_posts ); - if ( ( $status == 'publish' ) && ( $include == 'attachment' ) ) $status = 'inherit'; + $posts = $page_query = array(); + if ( $this->paginate ) { + $page_query = array( 'offset' => $page * $this->max_posts ); + } + if ( ( 'publish' === $status ) && ( 'attachment' === $include ) ) { + $status = 'inherit'; + } if ( is_array( $include ) && ( ( $pos = array_search( 'attachment', $include ) ) !== false ) ) { - unset( $include[$pos] ); - $att_args = Array( 'post_type' => 'attachment', 'post_status' => 'inherit' ); + unset( $include[ $pos ] ); + $att_args = array( 'post_type' => 'attachment', 'post_status' => 'inherit' ); $att_args = array_merge( $att_args, $page_query ); - $posts = $this->get_all_post_type_data( $att_args ); + $posts = $this->get_all_post_type_data( $att_args ); } - $args = Array( 'post_type' => $include, 'post_status' => $status ); - $args = array_merge( $args, $page_query ); - $args = $this->set_post_args( $args ); + $args = array( 'post_type' => $include, 'post_status' => $status ); + $args = array_merge( $args, $page_query ); + $args = $this->set_post_args( $args ); $posts = array_merge( $this->get_all_post_type_data( $args ), $posts ); + return $this->get_prio_from_posts( $posts, $this->get_default_priority( 'post', true ), $this->get_default_frequency( 'post', true ) ); } - /** Return a list of all permalinks. **/ + /** + * Return a list of all permalinks. + * + * @param string $include + * @param string $status + * + * @return array + */ function get_all_permalinks( $include = 'any', $status = 'publish' ) { - $args = Array( 'post_type' => $include, 'post_status' => $status ); - $args = $this->set_post_args( $args ); + $args = array( 'post_type' => $include, 'post_status' => $status ); + $args = $this->set_post_args( $args ); $posts = $this->get_all_post_type_data( $args ); $links = $this->get_post_permalinks( $posts ); - if ( $this->option_isset( 'archive' ) ) + if ( $this->option_isset( 'archive' ) ) { $links = array_merge( $links, $this->get_archive_permalinks( $posts ) ); - if ( $this->option_isset( 'author' ) ) + } + if ( $this->option_isset( 'author' ) ) { $links = array_merge( $links, $this->get_author_permalinks( $posts ) ); + } + return $links; } - - /** Static memory cache for permalink_structure option. **/ + + /** + * Static memory cache for permalink_structure option. + * + * @param $pre + * + * @return null + */ function cache_structure( $pre ) { return $this->cache_struct; } - - /** Static memory cache for home option. **/ + + /** + * Static memory cache for home option. + * + * @param $pre + * + * @return null + */ function cache_home( $pre ) { return $this->cache_home; } - - /** Cache permalink_structure and home for repeated sitemap queries. **/ + + /** + * Cache permalink_structure and home for repeated sitemap queries. + */ function cache_options() { static $start = true; if ( $start ) { $this->cache_struct = get_option( 'permalink_structure' ); - if ( !empty( $this->cache_struct ) ) add_filter( 'pre_option_permalink_structure', Array( $this, 'cache_structure' ) ); + if ( ! empty( $this->cache_struct ) ) { + add_filter( 'pre_option_permalink_structure', array( $this, 'cache_structure' ) ); + } $this->cache_home = get_option( 'home' ); - if ( !empty( $this->cache_home ) ) add_filter( 'pre_option_home', Array( $this, 'cache_home' ) ); + if ( ! empty( $this->cache_home ) ) { + add_filter( 'pre_option_home', array( $this, 'cache_home' ) ); + } $start = false; } } - /** Call get_term_link with caching in place. **/ + /** + * Call get_term_link with caching in place. + * + * @param $term + * @param string $taxonomy + * + * @return string|WP_Error + */ function get_term_link( $term, $taxonomy = '' ) { static $start = true; if ( $start ) { $this->cache_options(); $start = false; } + return get_term_link( $term, $taxonomy ); } - - /** Call get_permalink with caching in place. **/ + + /** + * Call get_permalink with caching in place. + * + * @param $post + * + * @return false|string + */ function get_permalink( $post ) { static $start = true; if ( $start ) { $this->cache_options(); $start = false; } + return get_permalink( $post ); } - - /** Return term counts using wp_count_terms(). **/ + + /** + * Return term counts using wp_count_terms(). + * + * @param $args + * + * @return array|int|mixed|null|void|WP_Error + */ function get_all_term_counts( $args ) { $term_counts = null; - if ( !empty( $args ) && !empty( $args['taxonomy'] ) ) - if ( !is_array( $args['taxonomy'] ) || ( count( $args['taxonomy'] ) == 1 ) ) { - if ( is_array( $args['taxonomy'] ) ) + if ( ! empty( $args ) && ! empty( $args['taxonomy'] ) ) { + if ( ! is_array( $args['taxonomy'] ) || ( count( $args['taxonomy'] ) == 1 ) ) { + if ( is_array( $args['taxonomy'] ) ) { $args['taxonomy'] = array_shift( $args['taxonomy'] ); - $term_counts = wp_count_terms( $args['taxonomy'], array('hide_empty' => true) ); - } else - foreach( $args['taxonomy'] as $taxonomy ) { - if ( $taxonomy === 'all' ) continue; - $term_counts[$taxonomy] = wp_count_terms( $taxonomy, array('hide_empty' => true) ); } + $term_counts = wp_count_terms( $args['taxonomy'], array( 'hide_empty' => true ) ); + } else { + foreach ( $args['taxonomy'] as $taxonomy ) { + if ( 'all' === $taxonomy ) { + continue; + } + $term_counts[ $taxonomy ] = wp_count_terms( $taxonomy, array( 'hide_empty' => true ) ); + } + } + } $term_counts = apply_filters( $this->prefix . 'term_counts', $term_counts, $args ); + return $term_counts; } - - /** Return post counts using wp_count_posts(). **/ + + /** + * Return post counts using wp_count_posts(). + * + * @param $args + * + * @return mixed|null|void + */ function get_all_post_counts( $args ) { $post_counts = null; - $status = 'inherit'; - if ( !empty( $args['post_status'] ) ) $status = $args['post_status']; - if ( !empty( $args ) && !empty( $args['post_type'] ) ) - if ( !is_array( $args['post_type'] ) || ( count( $args['post_type'] ) == 1 ) ) { - if ( is_array( $args['post_type'] ) ) + $status = 'inherit'; + if ( ! empty( $args['post_status'] ) ) { + $status = $args['post_status']; + } + if ( ! empty( $args ) && ! empty( $args['post_type'] ) ) { + if ( ! is_array( $args['post_type'] ) || ( count( $args['post_type'] ) == 1 ) ) { + if ( is_array( $args['post_type'] ) ) { $args['post_type'] = array_shift( $args['post_type'] ); - $count = (Array)wp_count_posts( $args['post_type'] ); - $post_counts = $count[$status]; - } else - foreach( $args['post_type'] as $post_type ) { - if ( $post_type === 'all' ) continue; - $count = (Array)wp_count_posts( $post_type ); - - if ( empty( $count ) ) - $post_counts[$post_type] = 0; - else { - if ( $post_type == 'attachment' ) - $post_counts[$post_type] = $count['inherit']; - else - $post_counts[$post_type] = $count[$status]; + } + $count = (Array) wp_count_posts( $args['post_type'] ); + $post_counts = $count[ $status ]; + } else { + foreach ( $args['post_type'] as $post_type ) { + if ( 'all' === $post_type ) { + continue; + } + $count = (Array) wp_count_posts( $post_type ); + + if ( empty( $count ) ) { + $post_counts[ $post_type ] = 0; + } else { + if ( 'attachment' === $post_type ) { + $post_counts[ $post_type ] = $count['inherit']; + } else { + $post_counts[ $post_type ] = $count[ $status ]; + } } } + } + } $post_counts = apply_filters( $this->prefix . 'post_counts', $post_counts, $args ); + return $post_counts; } - + + /** + * Get total post count. + * + * @param $args + * + * @return int|mixed|null|void + */ function get_total_post_count( $args ) { - $total = 0; + $total = 0; $counts = $this->get_all_post_counts( $args ); - if ( !empty( $counts ) ) - if ( is_array( $counts ) ) - foreach( $counts as $count ) + if ( ! empty( $counts ) ) { + if ( is_array( $counts ) ) { + foreach ( $counts as $count ) { $total += $count; - else + } + } else { $total = $counts; + } + } + return $total; } - /** Return post data using get_posts(). **/ + /** + * Return post data using get_posts(). + * + * @param $args + * + * @return array|mixed|void + */ function get_all_post_type_data( $args ) { $defaults = array( - 'numberposts' => $this->max_posts, 'offset' => 0, - 'category' => 0, 'orderby' => 'post_date', - 'order' => 'DESC', 'include' => array(), - 'exclude' => array(), 'post_type' => 'any', - 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 'meta_query' => '', + 'numberposts' => $this->max_posts, + 'offset' => 0, + 'category' => 0, + 'orderby' => 'post_date', + 'order' => 'DESC', + 'include' => array(), + 'exclude' => array(), + 'post_type' => 'any', + 'meta_key' => '', + 'meta_value' => '', + 'meta_compare' => '', + 'meta_query' => '', 'cache_results' => false, - 'no_found_rows' => true + 'no_found_rows' => true, ); - if ( defined( 'ICL_SITEPRESS_VERSION' ) ) $defaults['suppress_filters'] = false; + if ( defined( 'ICL_SITEPRESS_VERSION' ) ) { + $defaults['suppress_filters'] = false; + } $args = wp_parse_args( $args, $defaults ); - if ( empty( $args['post_type'] ) ) - return apply_filters( $this->prefix . 'post_filter', Array(), $args ); - $exclude_slugs = Array(); - if ( !empty( $args['exclude'] ) ) { + if ( empty( $args['post_type'] ) ) { + return apply_filters( $this->prefix . 'post_filter', array(), $args ); + } + $exclude_slugs = array(); + if ( ! empty( $args['exclude'] ) ) { $exclude = preg_split( '/[\s,]+/', trim( $args['exclude'] ) ); - if ( !empty( $exclude ) ) { - foreach( $exclude as $k => $v ) { - if ( !is_numeric( $v ) || ( $v != (int)$v ) ) { + if ( ! empty( $exclude ) ) { + foreach ( $exclude as $k => $v ) { + if ( ! is_numeric( $v ) || ( $v != (int) $v ) ) { $exclude_slugs[] = $v; - unset( $exclude[$k] ); + unset( $exclude[ $k ] ); } } - if ( !empty( $exclude_slugs ) ) + if ( ! empty( $exclude_slugs ) ) { $args['exclude'] = implode( ',', $exclude ); + } } } - - $ex_args = $args; - $ex_args['meta_key'] = '_aioseop_sitemap_exclude'; - $ex_args['meta_value'] = 'on'; - $ex_args['meta_compare'] = '='; - $ex_args['fields'] = 'ids'; - $ex_args['posts_per_page'] = -1; - $q = new WP_Query( $ex_args ); - if ( !is_array( $args['exclude'] ) ) $args['exclude'] = explode( ',', $args['exclude'] ); - if ( !empty( $q->posts ) ) $args['exclude'] = array_merge( $args['exclude'], $q->posts ); - // } - + + $ex_args = $args; + $ex_args['meta_key'] = '_aioseop_sitemap_exclude'; + $ex_args['meta_value'] = 'on'; + $ex_args['meta_compare'] = '='; + $ex_args['fields'] = 'ids'; + $ex_args['posts_per_page'] = - 1; + $q = new WP_Query( $ex_args ); + if ( ! is_array( $args['exclude'] ) ) { + $args['exclude'] = explode( ',', $args['exclude'] ); + } + if ( ! empty( $q->posts ) ) { + $args['exclude'] = array_merge( $args['exclude'], $q->posts ); + } + $posts = get_posts( apply_filters( $this->prefix . 'post_query', $args ) ); - if ( !empty( $exclude_slugs ) ) { - foreach( $posts as $k => $v ) { - if ( in_array( $v->post_name, $exclude_slugs ) ) - unset( $posts[$k] ); + if ( ! empty( $exclude_slugs ) ) { + foreach ( $posts as $k => $v ) { + if ( in_array( $v->post_name, $exclude_slugs ) ) { + unset( $posts[ $k ] ); + } } } $posts = apply_filters( $this->prefix . 'post_filter', $posts, $args ); + return $posts; } } diff --git a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_video_sitemap.php b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_video_sitemap.php index eb1767b795..2f03266a03 100644 --- a/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_video_sitemap.php +++ b/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_video_sitemap.php @@ -1,5 +1,11 @@ Add New' 2. Search for 'All in One SEO' -3. Activate All in One SEO Pack from your Plugins page. +3. Activate All in One SEO Pack from your Plugins page. = From WordPress.org = 1. Download All in One SEO Pack. 2. Upload the 'All in One SEO Pack' directory to your '/wp-content/plugins/' directory, using your favorite method (ftp, sftp, scp, etc...) -3. Activate All in One SEO Pack from your Plugins page. +3. Activate All in One SEO Pack from your Plugins page. = Once Activated = @@ -146,7 +146,7 @@ enhancements: -futureproofing the file editor function for PHP7,8 -futureproofing the import-export function for PHP7,8 -= 2.2.7.4 = += 2.2.7.4 = -Update for WordPress 4.4 -CSS fixes diff --git a/wp-content/plugins/all-in-one-seo-pack/sitemap.xsl b/wp-content/plugins/all-in-one-seo-pack/sitemap.xsl deleted file mode 100644 index 9e9fb27ffe..0000000000 --- a/wp-content/plugins/all-in-one-seo-pack/sitemap.xsl +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - Sitemap - SitemapIndex - - - - - - <xsl:choose><xsl:when test="$fileType='Sitemap'">Sitemap</xsl:when> - <xsl:otherwise>Sitemap Index</xsl:otherwise> - </xsl:choose> - - - - - -
    -

    XML Sitemap

    -
    -

    - - This sitemap contains URLs - This sitemap index contains sitemaps -

    -
    - - - - - - -
    - - -
    - - - - - - - - - - - - - - - stripe - - - - - - -
    URLLastChange
    - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - stripe - - - - - - - - - -
    URLPriorityChange FrequencyLastChange
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -