All in One SEO Pack - Version 2.3.6.1

Version Description

Download this release

Release Info

Developer hallsofmontezuma
Plugin Icon 128x128 All in One SEO Pack
Version 2.3.6.1
Comparing to
See all releases

Code changes from version 2.3.4.2 to 2.3.6.1

Files changed (95) hide show
  1. CONTRIBUTING.md +0 -154
  2. admin/aioseop_module_class.php +1436 -940
  3. admin/aioseop_module_manager.php +152 -68
  4. admin/display/general-metaboxes.php +138 -89
  5. admin/display/index.php +4 -1
  6. admin/index.php +4 -1
  7. admin/meta_import.php +455 -428
  8. aioseop-init.php +7 -0
  9. aioseop_class.php +4467 -2943
  10. aioseop_init.php +0 -2
  11. all_in_one_seo_pack.php +295 -229
  12. css/aiosp_admin.css +71 -67
  13. css/modules/aioseop_module-rtl.css +125 -111
  14. css/modules/aioseop_module.css +1309 -1120
  15. i18n/all-in-one-seo-pack-am.mo +0 -0
  16. i18n/all-in-one-seo-pack-ar.mo +0 -0
  17. i18n/all-in-one-seo-pack-art_xemoji.mo +0 -0
  18. i18n/all-in-one-seo-pack-ary.mo +0 -0
  19. i18n/all-in-one-seo-pack-bg_BG.mo +0 -0
  20. i18n/all-in-one-seo-pack-bn_BD.mo +0 -0
  21. i18n/all-in-one-seo-pack-bs_BA.mo +0 -0
  22. i18n/all-in-one-seo-pack-ca.mo +0 -0
  23. i18n/all-in-one-seo-pack-de_DE.mo +0 -0
  24. i18n/all-in-one-seo-pack-el.mo +0 -0
  25. i18n/all-in-one-seo-pack-en_AU.mo +0 -0
  26. i18n/all-in-one-seo-pack-en_CA.mo +0 -0
  27. i18n/all-in-one-seo-pack-en_GB.mo +0 -0
  28. i18n/all-in-one-seo-pack-en_NZ.mo +0 -0
  29. i18n/all-in-one-seo-pack-en_ZA.mo +0 -0
  30. i18n/all-in-one-seo-pack-es_ES.mo +0 -0
  31. i18n/all-in-one-seo-pack-es_VE.mo +0 -0
  32. i18n/all-in-one-seo-pack-et.mo +0 -0
  33. i18n/all-in-one-seo-pack-fa_IR.mo +0 -0
  34. i18n/all-in-one-seo-pack-fi.mo +0 -0
  35. i18n/all-in-one-seo-pack-fr_CA.mo +0 -0
  36. i18n/all-in-one-seo-pack-fr_FR.mo +0 -0
  37. i18n/all-in-one-seo-pack-he_IL.mo +0 -0
  38. i18n/all-in-one-seo-pack-hi_IN.mo +0 -0
  39. i18n/all-in-one-seo-pack-hr.mo +0 -0
  40. i18n/all-in-one-seo-pack-hu_HU.mo +0 -0
  41. i18n/all-in-one-seo-pack-hy +0 -0
  42. i18n/all-in-one-seo-pack-hy.mo +0 -0
  43. i18n/all-in-one-seo-pack-id_ID.mo +0 -0
  44. i18n/all-in-one-seo-pack-it_IT.mo +0 -0
  45. i18n/all-in-one-seo-pack-ja.mo +0 -0
  46. i18n/all-in-one-seo-pack-jv_ID.mo +0 -0
  47. i18n/all-in-one-seo-pack-ko_KR.mo +0 -0
  48. i18n/all-in-one-seo-pack-lv.mo +0 -0
  49. i18n/all-in-one-seo-pack-mk_MK.mo +0 -0
  50. i18n/all-in-one-seo-pack-mn.mo +0 -0
  51. i18n/all-in-one-seo-pack-mr.mo +0 -0
  52. i18n/all-in-one-seo-pack-ms_MY.mo +0 -0
  53. i18n/all-in-one-seo-pack-nb_NO.mo +0 -0
  54. i18n/all-in-one-seo-pack-nl.mo +0 -0
  55. i18n/all-in-one-seo-pack-nl_NL.mo +0 -0
  56. i18n/all-in-one-seo-pack-nn_NO.mo +0 -0
  57. i18n/all-in-one-seo-pack-oci.mo +0 -0
  58. i18n/all-in-one-seo-pack-pa_IN.mo +0 -0
  59. i18n/all-in-one-seo-pack-pl_PL.mo +0 -0
  60. i18n/all-in-one-seo-pack-ps.mo +0 -0
  61. i18n/all-in-one-seo-pack-pt_BR.mo +0 -0
  62. i18n/all-in-one-seo-pack-pt_PT.mo +0 -0
  63. i18n/all-in-one-seo-pack-ro_RO.mo +0 -0
  64. i18n/all-in-one-seo-pack-ru_RU.mo +0 -0
  65. i18n/all-in-one-seo-pack-si_LK.mo +0 -0
  66. i18n/all-in-one-seo-pack-sl_SL.mo +0 -0
  67. i18n/all-in-one-seo-pack-sq.mo +0 -0
  68. i18n/all-in-one-seo-pack-sv_SE.mo +0 -0
  69. i18n/all-in-one-seo-pack-ta_IN.mo +0 -0
  70. i18n/all-in-one-seo-pack-tg.mo +0 -0
  71. i18n/all-in-one-seo-pack-tr_TR.mo +0 -0
  72. i18n/all-in-one-seo-pack-uk.mo +0 -0
  73. i18n/all-in-one-seo-pack-ur.mo +0 -0
  74. i18n/all-in-one-seo-pack-vi.mo +0 -0
  75. i18n/all-in-one-seo-pack-zh_CN.mo +0 -0
  76. i18n/all-in-one-seo-pack-zh_TW.mo +0 -0
  77. inc/aioseop_functions.php +691 -377
  78. inc/aioseop_updates_class.php +212 -176
  79. inc/aiosp_common.php +56 -26
  80. inc/commonstrings.php +33 -30
  81. inc/compatability/compat-init.php +77 -0
  82. inc/deprecated.php +186 -115
  83. inc/index.php +4 -1
  84. inc/sitemap-xsl.php +190 -0
  85. inc/translations.php +173 -0
  86. index.php +4 -1
  87. js/modules/aioseop_module.js +641 -345
  88. modules/aioseop_bad_robots.php +149 -79
  89. modules/aioseop_feature_manager.php +143 -82
  90. modules/aioseop_file_editor.php +113 -61
  91. modules/aioseop_importer_exporter.php +503 -251
  92. modules/aioseop_opengraph.php +910 -540
  93. modules/aioseop_performance.php +235 -170
  94. modules/aioseop_robots.php +503 -259
  95. modules/aioseop_sitemap.php +132 -95
CONTRIBUTING.md DELETED
@@ -1,154 +0,0 @@
1
- # Contributing to All in One SEO Pack
2
-
3
- So you'd like to contribute to an open source project? You're awesome!
4
-
5
- - [Reporting bugs](#reporting-bugs)
6
- - [Feature ideas](#feature-ideas)
7
- - [Contributing code](#contributing-code)
8
- - [Translating](#translating)
9
-
10
-
11
- ## Reporting bugs
12
-
13
- 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/).
14
- 2. [**Search** the issues](https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues) first.
15
- 3. [Open a new issue](https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/new).
16
-
17
- What makes the issue really helpful:
18
-
19
- - You articulate the problem clearly and provide **steps to reproduce** the problem.
20
- - **Screenshots or GIFs** are appreciated.
21
-
22
-
23
- ## Feature ideas
24
-
25
- 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:
26
-
27
- [Submit a new feature request](https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/new) and start a discussion.
28
-
29
-
30
- ## Contributing code
31
-
32
- Generally:
33
-
34
- 1. Open a new issue / pick an existing one
35
- 2. Fork the repo, create a branch, commit to it
36
- 3. Push the branch, open a pull request
37
- 4. The core team will review it and work with you if necessary
38
- 5. Someone from the core team will merge the PR
39
- 6. :tada:
40
-
41
- 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).
42
-
43
- The following discusses some of the important details if you want to contribute.
44
-
45
- ### Core values
46
-
47
- - **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.
48
- - **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.
49
- - **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.
50
-
51
-
52
- ### Our development process
53
-
54
- **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.
55
-
56
- **Issues** are the most important tool to plan and manage almost everything around VersionPress:
57
-
58
- - 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.
59
- - [This set of **labels**](https://github.com/semperfiwebdesign/all-in-one-seo-pack/wiki/Issues#labels) is used to categorize issues.
60
- - 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.
61
-
62
- 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.
63
-
64
-
65
- ### Development workflow
66
-
67
- 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/):
68
-
69
- ![GitHub Flow](https://guides.github.com/activities/hello-world/branching.png)
70
-
71
- Here are the details:
72
-
73
-
74
- 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 `<issue number>-<short description>`, e.g., `123-row-filtering`.
75
-
76
- - **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.
77
-
78
- 2. **Commit to this branch**. We appreciate good commits, here are some tips:
79
-
80
- - **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.
81
- - **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.
82
- - 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.
83
- - **Link to an issue from the commit message**. Most of the commit messages look like this:
84
-
85
- ```
86
- [#123] Implemented xyz
87
- ```
88
-
89
- It means that the commit belongs to issue `#123`. It makes looking up issues from commits easier.
90
-
91
-
92
- 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.
93
-
94
- 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:
95
-
96
- Resolves #123.
97
-
98
- Some notes on the implementation here if it's not obvious from the code
99
- or the list of commits.
100
-
101
- Reviewers:
102
-
103
- - [ ] @JanVoracek
104
- - [ ] @borekb
105
-
106
- 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).
107
-
108
- 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.
109
-
110
- All checkboxes checked means that the PR is OK to merge.
111
-
112
- > 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**.
113
-
114
- 5. Someone from the core team **merges the pull request**, issue is closed and the branch can be deleted.
115
-
116
- A couple of notes:
117
-
118
- - 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.
119
- - 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).
120
- - **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.
121
-
122
-
123
- ### Style guides
124
-
125
- 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/).
126
-
127
- #### PHP style guide
128
-
129
- [WordPress PHP Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/)
130
-
131
- [WordPress PHP Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/)
132
-
133
- There are tools out there for apps like Netbeans and PHPStorm to apply WordPress Coding Standards.
134
-
135
-
136
- #### JavaScript style guide
137
-
138
- [WordPress Javascript Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/)
139
-
140
- [WordPress Javascript Documentation](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/)
141
-
142
-
143
-
144
- ## Translating
145
-
146
- We would love your help translating the project into your language. [Translations](https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack)
147
-
148
-
149
- *more instructions coming soon
150
-
151
-
152
- ---
153
-
154
- Other ideas of how to contribute? [Tell us](http://semperplugins.com/contact).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/aioseop_module_class.php CHANGED
@@ -5,7 +5,7 @@
5
  /**
6
  * The module base class; handles settings, options, menus, metaboxes, etc.
7
  */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
9
  abstract class All_in_One_SEO_Pack_Module {
10
  public static $instance = null;
11
  protected $plugin_name;
@@ -16,59 +16,65 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
16
  protected $options;
17
  protected $option_name;
18
  protected $default_options;
19
- protected $help_text = Array();
20
- protected $help_anchors = Array();
21
- protected $locations = null; // organize settings into settings pages with a menu items and/or metaboxes on post types edit screen; optional
22
- protected $layout = null; // organize settings on a settings page into multiple, separate metaboxes; optional
23
- protected $tabs = null; // organize layouts on a settings page into multiple, separate tabs; optional
24
- protected $current_tab = null; // the current tab
25
- protected $pagehook = null; // the current page hook
26
  protected $store_option = false;
27
  protected $parent_option = 'aioseop_options';
28
- protected $post_metaboxes = Array();
29
  protected $tabbed_metaboxes = true;
30
  protected $credentials = false; // used for WP Filesystem
31
- protected $script_data = null; // used for passing data to JavaScript
32
  protected $plugin_path = null;
33
- protected $pointers = Array();
34
  protected $form = 'dofollow';
35
-
36
  /**
37
  * Handles calls to display_settings_page_{$location}, does error checking.
38
  */
39
  function __call( $name, $arguments ) {
40
- if ( $this->strpos( $name, "display_settings_page_" ) === 0 )
41
  return $this->display_settings_page( $this->substr( $name, 22 ) );
 
42
  $error = __( sprintf( "Method %s doesn't exist", $name ), 'all-in-one-seo-pack' );
43
- if ( class_exists( 'BadMethodCallException' ) )
44
  throw new BadMethodCallException( $error );
 
45
  throw new Exception( $error );
46
  }
47
-
48
  function __construct() {
49
- if ( empty( $this->file ) ) $this->file = __FILE__;
 
 
50
  $this->plugin_name = AIOSEOP_PLUGIN_NAME;
51
- $this->plugin_path = Array();
52
  // $this->plugin_path['dir'] = plugin_dir_path( $this->file );
53
- $this->plugin_path['basename'] = plugin_basename( $this->file );
54
- $this->plugin_path['dirname'] = dirname( $this->plugin_path['basename'] );
55
- $this->plugin_path['url'] = plugin_dir_url( $this->file );
56
- $this->plugin_path['images_url'] = $this->plugin_path['url'] . 'images';
57
  $this->script_data['plugin_path'] = $this->plugin_path;
58
  }
59
 
60
  /**
61
  * Get options for module, stored individually or together.
62
  */
63
- function get_class_option( ) {
64
  $option_name = $this->get_option_name();
65
  if ( $this->store_option || $option_name == $this->parent_option ) {
66
  return get_option( $option_name );
67
  } else {
68
  $option = get_option( $this->parent_option );
69
- if ( isset( $option['modules'] ) && isset( $option['modules'][$option_name] ) )
70
- return $option['modules'][$option_name];
 
71
  }
 
72
  return false;
73
  }
74
 
@@ -76,18 +82,22 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
76
  * Update options for module, stored individually or together.
77
  */
78
  function update_class_option( $option_data, $option_name = false ) {
79
- if ( $option_name == false )
80
  $option_name = $this->get_option_name();
 
81
  if ( $this->store_option || $option_name == $this->parent_option ) {
82
  return update_option( $option_name, $option_data );
83
  } else {
84
  $option = get_option( $this->parent_option );
85
- if ( !isset( $option['modules'] ) ) $option['modules'] = Array();
86
- $option['modules'][$option_name] = $option_data;
 
 
 
87
  return update_option( $this->parent_option, $option );
88
  }
89
  }
90
-
91
  /**
92
  * Delete options for module, stored individually or together.
93
  */
@@ -97,11 +107,13 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
97
  delete_option( $option_name );
98
  } else {
99
  $option = get_option( $this->parent_option );
100
- if ( isset( $option['modules'] ) && isset( $option['modules'][$option_name] ) ) {
101
- unset( $option['modules'][$option_name] );
 
102
  return update_option( $this->parent_option, $option );
103
  }
104
  }
 
105
  return false;
106
  }
107
 
@@ -109,8 +121,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
109
  * Get the option name with prefix.
110
  */
111
  function get_option_name() {
112
- if ( !isset( $this->option_name ) || empty( $this->option_name ) )
113
  $this->option_name = $this->prefix . 'options';
 
 
114
  return $this->option_name;
115
  }
116
 
@@ -119,50 +133,60 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
119
  */
120
  function option_isset( $option, $location = null ) {
121
  $prefix = $this->get_prefix( $location );
122
- $opt = $prefix . $option;
123
- return ( ( isset( $this->options[$opt] ) ) && $this->options[$opt] );
 
124
  }
125
-
126
  /*** Case conversion; handle non UTF-8 encodings and fallback ***/
127
 
128
  function convert_case( $str, $mode = 'upper' ) {
129
  static $charset = null;
130
- if ( $charset == null ) $charset = get_bloginfo( 'charset' );
131
- $str = (string)$str;
 
 
132
  if ( $mode == 'title' ) {
133
- if ( function_exists( 'mb_convert_case' ) )
134
  return mb_convert_case( $str, MB_CASE_TITLE, $charset );
135
- else
136
  return ucwords( $str );
 
137
  }
138
-
139
  if ( $charset == 'UTF-8' ) {
140
  global $UTF8_TABLES;
141
  include_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_UTF8.php' );
142
  if ( is_array( $UTF8_TABLES ) ) {
143
- if ( $mode == 'upper' ) return strtr( $str, $UTF8_TABLES['strtoupper'] );
144
- if ( $mode == 'lower' ) return strtr( $str, $UTF8_TABLES['strtolower'] );
 
 
 
 
145
  }
146
  }
147
-
148
  if ( $mode == 'upper' ) {
149
- if ( function_exists( 'mb_strtoupper' ) )
150
  return mb_strtoupper( $str, $charset );
151
- else
152
  return strtoupper( $str );
 
153
  }
154
 
155
  if ( $mode == 'lower' ) {
156
- if ( function_exists( 'mb_strtolower' ) )
157
  return mb_strtolower( $str, $charset );
158
- else
159
  return strtolower( $str );
 
160
  }
161
-
162
  return $str;
163
  }
164
 
165
- /**
166
  * Convert a string to lower case
167
  * Compatible with mb_strtolower(), an UTF-8 friendly replacement for strtolower()
168
  */
@@ -170,7 +194,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
170
  return $this->convert_case( $str, 'lower' );
171
  }
172
 
173
- /**
174
  * Convert a string to upper case
175
  * Compatible with mb_strtoupper(), an UTF-8 friendly replacement for strtoupper()
176
  */
@@ -178,20 +202,22 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
178
  return $this->convert_case( $str, 'upper' );
179
  }
180
 
181
- /**
182
  * Convert a string to title case
183
  * Compatible with mb_convert_case(), an UTF-8 friendly replacement for ucwords()
184
  */
185
  function ucwords( $str ) {
186
  return $this->convert_case( $str, 'title' );
187
  }
188
-
189
  /**
190
  * Wrapper for strlen() - uses mb_strlen() if possible.
191
- */
192
  function strlen( $string ) {
193
- if ( function_exists( 'mb_strlen' ) )
194
  return mb_strlen( $string );
 
 
195
  return strlen( $string );
196
  }
197
 
@@ -200,118 +226,146 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
200
  */
201
  function substr( $string, $start = 0, $length = 2147483647 ) {
202
  $args = func_get_args();
203
- if ( function_exists( 'mb_substr' ) )
204
  return call_user_func_array( 'mb_substr', $args );
 
 
205
  return call_user_func_array( 'substr', $args );
206
  }
207
-
208
  /**
209
  * Wrapper for strpos() - uses mb_strpos() if possible.
210
  */
211
  function strpos( $haystack, $needle, $offset = 0 ) {
212
- if ( function_exists( 'mb_strpos' ) )
213
  return mb_strpos( $haystack, $needle, $offset );
 
 
214
  return strpos( $haystack, $needle, $offset );
215
  }
216
-
217
  /**
218
  * Wrapper for strrpos() - uses mb_strrpos() if possible.
219
  */
220
  function strrpos( $haystack, $needle, $offset = 0 ) {
221
- if ( function_exists( 'mb_strrpos' ) )
222
  return mb_strrpos( $haystack, $needle, $offset );
 
 
223
  return strrpos( $haystack, $needle, $offset );
224
  }
225
 
226
  /**
227
- * convert xml string to php array - useful to get a serializable value
228
- *
229
- * @param string $xmlstr
230
- * @return array
231
- *
232
- * @author Adrien aka Gaarf & contributors
233
- * @see http://gaarf.info/2009/08/13/xml-string-to-php-array/
234
- */
 
235
  function html_string_to_array( $xmlstr ) {
236
- if ( !class_exists( 'DOMDocument' ) ) {
237
- return Array();
238
- } else {
239
- $doc = new DOMDocument();
240
- $doc->loadHTML( $xmlstr );
241
- return $this->domnode_to_array( $doc->documentElement );
242
- }
 
243
  }
244
 
245
  function xml_string_to_array( $xmlstr ) {
246
- if ( !class_exists( 'DOMDocument' ) ) {
247
- return Array();
248
- } else {
249
- $doc = new DOMDocument();
250
- $doc->loadXML( $xmlstr );
251
- return $this->domnode_to_array( $doc->documentElement );
252
- }
 
253
  }
254
 
255
  function domnode_to_array( $node ) {
256
- switch ( $node->nodeType ) {
257
- case XML_CDATA_SECTION_NODE:
258
- case XML_TEXT_NODE:
259
- return trim( $node->textContent );
260
- break;
261
- case XML_ELEMENT_NODE:
262
- $output = array();
263
- for ($i=0, $m=$node->childNodes->length; $i<$m; $i++) {
264
- $child = $node->childNodes->item($i);
265
- $v = $this->domnode_to_array($child);
266
- if(isset($child->tagName)) {
267
- $t = $child->tagName;
268
- if(!isset($output[$t]))
269
- $output[$t] = array();
270
- if ( is_array($output) )
271
- $output[$t][] = $v;
272
- }
273
- elseif($v || $v === '0')
274
- $output = (string) $v;
275
- }
276
- if($node->attributes->length && !is_array($output)) //Has attributes but isn't an array
277
- $output = array('@content'=>$output); //Change output into an array.
278
- if(is_array($output)) {
279
- if($node->attributes->length) {
280
- $a = array();
281
- foreach($node->attributes as $attrName => $attrNode)
282
- $a[$attrName] = (string) $attrNode->value;
283
- $output['@attributes'] = $a;
284
- }
285
- foreach ($output as $t => $v)
286
- if(is_array($v) && count($v)==1 && $t!='@attributes')
287
- $output[$t] = $v[0];
288
- }
289
- }
290
- if ( empty( $output ) ) return '';
291
- return $output;
292
- }
293
-
 
 
 
 
 
 
 
 
 
 
294
  /*** adds support for using %cf_(name of field)% for using custom fields / Advanced Custom Fields in titles / descriptions etc. ***/
295
  function apply_cf_fields( $format ) {
296
- return preg_replace_callback( '/%cf_([^%]*?)%/', Array( $this, 'cf_field_replace' ), $format );
297
  }
298
 
299
  function cf_field_replace( $matches ) {
300
  $result = '';
301
- if ( !empty( $matches ) ) {
302
- if ( !empty( $matches[1] ) ) {
303
- if ( function_exists( 'get_field' ) ) $result = get_field( $matches[1] );
 
 
304
  if ( empty( $result ) ) {
305
  global $post;
306
- if ( !empty( $post ) ) $result = get_post_meta( $post->ID, $matches[1], true );
 
 
 
 
 
307
  }
308
- if ( empty( $result ) ) $result = $matches[0];
309
- } else $result = $matches[0];
 
310
  }
311
  $result = strip_tags( $result );
 
312
  return $result;
313
  }
314
-
315
  /**
316
  * Returns child blogs of parent in a multisite.
317
  */
@@ -319,198 +373,215 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
319
  global $wpdb, $blog_id;
320
  $site_id = $wpdb->siteid;
321
  if ( is_multisite() ) {
322
- if ( $site_id != $blog_id ) return false;
 
 
 
323
  return $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = {$blog_id} AND site_id != blog_id" );
324
  }
 
325
  return false;
326
  }
327
-
328
  /**
329
  * Checks if the plugin is active on a given blog by blogid on a multisite.
330
  */
331
  function is_aioseop_active_on_blog( $bid = false ) {
332
  global $blog_id;
333
- if ( empty( $bid ) || ( $bid == $blog_id ) || !is_multisite() ) return true;
334
- if ( ! function_exists( 'is_plugin_active_for_network' ) )
335
- require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
336
- if ( is_plugin_active_for_network( AIOSEOP_PLUGIN_BASENAME ) ) return true;
 
 
 
 
 
 
337
  return in_array( AIOSEOP_PLUGIN_BASENAME, (array) get_blog_option( $bid, 'active_plugins', array() ) );
338
  }
339
-
340
  function quote_list_for_regex( $list, $quote = '/' ) {
341
  $regex = '';
342
- $cont = 0;
343
- foreach( $list as $l ) {
344
- if ( $cont ) {
345
- $regex .= '|';
346
- }
347
- $cont = 1;
348
- $regex .= preg_quote( trim( $l ), $quote );
349
  }
 
350
  return $regex;
351
  }
352
-
353
  // original code thanks to Sean M. Brown -- http://smbrown.wordpress.com/2009/04/29/verify-googlebot-forward-reverse-dns/
354
  function is_good_bot() {
355
- $botlist = Array(
356
- "Yahoo! Slurp" => "crawl.yahoo.net",
357
- "googlebot" => ".googlebot.com",
358
- "msnbot" => "search.msn.com"
359
  );
360
- $botlist = apply_filters( $this->prefix . "botlist", $botlist );
361
- if ( !empty( $botlist ) ) {
362
- $ua = $_SERVER['HTTP_USER_AGENT'];
 
 
 
363
  $uas = $this->quote_list_for_regex( $botlist );
364
- if ( preg_match( '/' . $uas . '/i', $ua ) ) {
365
- $ip = $_SERVER['REMOTE_ADDR'];
366
- $hostname = gethostbyaddr( $ip );
367
  $ip_by_hostname = gethostbyname( $hostname );
368
- if ( $ip_by_hostname == $ip ) {
369
  $hosts = array_values( $botlist );
370
- foreach( $hosts as $k => $h )
371
- $hosts[$k] = preg_quote( $h ) . '$';
 
372
  $hosts = join( '|', $hosts );
373
- if ( preg_match( '/' . $hosts . '/i', $hostname ) )
374
  return true;
 
375
  }
376
  }
 
377
  return false;
378
  }
379
  }
380
-
381
  function default_bad_bots() {
382
- $botlist = Array(
383
- "Abonti",
384
- "aggregator",
385
- "AhrefsBot",
386
- "asterias",
387
- "BDCbot",
388
- "BLEXBot",
389
- "BuiltBotTough",
390
- "Bullseye",
391
- "BunnySlippers",
392
- "ca-crawler",
393
- "CCBot",
394
- "Cegbfeieh",
395
- "CheeseBot",
396
- "CherryPicker",
397
- "CopyRightCheck",
398
- "cosmos",
399
- "Crescent",
400
- "discobot",
401
- "DittoSpyder",
402
- "DotBot",
403
- "Download Ninja",
404
- "EasouSpider",
405
- "EmailCollector",
406
- "EmailSiphon",
407
- "EmailWolf",
408
- "EroCrawler",
409
- "Exabot",
410
- "ExtractorPro",
411
- "Fasterfox",
412
- "FeedBooster",
413
- "Foobot",
414
- "Genieo",
415
- "grub-client",
416
- "Harvest",
417
- "hloader",
418
- "httplib",
419
- "HTTrack",
420
- "humanlinks",
421
- "ieautodiscovery",
422
- "InfoNaviRobot",
423
- "IstellaBot",
424
- "Java/1.",
425
- "JennyBot",
426
- "k2spider",
427
- "Kenjin Spider",
428
- "Keyword Density/0.9",
429
- "larbin",
430
- "LexiBot",
431
- "libWeb",
432
- "libwww",
433
- "LinkextractorPro",
434
- "linko",
435
- "LinkScan/8.1a Unix",
436
- "LinkWalker",
437
- "LNSpiderguy",
438
- "lwp-trivial",
439
- "magpie",
440
- "Mata Hari",
441
  'MaxPointCrawler',
442
  'MegaIndex',
443
- "Microsoft URL Control",
444
- "MIIxpc",
445
- "Mippin",
446
- "Missigua Locator",
447
- "Mister PiX",
448
- "MJ12bot",
449
- "moget",
450
- "MSIECrawler",
451
- "NetAnts",
452
- "NICErsPRO",
453
- "Niki-Bot",
454
- "NPBot",
455
- "Nutch",
456
- "Offline Explorer",
457
- "Openfind",
458
  'panscient.com',
459
- "PHP/5.{",
460
- "ProPowerBot/2.14",
461
- "ProWebWalker",
462
- "Python-urllib",
463
- "QueryN Metasearch",
464
- "RepoMonkey",
465
- "RMA",
466
  'SemrushBot',
467
- "SeznamBot",
468
- "SISTRIX",
469
- "sitecheck.Internetseer.com",
470
- "SiteSnagger",
471
- "SnapPreviewBot",
472
- "Sogou",
473
- "SpankBot",
474
- "spanner",
475
- "spbot",
476
- "Spinn3r",
477
- "suzuran",
478
- "Szukacz/1.4",
479
- "Teleport",
480
- "Telesoft",
481
- "The Intraformant",
482
- "TheNomad",
483
- "TightTwatBot",
484
- "Titan",
485
- "toCrawl/UrlDispatcher",
486
- "True_Robot",
487
- "turingos",
488
- "TurnitinBot",
489
- "UbiCrawler",
490
- "UnisterBot",
491
- "URLy Warning",
492
- "VCI",
493
- "WBSearchBot",
494
- "Web Downloader/6.9",
495
- "Web Image Collector",
496
- "WebAuto",
497
- "WebBandit",
498
- "WebCopier",
499
- "WebEnhancer",
500
- "WebmasterWorldForumBot",
501
- "WebReaper",
502
- "WebSauger",
503
- "Website Quester",
504
- "Webster Pro",
505
- "WebStripper",
506
- "WebZip",
507
- "Wotbox",
508
- "wsr-agent",
509
- "WWW-Collector-E",
510
- "Xenu",
511
- "Zao",
512
- "Zeus",
513
- "ZyBORG",
514
  'coccoc',
515
  'Incutio',
516
  'lmspider',
@@ -520,24 +591,29 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
520
  'Unknown',
521
  'uptime files'
522
  );
 
523
  return $botlist;
524
  }
525
-
526
  function is_bad_bot() {
527
  $botlist = $this->default_bad_bots();
528
- $botlist = apply_filters( $this->prefix . "badbotlist", $botlist );
529
- if ( !empty( $botlist ) ) {
530
- $ua = $_SERVER['HTTP_USER_AGENT'];
 
 
 
531
  $uas = $this->quote_list_for_regex( $botlist );
532
- if ( preg_match( '/' . $uas . '/i', $ua ) ) {
533
  return true;
534
  }
535
  }
 
536
  return false;
537
  }
538
-
539
  function default_bad_referers() {
540
- $referlist = Array(
541
  'semalt.com',
542
  'kambasoft.com',
543
  'savetubevideo.com',
@@ -564,247 +640,304 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
564
  'site3.free-share-buttons.com',
565
  'webmaster-traffic.com'
566
  );
 
567
  return $referlist;
568
  }
569
 
570
  function is_bad_referer() {
571
  $referlist = $this->default_bad_referers();
572
- $referlist = apply_filters( $this->prefix . "badreferlist", $referlist );
573
 
574
- if ( !empty( $referlist ) && !empty( $_SERVER ) && !empty( $_SERVER['HTTP_REFERER'] ) ) {
575
- $ref = $_SERVER['HTTP_REFERER'];
576
  $regex = $this->quote_list_for_regex( $referlist );
577
- if ( preg_match( '/' . $regex . '/i', $ref ) ) {
578
  return true;
579
  }
580
  }
 
581
  return false;
582
  }
583
-
584
  function allow_bot() {
585
  $allow_bot = true;
586
- if ( ( !$this->is_good_bot() ) && ( $this->is_bad_bot() ) && !is_user_logged_in() )
587
  $allow_bot = false;
588
- return apply_filters( $this->prefix . "allow_bot", $allow_bot );
 
 
589
  }
590
 
591
  /**
592
  * Displays tabs for tabbed locations on a settings page.
593
  */
594
  function display_tabs( $location ) {
595
- if ( ( $location != null ) && isset( $locations[$location]['tabs'] ) )
596
  $tabs = $locations['location']['tabs'];
597
- else
598
  $tabs = $this->tabs;
599
- if ( !empty( $tabs ) ) {
600
- ?><div class="aioseop_tabs_div"><label class="aioseop_head_nav">
601
- <?php
602
- foreach ( $tabs as $k => $v ) {
603
- ?>
604
- <a class="aioseop_head_nav_tab aioseop_head_nav_<?php if ( $this->current_tab != $k ) echo "in"; ?>active" href="<?php echo esc_url( add_query_arg( 'tab', $k ) ); ?>"><?php echo $v['name']; ?></a>
605
- <?php
606
- }
607
- ?>
 
 
 
 
 
608
  </label></div>
609
  <?php
610
  }
611
  }
612
-
613
  function get_object_labels( $post_objs ) {
614
- $pt = array_keys( $post_objs );
615
- $post_types = Array();
616
- foreach ( $pt as $p )
617
- if ( !empty( $post_objs[$p]->label ) )
618
- $post_types[$p] = $post_objs[$p]->label;
619
- else
620
- $post_types[$p] = $p;
 
 
 
621
  return $post_types;
622
  }
623
 
624
  function get_term_labels( $post_objs ) {
625
- $post_types = Array();
626
- foreach ( $post_objs as $p )
627
- if ( !empty( $p->name ) )
628
- $post_types[$p->term_id] = $p->name;
 
 
 
629
  return $post_types;
630
  }
631
-
632
- function get_post_type_titles( $args = Array() ) {
633
  return $this->get_object_labels( get_post_types( $args, 'objects' ) );
634
  }
635
 
636
- function get_taxonomy_titles( $args = Array() ) {
637
  return $this->get_object_labels( get_taxonomies( $args, 'objects' ) );
638
  }
639
-
640
- function get_category_titles( $args = Array() ) {
641
  return $this->get_term_labels( get_categories( $args ) );
642
  }
643
-
644
  /**
645
  * Helper function for exporting settings on post data.
646
  */
647
- function post_data_export( $prefix = '_aioseop', $query = Array( 'posts_per_page' => -1 ) ) {
648
- $buf = '';
649
  $posts_query = new WP_Query( $query );
650
- while ($posts_query->have_posts() ) {
651
  $posts_query->the_post();
652
  global $post;
653
- $guid = $post->guid; $type = $post->post_type; $title = $post->post_title; $date = $post->post_date;
654
- $data = '';
 
 
 
655
  $post_custom_fields = get_post_custom( $post->ID );
656
- $has_data = null;
657
 
658
- if( is_array( $post_custom_fields ) ) {
659
- foreach( $post_custom_fields as $field_name => $field ){
660
- if( ( $this->strpos( $field_name, $prefix ) === 0 ) && ( $field[0] ) ) {
661
  $has_data = true;
662
  $data .= $field_name . " = '" . $field[0] . "'\n";
663
- }
664
  }
665
  }
666
- if ( !empty( $data ) ) $has_data = true;
 
 
667
 
668
- if( $has_data != null ){
669
  $post_info = "\n[post_data]\n\n";
670
  $post_info .= "post_title = '" . $title . "'\n";
671
  $post_info .= "post_guid = '" . $guid . "'\n";
672
  $post_info .= "post_date = '" . $date . "'\n";
673
  $post_info .= "post_type = '" . $type . "'\n";
674
- if ( $data ) $buf .= $post_info . $data . "\n";
 
 
675
  }
676
  }
677
  wp_reset_postdata();
 
678
  return $buf;
679
  }
680
-
681
  /**
682
  * Handles exporting settings data for a module.
683
  */
684
  function settings_export( $buf ) {
685
- global $aiosp;
686
- $post_types = null;
687
- $has_data = null;
688
  $general_settings = null;
689
  $exporter_choices = '';
690
- if ( !empty( $_REQUEST[ 'aiosp_importer_exporter_export_choices' ] ) )
691
- $exporter_choices = $_REQUEST[ 'aiosp_importer_exporter_export_choices' ];
692
- if ( !empty( $exporter_choices ) && is_array( $exporter_choices ) ) {
693
- foreach( $exporter_choices as $ex ) {
694
- if ( $ex == 1 ) $general_settings = true;
695
- if ( $ex == 2 ) {
696
- if ( isset( $_REQUEST[ 'aiosp_importer_exporter_export_post_types' ] ) )
697
- $post_types = $_REQUEST[ 'aiosp_importer_exporter_export_post_types' ];
 
 
698
  }
699
  }
700
  }
701
 
702
- if ( ( $post_types != null ) && ( $this === $aiosp ) )
703
- $buf .= $this->post_data_export( '_aioseop', Array( 'posts_per_page' => -1, 'post_type' => $post_types ) );
 
 
 
 
704
 
705
  /* Add all active settings to settings file */
706
- $name = $this->get_option_name();
707
  $options = $this->get_class_option();
708
- if( !empty( $options ) && $general_settings != null ) {
709
  $buf .= "\n[$name]\n\n";
710
  foreach ( $options as $key => $value ) {
711
- if ( ( $name == $this->parent_option ) && ( $key == 'modules' ) ) continue; // don't re-export all module settings -- pdb
712
- if ( is_array($value) )
713
- $value = "'" . str_replace( Array( "'", "\n", "\r" ), Array( "\'", '\n', '\r' ), trim( serialize( $value ) ) ) . "'";
714
- else
715
- $value = str_replace( Array( "\n", "\r" ), Array( '\n', '\r' ), trim( var_export($value, true) ) );
 
 
 
 
 
 
 
 
 
 
716
  $buf .= "$key = $value\n";
717
  }
718
  }
 
719
  return $buf;
720
  }
721
-
722
  /**
723
  * Order for adding the menus for the aioseop_modules_add_menus hook.
724
  */
725
  function menu_order() {
726
  return 10;
727
  }
728
-
729
  /**
730
  * Print a basic error message.
731
  */
732
  function output_error( $error ) {
733
  echo "<div class='aioseop_module error'>$error</div>";
734
- return FALSE;
 
735
  }
736
-
737
  /***
738
  * Backwards compatibility - see http://php.net/manual/en/function.str-getcsv.php
739
  */
740
- function str_getcsv( $input, $delimiter = ",", $enclosure = '"', $escape = "\\" ) {
741
- $fp = fopen( "php://memory", 'r+' );
742
  fputs( $fp, $input );
743
  rewind( $fp );
744
  $data = fgetcsv( $fp, null, $delimiter, $enclosure ); // $escape only got added in 5.3.0
745
  fclose( $fp );
 
746
  return $data;
747
  }
748
-
749
  /***
750
  * Helper function to convert csv in key/value pair format to an associative array.
751
  */
752
  function csv_to_array( $csv ) {
753
- $args = Array();
754
- if ( !function_exists( 'str_getcsv' ) )
755
  $v = $this->str_getcsv( $csv );
756
- else
757
  $v = str_getcsv( $csv );
 
758
  $size = count( $v );
759
- if ( is_array( $v ) && isset( $v[0] ) && $size >= 2 )
760
- for( $i = 0; $i < $size; $i += 2 )
761
  $args[ $v[ $i ] ] = $v[ $i + 1 ];
 
 
 
762
  return $args;
763
  }
764
 
765
  /** Allow modules to use WP Filesystem if available and desired, fall back to PHP filesystem access otherwise. */
766
  function use_wp_filesystem( $method = '', $form_fields = false, $url = '', $error = false ) {
767
- if ( empty( $method ) )
768
  $this->credentials = request_filesystem_credentials( $url );
769
- else
770
  $this->credentials = request_filesystem_credentials( $url, $method, $error, false, $form_fields );
 
 
771
  return $this->credentials;
772
  }
773
-
774
  /**
775
  * Wrapper function to get filesystem object.
776
  */
777
- function get_filesystem_object( ) {
778
  $cred = get_transient( 'aioseop_fs_credentials' );
779
- if ( !empty( $cred ) ) $this->credentials = $cred;
780
-
781
- if ( function_exists( 'WP_Filesystem' ) && ( WP_Filesystem( $this->credentials ) ) ) {
 
 
782
  global $wp_filesystem;
 
783
  return $wp_filesystem;
784
  } else {
785
  require_once( ABSPATH . 'wp-admin/includes/template.php' );
786
  require_once( ABSPATH . 'wp-admin/includes/screen.php' );
787
  require_once( ABSPATH . 'wp-admin/includes/file.php' );
788
 
789
- if ( !WP_Filesystem( $this->credentials ) )
790
  $this->use_wp_filesystem();
 
791
 
792
- if ( !empty( $this->credentials ) )
793
  set_transient( 'aioseop_fs_credentials', $this->credentials, 10800 );
 
794
  global $wp_filesystem;
795
- if ( is_object( $wp_filesystem ) )
796
  return $wp_filesystem;
 
797
  }
 
798
  return false;
799
  }
800
-
801
  /**
802
  * See if a file exists using WP Filesystem.
803
  */
804
  function file_exists( $filename ) {
805
  $wpfs = $this->get_filesystem_object();
806
- if ( is_object( $wpfs ) )
807
  return $wpfs->exists( $filename );
 
 
808
  return $wpfs;
809
  }
810
 
@@ -813,11 +946,13 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
813
  */
814
  function is_file( $filename ) {
815
  $wpfs = $this->get_filesystem_object();
816
- if ( is_object( $wpfs ) )
817
  return $wpfs->is_file( $filename );
 
 
818
  return $wpfs;
819
  }
820
-
821
  /**
822
  * List files in a directory using WP Filesystem.
823
  */
@@ -825,52 +960,72 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
825
  $wpfs = $this->get_filesystem_object();
826
  if ( is_object( $wpfs ) ) {
827
  $dirlist = $wpfs->dirlist( $path );
828
- if ( empty( $dirlist ) ) return $dirlist;
 
 
 
829
  return array_keys( $dirlist );
830
  }
831
- return $wpfs;
 
832
  }
833
-
834
  /**
835
  * Load a file through WP Filesystem; implement basic support for offset and maxlen.
836
  */
837
- function load_file( $filename, $use_include_path = false, $context = null, $offset = -1, $maxlen = -1 ) {
838
  $wpfs = $this->get_filesystem_object();
839
  if ( is_object( $wpfs ) ) {
840
- if ( !$wpfs->exists( $filename ) ) return false;
 
 
841
  if ( ( $offset > 0 ) || ( $maxlen >= 0 ) ) {
842
- if ( $maxlen === 0 ) return '';
843
- if ( $offset < 0 ) $offset = 0;
 
 
 
 
844
  $file = $wpfs->get_contents( $filename );
845
- if ( !is_string( $file ) || empty( $file ) ) return $file;
846
- if ( $maxlen < 0 )
 
 
847
  return $this->substr( $file, $offset );
848
- else
849
  return $this->substr( $file, $offset, $maxlen );
 
850
  } else {
851
  return $wpfs->get_contents( $filename );
852
  }
853
  }
 
854
  return false;
855
  }
856
-
857
  /**
858
  * Save a file through WP Filesystem.
859
  */
860
  function save_file( $filename, $contents ) {
861
- $failed_str = __( sprintf( "Failed to write file %s!\n", $filename ), 'all-in-one-seo-pack' );
862
  $readonly_str = __( sprintf( "File %s isn't writable!\n", $filename ), 'all-in-one-seo-pack' );
863
- $wpfs = $this->get_filesystem_object();
864
  if ( is_object( $wpfs ) ) {
865
  $file_exists = $wpfs->exists( $filename );
866
- if ( !$file_exists || $wpfs->is_writable( $filename ) ) {
867
- if ( $wpfs->put_contents( $filename, $contents ) === FALSE) return $this->output_error( $failed_str );
868
- } else return $this->output_error( $readonly_str );
 
 
 
 
 
869
  return true;
870
  }
 
871
  return false;
872
  }
873
-
874
  /**
875
  * Delete a file through WP Filesystem.
876
  */
@@ -878,35 +1033,42 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
878
  $wpfs = $this->get_filesystem_object();
879
  if ( is_object( $wpfs ) ) {
880
  if ( $wpfs->exists( $filename ) ) {
881
- if ( $wpfs->delete( $filename ) === FALSE)
882
  $this->output_error( __( sprintf( "Failed to delete file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
883
- else
884
  return true;
885
- } else $this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
 
 
 
886
  }
 
887
  return false;
888
  }
889
-
890
  /**
891
  * Rename a file through WP Filesystem.
892
  */
893
  function rename_file( $filename, $newname ) {
894
  $wpfs = $this->get_filesystem_object();
895
  if ( is_object( $wpfs ) ) {
896
- $file_exists = $wpfs->exists( $filename );
897
  $newfile_exists = $wpfs->exists( $newname );
898
- if ( $file_exists && !$newfile_exists ) {
899
- if ( $wpfs->move( $filename, $newname ) === FALSE)
900
  $this->output_error( __( sprintf( "Failed to rename file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
901
- else
902
  return true;
 
903
  } else {
904
- if ( !$file_exists )
905
  $this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
906
- elseif ( $newfile_exists )
907
  $this->output_error( __( sprintf( "File %s already exists!\n", $newname ), 'all-in-one-seo-pack' ) );
 
908
  }
909
  }
 
910
  return false;
911
  }
912
 
@@ -915,28 +1077,31 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
915
  */
916
  function load_files( $options, $opts, $prefix ) {
917
  foreach ( $opts as $opt => $file ) {
918
- $opt = $prefix . $opt;
919
- $file = ABSPATH . $file;
920
  $contents = $this->load_file( $file );
921
- if ( $contents !== false ) $options[$opt] = $contents;
 
 
922
  }
 
923
  return $options;
924
  }
925
-
926
  /**
927
  * Save multiple files.
928
  */
929
  function save_files( $opts, $prefix ) {
930
  foreach ( $opts as $opt => $file ) {
931
  $opt = $prefix . $opt;
932
- if ( isset($_POST[$opt] ) ) {
933
- $output = stripslashes_deep( $_POST[$opt] );
934
- $file = ABSPATH . $file;
935
  $this->save_file( $file, $output );
936
  }
937
  }
938
  }
939
-
940
  /**
941
  * Delete multiple files.
942
  */
@@ -946,9 +1111,9 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
946
  $this->delete_file( $file );
947
  }
948
  }
949
-
950
  function get_all_images_by_type( $options = null, $p = null ) {
951
- $img = Array();
952
  if ( empty( $img ) ) {
953
  $size = apply_filters( 'post_thumbnail_size', 'large' );
954
 
@@ -962,123 +1127,146 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
962
 
963
  $count = 1;
964
 
965
- if ( !empty( $post ) ) {
966
- if ( !is_object( $post ) ) $post = get_post( $post );
967
- if ( is_object( $post ) && function_exists('get_post_thumbnail_id' ) ) {
968
- if ( $post->post_type == 'attachment' )
 
 
969
  $post_thumbnail_id = $post->ID;
970
- else
971
  $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
972
- if ( !empty( $post_thumbnail_id ) ) {
 
973
  $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
974
  if ( is_array( $image ) ) {
975
- $img[] = Array( 'type' => 'featured', 'id' => $post_thumbnail_id, 'link' => $image[0] );
976
  }
977
  }
978
  }
979
 
980
  $post_id = $post->ID;
981
- $p = $post; $w = $wp_query;
 
982
 
983
  $meta_key = '';
984
- if ( is_array( $options ) ) {
985
- if ( isset( $options['meta_key'] ) ) {
986
  $meta_key = $options['meta_key'];
987
- }
988
  }
989
 
990
- if ( !empty( $meta_key ) && !empty( $post ) ) {
991
  $meta_key = explode( ',', $meta_key );
992
- $image = $this->get_the_image_by_meta_key( Array( 'post_id' => $post->ID, 'meta_key' => $meta_key ) );
993
- if ( !empty( $image ) ) {
994
- $img[] = Array( 'type' => 'meta_key', 'id' => $meta_key, 'link' => $image );
 
 
 
995
  }
996
  }
997
 
998
- if (! $post->post_modified_gmt != '' )
999
  $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
1000
- if ( $post->post_type == 'page' )
 
1001
  $wp_query->is_page = true;
1002
- elseif ( $post->post_type == 'attachment' )
1003
  $wp_query->is_attachment = true;
1004
- else
1005
  $wp_query->is_single = true;
1006
- if ( get_option( 'show_on_front' ) == 'page' ) {
1007
- if ( $post->ID == get_option( 'page_for_posts' ) )
1008
  $wp_query->is_home = true;
1009
  }
1010
- $args['options']['type'] = 'html';
1011
  $args['options']['nowrap'] = false;
1012
- $args['options']['save'] = false;
1013
- $wp_query->queried_object = $post;
1014
-
1015
- $attachments = get_children( Array( 'post_parent' => $post->ID,
1016
- 'post_status' => 'inherit',
1017
- 'post_type' => 'attachment',
1018
- 'post_mime_type' => 'image',
1019
- 'order' => 'ASC',
1020
- 'orderby' => 'menu_order ID' ) );
1021
- if ( !empty( $attachments ) )
1022
- foreach( $attachments as $id => $attachment ) {
 
 
1023
  $image = wp_get_attachment_image_src( $id, $size );
1024
  if ( is_array( $image ) ) {
1025
- $img[] = Array( 'type' => 'attachment', 'id' => $id, 'link' => $image[0] );
1026
  }
1027
  }
1028
- $matches = Array();
 
1029
  preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
1030
- if ( isset( $matches ) && !empty( $matches[1] ) && !empty( $matches[1][0] ) )
1031
- foreach( $matches[1] as $i => $m ) {
1032
- $img[] = Array( 'type' => 'post_content', 'id' => 'post' . $count++, 'link' => $m );
1033
  }
 
1034
  wp_reset_postdata();
1035
- $wp_query = $w; $post = $p;
 
1036
  }
1037
  }
 
1038
  return $img;
1039
  }
1040
-
1041
  function get_all_images( $options = null, $p = null ) {
1042
- $img = $this->get_all_images_by_type( $options, $p );
1043
- $legacy = Array();
1044
- foreach( $img as $k => $v ) {
1045
  if ( $v['type'] == 'featured' ) {
1046
- $legacy[$v['link']] = 1;
1047
- } else {
1048
- $legacy[$v['link']] = $v['id'];
1049
  }
1050
  }
 
1051
  return $legacy;
1052
  }
1053
 
1054
  /*** Thanks to Justin Tadlock for the original get-the-image code - http://themehybrid.com/plugins/get-the-image ***/
1055
 
1056
  function get_the_image( $options = null, $p = null ) {
1057
-
1058
  if ( $p === null ) {
1059
  global $post;
1060
  } else {
1061
  $post = $p;
1062
  }
1063
-
1064
  $meta_key = '';
1065
- if ( is_array( $options ) ) {
1066
- if ( isset( $options['meta_key'] ) ) {
1067
  $meta_key = $options['meta_key'];
1068
- }
1069
  }
1070
 
1071
- if ( !empty( $meta_key ) && !empty( $post ) ) {
1072
  $meta_key = explode( ',', $meta_key );
1073
- $image = $this->get_the_image_by_meta_key( Array( 'post_id' => $post->ID, 'meta_key' => $meta_key ) );
 
 
 
 
 
 
 
 
 
1074
  }
1075
- if ( empty( $image ) ) $image = $this->get_the_image_by_post_thumbnail( $post );
1076
- if ( empty( $image ) ) $image = $this->get_the_image_by_attachment( $post );
1077
- if ( empty( $image ) ) $image = $this->get_the_image_by_scan( $post );
1078
- if ( empty( $image ) ) $image = $this->get_the_image_by_default( $post );
 
 
 
1079
  return $image;
1080
  }
1081
-
1082
  function get_the_image_by_default( $p = null ) {
1083
  return '';
1084
  }
@@ -1086,17 +1274,20 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1086
  function get_the_image_by_meta_key( $args = array() ) {
1087
 
1088
  /* If $meta_key is not an array. */
1089
- if ( !is_array( $args['meta_key'] ) )
1090
  $args['meta_key'] = array( $args['meta_key'] );
 
1091
 
1092
  /* Loop through each of the given meta keys. */
1093
  foreach ( $args['meta_key'] as $meta_key ) {
1094
  /* Get the image URL by the current meta key in the loop. */
1095
  $image = get_post_meta( $args['post_id'], $meta_key, true );
1096
  /* If a custom key value has been given for one of the keys, return the image URL. */
1097
- if ( !empty( $image ) )
1098
  return $image;
 
1099
  }
 
1100
  return false;
1101
  }
1102
 
@@ -1107,58 +1298,62 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1107
  } else {
1108
  $post = $p;
1109
  }
1110
-
1111
  $post_thumbnail_id = null;
1112
- if ( function_exists('get_post_thumbnail_id' ) ) {
1113
- $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
1114
  }
1115
 
1116
- if ( empty( $post_thumbnail_id ) )
1117
  return false;
 
 
 
 
1118
 
1119
- $size = apply_filters( 'post_thumbnail_size', 'large' );
1120
- $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
1121
- return $image[0];
1122
  }
1123
 
1124
  function get_the_image_by_attachment( $p = null ) {
1125
-
1126
  if ( $p === null ) {
1127
  global $post;
1128
  } else {
1129
  $post = $p;
1130
  }
1131
 
1132
- $attachments = get_children( Array( 'post_parent' => $post->ID,
1133
- 'post_status' => 'inherit',
1134
- 'post_type' => 'attachment',
1135
- 'post_mime_type' => 'image',
1136
- 'order' => 'ASC',
1137
- 'orderby' => 'menu_order ID' ) );
 
 
1138
 
1139
- if ( empty( $attachments ) ) {
1140
- if ( 'attachment' == get_post_type( $post->ID ) ) {
1141
  $image = wp_get_attachment_image_src( $post->ID, 'large' );
1142
- }
1143
  }
1144
 
1145
  /* If no attachments or image is found, return false. */
1146
- if ( empty( $attachments ) && empty( $image ) )
1147
  return false;
 
1148
 
1149
  /* Set the default iterator to 0. */
1150
  $i = 0;
1151
 
1152
  /* Loop through each attachment. Once the $order_of_image (default is '1') is reached, break the loop. */
1153
  foreach ( $attachments as $id => $attachment ) {
1154
- if ( ++$i == 1 ) {
1155
  $image = wp_get_attachment_image_src( $id, 'large' );
1156
- $alt = trim( strip_tags( get_post_field( 'post_excerpt', $id ) ) );
1157
  break;
1158
  }
1159
  }
1160
 
1161
  /* Return the image URL. */
 
1162
  return $image[0];
1163
 
1164
  }
@@ -1170,113 +1365,132 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1170
  } else {
1171
  $post = $p;
1172
  }
1173
-
1174
  /* Search the post's content for the <img /> tag and get its URL. */
1175
  preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
1176
 
1177
  /* If there is a match for the image, return its URL. */
1178
- if ( isset( $matches ) && !empty( $matches[1][0] ) )
1179
  return $matches[1][0];
 
1180
 
1181
  return false;
1182
  }
1183
-
1184
  /** crude approximization of whether current user is an admin */
1185
  function is_admin() {
1186
  return current_user_can( 'level_8' );
1187
  }
1188
-
1189
  function help_text_helper( &$default_options, $options, $help_link = '' ) {
1190
- foreach( $options as $o ) {
1191
  $ht = '';
1192
- if ( !empty( $this->help_text[$o] ) )
1193
- $ht = $this->help_text[$o];
1194
- elseif ( !empty( $default_options[$o]["help_text"] ) )
1195
- $ht = $default_options[$o]["help_text"];
1196
- if ( $ht && !is_array( $ht ) ) {
 
1197
  $ha = '';
1198
  $hl = $help_link;
1199
  if ( strpos( $o, 'ga_' ) === 0 ) { // special case -- pdb
1200
  $hl = 'http://semperplugins.com/documentation/advanced-google-analytics-settings/';
1201
  }
1202
- if ( !empty( $this->help_anchors[$o] ) ) $ha = $this->help_anchors[$o];
1203
- if ( ( !empty( $ha ) && ( $pos = strrpos( $hl, '#' ) ) ) ) {
 
 
1204
  $hl = substr( $hl, 0, $pos );
1205
  }
1206
- if ( ( !empty( $ha ) && ( $ha[0] == 'h' ) ) ) $hl = '';
1207
- if ( !empty( $ha ) || !isset( $this->help_anchors[$o] ) ) {
1208
- $ht .= "<br /><a href='" . $hl . $ha . "' target='_blank'>" . __( "Click here for documentation on this setting", 'all-in-one-seo-pack' ) . "</a>";
 
 
1209
  }
1210
- $default_options[$o]['help_text'] = $ht;
1211
  }
1212
  }
1213
  }
1214
-
1215
  function add_help_text_links() {
1216
- if ( !empty( $this->help_text ) ) {
1217
- foreach( $this->layout as $k => $v ) {
1218
  $this->help_text_helper( $this->default_options, $v['options'], $v['help_link'] );
1219
  }
1220
- if ( !empty( $this->locations ) )
1221
- foreach( $this->locations as $k => $v ) {
1222
- if ( !empty( $v['default_options'] ) && !empty( $v['options'] ) ) {
1223
- $this->help_text_helper( $this->locations[$k]['default_options'], $v['options'], $v['help_link'] );
1224
  }
1225
  }
 
1226
  }
1227
  }
1228
-
1229
  /**
1230
  * Load scripts and styles for metaboxes.
1231
- *
1232
  * edit-tags exists only for pre 4.5 support... remove when we drop 4.5 support.
1233
  * Also, that check and others should be pulled out into their own functions
1234
  */
1235
- function enqueue_metabox_scripts( ) {
1236
  $screen = '';
1237
- if ( function_exists( 'get_current_screen' ) )
1238
  $screen = get_current_screen();
 
1239
  $bail = false;
1240
- if ( empty( $screen ) ) $bail = true;
1241
- if ( ( $screen->base != 'post' ) && ( $screen->base != 'term' ) && ( $screen->base != 'edit-tags' ) && ( $screen->base != 'toplevel_page_shopp-products' ) ) $bail = true;
 
 
 
 
1242
  $prefix = $this->get_prefix();
1243
- $bail = apply_filters( $prefix . 'bail_on_enqueue', $bail, $screen );
1244
- if ( $bail ) return;
 
 
1245
  $this->form = 'post';
1246
- if ( $screen->base == 'term' || $screen->base == 'edit-tags' ) $this->form = 'edittag';
1247
- if ( $screen->base == 'toplevel_page_shopp-products' ) $this->form = 'product';
 
 
 
 
1248
  $this->form = apply_filters( $prefix . 'set_form_on_enqueue', $this->form, $screen );
1249
- foreach( $this->locations as $k => $v ) {
1250
- if ( $v['type'] === 'metabox' ) {
1251
- if ( isset( $v['display'] ) && !empty( $v['display'] ) ) {
1252
  $enqueue_scripts = false;
1253
  $enqueue_scripts = ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) ) || in_array( $screen->post_type, $v['display'] );
1254
  $enqueue_scripts = apply_filters( $prefix . 'enqueue_metabox_scripts', $enqueue_scripts, $screen, $v );
1255
  if ( $enqueue_scripts ) {
1256
- add_filter( 'aioseop_localize_script_data', Array( $this, 'localize_script_data' ) );
1257
- add_action( "admin_print_scripts", Array( $this, 'enqueue_scripts' ), 20 );
1258
- add_action( "admin_print_scripts", Array( $this, 'enqueue_styles' ), 20 );
1259
- }
1260
  }
1261
  }
1262
  }
1263
  }
1264
-
1265
  /**
1266
  * Load styles for module.
1267
  */
1268
- function enqueue_styles( ) {
1269
  wp_enqueue_style( 'thickbox' );
1270
- if ( !empty( $this->pointers ) ) wp_enqueue_style( 'wp-pointer' );
1271
- wp_enqueue_style( 'aioseop-module-style', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module.css' );
1272
- if ( function_exists( 'is_rtl' ) && is_rtl() )
1273
- wp_enqueue_style( 'aioseop-module-style-rtl', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module-rtl.css', array('aioseop-module-style') );
 
 
 
1274
  }
1275
-
1276
  /**
1277
  * Load scripts for module, can pass data to module script.
1278
  */
1279
- function enqueue_scripts( ) {
1280
  wp_enqueue_script( 'sack' );
1281
  wp_enqueue_script( 'jquery' );
1282
  wp_enqueue_script( 'media-upload' );
@@ -1284,198 +1498,267 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1284
  wp_enqueue_script( 'common' );
1285
  wp_enqueue_script( 'wp-lists' );
1286
  wp_enqueue_script( 'postbox' );
1287
- if ( !empty( $this->pointers ) ) {
1288
  wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
1289
  }
1290
- wp_enqueue_script( 'aioseop-module-script', AIOSEOP_PLUGIN_URL . 'js/modules/aioseop_module.js', Array(), AIOSEOP_VERSION );
1291
- if ( !empty( $this->script_data ) ) {
1292
  aioseop_localize_script_data();
1293
  }
1294
  }
1295
-
1296
  function localize_script_data( $data ) {
1297
- if ( !is_array( $data ) ) {
1298
- $data = Array( 0 => $data );
 
 
 
1299
  }
1300
- if ( empty( $this->script_data ) ) $this->script_data = Array();
1301
- if ( !empty( $this->pointers ) )
1302
  $this->script_data['pointers'] = $this->pointers;
1303
- if ( empty( $data[0]['condshow'] ) ) $data[0]['condshow'] = Array();
1304
- if ( empty( $this->script_data['condshow'] ) ) $this->script_data['condshow'] = Array();
1305
- $condshow = $this->script_data['condshow'];
 
 
 
 
 
1306
  $data[0]['condshow'] = array_merge( $data[0]['condshow'], $condshow );
1307
  unset( $this->script_data['condshow'] );
1308
- $data[0] = array_merge( $this->script_data, $data[0] );
1309
  $this->script_data['condshow'] = $condshow;
 
1310
  return $data;
1311
  }
1312
-
1313
  /**
1314
  * Override this to run code at the beginning of the settings page.
1315
  */
1316
  function settings_page_init() {
1317
-
1318
  }
1319
-
1320
  /**
1321
  * Filter out admin pointers that have already been clicked.
1322
  */
1323
  function filter_pointers() {
1324
- if ( !empty( $this->pointers ) ) {
1325
  $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
1326
- foreach( $dismissed as $d )
1327
- if ( isset( $this->pointers[$d] ) )
1328
- unset( $this->pointers[$d] );
 
 
1329
  }
1330
  }
1331
-
1332
  /**
1333
  * Add basic hooks when on the module's page.
1334
  */
1335
  function add_page_hooks() {
1336
  $hookname = current_filter();
1337
- if ( $this->strpos( $hookname, 'load-' ) === 0 )
1338
  $this->pagehook = $this->substr( $hookname, 5 );
1339
- add_action( "admin_print_scripts", Array( $this, 'enqueue_scripts' ) );
1340
- add_action( "admin_print_styles", Array( $this, 'enqueue_styles' ) );
1341
- add_filter( 'aioseop_localize_script_data', Array( $this, 'localize_script_data' ) );
1342
- add_action( $this->prefix . 'settings_header', Array( $this, 'display_tabs' ) );
 
1343
  }
1344
-
1345
  function get_admin_links() {
1346
- if ( !empty( $this->menu_name ) )
1347
  $name = $this->menu_name;
1348
- else
1349
  $name = $this->name;
1350
-
 
1351
  $hookname = plugin_basename( $this->file );
1352
-
1353
- $links = Array();
1354
- $url = '';
1355
- if ( function_exists( 'menu_page_url' ) )
1356
- $url = menu_page_url( $hookname, 0 );
1357
- if ( empty( $url ) )
1358
- $url = esc_url( admin_url( 'admin.php?page=' . $hookname ) );
1359
-
1360
- if ( $this->locations === null )
1361
- array_unshift( $links, array( 'parent' => AIOSEOP_PLUGIN_DIRNAME, 'title' => $name, 'id' => $hookname, 'href' => $url, 'order' => $this->menu_order() ) );
1362
- else {
1363
- foreach( $this->locations as $k => $v ) {
 
 
 
 
 
 
 
 
1364
  if ( $v['type'] === 'settings' ) {
1365
  if ( $k === 'default' ) {
1366
- array_unshift( $links, array( 'parent' => AIOSEOP_PLUGIN_DIRNAME, 'title' => $name, 'id' => $hookname, 'href' => $url, 'order' => $this->menu_order() ) );
 
 
 
 
 
 
1367
  } else {
1368
- if ( !empty( $v['menu_name'] ) )
1369
  $name = $v['menu_name'];
1370
- else
1371
  $name = $v['name'];
1372
- array_unshift( $links, array( 'parent' => AIOSEOP_PLUGIN_DIRNAME, 'title' => $name, 'id' => $this->get_prefix( $k ) . $k, 'href' => esc_url( admin_url( 'admin.php?page=' . $this->get_prefix( $k ) . $k ) ), 'order' => $this->menu_order() ) );
 
 
 
 
 
 
 
1373
  }
1374
  }
1375
  }
1376
  }
 
1377
  return $links;
1378
  }
1379
-
1380
  function add_admin_bar_submenu() {
1381
  global $aioseop_admin_menu, $wp_admin_bar;
1382
-
1383
  if ( $aioseop_admin_menu ) {
1384
  $links = $this->get_admin_links();
1385
- if ( !empty( $links ) )
1386
- foreach( $links as $l )
1387
  $wp_admin_bar->add_menu( $l );
 
 
1388
  }
1389
  }
1390
-
1391
  /**
1392
  * Collect metabox data together for tabbed metaboxes.
1393
  */
1394
  function filter_return_metaboxes( $args ) {
1395
  return array_merge( $args, $this->post_metaboxes );
1396
  }
1397
-
1398
  /** Add submenu for module, call page hooks, set up metaboxes. */
1399
  function add_menu( $parent_slug ) {
1400
- if ( !empty( $this->menu_name ) )
1401
  $name = $this->menu_name;
1402
- else
1403
  $name = $this->name;
 
1404
  if ( $this->locations === null ) {
1405
- $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), plugin_basename( $this->file ), Array( $this, 'display_settings_page' ) );
1406
- add_action( "load-{$hookname}", Array( $this, 'add_page_hooks' ) );
 
 
 
 
1407
  return true;
1408
  }
1409
- foreach( $this->locations as $k => $v ) {
1410
  if ( $v['type'] === 'settings' ) {
1411
  if ( $k === 'default' ) {
1412
- if ( !empty( $this->menu_name ) )
1413
  $name = $this->menu_name;
1414
- else
1415
  $name = $this->name;
1416
- $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), plugin_basename( $this->file ), Array( $this, 'display_settings_page' ) );
 
 
 
 
1417
  } else {
1418
- if ( !empty( $v['menu_name'] ) )
1419
  $name = $v['menu_name'];
1420
- else
1421
  $name = $v['name'];
1422
- $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $this->get_prefix( $k ) . $k, Array( $this, "display_settings_page_$k" ) );
 
 
 
 
1423
  }
1424
- add_action( "load-{$hookname}", Array( $this, 'add_page_hooks' ) );
1425
  } elseif ( $v['type'] === 'metabox' ) {
1426
  $this->setting_options( $k ); // hack -- make sure this runs anyhow, for now -- pdb
1427
- add_action( 'edit_post', array( $this, 'save_post_data' ) );
1428
- add_action( 'publish_post', array( $this, 'save_post_data' ) );
1429
- add_action( 'add_attachment', array( $this, 'save_post_data' ) );
1430
- add_action( 'edit_attachment', array( $this, 'save_post_data' ) );
1431
- add_action( 'save_post', array( $this, 'save_post_data' ) );
1432
- add_action( 'edit_page_form', array( $this, 'save_post_data' ) );
1433
- if ( isset( $v['display'] ) && !empty( $v['display'] ) ) {
1434
- add_action( "admin_print_scripts", Array( $this, 'enqueue_metabox_scripts' ), 5 );
1435
- if ( $this->tabbed_metaboxes )
1436
- add_filter( 'aioseop_add_post_metabox', Array( $this, 'filter_return_metaboxes' ) );
 
1437
  foreach ( $v['display'] as $posttype ) {
1438
  $v['location'] = $k;
1439
  $v['posttype'] = $posttype;
1440
- if ( !isset($v['context'] ) ) $v['context'] = 'advanced';
1441
- if ( !isset($v['priority'] ) ) $v['priority'] = 'default';
 
 
 
 
1442
  if ( $this->tabbed_metaboxes ) {
1443
- $this->post_metaboxes[] = Array( 'id' => $v['prefix'] . $k, 'title' => $v['name'], 'callback' => Array( $this, 'display_metabox' ),
1444
- 'post_type' => $posttype, 'context' => $v['context'], 'priority' => $v['priority'], 'callback_args' => $v );
 
 
 
 
 
 
 
1445
  } else {
1446
  $title = $v['name'];
1447
- if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
1448
- if ( !empty( $v['help_link'] ) )
1449
- $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . "</span></a>";
1450
- add_meta_box( $v['prefix'] . $k, $title, Array( $this, 'display_metabox' ), $posttype, $v['context'], $v['priority'], $v );
 
 
 
 
 
 
1451
  }
1452
  }
1453
  }
1454
  }
1455
  }
1456
  }
1457
-
1458
  /**
1459
  * Update postmeta for metabox.
1460
  */
1461
  function save_post_data( $post_id ) {
1462
  static $update = false;
1463
- if ( $update ) return;
 
 
1464
  if ( $this->locations !== null ) {
1465
- foreach( $this->locations as $k => $v ) {
1466
- if ( isset($v['type']) && ( $v['type'] === 'metabox' ) ) {
1467
- $opts = $this->default_options( $k );
1468
- $options = Array();
1469
- $update = false;
1470
  foreach ( $opts as $l => $o ) {
1471
- if ( isset($_POST[$l] ) ) {
1472
- $options[$l] = stripslashes_deep( $_POST[$l] );
1473
- $options[$l] = esc_attr( $options[$l] );
1474
- $update = true;
1475
  }
1476
  }
1477
  if ( $update ) {
1478
- $prefix = $this->get_prefix( $k );
1479
  $options = apply_filters( $prefix . 'filter_metabox_options', $options, $k, $post_id );
1480
  update_post_meta( $post_id, '_' . $prefix . $k, $options );
1481
  }
@@ -1483,244 +1766,343 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1483
  }
1484
  }
1485
  }
1486
-
1487
  /**
1488
  * Outputs radio buttons, checkboxes, selects, multiselects, handles groups.
1489
- */
1490
  function do_multi_input( $args ) {
1491
  extract( $args );
1492
  $buf1 = '';
1493
  $type = $options['type'];
1494
  if ( ( $type == 'radio' ) || ( $type == 'checkbox' ) ) {
1495
- $strings = Array(
1496
- 'block' => "%s\n",
1497
- 'group' => "\t<b>%s</b><br>\n%s\n",
1498
- 'item' => "\t<label class='aioseop_option_setting_label'><input type='$type' %s name='%s' value='%s' %s> %s</label>\n",
1499
- 'item_args' => Array( 'sel', 'name', 'v', 'attr', 'subopt' ),
1500
- 'selected' => 'checked '
1501
- );
1502
  } else {
1503
- $strings = Array(
1504
- 'block' => "<select name='$name' $attr>%s\n</select>\n",
1505
- 'group' => "\t<optgroup label='%s'>\n%s\t</optgroup>\n",
1506
- 'item' => "\t<option %s value='%s'>%s</option>\n",
1507
- 'item_args' => Array( 'sel', 'v', 'subopt' ),
1508
- 'selected' => 'selected '
1509
- );
1510
  }
1511
  $setsel = $strings['selected'];
1512
- if ( isset($options['initial_options'] ) && is_array($options['initial_options']) ) {
1513
  foreach ( $options['initial_options'] as $l => $option ) {
1514
  $is_group = is_array( $option );
1515
- if ( !$is_group ) $option = Array( $l => $option );
 
 
1516
  $buf2 = '';
1517
  foreach ( $option as $v => $subopt ) {
1518
- $sel = '';
1519
  $is_arr = is_array( $value );
1520
  if ( is_string( $v ) || is_string( $value ) ) {
1521
- if ( is_string( $value ) )
1522
- $cmp = !strcmp( $v, $value );
1523
- else
1524
- $cmp = !strcmp( $v, "" );
1525
- // $cmp = !strcmp( (string)$v, (string)$value );
1526
- } else
 
1527
  $cmp = ( $value == $v );
1528
- if ( ( !$is_arr && $cmp ) || ( $is_arr && in_array( $v, $value ) ) )
 
1529
  $sel = $setsel;
1530
- $item_arr = Array();
1531
- foreach( $strings['item_args'] as $arg ) $item_arr[] = $$arg;
 
 
 
1532
  $buf2 .= vsprintf( $strings['item'], $item_arr );
1533
  }
1534
- if ( $is_group )
1535
- $buf1 .= sprintf( $strings['group'], $l, $buf2);
1536
- else
1537
  $buf1 .= $buf2;
1538
- }
 
1539
  $buf1 = sprintf( $strings['block'], $buf1 );
1540
  }
 
1541
  return $buf1;
1542
  }
1543
-
1544
  /**
1545
  * Outputs a setting item for settings pages and metaboxes.
1546
  */
1547
  function get_option_html( $args ) {
1548
  static $n = 0;
1549
  extract( $args );
1550
- if ( $options['type'] == 'custom' )
1551
- return apply_filters( "{$prefix}output_option", '', $args );
1552
- if ( in_array( $options['type'], Array( 'multiselect', 'select', 'multicheckbox', 'radio', 'checkbox', 'textarea', 'text', 'submit', 'hidden' ) ) && ( is_string( $value ) ) )
 
 
 
 
 
 
 
 
 
 
 
 
1553
  $value = esc_attr( $value );
1554
- $buf = '';
 
1555
  $onload = '';
1556
- if ( !empty( $options['count'] ) ) {
1557
- $n++;
1558
  $attr .= " onKeyDown='if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)' onKeyUp='if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)'";
1559
  $onload = "if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n);";
1560
  }
1561
- if ( isset( $opts['id'] ) ) $attr .= " id=\"{$opts['id']}\" ";
 
 
1562
  switch ( $options['type'] ) {
1563
- case 'multiselect': $attr .= ' MULTIPLE';
1564
- $args['attr'] = $attr;
1565
- $args['name'] = $name = "{$name}[]";
1566
- case 'select': $buf .= $this->do_multi_input( $args ); break;
1567
- case 'multicheckbox': $args['name'] = $name = "{$name}[]";
1568
- $args['options']['type'] = $options['type'] = 'checkbox';
1569
- case 'radio': $buf .= $this->do_multi_input( $args ); break;
1570
- case 'checkbox': if ( $value ) $attr .= ' CHECKED';
1571
- $buf .= "<input name='$name' type='{$options['type']}' $attr>\n"; break;
1572
- case 'textarea': $buf .= "<textarea name='$name' $attr>$value</textarea>"; break;
1573
- case 'image': $buf .= "<input class='aioseop_upload_image_button button-primary' type='button' value='Upload Image' style='float:left;' />" .
1574
- "<input class='aioseop_upload_image_label' name='$name' type='text' $attr value='$value' size=57 style='float:left;clear:left;'>\n";
1575
- break;
1576
- case 'html': $buf .= $value; break;
1577
- default: $buf .= "<input name='$name' type='{$options['type']}' $attr value='$value'>\n";
1578
- }
1579
- if ( !empty( $options['count'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1580
  $size = 60;
1581
- if ( isset( $options['size'] ) ) $size = $options['size'];
1582
- elseif ( isset( $options['rows'] ) && isset( $options['cols'] ) ) $size = $options['rows'] * $options['cols'];
1583
- if ( isset( $options['count_desc'] ) )
 
 
 
1584
  $count_desc = $options['count_desc'];
1585
- else
1586
  $count_desc = __( ' characters. Most search engines use a maximum of %s chars for the %s.', 'all-in-one-seo-pack' );
1587
- $buf .= "<br /><input readonly type='text' name='{$prefix}length$n' size='3' maxlength='3' style='width:53px;height:23px;margin:0px;padding:0px 0px 0px 10px;' value='" . $this->strlen($value) . "' />"
1588
- . sprintf( $count_desc, $size, trim( $this->strtolower( $options['name'] ), ':' ) );
1589
- if ( !empty( $onload ) ) $buf .= "<script>jQuery( document ).ready(function() { {$onload} });</script>";
 
 
 
1590
  }
 
1591
  return $buf;
1592
  }
1593
-
1594
- const DISPLAY_HELP_START = '<a class="aioseop_help_text_link" style="cursor:pointer;" title="%s" onclick="toggleVisibility(\'%s_tip\');"><label class="aioseop_label textinput">%s</label></a>';
1595
- const DISPLAY_HELP_END = '<div class="aioseop_help_text_div" style="display:none" id="%s_tip"><label class="aioseop_help_text">%s</label></div>';
1596
- const DISPLAY_LABEL_FORMAT = '<span class="aioseop_option_label" style="text-align:%s;vertical-align:top;">%s</span>';
1597
- const DISPLAY_TOP_LABEL = "</div>\n<div class='aioseop_input aioseop_top_label'>\n";
1598
- const DISPLAY_ROW_TEMPLATE = '<div class="aioseop_wrapper%s" id="%s_wrapper"><div class="aioseop_input">%s<span class="aioseop_option_input"><div class="aioseop_option_div" %s>%s</div>%s</span><p style="clear:left"></p></div></div>';
1599
-
1600
  /**
1601
  * Format a row for an option on a settings page.
1602
  */
1603
  function get_option_row( $name, $opts, $args ) {
1604
  $label_text = $input_attr = $help_text_2 = $id_attr = '';
1605
- if ( $opts['label'] == 'top' )
1606
- $align = 'left';
1607
- else
1608
  $align = 'right';
1609
- if ( isset( $opts['id'] ) ) $id_attr .= " id=\"{$opts['id']}_div\" ";
1610
- if ( $opts['label'] != 'none' ) {
 
 
 
1611
  if ( isset( $opts['help_text'] ) ) {
1612
- $help_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_START, __( 'Click for Help!', 'all-in-one-seo-pack' ), $name, $opts['name'] );
1613
- $help_text_2 = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_END, $name, $opts['help_text'] );
1614
- } else $help_text = $opts['name'];
 
 
1615
  $label_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_LABEL_FORMAT, $align, $help_text );
1616
- } else $input_attr .= ' aioseop_no_label ';
1617
- if ( $opts['label'] == 'top' ) $label_text .= All_in_One_SEO_Pack_Module::DISPLAY_TOP_LABEL;
 
 
 
 
1618
  $input_attr .= " aioseop_{$opts['type']}_type";
 
1619
  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 );
1620
  }
1621
-
1622
  /**
1623
  * Display options for settings pages and metaboxes, allows for filtering settings, custom display options.
1624
  */
1625
  function display_options( $location = null, $meta_args = null ) {
1626
- static $location_settings = Array();
1627
- $defaults = null;
1628
- $prefix = $this->get_prefix( $location );
1629
- $help_link = '';
1630
- if ( is_array( $meta_args['args'] ) && !empty( $meta_args['args']['default_options'] ) ) {
1631
- $defaults = $meta_args['args']['default_options'];
1632
- }
1633
- if ( !empty( $meta_args['callback_args'] ) ) {
1634
- if ( !empty( $meta_args['callback_args']['help_link'] ) ) {
1635
- $help_link = $meta_args['callback_args']['help_link'];
1636
- }
1637
- }
1638
- if ( !empty( $help_link ) )
1639
- echo "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $help_link . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . "</span></a>";
1640
-
1641
- if ( !isset( $location_settings[$prefix] ) ) {
1642
- $current_options = apply_filters( "{$this->prefix}display_options", $this->get_current_options( Array(), $location, $defaults ), $location );
1643
- $settings = apply_filters( "{$this->prefix}display_settings", $this->setting_options( $location, $defaults ), $location, $current_options );
1644
- $current_options = apply_filters( "{$this->prefix}override_options", $current_options, $location, $settings );
1645
- $location_settings[$prefix]['current_options'] = $current_options;
1646
- $location_settings[$prefix]['settings'] = $settings;
1647
- } else {
1648
- $current_options = $location_settings[$prefix]['current_options'];
1649
- $settings = $location_settings[$prefix]['settings'];
1650
- }
1651
- // $opts["snippet"]["default"] = sprintf( $opts["snippet"]["default"], "foo", "bar", "moby" );
1652
- $container = "<div class='aioseop aioseop_options {$this->prefix}settings'>";
1653
- if ( is_array( $meta_args['args'] ) && !empty( $meta_args['args']['options'] ) ) {
1654
- $args = Array();
1655
- $arg_keys = Array();
1656
- foreach ( $meta_args['args']['options'] as $a ) {
1657
- if ( !empty($location) ) {
1658
- $key = $prefix . $location . '_' . $a;
1659
- if ( !isset( $settings[$key] ) ) $key = $a;
1660
- } else $key = $prefix . $a;
1661
- if ( isset( $settings[$key] ) ) $arg_keys[$key] = 1;
1662
- elseif ( isset( $settings[$a] ) ) $arg_keys[$a] = 1;
1663
- }
1664
- $setting_keys = array_keys( $settings );
1665
- foreach ( $setting_keys as $s )
1666
- if ( !empty( $arg_keys[$s] ) ) $args[$s] = $settings[$s];
1667
- } else $args = $settings;
1668
- foreach ( $args as $name => $opts ) {
1669
- $attr_list = Array( 'class', 'style', 'readonly', 'disabled', 'size', 'placeholder' );
1670
- if ( $opts['type'] == 'textarea' ) $attr_list = array_merge( $attr_list, Array('rows', 'cols') );
1671
- $attr = '';
1672
- foreach ( $attr_list as $a )
1673
- if ( isset( $opts[$a] ) ) $attr .= ' ' . $a . '="' . esc_attr( $opts[$a] ) . '" ';
1674
- $opt = '';
1675
- if ( isset( $current_options[$name] ) ) $opt = $current_options[$name];
1676
- if ( $opts['label'] == 'none' && $opts['type'] == 'submit' && $opts['save'] == false ) $opt = $opts['name'];
1677
- if ( $opts['type'] == 'html' && empty( $opt ) && $opts['save'] == false ) $opt = $opts['default'];
1678
-
1679
- $args = Array( 'name' => $name, 'options' => $opts, 'attr' => $attr, 'value' => $opt, 'prefix' => $prefix );
1680
- if ( !empty( $opts['nowrap'] ) )
1681
- echo $this->get_option_html( $args );
1682
- else {
1683
- if ( $container ) {
1684
- echo $container;
1685
- $container = '';
1686
  }
1687
- echo $this->get_option_row( $name, $opts, $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1688
  }
1689
  }
1690
- if ( !$container ) echo "</div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1691
  }
1692
-
1693
  function sanitize_domain( $domain ) {
1694
  $domain = trim( $domain );
1695
  $domain = $this->strtolower( $domain );
1696
- if ( $this->strpos( $domain, "http://" ) === 0 ) $domain = $this->substr( $domain, 7 );
1697
- elseif ( $this->strpos( $domain, "https://" ) === 0 ) $domain = $this->substr( $domain, 8 );
 
 
 
1698
  $domain = untrailingslashit( $domain );
 
1699
  return $domain;
1700
  }
1701
 
1702
  /** Sanitize options */
1703
  function sanitize_options( $location = null ) {
1704
  foreach ( $this->setting_options( $location ) as $k => $v ) {
1705
- if ( isset( $this->options[$k] ) ) {
1706
- if ( !empty( $v['sanitize'] ) )
1707
  $type = $v['sanitize'];
1708
- else
1709
  $type = $v['type'];
 
1710
  switch ( $type ) {
1711
  case 'multiselect':
1712
- case 'multicheckbox': $this->options[$k] = urlencode_deep( $this->options[$k] );
1713
- break;
1714
- case 'textarea': $this->options[$k] = wp_kses_post( $this->options[$k] );
1715
- $this->options[$k] = htmlspecialchars( $this->options[$k], ENT_QUOTES );
1716
- break;
1717
- case 'filename': $this->options[$k] = sanitize_file_name( $this->options[$k] );
1718
- break;
1719
- case 'text': $this->options[$k] = wp_kses_post( $this->options[$k] );
 
 
 
 
1720
  case 'checkbox':
1721
  case 'radio':
1722
  case 'select':
1723
- default: if ( !is_array( $this->options[$k] ) ) $this->options[$k] = esc_attr( $this->options[$k] );
 
 
 
1724
  }
1725
  }
1726
  }
@@ -1739,39 +2121,43 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1739
  function reset_options( $location = null, $delete = false ) {
1740
  if ( $delete === true ) {
1741
  $this->delete_class_option( $delete );
1742
- $this->options = Array();
1743
  }
1744
  $default_options = $this->default_options( $location );
1745
  foreach ( $default_options as $k => $v ) {
1746
- $this->options[$k] = $v;
1747
  }
1748
  $this->update_class_option( $this->options );
1749
  }
1750
-
1751
  /** handle option resetting and updating */
1752
  function handle_settings_updates( $location = null ) {
1753
  $message = '';
1754
- if ( (isset($_POST['action']) && $_POST['action'] == 'aiosp_update_module' &&
1755
- ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) || !empty( $_POST['Submit'] ) ) ) ) {
 
1756
  $nonce = $_POST['nonce-aioseop'];
1757
- 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' ) );
 
 
1758
  if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) {
1759
- $message = __( "Options Reset.", 'all-in-one-seo-pack' );
1760
- if ( isset($_POST['Submit_All_Default']) ) {
1761
  $this->reset_options( $location, true );
1762
  do_action( 'aioseop_options_reset' );
1763
  } else {
1764
  $this->reset_options( $location );
1765
  }
1766
  }
1767
- if ( !empty( $_POST['Submit'] ) ) {
1768
- $message = __("All in One SEO Options Updated.", 'all-in-one-seo-pack');
1769
  $default_options = $this->default_options( $location );
1770
- foreach( $default_options as $k => $v ) {
1771
- if ( isset( $_POST[$k] ) )
1772
- $this->options[$k] = stripslashes_deep( $_POST[$k] );
1773
- else
1774
- $this->options[$k] = '';
 
1775
  }
1776
  $this->sanitize_options( $location );
1777
  $this->options = apply_filters( $this->prefix . 'update_options', $this->options, $location );
@@ -1780,202 +2166,312 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1780
  }
1781
  do_action( $this->prefix . 'settings_update', $this->options, $location );
1782
  }
 
1783
  return $message;
1784
  }
1785
 
1786
  /** Update / reset settings, printing options, sanitizing, posting back */
1787
  function display_settings_page( $location = null ) {
1788
- if ( $location != null ) $location_info = $this->locations[$location];
1789
- $name = null;
1790
- if ( ( $location ) && ( isset( $location_info['name'] ) ) ) $name = $location_info['name'];
1791
- if ( !$name ) $name = $this->name;
1792
- $message = $this->handle_settings_updates( $location );
1793
- $this->settings_page_init();
1794
- ?>
1795
- <div class="wrap <?php echo get_class( $this ); ?>">
1796
- <div id="aioseop_settings_header">
1797
- <?php if ( !empty( $message ) ) echo "<div id=\"message\" class=\"updated fade\"><p>$message</p></div>"; ?>
1798
- <div id="icon-aioseop" class="icon32"><br></div><h2><?php echo $name; ?></h2>
1799
- <div id="dropmessage" class="updated" style="display:none;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1800
  </div>
1801
- <?php
1802
- do_action( 'aioseop_global_settings_header', $location );
1803
- do_action( $this->prefix . 'settings_header', $location );
1804
- ?> <form id="aiosp_settings_form" name="dofollow" enctype="multipart/form-data" action="" method="post">
1805
- <div id="aioseop_top_button">
1806
- <div id="aiosp_ajax_settings_message"></div>
1807
- <?php
1808
-
1809
- $submit_options = Array('action' => Array( 'type' => 'hidden', 'value' => 'aiosp_update_module' ),
1810
- 'module' => Array( 'type' => 'hidden', 'value' => get_class( $this ) ),
1811
- 'location' => Array( 'type' => 'hidden', 'value' => $location ),
1812
- 'nonce-aioseop' => Array( 'type' => 'hidden', 'value' => wp_create_nonce('aioseop-nonce') ),
1813
- 'page_options' => Array( 'type' => 'hidden', 'value' => 'aiosp_home_description' ),
1814
- 'Submit' => Array( 'type' => 'submit', 'class' => 'button-primary', 'value' => __('Update Options', 'all-in-one-seo-pack') . ' &raquo;' ),
1815
- 'Submit_Default'=> Array( 'type' => 'submit', 'class' => 'button-secondary', 'value' => __( sprintf( 'Reset %s Settings to Defaults', $name ), 'all-in-one-seo-pack') . ' &raquo;' )
1816
- );
1817
- $submit_options = apply_filters( "{$this->prefix}submit_options", $submit_options, $location );
1818
- foreach ( $submit_options as $k => $s ) {
1819
- if ( $s['type'] == 'submit' && $k != 'Submit' ) continue;
1820
- $class = '';
1821
- if ( isset( $s['class'] ) ) $class = " class='{$s['class']}' ";
1822
- echo $this->get_option_html( Array( 'name' => $k, 'options' => $s, 'attr' => $class, 'value' => $s['value'] ) );
1823
- }
1824
- ?>
1825
- </div>
1826
  <div class="aioseop_options_wrapper aioseop_settings_left">
1827
- <?php $opts = $this->get_class_option();
1828
- if ($opts !== FALSE) $this->options = $opts;
 
 
1829
  if ( is_array( $this->layout ) ) {
1830
- foreach( $this->layout as $l => $lopts ) {
1831
- if ( !isset( $lopts['tab'] ) || ( $this->current_tab == $lopts['tab'] ) ) {
1832
  $title = $lopts['name'];
1833
- if ( !empty( $lopts['help_link'] ) )
1834
- $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . "</span></a>";
1835
- add_meta_box( $this->get_prefix( $location ) . $l . "_metabox", $title, array($this, 'display_options' ),
1836
- "{$this->prefix}settings", 'advanced', 'default', $lopts );
 
 
 
 
1837
  }
1838
  }
1839
- } else add_meta_box( $this->get_prefix( $location ) . "metabox", $name, array($this, 'display_options'), "{$this->prefix}settings", 'advanced');
 
 
 
 
 
1840
  do_meta_boxes( "{$this->prefix}settings", 'advanced', $location );
1841
- ?> <p class="submit" style="clear:both;"><?php
1842
- foreach( Array( 'action', 'nonce-aioseop', 'page_options' ) as $submit_field )
1843
- if ( isset( $submit_field ) ) unset( $submit_field );
1844
- foreach ( $submit_options as $k => $s ) {
1845
- $class = '';
1846
- if ( isset( $s['class'] ) ) $class = " class='{$s['class']}' ";
1847
- echo $this->get_option_html( Array( 'name' => $k, 'options' => $s, 'attr' => $class, 'value' => $s['value'] ) );
1848
- }
1849
- ?> </p>
1850
- </div>
 
 
 
 
 
 
 
 
 
 
1851
  </form>
1852
- <?php do_action( $this->prefix . 'settings_footer', $location );
1853
- do_action( 'aioseop_global_settings_footer', $location ); ?>
1854
- </div> <?php
1855
  }
1856
-
1857
  /**
1858
  * Get the prefix used for a given location.
1859
  */
1860
  function get_prefix( $location = null ) {
1861
- if ( ($location != null ) && isset($this->locations[$location]['prefix'] ) )
1862
- return $this->locations[$location]['prefix'];
 
 
1863
  return $this->prefix;
1864
  }
1865
 
1866
  /** Sets up initial settings */
1867
  function setting_options( $location = null, $defaults = null ) {
1868
- if ( $defaults === null )
1869
  $defaults = $this->default_options;
 
1870
  $prefix = $this->get_prefix( $location );
1871
- $opts = Array();
1872
- if ( $location == null || $this->locations[$location]['options'] === null )
1873
  $options = $defaults;
1874
- else {
1875
- $options = Array();
1876
- $prefix = "{$prefix}{$location}_";
1877
- if ( !empty( $this->locations[$location]['default_options'] ) )
1878
- $options = $this->locations[$location]['default_options'];
1879
- foreach( $this->locations[$location]['options'] as $opt ) {
1880
- if ( isset( $defaults[$opt] ) )
1881
- $options[$opt] = $defaults[$opt];
1882
- }
1883
- }
1884
- if ( !$prefix ) $prefix = $this->prefix;
1885
- if ( !empty( $options ) )
1886
- foreach ($options as $k => $v) {
1887
- if ( !isset( $v['name'] ) ) $v['name'] = $this->ucwords( strtr( $k, '_', ' ' ) );
1888
- if ( !isset( $v['type'] ) ) $v['type'] = 'checkbox';
1889
- if ( !isset( $v['default'] ) ) $v['default'] = null;
1890
- if ( !isset( $v['initial_options'] ) ) $v['initial_options'] = $v['default'];
1891
- if ( $v['type'] == 'custom' && ( !isset( $v['nowrap'] ) ) ) $v['nowrap'] = true;
1892
- elseif ( !isset( $v['nowrap'] ) ) $v['nowrap'] = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1893
  if ( isset( $v['condshow'] ) ) {
1894
- if ( !is_array( $this->script_data ) ) $this->script_data = Array();
1895
- if ( !isset( $this->script_data['condshow'] ) ) $this->script_data['condshow'] = Array();
1896
- $this->script_data['condshow'][$prefix . $k] = $v['condshow'];
 
 
 
 
1897
  }
1898
  if ( $v['type'] == 'submit' ) {
1899
- if ( !isset($v['save'] ) ) $v['save'] = false;
1900
- if ( !isset($v['label'] ) ) $v['label'] = 'none';
1901
- if ( !isset($v['prefix'] ) ) $v['prefix'] = false;
 
 
 
 
 
 
1902
  } else {
1903
- if ( !isset($v['label'] ) ) $v['label'] = null;
 
 
1904
  }
1905
  if ( $v['type'] == 'hidden' ) {
1906
- if ( !isset($v['label']) ) $v['label'] = 'none';
1907
- if ( !isset($v['prefix']) ) $v['prefix'] = false;
 
 
 
 
 
 
 
1908
  }
1909
- if ( ( $v['type'] == 'text' ) && ( !isset( $v['size'] ) ) ) $v['size'] = 57;
1910
  if ( $v['type'] == 'textarea' ) {
1911
- if ( !isset($v['cols'])) $v['cols'] = 57;
1912
- if ( !isset($v['rows'])) $v['rows'] = 2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1913
  }
1914
- if ( !isset($v['save']) ) $v['save'] = true;
1915
- if ( !isset($v['prefix']) ) $v['prefix'] = true;
1916
- if ( $v['prefix'] )
1917
- $opts[$prefix . $k] = $v;
1918
- else
1919
- $opts[$k] = $v;
1920
  }
 
 
1921
  return $opts;
1922
  }
1923
 
1924
  /** Generates just the default option names and values */
1925
  function default_options( $location = null, $defaults = null ) {
1926
  $options = $this->setting_options( $location, $defaults );
1927
- $opts = Array();
1928
- foreach ( $options as $k => $v ) if ( $v['save'] ) $opts[$k] = $v['default'];
 
 
 
 
 
1929
  return $opts;
1930
  }
1931
-
1932
  /** Gets the current options stored for a given location. */
1933
- function get_current_options( $opts = Array(), $location = null, $defaults = null, $post = null ) {
1934
- $prefix = $this->get_prefix( $location );
1935
  $get_opts = '';
1936
- if ( empty( $location ) )
1937
  $type = 'settings';
1938
- else
1939
- $type = $this->locations[$location]['type'];
 
1940
  if ( $type === 'settings' ) {
1941
  $get_opts = $this->get_class_option();
1942
  } elseif ( $type == 'metabox' ) {
1943
  if ( $post == null ) {
1944
  global $post;
1945
  }
1946
-
1947
  if ( ( isset( $_GET['taxonomy'] ) && isset( $_GET['tag_ID'] ) ) || is_category() || is_tag() || is_tax() ) {
1948
 
1949
  if ( AIOSEOPPRO ) {
1950
  $get_opts = AIO_ProGeneral::getprotax( $get_opts );
1951
  }
1952
-
1953
  } elseif ( isset( $post ) ) {
1954
  $get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
1955
  }
1956
  }
1957
  $defs = $this->default_options( $location, $defaults );
1958
- if ($get_opts == '')
1959
  $get_opts = $defs;
1960
- else
1961
  $get_opts = wp_parse_args( $get_opts, $defs );
 
1962
  $opts = wp_parse_args( $opts, $get_opts );
 
1963
  return $opts;
1964
  }
1965
 
1966
  /** Updates the options array in the module; loads saved settings with get_option() or uses defaults */
1967
- function update_options( $opts = Array(), $location = null, $defaults = null ) {
1968
- if ($location === null )
1969
  $type = 'settings';
1970
- else
1971
- $type = $this->locations[$location][$type];
 
1972
  if ( $type === 'settings' ) {
1973
  $get_opts = $this->get_class_option();
1974
  }
1975
- if ($get_opts === FALSE)
1976
  $get_opts = $this->default_options( $location, $defaults );
1977
- else
1978
- $this->setting_options( $location, $defaults ); // hack -- make sure this runs anyhow, for now -- pdb
 
1979
  $this->options = wp_parse_args( $opts, $get_opts );
1980
  }
1981
  }
5
  /**
6
  * The module base class; handles settings, options, menus, metaboxes, etc.
7
  */
8
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
9
  abstract class All_in_One_SEO_Pack_Module {
10
  public static $instance = null;
11
  protected $plugin_name;
16
  protected $options;
17
  protected $option_name;
18
  protected $default_options;
19
+ protected $help_text = array();
20
+ protected $help_anchors = array();
21
+ protected $locations = null; // organize settings into settings pages with a menu items and/or metaboxes on post types edit screen; optional
22
+ protected $layout = null; // organize settings on a settings page into multiple, separate metaboxes; optional
23
+ protected $tabs = null; // organize layouts on a settings page into multiple, separate tabs; optional
24
+ protected $current_tab = null; // the current tab
25
+ protected $pagehook = null; // the current page hook
26
  protected $store_option = false;
27
  protected $parent_option = 'aioseop_options';
28
+ protected $post_metaboxes = array();
29
  protected $tabbed_metaboxes = true;
30
  protected $credentials = false; // used for WP Filesystem
31
+ protected $script_data = null; // used for passing data to JavaScript
32
  protected $plugin_path = null;
33
+ protected $pointers = array();
34
  protected $form = 'dofollow';
35
+
36
  /**
37
  * Handles calls to display_settings_page_{$location}, does error checking.
38
  */
39
  function __call( $name, $arguments ) {
40
+ if ( $this->strpos( $name, 'display_settings_page_' ) === 0 ) {
41
  return $this->display_settings_page( $this->substr( $name, 22 ) );
42
+ }
43
  $error = __( sprintf( "Method %s doesn't exist", $name ), 'all-in-one-seo-pack' );
44
+ if ( class_exists( 'BadMethodCallException' ) ) {
45
  throw new BadMethodCallException( $error );
46
+ }
47
  throw new Exception( $error );
48
  }
49
+
50
  function __construct() {
51
+ if ( empty( $this->file ) ) {
52
+ $this->file = __FILE__;
53
+ }
54
  $this->plugin_name = AIOSEOP_PLUGIN_NAME;
55
+ $this->plugin_path = array();
56
  // $this->plugin_path['dir'] = plugin_dir_path( $this->file );
57
+ $this->plugin_path['basename'] = plugin_basename( $this->file );
58
+ $this->plugin_path['dirname'] = dirname( $this->plugin_path['basename'] );
59
+ $this->plugin_path['url'] = plugin_dir_url( $this->file );
60
+ $this->plugin_path['images_url'] = $this->plugin_path['url'] . 'images';
61
  $this->script_data['plugin_path'] = $this->plugin_path;
62
  }
63
 
64
  /**
65
  * Get options for module, stored individually or together.
66
  */
67
+ function get_class_option() {
68
  $option_name = $this->get_option_name();
69
  if ( $this->store_option || $option_name == $this->parent_option ) {
70
  return get_option( $option_name );
71
  } else {
72
  $option = get_option( $this->parent_option );
73
+ if ( isset( $option['modules'] ) && isset( $option['modules'][ $option_name ] ) ) {
74
+ return $option['modules'][ $option_name ];
75
+ }
76
  }
77
+
78
  return false;
79
  }
80
 
82
  * Update options for module, stored individually or together.
83
  */
84
  function update_class_option( $option_data, $option_name = false ) {
85
+ if ( $option_name == false ) {
86
  $option_name = $this->get_option_name();
87
+ }
88
  if ( $this->store_option || $option_name == $this->parent_option ) {
89
  return update_option( $option_name, $option_data );
90
  } else {
91
  $option = get_option( $this->parent_option );
92
+ if ( ! isset( $option['modules'] ) ) {
93
+ $option['modules'] = array();
94
+ }
95
+ $option['modules'][ $option_name ] = $option_data;
96
+
97
  return update_option( $this->parent_option, $option );
98
  }
99
  }
100
+
101
  /**
102
  * Delete options for module, stored individually or together.
103
  */
107
  delete_option( $option_name );
108
  } else {
109
  $option = get_option( $this->parent_option );
110
+ if ( isset( $option['modules'] ) && isset( $option['modules'][ $option_name ] ) ) {
111
+ unset( $option['modules'][ $option_name ] );
112
+
113
  return update_option( $this->parent_option, $option );
114
  }
115
  }
116
+
117
  return false;
118
  }
119
 
121
  * Get the option name with prefix.
122
  */
123
  function get_option_name() {
124
+ if ( ! isset( $this->option_name ) || empty( $this->option_name ) ) {
125
  $this->option_name = $this->prefix . 'options';
126
+ }
127
+
128
  return $this->option_name;
129
  }
130
 
133
  */
134
  function option_isset( $option, $location = null ) {
135
  $prefix = $this->get_prefix( $location );
136
+ $opt = $prefix . $option;
137
+
138
+ return ( isset( $this->options[ $opt ] ) && $this->options[ $opt ] );
139
  }
140
+
141
  /*** Case conversion; handle non UTF-8 encodings and fallback ***/
142
 
143
  function convert_case( $str, $mode = 'upper' ) {
144
  static $charset = null;
145
+ if ( $charset == null ) {
146
+ $charset = get_bloginfo( 'charset' );
147
+ }
148
+ $str = (string) $str;
149
  if ( $mode == 'title' ) {
150
+ if ( function_exists( 'mb_convert_case' ) ) {
151
  return mb_convert_case( $str, MB_CASE_TITLE, $charset );
152
+ } else {
153
  return ucwords( $str );
154
+ }
155
  }
156
+
157
  if ( $charset == 'UTF-8' ) {
158
  global $UTF8_TABLES;
159
  include_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_UTF8.php' );
160
  if ( is_array( $UTF8_TABLES ) ) {
161
+ if ( $mode == 'upper' ) {
162
+ return strtr( $str, $UTF8_TABLES['strtoupper'] );
163
+ }
164
+ if ( $mode == 'lower' ) {
165
+ return strtr( $str, $UTF8_TABLES['strtolower'] );
166
+ }
167
  }
168
  }
169
+
170
  if ( $mode == 'upper' ) {
171
+ if ( function_exists( 'mb_strtoupper' ) ) {
172
  return mb_strtoupper( $str, $charset );
173
+ } else {
174
  return strtoupper( $str );
175
+ }
176
  }
177
 
178
  if ( $mode == 'lower' ) {
179
+ if ( function_exists( 'mb_strtolower' ) ) {
180
  return mb_strtolower( $str, $charset );
181
+ } else {
182
  return strtolower( $str );
183
+ }
184
  }
185
+
186
  return $str;
187
  }
188
 
189
+ /**
190
  * Convert a string to lower case
191
  * Compatible with mb_strtolower(), an UTF-8 friendly replacement for strtolower()
192
  */
194
  return $this->convert_case( $str, 'lower' );
195
  }
196
 
197
+ /**
198
  * Convert a string to upper case
199
  * Compatible with mb_strtoupper(), an UTF-8 friendly replacement for strtoupper()
200
  */
202
  return $this->convert_case( $str, 'upper' );
203
  }
204
 
205
+ /**
206
  * Convert a string to title case
207
  * Compatible with mb_convert_case(), an UTF-8 friendly replacement for ucwords()
208
  */
209
  function ucwords( $str ) {
210
  return $this->convert_case( $str, 'title' );
211
  }
212
+
213
  /**
214
  * Wrapper for strlen() - uses mb_strlen() if possible.
215
+ */
216
  function strlen( $string ) {
217
+ if ( function_exists( 'mb_strlen' ) ) {
218
  return mb_strlen( $string );
219
+ }
220
+
221
  return strlen( $string );
222
  }
223
 
226
  */
227
  function substr( $string, $start = 0, $length = 2147483647 ) {
228
  $args = func_get_args();
229
+ if ( function_exists( 'mb_substr' ) ) {
230
  return call_user_func_array( 'mb_substr', $args );
231
+ }
232
+
233
  return call_user_func_array( 'substr', $args );
234
  }
235
+
236
  /**
237
  * Wrapper for strpos() - uses mb_strpos() if possible.
238
  */
239
  function strpos( $haystack, $needle, $offset = 0 ) {
240
+ if ( function_exists( 'mb_strpos' ) ) {
241
  return mb_strpos( $haystack, $needle, $offset );
242
+ }
243
+
244
  return strpos( $haystack, $needle, $offset );
245
  }
246
+
247
  /**
248
  * Wrapper for strrpos() - uses mb_strrpos() if possible.
249
  */
250
  function strrpos( $haystack, $needle, $offset = 0 ) {
251
+ if ( function_exists( 'mb_strrpos' ) ) {
252
  return mb_strrpos( $haystack, $needle, $offset );
253
+ }
254
+
255
  return strrpos( $haystack, $needle, $offset );
256
  }
257
 
258
  /**
259
+ * convert xml string to php array - useful to get a serializable value
260
+ *
261
+ * @param string $xmlstr
262
+ *
263
+ * @return array
264
+ *
265
+ * @author Adrien aka Gaarf & contributors
266
+ * @see http://gaarf.info/2009/08/13/xml-string-to-php-array/
267
+ */
268
  function html_string_to_array( $xmlstr ) {
269
+ if ( ! class_exists( 'DOMDocument' ) ) {
270
+ return array();
271
+ } else {
272
+ $doc = new DOMDocument();
273
+ $doc->loadHTML( $xmlstr );
274
+
275
+ return $this->domnode_to_array( $doc->documentElement );
276
+ }
277
  }
278
 
279
  function xml_string_to_array( $xmlstr ) {
280
+ if ( ! class_exists( 'DOMDocument' ) ) {
281
+ return array();
282
+ } else {
283
+ $doc = new DOMDocument();
284
+ $doc->loadXML( $xmlstr );
285
+
286
+ return $this->domnode_to_array( $doc->documentElement );
287
+ }
288
  }
289
 
290
  function domnode_to_array( $node ) {
291
+ switch ( $node->nodeType ) {
292
+ case XML_CDATA_SECTION_NODE:
293
+ case XML_TEXT_NODE:
294
+ return trim( $node->textContent );
295
+ break;
296
+ case XML_ELEMENT_NODE:
297
+ $output = array();
298
+ for ( $i = 0, $m = $node->childNodes->length; $i < $m; $i ++ ) {
299
+ $child = $node->childNodes->item( $i );
300
+ $v = $this->domnode_to_array( $child );
301
+ if ( isset( $child->tagName ) ) {
302
+ $t = $child->tagName;
303
+ if ( ! isset( $output[ $t ] ) ) {
304
+ $output[ $t ] = array();
305
+ }
306
+ if ( is_array( $output ) ) {
307
+ $output[ $t ][] = $v;
308
+ }
309
+ } elseif ( $v || $v === '0' ) {
310
+ $output = (string) $v;
311
+ }
312
+ }
313
+ if ( $node->attributes->length && ! is_array( $output ) ) //Has attributes but isn't an array
314
+ {
315
+ $output = array( '@content' => $output );
316
+ } //Change output into an array.
317
+ if ( is_array( $output ) ) {
318
+ if ( $node->attributes->length ) {
319
+ $a = array();
320
+ foreach ( $node->attributes as $attrName => $attrNode ) {
321
+ $a[ $attrName ] = (string) $attrNode->value;
322
+ }
323
+ $output['@attributes'] = $a;
324
+ }
325
+ foreach ( $output as $t => $v ) {
326
+ if ( is_array( $v ) && count( $v ) == 1 && $t != '@attributes' ) {
327
+ $output[ $t ] = $v[0];
328
+ }
329
+ }
330
+ }
331
+ }
332
+ if ( empty( $output ) ) {
333
+ return '';
334
+ }
335
+
336
+ return $output;
337
+ }
338
+
339
  /*** adds support for using %cf_(name of field)% for using custom fields / Advanced Custom Fields in titles / descriptions etc. ***/
340
  function apply_cf_fields( $format ) {
341
+ return preg_replace_callback( '/%cf_([^%]*?)%/', array( $this, 'cf_field_replace' ), $format );
342
  }
343
 
344
  function cf_field_replace( $matches ) {
345
  $result = '';
346
+ if ( ! empty( $matches ) ) {
347
+ if ( ! empty( $matches[1] ) ) {
348
+ if ( function_exists( 'get_field' ) ) {
349
+ $result = get_field( $matches[1] );
350
+ }
351
  if ( empty( $result ) ) {
352
  global $post;
353
+ if ( ! empty( $post ) ) {
354
+ $result = get_post_meta( $post->ID, $matches[1], true );
355
+ }
356
+ }
357
+ if ( empty( $result ) ) {
358
+ $result = $matches[0];
359
  }
360
+ } else {
361
+ $result = $matches[0];
362
+ }
363
  }
364
  $result = strip_tags( $result );
365
+
366
  return $result;
367
  }
368
+
369
  /**
370
  * Returns child blogs of parent in a multisite.
371
  */
373
  global $wpdb, $blog_id;
374
  $site_id = $wpdb->siteid;
375
  if ( is_multisite() ) {
376
+ if ( $site_id != $blog_id ) {
377
+ return false;
378
+ }
379
+
380
  return $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = {$blog_id} AND site_id != blog_id" );
381
  }
382
+
383
  return false;
384
  }
385
+
386
  /**
387
  * Checks if the plugin is active on a given blog by blogid on a multisite.
388
  */
389
  function is_aioseop_active_on_blog( $bid = false ) {
390
  global $blog_id;
391
+ if ( empty( $bid ) || ( $bid == $blog_id ) || ! is_multisite() ) {
392
+ return true;
393
+ }
394
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
395
+ require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
396
+ }
397
+ if ( is_plugin_active_for_network( AIOSEOP_PLUGIN_BASENAME ) ) {
398
+ return true;
399
+ }
400
+
401
  return in_array( AIOSEOP_PLUGIN_BASENAME, (array) get_blog_option( $bid, 'active_plugins', array() ) );
402
  }
403
+
404
  function quote_list_for_regex( $list, $quote = '/' ) {
405
  $regex = '';
406
+ $cont = 0;
407
+ foreach ( $list as $l ) {
408
+ if ( $cont ) {
409
+ $regex .= '|';
410
+ }
411
+ $cont = 1;
412
+ $regex .= preg_quote( trim( $l ), $quote );
413
  }
414
+
415
  return $regex;
416
  }
417
+
418
  // original code thanks to Sean M. Brown -- http://smbrown.wordpress.com/2009/04/29/verify-googlebot-forward-reverse-dns/
419
  function is_good_bot() {
420
+ $botlist = array(
421
+ 'Yahoo! Slurp' => 'crawl.yahoo.net',
422
+ 'googlebot' => '.googlebot.com',
423
+ 'msnbot' => 'search.msn.com'
424
  );
425
+ $botlist = apply_filters( $this->prefix . 'botlist', $botlist );
426
+ if ( ! empty( $botlist ) ) {
427
+ if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
428
+ return false;
429
+ }
430
+ $ua = $_SERVER['HTTP_USER_AGENT'];
431
  $uas = $this->quote_list_for_regex( $botlist );
432
+ if ( preg_match( '/' . $uas . '/i', $ua ) ) {
433
+ $ip = $_SERVER['REMOTE_ADDR'];
434
+ $hostname = gethostbyaddr( $ip );
435
  $ip_by_hostname = gethostbyname( $hostname );
436
+ if ( $ip_by_hostname == $ip ) {
437
  $hosts = array_values( $botlist );
438
+ foreach ( $hosts as $k => $h ) {
439
+ $hosts[ $k ] = preg_quote( $h ) . '$';
440
+ }
441
  $hosts = join( '|', $hosts );
442
+ if ( preg_match( '/' . $hosts . '/i', $hostname ) ) {
443
  return true;
444
+ }
445
  }
446
  }
447
+
448
  return false;
449
  }
450
  }
451
+
452
  function default_bad_bots() {
453
+ $botlist = array(
454
+ 'Abonti',
455
+ 'aggregator',
456
+ 'AhrefsBot',
457
+ 'asterias',
458
+ 'BDCbot',
459
+ 'BLEXBot',
460
+ 'BuiltBotTough',
461
+ 'Bullseye',
462
+ 'BunnySlippers',
463
+ 'ca-crawler',
464
+ 'CCBot',
465
+ 'Cegbfeieh',
466
+ 'CheeseBot',
467
+ 'CherryPicker',
468
+ 'CopyRightCheck',
469
+ 'cosmos',
470
+ 'Crescent',
471
+ 'discobot',
472
+ 'DittoSpyder',
473
+ 'DotBot',
474
+ 'Download Ninja',
475
+ 'EasouSpider',
476
+ 'EmailCollector',
477
+ 'EmailSiphon',
478
+ 'EmailWolf',
479
+ 'EroCrawler',
480
+ 'Exabot',
481
+ 'ExtractorPro',
482
+ 'Fasterfox',
483
+ 'FeedBooster',
484
+ 'Foobot',
485
+ 'Genieo',
486
+ 'grub-client',
487
+ 'Harvest',
488
+ 'hloader',
489
+ 'httplib',
490
+ 'HTTrack',
491
+ 'humanlinks',
492
+ 'ieautodiscovery',
493
+ 'InfoNaviRobot',
494
+ 'IstellaBot',
495
+ 'Java/1.',
496
+ 'JennyBot',
497
+ 'k2spider',
498
+ 'Kenjin Spider',
499
+ 'Keyword Density/0.9',
500
+ 'larbin',
501
+ 'LexiBot',
502
+ 'libWeb',
503
+ 'libwww',
504
+ 'LinkextractorPro',
505
+ 'linko',
506
+ 'LinkScan/8.1a Unix',
507
+ 'LinkWalker',
508
+ 'LNSpiderguy',
509
+ 'lwp-trivial',
510
+ 'magpie',
511
+ 'Mata Hari',
512
  'MaxPointCrawler',
513
  'MegaIndex',
514
+ 'Microsoft URL Control',
515
+ 'MIIxpc',
516
+ 'Mippin',
517
+ 'Missigua Locator',
518
+ 'Mister PiX',
519
+ 'MJ12bot',
520
+ 'moget',
521
+ 'MSIECrawler',
522
+ 'NetAnts',
523
+ 'NICErsPRO',
524
+ 'Niki-Bot',
525
+ 'NPBot',
526
+ 'Nutch',
527
+ 'Offline Explorer',
528
+ 'Openfind',
529
  'panscient.com',
530
+ 'PHP/5.{',
531
+ 'ProPowerBot/2.14',
532
+ 'ProWebWalker',
533
+ 'Python-urllib',
534
+ 'QueryN Metasearch',
535
+ 'RepoMonkey',
536
+ 'RMA',
537
  'SemrushBot',
538
+ 'SeznamBot',
539
+ 'SISTRIX',
540
+ 'sitecheck.Internetseer.com',
541
+ 'SiteSnagger',
542
+ 'SnapPreviewBot',
543
+ 'Sogou',
544
+ 'SpankBot',
545
+ 'spanner',
546
+ 'spbot',
547
+ 'Spinn3r',
548
+ 'suzuran',
549
+ 'Szukacz/1.4',
550
+ 'Teleport',
551
+ 'Telesoft',
552
+ 'The Intraformant',
553
+ 'TheNomad',
554
+ 'TightTwatBot',
555
+ 'Titan',
556
+ 'toCrawl/UrlDispatcher',
557
+ 'True_Robot',
558
+ 'turingos',
559
+ 'TurnitinBot',
560
+ 'UbiCrawler',
561
+ 'UnisterBot',
562
+ 'URLy Warning',
563
+ 'VCI',
564
+ 'WBSearchBot',
565
+ 'Web Downloader/6.9',
566
+ 'Web Image Collector',
567
+ 'WebAuto',
568
+ 'WebBandit',
569
+ 'WebCopier',
570
+ 'WebEnhancer',
571
+ 'WebmasterWorldForumBot',
572
+ 'WebReaper',
573
+ 'WebSauger',
574
+ 'Website Quester',
575
+ 'Webster Pro',
576
+ 'WebStripper',
577
+ 'WebZip',
578
+ 'Wotbox',
579
+ 'wsr-agent',
580
+ 'WWW-Collector-E',
581
+ 'Xenu',
582
+ 'Zao',
583
+ 'Zeus',
584
+ 'ZyBORG',
585
  'coccoc',
586
  'Incutio',
587
  'lmspider',
591
  'Unknown',
592
  'uptime files'
593
  );
594
+
595
  return $botlist;
596
  }
597
+
598
  function is_bad_bot() {
599
  $botlist = $this->default_bad_bots();
600
+ $botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
601
+ if ( ! empty( $botlist ) ) {
602
+ if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
603
+ return false;
604
+ }
605
+ $ua = $_SERVER['HTTP_USER_AGENT'];
606
  $uas = $this->quote_list_for_regex( $botlist );
607
+ if ( preg_match( '/' . $uas . '/i', $ua ) ) {
608
  return true;
609
  }
610
  }
611
+
612
  return false;
613
  }
614
+
615
  function default_bad_referers() {
616
+ $referlist = array(
617
  'semalt.com',
618
  'kambasoft.com',
619
  'savetubevideo.com',
640
  'site3.free-share-buttons.com',
641
  'webmaster-traffic.com'
642
  );
643
+
644
  return $referlist;
645
  }
646
 
647
  function is_bad_referer() {
648
  $referlist = $this->default_bad_referers();
649
+ $referlist = apply_filters( $this->prefix . 'badreferlist', $referlist );
650
 
651
+ if ( ! empty( $referlist ) && ! empty( $_SERVER ) && ! empty( $_SERVER['HTTP_REFERER'] ) ) {
652
+ $ref = $_SERVER['HTTP_REFERER'];
653
  $regex = $this->quote_list_for_regex( $referlist );
654
+ if ( preg_match( '/' . $regex . '/i', $ref ) ) {
655
  return true;
656
  }
657
  }
658
+
659
  return false;
660
  }
661
+
662
  function allow_bot() {
663
  $allow_bot = true;
664
+ if ( ( ! $this->is_good_bot() ) && $this->is_bad_bot() && ! is_user_logged_in() ) {
665
  $allow_bot = false;
666
+ }
667
+
668
+ return apply_filters( $this->prefix . 'allow_bot', $allow_bot );
669
  }
670
 
671
  /**
672
  * Displays tabs for tabbed locations on a settings page.
673
  */
674
  function display_tabs( $location ) {
675
+ if ( ( $location != null ) && isset( $locations[ $location ]['tabs'] ) ) {
676
  $tabs = $locations['location']['tabs'];
677
+ } else {
678
  $tabs = $this->tabs;
679
+ }
680
+ if ( ! empty( $tabs ) ) {
681
+ ?>
682
+ <div class="aioseop_tabs_div"><label class="aioseop_head_nav">
683
+ <?php
684
+ foreach ( $tabs as $k => $v ) {
685
+ ?>
686
+ <a class="aioseop_head_nav_tab aioseop_head_nav_<?php if ( $this->current_tab != $k ) {
687
+ echo 'in';
688
+ } ?>active"
689
+ href="<?php echo esc_url( add_query_arg( 'tab', $k ) ); ?>"><?php echo $v['name']; ?></a>
690
+ <?php
691
+ }
692
+ ?>
693
  </label></div>
694
  <?php
695
  }
696
  }
697
+
698
  function get_object_labels( $post_objs ) {
699
+ $pt = array_keys( $post_objs );
700
+ $post_types = array();
701
+ foreach ( $pt as $p ) {
702
+ if ( ! empty( $post_objs[ $p ]->label ) ) {
703
+ $post_types[ $p ] = $post_objs[ $p ]->label;
704
+ } else {
705
+ $post_types[ $p ] = $p;
706
+ }
707
+ }
708
+
709
  return $post_types;
710
  }
711
 
712
  function get_term_labels( $post_objs ) {
713
+ $post_types = array();
714
+ foreach ( $post_objs as $p ) {
715
+ if ( ! empty( $p->name ) ) {
716
+ $post_types[ $p->term_id ] = $p->name;
717
+ }
718
+ }
719
+
720
  return $post_types;
721
  }
722
+
723
+ function get_post_type_titles( $args = array() ) {
724
  return $this->get_object_labels( get_post_types( $args, 'objects' ) );
725
  }
726
 
727
+ function get_taxonomy_titles( $args = array() ) {
728
  return $this->get_object_labels( get_taxonomies( $args, 'objects' ) );
729
  }
730
+
731
+ function get_category_titles( $args = array() ) {
732
  return $this->get_term_labels( get_categories( $args ) );
733
  }
734
+
735
  /**
736
  * Helper function for exporting settings on post data.
737
  */
738
+ function post_data_export( $prefix = '_aioseop', $query = array( 'posts_per_page' => - 1 ) ) {
739
+ $buf = '';
740
  $posts_query = new WP_Query( $query );
741
+ while ( $posts_query->have_posts() ) {
742
  $posts_query->the_post();
743
  global $post;
744
+ $guid = $post->guid;
745
+ $type = $post->post_type;
746
+ $title = $post->post_title;
747
+ $date = $post->post_date;
748
+ $data = '';
749
  $post_custom_fields = get_post_custom( $post->ID );
750
+ $has_data = null;
751
 
752
+ if ( is_array( $post_custom_fields ) ) {
753
+ foreach ( $post_custom_fields as $field_name => $field ) {
754
+ if ( ( $this->strpos( $field_name, $prefix ) === 0 ) && $field[0] ) {
755
  $has_data = true;
756
  $data .= $field_name . " = '" . $field[0] . "'\n";
757
+ }
758
  }
759
  }
760
+ if ( ! empty( $data ) ) {
761
+ $has_data = true;
762
+ }
763
 
764
+ if ( $has_data != null ) {
765
  $post_info = "\n[post_data]\n\n";
766
  $post_info .= "post_title = '" . $title . "'\n";
767
  $post_info .= "post_guid = '" . $guid . "'\n";
768
  $post_info .= "post_date = '" . $date . "'\n";
769
  $post_info .= "post_type = '" . $type . "'\n";
770
+ if ( $data ) {
771
+ $buf .= $post_info . $data . "\n";
772
+ }
773
  }
774
  }
775
  wp_reset_postdata();
776
+
777
  return $buf;
778
  }
779
+
780
  /**
781
  * Handles exporting settings data for a module.
782
  */
783
  function settings_export( $buf ) {
784
+ global $aiosp;
785
+ $post_types = null;
786
+ $has_data = null;
787
  $general_settings = null;
788
  $exporter_choices = '';
789
+ if ( ! empty( $_REQUEST['aiosp_importer_exporter_export_choices'] ) ) {
790
+ $exporter_choices = $_REQUEST['aiosp_importer_exporter_export_choices'];
791
+ }
792
+ if ( ! empty( $exporter_choices ) && is_array( $exporter_choices ) ) {
793
+ foreach ( $exporter_choices as $ex ) {
794
+ if ( $ex == 1 ) {
795
+ $general_settings = true;
796
+ }
797
+ if ( $ex == 2 && isset( $_REQUEST['aiosp_importer_exporter_export_post_types'] ) ) {
798
+ $post_types = $_REQUEST['aiosp_importer_exporter_export_post_types'];
799
  }
800
  }
801
  }
802
 
803
+ if ( ( $post_types != null ) && ( $this === $aiosp ) ) {
804
+ $buf .= $this->post_data_export( '_aioseop', array(
805
+ 'posts_per_page' => - 1,
806
+ 'post_type' => $post_types
807
+ ) );
808
+ }
809
 
810
  /* Add all active settings to settings file */
811
+ $name = $this->get_option_name();
812
  $options = $this->get_class_option();
813
+ if ( ! empty( $options ) && $general_settings != null ) {
814
  $buf .= "\n[$name]\n\n";
815
  foreach ( $options as $key => $value ) {
816
+ if ( ( $name == $this->parent_option ) && ( $key == 'modules' ) ) {
817
+ continue;
818
+ } // don't re-export all module settings -- pdb
819
+ if ( is_array( $value ) ) {
820
+ $value = "'" . str_replace( array( "'", "\n", "\r" ), array(
821
+ "\'",
822
+ '\n',
823
+ '\r'
824
+ ), trim( serialize( $value ) ) ) . "'";
825
+ } else {
826
+ $value = str_replace( array( "\n", "\r" ), array(
827
+ '\n',
828
+ '\r'
829
+ ), trim( var_export( $value, true ) ) );
830
+ }
831
  $buf .= "$key = $value\n";
832
  }
833
  }
834
+
835
  return $buf;
836
  }
837
+
838
  /**
839
  * Order for adding the menus for the aioseop_modules_add_menus hook.
840
  */
841
  function menu_order() {
842
  return 10;
843
  }
844
+
845
  /**
846
  * Print a basic error message.
847
  */
848
  function output_error( $error ) {
849
  echo "<div class='aioseop_module error'>$error</div>";
850
+
851
+ return false;
852
  }
853
+
854
  /***
855
  * Backwards compatibility - see http://php.net/manual/en/function.str-getcsv.php
856
  */
857
+ function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = "\\" ) {
858
+ $fp = fopen( 'php://memory', 'r+' );
859
  fputs( $fp, $input );
860
  rewind( $fp );
861
  $data = fgetcsv( $fp, null, $delimiter, $enclosure ); // $escape only got added in 5.3.0
862
  fclose( $fp );
863
+
864
  return $data;
865
  }
866
+
867
  /***
868
  * Helper function to convert csv in key/value pair format to an associative array.
869
  */
870
  function csv_to_array( $csv ) {
871
+ $args = array();
872
+ if ( ! function_exists( 'str_getcsv' ) ) {
873
  $v = $this->str_getcsv( $csv );
874
+ } else {
875
  $v = str_getcsv( $csv );
876
+ }
877
  $size = count( $v );
878
+ if ( is_array( $v ) && isset( $v[0] ) && $size >= 2 ) {
879
+ for ( $i = 0; $i < $size; $i += 2 ) {
880
  $args[ $v[ $i ] ] = $v[ $i + 1 ];
881
+ }
882
+ }
883
+
884
  return $args;
885
  }
886
 
887
  /** Allow modules to use WP Filesystem if available and desired, fall back to PHP filesystem access otherwise. */
888
  function use_wp_filesystem( $method = '', $form_fields = false, $url = '', $error = false ) {
889
+ if ( empty( $method ) ) {
890
  $this->credentials = request_filesystem_credentials( $url );
891
+ } else {
892
  $this->credentials = request_filesystem_credentials( $url, $method, $error, false, $form_fields );
893
+ }
894
+
895
  return $this->credentials;
896
  }
897
+
898
  /**
899
  * Wrapper function to get filesystem object.
900
  */
901
+ function get_filesystem_object() {
902
  $cred = get_transient( 'aioseop_fs_credentials' );
903
+ if ( ! empty( $cred ) ) {
904
+ $this->credentials = $cred;
905
+ }
906
+
907
+ if ( function_exists( 'WP_Filesystem' ) && WP_Filesystem( $this->credentials ) ) {
908
  global $wp_filesystem;
909
+
910
  return $wp_filesystem;
911
  } else {
912
  require_once( ABSPATH . 'wp-admin/includes/template.php' );
913
  require_once( ABSPATH . 'wp-admin/includes/screen.php' );
914
  require_once( ABSPATH . 'wp-admin/includes/file.php' );
915
 
916
+ if ( ! WP_Filesystem( $this->credentials ) ) {
917
  $this->use_wp_filesystem();
918
+ }
919
 
920
+ if ( ! empty( $this->credentials ) ) {
921
  set_transient( 'aioseop_fs_credentials', $this->credentials, 10800 );
922
+ }
923
  global $wp_filesystem;
924
+ if ( is_object( $wp_filesystem ) ) {
925
  return $wp_filesystem;
926
+ }
927
  }
928
+
929
  return false;
930
  }
931
+
932
  /**
933
  * See if a file exists using WP Filesystem.
934
  */
935
  function file_exists( $filename ) {
936
  $wpfs = $this->get_filesystem_object();
937
+ if ( is_object( $wpfs ) ) {
938
  return $wpfs->exists( $filename );
939
+ }
940
+
941
  return $wpfs;
942
  }
943
 
946
  */
947
  function is_file( $filename ) {
948
  $wpfs = $this->get_filesystem_object();
949
+ if ( is_object( $wpfs ) ) {
950
  return $wpfs->is_file( $filename );
951
+ }
952
+
953
  return $wpfs;
954
  }
955
+
956
  /**
957
  * List files in a directory using WP Filesystem.
958
  */
960
  $wpfs = $this->get_filesystem_object();
961
  if ( is_object( $wpfs ) ) {
962
  $dirlist = $wpfs->dirlist( $path );
963
+ if ( empty( $dirlist ) ) {
964
+ return $dirlist;
965
+ }
966
+
967
  return array_keys( $dirlist );
968
  }
969
+
970
+ return $wpfs;
971
  }
972
+
973
  /**
974
  * Load a file through WP Filesystem; implement basic support for offset and maxlen.
975
  */
976
+ function load_file( $filename, $use_include_path = false, $context = null, $offset = - 1, $maxlen = - 1 ) {
977
  $wpfs = $this->get_filesystem_object();
978
  if ( is_object( $wpfs ) ) {
979
+ if ( ! $wpfs->exists( $filename ) ) {
980
+ return false;
981
+ }
982
  if ( ( $offset > 0 ) || ( $maxlen >= 0 ) ) {
983
+ if ( $maxlen === 0 ) {
984
+ return '';
985
+ }
986
+ if ( $offset < 0 ) {
987
+ $offset = 0;
988
+ }
989
  $file = $wpfs->get_contents( $filename );
990
+ if ( ! is_string( $file ) || empty( $file ) ) {
991
+ return $file;
992
+ }
993
+ if ( $maxlen < 0 ) {
994
  return $this->substr( $file, $offset );
995
+ } else {
996
  return $this->substr( $file, $offset, $maxlen );
997
+ }
998
  } else {
999
  return $wpfs->get_contents( $filename );
1000
  }
1001
  }
1002
+
1003
  return false;
1004
  }
1005
+
1006
  /**
1007
  * Save a file through WP Filesystem.
1008
  */
1009
  function save_file( $filename, $contents ) {
1010
+ $failed_str = __( sprintf( "Failed to write file %s!\n", $filename ), 'all-in-one-seo-pack' );
1011
  $readonly_str = __( sprintf( "File %s isn't writable!\n", $filename ), 'all-in-one-seo-pack' );
1012
+ $wpfs = $this->get_filesystem_object();
1013
  if ( is_object( $wpfs ) ) {
1014
  $file_exists = $wpfs->exists( $filename );
1015
+ if ( ! $file_exists || $wpfs->is_writable( $filename ) ) {
1016
+ if ( $wpfs->put_contents( $filename, $contents ) === false ) {
1017
+ return $this->output_error( $failed_str );
1018
+ }
1019
+ } else {
1020
+ return $this->output_error( $readonly_str );
1021
+ }
1022
+
1023
  return true;
1024
  }
1025
+
1026
  return false;
1027
  }
1028
+
1029
  /**
1030
  * Delete a file through WP Filesystem.
1031
  */
1033
  $wpfs = $this->get_filesystem_object();
1034
  if ( is_object( $wpfs ) ) {
1035
  if ( $wpfs->exists( $filename ) ) {
1036
+ if ( $wpfs->delete( $filename ) === false ) {
1037
  $this->output_error( __( sprintf( "Failed to delete file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
1038
+ } else {
1039
  return true;
1040
+ }
1041
+ } else {
1042
+ $this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
1043
+ }
1044
  }
1045
+
1046
  return false;
1047
  }
1048
+
1049
  /**
1050
  * Rename a file through WP Filesystem.
1051
  */
1052
  function rename_file( $filename, $newname ) {
1053
  $wpfs = $this->get_filesystem_object();
1054
  if ( is_object( $wpfs ) ) {
1055
+ $file_exists = $wpfs->exists( $filename );
1056
  $newfile_exists = $wpfs->exists( $newname );
1057
+ if ( $file_exists && ! $newfile_exists ) {
1058
+ if ( $wpfs->move( $filename, $newname ) === false ) {
1059
  $this->output_error( __( sprintf( "Failed to rename file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
1060
+ } else {
1061
  return true;
1062
+ }
1063
  } else {
1064
+ if ( ! $file_exists ) {
1065
  $this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
1066
+ } elseif ( $newfile_exists ) {
1067
  $this->output_error( __( sprintf( "File %s already exists!\n", $newname ), 'all-in-one-seo-pack' ) );
1068
+ }
1069
  }
1070
  }
1071
+
1072
  return false;
1073
  }
1074
 
1077
  */
1078
  function load_files( $options, $opts, $prefix ) {
1079
  foreach ( $opts as $opt => $file ) {
1080
+ $opt = $prefix . $opt;
1081
+ $file = ABSPATH . $file;
1082
  $contents = $this->load_file( $file );
1083
+ if ( $contents !== false ) {
1084
+ $options[ $opt ] = $contents;
1085
+ }
1086
  }
1087
+
1088
  return $options;
1089
  }
1090
+
1091
  /**
1092
  * Save multiple files.
1093
  */
1094
  function save_files( $opts, $prefix ) {
1095
  foreach ( $opts as $opt => $file ) {
1096
  $opt = $prefix . $opt;
1097
+ if ( isset( $_POST[ $opt ] ) ) {
1098
+ $output = stripslashes_deep( $_POST[ $opt ] );
1099
+ $file = ABSPATH . $file;
1100
  $this->save_file( $file, $output );
1101
  }
1102
  }
1103
  }
1104
+
1105
  /**
1106
  * Delete multiple files.
1107
  */
1111
  $this->delete_file( $file );
1112
  }
1113
  }
1114
+
1115
  function get_all_images_by_type( $options = null, $p = null ) {
1116
+ $img = array();
1117
  if ( empty( $img ) ) {
1118
  $size = apply_filters( 'post_thumbnail_size', 'large' );
1119
 
1127
 
1128
  $count = 1;
1129
 
1130
+ if ( ! empty( $post ) ) {
1131
+ if ( ! is_object( $post ) ) {
1132
+ $post = get_post( $post );
1133
+ }
1134
+ if ( is_object( $post ) && function_exists( 'get_post_thumbnail_id' ) ) {
1135
+ if ( $post->post_type == 'attachment' ) {
1136
  $post_thumbnail_id = $post->ID;
1137
+ } else {
1138
  $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
1139
+ }
1140
+ if ( ! empty( $post_thumbnail_id ) ) {
1141
  $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
1142
  if ( is_array( $image ) ) {
1143
+ $img[] = array( 'type' => 'featured', 'id' => $post_thumbnail_id, 'link' => $image[0] );
1144
  }
1145
  }
1146
  }
1147
 
1148
  $post_id = $post->ID;
1149
+ $p = $post;
1150
+ $w = $wp_query;
1151
 
1152
  $meta_key = '';
1153
+ if ( is_array( $options ) && isset( $options['meta_key'] ) ) {
 
1154
  $meta_key = $options['meta_key'];
 
1155
  }
1156
 
1157
+ if ( ! empty( $meta_key ) && ! empty( $post ) ) {
1158
  $meta_key = explode( ',', $meta_key );
1159
+ $image = $this->get_the_image_by_meta_key( array(
1160
+ 'post_id' => $post->ID,
1161
+ 'meta_key' => $meta_key
1162
+ ) );
1163
+ if ( ! empty( $image ) ) {
1164
+ $img[] = array( 'type' => 'meta_key', 'id' => $meta_key, 'link' => $image );
1165
  }
1166
  }
1167
 
1168
+ if ( ! $post->post_modified_gmt != '' ) {
1169
  $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
1170
+ }
1171
+ if ( $post->post_type == 'page' ) {
1172
  $wp_query->is_page = true;
1173
+ } elseif ( $post->post_type == 'attachment' ) {
1174
  $wp_query->is_attachment = true;
1175
+ } else {
1176
  $wp_query->is_single = true;
1177
+ }
1178
+ if ( get_option( 'show_on_front' ) == 'page' && $post->ID == get_option( 'page_for_posts' ) ) {
1179
  $wp_query->is_home = true;
1180
  }
1181
+ $args['options']['type'] = 'html';
1182
  $args['options']['nowrap'] = false;
1183
+ $args['options']['save'] = false;
1184
+ $wp_query->queried_object = $post;
1185
+
1186
+ $attachments = get_children( array(
1187
+ 'post_parent' => $post->ID,
1188
+ 'post_status' => 'inherit',
1189
+ 'post_type' => 'attachment',
1190
+ 'post_mime_type' => 'image',
1191
+ 'order' => 'ASC',
1192
+ 'orderby' => 'menu_order ID'
1193
+ ) );
1194
+ if ( ! empty( $attachments ) ) {
1195
+ foreach ( $attachments as $id => $attachment ) {
1196
  $image = wp_get_attachment_image_src( $id, $size );
1197
  if ( is_array( $image ) ) {
1198
+ $img[] = array( 'type' => 'attachment', 'id' => $id, 'link' => $image[0] );
1199
  }
1200
  }
1201
+ }
1202
+ $matches = array();
1203
  preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
1204
+ if ( isset( $matches ) && ! empty( $matches[1] ) && ! empty( $matches[1][0] ) ) {
1205
+ foreach ( $matches[1] as $i => $m ) {
1206
+ $img[] = array( 'type' => 'post_content', 'id' => 'post' . $count ++, 'link' => $m );
1207
  }
1208
+ }
1209
  wp_reset_postdata();
1210
+ $wp_query = $w;
1211
+ $post = $p;
1212
  }
1213
  }
1214
+
1215
  return $img;
1216
  }
1217
+
1218
  function get_all_images( $options = null, $p = null ) {
1219
+ $img = $this->get_all_images_by_type( $options, $p );
1220
+ $legacy = array();
1221
+ foreach ( $img as $k => $v ) {
1222
  if ( $v['type'] == 'featured' ) {
1223
+ $legacy[ $v['link'] ] = 1;
1224
+ } else {
1225
+ $legacy[ $v['link'] ] = $v['id'];
1226
  }
1227
  }
1228
+
1229
  return $legacy;
1230
  }
1231
 
1232
  /*** Thanks to Justin Tadlock for the original get-the-image code - http://themehybrid.com/plugins/get-the-image ***/
1233
 
1234
  function get_the_image( $options = null, $p = null ) {
1235
+
1236
  if ( $p === null ) {
1237
  global $post;
1238
  } else {
1239
  $post = $p;
1240
  }
1241
+
1242
  $meta_key = '';
1243
+ if ( is_array( $options ) && isset( $options['meta_key'] ) ) {
 
1244
  $meta_key = $options['meta_key'];
 
1245
  }
1246
 
1247
+ if ( ! empty( $meta_key ) && ! empty( $post ) ) {
1248
  $meta_key = explode( ',', $meta_key );
1249
+ $image = $this->get_the_image_by_meta_key( array(
1250
+ 'post_id' => $post->ID,
1251
+ 'meta_key' => $meta_key
1252
+ ) );
1253
+ }
1254
+ if ( empty( $image ) ) {
1255
+ $image = $this->get_the_image_by_post_thumbnail( $post );
1256
+ }
1257
+ if ( empty( $image ) ) {
1258
+ $image = $this->get_the_image_by_attachment( $post );
1259
  }
1260
+ if ( empty( $image ) ) {
1261
+ $image = $this->get_the_image_by_scan( $post );
1262
+ }
1263
+ if ( empty( $image ) ) {
1264
+ $image = $this->get_the_image_by_default( $post );
1265
+ }
1266
+
1267
  return $image;
1268
  }
1269
+
1270
  function get_the_image_by_default( $p = null ) {
1271
  return '';
1272
  }
1274
  function get_the_image_by_meta_key( $args = array() ) {
1275
 
1276
  /* If $meta_key is not an array. */
1277
+ if ( ! is_array( $args['meta_key'] ) ) {
1278
  $args['meta_key'] = array( $args['meta_key'] );
1279
+ }
1280
 
1281
  /* Loop through each of the given meta keys. */
1282
  foreach ( $args['meta_key'] as $meta_key ) {
1283
  /* Get the image URL by the current meta key in the loop. */
1284
  $image = get_post_meta( $args['post_id'], $meta_key, true );
1285
  /* If a custom key value has been given for one of the keys, return the image URL. */
1286
+ if ( ! empty( $image ) ) {
1287
  return $image;
1288
+ }
1289
  }
1290
+
1291
  return false;
1292
  }
1293
 
1298
  } else {
1299
  $post = $p;
1300
  }
1301
+
1302
  $post_thumbnail_id = null;
1303
+ if ( function_exists( 'get_post_thumbnail_id' ) ) {
1304
+ $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
1305
  }
1306
 
1307
+ if ( empty( $post_thumbnail_id ) ) {
1308
  return false;
1309
+ }
1310
+
1311
+ $size = apply_filters( 'post_thumbnail_size', 'large' );
1312
+ $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
1313
 
1314
+ return $image[0];
 
 
1315
  }
1316
 
1317
  function get_the_image_by_attachment( $p = null ) {
1318
+
1319
  if ( $p === null ) {
1320
  global $post;
1321
  } else {
1322
  $post = $p;
1323
  }
1324
 
1325
+ $attachments = get_children( array(
1326
+ 'post_parent' => $post->ID,
1327
+ 'post_status' => 'inherit',
1328
+ 'post_type' => 'attachment',
1329
+ 'post_mime_type' => 'image',
1330
+ 'order' => 'ASC',
1331
+ 'orderby' => 'menu_order ID'
1332
+ ) );
1333
 
1334
+ if ( empty( $attachments ) && 'attachment' == get_post_type( $post->ID ) ) {
 
1335
  $image = wp_get_attachment_image_src( $post->ID, 'large' );
 
1336
  }
1337
 
1338
  /* If no attachments or image is found, return false. */
1339
+ if ( empty( $attachments ) && empty( $image ) ) {
1340
  return false;
1341
+ }
1342
 
1343
  /* Set the default iterator to 0. */
1344
  $i = 0;
1345
 
1346
  /* Loop through each attachment. Once the $order_of_image (default is '1') is reached, break the loop. */
1347
  foreach ( $attachments as $id => $attachment ) {
1348
+ if ( ++ $i == 1 ) {
1349
  $image = wp_get_attachment_image_src( $id, 'large' );
1350
+ $alt = trim( strip_tags( get_post_field( 'post_excerpt', $id ) ) );
1351
  break;
1352
  }
1353
  }
1354
 
1355
  /* Return the image URL. */
1356
+
1357
  return $image[0];
1358
 
1359
  }
1365
  } else {
1366
  $post = $p;
1367
  }
1368
+
1369
  /* Search the post's content for the <img /> tag and get its URL. */
1370
  preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
1371
 
1372
  /* If there is a match for the image, return its URL. */
1373
+ if ( isset( $matches ) && ! empty( $matches[1][0] ) ) {
1374
  return $matches[1][0];
1375
+ }
1376
 
1377
  return false;
1378
  }
1379
+
1380
  /** crude approximization of whether current user is an admin */
1381
  function is_admin() {
1382
  return current_user_can( 'level_8' );
1383
  }
1384
+
1385
  function help_text_helper( &$default_options, $options, $help_link = '' ) {
1386
+ foreach ( $options as $o ) {
1387
  $ht = '';
1388
+ if ( ! empty( $this->help_text[ $o ] ) ) {
1389
+ $ht = $this->help_text[ $o ];
1390
+ } elseif ( ! empty( $default_options[ $o ]['help_text'] ) ) {
1391
+ $ht = $default_options[ $o ]['help_text'];
1392
+ }
1393
+ if ( $ht && ! is_array( $ht ) ) {
1394
  $ha = '';
1395
  $hl = $help_link;
1396
  if ( strpos( $o, 'ga_' ) === 0 ) { // special case -- pdb
1397
  $hl = 'http://semperplugins.com/documentation/advanced-google-analytics-settings/';
1398
  }
1399
+ if ( ! empty( $this->help_anchors[ $o ] ) ) {
1400
+ $ha = $this->help_anchors[ $o ];
1401
+ }
1402
+ if ( ! empty( $ha ) && ( $pos = strrpos( $hl, '#' ) ) ) {
1403
  $hl = substr( $hl, 0, $pos );
1404
  }
1405
+ if ( ! empty( $ha ) && ( $ha[0] == 'h' ) ) {
1406
+ $hl = '';
1407
+ }
1408
+ if ( ! empty( $ha ) || ! isset( $this->help_anchors[ $o ] ) ) {
1409
+ $ht .= "<br /><a href='" . $hl . $ha . "' target='_blank'>" . __( 'Click here for documentation on this setting', 'all-in-one-seo-pack' ) . '</a>';
1410
  }
1411
+ $default_options[ $o ]['help_text'] = $ht;
1412
  }
1413
  }
1414
  }
1415
+
1416
  function add_help_text_links() {
1417
+ if ( ! empty( $this->help_text ) ) {
1418
+ foreach ( $this->layout as $k => $v ) {
1419
  $this->help_text_helper( $this->default_options, $v['options'], $v['help_link'] );
1420
  }
1421
+ if ( ! empty( $this->locations ) ) {
1422
+ foreach ( $this->locations as $k => $v ) {
1423
+ if ( ! empty( $v['default_options'] ) && ! empty( $v['options'] ) ) {
1424
+ $this->help_text_helper( $this->locations[ $k ]['default_options'], $v['options'], $v['help_link'] );
1425
  }
1426
  }
1427
+ }
1428
  }
1429
  }
1430
+
1431
  /**
1432
  * Load scripts and styles for metaboxes.
1433
+ *
1434
  * edit-tags exists only for pre 4.5 support... remove when we drop 4.5 support.
1435
  * Also, that check and others should be pulled out into their own functions
1436
  */
1437
+ function enqueue_metabox_scripts() {
1438
  $screen = '';
1439
+ if ( function_exists( 'get_current_screen' ) ) {
1440
  $screen = get_current_screen();
1441
+ }
1442
  $bail = false;
1443
+ if ( empty( $screen ) ) {
1444
+ $bail = true;
1445
+ }
1446
+ if ( ( $screen->base != 'post' ) && ( $screen->base != 'term' ) && ( $screen->base != 'edit-tags' ) && ( $screen->base != 'toplevel_page_shopp-products' ) ) {
1447
+ $bail = true;
1448
+ }
1449
  $prefix = $this->get_prefix();
1450
+ $bail = apply_filters( $prefix . 'bail_on_enqueue', $bail, $screen );
1451
+ if ( $bail ) {
1452
+ return;
1453
+ }
1454
  $this->form = 'post';
1455
+ if ( $screen->base == 'term' || $screen->base == 'edit-tags' ) {
1456
+ $this->form = 'edittag';
1457
+ }
1458
+ if ( $screen->base == 'toplevel_page_shopp-products' ) {
1459
+ $this->form = 'product';
1460
+ }
1461
  $this->form = apply_filters( $prefix . 'set_form_on_enqueue', $this->form, $screen );
1462
+ foreach ( $this->locations as $k => $v ) {
1463
+ if ( $v['type'] === 'metabox' && isset( $v['display'] ) && ! empty( $v['display'] ) ) {
 
1464
  $enqueue_scripts = false;
1465
  $enqueue_scripts = ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) ) || in_array( $screen->post_type, $v['display'] );
1466
  $enqueue_scripts = apply_filters( $prefix . 'enqueue_metabox_scripts', $enqueue_scripts, $screen, $v );
1467
  if ( $enqueue_scripts ) {
1468
+ add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
1469
+ add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ), 20 );
1470
+ add_action( 'admin_print_scripts', array( $this, 'enqueue_styles' ), 20 );
 
1471
  }
1472
  }
1473
  }
1474
  }
1475
+
1476
  /**
1477
  * Load styles for module.
1478
  */
1479
+ function enqueue_styles() {
1480
  wp_enqueue_style( 'thickbox' );
1481
+ if ( ! empty( $this->pointers ) ) {
1482
+ wp_enqueue_style( 'wp-pointer' );
1483
+ }
1484
+ wp_enqueue_style( 'aioseop-module-style', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module.css' );
1485
+ if ( function_exists( 'is_rtl' ) && is_rtl() ) {
1486
+ wp_enqueue_style( 'aioseop-module-style-rtl', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module-rtl.css', array( 'aioseop-module-style' ) );
1487
+ }
1488
  }
1489
+
1490
  /**
1491
  * Load scripts for module, can pass data to module script.
1492
  */
1493
+ function enqueue_scripts() {
1494
  wp_enqueue_script( 'sack' );
1495
  wp_enqueue_script( 'jquery' );
1496
  wp_enqueue_script( 'media-upload' );
1498
  wp_enqueue_script( 'common' );
1499
  wp_enqueue_script( 'wp-lists' );
1500
  wp_enqueue_script( 'postbox' );
1501
+ if ( ! empty( $this->pointers ) ) {
1502
  wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
1503
  }
1504
+ wp_enqueue_script( 'aioseop-module-script', AIOSEOP_PLUGIN_URL . 'js/modules/aioseop_module.js', array(), AIOSEOP_VERSION );
1505
+ if ( ! empty( $this->script_data ) ) {
1506
  aioseop_localize_script_data();
1507
  }
1508
  }
1509
+
1510
  function localize_script_data( $data ) {
1511
+ if ( ! is_array( $data ) ) {
1512
+ $data = array( 0 => $data );
1513
+ }
1514
+ if ( empty( $this->script_data ) ) {
1515
+ $this->script_data = array();
1516
  }
1517
+ if ( ! empty( $this->pointers ) ) {
 
1518
  $this->script_data['pointers'] = $this->pointers;
1519
+ }
1520
+ if ( empty( $data[0]['condshow'] ) ) {
1521
+ $data[0]['condshow'] = array();
1522
+ }
1523
+ if ( empty( $this->script_data['condshow'] ) ) {
1524
+ $this->script_data['condshow'] = array();
1525
+ }
1526
+ $condshow = $this->script_data['condshow'];
1527
  $data[0]['condshow'] = array_merge( $data[0]['condshow'], $condshow );
1528
  unset( $this->script_data['condshow'] );
1529
+ $data[0] = array_merge( $this->script_data, $data[0] );
1530
  $this->script_data['condshow'] = $condshow;
1531
+
1532
  return $data;
1533
  }
1534
+
1535
  /**
1536
  * Override this to run code at the beginning of the settings page.
1537
  */
1538
  function settings_page_init() {
1539
+
1540
  }
1541
+
1542
  /**
1543
  * Filter out admin pointers that have already been clicked.
1544
  */
1545
  function filter_pointers() {
1546
+ if ( ! empty( $this->pointers ) ) {
1547
  $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
1548
+ foreach ( $dismissed as $d ) {
1549
+ if ( isset( $this->pointers[ $d ] ) ) {
1550
+ unset( $this->pointers[ $d ] );
1551
+ }
1552
+ }
1553
  }
1554
  }
1555
+
1556
  /**
1557
  * Add basic hooks when on the module's page.
1558
  */
1559
  function add_page_hooks() {
1560
  $hookname = current_filter();
1561
+ if ( $this->strpos( $hookname, 'load-' ) === 0 ) {
1562
  $this->pagehook = $this->substr( $hookname, 5 );
1563
+ }
1564
+ add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ) );
1565
+ add_action( 'admin_print_styles', array( $this, 'enqueue_styles' ) );
1566
+ add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
1567
+ add_action( $this->prefix . 'settings_header', array( $this, 'display_tabs' ) );
1568
  }
1569
+
1570
  function get_admin_links() {
1571
+ if ( ! empty( $this->menu_name ) ) {
1572
  $name = $this->menu_name;
1573
+ } else {
1574
  $name = $this->name;
1575
+ }
1576
+
1577
  $hookname = plugin_basename( $this->file );
1578
+
1579
+ $links = array();
1580
+ $url = '';
1581
+ if ( function_exists( 'menu_page_url' ) ) {
1582
+ $url = menu_page_url( $hookname, 0 );
1583
+ }
1584
+ if ( empty( $url ) ) {
1585
+ $url = esc_url( admin_url( 'admin.php?page=' . $hookname ) );
1586
+ }
1587
+
1588
+ if ( $this->locations === null ) {
1589
+ array_unshift( $links, array(
1590
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
1591
+ 'title' => $name,
1592
+ 'id' => $hookname,
1593
+ 'href' => $url,
1594
+ 'order' => $this->menu_order()
1595
+ ) );
1596
+ } else {
1597
+ foreach ( $this->locations as $k => $v ) {
1598
  if ( $v['type'] === 'settings' ) {
1599
  if ( $k === 'default' ) {
1600
+ array_unshift( $links, array(
1601
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
1602
+ 'title' => $name,
1603
+ 'id' => $hookname,
1604
+ 'href' => $url,
1605
+ 'order' => $this->menu_order()
1606
+ ) );
1607
  } else {
1608
+ if ( ! empty( $v['menu_name'] ) ) {
1609
  $name = $v['menu_name'];
1610
+ } else {
1611
  $name = $v['name'];
1612
+ }
1613
+ array_unshift( $links, array(
1614
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
1615
+ 'title' => $name,
1616
+ 'id' => $this->get_prefix( $k ) . $k,
1617
+ 'href' => esc_url( admin_url( 'admin.php?page=' . $this->get_prefix( $k ) . $k ) ),
1618
+ 'order' => $this->menu_order()
1619
+ ) );
1620
  }
1621
  }
1622
  }
1623
  }
1624
+
1625
  return $links;
1626
  }
1627
+
1628
  function add_admin_bar_submenu() {
1629
  global $aioseop_admin_menu, $wp_admin_bar;
1630
+
1631
  if ( $aioseop_admin_menu ) {
1632
  $links = $this->get_admin_links();
1633
+ if ( ! empty( $links ) ) {
1634
+ foreach ( $links as $l ) {
1635
  $wp_admin_bar->add_menu( $l );
1636
+ }
1637
+ }
1638
  }
1639
  }
1640
+
1641
  /**
1642
  * Collect metabox data together for tabbed metaboxes.
1643
  */
1644
  function filter_return_metaboxes( $args ) {
1645
  return array_merge( $args, $this->post_metaboxes );
1646
  }
1647
+
1648
  /** Add submenu for module, call page hooks, set up metaboxes. */
1649
  function add_menu( $parent_slug ) {
1650
+ if ( ! empty( $this->menu_name ) ) {
1651
  $name = $this->menu_name;
1652
+ } else {
1653
  $name = $this->name;
1654
+ }
1655
  if ( $this->locations === null ) {
1656
+ $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), plugin_basename( $this->file ), array(
1657
+ $this,
1658
+ 'display_settings_page'
1659
+ ) );
1660
+ add_action( "load-{$hookname}", array( $this, 'add_page_hooks' ) );
1661
+
1662
  return true;
1663
  }
1664
+ foreach ( $this->locations as $k => $v ) {
1665
  if ( $v['type'] === 'settings' ) {
1666
  if ( $k === 'default' ) {
1667
+ if ( ! empty( $this->menu_name ) ) {
1668
  $name = $this->menu_name;
1669
+ } else {
1670
  $name = $this->name;
1671
+ }
1672
+ $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), plugin_basename( $this->file ), array(
1673
+ $this,
1674
+ 'display_settings_page'
1675
+ ) );
1676
  } else {
1677
+ if ( ! empty( $v['menu_name'] ) ) {
1678
  $name = $v['menu_name'];
1679
+ } else {
1680
  $name = $v['name'];
1681
+ }
1682
+ $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $this->get_prefix( $k ) . $k, array(
1683
+ $this,
1684
+ "display_settings_page_$k"
1685
+ ) );
1686
  }
1687
+ add_action( "load-{$hookname}", array( $this, 'add_page_hooks' ) );
1688
  } elseif ( $v['type'] === 'metabox' ) {
1689
  $this->setting_options( $k ); // hack -- make sure this runs anyhow, for now -- pdb
1690
+ add_action( 'edit_post', array( $this, 'save_post_data' ) );
1691
+ add_action( 'publish_post', array( $this, 'save_post_data' ) );
1692
+ add_action( 'add_attachment', array( $this, 'save_post_data' ) );
1693
+ add_action( 'edit_attachment', array( $this, 'save_post_data' ) );
1694
+ add_action( 'save_post', array( $this, 'save_post_data' ) );
1695
+ add_action( 'edit_page_form', array( $this, 'save_post_data' ) );
1696
+ if ( isset( $v['display'] ) && ! empty( $v['display'] ) ) {
1697
+ add_action( 'admin_print_scripts', array( $this, 'enqueue_metabox_scripts' ), 5 );
1698
+ if ( $this->tabbed_metaboxes ) {
1699
+ add_filter( 'aioseop_add_post_metabox', array( $this, 'filter_return_metaboxes' ) );
1700
+ }
1701
  foreach ( $v['display'] as $posttype ) {
1702
  $v['location'] = $k;
1703
  $v['posttype'] = $posttype;
1704
+ if ( ! isset( $v['context'] ) ) {
1705
+ $v['context'] = 'advanced';
1706
+ }
1707
+ if ( ! isset( $v['priority'] ) ) {
1708
+ $v['priority'] = 'default';
1709
+ }
1710
  if ( $this->tabbed_metaboxes ) {
1711
+ $this->post_metaboxes[] = array(
1712
+ 'id' => $v['prefix'] . $k,
1713
+ 'title' => $v['name'],
1714
+ 'callback' => array( $this, 'display_metabox' ),
1715
+ 'post_type' => $posttype,
1716
+ 'context' => $v['context'],
1717
+ 'priority' => $v['priority'],
1718
+ 'callback_args' => $v
1719
+ );
1720
  } else {
1721
  $title = $v['name'];
1722
+ if ( $title != $this->plugin_name ) {
1723
+ $title = $this->plugin_name . ' - ' . $title;
1724
+ }
1725
+ if ( ! empty( $v['help_link'] ) ) {
1726
+ $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . '</span></a>';
1727
+ }
1728
+ add_meta_box( $v['prefix'] . $k, $title, array(
1729
+ $this,
1730
+ 'display_metabox'
1731
+ ), $posttype, $v['context'], $v['priority'], $v );
1732
  }
1733
  }
1734
  }
1735
  }
1736
  }
1737
  }
1738
+
1739
  /**
1740
  * Update postmeta for metabox.
1741
  */
1742
  function save_post_data( $post_id ) {
1743
  static $update = false;
1744
+ if ( $update ) {
1745
+ return;
1746
+ }
1747
  if ( $this->locations !== null ) {
1748
+ foreach ( $this->locations as $k => $v ) {
1749
+ if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) {
1750
+ $opts = $this->default_options( $k );
1751
+ $options = array();
1752
+ $update = false;
1753
  foreach ( $opts as $l => $o ) {
1754
+ if ( isset( $_POST[ $l ] ) ) {
1755
+ $options[ $l ] = stripslashes_deep( $_POST[ $l ] );
1756
+ $options[ $l ] = esc_attr( $options[ $l ] );
1757
+ $update = true;
1758
  }
1759
  }
1760
  if ( $update ) {
1761
+ $prefix = $this->get_prefix( $k );
1762
  $options = apply_filters( $prefix . 'filter_metabox_options', $options, $k, $post_id );
1763
  update_post_meta( $post_id, '_' . $prefix . $k, $options );
1764
  }
1766
  }
1767
  }
1768
  }
1769
+
1770
  /**
1771
  * Outputs radio buttons, checkboxes, selects, multiselects, handles groups.
1772
+ */
1773
  function do_multi_input( $args ) {
1774
  extract( $args );
1775
  $buf1 = '';
1776
  $type = $options['type'];
1777
  if ( ( $type == 'radio' ) || ( $type == 'checkbox' ) ) {
1778
+ $strings = array(
1779
+ 'block' => "%s\n",
1780
+ 'group' => "\t<b>%s</b><br>\n%s\n",
1781
+ 'item' => "\t<label class='aioseop_option_setting_label'><input type='$type' %s name='%s' value='%s' %s> %s</label>\n",
1782
+ 'item_args' => array( 'sel', 'name', 'v', 'attr', 'subopt' ),
1783
+ 'selected' => 'checked '
1784
+ );
1785
  } else {
1786
+ $strings = array(
1787
+ 'block' => "<select name='$name' $attr>%s\n</select>\n",
1788
+ 'group' => "\t<optgroup label='%s'>\n%s\t</optgroup>\n",
1789
+ 'item' => "\t<option %s value='%s'>%s</option>\n",
1790
+ 'item_args' => array( 'sel', 'v', 'subopt' ),
1791
+ 'selected' => 'selected '
1792
+ );
1793
  }
1794
  $setsel = $strings['selected'];
1795
+ if ( isset( $options['initial_options'] ) && is_array( $options['initial_options'] ) ) {
1796
  foreach ( $options['initial_options'] as $l => $option ) {
1797
  $is_group = is_array( $option );
1798
+ if ( ! $is_group ) {
1799
+ $option = array( $l => $option );
1800
+ }
1801
  $buf2 = '';
1802
  foreach ( $option as $v => $subopt ) {
1803
+ $sel = '';
1804
  $is_arr = is_array( $value );
1805
  if ( is_string( $v ) || is_string( $value ) ) {
1806
+ if ( is_string( $value ) ) {
1807
+ $cmp = ! strcmp( $v, $value );
1808
+ } else {
1809
+ $cmp = ! strcmp( $v, '' );
1810
+ }
1811
+ // $cmp = !strcmp( (string)$v, (string)$value );
1812
+ } else {
1813
  $cmp = ( $value == $v );
1814
+ }
1815
+ if ( ( ! $is_arr && $cmp ) || ( $is_arr && in_array( $v, $value ) ) ) {
1816
  $sel = $setsel;
1817
+ }
1818
+ $item_arr = array();
1819
+ foreach ( $strings['item_args'] as $arg ) {
1820
+ $item_arr[] = $$arg;
1821
+ }
1822
  $buf2 .= vsprintf( $strings['item'], $item_arr );
1823
  }
1824
+ if ( $is_group ) {
1825
+ $buf1 .= sprintf( $strings['group'], $l, $buf2 );
1826
+ } else {
1827
  $buf1 .= $buf2;
1828
+ }
1829
+ }
1830
  $buf1 = sprintf( $strings['block'], $buf1 );
1831
  }
1832
+
1833
  return $buf1;
1834
  }
1835
+
1836
  /**
1837
  * Outputs a setting item for settings pages and metaboxes.
1838
  */
1839
  function get_option_html( $args ) {
1840
  static $n = 0;
1841
  extract( $args );
1842
+ if ( $options['type'] == 'custom' ) {
1843
+ return apply_filters( "{$prefix}output_option", '', $args );
1844
+ }
1845
+ if ( in_array( $options['type'], array(
1846
+ 'multiselect',
1847
+ 'select',
1848
+ 'multicheckbox',
1849
+ 'radio',
1850
+ 'checkbox',
1851
+ 'textarea',
1852
+ 'text',
1853
+ 'submit',
1854
+ 'hidden'
1855
+ ) ) && is_string( $value )
1856
+ ) {
1857
  $value = esc_attr( $value );
1858
+ }
1859
+ $buf = '';
1860
  $onload = '';
1861
+ if ( ! empty( $options['count'] ) ) {
1862
+ $n ++;
1863
  $attr .= " onKeyDown='if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)' onKeyUp='if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)'";
1864
  $onload = "if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n);";
1865
  }
1866
+ if ( isset( $opts['id'] ) ) {
1867
+ $attr .= " id=\"{$opts['id']}\" ";
1868
+ }
1869
  switch ( $options['type'] ) {
1870
+ case 'multiselect':
1871
+ $attr .= ' MULTIPLE';
1872
+ $args['attr'] = $attr;
1873
+ $args['name'] = $name = "{$name}[]";
1874
+ case 'select':
1875
+ $buf .= $this->do_multi_input( $args );
1876
+ break;
1877
+ case 'multicheckbox':
1878
+ $args['name'] = $name = "{$name}[]";
1879
+ $args['options']['type'] = $options['type'] = 'checkbox';
1880
+ case 'radio':
1881
+ $buf .= $this->do_multi_input( $args );
1882
+ break;
1883
+ case 'checkbox':
1884
+ if ( $value ) {
1885
+ $attr .= ' CHECKED';
1886
+ }
1887
+ $buf .= "<input name='$name' type='{$options['type']}' $attr>\n";
1888
+ break;
1889
+ case 'textarea':
1890
+ $buf .= "<textarea name='$name' $attr>$value</textarea>";
1891
+ break;
1892
+ case 'image':
1893
+ $buf .= "<input class='aioseop_upload_image_button button-primary' type='button' value='Upload Image' style='float:left;' />" .
1894
+ "<input class='aioseop_upload_image_label' name='$name' type='text' $attr value='$value' size=57 style='float:left;clear:left;'>\n";
1895
+ break;
1896
+ case 'html':
1897
+ $buf .= $value;
1898
+ break;
1899
+ default:
1900
+ $buf .= "<input name='$name' type='{$options['type']}' $attr value='$value'>\n";
1901
+ }
1902
+ if ( ! empty( $options['count'] ) ) {
1903
  $size = 60;
1904
+ if ( isset( $options['size'] ) ) {
1905
+ $size = $options['size'];
1906
+ } elseif ( isset( $options['rows'] ) && isset( $options['cols'] ) ) {
1907
+ $size = $options['rows'] * $options['cols'];
1908
+ }
1909
+ if ( isset( $options['count_desc'] ) ) {
1910
  $count_desc = $options['count_desc'];
1911
+ } else {
1912
  $count_desc = __( ' characters. Most search engines use a maximum of %s chars for the %s.', 'all-in-one-seo-pack' );
1913
+ }
1914
+ $buf .= "<br /><input readonly type='text' name='{$prefix}length$n' size='3' maxlength='3' style='width:53px;height:23px;margin:0px;padding:0px 0px 0px 10px;' value='" . $this->strlen( $value ) . "' />"
1915
+ . sprintf( $count_desc, $size, trim( $this->strtolower( $options['name'] ), ':' ) );
1916
+ if ( ! empty( $onload ) ) {
1917
+ $buf .= "<script>jQuery( document ).ready(function() { {$onload} });</script>";
1918
+ }
1919
  }
1920
+
1921
  return $buf;
1922
  }
1923
+
1924
+ const DISPLAY_HELP_START = '<a class="aioseop_help_text_link" style="cursor:pointer;" title="%s" onclick="toggleVisibility(\'%s_tip\');"><label class="aioseop_label textinput">%s</label></a>';
1925
+ const DISPLAY_HELP_END = '<div class="aioseop_help_text_div" style="display:none" id="%s_tip"><label class="aioseop_help_text">%s</label></div>';
1926
+ const DISPLAY_LABEL_FORMAT = '<span class="aioseop_option_label" style="text-align:%s;vertical-align:top;">%s</span>';
1927
+ const DISPLAY_TOP_LABEL = "</div>\n<div class='aioseop_input aioseop_top_label'>\n";
1928
+ const DISPLAY_ROW_TEMPLATE = '<div class="aioseop_wrapper%s" id="%s_wrapper"><div class="aioseop_input">%s<span class="aioseop_option_input"><div class="aioseop_option_div" %s>%s</div>%s</span><p style="clear:left"></p></div></div>';
1929
+
1930
  /**
1931
  * Format a row for an option on a settings page.
1932
  */
1933
  function get_option_row( $name, $opts, $args ) {
1934
  $label_text = $input_attr = $help_text_2 = $id_attr = '';
1935
+ if ( $opts['label'] == 'top' ) {
1936
+ $align = 'left';
1937
+ } else {
1938
  $align = 'right';
1939
+ }
1940
+ if ( isset( $opts['id'] ) ) {
1941
+ $id_attr .= " id=\"{$opts['id']}_div\" ";
1942
+ }
1943
+ if ( $opts['label'] != 'none' ) {
1944
  if ( isset( $opts['help_text'] ) ) {
1945
+ $help_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_START, __( 'Click for Help!', 'all-in-one-seo-pack' ), $name, $opts['name'] );
1946
+ $help_text_2 = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_END, $name, $opts['help_text'] );
1947
+ } else {
1948
+ $help_text = $opts['name'];
1949
+ }
1950
  $label_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_LABEL_FORMAT, $align, $help_text );
1951
+ } else {
1952
+ $input_attr .= ' aioseop_no_label ';
1953
+ }
1954
+ if ( $opts['label'] == 'top' ) {
1955
+ $label_text .= All_in_One_SEO_Pack_Module::DISPLAY_TOP_LABEL;
1956
+ }
1957
  $input_attr .= " aioseop_{$opts['type']}_type";
1958
+
1959
  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 );
1960
  }
1961
+
1962
  /**
1963
  * Display options for settings pages and metaboxes, allows for filtering settings, custom display options.
1964
  */
1965
  function display_options( $location = null, $meta_args = null ) {
1966
+ static $location_settings = array();
1967
+ $defaults = null;
1968
+ $prefix = $this->get_prefix( $location );
1969
+ $help_link = '';
1970
+ if ( is_array( $meta_args['args'] ) && ! empty( $meta_args['args']['default_options'] ) ) {
1971
+ $defaults = $meta_args['args']['default_options'];
1972
+ }
1973
+ if ( ! empty( $meta_args['callback_args'] ) && ! empty( $meta_args['callback_args']['help_link'] ) ) {
1974
+ $help_link = $meta_args['callback_args']['help_link'];
1975
+ }
1976
+ if ( ! empty( $help_link ) ) {
1977
+ echo "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $help_link . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . '</span></a>';
1978
+ }
1979
+
1980
+ if ( ! isset( $location_settings[ $prefix ] ) ) {
1981
+ $current_options = apply_filters( "{$this->prefix}display_options", $this->get_current_options( array(), $location, $defaults ), $location );
1982
+ $settings = apply_filters( "{$this->prefix}display_settings", $this->setting_options( $location, $defaults ), $location, $current_options );
1983
+ $current_options = apply_filters( "{$this->prefix}override_options", $current_options, $location, $settings );
1984
+ $location_settings[ $prefix ]['current_options'] = $current_options;
1985
+ $location_settings[ $prefix ]['settings'] = $settings;
1986
+ } else {
1987
+ $current_options = $location_settings[ $prefix ]['current_options'];
1988
+ $settings = $location_settings[ $prefix ]['settings'];
1989
+ }
1990
+ // $opts["snippet"]["default"] = sprintf( $opts["snippet"]["default"], "foo", "bar", "moby" );
1991
+ $container = "<div class='aioseop aioseop_options {$this->prefix}settings'>";
1992
+ if ( is_array( $meta_args['args'] ) && ! empty( $meta_args['args']['options'] ) ) {
1993
+ $args = array();
1994
+ $arg_keys = array();
1995
+ foreach ( $meta_args['args']['options'] as $a ) {
1996
+ if ( ! empty( $location ) ) {
1997
+ $key = $prefix . $location . '_' . $a;
1998
+ if ( ! isset( $settings[ $key ] ) ) {
1999
+ $key = $a;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2000
  }
2001
+ } else {
2002
+ $key = $prefix . $a;
2003
+ }
2004
+ if ( isset( $settings[ $key ] ) ) {
2005
+ $arg_keys[ $key ] = 1;
2006
+ } elseif ( isset( $settings[ $a ] ) ) {
2007
+ $arg_keys[ $a ] = 1;
2008
+ }
2009
+ }
2010
+ $setting_keys = array_keys( $settings );
2011
+ foreach ( $setting_keys as $s ) {
2012
+ if ( ! empty( $arg_keys[ $s ] ) ) {
2013
+ $args[ $s ] = $settings[ $s ];
2014
+ }
2015
+ }
2016
+ } else {
2017
+ $args = $settings;
2018
+ }
2019
+ foreach ( $args as $name => $opts ) {
2020
+ $attr_list = array( 'class', 'style', 'readonly', 'disabled', 'size', 'placeholder' );
2021
+ if ( $opts['type'] == 'textarea' ) {
2022
+ $attr_list = array_merge( $attr_list, array( 'rows', 'cols' ) );
2023
+ }
2024
+ $attr = '';
2025
+ foreach ( $attr_list as $a ) {
2026
+ if ( isset( $opts[ $a ] ) ) {
2027
+ $attr .= ' ' . $a . '="' . esc_attr( $opts[ $a ] ) . '" ';
2028
  }
2029
  }
2030
+ $opt = '';
2031
+ if ( isset( $current_options[ $name ] ) ) {
2032
+ $opt = $current_options[ $name ];
2033
+ }
2034
+ if ( $opts['label'] == 'none' && $opts['type'] == 'submit' && $opts['save'] == false ) {
2035
+ $opt = $opts['name'];
2036
+ }
2037
+ if ( $opts['type'] == 'html' && empty( $opt ) && $opts['save'] == false ) {
2038
+ $opt = $opts['default'];
2039
+ }
2040
+
2041
+ $args = array(
2042
+ 'name' => $name,
2043
+ 'options' => $opts,
2044
+ 'attr' => $attr,
2045
+ 'value' => $opt,
2046
+ 'prefix' => $prefix
2047
+ );
2048
+ if ( ! empty( $opts['nowrap'] ) ) {
2049
+ echo $this->get_option_html( $args );
2050
+ } else {
2051
+ if ( $container ) {
2052
+ echo $container;
2053
+ $container = '';
2054
+ }
2055
+ echo $this->get_option_row( $name, $opts, $args );
2056
+ }
2057
+ }
2058
+ if ( ! $container ) {
2059
+ echo '</div>';
2060
+ }
2061
  }
2062
+
2063
  function sanitize_domain( $domain ) {
2064
  $domain = trim( $domain );
2065
  $domain = $this->strtolower( $domain );
2066
+ if ( $this->strpos( $domain, 'http://' ) === 0 ) {
2067
+ $domain = $this->substr( $domain, 7 );
2068
+ } elseif ( $this->strpos( $domain, 'https://' ) === 0 ) {
2069
+ $domain = $this->substr( $domain, 8 );
2070
+ }
2071
  $domain = untrailingslashit( $domain );
2072
+
2073
  return $domain;
2074
  }
2075
 
2076
  /** Sanitize options */
2077
  function sanitize_options( $location = null ) {
2078
  foreach ( $this->setting_options( $location ) as $k => $v ) {
2079
+ if ( isset( $this->options[ $k ] ) ) {
2080
+ if ( ! empty( $v['sanitize'] ) ) {
2081
  $type = $v['sanitize'];
2082
+ } else {
2083
  $type = $v['type'];
2084
+ }
2085
  switch ( $type ) {
2086
  case 'multiselect':
2087
+ case 'multicheckbox':
2088
+ $this->options[ $k ] = urlencode_deep( $this->options[ $k ] );
2089
+ break;
2090
+ case 'textarea':
2091
+ $this->options[ $k ] = wp_kses_post( $this->options[ $k ] );
2092
+ $this->options[ $k ] = htmlspecialchars( $this->options[ $k ], ENT_QUOTES );
2093
+ break;
2094
+ case 'filename':
2095
+ $this->options[ $k ] = sanitize_file_name( $this->options[ $k ] );
2096
+ break;
2097
+ case 'text':
2098
+ $this->options[ $k ] = wp_kses_post( $this->options[ $k ] );
2099
  case 'checkbox':
2100
  case 'radio':
2101
  case 'select':
2102
+ default:
2103
+ if ( ! is_array( $this->options[ $k ] ) ) {
2104
+ $this->options[ $k ] = esc_attr( $this->options[ $k ] );
2105
+ }
2106
  }
2107
  }
2108
  }
2121
  function reset_options( $location = null, $delete = false ) {
2122
  if ( $delete === true ) {
2123
  $this->delete_class_option( $delete );
2124
+ $this->options = array();
2125
  }
2126
  $default_options = $this->default_options( $location );
2127
  foreach ( $default_options as $k => $v ) {
2128
+ $this->options[ $k ] = $v;
2129
  }
2130
  $this->update_class_option( $this->options );
2131
  }
2132
+
2133
  /** handle option resetting and updating */
2134
  function handle_settings_updates( $location = null ) {
2135
  $message = '';
2136
+ if ( ( isset( $_POST['action'] ) && $_POST['action'] == 'aiosp_update_module' &&
2137
+ ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) || ! empty( $_POST['Submit'] ) ) )
2138
+ ) {
2139
  $nonce = $_POST['nonce-aioseop'];
2140
+ if ( ! wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) {
2141
+ die ( __( 'Security Check - If you receive this in error, log out and back in to WordPress', 'all-in-one-seo-pack' ) );
2142
+ }
2143
  if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) {
2144
+ $message = __( 'Options Reset.', 'all-in-one-seo-pack' );
2145
+ if ( isset( $_POST['Submit_All_Default'] ) ) {
2146
  $this->reset_options( $location, true );
2147
  do_action( 'aioseop_options_reset' );
2148
  } else {
2149
  $this->reset_options( $location );
2150
  }
2151
  }
2152
+ if ( ! empty( $_POST['Submit'] ) ) {
2153
+ $message = __( 'All in One SEO Options Updated.', 'all-in-one-seo-pack' );
2154
  $default_options = $this->default_options( $location );
2155
+ foreach ( $default_options as $k => $v ) {
2156
+ if ( isset( $_POST[ $k ] ) ) {
2157
+ $this->options[ $k ] = stripslashes_deep( $_POST[ $k ] );
2158
+ } else {
2159
+ $this->options[ $k ] = '';
2160
+ }
2161
  }
2162
  $this->sanitize_options( $location );
2163
  $this->options = apply_filters( $this->prefix . 'update_options', $this->options, $location );
2166
  }
2167
  do_action( $this->prefix . 'settings_update', $this->options, $location );
2168
  }
2169
+
2170
  return $message;
2171
  }
2172
 
2173
  /** Update / reset settings, printing options, sanitizing, posting back */
2174
  function display_settings_page( $location = null ) {
2175
+ if ( $location != null ) {
2176
+ $location_info = $this->locations[ $location ];
2177
+ }
2178
+ $name = null;
2179
+ if ( $location && isset( $location_info['name'] ) ) {
2180
+ $name = $location_info['name'];
2181
+ }
2182
+ if ( ! $name ) {
2183
+ $name = $this->name;
2184
+ }
2185
+ $message = $this->handle_settings_updates( $location );
2186
+ $this->settings_page_init();
2187
+ ?>
2188
+ <div class="wrap <?php echo get_class( $this ); ?>">
2189
+ <div id="aioseop_settings_header">
2190
+ <?php if ( ! empty( $message ) ) {
2191
+ echo "<div id=\"message\" class=\"updated fade\"><p>$message</p></div>";
2192
+ } ?>
2193
+ <div id="icon-aioseop" class="icon32"><br></div>
2194
+ <h2><?php echo $name; ?></h2>
2195
+ <div id="dropmessage" class="updated" style="display:none;"></div>
2196
+ </div>
2197
+ <?php
2198
+ do_action( 'aioseop_global_settings_header', $location );
2199
+ do_action( $this->prefix . 'settings_header', $location );
2200
+ ?>
2201
+ <form id="aiosp_settings_form" name="dofollow" enctype="multipart/form-data" action="" method="post">
2202
+ <div id="aioseop_top_button">
2203
+ <div id="aiosp_ajax_settings_message"></div>
2204
+ <?php
2205
+
2206
+ $submit_options = array(
2207
+ 'action' => array( 'type' => 'hidden', 'value' => 'aiosp_update_module' ),
2208
+ 'module' => array( 'type' => 'hidden', 'value' => get_class( $this ) ),
2209
+ 'location' => array( 'type' => 'hidden', 'value' => $location ),
2210
+ 'nonce-aioseop' => array(
2211
+ 'type' => 'hidden',
2212
+ 'value' => wp_create_nonce( 'aioseop-nonce' )
2213
+ ),
2214
+ 'page_options' => array( 'type' => 'hidden', 'value' => 'aiosp_home_description' ),
2215
+ 'Submit' => array(
2216
+ 'type' => 'submit',
2217
+ 'class' => 'button-primary',
2218
+ 'value' => __( 'Update Options', 'all-in-one-seo-pack' ) . ' &raquo;'
2219
+ ),
2220
+ 'Submit_Default' => array(
2221
+ 'type' => 'submit',
2222
+ 'class' => 'button-secondary',
2223
+ 'value' => __( sprintf( 'Reset %s Settings to Defaults', $name ), 'all-in-one-seo-pack' ) . ' &raquo;'
2224
+ )
2225
+ );
2226
+ $submit_options = apply_filters( "{$this->prefix}submit_options", $submit_options, $location );
2227
+ foreach ( $submit_options as $k => $s ) {
2228
+ if ( $s['type'] == 'submit' && $k != 'Submit' ) {
2229
+ continue;
2230
+ }
2231
+ $class = '';
2232
+ if ( isset( $s['class'] ) ) {
2233
+ $class = " class='{$s['class']}' ";
2234
+ }
2235
+ echo $this->get_option_html( array(
2236
+ 'name' => $k,
2237
+ 'options' => $s,
2238
+ 'attr' => $class,
2239
+ 'value' => $s['value']
2240
+ ) );
2241
+ }
2242
+ ?>
2243
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2244
  <div class="aioseop_options_wrapper aioseop_settings_left">
2245
+ <?php $opts = $this->get_class_option();
2246
+ if ( $opts !== false ) {
2247
+ $this->options = $opts;
2248
+ }
2249
  if ( is_array( $this->layout ) ) {
2250
+ foreach ( $this->layout as $l => $lopts ) {
2251
+ if ( ! isset( $lopts['tab'] ) || ( $this->current_tab == $lopts['tab'] ) ) {
2252
  $title = $lopts['name'];
2253
+ if ( ! empty( $lopts['help_link'] ) ) {
2254
+ $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . '</span></a>';
2255
+ }
2256
+ add_meta_box( $this->get_prefix( $location ) . $l . '_metabox', $title, array(
2257
+ $this,
2258
+ 'display_options'
2259
+ ),
2260
+ "{$this->prefix}settings", 'advanced', 'default', $lopts );
2261
  }
2262
  }
2263
+ } else {
2264
+ add_meta_box( $this->get_prefix( $location ) . 'metabox', $name, array(
2265
+ $this,
2266
+ 'display_options'
2267
+ ), "{$this->prefix}settings", 'advanced' );
2268
+ }
2269
  do_meta_boxes( "{$this->prefix}settings", 'advanced', $location );
2270
+ ?> <p class="submit" style="clear:both;"><?php
2271
+ foreach ( array( 'action', 'nonce-aioseop', 'page_options' ) as $submit_field ) {
2272
+ if ( isset( $submit_field ) ) {
2273
+ unset( $submit_field );
2274
+ }
2275
+ }
2276
+ foreach ( $submit_options as $k => $s ) {
2277
+ $class = '';
2278
+ if ( isset( $s['class'] ) ) {
2279
+ $class = " class='{$s['class']}' ";
2280
+ }
2281
+ echo $this->get_option_html( array(
2282
+ 'name' => $k,
2283
+ 'options' => $s,
2284
+ 'attr' => $class,
2285
+ 'value' => $s['value']
2286
+ ) );
2287
+ }
2288
+ ?> </p>
2289
+ </div>
2290
  </form>
2291
+ <?php do_action( $this->prefix . 'settings_footer', $location );
2292
+ do_action( 'aioseop_global_settings_footer', $location ); ?>
2293
+ </div> <?php
2294
  }
2295
+
2296
  /**
2297
  * Get the prefix used for a given location.
2298
  */
2299
  function get_prefix( $location = null ) {
2300
+ if ( ( $location != null ) && isset( $this->locations[ $location ]['prefix'] ) ) {
2301
+ return $this->locations[ $location ]['prefix'];
2302
+ }
2303
+
2304
  return $this->prefix;
2305
  }
2306
 
2307
  /** Sets up initial settings */
2308
  function setting_options( $location = null, $defaults = null ) {
2309
+ if ( $defaults === null ) {
2310
  $defaults = $this->default_options;
2311
+ }
2312
  $prefix = $this->get_prefix( $location );
2313
+ $opts = array();
2314
+ if ( $location == null || $this->locations[ $location ]['options'] === null ) {
2315
  $options = $defaults;
2316
+ } else {
2317
+ $options = array();
2318
+ $prefix = "{$prefix}{$location}_";
2319
+ if ( ! empty( $this->locations[ $location ]['default_options'] ) ) {
2320
+ $options = $this->locations[ $location ]['default_options'];
2321
+ }
2322
+ foreach ( $this->locations[ $location ]['options'] as $opt ) {
2323
+ if ( isset( $defaults[ $opt ] ) ) {
2324
+ $options[ $opt ] = $defaults[ $opt ];
2325
+ }
2326
+ }
2327
+ }
2328
+ if ( ! $prefix ) {
2329
+ $prefix = $this->prefix;
2330
+ }
2331
+ if ( ! empty( $options ) ) {
2332
+ foreach ( $options as $k => $v ) {
2333
+ if ( ! isset( $v['name'] ) ) {
2334
+ $v['name'] = $this->ucwords( strtr( $k, '_', ' ' ) );
2335
+ }
2336
+ if ( ! isset( $v['type'] ) ) {
2337
+ $v['type'] = 'checkbox';
2338
+ }
2339
+ if ( ! isset( $v['default'] ) ) {
2340
+ $v['default'] = null;
2341
+ }
2342
+ if ( ! isset( $v['initial_options'] ) ) {
2343
+ $v['initial_options'] = $v['default'];
2344
+ }
2345
+ if ( $v['type'] == 'custom' && ( ! isset( $v['nowrap'] ) ) ) {
2346
+ $v['nowrap'] = true;
2347
+ } elseif ( ! isset( $v['nowrap'] ) ) {
2348
+ $v['nowrap'] = null;
2349
+ }
2350
  if ( isset( $v['condshow'] ) ) {
2351
+ if ( ! is_array( $this->script_data ) ) {
2352
+ $this->script_data = array();
2353
+ }
2354
+ if ( ! isset( $this->script_data['condshow'] ) ) {
2355
+ $this->script_data['condshow'] = array();
2356
+ }
2357
+ $this->script_data['condshow'][ $prefix . $k ] = $v['condshow'];
2358
  }
2359
  if ( $v['type'] == 'submit' ) {
2360
+ if ( ! isset( $v['save'] ) ) {
2361
+ $v['save'] = false;
2362
+ }
2363
+ if ( ! isset( $v['label'] ) ) {
2364
+ $v['label'] = 'none';
2365
+ }
2366
+ if ( ! isset( $v['prefix'] ) ) {
2367
+ $v['prefix'] = false;
2368
+ }
2369
  } else {
2370
+ if ( ! isset( $v['label'] ) ) {
2371
+ $v['label'] = null;
2372
+ }
2373
  }
2374
  if ( $v['type'] == 'hidden' ) {
2375
+ if ( ! isset( $v['label'] ) ) {
2376
+ $v['label'] = 'none';
2377
+ }
2378
+ if ( ! isset( $v['prefix'] ) ) {
2379
+ $v['prefix'] = false;
2380
+ }
2381
+ }
2382
+ if ( ( $v['type'] == 'text' ) && ( ! isset( $v['size'] ) ) ) {
2383
+ $v['size'] = 57;
2384
  }
 
2385
  if ( $v['type'] == 'textarea' ) {
2386
+ if ( ! isset( $v['cols'] ) ) {
2387
+ $v['cols'] = 57;
2388
+ }
2389
+ if ( ! isset( $v['rows'] ) ) {
2390
+ $v['rows'] = 2;
2391
+ }
2392
+ }
2393
+ if ( ! isset( $v['save'] ) ) {
2394
+ $v['save'] = true;
2395
+ }
2396
+ if ( ! isset( $v['prefix'] ) ) {
2397
+ $v['prefix'] = true;
2398
+ }
2399
+ if ( $v['prefix'] ) {
2400
+ $opts[ $prefix . $k ] = $v;
2401
+ } else {
2402
+ $opts[ $k ] = $v;
2403
  }
 
 
 
 
 
 
2404
  }
2405
+ }
2406
+
2407
  return $opts;
2408
  }
2409
 
2410
  /** Generates just the default option names and values */
2411
  function default_options( $location = null, $defaults = null ) {
2412
  $options = $this->setting_options( $location, $defaults );
2413
+ $opts = array();
2414
+ foreach ( $options as $k => $v ) {
2415
+ if ( $v['save'] ) {
2416
+ $opts[ $k ] = $v['default'];
2417
+ }
2418
+ }
2419
+
2420
  return $opts;
2421
  }
2422
+
2423
  /** Gets the current options stored for a given location. */
2424
+ function get_current_options( $opts = array(), $location = null, $defaults = null, $post = null ) {
2425
+ $prefix = $this->get_prefix( $location );
2426
  $get_opts = '';
2427
+ if ( empty( $location ) ) {
2428
  $type = 'settings';
2429
+ } else {
2430
+ $type = $this->locations[ $location ]['type'];
2431
+ }
2432
  if ( $type === 'settings' ) {
2433
  $get_opts = $this->get_class_option();
2434
  } elseif ( $type == 'metabox' ) {
2435
  if ( $post == null ) {
2436
  global $post;
2437
  }
2438
+
2439
  if ( ( isset( $_GET['taxonomy'] ) && isset( $_GET['tag_ID'] ) ) || is_category() || is_tag() || is_tax() ) {
2440
 
2441
  if ( AIOSEOPPRO ) {
2442
  $get_opts = AIO_ProGeneral::getprotax( $get_opts );
2443
  }
2444
+
2445
  } elseif ( isset( $post ) ) {
2446
  $get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
2447
  }
2448
  }
2449
  $defs = $this->default_options( $location, $defaults );
2450
+ if ( $get_opts == '' ) {
2451
  $get_opts = $defs;
2452
+ } else {
2453
  $get_opts = wp_parse_args( $get_opts, $defs );
2454
+ }
2455
  $opts = wp_parse_args( $opts, $get_opts );
2456
+
2457
  return $opts;
2458
  }
2459
 
2460
  /** Updates the options array in the module; loads saved settings with get_option() or uses defaults */
2461
+ function update_options( $opts = array(), $location = null, $defaults = null ) {
2462
+ if ( $location === null ) {
2463
  $type = 'settings';
2464
+ } else {
2465
+ $type = $this->locations[ $location ][ $type ];
2466
+ }
2467
  if ( $type === 'settings' ) {
2468
  $get_opts = $this->get_class_option();
2469
  }
2470
+ if ( $get_opts === false ) {
2471
  $get_opts = $this->default_options( $location, $defaults );
2472
+ } else {
2473
+ $this->setting_options( $location, $defaults );
2474
+ } // hack -- make sure this runs anyhow, for now -- pdb
2475
  $this->options = wp_parse_args( $opts, $get_opts );
2476
  }
2477
  }
admin/aioseop_module_manager.php CHANGED
@@ -1,124 +1,208 @@
1
  <?php
2
- /**
3
- * @package All-in-One-SEO-Pack
4
- */
5
  /**
6
  * The Module Manager.
 
 
 
 
 
7
  */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
 
 
 
 
 
9
  class All_in_One_SEO_Pack_Module_Manager {
10
- protected $modules = Array();
11
  protected $settings_update = false;
12
  protected $settings_reset = false;
13
  protected $settings_reset_all = false;
14
  protected $module_settings_update = false;
15
- // initialize module list
 
 
 
 
 
 
 
16
  function __construct( $mod ) {
 
17
  $this->modules['feature_manager'] = null;
18
- foreach ( $mod as $m ) $this->modules[$m] = null;
19
- $reset = false;
20
- $reset_all = ( isset( $_POST['Submit_All_Default'] ) && $_POST['Submit_All_Default']!='' );
21
- $reset = ( ( isset( $_POST['Submit_Default'] ) && $_POST['Submit_Default']!='' ) || $reset_all );
22
- $update = ( isset($_POST['action']) && $_POST['action']
23
- && ( ( isset( $_POST['Submit'] ) && $_POST['Submit']!='' ) || $reset )
24
- );
 
 
25
  if ( $update ) {
26
- if ( $reset ) $this->settings_reset = true;
27
- if ( $reset_all ) $this->settings_reset_all = true;
28
- if ( $_POST['action'] == 'aiosp_update' ) $this->settings_update = true;
29
- if ( $_POST['action'] == 'aiosp_update_module' ) $this->module_settings_update = true;
 
 
 
 
 
 
 
 
30
  }
31
  $this->do_load_module( 'feature_manager', $mod );
32
  }
33
 
 
 
 
 
 
 
 
34
  function return_module( $class ) {
35
  global $aiosp;
36
- if ( $class == get_class( $aiosp ) ) return $aiosp;
37
- if ( $class == get_class( $this ) ) return $this;
38
- foreach( $this->modules as $m )
39
- if ( is_object( $m ) && ( $class == get_class( $m ) ) )
 
 
 
 
40
  return $m;
 
 
 
41
  return false;
42
  }
43
-
 
 
 
44
  function get_loaded_module_list() {
45
- $module_list = Array();
46
- if ( !empty( $this->modules ) ) {
47
- foreach( $this->modules as $k => $v )
48
- if ( !empty( $v ) )
49
- $module_list[$k] = get_class( $v );
 
 
50
  }
 
51
  return $module_list;
52
  }
53
 
54
- // Module name is used for these automatic settings:
55
- // The aiosp_enable_$module settings - whether each plugin is active or not
56
- // The name of the .php file containing the module - aioseop_$module.php
57
- // The name of the class - All_in_One_SEO_Pack_$Module
58
- // The global $aioseop_$module
59
- // $this->modules[$module]
60
  function do_load_module( $mod, $args = null ) {
 
 
 
 
 
 
 
61
  $mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "modules/aioseop_$mod.php" );
62
- if ( !empty( $mod_path ) )
63
  require_once( $mod_path );
64
- $ref = "aioseop_$mod";
65
- $classname = "All_in_One_SEO_Pack_" . strtr( ucwords( strtr( $mod, '_', ' ' ) ), ' ', '_' );
66
- $classname = apply_filters( "aioseop_class_$mod", $classname );
67
- $module_class = new $classname( $args );
68
- $GLOBALS[$ref] = $module_class;
69
- $this->modules[$mod] = $module_class;
70
- if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) )
71
- add_action( 'admin_bar_menu', array( $module_class, 'add_admin_bar_submenu' ), 1001 + $module_class->menu_order() );
 
 
 
 
 
72
  if ( is_admin() ) {
73
- add_action( 'aioseop_modules_add_menus', Array( $module_class, 'add_menu' ), $module_class->menu_order() );
74
- add_action( 'aiosoep_options_reset', Array( $module_class, 'reset_options' ) );
75
- add_filter( 'aioseop_export_settings', Array( $module_class, 'settings_export' ) );
 
 
 
76
  }
 
77
  return true;
78
  }
79
 
 
 
 
 
 
80
  function load_module( $mod ) {
81
  static $feature_options = null;
82
  static $feature_prefix = null;
83
- if ( !is_array( $this->modules ) ) return false;
 
 
84
  $v = $this->modules[ $mod ];
85
- if ( $v !== null ) return false; // already loaded
86
- if ( $mod == 'performance' && !is_super_admin() ) return false;
87
- if ( ( $mod == 'file_editor' || $mod == 'robots' )
88
- && ( ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
89
- || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
90
- || !is_super_admin() ) ) )
 
 
 
 
 
91
  return false;
 
92
  $mod_enable = false;
93
- $fm_page = ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) &&
94
- isset($_REQUEST['page']) && $_REQUEST['page'] == trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . 'modules/aioseop_feature_manager.php' );
95
- if ( $fm_page && !$this->settings_reset ) {
96
- if ( isset( $_POST["aiosp_feature_manager_enable_$mod"] ) )
97
- $mod_enable = $_POST["aiosp_feature_manager_enable_$mod"];
98
- else
99
- $mod_enable = false;
 
100
  } else {
101
- if ( $feature_prefix == null )
102
  $feature_prefix = $this->modules['feature_manager']->get_prefix();
103
- if ( $fm_page && $this->settings_reset )
 
104
  $feature_options = $this->modules['feature_manager']->default_options();
105
- if ( $feature_options == null ) {
106
- if ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) && $this->settings_reset_all )
 
107
  $feature_options = $this->modules['feature_manager']->default_options();
108
- else
109
  $feature_options = $this->modules['feature_manager']->get_current_options();
 
110
  }
111
- if ( isset( $feature_options["{$feature_prefix}enable_$mod"] ) )
112
  $mod_enable = $feature_options["{$feature_prefix}enable_$mod"];
 
113
  }
114
- if ( $mod_enable ) return $this->do_load_module( $mod );
 
 
 
115
  return false;
116
  }
117
 
118
  function load_modules() {
119
- if ( is_array( $this->modules ) )
120
- foreach( $this->modules as $k => $v )
121
  $this->load_module( $k );
 
 
122
  }
123
  }
124
  }
1
  <?php
 
 
 
2
  /**
3
  * The Module Manager.
4
+ *
5
+ * Mostly we're activating and deactivating modules/features.
6
+ *
7
+ * @package All-in-One-SEO-Pack
8
+ * @since 2.0
9
  */
10
+
11
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
12
+
13
+ /**
14
+ * Class All_in_One_SEO_Pack_Module_Manager
15
+ */
16
  class All_in_One_SEO_Pack_Module_Manager {
17
+ protected $modules = array();
18
  protected $settings_update = false;
19
  protected $settings_reset = false;
20
  protected $settings_reset_all = false;
21
  protected $module_settings_update = false;
22
+
23
+ /**
24
+ * All_in_One_SEO_Pack_Module_Manager constructor.
25
+ *
26
+ * Initialize module list.
27
+ *
28
+ * @param $mod Modules.
29
+ */
30
  function __construct( $mod ) {
31
+
32
  $this->modules['feature_manager'] = null;
33
+ foreach ( $mod as $m ) {
34
+ $this->modules[ $m ] = null;
35
+ }
36
+ $reset = false;
37
+ $reset_all = ( isset( $_POST['Submit_All_Default'] ) && '' !== $_POST['Submit_All_Default'] );
38
+ $reset = ( ( isset( $_POST['Submit_Default'] ) && '' !== $_POST['Submit_Default'] ) || $reset_all );
39
+ $update = ( isset( $_POST['action'] ) && $_POST['action']
40
+ && ( ( isset( $_POST['Submit'] ) && '' !== $_POST['Submit'] ) || $reset )
41
+ );
42
  if ( $update ) {
43
+ if ( $reset ) {
44
+ $this->settings_reset = true;
45
+ }
46
+ if ( $reset_all ) {
47
+ $this->settings_reset_all = true;
48
+ }
49
+ if ( 'aiosp_update' === $_POST['action'] ) {
50
+ $this->settings_update = true;
51
+ }
52
+ if ( 'aiosp_update_module' === $_POST['action'] ) {
53
+ $this->module_settings_update = true;
54
+ }
55
  }
56
  $this->do_load_module( 'feature_manager', $mod );
57
  }
58
 
59
+ /**
60
+ * Return module.
61
+ *
62
+ * @param $class
63
+ *
64
+ * @return $this|bool|mixed
65
+ */
66
  function return_module( $class ) {
67
  global $aiosp;
68
+ if ( get_class( $aiosp ) === $class ) {
69
+ return $aiosp;
70
+ }
71
+ if ( get_class( $aiosp ) === $class ) {
72
+ return $this;
73
+ }
74
+ foreach ( $this->modules as $m ) {
75
+ if ( is_object( $m ) && ( get_class( $m ) === $class ) ) {
76
  return $m;
77
+ }
78
+ }
79
+
80
  return false;
81
  }
82
+
83
+ /**
84
+ * @return array
85
+ */
86
  function get_loaded_module_list() {
87
+ $module_list = array();
88
+ if ( ! empty( $this->modules ) ) {
89
+ foreach ( $this->modules as $k => $v ) {
90
+ if ( ! empty( $v ) ) {
91
+ $module_list[ $k ] = get_class( $v );
92
+ }
93
+ }
94
  }
95
+
96
  return $module_list;
97
  }
98
 
99
+ /**
100
+ * @param $mod Module.
101
+ * @param null $args
102
+ *
103
+ * @return bool
104
+ */
105
  function do_load_module( $mod, $args = null ) {
106
+ // Module name is used for these automatic settings:
107
+ // The aiosp_enable_$module settings - whether each plugin is active or not.
108
+ // The name of the .php file containing the module - aioseop_$module.php.
109
+ // The name of the class - All_in_One_SEO_Pack_$Module.
110
+ // The global $aioseop_$module.
111
+ // $this->modules[$module].
112
+
113
  $mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "modules/aioseop_$mod.php" );
114
+ if ( ! empty( $mod_path ) ) {
115
  require_once( $mod_path );
116
+ }
117
+ $ref = "aioseop_$mod";
118
+ $classname = 'All_in_One_SEO_Pack_' . strtr( ucwords( strtr( $mod, '_', ' ' ) ), ' ', '_' );
119
+ $classname = apply_filters( "aioseop_class_$mod", $classname );
120
+ $module_class = new $classname( $args );
121
+ $GLOBALS[ $ref ] = $module_class;
122
+ $this->modules[ $mod ] = $module_class;
123
+ if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
124
+ add_action( 'admin_bar_menu', array(
125
+ $module_class,
126
+ 'add_admin_bar_submenu',
127
+ ), 1001 + $module_class->menu_order() );
128
+ }
129
  if ( is_admin() ) {
130
+ add_action( 'aioseop_modules_add_menus', array(
131
+ $module_class,
132
+ 'add_menu',
133
+ ), $module_class->menu_order() );
134
+ add_action( 'aiosoep_options_reset', array( $module_class, 'reset_options' ) );
135
+ add_filter( 'aioseop_export_settings', array( $module_class, 'settings_export' ) );
136
  }
137
+
138
  return true;
139
  }
140
 
141
+ /**
142
+ * @param $mod
143
+ *
144
+ * @return bool
145
+ */
146
  function load_module( $mod ) {
147
  static $feature_options = null;
148
  static $feature_prefix = null;
149
+ if ( ! is_array( $this->modules ) ) {
150
+ return false;
151
+ }
152
  $v = $this->modules[ $mod ];
153
+ if ( null !== $v ) {
154
+ return false;
155
+ } // Already loaded.
156
+ if ( 'performance' === $mod && ! is_super_admin() ) {
157
+ return false;
158
+ }
159
+ if ( ( 'file_editor' === $mod || 'robots' === $mod )
160
+ && ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
161
+ || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
162
+ || ! is_super_admin() )
163
+ ) {
164
  return false;
165
+ }
166
  $mod_enable = false;
167
+ $fm_page = ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) &&
168
+ isset( $_REQUEST['page'] ) && trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . 'modules/aioseop_feature_manager.php' === $_REQUEST['page'] );
169
+ if ( $fm_page && ! $this->settings_reset ) {
170
+ if ( isset( $_POST["aiosp_feature_manager_enable_$mod"] ) ) {
171
+ $mod_enable = $_POST["aiosp_feature_manager_enable_$mod"];
172
+ } else {
173
+ $mod_enable = false;
174
+ }
175
  } else {
176
+ if ( null === $feature_prefix ) {
177
  $feature_prefix = $this->modules['feature_manager']->get_prefix();
178
+ }
179
+ if ( $fm_page && $this->settings_reset ) {
180
  $feature_options = $this->modules['feature_manager']->default_options();
181
+ }
182
+ if ( null === $feature_options ) {
183
+ if ( $this->module_settings_update && $this->settings_reset_all && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
184
  $feature_options = $this->modules['feature_manager']->default_options();
185
+ } else {
186
  $feature_options = $this->modules['feature_manager']->get_current_options();
187
+ }
188
  }
189
+ if ( isset( $feature_options["{$feature_prefix}enable_$mod"] ) ) {
190
  $mod_enable = $feature_options["{$feature_prefix}enable_$mod"];
191
+ }
192
  }
193
+ if ( $mod_enable ) {
194
+ return $this->do_load_module( $mod );
195
+ }
196
+
197
  return false;
198
  }
199
 
200
  function load_modules() {
201
+ if ( is_array( $this->modules ) ) {
202
+ foreach ( $this->modules as $k => $v ) {
203
  $this->load_module( $k );
204
+ }
205
+ }
206
  }
207
  }
208
  }
admin/display/general-metaboxes.php CHANGED
@@ -3,117 +3,166 @@
3
  /**
4
  * @package All-in-One-SEO-Pack
5
  */
6
-
7
  class aiosp_metaboxes {
8
-
 
 
 
9
  function __construct() {
10
  //construct
11
 
12
  }
13
-
14
 
15
-
16
-
17
-
18
-
19
-
20
  static function display_extra_metaboxes( $add, $meta ) {
21
  echo "<div class='aioseop_metabox_wrapper' >";
22
  switch ( $meta['id'] ) {
23
- case "aioseop-about":
24
- ?><div class="aioseop_metabox_text">
25
- <p><h2 style="display:inline;"><?php echo AIOSEOP_PLUGIN_NAME; ?></h2><?php sprintf( __( "by %s of %s.", 'all-in-one-seo-pack' ), 'Michael Torbert', '<a target="_blank" title="Semper Fi Web Design"
 
 
26
  href="http://semperfiwebdesign.com/">Semper Fi Web Design</a>' ); ?>.</p>
27
- <?php
28
- global $current_user;
29
- $user_id = $current_user->ID;
30
- $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' );
31
- if ( !empty( $ignore ) ) {
32
- $qa = Array();
33
- wp_parse_str( $_SERVER["QUERY_STRING"], $qa );
34
- $qa['aioseop_reset_notices'] = 1;
35
- $url = '?' . build_query( $qa );
36
- echo '<p><a href="' . $url . '">' . __( "Reset Dismissed Notices", 'all-in-one-seo-pack' ) . '</a></p>';
37
- }
38
- if ( !AIOSEOPPRO ) {
39
- ?>
40
- <p>
41
- <strong><?php echo aiosp_common::get_upgrade_hyperlink( 'side', __('Pro Version', 'all-in-one-seo-pack'), __('UPGRADE TO PRO VERSION', 'all-in-one-seo-pack'), '_blank' ); ?></strong></p>
42
- <?php } ?>
43
- </div>
 
44
  <?php
45
- case "aioseop-donate":
46
- ?>
47
  <div>
48
 
49
- <?php if ( !AIOSEOPPRO ) { ?>
50
- <div class="aioseop_metabox_text">
51
- <p>If you like this plugin and find it useful, help keep this plugin free and actively developed by clicking the <a href="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&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8"
52
- target="_blank"><strong>donate</strong></a> button or send me a gift from my <a
53
- href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank">
54
- <strong>Amazon wishlist</strong></a>. Also, don't forget to follow me on <a
55
- href="http://twitter.com/michaeltorbert/" target="_blank"><strong>Twitter</strong></a>.
56
- </p>
57
- </div>
58
- <?php } ?>
 
 
 
59
 
60
  <div class="aioseop_metabox_feature">
61
 
62
- <?php if ( !AIOSEOPPRO ) { ?>
63
- <a target="_blank" title="<?php _e( 'Donate', 'all-in-one-seo-pack' ); ?>"
64
- href="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&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">
65
- <img src="<?php echo AIOSEOP_PLUGIN_URL; ?>images/donate.jpg" alt="<?php _e('Donate with Paypal', 'all-in-one-seo-pack' ); ?>" /> </a>
66
- <a target="_blank" title="Amazon Wish List" href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web">
67
- <img src="<?php echo AIOSEOP_PLUGIN_URL; ?>images/amazon.jpg" alt="<?php _e('My Amazon Wish List', 'all-in-one-seo-pack' ); ?>" /> </a>
68
- <?php } ?>
69
-
70
- <a target="_blank" title="<?php _e( 'Follow us on Facebook', 'all-in-one-seo-pack' ); ?>" href="http://www.facebook.com/pages/Semper-Fi-Web-Design/121878784498475"><span class="aioseop_follow_button aioseop_facebook_follow"></span></a>
71
- <a target="_blank" title="<?php _e( 'Follow us on Twitter', 'all-in-one-seo-pack' ); ?>" href="http://twitter.com/semperfidev/"><span class="aioseop_follow_button aioseop_twitter_follow"></span></a>
72
- </div><?php if(get_locale() != 'en_US'){ ?>
73
- <div><strong>
74
- <a target="_blank" title="translate" href="https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack">
75
- <?php _e( 'We need your help translating All in One SEO Pack into your language! Click Here to help make the translation complete and fix any errors.' , 'all-in-one-seo-pack' ); ?>
76
- </a></strong>
77
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  <?php } ?>
79
  </div>
80
- <?php
81
- break;
82
- case "aioseop-list":
83
- ?>
84
  <div class="aioseop_metabox_text">
85
- <form action="http://semperfiwebdesign.us1.list-manage.com/subscribe/post?u=794674d3d54fdd912f961ef14&amp;id=af0a96d3d9"
86
- method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
 
 
87
  <h2><?php _e( 'Join our mailing list for tips, tricks, and WordPress secrets.', 'all-in-one-seo-pack' ); ?></h2>
88
- <p><i><?php _e( 'Sign up today and receive a free copy of the e-book 5 SEO Tips for WordPress ($39 value).', 'all-in-one-seo-pack' ); ?></i></p>
89
- <p><input type="text" value="" name="EMAIL" class="required email" id="mce-EMAIL" placeholder="Email Address">
90
- <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="btn"></p>
91
- </form>
 
 
 
 
92
  </div>
93
- <?php
94
  break;
95
- case "aioseop-support":
96
- ?><div class="aioseop_metabox_text">
97
- <p><div class="aioseop_icon aioseop_file_icon"></div><a target="_blank" href="http://semperplugins.com/documentation/"><?php _e( 'Read the All in One SEO Pack user guide', 'all-in-one-seo-pack' ); ?></a></p>
98
- <p><div class="aioseop_icon aioseop_support_icon"></div><a target="_blank" title="<?php _e( 'All in One SEO Pro Plugin Support Forum', 'all-in-one-seo-pack' ); ?>"
99
- href="http://semperplugins.com/support/"><?php _e( 'Access our Premium Support Forums', 'all-in-one-seo-pack' ); ?></a></p>
100
- <p><div class="aioseop_icon aioseop_cog_icon"></div><a target="_blank" title="<?php _e( 'All in One SEO Pro Plugin Changelog', 'all-in-one-seo-pack' ); ?>"
101
- href="<?php if ( AIOSEOPPRO ) { echo 'http://semperplugins.com/documentation/all-in-one-seo-pack-pro-changelog/'; } else { echo 'http://semperfiwebdesign.com/blog/all-in-one-seo-pack/all-in-one-seo-pack-release-history/'; } ?>"><?php _e( 'View the Changelog', 'all-in-one-seo-pack' ); ?></a></p>
102
- <p><div class="aioseop_icon aioseop_youtube_icon"></div><a target="_blank" href="http://semperplugins.com/doc-type/video/"><?php _e( 'Watch video tutorials', 'all-in-one-seo-pack' ); ?></a></p>
103
- <p><div class="aioseop_icon aioseop_book_icon"></div><a target="_blank" href="http://semperplugins.com/documentation/quick-start-guide/"><?php _e( 'Getting started? Read the Beginners Guide', 'all-in-one-seo-pack' ); ?></a></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  </div>
105
- <?php
106
- break;
107
  }
108
- echo "</div>";
109
  }
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
- }
3
  /**
4
  * @package All-in-One-SEO-Pack
5
  */
 
6
  class aiosp_metaboxes {
7
+
8
+ /**
9
+ * aiosp_metaboxes constructor.
10
+ */
11
  function __construct() {
12
  //construct
13
 
14
  }
 
15
 
16
+
17
+ /**
18
+ * @param $add
19
+ * @param $meta
20
+ */
21
  static function display_extra_metaboxes( $add, $meta ) {
22
  echo "<div class='aioseop_metabox_wrapper' >";
23
  switch ( $meta['id'] ) {
24
+ case 'aioseop-about':
25
+ ?>
26
+ <div class="aioseop_metabox_text">
27
+ <p><h2
28
+ style="display:inline;"><?php echo AIOSEOP_PLUGIN_NAME; ?></h2><?php sprintf( __( 'by %s of %s.', 'all-in-one-seo-pack' ), 'Michael Torbert', '<a target="_blank" title="Semper Fi Web Design"
29
  href="http://semperfiwebdesign.com/">Semper Fi Web Design</a>' ); ?>.</p>
30
+ <?php
31
+ global $current_user;
32
+ $user_id = $current_user->ID;
33
+ $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' );
34
+ if ( ! empty( $ignore ) ) {
35
+ $qa = Array();
36
+ wp_parse_str( $_SERVER['QUERY_STRING'], $qa );
37
+ $qa['aioseop_reset_notices'] = 1;
38
+ $url = '?' . build_query( $qa );
39
+ echo '<p><a href="' . $url . '">' . __( 'Reset Dismissed Notices', 'all-in-one-seo-pack' ) . '</a></p>';
40
+ }
41
+ if ( ! AIOSEOPPRO ) {
42
+ ?>
43
+ <p>
44
+ <strong><?php echo aiosp_common::get_upgrade_hyperlink( 'side', __( 'Pro Version', 'all-in-one-seo-pack' ), __( 'UPGRADE TO PRO VERSION', 'all-in-one-seo-pack' ), '_blank' ); ?></strong>
45
+ </p>
46
+ <?php } ?>
47
+ </div>
48
  <?php
49
+ case 'aioseop-donate':
50
+ ?>
51
  <div>
52
 
53
+ <?php if ( ! AIOSEOPPRO ) { ?>
54
+ <div class="aioseop_metabox_text">
55
+ <p>If you like this plugin and find it useful, help keep this plugin free and actively
56
+ developed by clicking the <a
57
+ href="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&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8"
58
+ target="_blank"><strong>donate</strong></a> button or send me a gift from my <a
59
+ href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank">
60
+ <strong>Amazon wishlist</strong></a>. Also, don't forget to follow me on <a
61
+ href="http://twitter.com/michaeltorbert/"
62
+ target="_blank"><strong>Twitter</strong></a>.
63
+ </p>
64
+ </div>
65
+ <?php } ?>
66
 
67
  <div class="aioseop_metabox_feature">
68
 
69
+ <?php if ( ! AIOSEOPPRO ) { ?>
70
+ <a target="_blank" title="<?php _e( 'Donate', 'all-in-one-seo-pack' ); ?>"
71
+ href="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&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">
72
+ <img src="<?php echo AIOSEOP_PLUGIN_URL; ?>images/donate.jpg"
73
+ alt="<?php _e( 'Donate with Paypal', 'all-in-one-seo-pack' ); ?>"/> </a>
74
+ <a target="_blank" title="Amazon Wish List"
75
+ href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web">
76
+ <img src="<?php echo AIOSEOP_PLUGIN_URL; ?>images/amazon.jpg"
77
+ alt="<?php _e( 'My Amazon Wish List', 'all-in-one-seo-pack' ); ?>"/> </a>
78
+ <?php } ?>
79
+
80
+ <a target="_blank" title="<?php _e( 'Follow us on Facebook', 'all-in-one-seo-pack' ); ?>"
81
+ href="https://www.facebook.com/aioseopack/"><span
82
+ class="aioseop_follow_button aioseop_facebook_follow"></span></a>
83
+ <a target="_blank" title="<?php _e( 'Follow us on Twitter', 'all-in-one-seo-pack' ); ?>"
84
+ href="https://twitter.com/aioseopack"><span
85
+ class="aioseop_follow_button aioseop_twitter_follow"></span></a>
86
+ </div><?php
87
+
88
+ $aiosp_trans = new AIOSEOP_Translations();
89
+ // Eventually if nothing is returned we should just remove this section.
90
+
91
+ if ( get_locale() != 'en_US' ) { ?>
92
+ <div><strong>
93
+ <?php
94
+
95
+ if ( $aiosp_trans->percent_translated < 100 ) {
96
+
97
+ /* 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 */
98
+ printf( __(
99
+ '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' ),
100
+ $aiosp_trans->translated_count,
101
+ $aiosp_trans->percent_translated,
102
+ $aiosp_trans->name,
103
+ "<a href=\"$aiosp_trans->translation_url\" target=\"_BLANK\">",
104
+ '</a>' );
105
+ }
106
+
107
+ ?>
108
+ </strong></div>
109
  <?php } ?>
110
  </div>
111
+ <?php
112
+ break;
113
+ case 'aioseop-list':
114
+ ?>
115
  <div class="aioseop_metabox_text">
116
+ <form
117
+ action="http://semperfiwebdesign.us1.list-manage.com/subscribe/post?u=794674d3d54fdd912f961ef14&amp;id=af0a96d3d9"
118
+ method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
119
+ target="_blank">
120
  <h2><?php _e( 'Join our mailing list for tips, tricks, and WordPress secrets.', 'all-in-one-seo-pack' ); ?></h2>
121
+ <p>
122
+ <i><?php _e( 'Sign up today and receive a free copy of the e-book 5 SEO Tips for WordPress ($39 value).', 'all-in-one-seo-pack' ); ?></i>
123
+ </p>
124
+ <p><input type="text" value="" name="EMAIL" class="required email" id="mce-EMAIL"
125
+ placeholder="Email Address">
126
+ <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe"
127
+ class="btn"></p>
128
+ </form>
129
  </div>
130
+ <?php
131
  break;
132
+ case 'aioseop-support':
133
+ ?>
134
+ <div class="aioseop_metabox_text">
135
+ <p>
136
+ <div class="aioseop_icon aioseop_file_icon"></div>
137
+ <a target="_blank"
138
+ href="http://semperplugins.com/documentation/"><?php _e( 'Read the All in One SEO Pack user guide', 'all-in-one-seo-pack' ); ?></a></p>
139
+ <p>
140
+ <div class="aioseop_icon aioseop_support_icon"></div>
141
+ <a target="_blank"
142
+ title="<?php _e( 'All in One SEO Pro Plugin Support Forum', 'all-in-one-seo-pack' ); ?>"
143
+ href="http://semperplugins.com/support/"><?php _e( 'Access our Premium Support Forums', 'all-in-one-seo-pack' ); ?></a></p>
144
+ <p>
145
+ <div class="aioseop_icon aioseop_cog_icon"></div>
146
+ <a target="_blank" title="<?php _e( 'All in One SEO Pro Plugin Changelog', 'all-in-one-seo-pack' ); ?>"
147
+ href="<?php if ( AIOSEOPPRO ) {
148
+ echo 'http://semperplugins.com/documentation/all-in-one-seo-pack-pro-changelog/';
149
+ } else {
150
+ echo 'http://semperfiwebdesign.com/blog/all-in-one-seo-pack/all-in-one-seo-pack-release-history/';
151
+ } ?>"><?php _e( 'View the Changelog', 'all-in-one-seo-pack' ); ?></a></p>
152
+ <p>
153
+ <div class="aioseop_icon aioseop_youtube_icon"></div>
154
+ <a target="_blank"
155
+ href="http://semperplugins.com/doc-type/video/"><?php _e( 'Watch video tutorials', 'all-in-one-seo-pack' ); ?></a></p>
156
+ <p>
157
+ <div class="aioseop_icon aioseop_book_icon"></div>
158
+ <a target="_blank"
159
+ href="http://semperplugins.com/documentation/quick-start-guide/"><?php _e( 'Getting started? Read the Beginners Guide', 'all-in-one-seo-pack' ); ?></a></p>
160
  </div>
161
+ <?php
162
+ break;
163
  }
164
+ echo '</div>';
165
  }
166
+
167
+
168
+ }
 
 
 
 
 
 
 
admin/display/index.php CHANGED
@@ -1 +1,4 @@
1
- <?php // Silence is golden
 
 
 
1
+ <?php
2
+ /**
3
+ * Silence is golden.
4
+ */
admin/index.php CHANGED
@@ -1 +1,4 @@
1
- <?php // Silence is golden
 
 
 
1
+ <?php
2
+ /**
3
+ * Silence is golden.
4
+ */
admin/meta_import.php CHANGED
@@ -1,119 +1,131 @@
1
  <?php
2
 
3
- if( class_exists( 'WPSEO_Import_Hooks' )){
4
- class WPSEO_Import_AIOSEO_Hooks extends WPSEO_Import_Hooks {
5
 
6
- protected $plugin_file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
 
 
 
 
 
 
 
 
 
7
 
8
- protected $deactivation_listener = 'deactivate_aioseo';
 
 
 
9
 
10
- public function show_import_settings_notice() {
11
- // $url = admin_url( 'tools.php?page=seodt' ) );
12
- //make these save to the database and dismissible
13
 
14
-
15
- $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' ) );
16
- $aiourl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'aiosp-import' ) ), admin_url( 'tools.php?page=aiosp_import' ) );
17
 
 
18
 
19
- $aioseop_yst_detected_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
20
 
21
- if ( empty( $aioseop_yst_detected_notice_dismissed ) ) {
22
 
23
- echo '<div class="notice notice-warning row-title is-dismissible yst_notice"><p>', 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( '<a href="%s">', esc_url( $aiourl ) ), '</a>' ), '</p></div>';
24
 
25
  }
26
-
27
-
28
- echo '<div class="error"><p>', sprintf( esc_html__( 'The plugin All-In-One-SEO has been detected. Do you want to %simport its settings%s?', 'wordpress-seo' ), sprintf( '<a href="%s">', esc_url( $yoasturl ) ), '</a>' ), '</p></div>';
29
-
30
-
31
-
32
- }
33
 
34
- public function show_deactivate_notice() {
35
- echo '<div class="updated"><p>', esc_html__( 'All in One SEO has been deactivated', 'all-in-one-seo-pack' ), '</p></div>';
 
36
  }
37
- }
38
- }else{
39
  add_action( 'init', 'mi_aioseop_yst_detected_notice_dismissed' );
40
  }
41
 
42
- function mi_aioseop_yst_detected_notice_dismissed(){
 
 
 
 
 
43
  delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
44
  }
45
 
46
  /**
47
- * Register the admin menu page
 
 
48
  */
49
- add_action('admin_menu', 'aiosp_seometa_settings_init');
50
  function aiosp_seometa_settings_init() {
51
  global $_aiosp_seometa_admin_pagehook;
52
-
53
- // Add submenu page link
54
- $_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');
55
  }
 
 
56
 
57
  /**
58
- * This function intercepts POST data from the form submission, and uses that
59
- * data to convert values in the postmeta table from one platform to another.
 
60
  */
61
  function aiosp_seometa_action() {
62
-
63
- //print_r($_REQUEST);
64
-
65
- if ( empty( $_REQUEST['_wpnonce'] ) )
66
  return;
67
-
 
68
  if ( empty( $_REQUEST['platform_old'] ) ) {
69
- printf( '<div class="error"><p>%s</p></div>', __('Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.') );
 
70
  return;
71
  }
72
-
73
- if ( $_REQUEST['platform_old'] == 'All in One SEO Pack' ) {
74
- printf( '<div class="error"><p>%s</p></div>', __('Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.') );
 
75
  return;
76
  }
77
-
78
- check_admin_referer('aiosp_nonce'); // Verify nonce
79
-
80
- if ( !empty( $_REQUEST['analyze'] ) ) {
81
-
82
- printf( '<h3>%s</h3>', __('Analysis Results', 'all-in-one-seo-pack') );
83
-
84
  $response = aiosp_seometa_post_meta_analyze( $_REQUEST['platform_old'], 'All in One SEO Pack' );
85
  if ( is_wp_error( $response ) ) {
86
- printf( '<div class="error"><p>%s</p></div>', __('Sorry, something went wrong. Please try again') );
 
87
  return;
88
  }
89
-
90
- printf( __('<p>Analyzing records in a %s to %s conversion&hellip;', 'all-in-one-seo-pack'), esc_html( $_POST['platform_old'] ), 'All in One SEO Pack' );
91
  printf( '<p><b>%d</b> Compatible Records were identified</p>', $response->update );
92
- // printf( '<p>%d Compatible Records will be ignored</p>', $response->ignore );
93
-
94
- printf( '<p><b>%s</b></p>', __('Compatible data:', 'all-in-one-seo-pack') );
95
  echo '<ol>';
96
- foreach ( (array)$response->elements as $element ) {
97
  printf( '<li>%s</li>', $element );
98
  }
99
  echo '</ol>';
100
-
101
  return;
102
  }
103
-
104
- printf( '<h3>%s</h3>', __('Conversion Results', 'all-in-one-seo-pack') );
105
-
106
- $result = aiosp_seometa_post_meta_convert( stripslashes($_REQUEST['platform_old']), 'All in One SEO Pack' );
107
  if ( is_wp_error( $result ) ) {
108
- printf( '<p>%s</p>', __('Sorry, something went wrong. Please try again') );
 
109
  return;
110
  }
111
-
112
  printf( '<p><b>%d</b> Records were updated</p>', isset( $result->updated ) ? $result->updated : 0 );
113
  printf( '<p><b>%d</b> Records were ignored</p>', isset( $result->ignored ) ? $result->ignored : 0 );
114
-
115
- return;
116
-
117
  }
118
 
119
  /**
@@ -126,457 +138,472 @@ function aiosp_seometa_action() {
126
  */
127
  function aiosp_seometa_admin() {
128
  global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
129
- ?>
130
 
131
  <div class="wrap">
132
-
133
- <?php screen_icon('tools'); ?>
134
- <h2><?php _e('Import SEO Settings', 'all-in-one-seo-pack'); ?></h2>
135
-
136
- <p><span class="description"><?php printf( __('Use the drop down below to choose which plugin or theme you wish to import SEO data from.', 'all-in-one-seo-pack') ); ?></span></p>
137
-
138
- <p><span class="description"><?php printf( __('Click "Analyze" for a list of SEO data that can be imported into All in One SEO Pack, along with the number of records that will be imported.', 'all-in-one-seo-pack') ); ?></span></p>
139
-
140
- <p><span class="description"><strong><?php printf( __('Please Note: ') ); ?></strong><?php printf( __('Some plugins and themes do not share similar data, or they store data in a non-standard way. If we cannot import this data, it will remain unchanged in your database. Any compatible SEO data will be displayed for you to review. If a post or page already has SEO data in All in One SEO Pack, we will not import data from another plugin/theme.', 'all-in-one-seo-pack') ); ?></span></p>
141
-
142
- <p><span class="description"><?php printf( __('Click "Convert" to perform the import. After the import has completed, you will be alerted to how many records were imported, and how many records had to be ignored, based on the criteria above.', 'all-in-one-seo-pack') ); ?></span></p>
143
-
144
- <p><span class="row-title"><?php printf( esc_html__('Before performing an import, we strongly recommend that you make a backup of your site. We use and recommend %s BackupBuddy %s for backups.', 'all-in-one-seo-pack'), sprintf( '<a target="_blank" href="%s">', esc_url( 'http://semperfiwebdesign.com/backupbuddy/' ) ), '</a>' ); ?></span></p>
145
-
146
-
147
-
148
- <form action="<?php echo admin_url('tools.php?page=aiosp_import'); ?>" method="post">
149
- <?php
150
- wp_nonce_field('aiosp_nonce');
151
-
152
- $platform_old = (!isset($_POST['platform_old'])) ? '' : $_POST['platform_old'];
153
-
154
- _e('Import SEO data from:', 'all-in-one-seo-pack');
155
- echo '<select name="platform_old">';
156
- printf( '<option value="">%s</option>', __('Choose platform:', 'all-in-one-seo-pack') );
157
-
158
- printf( '<optgroup label="%s">', __('Plugins', 'all-in-one-seo-pack') );
159
- foreach ( $_aiosp_seometa_plugins as $platform => $data ) {
160
- if($platform != "All in One SEO Pack") printf( '<option value="%s" %s>%s</option>', $platform, selected($platform, $platform_old, 0), $platform );
161
- }
162
- printf( '</optgroup>' );
163
-
164
- printf( '<optgroup label="%s">', __('Themes', 'all-in-one-seo-pack') );
165
- foreach ( $_aiosp_seometa_themes as $platform => $data ) {
166
- printf( '<option value="%s" %s>%s</option>', $platform, selected($platform, $platform_old, 0), $platform );
167
- }
168
- printf( '</optgroup>' );
169
-
170
 
171
-
172
- echo '</select>' . "\n\n";
173
 
174
- ?>
175
-
176
- <input type="submit" class="button-highlighted" name="analyze" value="<?php _e('Analyze', 'genesis'); ?>" />
177
- <input type="submit" class="button-primary" value="<?php _e('Convert', 'genesis') ?>" />
178
-
179
- </form>
180
-
181
- <?php aiosp_seometa_action(); ?>
182
-
183
- </div>
184
 
185
- <?php
186
- }
 
187
 
 
 
 
188
 
 
 
 
189
 
190
- //////////////////FUNCTIONS//////////////////
 
 
191
 
192
- /**
193
- * This function converts $old meta_key entries in the postmeta table into $new entries.
194
- *
195
- * It first checks to see what records for the $new meta_key already exist,
196
- * storing the corresponding post_id values in an array. When the conversion
197
- * happens, rows that contain a post_id in that array will be ignored, to
198
- * avoid duplicate $new meta_key entries.
199
- *
200
- * The $old entries will be left as-is if $delete_old is left false. If set
201
- * to true, the $old entries will be deleted, rather than retained.
202
- *
203
- * The function returns an object for error detection, and the number of affected rows.
204
- */
205
- function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = false ) {
206
 
207
- do_action( 'pre_aiosp_seometa_meta_key_convert_before', $old, $new, $delete_old );
208
 
209
- global $wpdb;
 
 
210
 
211
- $output = new stdClass;
212
 
213
- if ( !$old || !$new ) {
214
- $output->WP_Error = 1;
215
- return $output;
216
- }
217
 
218
- // See which records we need to ignore, if any
219
- $exclude = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $new ) );
 
 
 
 
 
220
 
221
- // If no records to ignore, we'll do a basic UPDATE and DELETE
222
- if ( !$exclude ) {
 
 
 
223
 
224
- $output->updated = $wpdb->update( $wpdb->postmeta, array( 'meta_key' => $new ), array( 'meta_key' => $old ) );
225
- $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
226
- $output->ignored = 0;
227
 
228
- }
229
- // Else, do a more complex UPDATE and DELETE
230
- else {
231
 
232
- foreach ( (array)$exclude as $key => $value ) {
233
- $not_in[] = $value->post_id;
234
- }
235
- $not_in = implode(', ', (array)$not_in );
236
 
237
- $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 ) );
238
- $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
239
- $output->ignored = count( $exclude );
240
 
241
- }
242
 
243
- do_action( 'aiosp_seometa_meta_key_convert', $output, $old, $new, $delete_old );
244
 
245
- return $output;
 
246
 
247
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
- /**
250
- * This function cycles through all compatible SEO entries of two platforms,
251
- * performs a aiosp_seometa_meta_key_convert() conversion for each key, and returns
252
- * the results as an object.
253
- *
254
- * It first checks for compatible entries between the two platforms. When it
255
- * finds compatible entries, it loops through them and preforms the conversion
256
- * on each entry.
257
- */
258
- function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'All in One SEO Pack', $delete_old = false ) {
259
 
260
- do_action( 'pre_aiosp_seometa_post_meta_convert', $old_platform, $new_platform, $delete_old );
261
 
262
- global $_aiosp_seometa_platforms;
263
 
264
- $output = new stdClass;
 
265
 
266
- if ( empty( $_aiosp_seometa_platforms[$old_platform] ) || empty( $_aiosp_seometa_platforms[$new_platform] ) ) {
267
- $output->WP_Error = 1;
268
- return $output;
269
- }
 
270
 
271
- $output->updated = 0;
272
- $output->deleted = 0;
 
 
 
273
  $output->ignored = 0;
274
 
275
- foreach ( (array)$_aiosp_seometa_platforms[$old_platform] as $label => $meta_key ) {
 
276
 
277
- // skip iterations where no $new analog exists
278
- if ( empty( $_aiosp_seometa_platforms[$new_platform][$label] ) )
279
- continue;
 
280
 
281
- // set $old and $new meta_key values
282
- $old = $_aiosp_seometa_platforms[$old_platform][$label];
283
- $new = $_aiosp_seometa_platforms[$new_platform][$label];
284
 
285
- // convert
286
- $result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old );
287
 
288
- // error check
289
- if ( is_wp_error( $result ) )
290
- continue;
291
 
292
- // update total updated/ignored count
293
- $output->updated = $output->updated + (int)$result->updated;
294
- $output->ignored = $output->ignored + (int)$result->ignored;
295
 
296
- }
297
 
298
- do_action( 'aiosp_seometa_post_meta_convert', $output, $old_platform, $new_platform, $delete_old );
 
 
 
 
 
 
 
 
 
 
 
299
 
300
- return $output;
301
 
302
- }
303
 
304
- /**
305
- * This function analyzes two platforms to see what Compatible elements they share,
306
- * what data can be converted from one to the other, and which elements to ignore (future).
307
- */
308
- function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) {
309
 
310
- do_action( 'pre_aiosp_seometa_post_meta_analyze', $old_platform, $new_platform );
 
311
 
312
- global $wpdb, $_aiosp_seometa_platforms;
 
 
313
 
314
- $output = new stdClass;
315
 
316
- if ( empty( $_aiosp_seometa_platforms[$old_platform] ) || empty( $_aiosp_seometa_platforms[$new_platform] ) ) {
317
- $output->WP_Error = 1;
318
- return $output;
319
  }
320
 
321
- $output->update = 0;
322
- $output->ignore = 0;
323
- $output->elements = '';
324
 
325
- foreach ( (array)$_aiosp_seometa_platforms[$old_platform] as $label => $meta_key ) {
 
326
 
327
- // skip iterations where no $new analog exists
328
- if ( empty( $_aiosp_seometa_platforms[$new_platform][$label] ) )
329
- continue;
 
330
 
331
- $elements[] = $label;
 
 
332
 
333
- // see which records to ignore, if any
334
- $ignore = 0;
335
- // $ignore = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
336
 
337
- // see which records to update, if any
338
- $update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
339
 
340
- // count items in returned arrays
341
- // $ignore = count( (array)$ignore );
342
- $update = count( (array)$update );
343
 
344
- // calculate update/ignore by comparison
345
- // $update = ( (int)$update > (int)$ignore ) ? ( (int)$update - (int)$ignore ) : 0;
346
 
347
- // update output numbers
348
- $output->update = $output->update + (int)$update;
349
- $output->ignore = $output->ignore + (int)$ignore;
 
 
 
 
 
 
 
 
 
 
350
 
351
- } // endforeach
352
 
353
- $output->elements = $elements;
354
 
355
- do_action( 'aiosp_seometa_post_meta_analyze', $output, $old_platform, $new_platform );
 
356
 
357
  return $output;
358
-
359
  }
360
-
361
-
362
-
363
- ////////////PLUGIN/////////
364
 
 
 
 
365
 
366
- // define('aiosp_seometa_PLUGIN_DIR', dirname(__FILE__));
367
 
368
- //add_action( 'plugins_loaded', 'aiosp_seometa_import' );
369
- /**
370
- * Initialize the SEO Data Transporter plugin
371
- */
372
- function aiosp_seometa_import() {
373
 
374
- global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
375
 
376
- /**
377
- * The associative array of supported themes.
378
- */
379
- $_aiosp_seometa_themes = array(
380
- // alphabatized
381
- 'Builder' => array(
382
- 'Custom Doctitle' => '_builder_seo_title',
383
- 'META Description' => '_builder_seo_description',
384
- 'META Keywords' => '_builder_seo_keywords',
385
- ),
386
- 'Catalyst' => array(
387
- 'Custom Doctitle' => '_catalyst_title',
388
- 'META Description' => '_catalyst_description',
389
- 'META Keywords' => '_catalyst_keywords',
390
- 'noindex' => '_catalyst_noindex',
391
- 'nofollow' => '_catalyst_nofollow',
392
- 'noarchive' => '_catalyst_noarchive',
393
- ),
394
- 'Frugal' => array(
395
- 'Custom Doctitle' => '_title',
396
- 'META Description' => '_description',
397
- 'META Keywords' => '_keywords',
398
- 'noindex' => '_noindex',
399
- 'nofollow' => '_nofollow',
400
- ),
401
- 'Genesis' => array(
402
- 'Custom Doctitle' => '_genesis_title',
403
- 'META Description' => '_genesis_description',
404
- 'META Keywords' => '_genesis_keywords',
405
- 'noindex' => '_genesis_noindex',
406
- 'nofollow' => '_genesis_nofollow',
407
- 'noarchive' => '_genesis_noarchive',
408
- 'Canonical URI' => '_genesis_canonical_uri',
409
- 'Custom Scripts' => '_genesis_scripts',
410
- 'Redirect URI' => 'redirect',
411
- ),
412
- 'Headway' => array(
413
- 'Custom Doctitle' => '_title',
414
- 'META Description' => '_description',
415
- 'META Keywords' => '_keywords',
416
- ),
417
- 'Hybrid' => array(
418
- 'Custom Doctitle' => 'Title',
419
- 'META Description' => 'Description',
420
- 'META Keywords' => 'Keywords',
421
- ),
422
- 'Thesis 1.x' => array(
423
- 'Custom Doctitle' => 'thesis_title',
424
- 'META Description' => 'thesis_description',
425
- 'META Keywords' => 'thesis_keywords',
426
- 'Custom Scripts' => 'thesis_javascript_scripts',
427
- 'Redirect URI' => 'thesis_redirect',
428
- ),
429
- /*
430
- 'Thesis 2.x' => array(
431
- 'Custom Doctitle' => '_thesis_title_tag',
432
- 'META Description' => '_thesis_meta_description',
433
- 'META Keywords' => '_thesis_meta_keywords',
434
- 'Custom Scripts' => '_thesis_javascript_scripts',
435
- 'Canonical URI' => '_thesis_canonical_link',
436
- 'Redirect URI' => '_thesis_redirect',
437
- ),
438
- */
439
- 'WooFramework' => array(
440
- 'Custom Doctitle' => 'seo_title',
441
- 'META Description' => 'seo_description',
442
- 'META Keywords' => 'seo_keywords',
443
- )
444
- );
445
 
446
- /**
447
- * The associative array of supported plugins.
448
- */
449
- $_aiosp_seometa_plugins = array(
450
- // alphabatized
451
- 'Add Meta Tags' => array(
452
- 'META Description' => 'description',
453
- 'META Keywords' => 'keywords',
454
- ),
455
- 'All in One SEO Pack' => array(
456
- 'Custom Doctitle' => '_aioseop_title',
457
- 'META Description' => '_aioseop_description',
458
- 'META Keywords' => '_aioseop_keywords',
459
- ),
460
- 'Greg\'s High Performance SEO' => array(
461
- 'Custom Doctitle' => '_ghpseo_secondary_title',
462
- 'META Description' => '_ghpseo_alternative_description',
463
- 'META Keywords' => '_ghpseo_keywords',
464
- ),
465
- 'Headspace2' => array(
466
- 'Custom Doctitle' => '_headspace_page_title',
467
- 'META Description' => '_headspace_description',
468
- 'META Keywords' => '_headspace_keywords',
469
- 'Custom Scripts' => '_headspace_scripts',
470
- ),
471
- 'Infinite SEO' => array(
472
- 'Custom Doctitle' => '_wds_title',
473
- 'META Description' => '_wds_metadesc',
474
- 'META Keywords' => '_wds_keywords',
475
- 'noindex' => '_wds_meta-robots-noindex',
476
- 'nofollow' => '_wds_meta-robots-nofollow',
477
- 'Canonical URI' => '_wds_canonical',
478
- 'Redirect URI' => '_wds_redirect',
479
- ),
480
- 'Meta SEO Pack' => array(
481
- 'META Description' => '_msp_description',
482
- 'META Keywords' => '_msp_keywords',
483
- ),
484
- 'Platinum SEO' => array(
485
- 'Custom Doctitle' => 'title',
486
- 'META Description' => 'description',
487
- 'META Keywords' => 'keywords',
488
- ),
489
- 'SEO Title Tag' => array(
490
- 'Custom Doctitle' => 'title_tag',
491
- 'META Description' => 'meta_description',
492
- ),
493
- 'SEO Ultimate' => array(
494
- 'Custom Doctitle' => '_su_title',
495
- 'META Description' => '_su_description',
496
- 'META Keywords' => '_su_keywords',
497
- 'noindex' => '_su_meta_robots_noindex',
498
- 'nofollow' => '_su_meta_robots_nofollow',
499
- ),
500
- 'Yoast SEO' => array(
501
- 'Custom Doctitle' => '_yoast_wpseo_title',
502
- 'META Description' => '_yoast_wpseo_metadesc',
503
- 'META Keywords' => '_yoast_wpseo_metakeywords',
504
- 'noindex' => '_yoast_wpseo_meta-robots-noindex',
505
- 'nofollow' => '_yoast_wpseo_meta-robots-nofollow',
506
- 'Canonical URI' => '_yoast_wpseo_canonical',
507
- 'Redirect URI' => '_yoast_wpseo_redirect',
508
- )
509
- );
510
 
511
- /**
512
- * The combined array of supported platforms.
513
- */
514
- $_aiosp_seometa_platforms = array_merge( $_aiosp_seometa_themes, $_aiosp_seometa_plugins );
515
 
516
- /**
517
- * Include the other elements of the plugin.
518
- */
519
- // require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' );
520
- // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
521
 
522
- /**
523
- * Init hook.
524
- *
525
- * Hook fires after plugin functions are loaded.
526
- *
527
- * @since 0.9.10
528
- *
529
- */
530
- do_action( 'aiosp_seometa_import' );
531
 
532
  }
533
 
534
- /**
535
- * Activation Hook
536
- * @since 0.9.4
537
- */
538
- register_activation_hook( __FILE__, 'aiosp_seometa_activation_hook' );
539
- function aiosp_seometa_activation_hook() {
540
 
541
- // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
542
 
543
- aiosp_seometa_meta_key_convert( '_yoast_seo_title', 'yoast_wpseo_title', true );
544
- aiosp_seometa_meta_key_convert( '_yoast_seo_metadesc', 'yoast_wpseo_metadesc', true );
545
 
546
- }
 
 
 
 
 
 
 
 
 
 
 
547
 
548
  /**
549
- * Manual conversion test
550
  */
551
- /*
552
- $aiosp_seometa_convert = aiosp_seometa_post_meta_convert( 'All in One SEO Pack', 'Genesis', false );
553
- printf( '%d records were updated', $aiosp_seometa_convert->updated );
554
- /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
 
556
  /**
557
- * Manual analysis test
558
  */
559
- /*
560
- $aiosp_seometa_analyze = aiosp_seometa_post_meta_analyze( 'All in One SEO Pack', 'Genesis' );
561
- printf( '<p><b>%d</b> Compatible Records were identified</p>', $aiosp_seometa_analyze->update );
562
- /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
 
564
  /**
565
- * Delete all SEO data, from every platform
566
  */
567
- /*
568
- foreach ( $_aiosp_seometa_platforms as $platform => $data ) {
569
 
570
- foreach ( $data as $field ) {
571
- $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $field ) );
572
- printf( '%d %s records deleted<br />', $deleted, $field );
573
- }
574
-
575
- }
576
- /**/
577
 
578
  /**
579
- * Query all SEO data to find the number of records to change
 
 
 
 
 
580
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581
 
582
 
1
  <?php
2
 
3
+ if ( class_exists( 'WPSEO_Import_Hooks' ) ) {
 
4
 
5
+ /**
6
+ * Class WPSEO_Import_AIOSEO_Hooks
7
+ *
8
+ * @TODO Move this elsewhere.
9
+ */
10
+ class WPSEO_Import_AIOSEO_Hooks extends WPSEO_Import_Hooks {
11
+
12
+ protected $plugin_file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
13
+
14
+ protected $deactivation_listener = 'deactivate_aioseo';
15
 
16
+ /**
17
+ * Show notice the old plugin is installed and offer to import its data.
18
+ */
19
+ public function show_import_settings_notice() {
20
 
21
+ $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' ) );
22
+ $aiourl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'aiosp-import' ) ), admin_url( 'tools.php?page=aiosp_import' ) );
 
23
 
24
+ $aioseop_yst_detected_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
 
 
25
 
26
+ if ( empty( $aioseop_yst_detected_notice_dismissed ) ) {
27
 
28
+ echo '<div class="notice notice-warning row-title is-dismissible yst_notice"><p>', 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( '<a href="%s">', esc_url( $aiourl ) ), '</a>' ), '</p></div>';
29
 
30
+ }
31
 
32
+ echo '<div class="error"><p>', sprintf( esc_html__( 'The plugin All-In-One-SEO has been detected. Do you want to %simport its settings%s?', 'wordpress-seo' ), sprintf( '<a href="%s">', esc_url( $yoasturl ) ), '</a>' ), '</p></div>';
33
 
34
  }
 
 
 
 
 
 
 
35
 
36
+ public function show_deactivate_notice() {
37
+ echo '<div class="updated"><p>', esc_html__( 'All in One SEO has been deactivated', 'all-in-one-seo-pack' ), '</p></div>';
38
+ }
39
  }
40
+ } else {
 
41
  add_action( 'init', 'mi_aioseop_yst_detected_notice_dismissed' );
42
  }
43
 
44
+ /**
45
+ * Deletes the stored dismissal of the notice.
46
+ *
47
+ * This should only happen after reactivating after being deactivated.
48
+ */
49
+ function mi_aioseop_yst_detected_notice_dismissed() {
50
  delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
51
  }
52
 
53
  /**
54
+ * Init for settings import class.
55
+ *
56
+ * At the moment we just register the admin menu page.
57
  */
 
58
  function aiosp_seometa_settings_init() {
59
  global $_aiosp_seometa_admin_pagehook;
60
+
61
+ // TODO Put this in with the rest of the import/export stuff.
62
+ $_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' );
63
  }
64
+ add_action( 'admin_menu', 'aiosp_seometa_settings_init' );
65
+
66
 
67
  /**
68
+ * Intercept POST data from the form submission.
69
+ *
70
+ * Use the intercepted data to convert values in the postmeta table from one platform to another.
71
  */
72
  function aiosp_seometa_action() {
73
+
74
+ if ( empty( $_REQUEST['_wpnonce'] ) ) {
 
 
75
  return;
76
+ }
77
+
78
  if ( empty( $_REQUEST['platform_old'] ) ) {
79
+ printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) );
80
+
81
  return;
82
  }
83
+
84
+ if ( 'All in One SEO Pack' === $_REQUEST['platform_old'] ) {
85
+ printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) );
86
+
87
  return;
88
  }
89
+
90
+ check_admin_referer( 'aiosp_nonce' ); // Verify nonce. TODO We should make this better.
91
+
92
+ if ( ! empty( $_REQUEST['analyze'] ) ) {
93
+
94
+ printf( '<h3>%s</h3>', __( 'Analysis Results', 'all-in-one-seo-pack' ) );
95
+
96
  $response = aiosp_seometa_post_meta_analyze( $_REQUEST['platform_old'], 'All in One SEO Pack' );
97
  if ( is_wp_error( $response ) ) {
98
+ printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, something went wrong. Please try again' ) );
99
+
100
  return;
101
  }
102
+
103
+ printf( __( '<p>Analyzing records in a %s to %s conversion&hellip;', 'all-in-one-seo-pack' ), esc_html( $_POST['platform_old'] ), 'All in One SEO Pack' );
104
  printf( '<p><b>%d</b> Compatible Records were identified</p>', $response->update );
105
+ // printf( '<p>%d Compatible Records will be ignored</p>', $response->ignore );
106
+
107
+ printf( '<p><b>%s</b></p>', __( 'Compatible data:', 'all-in-one-seo-pack' ) );
108
  echo '<ol>';
109
+ foreach ( (array) $response->elements as $element ) {
110
  printf( '<li>%s</li>', $element );
111
  }
112
  echo '</ol>';
113
+
114
  return;
115
  }
116
+
117
+ printf( '<h3>%s</h3>', __( 'Conversion Results', 'all-in-one-seo-pack' ) );
118
+
119
+ $result = aiosp_seometa_post_meta_convert( stripslashes( $_REQUEST['platform_old'] ), 'All in One SEO Pack' );
120
  if ( is_wp_error( $result ) ) {
121
+ printf( '<p>%s</p>', __( 'Sorry, something went wrong. Please try again' ) );
122
+
123
  return;
124
  }
125
+
126
  printf( '<p><b>%d</b> Records were updated</p>', isset( $result->updated ) ? $result->updated : 0 );
127
  printf( '<p><b>%d</b> Records were ignored</p>', isset( $result->ignored ) ? $result->ignored : 0 );
128
+
 
 
129
  }
130
 
131
  /**
138
  */
139
  function aiosp_seometa_admin() {
140
  global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
141
+ ?>
142
 
143
  <div class="wrap">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
 
 
145
 
146
+ <h2><?php _e( 'Import SEO Settings', 'all-in-one-seo-pack' ); ?></h2>
 
 
 
 
 
 
 
 
 
147
 
148
+ <p><span
149
+ class="description"><?php printf( __( 'Use the drop down below to choose which plugin or theme you wish to import SEO data from.', 'all-in-one-seo-pack' ) ); ?></span>
150
+ </p>
151
 
152
+ <p><span
153
+ class="description"><?php printf( __( 'Click "Analyze" for a list of SEO data that can be imported into All in One SEO Pack, along with the number of records that will be imported.', 'all-in-one-seo-pack' ) ); ?></span>
154
+ </p>
155
 
156
+ <p><span
157
+ class="description"><strong><?php printf( __( 'Please Note: ' ) ); ?></strong><?php printf( __( 'Some plugins and themes do not share similar data, or they store data in a non-standard way. If we cannot import this data, it will remain unchanged in your database. Any compatible SEO data will be displayed for you to review. If a post or page already has SEO data in All in One SEO Pack, we will not import data from another plugin/theme.', 'all-in-one-seo-pack' ) ); ?></span>
158
+ </p>
159
 
160
+ <p><span
161
+ class="description"><?php printf( __( 'Click "Convert" to perform the import. After the import has completed, you will be alerted to how many records were imported, and how many records had to be ignored, based on the criteria above.', 'all-in-one-seo-pack' ) ); ?></span>
162
+ </p>
163
 
164
+ <p><span
165
+ class="row-title"><?php printf( esc_html__( 'Before performing an import, we strongly recommend that you make a backup of your site. We use and recommend %s BackupBuddy %s for backups.', 'all-in-one-seo-pack' ), sprintf( '<a target="_blank" href="%s">', esc_url( 'http://semperfiwebdesign.com/backupbuddy/' ) ), '</a>' ); ?></span>
166
+ </p>
 
 
 
 
 
 
 
 
 
 
 
167
 
 
168
 
169
+ <form action="<?php echo admin_url( 'tools.php?page=aiosp_import' ); ?>" method="post">
170
+ <?php
171
+ wp_nonce_field( 'aiosp_nonce' );
172
 
173
+ $platform_old = ( ! isset( $_POST['platform_old'] ) ) ? '' : $_POST['platform_old'];
174
 
175
+ _e( 'Import SEO data from:', 'all-in-one-seo-pack' );
176
+ echo '<select name="platform_old">';
177
+ printf( '<option value="">%s</option>', __( 'Choose platform:', 'all-in-one-seo-pack' ) );
 
178
 
179
+ printf( '<optgroup label="%s">', __( 'Plugins', 'all-in-one-seo-pack' ) );
180
+ foreach ( $_aiosp_seometa_plugins as $platform => $data ) {
181
+ if ( 'All in One SEO Pack' !== $platform ) {
182
+ printf( '<option value="%s" %s>%s</option>', $platform, selected( $platform, $platform_old, 0 ), $platform );
183
+ }
184
+ }
185
+ printf( '</optgroup>' );
186
 
187
+ printf( '<optgroup label="%s">', __( 'Themes', 'all-in-one-seo-pack' ) );
188
+ foreach ( $_aiosp_seometa_themes as $platform => $data ) {
189
+ printf( '<option value="%s" %s>%s</option>', $platform, selected( $platform, $platform_old, 0 ), $platform );
190
+ }
191
+ printf( '</optgroup>' );
192
 
193
+ echo '</select>' . "\n\n";
 
 
194
 
195
+ ?>
 
 
196
 
197
+ <input type="submit" class="button-highlighted" name="analyze"
198
+ value="<?php _e( 'Analyze', 'genesis' ); ?>"/>
199
+ <input type="submit" class="button-primary" value="<?php _e( 'Convert', 'genesis' ) ?>"/>
 
200
 
201
+ </form>
 
 
202
 
203
+ <?php aiosp_seometa_action(); ?>
204
 
205
+ </div>
206
 
207
+ <?php
208
+ }
209
 
210
+ /**
211
+ * Convert old meta_key entries in the post meta table into new entries.
212
+ *
213
+ * First check to see what records for $new already exist, storing the corresponding post_id values in an array.
214
+ * When the conversion happens, ignore rows that contain a post_id, to avoid duplicate entries.
215
+ *
216
+ *
217
+ * @param string $old Old meta_key entries.
218
+ * @param string $new New meta_key entries.
219
+ * @param bool $delete_old Whether to delete the old entries.
220
+ *
221
+ * @return stdClass Object for error detection, and the number of affected rows.
222
+ */
223
+ function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = false ) {
224
 
225
+ do_action( 'pre_aiosp_seometa_meta_key_convert_before', $old, $new, $delete_old );
 
 
 
 
 
 
 
 
 
226
 
227
+ global $wpdb;
228
 
229
+ $output = new stdClass;
230
 
231
+ if ( ! $old || ! $new ) {
232
+ $output->WP_Error = 1;
233
 
234
+ return $output;
235
+ }
236
+
237
+ // See which records we need to ignore, if any.
238
+ $exclude = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $new ) );
239
 
240
+ // If no records to ignore, we'll do a basic UPDATE and DELETE.
241
+ if ( ! $exclude ) {
242
+
243
+ $output->updated = $wpdb->update( $wpdb->postmeta, array( 'meta_key' => $new ), array( 'meta_key' => $old ) );
244
+ $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
245
  $output->ignored = 0;
246
 
247
+ } // Else, do a more complex UPDATE and DELETE.
248
+ else {
249
 
250
+ foreach ( (array) $exclude as $key => $value ) {
251
+ $not_in[] = $value->post_id;
252
+ }
253
+ $not_in = implode( ', ', (array) $not_in );
254
 
255
+ $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 ) );
256
+ $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
257
+ $output->ignored = count( $exclude );
258
 
259
+ }
 
260
 
261
+ do_action( 'aiosp_seometa_meta_key_convert', $output, $old, $new, $delete_old );
 
 
262
 
263
+ return $output;
 
 
264
 
265
+ }
266
 
267
+ /**
268
+ * Convert old to new postmeta.
269
+ *
270
+ * Cycle through all compatible SEO entries of two platforms and aiosp_seometa_meta_key_convert conversion for each key.
271
+ *
272
+ * @param string $old_platform
273
+ * @param string $new_platform
274
+ * @param bool $delete_old
275
+ *
276
+ * @return stdClass Results object.
277
+ */
278
+ function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'All in One SEO Pack', $delete_old = false ) {
279
 
280
+ do_action( 'pre_aiosp_seometa_post_meta_convert', $old_platform, $new_platform, $delete_old );
281
 
282
+ global $_aiosp_seometa_platforms;
283
 
284
+ $output = new stdClass;
285
+
286
+ if ( empty( $_aiosp_seometa_platforms[ $old_platform ] ) || empty( $_aiosp_seometa_platforms[ $new_platform ] ) ) {
287
+ $output->WP_Error = 1;
 
288
 
289
+ return $output;
290
+ }
291
 
292
+ $output->updated = 0;
293
+ $output->deleted = 0;
294
+ $output->ignored = 0;
295
 
296
+ foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
297
 
298
+ // Skip iterations where no $new analog exists.
299
+ if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
300
+ continue;
301
  }
302
 
303
+ // Set $old and $new meta_key values.
304
+ $old = $_aiosp_seometa_platforms[ $old_platform ][ $label ];
305
+ $new = $_aiosp_seometa_platforms[ $new_platform ][ $label ];
306
 
307
+ // Convert.
308
+ $result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old );
309
 
310
+ // Error check.
311
+ if ( is_wp_error( $result ) ) {
312
+ continue;
313
+ }
314
 
315
+ // Update total updated/ignored count.
316
+ $output->updated += (int) $result->updated;
317
+ $output->ignored += (int) $result->ignored;
318
 
319
+ }
 
 
320
 
321
+ do_action( 'aiosp_seometa_post_meta_convert', $output, $old_platform, $new_platform, $delete_old );
 
322
 
323
+ return $output;
 
 
324
 
325
+ }
 
326
 
327
+ /**
328
+ * Analyze two platforms to find shared and compatible elements.
329
+ *
330
+ * See what data can be converted from one to the other.
331
+ *
332
+ * @param string $old_platform
333
+ * @param string $new_platform
334
+ *
335
+ * @return stdClass
336
+ */
337
+ function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) {
338
+ // TODO Figure out which elements to ignore.
339
+ do_action( 'pre_aiosp_seometa_post_meta_analyze', $old_platform, $new_platform );
340
 
341
+ global $wpdb, $_aiosp_seometa_platforms;
342
 
343
+ $output = new stdClass;
344
 
345
+ if ( empty( $_aiosp_seometa_platforms[ $old_platform ] ) || empty( $_aiosp_seometa_platforms[ $new_platform ] ) ) {
346
+ $output->WP_Error = 1;
347
 
348
  return $output;
 
349
  }
 
 
 
 
350
 
351
+ $output->update = 0;
352
+ $output->ignore = 0;
353
+ $output->elements = '';
354
 
355
+ foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
356
 
357
+ // Skip iterations where no $new analog exists.
358
+ if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
359
+ continue;
360
+ }
 
361
 
362
+ $elements[] = $label;
363
 
364
+ // See which records to ignore, if any.
365
+ $ignore = 0;
366
+ // $ignore = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
 
368
+ // See which records to update, if any.
369
+ $update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
+ // Count items in returned arrays.
372
+ // $ignore = count( (array)$ignore );
373
+ $update = count( (array) $update );
 
374
 
375
+ // Calculate update/ignore by comparison.
376
+ // $update = ( (int)$update > (int)$ignore ) ? ( (int)$update - (int)$ignore ) : 0;
 
 
 
377
 
378
+ // update output numbers
379
+ $output->update += (int) $update;
380
+ $output->ignore += (int) $ignore;
 
 
 
 
 
 
381
 
382
  }
383
 
384
+ $output->elements = $elements;
 
 
 
 
 
385
 
386
+ do_action( 'aiosp_seometa_post_meta_analyze', $output, $old_platform, $new_platform );
387
 
388
+ return $output;
 
389
 
390
+ }
391
+
392
+
393
+ // define('aiosp_seometa_PLUGIN_DIR', dirname(__FILE__));
394
+
395
+ //add_action( 'plugins_loaded', 'aiosp_seometa_import' );
396
+ /**
397
+ * Initialize the SEO Data Transporter plugin
398
+ */
399
+ function aiosp_seometa_import() {
400
+
401
+ global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
402
 
403
  /**
404
+ * The associative array of supported themes.
405
  */
406
+ $_aiosp_seometa_themes = array(
407
+ // alphabatized
408
+ 'Builder' => array(
409
+ 'Custom Doctitle' => '_builder_seo_title',
410
+ 'META Description' => '_builder_seo_description',
411
+ 'META Keywords' => '_builder_seo_keywords',
412
+ ),
413
+ 'Catalyst' => array(
414
+ 'Custom Doctitle' => '_catalyst_title',
415
+ 'META Description' => '_catalyst_description',
416
+ 'META Keywords' => '_catalyst_keywords',
417
+ 'noindex' => '_catalyst_noindex',
418
+ 'nofollow' => '_catalyst_nofollow',
419
+ 'noarchive' => '_catalyst_noarchive',
420
+ ),
421
+ 'Frugal' => array(
422
+ 'Custom Doctitle' => '_title',
423
+ 'META Description' => '_description',
424
+ 'META Keywords' => '_keywords',
425
+ 'noindex' => '_noindex',
426
+ 'nofollow' => '_nofollow',
427
+ ),
428
+ 'Genesis' => array(
429
+ 'Custom Doctitle' => '_genesis_title',
430
+ 'META Description' => '_genesis_description',
431
+ 'META Keywords' => '_genesis_keywords',
432
+ 'noindex' => '_genesis_noindex',
433
+ 'nofollow' => '_genesis_nofollow',
434
+ 'noarchive' => '_genesis_noarchive',
435
+ 'Canonical URI' => '_genesis_canonical_uri',
436
+ 'Custom Scripts' => '_genesis_scripts',
437
+ 'Redirect URI' => 'redirect',
438
+ ),
439
+ 'Headway' => array(
440
+ 'Custom Doctitle' => '_title',
441
+ 'META Description' => '_description',
442
+ 'META Keywords' => '_keywords',
443
+ ),
444
+ 'Hybrid' => array(
445
+ 'Custom Doctitle' => 'Title',
446
+ 'META Description' => 'Description',
447
+ 'META Keywords' => 'Keywords',
448
+ ),
449
+ 'Thesis 1.x' => array(
450
+ 'Custom Doctitle' => 'thesis_title',
451
+ 'META Description' => 'thesis_description',
452
+ 'META Keywords' => 'thesis_keywords',
453
+ 'Custom Scripts' => 'thesis_javascript_scripts',
454
+ 'Redirect URI' => 'thesis_redirect',
455
+ ),
456
+ /*
457
+ 'Thesis 2.x' => array(
458
+ 'Custom Doctitle' => '_thesis_title_tag',
459
+ 'META Description' => '_thesis_meta_description',
460
+ 'META Keywords' => '_thesis_meta_keywords',
461
+ 'Custom Scripts' => '_thesis_javascript_scripts',
462
+ 'Canonical URI' => '_thesis_canonical_link',
463
+ 'Redirect URI' => '_thesis_redirect',
464
+ ),
465
+ */
466
+ 'WooFramework' => array(
467
+ 'Custom Doctitle' => 'seo_title',
468
+ 'META Description' => 'seo_description',
469
+ 'META Keywords' => 'seo_keywords',
470
+ ),
471
+ );
472
 
473
  /**
474
+ * The associative array of supported plugins.
475
  */
476
+ $_aiosp_seometa_plugins = array(
477
+ // alphabatized
478
+ 'Add Meta Tags' => array(
479
+ 'META Description' => 'description',
480
+ 'META Keywords' => 'keywords',
481
+ ),
482
+ 'All in One SEO Pack' => array(
483
+ 'Custom Doctitle' => '_aioseop_title',
484
+ 'META Description' => '_aioseop_description',
485
+ 'META Keywords' => '_aioseop_keywords',
486
+ ),
487
+ 'Greg\'s High Performance SEO' => array(
488
+ 'Custom Doctitle' => '_ghpseo_secondary_title',
489
+ 'META Description' => '_ghpseo_alternative_description',
490
+ 'META Keywords' => '_ghpseo_keywords',
491
+ ),
492
+ 'Headspace2' => array(
493
+ 'Custom Doctitle' => '_headspace_page_title',
494
+ 'META Description' => '_headspace_description',
495
+ 'META Keywords' => '_headspace_keywords',
496
+ 'Custom Scripts' => '_headspace_scripts',
497
+ ),
498
+ 'Infinite SEO' => array(
499
+ 'Custom Doctitle' => '_wds_title',
500
+ 'META Description' => '_wds_metadesc',
501
+ 'META Keywords' => '_wds_keywords',
502
+ 'noindex' => '_wds_meta-robots-noindex',
503
+ 'nofollow' => '_wds_meta-robots-nofollow',
504
+ 'Canonical URI' => '_wds_canonical',
505
+ 'Redirect URI' => '_wds_redirect',
506
+ ),
507
+ 'Meta SEO Pack' => array(
508
+ 'META Description' => '_msp_description',
509
+ 'META Keywords' => '_msp_keywords',
510
+ ),
511
+ 'Platinum SEO' => array(
512
+ 'Custom Doctitle' => 'title',
513
+ 'META Description' => 'description',
514
+ 'META Keywords' => 'keywords',
515
+ ),
516
+ 'SEO Title Tag' => array(
517
+ 'Custom Doctitle' => 'title_tag',
518
+ 'META Description' => 'meta_description',
519
+ ),
520
+ 'SEO Ultimate' => array(
521
+ 'Custom Doctitle' => '_su_title',
522
+ 'META Description' => '_su_description',
523
+ 'META Keywords' => '_su_keywords',
524
+ 'noindex' => '_su_meta_robots_noindex',
525
+ 'nofollow' => '_su_meta_robots_nofollow',
526
+ ),
527
+ 'Yoast SEO' => array(
528
+ 'Custom Doctitle' => '_yoast_wpseo_title',
529
+ 'META Description' => '_yoast_wpseo_metadesc',
530
+ 'META Keywords' => '_yoast_wpseo_metakeywords',
531
+ 'noindex' => '_yoast_wpseo_meta-robots-noindex',
532
+ 'nofollow' => '_yoast_wpseo_meta-robots-nofollow',
533
+ 'Canonical URI' => '_yoast_wpseo_canonical',
534
+ 'Redirect URI' => '_yoast_wpseo_redirect',
535
+ ),
536
+ );
537
 
538
  /**
539
+ * The combined array of supported platforms.
540
  */
541
+ $_aiosp_seometa_platforms = array_merge( $_aiosp_seometa_themes, $_aiosp_seometa_plugins );
 
542
 
543
+ /**
544
+ * Include the other elements of the plugin.
545
+ */
546
+ // require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' );
547
+ // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
 
 
548
 
549
  /**
550
+ * Init hook.
551
+ *
552
+ * Hook fires after plugin functions are loaded.
553
+ *
554
+ * @since 0.9.10
555
+ *
556
  */
557
+ do_action( 'aiosp_seometa_import' );
558
+
559
+ }
560
+
561
+ /**
562
+ * Activation Hook
563
+ * @since 0.9.4
564
+ */
565
+ register_activation_hook( __FILE__, 'aiosp_seometa_activation_hook' );
566
+ function aiosp_seometa_activation_hook() {
567
+
568
+ // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
569
+
570
+ aiosp_seometa_meta_key_convert( '_yoast_seo_title', 'yoast_wpseo_title', true );
571
+ aiosp_seometa_meta_key_convert( '_yoast_seo_metadesc', 'yoast_wpseo_metadesc', true );
572
+
573
+ }
574
+
575
+ /**
576
+ * Manual conversion test
577
+ */
578
+ /*
579
+ $aiosp_seometa_convert = aiosp_seometa_post_meta_convert( 'All in One SEO Pack', 'Genesis', false );
580
+ printf( '%d records were updated', $aiosp_seometa_convert->updated );
581
+ /**/
582
+
583
+ /**
584
+ * Manual analysis test
585
+ */
586
+ /*
587
+ $aiosp_seometa_analyze = aiosp_seometa_post_meta_analyze( 'All in One SEO Pack', 'Genesis' );
588
+ printf( '<p><b>%d</b> Compatible Records were identified</p>', $aiosp_seometa_analyze->update );
589
+ /**/
590
+
591
+ /**
592
+ * Delete all SEO data, from every platform
593
+ */
594
+ /*
595
+ foreach ( $_aiosp_seometa_platforms as $platform => $data ) {
596
+
597
+ foreach ( $data as $field ) {
598
+ $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $field ) );
599
+ printf( '%d %s records deleted<br />', $deleted, $field );
600
+ }
601
+
602
+ }
603
+ /**/
604
+
605
+ /**
606
+ * Query all SEO data to find the number of records to change
607
+ */
608
 
609
 
aioseop-init.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * We'll eventually put stuff in here from the main plugin file.
4
+ *
5
+ * @package All-in-One-SEO-Pack
6
+ *
7
+ */
aioseop_class.php CHANGED
@@ -1,44 +1,47 @@
1
  <?php
2
  /**
 
 
 
 
3
  * @package All-in-One-SEO-Pack
4
  */
 
 
 
5
  /**
6
- * Include the module base class.
7
- */
8
- require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' );
9
- /**
10
  * The main class.
11
  */
12
  class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
13
 
14
- /** The current version of the plugin. **/
15
- var $version = AIOSEOP_VERSION;
16
 
17
- /** Max numbers of chars in auto-generated description */
18
- var $maximum_description_length = 160;
19
 
20
- /** Minimum number of chars an excerpt should be so that it can be used
21
- * as description. Touch only if you know what you're doing
22
- */
23
- var $minimum_description_length = 1;
24
 
25
- /** Whether output buffering is already being used during forced title rewrites. **/
26
- var $ob_start_detected = false;
27
 
28
- /** The start of the title text in the head section for forced title rewrites. **/
29
- var $title_start = -1;
30
 
31
- /** The end of the title text in the head section for forced title rewrites. **/
32
- var $title_end = -1;
33
 
34
- /** The title before rewriting */
35
- var $orig_title = '';
36
 
37
- /** Filename of log file. */
38
- var $log_file;
39
 
40
- /** Flag whether there should be logging. */
41
- var $do_log;
42
 
43
  var $token;
44
  var $secret;
@@ -49,67 +52,69 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
49
  var $meta_opts = false;
50
  var $is_front_page = null;
51
 
 
 
 
52
  function __construct() {
53
  global $aioseop_options;
54
- $this->log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log';
55
 
56
- if ( !empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] )
57
  $this->do_log = true;
58
- else
59
  $this->do_log = false;
 
60
 
61
- $this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME );
62
  $this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
63
 
64
- $this->prefix = 'aiosp_'; // option prefix
65
- $this->option_name = 'aioseop_options';
66
  $this->store_option = true;
67
- $this->file = __FILE__; // the current file
68
- $blog_name = esc_attr( get_bloginfo( 'name' ) );
69
  parent::__construct();
70
 
71
- $this->help_text = Array(
72
- "donate" => __( "All donations support continued development of this free software.", 'all-in-one-seo-pack'),
73
- "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'),
74
- "can" => __( "This option will automatically generate Canonical URLs for your entire WordPress installation. This will help to prevent duplicate content penalties by <a href=\'http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html\' target=\'_blank\'>Google</a>.", 'all-in-one-seo-pack'),
75
- "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'),
76
- "customize_canonical_links"=> __( "Checking this option will allow you to customize Canonical URLs for specific posts.", 'all-in-one-seo-pack'),
77
- "can_set_protocol" => __( "Set protocol for canonical URLs.", 'all-in-one-seo-pack' ),
78
- "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' ),
79
- "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' ),
80
- "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' ),
81
- "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' ),
82
- "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' ),
83
- "use_static_home_info" => __( "Checking this option uses the title, description, and keywords set on your static Front Page.", 'all-in-one-seo-pack' ),
84
- "togglekeywords" => __( "This option allows you to toggle the use of Meta Keywords throughout the whole of the site.", 'all-in-one-seo-pack' ),
85
- "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' ),
86
- "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' ),
87
- "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'),
88
- "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' ),
89
- "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' ),
90
- "cap_cats" => __( "Check this and Category Titles will have the first letter of each word capitalized.", 'all-in-one-seo-pack'),
91
- "home_page_title_format" =>
92
- __( "This controls the format of the title tag for your Home Page.<br />The following macros are supported:", 'all-in-one-seo-pack' )
93
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
94
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
95
  __( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
96
  __( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
97
  __( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
98
  __( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
99
- __( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
100
- '</ul>',
101
- "page_title_format" =>
102
- __( "This controls the format of the title tag for Pages.<br />The following macros are supported:", 'all-in-one-seo-pack' )
103
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
104
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
105
  __( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
106
  __( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
107
  __( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
108
  __( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
109
- __( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
110
- '</ul>',
111
- "post_title_format" =>
112
- __( "This controls the format of the title tag for Posts.<br />The following macros are supported:", 'all-in-one-seo-pack' )
113
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
114
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
115
  __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
@@ -118,602 +123,886 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
118
  __( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
119
  __( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
120
  __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
121
- __( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
122
- '</ul>',
123
- "category_title_format" =>
124
- __( "This controls the format of the title tag for Category Archives.<br />The following macros are supported:", 'all-in-one-seo-pack' ) .
125
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
126
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
127
  __( '%category_title% - The original title of the category', 'all-in-one-seo-pack' ) . '</li><li>' .
128
  __( '%category_description% - The description of the category', 'all-in-one-seo-pack' ) . '</li></ul>',
129
- "archive_title_format" =>
130
- __( "This controls the format of the title tag for Custom Post Archives.<br />The following macros are supported:", 'all-in-one-seo-pack' ) .
131
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
132
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
133
  __( '%archive_title - The original archive title given by wordpress', 'all-in-one-seo-pack' ) . '</li></ul>',
134
- "date_title_format" =>
135
- __( "This controls the format of the title tag for Date Archives.<br />The following macros are supported:", 'all-in-one-seo-pack' ) .
136
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
137
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
138
  __( '%date% - The original archive title given by wordpress, e.g. "2007" or "2007 August"', 'all-in-one-seo-pack' ) . '</li><li>' .
139
  __( '%day% - The original archive day given by wordpress, e.g. "17"', 'all-in-one-seo-pack' ) . '</li><li>' .
140
  __( '%month% - The original archive month given by wordpress, e.g. "August"', 'all-in-one-seo-pack' ) . '</li><li>' .
141
  __( '%year% - The original archive year given by wordpress, e.g. "2007"', 'all-in-one-seo-pack' ) . '</li></ul>',
142
- "author_title_format" =>
143
- __( "This controls the format of the title tag for Author Archives.<br />The following macros are supported:", 'all-in-one-seo-pack' ) .
144
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
145
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
146
  __( '%author% - The original archive title given by wordpress, e.g. "Steve" or "John Smith"', 'all-in-one-seo-pack' ) . '</li></ul>',
147
- "tag_title_format" =>
148
- __( "This controls the format of the title tag for Tag Archives.<br />The following macros are supported:", 'all-in-one-seo-pack' ) .
149
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
150
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
151
  __( '%tag% - The name of the tag', 'all-in-one-seo-pack' ) . '</li></ul>',
152
- "search_title_format" =>
153
- __( "This controls the format of the title tag for the Search page.<br />The following macros are supported:", 'all-in-one-seo-pack' ) .
154
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
155
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
156
  __( '%search% - What was searched for', 'all-in-one-seo-pack' ) . '</li></ul>',
157
- "description_format" => __( "This controls the format of Meta Descriptions.The following macros are supported:", 'all-in-one-seo-pack' ) .
158
- '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
159
- __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
160
- __( '%description% - The original description as determined by the plugin, e.g. the excerpt if one is set or an auto-generated one if that option is set', 'all-in-one-seo-pack' ) . '</li><li>' .
161
- __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
162
- __( '%wp_title% - The original wordpress title, e.g. post_title for posts', 'all-in-one-seo-pack' ) . '</li></ul>',
163
- "404_title_format" => __( "This controls the format of the title tag for the 404 page.<br />The following macros are supported:", 'all-in-one-seo-pack' ) .
164
- '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
165
- __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
166
- __( '%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all-in-one-seo-pack' ) . '</li><li>' .
167
- __( '%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all-in-one-seo-pack' ) . '</li><li>' .
168
- __( '%404_title% - Additional 404 title input"', 'all-in-one-seo-pack' ) . '</li></ul>',
169
- "paged_format" => __( "This string gets appended/prepended to titles of paged index pages (like home or archive pages).", 'all-in-one-seo-pack' )
170
- . __( 'The following macros are supported:', 'all-in-one-seo-pack' )
171
- . '<ul><li>' . __( '%page% - The page number', 'all-in-one-seo-pack' ) . '</li></ul>',
172
- "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' ),
173
- "cpostadvanced" => __( "This will show or hide the advanced options for SEO for Custom Post Types.", 'all-in-one-seo-pack' ),
174
- "cpostactive" => __( "Use these checkboxes to select which Post Types you want to use All in One SEO Pack with.", 'all-in-one-seo-pack' ),
175
- "taxactive" => __( "Use these checkboxes to select which Taxonomies you want to use All in One SEO Pack with.", 'all-in-one-seo-pack' ),
176
- "cposttitles" => __( "This allows you to set the title tags for each Custom Post Type.", 'all-in-one-seo-pack' ),
177
- "posttypecolumns" => __( "This lets you select which screens display the SEO Title, SEO Keywords and SEO Description columns.", 'all-in-one-seo-pack' ),
178
- "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' ),
179
- "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' ),
180
- "google_verify" => __( "Enter your verification code here to verify your site with Google Webmaster Tools.<br /><a href='http://semperplugins.com/documentation/google-webmaster-tools-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
181
- "bing_verify" => __( "Enter your verification code here to verify your site with Bing Webmaster Tools.<br /><a href='http://semperplugins.com/documentation/bing-webmaster-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
182
- "pinterest_verify" => __( "Enter your verification code here to verify your site with Pinterest.<br /><a href='http://semperplugins.com/documentation/pinterest-site-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
183
- "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' ),
184
- "google_disable_profile"=> __( "Check this to remove the Google Plus field from the user profile screen.", 'all-in-one-seo-pack' ),
185
- "google_author_advanced"=> __( "Enable this to display advanced options for controlling Google Plus authorship information on your website.", 'all-in-one-seo-pack' ),
186
- "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' ),
187
- "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' ),
188
- "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' ),
189
- "google_sitelinks_search"=> __( "Add markup to display the Google Sitelinks Search Box next to your search results in Google.", 'all-in-one-seo-pack' ),
190
- "google_set_site_name" => __( "Add markup to tell Google the preferred name for your website.", 'all-in-one-seo-pack' ),
191
- "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' ),
192
- "google_analytics_id" => __( "Enter your Google Analytics ID here to track visitor behavior on your site using Google Analytics.", 'all-in-one-seo-pack' ),
193
- "ga_use_universal_analytics" => __( "Use the new Universal Analytics tracking code for Google Analytics.", 'all-in-one-seo-pack' ),
194
- "ga_advanced_options" => __( "Check to use advanced Google Analytics options.", 'all-in-one-seo-pack' ),
195
- "ga_domain" => __( "Enter your domain name without the http:// to set your cookie domain.", 'all-in-one-seo-pack' ),
196
- "ga_multi_domain" => __( "Use this option to enable tracking of multiple or additional domains.", 'all-in-one-seo-pack' ),
197
- "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' ),
198
- "ga_anonymize_ip" => __( "This enables support for IP Anonymization in Google Analytics.", 'all-in-one-seo-pack' ),
199
- "ga_display_advertising"=> __( "This enables support for the Display Advertiser Features in Google Analytics.", 'all-in-one-seo-pack' ),
200
- "ga_exclude_users" => __( "Exclude logged-in users from Google Analytics tracking by role.", 'all-in-one-seo-pack' ),
201
- "ga_track_outbound_links"=> __( "Check this if you want to track outbound links with Google Analytics.", 'all-in-one-seo-pack' ),
202
- "ga_link_attribution"=> __( "This enables support for the Enhanced Link Attribution in Google Analytics.", 'all-in-one-seo-pack' ),
203
- "ga_enhanced_ecommerce" => __( "This enables support for the Enhanced Ecommerce in Google Analytics.", 'all-in-one-seo-pack' ),
204
- "cpostnoindex" => __( "Set the default NOINDEX setting for each Post Type.", 'all-in-one-seo-pack' ),
205
- "cpostnofollow" => __( "Set the default NOFOLLOW setting for each Post Type.", 'all-in-one-seo-pack' ),
206
- "category_noindex" => __( "Check this to ask search engines not to index Category Archives. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ),
207
- "archive_date_noindex" => __( "Check this to ask search engines not to index Date Archives. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ),
208
- "archive_author_noindex"=> __( "Check this to ask search engines not to index Author Archives. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ),
209
- "tags_noindex" => __( "Check this to ask search engines not to index Tag Archives. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ),
210
- "search_noindex" => __( "Check this to ask search engines not to index the Search page. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ),
211
- "404_noindex" => __( "Check this to ask search engines not to index the 404 page.", 'all-in-one-seo-pack' ),
212
- "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' ),
213
- "paginated_noindex" => __( "Check this to ask search engines not to index paginated pages/posts. Useful for avoiding duplicate content.", 'all-in-one-seo-pack' ),
214
- "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' ),
215
- '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' ),
216
- 'cpostnoodp' => __( "Set the default noodp setting for each Post Type.", 'all-in-one-seo-pack' ),
217
- 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for your entire site.', 'all-in-one-seo-pack' ),
218
- 'cpostnoydir' => __( "Set the default noydir setting for each Post Type.", 'all-in-one-seo-pack' ),
219
- "skip_excerpt" => __( "Check this and your Meta Descriptions won't be generated from the excerpt.", 'all-in-one-seo-pack' ),
220
- "generate_descriptions" => __( "Check this and your Meta Descriptions will be auto-generated from your excerpt or content.", 'all-in-one-seo-pack' ),
221
- "run_shortcodes" => __( "Check this and shortcodes will get executed for descriptions auto-generated from content.", 'all-in-one-seo-pack' ),
222
- "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' ),
223
- "dont_truncate_descriptions"=> __( "Check this to prevent your Description from being truncated regardless of its length.", 'all-in-one-seo-pack' ),
224
- "schema_markup"=> __( "Check this to support Schema.org markup, i.e., itemprop on supported metadata.", 'all-in-one-seo-pack' ),
225
- "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' ),
226
- "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: <em>/forum/, /contact/</em> 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' ),
227
- "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' ),
228
- "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' ),
229
- "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' ),
230
- "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' ),
 
231
  );
232
 
233
- $this->help_anchors = Array(
234
- 'license_key' => '#license-key',
235
- 'can' => '#canonical-urls',
236
- 'no_paged_canonical_links' => '#no-pagination-for-canonical-urls',
237
- 'customize_canonical_links' => '#enable-custom-canonical-urls',
238
- 'use_original_title' => '#use-original-title',
239
- 'schema_markup' => '#use-schema-markup',
240
- 'do_log' => '#log-important-events',
241
- 'home_title' => '#home-title',
242
- 'home_description' => '#home-description',
243
- 'home_keywords' => '#home-keywords',
244
- 'togglekeywords' => '#use-keywords',
245
- 'use_categories' => '#use-categories-for-meta-keywords',
246
- 'use_tags_as_keywords' => '#use-tags-for-meta-keywords',
247
- 'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page',
248
- 'rewrite_titles' => '#rewrite-titles',
249
- 'cap_titles' => '#capitalize-titles',
250
- 'home_page_title_format' => '#title-format-fields',
251
- 'page_title_format' => '#title-format-fields',
252
- 'post_title_format' => '#title-format-fields',
253
- 'category_title_format' => '#title-format-fields',
254
- 'archive_title_format' => '#title-format-fields',
255
- 'date_title_format' => '#title-format-fields',
256
- 'author_title_format' => '#title-format-fields',
257
- 'tag_title_format' => '#title-format-fields',
258
- 'search_title_format' => '#title-format-fields',
259
- '404_title_format' => '#title-format-fields',
260
- 'enablecpost' => '#seo-for-custom-post-types',
261
- 'cpostadvanced' => '#enable-advanced-options',
262
- 'cpostactive' => '#seo-on-only-these-post-types',
263
- 'taxactive' => '#seo-on-only-these-taxonomies',
264
- 'cposttitles' => '#custom-titles',
265
- 'posttypecolumns' => '#show-column-labels-for-custom-post-types',
266
- 'admin_bar' => '#display-menu-in-admin-bar',
267
- 'custom_menu_order' => '#display-menu-at-the-top',
268
- 'google_verify' => '',
269
- 'bing_verify' => '',
270
- 'pinterest_verify' => '',
271
- 'google_publisher' => '#google-plus-default-profile',
272
- 'google_disable_profile' => '#disable-google-plus-profile',
273
- 'google_author_advanced' => '#advanced-authorship-options',
274
- 'google_author_location' => '#display-google-authorship',
275
- 'google_enable_publisher' => '#display-publisher-meta-on-front-page',
276
- 'google_specify_publisher' => '#specify-publisher-url',
277
- 'google_analytics_id' => 'http://semperplugins.com/documentation/setting-up-google-analytics/',
278
- 'ga_use_universal_analytics' => '#use-universal-analytics',
279
- 'ga_domain' => '#tracking-domain',
280
- 'ga_multi_domain' => '#track-multiple-domains-additional-domains',
281
- 'ga_addl_domains' => '#track-multiple-domains-additional-domains',
282
- 'ga_anonymize_ip' => '#anonymize-ip-addresses',
283
- 'ga_display_advertising' => '#display-advertiser-tracking',
284
- 'ga_exclude_users' => '#exclude-users-from-tracking',
285
- 'ga_track_outbound_links' => '#track-outbound-links',
286
- 'ga_link_attribution' => '#enhanced-link-attribution',
287
- 'ga_enhanced_ecommerce' => '#enhanced-ecommerce',
288
- 'cpostnoindex' => '#use-noindex-for-paginated-pages-posts',
289
- 'cpostnofollow' => '#use-nofollow-for-paginated-pages-posts',
290
- 'noodp' => '#exclude-site-from-the-open-directory-project',
291
- 'noydir' => '#exclude-site-from-yahoo-directory',
292
- 'generate_descriptions' => '#autogenerate-descriptions',
293
- 'run_shortcodes' => '#run-shortcodes-in-autogenerated-descriptions',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  'hide_paginated_descriptions' => '#remove-descriptions-for-paginated-pages',
295
- 'dont_truncate_descriptions' => '#never-shorten-long-descriptions',
296
- 'unprotect_meta' => '#unprotect-post-meta-fields',
297
- 'ex_pages' => '#exclude-pages',
298
- 'post_meta_tags' => '#additional-post-headers',
299
- 'page_meta_tags' => '#additional-page-headers',
300
- 'front_meta_tags' => '#additional-front-page-headers',
301
- 'home_meta_tags' => '#additional-blog-page-headers'
302
  );
303
 
304
- $meta_help_text = Array(
305
- 'snippet' => __( 'A preview of what this page might look like in search engine results.', 'all-in-one-seo-pack' ),
306
- 'title' => __( 'A custom title that shows up in the title tag for this page.', 'all-in-one-seo-pack' ),
307
- 'description' => __( 'The META description for this page. This will override any autogenerated descriptions.', 'all-in-one-seo-pack' ),
308
- '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' ),
309
- 'custom_link' => __( "Override the canonical URLs for this post.", 'all-in-one-seo-pack'),
310
- 'noindex' => __( 'Check this box to ask search engines not to index this page.', 'all-in-one-seo-pack' ),
311
- 'nofollow' => __( 'Check this box to ask search engines not to follow links from this page.', 'all-in-one-seo-pack' ),
312
- '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' ),
313
- 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for this page.', 'all-in-one-seo-pack' ),
314
- 'titleatr' => __( 'Set the title attribute for menu links.', 'all-in-one-seo-pack' ),
315
- 'menulabel' => __( 'Set the label for this page menu item.', 'all-in-one-seo-pack' ),
316
- 'sitemap_exclude' => __( "Don't display this page in the sitemap.", 'all-in-one-seo-pack' ),
317
- 'disable' => __( 'Disable SEO on this page.', 'all-in-one-seo-pack' ),
318
- 'disable_analytics' => __( 'Disable Google Analytics on this page.', 'all-in-one-seo-pack' )
319
  );
320
 
321
  $this->default_options = array(
322
- "license_key" => Array(
323
  'name' => __( 'License Key:', 'all-in-one-seo-pack' ),
324
- 'type' => 'text' ),
325
- "donate" => Array(
326
- 'name' => __( 'I enjoy this plugin and have made a donation:', 'all-in-one-seo-pack' ) ),
327
- "home_title"=> Array(
328
- 'name' => __( 'Home Title:', 'all-in-one-seo-pack' ),
329
- 'default' => null, 'type' => 'textarea', 'sanitize' => 'text',
330
- 'count' => true, 'rows' => 1, 'cols' => 60,
331
- 'condshow' => Array( "aiosp_use_static_home_info" => 0 ) ),
332
- "home_description"=> Array(
333
- 'name' => __( 'Home Description:', 'all-in-one-seo-pack' ),
334
- 'default' => '', 'type' => 'textarea', 'sanitize' => 'text',
335
- 'count' => true, 'cols' => 80, 'rows' => 2,
336
- 'condshow' => Array( "aiosp_use_static_home_info" => 0 ) ),
337
- "togglekeywords" => Array(
338
- 'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ),
339
- 'default' => 1,
340
- 'type' => 'radio',
341
- 'initial_options' => Array( 0 => __( 'Enabled', 'all-in-one-seo-pack' ),
342
- 1 => __( 'Disabled', 'all-in-one-seo-pack' ) )
343
- ),
344
- "home_keywords"=> Array(
345
- 'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ),
346
- 'default' => null, 'type' => 'textarea', 'sanitize' => 'text',
347
- 'condshow' => Array( "aiosp_togglekeywords" => 0, "aiosp_use_static_home_info" => 0 ) ),
348
- "use_static_home_info" => Array(
349
- 'name' => __( "Use Static Front Page Instead", 'all-in-one-seo-pack' ),
350
- 'default' => 0,
351
- 'type' => 'radio',
352
- 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
353
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) )
354
- ),
355
- "can"=> Array(
356
- 'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ),
357
- 'default' => 1),
358
- "no_paged_canonical_links"=> Array(
359
- 'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ),
360
- 'default' => 0,
361
- 'condshow' => Array( "aiosp_can" => 'on' ) ),
362
- "customize_canonical_links" => Array(
363
- 'name' => __( 'Enable Custom Canonical URLs:', 'all-in-one-seo-pack' ),
364
- 'default' => 0,
365
- 'condshow' => Array( "aiosp_can" => 'on' ) ),
366
- "can_set_protocol" => Array(
367
- 'name' => __( 'Set Protocol For Canonical URLs:', 'all-in-one-seo-pack' ),
368
- 'type' => 'radio',
369
- 'default' => 'auto',
370
- 'initial_options' => Array( 'auto' => __( 'Auto', 'all-in-one-seo-pack' ),
371
- 'http' => __( 'HTTP', 'all-in-one-seo-pack' ),
372
- 'https' => __( 'HTTPS', 'all-in-one-seo-pack' ) ),
373
- 'condshow' => Array( "aiosp_can" => 'on' )
374
  ),
375
- "rewrite_titles"=> Array(
376
- 'name' => __( 'Rewrite Titles:', 'all-in-one-seo-pack' ),
377
- 'default' => 1,
378
- 'type' => 'radio',
379
- 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
380
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) )
 
 
 
 
 
 
 
 
 
381
  ),
382
- "force_rewrites"=> Array(
383
- 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
 
384
  'default' => 1,
385
- 'type' => 'hidden',
386
- 'prefix' => $this->prefix,
387
- 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
388
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  ),
390
- "use_original_title"=> Array(
391
- 'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ),
392
- 'type' => 'radio',
393
- 'default' => 0,
394
- 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
395
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) )
 
 
 
396
  ),
397
- "cap_titles"=> Array(
398
- 'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ), 'default' => 1),
399
- "cap_cats"=> Array(
400
- 'name' => __( 'Capitalize Category Titles:', 'all-in-one-seo-pack' ), 'default' => 1),
401
- "home_page_title_format"=> Array(
402
- 'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
403
- 'type' => 'text', 'default' => '%page_title%',
404
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
405
- "page_title_format"=> Array(
406
- 'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ),
407
- 'type' => 'text', 'default' => '%page_title% | %blog_title%',
408
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
409
- "post_title_format"=> Array(
410
- 'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ),
411
- 'type' => 'text', 'default' => '%post_title% | %blog_title%',
412
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
413
- "category_title_format"=> Array(
414
- 'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ),
415
- 'type' => 'text', 'default' => '%category_title% | %blog_title%',
416
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
417
- "archive_title_format"=> Array(
418
- 'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ),
419
- 'type' => 'text', 'default' => '%archive_title% | %blog_title%',
420
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
421
- "date_title_format"=> Array(
422
- 'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ),
423
- 'type' => 'text', 'default' => '%date% | %blog_title%',
424
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
425
- "author_title_format"=> Array(
426
- 'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ),
427
- 'type' => 'text', 'default' => '%author% | %blog_title%',
428
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
429
- "tag_title_format"=> Array(
430
- 'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ),
431
- 'type' => 'text', 'default' => '%tag% | %blog_title%',
432
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
433
- "search_title_format"=> Array(
434
- 'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ),
435
- 'type' => 'text', 'default' => '%search% | %blog_title%',
436
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
437
- "description_format"=> Array(
438
- 'name' => __( 'Description Format', 'all-in-one-seo-pack' ),
439
- 'type' => 'text', 'default' => '%description%',
440
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
441
- "404_title_format"=> Array(
442
- 'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ),
443
- 'type' => 'text', 'default' => 'Nothing found for %request_words%',
444
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
445
- "paged_format"=> Array(
446
- 'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ),
447
- 'type' => 'text', 'default' => ' - Part %page%',
448
- 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
449
- "enablecpost"=> Array(
450
- 'name' => __( 'SEO for Custom Post Types:', 'all-in-one-seo-pack' ),
451
- 'default' => 'on',
452
- 'type' => 'radio',
453
- 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
454
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) )
455
  ),
456
- "cpostactive" => Array(
457
- 'name' => __( 'SEO on only these post types:', 'all-in-one-seo-pack' ),
458
- 'type' => 'multicheckbox', 'default' => array('post', 'page'),
459
- 'condshow' => Array( 'aiosp_enablecpost' => 'on' )
 
 
 
 
460
  ),
461
- "taxactive" => Array(
462
- 'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ),
463
- 'type' => 'multicheckbox', 'default' => array('category', 'post_tag'),
464
- 'condshow' => Array( 'aiosp_enablecpost' => 'on' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  ),
466
- "cpostadvanced" => Array(
467
- 'name' => __( 'Enable Advanced Options:', 'all-in-one-seo-pack' ),
468
- 'default' => 0, 'type' => 'radio',
469
- 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
470
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ),
471
- 'label' => null,
472
- 'condshow' => Array( "aiosp_enablecpost" => 'on' )
 
 
 
 
 
 
 
 
 
 
 
 
 
473
  ),
474
- "cpostnoindex" => Array(
475
- 'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ),
476
- 'type' => 'multicheckbox', 'default' => array(),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
  ),
478
- "cpostnofollow" => Array(
479
- 'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ),
480
- 'type' => 'multicheckbox', 'default' => array(),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  ),
482
- "cpostnoodp"=> Array(
483
- 'name' => __( 'Default to NOODP:', 'all-in-one-seo-pack' ),
484
- 'type' => 'multicheckbox', 'default' => array(),
 
 
 
 
 
 
 
 
 
 
 
 
485
  ),
486
- "cpostnoydir"=> Array(
487
- 'name' => __( 'Default to NOYDIR:', 'all-in-one-seo-pack' ),
488
- 'type' => 'multicheckbox', 'default' => array(),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  ),
490
- "cposttitles" => Array(
491
- 'name' => __( 'Custom titles:', 'all-in-one-seo-pack' ),
492
- 'type' => 'checkbox', 'default' => 0,
493
- 'condshow' => Array( "aiosp_rewrite_titles" => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' )
 
 
 
 
494
  ),
495
- "posttypecolumns" => Array(
496
- 'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ),
497
- 'type' => 'multicheckbox', 'default' => array('post', 'page'),
498
- 'condshow' => Array( 'aiosp_enablecpost' => 'on' ) ),
499
- "admin_bar" => Array(
500
- 'name' => __( 'Display Menu In Admin Bar:', 'all-in-one-seo-pack' ), 'default' => 'on',
501
  ),
502
- "custom_menu_order" => Array(
503
- 'name' => __( 'Display Menu At The Top:', 'all-in-one-seo-pack' ), 'default' => 'on',
 
 
 
 
 
 
 
 
 
504
  ),
505
- "google_verify" => Array(
506
- 'name' => __( 'Google Webmaster Tools:', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'text'
 
 
 
 
 
 
 
 
 
507
  ),
508
- "bing_verify" => Array(
509
- 'name' => __( 'Bing Webmaster Center:', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'text'
 
 
 
 
 
 
 
 
 
 
510
  ),
511
- "pinterest_verify" => Array(
512
- 'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'text'
 
 
 
 
 
 
 
 
 
513
  ),
514
- "google_publisher"=> Array(
515
- 'name' => __( 'Google Plus Default Profile:', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'text'
 
 
 
 
 
 
 
 
 
516
  ),
517
- "google_disable_profile"=> Array(
518
- 'name' => __( 'Disable Google Plus Profile:', 'all-in-one-seo-pack' ), 'default' => 0, 'type' => 'checkbox'
 
 
 
 
 
 
 
 
 
519
  ),
520
- "google_sitelinks_search" => Array(
521
- 'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' )
522
- ),
523
- "google_set_site_name" => Array(
524
- 'name' => __( 'Set Preferred Site Name:', 'all-in-one-seo-pack' )
525
- ),
526
- "google_specify_site_name" => Array(
527
- 'name' => __( 'Specify A Preferred Name:', 'all-in-one-seo-pack' ),
528
- 'type' => 'text',
529
- 'placeholder' => $blog_name,
530
- 'condshow' => Array( 'aiosp_google_set_site_name' => 'on' )
531
- ),
532
- "google_author_advanced" => Array(
533
- 'name' => __( 'Advanced Authorship Options:', 'all-in-one-seo-pack' ),
534
- 'default' => 0, 'type' => 'radio',
535
- 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
536
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ),
537
- 'label' => null
538
  ),
539
- "google_author_location"=> Array(
540
- 'name' => __( 'Display Google Authorship:', 'all-in-one-seo-pack' ), 'default' => array( 'all' ), 'type' => 'multicheckbox',
541
- 'condshow' => Array( 'aiosp_google_author_advanced' => 'on' )
542
  ),
543
- "google_enable_publisher" => Array(
544
- 'name' => __( 'Display Publisher Meta on Front Page:', 'all-in-one-seo-pack' ),
545
- 'default' => 'on', 'type' => 'radio',
546
- 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
547
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ),
548
- 'condshow' => Array( 'aiosp_google_author_advanced' => 'on' )
 
 
 
 
 
549
  ),
550
- "google_specify_publisher" => Array(
551
- 'name' => __( 'Specify Publisher URL:', 'all-in-one-seo-pack' ), 'type' => 'text',
552
- 'condshow' => Array( 'aiosp_google_author_advanced' => 'on', 'aiosp_google_enable_publisher' => 'on' )
 
 
 
 
 
 
 
 
 
553
  ),
554
- // "google_connect"=>Array( 'name' => __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ), ),
555
- "google_analytics_id"=> Array(
556
- 'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ),
557
- 'default' => null, 'type' => 'text', 'placeholder' => 'UA-########-#' ),
558
- "ga_use_universal_analytics" => Array(
559
- 'name' => __( 'Use Universal Analytics:', 'all-in-one-seo-pack' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  'default' => 0,
561
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ) ) ),
562
- "ga_advanced_options"=> Array(
563
- 'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ),
564
- 'default' => 'on',
565
- 'type' => 'radio',
566
- 'initial_options' => Array( 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
567
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) ),
568
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ) ) ),
569
- "ga_domain"=> Array(
570
- 'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ),
571
- 'type' => 'text',
572
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on') ),
573
- "ga_multi_domain"=> Array(
574
- 'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ),
575
  'default' => 0,
576
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ),
577
- "ga_addl_domains" => Array(
578
- 'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ),
579
- 'type' => 'textarea',
580
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on', 'aiosp_ga_multi_domain' => 'on' ) ),
581
- "ga_anonymize_ip"=> Array(
582
- 'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ),
583
- 'type' => 'checkbox',
584
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ),
585
- "ga_display_advertising"=> Array(
586
- 'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ),
587
- 'type' => 'checkbox',
588
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ),
589
- "ga_exclude_users"=> Array(
590
- 'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ),
591
- 'type' => 'multicheckbox',
592
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ),
593
- "ga_track_outbound_links"=> Array(
594
- 'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ),
595
  'default' => 0,
596
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ),
597
- "ga_link_attribution"=> Array(
598
- 'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ),
 
 
 
 
599
  'default' => 0,
600
- 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ), 'aiosp_ga_advanced_options' => 'on' ) ),
601
- "ga_enhanced_ecommerce"=> Array(
602
- 'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ),
603
  'default' => 0,
604
- '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' ) ),
605
- "use_categories"=> Array(
606
- 'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ),
607
  'default' => 0,
608
- 'condshow' => Array( "aiosp_togglekeywords" => 0 ) ),
609
- "use_tags_as_keywords" => Array(
610
- 'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ),
611
  'default' => 1,
612
- 'condshow' => Array( "aiosp_togglekeywords" => 0 ) ),
613
- "dynamic_postspage_keywords"=> Array(
614
- 'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
615
  'default' => 1,
616
- 'condshow' => Array( "aiosp_togglekeywords" => 0 ) ),
617
- "category_noindex"=> Array(
618
- 'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ),
619
- 'default' => 1),
620
- "archive_date_noindex"=> Array(
621
- 'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ),
622
- 'default' => 1),
623
- "archive_author_noindex"=> Array(
624
- 'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ),
625
- 'default' => 1),
626
- "tags_noindex"=> Array(
627
- 'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ),
628
- 'default' => 0),
629
- "search_noindex"=> Array(
630
- 'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ),
631
- 'default' => 0),
632
- "404_noindex"=> Array(
633
- 'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ),
634
- 'default' => 0),
635
- "tax_noindex"=> Array(
636
- 'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ),
637
- 'type' => 'multicheckbox', 'default' => array(),
638
- 'condshow' => Array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' )
639
- ),
640
- "paginated_noindex" => Array(
641
- 'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ),
642
- 'default' => 0),
643
- "paginated_nofollow"=> Array(
644
- 'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ),
645
- 'default' => 0),
646
- "noodp"=> Array(
647
- 'name' => __( 'Exclude site from the Open Directory Project:', 'all-in-one-seo-pack' ),
648
- 'default' => 0),
649
- "noydir"=> Array(
650
- 'name' => __( 'Exclude site from Yahoo! Directory:', 'all-in-one-seo-pack' ),
651
- 'default' => 0),
652
- "skip_excerpt"=> Array(
653
- 'name' => __( 'Avoid Using The Excerpt In Descriptions:', 'all-in-one-seo-pack' ),
654
- 'default' => 0 ),
655
- "generate_descriptions"=> Array(
656
- 'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ),
657
- 'default' => 1),
658
- "run_shortcodes"=> Array(
659
- 'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ),
660
  'default' => 0,
661
- 'condshow' => Array( 'aiosp_generate_descriptions' => 'on' ) ),
662
- "hide_paginated_descriptions"=> Array(
663
- 'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ),
664
- 'default' => 0),
665
- "dont_truncate_descriptions"=> Array(
666
- 'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ),
667
- 'default' => 0),
668
- "schema_markup"=> Array(
669
- 'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ),
670
- 'default' => 1),
671
- "unprotect_meta"=> Array(
672
- 'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ),
673
- 'default' => 0),
674
- "ex_pages" => Array(
675
- 'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ),
676
- 'type' => 'textarea', 'default' => '' ),
677
- "post_meta_tags"=> Array(
678
- 'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ),
679
- 'type' => 'textarea', 'default' => '', 'sanitize' => 'default' ),
680
- "page_meta_tags"=> Array(
681
- 'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ),
682
- 'type' => 'textarea', 'default' => '', 'sanitize' => 'default' ),
683
- "front_meta_tags"=> Array(
684
- 'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ),
685
- 'type' => 'textarea', 'default' => '', 'sanitize' => 'default' ),
686
- "home_meta_tags"=> Array(
687
- 'name' => __( 'Additional Blog Page Headers:', 'all-in-one-seo-pack' ),
688
- 'type' => 'textarea', 'default' => '', 'sanitize' => 'default' ),
689
- "do_log"=> Array(
690
- 'name' => __( 'Log important events:', 'all-in-one-seo-pack' ),
691
- 'default' => null ),
692
- );
 
 
 
693
 
694
- if ( AIOSEOPPRO ) {
695
- unset($this->default_options['donate']);
696
- } else {
697
- unset($this->default_options['license_key']);
698
- unset($this->default_options['taxactive']);
699
- }
700
-
701
- $this->locations = Array(
702
- 'default' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings', 'options' => null ),
703
- 'aiosp' => Array( 'name' => $this->plugin_name, 'type' => 'metabox', 'prefix' => '', 'help_link' => 'http://semperplugins.com/sections/postpage-settings/',
704
- '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' ),
705
- 'default_options' => Array(
706
- 'edit' => Array( 'type' => 'hidden', 'default' => 'aiosp_edit', 'prefix' => true, 'nowrap' => 1 ),
707
- 'nonce-aioseop-edit' => Array( 'type' => 'hidden', 'default' => null, 'prefix' => false, 'nowrap' => 1 ),
708
- 'upgrade' => Array( 'type' => 'html', 'label' => 'none',
709
- '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' )
710
- ),
711
- 'support' => Array( 'type' => 'html', 'label' => 'none',
712
- 'default' => '<a target="_blank" href="http://semperplugins.com/support/">'
713
- . __( 'Support Forum', 'all-in-one-seo-pack' ) . '</a>'
714
- ),
715
- 'snippet' => Array( 'name' => __( 'Preview Snippet', 'all-in-one-seo-pack' ), 'type' => 'custom', 'label' => 'top',
716
- 'default' => '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
717
  <script>
718
  jQuery(document).ready(function() {
719
  jQuery("#aiosp_title_wrapper").bind("input", function() {
@@ -724,172 +1013,379 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
724
  });
725
  });
726
  </script>
727
- <div class="preview_snippet"><div id="aioseop_snippet"><h3><a>%s</a></h3><div><div><cite id="aioseop_snippet_link">%s</cite></div><span id="aioseop_snippet_description">%s</span></div></div></div>' ),
728
- 'title' => Array( 'name' => __( 'Title', 'all-in-one-seo-pack' ), 'type' => 'text', 'count' => true, 'size' => 60 ),
729
- 'description' => Array( 'name' => __( 'Description', 'all-in-one-seo-pack' ), 'type' => 'textarea', 'count' => true, 'cols' => 80, 'rows' => 2 ),
730
-
731
- 'keywords' => Array( 'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ), 'type' => 'text' ),
732
- 'custom_link' => Array( 'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ),
733
- 'noindex' => Array( 'name' => __( "Robots Meta NOINDEX", 'all-in-one-seo-pack' ), 'default' => '' ),
734
- 'nofollow' => Array( 'name' => __( "Robots Meta NOFOLLOW", 'all-in-one-seo-pack' ), 'default' => '' ),
735
- 'noodp' => Array( 'name' => __( "Robots Meta NOODP", 'all-in-one-seo-pack' ) ),
736
- 'noydir' => Array( 'name' => __( "Robots Meta NOYDIR", 'all-in-one-seo-pack' ) ),
737
- 'titleatr' => Array( 'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ),
738
- 'menulabel' => Array( 'name' => __( 'Menu Label', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ),
739
- 'sitemap_exclude' => Array( 'name' => __( 'Exclude From Sitemap', 'all-in-one-seo-pack' ) ),
740
- 'disable' => Array( 'name' => __( 'Disable on this page/post', 'all-in-one-seo-pack' ) ),
741
- 'disable_analytics' => Array( 'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ), 'condshow' => Array( 'aiosp_disable' => 'on' ) ) ),
742
- 'display' => null )
743
- );
744
-
745
- if ( !empty( $meta_help_text ) )
746
- foreach( $meta_help_text as $k => $v )
747
- $this->locations['aiosp']['default_options'][$k]['help_text'] = $v;
748
-
749
- $this->layout = Array(
750
- 'default' => Array(
751
- 'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
752
- 'help_link' => 'http://semperplugins.com/documentation/general-settings/',
753
- 'options' => Array() // this is set below, to the remaining options -- pdb
754
  ),
755
- 'home' => Array(
756
- 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
757
- 'help_link' => 'http://semperplugins.com/documentation/home-page-settings/',
758
- 'options' => Array( 'home_title', 'home_description', 'home_keywords', 'use_static_home_info' )
 
 
759
  ),
760
- 'title' => Array(
761
- 'name' => __( 'Title Settings', 'all-in-one-seo-pack' ),
762
- 'help_link' => 'http://semperplugins.com/documentation/title-settings/',
763
- '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",
764
- "tag_title_format", "search_title_format", "description_format", "404_title_format", "paged_format" )
765
  ),
766
- 'cpt' => Array(
767
- 'name' => __( 'Custom Post Type Settings', 'all-in-one-seo-pack' ),
768
- 'help_link' => 'http://semperplugins.com/documentation/custom-post-type-settings/',
769
- 'options' => Array( "enablecpost", "cpostadvanced", "taxactive","cpostactive", "cposttitles" )
770
  ),
771
- 'display' => Array(
772
- 'name' => __( 'Display Settings', 'all-in-one-seo-pack' ),
773
- 'help_link' => 'http://semperplugins.com/documentation/display-settings/',
774
- 'options' => Array( "posttypecolumns", "admin_bar", "custom_menu_order" )
775
  ),
776
- 'webmaster' => Array(
777
- 'name' => __( 'Webmaster Verification', 'all-in-one-seo-pack' ),
778
- 'help_link' => 'http://semperplugins.com/sections/webmaster-verification/',
779
- 'options' => Array( "google_verify", "bing_verify", "pinterest_verify" )
780
  ),
781
- 'google' => Array(
782
- 'name' => __( 'Google Settings', 'all-in-one-seo-pack' ),
783
- 'help_link' => 'http://semperplugins.com/documentation/google-settings/',
784
- '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",
785
- // "google_connect",
786
- "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" )
787
  ),
788
- 'noindex' => Array(
789
- 'name' => __( 'Noindex Settings', 'all-in-one-seo-pack' ),
790
- 'help_link' => 'http://semperplugins.com/documentation/noindex-settings/',
791
- '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' )
792
  ),
793
- 'advanced' => Array(
794
- 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ),
795
- 'help_link' => 'http://semperplugins.com/documentation/advanced-settings/',
796
- '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' )
 
797
  ),
798
- 'keywords' => Array(
799
- 'name' => __( 'Keyword Settings', 'all-in-one-seo-pack' ),
800
- 'help_link' => 'http://semperplugins.com/documentation/keyword-settings/',
801
- 'options' => Array( "togglekeywords", "use_categories", "use_tags_as_keywords", "dynamic_postspage_keywords" )
802
- )
803
- );
804
 
805
- if(!AIOSEOPPRO){
806
- unset($this->layout['cpt']['options']['2']);
807
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
808
 
809
- $other_options = Array();
810
- foreach( $this->layout as $k => $v )
811
- $other_options = array_merge( $other_options, $v['options'] );
812
 
813
- $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
 
 
 
 
 
814
 
815
- if ( is_admin() ) {
816
- $this->add_help_text_links();
817
- add_action( "aioseop_global_settings_header", Array( $this, 'display_right_sidebar' ) );
818
- add_action( "aioseop_global_settings_footer", Array( $this, 'display_settings_footer' ) );
819
- add_action( "output_option", Array( $this, 'custom_output_option' ), 10, 2 );
820
- add_action('all_admin_notices', array( $this, 'visibility_warning'));
821
-
822
- if(!AIOSEOPPRO){
823
  // add_action('all_admin_notices', array( $this, 'woo_upgrade_notice'));
824
- }
825
- }
826
- if(AIOSEOPPRO){
827
- add_action( 'split_shared_term', Array( $this, 'split_shared_term' ), 10, 4 );
828
- }
829
- }
830
 
831
- //good candidate for pro dir
832
- function get_all_term_data( $term_id ) {
833
- $terms = Array();
834
- $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' );
835
- foreach( $optlist as $f ) {
836
- $meta = get_term_meta( $term_id, '_aioseop_' . $f, true );
837
- if ( !empty( $meta ) ) {
838
- $terms['_aioseop_' . $f] = $meta;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
839
  }
840
  }
841
- return $terms;
842
  }
843
-
844
- //good candidate for pro dir
845
- function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id = '', $taxonomy = '' ) {
846
- $terms = $this->get_all_term_data( $term_id );
847
- if ( !empty( $terms ) ) {
848
- $new_terms = $this->get_all_term_data( $new_term_id );
849
- if ( empty( $new_terms ) ) {
850
- foreach( $terms as $k => $v ) {
851
- add_term_meta( $new_term_id, $k, $v, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
852
  }
853
- add_term_meta( $term_id, '_aioseop_term_was_split', true, true );
854
  }
855
  }
 
 
 
 
856
  }
857
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
858
  function get_page_snippet_info() {
859
- static $info = Array();
860
- if ( !empty( $info ) )
861
  return $info;
 
862
  global $post, $aioseop_options, $wp_query;
863
  $title = $url = $description = $term = $category = '';
864
- $p = $post; $w = $wp_query;
865
- if ( !is_object( $post ) ) $post = $this->get_queried_object();
866
- if ( empty( $this->meta_opts ) )
867
- $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
868
- if ( !is_object( $post ) && is_admin() && !empty( $_GET ) && !empty( $_GET['post_type'] ) && !empty( $_GET['taxonomy'] ) && !empty( $_GET['tag_ID'] ) ) {
 
 
 
 
869
  $term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
870
  }
871
  if ( is_object( $post ) ) {
872
- $opts = $this->meta_opts;
873
  $post_id = $p->ID;
874
- if ( empty( $post->post_modified_gmt ) )
875
  $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
876
- if ( $post->post_type == 'page' )
 
877
  $wp_query->is_page = true;
878
- elseif ( $post->post_type == 'attachment' )
879
  $wp_query->is_attachment = true;
880
- else
881
  $wp_query->is_single = true;
882
- if ( empty( $this->is_front_page ) ) $this->is_front_page = false;
883
- if ( get_option( 'show_on_front' ) == 'page' ) {
884
- if ( is_page() && $post->ID == get_option( 'page_on_front' ) )
885
- $this->is_front_page = true;
886
- elseif ( $post->ID == get_option( 'page_for_posts' ) )
 
 
 
887
  $wp_query->is_home = true;
 
888
  }
889
  $wp_query->queried_object = $post;
890
- if ( !empty( $post ) && !$wp_query->is_home && !$this->is_front_page ) {
891
- $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
892
- if ( empty( $title ) ) $title = $post->post_title;
 
 
893
  }
894
  $title_format = '';
895
  if ( empty( $title ) ) {
@@ -897,47 +1393,65 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
897
  }
898
  $description = $this->get_main_description( $post );
899
  if ( empty( $title_format ) ) {
900
- if ( is_page() )
901
  $title_format = $aioseop_options['aiosp_page_title_format'];
902
- elseif ( is_single() || is_attachment() )
903
  $title_format = $this->get_post_title_format( 'post', $post );
 
904
  }
905
  if ( empty( $title_format ) ) {
906
  $title_format = '%post_title%';
907
  }
908
  $categories = $this->get_all_categories( $post_id );
909
- $category = '';
910
- if ( count( $categories ) > 0 )
911
  $category = $categories[0];
 
912
  } else if ( is_object( $term ) ) {
913
- if ( $_GET['taxonomy'] == 'category' ) {
914
- query_posts( Array( 'cat' => $_GET['tag_ID'] ) );
915
- } else if ( $_GET['taxonomy'] == 'post_tag' ) {
916
- query_posts( Array( 'tag' => $term->slug ) );
917
  } else {
918
- query_posts( Array( 'page' => '', $_GET['taxonomy'] => $term->slug, 'post_type' => $_GET['post_type'] ) );
 
 
 
 
 
 
 
919
  }
920
- if ( empty( $this->meta_opts ) )
921
- $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
922
- $title = $this->get_tax_name( $_GET['taxonomy'] );
923
  $title_format = $this->get_tax_title_format();
924
- $opts = $this->meta_opts;
925
- if ( !empty( $opts ) ) $description = $opts['aiosp_description'];
926
- if ( empty( $description ) ) $description = term_description();
 
 
 
 
927
  $description = $this->internationalize( $description );
928
  }
929
 
930
  $show_page = true;
931
- if ( !empty( $aioseop_options["aiosp_no_paged_canonical_links"] ) ) $show_page = false;
 
 
932
  if ( $aioseop_options['aiosp_can'] ) {
933
- if ( !empty( $aioseop_options['aiosp_customize_canonical_links'] ) && !empty( $opts['aiosp_custom_link'] ) ) $url = $opts['aiosp_custom_link'];
934
- if ( empty( $url ) )
 
 
935
  $url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
 
936
  $url = apply_filters( 'aioseop_canonical_url', $url );
937
  }
938
- if ( !$url ) $url = get_permalink();
 
 
939
 
940
- $title = $this->apply_cf_fields( $title );
941
  $description = $this->apply_cf_fields( $description );
942
  $description = apply_filters( 'aioseop_description', $description );
943
 
@@ -945,376 +1459,82 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
945
  $keywords = $this->apply_cf_fields( $keywords );
946
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
947
 
948
- $info = Array( 'title' => $title, 'description' => $description, 'keywords' => $keywords, 'url' => $url,
949
- 'title_format' => $title_format, 'category' => $category, 'w' => $wp_query, 'p' => $post );
 
 
 
 
 
 
 
 
950
  wp_reset_postdata();
951
- $wp_query = $w; $post = $p;
952
- return $info;
953
- }
954
-
955
- /*** Use custom callback for outputting snippet ***/
956
- function custom_output_option( $buf, $args ) {
957
- if ( $args['name'] == 'aiosp_snippet' ) {
958
- $args['options']['type'] = 'html';
959
- $args['options']['nowrap'] = false;
960
- $args['options']['save'] = false;
961
- $info = $this->get_page_snippet_info();
962
- extract( $info );
963
- } else return '';
964
-
965
- if ( $this->strlen( $title ) > 70 ) $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...';
966
- if ( $this->strlen( $description ) > 156 ) $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...';
967
- $extra_title_len = 0;
968
- if ( empty( $title_format ) ) {
969
- $title = '<span id="' . $args['name'] . '_title">' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . '</span>';
970
- } else {
971
- if ( strpos( $title_format, '%blog_title%' ) !== false ) $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
972
- $title_format = $this->apply_cf_fields( $title_format );
973
- $replace_title = '<span id="' . $args['name'] . '_title">' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . '</span>';
974
- if ( strpos( $title_format, '%post_title%' ) !== false ) $title_format = str_replace( '%post_title%', $replace_title, $title_format );
975
- if ( strpos( $title_format, '%page_title%' ) !== false ) $title_format = str_replace( '%page_title%', $replace_title, $title_format );
976
- if ( $w->is_category || $w->is_tag || $w->is_tax ) {
977
- if(AIOSEOPPRO){
978
- if ( !empty( $_GET ) && !empty( $_GET['taxonomy'] ) && !empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) {
979
- $term_id = intval( $_GET['tag_ID'] );
980
- $was_split = get_term_meta( $term_id, '_aioseop_term_was_split', true );
981
- if ( !$was_split ) {
982
- $split_terms = wp_get_split_terms( $term_id, $_GET['taxonomy'] );
983
- if ( !empty( $split_terms ) ) {
984
- foreach ( $split_terms as $new_tax => $new_term ) {
985
- $this->split_shared_term( $term_id, $new_term );
986
- }
987
- }
988
- }
989
- }
990
- }
991
- if ( strpos( $title_format, '%category_title%' ) !== false ) $title_format = str_replace( '%category_title%', $replace_title, $title_format );
992
- if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) $title_format = str_replace( '%taxonomy_title%', $replace_title, $title_format );
993
- } else {
994
- if ( strpos( $title_format, '%category%' ) !== false ) $title_format = str_replace( '%category%', $category, $title_format );
995
- if ( strpos( $title_format, '%category_title%' ) !== false ) $title_format = str_replace( '%category_title%', $category, $title_format );
996
- if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) $title_format = str_replace( '%taxonomy_title%', $category, $title_format );
997
- if(AIOSEOPPRO){
998
- if ( strpos( $title_format, "%tax_" ) && !empty( $p ) ) {
999
- $taxes = get_object_taxonomies( $p, 'objects' );
1000
- if ( !empty( $taxes ) )
1001
- foreach( $taxes as $t )
1002
- if ( strpos( $title_format, "%tax_{$t->name}%" ) ) {
1003
- $terms = $this->get_all_terms( $p->ID, $t->name );
1004
- $term = '';
1005
- if ( count( $terms ) > 0 )
1006
- $term = $terms[0];
1007
- $title_format = str_replace( "%tax_{$t->name}%", $term, $title_format );
1008
- }
1009
- }
1010
- }
1011
- }
1012
- if ( strpos( $title_format, '%taxonomy_description%' ) !== false ) $title_format = str_replace( '%taxonomy_description%', $description, $title_format );
1013
-
1014
- $title_format = preg_replace( '/%([^%]*?)%/', '', $title_format );
1015
- $title = $title_format;
1016
- $extra_title_len = strlen( str_replace( $replace_title, '', $title_format ) );
1017
- }
1018
-
1019
- $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( wp_strip_all_tags( $description ) ) );
1020
- $extra_title_len = (int)$extra_title_len;
1021
- $args['value'] .= "<script>var aiosp_title_extra = {$extra_title_len};</script>";
1022
- $buf = $this->get_option_row( $args['name'], $args['options'], $args );
1023
-
1024
- return $buf;
1025
- }
1026
-
1027
- function add_page_icon() {
1028
- wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
1029
- wp_enqueue_style( 'wp-pointer' );
1030
- $this->add_admin_pointers();
1031
-
1032
-
1033
- wp_enqueue_style( 'aiosp_admin_style' , AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css' );
1034
- ?>
1035
- <script>
1036
- function aioseop_show_pointer( handle, value ) {
1037
- if ( typeof( jQuery ) != 'undefined' ) {
1038
- var p_edge = 'bottom';
1039
- var p_align = 'center';
1040
- if ( typeof( jQuery( value.pointer_target ).pointer) != 'undefined' ) {
1041
- if ( typeof( value.pointer_edge ) != 'undefined' ) p_edge = value.pointer_edge;
1042
- if ( typeof( value.pointer_align ) != 'undefined' ) p_align = value.pointer_align;
1043
- jQuery(value.pointer_target).pointer({
1044
- content : value.pointer_text,
1045
- position: {
1046
- edge: p_edge,
1047
- align: p_align
1048
- },
1049
- close : function() {
1050
- jQuery.post( ajaxurl, {
1051
- pointer: handle,
1052
- action: 'dismiss-wp-pointer'
1053
- });
1054
- }
1055
- }).pointer('open');
1056
- }
1057
- }
1058
- }
1059
- <?php
1060
- if ( !empty( $this->pointers ) ) {
1061
- ?>
1062
- if ( typeof( jQuery ) != 'undefined' ) {
1063
- jQuery(document).ready(function() {
1064
- var admin_pointer;
1065
- var admin_index;
1066
- <?php
1067
- foreach( $this->pointers as $k => $p )
1068
- if ( !empty( $p["pointer_scope"] ) && ( $p["pointer_scope"] == 'global' ) ) {
1069
- ?>admin_index = "<?php echo esc_attr($k); ?>";
1070
- admin_pointer = <?php echo json_encode( $p ); ?>;
1071
- aioseop_show_pointer( admin_index, admin_pointer );
1072
- <?php
1073
- }
1074
- ?>
1075
- });
1076
- }
1077
- <?php
1078
- }
1079
- ?>
1080
- </script>
1081
- <?php
1082
- }
1083
-
1084
- function add_page_hooks() {
1085
-
1086
- global $aioseop_options;
1087
-
1088
- $post_objs = get_post_types( '', 'objects' );
1089
- $pt = array_keys( $post_objs );
1090
- $rempost = array( 'revision', 'nav_menu_item' );
1091
- $pt = array_diff( $pt, $rempost );
1092
- $post_types = Array();
1093
-
1094
- $aiosp_enablecpost = '';
1095
- if (isset($_REQUEST['aiosp_enablecpost'])) $aiosp_enablecpost = $_REQUEST['aiosp_enablecpost'];
1096
-
1097
- foreach ( $pt as $p ) {
1098
- if ( !empty( $post_objs[$p]->label ) ){
1099
- if ( $post_objs[$p]->_builtin && empty( $aioseop_options['aiosp_enablecpost'] )){
1100
- $post_types[$p] = $post_objs[$p]->label;
1101
- }elseif (!empty( $aioseop_options['aiosp_enablecpost'] ) || $aiosp_enablecpost == 'on' ) {
1102
- $post_types[$p] = $post_objs[$p]->label;
1103
- }
1104
- }
1105
- else{
1106
- $post_types[$p] = $p;
1107
- }
1108
- }
1109
-
1110
- foreach ($pt as $p){
1111
- if ( !empty( $post_objs[$p]->label)){
1112
- $all_post_types[$p] = $post_objs[$p]->label;
1113
- }
1114
- }
1115
-
1116
- $taxes = get_taxonomies( '', 'objects' );
1117
- $tx = array_keys( $taxes );
1118
- $remtax = array( 'nav_menu', 'link_category', 'post_format' );
1119
- $tx = array_diff( $tx, $remtax );
1120
- $tax_types = Array();
1121
- foreach( $tx as $t )
1122
- if ( !empty( $taxes[$t]->label ) )
1123
- $tax_types[$t] = $taxes[$t]->label;
1124
- else
1125
- $taxes[$t] = $t;
1126
- $this->default_options["posttypecolumns"]['initial_options'] = $post_types;
1127
- $this->default_options["cpostactive"]['initial_options'] = $all_post_types;
1128
- $this->default_options["cpostnoindex"]['initial_options'] = $post_types;
1129
- $this->default_options["cpostnofollow"]['initial_options'] = $post_types;
1130
- $this->default_options["cpostnoodp"]['initial_options'] = $post_types;
1131
- $this->default_options["cpostnoydir"]['initial_options'] = $post_types;
1132
- if ( AIOSEOPPRO ) $this->default_options["taxactive"]['initial_options'] = $tax_types;
1133
- $this->default_options["google_author_location"]['initial_options'] = $post_types;
1134
- $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' ) ) );
1135
- $this->default_options["google_author_location"]['default'] = array_keys( $this->default_options["google_author_location"]['initial_options'] );
1136
-
1137
- foreach ( $post_types as $p => $pt ) {
1138
- $field = $p . "_title_format";
1139
- $name = $post_objs[$p]->labels->singular_name;
1140
- if ( !isset( $this->default_options[$field] ) ) {
1141
- $this->default_options[$field] = Array (
1142
- 'name' => "$name " . __( 'Title Format:', 'all-in-one-seo-pack' ) . "<br />($p)",
1143
- 'type' => 'text',
1144
- 'default' => '%post_title% | %blog_title%',
1145
- 'condshow' => Array( 'aiosp_rewrite_titles' => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on', 'aiosp_cpostactive\[\]' => $p )
1146
- );
1147
- $this->help_text[$field] = __( 'The following macros are supported:', 'all-in-one-seo-pack' )
1148
- . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
1149
- __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
1150
- __( '%post_title% - The original title of the post.', 'all-in-one-seo-pack' ) . '</li><li>';
1151
- $taxes = get_object_taxonomies( $p, 'objects' );
1152
- if ( !empty( $taxes ) )
1153
- foreach( $taxes as $n => $t )
1154
- $this->help_text[$field] .= sprintf( __( "%%tax_%s%% - This post's associated %s taxonomy title", 'all-in-one-seo-pack' ), $n, $t->label ) . '</li><li>';
1155
- $this->help_text[$field] .=
1156
- __( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
1157
- __( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
1158
- __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
1159
- __( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
1160
- '</ul>';
1161
- $this->help_anchors[$field] = '#custom-titles';
1162
- $this->layout['cpt']['options'][] = $field;
1163
- }
1164
- }
1165
- global $wp_roles;
1166
- if ( ! isset( $wp_roles ) ) {
1167
- $wp_roles = new WP_Roles();
1168
- }
1169
- $role_names = $wp_roles->get_names();
1170
- ksort( $role_names );
1171
- $this->default_options["ga_exclude_users"]['initial_options'] = $role_names;
1172
-
1173
- unset( $tax_types['category'] );
1174
- unset( $tax_types['post_tag'] );
1175
- $this->default_options["tax_noindex"]['initial_options'] = $tax_types;
1176
- if ( empty( $tax_types ) )
1177
- unset( $this->default_options["tax_noindex"] );
1178
-
1179
- if (AIOSEOPPRO) {
1180
- foreach ( $tax_types as $p => $pt ) {
1181
- $field = $p . "_tax_title_format";
1182
- $name = $pt;
1183
- if ( !isset( $this->default_options[$field] ) ) {
1184
- $this->default_options[$field] = Array (
1185
- 'name' => "$name " . __( 'Taxonomy Title Format:', 'all-in-one-seo-pack' ),
1186
- 'type' => 'text',
1187
- 'default' => '%taxonomy_title% | %blog_title%',
1188
- 'condshow' => Array( 'aiosp_rewrite_titles' => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on', 'aiosp_taxactive\[\]' => $p )
1189
- );
1190
- $this->help_text[$field] = __( "The following macros are supported:", 'all-in-one-seo-pack' ) .
1191
- '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
1192
- __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
1193
- __( '%taxonomy_title% - The original title of the taxonomy', 'all-in-one-seo-pack' ) . '</li><li>' .
1194
- __( '%taxonomy_description% - The description of the taxonomy', 'all-in-one-seo-pack' ) . '</li></ul>';
1195
- $this->help_anchors[$field] = '#custom-titles';
1196
- $this->layout['cpt']['options'][] = $field;
1197
- }
1198
- }
1199
- }
1200
- $this->setting_options();
1201
- $this->add_help_text_links();
1202
-
1203
- if (AIOSEOPPRO){
1204
- global $aioseop_update_checker;
1205
- add_action( "{$this->prefix}update_options", Array( $aioseop_update_checker, 'license_change_check' ), 10, 2 );
1206
- add_action( "{$this->prefix}settings_update", Array( $aioseop_update_checker, 'update_check' ), 10, 2 );
1207
- }
1208
 
1209
- add_filter( "{$this->prefix}display_options", Array( $this, 'filter_options' ), 10, 2 );
1210
- parent::add_page_hooks();
1211
- }
1212
-
1213
- function add_admin_pointers() {
1214
- if ( AIOSEOPPRO ) {
1215
- $this->pointers['aioseop_menu_236'] = Array( 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-pro-aioseop_class',
1216
- 'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
1217
- . '</h3><p>' . __( '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' ) . '</p>',
1218
- 'pointer_edge' => 'top',
1219
- 'pointer_align' => 'left',
1220
- 'pointer_scope' => 'global'
1221
- );
1222
- $this->pointers['aioseop_welcome_230'] = Array( 'pointer_target' => '#aioseop_top_button',
1223
- 'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
1224
- . '</h3><p>' . __( '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' ) . '</p>',
1225
- 'pointer_edge' => 'bottom',
1226
- 'pointer_align' => 'left',
1227
- 'pointer_scope' => 'local'
1228
- );
1229
- $this->filter_pointers();
1230
- }
1231
- else {
1232
- $this->pointers['aioseop_menu_220'] = Array( 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class',
1233
- 'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
1234
- . '</h3><p>' . __( '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' ) . '</p>',
1235
- 'pointer_edge' => 'top',
1236
- 'pointer_align' => 'left',
1237
- 'pointer_scope' => 'global'
1238
- );
1239
- $this->pointers['aioseop_welcome_220'] = Array( 'pointer_target' => '#aioseop_top_button',
1240
- 'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
1241
- . '</h3><p>' . __( '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' ) . '</p>',
1242
- 'pointer_edge' => 'bottom',
1243
- 'pointer_align' => 'left',
1244
- 'pointer_scope' => 'local'
1245
- );
1246
- $this->filter_pointers();
1247
- }
1248
- }
1249
-
1250
- function settings_page_init() {
1251
- add_filter( "{$this->prefix}submit_options", Array( $this, 'filter_submit' ) );
1252
- }
1253
-
1254
- function enqueue_scripts() {
1255
- add_filter( "{$this->prefix}display_settings", Array( $this, 'filter_settings' ), 10, 3 );
1256
- add_filter( "{$this->prefix}display_options", Array( $this, 'filter_options' ), 10, 2 );
1257
- parent::enqueue_scripts();
1258
- }
1259
-
1260
- function filter_submit( $submit ) {
1261
- $submit['Submit_Default']['value'] = __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' &raquo;';
1262
- $submit['Submit_All_Default'] = Array( 'type' => 'submit', 'class' => 'button-secondary', 'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' &raquo;' );
1263
- return $submit;
1264
  }
1265
 
1266
  /**
1267
- * Handle resetting options to defaults, but preserve the license key if pro.
1268
  */
1269
- function reset_options( $location = null, $delete = false ) {
1270
- if ( AIOSEOPPRO) {
1271
- global $aioseop_update_checker;
 
 
1272
  }
1273
- if ( $delete === true ) {
1274
-
1275
- if ( AIOSEOPPRO ) {
1276
- $license_key = '';
1277
- if ( isset( $this->options ) && isset( $this->options['aiosp_license_key'] ) )
1278
- $license_key = $this->options['aiosp_license_key'];
1279
- }
1280
-
1281
- $this->delete_class_option( $delete );
1282
-
1283
- if ( AIOSEOPPRO ) {
1284
- $this->options = Array( 'aiosp_license_key' => $license_key );
1285
- } else {
1286
- $this->options = Array();
1287
  }
 
1288
  }
1289
- $default_options = $this->default_options( $location );
1290
 
1291
- if ( AIOSEOPPRO ) {
1292
- foreach ( $default_options as $k => $v )
1293
- if ( $k != 'aiosp_license_key' )
1294
- $this->options[$k] = $v;
1295
- $aioseop_update_checker->license_key = $this->options['aiosp_license_key'];
1296
- } else {
1297
- foreach ( $default_options as $k => $v )
1298
- $this->options[$k] = $v;
1299
- }
1300
- $this->update_class_option( $this->options );
1301
  }
1302
 
1303
- function get_current_options( $opts = Array(), $location = null, $defaults = null, $post = null ) {
1304
- if ( ( $location === 'aiosp' ) && ( $this->locations[$location]['type'] == 'metabox' ) ) {
1305
- if ( $post == null ) {
 
 
 
 
 
 
 
 
1306
  global $post;
1307
  }
1308
  $post_id = $post;
1309
- if ( is_object( $post_id ) )
1310
  $post_id = $post_id->ID;
 
1311
  $get_opts = $this->default_options( $location );
1312
- $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' );
1313
- if ( !( !empty( $this->options['aiosp_can'] ) ) && ( !empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
1314
- unset( $optlist["custom_link"] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1315
  }
1316
  foreach ( $optlist as $f ) {
1317
- $meta = '';
1318
  $field = "aiosp_$f";
1319
 
1320
  if ( AIOSEOPPRO ) {
@@ -1323,1977 +1543,3146 @@ global $aioseop_options;
1323
  $meta = get_term_meta( $_GET['tag_ID'], '_aioseop_' . $f, true );
1324
  } else {
1325
  $queried_object = get_queried_object();
1326
- if ( !empty( $queried_object ) && !empty( $queried_object->term_id ) ) {
1327
  $meta = get_term_meta( $queried_object->term_id, '_aioseop_' . $f, true );
1328
  }
1329
  }
1330
- } else
1331
  $meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
 
1332
  if ( 'title' === $f || 'description' === $f ) {
1333
- $get_opts[$field] = htmlspecialchars( ( $meta ) );
1334
  } else {
1335
- $get_opts[$field] = htmlspecialchars( stripslashes( $meta ) );
1336
  }
1337
  } else {
1338
  $field = "aiosp_$f";
1339
- $meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
1340
  if ( 'title' === $f || 'description' === $f ) {
1341
- $get_opts[$field] = htmlspecialchars( ( $meta ) );
1342
  } else {
1343
- $get_opts[$field] = htmlspecialchars( stripslashes( $meta ) );
1344
  }
1345
  }
1346
 
1347
  }
1348
  $opts = wp_parse_args( $opts, $get_opts );
 
1349
  return $opts;
1350
  } else {
1351
  $options = parent::get_current_options( $opts, $location, $defaults );
 
1352
  return $options;
1353
  }
1354
  }
1355
 
1356
- function filter_settings( $settings, $location, $current ) {
1357
- if ( $location == null ) {
1358
- $prefix = $this->prefix;
1359
-
1360
- foreach ( Array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt )
1361
- unset( $settings["{$prefix}$opt"] );
1362
-
1363
- if ( !class_exists( 'DOMDocument' ) ) {
1364
- unset( $settings["{prefix}google_connect"] );
1365
- }
1366
- if ( AIOSEOPPRO ) {
1367
- if ( !empty( $this->options['aiosp_license_key'] ) ) {
1368
- $settings['aiosp_license_key']['type'] = 'password';
1369
- $settings['aiosp_license_key']['size'] = 38;
1370
- }
1371
- }
1372
- } elseif ( $location == 'aiosp' ) {
1373
- global $post, $aioseop_sitemap;
1374
- $prefix = $this->get_prefix( $location ) . $location . '_';
1375
- if ( !empty( $post ) ) {
1376
- $post_type = get_post_type( $post );
1377
- if ( !empty( $this->options['aiosp_cpostnoindex'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoindex'] ) ) ) {
1378
- $settings["{$prefix}noindex"]['type'] = 'select';
1379
- $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' ) );
1380
- }
1381
- if ( !empty( $this->options['aiosp_cpostnofollow'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnofollow'] ) ) ) {
1382
- $settings["{$prefix}nofollow"]['type'] = 'select';
1383
- $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' ) );
1384
- }
1385
- if ( !empty( $this->options['aiosp_cpostnoodp'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoodp'] ) ) ) {
1386
- $settings["{$prefix}noodp"]['type'] = 'select';
1387
- $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' ) );
1388
- }
1389
- if ( !empty( $this->options['aiosp_cpostnoydir'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoydir'] ) ) ) {
1390
- $settings["{$prefix}noydir"]['type'] = 'select';
1391
- $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' ) );
1392
- }
1393
- global $post;
1394
- $info = $this->get_page_snippet_info();
1395
- extract( $info );
1396
- $settings["{$prefix}title"]['placeholder'] = $title;
1397
- $settings["{$prefix}description"]['placeholder'] = $description;
1398
- $settings["{$prefix}keywords"]['placeholder'] = $keywords;
1399
- }
1400
 
1401
- if ( !AIOSEOPPRO ){
1402
- if ( !current_user_can( 'update_plugins' ) )
1403
- unset( $settings["{$prefix}upgrade"] );
1404
- }
1405
 
1406
- if ( !is_object( $aioseop_sitemap ) )
1407
- unset( $settings['aiosp_sitemap_exclude'] );
1408
- if ( is_object( $post ) ) {
1409
- if ( $post->post_type != 'page' ) {
1410
- unset( $settings["{$prefix}titleatr"] );
1411
- unset( $settings["{$prefix}menulabel"] );
1412
- }
1413
- }
1414
- if ( !empty( $this->options[$this->prefix . 'togglekeywords'] ) ) {
1415
- unset( $settings["{$prefix}keywords"] );
1416
- unset( $settings["{$prefix}togglekeywords"] );
1417
- } elseif ( !empty( $current["{$prefix}togglekeywords"] ) ) {
1418
- unset( $settings["{$prefix}keywords"] );
1419
- }
1420
- if ( empty( $this->options['aiosp_can'] ) || ( empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
1421
- unset( $settings["{$prefix}custom_link"] );
1422
- }
1423
  }
1424
- return $settings;
 
1425
  }
1426
 
1427
- function filter_options( $options, $location ) {
1428
- if ( $location == 'aiosp' ) {
1429
- global $post;
1430
- if ( !empty( $post ) ) {
1431
- $prefix = $this->prefix;
1432
- $post_type = get_post_type( $post );
1433
- foreach( Array( 'noindex', 'nofollow', 'noodp', 'noydir' ) as $no ) {
1434
- if ( empty( $this->options['aiosp_cpost' . $no] ) || ( !in_array( $post_type, $this->options['aiosp_cpost' . $no] ) ) )
1435
- if ( isset( $options["{$prefix}{$no}"] ) && ( $options["{$prefix}{$no}"] != 'on' ) )
1436
- unset( $options["{$prefix}{$no}"] );
1437
- }
1438
- }
1439
- }
1440
- if ( $location == null ) {
1441
- $prefix = $this->prefix;
1442
- if ( isset( $options["{$prefix}rewrite_titles"] ) && ( !empty( $options["{$prefix}rewrite_titles"] ) ) )
1443
- $options["{$prefix}rewrite_titles"] = 1;
1444
- if ( ( isset( $options["{$prefix}enablecpost"] ) ) && ( $options["{$prefix}enablecpost"] === '' ) )
1445
- $options["{$prefix}enablecpost"] = 0;
1446
- if ( ( isset( $options["{$prefix}use_original_title"] ) ) && ( $options["{$prefix}use_original_title"] === '' ) )
1447
- $options["{$prefix}use_original_title"] = 0;
1448
  }
1449
- return $options;
1450
- }
1451
 
1452
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1453
 
1454
- function get_queried_object() {
1455
- static $p = null;
1456
- global $wp_query, $post;
1457
- if ( $p !== null ) return $p;
1458
- if ( is_object( $post ) )
1459
- $p = $post;
1460
- else {
1461
- if ( !$wp_query ) return null;
1462
- $p = $wp_query->get_queried_object();
 
 
 
 
 
 
 
 
 
 
1463
  }
1464
- return $p;
 
 
 
 
 
 
 
1465
  }
1466
 
1467
- function is_page_included() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1468
  global $aioseop_options;
1469
- if ( is_feed() ) return false;
1470
- if ( aioseop_mrt_exclude_this_page() ) return false;
1471
- $post = $this->get_queried_object();
1472
- $post_type = '';
1473
- if ( !empty( $post ) && !empty( $post->post_type ) )
1474
- $post_type = $post->post_type;
1475
- if ( empty( $aioseop_options['aiosp_enablecpost'] ) ) {
1476
- $wp_post_types = get_post_types( Array( '_builtin' => true ) ); // don't display meta if SEO isn't enabled on custom post types -- pdb
1477
- if( is_singular() && !in_array( $post_type, $wp_post_types ) && !is_front_page() ) return false;
 
 
 
 
 
 
 
1478
  } else {
1479
- $wp_post_types = $aioseop_options['aiosp_cpostactive'];
1480
- if ( empty( $wp_post_types ) ) $wp_post_types = Array();
1481
- if ( AIOSEOPPRO ) {
1482
- if ( is_tax() ) {
1483
- if ( empty( $aioseop_options['aiosp_taxactive'] ) || !is_tax( $aioseop_options['aiosp_taxactive'] ) ) return false;
1484
- } elseif ( is_category() ) {
1485
- if ( empty( $aioseop_options['aiosp_taxactive'] ) || !in_array( 'category', $aioseop_options['aiosp_taxactive'] ) ) return false;
1486
- } elseif ( is_tag() ) {
1487
- if ( empty( $aioseop_options['aiosp_taxactive'] ) || !in_array( 'post_tag', $aioseop_options['aiosp_taxactive'] ) ) return false;
1488
- } else if ( !in_array( $post_type, $wp_post_types ) && !is_front_page() && !is_post_type_archive( $wp_post_types ) && !is_404() ) return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1489
  } else {
1490
- if ( is_singular() && !in_array( $post_type, $wp_post_types ) && !is_front_page() ) return false;
1491
- if ( is_post_type_archive() && !is_post_type_archive( $wp_post_types ) ) return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1492
  }
 
 
 
1493
  }
1494
-
1495
- $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
1496
-
1497
- $aiosp_disable = $aiosp_disable_analytics = false;
1498
-
1499
- if ( !empty( $this->meta_opts ) ) {
1500
- if ( isset( $this->meta_opts['aiosp_disable'] ) ) $aiosp_disable = $this->meta_opts['aiosp_disable'];
1501
- if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) $aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics'];
1502
  }
1503
-
1504
- if ( $aiosp_disable ) {
1505
- if ( !$aiosp_disable_analytics ) {
1506
- if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
1507
- remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
1508
- add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) );
 
 
 
 
1509
  }
1510
  }
1511
- return false;
1512
  }
1513
 
1514
- if ( !empty( $this->meta_opts ) && $this->meta_opts['aiosp_disable'] == true ) return false;
1515
-
1516
- return true;
1517
  }
1518
 
1519
- function template_redirect() {
1520
- global $aioseop_options;
1521
-
1522
- $post = $this->get_queried_object();
1523
-
1524
- if ( !$this->is_page_included() ) return;
1525
-
1526
- if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
1527
- $force_rewrites = 1;
1528
- if ( isset( $aioseop_options['aiosp_force_rewrites'] ) )
1529
- $force_rewrites = $aioseop_options['aiosp_force_rewrites'];
1530
- if ( $force_rewrites )
1531
- ob_start( array( $this, 'output_callback_for_title' ) );
1532
- else
1533
- add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
 
 
 
 
1534
  }
1535
- }
1536
 
1537
- function output_callback_for_title( $content ) {
1538
- return $this->rewrite_title( $content );
1539
  }
1540
 
1541
- function add_hooks() {
1542
- global $aioseop_options, $aioseop_update_checker;
1543
-
1544
- $role = get_role( 'administrator' );
1545
- if ( is_object( $role ) ) $role->add_cap( 'aiosp_manage_seo' );
1546
-
1547
- aioseop_update_settings_check();
1548
- add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
1549
- if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) )
1550
- add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 );
1551
-
1552
- if ( is_admin() ) {
1553
- add_action( 'admin_menu', array( $this, 'admin_menu' ) );
1554
- add_action( 'admin_head', array( $this, 'add_page_icon' ) );
1555
- add_action( 'admin_init', 'aioseop_addmycolumns', 1 );
1556
- add_action( 'admin_init', 'aioseop_handle_ignore_notice' );
1557
- if ( AIOSEOPPRO ){
1558
- if ( current_user_can( 'update_plugins' ) )
1559
- add_action( 'admin_notices', Array( $aioseop_update_checker, 'key_warning' ) );
1560
- add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, Array( $aioseop_update_checker, 'add_plugin_row' ) );
1561
  }
 
 
 
 
 
 
1562
  } else {
1563
- if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' )
1564
- remove_action( 'wp_head', 'rel_canonical' );
1565
- ////analytics
1566
- if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) )
1567
- add_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
1568
- add_filter( 'wp_list_pages', 'aioseop_list_pages' );
1569
- add_action( 'wp_head', array( $this, 'wp_head'), apply_filters( 'aioseop_wp_head_priority', 1 ) );
1570
- add_action( 'template_redirect', array( $this, 'template_redirect' ), 0 );
1571
- add_filter( 'wp_list_pages_excludes', 'aioseop_get_pages_start' );
1572
- add_filter( 'get_pages', 'aioseop_get_pages' );
1573
  }
1574
- }
1575
-
1576
- function is_static_front_page() {
1577
- if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) return $this->is_front_page;
1578
- $post = $this->get_queried_object();
1579
- $this->is_front_page = ( get_option( 'show_on_front' ) == 'page' && is_page() && !empty( $post ) && $post->ID == get_option( 'page_on_front' ) );
1580
- return $this->is_front_page;
1581
- }
1582
 
1583
- function is_static_posts_page() {
1584
- static $is_posts_page = null;
1585
- if ( $is_posts_page !== null ) return $is_posts_page;
1586
- $post = $this->get_queried_object();
1587
- $is_posts_page = ( get_option( 'show_on_front' ) == 'page' && is_home() && !empty( $post ) && $post->ID == get_option( 'page_for_posts' ) );
1588
- return $is_posts_page;
1589
  }
1590
 
1591
- function check_rewrite_handler() {
 
 
 
 
1592
  global $aioseop_options;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1593
 
1594
- $force_rewrites = 1;
1595
- if ( isset( $aioseop_options['aiosp_force_rewrites'] ) )
1596
- $force_rewrites = $aioseop_options['aiosp_force_rewrites'];
 
 
 
 
 
 
 
 
1597
 
1598
- if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) && $force_rewrites ) {
1599
- // make the title rewrite as short as possible
1600
- if (function_exists( 'ob_list_handlers' ) ) {
1601
- $active_handlers = ob_list_handlers();
1602
- } else {
1603
- $active_handlers = array();
1604
- }
1605
- if (sizeof($active_handlers) > 0 &&
1606
- $this->strtolower( $active_handlers[sizeof( $active_handlers ) - 1] ) ==
1607
- $this->strtolower( 'All_in_One_SEO_Pack::output_callback_for_title' ) ) {
1608
- ob_end_flush();
1609
- } else {
1610
- $this->log( "another plugin interfering?" );
1611
- // if we get here there *could* be trouble with another plugin :(
1612
- $this->ob_start_detected = true;
1613
- if ( $this->option_isset( "rewrite_titles" ) ) { // try alternate method -- pdb
1614
- $aioseop_options['aiosp_rewrite_titles'] = 0;
1615
- $force_rewrites = 0;
1616
- add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
1617
- }
1618
- if ( function_exists( 'ob_list_handlers' ) ) {
1619
- foreach ( ob_list_handlers() as $handler ) {
1620
- $this->log( "detected output handler $handler" );
1621
  }
1622
  }
1623
  }
1624
  }
 
 
1625
  }
1626
 
1627
- // handle prev / next links
1628
- function get_prev_next_links( $post = null ) {
1629
- $prev = $next = '';
1630
- $page = $this->get_page_number();
1631
- if ( is_home() || is_archive() || is_paged() ) {
1632
- global $wp_query;
1633
- $max_page = $wp_query->max_num_pages;
1634
- if ( $page > 1 )
1635
- $prev = get_previous_posts_page_link();
1636
- if ( $page < $max_page ) {
1637
- $paged = $GLOBALS['paged'];
1638
- if ( !is_single() ) {
1639
- if ( !$paged )
1640
- $paged = 1;
1641
- $nextpage = intval($paged) + 1;
1642
- if ( !$max_page || $max_page >= $nextpage )
1643
- $next = get_pagenum_link($nextpage);
1644
- }
1645
- }
1646
- } else if ( is_page() || is_single() ) {
1647
- $numpages = 1;
1648
- $multipage = 0;
1649
- $page = get_query_var('page');
1650
- if ( ! $page )
1651
- $page = 1;
1652
- if ( is_single() || is_page() || is_feed() )
1653
- $more = 1;
1654
- $content = $post->post_content;
1655
- if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
1656
- if ( $page > 1 )
1657
- $more = 1;
1658
- $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
1659
- $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
1660
- $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
1661
- // Ignore nextpage at the beginning of the content.
1662
- if ( 0 === strpos( $content, '<!--nextpage-->' ) )
1663
- $content = substr( $content, 15 );
1664
- $pages = explode('<!--nextpage-->', $content);
1665
- $numpages = count($pages);
1666
- if ( $numpages > 1 )
1667
- $multipage = 1;
1668
- }
1669
- if ( !empty( $page ) ) {
1670
- if ( $page > 1 )
1671
- $prev = _wp_link_page( $page - 1 );
1672
- if ( $page + 1 <= $numpages )
1673
- $next = _wp_link_page( $page + 1 );
1674
- }
1675
- if ( !empty( $prev ) ) {
1676
- $prev = $this->substr( $prev, 9, -2 );
1677
  }
1678
- if ( !empty( $next ) ) {
1679
- $next = $this->substr( $next, 9, -2 );
 
 
 
 
 
 
 
 
 
 
 
1680
  }
1681
  }
1682
- return Array( 'prev' => $prev, 'next' => $next );
1683
- }
1684
 
1685
- function get_google_authorship( $post ) {
1686
- global $aioseop_options;
1687
- $page = $this->get_page_number();
1688
- // handle authorship
1689
- $googleplus = $publisher = $author = '';
1690
 
1691
- if ( !empty( $post ) && isset( $post->post_author ) && empty( $aioseop_options['aiosp_google_disable_profile'] ) )
1692
- $googleplus = get_the_author_meta( 'googleplus', $post->post_author );
 
 
 
 
 
 
1693
 
1694
- if ( empty( $googleplus ) && !empty( $aioseop_options['aiosp_google_publisher'] ) )
1695
- $googleplus = $aioseop_options['aiosp_google_publisher'];
 
 
 
 
 
 
 
 
 
 
 
 
 
1696
 
1697
- if ( ( is_front_page() ) && ( $page < 2 ) ) {
1698
- if ( !empty( $aioseop_options['aiosp_google_publisher'] ) )
1699
- $publisher = $aioseop_options['aiosp_google_publisher'];
1700
 
1701
- if ( !empty( $aioseop_options["aiosp_google_author_advanced"] ) ) {
1702
- if ( empty( $aioseop_options["aiosp_google_enable_publisher"] ) ) {
1703
- $publisher = '';
1704
- } elseif ( !empty( $aioseop_options["aiosp_google_specify_publisher"] ) ) {
1705
- $publisher = $aioseop_options["aiosp_google_specify_publisher"];
 
 
 
 
 
 
 
 
1706
  }
 
1707
  }
1708
  }
1709
- if ( is_singular() && ( !empty( $googleplus ) ) )
1710
- $author = $googleplus;
1711
- else if ( !empty( $aioseop_options['aiosp_google_publisher'] ) )
1712
- $author = $aioseop_options['aiosp_google_publisher'];
1713
 
1714
- if ( !empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) {
1715
- if ( empty( $aioseop_options['aiosp_google_author_location'] ) )
1716
- $aioseop_options['aiosp_google_author_location'] = Array();
1717
- if ( is_front_page() && !in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) {
1718
- $author = '';
1719
- } else {
1720
- if ( in_array( 'all', $aioseop_options['aiosp_google_author_location'] ) ) {
1721
- if ( is_singular() && !is_singular( $aioseop_options['aiosp_google_author_location'] ) )
1722
- $author = '';
1723
- } else {
1724
- if ( !is_singular( $aioseop_options['aiosp_google_author_location'] ) )
1725
- $author = '';
1726
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
1727
  }
1728
  }
1729
 
1730
- return Array( 'publisher' => $publisher, 'author' => $author );
1731
  }
1732
 
1733
- function visibility_warning() {
1734
-
1735
- $aioseop_visibility_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
1736
-
1737
- if ( '0' == get_option('blog_public') && empty( $aioseop_visibility_notice_dismissed ) ) {
1738
-
1739
- printf( '
1740
- <div id="message" class="error notice is-dismissible aioseop-notice visibility-notice">
1741
- <p>
1742
- <strong>%1$s</strong>
1743
- %2$s
1744
-
1745
- </p>
1746
- </div>',
1747
- __( 'Warning: You\'re blocking access to search engines.', 'all-in-one-seo-pack' ),
1748
- sprintf( __( 'You can %s click here%s to go to your reading settings and toggle your blog visibility.', 'all-in-one-seo-pack' ), sprintf( '<a href="%s">', esc_url( admin_url( 'options-reading.php' ) ) ), '</a>' ));
1749
 
1750
- }elseif( '1' == get_option('blog_public') && !empty( $aioseop_visibility_notice_dismissed ) ){
1751
- delete_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1752
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1753
  }
1754
 
1755
- function woo_upgrade_notice() {
1756
-
1757
- $aioseop_woo_upgrade_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
1758
 
1759
- if ( class_exists( 'WooCommerce' ) && empty( $aioseop_woo_upgrade_notice_dismissed ) && current_user_can( 'manage_options' ) ) {
1760
 
1761
- printf( '
1762
- <div id="message" class="notice-info notice is-dismissible aioseop-notice woo-upgrade-notice">
1763
- <p>
1764
- <strong>%1$s</strong>
1765
- %2$s
1766
 
1767
- </p>
1768
- </div>',
1769
- __( 'We\'ve detected you\'re running WooCommerce.', 'all-in-one-seo-pack' ),
1770
- sprintf( __( '%s Upgrade%s to All in One SEO Pack Pro for increased SEO compatibility for your products.', 'all-in-one-seo-pack' ), sprintf( '<a target="_blank" href="%s">', esc_url( 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=woo' ) ), '</a>' ));
1771
 
1772
- }elseif( !class_exists( 'WooCommerce' ) && !empty( $aioseop_woo_upgrade_notice_dismissed ) ){
1773
- delete_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed' );
 
 
 
 
 
 
 
1774
  }
1775
- }
1776
 
1777
- function get_robots_meta() {
1778
- global $aioseop_options;
1779
- $opts = $this->meta_opts;
1780
- $page = $this->get_page_number();
1781
- $robots_meta = $tax_noindex = '';
1782
- if ( isset( $aioseop_options['aiosp_tax_noindex'] ) ) $tax_noindex = $aioseop_options['aiosp_tax_noindex'];
1783
 
1784
- if ( empty( $tax_noindex ) || !is_array( $tax_noindex) ) $tax_noindex = Array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1785
 
1786
- $aiosp_noindex = $aiosp_nofollow = $aiosp_noodp = $aiosp_noydir = '';
1787
- $noindex = "index";
1788
- $nofollow = "follow";
1789
- if ( ( is_category() && !empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( !is_category() && is_archive() && !is_tag() && !is_tax()
1790
- && ( ( is_date() && !empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && !empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
1791
- || ( is_tag() && !empty( $aioseop_options['aiosp_tags_noindex'] ) )
1792
- || ( is_search() && !empty( $aioseop_options['aiosp_search_noindex'] ) )
1793
- || ( is_404() && !empty( $aioseop_options['aiosp_404_noindex'] ) )
1794
- || ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) ) ) {
1795
- $noindex = 'noindex';
1796
- } elseif ( ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) ) {
1797
- $post_type = get_post_type();
1798
- if ( !empty( $opts ) ) {
1799
- $aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
1800
- $aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
1801
- $aiosp_noodp = htmlspecialchars( stripslashes( $opts['aiosp_noodp'] ) );
1802
- $aiosp_noydir = htmlspecialchars( stripslashes( $opts['aiosp_noydir'] ) );
1803
- }
1804
- if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || !empty( $aioseop_options['aiosp_cpostnoindex'] )
1805
- || !empty( $aioseop_options['aiosp_cpostnofollow'] ) || !empty( $aioseop_options['aiosp_cpostnoodp'] ) || !empty( $aioseop_options['aiosp_cpostnoydir'] )
1806
- || !empty( $aioseop_options['aiosp_paginated_noindex'] ) || !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) {
1807
- if ( ( $aiosp_noindex == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && ( ( $page > 1 ) ) ) ||
1808
- ( ( $aiosp_noindex == '' ) && ( !empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) ) )
1809
- $noindex = "noindex";
1810
- if ( ( $aiosp_nofollow == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && ( ( $page > 1 ) ) ) ||
1811
- ( ( $aiosp_nofollow == '' ) && ( !empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) ) ) )
1812
- $nofollow = "nofollow";
1813
- if ( ( $aiosp_noodp == 'on' ) || ( empty( $aiosp_noodp ) && ( !empty( $aioseop_options['aiosp_cpostnoodp'] ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoodp'] ) ) ) ) )
1814
- $aiosp_noodp = true;
1815
- else
1816
- $aiosp_noodp = false;
1817
- if ( ( $aiosp_noydir == 'on' ) || ( empty( $aiosp_noydir ) && ( !empty( $aioseop_options['aiosp_cpostnoydir'] ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoydir'] ) ) ) ) )
1818
- $aiosp_noydir = true;
1819
- else
1820
- $aiosp_noydir = false;
1821
  }
1822
  }
1823
- if ( !empty( $aioseop_options['aiosp_noodp'] ) && $aioseop_options['aiosp_noodp'] ) $aiosp_noodp = true;
1824
- if ( !empty( $aioseop_options['aiosp_noydir'] ) && $aioseop_options['aiosp_noydir'] ) $aiosp_noydir = true;
1825
- if ( $aiosp_noodp ) $nofollow .= ',noodp';
1826
- if ( $aiosp_noydir ) $nofollow .= ',noydir';
1827
- $robots_meta = $noindex . ',' . $nofollow;
1828
- if ( $robots_meta == 'index,follow' ) $robots_meta = '';
1829
- return $robots_meta;
1830
- }
1831
 
1832
- function get_main_description( $post = null ) {
1833
- global $aioseop_options;
1834
- $opts = $this->meta_opts;
1835
- $description = '';
1836
- if ( is_author() && $this->show_page_description() ) {
1837
- $description = $this->internationalize( get_the_author_meta( 'description' ) );
1838
- } 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 ) ) ) {
1839
- //$description = $this->get_post_description( $post );
1840
- //$description = $this->apply_cf_fields( $description );
1841
- if ( !(woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ){
1842
- $description = trim( ( $this->internationalize( get_post_meta( $post->ID, "_aioseop_description", true ) ) ) );
1843
- }
1844
- else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && !empty( $aioseop_options['aiosp_use_static_home_info'] ) ){
1845
- //$description = $this->get_aioseop_description( $post );
1846
- $description = trim( ( $this->internationalize( get_post_meta( $post->ID, "_aioseop_description", true ) ) ) );
1847
- }else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ){
1848
- $description = $this->get_aioseop_description( $post );
1849
  }
1850
- } else if ( is_front_page() ) {
1851
- $description = $this->get_aioseop_description( $post );
1852
- } else if ( is_single() || is_page() || is_attachment() || is_home() || $this->is_static_posts_page() ) {
1853
- $description = $this->get_aioseop_description( $post );
1854
- } else if ( ( is_category() || is_tag() || is_tax() ) && $this->show_page_description() ) {
1855
- if ( !empty( $opts ) && AIOSEOPPRO ) $description = $opts['aiosp_description'];
1856
- if ( empty( $description ) ) $description = term_description();
1857
- $description = $this->internationalize( $description );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1858
  }
1859
- if ( empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) {
1860
- $description = $this->trim_excerpt_without_filters( $description );
 
 
 
 
 
 
 
 
1861
  }
1862
- return $description;
1863
- }
1864
 
1865
- function trim_description( $description ) {
1866
- $description = trim( wp_strip_all_tags( $description ) );
1867
- $description = str_replace( '"', '&quot;', $description );
1868
- $description = str_replace( "\r\n", ' ', $description );
1869
- $description = str_replace( "\n", ' ', $description );
1870
- return $description;
1871
  }
1872
 
1873
- function apply_description_format( $description, $post = null ) {
1874
- global $aioseop_options;
1875
- $description_format = $aioseop_options['aiosp_description_format'];
1876
- if ( !isset( $description_format ) || empty( $description_format ) ) {
1877
- $description_format = "%description%";
1878
- }
1879
- $description = str_replace( '%description%', apply_filters( 'aioseop_description_override', $description ), $description_format );
1880
- if ( strpos( $description, '%blog_title%' ) !== false ) $description = str_replace( '%blog_title%', get_bloginfo( 'name' ), $description );
1881
- if ( strpos( $description, '%blog_description%' ) !== false ) $description = str_replace( '%blog_description%', get_bloginfo( 'description' ), $description );
1882
- if ( strpos( $description, '%wp_title%' ) !== false ) $description = str_replace( '%wp_title%', $this->get_original_title(), $description );
1883
- if ( strpos( $description, '%post_title%' ) !== false ) $description = str_replace( '%post_title%', $this->get_aioseop_title( $post ), $description );
1884
 
 
 
 
 
 
1885
 
1886
- /*this was intended to make attachment descriptions unique if pulling from the parent... let's remove it and see if there are any problems
1887
- *on the roadmap is to have a better hierarchy for attachment description pulling
1888
- * if ($aioseop_options['aiosp_can']) $description = $this->make_unique_att_desc($description);
1889
- */
 
 
 
 
 
 
 
 
1890
 
1891
- return $description;
1892
  }
1893
 
1894
- function make_unique_att_desc($description){
1895
- global $wp_query;
1896
- if( is_attachment() ) {
1897
-
1898
- $url = $this->aiosp_mrt_get_url( $wp_query );
1899
- if ( $url ) {
1900
- $matches = Array();
1901
- preg_match_all( '/(\d+)/', $url, $matches );
1902
- if ( is_array( $matches ) ){
1903
- $uniqueDesc = join( '', $matches[0] );
 
 
 
 
 
 
1904
  }
1905
  }
1906
- $description .= ' ' . $uniqueDesc;
1907
- return $description;
1908
- }
1909
- }
1910
 
1911
- function get_main_keywords() {
1912
- global $aioseop_options;
1913
- global $aioseop_keywords;
1914
- global $post;
1915
- $opts = $this->meta_opts;
1916
- if ( ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && !$this->is_static_posts_page() ) || $this->is_static_front_page() ) ) {
1917
- if ( !empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1918
- $keywords = $this->get_all_keywords();
1919
  } else {
1920
- $keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) );
1921
  }
1922
- } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) {
1923
- $keywords = stripslashes( $this->internationalize( $opts["aiosp_keywords"] ) ); // and if option = use page set keywords instead of keywords from recent posts
1924
- } elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
1925
- $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, "_aioseop_keywords", true ) ) );
1926
- } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) {
1927
- $keywords = "";
1928
- } else {
1929
- $keywords = $this->get_all_keywords();
1930
  }
1931
- return $keywords;
1932
- }
1933
 
1934
- function wp_head() {
1935
- if ( !$this->is_page_included() ) return;
1936
- $opts = $this->meta_opts;
1937
- global $aioseop_update_checker, $wp_query, $aioseop_options, $posts;
1938
- static $aioseop_dup_counter = 0;
1939
- $aioseop_dup_counter++;
1940
- if ( $aioseop_dup_counter > 1 ) {
1941
- echo "\n<!-- " . sprintf( __( "Debug Warning: All in One SEO Pack meta data was included again from %s filter. Called %s times!", 'all-in-one-seo-pack' ), current_filter(), $aioseop_dup_counter ) . " -->\n";
1942
- return;
1943
- }
1944
- if ( is_home() && !is_front_page() ) {
1945
- $post = aiosp_common::get_blog_page();
1946
- } else {
1947
- $post = $this->get_queried_object();
1948
  }
1949
- $meta_string = null;
1950
- $description = '';
1951
- // logging - rewrite handler check for output buffering
1952
- $this->check_rewrite_handler();
1953
- if ( AIOSEOPPRO ) {
1954
- echo "\n<!-- All in One SEO Pack Pro $this->version by Michael Torbert of Semper Fi Web Design";
1955
- } else {
1956
- echo "\n<!-- All in One SEO Pack $this->version by Michael Torbert of Semper Fi Web Design";
1957
- }
1958
- if ( $this->ob_start_detected )
1959
- echo "ob_start_detected ";
1960
- echo "[$this->title_start,$this->title_end] ";
1961
- echo "-->\n";
1962
- if ( AIOSEOPPRO ) echo "<!-- " . __( "Debug String", 'all-in-one-seo-pack' ) . ": " . $aioseop_update_checker->get_verification_code() . " -->\n";
1963
- $blog_page = aiosp_common::get_blog_page( $post );
1964
- $save_posts = $posts;
1965
- if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
1966
- global $posts;
1967
- $opts = $this->meta_opts = $this->get_current_options( Array(), 'aiosp', null, $post );
1968
- $posts = Array();
1969
- $posts[] = $post;
1970
- }
1971
- $posts = $save_posts;
1972
- $description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) ); // get the description
1973
- // handle the description format
1974
- if ( isset($description) && ( $this->strlen($description) > $this->minimum_description_length ) && !( is_front_page() && is_paged() ) ) {
1975
- $description = $this->trim_description( $description );
1976
- if ( !isset( $meta_string) ) $meta_string = '';
1977
- // description format
1978
- $description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) );
1979
- $desc_attr = '';
1980
- if ( !empty( $aioseop_options['aiosp_schema_markup'] ) )
1981
- $desc_attr = 'itemprop="description"';
1982
- $desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr );
1983
- $meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );
1984
- }
1985
- // get the keywords
1986
- $togglekeywords = 0;
1987
- if ( isset( $aioseop_options['aiosp_togglekeywords'] ) )
1988
- $togglekeywords = $aioseop_options['aiosp_togglekeywords'];
1989
- if ( $togglekeywords == 0 && !( is_front_page() && is_paged() ) ) {
1990
- $keywords = $this->get_main_keywords();
1991
- $keywords = $this->apply_cf_fields( $keywords );
1992
- $keywords = apply_filters( 'aioseop_keywords', $keywords );
1993
-
1994
- if ( isset( $keywords ) && !empty( $keywords ) ) {
1995
- if ( isset( $meta_string ) ) $meta_string .= "\n";
1996
- $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
1997
- $key_attr = '';
1998
- if ( !empty( $aioseop_options['aiosp_schema_markup'] ) )
1999
- $key_attr = 'itemprop="keywords"';
2000
- $key_attr = apply_filters( 'aioseop_keywords_attributes', $key_attr );
2001
- $meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
2002
- }
2003
- }
2004
- // handle noindex, nofollow - robots meta
2005
- $robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
2006
- if ( !empty( $robots_meta ) )
2007
- $meta_string .= '<meta name="robots" content="' . esc_attr( $robots_meta ) . '" />' . "\n";
2008
- // handle site verification
2009
- if ( is_front_page() ) {
2010
- foreach( Array( 'google' => 'google-site-verification', 'bing' => 'msvalidate.01', 'pinterest' => 'p:domain_verify' ) as $k => $v )
2011
- if ( !empty( $aioseop_options["aiosp_{$k}_verify"] ) )
2012
- $meta_string .= '<meta name="' . $v . '" content="' . trim( strip_tags( $aioseop_options["aiosp_{$k}_verify"] ) ) . '" />' . "\n";
2013
-
2014
- // sitelinks search
2015
- if ( !empty( $aioseop_options["aiosp_google_sitelinks_search"] ) || !empty( $aioseop_options["aiosp_google_set_site_name"] ) )
2016
- $meta_string .= $this->sitelinks_search_box() . "\n";
2017
- }
2018
- // handle extra meta fields
2019
- foreach( Array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) {
2020
- if ( !empty( $aioseop_options["aiosp_{$meta}_tags" ] ) )
2021
- $$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags" ] ), ENT_QUOTES );
2022
- else
2023
- $$meta = '';
2024
- }
2025
- if ( is_page() && isset( $page_meta ) && !empty( $page_meta ) && ( !is_front_page() || empty( $front_meta ) ) ) {
2026
- if ( isset( $meta_string ) ) $meta_string .= "\n";
2027
- $meta_string .= $page_meta;
2028
- }
2029
- if ( is_single() && isset( $post_meta ) && !empty( $post_meta ) ) {
2030
- if ( isset( $meta_string ) ) $meta_string .= "\n";
2031
- $meta_string .= $post_meta;
2032
- }
2033
- // handle authorship
2034
- $authorship = $this->get_google_authorship( $post );
2035
- $publisher = apply_filters( 'aioseop_google_publisher', $authorship["publisher"] );
2036
- if ( !empty( $publisher ) )
2037
- $meta_string = '<link rel="publisher" href="' . esc_url( $publisher ) . '" />' . "\n" . $meta_string;
2038
- $author = apply_filters( 'aioseop_google_author', $authorship["author"] );
2039
- if ( !empty( $author ) )
2040
- $meta_string = '<link rel="author" href="' . esc_url( $author ) . '" />' . "\n" . $meta_string;
2041
-
2042
- if ( is_front_page() && !empty( $front_meta ) ) {
2043
- if ( isset( $meta_string ) ) $meta_string .= "\n";
2044
- $meta_string .= $front_meta;
2045
- } else {
2046
- if ( is_home() && !empty( $home_meta ) ) {
2047
- if ( isset( $meta_string ) ) $meta_string .= "\n";
2048
- $meta_string .= $home_meta;
2049
- }
2050
- }
2051
- $prev_next = $this->get_prev_next_links( $post );
2052
- $prev = apply_filters( 'aioseop_prev_link', $prev_next['prev'] );
2053
- $next = apply_filters( 'aioseop_next_link', $prev_next['next'] );
2054
- if ( !empty( $prev ) ) $meta_string .= "<link rel='prev' href='" . esc_url( $prev ) . "' />\n";
2055
- if ( !empty( $next ) ) $meta_string .= "<link rel='next' href='" . esc_url( $next ) . "' />\n";
2056
- if ( $meta_string != null ) echo "$meta_string\n";
2057
- // handle canonical links
2058
- $show_page = true;
2059
- if ( !empty( $aioseop_options["aiosp_no_paged_canonical_links"] ) ) $show_page = false;
2060
-
2061
- if ( $aioseop_options['aiosp_can'] ) {
2062
- $url = '';
2063
- if ( !empty( $aioseop_options['aiosp_customize_canonical_links'] ) && !empty( $opts['aiosp_custom_link'] ) ) $url = $opts['aiosp_custom_link'];
2064
- if ( empty( $url ) )
2065
- $url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
2066
- $url = apply_filters( 'aioseop_canonical_url', $url );
2067
- if ( !empty( $url ) )
2068
- echo '<link rel="canonical" href="'. esc_url( $url ) . '" />'."\n";
2069
- }
2070
- do_action( 'aioseop_modules_wp_head' );
2071
- if ( AIOSEOPPRO ) {
2072
- echo "<!-- /all in one seo pack pro -->\n";
2073
- } else{
2074
- echo "<!-- /all in one seo pack -->\n";
2075
  }
2076
- }
2077
-
2078
- function override_options( $options, $location, $settings ) {
2079
- if ( class_exists( 'DOMDocument' ) ) {
2080
- $options['aiosp_google_connect'] = $settings['aiosp_google_connect']['default'];
2081
  }
2082
- return $options;
2083
  }
2084
 
2085
- function get_analytics_domain() {
2086
- global $aioseop_options;
2087
- if ( !empty( $aioseop_options['aiosp_ga_domain'] ) )
2088
- return $this->sanitize_domain( $aioseop_options['aiosp_ga_domain'] );
2089
- return '';
2090
- }
 
 
 
 
2091
 
2092
- function universal_analytics() {
2093
- global $aioseop_options;
2094
- $analytics = '';
2095
- if ( !empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) {
2096
- $allow_linker = $cookie_domain = $domain = $addl_domains = $domain_list = '';
2097
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) )
2098
- $cookie_domain = $this->get_analytics_domain();
2099
- if ( !empty( $cookie_domain ) ) {
2100
- $cookie_domain = esc_js( $cookie_domain );
2101
- $cookie_domain = "'cookieDomain': '{$cookie_domain}'";
2102
  }
2103
- if ( empty( $cookie_domain ) ) {
2104
- $domain = ", 'auto'";
 
2105
  }
2106
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
2107
- $allow_linker = "'allowLinker': true";
2108
- if ( !empty( $aioseop_options['aiosp_ga_addl_domains'] ) ) {
2109
- $addl_domains = trim( $aioseop_options['aiosp_ga_addl_domains'] );
2110
- $addl_domains = preg_split('/[\s,]+/', $addl_domains);
2111
- if ( !empty( $addl_domains ) ) {
2112
- foreach( $addl_domains as $d ) {
2113
- $d = $this->sanitize_domain( $d );
2114
- if ( !empty( $d ) ) {
2115
- if ( !empty( $domain_list ) )
2116
- $domain_list .= ", ";
2117
- $domain_list .= "'" . $d . "'";
2118
- }
2119
- }
2120
- }
2121
  }
2122
  }
2123
- $extra_options = '';
2124
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
2125
- $extra_options .= "ga('require', 'displayfeatures');";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2126
  }
2127
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_enhanced_ecommerce'] ) ) {
2128
- if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t";
2129
- $extra_options .= "ga('require', 'ec');";
 
 
2130
  }
2131
- if ( !empty( $domain_list ) ) {
2132
- if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t";
2133
- $extra_options .= "ga('require', 'linker');\n\t\t\tga('linker:autoLink', [{$domain_list}] );";
2134
  }
2135
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
2136
- if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t";
2137
- $extra_options .= "ga('require', 'linkid', 'linkid.js');";
 
 
 
 
 
 
 
 
 
 
 
2138
  }
 
2139
 
2140
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
2141
- if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t";
2142
- $extra_options .= "ga('set', 'anonymizeIp', true);";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2143
  }
2144
- $js_options = Array();
2145
- foreach( Array( 'cookie_domain', 'allow_linker' ) as $opts ) {
2146
- if ( !empty( $$opts ) ) $js_options[] = $$opts;
2147
  }
2148
- if ( !empty( $js_options ) ) {
2149
- $js_options = join( ',', $js_options );
2150
- $js_options = ', { ' . $js_options . ' } ';
2151
- } else $js_options = '';
2152
- $analytics_id = esc_js( $aioseop_options["aiosp_google_analytics_id"] );
2153
- $analytics =<<<EOF
2154
- <script>
2155
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2156
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
2157
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
2158
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
2159
 
2160
- ga('create', '{$analytics_id}'{$domain}{$js_options});
2161
- {$extra_options}
2162
- ga('send', 'pageview');
2163
- </script>
2164
 
2165
- EOF;
 
 
 
 
 
 
2166
  }
2167
- return $analytics;
2168
- }
2169
 
2170
- function aiosp_google_analytics() {
2171
- global $aioseop_options;
2172
- $analytics = '';
2173
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_exclude_users'] ) ) {
2174
- if ( is_user_logged_in() ) {
2175
- global $current_user;
2176
- if ( empty( $current_user ) ) wp_get_current_user();
2177
- if ( !empty( $current_user ) ) {
2178
- $intersect = array_intersect( $aioseop_options['aiosp_ga_exclude_users'], $current_user->roles );
2179
- if ( !empty( $intersect ) ) return;
2180
- }
2181
- }
2182
- }
2183
- if ( !empty( $aioseop_options['aiosp_google_analytics_id'] ) ) {
2184
- ob_start();
2185
- $analytics = $this->universal_analytics();
2186
- echo $analytics;
2187
- if ( empty( $analytics ) ) {
2188
- ?> <script type="text/javascript">
2189
- var _gaq = _gaq || [];
2190
- <?php if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
2191
- ?> var pluginUrl =
2192
- '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
2193
- _gaq.push(['_require', 'inpage_linkid', pluginUrl]);
2194
- <?php
2195
- }
2196
- ?> _gaq.push(['_setAccount', '<?php
2197
- echo $aioseop_options['aiosp_google_analytics_id'];
2198
- ?>']);
2199
- <?php if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
2200
- ?> _gaq.push(['_gat._anonymizeIp']);
2201
- <?php
2202
- }
2203
- ?>
2204
- <?php if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
2205
- ?> _gaq.push(['_setAllowLinker', true]);
2206
- <?php
2207
- }
2208
- ?>
2209
- <?php if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_domain'] ) ) {
2210
- $domain = $this->get_analytics_domain();
2211
- ?> _gaq.push(['_setDomainName', '<?php echo $domain; ?>']);
2212
- <?php
2213
- }
2214
- ?> _gaq.push(['_trackPageview']);
2215
- (function() {
2216
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
2217
- <?php
2218
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
2219
- ?> ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
2220
- <?php
2221
- } else {
2222
- ?> ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
2223
- <?php
2224
  }
2225
- ?> var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
2226
- })();
2227
- </script>
2228
- <?php
2229
  }
2230
- if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && $aioseop_options['aiosp_ga_track_outbound_links'] ) { ?>
2231
- <script type="text/javascript">
2232
- function recordOutboundLink(link, category, action) {
2233
- <?php if ( !empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { ?>
2234
- ga('send', 'event', category, action);
2235
- <?php }
2236
- if ( empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { ?>
2237
- _gat._getTrackerByName()._trackEvent(category, action);
2238
- <?php } ?>
2239
- if ( link.target == '_blank' ) return true;
2240
- setTimeout('document.location = "' + link.href + '"', 100);
2241
  return false;
2242
  }
2243
- /* use regular Javascript for this */
2244
- function getAttr(ele, attr) {
2245
- var result = (ele.getAttribute && ele.getAttribute(attr)) || null;
2246
- if( !result ) {
2247
- var attrs = ele.attributes;
2248
- var length = attrs.length;
2249
- for(var i = 0; i < length; i++)
2250
- if(attr[i].nodeName === attr) result = attr[i].nodeValue;
2251
- }
2252
- return result;
2253
- }
2254
-
2255
- function aiosp_addLoadEvent(func) {
2256
- var oldonload = window.onload;
2257
- if (typeof window.onload != 'function') {
2258
- window.onload = func;
2259
- } else {
2260
- window.onload = function() {
2261
- if (oldonload) {
2262
- oldonload();
2263
- }
2264
- func();
2265
- }
2266
- }
2267
- }
2268
-
2269
- function aiosp_addEvent(element, evnt, funct){
2270
- if (element.attachEvent)
2271
- return element.attachEvent('on'+evnt, funct);
2272
- else
2273
- return element.addEventListener(evnt, funct, false);
2274
- }
2275
-
2276
- aiosp_addLoadEvent(function () {
2277
- var links = document.getElementsByTagName('a');
2278
- for (var x=0; x < links.length; x++) {
2279
- if (typeof links[x] == 'undefined') continue;
2280
- aiosp_addEvent( links[x], 'onclick', function () {
2281
- var mydomain = new RegExp(document.domain, 'i');
2282
- href = getAttr(this, 'href');
2283
- if (href && href.toLowerCase().indexOf('http') === 0 && !mydomain.test(href)) {
2284
- recordOutboundLink(this, 'Outbound Links', href);
2285
- }
2286
- });
2287
- }
2288
- });
2289
- </script>
2290
- <?php
2291
  }
2292
- $analytics = ob_get_clean();
2293
- }
2294
- echo apply_filters( 'aiosp_google_analytics', $analytics );
2295
- }
2296
-
2297
- function sitelinks_search_box() {
2298
- global $aioseop_options;
2299
- $home_url = esc_url( get_home_url() );
2300
- $name_block = $search_block = '';
2301
- if ( !empty( $aioseop_options["aiosp_google_set_site_name"] ) ) {
2302
- if ( !empty( $aioseop_options["aiosp_google_specify_site_name"] ) ) {
2303
- $blog_name = $aioseop_options["aiosp_google_specify_site_name"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2304
  } else {
2305
- $blog_name = get_bloginfo( 'name' );
 
 
 
 
 
2306
  }
2307
- $blog_name = esc_attr( $blog_name );
2308
- $name_block=<<<EOF
2309
- "name": "{$blog_name}",
2310
- EOF;
2311
  }
2312
 
2313
- if ( !empty( $aioseop_options["aiosp_google_sitelinks_search"] ) ) {
2314
- $search_block=<<<EOF
2315
- "potentialAction": {
2316
- "@type": "SearchAction",
2317
- "target": "{$home_url}/?s={search_term}",
2318
- "query-input": "required name=search_term"
2319
- },
2320
- EOF;
2321
- }
2322
 
2323
- $search_box=<<<EOF
2324
- <script type="application/ld+json">
2325
- {
2326
- "@context": "http://schema.org",
2327
- "@type": "WebSite",
2328
- EOF;
2329
- if ( !empty( $name_block ) ) $search_box .= $name_block;
2330
- if ( !empty( $search_block ) ) $search_box .= $search_block;
2331
- $search_box.=<<<EOF
2332
- "url": "{$home_url}/"
2333
- }
2334
- </script>
2335
- EOF;
2336
- return apply_filters( 'aiosp_sitelinks_search_box', $search_box );
2337
- }
2338
 
2339
- function aiosp_mrt_get_url( $query, $show_page = true ) {
2340
- if ( $query->is_404 || $query->is_search )
2341
- return false;
2342
- $link = '';
2343
- $haspost = count( $query->posts ) > 0;
2344
- if ( get_query_var( 'm' ) ) {
2345
- $m = preg_replace( '/[^0-9]/', '', get_query_var( 'm' ) );
2346
- switch ( $this->strlen( $m ) ) {
2347
- case 4: $link = get_year_link( $m ); break;
2348
- case 6: $link = get_month_link( $this->substr( $m, 0, 4), $this->substr($m, 4, 2 ) ); break;
2349
- case 8: $link = get_day_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ), $this->substr( $m, 6, 2 ) ); break;
2350
- default:
2351
- return false;
2352
  }
2353
- } elseif ( ( $query->is_home && (get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) ) {
2354
- $link = get_permalink( $pageid );
2355
- } elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || !get_option( 'page_for_posts' ) ) ) ) {
2356
- if ( function_exists( 'icl_get_home_url' ) ) {
2357
- $link = icl_get_home_url();
2358
- } else {
2359
- $link = trailingslashit( home_url() );
2360
  }
2361
- } elseif ( ( $query->is_single || $query->is_page ) && $haspost ) {
2362
- $post = $query->posts[0];
2363
- $link = get_permalink( $post->ID );
2364
- } elseif ( $query->is_author && $haspost ) {
2365
- $author = get_userdata( get_query_var( 'author' ) );
2366
- if ($author === false) return false;
2367
- $link = get_author_posts_url( $author->ID, $author->user_nicename );
2368
- } elseif ( $query->is_category && $haspost ) {
2369
- $link = get_category_link( get_query_var( 'cat' ) );
2370
- } elseif ( $query->is_tag && $haspost ) {
2371
- $tag = get_term_by( 'slug', get_query_var( 'tag' ), 'post_tag' );
2372
- if ( !empty( $tag->term_id ) )
2373
- $link = get_tag_link( $tag->term_id );
2374
- } elseif ( $query->is_day && $haspost ) {
2375
- $link = get_day_link( get_query_var( 'year' ),
2376
- get_query_var( 'monthnum' ),
2377
- get_query_var( 'day' ) );
2378
- } elseif ( $query->is_month && $haspost ) {
2379
- $link = get_month_link( get_query_var( 'year' ),
2380
- get_query_var( 'monthnum' ) );
2381
- } elseif ( $query->is_year && $haspost ) {
2382
- $link = get_year_link( get_query_var( 'year' ) );
2383
- } elseif ( $query->is_tax && $haspost ) {
2384
- $taxonomy = get_query_var( 'taxonomy' );
2385
- $term = get_query_var( 'term' );
2386
- if ( !empty( $term ) )
2387
- $link = get_term_link( $term, $taxonomy );
2388
- } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
2389
- if ( is_array( $post_type ) )
2390
- $post_type = reset( $post_type );
2391
- $link = get_post_type_archive_link( $post_type );
2392
- } else {
2393
- return false;
2394
- }
2395
- if ( empty( $link ) || !is_string( $link ) ) return false;
2396
- if ( apply_filters( 'aioseop_canonical_url_pagination', $show_page ) )
2397
- $link = $this->get_paged( $link );
2398
- if ( !empty( $link ) ) {
2399
- global $aioseop_options;
2400
- if ( !empty( $aioseop_options['aiosp_can_set_protocol'] ) && ( $aioseop_options['aiosp_can_set_protocol'] != 'auto' ) ) {
2401
- if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) {
2402
- $link = preg_replace("/^https:/i", "http:", $link );
2403
- } elseif ( $aioseop_options['aiosp_can_set_protocol'] == 'https' ) {
2404
- $link = preg_replace("/^http:/i", "https:", $link );
2405
  }
2406
  }
 
 
2407
  }
2408
- return $link;
 
 
 
 
 
2409
  }
2410
 
2411
- function get_page_number() {
2412
- $page = get_query_var( 'page' );
2413
- if ( empty( $page ) )
2414
- $page = get_query_var( 'paged' );
2415
- return $page;
 
 
2416
  }
2417
 
2418
- function get_paged( $link ) {
2419
- global $wp_rewrite;
2420
- $page = $this->get_page_number();
2421
- $page_name = 'page';
2422
- if ( !empty( $wp_rewrite ) && !empty( $wp_rewrite->pagination_base ) ) $page_name = $wp_rewrite->pagination_base;
2423
- if ( !empty( $page ) && $page > 1 ) {
2424
- if ( get_query_var( 'page' ) == $page )
2425
- $link = trailingslashit( $link ) . "$page";
2426
- else
2427
- $link = trailingslashit( $link ) . trailingslashit( $page_name ) . $page;
2428
- $link = user_trailingslashit( $link, 'paged' );
 
 
 
 
 
 
2429
  }
2430
- return $link;
2431
- }
2432
 
2433
- function is_singular( $post_types = Array(), $post = null ) {
2434
- if ( !empty( $post_types ) && is_object( $post ) )
2435
- return in_array( $post->post_type, (array)$post_types );
2436
- else
2437
- return is_singular( $post_types );
2438
  }
2439
 
2440
- function show_page_description() {
2441
- global $aioseop_options;
2442
- if ( !empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
2443
- $page = $this->get_page_number();
2444
- if ( !empty( $page ) && ( $page > 1 ) )
2445
- return false;
2446
- }
2447
- return true;
 
 
 
 
 
 
 
 
 
 
2448
  }
2449
 
2450
- function get_post_description( $post ) {
2451
- global $aioseop_options;
2452
- $description = '';
2453
- if ( !$this->show_page_description() ) {
2454
- return '';
2455
- }
2456
- $description = trim( ( $this->internationalize( get_post_meta( $post->ID, "_aioseop_description", true ) ) ) );
2457
- if ( !empty( $post ) && post_password_required( $post ) ) {
2458
- return $description;
 
 
 
 
2459
  }
2460
- if ( !$description ) {
2461
- if ( empty( $aioseop_options["aiosp_skip_excerpt"] ) )
2462
- $description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) );
2463
- if ( !$description && $aioseop_options["aiosp_generate_descriptions"] ) {
2464
- $content = $post->post_content;
2465
- if ( !empty( $aioseop_options["aiosp_run_shortcodes"] ) ) $content = do_shortcode( $content );
2466
- $content = wp_strip_all_tags( $content );
2467
- $description = $this->trim_excerpt_without_filters( $this->internationalize( $content ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2468
  }
 
 
 
 
 
2469
  }
2470
-
2471
- // "internal whitespace trim"
2472
- $description = preg_replace( "/\s\s+/u", " ", $description );
2473
- return $description;
2474
  }
2475
 
 
2476
 
2477
- function get_aioseop_description( $post = null ) {
2478
- global $aioseop_options;
2479
- if ( $post === null )
2480
- $post = $GLOBALS["post"];
2481
- $blog_page = aiosp_common::get_blog_page();
2482
- $description = '';
2483
- if ( is_front_page() && empty( $aioseop_options['aiosp_use_static_home_info'] ) )
2484
- $description = trim( ( $this->internationalize( $aioseop_options['aiosp_home_description'] ) ) );
2485
- elseif ( !empty( $blog_page ) )
2486
- $description = $this->get_post_description( $blog_page );
2487
- if ( empty( $description ) && is_object( $post ) && !is_archive() && empty( $blog_page ) )
2488
- $description = $this->get_post_description( $post );
2489
- $description = $this->apply_cf_fields( $description );
2490
- return $description;
2491
- }
2492
 
2493
- function replace_title( $content, $title ) {
2494
- //We can probably improve this... I'm not sure half of this is even being used.
2495
- $title = trim( strip_tags( $title ) );
2496
- $title_tag_start = "<title";
2497
- $title_tag_end = "</title";
2498
- $start = $this->strpos( $content, $title_tag_start );
2499
- $end = $this->strpos( $content, $title_tag_end );
2500
- $this->title_start = $start;
2501
- $this->title_end = $end;
2502
- $this->orig_title = $title;
 
 
2503
 
2504
- return preg_replace( '/<title([^>]*?)\s*>([^<]*?)<\/title\s*>/is', '<title\\1>' . preg_replace('/(\$|\\\\)(?=\d)/', '\\\\\1', strip_tags( $title ) ) . '</title>', $content, 1 );
 
 
2505
  }
2506
 
2507
- function internationalize( $in ) {
2508
- if ( function_exists( 'langswitch_filter_langs_with_message' ) )
2509
- $in = langswitch_filter_langs_with_message( $in );
2510
 
2511
- if ( function_exists( 'polyglot_filter' ) )
2512
- $in = polyglot_filter( $in );
2513
 
2514
- if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
2515
- $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
2516
- } elseif ( function_exists( 'ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
2517
- $in = ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
2518
- } elseif ( function_exists( 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
2519
- $in = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
2520
- }
 
 
 
 
 
2521
 
2522
- return apply_filters( 'localization', $in );
 
 
2523
  }
2524
 
2525
- /** @return The original title as delivered by WP (well, in most cases) */
2526
- function get_original_title( $sep = '|', $echo = false, $seplocation = '' ) {
2527
- global $aioseop_options;
2528
- if ( !empty( $aioseop_options['aiosp_use_original_title'] ) ) {
2529
- $has_filter = has_filter( 'wp_title', Array( $this, 'wp_title' ) );
2530
- if ( $has_filter !== false )
2531
- remove_filter( 'wp_title', Array( $this, 'wp_title' ), $has_filter );
2532
- if ( current_theme_supports( 'title-tag' ) ) {
2533
- $sep = '|';
2534
- $echo = false;
2535
- $seplocation = 'right';
 
 
 
 
 
2536
  }
2537
- $title = wp_title( $sep, $echo, $seplocation );
2538
- if ( $has_filter !== false )
2539
- add_filter( 'wp_title', Array( $this, 'wp_title' ), $has_filter );
2540
- if ( $title && ( $title = trim( $title ) ) )
2541
- return trim( $title );
2542
  }
2543
 
2544
- // the_search_query() is not suitable, it cannot just return
2545
- global $s;
2546
 
2547
- $title = null;
 
 
 
 
 
 
 
 
 
2548
 
2549
- if ( is_home() ) {
2550
- $title = get_option( 'blogname' );
2551
- } else if ( is_single() ) {
2552
- $title = $this->internationalize( single_post_title( '', false ) );
2553
- } else if ( is_search() && isset($s) && !empty($s) ) {
2554
- $search = esc_attr( stripslashes($s) );
2555
- if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
2556
- $search = $this->capitalize( $search );
2557
- $title = $search;
2558
- } else if ( ( is_tax() || is_category() ) && !is_feed() ) {
2559
- $category_name = $this->ucwords($this->internationalize( single_cat_title( '', false ) ) );
2560
- $title = $category_name;
2561
- } else if ( is_page() ) {
2562
- $title = $this->internationalize( single_post_title( '', false ) );
2563
- } else if ( is_tag() ) {
2564
- global $utw;
2565
- if ( $utw ) {
2566
- $tags = $utw->GetCurrentTagSet();
2567
- $tag = $tags[0]->tag;
2568
- $tag = str_replace('-', ' ', $tag);
2569
- } else {
2570
- // wordpress > 2.3
2571
- $tag = $this->internationalize( single_term_title( '', false ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2572
  }
2573
- if ( $tag ) $title = $tag;
2574
- } else if ( is_author() ) {
2575
- $author = get_userdata( get_query_var( 'author' ) );
2576
- if ( $author === false ) {
2577
- global $wp_query;
2578
- $author = $wp_query->get_queried_object();
2579
  }
2580
- if ($author !== false)
2581
- $title = $author->display_name;
2582
- } else if ( is_day() ) {
2583
- $title = get_the_date();
2584
- } else if ( is_month() ) {
2585
- $title = get_the_date( 'F, Y' );
2586
- } else if ( is_year() ) {
2587
- $title = get_the_date( 'Y' );
2588
- } else if ( is_archive() ) {
2589
- $title = $this->internationalize( post_type_archive_title( '', false) );
2590
- } else if ( is_404() ) {
2591
- $title_format = $aioseop_options['aiosp_404_title_format'];
2592
- $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
2593
- if ( strpos( $new_title, '%blog_description%' ) !== false ) $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2594
- if ( strpos( $new_title, '%request_url%' ) !== false ) $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title);
2595
- if ( strpos( $new_title, '%request_words%' ) !== false ) $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title );
2596
- $title = $new_title;
2597
  }
2598
- return trim( $title );
2599
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2600
 
2601
- function paged_title( $title ) {
2602
- // the page number if paged
2603
- global $paged;
2604
- global $aioseop_options;
2605
- // simple tagging support
2606
- global $STagging;
2607
- $page = get_query_var( 'page' );
2608
- if ( $paged > $page ) $page = $paged;
2609
- if ( is_paged() || ( isset($STagging) && $STagging->is_tag_view() && $paged ) || ( $page > 1 ) ) {
2610
- $part = $this->internationalize( $aioseop_options['aiosp_paged_format'] );
2611
- if ( isset( $part ) || !empty( $part ) ) {
2612
- $part = " " . trim( $part );
2613
- $part = str_replace( '%page%', $page, $part );
2614
- $this->log( "paged_title() [$title] [$part]" );
2615
- $title .= $part;
2616
  }
2617
  }
2618
- return $title;
2619
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2620
 
2621
- function get_tax_title_format( $tax = '' ) {
2622
- global $aioseop_options;
2623
- if ( AIOSEOPPRO ){
2624
- $title_format = '%taxonomy_title% | %blog_title%';
2625
- if ( is_category() ) {
2626
- $title_format = $aioseop_options['aiosp_category_title_format'];
2627
  } else {
2628
- $taxes = $aioseop_options['aiosp_taxactive'];
2629
- if ( empty( $tax ) )
2630
- $tax = get_query_var( 'taxonomy' );
2631
- if ( !empty( $aioseop_options["aiosp_{$tax}_tax_title_format"] ) )
2632
- $title_format = $aioseop_options["aiosp_{$tax}_tax_title_format"];
 
2633
  }
2634
- if ( empty( $title_format ) )
2635
- $title_format = '%category_title% | %blog_title%';
2636
- } else {
2637
- $title_format = '%category_title% | %blog_title%';
2638
- if ( !empty( $aioseop_options['aiosp_category_title_format'] ) )
2639
- $title_format = $aioseop_options['aiosp_category_title_format'];
2640
- return $title_format;
 
 
 
 
2641
  }
2642
- return $title_format;
2643
- }
2644
-
2645
- function apply_tax_title_format( $category_name, $category_description, $tax = '' ) {
2646
- if ( empty( $tax ) ) $tax = get_query_var( 'taxonomy' );
2647
- $title_format = $this->get_tax_title_format( $tax );
2648
- $title = str_replace( '%taxonomy_title%', $category_name, $title_format );
2649
- if ( strpos( $title, '%taxonomy_description%' ) !== false ) $title = str_replace( '%taxonomy_description%', $category_description, $title );
2650
- if ( strpos( $title, '%category_title%' ) !== false ) $title = str_replace( '%category_title%', $category_name, $title );
2651
- if ( strpos( $title, '%category_description%' ) !== false ) $title = str_replace( '%category_description%', $category_description, $title );
2652
- if ( strpos( $title, '%blog_title%' ) !== false ) $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title );
2653
- if ( strpos( $title, '%blog_description%' ) !== false ) $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
2654
- $title = wp_strip_all_tags( $title );
2655
- return $this->paged_title( $title );
2656
- }
2657
 
2658
- function get_tax_name( $tax ) {
2659
- global $aioseop_options;
2660
- if ( AIOSEOPPRO ){
2661
- $opts = $this->meta_opts;
2662
- if ( !empty( $opts ) )
2663
- $name = $opts['aiosp_title'];
2664
- } else {
2665
- $name = '';
2666
  }
2667
- if ( empty( $name ) ) $name = single_term_title( '', false );
2668
- //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??
2669
- // if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) )
2670
- // $name = $this->ucwords( $name );
2671
 
2672
- return $this->internationalize( $name );
2673
- }
 
 
 
 
 
 
2674
 
2675
- function get_tax_desc( $tax ) {
 
 
 
 
 
 
 
2676
  if ( AIOSEOPPRO ) {
2677
- $opts = $this->meta_opts;
2678
- if ( !empty( $opts ) )
2679
- $desc = $opts['aiosp_description'];
2680
  } else {
2681
- $desc = '';
2682
  }
2683
- if ( empty( $desc ) ) $desc = term_description( '', $tax );
2684
- return $this->internationalize( $desc );
2685
  }
2686
 
2687
- function get_tax_title( $tax = '' ) {
2688
- if ( AIOSEOPPRO ){
2689
- if ( empty( $this->meta_opts ) )
2690
- $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
 
 
 
 
 
2691
  }
2692
- if ( empty( $tax ) )
2693
- if ( is_category() )
2694
- $tax = 'category';
2695
- else
2696
- $tax = get_query_var( 'taxonomy' );
2697
- $name = $this->get_tax_name( $tax );
2698
- $desc = $this->get_tax_desc( $tax );
2699
- return $this->apply_tax_title_format( $name, $desc, $tax );
2700
- }
2701
 
2702
- function get_post_title_format( $title_type = 'post', $p = null ) {
2703
- global $aioseop_options;
2704
- if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) return false;
2705
- $title_format = "%{$title_type}_title% | %blog_title%";
2706
- if ( isset( $aioseop_options["aiosp_{$title_type}_title_format"] ) )
2707
- $title_format = $aioseop_options["aiosp_{$title_type}_title_format"];
2708
- if( !empty( $aioseop_options['aiosp_enablecpost'] ) && !empty( $aioseop_options['aiosp_cpostactive'] ) ) {
2709
- $wp_post_types = $aioseop_options['aiosp_cpostactive'];
2710
- if ( !empty( $aioseop_options["aiosp_cposttitles"] ) ) {
2711
- if ( ( ( $title_type == 'archive' ) && is_post_type_archive( $wp_post_types ) && $prefix = "aiosp_{$title_type}_" ) ||
2712
- ( ( $title_type == 'post' ) && $this->is_singular( $wp_post_types, $p ) && $prefix = "aiosp_" ) ) {
2713
- $post_type = get_post_type( $p );
2714
- if ( !empty( $aioseop_options["{$prefix}{$post_type}_title_format"] ) ) {
2715
- $title_format = $aioseop_options["{$prefix}{$post_type}_title_format"];
2716
- }
 
 
 
 
 
 
 
 
 
 
2717
  }
2718
  }
2719
  }
2720
- return $title_format;
2721
  }
2722
 
2723
- function get_archive_title_format() {
2724
- return $this->get_post_title_format( "archive" );
2725
- }
 
 
 
 
 
 
 
2726
 
2727
- function apply_archive_title_format( $title, $category = '' ) {
2728
- $title_format = $this->get_archive_title_format();
2729
- $r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' );
2730
- $d_title = array( $this->internationalize( get_bloginfo('name') ), $this->internationalize( get_bloginfo( 'description' ) ), post_type_archive_title( '', false ) );
2731
- $title = trim( str_replace( $r_title, $d_title, $title_format ) );
2732
- return $title;
2733
  }
2734
 
2735
- function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
2736
- if ( !empty( $post ) )
2737
- $authordata = get_userdata( $post->post_author );
2738
- else
2739
- $authordata = new WP_User();
2740
- $new_title = str_replace( "%blog_title%", $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
2741
- if ( strpos( $new_title, "%blog_description%" ) !== false ) $new_title = str_replace( "%blog_description%", $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2742
- if ( strpos( $new_title, "%{$type}_title%" ) !== false ) $new_title = str_replace( "%{$type}_title%", $title, $new_title );
2743
- if ( $type == 'post' ) {
2744
- if ( strpos( $new_title, "%category%" ) !== false ) $new_title = str_replace( "%category%", $category, $new_title );
2745
- if ( strpos( $new_title, "%category_title%" ) !== false ) $new_title = str_replace( "%category_title%", $category, $new_title );
2746
- if ( strpos( $new_title, "%tax_" ) && !empty( $post ) ) {
2747
- $taxes = get_object_taxonomies( $post, 'objects' );
2748
- if ( !empty( $taxes ) )
2749
- foreach( $taxes as $t )
2750
- if ( strpos( $new_title, "%tax_{$t->name}%" ) ) {
2751
- $terms = $this->get_all_terms( $post->ID, $t->name );
2752
- $term = '';
2753
- if ( count( $terms ) > 0 )
2754
- $term = $terms[0];
2755
- $new_title = str_replace( "%tax_{$t->name}%", $term, $new_title );
2756
- }
2757
- }
2758
  }
2759
- if ( strpos( $new_title, "%{$type}_author_login%" ) !== false ) $new_title = str_replace( "%{$type}_author_login%", $authordata->user_login, $new_title );
2760
- if ( strpos( $new_title, "%{$type}_author_nicename%" ) !== false ) $new_title = str_replace( "%{$type}_author_nicename%", $authordata->user_nicename, $new_title );
2761
- if ( strpos( $new_title, "%{$type}_author_firstname%" ) !== false ) $new_title = str_replace( "%{$type}_author_firstname%", $this->ucwords($authordata->first_name ), $new_title );
2762
- if ( strpos( $new_title, "%{$type}_author_lastname%" ) !== false ) $new_title = str_replace( "%{$type}_author_lastname%", $this->ucwords($authordata->last_name ), $new_title );
2763
- $title = trim( $new_title );
2764
- return $title;
2765
- }
2766
-
2767
- function apply_post_title_format( $title, $category = '', $p = null ) {
2768
- if ( $p === null ) {
2769
- global $post;
2770
- } else {
2771
- $post = $p;
2772
  }
2773
- $title_format = $this->get_post_title_format( 'post', $post );
2774
- return $this->title_placeholder_helper( $title, $post, 'post', $title_format, $category );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2775
  }
2776
 
2777
- function apply_page_title_format( $title, $p = null, $title_format = '' ) {
 
 
 
2778
  global $aioseop_options;
2779
- if ( $p === null ) {
2780
- global $post;
2781
- } else {
2782
- $post = $p;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2783
  }
2784
- if ( empty( $title_format ) )
2785
- $title_format = $aioseop_options['aiosp_page_title_format'];
2786
- return $this->title_placeholder_helper( $title, $post, 'page', $title_format );
 
 
 
 
 
 
 
 
 
 
 
 
2787
  }
2788
 
2789
- /*** Gets the title that will be used by AIOSEOP for title rewrites or returns false. ***/
2790
- function get_aioseop_title( $post ) {
 
 
2791
  global $aioseop_options;
2792
- // the_search_query() is not suitable, it cannot just return
2793
- global $s, $STagging;
2794
- $opts = $this->meta_opts;
2795
- if ( is_front_page() ) {
2796
- if ( !empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2797
- global $post;
2798
- if ( get_option( 'show_on_front' ) == 'page' && is_page() && $post->ID == get_option( 'page_on_front' ) ) {
2799
- $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
2800
- if ( !$title ) $title = $this->internationalize( $post->post_title );
2801
- if ( !$title ) $title = $this->internationalize( $this->get_original_title( '', false ) );
2802
- if ( !empty( $aioseop_options['aiosp_home_page_title_format'] ) )
2803
- $title = $this->apply_page_title_format( $title, $post, $aioseop_options['aiosp_home_page_title_format'] );
2804
- $title = $this->paged_title( $title );
2805
- $title = apply_filters( 'aioseop_home_page_title', $title );
2806
- }
2807
  } else {
2808
- $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
2809
- if ( !empty( $aioseop_options['aiosp_home_page_title_format'] ) )
2810
- $title = $this->apply_page_title_format( $title, null, $aioseop_options['aiosp_home_page_title_format'] );
2811
  }
2812
- if (empty( $title ) )
2813
- $title = $this->internationalize( get_option( 'blogname' ) ) . ' | ' . $this->internationalize( get_bloginfo( 'description' ) );
 
 
 
2814
 
2815
- global $post;
2816
- $post_id = $post->ID;
 
 
 
 
 
 
 
2817
 
2818
- if ( is_post_type_archive() && is_post_type_archive( 'product' ) && $post_id = woocommerce_get_page_id( 'shop' ) && $post = get_post( $post_id ) ){
2819
- $frontpage_id = get_option('page_on_front');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2820
 
2821
- if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && !empty( $aioseop_options['aiosp_use_static_home_info'] ) ){
2822
- $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
2823
- }
2824
- //$title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
2825
- if ( !$title ) $title = $this->internationalize( get_post_meta( $frontpage_id, "_aioseop_title", true ) ); //this is/was causing the first product to come through
2826
- if ( !$title ) $title = $this->internationalize( $post->post_title );
2827
- if ( !$title ) $title = $this->internationalize( $this->get_original_title( '', false ) );
2828
 
 
 
 
 
 
 
 
 
 
 
2829
 
 
 
 
2830
 
2831
- $title = $this->apply_page_title_format( $title, $post );
2832
- $title = $this->paged_title( $title );
2833
- $title = apply_filters( 'aioseop_title_page', $title );
2834
- return $title;
2835
 
 
 
 
2836
  }
2837
 
2838
- return $this->paged_title( $title ); //this is returned for woo
2839
- } else if ( is_attachment() ) {
2840
- if ( $post === null ) return false;
2841
- $title = get_post_meta( $post->ID, "_aioseop_title", true );
2842
- if ( empty( $title ) ) $title = $post->post_title;
2843
- if ( empty( $title ) ) $title = $this->get_original_title( '', false );
2844
- if ( empty( $title ) ) $title = get_the_title( $post->post_parent );
2845
- $title = apply_filters( 'aioseop_attachment_title', $this->internationalize( $this->apply_post_title_format( $title, '', $post ) ) );
2846
- return $title;
2847
- } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && !$this->is_static_posts_page() ) ) {
2848
- if ( $post === null ) return false;
2849
- if ( ( $this->is_static_front_page() ) && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) {
2850
- if ( !empty( $aioseop_options['aiosp_home_page_title_format'] ) )
2851
- $home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] );
2852
- //home title filter
2853
- return apply_filters( 'aioseop_home_page_title', $home_title );
2854
- } else {
2855
- $page_for_posts = '';
2856
- if ( is_home() )
2857
- $page_for_posts = get_option( 'page_for_posts' );
2858
- if ( $page_for_posts ) {
2859
- $title = $this->internationalize( get_post_meta( $page_for_posts, "_aioseop_title", true ) );
2860
- if ( !$title ) {
2861
- $post_page = get_post( $page_for_posts );
2862
- $title = $this->internationalize( $post_page->post_title );
2863
- }
2864
- } else {
2865
- $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
2866
- if ( !$title )
2867
- $title = $this->internationalize( $post->post_title );
2868
  }
2869
- if ( !$title )
2870
- $title = $this->internationalize( $this->get_original_title( '', false ) );
2871
-
2872
- $title = $this->apply_page_title_format( $title, $post );
2873
- $title = $this->paged_title( $title );
2874
- $title = apply_filters( 'aioseop_title_page', $title );
2875
- if ( $this->is_static_posts_page() )
2876
- $title = apply_filters( 'single_post_title', $title );
2877
- return $title;
2878
  }
2879
- } 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 ) ) ) {
2880
- //too far down? -mrt
2881
- $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
2882
- if ( !$title ) $title = $this->internationalize( $post->post_title );
2883
- if ( !$title ) $title = $this->internationalize( $this->get_original_title( '', false ) );
2884
- $title = $this->apply_page_title_format( $title, $post );
2885
- $title = $this->paged_title( $title );
2886
- $title = apply_filters( 'aioseop_title_page', $title );
2887
- return $title;
2888
- } else if ( is_single() ) {
2889
- // we're not in the loop :(
2890
- if ( $post === null ) return false;
2891
- $categories = $this->get_all_categories();
2892
- $category = '';
2893
- if ( count( $categories ) > 0 )
2894
- $category = $categories[0];
2895
- $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
2896
- if ( !$title ) {
2897
- $title = $this->internationalize( get_post_meta( $post->ID, "title_tag", true ) );
2898
- if ( !$title ) $title = $this->internationalize($this->get_original_title( '', false ) );
2899
  }
2900
- if ( empty( $title ) ) $title = $post->post_title;
2901
- if ( !empty( $title ) )
2902
- $title = $this->apply_post_title_format( $title, $category, $post );
2903
- $title = $this->paged_title( $title );
2904
- return apply_filters( 'aioseop_title_single', $title );
2905
- } else if ( is_search() && isset( $s ) && !empty( $s ) ) {
2906
- $search = esc_attr( stripslashes( $s ) );
2907
- if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
2908
- $search = $this->capitalize( $search );
2909
- $title_format = $aioseop_options['aiosp_search_title_format'];
2910
- $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
2911
- if ( strpos( $title, '%blog_description%' ) !== false ) $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
2912
- if ( strpos( $title, '%search%' ) !== false ) $title = str_replace( '%search%', $search, $title );
2913
- $title = $this->paged_title( $title );
2914
- return $title;
2915
- } else if ( is_tag() ) {
2916
- global $utw;
2917
- $tag = $tag_description = '';
2918
- if ( $utw ) {
2919
- $tags = $utw->GetCurrentTagSet();
2920
- $tag = $tags[0]->tag;
2921
- $tag = str_replace('-', ' ', $tag);
2922
  } else {
2923
- if ( AIOSEOPPRO ){
2924
- if ( !empty( $opts ) && !empty( $opts['aiosp_title'] ) ) $tag = $opts['aiosp_title'];
2925
- if ( !empty( $opts ) ) {
2926
- if ( !empty( $opts['aiosp_title'] ) ) $tag = $opts['aiosp_title'];
2927
- if ( !empty( $opts['aiosp_description'] ) ) $tag_description = $opts['aiosp_description'];
 
 
2928
  }
2929
  }
2930
- if ( empty( $tag ) ) $tag = $this->get_original_title( '', false );
2931
- if ( empty( $tag_description ) ) $tag_description = tag_description();
2932
- $tag = $this->internationalize( $tag );
2933
- $tag_description = $this->internationalize( $tag_description );
2934
- }
2935
- if ( $tag ) {
2936
- if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
2937
- $tag = $this->capitalize( $tag );
2938
- $title_format = $aioseop_options['aiosp_tag_title_format'];
2939
- $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo('name') ), $title_format );
2940
- if ( strpos( $title, '%blog_description%' ) !== false ) $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description') ), $title );
2941
- if ( strpos( $title, '%tag%' ) !== false ) $title = str_replace( '%tag%', $tag, $title );
2942
- if ( strpos( $title, '%tag_description%' ) !== false ) $title = str_replace( '%tag_description%', $tag_description, $title );
2943
- if ( strpos( $title, '%taxonomy_description%' ) !== false ) $title = str_replace( '%taxonomy_description%', $tag_description, $title );
2944
- $title = trim( wp_strip_all_tags( $title ) );
2945
- $title = str_replace( Array( '"', "\r\n", "\n" ), Array( '&quot;', ' ', ' ' ), $title );
2946
- $title = $this->paged_title( $title );
2947
- return $title;
2948
- }
2949
- } else if ( ( is_tax() || is_category() ) && !is_feed() ) {
2950
- return $this->get_tax_title();
2951
- } else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // simple tagging support
2952
- $tag = $STagging->search_tag;
2953
- if ( $tag ) {
2954
- if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
2955
- $tag = $this->capitalize($tag);
2956
- $title_format = $aioseop_options['aiosp_tag_title_format'];
2957
- $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name') ), $title_format);
2958
- if ( strpos( $title, '%blog_description%' ) !== false ) $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description') ), $title);
2959
- if ( strpos( $title, '%tag%' ) !== false ) $title = str_replace( '%tag%', $tag, $title );
2960
- $title = $this->paged_title( $title );
2961
- return $title;
2962
  }
2963
- } else if ( is_archive() || is_post_type_archive() ) {
2964
- if ( is_author() ) {
2965
- $author = $this->internationalize( $this->get_original_title( '', false ) );
2966
- $title_format = $aioseop_options['aiosp_author_title_format'];
2967
- $new_title = str_replace( '%author%', $author, $title_format );
2968
- } else if ( is_date() ) {
2969
- global $wp_query;
2970
- $date = $this->internationalize( $this->get_original_title( '', false ) );
2971
- $title_format = $aioseop_options['aiosp_date_title_format'];
2972
- $new_title = str_replace( '%date%', $date, $title_format );
2973
- $day = get_query_var( 'day' );
2974
- if ( empty( $day ) ) $day = '';
2975
- $new_title = str_replace( '%day%', $day, $new_title );
2976
- $monthnum = get_query_var( 'monthnum' );
2977
- $year = get_query_var( 'year' );
2978
- if ( empty( $monthnum ) || is_year() ) {
2979
- $month = '';
2980
- $monthnum = 0;
2981
- }
2982
- $month = date( "F", mktime( 0,0,0,(int)$monthnum,1,(int)$year ) );
2983
- $new_title = str_replace( '%monthnum%', $monthnum, $new_title );
2984
- if ( strpos( $new_title, '%month%' ) !== false ) $new_title = str_replace( '%month%', $month, $new_title );
2985
- if ( strpos( $new_title, '%year%' ) !== false ) $new_title = str_replace( '%year%', get_query_var( 'year' ), $new_title );
2986
- } else if ( is_post_type_archive() ) {
2987
- if ( empty( $title ) ) $title = $this->get_original_title( '', false );
2988
- $new_title = apply_filters( 'aioseop_archive_title', $this->apply_archive_title_format( $title ) );
2989
- } else return false;
2990
- $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $new_title );
2991
- if ( strpos( $new_title, '%blog_description%' ) !== false ) $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2992
- $title = trim( $new_title );
2993
- $title = $this->paged_title( $title );
2994
- return $title;
2995
- } else if ( is_404() ) {
2996
- $title_format = $aioseop_options['aiosp_404_title_format'];
2997
- $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name') ), $title_format );
2998
- if ( strpos( $new_title, '%blog_description%' ) !== false ) $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2999
- if ( strpos( $new_title, '%request_url%' ) !== false ) $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title );
3000
- if ( strpos( $new_title, '%request_words%' ) !== false ) $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title );
3001
- if ( strpos( $new_title, '%404_title%' ) !== false ) $new_title = str_replace( '%404_title%', $this->internationalize( $this->get_original_title( '', false ) ), $new_title );
3002
- return $new_title;
3003
- }
3004
- return false;
3005
- }
3006
-
3007
- /*** Used to filter wp_title(), get our title. ***/
3008
- function wp_title() {
3009
- global $aioseop_options;
3010
- $title = false;
3011
- $post = $this->get_queried_object();
3012
- if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
3013
- $title = $this->get_aioseop_title( $post );
3014
- $title = $this->apply_cf_fields( $title );
3015
  }
3016
 
3017
- if ( $title === false )
3018
- $title = $this->get_original_title();
3019
-
3020
- //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?
3021
- // The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums
3022
- // if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
3023
- // $title = $this->capitalize( $title );
3024
-
3025
- return apply_filters( 'aioseop_title', $title );
3026
- }
3027
-
3028
- /*** Used for forcing title rewrites. ***/
3029
- function rewrite_title($header) {
3030
- global $wp_query;
3031
- if (!$wp_query) {
3032
- $header .= "<!-- no wp_query found! -->\n";
3033
- return $header;
3034
- }
3035
- $title = $this->wp_title();
3036
- if ( !empty( $title ) )
3037
- $header = $this->replace_title( $header, $title );
3038
- return $header;
3039
  }
3040
 
3041
  /**
3042
- * @return User-readable nice words for a given request.
 
 
3043
  */
3044
- function request_as_words( $request ) {
3045
- $request = htmlspecialchars( $request );
3046
- $request = str_replace( '.html', ' ', $request );
3047
- $request = str_replace( '.htm', ' ', $request );
3048
- $request = str_replace( '.', ' ', $request );
3049
- $request = str_replace( '/', ' ', $request );
3050
- $request = str_replace( '-', ' ', $request );
3051
- $request_a = explode( ' ', $request );
3052
- $request_new = array();
3053
- foreach ( $request_a as $token ) {
3054
- $request_new[] = $this->ucwords( trim( $token ) );
3055
- }
3056
- $request = implode( ' ', $request_new );
3057
- return $request;
3058
- }
3059
-
3060
- function capitalize( $s ) {
3061
- $s = trim( $s );
3062
- $tokens = explode( ' ', $s );
3063
- while ( list( $key, $val ) = each( $tokens ) ) {
3064
- $tokens[ $key ] = trim( $tokens[ $key ] );
3065
- $tokens[ $key ] = $this->strtoupper( $this->substr( $tokens[$key], 0, 1 ) ) . $this->substr( $tokens[$key], 1 );
3066
- }
3067
- $s = implode( ' ', $tokens );
3068
- return $s;
3069
- }
3070
-
3071
- function trim_excerpt_without_filters( $text, $max = 0 ) {
3072
- $text = str_replace( ']]>', ']]&gt;', $text );
3073
- $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
3074
- $text = wp_strip_all_tags( $text );
3075
- // Treat other common word-break characters like a space
3076
- $text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text );
3077
- if ( !$max ) $max = $this->maximum_description_length;
3078
- $max_orig = $max;
3079
- $len = $this->strlen( $text2 );
3080
- if ( $max < $len ) {
3081
- if ( function_exists( 'mb_strrpos' ) ) {
3082
- $pos = mb_strrpos( $text2, ' ', -($len - $max) );
3083
- if ( $pos === false ) $pos = $max;
3084
- if ( $pos > $this->minimum_description_length ) {
3085
- $max = $pos;
3086
- } else {
3087
- $max = $this->minimum_description_length;
3088
  }
3089
- } else {
3090
- while( $text2[$max] != ' ' && $max > $this->minimum_description_length ) {
3091
- $max--;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3092
  }
3093
  }
3094
-
3095
- // probably no valid chars to break on?
3096
- if ( $len > $max_orig && $max < intval( $max_orig / 2 ) ) {
3097
- $max = $max_orig;
 
 
 
 
 
 
 
 
 
3098
  }
3099
  }
3100
- $text = $this->substr( $text, 0, $max );
3101
- return trim( $text );
3102
- }
3103
 
3104
- function trim_excerpt_without_filters_full_length( $text ) {
3105
- $text = str_replace( ']]>', ']]&gt;', $text );
3106
- $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
3107
- $text = wp_strip_all_tags( $text );
3108
- return trim( ( $text ) );
3109
  }
3110
 
3111
- function keyword_string_to_list( $keywords ) {
3112
- $traverse = Array();
3113
- $keywords_i = str_replace( '"', '', $keywords );
3114
- if (isset( $keywords_i ) && !empty( $keywords_i ) ) {
3115
- $traverse = explode( ',', $keywords_i );
3116
- }
3117
- return $traverse;
3118
- }
 
 
 
 
 
3119
 
3120
- function get_all_categories( $id = 0 ) {
3121
- $keywords = Array();
3122
- $categories = get_the_category( $id );
3123
- if ( !empty( $categories ) )
3124
- foreach ( $categories as $category )
3125
- $keywords[] = $this->internationalize( $category->cat_name );
3126
- return $keywords;
3127
- }
3128
 
3129
- function get_all_tags( $id = 0 ) {
3130
- $keywords = Array();
3131
- $tags = get_the_tags( $id );
3132
- if ( !empty( $tags ) && is_array( $tags) )
3133
- foreach ( $tags as $tag )
3134
- $keywords[] = $this->internationalize( $tag->name );
3135
- // Ultimate Tag Warrior integration
3136
- global $utw;
3137
- if ( $utw ) {
3138
- $tags = $utw->GetTagsForPost( $p );
3139
- if ( is_array( $tags ) )
3140
- foreach ( $tags as $tag ) {
3141
- $tag = $tag->tag;
3142
- $tag = str_replace( '_', ' ', $tag );
3143
- $tag = str_replace( '-', ' ', $tag );
3144
- $tag = stripslashes( $tag );
3145
- $keywords[] = $tag;
3146
- }
3147
- }
3148
- return $keywords;
3149
- }
3150
 
3151
- function get_all_terms( $id, $taxonomy ) {
3152
- $keywords = Array();
3153
- $terms = get_the_terms( $id, $taxonomy );
3154
- if ( !empty( $terms ) )
3155
- foreach ( $terms as $term )
3156
- $keywords[] = $this->internationalize( $term->name );
3157
- return $keywords;
3158
  }
3159
 
3160
  /**
3161
- * @return comma-separated list of unique keywords
 
 
 
 
3162
  */
3163
- function get_all_keywords() {
3164
- global $posts;
3165
- global $aioseop_options;
3166
- if ( is_404() ) return null;
3167
- // if we are on synthetic pages
3168
- 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() )
3169
- return null;
3170
- $keywords = array();
3171
- $opts = $this->meta_opts;
3172
- if ( !empty( $opts["aiosp_keywords"] ) ) {
3173
- $traverse = $this->keyword_string_to_list( $this->internationalize( $opts["aiosp_keywords"] ) );
3174
- if ( !empty( $traverse ) )
3175
- foreach ( $traverse as $keyword ) $keywords[] = $keyword;
3176
  }
3177
- if ( empty( $posts ) ) {
3178
- global $post;
3179
- $post_arr = Array( $post );
3180
- } else {
3181
- $post_arr = $posts;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3182
  }
3183
- if ( is_array( $post_arr ) ) {
3184
- $postcount = count( $post_arr );
3185
- foreach ( $post_arr as $p ) {
3186
- if ( $p ) {
3187
- $id = $p->ID;
3188
- if ( $postcount == 1 || !empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
3189
- // custom field keywords
3190
- $keywords_i = null;
3191
- $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, "_aioseop_keywords", true ) ) );
3192
- if ( is_attachment() ) {
3193
- $id = $p->post_parent;
3194
- if ( empty( $keywords_i ) )
3195
- $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, "_aioseop_keywords", true ) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3196
  }
3197
- $traverse = $this->keyword_string_to_list( $keywords_i );
3198
- if ( !empty( $traverse ) )
3199
- foreach ( $traverse as $keyword ) $keywords[] = $keyword;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3200
  }
3201
 
3202
- if ( !empty( $aioseop_options['aiosp_use_tags_as_keywords'] ) ) {
3203
- $keywords = array_merge( $keywords, $this->get_all_tags( $id ) );
 
 
 
 
 
 
 
 
 
 
3204
  }
3205
- // autometa
3206
- $autometa = stripslashes( get_post_meta( $id, 'autometa', true ) );
3207
- if ( isset( $autometa ) && !empty( $autometa ) ) {
3208
- $autometa_array = explode( ' ', $autometa );
3209
- foreach ( $autometa_array as $e )
3210
- $keywords[] = $e;
3211
- }
3212
 
3213
- if ( $aioseop_options['aiosp_use_categories'] && !is_page() ) {
3214
- $keywords = array_merge( $keywords, $this->get_all_categories( $id ) );
3215
- }
3216
- }
3217
- }
3218
- }
3219
- return $this->get_unique_keywords( $keywords );
3220
- }
3221
 
3222
- function clean_keyword_list( $keywords ) {
3223
- $small_keywords = array();
3224
- if ( !is_array( $keywords ) ) $keywords = $this->keyword_string_to_list( $keywords );
3225
- if ( !empty( $keywords ) )
3226
- foreach ( $keywords as $word ) {
3227
- $small_keywords[] = trim( $this->strtolower( $word ) );
 
 
 
 
 
 
 
 
 
3228
  }
3229
- return array_unique( $small_keywords );
 
 
3230
  }
3231
 
3232
- function get_unique_keywords($keywords) {
3233
- return implode( ',', $this->clean_keyword_list( $keywords ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3234
  }
3235
 
3236
- function log( $message ) {
3237
- if ( $this->do_log ) {
3238
- @error_log( date( 'Y-m-d H:i:s' ) . " " . $message . "\n", 3, $this->log_file );
 
 
 
 
3239
  }
 
 
3240
  }
3241
 
 
 
 
 
 
3242
  function save_post_data( $id ) {
3243
  $awmp_edit = $nonce = null;
3244
- if ( empty( $_POST ) ) return false;
3245
- if ( isset( $_POST[ 'aiosp_edit' ] ) ) $awmp_edit = $_POST['aiosp_edit'];
3246
- if ( isset( $_POST[ 'nonce-aioseop-edit' ] ) ) $nonce = $_POST['nonce-aioseop-edit'];
3247
-
3248
- if ( isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce') ) {
 
 
 
 
3249
 
3250
- $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' );
3251
- if ( !( !empty( $this->options['aiosp_can'] ) ) && ( !empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
3252
- unset( $optlist["custom_link"] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3253
  }
3254
- foreach ( $optlist as $f ) {
3255
  $field = "aiosp_$f";
3256
- if ( isset( $_POST[$field] ) ) $$field = $_POST[$field];
3257
- }
 
 
3258
 
3259
- $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' );
3260
- if ( !( !empty( $this->options['aiosp_can'] ) ) && ( !empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
3261
- unset( $optlist["custom_link"] );
 
 
 
 
 
 
 
 
 
 
 
3262
  }
3263
- foreach ( $optlist as $f )
3264
  delete_post_meta( $id, "_aioseop_{$f}" );
 
3265
 
3266
- if ( $this->is_admin() ) {
3267
- delete_post_meta($id, '_aioseop_sitemap_exclude' );
3268
- delete_post_meta($id, '_aioseop_disable' );
3269
- delete_post_meta($id, '_aioseop_disable_analytics' );
3270
  }
3271
 
3272
  foreach ( $optlist as $f ) {
3273
- $var = "aiosp_$f";
3274
  $field = "_aioseop_$f";
3275
- if ( isset( $$var ) && !empty( $$var ) )
3276
- add_post_meta( $id, $field, $$var );
3277
- }
3278
- if (isset( $aiosp_sitemap_exclude ) && !empty( $aiosp_sitemap_exclude ) && $this->is_admin() )
3279
- add_post_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
3280
- if (isset( $aiosp_disable ) && !empty( $aiosp_disable ) && $this->is_admin() ) {
3281
- add_post_meta( $id, '_aioseop_disable', $aiosp_disable );
3282
- if (isset( $aiosp_disable_analytics ) && !empty( $aiosp_disable_analytics ) )
3283
- add_post_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
3284
  }
3285
- }
 
 
 
 
 
 
 
 
 
3286
  }
3287
 
 
 
 
 
3288
  function display_tabbed_metabox( $post, $metabox ) {
3289
  $tabs = $metabox['args'];
3290
  echo '<div class="aioseop_tabs">';
3291
  $header = $this->get_metabox_header( $tabs );
3292
  echo $header;
3293
- $active = "";
3294
- foreach( $tabs as $m ) {
3295
- echo '<div id="'.$m['id'].'" class="aioseop_tab"' . $active . '>';
3296
- if ( !$active ) $active = ' style="display:none;"';
 
 
3297
  $m['args'] = $m['callback_args'];
3298
  $m['callback'][0]->{$m['callback'][1]}( $post, $m );
3299
  echo '</div>';
@@ -3301,129 +4690,225 @@ EOF;
3301
  echo '</div>';
3302
  }
3303
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3304
  function admin_bar_menu() {
3305
  global $wp_admin_bar, $aioseop_admin_menu, $aioseop_options, $post;
3306
 
3307
  $toggle = '';
3308
- if ( isset($_POST['aiosp_use_original_title']) && isset($_POST['aiosp_admin_bar']) ) $toggle = 'on';
3309
- if ( isset($_POST['aiosp_use_original_title']) && !isset($_POST['aiosp_admin_bar']) ) $toggle = 'off';
 
 
 
 
3310
 
3311
- if ( !empty( $aioseop_options['aiosp_admin_bar'] ) && $toggle != 'off' || isset($_POST['aiosp_admin_bar']) ) {
3312
  $menu_slug = plugin_basename( __FILE__ );
3313
 
3314
  $url = '';
3315
- if ( function_exists( 'menu_page_url' ) )
3316
- $url = menu_page_url( $menu_slug, 0 );
3317
- if ( empty( $url ) )
3318
- $url = esc_url( admin_url( 'admin.php?page=' . $menu_slug ) );
3319
-
3320
- $wp_admin_bar->add_menu( array( 'id' => AIOSEOP_PLUGIN_DIRNAME, 'title' => __( 'SEO', 'all-in-one-seo-pack' ), 'href' => $url ) );
3321
 
3322
- if ( current_user_can( 'update_plugins' ) && !AIOSEOPPRO ){
3323
- $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' ) ) );
3324
- // add_action( 'admin_bar_menu', array( $this, 'admin_bar_upgrade_menu' ), 1101 );
 
 
 
 
 
 
 
 
 
 
 
 
3325
  }
3326
 
3327
  $aioseop_admin_menu = 1;
3328
- if ( !is_admin() && !empty( $post ) ) {
3329
  $blog_page = aiosp_common::get_blog_page( $post );
3330
- if ( !empty( $blog_page ) ) $post = $blog_page;
3331
- $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' ) );
 
 
 
 
 
 
 
3332
  }
3333
  }
3334
  }
3335
 
3336
-
3337
-
 
3338
  function menu_order() {
3339
  return 5;
3340
  }
3341
 
 
 
 
3342
  function display_category_metaboxes( $tax ) {
3343
  $screen = 'edit-' . $tax->taxonomy;
3344
- ?><div id="poststuff">
3345
- <?php do_meta_boxes( '', 'advanced', $tax ); ?>
3346
- </div>
3347
- <?php
 
3348
  }
3349
 
 
 
 
3350
  function save_category_metaboxes( $id ) {
3351
  $awmp_edit = $nonce = null;
3352
- if ( isset( $_POST[ 'aiosp_edit' ] ) ) $awmp_edit = $_POST['aiosp_edit'];
3353
- if ( isset( $_POST[ 'nonce-aioseop-edit' ] ) ) $nonce = $_POST['nonce-aioseop-edit'];
 
 
 
 
3354
 
3355
- if ( isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce') ) {
3356
- $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' );
3357
- foreach ( $optlist as $f ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3358
  $field = "aiosp_$f";
3359
- if ( isset( $_POST[$field] ) ) $$field = $_POST[$field];
3360
- }
 
 
3361
 
3362
- $optlist = Array( 'keywords', 'description', 'title', 'custom_link', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' );
3363
- if ( !( !empty( $this->options['aiosp_can'] ) ) && ( !empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
3364
- unset( $optlist["custom_link"] );
 
 
 
 
 
 
 
 
 
 
 
3365
  }
3366
- foreach ( $optlist as $f )
3367
  delete_term_meta( $id, "_aioseop_{$f}" );
 
3368
 
3369
- if ( $this->is_admin() ) {
3370
- delete_term_meta($id, '_aioseop_sitemap_exclude' );
3371
- delete_term_meta($id, '_aioseop_disable' );
3372
- delete_term_meta($id, '_aioseop_disable_analytics' );
3373
  }
3374
 
3375
  foreach ( $optlist as $f ) {
3376
- $var = "aiosp_$f";
3377
  $field = "_aioseop_$f";
3378
- if ( isset( $$var ) && !empty( $$var ) )
3379
- add_term_meta( $id, $field, $$var );
3380
- }
3381
- if (isset( $aiosp_sitemap_exclude ) && !empty( $aiosp_sitemap_exclude ) && $this->is_admin() )
3382
- add_term_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
3383
- if (isset( $aiosp_disable ) && !empty( $aiosp_disable ) && $this->is_admin() ) {
3384
- add_term_meta( $id, '_aioseop_disable', $aiosp_disable );
3385
- if (isset( $aiosp_disable_analytics ) && !empty( $aiosp_disable_analytics ) )
3386
- add_term_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
 
 
 
3387
  }
3388
- }
3389
  }
3390
 
3391
  function admin_menu() {
3392
- $file = plugin_basename( __FILE__ );
3393
  $menu_name = __( 'All in One SEO', 'all-in-one-seo-pack' );
3394
 
3395
- $this->locations['aiosp']['default_options']['nonce-aioseop-edit']['default'] = wp_create_nonce('edit-aioseop-nonce');
3396
 
3397
  $custom_menu_order = false;
3398
  global $aioseop_options;
3399
- if ( !isset( $aioseop_options['custom_menu_order'] ) )
3400
  $custom_menu_order = true;
 
3401
 
3402
- $this->update_options( );
3403
 
3404
  $this->add_admin_pointers();
3405
- if ( !empty( $this->pointers ) )
3406
- foreach( $this->pointers as $k => $p )
3407
- if ( !empty( $p["pointer_scope"] ) && ( $p["pointer_scope"] == 'global' ) )
3408
- unset( $this->pointers[$k] );
 
 
 
3409
 
3410
  $donated = false;
3411
- 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' ) ) ) {
3412
- if ( isset( $_POST["aiosp_donate"] ) )
3413
- $donated = $_POST["aiosp_donate"];
3414
- if ( isset($_POST["Submit"] ) ) {
3415
- if ( isset( $_POST["aiosp_custom_menu_order"] ) )
3416
- $custom_menu_order = $_POST["aiosp_custom_menu_order"];
3417
- else
 
3418
  $custom_menu_order = false;
3419
- } else if ( ( isset($_POST["Submit_Default"] ) ) || ( ( isset($_POST["Submit_All_Default"] ) ) ) ) {
 
3420
  $custom_menu_order = true;
3421
  }
3422
  } else {
3423
- if ( isset( $this->options["aiosp_donate"] ) )
3424
- $donated = $this->options["aiosp_donate"];
3425
- if ( isset( $this->options["aiosp_custom_menu_order"] ) )
3426
- $custom_menu_order = $this->options["aiosp_custom_menu_order"];
 
 
3427
  }
3428
 
3429
  if ( $custom_menu_order ) {
@@ -3432,140 +4917,166 @@ EOF;
3432
  }
3433
 
3434
  if ( $donated ) {
3435
- // Thank you for your donation
3436
- $this->pointers['aioseop_donate'] = Array( 'pointer_target' => '#aiosp_donate_wrapper',
3437
- 'pointer_text' => '<h3>' . __( 'Thank you!', 'all-in-one-seo-pack' )
3438
- . '</h3><p>' . __( 'Thank you for your donation, it helps keep this plugin free and actively developed!', 'all-in-one-seo-pack' ) . '</p>'
3439
- );
 
3440
  }
3441
 
3442
- if ( !AIOSEOPPRO ){
3443
- if ( !empty( $this->pointers ) )
3444
- foreach( $this->pointers as $k => $p )
3445
- if ( !empty( $p["pointer_scope"] ) && ( $p["pointer_scope"] == 'global' ) )
3446
- unset( $this->pointers[$k] );
 
 
 
3447
 
3448
- $this->filter_pointers();
3449
  }
3450
 
3451
- if ( !empty( $this->options['aiosp_enablecpost'] ) && $this->options['aiosp_enablecpost'] ) {
3452
  if ( AIOSEOPPRO ) {
3453
- $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
3454
- if ( !empty( $this->options['aiosp_taxactive'] ) ) {
3455
- foreach( $this->options['aiosp_taxactive'] as $tax ) {
3456
- $this->locations['aiosp']['display'][] = 'edit-' . $tax;
3457
- add_action( "{$tax}_edit_form", Array( $this, 'display_category_metaboxes' ) );
3458
- add_action( "edited_{$tax}", Array( $this, 'save_category_metaboxes' ) );
 
3459
  }
3460
- }
3461
  } else {
3462
- if ( !empty( $this->options['aiosp_cpostactive'] ) ) {
3463
  $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
3464
  } else {
3465
- $this->locations['aiosp']['display'] = Array();
3466
  }
3467
  }
3468
  } else {
3469
- $this->locations['aiosp']['display'] = Array( 'post', 'page' );
3470
  }
3471
 
3472
 
3473
- add_menu_page( $menu_name, $menu_name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ) , $file, Array( $this, 'display_settings_page' ) );
 
 
 
3474
 
3475
- add_meta_box('aioseop-list', __( "Join Our Mailing List", 'all-in-one-seo-pack' ), array( 'aiosp_metaboxes', 'display_extra_metaboxes'), 'aioseop_metaboxes', 'normal', 'core');
3476
- if ( AIOSEOPPRO ){
3477
- add_meta_box('aioseop-about', __( "About", 'all-in-one-seo-pack' ), array( 'aiosp_metaboxes', 'display_extra_metaboxes'), 'aioseop_metaboxes', 'side', 'core');
 
 
 
 
 
 
3478
  } else {
3479
- add_meta_box('aioseop-about', "About <span class='Taha' style='float:right;'>Version <b>" . AIOSEOP_VERSION . "</b></span>", array( 'aiosp_metaboxes', 'display_extra_metaboxes'), 'aioseop_metaboxes', 'side', 'core');
 
 
 
3480
  }
3481
- add_meta_box('aioseop-support', __( "Support", 'all-in-one-seo-pack' ) . " <span class='Taha' style='float:right;'>" . __( "Version", 'all-in-one-seo-pack' ) . " <b>" . AIOSEOP_VERSION . "</b></span>", array( 'aiosp_metaboxes', 'display_extra_metaboxes'), 'aioseop_metaboxes', 'side', 'core');
 
 
 
3482
 
3483
- add_action( 'aioseop_modules_add_menus', Array( $this, 'add_menu' ), 5 );
3484
  do_action( 'aioseop_modules_add_menus', $file );
3485
 
3486
- $metaboxes = apply_filters( 'aioseop_add_post_metabox', Array() );
3487
 
3488
- if ( !empty( $metaboxes ) ) {
3489
  if ( $this->tabbed_metaboxes ) {
3490
- $tabs = Array();
3491
  $tab_num = 0;
3492
  foreach ( $metaboxes as $m ) {
3493
- if ( !isset( $tabs[ $m['post_type'] ] ) ) $tabs[ $m['post_type'] ] = Array();
 
 
3494
  $tabs[ $m['post_type'] ][] = $m;
3495
  }
3496
 
3497
- if ( !empty( $tabs ) ) {
3498
- foreach( $tabs as $p => $m ) {
3499
  $tab_num = count( $m );
3500
- $title = $m[0]['title'];
3501
- if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
 
 
3502
  if ( $tab_num <= 1 ) {
3503
- if ( !empty( $m[0]['callback_args']['help_link'] ) )
3504
- $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $m[0]['callback_args']['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . "</span></a>";
 
3505
  add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] );
3506
  } elseif ( $tab_num > 1 ) {
3507
- add_meta_box( $m[0]['id'] . '_tabbed', $title, Array( $this, 'display_tabbed_metabox' ), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m );
 
 
 
3508
  }
3509
  }
3510
  }
3511
  } else {
3512
  foreach ( $metaboxes as $m ) {
3513
  $title = $m['title'];
3514
- if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
3515
- if ( !empty( $m['help_link'] ) )
3516
- $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $m['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . "</span></a>";
 
 
 
3517
  add_meta_box( $m['id'], $title, $m['callback'], $m['post_type'], $m['context'], $m['priority'], $m['callback_args'] );
3518
  }
3519
  }
3520
  }
3521
  }
3522
 
3523
- function get_metabox_header( $tabs ) {
3524
- $header = '<ul class="aioseop_header_tabs hide">';
3525
- $active = ' active';
3526
- foreach( $tabs as $t ) {
3527
- if ( $active )
3528
- $title = __( 'Main Settings', 'all-in-one-seo-pack' );
3529
- else
3530
- $title = $t['title'];
3531
- $header .= '<li><label class="aioseop_header_nav"><a class="aioseop_header_tab' . $active . '" href="#'. $t['id'] .'">'.$title.'</a></label></li>';
3532
- $active = '';
3533
- }
3534
- $header .= '</ul>';
3535
- return $header;
3536
- }
3537
-
3538
  function set_menu_order( $menu_order ) {
3539
  $order = array();
3540
- $file = plugin_basename( __FILE__ );
3541
  foreach ( $menu_order as $index => $item ) {
3542
- if ( $item != $file ) $order[] = $item;
3543
- if ( $index == 0 ) $order[] = $file;
 
 
 
 
3544
  }
 
3545
  return $order;
3546
  }
3547
 
3548
  function display_settings_header() {
3549
  }
3550
- function display_settings_footer( ) {
 
3551
  }
3552
 
3553
- function display_right_sidebar( ) {
3554
  global $wpdb;
3555
 
3556
- if( !get_option( 'aioseop_options' ) ) {
3557
  $msg = "<div style='text-align:center;'><p><strong>Your database options need to be updated.</strong><em>(Back up your database before updating.)</em>
3558
  <FORM action='' method='post' name='aioseop-migrate-options'>
3559
  <input type='hidden' name='nonce-aioseop-migrate-options' value='" . wp_create_nonce( 'aioseop-migrate-nonce-options' ) . "' />
3560
  <input type='submit' name='aioseop_migrate_options' class='button-primary' value='Update Database Options'>
3561
  </FORM>
3562
  </p></div>";
3563
- aioseop_output_dismissable_notice( $msg, "", "error" );
3564
  }
3565
- ?>
3566
  <div class="aioseop_top">
3567
  <div class="aioseop_top_sidebar aioseop_options_wrapper">
3568
- <?php do_meta_boxes( 'aioseop_metaboxes', 'normal', Array( 'test' ) ); ?>
3569
  </div>
3570
  </div>
3571
  <style>
@@ -3575,51 +5086,64 @@ EOF;
3575
  </style>
3576
  <div class="aioseop_right_sidebar aioseop_options_wrapper">
3577
 
3578
- <div class="aioseop_sidebar">
3579
- <?php
3580
- do_meta_boxes( 'aioseop_metaboxes', 'side', Array( 'test' ) );
3581
- ?>
3582
- <script type="text/javascript">
3583
- //<![CDATA[
3584
- jQuery(document).ready( function($) {
3585
- // close postboxes that should be closed
3586
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
3587
- // postboxes setup
3588
- if ( typeof postboxes !== 'undefined' )
3589
- postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
3590
- });
3591
- //]]>
3592
- </script>
3593
- <?php if ( !AIOSEOPPRO ) { ?>
3594
- <div class="aioseop_advert aioseop_nopad_all">
3595
- <?php $adid = mt_rand( 21, 23 );
3596
-
3597
- if($adid == 23){ ?><div style="height: 220px; background-image: url('https://www.wincher.com/Content/Images/plugin/wp/banner30.jpg')">
3598
- <form style="position: relative; top: 170px; left: 40px;" action="https://www.wincher.com/FastReg" method="post" target="_blank">
3599
- <input type="hidden" name="adreferer" value="banner<?php echo $adid; ?>"/>
3600
- <input type="hidden" name="referer" value="all-in-one-seo-pack"/>
3601
- <input type="text" name="email" placeholder="Email" style="padding-left: 7px; height: 30px; width: 290px; border: solid 1px #DDD;"/>
3602
- <input type="submit" name="sub" value="Sign up!" style="height: 30px; width: 90px; background-color: #42DA76; color: #FFF; font-weight: bold; border:none; margin-left:5px;"/>
3603
- </form></div>
 
 
 
 
 
 
3604
  <?
3605
- }else{
3606
  ?>
3607
- <a href="https://www.wincher.com/?referer=all-in-one-seo-pack&adreferer=banner<?php echo $adid; ?>" target="_blank"><div class=wincherad id=wincher<?php echo $adid; ?>>
3608
- </div></a>
3609
- <?php } ?>
3610
- </div>
3611
- <!-- Headway Themes-->
3612
- <div class="aioseop_advert headwaythemes">
3613
- <div>
3614
- <h3>Drag and Drop WordPress Design</h3>
3615
- <p><a href="http://semperfiwebdesign.com/headwayaio/" target="_blank">Headway Themes</a> 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 <strong>SEMPERFI30</strong> at checkout.</p>
3616
  </div>
3617
- <a href="http://semperfiwebdesign.com/headwayaio/" target="_blank"><img src="<?php echo AIOSEOP_PLUGIN_IMAGES_URL; ?>headwaybanner.png"></a>
3618
- </div>
3619
- <?php } ?>
3620
- </div>
3621
- </div>
3622
- <?php
3623
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
3624
 
3625
  }
1
  <?php
2
  /**
3
+ * All in One SEO Pack Main Class file.
4
+ *
5
+ * Main class file, to be broken up later.
6
+ *
7
  * @package All-in-One-SEO-Pack
8
  */
9
+
10
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' ); // Include the module base class.
11
+
12
  /**
13
+ * Class All_in_One_SEO_Pack
14
+ *
 
 
15
  * The main class.
16
  */
17
  class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
18
 
19
+ // Current version of the plugin.
20
+ var $version = AIOSEOP_VERSION;
21
 
22
+ // Max numbers of chars in auto-generated description.
23
+ var $maximum_description_length = 160;
24
 
25
+ // Minimum number of chars an excerpt should be so that it can be used as description.
26
+ var $minimum_description_length = 1;
 
 
27
 
28
+ // Whether output buffering is already being used during forced title rewrites.
29
+ var $ob_start_detected = false;
30
 
31
+ // The start of the title text in the head section for forced title rewrites.
32
+ var $title_start = - 1;
33
 
34
+ // The end of the title text in the head section for forced title rewrites.
35
+ var $title_end = - 1;
36
 
37
+ // The title before rewriting.
38
+ var $orig_title = '';
39
 
40
+ // Filename of log file.
41
+ var $log_file;
42
 
43
+ // Flag whether there should be logging.
44
+ var $do_log;
45
 
46
  var $token;
47
  var $secret;
52
  var $meta_opts = false;
53
  var $is_front_page = null;
54
 
55
+ /**
56
+ * All_in_One_SEO_Pack constructor.
57
+ */
58
  function __construct() {
59
  global $aioseop_options;
60
+ $this->log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log'; // PHP <5.3 compatibility, once we drop support we can use __DIR___.
61
 
62
+ if ( ! empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] ) {
63
  $this->do_log = true;
64
+ } else {
65
  $this->do_log = false;
66
+ }
67
 
68
+ $this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME );
69
  $this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
70
 
71
+ $this->prefix = 'aiosp_'; // Option prefix.
72
+ $this->option_name = 'aioseop_options';
73
  $this->store_option = true;
74
+ $this->file = __FILE__; // The current file.
75
+ $blog_name = esc_attr( get_bloginfo( 'name' ) );
76
  parent::__construct();
77
 
78
+ $this->help_text = array(
79
+ 'donate' => __( 'All donations support continued development of this free software.', 'all-in-one-seo-pack' ),
80
+ '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' ),
81
+ 'can' => __( "This option will automatically generate Canonical URLs for your entire WordPress installation. This will help to prevent duplicate content penalties by <a href=\'http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html\' target=\'_blank\'>Google</a>.", 'all-in-one-seo-pack' ),
82
+ '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' ),
83
+ 'customize_canonical_links' => __( 'Checking this option will allow you to customize Canonical URLs for specific posts.', 'all-in-one-seo-pack' ),
84
+ 'can_set_protocol' => __( 'Set protocol for canonical URLs.', 'all-in-one-seo-pack' ),
85
+ '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' ),
86
+ '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' ),
87
+ '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' ),
88
+ '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' ),
89
+ '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' ),
90
+ 'use_static_home_info' => __( 'Checking this option uses the title, description, and keywords set on your static Front Page.', 'all-in-one-seo-pack' ),
91
+ 'togglekeywords' => __( 'This option allows you to toggle the use of Meta Keywords throughout the whole of the site.', 'all-in-one-seo-pack' ),
92
+ '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' ),
93
+ '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' ),
94
+ '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' ),
95
+ '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' ),
96
+ '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' ),
97
+ 'cap_cats' => __( 'Check this and Category Titles will have the first letter of each word capitalized.', 'all-in-one-seo-pack' ),
98
+ 'home_page_title_format' =>
99
+ __( 'This controls the format of the title tag for your Home Page.<br />The following macros are supported:', 'all-in-one-seo-pack' )
100
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
101
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
102
  __( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
103
  __( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
104
  __( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
105
  __( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
106
+ __( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
107
+ 'page_title_format' =>
108
+ __( 'This controls the format of the title tag for Pages.<br />The following macros are supported:', 'all-in-one-seo-pack' )
 
109
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
110
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
111
  __( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
112
  __( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
113
  __( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
114
  __( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
115
+ __( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
116
+ 'post_title_format' =>
117
+ __( 'This controls the format of the title tag for Posts.<br />The following macros are supported:', 'all-in-one-seo-pack' )
 
118
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
119
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
120
  __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
123
  __( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
124
  __( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
125
  __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
126
+ __( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
127
+ 'category_title_format' =>
128
+ __( 'This controls the format of the title tag for Category Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
 
129
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
130
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
131
  __( '%category_title% - The original title of the category', 'all-in-one-seo-pack' ) . '</li><li>' .
132
  __( '%category_description% - The description of the category', 'all-in-one-seo-pack' ) . '</li></ul>',
133
+ 'archive_title_format' =>
134
+ __( 'This controls the format of the title tag for Custom Post Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
135
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
136
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
137
  __( '%archive_title - The original archive title given by wordpress', 'all-in-one-seo-pack' ) . '</li></ul>',
138
+ 'date_title_format' =>
139
+ __( 'This controls the format of the title tag for Date Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
140
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
141
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
142
  __( '%date% - The original archive title given by wordpress, e.g. "2007" or "2007 August"', 'all-in-one-seo-pack' ) . '</li><li>' .
143
  __( '%day% - The original archive day given by wordpress, e.g. "17"', 'all-in-one-seo-pack' ) . '</li><li>' .
144
  __( '%month% - The original archive month given by wordpress, e.g. "August"', 'all-in-one-seo-pack' ) . '</li><li>' .
145
  __( '%year% - The original archive year given by wordpress, e.g. "2007"', 'all-in-one-seo-pack' ) . '</li></ul>',
146
+ 'author_title_format' =>
147
+ __( 'This controls the format of the title tag for Author Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
148
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
149
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
150
  __( '%author% - The original archive title given by wordpress, e.g. "Steve" or "John Smith"', 'all-in-one-seo-pack' ) . '</li></ul>',
151
+ 'tag_title_format' =>
152
+ __( 'This controls the format of the title tag for Tag Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
153
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
154
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
155
  __( '%tag% - The name of the tag', 'all-in-one-seo-pack' ) . '</li></ul>',
156
+ 'search_title_format' =>
157
+ __( 'This controls the format of the title tag for the Search page.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
158
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
159
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
160
  __( '%search% - What was searched for', 'all-in-one-seo-pack' ) . '</li></ul>',
161
+ 'description_format' => __( 'This controls the format of Meta Descriptions.The following macros are supported:', 'all-in-one-seo-pack' ) .
162
+ '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
163
+ __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
164
+ __( '%description% - The original description as determined by the plugin, e.g. the excerpt if one is set or an auto-generated one if that option is set', 'all-in-one-seo-pack' ) . '</li><li>' .
165
+ __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
166
+ __( '%wp_title% - The original wordpress title, e.g. post_title for posts', 'all-in-one-seo-pack' ) . '</li></ul>',
167
+ '404_title_format' => __( 'This controls the format of the title tag for the 404 page.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
168
+ '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
169
+ __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
170
+ __( '%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all-in-one-seo-pack' ) . '</li><li>' .
171
+ __( '%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all-in-one-seo-pack' ) . '</li><li>' .
172
+ __( '%404_title% - Additional 404 title input"', 'all-in-one-seo-pack' ) . '</li></ul>',
173
+ 'paged_format' => __( 'This string gets appended/prepended to titles of paged index pages (like home or archive pages).', 'all-in-one-seo-pack' )
174
+ . __( 'The following macros are supported:', 'all-in-one-seo-pack' )
175
+ . '<ul><li>' . __( '%page% - The page number', 'all-in-one-seo-pack' ) . '</li></ul>',
176
+ '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' ),
177
+ 'cpostadvanced' => __( 'This will show or hide the advanced options for SEO for Custom Post Types.', 'all-in-one-seo-pack' ),
178
+ 'cpostactive' => __( 'Use these checkboxes to select which Post Types you want to use All in One SEO Pack with.', 'all-in-one-seo-pack' ),
179
+ 'taxactive' => __( 'Use these checkboxes to select which Taxonomies you want to use All in One SEO Pack with.', 'all-in-one-seo-pack' ),
180
+ 'cposttitles' => __( 'This allows you to set the title tags for each Custom Post Type.', 'all-in-one-seo-pack' ),
181
+ 'posttypecolumns' => __( 'This lets you select which screens display the SEO Title, SEO Keywords and SEO Description columns.', 'all-in-one-seo-pack' ),
182
+ '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' ),
183
+ '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' ),
184
+ 'google_verify' => __( "Enter your verification code here to verify your site with Google Webmaster Tools.<br /><a href='http://semperplugins.com/documentation/google-webmaster-tools-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
185
+ 'bing_verify' => __( "Enter your verification code here to verify your site with Bing Webmaster Tools.<br /><a href='http://semperplugins.com/documentation/bing-webmaster-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
186
+ 'pinterest_verify' => __( "Enter your verification code here to verify your site with Pinterest.<br /><a href='http://semperplugins.com/documentation/pinterest-site-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
187
+ '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' ),
188
+ 'google_disable_profile' => __( 'Check this to remove the Google Plus field from the user profile screen.', 'all-in-one-seo-pack' ),
189
+ 'google_author_advanced' => __( 'Enable this to display advanced options for controlling Google Plus authorship information on your website.', 'all-in-one-seo-pack' ),
190
+ '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' ),
191
+ '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' ),
192
+ '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' ),
193
+ 'google_sitelinks_search' => __( 'Add markup to display the Google Sitelinks Search Box next to your search results in Google.', 'all-in-one-seo-pack' ),
194
+ 'google_set_site_name' => __( 'Add markup to tell Google the preferred name for your website.', 'all-in-one-seo-pack' ),
195
+ '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' ),
196
+ 'google_analytics_id' => __( 'Enter your Google Analytics ID here to track visitor behavior on your site using Google Analytics.', 'all-in-one-seo-pack' ),
197
+ 'ga_use_universal_analytics' => __( 'Use the new Universal Analytics tracking code for Google Analytics.', 'all-in-one-seo-pack' ),
198
+ 'ga_advanced_options' => __( 'Check to use advanced Google Analytics options.', 'all-in-one-seo-pack' ),
199
+ 'ga_domain' => __( 'Enter your domain name without the http:// to set your cookie domain.', 'all-in-one-seo-pack' ),
200
+ 'ga_multi_domain' => __( 'Use this option to enable tracking of multiple or additional domains.', 'all-in-one-seo-pack' ),
201
+ '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' ),
202
+ 'ga_anonymize_ip' => __( 'This enables support for IP Anonymization in Google Analytics.', 'all-in-one-seo-pack' ),
203
+ 'ga_display_advertising' => __( 'This enables support for the Display Advertiser Features in Google Analytics.', 'all-in-one-seo-pack' ),
204
+ 'ga_exclude_users' => __( 'Exclude logged-in users from Google Analytics tracking by role.', 'all-in-one-seo-pack' ),
205
+ 'ga_track_outbound_links' => __( 'Check this if you want to track outbound links with Google Analytics.', 'all-in-one-seo-pack' ),
206
+ 'ga_link_attribution' => __( 'This enables support for the Enhanced Link Attribution in Google Analytics.', 'all-in-one-seo-pack' ),
207
+ 'ga_enhanced_ecommerce' => __( 'This enables support for the Enhanced Ecommerce in Google Analytics.', 'all-in-one-seo-pack' ),
208
+ 'cpostnoindex' => __( 'Set the default NOINDEX setting for each Post Type.', 'all-in-one-seo-pack' ),
209
+ 'cpostnofollow' => __( 'Set the default NOFOLLOW setting for each Post Type.', 'all-in-one-seo-pack' ),
210
+
211
+ 'category_noindex' => __( 'Check this to ask search engines not to index Category Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
212
+ 'archive_date_noindex' => __( 'Check this to ask search engines not to index Date Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
213
+ 'archive_author_noindex' => __( 'Check this to ask search engines not to index Author Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
214
+ 'tags_noindex' => __( 'Check this to ask search engines not to index Tag Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
215
+ 'search_noindex' => __( 'Check this to ask search engines not to index the Search page. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
216
+ '404_noindex' => __( 'Check this to ask search engines not to index the 404 page.', 'all-in-one-seo-pack' ),
217
+ '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' ),
218
+ 'paginated_noindex' => __( 'Check this to ask search engines not to index paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
219
+ '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' ),
220
+ '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' ),
221
+ 'cpostnoodp' => __( 'Set the default noodp setting for each Post Type.', 'all-in-one-seo-pack' ),
222
+ 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for your entire site.', 'all-in-one-seo-pack' ),
223
+ 'cpostnoydir' => __( 'Set the default noydir setting for each Post Type.', 'all-in-one-seo-pack' ),
224
+ 'skip_excerpt' => __( "Check this and your Meta Descriptions won't be generated from the excerpt.", 'all-in-one-seo-pack' ),
225
+ 'generate_descriptions' => __( 'Check this and your Meta Descriptions will be auto-generated from your excerpt or content.', 'all-in-one-seo-pack' ),
226
+ 'run_shortcodes' => __( 'Check this and shortcodes will get executed for descriptions auto-generated from content.', 'all-in-one-seo-pack' ),
227
+ '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' ),
228
+ 'dont_truncate_descriptions' => __( 'Check this to prevent your Description from being truncated regardless of its length.', 'all-in-one-seo-pack' ),
229
+ 'schema_markup' => __( 'Check this to support Schema.org markup, i.e., itemprop on supported metadata.', 'all-in-one-seo-pack' ),
230
+ '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' ),
231
+ '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: <em>/forum/, /contact/</em> 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' ),
232
+ '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' ),
233
+ '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' ),
234
+ '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' ),
235
+ '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' ),
236
  );
237
 
238
+ $this->help_anchors = array(
239
+ 'license_key' => '#license-key',
240
+ 'can' => '#canonical-urls',
241
+ 'no_paged_canonical_links' => '#no-pagination-for-canonical-urls',
242
+ 'customize_canonical_links' => '#enable-custom-canonical-urls',
243
+ 'can_set_protocol' => '#set-protocol-for-canonical-urls',
244
+ 'use_original_title' => '#use-original-title',
245
+ 'schema_markup' => '#use-schema-markup',
246
+ 'do_log' => '#log-important-events',
247
+ 'home_title' => '#home-title',
248
+ 'home_description' => '#home-description',
249
+ 'home_keywords' => '#home-keywords',
250
+ 'use_static_home_info' => '#use-static-front-page-instead',
251
+ 'togglekeywords' => '#use-keywords',
252
+ 'use_categories' => '#use-categories-for-meta-keywords',
253
+ 'use_tags_as_keywords' => '#use-tags-for-meta-keywords',
254
+ 'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page',
255
+ 'rewrite_titles' => '#rewrite-titles',
256
+ 'cap_titles' => '#capitalize-titles',
257
+ 'cap_cats' => '#capitalize-titles',
258
+ 'home_page_title_format' => '#title-format-fields',
259
+ 'page_title_format' => '#title-format-fields',
260
+ 'post_title_format' => '#title-format-fields',
261
+ 'category_title_format' => '#title-format-fields',
262
+ 'archive_title_format' => '#title-format-fields',
263
+ 'date_title_format' => '#title-format-fields',
264
+ 'author_title_format' => '#title-format-fields',
265
+ 'tag_title_format' => '#title-format-fields',
266
+ 'search_title_format' => '#title-format-fields',
267
+ 'description_format' => '#title-format-fields',
268
+ '404_title_format' => '#title-format-fields',
269
+ 'paged_format' => '#title-format-fields',
270
+ 'enablecpost' => '#seo-for-custom-post-types',
271
+ 'cpostadvanced' => '#enable-advanced-options',
272
+ 'cpostactive' => '#seo-on-only-these-post-types',
273
+ 'taxactive' => '#seo-on-only-these-taxonomies',
274
+ 'cposttitles' => '#custom-titles',
275
+ 'posttypecolumns' => '#show-column-labels-for-custom-post-types',
276
+ 'admin_bar' => '#display-menu-in-admin-bar',
277
+ 'custom_menu_order' => '#display-menu-at-the-top',
278
+ 'google_verify' => '',
279
+ 'bing_verify' => '',
280
+ 'pinterest_verify' => '',
281
+ 'google_publisher' => '#google-plus-default-profile',
282
+ 'google_disable_profile' => '#disable-google-plus-profile',
283
+ 'google_sitelinks_search' => '#display-sitelinks-search-box',
284
+ 'google_set_site_name' => '#set-preferred-site-name',
285
+ 'google_author_advanced' => '#advanced-authorship-options',
286
+ 'google_author_location' => '#display-google-authorship',
287
+ 'google_enable_publisher' => '#display-publisher-meta-on-front-page',
288
+ 'google_specify_publisher' => '#specify-publisher-url',
289
+ 'google_analytics_id' => 'http://semperplugins.com/documentation/setting-up-google-analytics/',
290
+ 'ga_use_universal_analytics' => '#use-universal-analytics',
291
+ 'ga_domain' => '#tracking-domain',
292
+ 'ga_multi_domain' => '#track-multiple-domains-additional-domains',
293
+ 'ga_addl_domains' => '#track-multiple-domains-additional-domains',
294
+ 'ga_anonymize_ip' => '#anonymize-ip-addresses',
295
+ 'ga_display_advertising' => '#display-advertiser-tracking',
296
+ 'ga_exclude_users' => '#exclude-users-from-tracking',
297
+ 'ga_track_outbound_links' => '#track-outbound-links',
298
+ 'ga_link_attribution' => '#enhanced-link-attribution',
299
+ 'ga_enhanced_ecommerce' => '#enhanced-ecommerce',
300
+ 'cpostnoindex' => '#noindex',
301
+ 'cpostnofollow' => '#nofollow',
302
+ 'cpostnoodp' => '#noodp',
303
+ 'cpostnoydir' => '#noydir',
304
+ 'category_noindex' => '#noindex-settings',
305
+ 'archive_date_noindex' => '#noindex-settings',
306
+ 'archive_author_noindex' => '#noindex-settings',
307
+ 'tags_noindex' => '#noindex-settings',
308
+ 'search_noindex' => '#use-noindex-for-the-search-page',
309
+ '404_noindex' => '#use-noindex-for-the-404-page',
310
+ 'tax_noindex' => '#use-noindex-for-the-taxonomy-archives',
311
+ 'paginated_noindex' => '#use-noindex-for-paginated-pages-posts',
312
+ 'paginated_nofollow' => '#use-nofollow-for-paginated-pages-posts',
313
+ 'noodp' => '#exclude-site-from-the-open-directory-project',
314
+ 'noydir' => '#exclude-site-from-yahoo-directory',
315
+ 'skip_excerpt' => '#avoid-using-the-excerpt-in-descriptions',
316
+ 'generate_descriptions' => '#autogenerate-descriptions',
317
+ 'run_shortcodes' => '#run-shortcodes-in-autogenerated-descriptions',
318
  'hide_paginated_descriptions' => '#remove-descriptions-for-paginated-pages',
319
+ 'dont_truncate_descriptions' => '#never-shorten-long-descriptions',
320
+ 'unprotect_meta' => '#unprotect-post-meta-fields',
321
+ 'ex_pages' => '#exclude-pages',
322
+ 'post_meta_tags' => '#additional-post-headers',
323
+ 'page_meta_tags' => '#additional-page-headers',
324
+ 'front_meta_tags' => '#additional-front-page-headers',
325
+ 'home_meta_tags' => '#additional-blog-page-headers',
326
  );
327
 
328
+ $meta_help_text = array(
329
+ 'snippet' => __( 'A preview of what this page might look like in search engine results.', 'all-in-one-seo-pack' ),
330
+ 'title' => __( 'A custom title that shows up in the title tag for this page.', 'all-in-one-seo-pack' ),
331
+ 'description' => __( 'The META description for this page. This will override any autogenerated descriptions.', 'all-in-one-seo-pack' ),
332
+ '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' ),
333
+ 'custom_link' => __( 'Override the canonical URLs for this post.', 'all-in-one-seo-pack' ),
334
+ 'noindex' => __( 'Check this box to ask search engines not to index this page.', 'all-in-one-seo-pack' ),
335
+ 'nofollow' => __( 'Check this box to ask search engines not to follow links from this page.', 'all-in-one-seo-pack' ),
336
+ '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' ),
337
+ 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for this page.', 'all-in-one-seo-pack' ),
338
+ 'titleatr' => __( 'Set the title attribute for menu links.', 'all-in-one-seo-pack' ),
339
+ 'menulabel' => __( 'Set the label for this page menu item.', 'all-in-one-seo-pack' ),
340
+ 'sitemap_exclude' => __( "Don't display this page in the sitemap.", 'all-in-one-seo-pack' ),
341
+ 'disable' => __( 'Disable SEO on this page.', 'all-in-one-seo-pack' ),
342
+ 'disable_analytics' => __( 'Disable Google Analytics on this page.', 'all-in-one-seo-pack' ),
343
  );
344
 
345
  $this->default_options = array(
346
+ 'license_key' => array(
347
  'name' => __( 'License Key:', 'all-in-one-seo-pack' ),
348
+ 'type' => 'text',
349
+ ),
350
+ 'donate' => array(
351
+ 'name' => __( 'I enjoy this plugin and have made a donation:', 'all-in-one-seo-pack' ),
352
+ ),
353
+ 'home_title' => array(
354
+ 'name' => __( 'Home Title:', 'all-in-one-seo-pack' ),
355
+ 'default' => null,
356
+ 'type' => 'textarea',
357
+ 'sanitize' => 'text',
358
+ 'count' => true,
359
+ 'rows' => 1,
360
+ 'cols' => 60,
361
+ 'condshow' => array( 'aiosp_use_static_home_info' => 0 ),
362
+ ),
363
+ 'home_description' => array(
364
+ 'name' => __( 'Home Description:', 'all-in-one-seo-pack' ),
365
+ 'default' => '',
366
+ 'type' => 'textarea',
367
+ 'sanitize' => 'text',
368
+ 'count' => true,
369
+ 'cols' => 80,
370
+ 'rows' => 2,
371
+ 'condshow' => array( 'aiosp_use_static_home_info' => 0 ),
372
+ ),
373
+ 'togglekeywords' => array(
374
+ 'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ),
375
+ 'default' => 1,
376
+ 'type' => 'radio',
377
+ 'initial_options' => array(
378
+ 0 => __( 'Enabled', 'all-in-one-seo-pack' ),
379
+ 1 => __( 'Disabled', 'all-in-one-seo-pack' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  ),
381
+ ),
382
+ 'home_keywords' => array(
383
+ 'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ),
384
+ 'default' => null,
385
+ 'type' => 'textarea',
386
+ 'sanitize' => 'text',
387
+ 'condshow' => array( 'aiosp_togglekeywords' => 0, 'aiosp_use_static_home_info' => 0 ),
388
+ ),
389
+ 'use_static_home_info' => array(
390
+ 'name' => __( 'Use Static Front Page Instead', 'all-in-one-seo-pack' ),
391
+ 'default' => 0,
392
+ 'type' => 'radio',
393
+ 'initial_options' => array(
394
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
395
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
396
  ),
397
+ ),
398
+ 'can' => array(
399
+ 'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ),
400
  'default' => 1,
401
+ ),
402
+ 'no_paged_canonical_links' => array(
403
+ 'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ),
404
+ 'default' => 0,
405
+ 'condshow' => array( 'aiosp_can' => 'on' ),
406
+ ),
407
+ 'customize_canonical_links' => array(
408
+ 'name' => __( 'Enable Custom Canonical URLs:', 'all-in-one-seo-pack' ),
409
+ 'default' => 0,
410
+ 'condshow' => array( 'aiosp_can' => 'on' ),
411
+ ),
412
+ 'can_set_protocol' => array(
413
+ 'name' => __( 'Set Protocol For Canonical URLs:', 'all-in-one-seo-pack' ),
414
+ 'type' => 'radio',
415
+ 'default' => 'auto',
416
+ 'initial_options' => array(
417
+ 'auto' => __( 'Auto', 'all-in-one-seo-pack' ),
418
+ 'http' => __( 'HTTP', 'all-in-one-seo-pack' ),
419
+ 'https' => __( 'HTTPS', 'all-in-one-seo-pack' ),
420
  ),
421
+ 'condshow' => array( 'aiosp_can' => 'on' ),
422
+ ),
423
+ 'rewrite_titles' => array(
424
+ 'name' => __( 'Rewrite Titles:', 'all-in-one-seo-pack' ),
425
+ 'default' => 1,
426
+ 'type' => 'radio',
427
+ 'initial_options' => array(
428
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
429
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
430
  ),
431
+ ),
432
+ 'force_rewrites' => array(
433
+ 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
434
+ 'default' => 1,
435
+ 'type' => 'hidden',
436
+ 'prefix' => $this->prefix,
437
+ 'initial_options' => array(
438
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
439
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  ),
441
+ ),
442
+ 'use_original_title' => array(
443
+ 'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ),
444
+ 'type' => 'radio',
445
+ 'default' => 0,
446
+ 'initial_options' => array(
447
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
448
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
449
  ),
450
+ ),
451
+ 'cap_titles' => array(
452
+ 'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ),
453
+ 'default' => 1,
454
+ ),
455
+ 'cap_cats' => array(
456
+ 'name' => __( 'Capitalize Category Titles:', 'all-in-one-seo-pack' ),
457
+ 'default' => 1,
458
+ ),
459
+ 'home_page_title_format' => array(
460
+ 'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
461
+ 'type' => 'text',
462
+ 'default' => '%page_title%',
463
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
464
+ ),
465
+ 'page_title_format' => array(
466
+ 'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ),
467
+ 'type' => 'text',
468
+ 'default' => '%page_title% | %blog_title%',
469
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
470
+ ),
471
+ 'post_title_format' => array(
472
+ 'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ),
473
+ 'type' => 'text',
474
+ 'default' => '%post_title% | %blog_title%',
475
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
476
+ ),
477
+ 'category_title_format' => array(
478
+ 'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ),
479
+ 'type' => 'text',
480
+ 'default' => '%category_title% | %blog_title%',
481
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
482
+ ),
483
+ 'archive_title_format' => array(
484
+ 'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ),
485
+ 'type' => 'text',
486
+ 'default' => '%archive_title% | %blog_title%',
487
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
488
+ ),
489
+ 'date_title_format' => array(
490
+ 'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ),
491
+ 'type' => 'text',
492
+ 'default' => '%date% | %blog_title%',
493
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
494
+ ),
495
+ 'author_title_format' => array(
496
+ 'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ),
497
+ 'type' => 'text',
498
+ 'default' => '%author% | %blog_title%',
499
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
500
+ ),
501
+ 'tag_title_format' => array(
502
+ 'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ),
503
+ 'type' => 'text',
504
+ 'default' => '%tag% | %blog_title%',
505
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
506
+ ),
507
+ 'search_title_format' => array(
508
+ 'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ),
509
+ 'type' => 'text',
510
+ 'default' => '%search% | %blog_title%',
511
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
512
+ ),
513
+ 'description_format' => array(
514
+ 'name' => __( 'Description Format', 'all-in-one-seo-pack' ),
515
+ 'type' => 'text',
516
+ 'default' => '%description%',
517
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
518
+ ),
519
+ '404_title_format' => array(
520
+ 'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ),
521
+ 'type' => 'text',
522
+ 'default' => 'Nothing found for %request_words%',
523
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
524
+ ),
525
+ 'paged_format' => array(
526
+ 'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ),
527
+ 'type' => 'text',
528
+ 'default' => ' - Part %page%',
529
+ 'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
530
+ ),
531
+ 'enablecpost' => array(
532
+ 'name' => __( 'SEO for Custom Post Types:', 'all-in-one-seo-pack' ),
533
+ 'default' => 'on',
534
+ 'type' => 'radio',
535
+ 'initial_options' => array(
536
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
537
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
538
  ),
539
+ ),
540
+ 'cpostactive' => array(
541
+ 'name' => __( 'SEO on only these post types:', 'all-in-one-seo-pack' ),
542
+ 'type' => 'multicheckbox',
543
+ 'default' => array( 'post', 'page' ),
544
+ 'condshow' => array( 'aiosp_enablecpost' => 'on' ),
545
+ ),
546
+ 'taxactive' => array(
547
+ 'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ),
548
+ 'type' => 'multicheckbox',
549
+ 'default' => array( 'category', 'post_tag' ),
550
+ 'condshow' => array( 'aiosp_enablecpost' => 'on' ),
551
+ ),
552
+ 'cpostadvanced' => array(
553
+ 'name' => __( 'Enable Advanced Options:', 'all-in-one-seo-pack' ),
554
+ 'default' => 0,
555
+ 'type' => 'radio',
556
+ 'initial_options' => array(
557
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
558
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
559
  ),
560
+ 'label' => null,
561
+ 'condshow' => array( 'aiosp_enablecpost' => 'on' ),
562
+ ),
563
+ 'cpostnoindex' => array(
564
+ 'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ),
565
+ 'type' => 'multicheckbox',
566
+ 'default' => array(),
567
+ ),
568
+ 'cpostnofollow' => array(
569
+ 'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ),
570
+ 'type' => 'multicheckbox',
571
+ 'default' => array(),
572
+ ),
573
+ 'cpostnoodp' => array(
574
+ 'name' => __( 'Default to NOODP:', 'all-in-one-seo-pack' ),
575
+ 'type' => 'multicheckbox',
576
+ 'default' => array(),
577
+ ),
578
+ 'cpostnoydir' => array(
579
+ 'name' => __( 'Default to NOYDIR:', 'all-in-one-seo-pack' ),
580
+ 'type' => 'multicheckbox',
581
+ 'default' => array(),
582
+ ),
583
+ 'cposttitles' => array(
584
+ 'name' => __( 'Custom titles:', 'all-in-one-seo-pack' ),
585
+ 'type' => 'checkbox',
586
+ 'default' => 0,
587
+ 'condshow' => array(
588
+ 'aiosp_rewrite_titles' => 1,
589
+ 'aiosp_enablecpost' => 'on',
590
+ 'aiosp_cpostadvanced' => 'on',
591
  ),
592
+ ),
593
+ 'posttypecolumns' => array(
594
+ 'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ),
595
+ 'type' => 'multicheckbox',
596
+ 'default' => array( 'post', 'page' ),
597
+ 'condshow' => array( 'aiosp_enablecpost' => 'on' ),
598
+ ),
599
+ 'admin_bar' => array(
600
+ 'name' => __( 'Display Menu In Admin Bar:', 'all-in-one-seo-pack' ),
601
+ 'default' => 'on',
602
+ ),
603
+ 'custom_menu_order' => array(
604
+ 'name' => __( 'Display Menu At The Top:', 'all-in-one-seo-pack' ),
605
+ 'default' => 'on',
606
+ ),
607
+ 'google_verify' => array(
608
+ 'name' => __( 'Google Webmaster Tools:', 'all-in-one-seo-pack' ),
609
+ 'default' => '',
610
+ 'type' => 'text',
611
+ ),
612
+ 'bing_verify' => array(
613
+ 'name' => __( 'Bing Webmaster Center:', 'all-in-one-seo-pack' ),
614
+ 'default' => '',
615
+ 'type' => 'text',
616
+ ),
617
+ 'pinterest_verify' => array(
618
+ 'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ),
619
+ 'default' => '',
620
+ 'type' => 'text',
621
+ ),
622
+ 'google_publisher' => array(
623
+ 'name' => __( 'Google Plus Default Profile:', 'all-in-one-seo-pack' ),
624
+ 'default' => '',
625
+ 'type' => 'text',
626
+ ),
627
+ 'google_disable_profile' => array(
628
+ 'name' => __( 'Disable Google Plus Profile:', 'all-in-one-seo-pack' ),
629
+ 'default' => 0,
630
+ 'type' => 'checkbox',
631
+ ),
632
+ 'google_sitelinks_search' => array(
633
+ 'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' ),
634
+ ),
635
+ 'google_set_site_name' => array(
636
+ 'name' => __( 'Set Preferred Site Name:', 'all-in-one-seo-pack' ),
637
+ ),
638
+ 'google_specify_site_name' => array(
639
+ 'name' => __( 'Specify A Preferred Name:', 'all-in-one-seo-pack' ),
640
+ 'type' => 'text',
641
+ 'placeholder' => $blog_name,
642
+ 'condshow' => array( 'aiosp_google_set_site_name' => 'on' ),
643
+ ),
644
+ 'google_author_advanced' => array(
645
+ 'name' => __( 'Advanced Authorship Options:', 'all-in-one-seo-pack' ),
646
+ 'default' => 0,
647
+ 'type' => 'radio',
648
+ 'initial_options' => array(
649
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
650
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
651
  ),
652
+ 'label' => null,
653
+ ),
654
+ 'google_author_location' => array(
655
+ 'name' => __( 'Display Google Authorship:', 'all-in-one-seo-pack' ),
656
+ 'default' => array( 'all' ),
657
+ 'type' => 'multicheckbox',
658
+ 'condshow' => array( 'aiosp_google_author_advanced' => 'on' ),
659
+ ),
660
+ 'google_enable_publisher' => array(
661
+ 'name' => __( 'Display Publisher Meta on Front Page:', 'all-in-one-seo-pack' ),
662
+ 'default' => 'on',
663
+ 'type' => 'radio',
664
+ 'initial_options' => array(
665
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
666
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
667
  ),
668
+ 'condshow' => array( 'aiosp_google_author_advanced' => 'on' ),
669
+ ),
670
+ 'google_specify_publisher' => array(
671
+ 'name' => __( 'Specify Publisher URL:', 'all-in-one-seo-pack' ),
672
+ 'type' => 'text',
673
+ 'condshow' => array( 'aiosp_google_author_advanced' => 'on', 'aiosp_google_enable_publisher' => 'on' ),
674
+ ),
675
+ // "google_connect"=>array( 'name' => __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ), ),
676
+ 'google_analytics_id' => array(
677
+ 'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ),
678
+ 'default' => null,
679
+ 'type' => 'text',
680
+ 'placeholder' => 'UA-########-#',
681
+ ),
682
+ 'ga_use_universal_analytics' => array(
683
+ 'name' => __( 'Use Universal Analytics:', 'all-in-one-seo-pack' ),
684
+ 'default' => 0,
685
+ 'condshow' => array(
686
+ 'aiosp_google_analytics_id' => array(
687
+ 'lhs' => 'aiosp_google_analytics_id',
688
+ 'op' => '!=',
689
+ 'rhs' => '',
690
+ ),
691
  ),
692
+ ),
693
+ 'ga_advanced_options' => array(
694
+ 'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ),
695
+ 'default' => 'on',
696
+ 'type' => 'radio',
697
+ 'initial_options' => array(
698
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
699
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
700
  ),
701
+ 'condshow' => array(
702
+ 'aiosp_google_analytics_id' => array(
703
+ 'lhs' => 'aiosp_google_analytics_id',
704
+ 'op' => '!=',
705
+ 'rhs' => '',
706
+ ),
707
  ),
708
+ ),
709
+ 'ga_domain' => array(
710
+ 'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ),
711
+ 'type' => 'text',
712
+ 'condshow' => array(
713
+ 'aiosp_google_analytics_id' => array(
714
+ 'lhs' => 'aiosp_google_analytics_id',
715
+ 'op' => '!=',
716
+ 'rhs' => '',
717
+ ),
718
+ 'aiosp_ga_advanced_options' => 'on',
719
  ),
720
+ ),
721
+ 'ga_multi_domain' => array(
722
+ 'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ),
723
+ 'default' => 0,
724
+ 'condshow' => array(
725
+ 'aiosp_google_analytics_id' => array(
726
+ 'lhs' => 'aiosp_google_analytics_id',
727
+ 'op' => '!=',
728
+ 'rhs' => '',
729
+ ),
730
+ 'aiosp_ga_advanced_options' => 'on',
731
  ),
732
+ ),
733
+ 'ga_addl_domains' => array(
734
+ 'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ),
735
+ 'type' => 'textarea',
736
+ 'condshow' => array(
737
+ 'aiosp_google_analytics_id' => array(
738
+ 'lhs' => 'aiosp_google_analytics_id',
739
+ 'op' => '!=',
740
+ 'rhs' => '',
741
+ ),
742
+ 'aiosp_ga_advanced_options' => 'on',
743
+ 'aiosp_ga_multi_domain' => 'on',
744
  ),
745
+ ),
746
+ 'ga_anonymize_ip' => array(
747
+ 'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ),
748
+ 'type' => 'checkbox',
749
+ 'condshow' => array(
750
+ 'aiosp_google_analytics_id' => array(
751
+ 'lhs' => 'aiosp_google_analytics_id',
752
+ 'op' => '!=',
753
+ 'rhs' => '',
754
+ ),
755
+ 'aiosp_ga_advanced_options' => 'on',
756
  ),
757
+ ),
758
+ 'ga_display_advertising' => array(
759
+ 'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ),
760
+ 'type' => 'checkbox',
761
+ 'condshow' => array(
762
+ 'aiosp_google_analytics_id' => array(
763
+ 'lhs' => 'aiosp_google_analytics_id',
764
+ 'op' => '!=',
765
+ 'rhs' => '',
766
+ ),
767
+ 'aiosp_ga_advanced_options' => 'on',
768
  ),
769
+ ),
770
+ 'ga_exclude_users' => array(
771
+ 'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ),
772
+ 'type' => 'multicheckbox',
773
+ 'condshow' => array(
774
+ 'aiosp_google_analytics_id' => array(
775
+ 'lhs' => 'aiosp_google_analytics_id',
776
+ 'op' => '!=',
777
+ 'rhs' => '',
778
+ ),
779
+ 'aiosp_ga_advanced_options' => 'on',
780
  ),
781
+ ),
782
+ 'ga_track_outbound_links' => array(
783
+ 'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ),
784
+ 'default' => 0,
785
+ 'condshow' => array(
786
+ 'aiosp_google_analytics_id' => array(
787
+ 'lhs' => 'aiosp_google_analytics_id',
788
+ 'op' => '!=',
789
+ 'rhs' => '',
 
 
 
 
 
 
 
 
 
790
  ),
791
+ 'aiosp_ga_advanced_options' => 'on',
 
 
792
  ),
793
+ ),
794
+ 'ga_link_attribution' => array(
795
+ 'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ),
796
+ 'default' => 0,
797
+ 'condshow' => array(
798
+ 'aiosp_google_analytics_id' => array(
799
+ 'lhs' => 'aiosp_google_analytics_id',
800
+ 'op' => '!=',
801
+ 'rhs' => '',
802
+ ),
803
+ 'aiosp_ga_advanced_options' => 'on',
804
  ),
805
+ ),
806
+ 'ga_enhanced_ecommerce' => array(
807
+ 'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ),
808
+ 'default' => 0,
809
+ 'condshow' => array(
810
+ 'aiosp_google_analytics_id' => array(
811
+ 'lhs' => 'aiosp_google_analytics_id',
812
+ 'op' => '!=',
813
+ 'rhs' => '',
814
+ ),
815
+ 'aiosp_ga_use_universal_analytics' => 'on',
816
+ 'aiosp_ga_advanced_options' => 'on',
817
  ),
818
+ ),
819
+ 'use_categories' => array(
820
+ 'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ),
821
+ 'default' => 0,
822
+ 'condshow' => array( 'aiosp_togglekeywords' => 0 ),
823
+ ),
824
+ 'use_tags_as_keywords' => array(
825
+ 'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ),
826
+ 'default' => 1,
827
+ 'condshow' => array( 'aiosp_togglekeywords' => 0 ),
828
+ ),
829
+ 'dynamic_postspage_keywords' => array(
830
+ 'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ),
831
+ 'default' => 1,
832
+ 'condshow' => array( 'aiosp_togglekeywords' => 0 ),
833
+ ),
834
+ 'category_noindex' => array(
835
+ 'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ),
836
+ 'default' => 1,
837
+ ),
838
+ 'archive_date_noindex' => array(
839
+ 'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ),
840
+ 'default' => 1,
841
+ ),
842
+ 'archive_author_noindex' => array(
843
+ 'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ),
844
+ 'default' => 1,
845
+ ),
846
+ 'tags_noindex' => array(
847
+ 'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ),
848
  'default' => 0,
849
+ ),
850
+ 'search_noindex' => array(
851
+ 'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ),
 
 
 
 
 
 
 
 
 
 
 
852
  'default' => 0,
853
+ ),
854
+ '404_noindex' => array(
855
+ 'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ),
856
+ 'default' => 0,
857
+ ),
858
+ 'tax_noindex' => array(
859
+ 'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ),
860
+ 'type' => 'multicheckbox',
861
+ 'default' => array(),
862
+ 'condshow' => array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' ),
863
+ ),
864
+ 'paginated_noindex' => array(
865
+ 'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ),
 
 
 
 
 
 
866
  'default' => 0,
867
+ ),
868
+ 'paginated_nofollow' => array(
869
+ 'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ),
870
+ 'default' => 0,
871
+ ),
872
+ 'noodp' => array(
873
+ 'name' => __( 'Exclude site from the Open Directory Project:', 'all-in-one-seo-pack' ),
874
  'default' => 0,
875
+ ),
876
+ 'noydir' => array(
877
+ 'name' => __( 'Exclude site from Yahoo! Directory:', 'all-in-one-seo-pack' ),
878
  'default' => 0,
879
+ ),
880
+ 'skip_excerpt' => array(
881
+ 'name' => __( 'Avoid Using The Excerpt In Descriptions:', 'all-in-one-seo-pack' ),
882
  'default' => 0,
883
+ ),
884
+ 'generate_descriptions' => array(
885
+ 'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ),
886
  'default' => 1,
887
+ ),
888
+ 'run_shortcodes' => array(
889
+ 'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ),
890
+ 'default' => 0,
891
+ 'condshow' => array( 'aiosp_generate_descriptions' => 'on' ),
892
+ ),
893
+ 'hide_paginated_descriptions' => array(
894
+ 'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ),
895
+ 'default' => 0,
896
+ ),
897
+ 'dont_truncate_descriptions' => array(
898
+ 'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ),
899
+ 'default' => 0,
900
+ ),
901
+ 'schema_markup' => array(
902
+ 'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ),
903
  'default' => 1,
904
+ ),
905
+ 'unprotect_meta' => array(
906
+ 'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
907
  'default' => 0,
908
+ ),
909
+ 'ex_pages' => array(
910
+ 'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ),
911
+ 'type' => 'textarea',
912
+ 'default' => '',
913
+ ),
914
+ 'post_meta_tags' => array(
915
+ 'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ),
916
+ 'type' => 'textarea',
917
+ 'default' => '',
918
+ 'sanitize' => 'default',
919
+ ),
920
+ 'page_meta_tags' => array(
921
+ 'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ),
922
+ 'type' => 'textarea',
923
+ 'default' => '',
924
+ 'sanitize' => 'default',
925
+ ),
926
+ 'front_meta_tags' => array(
927
+ 'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ),
928
+ 'type' => 'textarea',
929
+ 'default' => '',
930
+ 'sanitize' => 'default',
931
+ ),
932
+ 'home_meta_tags' => array(
933
+ 'name' => __( 'Additional Blog Page Headers:', 'all-in-one-seo-pack' ),
934
+ 'type' => 'textarea',
935
+ 'default' => '',
936
+ 'sanitize' => 'default',
937
+ ),
938
+ 'do_log' => array(
939
+ 'name' => __( 'Log important events:', 'all-in-one-seo-pack' ),
940
+ 'default' => null,
941
+ ),
942
+ );
943
 
944
+ if ( AIOSEOPPRO ) {
945
+ unset( $this->default_options['donate'] );
946
+ } else {
947
+ unset( $this->default_options['license_key'] );
948
+ unset( $this->default_options['taxactive'] );
949
+ }
950
+
951
+ $this->locations = array(
952
+ 'default' => array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings', 'options' => null ),
953
+ 'aiosp' => array(
954
+ 'name' => $this->plugin_name,
955
+ 'type' => 'metabox',
956
+ 'prefix' => '',
957
+ 'help_link' => 'http://semperplugins.com/sections/postpage-settings/',
958
+ 'options' => array(
959
+ 'edit',
960
+ 'nonce-aioseop-edit',
961
+ AIOSEOPPRO ? 'support' : 'upgrade',
962
+ 'snippet',
963
+ 'title',
964
+ 'description',
965
+ 'keywords',
966
+ 'custom_link',
967
+ 'noindex',
968
+ 'nofollow',
969
+ 'noodp',
970
+ 'noydir',
971
+ 'titleatr',
972
+ 'menulabel',
973
+ 'sitemap_exclude',
974
+ 'disable',
975
+ 'disable_analytics',
976
+ ),
977
+ 'default_options' => array(
978
+ 'edit' => array(
979
+ 'type' => 'hidden',
980
+ 'default' => 'aiosp_edit',
981
+ 'prefix' => true,
982
+ 'nowrap' => 1,
983
+ ),
984
+ 'nonce-aioseop-edit' => array(
985
+ 'type' => 'hidden',
986
+ 'default' => null,
987
+ 'prefix' => false,
988
+ 'nowrap' => 1,
989
+ ),
990
+ 'upgrade' => array(
991
+ 'type' => 'html',
992
+ 'label' => 'none',
993
+ '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' ),
994
+ ),
995
+ 'support' => array(
996
+ 'type' => 'html',
997
+ 'label' => 'none',
998
+ 'default' => '<a target="_blank" href="https://semperplugins.com/support/">'
999
+ . __( 'Support Forum', 'all-in-one-seo-pack' ) . '</a>',
1000
+ ),
1001
+ 'snippet' => array(
1002
+ 'name' => __( 'Preview Snippet', 'all-in-one-seo-pack' ),
1003
+ 'type' => 'custom',
1004
+ 'label' => 'top',
1005
+ 'default' => '
1006
  <script>
1007
  jQuery(document).ready(function() {
1008
  jQuery("#aiosp_title_wrapper").bind("input", function() {
1013
  });
1014
  });
1015
  </script>
1016
+ <div class="preview_snippet"><div id="aioseop_snippet"><h3><a>%s</a></h3><div><div><cite id="aioseop_snippet_link">%s</cite></div><span id="aioseop_snippet_description">%s</span></div></div></div>',
1017
+ ),
1018
+ 'title' => array(
1019
+ 'name' => __( 'Title', 'all-in-one-seo-pack' ),
1020
+ 'type' => 'text',
1021
+ 'count' => true,
1022
+ 'size' => 60,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1023
  ),
1024
+ 'description' => array(
1025
+ 'name' => __( 'Description', 'all-in-one-seo-pack' ),
1026
+ 'type' => 'textarea',
1027
+ 'count' => true,
1028
+ 'cols' => 80,
1029
+ 'rows' => 2,
1030
  ),
1031
+
1032
+ 'keywords' => array(
1033
+ 'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ),
1034
+ 'type' => 'text',
 
1035
  ),
1036
+ 'custom_link' => array(
1037
+ 'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ),
1038
+ 'type' => 'text',
1039
+ 'size' => 60,
1040
  ),
1041
+ 'noindex' => array(
1042
+ 'name' => __( 'Robots Meta NOINDEX', 'all-in-one-seo-pack' ),
1043
+ 'default' => '',
 
1044
  ),
1045
+ 'nofollow' => array(
1046
+ 'name' => __( 'Robots Meta NOFOLLOW', 'all-in-one-seo-pack' ),
1047
+ 'default' => '',
 
1048
  ),
1049
+ 'noodp' => array( 'name' => __( 'Robots Meta NOODP', 'all-in-one-seo-pack' ) ),
1050
+ 'noydir' => array( 'name' => __( 'Robots Meta NOYDIR', 'all-in-one-seo-pack' ) ),
1051
+ 'titleatr' => array(
1052
+ 'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ),
1053
+ 'type' => 'text',
1054
+ 'size' => 60,
1055
  ),
1056
+ 'menulabel' => array(
1057
+ 'name' => __( 'Menu Label', 'all-in-one-seo-pack' ),
1058
+ 'type' => 'text',
1059
+ 'size' => 60,
1060
  ),
1061
+ 'sitemap_exclude' => array( 'name' => __( 'Exclude From Sitemap', 'all-in-one-seo-pack' ) ),
1062
+ 'disable' => array( 'name' => __( 'Disable on this page/post', 'all-in-one-seo-pack' ) ),
1063
+ 'disable_analytics' => array(
1064
+ 'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ),
1065
+ 'condshow' => array( 'aiosp_disable' => 'on' ),
1066
  ),
1067
+ ),
1068
+ 'display' => null,
1069
+ ),
1070
+ );
 
 
1071
 
1072
+ if ( ! empty( $meta_help_text ) ) {
1073
+ foreach ( $meta_help_text as $k => $v ) {
1074
+ $this->locations['aiosp']['default_options'][ $k ]['help_text'] = $v;
1075
+ }
1076
+ }
1077
+
1078
+ $this->layout = array(
1079
+ 'default' => array(
1080
+ 'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
1081
+ 'help_link' => 'https://semperplugins.com/documentation/general-settings/',
1082
+ 'options' => array(), // This is set below, to the remaining options -- pdb.
1083
+ ),
1084
+ 'home' => array(
1085
+ 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
1086
+ 'help_link' => 'https://semperplugins.com/documentation/home-page-settings/',
1087
+ 'options' => array( 'home_title', 'home_description', 'home_keywords', 'use_static_home_info' ),
1088
+ ),
1089
+ 'title' => array(
1090
+ 'name' => __( 'Title Settings', 'all-in-one-seo-pack' ),
1091
+ 'help_link' => 'https://semperplugins.com/documentation/title-settings/',
1092
+ 'options' => array(
1093
+ 'rewrite_titles',
1094
+ 'force_rewrites',
1095
+ 'cap_titles',
1096
+ 'cap_cats',
1097
+ 'home_page_title_format',
1098
+ 'page_title_format',
1099
+ 'post_title_format',
1100
+ 'category_title_format',
1101
+ 'archive_title_format',
1102
+ 'date_title_format',
1103
+ 'author_title_format',
1104
+ 'tag_title_format',
1105
+ 'search_title_format',
1106
+ 'description_format',
1107
+ '404_title_format',
1108
+ 'paged_format',
1109
+ ),
1110
+ ),
1111
+ 'cpt' => array(
1112
+ 'name' => __( 'Custom Post Type Settings', 'all-in-one-seo-pack' ),
1113
+ 'help_link' => 'http://semperplugins.com/documentation/custom-post-type-settings/',
1114
+ 'options' => array( 'enablecpost', 'cpostadvanced', 'taxactive', 'cpostactive', 'cposttitles' ),
1115
+ ),
1116
+ 'display' => array(
1117
+ 'name' => __( 'Display Settings', 'all-in-one-seo-pack' ),
1118
+ 'help_link' => 'http://semperplugins.com/documentation/display-settings/',
1119
+ 'options' => array( 'posttypecolumns', 'admin_bar', 'custom_menu_order' ),
1120
+ ),
1121
+ 'webmaster' => array(
1122
+ 'name' => __( 'Webmaster Verification', 'all-in-one-seo-pack' ),
1123
+ 'help_link' => 'http://semperplugins.com/sections/webmaster-verification/',
1124
+ 'options' => array( 'google_verify', 'bing_verify', 'pinterest_verify' ),
1125
+ ),
1126
+ 'google' => array(
1127
+ 'name' => __( 'Google Settings', 'all-in-one-seo-pack' ),
1128
+ 'help_link' => 'http://semperplugins.com/documentation/google-settings/',
1129
+ 'options' => array(
1130
+ 'google_publisher',
1131
+ 'google_disable_profile',
1132
+ 'google_sitelinks_search',
1133
+ 'google_set_site_name',
1134
+ 'google_specify_site_name',
1135
+ 'google_author_advanced',
1136
+ 'google_author_location',
1137
+ 'google_enable_publisher',
1138
+ 'google_specify_publisher',
1139
+ // "google_connect",
1140
+ 'google_analytics_id',
1141
+ 'ga_use_universal_analytics',
1142
+ 'ga_advanced_options',
1143
+ 'ga_domain',
1144
+ 'ga_multi_domain',
1145
+ 'ga_addl_domains',
1146
+ 'ga_anonymize_ip',
1147
+ 'ga_display_advertising',
1148
+ 'ga_exclude_users',
1149
+ 'ga_track_outbound_links',
1150
+ 'ga_link_attribution',
1151
+ 'ga_enhanced_ecommerce',
1152
+ ),
1153
+ ),
1154
+ 'noindex' => array(
1155
+ 'name' => __( 'Noindex Settings', 'all-in-one-seo-pack' ),
1156
+ 'help_link' => 'http://semperplugins.com/documentation/noindex-settings/',
1157
+ 'options' => array(
1158
+ 'cpostnoindex',
1159
+ 'cpostnofollow',
1160
+ 'cpostnoodp',
1161
+ 'cpostnoydir',
1162
+ 'category_noindex',
1163
+ 'archive_date_noindex',
1164
+ 'archive_author_noindex',
1165
+ 'tags_noindex',
1166
+ 'search_noindex',
1167
+ '404_noindex',
1168
+ 'tax_noindex',
1169
+ 'paginated_noindex',
1170
+ 'paginated_nofollow',
1171
+ 'noodp',
1172
+ 'noydir',
1173
+ ),
1174
+ ),
1175
+ 'advanced' => array(
1176
+ 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ),
1177
+ 'help_link' => 'http://semperplugins.com/documentation/advanced-settings/',
1178
+ 'options' => array(
1179
+ 'generate_descriptions',
1180
+ 'skip_excerpt',
1181
+ 'run_shortcodes',
1182
+ 'hide_paginated_descriptions',
1183
+ 'dont_truncate_descriptions',
1184
+ 'unprotect_meta',
1185
+ 'ex_pages',
1186
+ 'post_meta_tags',
1187
+ 'page_meta_tags',
1188
+ 'front_meta_tags',
1189
+ 'home_meta_tags',
1190
+ ),
1191
+ ),
1192
+ 'keywords' => array(
1193
+ 'name' => __( 'Keyword Settings', 'all-in-one-seo-pack' ),
1194
+ 'help_link' => 'http://semperplugins.com/documentation/keyword-settings/',
1195
+ 'options' => array(
1196
+ 'togglekeywords',
1197
+ 'use_categories',
1198
+ 'use_tags_as_keywords',
1199
+ 'dynamic_postspage_keywords',
1200
+ ),
1201
+ ),
1202
+ );
1203
+
1204
+ if ( ! AIOSEOPPRO ) {
1205
+ unset( $this->layout['cpt']['options']['2'] );
1206
+ }
1207
+
1208
+ $other_options = array();
1209
+ foreach ( $this->layout as $k => $v ) {
1210
+ $other_options = array_merge( $other_options, $v['options'] );
1211
+ }
1212
 
1213
+ $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
 
 
1214
 
1215
+ if ( is_admin() ) {
1216
+ $this->add_help_text_links();
1217
+ add_action( 'aioseop_global_settings_header', array( $this, 'display_right_sidebar' ) );
1218
+ add_action( 'aioseop_global_settings_footer', array( $this, 'display_settings_footer' ) );
1219
+ add_action( 'output_option', array( $this, 'custom_output_option' ), 10, 2 );
1220
+ add_action( 'all_admin_notices', array( $this, 'visibility_warning' ) );
1221
 
1222
+ if ( ! AIOSEOPPRO ) {
 
 
 
 
 
 
 
1223
  // add_action('all_admin_notices', array( $this, 'woo_upgrade_notice'));
1224
+ }
1225
+ }
1226
+ if ( AIOSEOPPRO ) {
1227
+ add_action( 'split_shared_term', array( $this, 'split_shared_term' ), 10, 4 );
1228
+ }
1229
+ }
1230
 
1231
+ //good candidate for pro dir
1232
+
1233
+ /**
1234
+ * Use custom callback for outputting snippet
1235
+ *
1236
+ * @param $buf
1237
+ * @param $args
1238
+ *
1239
+ * @return string
1240
+ */
1241
+ function custom_output_option( $buf, $args ) {
1242
+ if ( 'aiosp_snippet' === $args['name'] ) {
1243
+ $args['options']['type'] = 'html';
1244
+ $args['options']['nowrap'] = false;
1245
+ $args['options']['save'] = false;
1246
+ $info = $this->get_page_snippet_info();
1247
+ extract( $info );
1248
+ } else {
1249
+ return '';
1250
+ }
1251
+
1252
+ if ( $this->strlen( $title ) > 70 ) {
1253
+ $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...';
1254
+ }
1255
+ if ( $this->strlen( $description ) > 156 ) {
1256
+ $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...';
1257
+ }
1258
+ $extra_title_len = 0;
1259
+ if ( empty( $title_format ) ) {
1260
+ $title = '<span id="' . $args['name'] . '_title">' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . '</span>';
1261
+ } else {
1262
+ if ( strpos( $title_format, '%blog_title%' ) !== false ) {
1263
+ $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
1264
+ }
1265
+ $title_format = $this->apply_cf_fields( $title_format );
1266
+ $replace_title = '<span id="' . $args['name'] . '_title">' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . '</span>';
1267
+ if ( strpos( $title_format, '%post_title%' ) !== false ) {
1268
+ $title_format = str_replace( '%post_title%', $replace_title, $title_format );
1269
+ }
1270
+ if ( strpos( $title_format, '%page_title%' ) !== false ) {
1271
+ $title_format = str_replace( '%page_title%', $replace_title, $title_format );
1272
+ }
1273
+ if ( $w->is_category || $w->is_tag || $w->is_tax ) {
1274
+ if ( AIOSEOPPRO && ! empty( $_GET ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) {
1275
+ $term_id = intval( $_GET['tag_ID'] );
1276
+ $was_split = get_term_meta( $term_id, '_aioseop_term_was_split', true );
1277
+ if ( ! $was_split ) {
1278
+ $split_terms = wp_get_split_terms( $term_id, $_GET['taxonomy'] );
1279
+ if ( ! empty( $split_terms ) ) {
1280
+ foreach ( $split_terms as $new_tax => $new_term ) {
1281
+ $this->split_shared_term( $term_id, $new_term );
1282
+ }
1283
  }
1284
  }
 
1285
  }
1286
+ if ( strpos( $title_format, '%category_title%' ) !== false ) {
1287
+ $title_format = str_replace( '%category_title%', $replace_title, $title_format );
1288
+ }
1289
+ if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) {
1290
+ $title_format = str_replace( '%taxonomy_title%', $replace_title, $title_format );
1291
+ }
1292
+ } else {
1293
+ if ( strpos( $title_format, '%category%' ) !== false ) {
1294
+ $title_format = str_replace( '%category%', $category, $title_format );
1295
+ }
1296
+ if ( strpos( $title_format, '%category_title%' ) !== false ) {
1297
+ $title_format = str_replace( '%category_title%', $category, $title_format );
1298
+ }
1299
+ if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) {
1300
+ $title_format = str_replace( '%taxonomy_title%', $category, $title_format );
1301
+ }
1302
+ if ( AIOSEOPPRO ) {
1303
+ if ( strpos( $title_format, '%tax_' ) && ! empty( $p ) ) {
1304
+ $taxes = get_object_taxonomies( $p, 'objects' );
1305
+ if ( ! empty( $taxes ) ) {
1306
+ foreach ( $taxes as $t ) {
1307
+ if ( strpos( $title_format, "%tax_{$t->name}%" ) ) {
1308
+ $terms = $this->get_all_terms( $p->ID, $t->name );
1309
+ $term = '';
1310
+ if ( count( $terms ) > 0 ) {
1311
+ $term = $terms[0];
1312
+ }
1313
+ $title_format = str_replace( "%tax_{$t->name}%", $term, $title_format );
1314
+ }
1315
  }
 
1316
  }
1317
  }
1318
+ }
1319
+ }
1320
+ if ( strpos( $title_format, '%taxonomy_description%' ) !== false ) {
1321
+ $title_format = str_replace( '%taxonomy_description%', $description, $title_format );
1322
  }
1323
 
1324
+ $title_format = preg_replace( '/%([^%]*?)%/', '', $title_format );
1325
+ $title = $title_format;
1326
+ $extra_title_len = strlen( str_replace( $replace_title, '', $title_format ) );
1327
+ }
1328
+
1329
+ $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( wp_strip_all_tags( $description ) ) );
1330
+ $extra_title_len = (int) $extra_title_len;
1331
+ $args['value'] .= "<script>var aiosp_title_extra = {$extra_title_len};</script>";
1332
+ $buf = $this->get_option_row( $args['name'], $args['options'], $args );
1333
+
1334
+ return $buf;
1335
+ }
1336
+
1337
+ //good candidate for pro dir
1338
+
1339
+ /**
1340
+ * @return array
1341
+ */
1342
  function get_page_snippet_info() {
1343
+ static $info = array();
1344
+ if ( ! empty( $info ) ) {
1345
  return $info;
1346
+ }
1347
  global $post, $aioseop_options, $wp_query;
1348
  $title = $url = $description = $term = $category = '';
1349
+ $p = $post;
1350
+ $w = $wp_query;
1351
+ if ( ! is_object( $post ) ) {
1352
+ $post = $this->get_queried_object();
1353
+ }
1354
+ if ( empty( $this->meta_opts ) ) {
1355
+ $this->meta_opts = $this->get_current_options( array(), 'aiosp' );
1356
+ }
1357
+ if ( ! is_object( $post ) && is_admin() && ! empty( $_GET ) && ! empty( $_GET['post_type'] ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) ) {
1358
  $term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
1359
  }
1360
  if ( is_object( $post ) ) {
1361
+ $opts = $this->meta_opts;
1362
  $post_id = $p->ID;
1363
+ if ( empty( $post->post_modified_gmt ) ) {
1364
  $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
1365
+ }
1366
+ if ( 'page' === $post->post_type ) {
1367
  $wp_query->is_page = true;
1368
+ } elseif ( 'attachment' === $post->post_type ) {
1369
  $wp_query->is_attachment = true;
1370
+ } else {
1371
  $wp_query->is_single = true;
1372
+ }
1373
+ if ( empty( $this->is_front_page ) ) {
1374
+ $this->is_front_page = false;
1375
+ }
1376
+ if ( 'page' === get_option( 'show_on_front' ) ) {
1377
+ if ( is_page() && $post->ID == get_option( 'page_on_front' ) ) {
1378
+ $this->is_front_page = true;
1379
+ } elseif ( $post->ID == get_option( 'page_for_posts' ) ) {
1380
  $wp_query->is_home = true;
1381
+ }
1382
  }
1383
  $wp_query->queried_object = $post;
1384
+ if ( ! empty( $post ) && ! $wp_query->is_home && ! $this->is_front_page ) {
1385
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1386
+ if ( empty( $title ) ) {
1387
+ $title = $post->post_title;
1388
+ }
1389
  }
1390
  $title_format = '';
1391
  if ( empty( $title ) ) {
1393
  }
1394
  $description = $this->get_main_description( $post );
1395
  if ( empty( $title_format ) ) {
1396
+ if ( is_page() ) {
1397
  $title_format = $aioseop_options['aiosp_page_title_format'];
1398
+ } elseif ( is_single() || is_attachment() ) {
1399
  $title_format = $this->get_post_title_format( 'post', $post );
1400
+ }
1401
  }
1402
  if ( empty( $title_format ) ) {
1403
  $title_format = '%post_title%';
1404
  }
1405
  $categories = $this->get_all_categories( $post_id );
1406
+ $category = '';
1407
+ if ( count( $categories ) > 0 ) {
1408
  $category = $categories[0];
1409
+ }
1410
  } else if ( is_object( $term ) ) {
1411
+ if ( 'category' === $_GET['taxonomy'] ) {
1412
+ query_posts( array( 'cat' => $_GET['tag_ID'] ) );
1413
+ } else if ( 'post_tag' === $_GET['taxonomy'] ) {
1414
+ query_posts( array( 'tag' => $term->slug ) );
1415
  } else {
1416
+ query_posts( array(
1417
+ 'page' => '',
1418
+ $_GET['taxonomy'] => $term->slug,
1419
+ 'post_type' => $_GET['post_type'],
1420
+ ) );
1421
+ }
1422
+ if ( empty( $this->meta_opts ) ) {
1423
+ $this->meta_opts = $this->get_current_options( array(), 'aiosp' );
1424
  }
1425
+ $title = $this->get_tax_name( $_GET['taxonomy'] );
 
 
1426
  $title_format = $this->get_tax_title_format();
1427
+ $opts = $this->meta_opts;
1428
+ if ( ! empty( $opts ) ) {
1429
+ $description = $opts['aiosp_description'];
1430
+ }
1431
+ if ( empty( $description ) ) {
1432
+ $description = term_description();
1433
+ }
1434
  $description = $this->internationalize( $description );
1435
  }
1436
 
1437
  $show_page = true;
1438
+ if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
1439
+ $show_page = false;
1440
+ }
1441
  if ( $aioseop_options['aiosp_can'] ) {
1442
+ if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) {
1443
+ $url = $opts['aiosp_custom_link'];
1444
+ }
1445
+ if ( empty( $url ) ) {
1446
  $url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
1447
+ }
1448
  $url = apply_filters( 'aioseop_canonical_url', $url );
1449
  }
1450
+ if ( ! $url ) {
1451
+ $url = get_permalink();
1452
+ }
1453
 
1454
+ $title = $this->apply_cf_fields( $title );
1455
  $description = $this->apply_cf_fields( $description );
1456
  $description = apply_filters( 'aioseop_description', $description );
1457
 
1459
  $keywords = $this->apply_cf_fields( $keywords );
1460
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
1461
 
1462
+ $info = array(
1463
+ 'title' => $title,
1464
+ 'description' => $description,
1465
+ 'keywords' => $keywords,
1466
+ 'url' => $url,
1467
+ 'title_format' => $title_format,
1468
+ 'category' => $category,
1469
+ 'w' => $wp_query,
1470
+ 'p' => $post,
1471
+ );
1472
  wp_reset_postdata();
1473
+ $wp_query = $w;
1474
+ $post = $p;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1475
 
1476
+ return $info;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1477
  }
1478
 
1479
  /**
1480
+ * @return null|object|WP_Post
1481
  */
1482
+ function get_queried_object() {
1483
+ static $p = null;
1484
+ global $wp_query, $post;
1485
+ if ( null !== $p ) {
1486
+ return $p;
1487
  }
1488
+ if ( is_object( $post ) ) {
1489
+ $p = $post;
1490
+ } else {
1491
+ if ( ! $wp_query ) {
1492
+ return null;
 
 
 
 
 
 
 
 
 
1493
  }
1494
+ $p = $wp_query->get_queried_object();
1495
  }
 
1496
 
1497
+ return $p;
 
 
 
 
 
 
 
 
 
1498
  }
1499
 
1500
+ /**
1501
+ * @param array $opts
1502
+ * @param null $location
1503
+ * @param null $defaults
1504
+ * @param null $post
1505
+ *
1506
+ * @return array
1507
+ */
1508
+ function get_current_options( $opts = array(), $location = null, $defaults = null, $post = null ) {
1509
+ if ( ( 'aiosp' === $location) && ( 'metabox' == $this->locations[ $location ]['type'] ) ) {
1510
+ if ( null === $post ) {
1511
  global $post;
1512
  }
1513
  $post_id = $post;
1514
+ if ( is_object( $post_id ) ) {
1515
  $post_id = $post_id->ID;
1516
+ }
1517
  $get_opts = $this->default_options( $location );
1518
+ $optlist = array(
1519
+ 'keywords',
1520
+ 'description',
1521
+ 'title',
1522
+ 'custom_link',
1523
+ 'sitemap_exclude',
1524
+ 'disable',
1525
+ 'disable_analytics',
1526
+ 'noindex',
1527
+ 'nofollow',
1528
+ 'noodp',
1529
+ 'noydir',
1530
+ 'titleatr',
1531
+ 'menulabel',
1532
+ );
1533
+ if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
1534
+ unset( $optlist['custom_link'] );
1535
  }
1536
  foreach ( $optlist as $f ) {
1537
+ $meta = '';
1538
  $field = "aiosp_$f";
1539
 
1540
  if ( AIOSEOPPRO ) {
1543
  $meta = get_term_meta( $_GET['tag_ID'], '_aioseop_' . $f, true );
1544
  } else {
1545
  $queried_object = get_queried_object();
1546
+ if ( ! empty( $queried_object ) && ! empty( $queried_object->term_id ) ) {
1547
  $meta = get_term_meta( $queried_object->term_id, '_aioseop_' . $f, true );
1548
  }
1549
  }
1550
+ } else {
1551
  $meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
1552
+ }
1553
  if ( 'title' === $f || 'description' === $f ) {
1554
+ $get_opts[ $field ] = htmlspecialchars( $meta );
1555
  } else {
1556
+ $get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
1557
  }
1558
  } else {
1559
  $field = "aiosp_$f";
1560
+ $meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
1561
  if ( 'title' === $f || 'description' === $f ) {
1562
+ $get_opts[ $field ] = htmlspecialchars( $meta );
1563
  } else {
1564
+ $get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
1565
  }
1566
  }
1567
 
1568
  }
1569
  $opts = wp_parse_args( $opts, $get_opts );
1570
+
1571
  return $opts;
1572
  } else {
1573
  $options = parent::get_current_options( $opts, $location, $defaults );
1574
+
1575
  return $options;
1576
  }
1577
  }
1578
 
1579
+ /**
1580
+ * @param $in
1581
+ *
1582
+ * @return mixed|void
1583
+ */
1584
+ function internationalize( $in ) {
1585
+ if ( function_exists( 'langswitch_filter_langs_with_message' ) ) {
1586
+ $in = langswitch_filter_langs_with_message( $in );
1587
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1588
 
1589
+ if ( function_exists( 'polyglot_filter' ) ) {
1590
+ $in = polyglot_filter( $in );
1591
+ }
 
1592
 
1593
+ if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
1594
+ $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
1595
+ } elseif ( function_exists( 'ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
1596
+ $in = ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
1597
+ } elseif ( function_exists( 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
1598
+ $in = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
 
 
 
 
 
 
 
 
 
 
 
1599
  }
1600
+
1601
+ return apply_filters( 'localization', $in );
1602
  }
1603
 
1604
+ /*** Used to filter wp_title(), get our title. ***/
1605
+ function wp_title() {
1606
+ global $aioseop_options;
1607
+ $title = false;
1608
+ $post = $this->get_queried_object();
1609
+ if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
1610
+ $title = $this->get_aioseop_title( $post );
1611
+ $title = $this->apply_cf_fields( $title );
 
 
 
 
 
 
 
 
 
 
 
 
 
1612
  }
 
 
1613
 
1614
+ if ( false === $title ) {
1615
+ $title = $this->get_original_title();
1616
+ }
1617
+
1618
+ // 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?
1619
+ // The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums
1620
+ // if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
1621
+ // $title = $this->capitalize( $title );
1622
+
1623
+ return apply_filters( 'aioseop_title', $title );
1624
+ }
1625
+
1626
+ /**
1627
+ * Gets the title that will be used by AIOSEOP for title rewrites or returns false.
1628
+ *
1629
+ * @param $post
1630
+ *
1631
+ * @return bool|string
1632
+ */
1633
+ function get_aioseop_title( $post ) {
1634
+ global $aioseop_options;
1635
+ // the_search_query() is not suitable, it cannot just return.
1636
+ global $s, $STagging;
1637
+ $opts = $this->meta_opts;
1638
+ if ( is_front_page() ) {
1639
+ if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1640
+ global $post;
1641
+ if ( get_option( 'show_on_front' ) == 'page' && is_page() && $post->ID == get_option( 'page_on_front' ) ) {
1642
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1643
+ if ( ! $title ) {
1644
+ $title = $this->internationalize( $post->post_title );
1645
+ }
1646
+ if ( ! $title ) {
1647
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1648
+ }
1649
+ if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
1650
+ $title = $this->apply_page_title_format( $title, $post, $aioseop_options['aiosp_home_page_title_format'] );
1651
+ }
1652
+ $title = $this->paged_title( $title );
1653
+ $title = apply_filters( 'aioseop_home_page_title', $title );
1654
+ }
1655
+ } else {
1656
+ $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
1657
+ if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
1658
+ $title = $this->apply_page_title_format( $title, null, $aioseop_options['aiosp_home_page_title_format'] );
1659
+ }
1660
+ }
1661
+ if ( empty( $title ) ) {
1662
+ $title = $this->internationalize( get_option( 'blogname' ) ) . ' | ' . $this->internationalize( get_bloginfo( 'description' ) );
1663
+ }
1664
+
1665
+ global $post;
1666
+ $post_id = $post->ID;
1667
+
1668
+ if ( is_post_type_archive() && is_post_type_archive( 'product' ) && $post_id = woocommerce_get_page_id( 'shop' ) && $post = get_post( $post_id ) ) {
1669
+ $frontpage_id = get_option( 'page_on_front' );
1670
+
1671
+ if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1672
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1673
+ }
1674
+ // $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
1675
+ if ( ! $title ) {
1676
+ $title = $this->internationalize( get_post_meta( $frontpage_id, '_aioseop_title', true ) );
1677
+ } // This is/was causing the first product to come through.
1678
+ if ( ! $title ) {
1679
+ $title = $this->internationalize( $post->post_title );
1680
+ }
1681
+ if ( ! $title ) {
1682
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1683
+ }
1684
+
1685
+ $title = $this->apply_page_title_format( $title, $post );
1686
+ $title = $this->paged_title( $title );
1687
+ $title = apply_filters( 'aioseop_title_page', $title );
1688
+
1689
+ return $title;
1690
+
1691
+ }
1692
+
1693
+ return $this->paged_title( $title ); //this is returned for woo
1694
+ } else if ( is_attachment() ) {
1695
+ if ( null === $post ) {
1696
+ return false;
1697
+ }
1698
+ $title = get_post_meta( $post->ID, '_aioseop_title', true );
1699
+ if ( empty( $title ) ) {
1700
+ $title = $post->post_title;
1701
+ }
1702
+ if ( empty( $title ) ) {
1703
+ $title = $this->get_original_title( '', false );
1704
+ }
1705
+ if ( empty( $title ) ) {
1706
+ $title = get_the_title( $post->post_parent );
1707
+ }
1708
+ $title = apply_filters( 'aioseop_attachment_title', $this->internationalize( $this->apply_post_title_format( $title, '', $post ) ) );
1709
+
1710
+ return $title;
1711
+ } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && ! $this->is_static_posts_page() ) ) {
1712
+ if ( null === $post ) {
1713
+ return false;
1714
+ }
1715
+ if ( $this->is_static_front_page() && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) {
1716
+ if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
1717
+ $home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] );
1718
+ }
1719
+
1720
+ // Home title filter.
1721
+ return apply_filters( 'aioseop_home_page_title', $home_title );
1722
+ } else {
1723
+ $page_for_posts = '';
1724
+ if ( is_home() ) {
1725
+ $page_for_posts = get_option( 'page_for_posts' );
1726
+ }
1727
+ if ( $page_for_posts ) {
1728
+ $title = $this->internationalize( get_post_meta( $page_for_posts, '_aioseop_title', true ) );
1729
+ if ( ! $title ) {
1730
+ $post_page = get_post( $page_for_posts );
1731
+ $title = $this->internationalize( $post_page->post_title );
1732
+ }
1733
+ } else {
1734
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1735
+ if ( ! $title ) {
1736
+ $title = $this->internationalize( $post->post_title );
1737
+ }
1738
+ }
1739
+ if ( ! $title ) {
1740
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1741
+ }
1742
+
1743
+ $title = $this->apply_page_title_format( $title, $post );
1744
+ $title = $this->paged_title( $title );
1745
+ $title = apply_filters( 'aioseop_title_page', $title );
1746
+ if ( $this->is_static_posts_page() ) {
1747
+ $title = apply_filters( 'single_post_title', $title );
1748
+ }
1749
+
1750
+ return $title;
1751
+ }
1752
+ } 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 ) ) ) {
1753
+ // Too far down? -mrt.
1754
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1755
+ if ( ! $title ) {
1756
+ $title = $this->internationalize( $post->post_title );
1757
+ }
1758
+ if ( ! $title ) {
1759
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1760
+ }
1761
+ $title = $this->apply_page_title_format( $title, $post );
1762
+ $title = $this->paged_title( $title );
1763
+ $title = apply_filters( 'aioseop_title_page', $title );
1764
+
1765
+ return $title;
1766
+ } else if ( is_single() ) {
1767
+ // We're not in the loop :(.
1768
+ if ( null === $post ) {
1769
+ return false;
1770
+ }
1771
+ $categories = $this->get_all_categories();
1772
+ $category = '';
1773
+ if ( count( $categories ) > 0 ) {
1774
+ $category = $categories[0];
1775
+ }
1776
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1777
+ if ( ! $title ) {
1778
+ $title = $this->internationalize( get_post_meta( $post->ID, 'title_tag', true ) );
1779
+ if ( ! $title ) {
1780
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1781
+ }
1782
+ }
1783
+ if ( empty( $title ) ) {
1784
+ $title = $post->post_title;
1785
+ }
1786
+ if ( ! empty( $title ) ) {
1787
+ $title = $this->apply_post_title_format( $title, $category, $post );
1788
+ }
1789
+ $title = $this->paged_title( $title );
1790
+
1791
+ return apply_filters( 'aioseop_title_single', $title );
1792
+ } else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
1793
+ $search = esc_attr( stripslashes( $s ) );
1794
+ if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
1795
+ $search = $this->capitalize( $search );
1796
+ }
1797
+ $title_format = $aioseop_options['aiosp_search_title_format'];
1798
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1799
+ if ( strpos( $title, '%blog_description%' ) !== false ) {
1800
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
1801
+ }
1802
+ if ( strpos( $title, '%search%' ) !== false ) {
1803
+ $title = str_replace( '%search%', $search, $title );
1804
+ }
1805
+ $title = $this->paged_title( $title );
1806
+
1807
+ return $title;
1808
+ } else if ( is_tag() ) {
1809
+ global $utw;
1810
+ $tag = $tag_description = '';
1811
+ if ( $utw ) {
1812
+ $tags = $utw->GetCurrentTagSet();
1813
+ $tag = $tags[0]->tag;
1814
+ $tag = str_replace( '-', ' ', $tag );
1815
+ } else {
1816
+ if ( AIOSEOPPRO ) {
1817
+ if ( ! empty( $opts ) && ! empty( $opts['aiosp_title'] ) ) {
1818
+ $tag = $opts['aiosp_title'];
1819
+ }
1820
+ if ( ! empty( $opts ) ) {
1821
+ if ( ! empty( $opts['aiosp_title'] ) ) {
1822
+ $tag = $opts['aiosp_title'];
1823
+ }
1824
+ if ( ! empty( $opts['aiosp_description'] ) ) {
1825
+ $tag_description = $opts['aiosp_description'];
1826
+ }
1827
+ }
1828
+ }
1829
+ if ( empty( $tag ) ) {
1830
+ $tag = $this->get_original_title( '', false );
1831
+ }
1832
+ if ( empty( $tag_description ) ) {
1833
+ $tag_description = tag_description();
1834
+ }
1835
+ $tag = $this->internationalize( $tag );
1836
+ $tag_description = $this->internationalize( $tag_description );
1837
+ }
1838
+ if ( $tag ) {
1839
+ if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
1840
+ $tag = $this->capitalize( $tag );
1841
+ }
1842
+ $title_format = $aioseop_options['aiosp_tag_title_format'];
1843
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1844
+ if ( strpos( $title, '%blog_description%' ) !== false ) {
1845
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
1846
+ }
1847
+ if ( strpos( $title, '%tag%' ) !== false ) {
1848
+ $title = str_replace( '%tag%', $tag, $title );
1849
+ }
1850
+ if ( strpos( $title, '%tag_description%' ) !== false ) {
1851
+ $title = str_replace( '%tag_description%', $tag_description, $title );
1852
+ }
1853
+ if ( strpos( $title, '%taxonomy_description%' ) !== false ) {
1854
+ $title = str_replace( '%taxonomy_description%', $tag_description, $title );
1855
+ }
1856
+ $title = trim( wp_strip_all_tags( $title ) );
1857
+ $title = str_replace( array( '"', "\r\n", "\n" ), array( '&quot;', ' ', ' ' ), $title );
1858
+ $title = $this->paged_title( $title );
1859
+
1860
+ return $title;
1861
+ }
1862
+ } else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
1863
+ return $this->get_tax_title();
1864
+ } else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // Simple tagging support.
1865
+ $tag = $STagging->search_tag;
1866
+ if ( $tag ) {
1867
+ if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
1868
+ $tag = $this->capitalize( $tag );
1869
+ }
1870
+ $title_format = $aioseop_options['aiosp_tag_title_format'];
1871
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1872
+ if ( strpos( $title, '%blog_description%' ) !== false ) {
1873
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
1874
+ }
1875
+ if ( strpos( $title, '%tag%' ) !== false ) {
1876
+ $title = str_replace( '%tag%', $tag, $title );
1877
+ }
1878
+ $title = $this->paged_title( $title );
1879
+
1880
+ return $title;
1881
+ }
1882
+ } else if ( is_archive() || is_post_type_archive() ) {
1883
+ if ( is_author() ) {
1884
+ $author = $this->internationalize( $this->get_original_title( '', false ) );
1885
+ $title_format = $aioseop_options['aiosp_author_title_format'];
1886
+ $new_title = str_replace( '%author%', $author, $title_format );
1887
+ } else if ( is_date() ) {
1888
+ global $wp_query;
1889
+ $date = $this->internationalize( $this->get_original_title( '', false ) );
1890
+ $title_format = $aioseop_options['aiosp_date_title_format'];
1891
+ $new_title = str_replace( '%date%', $date, $title_format );
1892
+ $day = get_query_var( 'day' );
1893
+ if ( empty( $day ) ) {
1894
+ $day = '';
1895
+ }
1896
+ $new_title = str_replace( '%day%', $day, $new_title );
1897
+ $monthnum = get_query_var( 'monthnum' );
1898
+ $year = get_query_var( 'year' );
1899
+ if ( empty( $monthnum ) || is_year() ) {
1900
+ $month = '';
1901
+ $monthnum = 0;
1902
+ }
1903
+ $month = date( 'F', mktime( 0, 0, 0, (int) $monthnum, 1, (int) $year ) );
1904
+ $new_title = str_replace( '%monthnum%', $monthnum, $new_title );
1905
+ if ( strpos( $new_title, '%month%' ) !== false ) {
1906
+ $new_title = str_replace( '%month%', $month, $new_title );
1907
+ }
1908
+ if ( strpos( $new_title, '%year%' ) !== false ) {
1909
+ $new_title = str_replace( '%year%', get_query_var( 'year' ), $new_title );
1910
+ }
1911
+ } else if ( is_post_type_archive() ) {
1912
+ if ( empty( $title ) ) {
1913
+ $title = $this->get_original_title( '', false );
1914
+ }
1915
+ $new_title = apply_filters( 'aioseop_archive_title', $this->apply_archive_title_format( $title ) );
1916
+ } else {
1917
+ return false;
1918
+ }
1919
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $new_title );
1920
+ if ( strpos( $new_title, '%blog_description%' ) !== false ) {
1921
+ $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
1922
+ }
1923
+ $title = trim( $new_title );
1924
+ $title = $this->paged_title( $title );
1925
+
1926
+ return $title;
1927
+ } else if ( is_404() ) {
1928
+ $title_format = $aioseop_options['aiosp_404_title_format'];
1929
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1930
+ if ( strpos( $new_title, '%blog_description%' ) !== false ) {
1931
+ $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
1932
+ }
1933
+ if ( strpos( $new_title, '%request_url%' ) !== false ) {
1934
+ $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title );
1935
+ }
1936
+ if ( strpos( $new_title, '%request_words%' ) !== false ) {
1937
+ $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title );
1938
+ }
1939
+ if ( strpos( $new_title, '%404_title%' ) !== false ) {
1940
+ $new_title = str_replace( '%404_title%', $this->internationalize( $this->get_original_title( '', false ) ), $new_title );
1941
+ }
1942
+
1943
+ return $new_title;
1944
+ }
1945
+
1946
+ return false;
1947
+ }
1948
+
1949
+ /**
1950
+ * @param string $sep
1951
+ * @param bool $echo
1952
+ * @param string $seplocation
1953
+ *
1954
+ * @return The original title as delivered by WP (well, in most cases).
1955
+ */
1956
+ function get_original_title( $sep = '|', $echo = false, $seplocation = '' ) {
1957
+ global $aioseop_options;
1958
+ if ( ! empty( $aioseop_options['aiosp_use_original_title'] ) ) {
1959
+ $has_filter = has_filter( 'wp_title', array( $this, 'wp_title' ) );
1960
+ if ( false !== $has_filter ) {
1961
+ remove_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter );
1962
+ }
1963
+ if ( current_theme_supports( 'title-tag' ) ) {
1964
+ $sep = '|';
1965
+ $echo = false;
1966
+ $seplocation = 'right';
1967
+ }
1968
+ $title = wp_title( $sep, $echo, $seplocation );
1969
+ if ( false !== $has_filter ) {
1970
+ add_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter );
1971
+ }
1972
+ if ( $title && ( $title = trim( $title ) ) ) {
1973
+ return trim( $title );
1974
+ }
1975
+ }
1976
+
1977
+ // the_search_query() is not suitable, it cannot just return.
1978
+ global $s;
1979
+
1980
+ $title = null;
1981
+
1982
+ if ( is_home() ) {
1983
+ $title = get_option( 'blogname' );
1984
+ } else if ( is_single() ) {
1985
+ $title = $this->internationalize( single_post_title( '', false ) );
1986
+ } else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
1987
+ $search = esc_attr( stripslashes( $s ) );
1988
+ if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
1989
+ $search = $this->capitalize( $search );
1990
+ }
1991
+ $title = $search;
1992
+ } else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
1993
+ $category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) );
1994
+ $title = $category_name;
1995
+ } else if ( is_page() ) {
1996
+ $title = $this->internationalize( single_post_title( '', false ) );
1997
+ } else if ( is_tag() ) {
1998
+ global $utw;
1999
+ if ( $utw ) {
2000
+ $tags = $utw->GetCurrentTagSet();
2001
+ $tag = $tags[0]->tag;
2002
+ $tag = str_replace( '-', ' ', $tag );
2003
+ } else {
2004
+ // For WordPress > 2.3.
2005
+ $tag = $this->internationalize( single_term_title( '', false ) );
2006
+ }
2007
+ if ( $tag ) {
2008
+ $title = $tag;
2009
+ }
2010
+ } else if ( is_author() ) {
2011
+ $author = get_userdata( get_query_var( 'author' ) );
2012
+ if ( $author === false ) {
2013
+ global $wp_query;
2014
+ $author = $wp_query->get_queried_object();
2015
+ }
2016
+ if ( $author !== false ) {
2017
+ $title = $author->display_name;
2018
+ }
2019
+ } else if ( is_day() ) {
2020
+ $title = get_the_date();
2021
+ } else if ( is_month() ) {
2022
+ $title = get_the_date( 'F, Y' );
2023
+ } else if ( is_year() ) {
2024
+ $title = get_the_date( 'Y' );
2025
+ } else if ( is_archive() ) {
2026
+ $title = $this->internationalize( post_type_archive_title( '', false ) );
2027
+ } else if ( is_404() ) {
2028
+ $title_format = $aioseop_options['aiosp_404_title_format'];
2029
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
2030
+ if ( strpos( $new_title, '%blog_description%' ) !== false ) {
2031
+ $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2032
+ }
2033
+ if ( strpos( $new_title, '%request_url%' ) !== false ) {
2034
+ $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title );
2035
+ }
2036
+ if ( strpos( $new_title, '%request_words%' ) !== false ) {
2037
+ $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title );
2038
+ }
2039
+ $title = $new_title;
2040
+ }
2041
+
2042
+ return trim( $title );
2043
+ }
2044
+
2045
+ /**
2046
+ * @param $s
2047
+ *
2048
+ * @return string
2049
+ */
2050
+ function capitalize( $s ) {
2051
+ $s = trim( $s );
2052
+ $tokens = explode( ' ', $s );
2053
+ while ( list( $key, $val ) = each( $tokens ) ) {
2054
+ $tokens[ $key ] = trim( $tokens[ $key ] );
2055
+ $tokens[ $key ] = $this->strtoupper( $this->substr( $tokens[ $key ], 0, 1 ) ) . $this->substr( $tokens[ $key ], 1 );
2056
+ }
2057
+ $s = implode( ' ', $tokens );
2058
+
2059
+ return $s;
2060
+ }
2061
+
2062
+ /**
2063
+ * @param $request
2064
+ *
2065
+ * @return User -readable nice words for a given request.
2066
+ */
2067
+ function request_as_words( $request ) {
2068
+ $request = htmlspecialchars( $request );
2069
+ $request = str_replace( '.html', ' ', $request );
2070
+ $request = str_replace( '.htm', ' ', $request );
2071
+ $request = str_replace( '.', ' ', $request );
2072
+ $request = str_replace( '/', ' ', $request );
2073
+ $request = str_replace( '-', ' ', $request );
2074
+ $request_a = explode( ' ', $request );
2075
+ $request_new = array();
2076
+ foreach ( $request_a as $token ) {
2077
+ $request_new[] = $this->ucwords( trim( $token ) );
2078
+ }
2079
+ $request = implode( ' ', $request_new );
2080
+
2081
+ return $request;
2082
+ }
2083
+
2084
+ /**
2085
+ * @param $title
2086
+ * @param null $p
2087
+ * @param string $title_format
2088
+ *
2089
+ * @return string
2090
+ */
2091
+ function apply_page_title_format( $title, $p = null, $title_format = '' ) {
2092
+ global $aioseop_options;
2093
+ if ( $p === null ) {
2094
+ global $post;
2095
+ } else {
2096
+ $post = $p;
2097
+ }
2098
+ if ( empty( $title_format ) ) {
2099
+ $title_format = $aioseop_options['aiosp_page_title_format'];
2100
+ }
2101
+
2102
+ return $this->title_placeholder_helper( $title, $post, 'page', $title_format );
2103
+ }
2104
+
2105
+ /**
2106
+ * @param $title
2107
+ * @param $post
2108
+ * @param string $type
2109
+ * @param string $title_format
2110
+ * @param string $category
2111
+ *
2112
+ * @return string
2113
+ */
2114
+ function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
2115
+ if ( ! empty( $post ) ) {
2116
+ $authordata = get_userdata( $post->post_author );
2117
+ } else {
2118
+ $authordata = new WP_User();
2119
+ }
2120
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
2121
+ if ( strpos( $new_title, '%blog_description%' ) !== false ) {
2122
+ $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2123
+ }
2124
+ if ( strpos( $new_title, "%{$type}_title%" ) !== false ) {
2125
+ $new_title = str_replace( "%{$type}_title%", $title, $new_title );
2126
+ }
2127
+ if ( $type == 'post' ) {
2128
+ if ( strpos( $new_title, '%category%' ) !== false ) {
2129
+ $new_title = str_replace( '%category%', $category, $new_title );
2130
+ }
2131
+ if ( strpos( $new_title, '%category_title%' ) !== false ) {
2132
+ $new_title = str_replace( '%category_title%', $category, $new_title );
2133
+ }
2134
+ if ( strpos( $new_title, '%tax_' ) && ! empty( $post ) ) {
2135
+ $taxes = get_object_taxonomies( $post, 'objects' );
2136
+ if ( ! empty( $taxes ) ) {
2137
+ foreach ( $taxes as $t ) {
2138
+ if ( strpos( $new_title, "%tax_{$t->name}%" ) ) {
2139
+ $terms = $this->get_all_terms( $post->ID, $t->name );
2140
+ $term = '';
2141
+ if ( count( $terms ) > 0 ) {
2142
+ $term = $terms[0];
2143
+ }
2144
+ $new_title = str_replace( "%tax_{$t->name}%", $term, $new_title );
2145
+ }
2146
+ }
2147
+ }
2148
+ }
2149
+ }
2150
+ if ( strpos( $new_title, "%{$type}_author_login%" ) !== false ) {
2151
+ $new_title = str_replace( "%{$type}_author_login%", $authordata->user_login, $new_title );
2152
+ }
2153
+ if ( strpos( $new_title, "%{$type}_author_nicename%" ) !== false ) {
2154
+ $new_title = str_replace( "%{$type}_author_nicename%", $authordata->user_nicename, $new_title );
2155
+ }
2156
+ if ( strpos( $new_title, "%{$type}_author_firstname%" ) !== false ) {
2157
+ $new_title = str_replace( "%{$type}_author_firstname%", $this->ucwords( $authordata->first_name ), $new_title );
2158
+ }
2159
+ if ( strpos( $new_title, "%{$type}_author_lastname%" ) !== false ) {
2160
+ $new_title = str_replace( "%{$type}_author_lastname%", $this->ucwords( $authordata->last_name ), $new_title );
2161
+ }
2162
+ $title = trim( $new_title );
2163
+
2164
+ return $title;
2165
+ }
2166
+
2167
+ /**
2168
+ * @param $id
2169
+ * @param $taxonomy
2170
+ *
2171
+ * @return array
2172
+ */
2173
+ function get_all_terms( $id, $taxonomy ) {
2174
+ $keywords = array();
2175
+ $terms = get_the_terms( $id, $taxonomy );
2176
+ if ( ! empty( $terms ) ) {
2177
+ foreach ( $terms as $term ) {
2178
+ $keywords[] = $this->internationalize( $term->name );
2179
+ }
2180
+ }
2181
+
2182
+ return $keywords;
2183
+ }
2184
+
2185
+ /**
2186
+ * @param $title
2187
+ *
2188
+ * @return string
2189
+ */
2190
+ function paged_title( $title ) {
2191
+ // The page number if paged.
2192
+ global $paged;
2193
+ global $aioseop_options;
2194
+ // Simple tagging support.
2195
+ global $STagging;
2196
+ $page = get_query_var( 'page' );
2197
+ if ( $paged > $page ) {
2198
+ $page = $paged;
2199
+ }
2200
+ if ( is_paged() || ( isset( $STagging ) && $STagging->is_tag_view() && $paged ) || ( $page > 1 ) ) {
2201
+ $part = $this->internationalize( $aioseop_options['aiosp_paged_format'] );
2202
+ if ( isset( $part ) || ! empty( $part ) ) {
2203
+ $part = ' ' . trim( $part );
2204
+ $part = str_replace( '%page%', $page, $part );
2205
+ $this->log( "paged_title() [$title] [$part]" );
2206
+ $title .= $part;
2207
+ }
2208
+ }
2209
+
2210
+ return $title;
2211
+ }
2212
+
2213
+ /**
2214
+ * @param $message
2215
+ */
2216
+ function log( $message ) {
2217
+ if ( $this->do_log ) {
2218
+ @error_log( date( 'Y-m-d H:i:s' ) . ' ' . $message . "\n", 3, $this->log_file );
2219
+ }
2220
+ }
2221
+
2222
+ /**
2223
+ * @param $title
2224
+ * @param string $category
2225
+ * @param null $p
2226
+ *
2227
+ * @return string
2228
+ */
2229
+ function apply_post_title_format( $title, $category = '', $p = null ) {
2230
+ if ( $p === null ) {
2231
+ global $post;
2232
+ } else {
2233
+ $post = $p;
2234
+ }
2235
+ $title_format = $this->get_post_title_format( 'post', $post );
2236
+
2237
+ return $this->title_placeholder_helper( $title, $post, 'post', $title_format, $category );
2238
+ }
2239
+
2240
+ /**
2241
+ * @param string $title_type
2242
+ * @param null $p
2243
+ *
2244
+ * @return bool|string
2245
+ */
2246
+ function get_post_title_format( $title_type = 'post', $p = null ) {
2247
+ global $aioseop_options;
2248
+ if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) {
2249
+ return false;
2250
+ }
2251
+ $title_format = "%{$title_type}_title% | %blog_title%";
2252
+ if ( isset( $aioseop_options["aiosp_{$title_type}_title_format"] ) ) {
2253
+ $title_format = $aioseop_options["aiosp_{$title_type}_title_format"];
2254
+ }
2255
+ if ( ! empty( $aioseop_options['aiosp_enablecpost'] ) && ! empty( $aioseop_options['aiosp_cpostactive'] ) ) {
2256
+ $wp_post_types = $aioseop_options['aiosp_cpostactive'];
2257
+ if ( ! empty( $aioseop_options['aiosp_cposttitles'] ) ) {
2258
+ if ( ( ( $title_type == 'archive' ) && is_post_type_archive( $wp_post_types ) && $prefix = "aiosp_{$title_type}_" ) ||
2259
+ ( ( $title_type == 'post' ) && $this->is_singular( $wp_post_types, $p ) && $prefix = 'aiosp_' )
2260
+ ) {
2261
+ $post_type = get_post_type( $p );
2262
+ if ( ! empty( $aioseop_options["{$prefix}{$post_type}_title_format"] ) ) {
2263
+ $title_format = $aioseop_options["{$prefix}{$post_type}_title_format"];
2264
+ }
2265
+ }
2266
+ }
2267
+ }
2268
+
2269
+ return $title_format;
2270
+ }
2271
+
2272
+ /**
2273
+ * @param array $post_types
2274
+ * @param null $post
2275
+ *
2276
+ * @return bool
2277
+ */
2278
+ function is_singular( $post_types = array(), $post = null ) {
2279
+ if ( ! empty( $post_types ) && is_object( $post ) ) {
2280
+ return in_array( $post->post_type, (array) $post_types );
2281
+ } else {
2282
+ return is_singular( $post_types );
2283
+ }
2284
+ }
2285
+
2286
+ /**
2287
+ * @return bool|null
2288
+ */
2289
+ function is_static_posts_page() {
2290
+ static $is_posts_page = null;
2291
+ if ( $is_posts_page !== null ) {
2292
+ return $is_posts_page;
2293
+ }
2294
+ $post = $this->get_queried_object();
2295
+ $is_posts_page = ( get_option( 'show_on_front' ) == 'page' && is_home() && ! empty( $post ) && $post->ID == get_option( 'page_for_posts' ) );
2296
+
2297
+ return $is_posts_page;
2298
+ }
2299
+
2300
+ /**
2301
+ * @return bool|null
2302
+ */
2303
+ function is_static_front_page() {
2304
+ if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) {
2305
+ return $this->is_front_page;
2306
+ }
2307
+ $post = $this->get_queried_object();
2308
+ $this->is_front_page = ( get_option( 'show_on_front' ) == 'page' && is_page() && ! empty( $post ) && $post->ID == get_option( 'page_on_front' ) );
2309
+
2310
+ return $this->is_front_page;
2311
+ }
2312
+
2313
+ /**
2314
+ * @param int $id
2315
+ *
2316
+ * @return array
2317
+ */
2318
+ function get_all_categories( $id = 0 ) {
2319
+ $keywords = array();
2320
+ $categories = get_the_category( $id );
2321
+ if ( ! empty( $categories ) ) {
2322
+ foreach ( $categories as $category ) {
2323
+ $keywords[] = $this->internationalize( $category->cat_name );
2324
+ }
2325
+ }
2326
+
2327
+ return $keywords;
2328
+ }
2329
+
2330
+ /**
2331
+ * @param string $tax
2332
+ *
2333
+ * @return string
2334
+ */
2335
+ function get_tax_title( $tax = '' ) {
2336
+ if ( AIOSEOPPRO ) {
2337
+ if ( empty( $this->meta_opts ) ) {
2338
+ $this->meta_opts = $this->get_current_options( array(), 'aiosp' );
2339
+ }
2340
+ }
2341
+ if ( empty( $tax ) ) {
2342
+ if ( is_category() ) {
2343
+ $tax = 'category';
2344
+ } else {
2345
+ $tax = get_query_var( 'taxonomy' );
2346
+ }
2347
+ }
2348
+ $name = $this->get_tax_name( $tax );
2349
+ $desc = $this->get_tax_desc( $tax );
2350
 
2351
+ return $this->apply_tax_title_format( $name, $desc, $tax );
2352
+ }
2353
+
2354
+ // Handle prev / next links.
2355
+
2356
+ /**
2357
+ * @param $tax
2358
+ *
2359
+ * @return mixed|void
2360
+ */
2361
+ function get_tax_name( $tax ) {
2362
+ global $aioseop_options;
2363
+ if ( AIOSEOPPRO ) {
2364
+ $opts = $this->meta_opts;
2365
+ if ( ! empty( $opts ) ) {
2366
+ $name = $opts['aiosp_title'];
2367
+ }
2368
+ } else {
2369
+ $name = '';
2370
  }
2371
+ if ( empty( $name ) ) {
2372
+ $name = single_term_title( '', false );
2373
+ }
2374
+ // 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?
2375
+ // if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) )
2376
+ // $name = $this->ucwords( $name );
2377
+
2378
+ return $this->internationalize( $name );
2379
  }
2380
 
2381
+ /**
2382
+ * @param $tax
2383
+ *
2384
+ * @return mixed|void
2385
+ */
2386
+ function get_tax_desc( $tax ) {
2387
+ if ( AIOSEOPPRO ) {
2388
+ $opts = $this->meta_opts;
2389
+ if ( ! empty( $opts ) ) {
2390
+ $desc = $opts['aiosp_description'];
2391
+ }
2392
+ } else {
2393
+ $desc = '';
2394
+ }
2395
+ if ( empty( $desc ) ) {
2396
+ $desc = term_description( '', $tax );
2397
+ }
2398
+
2399
+ return $this->internationalize( $desc );
2400
+ }
2401
+
2402
+ /**
2403
+ * @param $category_name
2404
+ * @param $category_description
2405
+ * @param string $tax
2406
+ *
2407
+ * @return string
2408
+ */
2409
+ function apply_tax_title_format( $category_name, $category_description, $tax = '' ) {
2410
+ if ( empty( $tax ) ) {
2411
+ $tax = get_query_var( 'taxonomy' );
2412
+ }
2413
+ $title_format = $this->get_tax_title_format( $tax );
2414
+ $title = str_replace( '%taxonomy_title%', $category_name, $title_format );
2415
+ if ( strpos( $title, '%taxonomy_description%' ) !== false ) {
2416
+ $title = str_replace( '%taxonomy_description%', $category_description, $title );
2417
+ }
2418
+ if ( strpos( $title, '%category_title%' ) !== false ) {
2419
+ $title = str_replace( '%category_title%', $category_name, $title );
2420
+ }
2421
+ if ( strpos( $title, '%category_description%' ) !== false ) {
2422
+ $title = str_replace( '%category_description%', $category_description, $title );
2423
+ }
2424
+ if ( strpos( $title, '%blog_title%' ) !== false ) {
2425
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title );
2426
+ }
2427
+ if ( strpos( $title, '%blog_description%' ) !== false ) {
2428
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
2429
+ }
2430
+ $title = wp_strip_all_tags( $title );
2431
+
2432
+ return $this->paged_title( $title );
2433
+ }
2434
+
2435
+ /**
2436
+ * @param string $tax
2437
+ *
2438
+ * @return string
2439
+ */
2440
+ function get_tax_title_format( $tax = '' ) {
2441
  global $aioseop_options;
2442
+ if ( AIOSEOPPRO ) {
2443
+ $title_format = '%taxonomy_title% | %blog_title%';
2444
+ if ( is_category() ) {
2445
+ $title_format = $aioseop_options['aiosp_category_title_format'];
2446
+ } else {
2447
+ $taxes = $aioseop_options['aiosp_taxactive'];
2448
+ if ( empty( $tax ) ) {
2449
+ $tax = get_query_var( 'taxonomy' );
2450
+ }
2451
+ if ( ! empty( $aioseop_options["aiosp_{$tax}_tax_title_format"] ) ) {
2452
+ $title_format = $aioseop_options["aiosp_{$tax}_tax_title_format"];
2453
+ }
2454
+ }
2455
+ if ( empty( $title_format ) ) {
2456
+ $title_format = '%category_title% | %blog_title%';
2457
+ }
2458
  } else {
2459
+ $title_format = '%category_title% | %blog_title%';
2460
+ if ( ! empty( $aioseop_options['aiosp_category_title_format'] ) ) {
2461
+ $title_format = $aioseop_options['aiosp_category_title_format'];
2462
+ }
2463
+
2464
+ return $title_format;
2465
+ }
2466
+
2467
+ return $title_format;
2468
+ }
2469
+
2470
+ /**
2471
+ * @param $title
2472
+ * @param string $category
2473
+ *
2474
+ * @return string
2475
+ */
2476
+ function apply_archive_title_format( $title, $category = '' ) {
2477
+ $title_format = $this->get_archive_title_format();
2478
+ $r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' );
2479
+ $d_title = array(
2480
+ $this->internationalize( get_bloginfo( 'name' ) ),
2481
+ $this->internationalize( get_bloginfo( 'description' ) ),
2482
+ post_type_archive_title( '', false ),
2483
+ );
2484
+ $title = trim( str_replace( $r_title, $d_title, $title_format ) );
2485
+
2486
+ return $title;
2487
+ }
2488
+
2489
+ /**
2490
+ * @return bool|string
2491
+ */
2492
+ function get_archive_title_format() {
2493
+ return $this->get_post_title_format( 'archive' );
2494
+ }
2495
+
2496
+ /**
2497
+ * @param null $post
2498
+ *
2499
+ * @return mixed|string|void
2500
+ */
2501
+ function get_main_description( $post = null ) {
2502
+ global $aioseop_options;
2503
+ $opts = $this->meta_opts;
2504
+ $description = '';
2505
+ if ( is_author() && $this->show_page_description() ) {
2506
+ $description = $this->internationalize( get_the_author_meta( 'description' ) );
2507
+ } 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 ) ) ) {
2508
+ // $description = $this->get_post_description( $post );
2509
+ // $description = $this->apply_cf_fields( $description );
2510
+ if ( ! ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ) {
2511
+ $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
2512
+ } else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2513
+ // $description = $this->get_aioseop_description( $post );
2514
+ $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
2515
+ } else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2516
+ $description = $this->get_aioseop_description( $post );
2517
+ }
2518
+ } else if ( is_front_page() ) {
2519
+ $description = $this->get_aioseop_description( $post );
2520
+ } else if ( is_single() || is_page() || is_attachment() || is_home() || $this->is_static_posts_page() ) {
2521
+ $description = $this->get_aioseop_description( $post );
2522
+ } else if ( ( is_category() || is_tag() || is_tax() ) && $this->show_page_description() ) {
2523
+ if ( ! empty( $opts ) && AIOSEOPPRO ) {
2524
+ $description = $opts['aiosp_description'];
2525
+ }
2526
+ if ( empty( $description ) ) {
2527
+ $description = term_description();
2528
+ }
2529
+ $description = $this->internationalize( $description );
2530
+ }
2531
+ if ( empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) {
2532
+ $description = $this->trim_excerpt_without_filters( $description );
2533
+ }
2534
+
2535
+ return $description;
2536
+ }
2537
+
2538
+ /**
2539
+ * @return bool
2540
+ */
2541
+ function show_page_description() {
2542
+ global $aioseop_options;
2543
+ if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
2544
+ $page = $this->get_page_number();
2545
+ if ( ! empty( $page ) && ( $page > 1 ) ) {
2546
+ return false;
2547
+ }
2548
+ }
2549
+
2550
+ return true;
2551
+ }
2552
+
2553
+ /**
2554
+ * @return mixed
2555
+ */
2556
+ function get_page_number() {
2557
+ $page = get_query_var( 'page' );
2558
+ if ( empty( $page ) ) {
2559
+ $page = get_query_var( 'paged' );
2560
+ }
2561
+
2562
+ return $page;
2563
+ }
2564
+
2565
+ /**
2566
+ * @param null $post
2567
+ *
2568
+ * @return mixed|string
2569
+ */
2570
+ function get_aioseop_description( $post = null ) {
2571
+ global $aioseop_options;
2572
+ if ( null === $post ) {
2573
+ $post = $GLOBALS['post'];
2574
+ }
2575
+ $blog_page = aiosp_common::get_blog_page();
2576
+ $description = '';
2577
+ if ( is_front_page() && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2578
+ $description = trim( $this->internationalize( $aioseop_options['aiosp_home_description'] ) );
2579
+ } elseif ( ! empty( $blog_page ) ) {
2580
+ $description = $this->get_post_description( $blog_page );
2581
+ }
2582
+ if ( empty( $description ) && is_object( $post ) && ! is_archive() && empty( $blog_page ) ) {
2583
+ $description = $this->get_post_description( $post );
2584
+ }
2585
+ $description = $this->apply_cf_fields( $description );
2586
+
2587
+ return $description;
2588
+ }
2589
+
2590
+ /**
2591
+ * @param $post
2592
+ *
2593
+ * @return mixed|string
2594
+ */
2595
+ function get_post_description( $post ) {
2596
+ global $aioseop_options;
2597
+ $description = '';
2598
+ if ( ! $this->show_page_description() ) {
2599
+ return '';
2600
+ }
2601
+ $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
2602
+ if ( ! empty( $post ) && post_password_required( $post ) ) {
2603
+ return $description;
2604
+ }
2605
+ if ( ! $description ) {
2606
+ if ( empty( $aioseop_options['aiosp_skip_excerpt'] ) ) {
2607
+ $description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) );
2608
+ }
2609
+ if ( ! $description && isset( $aioseop_options['aiosp_generate_descriptions'] ) && $aioseop_options['aiosp_generate_descriptions'] ) {
2610
+ $content = $post->post_content;
2611
+ if ( ! empty( $aioseop_options['aiosp_run_shortcodes'] ) ) {
2612
+ $content = do_shortcode( $content );
2613
+ }
2614
+ $content = wp_strip_all_tags( $content );
2615
+ $description = $this->trim_excerpt_without_filters( $this->internationalize( $content ) );
2616
+ }
2617
+ }
2618
+
2619
+ // Internal whitespace trim.
2620
+ $description = preg_replace( '/\s\s+/u', ' ', $description );
2621
+
2622
+ return $description;
2623
+ }
2624
+
2625
+ /**
2626
+ * @param $text
2627
+ *
2628
+ * @return string
2629
+ */
2630
+ function trim_excerpt_without_filters_full_length( $text ) {
2631
+ $text = str_replace( ']]>', ']]&gt;', $text );
2632
+ $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
2633
+ $text = wp_strip_all_tags( $text );
2634
+
2635
+ return trim( $text );
2636
+ }
2637
+
2638
+ /**
2639
+ * @param $text
2640
+ * @param int $max
2641
+ *
2642
+ * @return string
2643
+ */
2644
+ function trim_excerpt_without_filters( $text, $max = 0 ) {
2645
+ $text = str_replace( ']]>', ']]&gt;', $text );
2646
+ $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
2647
+ $text = wp_strip_all_tags( $text );
2648
+ // Treat other common word-break characters like a space.
2649
+ $text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text );
2650
+ if ( ! $max ) {
2651
+ $max = $this->maximum_description_length;
2652
+ }
2653
+ $max_orig = $max;
2654
+ $len = $this->strlen( $text2 );
2655
+ if ( $max < $len ) {
2656
+ if ( function_exists( 'mb_strrpos' ) ) {
2657
+ $pos = mb_strrpos( $text2, ' ', - ( $len - $max ) );
2658
+ if ( false === $pos ) {
2659
+ $pos = $max;
2660
+ }
2661
+ if ( $pos > $this->minimum_description_length ) {
2662
+ $max = $pos;
2663
+ } else {
2664
+ $max = $this->minimum_description_length;
2665
+ }
2666
+ } else {
2667
+ while ( ' ' != $text2[ $max ] && $max > $this->minimum_description_length ) {
2668
+ $max --;
2669
+ }
2670
+ }
2671
+
2672
+ // Probably no valid chars to break on?
2673
+ if ( $len > $max_orig && $max < intval( $max_orig / 2 ) ) {
2674
+ $max = $max_orig;
2675
+ }
2676
+ }
2677
+ $text = $this->substr( $text, 0, $max );
2678
+
2679
+ return trim( $text );
2680
+ }
2681
+
2682
+ /**
2683
+ * @param $query
2684
+ * @param bool $show_page
2685
+ *
2686
+ * @return bool|false|string
2687
+ */
2688
+ function aiosp_mrt_get_url( $query, $show_page = true ) {
2689
+ if ( $query->is_404 || $query->is_search ) {
2690
+ return false;
2691
+ }
2692
+ $link = '';
2693
+ $haspost = count( $query->posts ) > 0;
2694
+ if ( get_query_var( 'm' ) ) {
2695
+ $m = preg_replace( '/[^0-9]/', '', get_query_var( 'm' ) );
2696
+ switch ( $this->strlen( $m ) ) {
2697
+ case 4:
2698
+ $link = get_year_link( $m );
2699
+ break;
2700
+ case 6:
2701
+ $link = get_month_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ) );
2702
+ break;
2703
+ case 8:
2704
+ $link = get_day_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ), $this->substr( $m, 6, 2 ) );
2705
+ break;
2706
+ default:
2707
+ return false;
2708
+ }
2709
+ } elseif ( $query->is_home && ( get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) {
2710
+ $link = get_permalink( $pageid );
2711
+ } elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) {
2712
+ if ( function_exists( 'icl_get_home_url' ) ) {
2713
+ $link = icl_get_home_url();
2714
  } else {
2715
+ $link = trailingslashit( home_url() );
2716
+ }
2717
+ } elseif ( ( $query->is_single || $query->is_page ) && $haspost ) {
2718
+ $post = $query->posts[0];
2719
+ $link = get_permalink( $post->ID );
2720
+ } elseif ( $query->is_author && $haspost ) {
2721
+ $author = get_userdata( get_query_var( 'author' ) );
2722
+ if ( false === $author ) {
2723
+ return false;
2724
+ }
2725
+ $link = get_author_posts_url( $author->ID, $author->user_nicename );
2726
+ } elseif ( $query->is_category && $haspost ) {
2727
+ $link = get_category_link( get_query_var( 'cat' ) );
2728
+ } elseif ( $query->is_tag && $haspost ) {
2729
+ $tag = get_term_by( 'slug', get_query_var( 'tag' ), 'post_tag' );
2730
+ if ( ! empty( $tag->term_id ) ) {
2731
+ $link = get_tag_link( $tag->term_id );
2732
+ }
2733
+ } elseif ( $query->is_day && $haspost ) {
2734
+ $link = get_day_link( get_query_var( 'year' ),
2735
+ get_query_var( 'monthnum' ),
2736
+ get_query_var( 'day' ) );
2737
+ } elseif ( $query->is_month && $haspost ) {
2738
+ $link = get_month_link( get_query_var( 'year' ),
2739
+ get_query_var( 'monthnum' ) );
2740
+ } elseif ( $query->is_year && $haspost ) {
2741
+ $link = get_year_link( get_query_var( 'year' ) );
2742
+ } elseif ( $query->is_tax && $haspost ) {
2743
+ $taxonomy = get_query_var( 'taxonomy' );
2744
+ $term = get_query_var( 'term' );
2745
+ if ( ! empty( $term ) ) {
2746
+ $link = get_term_link( $term, $taxonomy );
2747
+ }
2748
+ } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
2749
+ if ( is_array( $post_type ) ) {
2750
+ $post_type = reset( $post_type );
2751
  }
2752
+ $link = get_post_type_archive_link( $post_type );
2753
+ } else {
2754
+ return false;
2755
  }
2756
+ if ( empty( $link ) || ! is_string( $link ) ) {
2757
+ return false;
 
 
 
 
 
 
2758
  }
2759
+ if ( apply_filters( 'aioseop_canonical_url_pagination', $show_page ) ) {
2760
+ $link = $this->get_paged( $link );
2761
+ }
2762
+ if ( ! empty( $link ) ) {
2763
+ global $aioseop_options;
2764
+ if ( isset( $aioseop_options['aiosp_can_set_protocol'] ) && ( 'auto' !== $aioseop_options['aiosp_can_set_protocol'] ) ) {
2765
+ if ( 'http' === $aioseop_options['aiosp_can_set_protocol'] ) {
2766
+ $link = preg_replace( '/^https:/i', 'http:', $link );
2767
+ } elseif ( 'https' === $aioseop_options['aiosp_can_set_protocol'] ) {
2768
+ $link = preg_replace( '/^http:/i', 'https:', $link );
2769
  }
2770
  }
 
2771
  }
2772
 
2773
+ return $link;
 
 
2774
  }
2775
 
2776
+ /**
2777
+ * @param $link
2778
+ *
2779
+ * @return string
2780
+ */
2781
+ function get_paged( $link ) {
2782
+ global $wp_rewrite;
2783
+ $page = $this->get_page_number();
2784
+ $page_name = 'page';
2785
+ if ( ! empty( $wp_rewrite ) && ! empty( $wp_rewrite->pagination_base ) ) {
2786
+ $page_name = $wp_rewrite->pagination_base;
2787
+ }
2788
+ if ( ! empty( $page ) && $page > 1 ) {
2789
+ if ( $page == get_query_var( 'page' ) ) {
2790
+ $link = trailingslashit( $link ) . "$page";
2791
+ } else {
2792
+ $link = trailingslashit( $link ) . trailingslashit( $page_name ) . $page;
2793
+ }
2794
+ $link = user_trailingslashit( $link, 'paged' );
2795
  }
 
2796
 
2797
+ return $link;
 
2798
  }
2799
 
2800
+ /**
2801
+ * @return comma|string
2802
+ */
2803
+ function get_main_keywords() {
2804
+ global $aioseop_options;
2805
+ global $aioseop_keywords;
2806
+ global $post;
2807
+ $opts = $this->meta_opts;
2808
+ if ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && ! $this->is_static_posts_page() ) || $this->is_static_front_page() ) {
2809
+ if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2810
+ $keywords = $this->get_all_keywords();
2811
+ } else {
2812
+ $keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) );
 
 
 
 
 
 
 
2813
  }
2814
+ } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) {
2815
+ $keywords = stripslashes( $this->internationalize( $opts['aiosp_keywords'] ) ); // And if option = use page set keywords instead of keywords from recent posts.
2816
+ } elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
2817
+ $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, '_aioseop_keywords', true ) ) );
2818
+ } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) {
2819
+ $keywords = '';
2820
  } else {
2821
+ $keywords = $this->get_all_keywords();
 
 
 
 
 
 
 
 
 
2822
  }
 
 
 
 
 
 
 
 
2823
 
2824
+ return $keywords;
 
 
 
 
 
2825
  }
2826
 
2827
+ /**
2828
+ * @return comma-separated list of unique keywords
2829
+ */
2830
+ function get_all_keywords() {
2831
+ global $posts;
2832
  global $aioseop_options;
2833
+ if ( is_404() ) {
2834
+ return null;
2835
+ }
2836
+ // If we are on synthetic pages.
2837
+ 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() ) {
2838
+ return null;
2839
+ }
2840
+ $keywords = array();
2841
+ $opts = $this->meta_opts;
2842
+ if ( ! empty( $opts['aiosp_keywords'] ) ) {
2843
+ $traverse = $this->keyword_string_to_list( $this->internationalize( $opts['aiosp_keywords'] ) );
2844
+ if ( ! empty( $traverse ) ) {
2845
+ foreach ( $traverse as $keyword ) {
2846
+ $keywords[] = $keyword;
2847
+ }
2848
+ }
2849
+ }
2850
+ if ( empty( $posts ) ) {
2851
+ global $post;
2852
+ $post_arr = array( $post );
2853
+ } else {
2854
+ $post_arr = $posts;
2855
+ }
2856
+ if ( is_array( $post_arr ) ) {
2857
+ $postcount = count( $post_arr );
2858
+ foreach ( $post_arr as $p ) {
2859
+ if ( $p ) {
2860
+ $id = $p->ID;
2861
+ if ( 1 == $postcount || ! empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
2862
+ // Custom field keywords.
2863
+ $keywords_i = null;
2864
+ $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) );
2865
+ if ( is_attachment() ) {
2866
+ $id = $p->post_parent;
2867
+ if ( empty( $keywords_i ) ) {
2868
+ $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) );
2869
+ }
2870
+ }
2871
+ $traverse = $this->keyword_string_to_list( $keywords_i );
2872
+ if ( ! empty( $traverse ) ) {
2873
+ foreach ( $traverse as $keyword ) {
2874
+ $keywords[] = $keyword;
2875
+ }
2876
+ }
2877
+ }
2878
 
2879
+ if ( ! empty( $aioseop_options['aiosp_use_tags_as_keywords'] ) ) {
2880
+ $keywords = array_merge( $keywords, $this->get_all_tags( $id ) );
2881
+ }
2882
+ // Autometa.
2883
+ $autometa = stripslashes( get_post_meta( $id, 'autometa', true ) );
2884
+ if ( isset( $autometa ) && ! empty( $autometa ) ) {
2885
+ $autometa_array = explode( ' ', $autometa );
2886
+ foreach ( $autometa_array as $e ) {
2887
+ $keywords[] = $e;
2888
+ }
2889
+ }
2890
 
2891
+ if ( isset( $aioseop_options['aiosp_use_categories'] ) && $aioseop_options['aiosp_use_categories'] && ! is_page() ) {
2892
+ $keywords = array_merge( $keywords, $this->get_all_categories( $id ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2893
  }
2894
  }
2895
  }
2896
  }
2897
+
2898
+ return $this->get_unique_keywords( $keywords );
2899
  }
2900
 
2901
+ /**
2902
+ * @param $keywords
2903
+ *
2904
+ * @return array
2905
+ */
2906
+ function keyword_string_to_list( $keywords ) {
2907
+ $traverse = array();
2908
+ $keywords_i = str_replace( '"', '', $keywords );
2909
+ if ( isset( $keywords_i ) && ! empty( $keywords_i ) ) {
2910
+ $traverse = explode( ',', $keywords_i );
2911
+ }
2912
+
2913
+ return $traverse;
2914
+ }
2915
+
2916
+ /**
2917
+ * @param int $id
2918
+ *
2919
+ * @return array
2920
+ */
2921
+ function get_all_tags( $id = 0 ) {
2922
+ $keywords = array();
2923
+ $tags = get_the_tags( $id );
2924
+ if ( ! empty( $tags ) && is_array( $tags ) ) {
2925
+ foreach ( $tags as $tag ) {
2926
+ $keywords[] = $this->internationalize( $tag->name );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2927
  }
2928
+ }
2929
+ // Ultimate Tag Warrior integration.
2930
+ global $utw;
2931
+ if ( $utw ) {
2932
+ $tags = $utw->GetTagsForPost( $p );
2933
+ if ( is_array( $tags ) ) {
2934
+ foreach ( $tags as $tag ) {
2935
+ $tag = $tag->tag;
2936
+ $tag = str_replace( '_', ' ', $tag );
2937
+ $tag = str_replace( '-', ' ', $tag );
2938
+ $tag = stripslashes( $tag );
2939
+ $keywords[] = $tag;
2940
+ }
2941
  }
2942
  }
 
 
2943
 
2944
+ return $keywords;
2945
+ }
 
 
 
2946
 
2947
+ /**
2948
+ * @param $keywords
2949
+ *
2950
+ * @return string
2951
+ */
2952
+ function get_unique_keywords( $keywords ) {
2953
+ return implode( ',', $this->clean_keyword_list( $keywords ) );
2954
+ }
2955
 
2956
+ /**
2957
+ * @param $keywords
2958
+ *
2959
+ * @return array
2960
+ */
2961
+ function clean_keyword_list( $keywords ) {
2962
+ $small_keywords = array();
2963
+ if ( ! is_array( $keywords ) ) {
2964
+ $keywords = $this->keyword_string_to_list( $keywords );
2965
+ }
2966
+ if ( ! empty( $keywords ) ) {
2967
+ foreach ( $keywords as $word ) {
2968
+ $small_keywords[] = trim( $this->strtolower( $word ) );
2969
+ }
2970
+ }
2971
 
2972
+ return array_unique( $small_keywords );
2973
+ }
 
2974
 
2975
+ /**
2976
+ * @param $term_id
2977
+ * @param $new_term_id
2978
+ * @param string $term_taxonomy_id
2979
+ * @param string $taxonomy
2980
+ */
2981
+ function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id = '', $taxonomy = '' ) {
2982
+ $terms = $this->get_all_term_data( $term_id );
2983
+ if ( ! empty( $terms ) ) {
2984
+ $new_terms = $this->get_all_term_data( $new_term_id );
2985
+ if ( empty( $new_terms ) ) {
2986
+ foreach ( $terms as $k => $v ) {
2987
+ add_term_meta( $new_term_id, $k, $v, true );
2988
  }
2989
+ add_term_meta( $term_id, '_aioseop_term_was_split', true, true );
2990
  }
2991
  }
2992
+ }
 
 
 
2993
 
2994
+ /**
2995
+ * @param $term_id
2996
+ *
2997
+ * @return array
2998
+ */
2999
+ function get_all_term_data( $term_id ) {
3000
+ $terms = array();
3001
+ $optlist = array(
3002
+ 'keywords',
3003
+ 'description',
3004
+ 'title',
3005
+ 'custom_link',
3006
+ 'sitemap_exclude',
3007
+ 'disable',
3008
+ 'disable_analytics',
3009
+ 'noindex',
3010
+ 'nofollow',
3011
+ 'noodp',
3012
+ 'noydir',
3013
+ 'titleatr',
3014
+ 'menulabel',
3015
+ );
3016
+ foreach ( $optlist as $f ) {
3017
+ $meta = get_term_meta( $term_id, '_aioseop_' . $f, true );
3018
+ if ( ! empty( $meta ) ) {
3019
+ $terms[ '_aioseop_' . $f ] = $meta;
3020
  }
3021
  }
3022
 
3023
+ return $terms;
3024
  }
3025
 
3026
+ function add_page_icon() {
3027
+ wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
3028
+ wp_enqueue_style( 'wp-pointer' );
3029
+ $this->add_admin_pointers();
 
 
 
 
 
 
 
 
 
 
 
 
3030
 
3031
+ wp_enqueue_style( 'aiosp_admin_style', AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css' );
3032
+ ?>
3033
+ <script>
3034
+ function aioseop_show_pointer(handle, value) {
3035
+ if (typeof( jQuery ) != 'undefined') {
3036
+ var p_edge = 'bottom';
3037
+ var p_align = 'center';
3038
+ if (typeof( jQuery(value.pointer_target).pointer) != 'undefined') {
3039
+ if (typeof( value.pointer_edge ) != 'undefined') p_edge = value.pointer_edge;
3040
+ if (typeof( value.pointer_align ) != 'undefined') p_align = value.pointer_align;
3041
+ jQuery(value.pointer_target).pointer({
3042
+ content: value.pointer_text,
3043
+ position: {
3044
+ edge: p_edge,
3045
+ align: p_align
3046
+ },
3047
+ close: function () {
3048
+ jQuery.post(ajaxurl, {
3049
+ pointer: handle,
3050
+ action: 'dismiss-wp-pointer'
3051
+ });
3052
+ }
3053
+ }).pointer('open');
3054
+ }
3055
+ }
3056
+ }
3057
+ <?php
3058
+ if ( ! empty( $this->pointers ) ) {
3059
+ ?>
3060
+ if (typeof( jQuery ) != 'undefined') {
3061
+ jQuery(document).ready(function () {
3062
+ var admin_pointer;
3063
+ var admin_index;
3064
+ <?php
3065
+ foreach ( $this->pointers as $k => $p )
3066
+ {if ( ! empty( $p['pointer_scope'] ) && ( 'global' === $p['pointer_scope'] ) ) {
3067
+ ?>admin_index = "<?php echo esc_attr( $k ); ?>";
3068
+ admin_pointer = <?php echo json_encode( $p ); ?>;
3069
+ aioseop_show_pointer(admin_index, admin_pointer);
3070
+ <?php
3071
+ }
3072
+ } ?>
3073
+ });
3074
  }
3075
+ <?php } ?>
3076
+ </script>
3077
+ <?php
3078
+ }
3079
+
3080
+ function add_admin_pointers() {
3081
+ if ( AIOSEOPPRO ) {
3082
+ $this->pointers['aioseop_menu_236'] = array(
3083
+ 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-pro-aioseop_class',
3084
+ 'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
3085
+ . '</h3><p>' . __( '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' ) . '</p>',
3086
+ 'pointer_edge' => 'top',
3087
+ 'pointer_align' => 'left',
3088
+ 'pointer_scope' => 'global',
3089
+ );
3090
+ $this->pointers['aioseop_welcome_230'] = array(
3091
+ 'pointer_target' => '#aioseop_top_button',
3092
+ 'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
3093
+ . '</h3><p>' . __( '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' ) . '</p>',
3094
+ 'pointer_edge' => 'bottom',
3095
+ 'pointer_align' => 'left',
3096
+ 'pointer_scope' => 'local',
3097
+ );
3098
+ $this->filter_pointers();
3099
+ } else {
3100
+ $this->pointers['aioseop_menu_220'] = array(
3101
+ 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class',
3102
+ 'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
3103
+ . '</h3><p>' . __( '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' ) . '</p>',
3104
+ 'pointer_edge' => 'top',
3105
+ 'pointer_align' => 'left',
3106
+ 'pointer_scope' => 'global',
3107
+ );
3108
+ $this->pointers['aioseop_welcome_220'] = array(
3109
+ 'pointer_target' => '#aioseop_top_button',
3110
+ 'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
3111
+ . '</h3><p>' . __( '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' ) . '</p>',
3112
+ 'pointer_edge' => 'bottom',
3113
+ 'pointer_align' => 'left',
3114
+ 'pointer_scope' => 'local',
3115
+ );
3116
+ $this->filter_pointers();
3117
+ }
3118
  }
3119
 
3120
+ function add_page_hooks() {
 
 
3121
 
3122
+ global $aioseop_options;
3123
 
3124
+ $post_objs = get_post_types( '', 'objects' );
3125
+ $pt = array_keys( $post_objs );
3126
+ $rempost = array( 'revision', 'nav_menu_item' );
3127
+ $pt = array_diff( $pt, $rempost );
3128
+ $post_types = array();
3129
 
3130
+ $aiosp_enablecpost = '';
3131
+ if ( isset( $_REQUEST['aiosp_enablecpost'] ) ) {
3132
+ $aiosp_enablecpost = $_REQUEST['aiosp_enablecpost'];
3133
+ }
3134
 
3135
+ foreach ( $pt as $p ) {
3136
+ if ( ! empty( $post_objs[ $p ]->label ) ) {
3137
+ if ( $post_objs[ $p ]->_builtin && empty( $aioseop_options['aiosp_enablecpost'] ) ) {
3138
+ $post_types[ $p ] = $post_objs[ $p ]->label;
3139
+ } elseif ( ! empty( $aioseop_options['aiosp_enablecpost'] ) || $aiosp_enablecpost == 'on' ) {
3140
+ $post_types[ $p ] = $post_objs[ $p ]->label;
3141
+ }
3142
+ } else {
3143
+ $post_types[ $p ] = $p;
3144
  }
3145
+ }
3146
 
3147
+ foreach ( $pt as $p ) {
3148
+ if ( ! empty( $post_objs[ $p ]->label ) ) {
3149
+ $all_post_types[ $p ] = $post_objs[ $p ]->label;
3150
+ }
3151
+ }
 
3152
 
3153
+ $taxes = get_taxonomies( '', 'objects' );
3154
+ $tx = array_keys( $taxes );
3155
+ $remtax = array( 'nav_menu', 'link_category', 'post_format' );
3156
+ $tx = array_diff( $tx, $remtax );
3157
+ $tax_types = array();
3158
+ foreach ( $tx as $t ) {
3159
+ if ( ! empty( $taxes[ $t ]->label ) ) {
3160
+ $tax_types[ $t ] = $taxes[ $t ]->label;
3161
+ } else {
3162
+ $taxes[ $t ] = $t;
3163
+ }
3164
+ }
3165
+ $this->default_options['posttypecolumns']['initial_options'] = $post_types;
3166
+ $this->default_options['cpostactive']['initial_options'] = $all_post_types;
3167
+ $this->default_options['cpostnoindex']['initial_options'] = $post_types;
3168
+ $this->default_options['cpostnofollow']['initial_options'] = $post_types;
3169
+ $this->default_options['cpostnoodp']['initial_options'] = $post_types;
3170
+ $this->default_options['cpostnoydir']['initial_options'] = $post_types;
3171
+ if ( AIOSEOPPRO ) {
3172
+ $this->default_options['taxactive']['initial_options'] = $tax_types;
3173
+ }
3174
+ $this->default_options['google_author_location']['initial_options'] = $post_types;
3175
+ $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' ) ) );
3176
+ $this->default_options['google_author_location']['default'] = array_keys( $this->default_options['google_author_location']['initial_options'] );
3177
 
3178
+ foreach ( $post_types as $p => $pt ) {
3179
+ $field = $p . '_title_format';
3180
+ $name = $post_objs[ $p ]->labels->singular_name;
3181
+ if ( ! isset( $this->default_options[ $field ] ) ) {
3182
+ $this->default_options[ $field ] = array(
3183
+ 'name' => "$name " . __( 'Title Format:', 'all-in-one-seo-pack' ) . "<br />($p)",
3184
+ 'type' => 'text',
3185
+ 'default' => '%post_title% | %blog_title%',
3186
+ 'condshow' => array(
3187
+ 'aiosp_rewrite_titles' => 1,
3188
+ 'aiosp_enablecpost' => 'on',
3189
+ 'aiosp_cpostadvanced' => 'on',
3190
+ 'aiosp_cposttitles' => 'on',
3191
+ 'aiosp_cpostactive\[\]' => $p,
3192
+ ),
3193
+ );
3194
+ $this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' )
3195
+ . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
3196
+ __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
3197
+ __( '%post_title% - The original title of the post.', 'all-in-one-seo-pack' ) . '</li><li>';
3198
+ $taxes = get_object_taxonomies( $p, 'objects' );
3199
+ if ( ! empty( $taxes ) ) {
3200
+ foreach ( $taxes as $n => $t ) {
3201
+ $this->help_text[ $field ] .= sprintf( __( "%%tax_%s%% - This post's associated %s taxonomy title", 'all-in-one-seo-pack' ), $n, $t->label ) . '</li><li>';
3202
+ }
3203
+ }
3204
+ $this->help_text[ $field ] .=
3205
+ __( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
3206
+ __( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
3207
+ __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
3208
+ __( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
3209
+ '</ul>';
3210
+ $this->help_anchors[ $field ] = '#custom-titles';
3211
+ $this->layout['cpt']['options'][] = $field;
 
3212
  }
3213
  }
3214
+ global $wp_roles;
3215
+ if ( ! isset( $wp_roles ) ) {
3216
+ $wp_roles = new WP_Roles();
3217
+ }
3218
+ $role_names = $wp_roles->get_names();
3219
+ ksort( $role_names );
3220
+ $this->default_options['ga_exclude_users']['initial_options'] = $role_names;
 
3221
 
3222
+ unset( $tax_types['category'] );
3223
+ unset( $tax_types['post_tag'] );
3224
+ $this->default_options['tax_noindex']['initial_options'] = $tax_types;
3225
+ if ( empty( $tax_types ) ) {
3226
+ unset( $this->default_options['tax_noindex'] );
 
 
 
 
 
 
 
 
 
 
 
 
3227
  }
3228
+
3229
+ if ( AIOSEOPPRO ) {
3230
+ foreach ( $tax_types as $p => $pt ) {
3231
+ $field = $p . '_tax_title_format';
3232
+ $name = $pt;
3233
+ if ( ! isset( $this->default_options[ $field ] ) ) {
3234
+ $this->default_options[ $field ] = array(
3235
+ 'name' => "$name " . __( 'Taxonomy Title Format:', 'all-in-one-seo-pack' ),
3236
+ 'type' => 'text',
3237
+ 'default' => '%taxonomy_title% | %blog_title%',
3238
+ 'condshow' => array(
3239
+ 'aiosp_rewrite_titles' => 1,
3240
+ 'aiosp_enablecpost' => 'on',
3241
+ 'aiosp_cpostadvanced' => 'on',
3242
+ 'aiosp_cposttitles' => 'on',
3243
+ 'aiosp_taxactive\[\]' => $p,
3244
+ ),
3245
+ );
3246
+ $this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' ) .
3247
+ '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
3248
+ __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
3249
+ __( '%taxonomy_title% - The original title of the taxonomy', 'all-in-one-seo-pack' ) . '</li><li>' .
3250
+ __( '%taxonomy_description% - The description of the taxonomy', 'all-in-one-seo-pack' ) . '</li></ul>';
3251
+ $this->help_anchors[ $field ] = '#custom-titles';
3252
+ $this->layout['cpt']['options'][] = $field;
3253
+ }
3254
+ }
3255
  }
3256
+ $this->setting_options();
3257
+ $this->add_help_text_links();
3258
+
3259
+ if ( AIOSEOPPRO ) {
3260
+ global $aioseop_update_checker;
3261
+ add_action( "{$this->prefix}update_options", array(
3262
+ $aioseop_update_checker,
3263
+ 'license_change_check',
3264
+ ), 10, 2 );
3265
+ add_action( "{$this->prefix}settings_update", array( $aioseop_update_checker, 'update_check' ), 10, 2 );
3266
  }
 
 
3267
 
3268
+ add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 );
3269
+ parent::add_page_hooks();
 
 
 
 
3270
  }
3271
 
3272
+ function settings_page_init() {
3273
+ add_filter( "{$this->prefix}submit_options", array( $this, 'filter_submit' ) );
3274
+ }
 
 
 
 
 
 
 
 
3275
 
3276
+ function enqueue_scripts() {
3277
+ add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 );
3278
+ add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 );
3279
+ parent::enqueue_scripts();
3280
+ }
3281
 
3282
+ /**
3283
+ * @param $submit
3284
+ *
3285
+ * @return mixed
3286
+ */
3287
+ function filter_submit( $submit ) {
3288
+ $submit['Submit_Default']['value'] = __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' &raquo;';
3289
+ $submit['Submit_All_Default'] = array(
3290
+ 'type' => 'submit',
3291
+ 'class' => 'button-secondary',
3292
+ 'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' &raquo;',
3293
+ );
3294
 
3295
+ return $submit;
3296
  }
3297
 
3298
+ /**
3299
+ * Handle resetting options to defaults, but preserve the license key if pro.
3300
+ *
3301
+ * @param null $location
3302
+ * @param bool $delete
3303
+ */
3304
+ function reset_options( $location = null, $delete = false ) {
3305
+ if ( AIOSEOPPRO ) {
3306
+ global $aioseop_update_checker;
3307
+ }
3308
+ if ( $delete === true ) {
3309
+
3310
+ if ( AIOSEOPPRO ) {
3311
+ $license_key = '';
3312
+ if ( isset( $this->options ) && isset( $this->options['aiosp_license_key'] ) ) {
3313
+ $license_key = $this->options['aiosp_license_key'];
3314
  }
3315
  }
 
 
 
 
3316
 
3317
+ $this->delete_class_option( $delete );
3318
+
3319
+ if ( AIOSEOPPRO ) {
3320
+ $this->options = array( 'aiosp_license_key' => $license_key );
 
 
 
 
3321
  } else {
3322
+ $this->options = array();
3323
  }
 
 
 
 
 
 
 
 
3324
  }
3325
+ $default_options = $this->default_options( $location );
 
3326
 
3327
+ if ( AIOSEOPPRO ) {
3328
+ foreach ( $default_options as $k => $v ) {
3329
+ if ( $k != 'aiosp_license_key' ) {
3330
+ $this->options[ $k ] = $v;
3331
+ }
 
 
 
 
 
 
 
 
 
3332
  }
3333
+ $aioseop_update_checker->license_key = $this->options['aiosp_license_key'];
3334
+ } else {
3335
+ foreach ( $default_options as $k => $v ) {
3336
+ $this->options[ $k ] = $v;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3337
  }
 
 
 
 
 
3338
  }
3339
+ $this->update_class_option( $this->options );
3340
  }
3341
 
3342
+ /**
3343
+ * @param $settings
3344
+ * @param $location
3345
+ * @param $current
3346
+ *
3347
+ * @return mixed
3348
+ */
3349
+ function filter_settings( $settings, $location, $current ) {
3350
+ if ( $location == null ) {
3351
+ $prefix = $this->prefix;
3352
 
3353
+ foreach ( array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt ) {
3354
+ unset( $settings["{$prefix}$opt"] );
 
 
 
 
 
 
 
 
3355
  }
3356
+
3357
+ if ( ! class_exists( 'DOMDocument' ) ) {
3358
+ unset( $settings['{prefix}google_connect'] );
3359
  }
3360
+ if ( AIOSEOPPRO ) {
3361
+ if ( ! empty( $this->options['aiosp_license_key'] ) ) {
3362
+ $settings['aiosp_license_key']['type'] = 'password';
3363
+ $settings['aiosp_license_key']['size'] = 38;
 
 
 
 
 
 
 
 
 
 
 
3364
  }
3365
  }
3366
+ } elseif ( $location == 'aiosp' ) {
3367
+ global $post, $aioseop_sitemap;
3368
+ $prefix = $this->get_prefix( $location ) . $location . '_';
3369
+ if ( ! empty( $post ) ) {
3370
+ $post_type = get_post_type( $post );
3371
+ if ( ! empty( $this->options['aiosp_cpostnoindex'] ) && in_array( $post_type, $this->options['aiosp_cpostnoindex'] ) ) {
3372
+ $settings["{$prefix}noindex"]['type'] = 'select';
3373
+ $settings["{$prefix}noindex"]['initial_options'] = array(
3374
+ '' => __( 'Default - noindex', 'all-in-one-seo-pack' ),
3375
+ 'off' => __( 'index', 'all-in-one-seo-pack' ),
3376
+ 'on' => __( 'noindex', 'all-in-one-seo-pack' ),
3377
+ );
3378
+ }
3379
+ if ( ! empty( $this->options['aiosp_cpostnofollow'] ) && in_array( $post_type, $this->options['aiosp_cpostnofollow'] ) ) {
3380
+ $settings["{$prefix}nofollow"]['type'] = 'select';
3381
+ $settings["{$prefix}nofollow"]['initial_options'] = array(
3382
+ '' => __( 'Default - nofollow', 'all-in-one-seo-pack' ),
3383
+ 'off' => __( 'follow', 'all-in-one-seo-pack' ),
3384
+ 'on' => __( 'nofollow', 'all-in-one-seo-pack' ),
3385
+ );
3386
+ }
3387
+ if ( ! empty( $this->options['aiosp_cpostnoodp'] ) && in_array( $post_type, $this->options['aiosp_cpostnoodp'] ) ) {
3388
+ $settings["{$prefix}noodp"]['type'] = 'select';
3389
+ $settings["{$prefix}noodp"]['initial_options'] = array(
3390
+ '' => __( 'Default - noodp', 'all-in-one-seo-pack' ),
3391
+ 'off' => __( 'odp', 'all-in-one-seo-pack' ),
3392
+ 'on' => __( 'noodp', 'all-in-one-seo-pack' ),
3393
+ );
3394
+ }
3395
+ if ( ! empty( $this->options['aiosp_cpostnoydir'] ) && in_array( $post_type, $this->options['aiosp_cpostnoydir'] ) ) {
3396
+ $settings["{$prefix}noydir"]['type'] = 'select';
3397
+ $settings["{$prefix}noydir"]['initial_options'] = array(
3398
+ '' => __( 'Default - noydir', 'all-in-one-seo-pack' ),
3399
+ 'off' => __( 'ydir', 'all-in-one-seo-pack' ),
3400
+ 'on' => __( 'noydir', 'all-in-one-seo-pack' ),
3401
+ );
3402
+ }
3403
+ global $post;
3404
+ $info = $this->get_page_snippet_info();
3405
+ extract( $info );
3406
+ $settings["{$prefix}title"]['placeholder'] = $title;
3407
+ $settings["{$prefix}description"]['placeholder'] = $description;
3408
+ $settings["{$prefix}keywords"]['placeholder'] = $keywords;
3409
  }
3410
+
3411
+ if ( ! AIOSEOPPRO ) {
3412
+ if ( ! current_user_can( 'update_plugins' ) ) {
3413
+ unset( $settings["{$prefix}upgrade"] );
3414
+ }
3415
  }
3416
+
3417
+ if ( ! is_object( $aioseop_sitemap ) ) {
3418
+ unset( $settings['aiosp_sitemap_exclude'] );
3419
  }
3420
+ if ( is_object( $post ) ) {
3421
+ if ( $post->post_type != 'page' ) {
3422
+ unset( $settings["{$prefix}titleatr"] );
3423
+ unset( $settings["{$prefix}menulabel"] );
3424
+ }
3425
+ }
3426
+ if ( ! empty( $this->options[ $this->prefix . 'togglekeywords' ] ) ) {
3427
+ unset( $settings["{$prefix}keywords"] );
3428
+ unset( $settings["{$prefix}togglekeywords"] );
3429
+ } elseif ( ! empty( $current["{$prefix}togglekeywords"] ) ) {
3430
+ unset( $settings["{$prefix}keywords"] );
3431
+ }
3432
+ if ( empty( $this->options['aiosp_can'] ) || empty( $this->options['aiosp_customize_canonical_links'] ) ) {
3433
+ unset( $settings["{$prefix}custom_link"] );
3434
  }
3435
+ }
3436
 
3437
+ return $settings;
3438
+ }
3439
+
3440
+ /**
3441
+ * @param $options
3442
+ * @param $location
3443
+ *
3444
+ * @return mixed
3445
+ */
3446
+ function filter_options( $options, $location ) {
3447
+ if ( $location == 'aiosp' ) {
3448
+ global $post;
3449
+ if ( ! empty( $post ) ) {
3450
+ $prefix = $this->prefix;
3451
+ $post_type = get_post_type( $post );
3452
+ foreach ( array( 'noindex', 'nofollow', 'noodp', 'noydir' ) as $no ) {
3453
+ if ( empty( $this->options[ 'aiosp_cpost' . $no ] ) || ( ! in_array( $post_type, $this->options[ 'aiosp_cpost' . $no ] ) ) ) {
3454
+ if ( isset( $options["{$prefix}{$no}"] ) && ( $options["{$prefix}{$no}"] != 'on' ) ) {
3455
+ unset( $options["{$prefix}{$no}"] );
3456
+ }
3457
+ }
3458
+ }
3459
+ }
3460
+ }
3461
+ if ( $location == null ) {
3462
+ $prefix = $this->prefix;
3463
+ if ( isset( $options["{$prefix}rewrite_titles"] ) && ( ! empty( $options["{$prefix}rewrite_titles"] ) ) ) {
3464
+ $options["{$prefix}rewrite_titles"] = 1;
3465
  }
3466
+ if ( isset( $options["{$prefix}enablecpost"] ) && ( $options["{$prefix}enablecpost"] === '' ) ) {
3467
+ $options["{$prefix}enablecpost"] = 0;
 
3468
  }
3469
+ if ( isset( $options["{$prefix}use_original_title"] ) && ( $options["{$prefix}use_original_title"] === '' ) ) {
3470
+ $options["{$prefix}use_original_title"] = 0;
3471
+ }
3472
+ }
 
 
 
 
 
 
 
3473
 
3474
+ return $options;
3475
+ }
 
 
3476
 
3477
+ function template_redirect() {
3478
+ global $aioseop_options;
3479
+
3480
+ $post = $this->get_queried_object();
3481
+
3482
+ if ( ! $this->is_page_included() ) {
3483
+ return;
3484
  }
 
 
3485
 
3486
+ if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
3487
+ $force_rewrites = 1;
3488
+ if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) {
3489
+ $force_rewrites = $aioseop_options['aiosp_force_rewrites'];
3490
+ }
3491
+ if ( $force_rewrites ) {
3492
+ ob_start( array( $this, 'output_callback_for_title' ) );
3493
+ } else {
3494
+ add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
3495
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3496
  }
 
 
 
 
3497
  }
3498
+
3499
+ /**
3500
+ * @return bool
3501
+ */
3502
+ function is_page_included() {
3503
+ global $aioseop_options;
3504
+ if ( is_feed() ) {
 
 
 
 
3505
  return false;
3506
  }
3507
+ if ( aioseop_mrt_exclude_this_page() ) {
3508
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3509
  }
3510
+ $post = $this->get_queried_object();
3511
+ $post_type = '';
3512
+ if ( ! empty( $post ) && ! empty( $post->post_type ) ) {
3513
+ $post_type = $post->post_type;
3514
+ }
3515
+ if ( empty( $aioseop_options['aiosp_enablecpost'] ) ) {
3516
+ $wp_post_types = get_post_types( array( '_builtin' => true ) ); // Don't display meta if SEO isn't enabled on custom post types -- pdb.
3517
+ if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) {
3518
+ return false;
3519
+ }
3520
+ } else {
3521
+ $wp_post_types = $aioseop_options['aiosp_cpostactive'];
3522
+ if ( empty( $wp_post_types ) ) {
3523
+ $wp_post_types = array();
3524
+ }
3525
+ if ( AIOSEOPPRO ) {
3526
+ if ( is_tax() ) {
3527
+ if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! is_tax( $aioseop_options['aiosp_taxactive'] ) ) {
3528
+ return false;
3529
+ }
3530
+ } elseif ( is_category() ) {
3531
+ if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! in_array( 'category', $aioseop_options['aiosp_taxactive'] ) ) {
3532
+ return false;
3533
+ }
3534
+ } elseif ( is_tag() ) {
3535
+ if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! in_array( 'post_tag', $aioseop_options['aiosp_taxactive'] ) ) {
3536
+ return false;
3537
+ }
3538
+ } else if ( ! in_array( $post_type, $wp_post_types ) && ! is_front_page() && ! is_post_type_archive( $wp_post_types ) && ! is_404() ) {
3539
+ return false;
3540
+ }
3541
  } else {
3542
+ if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) {
3543
+ return false;
3544
+ }
3545
+ if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) {
3546
+ return false;
3547
+ }
3548
  }
 
 
 
 
3549
  }
3550
 
3551
+ $this->meta_opts = $this->get_current_options( array(), 'aiosp' );
 
 
 
 
 
 
 
 
3552
 
3553
+ $aiosp_disable = $aiosp_disable_analytics = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3554
 
3555
+ if ( ! empty( $this->meta_opts ) ) {
3556
+ if ( isset( $this->meta_opts['aiosp_disable'] ) ) {
3557
+ $aiosp_disable = $this->meta_opts['aiosp_disable'];
 
 
 
 
 
 
 
 
 
 
3558
  }
3559
+ if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) {
3560
+ $aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics'];
 
 
 
 
 
3561
  }
3562
+ }
3563
+
3564
+ if ( $aiosp_disable ) {
3565
+ if ( ! $aiosp_disable_analytics ) {
3566
+ if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
3567
+ remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
3568
+ add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3569
  }
3570
  }
3571
+
3572
+ return false;
3573
  }
3574
+
3575
+ if ( ! empty( $this->meta_opts ) && $this->meta_opts['aiosp_disable'] == true ) {
3576
+ return false;
3577
+ }
3578
+
3579
+ return true;
3580
  }
3581
 
3582
+ /**
3583
+ * @param $content
3584
+ *
3585
+ * @return mixed|string
3586
+ */
3587
+ function output_callback_for_title( $content ) {
3588
+ return $this->rewrite_title( $content );
3589
  }
3590
 
3591
+ /**
3592
+ * Used for forcing title rewrites.
3593
+ *
3594
+ * @param $header
3595
+ *
3596
+ * @return mixed|string
3597
+ */
3598
+ function rewrite_title( $header ) {
3599
+ global $wp_query;
3600
+ if ( ! $wp_query ) {
3601
+ $header .= "<!-- no wp_query found! -->\n";
3602
+
3603
+ return $header;
3604
+ }
3605
+ $title = $this->wp_title();
3606
+ if ( ! empty( $title ) ) {
3607
+ $header = $this->replace_title( $header, $title );
3608
  }
 
 
3609
 
3610
+ return $header;
 
 
 
 
3611
  }
3612
 
3613
+ /**
3614
+ * @param $content
3615
+ * @param $title
3616
+ *
3617
+ * @return mixed
3618
+ */
3619
+ function replace_title( $content, $title ) {
3620
+ // We can probably improve this... I'm not sure half of this is even being used.
3621
+ $title = trim( strip_tags( $title ) );
3622
+ $title_tag_start = '<title';
3623
+ $title_tag_end = '</title';
3624
+ $start = $this->strpos( $content, $title_tag_start );
3625
+ $end = $this->strpos( $content, $title_tag_end );
3626
+ $this->title_start = $start;
3627
+ $this->title_end = $end;
3628
+ $this->orig_title = $title;
3629
+
3630
+ return preg_replace( '/<title([^>]*?)\s*>([^<]*?)<\/title\s*>/is', '<title\\1>' . preg_replace( '/(\$|\\\\)(?=\d)/', '\\\\\1', strip_tags( $title ) ) . '</title>', $content, 1 );
3631
  }
3632
 
3633
+ function add_hooks() {
3634
+ global $aioseop_options, $aioseop_update_checker;
3635
+
3636
+ // MOVED TO MAIN PLUGIN FILE IN ORDER TO FIRE SOONS
3637
+ //$role = get_role( 'administrator' );
3638
+ //if ( is_object( $role ) ) {
3639
+ // $role->add_cap( 'aiosp_manage_seo' );
3640
+ //}
3641
+
3642
+ aioseop_update_settings_check();
3643
+ add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
3644
+ if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
3645
+ add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 );
3646
  }
3647
+
3648
+ if ( is_admin() ) {
3649
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
3650
+ add_action( 'admin_head', array( $this, 'add_page_icon' ) );
3651
+ add_action( 'admin_init', 'aioseop_addmycolumns', 1 );
3652
+ add_action( 'admin_init', 'aioseop_handle_ignore_notice' );
3653
+ if ( AIOSEOPPRO ) {
3654
+ if ( current_user_can( 'update_plugins' ) ) {
3655
+ add_action( 'admin_notices', array( $aioseop_update_checker, 'key_warning' ) );
3656
+ }
3657
+ add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, array(
3658
+ $aioseop_update_checker,
3659
+ 'add_plugin_row',
3660
+ ) );
3661
+ }
3662
+ } else {
3663
+ if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' ) {
3664
+ remove_action( 'wp_head', 'rel_canonical' );
3665
+ }
3666
+ // Analytics.
3667
+ if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
3668
+ add_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
3669
  }
3670
+ add_filter( 'wp_list_pages', 'aioseop_list_pages' );
3671
+ add_action( 'wp_head', array( $this, 'wp_head' ), apply_filters( 'aioseop_wp_head_priority', 1 ) );
3672
+ add_action( 'template_redirect', array( $this, 'template_redirect' ), 0 );
3673
+ add_filter( 'wp_list_pages_excludes', 'aioseop_get_pages_start' );
3674
+ add_filter( 'get_pages', 'aioseop_get_pages' );
3675
  }
 
 
 
 
3676
  }
3677
 
3678
+ function visibility_warning() {
3679
 
3680
+ $aioseop_visibility_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3681
 
3682
+ if ( '0' == get_option( 'blog_public' ) && empty( $aioseop_visibility_notice_dismissed ) ) {
3683
+
3684
+ printf( '
3685
+ <div id="message" class="error notice is-dismissible aioseop-notice visibility-notice">
3686
+ <p>
3687
+ <strong>%1$s</strong>
3688
+ %2$s
3689
+
3690
+ </p>
3691
+ </div>',
3692
+ __( 'Warning: You\'re blocking access to search engines.', 'all-in-one-seo-pack' ),
3693
+ sprintf( __( 'You can %s click here%s to go to your reading settings and toggle your blog visibility.', 'all-in-one-seo-pack' ), sprintf( '<a href="%s">', esc_url( admin_url( 'options-reading.php' ) ) ), '</a>' ) );
3694
 
3695
+ } elseif ( '1' == get_option( 'blog_public' ) && ! empty( $aioseop_visibility_notice_dismissed ) ) {
3696
+ delete_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed' );
3697
+ }
3698
  }
3699
 
3700
+ function woo_upgrade_notice() {
 
 
3701
 
3702
+ $aioseop_woo_upgrade_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
 
3703
 
3704
+ if ( class_exists( 'WooCommerce' ) && empty( $aioseop_woo_upgrade_notice_dismissed ) && current_user_can( 'manage_options' ) ) {
3705
+
3706
+ printf( '
3707
+ <div id="message" class="notice-info notice is-dismissible aioseop-notice woo-upgrade-notice">
3708
+ <p>
3709
+ <strong>%1$s</strong>
3710
+ %2$s
3711
+
3712
+ </p>
3713
+ </div>',
3714
+ __( 'We\'ve detected you\'re running WooCommerce.', 'all-in-one-seo-pack' ),
3715
+ sprintf( __( '%s Upgrade%s to All in One SEO Pack Pro for increased SEO compatibility for your products.', 'all-in-one-seo-pack' ), sprintf( '<a target="_blank" href="%s">', esc_url( 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=woo' ) ), '</a>' ) );
3716
 
3717
+ } elseif ( ! class_exists( 'WooCommerce' ) && ! empty( $aioseop_woo_upgrade_notice_dismissed ) ) {
3718
+ delete_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed' );
3719
+ }
3720
  }
3721
 
3722
+ /**
3723
+ * @param $description
3724
+ *
3725
+ * @return string
3726
+ */
3727
+ function make_unique_att_desc( $description ) {
3728
+ global $wp_query;
3729
+ if ( is_attachment() ) {
3730
+
3731
+ $url = $this->aiosp_mrt_get_url( $wp_query );
3732
+ if ( $url ) {
3733
+ $matches = array();
3734
+ preg_match_all( '/(\d+)/', $url, $matches );
3735
+ if ( is_array( $matches ) ) {
3736
+ $uniqueDesc = join( '', $matches[0] );
3737
+ }
3738
  }
3739
+ $description .= ' ' . $uniqueDesc;
 
 
 
 
3740
  }
3741
 
3742
+ return $description;
3743
+ }
3744
 
3745
+ function wp_head() {
3746
+ if ( ! $this->is_page_included() ) {
3747
+ return;
3748
+ }
3749
+ $opts = $this->meta_opts;
3750
+ global $aioseop_update_checker, $wp_query, $aioseop_options, $posts;
3751
+ static $aioseop_dup_counter = 0;
3752
+ $aioseop_dup_counter ++;
3753
+ if ( $aioseop_dup_counter > 1 ) {
3754
+ echo "\n<!-- " . sprintf( __( 'Debug Warning: All in One SEO Pack meta data was included again from %s filter. Called %s times!', 'all-in-one-seo-pack' ), current_filter(), $aioseop_dup_counter ) . " -->\n";
3755
 
3756
+ return;
3757
+ }
3758
+ if ( is_home() && ! is_front_page() ) {
3759
+ $post = aiosp_common::get_blog_page();
3760
+ } else {
3761
+ $post = $this->get_queried_object();
3762
+ }
3763
+ $meta_string = null;
3764
+ $description = '';
3765
+ // Logging - rewrite handler check for output buffering.
3766
+ $this->check_rewrite_handler();
3767
+ if ( AIOSEOPPRO ) {
3768
+ echo "\n<!-- All in One SEO Pack Pro $this->version by Michael Torbert of Semper Fi Web Design";
3769
+ } else {
3770
+ echo "\n<!-- All in One SEO Pack $this->version by Michael Torbert of Semper Fi Web Design";
3771
+ }
3772
+ if ( $this->ob_start_detected ) {
3773
+ echo 'ob_start_detected ';
3774
+ }
3775
+ echo "[$this->title_start,$this->title_end] ";
3776
+ echo "-->\n";
3777
+ if ( AIOSEOPPRO ) {
3778
+ echo '<!-- ' . __( 'Debug String', 'all-in-one-seo-pack' ) . ': ' . $aioseop_update_checker->get_verification_code() . " -->\n";
3779
+ }
3780
+ $blog_page = aiosp_common::get_blog_page( $post );
3781
+ $save_posts = $posts;
3782
+ if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
3783
+ global $posts;
3784
+ $opts = $this->meta_opts = $this->get_current_options( array(), 'aiosp', null, $post );
3785
+ $posts = array();
3786
+ $posts[] = $post;
3787
+ }
3788
+ $posts = $save_posts;
3789
+ $description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) ); // Get the description.
3790
+ // Handle the description format.
3791
+ if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) {
3792
+ $description = $this->trim_description( $description );
3793
+ if ( ! isset( $meta_string ) ) {
3794
+ $meta_string = '';
3795
  }
3796
+ // Description format.
3797
+ $description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) );
3798
+ $desc_attr = '';
3799
+ if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
3800
+ $desc_attr = 'itemprop="description"';
 
3801
  }
3802
+ $desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr );
3803
+ $meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3804
  }
3805
+ // Get the keywords.
3806
+ $togglekeywords = 0;
3807
+ if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) {
3808
+ $togglekeywords = $aioseop_options['aiosp_togglekeywords'];
3809
+ }
3810
+ if ( $togglekeywords == 0 && ! ( is_front_page() && is_paged() ) ) {
3811
+ $keywords = $this->get_main_keywords();
3812
+ $keywords = $this->apply_cf_fields( $keywords );
3813
+ $keywords = apply_filters( 'aioseop_keywords', $keywords );
3814
+
3815
+ if ( isset( $keywords ) && ! empty( $keywords ) ) {
3816
+ if ( isset( $meta_string ) ) {
3817
+ $meta_string .= "\n";
3818
+ }
3819
+ $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
3820
+ $key_attr = '';
3821
+ if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
3822
+ $key_attr = 'itemprop="keywords"';
3823
+ }
3824
+ $key_attr = apply_filters( 'aioseop_keywords_attributes', $key_attr );
3825
+ $meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
3826
+ }
3827
+ }
3828
+ // Handle noindex, nofollow - robots meta.
3829
+ $robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
3830
+ if ( ! empty( $robots_meta ) ) {
3831
+ $meta_string .= '<meta name="robots" content="' . esc_attr( $robots_meta ) . '" />' . "\n";
3832
+ }
3833
+ // Handle site verification.
3834
+ if ( is_front_page() ) {
3835
+ foreach (
3836
+ array(
3837
+ 'google' => 'google-site-verification',
3838
+ 'bing' => 'msvalidate.01',
3839
+ 'pinterest' => 'p:domain_verify',
3840
+ ) as $k => $v
3841
+ ) {
3842
+ if ( ! empty( $aioseop_options["aiosp_{$k}_verify"] ) ) {
3843
+ $meta_string .= '<meta name="' . $v . '" content="' . trim( strip_tags( $aioseop_options["aiosp_{$k}_verify"] ) ) . '" />' . "\n";
3844
+ }
3845
+ }
3846
 
3847
+ // Sitelinks search.
3848
+ if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) || ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
3849
+ $meta_string .= $this->sitelinks_search_box() . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
3850
  }
3851
  }
3852
+ // Handle extra meta fields.
3853
+ foreach ( array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) {
3854
+ if ( ! empty( $aioseop_options["aiosp_{$meta}_tags"] ) ) {
3855
+ $$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags"] ), ENT_QUOTES );
3856
+ } else {
3857
+ $$meta = '';
3858
+ }
3859
+ }
3860
+ if ( is_page() && isset( $page_meta ) && ! empty( $page_meta ) && ( ! is_front_page() || empty( $front_meta ) ) ) {
3861
+ if ( isset( $meta_string ) ) {
3862
+ $meta_string .= "\n";
3863
+ }
3864
+ $meta_string .= $page_meta;
3865
+ }
3866
+ if ( is_single() && isset( $post_meta ) && ! empty( $post_meta ) ) {
3867
+ if ( isset( $meta_string ) ) {
3868
+ $meta_string .= "\n";
3869
+ }
3870
+ $meta_string .= $post_meta;
3871
+ }
3872
+ // Handle authorship.
3873
+ $authorship = $this->get_google_authorship( $post );
3874
+ $publisher = apply_filters( 'aioseop_google_publisher', $authorship['publisher'] );
3875
+ if ( ! empty( $publisher ) ) {
3876
+ $meta_string = '<link rel="publisher" href="' . esc_url( $publisher ) . '" />' . "\n" . $meta_string;
3877
+ }
3878
+ $author = apply_filters( 'aioseop_google_author', $authorship['author'] );
3879
+ if ( ! empty( $author ) ) {
3880
+ $meta_string = '<link rel="author" href="' . esc_url( $author ) . '" />' . "\n" . $meta_string;
3881
+ }
3882
 
3883
+ if ( is_front_page() && ! empty( $front_meta ) ) {
3884
+ if ( isset( $meta_string ) ) {
3885
+ $meta_string .= "\n";
3886
+ }
3887
+ $meta_string .= $front_meta;
 
3888
  } else {
3889
+ if ( is_home() && ! empty( $home_meta ) ) {
3890
+ if ( isset( $meta_string ) ) {
3891
+ $meta_string .= "\n";
3892
+ }
3893
+ $meta_string .= $home_meta;
3894
+ }
3895
  }
3896
+ $prev_next = $this->get_prev_next_links( $post );
3897
+ $prev = apply_filters( 'aioseop_prev_link', $prev_next['prev'] );
3898
+ $next = apply_filters( 'aioseop_next_link', $prev_next['next'] );
3899
+ if ( ! empty( $prev ) ) {
3900
+ $meta_string .= "<link rel='prev' href='" . esc_url( $prev ) . "' />\n";
3901
+ }
3902
+ if ( ! empty( $next ) ) {
3903
+ $meta_string .= "<link rel='next' href='" . esc_url( $next ) . "' />\n";
3904
+ }
3905
+ if ( $meta_string != null ) {
3906
+ echo "$meta_string\n";
3907
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3908
 
3909
+ // Handle canonical links.
3910
+ $show_page = true;
3911
+ if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
3912
+ $show_page = false;
 
 
 
 
3913
  }
 
 
 
 
3914
 
3915
+ if ( $aioseop_options['aiosp_can'] ) {
3916
+ $url = '';
3917
+ if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) {
3918
+ $url = $opts['aiosp_custom_link'];
3919
+ }
3920
+ if ( empty( $url ) ) {
3921
+ $url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
3922
+ }
3923
 
3924
+ $url = $this->validate_url_scheme( $url );
3925
+
3926
+ $url = apply_filters( 'aioseop_canonical_url', $url );
3927
+ if ( ! empty( $url ) ) {
3928
+ echo '<link rel="canonical" href="' . esc_url( $url ) . '" />' . "\n";
3929
+ }
3930
+ }
3931
+ do_action( 'aioseop_modules_wp_head' );
3932
  if ( AIOSEOPPRO ) {
3933
+ echo "<!-- /all in one seo pack pro -->\n";
 
 
3934
  } else {
3935
+ echo "<!-- /all in one seo pack -->\n";
3936
  }
 
 
3937
  }
3938
 
3939
+ /**
3940
+ * Check rewrite handler.
3941
+ */
3942
+ function check_rewrite_handler() {
3943
+ global $aioseop_options;
3944
+
3945
+ $force_rewrites = 1;
3946
+ if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) {
3947
+ $force_rewrites = $aioseop_options['aiosp_force_rewrites'];
3948
  }
 
 
 
 
 
 
 
 
 
3949
 
3950
+ if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) && $force_rewrites ) {
3951
+ // Make the title rewrite as short as possible.
3952
+ if ( function_exists( 'ob_list_handlers' ) ) {
3953
+ $active_handlers = ob_list_handlers();
3954
+ } else {
3955
+ $active_handlers = array();
3956
+ }
3957
+ if ( sizeof( $active_handlers ) > 0 &&
3958
+ $this->strtolower( $active_handlers[ sizeof( $active_handlers ) - 1 ] ) ==
3959
+ $this->strtolower( 'All_in_One_SEO_Pack::output_callback_for_title' )
3960
+ ) {
3961
+ ob_end_flush();
3962
+ } else {
3963
+ $this->log( 'another plugin interfering?' );
3964
+ // If we get here there *could* be trouble with another plugin :(.
3965
+ $this->ob_start_detected = true;
3966
+ if ( $this->option_isset( 'rewrite_titles' ) ) { // Try alternate method -- pdb.
3967
+ $aioseop_options['aiosp_rewrite_titles'] = 0;
3968
+ $force_rewrites = 0;
3969
+ add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
3970
+ }
3971
+ if ( function_exists( 'ob_list_handlers' ) ) {
3972
+ foreach ( ob_list_handlers() as $handler ) {
3973
+ $this->log( "detected output handler $handler" );
3974
+ }
3975
  }
3976
  }
3977
  }
 
3978
  }
3979
 
3980
+ /**
3981
+ * @param $description
3982
+ *
3983
+ * @return mixed|string
3984
+ */
3985
+ function trim_description( $description ) {
3986
+ $description = trim( wp_strip_all_tags( $description ) );
3987
+ $description = str_replace( '"', '&quot;', $description );
3988
+ $description = str_replace( "\r\n", ' ', $description );
3989
+ $description = str_replace( "\n", ' ', $description );
3990
 
3991
+ return $description;
 
 
 
 
 
3992
  }
3993
 
3994
+ /**
3995
+ * @param $description
3996
+ * @param null $post
3997
+ *
3998
+ * @return mixed
3999
+ */
4000
+ function apply_description_format( $description, $post = null ) {
4001
+ global $aioseop_options;
4002
+ $description_format = $aioseop_options['aiosp_description_format'];
4003
+ if ( ! isset( $description_format ) || empty( $description_format ) ) {
4004
+ $description_format = '%description%';
 
 
 
 
 
 
 
 
 
 
 
 
4005
  }
4006
+ $description = str_replace( '%description%', apply_filters( 'aioseop_description_override', $description ), $description_format );
4007
+ if ( strpos( $description, '%blog_title%' ) !== false ) {
4008
+ $description = str_replace( '%blog_title%', get_bloginfo( 'name' ), $description );
 
 
 
 
 
 
 
 
 
 
4009
  }
4010
+ if ( strpos( $description, '%blog_description%' ) !== false ) {
4011
+ $description = str_replace( '%blog_description%', get_bloginfo( 'description' ), $description );
4012
+ }
4013
+ if ( strpos( $description, '%wp_title%' ) !== false ) {
4014
+ $description = str_replace( '%wp_title%', $this->get_original_title(), $description );
4015
+ }
4016
+ if ( strpos( $description, '%post_title%' ) !== false ) {
4017
+ $description = str_replace( '%post_title%', $this->get_aioseop_title( $post ), $description );
4018
+ }
4019
+
4020
+
4021
+ /*this was intended to make attachment descriptions unique if pulling from the parent... let's remove it and see if there are any problems
4022
+ *on the roadmap is to have a better hierarchy for attachment description pulling
4023
+ * if ($aioseop_options['aiosp_can']) $description = $this->make_unique_att_desc($description);
4024
+ */
4025
+
4026
+ return $description;
4027
  }
4028
 
4029
+ /**
4030
+ * @return string
4031
+ */
4032
+ function get_robots_meta() {
4033
  global $aioseop_options;
4034
+ $opts = $this->meta_opts;
4035
+ $page = $this->get_page_number();
4036
+ $robots_meta = $tax_noindex = '';
4037
+ if ( isset( $aioseop_options['aiosp_tax_noindex'] ) ) {
4038
+ $tax_noindex = $aioseop_options['aiosp_tax_noindex'];
4039
+ }
4040
+
4041
+ if ( empty( $tax_noindex ) || ! is_array( $tax_noindex ) ) {
4042
+ $tax_noindex = array();
4043
+ }
4044
+
4045
+ $aiosp_noindex = $aiosp_nofollow = $aiosp_noodp = $aiosp_noydir = '';
4046
+ $noindex = 'index';
4047
+ $nofollow = 'follow';
4048
+ if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax()
4049
+ && ( ( is_date() && ! empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && ! empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
4050
+ || ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) )
4051
+ || ( is_search() && ! empty( $aioseop_options['aiosp_search_noindex'] ) )
4052
+ || ( is_404() && ! empty( $aioseop_options['aiosp_404_noindex'] ) )
4053
+ || ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
4054
+ ) {
4055
+ $noindex = 'noindex';
4056
+ } elseif ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) {
4057
+ $post_type = get_post_type();
4058
+ if ( ! empty( $opts ) ) {
4059
+ $aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
4060
+ $aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
4061
+ $aiosp_noodp = htmlspecialchars( stripslashes( $opts['aiosp_noodp'] ) );
4062
+ $aiosp_noydir = htmlspecialchars( stripslashes( $opts['aiosp_noydir'] ) );
4063
+ }
4064
+ if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || ! empty( $aioseop_options['aiosp_cpostnoindex'] )
4065
+ || ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_cpostnoodp'] ) || ! empty( $aioseop_options['aiosp_cpostnoydir'] )
4066
+ || ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
4067
+ ) {
4068
+ if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) ||
4069
+ ( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) )
4070
+ ) {
4071
+ $noindex = 'noindex';
4072
+ }
4073
+ if ( ( $aiosp_nofollow == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && $page > 1 ) ||
4074
+ ( ( $aiosp_nofollow == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) )
4075
+ ) {
4076
+ $nofollow = 'nofollow';
4077
+ }
4078
+ if ( ( $aiosp_noodp == 'on' ) || ( empty( $aiosp_noodp ) && ( ! empty( $aioseop_options['aiosp_cpostnoodp'] ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoodp'] ) ) ) ) {
4079
+ $aiosp_noodp = true;
4080
+ } else {
4081
+ $aiosp_noodp = false;
4082
+ }
4083
+ if ( ( $aiosp_noydir == 'on' ) || ( empty( $aiosp_noydir ) && ( ! empty( $aioseop_options['aiosp_cpostnoydir'] ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoydir'] ) ) ) ) {
4084
+ $aiosp_noydir = true;
4085
+ } else {
4086
+ $aiosp_noydir = false;
4087
+ }
4088
+ }
4089
+ }
4090
+ if ( ! empty( $aioseop_options['aiosp_noodp'] ) && $aioseop_options['aiosp_noodp'] ) {
4091
+ $aiosp_noodp = true;
4092
  }
4093
+ if ( ! empty( $aioseop_options['aiosp_noydir'] ) && $aioseop_options['aiosp_noydir'] ) {
4094
+ $aiosp_noydir = true;
4095
+ }
4096
+ if ( $aiosp_noodp ) {
4097
+ $nofollow .= ',noodp';
4098
+ }
4099
+ if ( $aiosp_noydir ) {
4100
+ $nofollow .= ',noydir';
4101
+ }
4102
+ $robots_meta = $noindex . ',' . $nofollow;
4103
+ if ( $robots_meta == 'index,follow' ) {
4104
+ $robots_meta = '';
4105
+ }
4106
+
4107
+ return $robots_meta;
4108
  }
4109
 
4110
+ /**
4111
+ * @return mixed|void
4112
+ */
4113
+ function sitelinks_search_box() {
4114
  global $aioseop_options;
4115
+ $home_url = esc_url( get_home_url() );
4116
+ $name_block = $search_block = '';
4117
+ if ( ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
4118
+ if ( ! empty( $aioseop_options['aiosp_google_specify_site_name'] ) ) {
4119
+ $blog_name = $aioseop_options['aiosp_google_specify_site_name'];
 
 
 
 
 
 
 
 
 
 
4120
  } else {
4121
+ $blog_name = get_bloginfo( 'name' );
 
 
4122
  }
4123
+ $blog_name = esc_attr( $blog_name );
4124
+ $name_block = <<<EOF
4125
+ "name": "{$blog_name}",
4126
+ EOF;
4127
+ }
4128
 
4129
+ if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) ) {
4130
+ $search_block = <<<EOF
4131
+ "potentialAction": {
4132
+ "@type": "SearchAction",
4133
+ "target": "{$home_url}/?s={search_term}",
4134
+ "query-input": "required name=search_term"
4135
+ },
4136
+ EOF;
4137
+ }
4138
 
4139
+ $search_box = <<<EOF
4140
+ <script type="application/ld+json">
4141
+ {
4142
+ "@context": "http://schema.org",
4143
+ "@type": "WebSite",
4144
+ EOF;
4145
+ if ( ! empty( $name_block ) ) {
4146
+ $search_box .= $name_block;
4147
+ }
4148
+ if ( ! empty( $search_block ) ) {
4149
+ $search_box .= $search_block;
4150
+ }
4151
+ $search_box .= <<<EOF
4152
+ "url": "{$home_url}/"
4153
+ }
4154
+ </script>
4155
+ EOF;
4156
 
4157
+ return apply_filters( 'aiosp_sitelinks_search_box', $search_box );
4158
+ }
 
 
 
 
 
4159
 
4160
+ /**
4161
+ * @param $post
4162
+ *
4163
+ * @return array
4164
+ */
4165
+ function get_google_authorship( $post ) {
4166
+ global $aioseop_options;
4167
+ $page = $this->get_page_number();
4168
+ // Handle authorship.
4169
+ $googleplus = $publisher = $author = '';
4170
 
4171
+ if ( ! empty( $post ) && isset( $post->post_author ) && empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
4172
+ $googleplus = get_the_author_meta( 'googleplus', $post->post_author );
4173
+ }
4174
 
4175
+ if ( empty( $googleplus ) && ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
4176
+ $googleplus = $aioseop_options['aiosp_google_publisher'];
4177
+ }
 
4178
 
4179
+ if ( is_front_page() && ( $page < 2 ) ) {
4180
+ if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
4181
+ $publisher = $aioseop_options['aiosp_google_publisher'];
4182
  }
4183
 
4184
+ if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) ) {
4185
+ if ( empty( $aioseop_options['aiosp_google_enable_publisher'] ) ) {
4186
+ $publisher = '';
4187
+ } elseif ( ! empty( $aioseop_options['aiosp_google_specify_publisher'] ) ) {
4188
+ $publisher = $aioseop_options['aiosp_google_specify_publisher'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4189
  }
 
 
 
 
 
 
 
 
 
4190
  }
4191
+ }
4192
+ if ( is_singular() && ( ! empty( $googleplus ) ) ) {
4193
+ $author = $googleplus;
4194
+ } else if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
4195
+ $author = $aioseop_options['aiosp_google_publisher'];
4196
+ }
4197
+
4198
+ if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) {
4199
+ if ( empty( $aioseop_options['aiosp_google_author_location'] ) ) {
4200
+ $aioseop_options['aiosp_google_author_location'] = array();
 
 
 
 
 
 
 
 
 
 
4201
  }
4202
+ if ( is_front_page() && ! in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) {
4203
+ $author = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4204
  } else {
4205
+ if ( in_array( 'all', $aioseop_options['aiosp_google_author_location'] ) ) {
4206
+ if ( is_singular() && ! is_singular( $aioseop_options['aiosp_google_author_location'] ) ) {
4207
+ $author = '';
4208
+ }
4209
+ } else {
4210
+ if ( ! is_singular( $aioseop_options['aiosp_google_author_location'] ) ) {
4211
+ $author = '';
4212
  }
4213
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4214
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4215
  }
4216
 
4217
+ return array( 'publisher' => $publisher, 'author' => $author );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4218
  }
4219
 
4220
  /**
4221
+ * @param null $post
4222
+ *
4223
+ * @return array
4224
  */
4225
+ function get_prev_next_links( $post = null ) {
4226
+ $prev = $next = '';
4227
+ $page = $this->get_page_number();
4228
+ if ( is_home() || is_archive() || is_paged() ) {
4229
+ global $wp_query;
4230
+ $max_page = $wp_query->max_num_pages;
4231
+ if ( $page > 1 ) {
4232
+ $prev = get_previous_posts_page_link();
4233
+ }
4234
+ if ( $page < $max_page ) {
4235
+ $paged = $GLOBALS['paged'];
4236
+ if ( ! is_single() ) {
4237
+ if ( ! $paged ) {
4238
+ $paged = 1;
4239
+ }
4240
+ $nextpage = intval( $paged ) + 1;
4241
+ if ( ! $max_page || $max_page >= $nextpage ) {
4242
+ $next = get_pagenum_link( $nextpage );
4243
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4244
  }
4245
+ }
4246
+ } else if ( is_page() || is_single() ) {
4247
+ $numpages = 1;
4248
+ $multipage = 0;
4249
+ $page = get_query_var( 'page' );
4250
+ if ( ! $page ) {
4251
+ $page = 1;
4252
+ }
4253
+ if ( is_single() || is_page() || is_feed() ) {
4254
+ $more = 1;
4255
+ }
4256
+ $content = $post->post_content;
4257
+ if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
4258
+ if ( $page > 1 ) {
4259
+ $more = 1;
4260
+ }
4261
+ $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
4262
+ $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
4263
+ $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
4264
+ // Ignore nextpage at the beginning of the content.
4265
+ if ( 0 === strpos( $content, '<!--nextpage-->' ) ) {
4266
+ $content = substr( $content, 15 );
4267
+ }
4268
+ $pages = explode( '<!--nextpage-->', $content );
4269
+ $numpages = count( $pages );
4270
+ if ( $numpages > 1 ) {
4271
+ $multipage = 1;
4272
  }
4273
  }
4274
+ if ( ! empty( $page ) ) {
4275
+ if ( $page > 1 ) {
4276
+ $prev = _wp_link_page( $page - 1 );
4277
+ }
4278
+ if ( $page + 1 <= $numpages ) {
4279
+ $next = _wp_link_page( $page + 1 );
4280
+ }
4281
+ }
4282
+ if ( ! empty( $prev ) ) {
4283
+ $prev = $this->substr( $prev, 9, - 2 );
4284
+ }
4285
+ if ( ! empty( $next ) ) {
4286
+ $next = $this->substr( $next, 9, - 2 );
4287
  }
4288
  }
 
 
 
4289
 
4290
+ return array( 'prev' => $prev, 'next' => $next );
 
 
 
 
4291
  }
4292
 
4293
+ /**
4294
+ *
4295
+ * Validates whether the url should be https or http.
4296
+ *
4297
+ * Mainly we're just using this for canonical URLS, but eventually it may be useful for other things
4298
+ *
4299
+ * @param $url
4300
+ *
4301
+ * @return string $url
4302
+ *
4303
+ * @since 2.3.5
4304
+ */
4305
+ function validate_url_scheme( $url ) {
4306
 
4307
+ // TODO we should check for the site setting in the case of auto.
 
 
 
 
 
 
 
4308
 
4309
+ global $aioseop_options;
4310
+
4311
+ if( ! isset( $aioseop_options['aiosp_can_set_protocol'] ) ){
4312
+ return $url; // Just send the url back if there's nothing there.
4313
+ }
4314
+
4315
+ if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) {
4316
+ $url = preg_replace( '/^https:/i', 'http:', $url );
4317
+ }
4318
+ if ( $aioseop_options['aiosp_can_set_protocol'] == 'https' ) {
4319
+ $url = preg_replace( '/^http:/i', 'https:', $url );
4320
+ }
 
 
 
 
 
 
 
 
 
4321
 
4322
+ return $url;
 
 
 
 
 
 
4323
  }
4324
 
4325
  /**
4326
+ * @param $options
4327
+ * @param $location
4328
+ * @param $settings
4329
+ *
4330
+ * @return mixed
4331
  */
4332
+ function override_options( $options, $location, $settings ) {
4333
+ if ( class_exists( 'DOMDocument' ) ) {
4334
+ $options['aiosp_google_connect'] = $settings['aiosp_google_connect']['default'];
 
 
 
 
 
 
 
 
 
 
4335
  }
4336
+
4337
+ return $options;
4338
+ }
4339
+
4340
+ function aiosp_google_analytics() {
4341
+ global $aioseop_options;
4342
+ $analytics = '';
4343
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_exclude_users'] ) ) {
4344
+ if ( is_user_logged_in() ) {
4345
+ global $current_user;
4346
+ if ( empty( $current_user ) ) {
4347
+ wp_get_current_user();
4348
+ }
4349
+ if ( ! empty( $current_user ) ) {
4350
+ $intersect = array_intersect( $aioseop_options['aiosp_ga_exclude_users'], $current_user->roles );
4351
+ if ( ! empty( $intersect ) ) {
4352
+ return;
4353
+ }
4354
+ }
4355
+ }
4356
  }
4357
+ if ( ! empty( $aioseop_options['aiosp_google_analytics_id'] ) ) {
4358
+ ob_start();
4359
+ $analytics = $this->universal_analytics();
4360
+ echo $analytics;
4361
+ if ( empty( $analytics ) ) {
4362
+ ?>
4363
+ <script type="text/javascript">
4364
+ var _gaq = _gaq || [];
4365
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
4366
+ ?> var pluginUrl =
4367
+ '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
4368
+ _gaq.push(['_require', 'inpage_linkid', pluginUrl]);
4369
+ <?php
4370
+ }
4371
+ ?> _gaq.push(['_setAccount', '<?php
4372
+ echo $aioseop_options['aiosp_google_analytics_id'];
4373
+ ?>']);
4374
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
4375
+ ?> _gaq.push(['_gat._anonymizeIp']);
4376
+ <?php
4377
+ }
4378
+ ?>
4379
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
4380
+ ?> _gaq.push(['_setAllowLinker', true]);
4381
+ <?php
4382
+ }
4383
+ ?>
4384
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
4385
+ $domain = $this->get_analytics_domain();
4386
+ ?> _gaq.push(['_setDomainName', '<?php echo $domain; ?>']);
4387
+ <?php
4388
+ }
4389
+ ?> _gaq.push(['_trackPageview']);
4390
+ (function () {
4391
+ var ga = document.createElement('script');
4392
+ ga.type = 'text/javascript';
4393
+ ga.async = true;
4394
+ <?php
4395
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
4396
+ ?> ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
4397
+ <?php
4398
+ } else {
4399
+ ?> ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
4400
+ <?php
4401
  }
4402
+ ?> var s = document.getElementsByTagName('script')[0];
4403
+ s.parentNode.insertBefore(ga, s);
4404
+ })();
4405
+ </script>
4406
+ <?php
4407
+ }
4408
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && $aioseop_options['aiosp_ga_track_outbound_links'] ) { ?>
4409
+ <script type="text/javascript">
4410
+ function recordOutboundLink(link, category, action) {
4411
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { ?>
4412
+ ga('send', 'event', category, action);
4413
+ <?php }
4414
+ if ( empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { ?>
4415
+ _gat._getTrackerByName()._trackEvent(category, action);
4416
+ <?php } ?>
4417
+ if (link.target == '_blank') return true;
4418
+ setTimeout('document.location = "' + link.href + '"', 100);
4419
+ return false;
4420
+ }
4421
+ /* use regular Javascript for this */
4422
+ function getAttr(ele, attr) {
4423
+ var result = (ele.getAttribute && ele.getAttribute(attr)) || null;
4424
+ if (!result) {
4425
+ var attrs = ele.attributes;
4426
+ var length = attrs.length;
4427
+ for (var i = 0; i < length; i++)
4428
+ if (attr[i].nodeName === attr) result = attr[i].nodeValue;
4429
+ }
4430
+ return result;
4431
  }
4432
 
4433
+ function aiosp_addLoadEvent(func) {
4434
+ var oldonload = window.onload;
4435
+ if (typeof window.onload != 'function') {
4436
+ window.onload = func;
4437
+ } else {
4438
+ window.onload = function () {
4439
+ if (oldonload) {
4440
+ oldonload();
4441
+ }
4442
+ func();
4443
+ }
4444
+ }
4445
  }
 
 
 
 
 
 
 
4446
 
4447
+ function aiosp_addEvent(element, evnt, funct) {
4448
+ if (element.attachEvent)
4449
+ return element.attachEvent('on' + evnt, funct);
4450
+ else
4451
+ return element.addEventListener(evnt, funct, false);
4452
+ }
 
 
4453
 
4454
+ aiosp_addLoadEvent(function () {
4455
+ var links = document.getElementsByTagName('a');
4456
+ for (var x = 0; x < links.length; x++) {
4457
+ if (typeof links[x] == 'undefined') continue;
4458
+ aiosp_addEvent(links[x], 'onclick', function () {
4459
+ var mydomain = new RegExp(document.domain, 'i');
4460
+ href = getAttr(this, 'href');
4461
+ if (href && href.toLowerCase().indexOf('http') === 0 && !mydomain.test(href)) {
4462
+ recordOutboundLink(this, 'Outbound Links', href);
4463
+ }
4464
+ });
4465
+ }
4466
+ });
4467
+ </script>
4468
+ <?php
4469
  }
4470
+ $analytics = ob_get_clean();
4471
+ }
4472
+ echo apply_filters( 'aiosp_google_analytics', $analytics );
4473
  }
4474
 
4475
+ /**
4476
+ * @return string
4477
+ */
4478
+ function universal_analytics() {
4479
+ global $aioseop_options;
4480
+ $analytics = '';
4481
+ if ( ! empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) {
4482
+ $allow_linker = $cookie_domain = $domain = $addl_domains = $domain_list = '';
4483
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) ) {
4484
+ $cookie_domain = $this->get_analytics_domain();
4485
+ }
4486
+ if ( ! empty( $cookie_domain ) ) {
4487
+ $cookie_domain = esc_js( $cookie_domain );
4488
+ $cookie_domain = "'cookieDomain': '{$cookie_domain}'";
4489
+ }
4490
+ if ( empty( $cookie_domain ) ) {
4491
+ $domain = ", 'auto'";
4492
+ }
4493
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
4494
+ $allow_linker = "'allowLinker': true";
4495
+ if ( ! empty( $aioseop_options['aiosp_ga_addl_domains'] ) ) {
4496
+ $addl_domains = trim( $aioseop_options['aiosp_ga_addl_domains'] );
4497
+ $addl_domains = preg_split( '/[\s,]+/', $addl_domains );
4498
+ if ( ! empty( $addl_domains ) ) {
4499
+ foreach ( $addl_domains as $d ) {
4500
+ $d = $this->sanitize_domain( $d );
4501
+ if ( ! empty( $d ) ) {
4502
+ if ( ! empty( $domain_list ) ) {
4503
+ $domain_list .= ', ';
4504
+ }
4505
+ $domain_list .= "'" . $d . "'";
4506
+ }
4507
+ }
4508
+ }
4509
+ }
4510
+ }
4511
+ $extra_options = '';
4512
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
4513
+ $extra_options .= "ga('require', 'displayfeatures');";
4514
+ }
4515
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_enhanced_ecommerce'] ) ) {
4516
+ if ( ! empty( $extra_options ) ) {
4517
+ $extra_options .= "\n\t\t\t";
4518
+ }
4519
+ $extra_options .= "ga('require', 'ec');";
4520
+ }
4521
+ if ( ! empty( $domain_list ) ) {
4522
+ if ( ! empty( $extra_options ) ) {
4523
+ $extra_options .= "\n\t\t\t";
4524
+ }
4525
+ $extra_options .= "ga('require', 'linker');\n\t\t\tga('linker:autoLink', [{$domain_list}] );";
4526
+ }
4527
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
4528
+ if ( ! empty( $extra_options ) ) {
4529
+ $extra_options .= "\n\t\t\t";
4530
+ }
4531
+ $extra_options .= "ga('require', 'linkid', 'linkid.js');";
4532
+ }
4533
+
4534
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
4535
+ if ( ! empty( $extra_options ) ) {
4536
+ $extra_options .= "\n\t\t\t";
4537
+ }
4538
+ $extra_options .= "ga('set', 'anonymizeIp', true);";
4539
+ }
4540
+ $js_options = array();
4541
+ foreach ( array( 'cookie_domain', 'allow_linker' ) as $opts ) {
4542
+ if ( ! empty( $$opts ) ) {
4543
+ $js_options[] = $$opts;
4544
+ }
4545
+ }
4546
+ if ( ! empty( $js_options ) ) {
4547
+ $js_options = join( ',', $js_options );
4548
+ $js_options = ', { ' . $js_options . ' } ';
4549
+ } else {
4550
+ $js_options = '';
4551
+ }
4552
+ $analytics_id = esc_js( $aioseop_options['aiosp_google_analytics_id'] );
4553
+ $analytics = <<<EOF
4554
+ <script>
4555
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4556
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
4557
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
4558
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
4559
+
4560
+ ga('create', '{$analytics_id}'{$domain}{$js_options});
4561
+ {$extra_options}
4562
+ ga('send', 'pageview');
4563
+ </script>
4564
+
4565
+ EOF;
4566
+ }
4567
+
4568
+ return $analytics;
4569
  }
4570
 
4571
+ /**
4572
+ * @return mixed|string
4573
+ */
4574
+ function get_analytics_domain() {
4575
+ global $aioseop_options;
4576
+ if ( ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
4577
+ return $this->sanitize_domain( $aioseop_options['aiosp_ga_domain'] );
4578
  }
4579
+
4580
+ return '';
4581
  }
4582
 
4583
+ /**
4584
+ * @param $id
4585
+ *
4586
+ * @return bool
4587
+ */
4588
  function save_post_data( $id ) {
4589
  $awmp_edit = $nonce = null;
4590
+ if ( empty( $_POST ) ) {
4591
+ return false;
4592
+ }
4593
+ if ( isset( $_POST['aiosp_edit'] ) ) {
4594
+ $awmp_edit = $_POST['aiosp_edit'];
4595
+ }
4596
+ if ( isset( $_POST['nonce-aioseop-edit'] ) ) {
4597
+ $nonce = $_POST['nonce-aioseop-edit'];
4598
+ }
4599
 
4600
+ if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
4601
+
4602
+ $optlist = array(
4603
+ 'keywords',
4604
+ 'description',
4605
+ 'title',
4606
+ 'custom_link',
4607
+ 'sitemap_exclude',
4608
+ 'disable',
4609
+ 'disable_analytics',
4610
+ 'noindex',
4611
+ 'nofollow',
4612
+ 'noodp',
4613
+ 'noydir',
4614
+ 'titleatr',
4615
+ 'menulabel',
4616
+ );
4617
+ if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
4618
+ unset( $optlist['custom_link'] );
4619
  }
4620
+ foreach ( $optlist as $f ) {
4621
  $field = "aiosp_$f";
4622
+ if ( isset( $_POST[ $field ] ) ) {
4623
+ $$field = $_POST[ $field ];
4624
+ }
4625
+ }
4626
 
4627
+ $optlist = array(
4628
+ 'keywords',
4629
+ 'description',
4630
+ 'title',
4631
+ 'custom_link',
4632
+ 'noindex',
4633
+ 'nofollow',
4634
+ 'noodp',
4635
+ 'noydir',
4636
+ 'titleatr',
4637
+ 'menulabel',
4638
+ );
4639
+ if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
4640
+ unset( $optlist['custom_link'] );
4641
  }
4642
+ foreach ( $optlist as $f ) {
4643
  delete_post_meta( $id, "_aioseop_{$f}" );
4644
+ }
4645
 
4646
+ if ( $this->is_admin() ) {
4647
+ delete_post_meta( $id, '_aioseop_sitemap_exclude' );
4648
+ delete_post_meta( $id, '_aioseop_disable' );
4649
+ delete_post_meta( $id, '_aioseop_disable_analytics' );
4650
  }
4651
 
4652
  foreach ( $optlist as $f ) {
4653
+ $var = "aiosp_$f";
4654
  $field = "_aioseop_$f";
4655
+ if ( isset( $$var ) && ! empty( $$var ) ) {
4656
+ add_post_meta( $id, $field, $$var );
4657
+ }
 
 
 
 
 
 
4658
  }
4659
+ if ( isset( $aiosp_sitemap_exclude ) && ! empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) {
4660
+ add_post_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
4661
+ }
4662
+ if ( isset( $aiosp_disable ) && ! empty( $aiosp_disable ) && $this->is_admin() ) {
4663
+ add_post_meta( $id, '_aioseop_disable', $aiosp_disable );
4664
+ if ( isset( $aiosp_disable_analytics ) && ! empty( $aiosp_disable_analytics ) ) {
4665
+ add_post_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
4666
+ }
4667
+ }
4668
+ }
4669
  }
4670
 
4671
+ /**
4672
+ * @param $post
4673
+ * @param $metabox
4674
+ */
4675
  function display_tabbed_metabox( $post, $metabox ) {
4676
  $tabs = $metabox['args'];
4677
  echo '<div class="aioseop_tabs">';
4678
  $header = $this->get_metabox_header( $tabs );
4679
  echo $header;
4680
+ $active = '';
4681
+ foreach ( $tabs as $m ) {
4682
+ echo '<div id="' . $m['id'] . '" class="aioseop_tab"' . $active . '>';
4683
+ if ( ! $active ) {
4684
+ $active = ' style="display:none;"';
4685
+ }
4686
  $m['args'] = $m['callback_args'];
4687
  $m['callback'][0]->{$m['callback'][1]}( $post, $m );
4688
  echo '</div>';
4690
  echo '</div>';
4691
  }
4692
 
4693
+ /**
4694
+ * @param $tabs
4695
+ *
4696
+ * @return string
4697
+ */
4698
+ function get_metabox_header( $tabs ) {
4699
+ $header = '<ul class="aioseop_header_tabs hide">';
4700
+ $active = ' active';
4701
+ foreach ( $tabs as $t ) {
4702
+ if ( $active ) {
4703
+ $title = __( 'Main Settings', 'all-in-one-seo-pack' );
4704
+ } else {
4705
+ $title = $t['title'];
4706
+ }
4707
+ $header .= '<li><label class="aioseop_header_nav"><a class="aioseop_header_tab' . $active . '" href="#' . $t['id'] . '">' . $title . '</a></label></li>';
4708
+ $active = '';
4709
+ }
4710
+ $header .= '</ul>';
4711
+
4712
+ return $header;
4713
+ }
4714
+
4715
  function admin_bar_menu() {
4716
  global $wp_admin_bar, $aioseop_admin_menu, $aioseop_options, $post;
4717
 
4718
  $toggle = '';
4719
+ if ( isset( $_POST['aiosp_use_original_title'] ) && isset( $_POST['aiosp_admin_bar'] ) ) {
4720
+ $toggle = 'on';
4721
+ }
4722
+ if ( isset( $_POST['aiosp_use_original_title'] ) && ! isset( $_POST['aiosp_admin_bar'] ) ) {
4723
+ $toggle = 'off';
4724
+ }
4725
 
4726
+ if ( ! empty( $aioseop_options['aiosp_admin_bar'] ) && $toggle != 'off' || isset( $_POST['aiosp_admin_bar'] ) ) {
4727
  $menu_slug = plugin_basename( __FILE__ );
4728
 
4729
  $url = '';
4730
+ if ( function_exists( 'menu_page_url' ) ) {
4731
+ $url = menu_page_url( $menu_slug, 0 );
4732
+ }
4733
+ if ( empty( $url ) ) {
4734
+ $url = esc_url( admin_url( 'admin.php?page=' . $menu_slug ) );
4735
+ }
4736
 
4737
+ $wp_admin_bar->add_menu( array(
4738
+ 'id' => AIOSEOP_PLUGIN_DIRNAME,
4739
+ 'title' => __( 'SEO', 'all-in-one-seo-pack' ),
4740
+ 'href' => $url,
4741
+ ) );
4742
+
4743
+ if ( current_user_can( 'update_plugins' ) && ! AIOSEOPPRO ) {
4744
+ $wp_admin_bar->add_menu( array(
4745
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
4746
+ 'title' => __( 'Upgrade To Pro', 'all-in-one-seo-pack' ),
4747
+ 'id' => 'aioseop-pro-upgrade',
4748
+ 'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu',
4749
+ 'meta' => array( 'target' => '_blank' ),
4750
+ ) );
4751
+ // add_action( 'admin_bar_menu', array( $this, 'admin_bar_upgrade_menu' ), 1101 );
4752
  }
4753
 
4754
  $aioseop_admin_menu = 1;
4755
+ if ( ! is_admin() && ! empty( $post ) ) {
4756
  $blog_page = aiosp_common::get_blog_page( $post );
4757
+ if ( ! empty( $blog_page ) ) {
4758
+ $post = $blog_page;
4759
+ }
4760
+ $wp_admin_bar->add_menu( array(
4761
+ 'id' => 'aiosp_edit_' . $post->ID,
4762
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
4763
+ 'title' => __( 'Edit SEO', 'all-in-one-seo-pack' ),
4764
+ 'href' => get_edit_post_link( $post->ID ) . '#aiosp',
4765
+ ) );
4766
  }
4767
  }
4768
  }
4769
 
4770
+ /**
4771
+ * Order for adding the menus for the aioseop_modules_add_menus hook.
4772
+ */
4773
  function menu_order() {
4774
  return 5;
4775
  }
4776
 
4777
+ /**
4778
+ * @param $tax
4779
+ */
4780
  function display_category_metaboxes( $tax ) {
4781
  $screen = 'edit-' . $tax->taxonomy;
4782
+ ?>
4783
+ <div id="poststuff">
4784
+ <?php do_meta_boxes( '', 'advanced', $tax ); ?>
4785
+ </div>
4786
+ <?php
4787
  }
4788
 
4789
+ /**
4790
+ * @param $id
4791
+ */
4792
  function save_category_metaboxes( $id ) {
4793
  $awmp_edit = $nonce = null;
4794
+ if ( isset( $_POST['aiosp_edit'] ) ) {
4795
+ $awmp_edit = $_POST['aiosp_edit'];
4796
+ }
4797
+ if ( isset( $_POST['nonce-aioseop-edit'] ) ) {
4798
+ $nonce = $_POST['nonce-aioseop-edit'];
4799
+ }
4800
 
4801
+ if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
4802
+ $optlist = array(
4803
+ 'keywords',
4804
+ 'description',
4805
+ 'title',
4806
+ 'custom_link',
4807
+ 'sitemap_exclude',
4808
+ 'disable',
4809
+ 'disable_analytics',
4810
+ 'noindex',
4811
+ 'nofollow',
4812
+ 'noodp',
4813
+ 'noydir',
4814
+ 'titleatr',
4815
+ 'menulabel',
4816
+ );
4817
+ foreach ( $optlist as $f ) {
4818
  $field = "aiosp_$f";
4819
+ if ( isset( $_POST[ $field ] ) ) {
4820
+ $$field = $_POST[ $field ];
4821
+ }
4822
+ }
4823
 
4824
+ $optlist = array(
4825
+ 'keywords',
4826
+ 'description',
4827
+ 'title',
4828
+ 'custom_link',
4829
+ 'noindex',
4830
+ 'nofollow',
4831
+ 'noodp',
4832
+ 'noydir',
4833
+ 'titleatr',
4834
+ 'menulabel',
4835
+ );
4836
+ if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
4837
+ unset( $optlist['custom_link'] );
4838
  }
4839
+ foreach ( $optlist as $f ) {
4840
  delete_term_meta( $id, "_aioseop_{$f}" );
4841
+ }
4842
 
4843
+ if ( $this->is_admin() ) {
4844
+ delete_term_meta( $id, '_aioseop_sitemap_exclude' );
4845
+ delete_term_meta( $id, '_aioseop_disable' );
4846
+ delete_term_meta( $id, '_aioseop_disable_analytics' );
4847
  }
4848
 
4849
  foreach ( $optlist as $f ) {
4850
+ $var = "aiosp_$f";
4851
  $field = "_aioseop_$f";
4852
+ if ( isset( $$var ) && ! empty( $$var ) ) {
4853
+ add_term_meta( $id, $field, $$var );
4854
+ }
4855
+ }
4856
+ if ( isset( $aiosp_sitemap_exclude ) && ! empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) {
4857
+ add_term_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
4858
+ }
4859
+ if ( isset( $aiosp_disable ) && ! empty( $aiosp_disable ) && $this->is_admin() ) {
4860
+ add_term_meta( $id, '_aioseop_disable', $aiosp_disable );
4861
+ if ( isset( $aiosp_disable_analytics ) && ! empty( $aiosp_disable_analytics ) ) {
4862
+ add_term_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
4863
+ }
4864
  }
4865
+ }
4866
  }
4867
 
4868
  function admin_menu() {
4869
+ $file = plugin_basename( __FILE__ );
4870
  $menu_name = __( 'All in One SEO', 'all-in-one-seo-pack' );
4871
 
4872
+ $this->locations['aiosp']['default_options']['nonce-aioseop-edit']['default'] = wp_create_nonce( 'edit-aioseop-nonce' );
4873
 
4874
  $custom_menu_order = false;
4875
  global $aioseop_options;
4876
+ if ( ! isset( $aioseop_options['custom_menu_order'] ) ) {
4877
  $custom_menu_order = true;
4878
+ }
4879
 
4880
+ $this->update_options();
4881
 
4882
  $this->add_admin_pointers();
4883
+ if ( ! empty( $this->pointers ) ) {
4884
+ foreach ( $this->pointers as $k => $p ) {
4885
+ if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) {
4886
+ unset( $this->pointers[ $k ] );
4887
+ }
4888
+ }
4889
+ }
4890
 
4891
  $donated = false;
4892
+ 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' ) ) {
4893
+ if ( isset( $_POST['aiosp_donate'] ) ) {
4894
+ $donated = $_POST['aiosp_donate'];
4895
+ }
4896
+ if ( isset( $_POST['Submit'] ) ) {
4897
+ if ( isset( $_POST['aiosp_custom_menu_order'] ) ) {
4898
+ $custom_menu_order = $_POST['aiosp_custom_menu_order'];
4899
+ } else {
4900
  $custom_menu_order = false;
4901
+ }
4902
+ } else if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) {
4903
  $custom_menu_order = true;
4904
  }
4905
  } else {
4906
+ if ( isset( $this->options['aiosp_donate'] ) ) {
4907
+ $donated = $this->options['aiosp_donate'];
4908
+ }
4909
+ if ( isset( $this->options['aiosp_custom_menu_order'] ) ) {
4910
+ $custom_menu_order = $this->options['aiosp_custom_menu_order'];
4911
+ }
4912
  }
4913
 
4914
  if ( $custom_menu_order ) {
4917
  }
4918
 
4919
  if ( $donated ) {
4920
+ // Thank you for your donation.
4921
+ $this->pointers['aioseop_donate'] = array(
4922
+ 'pointer_target' => '#aiosp_donate_wrapper',
4923
+ 'pointer_text' => '<h3>' . __( 'Thank you!', 'all-in-one-seo-pack' )
4924
+ . '</h3><p>' . __( 'Thank you for your donation, it helps keep this plugin free and actively developed!', 'all-in-one-seo-pack' ) . '</p>',
4925
+ );
4926
  }
4927
 
4928
+ if ( ! AIOSEOPPRO ) {
4929
+ if ( ! empty( $this->pointers ) ) {
4930
+ foreach ( $this->pointers as $k => $p ) {
4931
+ if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) {
4932
+ unset( $this->pointers[ $k ] );
4933
+ }
4934
+ }
4935
+ }
4936
 
4937
+ $this->filter_pointers();
4938
  }
4939
 
4940
+ if ( ! empty( $this->options['aiosp_enablecpost'] ) && $this->options['aiosp_enablecpost'] ) {
4941
  if ( AIOSEOPPRO ) {
4942
+ $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
4943
+ if ( ! empty( $this->options['aiosp_taxactive'] ) ) {
4944
+ foreach ( $this->options['aiosp_taxactive'] as $tax ) {
4945
+ $this->locations['aiosp']['display'][] = 'edit-' . $tax;
4946
+ add_action( "{$tax}_edit_form", array( $this, 'display_category_metaboxes' ) );
4947
+ add_action( "edited_{$tax}", array( $this, 'save_category_metaboxes' ) );
4948
+ }
4949
  }
 
4950
  } else {
4951
+ if ( ! empty( $this->options['aiosp_cpostactive'] ) ) {
4952
  $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
4953
  } else {
4954
+ $this->locations['aiosp']['display'] = array();
4955
  }
4956
  }
4957
  } else {
4958
+ $this->locations['aiosp']['display'] = array( 'post', 'page' );
4959
  }
4960
 
4961
 
4962
+ add_menu_page( $menu_name, $menu_name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $file, array(
4963
+ $this,
4964
+ 'display_settings_page',
4965
+ ) );
4966
 
4967
+ add_meta_box( 'aioseop-list', __( 'Join Our Mailing List', 'all-in-one-seo-pack' ), array(
4968
+ 'aiosp_metaboxes',
4969
+ 'display_extra_metaboxes',
4970
+ ), 'aioseop_metaboxes', 'normal', 'core' );
4971
+ if ( AIOSEOPPRO ) {
4972
+ add_meta_box( 'aioseop-about', __( 'About', 'all-in-one-seo-pack' ), array(
4973
+ 'aiosp_metaboxes',
4974
+ 'display_extra_metaboxes',
4975
+ ), 'aioseop_metaboxes', 'side', 'core' );
4976
  } else {
4977
+ add_meta_box( 'aioseop-about', "About <span class='Taha' style='float:right;'>Version <b>" . AIOSEOP_VERSION . '</b></span>', array(
4978
+ 'aiosp_metaboxes',
4979
+ 'display_extra_metaboxes',
4980
+ ), 'aioseop_metaboxes', 'side', 'core' );
4981
  }
4982
+ add_meta_box( 'aioseop-support', __( 'Support', 'all-in-one-seo-pack' ) . " <span class='Taha' style='float:right;'>" . __( 'Version', 'all-in-one-seo-pack' ) . ' <b>' . AIOSEOP_VERSION . '</b></span>', array(
4983
+ 'aiosp_metaboxes',
4984
+ 'display_extra_metaboxes',
4985
+ ), 'aioseop_metaboxes', 'side', 'core' );
4986
 
4987
+ add_action( 'aioseop_modules_add_menus', array( $this, 'add_menu' ), 5 );
4988
  do_action( 'aioseop_modules_add_menus', $file );
4989
 
4990
+ $metaboxes = apply_filters( 'aioseop_add_post_metabox', array() );
4991
 
4992
+ if ( ! empty( $metaboxes ) ) {
4993
  if ( $this->tabbed_metaboxes ) {
4994
+ $tabs = array();
4995
  $tab_num = 0;
4996
  foreach ( $metaboxes as $m ) {
4997
+ if ( ! isset( $tabs[ $m['post_type'] ] ) ) {
4998
+ $tabs[ $m['post_type'] ] = array();
4999
+ }
5000
  $tabs[ $m['post_type'] ][] = $m;
5001
  }
5002
 
5003
+ if ( ! empty( $tabs ) ) {
5004
+ foreach ( $tabs as $p => $m ) {
5005
  $tab_num = count( $m );
5006
+ $title = $m[0]['title'];
5007
+ if ( $title != $this->plugin_name ) {
5008
+ $title = $this->plugin_name . ' - ' . $title;
5009
+ }
5010
  if ( $tab_num <= 1 ) {
5011
+ if ( ! empty( $m[0]['callback_args']['help_link'] ) ) {
5012
+ $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $m[0]['callback_args']['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . '</span></a>';
5013
+ }
5014
  add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] );
5015
  } elseif ( $tab_num > 1 ) {
5016
+ add_meta_box( $m[0]['id'] . '_tabbed', $title, array(
5017
+ $this,
5018
+ 'display_tabbed_metabox',
5019
+ ), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m );
5020
  }
5021
  }
5022
  }
5023
  } else {
5024
  foreach ( $metaboxes as $m ) {
5025
  $title = $m['title'];
5026
+ if ( $title != $this->plugin_name ) {
5027
+ $title = $this->plugin_name . ' - ' . $title;
5028
+ }
5029
+ if ( ! empty( $m['help_link'] ) ) {
5030
+ $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $m['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . '</span></a>';
5031
+ }
5032
  add_meta_box( $m['id'], $title, $m['callback'], $m['post_type'], $m['context'], $m['priority'], $m['callback_args'] );
5033
  }
5034
  }
5035
  }
5036
  }
5037
 
5038
+ /**
5039
+ * @param $menu_order
5040
+ *
5041
+ * @return array
5042
+ */
 
 
 
 
 
 
 
 
 
 
5043
  function set_menu_order( $menu_order ) {
5044
  $order = array();
5045
+ $file = plugin_basename( __FILE__ );
5046
  foreach ( $menu_order as $index => $item ) {
5047
+ if ( $item != $file ) {
5048
+ $order[] = $item;
5049
+ }
5050
+ if ( $index == 0 ) {
5051
+ $order[] = $file;
5052
+ }
5053
  }
5054
+
5055
  return $order;
5056
  }
5057
 
5058
  function display_settings_header() {
5059
  }
5060
+
5061
+ function display_settings_footer() {
5062
  }
5063
 
5064
+ function display_right_sidebar() {
5065
  global $wpdb;
5066
 
5067
+ if ( ! get_option( 'aioseop_options' ) ) {
5068
  $msg = "<div style='text-align:center;'><p><strong>Your database options need to be updated.</strong><em>(Back up your database before updating.)</em>
5069
  <FORM action='' method='post' name='aioseop-migrate-options'>
5070
  <input type='hidden' name='nonce-aioseop-migrate-options' value='" . wp_create_nonce( 'aioseop-migrate-nonce-options' ) . "' />
5071
  <input type='submit' name='aioseop_migrate_options' class='button-primary' value='Update Database Options'>
5072
  </FORM>
5073
  </p></div>";
5074
+ aioseop_output_dismissable_notice( $msg, '', 'error' );
5075
  }
5076
+ ?>
5077
  <div class="aioseop_top">
5078
  <div class="aioseop_top_sidebar aioseop_options_wrapper">
5079
+ <?php do_meta_boxes( 'aioseop_metaboxes', 'normal', array( 'test' ) ); ?>
5080
  </div>
5081
  </div>
5082
  <style>
5086
  </style>
5087
  <div class="aioseop_right_sidebar aioseop_options_wrapper">
5088
 
5089
+ <div class="aioseop_sidebar">
5090
+ <?php
5091
+ do_meta_boxes( 'aioseop_metaboxes', 'side', array( 'test' ) );
5092
+ ?>
5093
+ <script type="text/javascript">
5094
+ //<![CDATA[
5095
+ jQuery(document).ready(function ($) {
5096
+ // Close postboxes that should be closed.
5097
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
5098
+ // Postboxes setup.
5099
+ if (typeof postboxes !== 'undefined')
5100
+ postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
5101
+ });
5102
+ //]]>
5103
+ </script>
5104
+ <?php if ( ! AIOSEOPPRO ) { ?>
5105
+ <div class="aioseop_advert aioseop_nopad_all">
5106
+ <?php $adid = mt_rand( 21, 23 );
5107
+
5108
+ if ( $adid == 23 ) { ?>
5109
+ <div
5110
+ style="height: 220px; background-image: url('https://www.wincher.com/Content/Images/plugin/wp/banner30.jpg')">
5111
+ <form style="position: relative; top: 170px; left: 40px;"
5112
+ action="https://www.wincher.com/FastReg" method="post" target="_blank">
5113
+ <input type="hidden" name="adreferer" value="banner<?php echo $adid; ?>"/>
5114
+ <input type="hidden" name="referer" value="all-in-one-seo-pack"/>
5115
+ <input type="text" name="email" placeholder="Email"
5116
+ style="padding-left: 7px; height: 30px; width: 290px; border: solid 1px #DDD;"/>
5117
+ <input type="submit" name="sub" value="Sign up!"
5118
+ style="height: 30px; width: 90px; background-color: #42DA76; color: #FFF; font-weight: bold; border:none; margin-left:5px;"/>
5119
+ </form>
5120
+ </div>
5121
  <?
5122
+ } else {
5123
  ?>
5124
+ <a href="https://www.wincher.com/?referer=all-in-one-seo-pack&adreferer=banner<?php echo $adid; ?>"
5125
+ target="_blank">
5126
+ <div class=wincherad id=wincher<?php echo $adid; ?>>
 
 
 
 
 
 
5127
  </div>
5128
+ </a>
5129
+ <?php } ?>
5130
+ </div>
5131
+ <div class="aioseop_advert headwaythemes">
5132
+ <div>
5133
+ <h3>Drag and Drop WordPress Design</h3>
5134
+ <p><a href="http://semperfiwebdesign.com/headwayaio/" target="_blank">Headway Themes</a>
5135
+ allows you to easily create your own stunning website designs! Stop using premade themes
5136
+ start making your own design with Headway's easy to use Drag and Drop interface. All in
5137
+ One SEO Pack users have an exclusive discount by using coupon code
5138
+ <strong>SEMPERFI30</strong> at checkout.</p>
5139
+ </div>
5140
+ <a href="http://semperfiwebdesign.com/headwayaio/" target="_blank"><img
5141
+ src="<?php echo AIOSEOP_PLUGIN_IMAGES_URL; ?>headwaybanner.png"></a>
5142
+ </div>
5143
+ <?php } ?>
5144
+ </div>
5145
+ </div>
5146
+ <?php
5147
+ }
5148
 
5149
  }
aioseop_init.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
-
 
 
all_in_one_seo_pack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: All In One SEO Pack
4
  Plugin URI: http://semperfiwebdesign.com
5
  Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. Almost 30 million downloads since 2007.
6
- Version: 2.3.4.2
7
  Author: Michael Torbert
8
  Author URI: http://michaeltorbert.com
9
  Text Domain: all-in-one-seo-pack
@@ -11,7 +11,7 @@ Domain Path: /i18n/
11
  */
12
 
13
  /*
14
- Copyright (C) 2007-2016 Michael Torbert, semperfiwebdesign.com (michael AT semperfiwebdesign DOT com)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
@@ -28,71 +28,98 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
28
  */
29
 
30
  /**
 
 
 
31
  * @package All-in-One-SEO-Pack
32
- * @version 2.3.4.2
33
  */
34
 
35
- if(!defined('AIOSEOPPRO')) define('AIOSEOPPRO', false);
36
- if ( ! defined( 'AIOSEOP_VERSION' ) ) define( 'AIOSEOP_VERSION', '2.3.4.2' );
 
 
 
 
37
  global $aioseop_plugin_name;
38
  $aioseop_plugin_name = 'All in One SEO Pack';
39
 
40
- /*******
41
- *
42
- * All in One SEO Pack
43
- *
44
- *******/
45
 
46
- if ( ! defined( 'ABSPATH' ) ) return;
 
 
47
 
 
48
 
49
- if( AIOSEOPPRO ){
50
-
51
  add_action( 'admin_init', 'disable_all_in_one_free', 1 );
52
-
53
  }
54
 
55
- if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) define( 'AIOSEOP_PLUGIN_NAME', $aioseop_plugin_name );
 
 
 
 
56
 
 
 
 
 
 
 
57
 
58
- //register_activation_hook(__FILE__,'aioseop_activate_pl');
 
 
59
 
 
60
  if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
61
- define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
62
- } elseif ( AIOSEOP_PLUGIN_DIR != plugin_dir_path( __FILE__ ) ) {
63
-
64
- //this is not a great message
65
- /*
66
- add_action( 'admin_notices', create_function( '', 'echo "' . "<div class='error'>" . sprintf(
67
- __( "%s detected a conflict; please deactivate the plugin located in %s.", 'all-in-one-seo-pack' ),
68
- $aioseop_plugin_name, AIOSEOP_PLUGIN_DIR ) . "</div>" . '";' ) );
69
- */
70
-
71
- return;
72
 
 
 
 
 
 
 
73
 
 
74
  }
75
 
76
- if ( ! defined( 'AIOSEOP_PLUGIN_BASENAME' ) )
77
- define( 'AIOSEOP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
78
- if ( ! defined( 'AIOSEOP_PLUGIN_DIRNAME' ) )
79
- define( 'AIOSEOP_PLUGIN_DIRNAME', dirname( AIOSEOP_PLUGIN_BASENAME ) );
80
- if ( ! defined( 'AIOSEOP_PLUGIN_URL' ) )
81
- define( 'AIOSEOP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
82
- if ( ! defined( 'AIOSEOP_PLUGIN_IMAGES_URL' ) )
83
- define( 'AIOSEOP_PLUGIN_IMAGES_URL', AIOSEOP_PLUGIN_URL . 'images/' );
84
- if ( ! defined( 'AIOSEOP_BASELINE_MEM_LIMIT' ) )
85
- define( 'AIOSEOP_BASELINE_MEM_LIMIT', 268435456 ); // 256MB
86
- if ( ! defined( 'WP_CONTENT_URL' ) )
87
- define( 'WP_CONTENT_URL', site_url() . '/wp-content' );
88
- if ( ! defined( 'WP_ADMIN_URL' ) )
89
- define( 'WP_ADMIN_URL', site_url() . '/wp-admin' );
90
- if ( ! defined( 'WP_CONTENT_DIR' ) )
91
- define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
92
- if ( ! defined( 'WP_PLUGIN_URL' ) )
93
- define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
94
- if ( ! defined( 'WP_PLUGIN_DIR' ) )
95
- define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
 
 
 
 
 
 
 
 
 
 
96
 
97
  global $aiosp, $aioseop_options, $aioseop_modules, $aioseop_module_list, $aiosp_activation, $aioseop_mem_limit, $aioseop_get_pages_start, $aioseop_admin_menu;
98
  $aioseop_get_pages_start = $aioseop_admin_menu = 0;
@@ -105,253 +132,290 @@ $aioseop_options = get_option( 'aioseop_options' );
105
 
106
  $aioseop_mem_limit = @ini_get( 'memory_limit' );
107
 
108
- if ( !function_exists( 'aioseop_convert_bytestring' ) ) {
109
- function aioseop_convert_bytestring( $byteString ) {
 
 
 
 
 
110
  $num = 0;
111
- preg_match( '/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $byteString, $matches );
112
- if ( !empty( $matches ) ) {
113
- $num = ( float )$matches[1];
114
  switch ( strtoupper( $matches[2] ) ) {
115
- case 'E': $num = $num * 1024;
116
- case 'P': $num = $num * 1024;
117
- case 'T': $num = $num * 1024;
118
- case 'G': $num = $num * 1024;
119
- case 'M': $num = $num * 1024;
120
- case 'K': $num = $num * 1024;
 
 
 
 
 
 
121
  }
122
  }
 
123
  return intval( $num );
124
  }
125
  }
126
 
127
  if ( is_array( $aioseop_options ) && isset( $aioseop_options['modules'] ) && isset( $aioseop_options['modules']['aiosp_performance_options'] ) ) {
128
  $perf_opts = $aioseop_options['modules']['aiosp_performance_options'];
129
- if ( isset( $perf_opts['aiosp_performance_memory_limit'] ) )
130
  $aioseop_mem_limit = $perf_opts['aiosp_performance_memory_limit'];
131
- if ( isset( $perf_opts['aiosp_performance_execution_time'] ) && ( $perf_opts['aiosp_performance_execution_time'] !== '' ) ) {
132
- @ini_set( 'max_execution_time', (int)$perf_opts['aiosp_performance_execution_time'] );
133
- @set_time_limit( (int)$perf_opts['aiosp_performance_execution_time'] );
 
134
  }
135
  } else {
136
  $aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit );
137
- if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit < AIOSEOP_BASELINE_MEM_LIMIT ) )
138
  $aioseop_mem_limit = AIOSEOP_BASELINE_MEM_LIMIT;
 
139
  }
140
 
141
- if ( !empty( $aioseop_mem_limit ) ) {
142
- if ( !is_int( $aioseop_mem_limit ) )
143
  $aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit );
144
- if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit <= AIOSEOP_BASELINE_MEM_LIMIT ) )
 
145
  @ini_set( 'memory_limit', $aioseop_mem_limit );
 
146
  }
147
 
148
- $aiosp_activation = false;
149
- $aioseop_module_list = Array( 'sitemap', 'opengraph', 'robots', 'file_editor', 'importer_exporter', 'bad_robots', 'performance' ); // list all available modules here
 
 
 
 
 
 
 
 
150
 
151
- if (AIOSEOPPRO){
152
  $aioseop_module_list[] = 'video_sitemap';
153
  }
154
 
155
  if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
156
  add_action( 'admin_notices', create_function( '', 'echo "<div class=\'error\'>The All In One SEO Pack class is already defined";'
157
- . "if ( class_exists( 'ReflectionClass' ) ) { \$r = new ReflectionClass( 'All_in_One_SEO_Pack' ); echo ' in ' . \$r->getFileName(); } "
158
- . ' echo ", preventing All In One SEO Pack from loading.</div>";' ) );
159
- return;
 
160
  }
161
 
162
- if ( AIOSEOPPRO ){
163
-
164
- require( AIOSEOP_PLUGIN_DIR . 'pro/sfwd_update_checker.php');
165
  $aioseop_update_checker = new SFWD_Update_Checker(
166
- 'http://semperplugins.com/upgrade_plugins.php',
167
- __FILE__,
168
- 'aioseop'
169
  );
170
-
171
-
172
- $aioseop_update_checker->plugin_name = AIOSEOP_PLUGIN_NAME;
173
- $aioseop_update_checker->plugin_basename = AIOSEOP_PLUGIN_BASENAME;
174
- if ( !empty( $aioseop_options['aiosp_license_key'] ) )
175
- $aioseop_update_checker->license_key = $aioseop_options['aiosp_license_key'];
176
- else
177
- $aioseop_update_checker->license_key = '';
178
- $aioseop_update_checker->options_page = 'all-in-one-seo-pack-pro/aioseop_class.php';
179
- $aioseop_update_checker->renewal_page = 'http://semperplugins.com/all-in-one-seo-pack-pro-support-updates-renewal/';
180
 
181
- $aioseop_update_checker->addQueryArgFilter( Array( $aioseop_update_checker, 'add_secret_key' ) );
 
 
 
 
 
 
 
 
 
 
182
  }
183
 
184
 
185
- /**
186
- * Check if we just got activated.
187
- */
188
- if ( !function_exists( 'aioseop_activate' ) ) {
189
  function aioseop_activate() {
190
-
191
- global $aiosp_activation;
192
- if ( AIOSEOPPRO ){
193
- global $aioseop_update_checker;
194
- }
195
- $aiosp_activation = true;
196
- delete_transient( "aioseop_oauth_current" );
197
 
198
  delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
199
 
200
- if ( AIOSEOPPRO ){
201
- $aioseop_update_checker->checkForUpdates();
202
  }
203
  }
204
  }
205
 
206
  add_action( 'plugins_loaded', 'aioseop_init_class' );
207
 
 
208
 
 
209
 
210
- if(!function_exists('aiosp_plugin_row_meta')){
211
-
212
- add_filter( 'plugin_row_meta', 'aiosp_plugin_row_meta', 10, 2 );
 
 
 
 
213
 
214
- function aiosp_plugin_row_meta( $actions, $plugin_file ) {
215
 
216
- if(!AIOSEOPPRO){
 
 
 
 
 
 
 
 
217
 
218
- $action_links = array(
219
- 'donatelink' => array(
220
- 'label' => __('Donate', 'all-in-one-seo-pack'),
221
- '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&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8'
222
- )
223
- ,
224
- 'amazon' => array(
225
- 'label' => __('Amazon Wishlist', 'all-in-one-seo-pack'),
226
- 'url' => 'https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web'
227
- )
228
 
 
 
 
229
 
230
- );
231
-
232
- }else{
233
- $action_links = '';
234
- }
235
-
236
- return aiosp_action_links( $actions, $plugin_file, $action_links, 'after');
237
- }
238
  }
239
 
 
240
 
241
 
 
242
 
 
 
 
 
 
 
 
243
 
 
 
 
 
 
 
 
244
 
245
- if(!function_exists('aiosp_add_action_links')) {
246
-
247
-
248
- add_filter( 'plugin_action_links_' . plugin_basename(__FILE__) , 'aiosp_add_action_links', 10, 2 );
249
-
250
-
251
 
252
- function aiosp_add_action_links( $actions, $plugin_file ) {
253
-
254
- $aioseop_plugin_dirname = AIOSEOP_PLUGIN_DIRNAME;
255
- $action_links = Array();
256
- $action_links = array(
257
- 'settings' => array(
258
- 'label' => __('SEO Settings', 'all-in-one-seo-pack'),
259
- 'url' => get_admin_url(null, "admin.php?page=$aioseop_plugin_dirname/aioseop_class.php")
260
- ),
261
-
262
- 'forum' => array(
263
- 'label' => __('Support Forum', 'all-in-one-seo-pack'),
264
- 'url' => 'http://semperplugins.com/support/'
265
  ),
266
 
267
- 'docs' => array(
268
- 'label' => __('Documentation', 'all-in-one-seo-pack'),
269
- 'url' => 'http://semperplugins.com/documentation/'
270
- )
271
-
272
- );
273
 
274
- unset( $actions['edit'] );
275
 
276
- if(!AIOSEOPPRO){
277
- $action_links['proupgrade'] =
278
- array(
279
- 'label' => __('Upgrade to Pro', 'all-in-one-seo-pack'),
280
- 'url' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins'
281
 
282
- );
283
- }
284
 
285
- return aiosp_action_links( $actions, $plugin_file, $action_links, 'before');
 
286
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  }
288
 
289
- if(!function_exists('aiosp_action_links')) {
290
 
291
- function aiosp_action_links ( $actions, $plugin_file, $action_links = array(), $position = 'after' ) {
292
- static $plugin;
293
- if( !isset($plugin) ) {
294
- $plugin = plugin_basename( __FILE__ );
295
- }
296
- if( $plugin == $plugin_file && !empty( $action_links ) ) {
297
- foreach( $action_links as $key => $value ) {
298
- $link = array( $key => '<a href="' . $value['url'] . '">' . $value['label'] . '</a>' );
299
- if( $position == 'after' ) {
300
- $actions = array_merge( $actions, $link );
301
- } else {
302
- $actions = array_merge( $link, $actions );
303
- }
304
- }//foreach
305
- }// if
306
- return $actions;
307
- }
308
- }
309
- if ( !function_exists( 'aioseop_init_class' ) ) {
310
  function aioseop_init_class() {
311
  global $aiosp;
312
  load_plugin_textdomain( 'all-in-one-seo-pack', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n/' );
313
  require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_functions.php' );
314
  require_once( AIOSEOP_PLUGIN_DIR . 'aioseop_class.php' );
315
- require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_updates_class.php');
316
- require_once( AIOSEOP_PLUGIN_DIR . 'inc/commonstrings.php');
317
- require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/postedit.php');
318
- require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/general-metaboxes.php');
319
- require_once( AIOSEOP_PLUGIN_DIR . 'inc/aiosp_common.php');
320
- require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php');
321
-
322
- if( AIOSEOPPRO ){
 
 
 
 
323
  require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_general.php' );
324
- require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_class.php');
325
- require_once( AIOSEOP_PLUGIN_DIR . 'pro/aioseop_pro_updates_class.php');
326
  }
327
  aiosp_seometa_import(); // call importer functions... this should be moved somewhere better
328
-
329
  $aiosp = new All_in_One_SEO_Pack();
330
-
331
  $aioseop_updates = new AIOSEOP_Updates();
332
 
333
- if( AIOSEOPPRO ){
334
  $aioseop_pro_updates = new AIOSEOP_Pro_Updates();
335
  add_action( 'admin_init', array( $aioseop_pro_updates, 'version_updates' ), 12 );
336
  }
337
 
338
- if ( aioseop_option_isset( 'aiosp_unprotect_meta' ) )
339
  add_filter( 'is_protected_meta', 'aioseop_unprotect_meta', 10, 3 );
340
-
341
-
342
-
343
 
344
  add_action( 'init', array( $aiosp, 'add_hooks' ) );
345
  add_action( 'admin_init', array( $aioseop_updates, 'version_updates' ), 11 );
346
-
347
- if ( defined( 'DOING_AJAX' ) && !empty( $_POST ) && !empty( $_POST['action'] ) && ( $_POST['action'] === 'aioseop_ajax_scan_header' ) ) {
348
  remove_action( 'init', array( $aiosp, 'add_hooks' ) );
349
- add_action('admin_init', 'aioseop_scan_post_header' );
350
- add_action('shutdown', 'aioseop_ajax_scan_header' ); // if the action doesn't run -- pdb
351
- include_once(ABSPATH . 'wp-admin/includes/screen.php');
352
  global $current_screen;
353
- if ( class_exists( 'WP_Screen' ) )
354
  $current_screen = WP_Screen::get( 'front' );
 
355
  }
356
  }
357
  }
@@ -360,47 +424,49 @@ add_action( 'init', 'aioseop_load_modules', 1 );
360
  //add_action( 'after_setup_theme', 'aioseop_load_modules' );
361
 
362
  if ( is_admin() ) {
363
- add_action( 'wp_ajax_aioseop_ajax_save_meta', 'aioseop_ajax_save_meta' );
364
- add_action( 'wp_ajax_aioseop_ajax_save_url', 'aioseop_ajax_save_url' );
365
- add_action( 'wp_ajax_aioseop_ajax_delete_url', 'aioseop_ajax_delete_url' );
366
- add_action( 'wp_ajax_aioseop_ajax_scan_header', 'aioseop_ajax_scan_header' );
367
- if(AIOSEOPPRO){
368
  add_action( 'wp_ajax_aioseop_ajax_facebook_debug', 'aioseop_ajax_facebook_debug' );
369
  }
370
- add_action( 'wp_ajax_aioseop_ajax_save_settings', 'aioseop_ajax_save_settings');
371
- add_action( 'wp_ajax_aioseop_ajax_get_menu_links', 'aioseop_ajax_get_menu_links');
372
- add_action( 'wp_ajax_aioseo_dismiss_yst_notice' , 'aioseop_update_yst_detected_notice');
373
- add_action( 'wp_ajax_aioseo_dismiss_visibility_notice' , 'aioseop_update_user_visibilitynotice');
374
- add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice' , 'aioseop_woo_upgrade_notice_dismissed');
375
- if(AIOSEOPPRO){
376
- add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' );
377
  }
378
  }
379
 
380
- if ( !function_exists( 'aioseop_scan_post_header' ) ) {
381
  function aioseop_scan_post_header() {
382
  require_once( ABSPATH . WPINC . '/default-filters.php' );
383
  global $wp_query;
384
  $wp_query->query_vars['paged'] = 0;
385
- query_posts('post_type=post&posts_per_page=1');
386
- if (have_posts()) the_post();
 
 
387
  }
388
  }
389
 
390
- require_once( AIOSEOP_PLUGIN_DIR . 'aioseop_init.php' );
391
-
392
 
393
- if(!function_exists('aioseop_install')){
394
- register_activation_hook( __FILE__, 'aioseop_install' );
395
 
396
- function aioseop_install(){
397
- aioseop_activate();
398
- }
399
  }
400
 
401
- if(!function_exists('disable_all_in_one_free')){
402
- function disable_all_in_one_free(){
403
- if ( AIOSEOPPRO && is_plugin_active( 'all-in-one-seo-pack/all_in_one_seo_pack.php' )){
404
- deactivate_plugins( 'all-in-one-seo-pack/all_in_one_seo_pack.php' );
 
405
  }
406
- }}
3
  Plugin Name: All In One SEO Pack
4
  Plugin URI: http://semperfiwebdesign.com
5
  Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. Almost 30 million downloads since 2007.
6
+ Version: 2.3.6.1
7
  Author: Michael Torbert
8
  Author URI: http://michaeltorbert.com
9
  Text Domain: all-in-one-seo-pack
11
  */
12
 
13
  /*
14
+ Copyright (C) 2007-2016 Michael Torbert, https://semperfiwebdesign.com
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
28
  */
29
 
30
  /**
31
+ * All in One SEO Pack.
32
+ * The original WordPress SEO plugin.
33
+ *
34
  * @package All-in-One-SEO-Pack
35
+ * @version 2.3.6.1
36
  */
37
 
38
+ if ( ! defined( 'AIOSEOPPRO' ) ) {
39
+ define( 'AIOSEOPPRO', false );
40
+ }
41
+ if ( ! defined( 'AIOSEOP_VERSION' ) ) {
42
+ define( 'AIOSEOP_VERSION', '2.3.6.1' );
43
+ }
44
  global $aioseop_plugin_name;
45
  $aioseop_plugin_name = 'All in One SEO Pack';
46
 
47
+ /*
48
+ * DO NOT EDIT BELOW THIS LINE.
49
+ */
 
 
50
 
51
+ if ( ! defined( 'ABSPATH' ) ) {
52
+ return;
53
+ }
54
 
55
+ if ( AIOSEOPPRO ) {
56
 
 
 
57
  add_action( 'admin_init', 'disable_all_in_one_free', 1 );
58
+
59
  }
60
 
61
+ function aiosp_add_cap(){
62
+ /*
63
+ TODO we should put this into an install script. We just need to make sure it runs soon enough and we need to make
64
+ sure people updating from previous versions have access to it.
65
+ */
66
 
67
+ $role = get_role( 'administrator' );
68
+ if ( is_object( $role ) ) {
69
+ $role->add_cap( 'aiosp_manage_seo' );
70
+ }
71
+ }
72
+ add_action( 'plugins_loaded', 'aiosp_add_cap' );
73
 
74
+ if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) {
75
+ define( 'AIOSEOP_PLUGIN_NAME', $aioseop_plugin_name );
76
+ }
77
 
78
+ // Do we need this? register_activation_hook(__FILE__,'aioseop_activate_pl');.
79
  if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
80
+ define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
81
+ } elseif ( AIOSEOP_PLUGIN_DIR !== plugin_dir_path( __FILE__ ) ) {
 
 
 
 
 
 
 
 
 
82
 
83
+ /*
84
+ This is not a great message.
85
+ add_action( 'admin_notices', create_function( '', 'echo "' . "<div class='error'>" . sprintf(
86
+ __( "%s detected a conflict; please deactivate the plugin located in %s.", 'all-in-one-seo-pack' ),
87
+ $aioseop_plugin_name, AIOSEOP_PLUGIN_DIR ) . "</div>" . '";' ) );
88
+ */
89
 
90
+ return;
91
  }
92
 
93
+ if ( ! defined( 'AIOSEOP_PLUGIN_BASENAME' ) ) {
94
+ define( 'AIOSEOP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
95
+ }
96
+ if ( ! defined( 'AIOSEOP_PLUGIN_DIRNAME' ) ) {
97
+ define( 'AIOSEOP_PLUGIN_DIRNAME', dirname( AIOSEOP_PLUGIN_BASENAME ) );
98
+ }
99
+ if ( ! defined( 'AIOSEOP_PLUGIN_URL' ) ) {
100
+ define( 'AIOSEOP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
101
+ }
102
+ if ( ! defined( 'AIOSEOP_PLUGIN_IMAGES_URL' ) ) {
103
+ define( 'AIOSEOP_PLUGIN_IMAGES_URL', AIOSEOP_PLUGIN_URL . 'images/' );
104
+ }
105
+ if ( ! defined( 'AIOSEOP_BASELINE_MEM_LIMIT' ) ) {
106
+ define( 'AIOSEOP_BASELINE_MEM_LIMIT', 268435456 );
107
+ } // 256MB
108
+ if ( ! defined( 'WP_CONTENT_URL' ) ) {
109
+ define( 'WP_CONTENT_URL', site_url() . '/wp-content' );
110
+ }
111
+ if ( ! defined( 'WP_ADMIN_URL' ) ) {
112
+ define( 'WP_ADMIN_URL', site_url() . '/wp-admin' );
113
+ }
114
+ if ( ! defined( 'WP_CONTENT_DIR' ) ) {
115
+ define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
116
+ }
117
+ if ( ! defined( 'WP_PLUGIN_URL' ) ) {
118
+ define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' );
119
+ }
120
+ if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
121
+ define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
122
+ }
123
 
124
  global $aiosp, $aioseop_options, $aioseop_modules, $aioseop_module_list, $aiosp_activation, $aioseop_mem_limit, $aioseop_get_pages_start, $aioseop_admin_menu;
125
  $aioseop_get_pages_start = $aioseop_admin_menu = 0;
132
 
133
  $aioseop_mem_limit = @ini_get( 'memory_limit' );
134
 
135
+ if ( ! function_exists( 'aioseop_convert_bytestring' ) ) {
136
+ /**
137
+ * @param $byte_string
138
+ *
139
+ * @return int
140
+ */
141
+ function aioseop_convert_bytestring( $byte_string ) {
142
  $num = 0;
143
+ preg_match( '/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $byte_string, $matches );
144
+ if ( ! empty( $matches ) ) {
145
+ $num = (float) $matches[1];
146
  switch ( strtoupper( $matches[2] ) ) {
147
+ case 'E':
148
+ $num *= 1024;
149
+ case 'P':
150
+ $num *= 1024;
151
+ case 'T':
152
+ $num *= 1024;
153
+ case 'G':
154
+ $num *= 1024;
155
+ case 'M':
156
+ $num *= 1024;
157
+ case 'K':
158
+ $num *= 1024;
159
  }
160
  }
161
+
162
  return intval( $num );
163
  }
164
  }
165
 
166
  if ( is_array( $aioseop_options ) && isset( $aioseop_options['modules'] ) && isset( $aioseop_options['modules']['aiosp_performance_options'] ) ) {
167
  $perf_opts = $aioseop_options['modules']['aiosp_performance_options'];
168
+ if ( isset( $perf_opts['aiosp_performance_memory_limit'] ) ) {
169
  $aioseop_mem_limit = $perf_opts['aiosp_performance_memory_limit'];
170
+ }
171
+ if ( isset( $perf_opts['aiosp_performance_execution_time'] ) && ( '' !== $perf_opts['aiosp_performance_execution_time'] ) ) {
172
+ @ini_set( 'max_execution_time', (int) $perf_opts['aiosp_performance_execution_time'] );
173
+ @set_time_limit( (int) $perf_opts['aiosp_performance_execution_time'] );
174
  }
175
  } else {
176
  $aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit );
177
+ if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit < AIOSEOP_BASELINE_MEM_LIMIT ) ) {
178
  $aioseop_mem_limit = AIOSEOP_BASELINE_MEM_LIMIT;
179
+ }
180
  }
181
 
182
+ if ( ! empty( $aioseop_mem_limit ) ) {
183
+ if ( ! is_int( $aioseop_mem_limit ) ) {
184
  $aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit );
185
+ }
186
+ if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit <= AIOSEOP_BASELINE_MEM_LIMIT ) ) {
187
  @ini_set( 'memory_limit', $aioseop_mem_limit );
188
+ }
189
  }
190
 
191
+ $aiosp_activation = false;
192
+ $aioseop_module_list = array(
193
+ 'sitemap',
194
+ 'opengraph',
195
+ 'robots',
196
+ 'file_editor',
197
+ 'importer_exporter',
198
+ 'bad_robots',
199
+ 'performance',
200
+ ); // list all available modules here
201
 
202
+ if ( AIOSEOPPRO ) {
203
  $aioseop_module_list[] = 'video_sitemap';
204
  }
205
 
206
  if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
207
  add_action( 'admin_notices', create_function( '', 'echo "<div class=\'error\'>The All In One SEO Pack class is already defined";'
208
+ . "if ( class_exists( 'ReflectionClass' ) ) { \$r = new ReflectionClass( 'All_in_One_SEO_Pack' ); echo ' in ' . \$r->getFileName(); } "
209
+ . ' echo ", preventing All In One SEO Pack from loading.</div>";' ) );
210
+
211
+ return;
212
  }
213
 
214
+ if ( AIOSEOPPRO ) {
215
+
216
+ require( AIOSEOP_PLUGIN_DIR . 'pro/sfwd_update_checker.php' );
217
  $aioseop_update_checker = new SFWD_Update_Checker(
218
+ 'http://semperplugins.com/upgrade_plugins.php',
219
+ __FILE__,
220
+ 'aioseop'
221
  );
 
 
 
 
 
 
 
 
 
 
222
 
223
+ $aioseop_update_checker->plugin_name = AIOSEOP_PLUGIN_NAME;
224
+ $aioseop_update_checker->plugin_basename = AIOSEOP_PLUGIN_BASENAME;
225
+ if ( ! empty( $aioseop_options['aiosp_license_key'] ) ) {
226
+ $aioseop_update_checker->license_key = $aioseop_options['aiosp_license_key'];
227
+ } else {
228
+ $aioseop_update_checker->license_key = '';
229
+ }
230
+ $aioseop_update_checker->options_page = 'all-in-one-seo-pack-pro/aioseop_class.php';
231
+ $aioseop_update_checker->renewal_page = 'http://semperplugins.com/all-in-one-seo-pack-pro-support-updates-renewal/';
232
+
233
+ $aioseop_update_checker->addQueryArgFilter( array( $aioseop_update_checker, 'add_secret_key' ) );
234
  }
235
 
236
 
237
+ if ( ! function_exists( 'aioseop_activate' ) ) {
238
+
 
 
239
  function aioseop_activate() {
240
+
241
+ //Check if we just got activated.
242
+ global $aiosp_activation;
243
+ if ( AIOSEOPPRO ) {
244
+ global $aioseop_update_checker;
245
+ }
246
+ $aiosp_activation = true;
247
 
248
  delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
249
 
250
+ if ( AIOSEOPPRO ) {
251
+ $aioseop_update_checker->checkForUpdates();
252
  }
253
  }
254
  }
255
 
256
  add_action( 'plugins_loaded', 'aioseop_init_class' );
257
 
258
+ if ( ! function_exists( 'aiosp_plugin_row_meta' ) ) {
259
 
260
+ add_filter( 'plugin_row_meta', 'aiosp_plugin_row_meta', 10, 2 );
261
 
262
+ /**
263
+ * @param $actions
264
+ * @param $plugin_file
265
+ *
266
+ * @return array
267
+ */
268
+ function aiosp_plugin_row_meta( $actions, $plugin_file ) {
269
 
270
+ if ( ! AIOSEOPPRO ) {
271
 
272
+ $action_links = array(
273
+ 'donatelink' => array(
274
+ 'label' => __( 'Donate', 'all-in-one-seo-pack' ),
275
+ '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&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8',
276
+ ),
277
+ 'amazon' => array(
278
+ 'label' => __( 'Amazon Wishlist', 'all-in-one-seo-pack' ),
279
+ 'url' => 'https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web',
280
+ ),
281
 
282
+ );
 
 
 
 
 
 
 
 
 
283
 
284
+ } else {
285
+ $action_links = '';
286
+ }
287
 
288
+ return aiosp_action_links( $actions, $plugin_file, $action_links, 'after' );
289
+ }
 
 
 
 
 
 
290
  }
291
 
292
+ if ( ! function_exists( 'aiosp_add_action_links' ) ) {
293
 
294
 
295
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'aiosp_add_action_links', 10, 2 );
296
 
297
+ /**
298
+ * @param $actions
299
+ * @param $plugin_file
300
+ *
301
+ * @return array
302
+ */
303
+ function aiosp_add_action_links( $actions, $plugin_file ) {
304
 
305
+ $aioseop_plugin_dirname = AIOSEOP_PLUGIN_DIRNAME;
306
+ $action_links = array();
307
+ $action_links = array(
308
+ 'settings' => array(
309
+ 'label' => __( 'SEO Settings', 'all-in-one-seo-pack' ),
310
+ 'url' => get_admin_url( null, "admin.php?page=$aioseop_plugin_dirname/aioseop_class.php" ),
311
+ ),
312
 
313
+ 'forum' => array(
314
+ 'label' => __( 'Support Forum', 'all-in-one-seo-pack' ),
315
+ 'url' => 'http://semperplugins.com/support/',
316
+ ),
 
 
317
 
318
+ 'docs' => array(
319
+ 'label' => __( 'Documentation', 'all-in-one-seo-pack' ),
320
+ 'url' => 'http://semperplugins.com/documentation/',
 
 
 
 
 
 
 
 
 
 
321
  ),
322
 
323
+ );
 
 
 
 
 
324
 
325
+ unset( $actions['edit'] );
326
 
327
+ if ( ! AIOSEOPPRO ) {
328
+ $action_links['proupgrade'] =
329
+ array(
330
+ 'label' => __( 'Upgrade to Pro', 'all-in-one-seo-pack' ),
331
+ 'url' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins',
332
 
333
+ );
334
+ }
335
 
336
+ return aiosp_action_links( $actions, $plugin_file, $action_links, 'before' );
337
+ }
338
  }
339
+
340
+ if ( ! function_exists( 'aiosp_action_links' ) ) {
341
+
342
+ /**
343
+ * @param $actions
344
+ * @param $plugin_file
345
+ * @param array $action_links
346
+ * @param string $position
347
+ *
348
+ * @return array
349
+ */
350
+ function aiosp_action_links( $actions, $plugin_file, $action_links = array(), $position = 'after' ) {
351
+ static $plugin;
352
+ if ( ! isset( $plugin ) ) {
353
+ $plugin = plugin_basename( __FILE__ );
354
+ }
355
+ if ( $plugin === $plugin_file && ! empty( $action_links ) ) {
356
+ foreach ( $action_links as $key => $value ) {
357
+ $link = array( $key => '<a href="' . $value['url'] . '">' . $value['label'] . '</a>' );
358
+ if ( 'after' === $position ) {
359
+ $actions = array_merge( $actions, $link );
360
+ } else {
361
+ $actions = array_merge( $link, $actions );
362
+ }
363
+ }//foreach
364
+ }// if
365
+ return $actions;
366
+ }
367
  }
368
 
 
369
 
370
+ if ( ! function_exists( 'aioseop_init_class' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  function aioseop_init_class() {
372
  global $aiosp;
373
  load_plugin_textdomain( 'all-in-one-seo-pack', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n/' );
374
  require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_functions.php' );
375
  require_once( AIOSEOP_PLUGIN_DIR . 'aioseop_class.php' );
376
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_updates_class.php' );
377
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/commonstrings.php' );
378
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/postedit.php' );
379
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/general-metaboxes.php' );
380
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/aiosp_common.php' );
381
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php' );
382
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/translations.php' );
383
+ require_once( AIOSEOP_PLUGIN_DIR . 'public/opengraph.php' );
384
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/compat-init.php');
385
+ require_once( AIOSEOP_PLUGIN_DIR . 'public/front.php' );
386
+
387
+ if ( AIOSEOPPRO ) {
388
  require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_general.php' );
389
+ require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_class.php' );
390
+ require_once( AIOSEOP_PLUGIN_DIR . 'pro/aioseop_pro_updates_class.php' );
391
  }
392
  aiosp_seometa_import(); // call importer functions... this should be moved somewhere better
393
+
394
  $aiosp = new All_in_One_SEO_Pack();
395
+
396
  $aioseop_updates = new AIOSEOP_Updates();
397
 
398
+ if ( AIOSEOPPRO ) {
399
  $aioseop_pro_updates = new AIOSEOP_Pro_Updates();
400
  add_action( 'admin_init', array( $aioseop_pro_updates, 'version_updates' ), 12 );
401
  }
402
 
403
+ if ( aioseop_option_isset( 'aiosp_unprotect_meta' ) ) {
404
  add_filter( 'is_protected_meta', 'aioseop_unprotect_meta', 10, 3 );
405
+ }
 
 
406
 
407
  add_action( 'init', array( $aiosp, 'add_hooks' ) );
408
  add_action( 'admin_init', array( $aioseop_updates, 'version_updates' ), 11 );
409
+
410
+ if ( defined( 'DOING_AJAX' ) && ! empty( $_POST ) && ! empty( $_POST['action'] ) && 'aioseop_ajax_scan_header' === $_POST['action'] ) {
411
  remove_action( 'init', array( $aiosp, 'add_hooks' ) );
412
+ add_action( 'admin_init', 'aioseop_scan_post_header' );
413
+ add_action( 'shutdown', 'aioseop_ajax_scan_header' ); // if the action doesn't run -- pdb
414
+ include_once( ABSPATH . 'wp-admin/includes/screen.php' );
415
  global $current_screen;
416
+ if ( class_exists( 'WP_Screen' ) ) {
417
  $current_screen = WP_Screen::get( 'front' );
418
+ }
419
  }
420
  }
421
  }
424
  //add_action( 'after_setup_theme', 'aioseop_load_modules' );
425
 
426
  if ( is_admin() ) {
427
+ add_action( 'wp_ajax_aioseop_ajax_save_meta', 'aioseop_ajax_save_meta' );
428
+ add_action( 'wp_ajax_aioseop_ajax_save_url', 'aioseop_ajax_save_url' );
429
+ add_action( 'wp_ajax_aioseop_ajax_delete_url', 'aioseop_ajax_delete_url' );
430
+ add_action( 'wp_ajax_aioseop_ajax_scan_header', 'aioseop_ajax_scan_header' );
431
+ if ( AIOSEOPPRO ) {
432
  add_action( 'wp_ajax_aioseop_ajax_facebook_debug', 'aioseop_ajax_facebook_debug' );
433
  }
434
+ add_action( 'wp_ajax_aioseop_ajax_save_settings', 'aioseop_ajax_save_settings' );
435
+ add_action( 'wp_ajax_aioseop_ajax_get_menu_links', 'aioseop_ajax_get_menu_links' );
436
+ add_action( 'wp_ajax_aioseo_dismiss_yst_notice', 'aioseop_update_yst_detected_notice' );
437
+ add_action( 'wp_ajax_aioseo_dismiss_visibility_notice', 'aioseop_update_user_visibilitynotice' );
438
+ add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice', 'aioseop_woo_upgrade_notice_dismissed' );
439
+ if ( AIOSEOPPRO ) {
440
+ add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' );
441
  }
442
  }
443
 
444
+ if ( ! function_exists( 'aioseop_scan_post_header' ) ) {
445
  function aioseop_scan_post_header() {
446
  require_once( ABSPATH . WPINC . '/default-filters.php' );
447
  global $wp_query;
448
  $wp_query->query_vars['paged'] = 0;
449
+ query_posts( 'post_type=post&posts_per_page=1' );
450
+ if ( have_posts() ) {
451
+ the_post();
452
+ }
453
  }
454
  }
455
 
456
+ require_once( AIOSEOP_PLUGIN_DIR . 'aioseop-init.php' );
 
457
 
458
+ if ( ! function_exists( 'aioseop_install' ) ) {
459
+ register_activation_hook( __FILE__, 'aioseop_install' );
460
 
461
+ function aioseop_install() {
462
+ aioseop_activate();
463
+ }
464
  }
465
 
466
+ if ( ! function_exists( 'disable_all_in_one_free' ) ) {
467
+ function disable_all_in_one_free() {
468
+ if ( AIOSEOPPRO && is_plugin_active( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ) ) {
469
+ deactivate_plugins( 'all-in-one-seo-pack/all_in_one_seo_pack.php' );
470
+ }
471
  }
472
+ }
css/aiosp_admin.css CHANGED
@@ -1,72 +1,76 @@
1
- #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image {
2
- background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important;
3
- }
4
- #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image {
5
- background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important;
6
- }
7
- #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image img {
8
- display: none;
9
- }
10
- #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image img {
11
- display: none;
12
- }
13
- #adminmenu #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image:before {
14
- content: '';
15
- }
16
- #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image:before {
17
- content: '' !important;
18
- }
19
- #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 {
20
- background-position: 8px -26px !important;
21
- }
22
- #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 {
23
- background-position: 8px -26px !important;
24
- }
25
- #icon-aioseop.icon32 {
26
- background: url(../images/shield32.png) no-repeat left top !important;
27
- }
28
- #aioseop_settings_header #message {
29
- padding: 5px 0px 5px 50px;
30
- background-image: url(../images/update32.png);
31
- background-repeat: no-repeat;
32
- background-position: 10px;
33
- font-size: 14px;
34
- min-height: 32px;
35
- clear: none;
36
- }
37
 
38
- @media
39
- only screen and (-webkit-min-device-pixel-ratio: 1.5),
40
- only screen and ( min--moz-device-pixel-ratio: 1.5),
41
- only screen and ( -o-min-device-pixel-ratio: 3/2),
42
- only screen and ( min-device-pixel-ratio: 1.5),
43
- only screen and ( min-resolution: 1.5dppx) {
44
 
45
- #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image {
46
- background-image: url('../images/shield-sprite-32.png') !important;
47
- -webkit-background-size: 16px 48px !important;
48
- -moz-background-size: 16px 48px !important;
49
- background-size: 16px 48px !important;
50
- }
51
 
52
- #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image {
53
- background-image: url('../images/shield-sprite-32.png') !important;
54
- -webkit-background-size: 16px 48px !important;
55
- -moz-background-size: 16px 48px !important;
56
- background-size: 16px 48px !important;
57
- }
58
 
59
- #icon-aioseop.icon32 {
60
- background-image: url('../images/shield64.png') !important;
61
- -webkit-background-size: 32px 32px !important;
62
- -moz-background-size: 32px 32px !important;
63
- background-size: 32px 32px !important;
64
- }
 
 
 
65
 
66
- #aioseop_settings_header #message {
67
- background-image: url(../images/update64.png) !important;
68
- -webkit-background-size: 32px 32px !important;
69
- -moz-background-size: 32px 32px !important;
70
- background-size: 32px 32px !important;
71
- }
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image {
2
+ background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important;
3
+ }
4
+
5
+ #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image {
6
+ background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important;
7
+ }
8
+
9
+ #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image img {
10
+ display: none;
11
+ }
12
+
13
+ #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image img {
14
+ display: none;
15
+ }
16
+
17
+ #adminmenu #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image:before {
18
+ content: '';
19
+ }
20
+
21
+ #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image:before {
22
+ content: '' !important;
23
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
+ #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 {
26
+ background-position: 8px -26px !important;
27
+ }
 
 
 
28
 
29
+ #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 {
30
+ background-position: 8px -26px !important;
31
+ }
 
 
 
32
 
33
+ #icon-aioseop.icon32 {
34
+ background: url(../images/shield32.png) no-repeat left top !important;
35
+ }
 
 
 
36
 
37
+ #aioseop_settings_header #message {
38
+ padding: 5px 0px 5px 50px;
39
+ background-image: url(../images/update32.png);
40
+ background-repeat: no-repeat;
41
+ background-position: 10px;
42
+ font-size: 14px;
43
+ min-height: 32px;
44
+ clear: none;
45
+ }
46
 
47
+ @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) {
48
+
49
+ #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image {
50
+ background-image: url('../images/shield-sprite-32.png') !important;
51
+ -webkit-background-size: 16px 48px !important;
52
+ -moz-background-size: 16px 48px !important;
53
+ background-size: 16px 48px !important;
54
+ }
55
+
56
+ #toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image {
57
+ background-image: url('../images/shield-sprite-32.png') !important;
58
+ -webkit-background-size: 16px 48px !important;
59
+ -moz-background-size: 16px 48px !important;
60
+ background-size: 16px 48px !important;
61
+ }
62
+
63
+ #icon-aioseop.icon32 {
64
+ background-image: url('../images/shield64.png') !important;
65
+ -webkit-background-size: 32px 32px !important;
66
+ -moz-background-size: 32px 32px !important;
67
+ background-size: 32px 32px !important;
68
+ }
69
+
70
+ #aioseop_settings_header #message {
71
+ background-image: url(../images/update64.png) !important;
72
+ -webkit-background-size: 32px 32px !important;
73
+ -moz-background-size: 32px 32px !important;
74
+ background-size: 32px 32px !important;
75
+ }
76
+ }
css/modules/aioseop_module-rtl.css CHANGED
@@ -1,232 +1,246 @@
1
  * {
2
- direction: rtl !important
3
  }
4
 
5
  .form-table.aioseop {
6
- clear: none
7
  }
8
 
9
  .form-table.aioseop th {
10
- padding: 10px 9px 12px 0;
11
- direction: rtl
12
  }
13
 
14
  .aioseop_help_text_link,
15
  .aioseop_help_text_link:active {
16
- text-align: right;
17
- float: right
18
  }
19
 
20
  .aioseop_help_text_link span {
21
- left: -60px;
22
  }
23
 
24
  .aioseop_meta_box_help > label {
25
- margin-left: 0;
26
- margin-right: 8px
27
  }
28
 
29
  .aioseop_help_text_link img {
30
- float: left
31
  }
32
 
33
  .aioseop_meta_box_help,
34
  .aioseop_meta_box_help:active {
35
- float: left;
36
- padding-left: 0;
37
- margin-right: 0;
38
- margin-left: 64px
39
  }
40
 
41
  .aioseop_label {
42
- padding-left: 0;
43
- padding-right: 20px;
44
- text-align: right;
45
- direction: rtl
46
  }
47
 
48
  .aioseop input[type="text"] {
49
- padding: 2px 10px 2px 0
50
  }
51
 
52
  .aioseop textarea {
53
- padding: 10px 10px 0 0
54
  }
55
 
56
  .aioseop_help_text_div {
57
- text-align: right;
58
- margin: 8px 0 10px 0
59
  }
60
 
61
  .aioseop_help_text {
62
- float: right;
63
- clear: right
64
  }
65
 
66
  .aioseop_head_nav {
67
- float: right
68
  }
69
 
70
  .aioseop_head_nav_tab {
71
- margin: 0 15px 0 0;
72
- float: right
73
  }
74
 
75
  .aioseop_head_nav_tab:first-child {
76
- margin-right: 0
77
  }
78
 
79
  .aioseop_header {
80
- float: right;
81
- clear: right
82
  }
83
 
84
  .aioseop_nopad {
85
- padding-right: 0
86
  }
87
 
88
  .aioseop_adverts {
89
- float: left
90
  }
91
 
92
  .aioseop_content {
93
- clear: right
94
  }
95
 
96
  #aiosp_feature_manager_metabox.postbox {
97
- float: right
98
  }
99
 
100
  .aioseop_sidebar {
101
- margin-left: 0;
102
- margin-right: 10px
103
  }
104
 
105
  .aioseop_option_label {
106
- float: right !important;
107
- clear: right !important;
108
  }
109
 
110
  .aioseop_settings_left {
111
- float: right;
112
  }
113
 
114
  .aioseop_option_input {
115
- float: left; /*clear: right !important;*/
116
- padding-left: 0;
117
- padding-right: 1px;
118
- margin-bottom: 20px;
119
- width: 60%;
120
- min-width: 160px;
121
  }
122
 
123
  .aioseop_top {
124
- margin: 10px 0 0 10px
125
  }
126
 
127
  .aioseop_right_sidebar {
128
- float: left
129
  }
130
 
131
  div.aioseop_feature {
132
- float: right
133
  }
134
 
135
- .aioseop_feature .feature_button {
136
  float: left;
137
  margin-right: 0;
138
- margin-left: 10px
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
 
141
  .aioseop_follow_button {
142
- margin-right: 0;
143
- margin-left: 5px
144
  }
145
 
146
  .aioseop_wrapper {
147
- padding-left: 0;
148
- padding-right: 5px;
149
- direction: rtl
150
  }
151
 
152
  .aioseop_input {
153
- clear: left
154
  }
155
 
156
  #aiosp div.preview_snippet {
157
- padding: 15px 7px 20px 15px
158
  }
159
 
160
  #aiosp_sitemap_addl_pages,
161
  #aiosp_video_sitemap_addl_pages {
162
- clear: right;
163
- margin-left: 0px;
164
- margin-right: 20px
165
  }
166
 
167
  .All_in_One_SEO_Pack_Opengraph table.aioseop_table {
168
- border-left: 0 solid #dfdfdf;
169
- border-right: 1px solid #dfdfdf
170
  }
171
 
172
  .All_in_One_SEO_Pack_Opengraph table.aioseop_table th {
173
- border-right: 0 solid #dfdfdf;
174
- border-left: 1px solid #dfdfdf
175
  }
176
 
177
  .All_in_One_SEO_Pack_Opengraph table.aioseop_table td {
178
- border-right: 0 solid #dfdfdf;
179
- border-left: 1px solid #dfdfdf
180
  }
181
 
182
  #aiosp_sitemap_addl_pages_metabox table.aioseop_table td,
183
  #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td {
184
- padding-left: 0;
185
- padding-right: 5%
186
  }
187
 
188
  .aioseop_settings_left .postbox {
189
- float: right
190
  }
191
 
192
  .aioseop_option_setting_label {
193
- padding-left: 0;
194
- padding-right: 1px
195
  }
196
 
197
  .aioseop_settings_left .postbox .inside {
198
- clear: left
199
  }
200
 
201
- .postbox h2 .Taha {
202
- float: left !important;
203
  }
204
 
205
  #aiosp_settings_form .aioseop_no_label,
206
  .aioseop_no_label {
207
- float: right;
208
- margin: 0 13px 0 23px
209
  }
210
 
211
  .aioseop_module.error.below-h2 {
212
- margin: 0 0 15px 477px !important
213
  }
214
 
215
  .robots img {
216
- margin: 0 2px 0 0
217
  }
218
 
219
  /* Robots.txt styling */
220
  #aiosp_robots_generator_robotgen_wrapper .aioseop_option_div,
221
  #aiosp_robots_generator_robothtml_wrapper .aioseop_option_div {
222
- margin-top: 10px;
223
  }
224
 
225
  div.aioseop_notice a.aioseop_dismiss_link {
226
- position: absolute;
227
- top: 10px;
228
- left: 10px;
229
- text-align: left;
230
  }
231
 
232
  /*
@@ -237,65 +251,65 @@ div.aioseop_notice a.aioseop_dismiss_link {
237
 
238
  }*/
239
  .aioseop_help_text ul {
240
- margin: 15px 20px 0 0
241
  }
242
 
243
  .aioseop_header_tabs li a.aioseop_header_tab {
244
- margin: 5px 0 0 5px
245
  }
246
 
247
  .aioseop_header_tabs li:first-child a.aioseop_header_tab {
248
- border-left: solid 0 #CCC;
249
- border-right: solid 1px #CCC;
250
- margin-left: 0;
251
- margin-right: 5px
252
  }
253
 
254
  .aioseop_tab {
255
- padding-left: 0;
256
- padding-right: 5px
257
  }
258
 
259
  form#aiosp_settings_form,
260
  .aioseop_tabs_div {
261
- padding-right: 0;
262
- padding-left: 477px
263
  }
264
 
265
  #aiosp_settings_form ul.sfwd_debug_settings li strong {
266
- float: right;
267
- text-align: left;
268
- margin-right: 0;
269
- margin-left: 8px;
270
- padding-right: 0;
271
- padding-left: 8px
272
  }
273
 
274
  #aiosp_settings_form ul.sfwd_debug_settings li {
275
- clear: right
276
  }
277
 
278
  .aioseop_advert {
279
- direction: rtl;
280
- float: right;
281
- z-index: 999999
282
  }
283
 
284
  .aioseop_advert form input {
285
- float: left
286
  }
287
 
288
  .MRL {
289
- margin-left: 0 !important;
290
- margin-right: 20px !important;
291
  }
292
 
293
  .aioseop_upload_image_label {
294
- clear: right !important;
295
- float: none !important;
296
  }
297
 
298
  .aioseop_upload_image_button {
299
- float: right !important;
300
- margin-bottom: 5px !important;
301
- }
1
  * {
2
+ direction: rtl !important
3
  }
4
 
5
  .form-table.aioseop {
6
+ clear: none
7
  }
8
 
9
  .form-table.aioseop th {
10
+ padding: 10px 9px 12px 0;
11
+ direction: rtl
12
  }
13
 
14
  .aioseop_help_text_link,
15
  .aioseop_help_text_link:active {
16
+ text-align: right;
17
+ float: right
18
  }
19
 
20
  .aioseop_help_text_link span {
21
+ left: -60px;
22
  }
23
 
24
  .aioseop_meta_box_help > label {
25
+ margin-left: 0;
26
+ margin-right: 8px
27
  }
28
 
29
  .aioseop_help_text_link img {
30
+ float: left
31
  }
32
 
33
  .aioseop_meta_box_help,
34
  .aioseop_meta_box_help:active {
35
+ float: left;
36
+ padding-left: 0;
37
+ margin-right: 0;
38
+ margin-left: 64px
39
  }
40
 
41
  .aioseop_label {
42
+ padding-left: 0;
43
+ padding-right: 20px;
44
+ text-align: right;
45
+ direction: rtl
46
  }
47
 
48
  .aioseop input[type="text"] {
49
+ padding: 2px 10px 2px 0
50
  }
51
 
52
  .aioseop textarea {
53
+ padding: 10px 10px 0 0
54
  }
55
 
56
  .aioseop_help_text_div {
57
+ text-align: right;
58
+ margin: 8px 0 10px 0
59
  }
60
 
61
  .aioseop_help_text {
62
+ float: right;
63
+ clear: right
64
  }
65
 
66
  .aioseop_head_nav {
67
+ float: right
68
  }
69
 
70
  .aioseop_head_nav_tab {
71
+ margin: 0 15px 0 0;
72
+ float: right
73
  }
74
 
75
  .aioseop_head_nav_tab:first-child {
76
+ margin-right: 0
77
  }
78
 
79
  .aioseop_header {
80
+ float: right;
81
+ clear: right
82
  }
83
 
84
  .aioseop_nopad {
85
+ padding-right: 0
86
  }
87
 
88
  .aioseop_adverts {
89
+ float: left
90
  }
91
 
92
  .aioseop_content {
93
+ clear: right
94
  }
95
 
96
  #aiosp_feature_manager_metabox.postbox {
97
+ float: right
98
  }
99
 
100
  .aioseop_sidebar {
101
+ margin-left: 0;
102
+ margin-right: 10px
103
  }
104
 
105
  .aioseop_option_label {
106
+ float: right !important;
107
+ clear: right !important;
108
  }
109
 
110
  .aioseop_settings_left {
111
+ float: right;
112
  }
113
 
114
  .aioseop_option_input {
115
+ float: left; /*clear: right !important;*/
116
+ padding-left: 0;
117
+ padding-right: 1px;
118
+ margin-bottom: 20px;
119
+ width: 60%;
120
+ min-width: 160px;
121
  }
122
 
123
  .aioseop_top {
124
+ margin: 10px 0 0 10px
125
  }
126
 
127
  .aioseop_right_sidebar {
128
+ float: left
129
  }
130
 
131
  div.aioseop_feature {
132
+ float: right
133
  }
134
 
135
+ .aioseop_feature #free-flag {
136
  float: left;
137
  margin-right: 0;
138
+ background: none repeat scroll 0 0 #D23D46;
139
+ color: #FFFFFF;
140
+ padding: 5px 12px;
141
+ position: relative;
142
+ }
143
+
144
+ .aioseop_feature #free-flag:before,
145
+ .aioseop_feature #free-flag:after {
146
+ display: none;
147
+ }
148
+
149
+ .aioseop_feature .feature_button {
150
+ float: left;
151
+ margin-right: 0;
152
+ margin-left: 10px
153
  }
154
 
155
  .aioseop_follow_button {
156
+ margin-right: 0;
157
+ margin-left: 5px
158
  }
159
 
160
  .aioseop_wrapper {
161
+ padding-left: 0;
162
+ padding-right: 5px;
163
+ direction: rtl
164
  }
165
 
166
  .aioseop_input {
167
+ clear: left
168
  }
169
 
170
  #aiosp div.preview_snippet {
171
+ padding: 15px 7px 20px 15px
172
  }
173
 
174
  #aiosp_sitemap_addl_pages,
175
  #aiosp_video_sitemap_addl_pages {
176
+ clear: right;
177
+ margin-left: 0;
178
+ margin-right: 20px
179
  }
180
 
181
  .All_in_One_SEO_Pack_Opengraph table.aioseop_table {
182
+ border-left: 0 solid #dfdfdf;
183
+ border-right: 1px solid #dfdfdf
184
  }
185
 
186
  .All_in_One_SEO_Pack_Opengraph table.aioseop_table th {
187
+ border-right: 0 solid #dfdfdf;
188
+ border-left: 1px solid #dfdfdf
189
  }
190
 
191
  .All_in_One_SEO_Pack_Opengraph table.aioseop_table td {
192
+ border-right: 0 solid #dfdfdf;
193
+ border-left: 1px solid #dfdfdf
194
  }
195
 
196
  #aiosp_sitemap_addl_pages_metabox table.aioseop_table td,
197
  #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td {
198
+ padding-left: 0;
199
+ padding-right: 5%
200
  }
201
 
202
  .aioseop_settings_left .postbox {
203
+ float: right
204
  }
205
 
206
  .aioseop_option_setting_label {
207
+ padding-left: 0;
208
+ padding-right: 1px
209
  }
210
 
211
  .aioseop_settings_left .postbox .inside {
212
+ clear: left
213
  }
214
 
215
+ .postbox h2 .Taha {
216
+ float: left !important;
217
  }
218
 
219
  #aiosp_settings_form .aioseop_no_label,
220
  .aioseop_no_label {
221
+ float: right;
222
+ margin: 0 13px 0 23px
223
  }
224
 
225
  .aioseop_module.error.below-h2 {
226
+ margin: 0 0 15px 477px !important
227
  }
228
 
229
  .robots img {
230
+ margin: 0 2px 0 0
231
  }
232
 
233
  /* Robots.txt styling */
234
  #aiosp_robots_generator_robotgen_wrapper .aioseop_option_div,
235
  #aiosp_robots_generator_robothtml_wrapper .aioseop_option_div {
236
+ margin-top: 10px;
237
  }
238
 
239
  div.aioseop_notice a.aioseop_dismiss_link {
240
+ position: absolute;
241
+ top: 10px;
242
+ left: 10px;
243
+ text-align: left;
244
  }
245
 
246
  /*
251
 
252
  }*/
253
  .aioseop_help_text ul {
254
+ margin: 15px 20px 0 0
255
  }
256
 
257
  .aioseop_header_tabs li a.aioseop_header_tab {
258
+ margin: 5px 0 0 5px
259
  }
260
 
261
  .aioseop_header_tabs li:first-child a.aioseop_header_tab {
262
+ border-left: solid 0 #CCC;
263
+ border-right: solid 1px #CCC;
264
+ margin-left: 0;
265
+ margin-right: 5px
266
  }
267
 
268
  .aioseop_tab {
269
+ padding-left: 0;
270
+ padding-right: 5px
271
  }
272
 
273
  form#aiosp_settings_form,
274
  .aioseop_tabs_div {
275
+ padding-right: 0;
276
+ padding-left: 477px
277
  }
278
 
279
  #aiosp_settings_form ul.sfwd_debug_settings li strong {
280
+ float: right;
281
+ text-align: left;
282
+ margin-right: 0;
283
+ margin-left: 8px;
284
+ padding-right: 0;
285
+ padding-left: 8px
286
  }
287
 
288
  #aiosp_settings_form ul.sfwd_debug_settings li {
289
+ clear: right
290
  }
291
 
292
  .aioseop_advert {
293
+ direction: rtl;
294
+ float: right;
295
+ z-index: 999999
296
  }
297
 
298
  .aioseop_advert form input {
299
+ float: left
300
  }
301
 
302
  .MRL {
303
+ margin-left: 0 !important;
304
+ margin-right: 20px !important;
305
  }
306
 
307
  .aioseop_upload_image_label {
308
+ clear: right !important;
309
+ float: none !important;
310
  }
311
 
312
  .aioseop_upload_image_button {
313
+ float: right !important;
314
+ margin-bottom: 5px !important;
315
+ }
css/modules/aioseop_module.css CHANGED
@@ -1,1120 +1,1309 @@
1
- .form-table.aioseop {
2
- clear: none;
3
- }
4
- .form-table.aioseop td {
5
- vertical-align: top;
6
- padding: 16px 0 10px 0;
7
- line-height: 20px;
8
- font-size: 12px;
9
- }
10
- .form-table.aioseop th {
11
- width: 200px;
12
- padding: 10px 0 12px 9px;
13
- }
14
- .aioseop_help_text_link, .aioseop_help_text_link:active {
15
- text-align: left;
16
- float: left;
17
- max-width: 300px;
18
- min-width: 1px;
19
- padding-top: 2px;
20
- outline: none;
21
- color: #888;
22
- border: 2px solid #888;
23
- border-radius: 33px;
24
- width: 22px;
25
- height: 20px;
26
- display: inline-block;
27
- font-family: sans-serif;
28
- }
29
- .aioseop_help_text_link span {
30
- position: absolute;
31
- left: 21px;
32
- font-size: 14px;
33
- }
34
- .aioseop_help_text_link:before {
35
- content: '\a0?';
36
- color: #888;
37
- font-size: 19px;
38
- }
39
-
40
- #aioseop-support .aioseop_metabox_text, #aioseop-support a {
41
- font-size: 14px;
42
- color: #000;
43
- text-decoration: none;
44
- }
45
-
46
- .aioseop_icon {
47
- display: inline-block;
48
- width: 40px;
49
- height: 40px;
50
- background-repeat: no-repeat;
51
- background-size: 100%;
52
- vertical-align: middle;
53
- margin: 10px;
54
- }
55
-
56
- .aioseop_book_icon {
57
- background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==);
58
- }
59
-
60
- .aioseop_cog_icon {
61
- 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=);
62
- }
63
-
64
- .aioseop_file_icon {
65
- background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==);
66
- }
67
-
68
- .aioseop_help_icon {
69
- 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);
70
- }
71
-
72
- .aioseop_support_icon {
73
- 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);
74
- }
75
-
76
- .aioseop_youtube_icon {
77
- 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==);
78
- }
79
-
80
- .aioseop_help_text_link.aioseop_meta_box_help:before {
81
- font-size: 14px;
82
- }
83
- .aioseop_meta_box_help > label {
84
- position: absolute;
85
- margin-left: 8px;
86
- }
87
- div.aioseop_tip_icon {
88
- font-size: 14px;
89
- border: 1px solid #888;
90
- width: 1em;
91
- text-align: center;
92
- padding: 0px 4px;
93
- -webkit-border-radius: 12px;
94
- -moz-border-radius: 12px;
95
- -webkit-box-shadow: 1px 1px 1px #888;
96
- -moz-box-shadow: 1px 1px 1px #888;
97
- box-shadow: 1px 1px 1px #888;
98
- border-radius: 12px;
99
- }
100
- div.aioseop_tip_icon:before {
101
- content: '?';
102
- }
103
- .aioseop_help_text_link img {
104
- width: 40px;
105
- float: left;
106
- }
107
- .aioseop_meta_box_help, .aioseop_meta_box_help:active {
108
- float: right;
109
- padding-left: 0px;
110
- width: 16px;
111
- margin-right: 32px;
112
- text-decoration: none;
113
- height: 15px;
114
- padding-top: 1px;
115
- position: relative;
116
- }
117
- .aioseop_label {
118
- color: #5F5F5F;
119
- font-weight: bold;
120
- line-height: 19px;
121
- padding-left: 10px; /*changed from 20px to 10px for certain language support*/
122
- display: inline-block;
123
- text-align: left;
124
- position: absolute;
125
- font-family: 'Open Sans', sans-serif;
126
- width: 26%;
127
- min-width: 120px;
128
- max-width: 230px;
129
- }
130
- .aioseop_option_div {
131
- max-height: 160px;
132
- min-height: 43px;
133
- width: 95%;
134
- overflow-y: auto;
135
- }
136
- .aioseop_overflowed {
137
- border: 1px solid #e1e1e1;
138
- }
139
- .aioseop input[type="text"] {
140
- color: #515151;
141
- height: 35px;
142
- padding: 10px 0px 10px 10px;
143
- font-size: 14px;
144
- width: 95%;
145
- max-width: 600px;
146
- }
147
- .aioseop textarea {
148
- color: #515151;
149
- padding: 10px 0px 0px 10px;
150
- margin: 0px;
151
- font-size: 14px;
152
- line-height: 25px;
153
- width: 95%;
154
- max-width: 600px;
155
- }
156
- .aioseop_help_text_div {
157
- text-align:left;
158
- width:100%;
159
- margin: 10px 0px 10px 0px;
160
- }
161
- .aioseop_help_text {
162
- font-size: 12px;
163
- float: left;
164
- clear: left;
165
- color: #797979;
166
- line-height: 15px;
167
- font-style: italic;
168
- }
169
- .aioseop_head_tagline {
170
- color: #5F5F5F;
171
- font-size: 13px;
172
- }
173
-
174
- .aioseop_head_nav {
175
- float: left;
176
- font-size: 18px;
177
- margin: 0px 0 16px 0;
178
- font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;
179
- border-bottom: 1px solid #CCC;
180
- width: 100%;
181
- }
182
- .aioseop_head_nav_tab {
183
- padding: 10px 15px 10px 15px;
184
- margin: 0 0 0 15px;
185
- border-width: 1px 1px 0;
186
- border-radius: 4px 4px 0px 0;
187
- border-style: solid;
188
- border-color: #CCC #CCC white;
189
- float: left;
190
- opacity: 0.5;
191
- color: black;
192
- text-shadow: white 0 1px 0;
193
- text-decoration: none;
194
- }
195
- .aioseop_head_nav_tab.aioseop_head_nav_active {
196
- opacity: 1;
197
- margin-bottom: -1px;
198
- border-width: 1px;
199
- }
200
- .aioseop_head_nav_tab:first-child {
201
- margin-left: 0px;
202
- }
203
- .aioseop_head_nav_tab:hover {
204
- opacity:1;
205
- }
206
- .aioseop_header {
207
- float: left;
208
- clear: left;
209
- }
210
-
211
- .aioseop_advert {
212
- padding: 10px;
213
- margin-bottom: 30px;
214
- border: 1px solid #DDD;
215
- height: 200px;
216
- width: 423px;
217
- }
218
-
219
- .headwaythemes {
220
- background-color: #FFFFFF;
221
- padding-bottom: 110px;
222
- height: 125px;
223
- }
224
-
225
- .aioseop_nopad {
226
- padding-left: 0px;
227
- padding-top: 0px;
228
- }
229
-
230
- .aioseop_nopad_all {
231
- padding: 0px;
232
- height: 220px;
233
- width: 445px;
234
- margin-bottom: 20px;
235
- border: none;
236
- }
237
-
238
- .aioseop_adverts {
239
- float: right;
240
- }
241
-
242
- .wincherad {
243
- width: 100%;
244
- height: 100%;
245
- background-size: 100%;
246
- background-repeat: no-repeat;
247
- margin-bottom: 0px;
248
- border: none;
249
- }
250
- /*
251
- #wincher11 {
252
- background-image: url(images/banner11.png);
253
- }
254
- #wincher12 {
255
- background-image: url(images/banner12.png);
256
- }
257
- #wincher13 {
258
- background-image: url(images/banner13.png);
259
- }
260
- #wincher14 {
261
- background-image: url(images/banner14.png);
262
- }
263
- #wincher15 {
264
- background-image: url(images/banner15.png);
265
- }
266
- */
267
- #wincher21 {
268
- background-image: url(../../modules/images/banner21.jpg);
269
- }
270
- #wincher22 {
271
- background-image: url(../../modules/images/banner22.jpg);
272
- }
273
- .aioseop_content {
274
- min-width: 760px;
275
- clear: left;
276
- }
277
- .aioseop_options_wrapper {
278
- }
279
- .aioseop_options_wrapper .hndle {
280
- font-size: 15px;
281
- font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
282
- font-weight: normal;
283
- padding: 7px 10px;
284
- margin: 0;
285
- line-height: 1;
286
- }
287
- .aioseop_options_wrapper .submit input.button-primary {
288
- margin-bottom: 5px;
289
- }
290
- #aiosp_feature_manager_metabox.postbox {
291
- margin-top: 20px;
292
- float: left;
293
- }
294
- .aioseop_advert p {
295
- margin: 25px 0 25px 0;
296
- }
297
- /*
298
- .widget, #widget-list .widget-top, .postbox, #titlediv, .aioseop_options_wrapper .postarea, .stuffbox {
299
- border-color: #DFDFDF;
300
- -moz-box-shadow: inset 0 1px 0 #fff;
301
- -webkit-box-shadow: inset 0 1px 0 #fff;
302
- box-shadow: inset 0 1px 0 #fff;
303
- -moz-border-radius: 3px;
304
- -khtml-border-radius: 3px;
305
- -webkit-border-radius: 3px;
306
- border-radius: 3px;
307
- }
308
- */
309
- .aioseop_options_wrapper .postarea {
310
- border-color: #DFDFDF;
311
- -moz-box-shadow: inset 0 1px 0 #fff;
312
- -webkit-box-shadow: inset 0 1px 0 #fff;
313
- box-shadow: inset 0 1px 0 #fff;
314
- -moz-border-radius: 3px;
315
- -khtml-border-radius: 3px;
316
- -webkit-border-radius: 3px;
317
- border-radius: 3px;
318
- }
319
- .aioseop_advert h3 {
320
- padding: 0;
321
- margin-top: 6px;
322
- }
323
- .aioseop_metabox_text p {
324
- margin: 0 0 0px 0;
325
- width: 101%;
326
- }
327
- .aioseop_sidebar {
328
- width: 457px;
329
- margin-left: 10px;
330
- }
331
- .aioseop_metabox_text {
332
- margin-bottom: 0px;
333
- }
334
- .aioseop_metabox_wrapper {
335
- padding: 0px;
336
- }
337
- .aioseop_metabox_text *:last-child {
338
- margin: 0;
339
- }
340
- .aioseop_metabox_feature {
341
- margin-top: 20px;
342
- }
343
-
344
- .aioseop_metabox_feature img {
345
- }
346
-
347
- .aioseop_option_label {
348
- float: left;
349
- margin: 0px;
350
- min-width: 150px;
351
- width: 37%;
352
- max-width: 270px;
353
- padding-top: 3px;
354
- padding-bottom: 3px;
355
- height:67px !important; /*added for certain language support*/
356
- }
357
- .aioseop_metabox_text h2 {
358
- font-size: 14px;
359
- padding: 0px;
360
- font-weight: bold;
361
- line-height: 29px;
362
- }
363
- #aioseop-about {
364
- width: 443px;
365
- margin-bottom: 20px;
366
- }
367
- #aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 {
368
- font-size: 13px;
369
- }
370
- .aioseop_sidebar #mc-embedded-subscribe-form {
371
- margin: 0 0 10px 0;
372
- background: white;
373
- padding: 10px 10px;
374
- border: 1px solid #DDD;
375
- }
376
- .aioseop input[readonly] {
377
- background-color: #EEE;
378
- margin: 5px 0 5px 0 !important;
379
- }
380
- /*
381
- .aioseop input[type="button"] {
382
- border-radius: 5px;
383
- font-size: 15px;
384
- }
385
- */
386
- .aioseop_settings_left {
387
- float: left;
388
- padding: 0px;
389
- margin: 0px;
390
- width: 100%;
391
- }
392
-
393
- body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left {
394
- margin-top: 20px;
395
- }
396
-
397
- body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left {
398
- margin-top: 20px;
399
- }
400
-
401
- #aioseop_top_button {
402
- margin-top: 5px;
403
- height: 30px;
404
- }
405
-
406
- #aioseop-list #mce-EMAIL {
407
- margin-top: 5px;
408
- width: 250px;
409
- }
410
-
411
- .aioseop_top {
412
- margin: 10px 10px 0px 0px;
413
- /* margin: 10px 477px 0px 0px; */
414
- }
415
-
416
- .aioseop_top #aioseop-list {
417
- margin-bottom: 0px;
418
- }
419
-
420
- .aioseop_right_sidebar {
421
- float: right;
422
- margin-top: 35px;
423
- }
424
- /*
425
- #wpbody-content {
426
- min-width: 1180px;
427
- }
428
- */
429
- #aiosp_settings_form .button-primary.hidden {
430
- display: none;
431
- }
432
- form#edittag div#aiosp_titleatr_wrapper, form#edittag div#aiosp_menulabel_wrapper, form#edittag div#aiosp_sitemap_exclude_wrapper {
433
- display: none;
434
- }
435
- .All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button {
436
- height: 5px;
437
- }
438
- .All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper {
439
- margin-top: 10px;
440
- }
441
- div#aiosp_feature_manager_metabox .inside {
442
- padding: 8px;
443
- }
444
- div.aioseop_feature {
445
- position: relative;
446
- display: inline-block;
447
- float: left;
448
- vertical-align: top;
449
- width: 240px;
450
- height: 288px;
451
- margin: 8px;
452
- border: 1px solid #DEDEDE;
453
- -moz-border-radius: 3px;
454
- -webkit-border-radius: 3px;
455
- border-radius: 3px;
456
- background: white;
457
- padding: 10px 0px 0px;
458
- -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 );
459
- -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 );
460
- 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 );
461
- -webkit-transition-duration: .4s;
462
- -moz-transition-duration: .4s;
463
- }
464
- .aioseop_feature h3 {
465
- font-size: 17px;
466
- margin: 0;
467
- padding: 0px 10px 5px 10px;
468
- font-weight: normal;
469
- font-style: normal;
470
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
471
- }
472
- .aioseop_feature p {
473
- line-height: 150%;
474
- font-size: 12px;
475
- font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
476
- margin-bottom: 20px;
477
- color: #666;
478
- padding: 0px 10px;
479
- }
480
- .aioseop_feature p.aioseop_desc {
481
- min-height: 80px;
482
- }
483
- .aioseop_feature .feature_button {
484
- float: right;
485
- margin-bottom: 10px;
486
- margin-right: 10px;
487
- min-width: 80px;
488
- text-align: center;
489
- }
490
- .aioseop_feature .feature_button:before {
491
- content: "Activate";
492
- }
493
- .aioseop_feature .active.feature_button:before {
494
- content: "Deactivate";
495
- }
496
- div.aioseop_feature .aioseop_featured_image {
497
- min-height: 100px;
498
- background-repeat: no-repeat;
499
- display: block;
500
- margin: 0 auto;
501
- width: 133px;
502
- }
503
- div.aioseop_feature .aioseop_featured_image {
504
- background-image: url(../../modules/images/Default-BW-Standard.png);
505
- }
506
- div.aioseop_feature .aioseop_featured_image.active {
507
- background-image: url(../../modules/images/Default-Color-Standard.png);
508
- }
509
- div.aioseop_feature#aioseop_sitemap .aioseop_featured_image {
510
- background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png);
511
- }
512
- div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active {
513
- background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png);
514
- }
515
- div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image {
516
- background-image: url(../../modules/images/VideoSitemap-BW-Standard.png);
517
- }
518
- div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active {
519
- background-image: url(../../modules/images/VideoSitemap-Color-Standard.png);
520
- }
521
- div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
522
- background-image: url(../../modules/images/SocialMeta-BW-Standard.png);
523
- }
524
- div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
525
- background-image: url(../../modules/images/SocialMeta-Color-Standard.png);
526
- }
527
- div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image {
528
- background-image: url(../../modules/images/Robots-BW-Standard.png);
529
- }
530
- div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active {
531
- background-image: url(../../modules/images/Robots-Color-Standard.png);
532
- }
533
- div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
534
- background-image: url(../../modules/images/FileEditor-BW-Standard.png);
535
- }
536
- div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
537
- background-image: url(../../modules/images/FileEditor-Color-Standard.png);
538
- }
539
- div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
540
- background-image: url(../../modules/images/ImporterExporter-BW-Standard.png);
541
- }
542
- div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
543
- background-image: url(../../modules/images/ImporterExporter-Color-Standard.png);
544
- }
545
- div.aioseop_feature#aioseop_performance .aioseop_featured_image {
546
- background-image: url(../../modules/images/Performance-BW-Standard.png);
547
- }
548
- div.aioseop_feature#aioseop_performance .aioseop_featured_image.active {
549
- background-image: url(../../modules/images/Performance-Color-Standard.png);
550
- }
551
- div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
552
- background-image: url(../../modules/images/Default-Color-Standard.png);
553
- }
554
- div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
555
- background-image: url(../../modules/images/Default-Color-Standard.png);
556
- }
557
- .All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table,
558
- .All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table {
559
- max-width: 500px;
560
- clear: none;
561
- }
562
- .aioseop_follow_button {
563
- min-height: 50px;
564
- background-repeat: no-repeat;
565
- display: inline-block;
566
- width: 100px;
567
- background-size: auto 50px !important;
568
- margin-right: 0px;
569
- }
570
- .aioseop_facebook_follow {
571
- background-image: url(../../modules/images/facebook-follow-standard.png);
572
- }
573
- .aioseop_twitter_follow {
574
- background-image: url(../../modules/images/twitter-follow-standard.png);
575
- }
576
- @media
577
- only screen and (-webkit-min-device-pixel-ratio: 1.5),
578
- only screen and ( min--moz-device-pixel-ratio: 1.5),
579
- only screen and ( -o-min-device-pixel-ratio: 3/2),
580
- only screen and ( min-device-pixel-ratio: 1.5),
581
- only screen and ( min-resolution: 1.5dppx) {
582
- div.aioseop_feature .aioseop_featured_image {
583
- background-size: auto 100px !important;
584
- }
585
- div.aioseop_feature .aioseop_featured_image.active {
586
- background-image: url(../../modules/images/Default-Color-Retina.png);
587
- }
588
- div.aioseop_feature .aioseop_featured_image {
589
- background-image: url(../../modules/images/Default-BW-Retina.png);
590
- }
591
- div.aioseop_feature#aioseop_sitemap .aioseop_featured_image {
592
- background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png);
593
- }
594
- div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active {
595
- background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png);
596
- }
597
- div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image {
598
- background-image: url(../../modules/images/VideoSitemap-BW-Retina.png);
599
- }
600
- div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active {
601
- background-image: url(../../modules/images/VideoSitemap-Color-Retina.png);
602
- }
603
- div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
604
- background-image: url(../../modules/images/SocialMeta-BW-Retina.png);
605
- }
606
- div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
607
- background-image: url(../../modules/images/SocialMeta-Color-Retina.png);
608
- }
609
- div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image {
610
- background-image: url(../../modules/images/Robots-BW-Retina.png);
611
- }
612
- div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active {
613
- background-image: url(../../modules/images/Robots-Color-Retina.png);
614
- }
615
- div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
616
- background-image: url(../../modules/images/FileEditor-BW-Retina.png);
617
- }
618
- div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
619
- background-image: url(../../modules/images/FileEditor-Color-Retina.png);
620
- }
621
- div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
622
- background-image: url(../../modules/images/ImporterExporter-BW-Retina.png);
623
- }
624
- div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
625
- background-image: url(../../modules/images/ImporterExporter-Color-Retina.png);
626
- }
627
- div.aioseop_feature#aioseop_performance .aioseop_featured_image {
628
- background-image: url(../../modules/images/Performance-BW-Retina.png);
629
- }
630
- div.aioseop_feature#aioseop_performance .aioseop_featured_image.active {
631
- background-image: url(../../modules/images/Performance-Color-Retina.png);
632
- }
633
- div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
634
- background-image: url(../../modules/images/Default-BW-Retina.png);
635
- }
636
- div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
637
- background-image: url(../../modules/images/Default-BW-Retina.png);
638
- }
639
- .aioseop_facebook_follow {
640
- background-image: url(../../modules/images/facebook-follow-retina.png);
641
- }
642
- .aioseop_twitter_follow {
643
- background-image: url(../../modules/images/twitter-follow-retina.png);
644
- }
645
- }
646
-
647
- .aioseop_options {
648
- width: 100%;
649
- margin: 18px 0px 10px 0px;
650
- }
651
- .aioseop_wrapper {
652
- width: 100%;
653
- padding-left: 5px;
654
- }
655
- .aioseop_input {
656
- clear: left;
657
- width: 100%;
658
- padding: 5px;
659
- display: inline;
660
- }
661
- .aioseop_option_input {
662
- float: left;
663
- width: 61%;
664
- margin: 0;
665
- padding-left: 1px;
666
- min-width: 160px;
667
- /* max-width: 900px; */
668
- }
669
- #aiosp div.preview_snippet {
670
- border: 1px solid #ebebeb;
671
- padding: 15px 15px 20px 7px;
672
- background-color: #fff;
673
- }
674
- div#aioseop_snippet {
675
- font-family: arial, sans-serif;
676
- font-size: 13px;
677
- }
678
- div#aioseop_snippet > h3 {
679
- font-size: 16px;
680
- padding: 8px 0;
681
- border: 0px;
682
- background: inherit;
683
- }
684
- div#aioseop_snippet > h3 > a {
685
- color: #12c;
686
- text-decoration: none;
687
- cursor: pointer;
688
- }
689
- div#aioseop_snippet > div {
690
- color: #222;
691
- max-width: 42em;
692
- }
693
- div#aioseop_snippet > div > div {
694
- display: block;
695
- margin-bottom: 1px;
696
- }
697
- div#aioseop_snippet > div > div > cite {
698
- color: #093;
699
- font-style: normal;
700
- }
701
- div#aioseop_snippet > div > span {
702
- margin: 0px;
703
- padding: 0px;
704
- border: 0px;
705
- }
706
- #aiosp_sitemap_addl_pages,
707
- #aiosp_video_sitemap_addl_pages {
708
- clear: left;
709
- margin-left: 20px;
710
- max-width: 1072px;
711
- }
712
- #aiosp_sitemap_addl_pages_metabox .aioseop_wrapper,
713
- #aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper {
714
- width: 23%;
715
- min-width: 165px;
716
- display: inline-block;
717
- max-width: 265px;
718
- }
719
- #aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div,
720
- #aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div {
721
- position: absolute;
722
- margin: 5px 0px 10px 0px;
723
- }
724
- #aiosp_sitemap_addl_pages_metabox .aioseop_option_input,
725
- #aiosp_video_sitemap_addl_pages_metabox .aioseop_option_input {
726
- width: 94%;
727
- min-width: 94%;
728
- }
729
- #aiosp_sitemap_addl_pages_metabox table.aioseop_table,
730
- #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table {
731
- width: 96%;
732
- border: 1px solid #CCC;
733
- margin: 5px 0px 10px 0px;
734
- }
735
- table.aioseop_table tr:nth-child(odd) {
736
- background-color: #EEE;
737
- }
738
- .All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) {
739
- background-color: rgba( 238, 238, 238, 0.5 );
740
- }
741
- table.aioseop_table td {
742
- width: 23%;
743
- }
744
- .All_in_One_SEO_Pack_Opengraph table.aioseop_table {
745
- width: 80%;
746
- max-width: 800px;
747
- display: block;
748
- border-top: 1px solid #dfdfdf;
749
- border-left: 1px solid #dfdfdf;
750
- }
751
- .All_in_One_SEO_Pack_Opengraph table.aioseop_table th {
752
- width: 18%;
753
- border-right: 1px solid #dfdfdf;
754
- border-bottom: 1px solid #dfdfdf;
755
- }
756
- .All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info {
757
- margin-top:10px;
758
- border: 1px solid #dfdfdf;
759
- width:80%;
760
- max-width:800px;
761
- }
762
- .All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th {
763
- background: #f1f1f1;
764
- background-image: -webkit-gradient(linear,left bottom,left top,from(#ececec),to(#f9f9f9));
765
- background-image: -webkit-linear-gradient(bottom,#ececec,#f9f9f9);
766
- background-image: -moz-linear-gradient(bottom,#ececec,#f9f9f9);
767
- background-image: -o-linear-gradient(bottom,#ececec,#f9f9f9);
768
- background-image: linear-gradient(to top,#ececec,#f9f9f9);
769
- padding: 5px;
770
- border-bottom-color: #dfdfdf;
771
- text-shadow: #fff 0 1px 0;
772
- -webkit-box-shadow: 0 1px 0 #fff;
773
- -moz-box-shadow: 0 1px 0 #fff;
774
- box-shadow: 0 1px 0 #fff;
775
- }
776
- .All_in_One_SEO_Pack_Opengraph table.aioseop_table td {
777
- border-right: 1px solid #dfdfdf;
778
- border-bottom: 1px solid #dfdfdf;
779
- }
780
- #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item {
781
- display: inline-block;
782
- width: 30%;
783
- vertical-align: top;
784
- }
785
- #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) {
786
- font-weight: bold;
787
- }
788
- #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) {
789
- width: 70%;
790
- }
791
- #aiosp_sitemap_addl_pages_metabox table.aioseop_table td,
792
- #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td {
793
- width: 25%;
794
- padding-left: 5%;
795
- }
796
- table.aioseop_table td, table.aioseop_table th {
797
- padding: 3px;
798
- }
799
- .aioseop_top_label .aioseop_option_input,
800
- .aioseop_no_label .aioseop_option_input {
801
- width: 100%;
802
- }
803
-
804
- #aiosp_settings_form .postbox {
805
- margin: 0px 0px 20px 0px;
806
- }
807
-
808
- .aioseop_settings_left .postbox {
809
- float: left;
810
- width: 100%;
811
- }
812
- .aioseop_option_setting_label {
813
- min-height: 35px;
814
- display: inline-block;
815
- white-space: nowrap;
816
- overflow: hidden;
817
- padding-left: 1px;
818
- max-width: 229px;
819
- min-width: 160px;
820
- width: 33%;
821
- }
822
- .aioseop_settings_left .postbox .inside {
823
- padding: 0;
824
- margin: 0;
825
- clear: right;
826
- }
827
- #aiosp_settings_form .aioseop_no_label, .aioseop_no_label {
828
- float: left;
829
- width: 92%;
830
- max-width: 100%;
831
- margin: 0px 23px 0px 13px;
832
- }
833
- .aioseop_top_label {
834
- width: 96%;
835
- margin: 0 10px;
836
- }
837
- .aioseop_hidden_type {
838
- margin: 0;
839
- padding: 0;
840
- height: 0;
841
- }
842
- .aioseop_module.error.below-h2 {
843
- padding: 5px 0px;
844
- margin: 0px 477px 15px 0px !important;
845
- }
846
- #aioseop_opengraph_settings .inside {
847
- margin: 0;
848
- padding: 0;
849
- }
850
- #aioseop_opengraph_settings_image_wrapper img {
851
- width: auto;
852
- height: 75px;
853
- }
854
- #aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label {
855
- max-width: 160px;
856
- min-width: 100px;
857
- width: 30%;
858
- }
859
- .aioseop_input input[type="checkbox"],
860
- .aioseop_input input[type="radio"] {
861
- vertical-align: text-bottom;
862
- margin-top: 8px;
863
- }
864
- #aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div {
865
- max-height: initial;
866
- }
867
- #aiosp {
868
- width: 100%;
869
- }
870
-
871
- .aioseop_input.aioseop_top_label .aioseop_option_input {
872
- margin: 0 0 10px 0;
873
- }
874
-
875
- .aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div {
876
- max-height: none;
877
- }
878
-
879
- /* Robots.txt styling */
880
- #aiosp_robots_generator_robotgen_wrapper .aioseop_option_div,
881
- #aiosp_robots_generator_robothtml_wrapper .aioseop_option_div {
882
- max-height: none;
883
- }
884
- .aioseop_option_input .widefat td {
885
- vertical-align: middle;
886
- }
887
- .entry-row.robots.quirks {
888
- font-weight: bold;
889
- opacity: 1;
890
- }
891
- .entry-row.robots {
892
- opacity: 0.8;
893
- }
894
- .entry-row.robots.invalid {
895
- opacity: 1;
896
- font-weight: bold;
897
- }
898
- .invalid .entry_label {
899
- font-weight: bold;
900
- }
901
- .column_label, .entry_label {
902
- }
903
- .aioseop .aioseop_option_input tbody {
904
- background: #FCFCFC;
905
- }
906
- .All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody {
907
- background: transparent;
908
- }
909
- .entry-row.robots div {
910
- height: 20px;
911
- vertical-align: middle;
912
- width: 90%;
913
- margin: 0 0 4px 0;
914
- }
915
- .robots img {
916
- margin: 0 0 0 2px;
917
- opacity: 0.6;
918
- }
919
-
920
- .aioseop_option_docs {
921
- width: 98%;
922
- display: none;
923
- border: 1px solid #D3D3D3;
924
- margin-top: 20px;
925
- padding: 1%;
926
- background-color: #EEE;
927
- }
928
- .aioseop_option_docs h3 {
929
- background:none;
930
- }
931
- div.aioseop_notice {
932
- position: relative;
933
- }
934
- div.aioseop_notice a.aioseop_dismiss_link {
935
- position: absolute;
936
- top: 10px;
937
- right: 10px;
938
- }
939
- .aioseop_error_notice {
940
- color: #f00;
941
- font-weight: bold;
942
- }
943
-
944
- .aioseop_input select {
945
- margin: 7px 0px;
946
- }
947
- .aioseop_help_text ul {
948
- margin: 15px 0 0 20px;
949
- }
950
-
951
- .aioseop_help_text ul li {
952
- line-height: 20px;
953
- margin: 0;
954
- }
955
- .aioseop_sidebar #side-sortables {
956
- width: 98%;
957
- }
958
- #aioseop_opengraph_settings .aioseop_option_label {
959
- width: 30%;
960
- }
961
- .aioseop_tabs {
962
- padding-top: 6px;
963
- }
964
- .aioseop_tabs.hide, .aioseop_header_tabs.hide {
965
- display: block !important;
966
- }
967
- .aioseop_header_tabs li {
968
- display: inline;
969
- padding: 0px;
970
- margin: 0px;
971
- }
972
- .aioseop_header_tabs {
973
- margin: 0px;
974
- }
975
- .aioseop_header_nav {
976
- margin: 0px;
977
- }
978
- .aioseop_header_tabs li a.aioseop_header_tab.active {
979
- background-color: rgb( 255, 255, 255 );
980
- border-bottom-color: rgba( 255, 255, 255, 0.5 );
981
- font-weight: bold;
982
- }
983
- .aioseop_header_tabs li a.aioseop_header_tab {
984
- height: 18px;
985
- font: 13px/18px Arial,Helvetica,sans-serif normal;
986
- text-decoration: none;
987
- margin: 5px 5px 0 0;
988
- padding: 4px 5px 2px;
989
- cursor: pointer;
990
- border-width: 1px;
991
- border-style: solid;
992
- -webkit-border-top-right-radius: 3px;
993
- -webkit-border-top-left-radius: 3px;
994
- border-top-right-radius: 3px;
995
- border-top-left-radius: 3px;
996
- background-color: rgb( 255, 255, 255 );
997
- background-color: rgba( 255, 255, 255, 0.5 );
998
- border-color: #ccc;
999
- color: #5F5F5F;
1000
- }
1001
- .aioseop_header_tabs li:first-child a.aioseop_header_tab {
1002
- border-left: solid 1px #CCC;
1003
- margin-left: 5px;
1004
- }
1005
- .aioseop_tab {
1006
- border: solid 1px #CCC;
1007
- background-color: rgb( 255, 255, 255 );
1008
- background-color: rgba( 255, 255, 255, 0.5 );
1009
- padding-left: 5px;
1010
- }
1011
- .aioseop_loading {
1012
- background-image: url('../../images/activity.gif');
1013
- display: inline-block;
1014
- width: 24px;
1015
- height: 24px;
1016
- margin: 0px;
1017
- padding: 0px;
1018
- vertical-align: bottom;
1019
- }
1020
- .aiosp_delete_url {
1021
- background-image: url('../../images/delete.png');
1022
- display: inline-block;
1023
- width: 16px;
1024
- height: 16px;
1025
- margin: 0px;
1026
- padding: 0px;
1027
- vertical-align: bottom;
1028
- }
1029
- form#aiosp_settings_form, .aioseop_tabs_div {
1030
- padding-right: 477px;
1031
- }
1032
- .aioseop_tabs_div {
1033
- margin-top: 10px;
1034
- }
1035
- /*
1036
- .wrap > h2 {
1037
- padding-bottom: 14px;
1038
- }
1039
- div.wrap > form table.form-table {
1040
- clear: none;
1041
- width: 580px;
1042
- }
1043
- div.wrap > div#message.error {
1044
- max-width: 540px;
1045
- }
1046
- */
1047
- #aiosp_settings_form ul.sfwd_debug_settings li strong {
1048
- display: block;
1049
- float: left;
1050
- text-align: right;
1051
- background-color: #DDD;
1052
- margin-right: 8px;
1053
- padding: 1px;
1054
- padding-right: 8px;
1055
- overflow: auto;
1056
- width: 200px;
1057
- min-height: 16px;
1058
- }
1059
- #aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong {
1060
- background-color: #CCC;
1061
- }
1062
- #aiosp_settings_form ul.sfwd_debug_settings li {
1063
- clear: left;
1064
- padding: 5px;
1065
- margin: 0px;
1066
- padding: 0px;
1067
- background-color: #EEE;
1068
- overflow: auto;
1069
- max-width: 75%;
1070
- min-width: 800px;
1071
- }
1072
- #aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) {
1073
- background-color: #DDD;
1074
- }
1075
- div.sfwd_debug_mail_sent {
1076
- background-color: #080;
1077
- border: 1px solid #0A0;
1078
- margin: 10px 0px 10px 0px;
1079
- width: 598px;
1080
- color: #FFF;
1081
- text-align: center;
1082
- }
1083
- div.sfwd_debug_error {
1084
- background-color: #F00;
1085
- color: #FFF;
1086
- border: 1px solid #A00;
1087
- margin: 10px 0px 10px 0px;
1088
- width: 598px;
1089
- text-align: center;
1090
- font-weight: bolder;
1091
- }
1092
- #aiosp_performance_status_wrapper .aioseop_option_div {
1093
- max-height: 420px;
1094
- }
1095
-
1096
- #aioseop_coming_soon, #aioseop_coming_soon2 {
1097
- padding-top: 40px;
1098
- text-align: center;
1099
- height: 258px;
1100
- font-size: 16px;
1101
- }
1102
- /*
1103
- #aioseop_coming_soon {
1104
- text-align: center;
1105
- background-color: rgba(255, 255, 255, 0.5);
1106
- }
1107
- #aioseop_coming_soon p {
1108
- padding: 0px;
1109
- margin: 0px;
1110
- font-size: 16px;
1111
- font-family: Arial,Helvetica,sans-serif;
1112
- }
1113
- #aioseop_coming_soon img {
1114
- padding-top: 40%;
1115
- }
1116
- */
1117
- .MRL {
1118
- margin-left: 20px !important;
1119
- margin-bottom: 10px !important;
1120
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Controls all the styling of the plugin.
3
+ *
4
+ * @author Michael Torbert.
5
+ * @author Semper Fi Web Design.
6
+ * @copyright http://semperplugins.com
7
+ * @package All-in-One-SEO-Pack.
8
+ */
9
+
10
+ .form-table.aioseop {
11
+ clear: none;
12
+ }
13
+
14
+ .form-table.aioseop td {
15
+ vertical-align: top;
16
+ padding: 16px 0 10px 0;
17
+ line-height: 20px;
18
+ font-size: 12px;
19
+ }
20
+
21
+ .form-table.aioseop th {
22
+ width: 200px;
23
+ padding: 10px 0 12px 9px;
24
+ }
25
+
26
+ .aioseop_help_text_link,
27
+ .aioseop_help_text_link:active {
28
+ text-align: left;
29
+ float: left;
30
+ max-width: 300px;
31
+ min-width: 1px;
32
+ padding-top: 2px;
33
+ outline: none;
34
+ color: #888;
35
+ border: 2px solid #888;
36
+ border-radius: 33px;
37
+ width: 22px;
38
+ height: 20px;
39
+ font-family: sans-serif;
40
+ }
41
+
42
+ .aioseop_help_text_link span {
43
+ position: absolute;
44
+ left: 21px;
45
+ font-size: 14px;
46
+ }
47
+
48
+ .aioseop_help_text_link:before {
49
+ content: '\a0?';
50
+ color: #888;
51
+ font-size: 19px;
52
+ }
53
+
54
+ #aioseop-support .aioseop_metabox_text,
55
+ #aioseop-support a {
56
+ font-size: 14px;
57
+ color: #000;
58
+ text-decoration: none;
59
+ }
60
+
61
+ .aioseop_icon {
62
+ display: inline-block;
63
+ width: 40px;
64
+ height: 40px;
65
+ background-repeat: no-repeat;
66
+ background-size: 100%;
67
+ vertical-align: middle;
68
+ margin: 10px;
69
+ }
70
+
71
+ .aioseop_book_icon {
72
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==);
73
+ }
74
+
75
+ .aioseop_cog_icon {
76
+ 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=);
77
+ }
78
+
79
+ .aioseop_file_icon {
80
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==);
81
+ }
82
+
83
+ .aioseop_help_icon {
84
+ 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);
85
+ }
86
+
87
+ .aioseop_support_icon {
88
+ 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);
89
+ }
90
+
91
+ .aioseop_youtube_icon {
92
+ 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==);
93
+ }
94
+
95
+ .aioseop_help_text_link.aioseop_meta_box_help:before {
96
+ font-size: 14px;
97
+ }
98
+
99
+ .aioseop_meta_box_help > label {
100
+ position: absolute;
101
+ margin-left: 8px;
102
+ }
103
+
104
+ div.aioseop_tip_icon {
105
+ font-size: 14px;
106
+ border: 1px solid #888;
107
+ width: 1em;
108
+ text-align: center;
109
+ padding: 0 4px;
110
+ -webkit-border-radius: 12px;
111
+ -moz-border-radius: 12px;
112
+ -webkit-box-shadow: 1px 1px 1px #888;
113
+ -moz-box-shadow: 1px 1px 1px #888;
114
+ box-shadow: 1px 1px 1px #888;
115
+ border-radius: 12px;
116
+ }
117
+
118
+ div.aioseop_tip_icon:before {
119
+ content: '?';
120
+ }
121
+
122
+ .aioseop_help_text_link img {
123
+ width: 40px;
124
+ float: left;
125
+ }
126
+
127
+ .aioseop_meta_box_help,
128
+ .aioseop_meta_box_help:active {
129
+ float: right;
130
+ padding-left: 0;
131
+ width: 16px;
132
+ margin-right: 32px;
133
+ text-decoration: none;
134
+ height: 15px;
135
+ padding-top: 1px;
136
+ position: relative;
137
+ }
138
+
139
+ .aioseop_label {
140
+ color: #5F5F5F;
141
+ font-weight: bold;
142
+ line-height: 19px;
143
+ padding-left: 10px; /*changed from 20px to 10px for certain language support*/
144
+ display: inline-block;
145
+ text-align: left;
146
+ position: absolute;
147
+ font-family: 'Open Sans', sans-serif;
148
+ width: 26%;
149
+ min-width: 120px;
150
+ max-width: 230px;
151
+ }
152
+
153
+ .aioseop_option_div {
154
+ max-height: 160px;
155
+ min-height: 43px;
156
+ width: 95%;
157
+ overflow-y: auto;
158
+ }
159
+
160
+ .aioseop_overflowed {
161
+ border: 1px solid #e1e1e1;
162
+ }
163
+
164
+ .aioseop input[type="text"] {
165
+ color: #515151;
166
+ height: 35px;
167
+ padding: 10px 0 10px 10px;
168
+ font-size: 14px;
169
+ width: 95%;
170
+ max-width: 600px;
171
+ }
172
+
173
+ .aioseop textarea {
174
+ color: #515151;
175
+ padding: 10px 0 0 10px;
176
+ margin: 0;
177
+ font-size: 14px;
178
+ line-height: 25px;
179
+ width: 95%;
180
+ max-width: 600px;
181
+ }
182
+
183
+ .aioseop_help_text_div {
184
+ text-align: left;
185
+ width: 100%;
186
+ margin: 10px 0 10px 0;
187
+ }
188
+
189
+ .aioseop_help_text {
190
+ font-size: 12px;
191
+ float: left;
192
+ clear: left;
193
+ color: #797979;
194
+ line-height: 15px;
195
+ font-style: italic;
196
+ }
197
+
198
+ .aioseop_head_tagline {
199
+ color: #5F5F5F;
200
+ font-size: 13px;
201
+ }
202
+
203
+ .aioseop_head_nav {
204
+ float: left;
205
+ font-size: 18px;
206
+ margin: 0 0 16px 0;
207
+ font-family: "HelveticaNeue-Light",
208
+ "Helvetica Neue Light",
209
+ "Helvetica Neue",
210
+ sans-serif;
211
+ border-bottom: 1px solid #CCC;
212
+ width: 100%;
213
+ }
214
+
215
+ .aioseop_head_nav_tab {
216
+ padding: 10px 15px 10px 15px;
217
+ margin: 0 0 0 15px;
218
+ border-radius: 4px 4px 0 0;
219
+ border: 1px solid #CCC;
220
+ border-bottom: 0 white;
221
+ float: left;
222
+ opacity: 0.5;
223
+ color: black;
224
+ text-shadow: white 0 1px 0;
225
+ text-decoration: none;
226
+ }
227
+
228
+ .aioseop_head_nav_tab.aioseop_head_nav_active {
229
+ opacity: 1;
230
+ margin-bottom: -1px;
231
+ border-width: 1px;
232
+ }
233
+
234
+ .aioseop_head_nav_tab:first-child {
235
+ margin-left: 0;
236
+ }
237
+
238
+ .aioseop_head_nav_tab:hover {
239
+ opacity: 1;
240
+ }
241
+
242
+ .aioseop_header {
243
+ float: left;
244
+ clear: left;
245
+ }
246
+
247
+ .aioseop_advert {
248
+ padding: 10px;
249
+ margin-bottom: 30px;
250
+ border: 1px solid #DDD;
251
+ height: 200px;
252
+ width: 423px;
253
+ }
254
+
255
+ .headwaythemes {
256
+ background-color: #FFFFFF;
257
+ padding-bottom: 110px;
258
+ height: 125px;
259
+ }
260
+
261
+ .aioseop_nopad {
262
+ padding-left: 0;
263
+ padding-top: 0;
264
+ }
265
+
266
+ .aioseop_nopad_all {
267
+ padding: 0;
268
+ height: 220px;
269
+ width: 445px;
270
+ margin-bottom: 20px;
271
+ border: none;
272
+ }
273
+
274
+ .aioseop_adverts {
275
+ float: right;
276
+ }
277
+
278
+ .wincherad {
279
+ width: 100%;
280
+ height: 100%;
281
+ background-size: 100%;
282
+ background-repeat: no-repeat;
283
+ margin-bottom: 0;
284
+ border: none;
285
+ }
286
+
287
+ #wincher21 {
288
+ background-image: url(../../modules/images/banner21.jpg);
289
+ }
290
+
291
+ #wincher22 {
292
+ background-image: url(../../modules/images/banner22.jpg);
293
+ }
294
+
295
+ .aioseop_content {
296
+ min-width: 760px;
297
+ clear: left;
298
+ }
299
+
300
+ .aioseop_options_wrapper {
301
+ }
302
+
303
+ .aioseop_options_wrapper .hndle {
304
+ font-size: 15px;
305
+ font-family: Georgia,
306
+ "Times New Roman",
307
+ "Bitstream Charter",
308
+ Times,
309
+ serif;
310
+ font-weight: normal;
311
+ padding: 7px 10px;
312
+ margin: 0;
313
+ line-height: 1;
314
+ }
315
+
316
+ .aioseop_options_wrapper .submit input.button-primary {
317
+ margin-bottom: 5px;
318
+ }
319
+
320
+ #aiosp_feature_manager_metabox.postbox {
321
+ margin-top: 20px;
322
+ float: left;
323
+ }
324
+
325
+ .aioseop_advert p {
326
+ margin: 25px 0 25px 0;
327
+ }
328
+
329
+ .aioseop_options_wrapper .postarea {
330
+ border-color: #DFDFDF;
331
+ -moz-box-shadow: inset 0 1px 0 #fff;
332
+ -webkit-box-shadow: inset 0 1px 0 #fff;
333
+ box-shadow: inset 0 1px 0 #fff;
334
+ -moz-border-radius: 3px;
335
+ -webkit-border-radius: 3px;
336
+ border-radius: 3px;
337
+ }
338
+
339
+ .aioseop_advert h3 {
340
+ padding: 0;
341
+ margin-top: 6px;
342
+ }
343
+
344
+ .aioseop_metabox_text p {
345
+ margin: 0 0 0 0;
346
+ width: 101%;
347
+ }
348
+
349
+ .aioseop_sidebar {
350
+ width: 457px;
351
+ margin-left: 10px;
352
+ }
353
+
354
+ .aioseop_metabox_text {
355
+ margin-bottom: 0;
356
+ }
357
+
358
+ .aioseop_metabox_wrapper {
359
+ padding: 0;
360
+ }
361
+
362
+ .aioseop_metabox_text *:last-child {
363
+ margin: 0;
364
+ }
365
+
366
+ .aioseop_metabox_feature {
367
+ margin-top: 20px;
368
+ }
369
+
370
+ .aioseop_option_label {
371
+ float: left;
372
+ margin: 0;
373
+ min-width: 150px;
374
+ width: 37%;
375
+ max-width: 270px;
376
+ padding-top: 3px;
377
+ padding-bottom: 3px;
378
+ height: 67px !important; /*added for certain language support*/
379
+ }
380
+
381
+ .aioseop_metabox_text h2 {
382
+ font-size: 14px;
383
+ padding: 0;
384
+ font-weight: bold;
385
+ line-height: 29px;
386
+ }
387
+
388
+ #aioseop-about {
389
+ width: 443px;
390
+ margin-bottom: 20px;
391
+ }
392
+
393
+ #aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 {
394
+ font-size: 13px;
395
+ }
396
+
397
+ .aioseop_sidebar #mc-embedded-subscribe-form {
398
+ margin: 0 0 10px 0;
399
+ background: white;
400
+ padding: 10px 10px;
401
+ border: 1px solid #DDD;
402
+ }
403
+
404
+ .aioseop input[readonly] {
405
+ background-color: #EEE;
406
+ margin: 5px 0 5px 0 !important;
407
+ }
408
+
409
+ .aioseop_settings_left {
410
+ float: left;
411
+ padding: 0;
412
+ margin: 0;
413
+ width: 100%;
414
+ }
415
+
416
+ body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left {
417
+ margin-top: 20px;
418
+ }
419
+
420
+ body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left {
421
+ margin-top: 20px;
422
+ }
423
+
424
+ #aioseop_top_button {
425
+ margin-top: 5px;
426
+ height: 30px;
427
+ }
428
+
429
+ #aioseop-list #mce-EMAIL {
430
+ margin-top: 5px;
431
+ width: 250px;
432
+ }
433
+
434
+ .aioseop_top {
435
+ margin: 10px 10px 0 0;
436
+ /* margin: 10px 477px 0px 0px; */
437
+ }
438
+
439
+ .aioseop_top #aioseop-list {
440
+ margin-bottom: 0;
441
+ }
442
+
443
+ .aioseop_right_sidebar {
444
+ float: right;
445
+ margin-top: 35px;
446
+ }
447
+
448
+ #aiosp_settings_form .button-primary.hidden {
449
+ display: none;
450
+ }
451
+
452
+ form#edittag div#aiosp_titleatr_wrapper,
453
+ form#edittag div#aiosp_menulabel_wrapper,
454
+ form#edittag div#aiosp_sitemap_exclude_wrapper {
455
+ display: none;
456
+ }
457
+
458
+ .All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button {
459
+ height: 5px;
460
+ position: absolute;
461
+ top: 0;
462
+ width: 97%;
463
+ }
464
+
465
+ .All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > .aioseop_settings_left {
466
+ margin-top: 10px;
467
+ }
468
+
469
+ .All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper {
470
+ margin-top: 10px;
471
+ }
472
+
473
+ div#aiosp_feature_manager_metabox .inside {
474
+ padding: 8px;
475
+ }
476
+
477
+ div.aioseop_feature {
478
+ position: relative;
479
+ display: inline-block;
480
+ float: left;
481
+ vertical-align: top;
482
+ width: 240px;
483
+ height: 288px;
484
+ margin: 8px;
485
+ border: 1px solid #DEDEDE;
486
+ -moz-border-radius: 3px;
487
+ -webkit-border-radius: 3px;
488
+ border-radius: 3px;
489
+ background: white;
490
+ padding: 10px 0 0;
491
+ -webkit-box-shadow: inset 0 1px 0 #fff,
492
+ inset 0 0 20px rgba(0, 0, 0, 0.05),
493
+ 0 1px 2px rgba(0, 0, 0, 0.1);
494
+ -moz-box-shadow: inset 0 1px 0 #fff,
495
+ inset 0 0 20px rgba(0, 0, 0, 0.05),
496
+ 0 1px 2px rgba(0, 0, 0, 0.1);
497
+ box-shadow: inset 0 1px 0 #fff,
498
+ inset 0 0 20px rgba(0, 0, 0, 0.05),
499
+ 0 1px 2px rgba(0, 0, 0, 0.1);
500
+ -webkit-transition-duration: .4s;
501
+ -moz-transition-duration: .4s;
502
+ }
503
+
504
+ .aioseop_feature #free-flag {
505
+ float: right;
506
+ margin-right: -7px;
507
+ background: none repeat scroll 0 0 #D23D46;
508
+ color: #FFFFFF;
509
+ padding: 5px 12px 6px 5px;
510
+ position: relative;
511
+ }
512
+
513
+ .aioseop_feature #free-flag:before {
514
+ border-color: #D23D46 #D23D46 #D23D46 transparent;
515
+ border-style: solid;
516
+ border-width: 14px 4px 15px 10px;
517
+ content: "";
518
+ left: -14px;
519
+ position: absolute;
520
+ top: 0;
521
+ }
522
+
523
+ .aioseop_feature #free-flag:after {
524
+ border-color: #892026 transparent transparent;
525
+ border-style: solid;
526
+ border-width: 6px 6px 6px 0;
527
+ bottom: -12px;
528
+ content: "";
529
+ position: absolute;
530
+ right: 0;
531
+ }
532
+
533
+ #aioseop_coming_soon #free-flag {
534
+ display: none;
535
+ }
536
+
537
+ .aioseop_feature h3 {
538
+ font-size: 17px;
539
+ margin: 0;
540
+ padding: 0 10px 5px 10px;
541
+ font-weight: normal;
542
+ font-style: normal;
543
+ font-family: "Helvetica Neue",
544
+ Helvetica,
545
+ Arial,
546
+ "Lucida Grande",
547
+ Verdana,
548
+ "Bitstream Vera Sans",
549
+ sans-serif;
550
+ }
551
+
552
+ .aioseop_feature p {
553
+ line-height: 150%;
554
+ font-size: 12px;
555
+ font-family: Georgia,
556
+ "Times New Roman",
557
+ "Bitstream Charter",
558
+ Times, serif;
559
+ margin-bottom: 20px;
560
+ color: #666;
561
+ padding: 0 10px;
562
+ }
563
+
564
+ .aioseop_feature p.aioseop_desc {
565
+ min-height: 80px;
566
+ }
567
+
568
+ .aioseop_feature .feature_button {
569
+ float: right;
570
+ margin-bottom: 10px;
571
+ margin-right: 10px;
572
+ min-width: 80px;
573
+ text-align: center;
574
+ }
575
+
576
+ .aioseop_feature .feature_button:before {
577
+ content: "Activate";
578
+ }
579
+
580
+ .aioseop_feature .active.feature_button:before {
581
+ content: "Deactivate";
582
+ }
583
+
584
+ div.aioseop_feature .aioseop_featured_image {
585
+ min-height: 100px;
586
+ background-repeat: no-repeat;
587
+ display: block;
588
+ margin: 0 auto;
589
+ width: 133px;
590
+ }
591
+
592
+ div.aioseop_feature .aioseop_featured_image {
593
+ background-image: url(../../modules/images/Default-BW-Standard.png);
594
+ }
595
+
596
+ div.aioseop_feature .aioseop_featured_image.active {
597
+ background-image: url(../../modules/images/Default-Color-Standard.png);
598
+ }
599
+
600
+ div.aioseop_feature#aioseop_sitemap .aioseop_featured_image {
601
+ background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png);
602
+ }
603
+
604
+ div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active {
605
+ background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png);
606
+ }
607
+
608
+ div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image {
609
+ background-image: url(../../modules/images/VideoSitemap-BW-Standard.png);
610
+ }
611
+
612
+ div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active {
613
+ background-image: url(../../modules/images/VideoSitemap-Color-Standard.png);
614
+ }
615
+
616
+ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
617
+ background-image: url(../../modules/images/SocialMeta-BW-Standard.png);
618
+ }
619
+
620
+ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
621
+ background-image: url(../../modules/images/SocialMeta-Color-Standard.png);
622
+ }
623
+
624
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image {
625
+ background-image: url(../../modules/images/Robots-BW-Standard.png);
626
+ }
627
+
628
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active {
629
+ background-image: url(../../modules/images/Robots-Color-Standard.png);
630
+ }
631
+
632
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
633
+ background-image: url(../../modules/images/FileEditor-BW-Standard.png);
634
+ }
635
+
636
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
637
+ background-image: url(../../modules/images/FileEditor-Color-Standard.png);
638
+ }
639
+
640
+ div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
641
+ background-image: url(../../modules/images/ImporterExporter-BW-Standard.png);
642
+ }
643
+
644
+ div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
645
+ background-image: url(../../modules/images/ImporterExporter-Color-Standard.png);
646
+ }
647
+
648
+ div.aioseop_feature#aioseop_performance .aioseop_featured_image {
649
+ background-image: url(../../modules/images/Performance-BW-Standard.png);
650
+ }
651
+
652
+ div.aioseop_feature#aioseop_performance .aioseop_featured_image.active {
653
+ background-image: url(../../modules/images/Performance-Color-Standard.png);
654
+ }
655
+
656
+ div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
657
+ background-image: url(../../modules/images/Default-Color-Standard.png);
658
+ }
659
+
660
+ div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
661
+ background-image: url(../../modules/images/Default-Color-Standard.png);
662
+ }
663
+
664
+ .All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table,
665
+ .All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table {
666
+ max-width: 500px;
667
+ clear: none;
668
+ }
669
+
670
+ .aioseop_follow_button {
671
+ min-height: 50px;
672
+ background-repeat: no-repeat;
673
+ display: inline-block;
674
+ width: 100px;
675
+ background-size: auto 50px !important;
676
+ margin-right: 0;
677
+ }
678
+
679
+ .aioseop_facebook_follow {
680
+ background-image: url(../../modules/images/facebook-follow-standard.png);
681
+ }
682
+
683
+ .aioseop_twitter_follow {
684
+ background-image: url(../../modules/images/twitter-follow-standard.png);
685
+ }
686
+
687
+ @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) {
688
+ div.aioseop_feature .aioseop_featured_image {
689
+ background-size: auto 100px !important;
690
+ }
691
+
692
+ div.aioseop_feature .aioseop_featured_image.active {
693
+ background-image: url(../../modules/images/Default-Color-Retina.png);
694
+ }
695
+
696
+ div.aioseop_feature .aioseop_featured_image {
697
+ background-image: url(../../modules/images/Default-BW-Retina.png);
698
+ }
699
+
700
+ div.aioseop_feature#aioseop_sitemap .aioseop_featured_image {
701
+ background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png);
702
+ }
703
+
704
+ div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active {
705
+ background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png);
706
+ }
707
+
708
+ div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image {
709
+ background-image: url(../../modules/images/VideoSitemap-BW-Retina.png);
710
+ }
711
+
712
+ div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active {
713
+ background-image: url(../../modules/images/VideoSitemap-Color-Retina.png);
714
+ }
715
+
716
+ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
717
+ background-image: url(../../modules/images/SocialMeta-BW-Retina.png);
718
+ }
719
+
720
+ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
721
+ background-image: url(../../modules/images/SocialMeta-Color-Retina.png);
722
+ }
723
+
724
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image {
725
+ background-image: url(../../modules/images/Robots-BW-Retina.png);
726
+ }
727
+
728
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active {
729
+ background-image: url(../../modules/images/Robots-Color-Retina.png);
730
+ }
731
+
732
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
733
+ background-image: url(../../modules/images/FileEditor-BW-Retina.png);
734
+ }
735
+
736
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
737
+ background-image: url(../../modules/images/FileEditor-Color-Retina.png);
738
+ }
739
+
740
+ div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
741
+ background-image: url(../../modules/images/ImporterExporter-BW-Retina.png);
742
+ }
743
+
744
+ div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
745
+ background-image: url(../../modules/images/ImporterExporter-Color-Retina.png);
746
+ }
747
+
748
+ div.aioseop_feature#aioseop_performance .aioseop_featured_image {
749
+ background-image: url(../../modules/images/Performance-BW-Retina.png);
750
+ }
751
+
752
+ div.aioseop_feature#aioseop_performance .aioseop_featured_image.active {
753
+ background-image: url(../../modules/images/Performance-Color-Retina.png);
754
+ }
755
+
756
+ div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
757
+ background-image: url(../../modules/images/Default-BW-Retina.png);
758
+ }
759
+
760
+ div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
761
+ background-image: url(../../modules/images/Default-BW-Retina.png);
762
+ }
763
+
764
+ .aioseop_facebook_follow {
765
+ background-image: url(../../modules/images/facebook-follow-retina.png);
766
+ }
767
+
768
+ .aioseop_twitter_follow {
769
+ background-image: url(../../modules/images/twitter-follow-retina.png);
770
+ }
771
+ }
772
+
773
+ .aioseop_options {
774
+ width: 100%;
775
+ margin: 18px 0 10px 0;
776
+ }
777
+
778
+ .aioseop_wrapper {
779
+ width: 100%;
780
+ padding-left: 5px;
781
+ }
782
+
783
+ .aioseop_input {
784
+ clear: left;
785
+ width: 100%;
786
+ padding: 5px;
787
+ display: inline;
788
+ }
789
+
790
+ .aioseop_option_input {
791
+ float: left;
792
+ width: 61%;
793
+ margin: 0;
794
+ padding-left: 1px;
795
+ min-width: 160px;
796
+ /* max-width: 900px; */
797
+ }
798
+
799
+ #aiosp div.preview_snippet {
800
+ border: 1px solid #ebebeb;
801
+ padding: 15px 15px 20px 7px;
802
+ background-color: #fff;
803
+ }
804
+
805
+ div#aioseop_snippet {
806
+ font-family: arial, sans-serif;
807
+ font-size: 13px;
808
+ }
809
+
810
+ div#aioseop_snippet > h3 {
811
+ font-size: 16px;
812
+ padding: 8px 0;
813
+ border: 0;
814
+ background: inherit;
815
+ }
816
+
817
+ div#aioseop_snippet > h3 > a {
818
+ color: #12c;
819
+ text-decoration: none;
820
+ cursor: pointer;
821
+ }
822
+
823
+ div#aioseop_snippet > div {
824
+ color: #222;
825
+ max-width: 42em;
826
+ }
827
+
828
+ div#aioseop_snippet > div > div {
829
+ display: block;
830
+ margin-bottom: 1px;
831
+ }
832
+
833
+ div#aioseop_snippet > div > div > cite {
834
+ color: #093;
835
+ font-style: normal;
836
+ }
837
+
838
+ div#aioseop_snippet > div > span {
839
+ margin: 0;
840
+ padding: 0;
841
+ border: 0;
842
+ }
843
+
844
+ #aiosp_sitemap_addl_pages,
845
+ #aiosp_video_sitemap_addl_pages {
846
+ clear: left;
847
+ margin-left: 20px;
848
+ max-width: 1072px;
849
+ }
850
+
851
+ #aiosp_sitemap_addl_pages_metabox .aioseop_wrapper,
852
+ #aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper {
853
+ width: 23%;
854
+ min-width: 165px;
855
+ display: inline-block;
856
+ max-width: 265px;
857
+ }
858
+
859
+ #aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div,
860
+ #aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div {
861
+ position: absolute;
862
+ margin: 5px 0 10px 0;
863
+ }
864
+
865
+ #aiosp_sitemap_addl_pages_metabox .aioseop_option_input,
866
+ #aiosp_video_sitemap_addl_pages_metabox .aioseop_option_input {
867
+ width: 94%;
868
+ min-width: 94%;
869
+ }
870
+
871
+ #aiosp_sitemap_addl_pages_metabox table.aioseop_table,
872
+ #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table {
873
+ width: 96%;
874
+ border: 1px solid #CCC;
875
+ margin: 5px 0 10px 0;
876
+ }
877
+
878
+ table.aioseop_table tr:nth-child(odd) {
879
+ background-color: #EEE;
880
+ }
881
+
882
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) {
883
+ background-color: rgba(238, 238, 238, 0.5);
884
+ }
885
+
886
+ table.aioseop_table td {
887
+ width: 23%;
888
+ }
889
+
890
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table {
891
+ width: 80%;
892
+ max-width: 800px;
893
+ display: block;
894
+ border-top: 1px solid #dfdfdf;
895
+ border-left: 1px solid #dfdfdf;
896
+ }
897
+
898
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table th {
899
+ width: 18%;
900
+ border-right: 1px solid #dfdfdf;
901
+ border-bottom: 1px solid #dfdfdf;
902
+ }
903
+
904
+ .All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info {
905
+ margin-top: 10px;
906
+ border: 1px solid #dfdfdf;
907
+ width: 80%;
908
+ max-width: 800px;
909
+ }
910
+
911
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th {
912
+ background: #f1f1f1;
913
+ background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9));
914
+ background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9);
915
+ background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9);
916
+ background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9);
917
+ background-image: linear-gradient(to top, #ececec, #f9f9f9);
918
+ padding: 5px;
919
+ border-bottom-color: #dfdfdf;
920
+ text-shadow: #fff 0 1px 0;
921
+ -webkit-box-shadow: 0 1px 0 #fff;
922
+ -moz-box-shadow: 0 1px 0 #fff;
923
+ box-shadow: 0 1px 0 #fff;
924
+ }
925
+
926
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table td {
927
+ border-right: 1px solid #dfdfdf;
928
+ border-bottom: 1px solid #dfdfdf;
929
+ }
930
+
931
+ #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item {
932
+ display: inline-block;
933
+ width: 30%;
934
+ vertical-align: top;
935
+ }
936
+
937
+ #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) {
938
+ font-weight: bold;
939
+ }
940
+
941
+ #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) {
942
+ width: 70%;
943
+ }
944
+
945
+ #aiosp_sitemap_addl_pages_metabox table.aioseop_table td,
946
+ #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td {
947
+ width: 25%;
948
+ padding-left: 5%;
949
+ }
950
+
951
+ table.aioseop_table td, table.aioseop_table th {
952
+ padding: 3px;
953
+ }
954
+
955
+ .aioseop_top_label .aioseop_option_input,
956
+ .aioseop_no_label .aioseop_option_input {
957
+ width: 100%;
958
+ }
959
+
960
+ #aiosp_settings_form .postbox {
961
+ margin: 0 0 20px 0;
962
+ }
963
+
964
+ .aioseop_settings_left .postbox {
965
+ float: left;
966
+ width: 100%;
967
+ }
968
+
969
+ .aioseop_option_setting_label {
970
+ min-height: 35px;
971
+ display: inline-block;
972
+ white-space: nowrap;
973
+ overflow: hidden;
974
+ padding-left: 1px;
975
+ max-width: 229px;
976
+ min-width: 160px;
977
+ width: 33%;
978
+ }
979
+
980
+ .aioseop_settings_left .postbox .inside {
981
+ padding: 0;
982
+ margin: 0;
983
+ clear: right;
984
+ }
985
+
986
+ #aiosp_settings_form .aioseop_no_label, .aioseop_no_label {
987
+ float: left;
988
+ width: 92%;
989
+ max-width: 100%;
990
+ margin: 0 23px 0 13px;
991
+ }
992
+
993
+ .aioseop_top_label {
994
+ width: 96%;
995
+ margin: 0 10px;
996
+ }
997
+
998
+ .aioseop_hidden_type {
999
+ margin: 0;
1000
+ padding: 0;
1001
+ height: 0;
1002
+ }
1003
+
1004
+ .aioseop_module.error.below-h2 {
1005
+ padding: 5px 0;
1006
+ margin: 0 477px 15px 0 !important;
1007
+ }
1008
+
1009
+ #aioseop_opengraph_settings .inside {
1010
+ margin: 0;
1011
+ padding: 0;
1012
+ }
1013
+
1014
+ #aioseop_opengraph_settings_image_wrapper img {
1015
+ width: auto;
1016
+ height: 75px;
1017
+ }
1018
+
1019
+ #aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label {
1020
+ max-width: 160px;
1021
+ min-width: 100px;
1022
+ width: 30%;
1023
+ }
1024
+
1025
+ .aioseop_input input[type="checkbox"],
1026
+ .aioseop_input input[type="radio"] {
1027
+ vertical-align: text-bottom;
1028
+ margin-top: 8px;
1029
+ }
1030
+
1031
+ #aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div {
1032
+ max-height: initial;
1033
+ }
1034
+
1035
+ #aiosp {
1036
+ width: 100%;
1037
+ }
1038
+
1039
+ .aioseop_input.aioseop_top_label .aioseop_option_input {
1040
+ margin: 0 0 10px 0;
1041
+ }
1042
+
1043
+ .aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div {
1044
+ max-height: none;
1045
+ }
1046
+
1047
+ /* Robots.txt styling */
1048
+ #aiosp_robots_generator_robotgen_wrapper .aioseop_option_div,
1049
+ #aiosp_robots_generator_robothtml_wrapper .aioseop_option_div {
1050
+ max-height: none;
1051
+ }
1052
+
1053
+ .aioseop_option_input .widefat td {
1054
+ vertical-align: middle;
1055
+ }
1056
+
1057
+ .entry-row.robots.quirks {
1058
+ font-weight: bold;
1059
+ opacity: 1;
1060
+ }
1061
+
1062
+ .entry-row.robots {
1063
+ opacity: 0.8;
1064
+ }
1065
+
1066
+ .entry-row.robots.invalid {
1067
+ opacity: 1;
1068
+ font-weight: bold;
1069
+ }
1070
+
1071
+ .invalid .entry_label {
1072
+ font-weight: bold;
1073
+ }
1074
+
1075
+ .aioseop .aioseop_option_input tbody {
1076
+ background: #FCFCFC;
1077
+ }
1078
+
1079
+ .All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody {
1080
+ background: transparent;
1081
+ }
1082
+
1083
+ .entry-row.robots div {
1084
+ height: 20px;
1085
+ vertical-align: middle;
1086
+ width: 90%;
1087
+ margin: 0 0 4px 0;
1088
+ }
1089
+
1090
+ .robots img {
1091
+ margin: 0 0 0 2px;
1092
+ opacity: 0.6;
1093
+ }
1094
+
1095
+ .aioseop_option_docs {
1096
+ width: 98%;
1097
+ display: none;
1098
+ border: 1px solid #D3D3D3;
1099
+ margin-top: 20px;
1100
+ padding: 1%;
1101
+ background-color: #EEE;
1102
+ }
1103
+
1104
+ .aioseop_option_docs h3 {
1105
+ background: none;
1106
+ }
1107
+
1108
+ div.aioseop_notice {
1109
+ position: relative;
1110
+ }
1111
+
1112
+ div.aioseop_notice a.aioseop_dismiss_link {
1113
+ position: absolute;
1114
+ top: 10px;
1115
+ right: 10px;
1116
+ }
1117
+
1118
+ .aioseop_error_notice {
1119
+ color: #f00;
1120
+ font-weight: bold;
1121
+ }
1122
+
1123
+ .aioseop_input select {
1124
+ margin: 7px 0;
1125
+ }
1126
+
1127
+ .aioseop_help_text ul {
1128
+ margin: 15px 0 0 20px;
1129
+ }
1130
+
1131
+ .aioseop_help_text ul li {
1132
+ line-height: 20px;
1133
+ margin: 0;
1134
+ }
1135
+
1136
+ .aioseop_sidebar #side-sortables {
1137
+ width: 98%;
1138
+ }
1139
+
1140
+ #aioseop_opengraph_settings .aioseop_option_label {
1141
+ width: 30%;
1142
+ }
1143
+
1144
+ .aioseop_tabs {
1145
+ padding-top: 6px;
1146
+ }
1147
+
1148
+ .aioseop_tabs.hide,
1149
+ .aioseop_header_tabs.hide {
1150
+ display: block !important;
1151
+ }
1152
+
1153
+ .aioseop_header_tabs li {
1154
+ display: inline;
1155
+ padding: 0;
1156
+ margin: 0;
1157
+ }
1158
+
1159
+ .aioseop_header_tabs {
1160
+ margin: 0;
1161
+ }
1162
+
1163
+ .aioseop_header_nav {
1164
+ margin: 0;
1165
+ }
1166
+
1167
+ .aioseop_header_tabs li a.aioseop_header_tab.active {
1168
+ background-color: rgb(255, 255, 255);
1169
+ border-bottom-color: rgba(255, 255, 255, 0.5);
1170
+ font-weight: bold;
1171
+ }
1172
+
1173
+ .aioseop_header_tabs li a.aioseop_header_tab {
1174
+ height: 18px;
1175
+ font: 13px/18px Arial,
1176
+ Helvetica,
1177
+ sans-serif normal;
1178
+ text-decoration: none;
1179
+ margin: 5px 5px 0 0;
1180
+ padding: 4px 5px 2px;
1181
+ cursor: pointer;
1182
+ -webkit-border-top-right-radius: 3px;
1183
+ -webkit-border-top-left-radius: 3px;
1184
+ border-top-right-radius: 3px;
1185
+ border-top-left-radius: 3px;
1186
+ background-color: rgb(255, 255, 255);
1187
+ background-color: rgba(255, 255, 255, 0.5);
1188
+ border: 1px solid #ccc;
1189
+ color: #5F5F5F;
1190
+ }
1191
+
1192
+ /* Fix for Chrome */
1193
+ @media screen and (-webkit-min-device-pixel-ratio:0) {
1194
+
1195
+ .aioseop_header_tabs li a.aioseop_header_tab {
1196
+ padding-bottom: 0;
1197
+ }
1198
+ }
1199
+
1200
+ /* Fix for Safari */
1201
+ _:-webkit-full-screen:not(:root:root), .aioseop_header_tabs li a.aioseop_header_tab {
1202
+ padding-bottom: 2px;
1203
+ }
1204
+
1205
+ .aioseop_header_tabs li:first-child a.aioseop_header_tab {
1206
+ border-left: solid 1px #CCC;
1207
+ margin-left: 5px;
1208
+ }
1209
+
1210
+ .aioseop_tab {
1211
+ border: solid 1px #CCC;
1212
+ background-color: rgb(255, 255, 255);
1213
+ background-color: rgba(255, 255, 255, 0.5);
1214
+ padding-left: 5px;
1215
+ }
1216
+
1217
+ .aioseop_loading {
1218
+ background-image: url('../../images/activity.gif');
1219
+ display: inline-block;
1220
+ width: 24px;
1221
+ height: 24px;
1222
+ margin: 0;
1223
+ padding: 0;
1224
+ vertical-align: bottom;
1225
+ }
1226
+
1227
+ .aiosp_delete_url {
1228
+ background-image: url('../../images/delete.png');
1229
+ display: inline-block;
1230
+ width: 16px;
1231
+ height: 16px;
1232
+ margin: 0;
1233
+ padding: 0;
1234
+ vertical-align: bottom;
1235
+ }
1236
+
1237
+ form#aiosp_settings_form,
1238
+ .aioseop_tabs_div {
1239
+ padding-right: 477px;
1240
+ }
1241
+
1242
+ .aioseop_tabs_div {
1243
+ margin-top: 10px;
1244
+ }
1245
+
1246
+ #aiosp_settings_form ul.sfwd_debug_settings li strong {
1247
+ display: block;
1248
+ float: left;
1249
+ text-align: right;
1250
+ background-color: #DDD;
1251
+ margin-right: 8px;
1252
+ padding: 1px 8px 1px 1px;
1253
+ overflow: auto;
1254
+ width: 200px;
1255
+ min-height: 16px;
1256
+ }
1257
+
1258
+ #aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong {
1259
+ background-color: #CCC;
1260
+ }
1261
+
1262
+ #aiosp_settings_form ul.sfwd_debug_settings li {
1263
+ clear: left;
1264
+ margin: 0;
1265
+ padding: 0;
1266
+ background-color: #EEE;
1267
+ overflow: auto;
1268
+ max-width: 75%;
1269
+ min-width: 800px;
1270
+ }
1271
+
1272
+ #aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) {
1273
+ background-color: #DDD;
1274
+ }
1275
+
1276
+ div.sfwd_debug_mail_sent {
1277
+ background-color: #080;
1278
+ border: 1px solid #0A0;
1279
+ margin: 10px 0 10px 0;
1280
+ width: 598px;
1281
+ color: #FFF;
1282
+ text-align: center;
1283
+ }
1284
+
1285
+ div.sfwd_debug_error {
1286
+ background-color: #F00;
1287
+ color: #FFF;
1288
+ border: 1px solid #A00;
1289
+ margin: 10px 0 10px 0;
1290
+ width: 598px;
1291
+ text-align: center;
1292
+ font-weight: bolder;
1293
+ }
1294
+
1295
+ #aiosp_performance_status_wrapper .aioseop_option_div {
1296
+ max-height: 420px;
1297
+ }
1298
+
1299
+ #aioseop_coming_soon, #aioseop_coming_soon2 {
1300
+ padding-top: 40px;
1301
+ text-align: center;
1302
+ height: 258px;
1303
+ font-size: 16px;
1304
+ }
1305
+
1306
+ .MRL {
1307
+ margin-left: 20px !important;
1308
+ margin-bottom: 10px !important;
1309
+ }
i18n/all-in-one-seo-pack-am.mo ADDED
Binary file
i18n/all-in-one-seo-pack-ar.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-art_xemoji.mo ADDED
Binary file
i18n/all-in-one-seo-pack-ary.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-bg_BG.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-bn_BD.mo ADDED
Binary file
i18n/all-in-one-seo-pack-bs_BA.mo ADDED
Binary file
i18n/all-in-one-seo-pack-ca.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-de_DE.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-el.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-en_AU.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-en_CA.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-en_GB.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-en_NZ.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-en_ZA.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-es_ES.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-es_VE.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-et.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-fa_IR.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-fi.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-fr_CA.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-fr_FR.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-he_IL.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-hi_IN.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-hr.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-hu_HU.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-hy DELETED
Binary file
i18n/all-in-one-seo-pack-hy.mo ADDED
Binary file
i18n/all-in-one-seo-pack-id_ID.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-it_IT.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-ja.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-jv_ID.mo ADDED
Binary file
i18n/all-in-one-seo-pack-ko_KR.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-lv.mo ADDED
Binary file
i18n/all-in-one-seo-pack-mk_MK.mo ADDED
Binary file
i18n/all-in-one-seo-pack-mn.mo ADDED
Binary file
i18n/all-in-one-seo-pack-mr.mo ADDED
Binary file
i18n/all-in-one-seo-pack-ms_MY.mo ADDED
Binary file
i18n/all-in-one-seo-pack-nb_NO.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-nl.mo DELETED
Binary file
i18n/all-in-one-seo-pack-nl_NL.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-nn_NO.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-oci.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-pa_IN.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-pl_PL.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-ps.mo ADDED
Binary file
i18n/all-in-one-seo-pack-pt_BR.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-pt_PT.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-ro_RO.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-ru_RU.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-si_LK.mo ADDED
Binary file
i18n/all-in-one-seo-pack-sl_SL.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-sq.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-sv_SE.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-ta_IN.mo ADDED
Binary file
i18n/all-in-one-seo-pack-tg.mo ADDED
Binary file
i18n/all-in-one-seo-pack-tr_TR.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-uk.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-ur.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-vi.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-zh_CN.mo CHANGED
Binary file
i18n/all-in-one-seo-pack-zh_TW.mo CHANGED
Binary file
inc/aioseop_functions.php CHANGED
@@ -1,77 +1,91 @@
1
  <?php
2
  /**
 
 
 
 
3
  * @package All-in-One-SEO-Pack
4
  */
5
- /**
6
- * Load the module manager.
7
- */
8
- if (!function_exists('aioseop_load_modules')) {
 
9
  function aioseop_load_modules() {
10
  global $aioseop_modules, $aioseop_module_list;
11
- require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_manager.php' );
12
- $aioseop_modules = new All_in_One_SEO_Pack_Module_Manager( apply_filters( 'aioseop_module_list', $aioseop_module_list ) );
13
- $aioseop_modules->load_modules();
14
  }
15
  }
16
 
17
- if ( !function_exists( 'aioseop_get_options' ) ) {
 
 
 
18
  function aioseop_get_options() {
19
  global $aioseop_options;
20
  $aioseop_options = get_option( 'aioseop_options' );
21
  $aioseop_options = apply_filters( 'aioseop_get_options', $aioseop_options );
 
22
  return $aioseop_options;
23
  }
24
  }
25
 
26
- /**
27
- * Check if settings need to be updated / migrated from old version.
28
- */
29
- if ( !function_exists( 'aioseop_update_settings_check' ) ) {
 
 
30
  function aioseop_update_settings_check() {
31
  global $aioseop_options;
32
- if ( ( isset( $_POST['aioseop_migrate_options'] ) ) ||
33
- ( empty( $aioseop_options ) ) )
34
  aioseop_mrt_mkarry();
35
- // WPML has now attached to filters, read settings again so they can be translated
 
36
  aioseop_get_options();
37
  $update_options = false;
38
- if ( !empty( $aioseop_options ) ) {
39
- if ( !empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // migrate setting for noindex archives
40
  $aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex'];
41
  unset( $aioseop_options['aiosp_archive_noindex'] );
42
  $update_options = true;
43
  }
44
- if ( !empty( $aioseop_options['aiosp_archive_title_format'] ) && empty( $aioseop_options['aiosp_date_title_format'] ) ) {
45
  $aioseop_options['aiosp_date_title_format'] = $aioseop_options['aiosp_archive_title_format'];
46
  unset( $aioseop_options['aiosp_archive_title_format'] );
47
  $update_options = true;
48
  }
49
- if ( !empty( $aioseop_options['aiosp_archive_title_format'] ) && ( $aioseop_options['aiosp_archive_title_format'] == '%date% | %blog_title%' ) ) {
50
  $aioseop_options['aiosp_archive_title_format'] = '%archive_title% | %blog_title%';
51
- $update_options = true;
52
  }
53
- if ( $update_options )
54
  update_option( 'aioseop_options', $aioseop_options );
 
55
  }
56
  }
57
  }
58
 
59
- /**
60
- * Initialize settings to defaults.
61
- */
62
- if ( !function_exists( 'aioseop_mrt_mkarry' ) ) {
 
 
63
  function aioseop_mrt_mkarry() {
64
  global $aiosp;
65
  global $aioseop_options;
66
  $naioseop_options = $aiosp->default_options();
67
 
68
- if( get_option( 'aiosp_post_title_format' ) ) {
69
- foreach( $naioseop_options as $aioseop_opt_name => $value ) {
70
- if( $aioseop_oldval = get_option( $aioseop_opt_name ) ) {
71
- $naioseop_options[$aioseop_opt_name] = $aioseop_oldval;
72
  }
73
- if( $aioseop_oldval == '' ) {
74
- $naioseop_options[$aioseop_opt_name] = '';
75
  }
76
  delete_option( $aioseop_opt_name );
77
  }
@@ -81,375 +95,500 @@ if ( !function_exists( 'aioseop_mrt_mkarry' ) ) {
81
  }
82
  }
83
 
84
- if ( !function_exists( 'aioseop_activate_pl' ) ) {
 
 
 
85
  function aioseop_activate_pl() {
86
- if( $aioseop_options = get_option( 'aioseop_options' ) ) {
87
- $aioseop_options['aiosp_enabled'] = "0";
88
 
89
- if( empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
90
- $aioseop_options['aiosp_posttypecolumns'] = array('post','page');
91
  }
92
 
93
- update_option('aioseop_options', $aioseop_options);
94
  }
95
  }
96
  }
97
 
98
- if ( !function_exists( 'aioseop_get_version' ) ) {
 
 
 
 
 
 
 
99
  function aioseop_get_version() {
100
  return AIOSEOP_VERSION;
101
  }
102
  }
103
 
104
- if ( !function_exists( 'aioseop_option_isset' ) ) {
 
 
 
 
 
 
 
105
  function aioseop_option_isset( $option ) {
106
  global $aioseop_options;
107
- return ( ( isset( $aioseop_options[$option] ) ) && $aioseop_options[$option] );
 
108
  }
109
  }
110
 
111
- if ( !function_exists( 'aioseop_addmycolumns' ) ) {
 
 
 
 
 
112
  function aioseop_addmycolumns() {
113
  global $aioseop_options, $pagenow;
114
  $aiosp_posttypecolumns = Array();
115
- if ( !empty( $aioseop_options) && !empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
116
  $aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns'];
117
  }
118
- if ( !empty( $pagenow ) && ( $pagenow == 'upload.php' ) )
119
  $post_type = 'attachment';
120
- elseif ( !isset( $_REQUEST['post_type'] ) )
121
  $post_type = 'post';
122
- else
123
  $post_type = $_REQUEST['post_type'];
 
124
 
125
- if( is_array( $aiosp_posttypecolumns ) && in_array( $post_type, $aiosp_posttypecolumns ) ) {
126
  add_action( 'admin_head', 'aioseop_admin_head' );
127
- if ( $post_type == 'page' )
128
  add_filter( 'manage_pages_columns', 'aioseop_mrt_pcolumns' );
129
- elseif ( $post_type == 'attachment' )
130
  add_filter( 'manage_media_columns', 'aioseop_mrt_pcolumns' );
131
- else
132
  add_filter( 'manage_posts_columns', 'aioseop_mrt_pcolumns' );
133
- if ( $post_type == 'attachment' )
 
134
  add_action( 'manage_media_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
135
- elseif ( is_post_type_hierarchical( $post_type ) )
136
  add_action( 'manage_pages_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
137
- else
138
  add_action( 'manage_posts_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
 
139
  }
140
  }
141
  }
142
 
143
- if ( !function_exists( 'aioseop_mrt_pcolumns' ) ) {
 
 
 
 
 
 
144
  function aioseop_mrt_pcolumns( $aioseopc ) {
145
  global $aioseop_options;
146
- $aioseopc['seotitle'] = __( 'SEO Title', 'all-in-one-seo-pack' );
147
- $aioseopc['seodesc'] = __( 'SEO Description', 'all-in-one-seo-pack' );
148
- if ( empty( $aioseop_options['aiosp_togglekeywords'] ) )
149
  $aioseopc['seokeywords'] = __( 'SEO Keywords', 'all-in-one-seo-pack' );
150
- return $aioseopc;
 
 
151
  }
152
  }
153
 
154
- if ( !function_exists( 'aioseop_admin_head' ) ) {
 
155
  function aioseop_admin_head() {
156
  echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'js/quickedit_functions.js" ></script>';
157
- ?><style>
158
- .aioseop_edit_button {
159
- margin: 0 0 0 5px;
160
- opacity: 0.6;
161
- width: 12px;
162
- }
163
- .aioseop_edit_link {
164
- display: inline-block;
165
- position: absolute;
166
- }
167
- .aioseop_mpc_SEO_admin_options_edit img {
168
- margin: 3px 2px;
169
- opacity: 0.7;
170
- }
171
- .aioseop_mpc_admin_meta_options {
172
- float: left;
173
- display: block;
174
- opacity: 1;
175
- max-height: 75px;
176
- overflow: hidden;
177
- width: 100%;
178
- }
179
- .aioseop_mpc_admin_meta_options.editing {
180
- max-height: initial;
181
- overflow: visible;
182
- }
183
- .aioseop_mpc_admin_meta_content {
184
- float:left;
185
- width: 100%;
186
- margin: 0 0 10px 0;
187
- }
188
- td.seotitle.column-seotitle,
189
- td.seodesc.column-seodesc,
190
- td.seokeywords.column-seokeywords {
191
- overflow: visible;
192
- }
193
- @media screen and (max-width: 782px) {
194
- body.wp-admin th.column-seotitle, th.column-seodesc, th.column-seokeywords, td.seotitle.column-seotitle, td.seodesc.column-seodesc, td.seokeywords.column-seokeywords {
195
- display: none;
 
 
 
 
 
 
 
 
 
196
  }
197
- }
198
  </style>
199
  <?php wp_print_scripts( Array( 'sack' ) );
200
- ?><script type="text/javascript">
201
- //<![CDATA[
202
- var aioseopadmin = {
203
- blogUrl: "<?php print get_bloginfo( 'url'); ?>",
204
- pluginUrl: "<?php print AIOSEOP_PLUGIN_URL; ?>",
205
- requestUrl: "<?php print WP_ADMIN_URL . '/admin-ajax.php' ?>",
206
- imgUrl: "<?php print AIOSEOP_PLUGIN_IMAGES_URL; ?>",
207
- Edit: "<?php _e( 'Edit', 'all-in-one-seo-pack'); ?>", Post: "<?php _e( 'Post', 'all-in-one-seo-pack'); ?>", Save: "<?php _e( 'Save', 'all-in-one-seo-pack'); ?>", Cancel: "<?php _e( 'Cancel', 'all-in-one-seo-pack'); ?>", postType: "post",
208
- pleaseWait: "<?php _e( 'Please wait...', 'all-in-one-seo-pack'); ?>", slugEmpty: "<?php _e( 'Slug may not be empty!', 'all-in-one-seo-pack'); ?>",
209
- Revisions: "<?php _e( 'Revisions', 'all-in-one-seo-pack'); ?>", Time: "<?php _e( 'Insert time', 'all-in-one-seo-pack'); ?>"
210
- }
211
- //]]>
 
 
 
 
 
 
 
212
  </script>
213
  <?php
214
  }
215
  }
216
 
217
- if ( !function_exists( 'aioseop_handle_ignore_notice' ) ) {
 
218
  function aioseop_handle_ignore_notice() {
219
 
220
- if ( !empty( $_GET ) ) {
221
  global $current_user;
222
  $user_id = $current_user->ID;
223
 
224
- if ( !empty( $_GET["aioseop_reset_notices"] ) ) {
225
  delete_user_meta( $user_id, 'aioseop_ignore_notice' );
226
  }
227
- if ( !empty($_GET['aioseop_ignore_notice'] ) ) {
228
  add_user_meta( $user_id, 'aioseop_ignore_notice', $_GET['aioseop_ignore_notice'], false );
229
  }
230
  }
231
  }
232
  }
233
 
234
- if ( !function_exists( 'aioseop_output_notice' ) ) {
235
- function aioseop_output_notice( $message, $id = '', $class = "updated fade" ) {
 
 
 
 
 
 
 
 
236
  $class = 'aioseop_notice ' . $class;
237
- if ( !empty( $class ) ) $class = ' class="' . esc_attr( $class ) . '"';
238
- if ( !empty( $id ) ) $class .= ' id="' . esc_attr( $id ) . '"';
 
 
 
 
239
  $dismiss = ' ';
240
- echo "<div{$class}>" . wp_kses_post( $message ) . "<br class=clear /></div>";
 
241
  return true;
242
  }
243
  }
244
 
245
- if ( !function_exists( 'aioseop_output_dismissable_notice' ) ) {
246
- function aioseop_output_dismissable_notice( $message, $id = "", $class = "updated fade") {
 
 
 
 
 
 
 
 
247
  global $current_user;
248
- if ( !empty( $current_user ) ) {
249
  $user_id = $current_user->ID;
250
- $msgid = md5( $message );
251
- $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' );
252
- if ( !empty( $ignore ) && in_array( $msgid, $ignore ) ) return false;
 
 
253
  global $wp;
254
  $qa = Array();
255
- wp_parse_str( $_SERVER["QUERY_STRING"], $qa );
256
  $qa['aioseop_ignore_notice'] = $msgid;
257
- $url = '?' . build_query( $qa );
258
- $message = '<p class=alignleft>' . $message . '</p><p class="alignright"><a class="aioseop_dismiss_link" href="' . $url . '">Dismiss</a></p>';
259
  }
 
260
  return aioseop_output_notice( $message, $id, $class );
261
  }
262
  }
263
 
264
- if ( !function_exists( 'aioseop_ajax_save_meta' ) ) {
 
265
  function aioseop_ajax_save_meta() {
266
- if ( !empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] != 'undefined' ) )
267
  check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
268
- $post_id = intval( $_POST['post_id'] );
 
269
  $new_meta = strip_tags( $_POST['new_meta'] );
270
- $target = $_POST['target_meta'];
271
  check_ajax_referer( 'aioseop_meta_' . $target . '_' . $post_id, '_nonce' );
272
  $result = '';
273
- if ( in_array( $target, Array( 'title', 'description', 'keywords' ) ) && current_user_can( 'edit_post', $post_id ) ) {
 
 
 
 
 
274
  update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
275
  $result = get_post_meta( $post_id, '_aioseop_' . $target, true );
276
  } else {
277
  die();
278
  }
279
- if( $result != '' ):
280
  $label = "<label id='aioseop_label_{$target}_{$post_id}'><span style='width: 20px;display: inline-block;'></span>" . $result . '</label>';
281
  else:
282
  $label = "<label id='aioseop_label_{$target}_{$post_id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __( 'No', 'all-in-one-seo-pack' ) . ' ' . $target . '</i></strong>';
283
  endif;
284
- $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$post_id}" );
285
  $output = '<a id="' . $target . 'editlink' . $post_id . '" class="aioseop_edit_link" href="javascript:void(0);"'
286
- . 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __('Edit') . '">'
287
- . '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a> ' . $label;
288
- die( "jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . ";
289
- jQuery('div#aioseop_" . $target . "_" . $post_id . "').html(my_label).fadeIn('fast');
290
  });" );
291
  }
292
  }
293
 
294
- if ( !function_exists( 'aioseop_ajax_init' ) ) {
 
295
  function aioseop_ajax_init() {
296
- if ( !empty( $_POST ) && !empty( $_POST['settings'] ) && (!empty( $_POST['nonce-aioseop'])||(!empty( $_POST['nonce-aioseop-edit']))) && !empty( $_POST['options'] ) ) {
297
- $_POST = stripslashes_deep( $_POST );
298
  $settings = esc_attr( $_POST['settings'] );
299
- if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) )
300
- define( 'AIOSEOP_AJAX_MSG_TMPL', "jQuery('div#aiosp_$settings').fadeOut('fast', function(){jQuery('div#aiosp_$settings').html('%s').fadeIn('fast');});" );
 
301
 
302
- if ( !wp_verify_nonce($_POST['nonce-aioseop'], 'aioseop-nonce') )
303
- die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __( "Unauthorized access; try reloading the page.", 'all-in-one-seo-pack' ) ) );
 
304
  } else {
305
- die(0);
306
  }
307
  }
308
  }
309
 
310
- function aioseop_embed_handler_html( $return, $url, $attr ) {
311
- return AIO_ProGeneral::aioseop_embed_handler_html();
312
- }
 
 
 
 
 
 
 
313
 
314
- function aioseop_ajax_update_oembed() {
315
- AIO_ProGeneral::aioseop_ajax_update_oembed();
316
- }
 
 
317
 
318
- if ( !function_exists( 'aioseop_ajax_save_url' ) ) {
319
  function aioseop_ajax_save_url() {
320
  aioseop_ajax_init();
321
  $options = Array();
322
  parse_str( $_POST['options'], $options );
323
- foreach( $options as $k => $v ) $_POST[$k] = $v;
 
 
324
  $_POST['action'] = 'aiosp_update_module';
325
  global $aiosp, $aioseop_modules;
326
  aioseop_load_modules();
327
  $aiosp->admin_menu();
328
- if ( !empty( $_POST['settings'] ) && ( $_POST['settings'] == 'video_sitemap_addl_pages' ) ) {
329
- $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Video_Sitemap" );
330
- } elseif ( !empty( $_POST['settings'] ) && ( $_POST['settings'] == 'news_sitemap_addl_pages' ) ) {
331
- $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_News_Sitemap" );
332
  } else {
333
- $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" );
334
  }
335
  $_POST['location'] = null;
336
- $_POST['Submit'] = 'ajax';
337
  $module->add_page_hooks();
338
  $prefix = $module->get_prefix();
339
- $_POST = $module->get_current_options( $_POST, null );
340
  $module->handle_settings_updates( null );
341
  $options = $module->get_current_options( Array(), null );
342
- $output = $module->display_custom_options( '', Array( 'name' => $prefix . 'addl_pages', 'type' => 'custom', 'save' => true, 'value' => $options[$prefix . 'addl_pages'], 'attr' => '' ) );
343
- $output = str_replace( "'", "\'", $output );
344
- $output = str_replace( "\n", '\n', $output );
 
 
 
 
 
 
345
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
346
  }
347
  }
348
 
349
- if ( !function_exists( 'aioseop_ajax_delete_url' ) ) {
 
350
  function aioseop_ajax_delete_url() {
351
  aioseop_ajax_init();
352
- $options = Array();
353
- $options = esc_attr( $_POST['options'] );
354
  $_POST['action'] = 'aiosp_update_module';
355
  global $aiosp, $aioseop_modules;
356
  aioseop_load_modules();
357
  $aiosp->admin_menu();
358
- $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" );
359
  $_POST['location'] = null;
360
- $_POST['Submit'] = 'ajax';
361
  $module->add_page_hooks();
362
- $_POST = (Array)$module->get_current_options( $_POST, null );
363
- if ( !empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( is_object( $_POST['aiosp_sitemap_addl_pages'] ) ) )
364
- $_POST['aiosp_sitemap_addl_pages'] = (Array)$_POST['aiosp_sitemap_addl_pages'];
365
- if ( !empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( !empty( $_POST['aiosp_sitemap_addl_pages'][ $options ] ) ) ) {
 
366
  unset( $_POST['aiosp_sitemap_addl_pages'][ $options ] );
367
- if ( empty( $_POST['aiosp_sitemap_addl_pages'] ) )
368
  $_POST['aiosp_sitemap_addl_pages'] = '';
369
- else
370
  $_POST['aiosp_sitemap_addl_pages'] = json_encode( $_POST['aiosp_sitemap_addl_pages'] );
 
371
  $module->handle_settings_updates( null );
372
  $options = $module->get_current_options( Array(), null );
373
- $output = $module->display_custom_options( '', Array( 'name' => 'aiosp_sitemap_addl_pages', 'type' => 'custom', 'save' => true, 'value' => $options['aiosp_sitemap_addl_pages'], 'attr' => '' ) );
374
- $output = str_replace( "'", "\'", $output );
375
- $output = str_replace( "\n", '\n', $output );
 
 
 
 
 
 
376
  } else {
377
- $output = sprintf( __( "Row %s not found; no rows were deleted.", 'all-in-one-seo-pack' ), esc_attr( $options ) );
378
  }
379
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
380
  }
381
  }
382
 
383
- if ( !function_exists( 'aioseop_ajax_scan_header' ) ) {
384
 
385
  function aioseop_ajax_scan_header() {
386
- $_POST["options"] = "foo";
387
  aioseop_ajax_init();
388
  $options = Array();
389
  parse_str( $_POST['options'], $options );
390
- foreach( $options as $k => $v ) $_POST[$k] = $v;
391
- $_POST['action'] = 'aiosp_update_module';
 
 
392
  $_POST['location'] = null;
393
- $_POST['Submit'] = 'ajax';
394
  ob_start();
395
- do_action('wp');
396
  global $aioseop_modules;
397
- $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Opengraph" );
398
  wp_head();
399
  $output = ob_get_clean();
400
  global $aiosp;
401
- $output = $aiosp->html_string_to_array( $output );
402
- $meta = '';
403
  $metatags = Array(
404
- 'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
405
- 'twitter' => Array( 'name' => 'name', 'value' => 'value' ),
406
- 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' )
407
  );
408
  $metadata = Array(
409
- 'facebook' => Array(
410
- 'title' => 'og:title',
411
- 'type' => 'og:type',
412
- 'url' => 'og:url',
413
- 'thumbnail' => 'og:image',
414
- 'sitename' => 'og:site_name',
415
- 'key' => 'fb:admins',
416
- 'description' => 'og:description'
417
- ),
418
- 'google+' => Array(
419
- 'thumbnail' => 'image',
420
- 'title' => 'name',
421
- 'description' => 'description'
422
- ),
423
- 'twitter' => Array(
424
- 'card' => 'twitter:card',
425
- 'url' => 'twitter:url',
426
- 'title' => 'twitter:title',
427
- 'description' => 'twitter:description',
428
- 'thumbnail' => 'twitter:image'
429
- )
430
  );
431
- if ( !empty( $output ) && !empty( $output['head'] ) && !empty( $output['head']['meta'] ) )
432
- foreach( $output['head']['meta'] as $v )
433
- if ( !empty( $v['@attributes'] ) ) {
434
  $m = $v['@attributes'];
435
- foreach( $metatags as $type => $tags )
436
- if ( !empty( $m[$tags['name']] ) && !empty( $m[$tags['value']] ) )
437
- foreach( $metadata[$type] as $tk => $tv )
438
- if ( $m[$tags['name']] == $tv )
439
- $meta .= "<tr><th style='color:red;'>" . sprintf( __( 'Duplicate %s Meta'), ucwords( $type ) ) . "</th><td>" . ucwords( $tk ) . "</td><td>{$m[$tags['name']]}</td><td>{$m[$tags['value']]}</td></tr>\n";
 
 
 
 
440
  }
441
- if ( empty( $meta ) ) $meta = '<span style="color:green;">' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . '</span>';
442
- else {
443
- $meta = "<table cellspacing=0 cellpadding=0 width=80% class='aioseop_table'><tr class='aioseop_table_header'><th>Meta For Site</th><th>Kind of Meta</th><th>Element Name</th><th>Element Value</th></tr>" . $meta . "</table>";
 
 
 
444
  $meta .= "<p><div class='aioseop_meta_info'><h3 style='padding:5px;margin-bottom:0px;'>" . __( 'What Does This Mean?', 'all-in-one-seo-pack' ) . "</h3><div style='padding:5px;padding-top:0px;'>"
445
- . "<p>" . __( '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' )
446
- . "</p><p>" . __( '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' )
447
- . "</p><p>" . __( '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' ) . "</p>";
448
 
449
- 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 ) {
 
 
 
 
 
 
450
  $meta .= "<a href='{$link}' target='_blank'>{$link}</a><br />";
451
  }
452
- $meta .= "<p>" . __( 'Please refer to the document for each tool for help in using these to debug your social meta.', 'all-in-one-seo-pack' ) . "</div></div>";
453
  }
454
  $output = $meta;
455
  $output = str_replace( "'", "\'", $output );
@@ -458,188 +597,273 @@ if ( !function_exists( 'aioseop_ajax_scan_header' ) ) {
458
  }
459
  }
460
 
461
- if (!function_exists('aioseop_ajax_save_settings')) {
 
462
  function aioseop_ajax_save_settings() {
463
  aioseop_ajax_init();
464
  $options = Array();
465
  parse_str( $_POST['options'], $options );
466
- $_POST = $options;
467
  $_POST['action'] = 'aiosp_update_module';
468
  global $aiosp, $aioseop_modules;
469
  aioseop_load_modules();
470
  $aiosp->admin_menu();
471
  $module = $aioseop_modules->return_module( $_POST['module'] );
472
  unset( $_POST['module'] );
473
- if ( empty( $_POST['location'] ) ) $_POST['location'] = null;
 
 
474
  $_POST['Submit'] = 'ajax';
475
  $module->add_page_hooks();
476
  $output = $module->handle_settings_updates( $_POST['location'] );
477
 
478
- if( AIOSEOPPRO ){
479
- $output = '<div id="aioseop_settings_header"><div id="message" class="updated fade"><p>' . $output . '</p></div></div><style>body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { margin-top: 45px !important; }</style>';
480
- }else{
481
- $output = '<div id="aioseop_settings_header"><div id="message" class="updated fade"><p>' . $output . '</p></div></div><style>body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { margin-top: 45px !important; }</style>';
482
- }
483
 
484
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
485
  }
486
  }
487
 
488
- if (!function_exists('aioseop_ajax_get_menu_links')) {
 
489
  function aioseop_ajax_get_menu_links() {
490
  aioseop_ajax_init();
491
  $options = Array();
492
  parse_str( $_POST['options'], $options );
493
- $_POST = $options;
494
  $_POST['action'] = 'aiosp_update_module';
495
  global $aiosp, $aioseop_modules;
496
  aioseop_load_modules();
497
  $aiosp->admin_menu();
498
- if ( empty( $_POST['location'] ) ) $_POST['location'] = null;
 
 
499
  $_POST['Submit'] = 'ajax';
500
- $modlist = $aioseop_modules->get_loaded_module_list();
501
- $links = Array();
502
- $link_list = Array();
503
- $link = $aiosp->get_admin_links();
504
- if ( !empty( $link ) )
505
- foreach( $link as $l )
506
- if ( !empty( $l ) ) {
507
- if ( empty( $link_list[$l['order']] ) ) $link_list[$l['order']] = Array();
508
- $link_list[$l['order']][$l['title']] = $l['href'];
 
 
509
  }
510
- if ( !empty( $modlist ) )
511
- foreach( $modlist as $k => $v ) {
 
 
512
  $mod = $aioseop_modules->return_module( $v );
513
  if ( is_object( $mod ) ) {
514
  $mod->add_page_hooks();
515
  $link = $mod->get_admin_links();
516
- foreach( $link as $l )
517
- if ( !empty( $l ) ) {
518
- if ( empty( $link_list[$l['order']] ) ) $link_list[$l['order']] = Array();
519
- $link_list[$l['order']][$l['title']] = $l['href'];
 
 
520
  }
 
521
  }
522
  }
523
- if ( !empty( $link_list ) ) {
 
524
  ksort( $link_list );
525
- foreach( $link_list as $ll )
526
- foreach( $ll as $k => $v )
527
- $links[$k] = $v;
528
- }
529
- $output = "<ul>";
530
- if ( !empty( $links ) )
531
- foreach( $links as $k => $v ) {
532
- if ( $k == "Feature Manager" )
 
 
533
  $current = ' class="current"';
534
- else
535
  $current = '';
536
- $output .= "<li{$current}><a href='" . esc_url($v) . "'>" . esc_attr( $k ) . "</a></li>";
 
537
  }
538
- $output .= "</ul>";
539
- die( sprintf( "jQuery('{$_POST['target']}').fadeOut('fast', function(){jQuery('{$_POST['target']}').html('%s').fadeIn('fast');});", addslashes( $output ) ));
 
540
  }
541
  }
542
 
543
- if ( !function_exists( 'aioseop_mrt_pccolumn' ) ) {
544
- function aioseop_mrt_pccolumn($aioseopcn, $aioseoppi) {
545
- $id = $aioseoppi;
 
 
 
 
 
546
  $target = null;
547
- if( $aioseopcn == 'seotitle' ) $target = 'title';
548
- if( $aioseopcn == 'seokeywords' ) $target = 'keywords';
549
- if( $aioseopcn == 'seodesc' ) $target = 'description';
550
- if ( !$target ) return;
551
- if( current_user_can( 'edit_post', $id ) ) { ?>
 
 
 
 
 
 
 
 
552
  <div class="aioseop_mpc_admin_meta_container">
553
- <div class="aioseop_mpc_admin_meta_options"
554
- id="aioseop_<?php print $target; ?>_<?php echo $id; ?>"
555
- style="float:left;">
556
- <?php $content = strip_tags( stripslashes( get_post_meta( $id, "_aioseop_" . $target, TRUE ) ) );
557
- if( !empty($content) ):
558
- $label = "<label id='aioseop_label_{$target}_{$id}'><span style='width: 20px;display: inline-block;'></span>" . $content . '</label>';
559
- else:
560
- $label = "<label id='aioseop_label_{$target}_{$id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __( 'No', 'all-in-one-seo-pack' ) . " " . $target . '</i></strong>';
561
- endif;
562
  $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$id}" );
563
  echo '<a id="' . $target . 'editlink' . $id . '" class="aioseop_edit_link" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
564
- $id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __('Edit') . '">'
565
- . "<img class='aioseop_edit_button'
566
  id='aioseop_edit_id'
567
  src='" . AIOSEOP_PLUGIN_IMAGES_URL . "cog_edit.png' /></a> " . $label;
568
- ?>
569
  </div>
570
  </div>
571
  <?php }
572
  }
573
  }
574
 
575
- if ( !function_exists( 'aioseop_unprotect_meta' ) ) {
 
 
 
 
 
 
 
 
576
  function aioseop_unprotect_meta( $protected, $meta_key, $meta_type ) {
577
- if ( isset( $meta_key ) && ( substr( $meta_key, 0, 9 ) === '_aioseop_' ) ) return false;
 
 
 
578
  return $protected;
579
  }
580
  }
581
 
582
- if ( !function_exists( 'aioseop_mrt_exclude_this_page' ) ) {
 
 
 
 
 
 
583
  function aioseop_mrt_exclude_this_page( $url = null ) {
584
  static $excluded = false;
585
  if ( $excluded === false ) {
586
  global $aioseop_options;
587
  $ex_pages = '';
588
- if ( isset( $aioseop_options['aiosp_ex_pages'] ) )
589
  $ex_pages = trim( $aioseop_options['aiosp_ex_pages'] );
590
- if ( !empty( $ex_pages ) ) {
 
591
  $excluded = explode( ',', $ex_pages );
592
- if ( !empty( $excluded ) )
593
- foreach( $excluded as $k => $v ) {
594
- $excluded[$k] = trim( $v );
595
- if ( empty( $excluded[$k] ) ) unset( $excluded[$k] );
 
 
596
  }
597
- if ( empty( $excluded ) ) $excluded = null;
 
 
 
598
  }
599
  }
600
- if ( !empty( $excluded ) ) {
601
- if ( $url === null )
602
  $url = $_SERVER['REQUEST_URI'];
603
- else {
604
  $url = parse_url( $url );
605
- if ( !empty( $url['path'] ) )
606
  $url = $url['path'];
607
- else
608
  return false;
 
 
 
 
 
 
 
 
609
  }
610
- if ( !empty( $url ) )
611
- foreach( $excluded as $exedd )
612
- if ( ( $exedd ) && ( stripos( $url, $exedd ) !== FALSE ) )
613
- return true;
614
  }
 
615
  return false;
616
  }
617
  }
618
 
619
- if ( !function_exists( 'aioseop_get_pages_start' ) ) {
 
 
 
 
 
 
620
  function aioseop_get_pages_start( $excludes ) {
621
  global $aioseop_get_pages_start;
622
  $aioseop_get_pages_start = 1;
 
623
  return $excludes;
624
  }
625
  }
626
 
627
- if ( !function_exists( 'aioseop_get_pages' ) ) {
 
 
 
 
 
 
628
  function aioseop_get_pages( $pages ) {
629
  global $aioseop_get_pages_start;
630
- if ( !$aioseop_get_pages_start ) return $pages;
 
 
631
  foreach ( $pages as $k => $v ) {
632
- $postID = $v->ID;
633
  $menulabel = stripslashes( get_post_meta( $postID, '_aioseop_menulabel', true ) );
634
- if ( $menulabel ) $pages[$k]->post_title = $menulabel;
 
 
635
  }
636
  $aioseop_get_pages_start = 0;
 
637
  return $pages;
638
  }
639
  }
640
 
641
  // The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/.
642
- if ( !function_exists( 'aioseop_list_pages' ) ) {
 
 
 
 
 
 
 
 
643
  function aioseop_list_pages( $content ) {
644
  global $wp_version;
645
  $matches = array();
@@ -651,45 +875,73 @@ if ( !function_exists( 'aioseop_list_pages' ) ) {
651
  } else {
652
  $pattern = '@<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">@is';
653
  }
654
- return preg_replace_callback( $pattern, "aioseop_filter_callback", $content );
 
655
  }
 
656
  return $content;
657
  }
658
  }
659
 
660
- if ( !function_exists( 'aioseop_filter_callback' ) ) {
 
 
 
 
 
 
661
  function aioseop_filter_callback( $matches ) {
662
- if ( $matches[1] && !empty( $matches[1] ) ) $postID = $matches[1];
663
- if ( empty( $postID ) ) $postID = get_option( "page_on_front" );
664
- $title_attrib = stripslashes( get_post_meta($postID, '_aioseop_titleatr', true ) );
665
- if ( empty( $title_attrib ) && !empty( $matches[4] ) ) $title_attrib = $matches[4];
666
- if ( !empty( $title_attrib ) ) $title_attrib = ' title="' . strip_tags( $title_attrib ) . '"';
667
- return '<li class="page_item page-item-'.$postID.$matches[2].'"><a href="'.$matches[3].'"'.$title_attrib.'>';
 
 
 
 
 
 
 
 
 
668
  }
669
  }
670
 
671
- if ( !function_exists( 'aioseop_add_contactmethods' ) ) {
 
 
 
 
 
 
672
  function aioseop_add_contactmethods( $contactmethods ) {
673
  global $aioseop_options, $aioseop_modules;
674
- if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) )
675
  $contactmethods['googleplus'] = __( 'Google+', 'all-in-one-seo-pack' );
676
- if ( !empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) {
 
677
  $m = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' );
678
  if ( ( $m !== false ) && is_object( $m ) ) {
679
- if ( $m->option_isset( 'twitter_creator' ) )
680
  $contactmethods['twitter'] = __( 'Twitter', 'all-in-one-seo-pack' );
681
- if ( $m->option_isset( 'facebook_author' ) )
 
682
  $contactmethods['facebook'] = __( 'Facebook', 'all-in-one-seo-pack' );
 
683
  }
684
  }
 
685
  return $contactmethods;
686
  }
687
  }
688
 
689
- if ( !function_exists( 'aioseop_localize_script_data' ) ) {
 
690
  function aioseop_localize_script_data() {
691
  static $loaded = 0;
692
- if ( !$loaded ) {
693
  $data = apply_filters( 'aioseop_localize_script_data', Array() );
694
  wp_localize_script( 'aioseop-module-script', 'aiosp_data', $data );
695
  $loaded = 1;
@@ -697,98 +949,160 @@ if ( !function_exists( 'aioseop_localize_script_data' ) ) {
697
  }
698
  }
699
 
700
- /***
701
- * Utility function for inserting elements into associative arrays by key
702
- */
703
- if ( !function_exists( 'aioseop_array_insert_after' ) ) {
 
 
 
 
 
 
704
  function aioseop_array_insert_after( $arr, $insertKey, $newValues ) {
705
- $keys = array_keys($arr);
706
- $vals = array_values($arr);
707
- $insertAfter = array_search($insertKey, $keys) + 1;
708
- $keys2 = array_splice($keys, $insertAfter);
709
- $vals2 = array_splice($vals, $insertAfter);
710
- foreach( $newValues as $k => $v ) {
711
- $keys[] = $k;
712
- $vals[] = $v;
713
- }
714
- return array_merge(array_combine($keys, $vals), array_combine($keys2, $vals2));
 
715
  }
716
  }
717
 
718
- /***
719
- * JSON support for PHP < 5.2
720
- */
721
- if ( !function_exists( 'aioseop_load_json_services' ) ) {
 
 
 
722
  function aioseop_load_json_services() {
723
  static $services_json = null;
724
- if ( $services_json ) return $services_json;
725
- if ( !class_exists( 'Services_JSON' ) ) require_once( 'inc/extlib/JSON.php' );
726
- if ( !$services_json ) $services_json = new Services_JSON();
 
 
 
 
 
 
 
727
  return $services_json;
728
  }
729
  }
730
 
731
- if ( !function_exists( 'json_encode' ) ) {
 
 
 
 
 
 
732
  function json_encode( $arg ) {
733
  $services_json = aioseop_load_json_services();
 
734
  return $services_json->encode( $arg );
735
  }
736
  }
737
 
738
- if ( !function_exists( 'json_decode' ) ) {
 
 
 
 
 
 
739
  function json_decode( $arg ) {
740
  $services_json = aioseop_load_json_services();
 
741
  return $services_json->decode( $arg );
742
  }
743
  }
744
 
745
- /***
746
- * fnmatch() doesn't exist on Windows pre PHP 5.3
747
- */
748
- if( !function_exists( 'fnmatch' ) ) {
749
- function fnmatch( $pattern, $string ) {
750
- return preg_match( "#^" . strtr( preg_quote( $pattern, '#' ), array( '\*' => '.*', '\?' => '.' ) ) . "$#i", $string );
751
- }
 
 
 
 
 
 
 
 
752
  }
753
 
754
- /***
755
- * parse_ini_string() doesn't exist pre PHP 5.3
756
- */
757
- if ( !function_exists( 'parse_ini_string' ) ) {
 
 
 
 
 
758
  function parse_ini_string( $string, $process_sections ) {
759
- if ( !class_exists( 'parse_ini_filter' ) ) {
760
- /* Define our filter class */
 
 
 
 
 
 
761
  class parse_ini_filter extends php_user_filter {
762
  static $buf = '';
 
 
 
 
 
 
 
 
 
 
 
763
  function filter( $in, $out, &$consumed, $closing ) {
764
- $bucket = stream_bucket_new( fopen('php://memory', 'wb'), self::$buf );
765
  stream_bucket_append( $out, $bucket );
 
766
  return PSFS_PASS_ON;
767
  }
768
  }
769
- /* Register our filter with PHP */
770
- if ( !stream_filter_register("parse_ini", "parse_ini_filter") )
 
771
  return false;
 
772
  }
773
  parse_ini_filter::$buf = $string;
774
- return parse_ini_file( "php://filter/read=parse_ini/resource=php://memory", $process_sections );
 
775
  }
776
  }
777
 
778
- function aioseop_update_user_visibilitynotice(){
779
 
780
  update_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
 
781
 
782
- }
783
-
784
- function aioseop_update_yst_detected_notice(){
785
 
786
  update_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
 
787
 
788
- }
789
-
790
- function aioseop_woo_upgrade_notice_dismissed(){
791
 
792
  update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
793
-
794
- }
1
  <?php
2
  /**
3
+ * General functions file.
4
+ *
5
+ * We'll eventually move these to a better place, and figure out ones not being used anymore.
6
+ *
7
  * @package All-in-One-SEO-Pack
8
  */
9
+
10
+ if ( ! function_exists( 'aioseop_load_modules' ) ) {
11
+ /**
12
+ * Load the module manager.
13
+ */
14
  function aioseop_load_modules() {
15
  global $aioseop_modules, $aioseop_module_list;
16
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_manager.php' );
17
+ $aioseop_modules = new All_in_One_SEO_Pack_Module_Manager( apply_filters( 'aioseop_module_list', $aioseop_module_list ) );
18
+ $aioseop_modules->load_modules();
19
  }
20
  }
21
 
22
+ if ( ! function_exists( 'aioseop_get_options' ) ) {
23
+ /**
24
+ * @return mixed|void
25
+ */
26
  function aioseop_get_options() {
27
  global $aioseop_options;
28
  $aioseop_options = get_option( 'aioseop_options' );
29
  $aioseop_options = apply_filters( 'aioseop_get_options', $aioseop_options );
30
+
31
  return $aioseop_options;
32
  }
33
  }
34
 
35
+ if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
36
+ /**
37
+ * Check if settings need to be updated / migrated from old version.
38
+ *
39
+ * @TODO See when this is from and if we can move it elsewhere... our new db updates/upgrades class?
40
+ */
41
  function aioseop_update_settings_check() {
42
  global $aioseop_options;
43
+ if ( empty( $aioseop_options ) || isset( $_POST['aioseop_migrate_options'] ) ) {
 
44
  aioseop_mrt_mkarry();
45
+ }
46
+ // WPML has now attached to filters, read settings again so they can be translated.
47
  aioseop_get_options();
48
  $update_options = false;
49
+ if ( ! empty( $aioseop_options ) ) {
50
+ if ( ! empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // Migrate setting for noindex archives.
51
  $aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex'];
52
  unset( $aioseop_options['aiosp_archive_noindex'] );
53
  $update_options = true;
54
  }
55
+ if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && empty( $aioseop_options['aiosp_date_title_format'] ) ) {
56
  $aioseop_options['aiosp_date_title_format'] = $aioseop_options['aiosp_archive_title_format'];
57
  unset( $aioseop_options['aiosp_archive_title_format'] );
58
  $update_options = true;
59
  }
60
+ if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && ( $aioseop_options['aiosp_archive_title_format'] === '%date% | %blog_title%' ) ) {
61
  $aioseop_options['aiosp_archive_title_format'] = '%archive_title% | %blog_title%';
62
+ $update_options = true;
63
  }
64
+ if ( $update_options ) {
65
  update_option( 'aioseop_options', $aioseop_options );
66
+ }
67
  }
68
  }
69
  }
70
 
71
+ if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) {
72
+ /**
73
+ * Initialize settings to defaults.
74
+ *
75
+ * @TODO Should also move.
76
+ */
77
  function aioseop_mrt_mkarry() {
78
  global $aiosp;
79
  global $aioseop_options;
80
  $naioseop_options = $aiosp->default_options();
81
 
82
+ if ( get_option( 'aiosp_post_title_format' ) ) {
83
+ foreach ( $naioseop_options as $aioseop_opt_name => $value ) {
84
+ if ( $aioseop_oldval = get_option( $aioseop_opt_name ) ) {
85
+ $naioseop_options[ $aioseop_opt_name ] = $aioseop_oldval;
86
  }
87
+ if ( $aioseop_oldval == '' ) {
88
+ $naioseop_options[ $aioseop_opt_name ] = '';
89
  }
90
  delete_option( $aioseop_opt_name );
91
  }
95
  }
96
  }
97
 
98
+ if ( ! function_exists( 'aioseop_activate_pl' ) ) {
99
+ /**
100
+ * @TODO see if this still gets used.
101
+ */
102
  function aioseop_activate_pl() {
103
+ if ( $aioseop_options = get_option( 'aioseop_options' ) ) {
104
+ $aioseop_options['aiosp_enabled'] = '0';
105
 
106
+ if ( empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
107
+ $aioseop_options['aiosp_posttypecolumns'] = array( 'post', 'page' );
108
  }
109
 
110
+ update_option( 'aioseop_options', $aioseop_options );
111
  }
112
  }
113
  }
114
 
115
+ if ( ! function_exists( 'aioseop_get_version' ) ) {
116
+ /**
117
+ * Returns the version.
118
+ *
119
+ * I'm not sure why we have BOTH a function and a constant for this. -mrt
120
+ *
121
+ * @return string
122
+ */
123
  function aioseop_get_version() {
124
  return AIOSEOP_VERSION;
125
  }
126
  }
127
 
128
+ if ( ! function_exists( 'aioseop_option_isset' ) ) {
129
+ /**
130
+ * Checks if an option isset.
131
+ *
132
+ * @param $option
133
+ *
134
+ * @return bool
135
+ */
136
  function aioseop_option_isset( $option ) {
137
  global $aioseop_options;
138
+
139
+ return ( isset( $aioseop_options[ $option ] ) && $aioseop_options[ $option ] );
140
  }
141
  }
142
 
143
+ if ( ! function_exists( 'aioseop_addmycolumns' ) ) {
144
+ /**
145
+ * Adds posttype columns.
146
+ *
147
+ * @TODO We should see if this is still being used, and move it either way.
148
+ */
149
  function aioseop_addmycolumns() {
150
  global $aioseop_options, $pagenow;
151
  $aiosp_posttypecolumns = Array();
152
+ if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
153
  $aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns'];
154
  }
155
+ if ( ! empty( $pagenow ) && ( $pagenow === 'upload.php' ) ) {
156
  $post_type = 'attachment';
157
+ } elseif ( ! isset( $_REQUEST['post_type'] ) ) {
158
  $post_type = 'post';
159
+ } else {
160
  $post_type = $_REQUEST['post_type'];
161
+ }
162
 
163
+ if ( is_array( $aiosp_posttypecolumns ) && in_array( $post_type, $aiosp_posttypecolumns ) ) {
164
  add_action( 'admin_head', 'aioseop_admin_head' );
165
+ if ( $post_type === 'page' ) {
166
  add_filter( 'manage_pages_columns', 'aioseop_mrt_pcolumns' );
167
+ } elseif ( $post_type === 'attachment' ) {
168
  add_filter( 'manage_media_columns', 'aioseop_mrt_pcolumns' );
169
+ } else {
170
  add_filter( 'manage_posts_columns', 'aioseop_mrt_pcolumns' );
171
+ }
172
+ if ( $post_type === 'attachment' ) {
173
  add_action( 'manage_media_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
174
+ } elseif ( is_post_type_hierarchical( $post_type ) ) {
175
  add_action( 'manage_pages_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
176
+ } else {
177
  add_action( 'manage_posts_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
178
+ }
179
  }
180
  }
181
  }
182
 
183
+ if ( ! function_exists( 'aioseop_mrt_pcolumns' ) ) {
184
+
185
+ /**
186
+ * @param $aioseopc
187
+ *
188
+ * @return mixed
189
+ */
190
  function aioseop_mrt_pcolumns( $aioseopc ) {
191
  global $aioseop_options;
192
+ $aioseopc['seotitle'] = __( 'SEO Title', 'all-in-one-seo-pack' );
193
+ $aioseopc['seodesc'] = __( 'SEO Description', 'all-in-one-seo-pack' );
194
+ if ( empty( $aioseop_options['aiosp_togglekeywords'] ) ) {
195
  $aioseopc['seokeywords'] = __( 'SEO Keywords', 'all-in-one-seo-pack' );
196
+ }
197
+
198
+ return $aioseopc;
199
  }
200
  }
201
 
202
+ if ( ! function_exists( 'aioseop_admin_head' ) ) {
203
+
204
  function aioseop_admin_head() {
205
  echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'js/quickedit_functions.js" ></script>';
206
+ ?>
207
+ <style>
208
+ .aioseop_edit_button {
209
+ margin: 0 0 0 5px;
210
+ opacity: 0.6;
211
+ width: 12px;
212
+ }
213
+
214
+ .aioseop_edit_link {
215
+ display: inline-block;
216
+ position: absolute;
217
+ }
218
+
219
+ .aioseop_mpc_SEO_admin_options_edit img {
220
+ margin: 3px 2px;
221
+ opacity: 0.7;
222
+ }
223
+
224
+ .aioseop_mpc_admin_meta_options {
225
+ float: left;
226
+ display: block;
227
+ opacity: 1;
228
+ max-height: 75px;
229
+ overflow: hidden;
230
+ width: 100%;
231
+ }
232
+
233
+ .aioseop_mpc_admin_meta_options.editing {
234
+ max-height: initial;
235
+ overflow: visible;
236
+ }
237
+
238
+ .aioseop_mpc_admin_meta_content {
239
+ float: left;
240
+ width: 100%;
241
+ margin: 0 0 10px 0;
242
+ }
243
+
244
+ td.seotitle.column-seotitle,
245
+ td.seodesc.column-seodesc,
246
+ td.seokeywords.column-seokeywords {
247
+ overflow: visible;
248
+ }
249
+
250
+ @media screen and (max-width: 782px) {
251
+ body.wp-admin th.column-seotitle, th.column-seodesc, th.column-seokeywords, td.seotitle.column-seotitle, td.seodesc.column-seodesc, td.seokeywords.column-seokeywords {
252
+ display: none;
253
+ }
254
  }
 
255
  </style>
256
  <?php wp_print_scripts( Array( 'sack' ) );
257
+ ?>
258
+ <script type="text/javascript">
259
+ //<![CDATA[
260
+ var aioseopadmin = {
261
+ blogUrl: "<?php print get_bloginfo( 'url' ); ?>",
262
+ pluginUrl: "<?php print AIOSEOP_PLUGIN_URL; ?>",
263
+ requestUrl: "<?php print WP_ADMIN_URL . '/admin-ajax.php' ?>",
264
+ imgUrl: "<?php print AIOSEOP_PLUGIN_IMAGES_URL; ?>",
265
+ Edit: "<?php _e( 'Edit', 'all-in-one-seo-pack' ); ?>",
266
+ Post: "<?php _e( 'Post', 'all-in-one-seo-pack' ); ?>",
267
+ Save: "<?php _e( 'Save', 'all-in-one-seo-pack' ); ?>",
268
+ Cancel: "<?php _e( 'Cancel', 'all-in-one-seo-pack' ); ?>",
269
+ postType: "post",
270
+ pleaseWait: "<?php _e( 'Please wait...', 'all-in-one-seo-pack' ); ?>",
271
+ slugEmpty: "<?php _e( 'Slug may not be empty!', 'all-in-one-seo-pack' ); ?>",
272
+ Revisions: "<?php _e( 'Revisions', 'all-in-one-seo-pack' ); ?>",
273
+ Time: "<?php _e( 'Insert time', 'all-in-one-seo-pack' ); ?>"
274
+ }
275
+ //]]>
276
  </script>
277
  <?php
278
  }
279
  }
280
 
281
+ if ( ! function_exists( 'aioseop_handle_ignore_notice' ) ) {
282
+
283
  function aioseop_handle_ignore_notice() {
284
 
285
+ if ( ! empty( $_GET ) ) {
286
  global $current_user;
287
  $user_id = $current_user->ID;
288
 
289
+ if ( ! empty( $_GET['aioseop_reset_notices'] ) ) {
290
  delete_user_meta( $user_id, 'aioseop_ignore_notice' );
291
  }
292
+ if ( ! empty( $_GET['aioseop_ignore_notice'] ) ) {
293
  add_user_meta( $user_id, 'aioseop_ignore_notice', $_GET['aioseop_ignore_notice'], false );
294
  }
295
  }
296
  }
297
  }
298
 
299
+ if ( ! function_exists( 'aioseop_output_notice' ) ) {
300
+
301
+ /**
302
+ * @param $message
303
+ * @param string $id
304
+ * @param string $class
305
+ *
306
+ * @return bool
307
+ */
308
+ function aioseop_output_notice( $message, $id = '', $class = 'updated fade' ) {
309
  $class = 'aioseop_notice ' . $class;
310
+ if ( ! empty( $class ) ) {
311
+ $class = ' class="' . esc_attr( $class ) . '"';
312
+ }
313
+ if ( ! empty( $id ) ) {
314
+ $class .= ' id="' . esc_attr( $id ) . '"';
315
+ }
316
  $dismiss = ' ';
317
+ echo "<div{$class}>" . wp_kses_post( $message ) . '<br class=clear /></div>';
318
+
319
  return true;
320
  }
321
  }
322
 
323
+ if ( ! function_exists( 'aioseop_output_dismissable_notice' ) ) {
324
+
325
+ /**
326
+ * @param $message
327
+ * @param string $id
328
+ * @param string $class
329
+ *
330
+ * @return bool
331
+ */
332
+ function aioseop_output_dismissable_notice( $message, $id = '', $class = 'updated fade' ) {
333
  global $current_user;
334
+ if ( ! empty( $current_user ) ) {
335
  $user_id = $current_user->ID;
336
+ $msgid = md5( $message );
337
+ $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' );
338
+ if ( ! empty( $ignore ) && in_array( $msgid, $ignore ) ) {
339
+ return false;
340
+ }
341
  global $wp;
342
  $qa = Array();
343
+ wp_parse_str( $_SERVER['QUERY_STRING'], $qa );
344
  $qa['aioseop_ignore_notice'] = $msgid;
345
+ $url = '?' . build_query( $qa );
346
+ $message = '<p class=alignleft>' . $message . '</p><p class="alignright"><a class="aioseop_dismiss_link" href="' . $url . '">Dismiss</a></p>';
347
  }
348
+
349
  return aioseop_output_notice( $message, $id, $class );
350
  }
351
  }
352
 
353
+ if ( ! function_exists( 'aioseop_ajax_save_meta' ) ) {
354
+
355
  function aioseop_ajax_save_meta() {
356
+ if ( ! empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] !== 'undefined' ) ) {
357
  check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
358
+ }
359
+ $post_id = intval( $_POST['post_id'] );
360
  $new_meta = strip_tags( $_POST['new_meta'] );
361
+ $target = $_POST['target_meta'];
362
  check_ajax_referer( 'aioseop_meta_' . $target . '_' . $post_id, '_nonce' );
363
  $result = '';
364
+ if ( in_array( $target, Array(
365
+ 'title',
366
+ 'description',
367
+ 'keywords',
368
+ ) ) && current_user_can( 'edit_post', $post_id )
369
+ ) {
370
  update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
371
  $result = get_post_meta( $post_id, '_aioseop_' . $target, true );
372
  } else {
373
  die();
374
  }
375
+ if ( $result != '' ):
376
  $label = "<label id='aioseop_label_{$target}_{$post_id}'><span style='width: 20px;display: inline-block;'></span>" . $result . '</label>';
377
  else:
378
  $label = "<label id='aioseop_label_{$target}_{$post_id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __( 'No', 'all-in-one-seo-pack' ) . ' ' . $target . '</i></strong>';
379
  endif;
380
+ $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$post_id}" );
381
  $output = '<a id="' . $target . 'editlink' . $post_id . '" class="aioseop_edit_link" href="javascript:void(0);"'
382
+ . 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">'
383
+ . '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a> ' . $label;
384
+ die( "jQuery('div#aioseop_" . $target . '_' . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . ";
385
+ jQuery('div#aioseop_" . $target . '_' . $post_id . "').html(my_label).fadeIn('fast');
386
  });" );
387
  }
388
  }
389
 
390
+ if ( ! function_exists( 'aioseop_ajax_init' ) ) {
391
+
392
  function aioseop_ajax_init() {
393
+ if ( ! empty( $_POST ) && ! empty( $_POST['settings'] ) && ( ! empty( $_POST['nonce-aioseop'] ) || ( ! empty( $_POST['nonce-aioseop-edit'] ) ) ) && ! empty( $_POST['options'] ) ) {
394
+ $_POST = stripslashes_deep( $_POST );
395
  $settings = esc_attr( $_POST['settings'] );
396
+ if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) ) {
397
+ define( 'AIOSEOP_AJAX_MSG_TMPL', "jQuery('div#aiosp_$settings').fadeOut('fast', function(){jQuery('div#aiosp_$settings').html('%s').fadeIn('fast');});" );
398
+ }
399
 
400
+ if ( ! wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
401
+ die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __( 'Unauthorized access; try reloading the page.', 'all-in-one-seo-pack' ) ) );
402
+ }
403
  } else {
404
+ die( 0 );
405
  }
406
  }
407
  }
408
 
409
+ /**
410
+ * @param $return
411
+ * @param $url
412
+ * @param $attr
413
+ *
414
+ * @return mixed
415
+ */
416
+ function aioseop_embed_handler_html( $return, $url, $attr ) {
417
+ return AIO_ProGeneral::aioseop_embed_handler_html();
418
+ }
419
 
420
+ function aioseop_ajax_update_oembed() {
421
+ AIO_ProGeneral::aioseop_ajax_update_oembed();
422
+ }
423
+
424
+ if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {
425
 
 
426
  function aioseop_ajax_save_url() {
427
  aioseop_ajax_init();
428
  $options = Array();
429
  parse_str( $_POST['options'], $options );
430
+ foreach ( $options as $k => $v ) {
431
+ $_POST[ $k ] = $v;
432
+ }
433
  $_POST['action'] = 'aiosp_update_module';
434
  global $aiosp, $aioseop_modules;
435
  aioseop_load_modules();
436
  $aiosp->admin_menu();
437
+ if ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'video_sitemap_addl_pages' ) ) {
438
+ $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Video_Sitemap' );
439
+ } elseif ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'news_sitemap_addl_pages' ) ) {
440
+ $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_News_Sitemap' );
441
  } else {
442
+ $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' );
443
  }
444
  $_POST['location'] = null;
445
+ $_POST['Submit'] = 'ajax';
446
  $module->add_page_hooks();
447
  $prefix = $module->get_prefix();
448
+ $_POST = $module->get_current_options( $_POST, null );
449
  $module->handle_settings_updates( null );
450
  $options = $module->get_current_options( Array(), null );
451
+ $output = $module->display_custom_options( '', Array(
452
+ 'name' => $prefix . 'addl_pages',
453
+ 'type' => 'custom',
454
+ 'save' => true,
455
+ 'value' => $options[ $prefix . 'addl_pages' ],
456
+ 'attr' => '',
457
+ ) );
458
+ $output = str_replace( "'", "\'", $output );
459
+ $output = str_replace( "\n", '\n', $output );
460
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
461
  }
462
  }
463
 
464
+ if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) {
465
+
466
  function aioseop_ajax_delete_url() {
467
  aioseop_ajax_init();
468
+ $options = Array();
469
+ $options = esc_attr( $_POST['options'] );
470
  $_POST['action'] = 'aiosp_update_module';
471
  global $aiosp, $aioseop_modules;
472
  aioseop_load_modules();
473
  $aiosp->admin_menu();
474
+ $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' );
475
  $_POST['location'] = null;
476
+ $_POST['Submit'] = 'ajax';
477
  $module->add_page_hooks();
478
+ $_POST = (Array) $module->get_current_options( $_POST, null );
479
+ if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && is_object( $_POST['aiosp_sitemap_addl_pages'] ) ) {
480
+ $_POST['aiosp_sitemap_addl_pages'] = (Array) $_POST['aiosp_sitemap_addl_pages'];
481
+ }
482
+ if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( ! empty( $_POST['aiosp_sitemap_addl_pages'][ $options ] ) ) ) {
483
  unset( $_POST['aiosp_sitemap_addl_pages'][ $options ] );
484
+ if ( empty( $_POST['aiosp_sitemap_addl_pages'] ) ) {
485
  $_POST['aiosp_sitemap_addl_pages'] = '';
486
+ } else {
487
  $_POST['aiosp_sitemap_addl_pages'] = json_encode( $_POST['aiosp_sitemap_addl_pages'] );
488
+ }
489
  $module->handle_settings_updates( null );
490
  $options = $module->get_current_options( Array(), null );
491
+ $output = $module->display_custom_options( '', Array(
492
+ 'name' => 'aiosp_sitemap_addl_pages',
493
+ 'type' => 'custom',
494
+ 'save' => true,
495
+ 'value' => $options['aiosp_sitemap_addl_pages'],
496
+ 'attr' => '',
497
+ ) );
498
+ $output = str_replace( "'", "\'", $output );
499
+ $output = str_replace( "\n", '\n', $output );
500
  } else {
501
+ $output = sprintf( __( 'Row %s not found; no rows were deleted.', 'all-in-one-seo-pack' ), esc_attr( $options ) );
502
  }
503
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
504
  }
505
  }
506
 
507
+ if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
508
 
509
  function aioseop_ajax_scan_header() {
510
+ $_POST['options'] = 'foo';
511
  aioseop_ajax_init();
512
  $options = Array();
513
  parse_str( $_POST['options'], $options );
514
+ foreach ( $options as $k => $v ) {
515
+ $_POST[ $k ] = $v;
516
+ }
517
+ $_POST['action'] = 'aiosp_update_module';
518
  $_POST['location'] = null;
519
+ $_POST['Submit'] = 'ajax';
520
  ob_start();
521
+ do_action( 'wp' );
522
  global $aioseop_modules;
523
+ $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' );
524
  wp_head();
525
  $output = ob_get_clean();
526
  global $aiosp;
527
+ $output = $aiosp->html_string_to_array( $output );
528
+ $meta = '';
529
  $metatags = Array(
530
+ 'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
531
+ 'twitter' => Array( 'name' => 'name', 'value' => 'value' ),
532
+ 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' ),
533
  );
534
  $metadata = Array(
535
+ 'facebook' => Array(
536
+ 'title' => 'og:title',
537
+ 'type' => 'og:type',
538
+ 'url' => 'og:url',
539
+ 'thumbnail' => 'og:image',
540
+ 'sitename' => 'og:site_name',
541
+ 'key' => 'fb:admins',
542
+ 'description' => 'og:description',
543
+ ),
544
+ 'google+' => Array(
545
+ 'thumbnail' => 'image',
546
+ 'title' => 'name',
547
+ 'description' => 'description',
548
+ ),
549
+ 'twitter' => Array(
550
+ 'card' => 'twitter:card',
551
+ 'url' => 'twitter:url',
552
+ 'title' => 'twitter:title',
553
+ 'description' => 'twitter:description',
554
+ 'thumbnail' => 'twitter:image',
555
+ ),
556
  );
557
+ if ( ! empty( $output ) && ! empty( $output['head'] ) && ! empty( $output['head']['meta'] ) ) {
558
+ foreach ( $output['head']['meta'] as $v ) {
559
+ if ( ! empty( $v['@attributes'] ) ) {
560
  $m = $v['@attributes'];
561
+ foreach ( $metatags as $type => $tags ) {
562
+ if ( ! empty( $m[ $tags['name'] ] ) && ! empty( $m[ $tags['value'] ] ) ) {
563
+ foreach ( $metadata[ $type ] as $tk => $tv ) {
564
+ if ( $m[ $tags['name'] ] == $tv ) {
565
+ $meta .= "<tr><th style='color:red;'>" . sprintf( __( 'Duplicate %s Meta' ), ucwords( $type ) ) . '</th><td>' . ucwords( $tk ) . "</td><td>{$m[$tags['name']]}</td><td>{$m[$tags['value']]}</td></tr>\n";
566
+ }
567
+ }
568
+ }
569
+ }
570
  }
571
+ }
572
+ }
573
+ if ( empty( $meta ) ) {
574
+ $meta = '<span style="color:green;">' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . '</span>';
575
+ } else {
576
+ $meta = "<table cellspacing=0 cellpadding=0 width=80% class='aioseop_table'><tr class='aioseop_table_header'><th>Meta For Site</th><th>Kind of Meta</th><th>Element Name</th><th>Element Value</th></tr>" . $meta . '</table>';
577
  $meta .= "<p><div class='aioseop_meta_info'><h3 style='padding:5px;margin-bottom:0px;'>" . __( 'What Does This Mean?', 'all-in-one-seo-pack' ) . "</h3><div style='padding:5px;padding-top:0px;'>"
578
+ . '<p>' . __( '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' )
579
+ . '</p><p>' . __( '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' )
580
+ . '</p><p>' . __( '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' ) . '</p>';
581
 
582
+ foreach (
583
+ Array(
584
+ 'https://developers.facebook.com/tools/debug',
585
+ 'http://www.google.com/webmasters/tools/richsnippets',
586
+ 'https://dev.twitter.com/docs/cards/validation/validator',
587
+ ) as $link
588
+ ) {
589
  $meta .= "<a href='{$link}' target='_blank'>{$link}</a><br />";
590
  }
591
+ $meta .= '<p>' . __( 'Please refer to the document for each tool for help in using these to debug your social meta.', 'all-in-one-seo-pack' ) . '</div></div>';
592
  }
593
  $output = $meta;
594
  $output = str_replace( "'", "\'", $output );
597
  }
598
  }
599
 
600
+ if ( ! function_exists( 'aioseop_ajax_save_settings' ) ) {
601
+
602
  function aioseop_ajax_save_settings() {
603
  aioseop_ajax_init();
604
  $options = Array();
605
  parse_str( $_POST['options'], $options );
606
+ $_POST = $options;
607
  $_POST['action'] = 'aiosp_update_module';
608
  global $aiosp, $aioseop_modules;
609
  aioseop_load_modules();
610
  $aiosp->admin_menu();
611
  $module = $aioseop_modules->return_module( $_POST['module'] );
612
  unset( $_POST['module'] );
613
+ if ( empty( $_POST['location'] ) ) {
614
+ $_POST['location'] = null;
615
+ }
616
  $_POST['Submit'] = 'ajax';
617
  $module->add_page_hooks();
618
  $output = $module->handle_settings_updates( $_POST['location'] );
619
 
620
+ if ( AIOSEOPPRO ) {
621
+ $output = '<div id="aioseop_settings_header"><div id="message" class="updated fade"><p>' . $output . '</p></div></div><style>body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { margin-top: 45px !important; }</style>';
622
+ } else {
623
+ $output = '<div id="aioseop_settings_header"><div id="message" class="updated fade"><p>' . $output . '</p></div></div><style>body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { margin-top: 45px !important; }</style>';
624
+ }
625
 
626
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
627
  }
628
  }
629
 
630
+ if ( ! function_exists( 'aioseop_ajax_get_menu_links' ) ) {
631
+
632
  function aioseop_ajax_get_menu_links() {
633
  aioseop_ajax_init();
634
  $options = Array();
635
  parse_str( $_POST['options'], $options );
636
+ $_POST = $options;
637
  $_POST['action'] = 'aiosp_update_module';
638
  global $aiosp, $aioseop_modules;
639
  aioseop_load_modules();
640
  $aiosp->admin_menu();
641
+ if ( empty( $_POST['location'] ) ) {
642
+ $_POST['location'] = null;
643
+ }
644
  $_POST['Submit'] = 'ajax';
645
+ $modlist = $aioseop_modules->get_loaded_module_list();
646
+ $links = Array();
647
+ $link_list = Array();
648
+ $link = $aiosp->get_admin_links();
649
+ if ( ! empty( $link ) ) {
650
+ foreach ( $link as $l ) {
651
+ if ( ! empty( $l ) ) {
652
+ if ( empty( $link_list[ $l['order'] ] ) ) {
653
+ $link_list[ $l['order'] ] = Array();
654
+ }
655
+ $link_list[ $l['order'] ][ $l['title'] ] = $l['href'];
656
  }
657
+ }
658
+ }
659
+ if ( ! empty( $modlist ) ) {
660
+ foreach ( $modlist as $k => $v ) {
661
  $mod = $aioseop_modules->return_module( $v );
662
  if ( is_object( $mod ) ) {
663
  $mod->add_page_hooks();
664
  $link = $mod->get_admin_links();
665
+ foreach ( $link as $l ) {
666
+ if ( ! empty( $l ) ) {
667
+ if ( empty( $link_list[ $l['order'] ] ) ) {
668
+ $link_list[ $l['order'] ] = Array();
669
+ }
670
+ $link_list[ $l['order'] ][ $l['title'] ] = $l['href'];
671
  }
672
+ }
673
  }
674
  }
675
+ }
676
+ if ( ! empty( $link_list ) ) {
677
  ksort( $link_list );
678
+ foreach ( $link_list as $ll ) {
679
+ foreach ( $ll as $k => $v ) {
680
+ $links[ $k ] = $v;
681
+ }
682
+ }
683
+ }
684
+ $output = '<ul>';
685
+ if ( ! empty( $links ) ) {
686
+ foreach ( $links as $k => $v ) {
687
+ if ( $k === 'Feature Manager' ) {
688
  $current = ' class="current"';
689
+ } else {
690
  $current = '';
691
+ }
692
+ $output .= "<li{$current}><a href='" . esc_url( $v ) . "'>" . esc_attr( $k ) . '</a></li>';
693
  }
694
+ }
695
+ $output .= '</ul>';
696
+ die( sprintf( "jQuery('{$_POST['target']}').fadeOut('fast', function(){jQuery('{$_POST['target']}').html('%s').fadeIn('fast');});", addslashes( $output ) ) );
697
  }
698
  }
699
 
700
+ if ( ! function_exists( 'aioseop_mrt_pccolumn' ) ) {
701
+
702
+ /**
703
+ * @param $aioseopcn
704
+ * @param $aioseoppi
705
+ */
706
+ function aioseop_mrt_pccolumn( $aioseopcn, $aioseoppi ) {
707
+ $id = $aioseoppi;
708
  $target = null;
709
+ if ( $aioseopcn === 'seotitle' ) {
710
+ $target = 'title';
711
+ }
712
+ if ( $aioseopcn === 'seokeywords' ) {
713
+ $target = 'keywords';
714
+ }
715
+ if ( $aioseopcn === 'seodesc' ) {
716
+ $target = 'description';
717
+ }
718
+ if ( ! $target ) {
719
+ return;
720
+ }
721
+ if ( current_user_can( 'edit_post', $id ) ) { ?>
722
  <div class="aioseop_mpc_admin_meta_container">
723
+ <div class="aioseop_mpc_admin_meta_options"
724
+ id="aioseop_<?php print $target; ?>_<?php echo $id; ?>"
725
+ style="float:left;">
726
+ <?php $content = strip_tags( stripslashes( get_post_meta( $id, '_aioseop_' . $target, true ) ) );
727
+ if ( ! empty( $content ) ):
728
+ $label = "<label id='aioseop_label_{$target}_{$id}'><span style='width: 20px;display: inline-block;'></span>" . $content . '</label>';
729
+ else:
730
+ $label = "<label id='aioseop_label_{$target}_{$id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __( 'No', 'all-in-one-seo-pack' ) . ' ' . $target . '</i></strong>';
731
+ endif;
732
  $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$id}" );
733
  echo '<a id="' . $target . 'editlink' . $id . '" class="aioseop_edit_link" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
734
+ $id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">'
735
+ . "<img class='aioseop_edit_button'
736
  id='aioseop_edit_id'
737
  src='" . AIOSEOP_PLUGIN_IMAGES_URL . "cog_edit.png' /></a> " . $label;
738
+ ?>
739
  </div>
740
  </div>
741
  <?php }
742
  }
743
  }
744
 
745
+ if ( ! function_exists( 'aioseop_unprotect_meta' ) ) {
746
+
747
+ /**
748
+ * @param $protected
749
+ * @param $meta_key
750
+ * @param $meta_type
751
+ *
752
+ * @return bool
753
+ */
754
  function aioseop_unprotect_meta( $protected, $meta_key, $meta_type ) {
755
+ if ( isset( $meta_key ) && ( substr( $meta_key, 0, 9 ) === '_aioseop_' ) ) {
756
+ return false;
757
+ }
758
+
759
  return $protected;
760
  }
761
  }
762
 
763
+ if ( ! function_exists( 'aioseop_mrt_exclude_this_page' ) ) {
764
+
765
+ /**
766
+ * @param null $url
767
+ *
768
+ * @return bool
769
+ */
770
  function aioseop_mrt_exclude_this_page( $url = null ) {
771
  static $excluded = false;
772
  if ( $excluded === false ) {
773
  global $aioseop_options;
774
  $ex_pages = '';
775
+ if ( isset( $aioseop_options['aiosp_ex_pages'] ) ) {
776
  $ex_pages = trim( $aioseop_options['aiosp_ex_pages'] );
777
+ }
778
+ if ( ! empty( $ex_pages ) ) {
779
  $excluded = explode( ',', $ex_pages );
780
+ if ( ! empty( $excluded ) ) {
781
+ foreach ( $excluded as $k => $v ) {
782
+ $excluded[ $k ] = trim( $v );
783
+ if ( empty( $excluded[ $k ] ) ) {
784
+ unset( $excluded[ $k ] );
785
+ }
786
  }
787
+ }
788
+ if ( empty( $excluded ) ) {
789
+ $excluded = null;
790
+ }
791
  }
792
  }
793
+ if ( ! empty( $excluded ) ) {
794
+ if ( $url === null ) {
795
  $url = $_SERVER['REQUEST_URI'];
796
+ } else {
797
  $url = parse_url( $url );
798
+ if ( ! empty( $url['path'] ) ) {
799
  $url = $url['path'];
800
+ } else {
801
  return false;
802
+ }
803
+ }
804
+ if ( ! empty( $url ) ) {
805
+ foreach ( $excluded as $exedd ) {
806
+ if ( $exedd && ( stripos( $url, $exedd ) !== false ) ) {
807
+ return true;
808
+ }
809
+ }
810
  }
 
 
 
 
811
  }
812
+
813
  return false;
814
  }
815
  }
816
 
817
+ if ( ! function_exists( 'aioseop_get_pages_start' ) ) {
818
+
819
+ /**
820
+ * @param $excludes
821
+ *
822
+ * @return mixed
823
+ */
824
  function aioseop_get_pages_start( $excludes ) {
825
  global $aioseop_get_pages_start;
826
  $aioseop_get_pages_start = 1;
827
+
828
  return $excludes;
829
  }
830
  }
831
 
832
+ if ( ! function_exists( 'aioseop_get_pages' ) ) {
833
+
834
+ /**
835
+ * @param $pages
836
+ *
837
+ * @return mixed
838
+ */
839
  function aioseop_get_pages( $pages ) {
840
  global $aioseop_get_pages_start;
841
+ if ( ! $aioseop_get_pages_start ) {
842
+ return $pages;
843
+ }
844
  foreach ( $pages as $k => $v ) {
845
+ $postID = $v->ID;
846
  $menulabel = stripslashes( get_post_meta( $postID, '_aioseop_menulabel', true ) );
847
+ if ( $menulabel ) {
848
+ $pages[ $k ]->post_title = $menulabel;
849
+ }
850
  }
851
  $aioseop_get_pages_start = 0;
852
+
853
  return $pages;
854
  }
855
  }
856
 
857
  // The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/.
858
+ if ( ! function_exists( 'aioseop_list_pages' ) ) {
859
+ /**
860
+ * Adds stuff to the HTML in list_pages.
861
+ * @TODO See if we still use, or even want, these functions.
862
+ *
863
+ * @param $content
864
+ *
865
+ * @return mixed
866
+ */
867
  function aioseop_list_pages( $content ) {
868
  global $wp_version;
869
  $matches = array();
875
  } else {
876
  $pattern = '@<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">@is';
877
  }
878
+
879
+ return preg_replace_callback( $pattern, 'aioseop_filter_callback', $content );
880
  }
881
+
882
  return $content;
883
  }
884
  }
885
 
886
+ if ( ! function_exists( 'aioseop_filter_callback' ) ) {
887
+
888
+ /**
889
+ * @param $matches
890
+ *
891
+ * @return string
892
+ */
893
  function aioseop_filter_callback( $matches ) {
894
+ if ( $matches[1] && ! empty( $matches[1] ) ) {
895
+ $postID = $matches[1];
896
+ }
897
+ if ( empty( $postID ) ) {
898
+ $postID = get_option( 'page_on_front' );
899
+ }
900
+ $title_attrib = stripslashes( get_post_meta( $postID, '_aioseop_titleatr', true ) );
901
+ if ( empty( $title_attrib ) && ! empty( $matches[4] ) ) {
902
+ $title_attrib = $matches[4];
903
+ }
904
+ if ( ! empty( $title_attrib ) ) {
905
+ $title_attrib = ' title="' . strip_tags( $title_attrib ) . '"';
906
+ }
907
+
908
+ return '<li class="page_item page-item-' . $postID . $matches[2] . '"><a href="' . $matches[3] . '"' . $title_attrib . '>';
909
  }
910
  }
911
 
912
+ if ( ! function_exists( 'aioseop_add_contactmethods' ) ) {
913
+
914
+ /**
915
+ * @param $contactmethods
916
+ *
917
+ * @return mixed
918
+ */
919
  function aioseop_add_contactmethods( $contactmethods ) {
920
  global $aioseop_options, $aioseop_modules;
921
+ if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
922
  $contactmethods['googleplus'] = __( 'Google+', 'all-in-one-seo-pack' );
923
+ }
924
+ if ( ! empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) {
925
  $m = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' );
926
  if ( ( $m !== false ) && is_object( $m ) ) {
927
+ if ( $m->option_isset( 'twitter_creator' ) ) {
928
  $contactmethods['twitter'] = __( 'Twitter', 'all-in-one-seo-pack' );
929
+ }
930
+ if ( $m->option_isset( 'facebook_author' ) ) {
931
  $contactmethods['facebook'] = __( 'Facebook', 'all-in-one-seo-pack' );
932
+ }
933
  }
934
  }
935
+
936
  return $contactmethods;
937
  }
938
  }
939
 
940
+ if ( ! function_exists( 'aioseop_localize_script_data' ) ) {
941
+
942
  function aioseop_localize_script_data() {
943
  static $loaded = 0;
944
+ if ( ! $loaded ) {
945
  $data = apply_filters( 'aioseop_localize_script_data', Array() );
946
  wp_localize_script( 'aioseop-module-script', 'aiosp_data', $data );
947
  $loaded = 1;
949
  }
950
  }
951
 
952
+ if ( ! function_exists( 'aioseop_array_insert_after' ) ) {
953
+ /**
954
+ * Utility function for inserting elements into associative arrays by key.
955
+ *
956
+ * @param $arr
957
+ * @param $insertKey
958
+ * @param $newValues
959
+ *
960
+ * @return array
961
+ */
962
  function aioseop_array_insert_after( $arr, $insertKey, $newValues ) {
963
+ $keys = array_keys( $arr );
964
+ $vals = array_values( $arr );
965
+ $insertAfter = array_search( $insertKey, $keys ) + 1;
966
+ $keys2 = array_splice( $keys, $insertAfter );
967
+ $vals2 = array_splice( $vals, $insertAfter );
968
+ foreach ( $newValues as $k => $v ) {
969
+ $keys[] = $k;
970
+ $vals[] = $v;
971
+ }
972
+
973
+ return array_merge( array_combine( $keys, $vals ), array_combine( $keys2, $vals2 ) );
974
  }
975
  }
976
 
977
+ if ( ! function_exists( 'aioseop_load_json_services' ) ) {
978
+ /**
979
+ * JSON support for PHP < 5.2.
980
+ *
981
+ * @TODO Do we really need to support < PHP 5.2 with the following functions??
982
+ * @return null|Services_JSON
983
+ */
984
  function aioseop_load_json_services() {
985
  static $services_json = null;
986
+ if ( $services_json ) {
987
+ return $services_json;
988
+ }
989
+ if ( ! class_exists( 'Services_JSON' ) ) {
990
+ require_once( 'inc/extlib/JSON.php' );
991
+ }
992
+ if ( ! $services_json ) {
993
+ $services_json = new Services_JSON();
994
+ }
995
+
996
  return $services_json;
997
  }
998
  }
999
 
1000
+ if ( ! function_exists( 'json_encode' ) ) {
1001
+
1002
+ /**
1003
+ * @param $arg
1004
+ *
1005
+ * @return mixed
1006
+ */
1007
  function json_encode( $arg ) {
1008
  $services_json = aioseop_load_json_services();
1009
+
1010
  return $services_json->encode( $arg );
1011
  }
1012
  }
1013
 
1014
+ if ( ! function_exists( 'json_decode' ) ) {
1015
+
1016
+ /**
1017
+ * @param $arg
1018
+ *
1019
+ * @return mixed
1020
+ */
1021
  function json_decode( $arg ) {
1022
  $services_json = aioseop_load_json_services();
1023
+
1024
  return $services_json->decode( $arg );
1025
  }
1026
  }
1027
 
1028
+ if ( ! function_exists( 'fnmatch' ) ) {
1029
+ /**
1030
+ * Support for fnmatch() doesn't exist on Windows pre PHP 5.3.
1031
+ *
1032
+ * @param $pattern
1033
+ * @param $string
1034
+ *
1035
+ * @return int
1036
+ */
1037
+ function fnmatch( $pattern, $string ) {
1038
+ return preg_match( '#^' . strtr( preg_quote( $pattern, '#' ), array(
1039
+ '\*' => '.*',
1040
+ '\?' => '.',
1041
+ ) ) . "$#i", $string );
1042
+ }
1043
  }
1044
 
1045
+ if ( ! function_exists( 'parse_ini_string' ) ) {
1046
+ /**
1047
+ * Parse_ini_string() doesn't exist pre PHP 5.3.
1048
+ *
1049
+ * @param $string
1050
+ * @param $process_sections
1051
+ *
1052
+ * @return array|bool
1053
+ */
1054
  function parse_ini_string( $string, $process_sections ) {
1055
+
1056
+ if ( ! class_exists( 'parse_ini_filter' ) ) {
1057
+
1058
+ /**
1059
+ * Class parse_ini_filter
1060
+ *
1061
+ * Define our filter class.
1062
+ */
1063
  class parse_ini_filter extends php_user_filter {
1064
  static $buf = '';
1065
+
1066
+ /**
1067
+ * The actual filter for parsing.
1068
+ *
1069
+ * @param $in
1070
+ * @param $out
1071
+ * @param $consumed
1072
+ * @param $closing
1073
+ *
1074
+ * @return int
1075
+ */
1076
  function filter( $in, $out, &$consumed, $closing ) {
1077
+ $bucket = stream_bucket_new( fopen( 'php://memory', 'wb' ), self::$buf );
1078
  stream_bucket_append( $out, $bucket );
1079
+
1080
  return PSFS_PASS_ON;
1081
  }
1082
  }
1083
+
1084
+ // Register our filter with PHP.
1085
+ if ( ! stream_filter_register( 'parse_ini', 'parse_ini_filter' ) ) {
1086
  return false;
1087
+ }
1088
  }
1089
  parse_ini_filter::$buf = $string;
1090
+
1091
+ return parse_ini_file( 'php://filter/read=parse_ini/resource=php://memory', $process_sections );
1092
  }
1093
  }
1094
 
1095
+ function aioseop_update_user_visibilitynotice() {
1096
 
1097
  update_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
1098
+ }
1099
 
1100
+ function aioseop_update_yst_detected_notice() {
 
 
1101
 
1102
  update_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
1103
+ }
1104
 
1105
+ function aioseop_woo_upgrade_notice_dismissed() {
 
 
1106
 
1107
  update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
1108
+ }
 
inc/aioseop_updates_class.php CHANGED
@@ -1,176 +1,212 @@
1
- <?php
2
- /**
3
- * @package All-in-One-SEO-Pack
4
- */
5
-
6
- /**
7
- * AIOSEOP Updates class.
8
- *
9
- * Handle detection of new plugin version updates, migration of old settings,
10
- * new WP core feature support, etc.
11
- */
12
- class aioseop_updates {
13
- /**
14
- * Constructor
15
- */
16
- function __construct() {
17
- }
18
-
19
- function version_updates() {
20
- global $aiosp, $aioseop_options;
21
- if ( empty( $aioseop_options ) ) {
22
- $aioseop_options = get_option( $aioseop_options );
23
- if ( empty( $aioseop_options ) ) {
24
- // something's wrong. bail.
25
- return;
26
- }
27
- }
28
-
29
- // Last known running plugin version
30
- $last_active_version = isset( $aioseop_options['last_active_version'] ) ? $aioseop_options['last_active_version'] : '0.0';
31
-
32
- // See if we are running a newer version than last time we checked.
33
- if ( version_compare( $last_active_version, AIOSEOP_VERSION, '<' ) ) {
34
-
35
- // Do upgrades based on previous version
36
- $this->do_version_updates( $last_active_version );
37
-
38
- // If we're running Pro, let the Pro updater set the version.
39
- if ( !AIOSEOPPRO ) {
40
- // Save the current plugin version as the new last_active_version
41
- $aioseop_options['last_active_version'] = AIOSEOP_VERSION;
42
- $aiosp->update_class_option( $aioseop_options );
43
- }
44
- }
45
-
46
- /**
47
- * Perform updates that are dependent on external factors, not
48
- * just the plugin version.
49
- */
50
- $this->do_feature_updates();
51
-
52
- }
53
-
54
- //TODO: the compare here should be extracted into a function
55
- function do_version_updates( $old_version ) {
56
- global $aioseop_options;
57
-
58
- if (
59
- ( !AIOSEOPPRO && version_compare( $old_version, '2.3.3', '<' ) ) ||
60
- ( AIOSEOPPRO && version_compare( $old_version, '2.4.3', '<' ) )
61
- ) {
62
- $this->bad_bots_201603();
63
- }
64
-
65
- if (
66
- ( !AIOSEOPPRO && version_compare( $old_version, '2.3.4.1', '<' ) ) ||
67
- ( AIOSEOPPRO && version_compare( $old_version, '2.4.4.1', '<' ) )
68
- ) {
69
- $this->bad_bots_remove_yandex_201604();
70
- }
71
-
72
-
73
- /*
74
- if (
75
- ( !AIOSEOPPRO && version_compare( $old_version, '2.4', '<' ) ) ||
76
- ( AIOSEOPPRO && version_compare( $old_version, '2.5', '<' ) )
77
- ) {
78
- // Do changes needed for 2.4/2.5... etc
79
- }
80
- */
81
- }
82
-
83
- function do_feature_updates() {
84
- global $aioseop_options;
85
-
86
- // We don't need to check all the time. Use a transient to limit frequency.
87
- if ( get_site_transient( 'aioseop_update_check_time' ) ) return;
88
-
89
- // If we're running Pro, let the Pro updater set the transient.
90
- if ( !AIOSEOPPRO ) {
91
- // We haven't checked recently. Reset the timestamp, timeout 6 hours.
92
- set_site_transient( 'aioseop_update_check_time', time(), apply_filters( 'aioseop_update_check_time', 3600 * 6 ) );
93
- }
94
-
95
- /*
96
- if ( ! ( isset( $aioseop_options['version_feature_flags']['FEATURE_NAME'] ) &&
97
- $aioseop_options['version_feature_flags']['FEATURE_NAME'] === 'yes' ) ) {
98
- $this->some_feature_update_method(); // sets flag to 'yes' on completion.
99
- }
100
- */
101
- }
102
-
103
- /*
104
- * Functions for specific version milestones
105
- */
106
-
107
- /**
108
- * Remove overzealous 'DOC' entry which is causing false-positive bad
109
- * bot blocking.
110
- *
111
- * @since 2.3.3
112
- *
113
- */
114
- function bad_bots_201603() {
115
- global $aiosp, $aioseop_options;
116
- // Remove 'DOC' from bad bots list to avoid false positives
117
- if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
118
- $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
119
- $list = str_replace(array( "DOC\r\n", "DOC\n"), '', $list);
120
- $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
121
- update_option( 'aioseop_options', $aioseop_options );
122
- $aiosp->update_class_option( $aioseop_options );
123
-
124
- 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'] ){
125
-
126
- if (!class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
127
- require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php');
128
- require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php');
129
- }
130
-
131
- $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
132
- $aiosp_reset_htaccess->generate_htaccess_blocklist();
133
- }
134
-
135
- if ( !isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ){
136
- insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
137
- }
138
- }
139
- }
140
-
141
- /**
142
- * Remove 'yandex' entry. This is a major Russian search engine, and no longer needs to be blocked.
143
- *
144
- * @since 2.3.4.1
145
- *
146
- **/
147
-
148
- function bad_bots_remove_yandex_201604() {
149
- global $aiosp, $aioseop_options;
150
- // Remove 'yandex' from bad bots list to avoid false positives
151
- if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
152
- $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
153
- $list = str_replace(array( "yandex\r\n", "yandex\n"), '', $list);
154
- $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
155
- update_option( 'aioseop_options', $aioseop_options );
156
- $aiosp->update_class_option( $aioseop_options );
157
-
158
- 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'] ){
159
-
160
- if (!class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
161
- require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php');
162
- require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php');
163
- }
164
-
165
- $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
166
- $aiosp_reset_htaccess->generate_htaccess_blocklist();
167
- }
168
-
169
- if ( !isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ){
170
- insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
171
- }
172
- }
173
- }
174
-
175
-
176
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handles detection of new plugin version updates.
5
+ *
6
+ * Handles detection of new plugin version updates, migration of old settings,
7
+ * new WP core feature support, etc.
8
+ * AIOSEOP Updates class.
9
+ *
10
+ * @package All-in-One-SEO-Pack.
11
+ * @version 1.0.0
12
+ */
13
+ class AIOSEOP_Updates {
14
+
15
+ /**
16
+ * Constructor
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ function __construct() {
21
+ }
22
+
23
+ /**
24
+ * Updates version.
25
+ *
26
+ * @since 1.0.0
27
+ * @global $aiosp , $aioseop_options.
28
+ * @return null
29
+ */
30
+ function version_updates() {
31
+ global $aiosp, $aioseop_options;
32
+ if ( empty( $aioseop_options ) ) {
33
+ $aioseop_options = get_option( $aioseop_options );
34
+ if ( empty( $aioseop_options ) ) {
35
+ // Something's wrong. bail.
36
+ return;
37
+ }
38
+ }
39
+
40
+ // Last known running plugin version.
41
+ $last_active_version = '0.0';
42
+ if ( isset( $aioseop_options['last_active_version'] ) ) {
43
+ $last_active_version = $aioseop_options['last_active_version'];
44
+ }
45
+
46
+ // Compares version to see which one is the newer.
47
+ if ( version_compare( $last_active_version, AIOSEOP_VERSION, '<' ) ) {
48
+
49
+ // Upgrades based on previous version.
50
+ do_action( 'before_doing_aioseop_updates' );
51
+ $this->do_version_updates( $last_active_version );
52
+ do_action( 'after_doing_aioseop_updates' );
53
+ // If we're running Pro, let the Pro updater set the version.
54
+ if ( ! AIOSEOPPRO ) {
55
+
56
+ // Save the current plugin version as the new last_active_version.
57
+ $aioseop_options['last_active_version'] = AIOSEOP_VERSION;
58
+ $aiosp->update_class_option( $aioseop_options );
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Perform updates that are dependent on external factors, not
64
+ * just the plugin version.
65
+ */
66
+ $this->do_feature_updates();
67
+ }
68
+
69
+
70
+ /**
71
+ * Updates version.
72
+ *
73
+ * TODO: the compare here should be extracted into a function
74
+ *
75
+ * @since 1.0.0
76
+ * @global $aioseop_options .
77
+ *
78
+ * @param String $old_version
79
+ */
80
+ function do_version_updates( $old_version ) {
81
+ global $aioseop_options;
82
+ if (
83
+ ( ! AIOSEOPPRO && version_compare( $old_version, '2.3.3', '<' ) ) ||
84
+ ( AIOSEOPPRO && version_compare( $old_version, '2.4.3', '<' ) )
85
+ ) {
86
+ $this->bad_bots_201603();
87
+ }
88
+
89
+ if (
90
+ ( ! AIOSEOPPRO && version_compare( $old_version, '2.3.4.1', '<' ) ) ||
91
+ ( AIOSEOPPRO && version_compare( $old_version, '2.4.4.1', '<' ) )
92
+ ) {
93
+ $this->bad_bots_remove_yandex_201604();
94
+ }
95
+
96
+ }
97
+
98
+ /**
99
+ * Removes overzealous 'DOC' entry which is causing false-positive bad
100
+ * bot blocking.
101
+
102
+ * @since 2.3.3
103
+ * @global $aiosp , $aioseop_options.
104
+ */
105
+ function bad_bots_201603() {
106
+ global $aiosp, $aioseop_options;
107
+
108
+ // Remove 'DOC' from bad bots list to avoid false positives.
109
+ if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
110
+ $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
111
+ $list = str_replace( array(
112
+ "DOC\r\n",
113
+ "DOC\n",
114
+ ), '', $list );
115
+ $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
116
+ update_option( 'aioseop_options', $aioseop_options );
117
+ $aiosp->update_class_option( $aioseop_options );
118
+ if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
119
+ && 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules']
120
+ ) {
121
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
122
+ require_once(
123
+ AIOSEOP_PLUGIN_DIR .
124
+ 'admin/aioseop_module_class.php'
125
+ );
126
+ require_once(
127
+ AIOSEOP_PLUGIN_DIR .
128
+ 'modules/aioseop_bad_robots.php'
129
+ );
130
+ }
131
+ $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
132
+ $aiosp_reset_htaccess->generate_htaccess_blocklist();
133
+ }
134
+ if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
135
+ && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' )
136
+ ) {
137
+ insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
138
+ }
139
+ }
140
+ }
141
+
142
+ /*
143
+ * Functions for specific version milestones.
144
+ */
145
+
146
+ /**
147
+ * Remove 'yandex' entry. This is a major Russian search engine, and no longer needs to be blocked.
148
+ *
149
+ * @since 2.3.4.1
150
+ * @global $aiosp , $aioseop_options.
151
+ */
152
+ function bad_bots_remove_yandex_201604() {
153
+ global $aiosp, $aioseop_options;
154
+
155
+ // Remove 'yandex' from bad bots list to avoid false positives.
156
+ if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
157
+ $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
158
+ $list = str_replace( array(
159
+ "yandex\r\n",
160
+ "yandex\n",
161
+ ), '', $list );
162
+ $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
163
+ update_option( 'aioseop_options', $aioseop_options );
164
+ $aiosp->update_class_option( $aioseop_options );
165
+
166
+ 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'] ) {
167
+
168
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
169
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' );
170
+ require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php' );
171
+ }
172
+
173
+ $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
174
+ $aiosp_reset_htaccess->generate_htaccess_blocklist();
175
+ }
176
+
177
+ if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ) {
178
+ insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
179
+ }
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Updates features.
185
+
186
+ * @since 1.0.0
187
+ * @return null
188
+ *
189
+ * if ( ! ( isset( $aioseop_options['version_feature_flags']['FEATURE_NAME'] ) &&
190
+ * $aioseop_options['version_feature_flags']['FEATURE_NAME'] === 'yes' ) ) {
191
+ * $this->some_feature_update_method(); // sets flag to 'yes' on completion.
192
+ */
193
+ public function do_feature_updates() {
194
+ global $aioseop_options;
195
+
196
+ // We don't need to check all the time. Use a transient to limit frequency.
197
+ if ( get_site_transient( 'aioseop_update_check_time' ) ) {
198
+ return;
199
+ }
200
+
201
+ // If we're running Pro, let the Pro updater set the transient.
202
+ if ( ! AIOSEOPPRO ) {
203
+
204
+ // We haven't checked recently. Reset the timestamp, timeout 6 hours.
205
+ set_site_transient(
206
+ 'aioseop_update_check_time',
207
+ time(),
208
+ apply_filters( 'aioseop_update_check_time', 3600 * 6 )
209
+ );
210
+ }
211
+ }
212
+ }
inc/aiosp_common.php CHANGED
@@ -3,55 +3,85 @@
3
  /**
4
  * @package All-in-One-SEO-Pack
5
  */
6
-
7
  class aiosp_common {
8
-
9
- function __construct(){
 
 
 
 
 
 
 
10
  //construct
11
  }
12
-
13
-
 
 
 
 
 
14
  static function get_blog_page( $p = null ) {
15
  static $blog_page = '';
16
  static $page_for_posts = '';
17
- if ( $p === null ) {
18
  global $post;
19
  } else {
20
  $post = $p;
21
  }
22
- if ( $blog_page === '' ) {
23
- if ( $page_for_posts === '' ) $page_for_posts = get_option( 'page_for_posts' );
24
- if ( $page_for_posts && is_home() && ( !is_object( $post ) || ( $page_for_posts != $post->ID ) ) )
 
 
25
  $blog_page = get_post( $page_for_posts );
 
26
  }
 
27
  return $blog_page;
28
  }
29
-
30
- static function get_upgrade_hyperlink( $location = '', $title = '', $anchor = '', $target = '', $class = '', $id = '' ){
31
-
 
 
 
 
 
 
 
 
 
 
32
  $affiliate_id = '';
33
-
34
- //call during plugins_loaded
35
- $affiliate_id = apply_filters( 'aiosp_aff_id' , $affiliate_id );
36
 
 
 
37
 
38
  //build URL
39
  $url = 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/';
40
- if( $location ) $url .= '?loc=' . $location;
41
- if( $affiliate_id ) $url .= "?ap_id=$affiliate_id";
42
-
43
-
44
- //build hyperlink
 
 
 
45
  $hyperlink = '<a ';
46
- if( $target ) $hyperlink .= "target=\"$target\" ";
47
- if( $title ) $hyperlink .= "title=\"$title\" ";
 
 
 
 
48
  $hyperlink .= "href=\"$url\">$anchor</a>";
49
 
50
  return $hyperlink;
51
  }
52
-
53
- static function get_upgrade_url(){
54
  //put build URL stuff in here
55
  }
56
-
57
- }
3
  /**
4
  * @package All-in-One-SEO-Pack
5
  */
 
6
  class aiosp_common {
7
+
8
+ /**
9
+ * aiosp_common constructor.
10
+ *
11
+ * These are commonly used functions that can be pulled from anywhere.
12
+ * (or in some cases they're functions waiting for a home)
13
+ *
14
+ */
15
+ function __construct() {
16
  //construct
17
  }
18
+
19
+
20
+ /**
21
+ * @param null $p
22
+ *
23
+ * @return array|null|string|WP_Post
24
+ */
25
  static function get_blog_page( $p = null ) {
26
  static $blog_page = '';
27
  static $page_for_posts = '';
28
+ if ( null === $p ) {
29
  global $post;
30
  } else {
31
  $post = $p;
32
  }
33
+ if ( '' === $blog_page ) {
34
+ if ( '' === $page_for_posts ) {
35
+ $page_for_posts = get_option( 'page_for_posts' );
36
+ }
37
+ if ( $page_for_posts && is_home() && ( ! is_object( $post ) || ( $page_for_posts !== $post->ID ) ) ) {
38
  $blog_page = get_post( $page_for_posts );
39
+ }
40
  }
41
+
42
  return $blog_page;
43
  }
44
+
45
+ /**
46
+ * @param string $location
47
+ * @param string $title
48
+ * @param string $anchor
49
+ * @param string $target
50
+ * @param string $class
51
+ * @param string $id
52
+ *
53
+ * @return string
54
+ */
55
+ static function get_upgrade_hyperlink( $location = '', $title = '', $anchor = '', $target = '', $class = '', $id = '' ) {
56
+
57
  $affiliate_id = '';
 
 
 
58
 
59
+ //call during plugins_loaded
60
+ $affiliate_id = apply_filters( 'aiosp_aff_id', $affiliate_id );
61
 
62
  //build URL
63
  $url = 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/';
64
+ if ( $location ) {
65
+ $url .= '?loc=' . $location;
66
+ }
67
+ if ( $affiliate_id ) {
68
+ $url .= "?ap_id=$affiliate_id";
69
+ }
70
+
71
+ //build hyperlink
72
  $hyperlink = '<a ';
73
+ if ( $target ) {
74
+ $hyperlink .= "target=\"$target\" ";
75
+ }
76
+ if ( $title ) {
77
+ $hyperlink .= "title=\"$title\" ";
78
+ }
79
  $hyperlink .= "href=\"$url\">$anchor</a>";
80
 
81
  return $hyperlink;
82
  }
83
+
84
+ static function get_upgrade_url() {
85
  //put build URL stuff in here
86
  }
87
+ }
 
inc/commonstrings.php CHANGED
@@ -1,38 +1,41 @@
1
  <?php
 
 
 
 
 
 
 
2
 
3
- class aiosp_common_strings {
4
 
5
- function __construct( ){
6
-
7
- //video sitemap strings
8
- __( 'Video Sitemap', 'all-in-one-seo-pack' );
9
- __( 'Show Only Posts With Videos', 'all-in-one-seo-pack' );
10
- __( 'Scan Posts For Videos', 'all-in-one-seo-pack' );
11
- __( 'Restrict Access to Video Sitemap', 'all-in-one-seo-pack' );
12
- __( 'Press the Scan button to scan your posts for videos! Do this if video content from a post or posts is not showing up in your sitemap.', 'all-in-one-seo-pack' );
13
- __( 'If checked, only posts that have videos in them will be displayed on the sitemap.', 'all-in-one-seo-pack' );
14
- __( 'Enable this option to only allow access to your sitemap by site administrators and major search engines.', 'all-in-one-seo-pack' );
15
- __( 'You do not have access to this page; try logging in as an administrator.' , 'all-in-one-seo-pack' );
16
- __( 'Scan', 'all-in-one-seo-pack' );
17
-
18
- //functions_class strings
19
- __( 'Finished scanning posts', 'all-in-one-seo-pack' );
20
-
21
- //update checker strings (incomplete... need to separate out html)
22
- __( 'Purchase one now', 'all-in-one-seo-pack' );
23
- __( 'License Key is not set yet or invalid. ', 'all-in-one-seo-pack' );
24
- __( ' Need a license key?', 'all-in-one-seo-pack' );
25
- __("Notice: ", 'all-in-one-seo-pack' );
26
- __( 'Manage Licenses', 'all-in-one-seo-pack' );
27
-
28
-
29
-
30
- }
31
-
32
-
33
 
34
-
35
 
 
 
 
 
 
 
 
 
 
 
36
 
 
 
37
 
 
 
 
 
 
 
38
  }
 
1
  <?php
2
+ /**
3
+ * Class AIOSP_Common_Strings
4
+ *
5
+ * This is just for Pro strings to be translated.
6
+ *
7
+ * @package All-in-One-SEO-Pack
8
+ */
9
 
10
+ class AIOSP_Common_Strings {
11
 
12
+ /**
13
+ * AIOSP_Common_Strings constructor.
14
+ *
15
+ * We'll just put all the strings in the contruct for lack of a better.
16
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
+ private function __construct() {
19
 
20
+ // Video sitemap strings.
21
+ __( 'Video Sitemap', 'all-in-one-seo-pack' );
22
+ __( 'Show Only Posts With Videos', 'all-in-one-seo-pack' );
23
+ __( 'Scan Posts For Videos', 'all-in-one-seo-pack' );
24
+ __( 'Restrict Access to Video Sitemap', 'all-in-one-seo-pack' );
25
+ __( 'Press the Scan button to scan your posts for videos! Do this if video content from a post or posts is not showing up in your sitemap.', 'all-in-one-seo-pack' );
26
+ __( 'If checked, only posts that have videos in them will be displayed on the sitemap.', 'all-in-one-seo-pack' );
27
+ __( 'Enable this option to only allow access to your sitemap by site administrators and major search engines.', 'all-in-one-seo-pack' );
28
+ __( 'You do not have access to this page; try logging in as an administrator.', 'all-in-one-seo-pack' );
29
+ __( 'Scan', 'all-in-one-seo-pack' );
30
 
31
+ // These are functions_class strings.
32
+ __( 'Finished scanning posts', 'all-in-one-seo-pack' );
33
 
34
+ // Update checker strings (incomplete... need to separate out html).
35
+ __( 'Purchase one now', 'all-in-one-seo-pack' );
36
+ __( 'License Key is not set yet or invalid. ', 'all-in-one-seo-pack' );
37
+ __( ' Need a license key?', 'all-in-one-seo-pack' );
38
+ __( 'Notice: ', 'all-in-one-seo-pack' );
39
+ __( 'Manage Licenses', 'all-in-one-seo-pack' );
40
  }
41
+ }
inc/compatability/compat-init.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Initiates compatibility code with other plugins/themes
4
+ *
5
+ * Eventually we'll have subclasses for each.
6
+ *
7
+ * @package All-in-One-SEO-Pack
8
+ * @since 2.3.6
9
+ */
10
+
11
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Compatibility' ) ) {
12
+
13
+ /**
14
+ * Class All_in_One_SEO_Pack_Compatibility
15
+ *
16
+ * @since 2.3.6
17
+ */
18
+ class All_in_One_SEO_Pack_Compatibility {
19
+
20
+ /**
21
+ * All_in_One_SEO_Pack_Compatibility constructor.
22
+ *
23
+ * @since 2.3.6
24
+ */
25
+ public function __construct() {
26
+
27
+ $this->load_compatibility_classes();
28
+
29
+ }
30
+
31
+ /**
32
+ * Load Compatibility Hooks.
33
+ *
34
+ * @since 2.3.6
35
+ */
36
+ public function load_compatibility_hooks() {
37
+ // We'll use this until we set up our classes.
38
+ if ( class_exists( 'jetpack' ) ) {
39
+ add_filter( 'jetpack_get_available_modules', array( $this, 'remove_jetpack_sitemap' ) );
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Remove Jetpack's sitemap.
45
+ *
46
+ * @param array $modules All the Jetpack modules.
47
+ *
48
+ * @since 2.3.6
49
+ * @since 2.3.6.1 Make sure we only disable Jetpack's sitemap if they're using ours.
50
+ *
51
+ * @return array
52
+ */
53
+ public function remove_jetpack_sitemap( $modules ) {
54
+
55
+ global $aioseop_options;
56
+ // Check if AIOSEOP's sitemap exists.
57
+ 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' ) {
58
+ unset( $modules['sitemaps'] ); // Remove Jetpack's sitemap.
59
+ }
60
+
61
+ return $modules;
62
+ }
63
+
64
+ /**
65
+ * Load Compatibility classes.
66
+ *
67
+ * @since 2.3.6
68
+ */
69
+ public function load_compatibility_classes() {
70
+ // Eventually we'll load our other classes from here.
71
+ $this->load_compatibility_hooks();
72
+ }
73
+ }
74
+
75
+ }
76
+
77
+ $aiosp_compat = new All_in_One_SEO_Pack_Compatibility();
inc/deprecated.php CHANGED
@@ -1,46 +1,53 @@
1
  <?php
2
 
 
 
 
3
  function oauth_init() {
4
- if ( !is_user_logged_in() || !current_user_can( 'aiosp_manage_seo' ) ) return false;
5
- $this->token = "anonymous";
6
- $this->secret = "anonymous";
7
- $preload = $this->get_class_option();
8
- $manual_ua = '';
9
- if ( !empty( $_POST ) ) {
10
- if ( !empty( $_POST["{$this->prefix}google_connect"] ) ) {
 
 
11
  $manual_ua = 1;
12
  }
13
- } elseif ( !empty( $preload["{$this->prefix}google_connect"] ) ) {
14
  $manual_ua = 1;
15
  }
16
- if ( !empty( $manual_ua ) ) {
17
- foreach ( Array( "token", "secret", "access_token", "ga_token", "account_cache" ) as $v ) {
18
- if ( !empty( $preload["{$this->prefix}{$v}"]) ) {
19
- unset( $preload["{$this->prefix}{$v}"] );
20
- unset( $this->$v );
21
- }
22
  }
23
- $this->update_class_option( $preload );
24
- $this->update_options( );
25
- // return;
 
26
  }
27
- foreach ( Array( "token", "secret", "access_token", "ga_token", "account_cache" ) as $v ) {
28
- if ( !empty( $preload["{$this->prefix}{$v}"]) ) {
29
- $this->$v = $preload["{$this->prefix}{$v}"];
30
  }
31
  }
32
- $callback_url = NULL;
33
- if ( !empty( $_REQUEST['oauth_verifier'] ) ) {
34
  $this->verifier = $_REQUEST['oauth_verifier'];
35
- if ( !empty( $_REQUEST['oauth_token'] ) ) {
36
- if ( isset( $this->token ) && $this->token == $_REQUEST['oauth_token'] ) {
37
  $this->access_token = $this->oauth_get_token( $this->verifier );
38
- if ( is_array( $this->access_token ) && !empty( $this->access_token['oauth_token'] ) ) {
39
  unset( $this->token );
40
  unset( $this->secret );
41
  $this->ga_token = $this->access_token['oauth_token'];
42
- foreach ( Array( "token", "secret", "access_token", "ga_token" ) as $v ) {
43
- if ( !empty( $this->$v) ) $preload["{$this->prefix}{$v}"] = $this->$v;
 
 
44
  }
45
  $this->update_class_option( $preload );
46
  }
@@ -49,49 +56,56 @@ function oauth_init() {
49
  exit;
50
  }
51
  }
52
- if ( !empty( $this->ga_token ) ) {
53
- if ( !empty( $this->account_cache ) ) {
54
- $ua = $this->account_cache['ua'];
55
  $profiles = $this->account_cache['profiles'];
56
  } else {
57
- $this->token = $this->access_token['oauth_token'];
58
  $this->secret = $this->access_token['oauth_token_secret'];
59
 
60
- $data = $this->oauth_get_data('https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' );
61
 
62
  $http_code = wp_remote_retrieve_response_code( $data );
63
 
64
- if( $http_code == 200 ) {
65
  $response = wp_remote_retrieve_body( $data );
66
- $xml = $this->xml_string_to_array( $response );
67
- $ua = Array();
68
- $profiles = Array();
69
- if ( !empty( $xml["entry"] ) ) {
70
- $rec = Array();
71
- $results = Array();
72
- if ( !empty( $xml["entry"][0] ) )
73
- $results = $xml["entry"];
74
- else
75
- $results[] = $xml["entry"];
76
- foreach( $results as $r ) {
77
- foreach( $r as $k => $v )
78
- switch( $k ) {
79
- case 'id': $rec['id'] = $v; break;
80
- case 'title': $rec['title'] = $v['@content']; break;
 
 
 
 
 
81
  case 'dxp:property':
82
- $attr = Array();
83
- foreach ( $v as $a => $f )
84
- if ( is_array($f) && !empty($f['@attributes'] ) )
85
- $rec[$f['@attributes']['name']] = $f['@attributes']['value'];
86
- break;
 
 
87
  }
88
- $ua[$rec['title']] = Array( $rec['ga:webPropertyId'] => $rec['ga:webPropertyId'] );
89
  $profiles[ $rec['ga:webPropertyId'] ] = $rec['ga:profileId'];
90
  }
91
  }
92
- $this->account_cache = Array();
93
- $this->account_cache['ua'] = $ua;
94
- $this->account_cache['profiles'] = $profiles;
95
  $preload["{$this->prefix}account_cache"] = $this->account_cache;
96
  } else {
97
  unset( $this->token );
@@ -99,116 +113,173 @@ function oauth_init() {
99
  unset( $this->ga_token );
100
  unset( $preload["{$this->prefix}ga_token"] ); // error condition here -- pdb
101
  $response = wp_remote_retrieve_body( $data );
102
- $xml = $this->xml_string_to_array( $response );
103
- if ( !empty( $xml ) && !empty( $xml["error"] ) ) {
104
  $error = 'Error: ';
105
- if ( !empty( $xml["error"]["internalReason"] ) ) {
106
- $error .= $xml["error"]["internalReason"];
107
  } else {
108
- foreach( $xml["error"] as $k => $v )
109
  $error .= "$k: $v\n";
 
110
  }
111
  $this->output_error( $error );
112
  }
113
  }
114
  }
115
  }
116
- if ( !empty( $this->ga_token ) ) {
117
- $this->default_options["google_analytics_id"]['type'] = 'select';
118
- $this->default_options["google_analytics_id"]['initial_options'] = $ua;
119
- $this->default_options["google_connect"]["type"] = 'html';
120
- $this->default_options["google_connect"]["nolabel"] = 1;
121
- $this->default_options["google_connect"]["save"] = true;
122
- $this->default_options["google_connect"]["name"] = __( 'Disconnect From Google Analytics', 'all-in-one-seo-pack' );
123
- $this->default_options["google_connect"]["default"] = "<input name='aiosp_google_connect' type=submit class='button-primary' value='" . __( 'Remove Stored Credentials', 'all-in-one-seo-pack' ) . "'>";
124
  add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 );
125
  } else {
126
- $this->default_options["google_connect"]["type"] = 'html';
127
- $this->default_options["google_connect"]["nolabel"] = 1;
128
- $this->default_options["google_connect"]["save"] = false;
129
- $url = $this->oauth_connect();
130
- $this->default_options["google_connect"]["default"] = "<a href='{$url}' class='button-primary'>" . __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ) . "</a>";
131
- foreach ( Array( "token", "secret", "access_token", "ga_token", "account_cache" ) as $v ) {
132
- if ( !empty( $this->$v) ) $preload["{$this->prefix}{$v}"] = $this->$v;
 
 
133
  }
134
  }
135
  $this->update_class_option( $preload );
136
- $this->update_options( );
137
  // $url = $this->report_query();
138
- 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"] ] ) ) {
139
- $this->profile_id = $this->account_cache["profiles"][ $this->options["{$this->prefix}google_analytics_id"] ];
140
  }
141
  }
142
 
 
 
 
 
 
 
143
  function oauth_get_data( $oauth_url, $args = null ) {
144
- if ( !class_exists( 'OAuthConsumer' ) ) require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
145
- 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' ) );
 
 
 
 
 
 
 
146
  $req_token = new OAuthConsumer( $this->token, $this->secret );
147
- $req = $this->oauth_get_creds( $oauth_url, $req_token, $args );
 
148
  return wp_remote_get( $req->to_url() );
149
  }
150
 
151
- function oauth_get_creds( $oauth_url, $req_token = NULL, $args = Array(), $callback = null ) {
152
- if ( !class_exists( 'OAuthConsumer' ) ) require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
153
- if ( !empty( $callback ) ) $args['oauth_callback'] = $callback;
154
- if ( empty( $this->sig_method ) ) $this->sig_method = new OAuthSignatureMethod_HMAC_SHA1();
155
- if ( empty( $this->consumer ) ) $this->consumer = new OAuthCOnsumer( 'anonymous', 'anonymous' );
156
- $req_req = OAuthRequest::from_consumer_and_token( $this->consumer, $req_token, "GET", $oauth_url, $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  $req_req->sign_request( $this->sig_method, $this->consumer, $req_token );
 
158
  return $req_req;
159
  }
160
 
 
 
 
 
 
161
  function oauth_get_token( $oauth_verifier ) {
162
- if ( !class_exists( 'OAuthConsumer' ) ) require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
163
- $args = Array( 'scope' => 'https://www.google.com/analytics/feeds/', 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __('Google Analytics', 'all-in-one-seo-pack' ) );
 
 
 
 
 
164
  $args['oauth_verifier'] = $oauth_verifier;
165
- $oauth_access_token = "https://www.google.com/accounts/OAuthGetAccessToken";
166
- $reqData = $this->oauth_get_data( $oauth_access_token, $args );
167
- $reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) );
 
168
  return $reqOAuthData;
169
  }
170
 
 
 
 
 
 
171
  function oauth_connect( $count = 0 ) {
172
  global $aiosp_activation;
173
- if ( !class_exists( 'OAuthConsumer' ) ) require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
174
- $url = '';
175
- $callback_url = NULL;
176
- $consumer_key = "anonymous";
177
- $consumer_secret = "anonymous";
178
- $oauth_request_token = "https://www.google.com/accounts/OAuthGetRequestToken";
179
- $oauth_authorize = "https://www.google.com/accounts/OAuthAuthorizeToken";
180
- $oauth_access_token = "https://www.google.com/accounts/OAuthGetAccessToken";
 
 
181
  if ( $aiosp_activation ) {
182
  $oauth_current = false;
183
  } else {
184
- $oauth_current = get_transient( "aioseop_oauth_current" );
185
  }
186
- if ( !empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) {
187
  return $oauth_authorize . '?oauth_token=' . $this->token;
188
  } else {
189
- set_transient( "aioseop_oauth_current", 1, 3600 );
190
  unset( $this->token );
191
  unset( $this->secret );
192
  }
193
  $args = array(
194
- 'scope' => 'https://www.google.com/analytics/feeds/',
195
- 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __('Google Analytics', 'all-in-one-seo-pack')
196
  );
197
  if ( AIOSEOPPRO ) {
198
- $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" ) );
199
  } else {
200
- $req_req = $this->oauth_get_creds( $oauth_request_token, NULL, $args, admin_url( "admin.php?page=all-in-one-seo-pack/aioseop_class.php" ) );
201
  }
202
- $reqData = wp_remote_get( $req_req->to_url() );
203
  $reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) );
204
- if ( !empty( $reqOAuthData['oauth_token'] ) ) $this->token = $reqOAuthData['oauth_token'];
205
- if ( !empty( $reqOAuthData['oauth_token_secret'] ) ) $this->secret = $reqOAuthData['oauth_token_secret'];
206
- if ( !empty( $this->token ) && ( $this->token != 'anonymous' ) && ( $oauth_current ) ) {
 
 
 
 
207
  $url = $oauth_authorize . "?oauth_token={$this->token}";
208
  } else {
209
- if ( !$count ) {
210
  return $this->oauth_connect( 1 );
211
  }
212
  }
 
213
  return $url;
214
- }
1
  <?php
2
 
3
+ /**
4
+ * @return bool
5
+ */
6
  function oauth_init() {
7
+ if ( ! is_user_logged_in() || ! current_user_can( 'aiosp_manage_seo' ) ) {
8
+ return false;
9
+ }
10
+ $this->token = 'anonymous';
11
+ $this->secret = 'anonymous';
12
+ $preload = $this->get_class_option();
13
+ $manual_ua = '';
14
+ if ( ! empty( $_POST ) ) {
15
+ if ( ! empty( $_POST[ "{$this->prefix}google_connect" ] ) ) {
16
  $manual_ua = 1;
17
  }
18
+ } elseif ( ! empty( $preload[ "{$this->prefix}google_connect" ] ) ) {
19
  $manual_ua = 1;
20
  }
21
+ if ( ! empty( $manual_ua ) ) {
22
+ foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) {
23
+ if ( ! empty( $preload[ "{$this->prefix}{$v}" ] ) ) {
24
+ unset( $preload[ "{$this->prefix}{$v}" ] );
25
+ unset( $this->$v );
 
26
  }
27
+ }
28
+ $this->update_class_option( $preload );
29
+ $this->update_options();
30
+ //return;
31
  }
32
+ foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) {
33
+ if ( ! empty( $preload[ "{$this->prefix}{$v}" ] ) ) {
34
+ $this->$v = $preload[ "{$this->prefix}{$v}" ];
35
  }
36
  }
37
+ $callback_url = null;
38
+ if ( ! empty( $_REQUEST['oauth_verifier'] ) ) {
39
  $this->verifier = $_REQUEST['oauth_verifier'];
40
+ if ( ! empty( $_REQUEST['oauth_token'] ) ) {
41
+ if ( isset( $this->token ) && $this->token === $_REQUEST['oauth_token'] ) {
42
  $this->access_token = $this->oauth_get_token( $this->verifier );
43
+ if ( is_array( $this->access_token ) && ! empty( $this->access_token['oauth_token'] ) ) {
44
  unset( $this->token );
45
  unset( $this->secret );
46
  $this->ga_token = $this->access_token['oauth_token'];
47
+ foreach ( array( 'token', 'secret', 'access_token', 'ga_token' ) as $v ) {
48
+ if ( ! empty( $this->$v ) ) {
49
+ $preload[ "{$this->prefix}{$v}" ] = $this->$v;
50
+ }
51
  }
52
  $this->update_class_option( $preload );
53
  }
56
  exit;
57
  }
58
  }
59
+ if ( ! empty( $this->ga_token ) ) {
60
+ if ( ! empty( $this->account_cache ) ) {
61
+ $ua = $this->account_cache['ua'];
62
  $profiles = $this->account_cache['profiles'];
63
  } else {
64
+ $this->token = $this->access_token['oauth_token'];
65
  $this->secret = $this->access_token['oauth_token_secret'];
66
 
67
+ $data = $this->oauth_get_data( 'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' );
68
 
69
  $http_code = wp_remote_retrieve_response_code( $data );
70
 
71
+ if ( 200 === $http_code ) {
72
  $response = wp_remote_retrieve_body( $data );
73
+ $xml = $this->xml_string_to_array( $response );
74
+ $ua = array();
75
+ $profiles = array();
76
+ if ( ! empty( $xml['entry'] ) ) {
77
+ $rec = array();
78
+ $results = array();
79
+ if ( ! empty( $xml['entry'][0] ) ) {
80
+ $results = $xml['entry'];
81
+ } else {
82
+ $results[] = $xml['entry'];
83
+ }
84
+ foreach ( $results as $r ) {
85
+ foreach ( $r as $k => $v )
86
+ switch ( $k ) {
87
+ case 'id':
88
+ $rec['id'] = $v;
89
+ break;
90
+ case 'title':
91
+ $rec['title'] = $v['@content'];
92
+ break;
93
  case 'dxp:property':
94
+ $attr = array();
95
+ foreach ( $v as $a => $f ) {
96
+ if ( is_array( $f ) && ! empty( $f['@attributes'] ) ) {
97
+ $rec[ $f['@attributes']['name'] ] = $f['@attributes']['value'];
98
+ }
99
+ }
100
+ break;
101
  }
102
+ $ua[ $rec['title'] ] = array( $rec['ga:webPropertyId'] => $rec['ga:webPropertyId'] );
103
  $profiles[ $rec['ga:webPropertyId'] ] = $rec['ga:profileId'];
104
  }
105
  }
106
+ $this->account_cache = array();
107
+ $this->account_cache['ua'] = $ua;
108
+ $this->account_cache['profiles'] = $profiles;
109
  $preload["{$this->prefix}account_cache"] = $this->account_cache;
110
  } else {
111
  unset( $this->token );
113
  unset( $this->ga_token );
114
  unset( $preload["{$this->prefix}ga_token"] ); // error condition here -- pdb
115
  $response = wp_remote_retrieve_body( $data );
116
+ $xml = $this->xml_string_to_array( $response );
117
+ if ( ! empty( $xml ) && ! empty( $xml['error'] ) ) {
118
  $error = 'Error: ';
119
+ if ( ! empty( $xml['error']['internalReason'] ) ) {
120
+ $error .= $xml['error']['internalReason'];
121
  } else {
122
+ foreach ( $xml['error'] as $k => $v ) {
123
  $error .= "$k: $v\n";
124
+ }
125
  }
126
  $this->output_error( $error );
127
  }
128
  }
129
  }
130
  }
131
+ if ( ! empty( $this->ga_token ) ) {
132
+ $this->default_options['google_analytics_id']['type'] = 'select';
133
+ $this->default_options['google_analytics_id']['initial_options'] = $ua;
134
+ $this->default_options['google_connect']['type'] = 'html';
135
+ $this->default_options['google_connect']['nolabel'] = 1;
136
+ $this->default_options['google_connect']['save'] = true;
137
+ $this->default_options['google_connect']['name'] = __( 'Disconnect From Google Analytics', 'all-in-one-seo-pack' );
138
+ $this->default_options['google_connect']['default'] = "<input name='aiosp_google_connect' type=submit class='button-primary' value='" . __( 'Remove Stored Credentials', 'all-in-one-seo-pack' ) . "'>";
139
  add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 );
140
  } else {
141
+ $this->default_options['google_connect']['type'] = 'html';
142
+ $this->default_options['google_connect']['nolabel'] = 1;
143
+ $this->default_options['google_connect']['save'] = false;
144
+ $url = $this->oauth_connect();
145
+ $this->default_options['google_connect']['default'] = "<a href='{$url}' class='button-primary'>" . __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ) . '</a>';
146
+ foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) {
147
+ if ( ! empty( $this->$v ) ) {
148
+ $preload["{$this->prefix}{$v}"] = $this->$v;
149
+ }
150
  }
151
  }
152
  $this->update_class_option( $preload );
153
+ $this->update_options();
154
  // $url = $this->report_query();
155
+ 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"] ] ) ) {
156
+ $this->profile_id = $this->account_cache['profiles'][ $this->options["{$this->prefix}google_analytics_id"] ];
157
  }
158
  }
159
 
160
+ /**
161
+ * @param $oauth_url
162
+ * @param null $args
163
+ *
164
+ * @return array|WP_Error
165
+ */
166
  function oauth_get_data( $oauth_url, $args = null ) {
167
+ if ( ! class_exists( 'OAuthConsumer' ) ) {
168
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
169
+ }
170
+ if ( $args === null ) {
171
+ $args = Array(
172
+ 'scope' => 'https://www.googleapis.com/auth/analytics.readonly',
173
+ 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' )
174
+ );
175
+ }
176
  $req_token = new OAuthConsumer( $this->token, $this->secret );
177
+ $req = $this->oauth_get_creds( $oauth_url, $req_token, $args );
178
+
179
  return wp_remote_get( $req->to_url() );
180
  }
181
 
182
+ /**
183
+ * @param $oauth_url
184
+ * @param null $req_token
185
+ * @param array $args
186
+ * @param null $callback
187
+ *
188
+ * @return OAuthRequest
189
+ */
190
+ function oauth_get_creds( $oauth_url, $req_token = null, $args = array(), $callback = null ) {
191
+ if ( ! class_exists( 'OAuthConsumer' ) ) {
192
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
193
+ }
194
+ if ( ! empty( $callback ) ) {
195
+ $args['oauth_callback'] = $callback;
196
+ }
197
+ if ( empty( $this->sig_method ) ) {
198
+ $this->sig_method = new OAuthSignatureMethod_HMAC_SHA1();
199
+ }
200
+ if ( empty( $this->consumer ) ) {
201
+ $this->consumer = new OAuthCOnsumer( 'anonymous', 'anonymous' );
202
+ }
203
+ $req_req = OAuthRequest::from_consumer_and_token( $this->consumer, $req_token, 'GET', $oauth_url, $args );
204
  $req_req->sign_request( $this->sig_method, $this->consumer, $req_token );
205
+
206
  return $req_req;
207
  }
208
 
209
+ /**
210
+ * @param $oauth_verifier
211
+ *
212
+ * @return array
213
+ */
214
  function oauth_get_token( $oauth_verifier ) {
215
+ if ( ! class_exists( 'OAuthConsumer' ) ) {
216
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
217
+ }
218
+ $args = array(
219
+ 'scope' => 'https://www.google.com/analytics/feeds/',
220
+ 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' )
221
+ );
222
  $args['oauth_verifier'] = $oauth_verifier;
223
+ $oauth_access_token = 'https://www.google.com/accounts/OAuthGetAccessToken';
224
+ $reqData = $this->oauth_get_data( $oauth_access_token, $args );
225
+ $reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) );
226
+
227
  return $reqOAuthData;
228
  }
229
 
230
+ /**
231
+ * @param int $count
232
+ *
233
+ * @return string
234
+ */
235
  function oauth_connect( $count = 0 ) {
236
  global $aiosp_activation;
237
+ if ( ! class_exists( 'OAuthConsumer' ) ) {
238
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
239
+ }
240
+ $url = '';
241
+ $callback_url = null;
242
+ $consumer_key = 'anonymous';
243
+ $consumer_secret = 'anonymous';
244
+ $oauth_request_token = 'https://www.google.com/accounts/OAuthGetRequestToken';
245
+ $oauth_authorize = 'https://www.google.com/accounts/OAuthAuthorizeToken';
246
+ $oauth_access_token = 'https://www.google.com/accounts/OAuthGetAccessToken';
247
  if ( $aiosp_activation ) {
248
  $oauth_current = false;
249
  } else {
250
+ $oauth_current = get_transient( 'aioseop_oauth_current' );
251
  }
252
+ if ( ! empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) {
253
  return $oauth_authorize . '?oauth_token=' . $this->token;
254
  } else {
255
+ set_transient( 'aioseop_oauth_current', 1, 3600 );
256
  unset( $this->token );
257
  unset( $this->secret );
258
  }
259
  $args = array(
260
+ 'scope' => 'https://www.google.com/analytics/feeds/',
261
+ 'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' )
262
  );
263
  if ( AIOSEOPPRO ) {
264
+ $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' ) );
265
  } else {
266
+ $req_req = $this->oauth_get_creds( $oauth_request_token, null, $args, admin_url( 'admin.php?page=all-in-one-seo-pack/aioseop_class.php' ) );
267
  }
268
+ $reqData = wp_remote_get( $req_req->to_url() );
269
  $reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) );
270
+ if ( ! empty( $reqOAuthData['oauth_token'] ) ) {
271
+ $this->token = $reqOAuthData['oauth_token'];
272
+ }
273
+ if ( ! empty( $reqOAuthData['oauth_token_secret'] ) ) {
274
+ $this->secret = $reqOAuthData['oauth_token_secret'];
275
+ }
276
+ if ( ! empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) {
277
  $url = $oauth_authorize . "?oauth_token={$this->token}";
278
  } else {
279
+ if ( ! $count ) {
280
  return $this->oauth_connect( 1 );
281
  }
282
  }
283
+
284
  return $url;
285
+ }
inc/index.php CHANGED
@@ -1 +1,4 @@
1
- <?php // Silence is golden
 
 
 
1
+ <?php
2
+ /**
3
+ * Silence is golden.
4
+ */
inc/sitemap-xsl.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sitemap XSL.
4
+ *
5
+ * Dynamically generates the XML Sitemap's XSL file.
6
+ *
7
+ * @package All-in-One-SEO-Pack
8
+ *
9
+ * @since 2.3.6
10
+ */
11
+
12
+ echo '<?xml version="1.0" encoding="UTF-8"?>';
13
+ ?>
14
+ <xsl:stylesheet version="2.0"
15
+ xmlns:html="http://www.w3.org/TR/REC-html40"
16
+ xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
17
+ xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
18
+ xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
19
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
20
+ <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
21
+ <xsl:template match="/">
22
+ <xsl:variable name="fileType">
23
+ <xsl:choose>
24
+ <xsl:when test="//sitemap:url">Sitemap</xsl:when>
25
+ <xsl:otherwise>SitemapIndex</xsl:otherwise>
26
+ </xsl:choose>
27
+ </xsl:variable>
28
+ <html xmlns="http://www.w3.org/1999/xhtml">
29
+ <head>
30
+ <title>
31
+ <xsl:choose><xsl:when test="$fileType='Sitemap'">Sitemap</xsl:when>
32
+ <xsl:otherwise>Sitemap Index</xsl:otherwise>
33
+ </xsl:choose>
34
+ </title>
35
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
36
+ <style type="text/css">
37
+ body {
38
+ margin: 0;
39
+ font-family: Helvetica, Arial, sans-serif;
40
+ font-size: 68.5%;
41
+ }
42
+ #content-head {
43
+ background-color: #4275f4;
44
+ padding: 20px 40px;
45
+ }
46
+ #content-head h1,
47
+ #content-head p,
48
+ #content-head a {
49
+ color: #fff;
50
+ font-size: 1.2em;
51
+ }
52
+ #content-head h1 {
53
+ font-size: 2em;
54
+ }
55
+ table {
56
+ margin: 20px 40px;
57
+ border: none;
58
+ border-collapse: collapse;
59
+ }
60
+ table {
61
+ font-size: 1em;
62
+ width: 75%;
63
+ }
64
+ th {
65
+ border-bottom: 1px solid #ccc;
66
+ text-align: left;
67
+ padding: 15px 5px;
68
+ font-size: 14px;
69
+ }
70
+ td {
71
+ padding: 10px 5px;
72
+ border-left: 3px solid #fff;
73
+ }
74
+ tr.stripe {
75
+ background-color: #f7f7f7;
76
+ }
77
+ </style>
78
+ </head>
79
+ <body>
80
+ <div id="content">
81
+ <div id="content-head">
82
+ <h1>XML Sitemap</h1>
83
+ <p>Generated by <a href="https://semperplugins.com">All in One </a> <a href="https://semperplugins.com/all-in-one-seo-pack-pro-version/">SEO</a>, this is an XML Sitemap, meant to be consumed by search engines like Google or Bing.<br/>
84
+ You can find more information about XML sitemaps at <a href="http://sitemaps.org">sitemaps.org</a>.</p>
85
+ <p><xsl:choose>
86
+ <xsl:when test="$fileType='Sitemap'">
87
+ This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"></xsl:value-of> URLs</xsl:when>
88
+ <xsl:otherwise>This sitemap index contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"></xsl:value-of> sitemaps</xsl:otherwise>
89
+ </xsl:choose></p>
90
+ </div>
91
+ <xsl:choose>
92
+ <xsl:when test="$fileType='Sitemap'">
93
+ <xsl:call-template name="sitemapTable"/></xsl:when>
94
+ <xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise>
95
+ </xsl:choose>
96
+
97
+ </div>
98
+ </body>
99
+ </html>
100
+ </xsl:template>
101
+ <xsl:template name="siteindexTable">
102
+ <table cellpadding="3">
103
+ <thead>
104
+ <tr>
105
+ <th width="50%">URL</th>
106
+ <th>LastChange</th>
107
+ </tr>
108
+ </thead>
109
+ <tbody>
110
+ <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
111
+ <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
112
+ <xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
113
+ <tr>
114
+ <xsl:if test="position() mod 2 != 1">
115
+ <xsl:attribute name="class">stripe</xsl:attribute>
116
+ </xsl:if>
117
+ <td>
118
+ <xsl:variable name="itemURL">
119
+ <xsl:value-of select="sitemap:loc"/>
120
+ </xsl:variable>
121
+ <a href="{$itemURL}">
122
+ <xsl:value-of select="sitemap:loc"/>
123
+ </a>
124
+ </td>
125
+ <td>
126
+ <xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
127
+ </td>
128
+ </tr>
129
+ </xsl:for-each>
130
+ </tbody>
131
+ </table>
132
+ </xsl:template>
133
+ <xsl:template name="sitemapTable">
134
+ <table cellpadding="3">
135
+ <thead>
136
+ <tr>
137
+ <th width="50%">URL</th>
138
+ <th>Priority</th>
139
+ <th>Change Frequency</th>
140
+ <th>LastChange</th>
141
+ </tr>
142
+ </thead>
143
+ <tbody>
144
+ <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
145
+ <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
146
+ <xsl:for-each select="sitemap:urlset/sitemap:url">
147
+ <tr>
148
+ <xsl:if test="position() mod 2 != 1">
149
+ <xsl:attribute name="class">stripe</xsl:attribute>
150
+ </xsl:if>
151
+ <td>
152
+ <xsl:variable name="itemURL">
153
+ <xsl:value-of select="sitemap:loc"/>
154
+ </xsl:variable>
155
+ <a href="{$itemURL}">
156
+ <xsl:value-of select="sitemap:loc"/>
157
+ </a>
158
+ <xsl:variable name="thumbURL">
159
+ <xsl:value-of select="video:video/video:thumbnail_loc"/>
160
+ </xsl:variable>
161
+ <xsl:variable name="playURL">
162
+ <xsl:value-of select="video:video/video:player_loc"/>
163
+ </xsl:variable>
164
+ <xsl:if test="$thumbURL != ''">
165
+ <a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
166
+ </xsl:if>
167
+ </td>
168
+ <td>
169
+ <xsl:if test="string(number(sitemap:priority))!='NaN'">
170
+ <xsl:value-of select="concat(sitemap:priority*100,'%')"/>
171
+ </xsl:if>
172
+ </td>
173
+ <td>
174
+ <xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
175
+ </td>
176
+ <td>
177
+ <xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
178
+ </td>
179
+ <td>
180
+
181
+
182
+
183
+ </td>
184
+ </tr>
185
+ </xsl:for-each>
186
+ </tbody>
187
+ </table>
188
+ </xsl:template>
189
+ </xsl:stylesheet>
190
+ <?php
inc/translations.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! class_exists( 'AIOSEOP_Translations' ) ) :
4
+
5
+ /**
6
+ * Class AIOSEOP_Translations
7
+ *
8
+ * @since 2.3.5
9
+ */
10
+ class AIOSEOP_Translations {
11
+
12
+ public $current_locale = '';
13
+
14
+ public $url = 'https://translate.wordpress.org/api/projects/wp-plugins/all-in-one-seo-pack/dev';
15
+
16
+ public $name = '';
17
+
18
+ /**
19
+ * Loop through the locale info.
20
+ *
21
+ * @since 2.3.5
22
+ * @access public
23
+ * @var string $wplocale Information for a particular locale (in loop)
24
+ */
25
+ public $wplocale = '';
26
+
27
+ public $translated_count = 0;
28
+
29
+ public $translation_url = 'https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack';
30
+
31
+ public $slug = '';
32
+
33
+ public $percent_translated = '';
34
+
35
+ /**
36
+ * AIOSEOP_Translations constructor.
37
+ *
38
+ * @since 2.3.5
39
+ *
40
+ */
41
+ public function __construct() {
42
+
43
+ $this->current_locale = get_locale();
44
+
45
+ $this->init();
46
+
47
+ }
48
+
49
+ /**
50
+ * Fetch locale data from WP.
51
+ *
52
+ * @since 2.3.5
53
+ * @since 2.3.6 Return FALSE on WP_Error object.
54
+ *
55
+ * @return mixed
56
+ */
57
+ private function get_locale_data() {
58
+ $response = wp_remote_get( $this->url );
59
+
60
+ if(is_wp_error($response)){
61
+ return FALSE;
62
+ }
63
+
64
+ return $response['body'];
65
+ }
66
+
67
+
68
+ /**
69
+ *
70
+ * @since 2.3.5
71
+ *
72
+ * @param $locales
73
+ */
74
+ private function set_current_locale_data( $locales ) {
75
+
76
+ // Some locales are missing the locale code (wp_locale) so we need to check for that.
77
+
78
+ foreach ( $locales as $locale ) {
79
+
80
+ $wplocale = '';
81
+
82
+ if ( isset( $locale->wp_locale ) ) {
83
+ $wplocale = $locale->wp_locale;
84
+ }
85
+
86
+ if ( $wplocale === $this->current_locale ) {
87
+
88
+ $name = '';
89
+ $percent_translated = '';
90
+
91
+ if ( isset( $locale->name ) ) {
92
+ $name = $locale->name;
93
+ }
94
+
95
+ if ( isset( $locale->percent_translated ) ) {
96
+ $percent_translated = $locale->percent_translated;
97
+ }
98
+
99
+ $this->name = $name;
100
+ $this->wplocale = $wplocale;
101
+ $this->percent_translated = $percent_translated;
102
+ $this->slug = $locale->locale;
103
+
104
+ }
105
+ }
106
+
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @since 2.3.5
112
+ *
113
+ * @param $locales
114
+ *
115
+ * @return int
116
+ */
117
+ private function count_translated_languages( $locales ) {
118
+
119
+ $count = 0;
120
+
121
+ foreach ( $locales as $locale ) {
122
+
123
+ if ( $locale->percent_translated > 0 ) {
124
+ ++ $count;
125
+ }
126
+ }
127
+
128
+ return $count;
129
+ }
130
+
131
+ /**
132
+ *
133
+ *
134
+ * @since 2.3.5
135
+ */
136
+ private function set_translation_url() {
137
+
138
+ if ( null !== $this->wplocale ) {
139
+
140
+ $url = "https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack/dev/$this->slug/default";
141
+
142
+ $this->translation_url = $url;
143
+ }
144
+
145
+ }
146
+
147
+ /**
148
+ *
149
+ * @since 2.3.5
150
+ * @since 2.3.6 Return FALSE on WP_Error object in get_locale_data().
151
+ *
152
+ */
153
+ private function init() {
154
+
155
+ $json = $this->get_locale_data();
156
+
157
+ if( $json === FALSE ){
158
+ return FALSE;
159
+ }
160
+
161
+ $translation_data = json_decode( $json );
162
+
163
+ $locales = $translation_data->translation_sets;
164
+
165
+ $this->set_current_locale_data( $locales );
166
+
167
+ $this->translated_count = $this->count_translated_languages( $locales );
168
+
169
+ $this->set_translation_url();
170
+ }
171
+ }
172
+
173
+ endif; // End class_exists check.
index.php CHANGED
@@ -1 +1,4 @@
1
- <?php // Silence is golden
 
 
 
1
+ <?php
2
+ /**
3
+ * Silence is golden.
4
+ */
js/modules/aioseop_module.js CHANGED
@@ -1,345 +1,641 @@
1
- if ( typeof aiosp_data != 'undefined' ) {
2
- jQuery.each( aiosp_data, function( index, value ) {
3
- // aiosp_data[index] = value.json.replace(/&quot;/g, '"');
4
- // aiosp_data[index] = jQuery.parseJSON( value );
5
- if ( index == 0 ) {
6
- if ( typeof value.condshow == 'undefined' ) {
7
- aiosp_data[index].condshow = [];
8
- }
9
- } else {
10
- if ( typeof value.condshow != 'undefined' ) {
11
- aiosp_data[0].condshow = jQuery.merge( aiosp_data[0].condshow, value.condshow );
12
- }
13
- }
14
- });
15
- aiosp_data = aiosp_data[0];
16
- }
17
-
18
- function toggleVisibility(id) {
19
- var e = document.getElementById(id);
20
- if (e.style.display == 'block')
21
- e.style.display = 'none';
22
- else
23
- e.style.display = 'block';
24
- }
25
-
26
- function countChars(field,cntfield) {
27
- var extra = 0;
28
- var field_size;
29
- if ( ( field.name == 'aiosp_title' ) && ( typeof aiosp_title_extra !== 'undefined' ) ) {
30
- extra = aiosp_title_extra;
31
- }
32
-
33
- cntfield.value = field.value.length + extra;
34
- if ( typeof field.size != 'undefined' ) {
35
- field_size = field.size;
36
- } else {
37
- field_size = field.rows * field.cols;
38
- }
39
- if ( field_size < 10 ) return;
40
- if ( cntfield.value > field_size ) {
41
- cntfield.style.color = "#fff";
42
- cntfield.style.backgroundColor = "#f00";
43
- } else {
44
- if ( cntfield.value > ( field_size - 6 ) ) {
45
- cntfield.style.color = "#515151";
46
- cntfield.style.backgroundColor = "#ff0";
47
- } else {
48
- cntfield.style.color = "#515151";
49
- cntfield.style.backgroundColor = "#eee";
50
- }
51
- }
52
- }
53
-
54
- function aioseop_get_field_value( field ) {
55
- if ( field.length == 0 ) return field;
56
- cur = jQuery('[name=' + field + ']');
57
- if ( cur.length == 0 ) return field;
58
- type = cur.attr('type');
59
- if ( type == "checkbox" || type == "radio" )
60
- cur = jQuery('input[name=' + field + ']:checked');
61
- return cur.val();
62
- }
63
-
64
- function aioseop_get_field_values( field ) {
65
- arr = [];
66
- cur = jQuery('[name=' + field + ']');
67
- if ( cur.length == 0 ) return field;
68
- type = cur.attr('type');
69
- if ( type == "checkbox" || type == "radio" )
70
- jQuery('input[name=' + field + ']:checked').each(function() {
71
- arr.push(jQuery(this).val());
72
- });
73
- if ( arr.length <= 0 )
74
- arr.push(cur.val());
75
- return arr;
76
- }
77
-
78
- function aioseop_eval_condshow_logic( statement ) {
79
- var lhs, rhs;
80
- if ( ( typeof statement ) == 'object' ) {
81
- lhs = statement['lhs'];
82
- rhs = statement['rhs'];
83
- if ( lhs !== null && ( ( typeof lhs ) == 'object' ) )
84
- lhs = aioseop_eval_condshow_logic( statement['lhs'] );
85
- if ( rhs !== null && ( typeof rhs ) == 'object' )
86
- rhs = aioseop_eval_condshow_logic( statement['rhs'] );
87
- lhs = aioseop_get_field_value( lhs );
88
- rhs = aioseop_get_field_value( rhs );
89
- switch ( statement['op'] ) {
90
- case 'NOT': return ( ! lhs );
91
- case 'AND': return ( lhs && rhs );
92
- case 'OR' : return ( lhs || rhs );
93
- case '==' : return ( lhs == rhs );
94
- case '!=' : return ( lhs != rhs );
95
- default : return null;
96
- }
97
- }
98
- return statement;
99
- }
100
-
101
- function aioseop_do_condshow_match( index, value ) {
102
- if ( typeof value != 'undefined' ) {
103
- matches = true;
104
- jQuery.each(value, function(subopt, setting) {
105
- var statement;
106
- if ( ( typeof setting ) == 'object' ) {
107
- statement = aioseop_eval_condshow_logic( setting );
108
- if ( !statement ) {
109
- matches = false;
110
- }
111
- } else {
112
- if ( subopt.match(/\\\[\\\]/) ) { // special case for these -- pdb
113
- cur = aioseop_get_field_values( subopt );
114
- if ( jQuery.inArray( setting, cur, 0 ) < 0 ) {
115
- matches = false;
116
- }
117
- } else {
118
- cur = aioseop_get_field_value( subopt );
119
- if ( cur != setting ) {
120
- matches = false;
121
- }
122
- }
123
- }
124
- });
125
- if ( matches ) {
126
- jQuery('#' + index + '_wrapper' ).show();
127
- } else {
128
- jQuery('#' + index + '_wrapper' ).hide();
129
- }
130
- return matches;
131
- }
132
- return false;
133
- }
134
-
135
- function aioseop_add_condshow_handlers( index, value ) {
136
- if ( typeof value != 'undefined' ) {
137
- jQuery.each(value, function(subopt, setting) {
138
- jQuery('[name=' + subopt + ']').bind( "change keyup", function() {
139
- aioseop_do_condshow_match( index, value );
140
- });
141
- });
142
- }
143
- }
144
-
145
- function aioseop_do_condshow( condshow ) {
146
- if ( typeof aiosp_data.condshow != 'undefined' ) {
147
- jQuery.each(aiosp_data.condshow, function(index, value) {
148
- aioseop_do_condshow_match( index, value );
149
- aioseop_add_condshow_handlers( index, value );
150
- });
151
- }
152
- }
153
-
154
- jQuery(document).ready(function(){
155
- if (typeof aiosp_data != 'undefined') {
156
- if ( typeof aiosp_data.condshow != 'undefined' ) {
157
- aioseop_do_condshow( aiosp_data.condshow );
158
- }
159
- }
160
- });
161
-
162
- jQuery(document).ready(function() {
163
- var image_field;
164
- jQuery('.aioseop_upload_image_button').click(function() {
165
- window.send_to_editor = aioseopNewSendToEditor;
166
- image_field = jQuery(this).next();
167
- formfield = image_field.attr('name');
168
- tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
169
- return false;
170
- });
171
- aioseopStoreSendToEditor = window.send_to_editor;
172
- aioseopNewSendToEditor = function(html) {
173
- imgurl = jQuery('img',html).attr('src');
174
- if ( typeof(imgurl) !== undefined )
175
- image_field.val(imgurl);
176
- tb_remove();
177
- window.send_to_editor = aioseopStoreSendToEditor;
178
- };
179
- });
180
-
181
- // props to commentluv for this fix
182
- // workaround for bug that causes radio inputs to lose settings when meta box is dragged.
183
- // http://core.trac.wordpress.org/ticket/16972
184
- jQuery(document).ready(function(){
185
- // listen for drag drop of metaboxes , bind mousedown to .hndle so it only fires when starting to drag
186
- jQuery('.hndle').mousedown(function(){
187
- // 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
188
- jQuery('.wrap').mouseup(function(){aiosp_store_radio(); setTimeout('aiosp_reclick_radio();',50);});
189
- })
190
- });
191
- /**
192
- * stores object of all radio buttons that are checked for entire form
193
- */
194
-
195
- function aiosp_store_radio(){
196
- var radioshack = {};
197
- jQuery('input[type="radio"]').each(function(){
198
- if(jQuery(this).is(':checked')){
199
- radioshack[jQuery(this).attr('name')] = jQuery(this).val();
200
- }
201
- jQuery(document).data('radioshack',radioshack);
202
- });
203
- }
204
-
205
- /**
206
- * detect mouseup and restore all radio buttons that were checked
207
- */
208
-
209
- function aiosp_reclick_radio(){
210
- // get object of checked radio button names and values
211
- var radios = jQuery(document).data('radioshack');
212
- //step thru each object element and trigger a click on it's corresponding radio button
213
- for(key in radios){
214
- jQuery('input[name="'+key+'"]').filter('[value="'+radios[key]+'"]').trigger('click');
215
- }
216
- // unbind the event listener on .wrap (prevents clicks on inputs from triggering function)
217
- jQuery('.wrap').unbind('mouseup');
218
- }
219
-
220
-
221
- function aioseop_handle_ajax_call( action, settings, options, success) {
222
- var aioseop_sack = new sack(ajaxurl);
223
- aioseop_sack.execute = 1;
224
- aioseop_sack.method = 'POST';
225
- aioseop_sack.setVar( "action", action );
226
- aioseop_sack.setVar( "settings", settings );
227
- aioseop_sack.setVar( "options", options );
228
- if ( typeof success != 'undefined' ) {
229
- aioseop_sack.onCompletion = success;
230
- }
231
- aioseop_sack.setVar( "nonce-aioseop", jQuery('input[name="nonce-aioseop"]').val() );
232
- aioseop_sack.setVar( "nonce-aioseop-edit", jQuery('input[name="nonce-aioseop-edit"]').val() );
233
-
234
- aioseop_sack.onError = function() {alert('Ajax error on saving.'); };
235
- aioseop_sack.runAJAX();
236
- }
237
-
238
- function aioseop_handle_post_url( action, settings, options, success) {
239
- jQuery("div#aiosp_"+settings).fadeOut('fast', function() {
240
- var loading = '<label class="aioseop_loading aioseop_'+settings+'_loading"></label> Please wait...';
241
- jQuery("div#aiosp_"+settings).fadeIn('fast', function() {
242
- aioseop_handle_ajax_call( action, settings, options, success);
243
- });
244
- jQuery("div#aiosp_"+settings).html(loading);
245
- })
246
- };
247
-
248
- function aioseop_is_overflowed(element) {
249
- return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
250
- }
251
-
252
- function aioseop_overflow_border( el ) {
253
- if ( aioseop_is_overflowed(el) ) {
254
- el.className = 'aioseop_option_div aioseop_overflowed';
255
- } else {
256
- el.className = 'aioseop_option_div';
257
- }
258
- }
259
-
260
- jQuery(document).ready(function() {
261
- jQuery("#poststuff .aioseop_radio_type input[type='radio']").on( 'click', function() {
262
- var previousValue = jQuery(this).attr('previousValue');
263
- var name = jQuery(this).attr('name');
264
- if ( typeof previousValue == 'undefined' ) {
265
- if ( jQuery(this).prop( "checked" ) ) {
266
- jQuery(this).prop( 'checked', true );
267
- jQuery(this).attr('previousValue', 'checked' );
268
- } else {
269
- jQuery(this).prop( 'checked', false );
270
- jQuery(this).attr('previousValue', false );
271
- }
272
- return;
273
- }
274
- if (previousValue == 'checked') {
275
- jQuery(this).prop('checked', false);
276
- jQuery(this).attr('previousValue', false);
277
- } else {
278
- jQuery("input[name="+name+"]:radio").attr('previousValue', false);
279
- jQuery(this).attr('previousValue', 'checked');
280
- }
281
- });
282
- if ( typeof aiosp_data.pointers != 'undefined' ) {
283
- jQuery.each(aiosp_data.pointers, function(index, value) {
284
- if ( value != 'undefined' && value.pointer_text != '' ) {
285
- aioseop_show_pointer( index, value );
286
- }
287
- });
288
- }
289
- 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) {
290
- e.preventDefault();
291
- return false;
292
- });
293
- 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) {
294
- e.preventDefault();
295
- aioseop_handle_post_url('aioseop_ajax_save_settings', 'ajax_settings_message', jQuery('form#aiosp_settings_form').serialize(),
296
- function() {
297
- jQuery('.wp-has-current-submenu').fadeIn('fast', function() {
298
- aioseop_handle_ajax_call('aioseop_ajax_get_menu_links', 'ajax_settings_message', jQuery.param( {target: '.wp-has-current-submenu > ul'} ) );
299
- });
300
- } );
301
- return false;
302
- });
303
- var selectors = "div.aioseop_multicheckbox_type div.aioseop_option_div, #aiosp_sitemap_debug div.aioseop_option_div, #aiosp_performance_status div.aioseop_option_div";
304
- jQuery("div#aiosp_sitemap_addl_pages_metabox").delegate("input[name='Submit']", "click", function() {
305
- 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() );
306
- return false;
307
- });
308
- jQuery("div#aiosp_video_sitemap_addl_pages_metabox").delegate("input[name='Submit']", "click", function() {
309
- 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() );
310
- return false;
311
- });
312
- jQuery("div#aiosp_sitemap_addl_pages_metabox").delegate("a.aiosp_delete_url", "click", function(e) {
313
- e.preventDefault();
314
- aioseop_handle_post_url('aioseop_ajax_delete_url', 'sitemap_addl_pages', jQuery(this).attr("title") );
315
- return false;
316
- });
317
- jQuery("div#aiosp_video_sitemap_addl_pages_metabox").delegate("a.aiosp_delete_url", "click", function(e) {
318
- e.preventDefault();
319
- aioseop_handle_post_url('aioseop_ajax_delete_url', 'video_sitemap_addl_pages', jQuery(this).attr("title") );
320
- return false;
321
- });
322
- jQuery("div#aiosp_opengraph_scan_header").delegate("input[name='aiosp_opengraph_scan_header']", "click", function(e) {
323
- e.preventDefault();
324
- aioseop_handle_post_url('aioseop_ajax_scan_header', 'opengraph_scan_header', jQuery('div#aiosp_opengraph_scan_header').serialize() );
325
- return false;
326
- });
327
- 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 () {
328
- jQuery(this).parents('div:eq(0)').find(':checkbox').prop('checked', this.checked);
329
- });
330
- 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 () {
331
- if ( !this.checked )
332
- jQuery(this).parents('div:eq(0)').find('input[value="all"]:checkbox').prop('checked', this.checked);
333
- });
334
-
335
- jQuery(".aioseop_tab:not(:first)").hide();
336
- jQuery(".aioseop_tab:first").show();
337
- jQuery("a.aioseop_header_tab").click(function(){
338
- var stringref = jQuery(this).attr("href").split('#')[1];
339
- jQuery('.aioseop_tab:not(#'+stringref+')').hide('slow');
340
- jQuery('.aioseop_tab#' + stringref).show('slow');
341
- jQuery('.aioseop_header_tab[href!="#'+stringref+'"]').removeClass('active');
342
- jQuery('.aioseop_header_tab[href="#' + stringref+'"]').addClass('active');
343
- return false;
344
- });
345
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Controls all the styling of the plugin.
3
+ *
4
+ * AIOSEOP Updates class.
5
+ * @author Michael Torbert.
6
+ * @author Semper Fi Web Design.
7
+ * @copyright http://semperplugins.com
8
+ * @version 1.0.0
9
+ */
10
+ if ( typeof aiosp_data != 'undefined' ) {
11
+
12
+ /**
13
+ * @since 1.0.0
14
+ * @param int $index.
15
+ * @param $value
16
+ */
17
+ jQuery.each( aiosp_data, function( index, value ) {
18
+ // aiosp_data[index] = value.json.replace(/&quot;/g, '"');
19
+ // aiosp_data[index] = jQuery.parseJSON( value );
20
+ if ( index == 0 ) {
21
+ if ( typeof value.condshow == 'undefined' ) {
22
+ aiosp_data[ index ].condshow = [];
23
+ }
24
+ } else {
25
+ if ( typeof value.condshow != 'undefined' ) {
26
+ aiosp_data[ 0 ].condshow =
27
+ jQuery.merge( aiosp_data[0].condshow, value.condshow );
28
+ }
29
+ }
30
+ });
31
+ aiosp_data = aiosp_data[0];
32
+ }
33
+
34
+ /**
35
+ * @summary Changes visibility.
36
+ *
37
+ * @since 1.0.0
38
+ * @param int $id.
39
+ */
40
+ function toggleVisibility( id ) {
41
+ var e = document.getElementById( id );
42
+ if ( e.style.display == 'block' )
43
+ e.style.display = 'none';
44
+ else
45
+ e.style.display = 'block';
46
+ }
47
+
48
+ /**
49
+ * @summary Counts characters.
50
+ *
51
+ * @since 1.0.0
52
+ * @param String $field.
53
+ * @param Int $cntfield.
54
+ * @return Mixed.
55
+ */
56
+ function countChars( field, cntfield ) {
57
+ var extra = 0;
58
+ var field_size;
59
+ if ( ( field.name == 'aiosp_title' )
60
+ && ( typeof aiosp_title_extra !== 'undefined' ) ) {
61
+ extra = aiosp_title_extra;
62
+ }
63
+ cntfield.value = field.value.length + extra;
64
+ if ( typeof field.size != 'undefined' ) {
65
+ field_size = field.size;
66
+ } else {
67
+ field_size = field.rows * field.cols;
68
+ }
69
+ if ( field_size < 10 )
70
+ return;
71
+ if ( cntfield.value > field_size ) {
72
+ cntfield.style.color = "#fff";
73
+ cntfield.style.backgroundColor = "#f00";
74
+ } else {
75
+ if ( cntfield.value > ( field_size - 6 ) ) {
76
+ cntfield.style.color = "#515151";
77
+ cntfield.style.backgroundColor = "#ff0";
78
+ } else {
79
+ cntfield.style.color = "#515151";
80
+ cntfield.style.backgroundColor = "#eee";
81
+ }
82
+ }
83
+ }
84
+
85
+ /**
86
+ * @summary Returns the fields value.
87
+ *
88
+ * @since 1.0.0
89
+ * @param String $field.
90
+ * @return Mixed.
91
+ */
92
+ function aioseop_get_field_value( field ) {
93
+ if ( field.length == 0 )
94
+ return field;
95
+ cur = jQuery('[name=' + field + ']');
96
+ if ( cur.length == 0 )
97
+ return field;
98
+ type = cur.attr('type');
99
+ if ( type == "checkbox" || type == "radio" )
100
+ cur = jQuery('input[name=' + field + ']:checked');
101
+ return cur.val();
102
+ }
103
+
104
+ /**
105
+ * @summary Returns the fields value.
106
+ *
107
+ * @since 1.0.0
108
+ * @param String $field.
109
+ * @return Mixed.
110
+ */
111
+ function aioseop_get_field_values( field ) {
112
+ arr = [];
113
+ cur = jQuery( '[name=' + field + ']' );
114
+ if ( cur.length == 0 )
115
+ return field;
116
+ type = cur.attr('type');
117
+ if ( type == "checkbox" || type == "radio" )
118
+ jQuery( 'input[name=' + field + ']:checked' ).each(function() {
119
+ arr.push(jQuery(this).val());
120
+ });
121
+ if ( arr.length <= 0 )
122
+ arr.push(cur.val());
123
+ return arr;
124
+ }
125
+
126
+ /**
127
+ * @summary Evaluates condshow logic.
128
+ *
129
+ * @since 1.0.0
130
+ * @param String $statement.
131
+ * @return Mixed.
132
+ */
133
+ function aioseop_eval_condshow_logic( statement ) {
134
+ var lhs, rhs;
135
+ if ( ( typeof statement ) == 'object' ) {
136
+ lhs = statement['lhs'];
137
+ rhs = statement['rhs'];
138
+ if ( lhs !== null && ( ( typeof lhs ) == 'object' ) )
139
+ lhs = aioseop_eval_condshow_logic( statement['lhs'] );
140
+ if ( rhs !== null && ( typeof rhs ) == 'object' )
141
+ rhs = aioseop_eval_condshow_logic( statement['rhs'] );
142
+ lhs = aioseop_get_field_value( lhs );
143
+ rhs = aioseop_get_field_value( rhs );
144
+ switch ( statement['op'] ) {
145
+ case 'NOT':
146
+ return ( ! lhs );
147
+ case 'AND':
148
+ return ( lhs && rhs );
149
+ case 'OR' :
150
+ return ( lhs || rhs );
151
+ case '==' :
152
+ return ( lhs == rhs );
153
+ case '!=' :
154
+ return ( lhs != rhs );
155
+ default :
156
+ return null;
157
+ }
158
+ }
159
+ return statement;
160
+ }
161
+
162
+ /**
163
+ * @summary Evaluates condshow logic.
164
+ *
165
+ * @since 1.0.0
166
+ * @param String $index.
167
+ * @param $value.
168
+ * @return Mixed.
169
+ */
170
+ function aioseop_do_condshow_match( index, value ) {
171
+ if ( typeof value != 'undefined' ) {
172
+ matches = true;
173
+ jQuery.each( value, function(subopt, setting) {
174
+ var statement;
175
+ if ( ( typeof setting ) == 'object' ) {
176
+ statement = aioseop_eval_condshow_logic( setting );
177
+ if ( ! statement ) {
178
+ matches = false;
179
+ }
180
+ } else {
181
+ if ( subopt.match( /\\\[\\\]/ ) ) { // special case for these -- pdb
182
+ cur = aioseop_get_field_values( subopt );
183
+ if ( jQuery.inArray( setting, cur, 0 ) < 0 ) {
184
+ matches = false;
185
+ }
186
+ } else {
187
+ cur = aioseop_get_field_value( subopt );
188
+ if ( cur != setting ) {
189
+ matches = false;
190
+ }
191
+ }
192
+ }
193
+ });
194
+ if ( matches ) {
195
+ jQuery( '#' + index + '_wrapper' ).show();
196
+ } else {
197
+ jQuery( '#' + index + '_wrapper' ).hide();
198
+ }
199
+ return matches;
200
+ }
201
+ return false;
202
+ }
203
+
204
+ /**
205
+ * @summary Adds condshow handlers.
206
+ *
207
+ * @since 1.0.0
208
+ * @param String $index.
209
+ * @param $value.
210
+ */
211
+ function aioseop_add_condshow_handlers( index, value ) {
212
+ if ( typeof value != 'undefined' ) {
213
+ jQuery.each(value, function(subopt, setting) {
214
+ jQuery('[name=' + subopt + ']').bind( "change keyup", function() {
215
+ aioseop_do_condshow_match( index, value );
216
+ });
217
+ });
218
+ }
219
+ }
220
+
221
+ /**
222
+ * @summary Does condshow.
223
+ *
224
+ * @since 1.0.0
225
+ * @param $condshow.
226
+ */
227
+ function aioseop_do_condshow( condshow ) {
228
+ if ( typeof aiosp_data.condshow != 'undefined' ) {
229
+ jQuery.each( aiosp_data.condshow, function( index, value ) {
230
+ aioseop_do_condshow_match( index, value );
231
+ aioseop_add_condshow_handlers( index, value );
232
+ });
233
+ }
234
+ }
235
+
236
+ /**
237
+ * @since 1.0.0
238
+ */
239
+ jQuery( document ).ready(function() {
240
+ if ( typeof aiosp_data != 'undefined' ) {
241
+ if ( typeof aiosp_data.condshow != 'undefined' ) {
242
+ aioseop_do_condshow( aiosp_data.condshow );
243
+ }
244
+ }
245
+ });
246
+
247
+ /**
248
+ * @since 1.0.0
249
+ * @return boolean.
250
+ */
251
+ jQuery( document ).ready(function() {
252
+ var image_field;
253
+ jQuery( '.aioseop_upload_image_button' ).click(function() {
254
+ window.send_to_editor = aioseopNewSendToEditor;
255
+ image_field = jQuery( this ).next();
256
+ formfield = image_field.attr( 'name' );
257
+ tb_show( '', 'media-upload.php?type=image&amp;TB_iframe=true' );
258
+ return false;
259
+ });
260
+ aioseopStoreSendToEditor = window.send_to_editor;
261
+ aioseopNewSendToEditor = function(html) {
262
+ imgurl = jQuery( 'img',html ).attr( 'src' );
263
+ if ( typeof( imgurl ) !== undefined )
264
+ image_field.val( imgurl );
265
+ tb_remove();
266
+ window.send_to_editor = aioseopStoreSendToEditor;
267
+ };
268
+ });
269
+
270
+ /**
271
+ * @summary workaround for bug that causes radio inputs to lose settings when meta box is dragged.
272
+ *
273
+ * props to commentluv for this fix
274
+ * @author commentluv.
275
+ * @link http://core.trac.wordpress.org/ticket/16972
276
+ * @since 1.0.0
277
+ */
278
+ jQuery( document ).ready(function() {
279
+
280
+ // listen for drag drop of metaboxes , bind mousedown to .hndle so it only fires when starting to drag
281
+ jQuery( '.hndle' ).mousedown(function() {
282
+
283
+ // 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
284
+ jQuery( '.wrap').mouseup(function() {
285
+ aiosp_store_radio();
286
+ setTimeout( 'aiosp_reclick_radio();', 50 );
287
+ });
288
+ })
289
+ });
290
+
291
+ /**
292
+ * @summary Stores object of all radio buttons that are checked for entire form.
293
+ *
294
+ * @since 1.0.0
295
+ */
296
+ function aiosp_store_radio() {
297
+ var radioshack = {};
298
+ jQuery( 'input[type="radio"]' ).each(function() {
299
+ if( jQuery( this ).is( ':checked' ) ) {
300
+ radioshack[ jQuery( this ).attr( 'name' ) ] = jQuery( this ).val();
301
+ }
302
+ jQuery( document ).data( 'radioshack', radioshack );
303
+ });
304
+ }
305
+
306
+ /**
307
+ * @summary Detects mouseup and restore all radio buttons that were checked.
308
+ *
309
+ * @since 1.0.0
310
+ */
311
+ function aiosp_reclick_radio() {
312
+
313
+ // gets the object of checked radio button names and values
314
+ var radios = jQuery( document ).data( 'radioshack' );
315
+
316
+ //steps thru each object element and trigger a click on it's corresponding radio button
317
+ for( key in radios ) {
318
+ jQuery( 'input[name="' + key + '"]' )
319
+ .filter( '[value="' + radios[ key ]+ '"]' )
320
+ .trigger( 'click' );
321
+ }
322
+ // unbinds the event listener on .wrap (prevents clicks on inputs from triggering function)
323
+ jQuery( '.wrap' ).unbind( 'mouseup' );
324
+ }
325
+
326
+ /**
327
+ * @summary Handdles ajax call.
328
+ *
329
+ * @since 1.0.0
330
+ * @param $action.
331
+ * @param $setting.
332
+ * @param $options.
333
+ * @param $success.
334
+ */
335
+ function aioseop_handle_ajax_call( action, settings, options, success ) {
336
+ var aioseop_sack = new sack( ajaxurl );
337
+ aioseop_sack.execute = 1;
338
+ aioseop_sack.method = 'POST';
339
+ aioseop_sack.setVar( "action", action );
340
+ aioseop_sack.setVar( "settings", settings );
341
+ aioseop_sack.setVar( "options", options );
342
+ if ( typeof success != 'undefined' ) {
343
+ aioseop_sack.onCompletion = success;
344
+ }
345
+ aioseop_sack.setVar(
346
+ "nonce-aioseop",
347
+ jQuery( 'input[name="nonce-aioseop"]' ).val()
348
+ );
349
+ aioseop_sack.setVar(
350
+ "nonce-aioseop-edit",
351
+ jQuery( 'input[name="nonce-aioseop-edit"]' ).val()
352
+ );
353
+ aioseop_sack.onError = function() {
354
+ alert( 'Ajax error on saving.' );
355
+ };
356
+ aioseop_sack.runAJAX();
357
+ }
358
+
359
+ /**
360
+ * @summary Handdles posts URL.
361
+ *
362
+ * @since 1.0.0
363
+ * @param $action.
364
+ * @param $setting.
365
+ * @param $options.
366
+ * @param $success.
367
+ */
368
+ function aioseop_handle_post_url( action, settings, options, success) {
369
+ jQuery("div#aiosp_"+settings).fadeOut('fast', function() {
370
+ var loading = '<label class="aioseop_loading aioseop_' + settings + '_loading"></label> Please wait...';
371
+ jQuery( "div#aiosp_"+ settings ).fadeIn( 'fast', function() {
372
+ aioseop_handle_ajax_call( action, settings, options, success);
373
+ });
374
+ jQuery( "div#aiosp_" + settings ).html( loading );
375
+ })
376
+ };
377
+
378
+ /**
379
+ * @summary Handles when AIOSEOP is overflowed.
380
+ *
381
+ * @since 1.0.0
382
+ * @param $element.
383
+ * @return mixed.
384
+ */
385
+ function aioseop_is_overflowed( element ) {
386
+ return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
387
+ }
388
+
389
+ /**
390
+ * @summary Handles when overflowed border.
391
+ *
392
+ * @since 1.0.0
393
+ * @param $el.
394
+ */
395
+ function aioseop_overflow_border( el ) {
396
+ if ( aioseop_is_overflowed( el ) ) {
397
+ el.className = 'aioseop_option_div aioseop_overflowed';
398
+ } else {
399
+ el.className = 'aioseop_option_div';
400
+ }
401
+ }
402
+
403
+ /**
404
+ * @since 1.0.0
405
+ * @return mixed.
406
+ */
407
+ jQuery( document ).ready(function() {
408
+ jQuery( "#poststuff .aioseop_radio_type input[type='radio']" ).on( 'click', function() {
409
+ var previousValue = jQuery( this ).attr( 'previousValue' );
410
+ var name = jQuery( this ).attr( 'name' );
411
+ if ( typeof previousValue == 'undefined' ) {
412
+ if ( jQuery( this ).prop( "checked" ) ) {
413
+ jQuery( this ).prop( 'checked', true );
414
+ jQuery( this ).attr( 'previousValue', 'checked' );
415
+ } else {
416
+ jQuery( this ).prop( 'checked', false );
417
+ jQuery( this ).attr( 'previousValue', false );
418
+ }
419
+ return;
420
+ }
421
+ if ( previousValue == 'checked' ) {
422
+ jQuery( this ).prop( 'checked', false );
423
+ jQuery( this ).attr( 'previousValue', false );
424
+ } else {
425
+ jQuery( "input[name=" + name + "]:radio" )
426
+ .attr( 'previousValue', false );
427
+ jQuery( this ).attr( 'previousValue', 'checked' );
428
+ }
429
+ });
430
+ if ( typeof aiosp_data.pointers != 'undefined' ) {
431
+
432
+ /**
433
+ * @since 1.0.0
434
+ * @param $index.
435
+ * @param $value.
436
+ * @return mixed.
437
+ */
438
+ jQuery.each( aiosp_data.pointers, function( index, value ) {
439
+ if ( value != 'undefined' && value.pointer_text != '' ) {
440
+ aioseop_show_pointer( index, value );
441
+ }
442
+ });
443
+ }
444
+
445
+ /**
446
+ * @since 1.0.0
447
+ * @param $e.
448
+ * @return boolean.
449
+ */
450
+ jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-modules-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left" )
451
+ .delegate("input[name='Submit']", "click", function( e ) {
452
+ e.preventDefault();
453
+ return false;
454
+ });
455
+
456
+ /**
457
+ * @since 1.0.0
458
+ * @param $e.
459
+ * @return boolean.
460
+ */
461
+ jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-modules-aioseop_feature_manager #aiosp_settings_form" )
462
+ .delegate( "input[name='Submit']", "click", function( e ) {
463
+ e.preventDefault();
464
+ aioseop_handle_post_url(
465
+ 'aioseop_ajax_save_settings',
466
+ 'ajax_settings_message',
467
+ jQuery( 'form#aiosp_settings_form' ).serialize(),
468
+ function() {
469
+ jQuery( '.wp-has-current-submenu' ).fadeIn( 'fast', function() {
470
+ aioseop_handle_ajax_call(
471
+ 'aioseop_ajax_get_menu_links',
472
+ 'ajax_settings_message',
473
+ jQuery.param( {target: '.wp-has-current-submenu > ul'} )
474
+ );
475
+ });
476
+ } );
477
+ return false;
478
+ });
479
+
480
+ /**
481
+ * @since 1.0.0
482
+ * @param $e.
483
+ * @return boolean.
484
+ */
485
+ jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left" )
486
+ .delegate("input[name='Submit']", "click", function( e ) {
487
+ e.preventDefault();
488
+ return false;
489
+ });
490
+
491
+ /**
492
+ * @since 1.0.0
493
+ * @param $e.
494
+ * @return boolean.
495
+ */
496
+ jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aiosp_settings_form" )
497
+ .delegate( "input[name='Submit']", "click", function( e ) {
498
+ e.preventDefault();
499
+ aioseop_handle_post_url(
500
+ 'aioseop_ajax_save_settings',
501
+ 'ajax_settings_message',
502
+ jQuery( 'form#aiosp_settings_form' ).serialize(),
503
+ function() {
504
+ jQuery( '.wp-has-current-submenu' ).fadeIn( 'fast', function() {
505
+ aioseop_handle_ajax_call(
506
+ 'aioseop_ajax_get_menu_links',
507
+ 'ajax_settings_message',
508
+ jQuery.param( {target: '.wp-has-current-submenu > ul'} )
509
+ );
510
+ });
511
+ } );
512
+ return false;
513
+ });
514
+
515
+ var selectors =
516
+ "div.aioseop_multicheckbox_type div.aioseop_option_div, #aiosp_sitemap_debug div.aioseop_option_div, #aiosp_performance_status div.aioseop_option_div";
517
+
518
+ /**
519
+ * @since 1.0.0
520
+ * @return boolean.
521
+ */
522
+ jQuery( "div#aiosp_sitemap_addl_pages_metabox" )
523
+ .delegate( "input[name='Submit']", "click", function() {
524
+ aioseop_handle_post_url(
525
+ 'aioseop_ajax_save_url',
526
+ 'sitemap_addl_pages',
527
+ jQuery( 'div#aiosp_sitemap_addl_pages_metabox input, div#aiosp_sitemap_addl_pages_metabox select' )
528
+ .serialize()
529
+ );
530
+ return false;
531
+ });
532
+
533
+ /**
534
+ * @since 1.0.0
535
+ * @return boolean.
536
+ */
537
+ jQuery( "div#aiosp_video_sitemap_addl_pages_metabox" )
538
+ .delegate( "input[name='Submit']", "click", function() {
539
+ aioseop_handle_post_url(
540
+ 'aioseop_ajax_save_url',
541
+ 'video_sitemap_addl_pages',
542
+ jQuery( 'div#aiosp_video_sitemap_addl_pages_metabox input, div#aiosp_video_sitemap_addl_pages_metabox select')
543
+ .serialize()
544
+ );
545
+ return false;
546
+ });
547
+
548
+ /**
549
+ * @since 1.0.0
550
+ * @param $e.
551
+ * @return boolean.
552
+ */
553
+ jQuery( "div#aiosp_sitemap_addl_pages_metabox" )
554
+ .delegate("a.aiosp_delete_url", "click", function( e ) {
555
+ e.preventDefault();
556
+ aioseop_handle_post_url(
557
+ 'aioseop_ajax_delete_url',
558
+ 'sitemap_addl_pages',
559
+ jQuery( this ).attr( "title" )
560
+ );
561
+ return false;
562
+ });
563
+
564
+ /**
565
+ * @since 1.0.0
566
+ * @param $e.
567
+ * @return boolean.
568
+ */
569
+ jQuery( "div#aiosp_video_sitemap_addl_pages_metabox" )
570
+ .delegate( "a.aiosp_delete_url", "click", function( e ) {
571
+ e.preventDefault();
572
+ aioseop_handle_post_url(
573
+ 'aioseop_ajax_delete_url',
574
+ 'video_sitemap_addl_pages',
575
+ jQuery( this ).attr( "title" )
576
+ );
577
+ return false;
578
+ });
579
+
580
+ /**
581
+ * @since 1.0.0
582
+ * @param $e.
583
+ * @return boolean.
584
+ */
585
+ jQuery( "div#aiosp_opengraph_scan_header" )
586
+ .delegate( "input[name='aiosp_opengraph_scan_header']", "click", function( e ) {
587
+ e.preventDefault();
588
+ aioseop_handle_post_url(
589
+ 'aioseop_ajax_scan_header',
590
+ 'opengraph_scan_header',
591
+ jQuery( 'div#aiosp_opengraph_scan_header' ).serialize()
592
+ );
593
+ return false;
594
+ });
595
+
596
+ /**
597
+ * @since 1.0.0
598
+ */
599
+ 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"]' )
600
+ .click(function() {
601
+ jQuery( this )
602
+ .parents( 'div:eq(0)' )
603
+ .find( ':checkbox' )
604
+ .prop( 'checked', this.checked );
605
+ });
606
+
607
+ /**
608
+ * @since 1.0.0
609
+ */
610
+ 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"]' )
611
+ .click(function () {
612
+ if ( ! this.checked )
613
+ jQuery( this )
614
+ .parents( 'div:eq(0)' )
615
+ .find( 'input[value="all"]:checkbox' )
616
+ .prop( 'checked', this.checked );
617
+ });
618
+
619
+ /**
620
+ * @since 1.0.0
621
+ */
622
+ jQuery( ".aioseop_tab:not(:first)" ).hide();
623
+
624
+ /**
625
+ * @since 1.0.0
626
+ */
627
+ jQuery( ".aioseop_tab:first" ).show();
628
+
629
+ /**
630
+ * @since 1.0.0
631
+ * @return boolean.
632
+ */
633
+ jQuery( "a.aioseop_header_tab" ).click(function() {
634
+ var stringref = jQuery( this ).attr( "href" ).split( '#' )[1];
635
+ jQuery( '.aioseop_tab:not(#' + stringref + ')' ).hide( 'slow' );
636
+ jQuery( '.aioseop_tab#' + stringref ).show( 'slow' );
637
+ jQuery( '.aioseop_header_tab[href!="#'+ stringref +'"]' ).removeClass( 'active' );
638
+ jQuery( '.aioseop_header_tab[href="#' + stringref +'"]' ).addClass( 'active' );
639
+ return false;
640
+ });
641
+ });
modules/aioseop_bad_robots.php CHANGED
@@ -1,155 +1,225 @@
1
  <?php
2
  /**
3
- * @package All-in-One-SEO-Pack
4
  */
5
- /**
6
- * The Bad Robots class.
7
- */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
 
 
9
  class All_in_One_SEO_Pack_Bad_Robots extends All_in_One_SEO_Pack_Module {
10
- function __construct( ) {
11
- $this->name = __('Bad Bot Blocker', 'all-in-one-seo-pack'); // Human-readable name of the plugin
12
- $this->prefix = 'aiosp_bad_robots_'; // option prefix
13
- $this->file = __FILE__; // the current file
 
 
 
 
14
  parent::__construct();
15
-
16
- $help_text = Array(
17
- 'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ),
18
- 'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ),
19
- 'track_blocks'=> __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ),
20
- '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' ),
21
- 'edit_blocks' => __( 'Check this to edit the list of disallowed user agents for blocking bad bots.', 'all-in-one-seo-pack' ),
22
- 'blocklist' => __( 'This is the list of disallowed user agents used for blocking bad bots.', 'all-in-one-seo-pack' ),
23
- 'referlist' => __( 'This is the list of disallowed referers used for blocking bad bots.', 'all-in-one-seo-pack' ),
24
- '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' ),
25
  );
26
-
27
  $this->default_options = array(
28
- 'block_bots' => Array( 'name' => __( 'Block Bad Bots using HTTP', 'all-in-one-seo-pack' ) ),
29
- 'block_refer' => Array( 'name' => __( 'Block Referral Spam using HTTP', 'all-in-one-seo-pack' ) ),
30
- 'track_blocks' => Array( 'name' => __( 'Track Blocked Bots', 'all-in-one-seo-pack' ) ),
31
- 'htaccess_rules' => Array( 'name' => __( 'Block Bad Bots using .htaccess', 'all-in-one-seo-pack' ) ),
32
- 'edit_blocks' => Array( 'name' => __( 'Use Custom Blocklists', 'all-in-one-seo-pack' ) ),
33
- '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() ) ),
34
- '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() ) ),
35
- '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' ) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  );
37
- $is_apache = false;
38
- if ( ( !empty($_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) ) {
39
  $is_apache = true;
40
- add_action( $this->prefix . 'settings_update', Array( $this, 'generate_htaccess_blocklist' ), 10 );
41
  } else {
42
- unset( $this->default_options["htaccess_rules"] );
43
- unset( $help_text["htaccess_rules"] );
44
  }
45
-
46
- if ( !empty( $help_text ) )
47
- foreach( $help_text as $k => $v )
48
- $this->default_options[$k]['help_text'] = $v;
49
-
50
- add_filter( $this->prefix . 'display_options', Array( $this, 'filter_display_options' ) );
51
-
52
- // load initial options / set defaults
53
- $this->update_options( );
54
-
 
 
55
  if ( $this->option_isset( 'edit_blocks' ) ) {
56
- add_filter( $this->prefix . 'badbotlist', Array( $this, 'filter_bad_botlist' ) );
57
  if ( $this->option_isset( 'block_refer' ) ) {
58
- add_filter( $this->prefix . 'badreferlist', Array( $this, 'filter_bad_referlist' ) );
59
  }
60
  }
61
-
62
  if ( $this->option_isset( 'block_bots' ) ) {
63
- if ( !$this->allow_bot() ) {
64
  status_header( 503 );
65
- $ip = $_SERVER['REMOTE_ADDR'];
66
  $user_agent = $_SERVER['HTTP_USER_AGENT'];
67
- $this->blocked_message( sprintf( __( "Blocked bot with IP %s -- matched user agent %s found in blocklist.", 'all-in-one-seo-pack' ), $ip, $user_agent ) );
68
  exit();
69
  } elseif ( $this->option_isset( 'block_refer' ) && $this->is_bad_referer() ) {
70
  status_header( 503 );
71
- $ip = $_SERVER['REMOTE_ADDR'];
72
  $referer = $_SERVER['HTTP_REFERER'];
73
- $this->blocked_message( sprintf( __( "Blocked bot with IP %s -- matched referer %s found in blocklist.", 'all-in-one-seo-pack' ), $ip, $referer ) );
74
  }
75
  }
76
  }
77
-
78
  function generate_htaccess_blocklist() {
79
- if ( !$this->option_isset( 'htaccess_rules' ) ) {
80
 
81
  if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, '' ) ) {
82
- aioseop_output_notice( __( "Updated .htaccess rules.", 'all-in-one-seo-pack' ) );
83
  } else {
84
- aioseop_output_notice( __( "Failed to update .htaccess rules!", 'all-in-one-seo-pack' ), "", "error" );
85
  }
86
-
87
  return;
88
-
89
  }
90
 
91
  if ( function_exists( 'apache_get_modules' ) ) {
92
  $modules = apache_get_modules();
93
- foreach( Array( 'mod_authz_host', 'mod_setenvif' ) as $m ) {
94
- if ( !in_array( $m, $modules ) ) {
95
- aioseop_output_notice( sprintf( __( "Apache module %s is required!", 'all-in-one-seo-pack' ), $m ), "", "error" );
96
  }
97
  }
98
  }
99
  $botlist = $this->default_bad_bots();
100
- $botlist = apply_filters( $this->prefix . "badbotlist", $botlist );
101
- if ( !empty( $botlist ) ) {
102
- $regex = $this->quote_list_for_regex( $botlist, '"' );
103
- $htaccess = Array();
104
  $htaccess[] = 'SetEnvIfNoCase User-Agent "' . $regex . '" bad_bot';
105
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
106
  $referlist = $this->default_bad_referers();
107
- $referlist = apply_filters( $this->prefix . "badreferlist", $botlist );
108
- if ( !empty( $referlist ) ) {
109
- $regex = $this->quote_list_for_regex( $referlist, '"' );
110
  $htaccess[] = 'SetEnvIfNoCase Referer "' . $regex . '" bad_bot';
111
  }
112
  }
113
  $htaccess[] = 'Deny from env=bad_bot';
114
  if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, $htaccess ) ) {
115
- aioseop_output_notice( __( "Updated .htaccess rules.", 'all-in-one-seo-pack' ) );
116
  } else {
117
- aioseop_output_notice( __( "Failed to update .htaccess rules!", 'all-in-one-seo-pack' ), "", "error" );
118
  }
119
  } else {
120
- aioseop_output_notice( __( "No rules to update!", 'all-in-one-seo-pack' ), "", "error" );
121
  }
122
  }
123
-
 
 
 
 
 
124
  function filter_bad_referlist( $referlist ) {
125
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
126
  $referlist = explode( "\n", $this->options["{$this->prefix}referlist"] );
127
  }
 
128
  return $referlist;
129
  }
130
-
 
 
 
 
 
131
  function filter_bad_botlist( $botlist ) {
132
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'blocklist' ) ) {
133
  $botlist = explode( "\n", $this->options["{$this->prefix}blocklist"] );
134
  }
 
135
  return $botlist;
136
  }
137
-
138
- /** Updates blocked log messages. **/
 
 
 
 
 
139
  function blocked_message( $msg ) {
140
- if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) $this->options["{$this->prefix}blocked_log"] = '';
 
 
141
  $this->options["{$this->prefix}blocked_log"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}blocked_log"];
142
  if ( $this->strlen( $this->options["{$this->prefix}blocked_log"] ) > 4096 ) {
143
  $end = $this->strrpos( $this->options["{$this->prefix}blocked_log"], "\n" );
144
- if ( $end === false ) $end = 4096;
 
 
145
  $this->options["{$this->prefix}blocked_log"] = $this->substr( $this->options["{$this->prefix}blocked_log"], 0, $end );
146
  }
147
  $this->update_class_option( $this->options );
148
  }
149
-
150
- /** Add in options for status display on settings page, sitemap rewriting on multisite. **/
 
 
 
 
 
 
 
 
 
151
  function filter_display_options( $options ) {
152
- if ( $this->option_isset( 'blocked_log' ) ) $options["{$this->prefix}blocked_log"] = '<pre>' . $options["{$this->prefix}blocked_log"] . '</pre>';
 
 
 
 
153
  return $options;
154
  }
155
  }
1
  <?php
2
  /**
3
+ * @package All-in-One-SEO-Pack
4
  */
5
+
6
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
7
+
8
+ /**
9
+ * Class All_in_One_SEO_Pack_Bad_Robots
10
+ */
11
  class All_in_One_SEO_Pack_Bad_Robots extends All_in_One_SEO_Pack_Module {
12
+
13
+ /**
14
+ * All_in_One_SEO_Pack_Bad_Robots constructor.
15
+ */
16
+ function __construct() {
17
+ $this->name = __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
18
+ $this->prefix = 'aiosp_bad_robots_'; // Option prefix.
19
+ $this->file = __FILE__; // The current file.
20
  parent::__construct();
21
+
22
+ $help_text = array(
23
+ 'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ),
24
+ 'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ),
25
+ 'track_blocks' => __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ),
26
+ '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' ),
27
+ 'edit_blocks' => __( 'Check this to edit the list of disallowed user agents for blocking bad bots.', 'all-in-one-seo-pack' ),
28
+ 'blocklist' => __( 'This is the list of disallowed user agents used for blocking bad bots.', 'all-in-one-seo-pack' ),
29
+ 'referlist' => __( 'This is the list of disallowed referers used for blocking bad bots.', 'all-in-one-seo-pack' ),
30
+ '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' ),
31
  );
32
+
33
  $this->default_options = array(
34
+ 'block_bots' => array( 'name' => __( 'Block Bad Bots using HTTP', 'all-in-one-seo-pack' ) ),
35
+ 'block_refer' => array( 'name' => __( 'Block Referral Spam using HTTP', 'all-in-one-seo-pack' ) ),
36
+ 'track_blocks' => array( 'name' => __( 'Track Blocked Bots', 'all-in-one-seo-pack' ) ),
37
+ 'htaccess_rules' => array( 'name' => __( 'Block Bad Bots using .htaccess', 'all-in-one-seo-pack' ) ),
38
+ 'edit_blocks' => array( 'name' => __( 'Use Custom Blocklists', 'all-in-one-seo-pack' ) ),
39
+ 'blocklist' => array(
40
+ 'name' => __( 'User Agent Blocklist', 'all-in-one-seo-pack' ),
41
+ 'type' => 'textarea',
42
+ 'rows' => 5,
43
+ 'cols' => 120,
44
+ 'condshow' => array( "{$this->prefix}edit_blocks" => 'on' ),
45
+ 'default' => join( "\n", $this->default_bad_bots() ),
46
+ ),
47
+ 'referlist' => array(
48
+ 'name' => __( 'Referer Blocklist', 'all-in-one-seo-pack' ),
49
+ 'type' => 'textarea',
50
+ 'rows' => 5,
51
+ 'cols' => 120,
52
+ 'condshow' => array(
53
+ "{$this->prefix}edit_blocks" => 'on',
54
+ "{$this->prefix}block_refer" => 'on',
55
+ ),
56
+ 'default' => join( "\n", $this->default_bad_referers() ),
57
+ ),
58
+ 'blocked_log' => array(
59
+ 'name' => __( 'Log Of Blocked Bots', 'all-in-one-seo-pack' ),
60
+ 'default' => __( 'No requests yet.', 'all-in-one-seo-pack' ),
61
+ 'type' => 'html',
62
+ 'disabled' => 'disabled',
63
+ 'save' => false,
64
+ 'label' => 'top',
65
+ 'rows' => 5,
66
+ 'cols' => 120,
67
+ 'style' => 'min-width:950px',
68
+ 'condshow' => array( "{$this->prefix}track_blocks" => 'on' ),
69
+ ),
70
  );
71
+ $is_apache = false;
72
+ if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) {
73
  $is_apache = true;
74
+ add_action( $this->prefix . 'settings_update', array( $this, 'generate_htaccess_blocklist' ), 10 );
75
  } else {
76
+ unset( $this->default_options['htaccess_rules'] );
77
+ unset( $help_text['htaccess_rules'] );
78
  }
79
+
80
+ if ( ! empty( $help_text ) ) {
81
+ foreach ( $help_text as $k => $v ) {
82
+ $this->default_options[ $k ]['help_text'] = $v;
83
+ }
84
+ }
85
+
86
+ add_filter( $this->prefix . 'display_options', array( $this, 'filter_display_options' ) );
87
+
88
+ // Load initial options / set defaults,
89
+ $this->update_options();
90
+
91
  if ( $this->option_isset( 'edit_blocks' ) ) {
92
+ add_filter( $this->prefix . 'badbotlist', array( $this, 'filter_bad_botlist' ) );
93
  if ( $this->option_isset( 'block_refer' ) ) {
94
+ add_filter( $this->prefix . 'badreferlist', array( $this, 'filter_bad_referlist' ) );
95
  }
96
  }
97
+
98
  if ( $this->option_isset( 'block_bots' ) ) {
99
+ if ( ! $this->allow_bot() ) {
100
  status_header( 503 );
101
+ $ip = $_SERVER['REMOTE_ADDR'];
102
  $user_agent = $_SERVER['HTTP_USER_AGENT'];
103
+ $this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched user agent %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $user_agent ) );
104
  exit();
105
  } elseif ( $this->option_isset( 'block_refer' ) && $this->is_bad_referer() ) {
106
  status_header( 503 );
107
+ $ip = $_SERVER['REMOTE_ADDR'];
108
  $referer = $_SERVER['HTTP_REFERER'];
109
+ $this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched referer %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $referer ) );
110
  }
111
  }
112
  }
113
+
114
  function generate_htaccess_blocklist() {
115
+ if ( ! $this->option_isset( 'htaccess_rules' ) ) {
116
 
117
  if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, '' ) ) {
118
+ aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) );
119
  } else {
120
+ aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' );
121
  }
122
+
123
  return;
124
+
125
  }
126
 
127
  if ( function_exists( 'apache_get_modules' ) ) {
128
  $modules = apache_get_modules();
129
+ foreach ( array( 'mod_authz_host', 'mod_setenvif' ) as $m ) {
130
+ if ( ! in_array( $m, $modules ) ) {
131
+ aioseop_output_notice( sprintf( __( 'Apache module %s is required!', 'all-in-one-seo-pack' ), $m ), '', 'error' );
132
  }
133
  }
134
  }
135
  $botlist = $this->default_bad_bots();
136
+ $botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
137
+ if ( ! empty( $botlist ) ) {
138
+ $regex = $this->quote_list_for_regex( $botlist, '"' );
139
+ $htaccess = array();
140
  $htaccess[] = 'SetEnvIfNoCase User-Agent "' . $regex . '" bad_bot';
141
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
142
  $referlist = $this->default_bad_referers();
143
+ $referlist = apply_filters( $this->prefix . 'badreferlist', $botlist );
144
+ if ( ! empty( $referlist ) ) {
145
+ $regex = $this->quote_list_for_regex( $referlist, '"' );
146
  $htaccess[] = 'SetEnvIfNoCase Referer "' . $regex . '" bad_bot';
147
  }
148
  }
149
  $htaccess[] = 'Deny from env=bad_bot';
150
  if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, $htaccess ) ) {
151
+ aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) );
152
  } else {
153
+ aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' );
154
  }
155
  } else {
156
+ aioseop_output_notice( __( 'No rules to update!', 'all-in-one-seo-pack' ), '', 'error' );
157
  }
158
  }
159
+
160
+ /**
161
+ * @param $referlist
162
+ *
163
+ * @return array
164
+ */
165
  function filter_bad_referlist( $referlist ) {
166
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
167
  $referlist = explode( "\n", $this->options["{$this->prefix}referlist"] );
168
  }
169
+
170
  return $referlist;
171
  }
172
+
173
+ /**
174
+ * @param $botlist
175
+ *
176
+ * @return array
177
+ */
178
  function filter_bad_botlist( $botlist ) {
179
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'blocklist' ) ) {
180
  $botlist = explode( "\n", $this->options["{$this->prefix}blocklist"] );
181
  }
182
+
183
  return $botlist;
184
  }
185
+
186
+
187
+ /**
188
+ * Updates blocked message.
189
+ *
190
+ * @param string $msg
191
+ */
192
  function blocked_message( $msg ) {
193
+ if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) {
194
+ $this->options["{$this->prefix}blocked_log"] = '';
195
+ }
196
  $this->options["{$this->prefix}blocked_log"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}blocked_log"];
197
  if ( $this->strlen( $this->options["{$this->prefix}blocked_log"] ) > 4096 ) {
198
  $end = $this->strrpos( $this->options["{$this->prefix}blocked_log"], "\n" );
199
+ if ( false === $end ) {
200
+ $end = 4096;
201
+ }
202
  $this->options["{$this->prefix}blocked_log"] = $this->substr( $this->options["{$this->prefix}blocked_log"], 0, $end );
203
  }
204
  $this->update_class_option( $this->options );
205
  }
206
+
207
+
208
+ /**
209
+ * Filter display options.
210
+ *
211
+ * Add in options for status display on settings page, sitemap rewriting on multisite.
212
+ *
213
+ * @param $options
214
+ *
215
+ * @return mixed
216
+ */
217
  function filter_display_options( $options ) {
218
+
219
+ if ( $this->option_isset( 'blocked_log' ) ) {
220
+ $options["{$this->prefix}blocked_log"] = '<pre>' . $options["{$this->prefix}blocked_log"] . '</pre>';
221
+ }
222
+
223
  return $options;
224
  }
225
  }
modules/aioseop_feature_manager.php CHANGED
@@ -1,130 +1,191 @@
1
  <?php
2
- /**
3
- * @package All-in-One-SEO-Pack
4
- */
5
  /**
6
  * The Feature Manager class.
 
 
7
  */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
 
 
 
 
 
9
  class All_in_One_SEO_Pack_Feature_Manager extends All_in_One_SEO_Pack_Module {
10
 
11
- protected $module_info = Array( );
12
 
 
 
 
 
 
13
  function __construct( $mod ) {
14
- $this->name = __('Feature Manager', 'all-in-one-seo-pack'); // Human-readable name of the plugin
15
- $this->prefix = 'aiosp_feature_manager_'; // option prefix
16
- $this->file = __FILE__; // the current file
17
  parent::__construct();
18
- $this->module_info = Array(
19
- 'sitemap' => Array( 'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
20
- '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' ) ),
21
- 'opengraph' => Array( 'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
22
- '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' ) ),
23
- 'robots' => Array( 'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
24
- 'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ) ),
25
- 'file_editor' => Array( 'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
26
- 'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ) ),
27
- 'importer_exporter' => Array( 'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
28
- 'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ) ),
29
- 'bad_robots' => Array( 'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
30
- 'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ) ),
31
- 'performance' => Array( 'name' => __( 'Performance', 'all-in-one-seo-pack' ),
32
- 'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
33
- 'default' => 'on' )
34
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
 
36
 
37
- if( AIOSEOPPRO ){
 
 
 
 
 
 
 
 
38
 
39
- $this->module_info['coming_soon'] = Array( 'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
40
- 'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
41
- 'save' => false );
42
- $this->module_info['video_sitemap'] = Array( 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
43
- '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' ) );
44
 
 
 
 
 
 
45
 
46
- }else{
47
 
48
- $this->module_info['coming_soon'] = Array( 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
49
- 'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
50
- 'save' => false ) ;
 
 
 
 
51
 
52
- }
 
 
53
 
54
- // Set up default settings fields
55
- // name - Human-readable name of the setting
56
- // help_text - Inline documentation for the setting
57
- // type - Type of field; this defaults to checkbox; currently supported types are checkbox, text, select, multiselect
58
- // default - Default value of the field
59
- // initial_options - Initial option list used for selects and multiselects
60
- // Other supported options: class, id, style -- allows you to set these HTML attributes on the field
 
 
 
 
 
61
 
62
- $this->default_options = array();
63
- $this->module_info = apply_filters( 'aioseop_module_info', $this->module_info );
64
- $mod[] = 'coming_soon';
65
-
66
- foreach ( $mod as $m ) {
67
- if ( $m == 'performance' && !is_super_admin() ) continue;
68
- $this->default_options["enable_$m"] = Array( 'name' => $this->module_info[$m]['name'],
69
- 'help_text' => $this->module_info[$m]['description'],
70
- 'type' => 'custom',
71
- 'class' => 'aioseop_feature',
72
- 'id' => "aioseop_$m",
73
- 'save' => true );
74
-
75
- if ( !empty( $this->module_info[$m]['image'] ) )
76
- $this->default_options["enable_$m"]['image'] = $this->module_info[$m]['image'];
77
- if ( !empty( $this->module_info[$m] ) )
78
- foreach( Array( 'save', 'default' ) as $option )
79
- if ( isset( $this->module_info[$m][$option] ) )
80
- $this->default_options["enable_$m"][$option] = $this->module_info[$m][$option];
81
  }
82
- $this->layout = Array(
83
- 'default' => Array(
84
- 'name' => $this->name,
85
- 'help_link' => 'http://semperplugins.com/documentation/feature-manager/',
86
- 'options' => array_keys( $this->default_options )
87
- )
88
  );
89
- // load initial options / set defaults
90
- $this->update_options( );
91
  if ( is_admin() ) {
92
- add_filter( $this->prefix . 'output_option', Array( $this, 'display_option_div' ), 10, 2 );
93
- add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ) );
94
  }
95
  }
96
 
 
 
 
 
 
97
  function menu_order() {
98
  return 20;
99
  }
100
 
 
 
 
 
 
101
  function filter_submit( $submit ) {
102
- $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' &raquo;';
103
- $submit['Submit']['class'] .= " hidden";
104
  $submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' &raquo;';
 
105
  return $submit;
106
  }
107
 
 
 
 
 
 
 
108
  function display_option_div( $buf, $args ) {
109
  $name = $img = $desc = $checkbox = $class = '';
110
- if ( isset( $args['options']['help_text'] ) && !empty( $args['options']['help_text'] ) )
111
  $desc .= '<p class="aioseop_desc">' . $args['options']['help_text'] . '</p>';
112
- if ($args['value']) $class = ' active';
113
- if ( isset( $args['options']['image'] ) && !empty( $args['options']['image'] ) )
 
 
 
114
  $img .= '<p><img src="' . AIOSEOP_PLUGIN_IMAGES_URL . $args['options']['image'] . '"></p>';
115
- else
116
  $img .= '<p><span class="aioseop_featured_image' . $class . '"></span></p>';
 
117
 
118
  if ( $args['options']['save'] ) {
119
  $name = "<h3>{$args['options']['name']}</h3>";
120
- $checkbox .= '<input type="checkbox" onchange="jQuery(\'#' . $args["options"]["id"] . ' .aioseop_featured_image, #' . $args["options"]["id"] . ' .feature_button\').toggleClass(\'active\', this.checked);jQuery(\'input[name=Submit]\').trigger(\'click\');" style="display:none;" id="' . $args['name'] . '" name="' . $args['name'] . '"';
121
- if ($args['value']) $checkbox .= " CHECKED";
 
 
122
  $checkbox .= '><span class="button-primary feature_button' . $class . '"></span>';
123
  } else {
124
  $name = "<b>{$args['options']['name']}</b>";
125
  }
126
- if ( !empty( $args['options']['id'] ) ) $args['attr'] .= " id='{$args['options']['id']}'";
127
- return $buf . "<div {$args['attr']}><label for='{$args['name']}'>{$name}{$img}{$desc}{$checkbox}</label></div>";
 
 
 
128
  }
129
  }
130
  }
1
  <?php
 
 
 
2
  /**
3
  * The Feature Manager class.
4
+ *
5
+ * @package All-in-One-SEO-Pack
6
  */
7
+
8
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
9
+
10
+ /**
11
+ * Class All_in_One_SEO_Pack_Feature_Manager
12
+ */
13
  class All_in_One_SEO_Pack_Feature_Manager extends All_in_One_SEO_Pack_Module {
14
 
15
+ protected $module_info = array();
16
 
17
+ /**
18
+ * All_in_One_SEO_Pack_Feature_Manager constructor.
19
+ *
20
+ * @param $mod Module.
21
+ */
22
  function __construct( $mod ) {
23
+ $this->name = __( 'Feature Manager', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
24
+ $this->prefix = 'aiosp_feature_manager_'; // Option prefix.
25
+ $this->file = __FILE__; // The current file.
26
  parent::__construct();
27
+ $this->module_info = array(
28
+ 'sitemap' => array(
29
+ 'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
30
+ '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' ),
31
+ ),
32
+ 'opengraph' => array(
33
+ 'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
34
+ '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' ),
35
+ ),
36
+ 'robots' => array(
37
+ 'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
38
+ 'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ),
39
+ ),
40
+ 'file_editor' => array(
41
+ 'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
42
+ 'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ),
43
+ ),
44
+ 'importer_exporter' => array(
45
+ 'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
46
+ 'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ),
47
+ ),
48
+ 'bad_robots' => array(
49
+ 'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
50
+ 'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ),
51
+ ),
52
+ 'performance' => array(
53
+ 'name' => __( 'Performance', 'all-in-one-seo-pack' ),
54
+ 'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
55
+ 'default' => 'on',
56
+ ),
57
+ );
58
 
59
+ if ( AIOSEOPPRO ) {
60
 
61
+ $this->module_info['coming_soon'] = array(
62
+ 'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
63
+ 'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
64
+ 'save' => false,
65
+ );
66
+ $this->module_info['video_sitemap'] = array(
67
+ 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
68
+ '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' ),
69
+ );
70
 
71
+ } else {
 
 
 
 
72
 
73
+ $this->module_info['coming_soon'] = array(
74
+ 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
75
+ 'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
76
+ 'save' => false,
77
+ );
78
 
79
+ }
80
 
81
+ // Set up default settings fields.
82
+ // Name - Human-readable name of the setting.
83
+ // Help_text - Inline documentation for the setting.
84
+ // Type - Type of field; this defaults to checkbox; currently supported types are checkbox, text, select, multiselect.
85
+ // Default - Default value of the field.
86
+ // Initial_options - Initial option list used for selects and multiselects.
87
+ // Other supported options: class, id, style -- allows you to set these HTML attributes on the field.
88
 
89
+ $this->default_options = array();
90
+ $this->module_info = apply_filters( 'aioseop_module_info', $this->module_info );
91
+ $mod[] = 'coming_soon';
92
 
93
+ foreach ( $mod as $m ) {
94
+ if ( 'performance' === $m && ! is_super_admin() ) {
95
+ continue;
96
+ }
97
+ $this->default_options["enable_$m"] = array(
98
+ 'name' => $this->module_info[ $m ]['name'],
99
+ 'help_text' => $this->module_info[ $m ]['description'],
100
+ 'type' => 'custom',
101
+ 'class' => 'aioseop_feature',
102
+ 'id' => "aioseop_$m",
103
+ 'save' => true,
104
+ );
105
 
106
+ if ( ! empty( $this->module_info[ $m ]['image'] ) ) {
107
+ $this->default_options["enable_$m"]['image'] = $this->module_info[ $m ]['image'];
108
+ }
109
+ if ( ! empty( $this->module_info[ $m ] ) ) {
110
+ foreach ( array( 'save', 'default' ) as $option ) {
111
+ if ( isset( $this->module_info[ $m ][ $option ] ) ) {
112
+ $this->default_options["enable_$m"][ $option ] = $this->module_info[ $m ][ $option ];
113
+ }
114
+ }
115
+ }
 
 
 
 
 
 
 
 
 
116
  }
117
+ $this->layout = array(
118
+ 'default' => array(
119
+ 'name' => $this->name,
120
+ 'help_link' => 'http://semperplugins.com/documentation/feature-manager/',
121
+ 'options' => array_keys( $this->default_options ),
122
+ ),
123
  );
124
+ // Load initial options / set defaults.
125
+ $this->update_options();
126
  if ( is_admin() ) {
127
+ add_filter( $this->prefix . 'output_option', array( $this, 'display_option_div' ), 10, 2 );
128
+ add_filter( $this->prefix . 'submit_options', array( $this, 'filter_submit' ) );
129
  }
130
  }
131
 
132
+ /**
133
+ * Determines the menu order.
134
+ *
135
+ * @return int
136
+ */
137
  function menu_order() {
138
  return 20;
139
  }
140
 
141
+ /**
142
+ * @param $submit
143
+ *
144
+ * @return mixed
145
+ */
146
  function filter_submit( $submit ) {
147
+ $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' &raquo;';
148
+ $submit['Submit']['class'] .= ' hidden';
149
  $submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' &raquo;';
150
+
151
  return $submit;
152
  }
153
 
154
+ /**
155
+ * @param $buf
156
+ * @param $args
157
+ *
158
+ * @return string
159
+ */
160
  function display_option_div( $buf, $args ) {
161
  $name = $img = $desc = $checkbox = $class = '';
162
+ if ( isset( $args['options']['help_text'] ) && ! empty( $args['options']['help_text'] ) ) {
163
  $desc .= '<p class="aioseop_desc">' . $args['options']['help_text'] . '</p>';
164
+ }
165
+ if ( $args['value'] ) {
166
+ $class = ' active';
167
+ }
168
+ if ( isset( $args['options']['image'] ) && ! empty( $args['options']['image'] ) ) {
169
  $img .= '<p><img src="' . AIOSEOP_PLUGIN_IMAGES_URL . $args['options']['image'] . '"></p>';
170
+ } else {
171
  $img .= '<p><span class="aioseop_featured_image' . $class . '"></span></p>';
172
+ }
173
 
174
  if ( $args['options']['save'] ) {
175
  $name = "<h3>{$args['options']['name']}</h3>";
176
+ $checkbox .= '<input type="checkbox" onchange="jQuery(\'#' . $args['options']['id'] . ' .aioseop_featured_image, #' . $args['options']['id'] . ' .feature_button\').toggleClass(\'active\', this.checked);jQuery(\'input[name=Submit]\').trigger(\'click\');" style="display:none;" id="' . $args['name'] . '" name="' . $args['name'] . '"';
177
+ if ( $args['value'] ) {
178
+ $checkbox .= ' CHECKED';
179
+ }
180
  $checkbox .= '><span class="button-primary feature_button' . $class . '"></span>';
181
  } else {
182
  $name = "<b>{$args['options']['name']}</b>";
183
  }
184
+ if ( ! empty( $args['options']['id'] ) ) {
185
+ $args['attr'] .= " id='{$args['options']['id']}'";
186
+ }
187
+
188
+ return $buf . "<div {$args['attr']}><label for='{$args['name']}'><div id='free-flag'>FREE</div>{$name}{$img}{$desc}{$checkbox}</label></div>";
189
  }
190
  }
191
  }
modules/aioseop_file_editor.php CHANGED
@@ -1,93 +1,145 @@
1
  <?php
 
2
  /**
3
- * @package All-in-One-SEO-Pack
4
- */
5
- /**
6
- * The File Editor class.
7
  */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
 
 
 
 
9
  class All_in_One_SEO_Pack_File_Editor extends All_in_One_SEO_Pack_Module {
10
 
11
- function __construct( ) {
12
- $this->name = __('File Editor', 'all-in-one-seo-pack'); // Human-readable name of the plugin
13
- $this->prefix = 'aiosp_file_editor_'; // option prefix
14
- $this->file = __FILE__; // the current file
 
 
 
15
  parent::__construct();
16
- if ( isset($_REQUEST['tab'] ) )
 
17
  $this->current_tab = $_REQUEST['tab'];
18
- else
19
- $this->current_tab = 'robots';
20
 
21
- $help_text = Array(
22
- 'robotfile' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ),
23
- 'htaccfile' => __( '.htaccess editor', 'all-in-one-seo-pack' )
24
  );
25
  $this->default_options = array(
26
- 'robotfile' => Array( 'name' => __( 'Edit Robots.txt', 'all-in-one-seo-pack'),
27
- 'save' => false, 'default' => '', 'type' => 'textarea', 'cols' => 70, 'rows' => 25, 'label' => 'top' ),
28
- 'htaccfile' => Array( 'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack'),
29
- 'save' => false, 'default' => '', 'type' => 'textarea', 'cols' => 70, 'rows' => 25, 'label' => 'top' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  );
31
 
32
- if ( !empty( $help_text ) )
33
- foreach( $help_text as $k => $v )
34
- $this->default_options[$k]['help_text'] = $v;
35
- $this->tabs = Array(
36
- 'robots' => Array( 'name' => __( 'robots.txt' ) ),
37
- 'htaccess' => Array( 'name' => __( '.htaccess' ) )
38
- );
39
-
40
- $this->layout = Array(
41
- 'robots' => Array(
42
- 'name' => __( 'Edit robots.txt', 'all-in-one-seo-pack' ),
43
- 'options' => Array( 'robotfile' ),
44
- 'tab' => 'robots'
45
- ),
46
- 'htaccess' => Array(
47
- 'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
48
- 'options' => Array( 'htaccfile' ),
49
- 'tab' => 'htaccess'
50
- )
51
- );
52
-
53
- $this->update_options( ); // load initial options / set defaults
 
 
54
  }
55
-
56
  function settings_page_init() {
57
- add_filter($this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 );
58
- add_filter($this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 );
59
  }
60
-
61
  function add_page_hooks() {
62
  parent::add_page_hooks();
63
- add_action($this->prefix . 'settings_update', Array($this, 'do_file_editor'), 10, 2 );
64
  }
65
-
 
 
 
 
 
 
66
  function filter_submit( $submit, $location ) {
67
  unset( $submit['Submit_Default'] );
68
  $submit['Submit']['type'] = 'hidden';
69
- if ( $this->current_tab == 'robots' )
70
- $submit['Submit_File_Editor'] = Array( 'type' => 'submit', 'class' => 'button-primary', 'value' => __('Update robots.txt', 'all-in-one-seo-pack') . ' &raquo;' );
71
- elseif ( $this->current_tab == 'htaccess' )
72
- $submit['Submit_htaccess'] = Array( 'type' => 'submit', 'class' => 'button-primary', 'value' => __('Update .htaccess', 'all-in-one-seo-pack') . ' &raquo;' );
 
 
 
 
 
 
 
 
 
 
73
  return $submit;
74
  }
75
-
 
 
 
 
 
 
76
  function filter_options( $options, $location ) {
77
  $prefix = $this->get_prefix( $location );
78
- if ( $this->current_tab == 'robots' )
79
- $options = $this->load_files( $options, Array( 'robotfile' => 'robots.txt' ), $prefix );
80
- elseif ( $this->current_tab == 'htaccess' )
81
- $options = $this->load_files( $options, Array( 'htaccfile' => '.htaccess' ), $prefix );
 
 
82
  return $options;
83
  }
84
 
 
 
 
 
85
  function do_file_editor( $options, $location ) {
86
  $prefix = $this->get_prefix( $location );
87
- if ( $this->current_tab == 'robots' && isset($_POST['Submit_File_Editor']) && $_POST['Submit_File_Editor'] )
88
- $this->save_files( Array( 'robotfile' => 'robots.txt' ), $prefix );
89
- elseif ( $this->current_tab == 'htaccess' && isset($_POST['Submit_htaccess']) && $_POST['Submit_htaccess'] )
90
- $this->save_files( Array( 'htaccfile' => '.htaccess' ), $prefix );
 
91
  }
92
  }
93
- }
1
  <?php
2
+
3
  /**
4
+ * The File Editor class.
5
+ *
6
+ * @package All-in-One-SEO-Pack
 
7
  */
8
+ if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
9
+
10
+ /**
11
+ * Class All_in_One_SEO_Pack_File_Editor
12
+ */
13
  class All_in_One_SEO_Pack_File_Editor extends All_in_One_SEO_Pack_Module {
14
 
15
+ /**
16
+ * All_in_One_SEO_Pack_File_Editor constructor.
17
+ */
18
+ function __construct() {
19
+ $this->name = __( 'File Editor', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
20
+ $this->prefix = 'aiosp_file_editor_'; // option prefix
21
+ $this->file = __FILE__; // the current file
22
  parent::__construct();
23
+ $this->current_tab = 'robots';
24
+ if ( isset( $_REQUEST['tab'] ) ) {
25
  $this->current_tab = $_REQUEST['tab'];
26
+ }
 
27
 
28
+ $help_text = array(
29
+ 'robotfile' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ),
30
+ 'htaccfile' => __( '.htaccess editor', 'all-in-one-seo-pack' ),
31
  );
32
  $this->default_options = array(
33
+ 'robotfile' => array(
34
+ 'name' => __( 'Edit Robots.txt', 'all-in-one-seo-pack' ),
35
+ 'save' => false,
36
+ 'default' => '',
37
+ 'type' => 'textarea',
38
+ 'cols' => 70,
39
+ 'rows' => 25,
40
+ 'label' => 'top',
41
+ ),
42
+ 'htaccfile' => array(
43
+ 'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
44
+ 'save' => false,
45
+ 'default' => '',
46
+ 'type' => 'textarea',
47
+ 'cols' => 70,
48
+ 'rows' => 25,
49
+ 'label' => 'top',
50
+ ),
51
  );
52
 
53
+ if ( ! empty( $help_text ) ) {
54
+ foreach ( $help_text as $k => $v ) {
55
+ $this->default_options[ $k ]['help_text'] = $v;
56
+ }
57
+ }
58
+ $this->tabs = array(
59
+ 'robots' => array( 'name' => __( 'robots.txt' ) ),
60
+ 'htaccess' => array( 'name' => __( '.htaccess' ) ),
61
+ );
62
+
63
+ $this->layout = array(
64
+ 'robots' => array(
65
+ 'name' => __( 'Edit robots.txt', 'all-in-one-seo-pack' ),
66
+ 'options' => array( 'robotfile' ),
67
+ 'tab' => 'robots',
68
+ ),
69
+ 'htaccess' => array(
70
+ 'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
71
+ 'options' => array( 'htaccfile' ),
72
+ 'tab' => 'htaccess',
73
+ ),
74
+ );
75
+
76
+ $this->update_options(); // load initial options / set defaults
77
  }
78
+
79
  function settings_page_init() {
80
+ add_filter( $this->prefix . 'display_options', array( $this, 'filter_options' ), 10, 2 );
81
+ add_filter( $this->prefix . 'submit_options', array( $this, 'filter_submit' ), 10, 2 );
82
  }
83
+
84
  function add_page_hooks() {
85
  parent::add_page_hooks();
86
+ add_action( $this->prefix . 'settings_update', array( $this, 'do_file_editor' ), 10, 2 );
87
  }
88
+
89
+ /**
90
+ * @param $submit
91
+ * @param $location
92
+ *
93
+ * @return mixed
94
+ */
95
  function filter_submit( $submit, $location ) {
96
  unset( $submit['Submit_Default'] );
97
  $submit['Submit']['type'] = 'hidden';
98
+ if ( 'robots' === $this->current_tab ) {
99
+ $submit['Submit_File_Editor'] = array(
100
+ 'type' => 'submit',
101
+ 'class' => 'button-primary',
102
+ 'value' => __( 'Update robots.txt', 'all-in-one-seo-pack' ) . ' &raquo;',
103
+ );
104
+ } elseif ( 'htaccess' === $this->current_tab ) {
105
+ $submit['Submit_htaccess'] = array(
106
+ 'type' => 'submit',
107
+ 'class' => 'button-primary',
108
+ 'value' => __( 'Update .htaccess', 'all-in-one-seo-pack' ) . ' &raquo;',
109
+ );
110
+ }
111
+
112
  return $submit;
113
  }
114
+
115
+ /**
116
+ * @param $options
117
+ * @param $location
118
+ *
119
+ * @return mixed
120
+ */
121
  function filter_options( $options, $location ) {
122
  $prefix = $this->get_prefix( $location );
123
+ if ( 'robots' === $this->current_tab ) {
124
+ $options = $this->load_files( $options, array( 'robotfile' => 'robots.txt' ), $prefix );
125
+ } elseif ( 'htaccess' === $this->current_tab ) {
126
+ $options = $this->load_files( $options, array( 'htaccfile' => '.htaccess' ), $prefix );
127
+ }
128
+
129
  return $options;
130
  }
131
 
132
+ /**
133
+ * @param $options This seems to be unused.
134
+ * @param $location
135
+ */
136
  function do_file_editor( $options, $location ) {
137
  $prefix = $this->get_prefix( $location );
138
+ if ( 'robots' === $this->current_tab && isset( $_POST['Submit_File_Editor'] ) && $_POST['Submit_File_Editor'] ) {
139
+ $this->save_files( array( 'robotfile' => 'robots.txt' ), $prefix );
140
+ } elseif ( 'htaccess' === $this->current_tab && isset( $_POST['Submit_htaccess'] ) && $_POST['Submit_htaccess'] ) {
141
+ $this->save_files( array( 'htaccfile' => '.htaccess' ), $prefix );
142
+ }
143
  }
144
  }
145
+ }
modules/aioseop_importer_exporter.php CHANGED
@@ -1,320 +1,572 @@
1
  <?php
2
- /**
3
- * @package All-in-One-SEO-Pack
4
- */
5
- /**
6
- * The Importer / Exporter class.
7
- */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
9
  class All_in_One_SEO_Pack_Importer_Exporter extends All_in_One_SEO_Pack_Module {
10
 
11
- function __construct( ) {
12
- $this->name = __( 'Importer & Exporter', 'all-in-one-seo-pack' ); // Human-readable name of the module
13
- $this->prefix = 'aiosp_importer_exporter_'; // option prefix
14
- $this->file = __FILE__;
 
 
 
 
15
  parent::__construct();
16
- $help_text = Array(
17
- "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.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
18
- "export_choices" => __( "You may choose to export settings from active modules, and content from post data.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack'),
19
- "export_post_types" => __( "Select which Post Types you want to export your All in One SEO Pack meta data for.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack')
 
 
 
 
 
 
 
 
 
20
  );
21
- $this->warnings = Array();
22
  $this->default_options = array(
23
- 'import_submit' => Array( 'name' => __( 'Import', 'all-in-one-seo-pack' ), 'default' => '', 'type' => 'file', 'save' => false ),
24
- 'export_choices' => Array( 'name' => __( 'Export Settings', 'all-in-one-seo-pack'),
25
- 'type' => 'multicheckbox',
26
- 'initial_options' => Array( 1 => 'General Settings',
27
- 2 => 'Post Data' ) ),
28
- 'export_post_types' => Array( 'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ),
29
- 'default' => Array( 'post' => 'post', 'page' => 'page' ),
30
- 'type' => 'multicheckbox',
31
- 'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ) ),
32
- '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') . "<br />" )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  );
34
-
35
- if ( !empty( $help_text ) )
36
- foreach( $help_text as $k => $v )
37
- $this->default_options[$k]['help_text'] = $v;
38
-
39
  $this->layout = Array(
40
  'default' => Array(
41
- 'name' => $this->name,
42
- 'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/',
43
- 'options' => array_keys( $this->default_options )
44
- )
45
  );
46
-
47
- // load initial options / set defaults
48
 
 
49
  add_action( 'admin_init', Array( $this, 'debug_post_types' ), 5 );
50
  }
51
-
 
52
  function settings_page_init() {
53
- add_filter($this->prefix . 'submit_options', Array( $this, 'filter_submit' ) );
 
 
 
54
  }
55
-
 
 
 
 
 
 
56
  function filter_submit( $submit ) {
57
- $submit['Submit']['value'] = __('Import', 'all-in-one-seo-pack') . ' &raquo;';
58
- return Array( 'export_submit' => Array( 'type' => 'submit',
59
- 'class' => 'button-primary',
60
- 'value' => __('Export', 'all-in-one-seo-pack') . ' &raquo;' ) ) + $submit;
 
 
 
 
 
 
 
 
 
61
  }
62
-
63
- function debug_post_types( ) {
64
- $post_types = $this->get_post_type_titles( );
65
- $rempost = array( 'attachment' => 1, 'revision' => 1, 'nav_menu_item' => 1 );
66
- $this->default_options['export_post_types']['initial_options'] = array_diff_key( $post_types, $rempost );
67
-
 
 
 
 
 
 
 
68
  global $aioseop_modules;
69
- if ( !empty( $aioseop_modules ) ) {
70
  $modules = $aioseop_modules->get_loaded_module_list();
71
- if ( !empty( $modules ) && !empty( $modules['feature_manager'] ) )
72
  unset( $modules['feature_manager'] );
73
- if ( !empty( $modules ) ) {
 
74
  $this->default_options['import_export_help']['default'] .= "<ul>\n";
75
- foreach( $modules as $m ) {
76
  $module = $aioseop_modules->return_module( $m );
77
- $this->default_options['import_export_help']['default'] .= "\t<li>" . $module->name . "</li>\n";
 
78
  }
79
- $this->default_options['import_export_help']['default'] .= "\n</ul>\n";
80
- } else $this->default_options['import_export_help']['default'] .= "<br />" . __( "There are no other modules currently loaded!", 'all-in-one-seo-pack' );
 
 
 
 
 
 
81
  }
82
- $this->default_options['import_export_help']['default'] .= '<br />' . __( "You may change this by activating or deactivating modules in the Feature Manager.", 'all-in-one-seo-pack' );
83
- $this->update_options( );
84
-
85
- if ( !empty( $_REQUEST['export_submit'] ) )
 
 
 
 
86
  $this->do_importer_exporter();
87
- else
88
- add_action( $this->prefix . 'settings_update', Array( $this, 'do_importer_exporter' ) );
 
 
 
 
89
  }
90
-
91
- function importer_exporter_export( $args ){
92
 
93
- /* Add all settings to settings file */
 
 
 
 
 
 
 
 
94
  $name = $this->get_option_name();
95
-
96
- $buf = '[' . $this->get_option_name() . "]\n";
97
- if( !empty( $this->options ) ) {
98
  foreach ( $this->options as $key => $value ) {
99
- $buf .= "$key = '" . str_replace("'", "\'", trim( serialize( $value ) ) ) . "'\n";
 
 
 
 
100
  }
101
  }
 
102
  return $buf;
103
  }
104
-
105
- function show_import_warnings(){
 
 
106
  echo '<div class="error fade" style="width:52%">';
107
- if( is_array( $this->warnings ) ){
108
- foreach( $this->warnings as $warning ){
109
- echo "<p>{$warning}</p>";
110
- }
111
  }
 
112
  echo '</div>';
113
  }
114
-
 
 
 
 
 
 
115
  function parse_ini_helper( $array ) {
116
- $returnArray = array();
117
- if (is_array($array)) {
118
- foreach ($array as $key => $value) {
119
- $e = explode(':', $key);
120
- if (!empty($e[1])) {
121
- $x = array();
122
- foreach ($e as $tk => $tv) {
123
- $x[$tk] = trim($tv);
124
- }
125
- $x = array_reverse($x, true);
126
- foreach ($x as $k => $v) {
127
- $c = $x[0];
128
- if (empty($returnArray[$c])) {
129
- $returnArray[$c] = array();
130
- }
131
- if (isset($returnArray[$x[1]])) {
132
- $returnArray[$c] = array_merge($returnArray[$c], $returnArray[$x[1]]);
133
- }
134
- if ($k === 0) {
135
- $returnArray[$c] = array_merge($returnArray[$c], $array[$key]);
136
- }
137
- }
138
- } else {
139
- $returnArray[$key] = $array[$key];
140
- }
141
- }
142
- }
143
- return $returnArray;
 
 
 
 
 
144
  }
145
-
 
 
 
 
 
 
146
  function recursive_parse( $array ) {
147
- $returnArray = array();
148
- if (is_array($array)) {
149
- foreach ($array as $key => $value) {
150
- if (is_array($value)) {
151
- $array[$key] = $this->recursive_parse( $value );
152
- }
153
- $x = explode('.', $key);
154
- if (!empty($x[1])) {
155
- $x = array_reverse($x, true);
156
- if (isset($returnArray[$key])) {
157
- unset($returnArray[$key]);
158
- }
159
- if (!isset($returnArray[$x[0]])) {
160
- $returnArray[$x[0]] = array();
161
- }
162
- $first = true;
163
- foreach ($x as $k => $v) {
164
- if ($first === true) {
165
- $b = $array[$key];
166
- $first = false;
167
- }
168
- $b = array($v => $b);
169
- }
170
- $returnArray[$x[0]] = array_merge_recursive( $returnArray[$x[0]], $b[$x[0]] );
171
- } else {
172
- $returnArray[$key] = $array[$key];
173
- }
174
- }
175
- }
176
- return $returnArray;
 
 
 
177
  }
178
-
179
- function get_ini_file( $assoc_arr, $has_sections=TRUE ) {
180
- $content = "";
181
- if ($has_sections) {
182
- foreach ($assoc_arr as $key=>$elem) {
183
- $content .= "[".$key."]\n";
184
- foreach ($elem as $key2=>$elem2) {
185
- if(is_array($elem2))
186
- {
187
- for($i=0;$i<count($elem2);$i++)
188
- {
189
- $content .= $key2."[] = \"".$elem2[$i]."\"\n";
190
- }
191
- }
192
- else if ($elem2=="") $content .= $key2." = \n";
193
- else $content .= $key2." = \"".$elem2."\"\n";
194
- }
195
- }
196
- } else {
197
- foreach ($assoc_arr as $key=>$elem) {
198
- if( is_array( $elem ) ) {
199
- for($i=0;$i<count($elem);$i++) {
200
- $content .= $key2."[] = \"".$elem[$i]."\"\n";
201
- }
202
- } else if ($elem=="") $content .= $key2." = \n";
203
- else $content .= $key2." = \"".$elem."\"\n";
204
- }
205
- }
206
- return $content;
 
 
 
 
 
 
 
 
 
 
 
207
  }
208
-
 
 
 
 
 
 
209
  function parse_ini_advanced( $string ) {
210
- return $this->recursive_parse( $this->parse_ini_helper( parse_ini_string( $string, true ) ) );
 
 
 
 
211
  }
212
-
213
- function do_importer_exporter( ) {
214
- $submit = null; $count = 0; $post_exists = null; $post_warning = null;
 
 
 
 
215
  global $aioseop_options, $aiosp, $aioseop_module_list;
216
- if ( isset( $_REQUEST['nonce-aioseop'] ) ) $nonce = $_REQUEST['nonce-aioseop'];
217
- $post_fields = Array( 'keywords', 'description', 'title', 'meta', 'disable', 'disable', 'disable_analytics', 'titleatr', 'menulabel', 'togglekeywords' );
218
- if ( !empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) $submit = "Import";
219
- if ( !empty( $_REQUEST['export_submit'] ) ) $submit = 'Export';
220
- if ( ($submit != null ) && ( wp_verify_nonce( $nonce, 'aioseop-nonce') ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  switch ( $submit ) {
222
  case 'Import':
223
- /* Parse export file */
224
- $file = file( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] );
225
- $section = Array(); $section_label = null;
226
- foreach ( $file as $line_number => $line ) {
227
- $line = trim( $line );
 
 
 
 
228
  $matches = Array();
229
- if ( empty( $line ) ) continue;
230
- if ( $line[0] == ';' ) continue;
231
- if ( preg_match("/^\[(\S+)\]$/", $line, $label ) ) {
 
 
 
 
232
  $section_label = strval( $label[1] );
233
- if ( $section_label == 'post_data') $count++;
234
- if ( !isset( $section[ $section_label ] ) )
 
 
235
  $section[ $section_label ] = Array();
 
236
  } elseif ( preg_match( "/^(\S+)\s*=\s*'(.*)'$/", $line, $matches ) ) {
237
- if ( $section_label == 'post_data')
238
- $section[ $section_label ][$count][ $matches[ 1 ] ] = $matches[ 2 ];
239
- else
240
- $section[ $section_label ][ $matches[ 1 ] ] = $matches[ 2 ];
 
241
  } elseif ( preg_match( "/^(\S+)\s*=\s*NULL$/", $line, $matches ) ) {
242
- if( $section_label == 'post_data' )
243
- $section[ $section_label ][$count][ $matches[ 1 ] ] = NULL;
244
- else
245
- $section[ $section_label ][ $matches[ 1 ] ] = NULL;
 
246
  } else {
247
- $this->warnings[] = sprintf( __( '<b>Warning:</b> Line not matched: <b>"%s"</b>, On Line: <b>%s</b>', 'all-in-one-seo-pack' ), $line, $line_number ) ;
 
 
 
 
 
 
 
248
  }
249
- }
250
- /* Update Plugin Settings */
251
- if( is_array( $section ) ) {
252
- foreach( $section as $label => $module_options ) {
253
- if( is_array( $module_options ) ) {
254
- foreach( $module_options as $key => $value ) {
255
- /* Update Post Data */
256
- if( $label == 'post_data' ) {
257
- $post_exists = post_exists( $module_options[$key]['post_title'], '', $module_options[$key]['post_date'] );
258
- $target = get_post( $post_exists );
259
- if( ( !empty( $module_options[$key]['post_type'] ) ) && $post_exists != null ) {
260
- if( is_array($value) )
261
- foreach ( $value as $field_name => $field_value )
262
- if ( substr( $field_name, 1, 7) == 'aioseop' )
263
- if ( $value )
264
- update_post_meta( $target->ID, $field_name, maybe_unserialize( $field_value ) );
265
- else
266
- delete_post_meta($target->ID, $field_name );
267
- $post_exists = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  } else {
269
- $target_title = $module_options[$key]['post_title'];
270
- $post_warning = sprintf( __( '<b>Warning:</b> This following post could not be found: <b>"%s"</b>', 'all-in-one-seo-pack' ), $target_title );
271
- }
272
- if ( $post_warning != null ) {
273
- $this->warnings[] = $post_warning;
274
- $post_warning = null;
275
  }
276
-
277
- /* Update Module Settings */
278
- } else{ $module_options[$key] = str_replace( Array( "\'", '\n', '\r' ), Array( "'", "\n", "\r" ), maybe_unserialize( $value ) ); }
 
 
 
 
279
  }
280
- /* Update Module Settings */
281
- $this->update_class_option( $module_options, $label );
282
  }
283
  }
284
- }
285
-
286
-
287
-
288
- /* Show all errors found */
289
- if( !empty( $this->warnings ) ) {
290
- add_action( $this->prefix . 'settings_header', Array( $this, 'show_import_warnings' ), 5 );
291
  }
292
-
293
- break;
294
- case 'Export':
295
-
296
- /* Create File Contents */
297
- $settings_file = "settings_aioseop.ini";
298
- $buf = "; " . __( 'Settings export file for All in One SEO Pack', 'all-in-one-seo-pack' ) . "\n";
299
-
300
- /* Add all settings to settings file */
 
 
 
 
 
 
 
 
 
 
 
 
301
  $buf = $aiosp->settings_export( $buf );
302
  $buf = apply_filters( 'aioseop_export_settings', $buf );
303
-
304
- /* Send File to browser */
305
- $strlength = strlen($buf);
306
- header("Content-type: application/ini");
307
- header("Content-Disposition: attachment; filename=$settings_file");
308
- header("Content-Length: " . $strlength);
309
-
 
 
310
  echo $buf;
311
  die();
312
- break;
313
  }
314
- }
 
 
 
 
315
  }
316
-
317
- function settings_update( ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  }
319
  }
320
  }
1
  <?php
2
+
3
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
4
+
5
+
6
+ /**
7
+ * Class All_in_One_SEO_Pack_Importer_Exporter
8
+ */
9
  class All_in_One_SEO_Pack_Importer_Exporter extends All_in_One_SEO_Pack_Module {
10
 
11
+
12
+ /**
13
+ * All_in_One_SEO_Pack_Importer_Exporter constructor.
14
+ */
15
+ function __construct() {
16
+ $this->name = __( 'Importer & Exporter', 'all-in-one-seo-pack' ); // Human-readable name of the module
17
+ $this->prefix = 'aiosp_importer_exporter_'; // option prefix
18
+ $this->file = __FILE__;
19
  parent::__construct();
20
+ $help_text = Array(
21
+ 'import_submit' => __(
22
+ "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.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
23
+ 'all-in-one-seo-pack'
24
+ ),
25
+ 'export_choices' => __(
26
+ "You may choose to export settings from active modules, and content from post data.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
27
+ 'all-in-one-seo-pack'
28
+ ),
29
+ 'export_post_types' => __(
30
+ "Select which Post Types you want to export your All in One SEO Pack meta data for.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
31
+ 'all-in-one-seo-pack'
32
+ )
33
  );
34
+ $this->warnings = Array();
35
  $this->default_options = array(
36
+ 'import_submit' => Array(
37
+ 'name' => __( 'Import', 'all-in-one-seo-pack' ),
38
+ 'default' => '',
39
+ 'type' => 'file',
40
+ 'save' => false
41
+ ),
42
+ 'export_choices' => Array(
43
+ 'name' => __( 'Export Settings', 'all-in-one-seo-pack' ),
44
+ 'type' => 'multicheckbox',
45
+ 'initial_options' => Array(
46
+ 1 => 'General Settings',
47
+ 2 => 'Post Data'
48
+ )
49
+ ),
50
+ 'export_post_types' => Array(
51
+ 'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ),
52
+ 'default' => Array(
53
+ 'post' => 'post',
54
+ 'page' => 'page'
55
+ ),
56
+ 'type' => 'multicheckbox',
57
+ 'initial_options' => $this->get_post_type_titles(
58
+ Array( '_builtin' => false )
59
+ )
60
+ ),
61
+ 'import_export_help' => Array(
62
+ 'type' => 'html',
63
+ 'label' => 'none',
64
+ 'default' => __(
65
+ 'Note: If General Settings is checked, the
66
+ General Settings, the Feature Manager settings,
67
+ and the following currently active modules will
68
+ have their settings data exported:',
69
+ 'all-in-one-seo-pack'
70
+ ) . '<br />'
71
+ )
72
  );
73
+ if ( ! empty( $help_text ) ) {
74
+ foreach ( $help_text as $k => $v ) {
75
+ $this->default_options[ $k ]['help_text'] = $v;
76
+ }
77
+ }
78
  $this->layout = Array(
79
  'default' => Array(
80
+ 'name' => $this->name,
81
+ 'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/',
82
+ 'options' => array_keys( $this->default_options )
83
+ )
84
  );
 
 
85
 
86
+ // load initial options / set defaults
87
  add_action( 'admin_init', Array( $this, 'debug_post_types' ), 5 );
88
  }
89
+
90
+
91
  function settings_page_init() {
92
+ add_filter(
93
+ $this->prefix . 'submit_options',
94
+ Array( $this, 'filter_submit' )
95
+ );
96
  }
97
+
98
+
99
+ /**
100
+ * @param $submit
101
+ *
102
+ * @return array
103
+ */
104
  function filter_submit( $submit ) {
105
+ $submit['Submit']['value'] = __(
106
+ 'Import',
107
+ 'all-in-one-seo-pack'
108
+ )
109
+ . ' &raquo;';
110
+
111
+ return Array(
112
+ 'export_submit' => Array(
113
+ 'type' => 'submit',
114
+ 'class' => 'button-primary',
115
+ 'value' => __( 'Export', 'all-in-one-seo-pack' ) . ' &raquo;'
116
+ )
117
+ ) + $submit;
118
  }
119
+
120
+
121
+ function debug_post_types() {
122
+ $post_types = $this->get_post_type_titles();
123
+ $rempost = array(
124
+ 'attachment' => 1,
125
+ 'revision' => 1,
126
+ 'nav_menu_item' => 1
127
+ );
128
+ $this->default_options['export_post_types']['initial_options'] = array_diff_key(
129
+ $post_types,
130
+ $rempost
131
+ );
132
  global $aioseop_modules;
133
+ if ( ! empty( $aioseop_modules ) ) {
134
  $modules = $aioseop_modules->get_loaded_module_list();
135
+ if ( ! empty( $modules ) && ! empty( $modules['feature_manager'] ) ) {
136
  unset( $modules['feature_manager'] );
137
+ }
138
+ if ( ! empty( $modules ) ) {
139
  $this->default_options['import_export_help']['default'] .= "<ul>\n";
140
+ foreach ( $modules as $m ) {
141
  $module = $aioseop_modules->return_module( $m );
142
+ $this->default_options['import_export_help']['default'] .=
143
+ "\t<li>" . $module->name . "</li>\n";
144
  }
145
+ $this->default_options['import_export_help']['default'] .= "\n</ul>\n";
146
+ } else {
147
+ $this->default_options['import_export_help']['default'] .= '<br />'
148
+ . __(
149
+ 'There are no other modules currently loaded!',
150
+ 'all-in-one-seo-pack'
151
+ );
152
+ }
153
  }
154
+ $this->default_options['import_export_help']['default'] .= '<br />'
155
+ . __(
156
+ 'You may change this by activating or deactivating
157
+ modules in the Feature Manager.',
158
+ 'all-in-one-seo-pack'
159
+ );
160
+ $this->update_options();
161
+ if ( ! empty( $_REQUEST['export_submit'] ) ) {
162
  $this->do_importer_exporter();
163
+ } else {
164
+ add_action(
165
+ $this->prefix . 'settings_update',
166
+ Array( $this, 'do_importer_exporter' )
167
+ );
168
+ }
169
  }
 
 
170
 
171
+
172
+ /**
173
+ * @param $args
174
+ *
175
+ * @return string
176
+ */
177
+ function importer_exporter_export( $args ) {
178
+
179
+ // Adds all settings to settings file
180
  $name = $this->get_option_name();
181
+ $buf = '[' . $this->get_option_name() . "]\n";
182
+ if ( ! empty( $this->options ) ) {
 
183
  foreach ( $this->options as $key => $value ) {
184
+ $buf .= "$key = '" . str_replace(
185
+ "'",
186
+ "\'",
187
+ trim( serialize( $value ) )
188
+ ) . "'\n";
189
  }
190
  }
191
+
192
  return $buf;
193
  }
194
+
195
+
196
+ function show_import_warnings() {
197
+
198
  echo '<div class="error fade" style="width:52%">';
199
+
200
+ if ( is_array( $this->warnings ) ) {
201
+ foreach ( $this->warnings as $warning ) {
202
+ echo "<p>{$warning}</p>";
203
  }
204
+ }
205
  echo '</div>';
206
  }
207
+
208
+
209
+ /**
210
+ * @param $array
211
+ *
212
+ * @return array
213
+ */
214
  function parse_ini_helper( $array ) {
215
+ $returnArray = array();
216
+ if ( is_array( $array ) ) {
217
+ foreach ( $array as $key => $value ) {
218
+ $e = explode( ':', $key );
219
+ if ( ! empty( $e[1] ) ) {
220
+ $x = array();
221
+ foreach ( $e as $tk => $tv ) {
222
+ $x[ $tk ] = trim( $tv );
223
+ }
224
+ $x = array_reverse( $x, true );
225
+ foreach ( $x as $k => $v ) {
226
+ $c = $x[0];
227
+ if ( empty( $returnArray[ $c ] ) ) {
228
+ $returnArray[ $c ] = array();
229
+ }
230
+ if ( isset( $returnArray[ $x[1] ] ) ) {
231
+ $returnArray[ $c ] = array_merge(
232
+ $returnArray[ $c ], $returnArray[ $x[1] ]
233
+ );
234
+ }
235
+ if ( $k === 0 ) {
236
+ $returnArray[ $c ] = array_merge(
237
+ $returnArray[ $c ], $array[ $key ]
238
+ );
239
+ }
240
+ }
241
+ } else {
242
+ $returnArray[ $key ] = $array[ $key ];
243
+ }
244
+ }
245
+ }
246
+
247
+ return $returnArray;
248
  }
249
+
250
+
251
+ /**
252
+ * @param $array
253
+ *
254
+ * @return array
255
+ */
256
  function recursive_parse( $array ) {
257
+ $returnArray = array();
258
+ if ( is_array( $array ) ) {
259
+ foreach ( $array as $key => $value ) {
260
+ if ( is_array( $value ) ) {
261
+ $array[ $key ] = $this->recursive_parse( $value );
262
+ }
263
+ $x = explode( '.', $key );
264
+ if ( ! empty( $x[1] ) ) {
265
+ $x = array_reverse( $x, true );
266
+ if ( isset( $returnArray[ $key ] ) ) {
267
+ unset( $returnArray[ $key ] );
268
+ }
269
+ if ( ! isset( $returnArray[ $x[0] ] ) ) {
270
+ $returnArray[ $x[0] ] = array();
271
+ }
272
+ $first = true;
273
+ foreach ( $x as $k => $v ) {
274
+ if ( $first === true ) {
275
+ $b = $array[ $key ];
276
+ $first = false;
277
+ }
278
+ $b = array( $v => $b );
279
+ }
280
+ $returnArray[ $x[0] ] = array_merge_recursive(
281
+ $returnArray[ $x[0] ], $b[ $x[0] ]
282
+ );
283
+ } else {
284
+ $returnArray[ $key ] = $array[ $key ];
285
+ }
286
+ }
287
+ }
288
+
289
+ return $returnArray;
290
  }
291
+
292
+
293
+ /**
294
+ * @param $assoc_arr
295
+ * @param bool $has_sections
296
+ *
297
+ * @return string
298
+ */
299
+ function get_ini_file( $assoc_arr, $has_sections = true ) {
300
+ $content = '';
301
+ if ( $has_sections ) {
302
+ foreach ( $assoc_arr as $key => $elem ) {
303
+ $content .= '[' . $key . "]\n";
304
+ foreach ( $elem as $key2 => $elem2 ) {
305
+ if ( is_array( $elem2 ) ) {
306
+ for ( $i = 0; $i < count( $elem2 ); $i ++ ) {
307
+ $content .= $key2 . "[] = \"" . $elem2[ $i ] . "\"\n";
308
+ }
309
+ } else if ( $elem2 == '' ) {
310
+ $content .= $key2 . " = \n";
311
+ } else {
312
+ $content .= $key2 . " = \"" . $elem2 . "\"\n";
313
+ }
314
+ }
315
+ }
316
+ } else {
317
+ foreach ( $assoc_arr as $key => $elem ) {
318
+ if ( is_array( $elem ) ) {
319
+ for ( $i = 0; $i < count( $elem ); $i ++ ) {
320
+ $content .= $key2 . "[] = \"" . $elem[ $i ] . "\"\n";
321
+ }
322
+ } else if ( $elem == '' ) {
323
+ $content .= $key2 . " = \n";
324
+ } else {
325
+ $content .= $key2 . " = \"" . $elem . "\"\n";
326
+ }
327
+ }
328
+ }
329
+
330
+ return $content;
331
  }
332
+
333
+
334
+ /**
335
+ * @param $string
336
+ *
337
+ * @return array
338
+ */
339
  function parse_ini_advanced( $string ) {
340
+ return $this->recursive_parse(
341
+ $this->parse_ini_helper(
342
+ parse_ini_string( $string, true )
343
+ )
344
+ );
345
  }
346
+
347
+
348
+ function do_importer_exporter() {
349
+ $submit = null;
350
+ $count = 0;
351
+ $post_exists = null;
352
+ $post_warning = null;
353
  global $aioseop_options, $aiosp, $aioseop_module_list;
354
+ if ( isset( $_REQUEST['nonce-aioseop'] ) ) {
355
+ $nonce = $_REQUEST['nonce-aioseop'];
356
+ }
357
+ $post_fields = Array(
358
+ 'keywords',
359
+ 'description',
360
+ 'title',
361
+ 'meta',
362
+ 'disable',
363
+ 'disable',
364
+ 'disable_analytics',
365
+ 'titleatr',
366
+ 'menulabel',
367
+ 'togglekeywords'
368
+ );
369
+ if ( ! empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) {
370
+ $submit = 'Import';
371
+ }
372
+ if ( ! empty( $_REQUEST['export_submit'] ) ) {
373
+ $submit = 'Export';
374
+ }
375
+ if ( ( $submit != null ) && wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) {
376
  switch ( $submit ) {
377
  case 'Import':
378
+ try {
379
+ // Parses export file
380
+ $file = $this->get_sanitized_file(
381
+ $_FILES['aiosp_importer_exporter_import_submit']['tmp_name']
382
+ );
383
+ $section = Array();
384
+ $section_label = null;
385
+ foreach ( $file as $line_number => $line ) {
386
+ $line = trim( $line );
387
  $matches = Array();
388
+ if ( empty( $line ) ) {
389
+ continue;
390
+ }
391
+ if ( $line[0] == ';' ) {
392
+ continue;
393
+ }
394
+ if ( preg_match( "/^\[(\S+)\]$/", $line, $label ) ) {
395
  $section_label = strval( $label[1] );
396
+ if ( $section_label == 'post_data' ) {
397
+ $count ++;
398
+ }
399
+ if ( ! isset( $section[ $section_label ] ) ) {
400
  $section[ $section_label ] = Array();
401
+ }
402
  } elseif ( preg_match( "/^(\S+)\s*=\s*'(.*)'$/", $line, $matches ) ) {
403
+ if ( $section_label == 'post_data' ) {
404
+ $section[ $section_label ][ $count ][ $matches[1] ] = $matches[2];
405
+ } else {
406
+ $section[ $section_label ][ $matches[1] ] = $matches[2];
407
+ }
408
  } elseif ( preg_match( "/^(\S+)\s*=\s*NULL$/", $line, $matches ) ) {
409
+ if ( $section_label == 'post_data' ) {
410
+ $section[ $section_label ][ $count ][ $matches[1] ] = null;
411
+ } else {
412
+ $section[ $section_label ][ $matches[1] ] = null;
413
+ }
414
  } else {
415
+ $this->warnings[] = sprintf(
416
+ __(
417
+ '<b>Warning:</b> Line not matched: <b>"%s"</b>, On Line: <b>%s</b>',
418
+ 'all-in-one-seo-pack'
419
+ ),
420
+ $line,
421
+ $line_number
422
+ );
423
  }
424
+ }
425
+
426
+ // Updates Plugin Settings
427
+ if ( is_array( $section ) ) {
428
+ foreach ( $section as $label => $module_options ) {
429
+ if ( is_array( $module_options ) ) {
430
+ foreach ( $module_options as $key => $value ) {
431
+
432
+ // Updates Post Data
433
+ if ( $label == 'post_data' ) {
434
+ $post_exists = post_exists(
435
+ $module_options[ $key ]['post_title'],
436
+ '',
437
+ $module_options[ $key ]['post_date']
438
+ );
439
+ $target = get_post( $post_exists );
440
+ if ( ( ! empty( $module_options[ $key ]['post_type'] ) )
441
+ && $post_exists != null
442
+ ) {
443
+ if ( is_array( $value ) ) {
444
+ foreach ( $value as $field_name => $field_value ) {
445
+ if ( substr( $field_name, 1, 7 ) == 'aioseop' ) {
446
+ if ( $value ) {
447
+ update_post_meta(
448
+ $target->ID,
449
+ $field_name,
450
+ maybe_unserialize( $field_value )
451
+ );
452
+ } else {
453
+ delete_post_meta(
454
+ $target->ID,
455
+ $field_name
456
+ );
457
+ }
458
+ }
459
+ }
460
+ }
461
+ $post_exists = null;
462
+ } else {
463
+ $target_title = $module_options[ $key ]['post_title'];
464
+ $post_warning = sprintf(
465
+ __(
466
+ '<b>Warning:</b> This following post could not be found: <b>"%s"</b>',
467
+ 'all-in-one-seo-pack'
468
+ ),
469
+ $target_title
470
+ );
471
+ }
472
+ if ( $post_warning != null ) {
473
+ $this->warnings[] = $post_warning;
474
+ $post_warning = null;
475
+ }
476
+
477
+ // Updates Module Settings
478
  } else {
479
+ $module_options[ $key ] = str_replace(
480
+ Array( "\'", '\n', '\r' ),
481
+ Array( "'", "\n", "\r" ),
482
+ maybe_unserialize( $value )
483
+ );
 
484
  }
485
+ }
486
+
487
+ // Updates Module Settings
488
+ $this->update_class_option(
489
+ $module_options,
490
+ $label
491
+ );
492
  }
 
 
493
  }
494
  }
495
+ } catch ( Exception $e ) {
496
+ $this->warnings[] = $e->getMessage();
 
 
 
 
 
497
  }
498
+
499
+ // Shows all errors found
500
+ if ( ! empty( $this->warnings ) ) {
501
+ add_action(
502
+ $this->prefix . 'settings_header',
503
+ Array( $this, 'show_import_warnings' ),
504
+ 5
505
+ );
506
+ }
507
+
508
+ break;
509
+ case 'Export':
510
+
511
+ // Creates Files Contents
512
+ $settings_file = 'settings_aioseop.ini';
513
+ $buf = '; ' . __(
514
+ 'Settings export file for All in One SEO Pack', '
515
+ all-in-one-seo-pack'
516
+ ) . "\n";
517
+
518
+ // Adds all settings to settings file
519
  $buf = $aiosp->settings_export( $buf );
520
  $buf = apply_filters( 'aioseop_export_settings', $buf );
521
+
522
+ // Sends File to browser
523
+ $strlength = strlen( $buf );
524
+ header( 'Content-type: application/ini' );
525
+ header(
526
+ "Content-Disposition:
527
+ attachment; filename=$settings_file"
528
+ );
529
+ header( 'Content-Length: ' . $strlength );
530
  echo $buf;
531
  die();
532
+ break;
533
  }
534
+ }
535
+ }
536
+
537
+
538
+ function settings_update() {
539
  }
540
+
541
+ /**
542
+ * Returns sanitized imported file.
543
+ *
544
+ * @since
545
+ *
546
+ * @param string $filename Path to where the uploaded file is located.
547
+ *
548
+ * @return array Sanitized file as array.
549
+ * @throws Exception
550
+ */
551
+ private function get_sanitized_file( $filename ) {
552
+ $file = file( $filename );
553
+ for ( $i = count( $file ) - 1; $i >= 0; -- $i ) {
554
+ // Remove insecured lines
555
+ if ( preg_match( '/\<(\?php|script)/', $file[ $i ] ) ) {
556
+ throw new Exception( __(
557
+ '<b>Security warning:</b> Your file looks compromised. Please check the file for any script-injection.',
558
+ 'all-in-one-seo-pack'
559
+ ) );
560
+ }
561
+ // Apply security filters
562
+ $file[ $i ] = strip_tags( trim( $file[ $i ] ) );
563
+ // Remove empty lines
564
+ if ( empty( $file[ $i ] ) ) {
565
+ unset( $file[ $i ] );
566
+ }
567
+ }
568
+
569
+ return $file;
570
  }
571
  }
572
  }
modules/aioseop_opengraph.php CHANGED
@@ -5,220 +5,393 @@
5
  /**
6
  * The Opengraph class.
7
  */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
9
  class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
10
  var $fb_object_types;
11
  var $type;
12
 
13
- function __construct( ) {
14
- $this->name = __('Social Meta', 'all-in-one-seo-pack'); // Human-readable name of the plugin
15
- $this->prefix = 'aiosp_opengraph_'; // option prefix
16
- $this->file = __FILE__; // the current file
17
  $this->fb_object_types = Array(
18
- 'Activities' => Array(
19
  'activity' => __( 'Activity', 'all-in-one-seo-pack' ),
20
- 'sport' => __( 'Sport', 'all-in-one-seo-pack' )
21
  ),
22
- 'Businesses' => Array(
23
- 'bar' => __( 'Bar', 'all-in-one-seo-pack' ),
24
- 'company' => __( 'Company', 'all-in-one-seo-pack' ),
25
- 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ),
26
- 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ),
27
  'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' )
28
  ),
29
- 'Groups' => Array(
30
- 'cause' => __( 'Cause', 'all-in-one-seo-pack' ),
31
  'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ),
32
- 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' )
33
  ),
34
- 'Organizations' => Array(
35
- 'band' => __( 'Band', 'all-in-one-seo-pack' ),
36
  'government' => __( 'Government', 'all-in-one-seo-pack' ),
37
  'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ),
38
- 'school' => __( 'School', 'all-in-one-seo-pack' ),
39
  'university' => __( 'University', 'all-in-one-seo-pack' )
40
  ),
41
- 'People' => Array(
42
- 'actor' => __( 'Actor', 'all-in-one-seo-pack' ),
43
- 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ),
44
- 'author' => __( 'Author', 'all-in-one-seo-pack' ),
45
- 'director' => __( 'Director', 'all-in-one-seo-pack' ),
46
- 'musician' => __( 'Musician', 'all-in-one-seo-pack' ),
47
- 'politician' => __( 'Politician', 'all-in-one-seo-pack' ),
48
- 'profile' => __( 'Profile', 'all-in-one-seo-pack' ),
49
  'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' )
50
  ),
51
- 'Places' => Array(
52
- 'city' => __( 'City', 'all-in-one-seo-pack' ),
53
- 'country' => __( 'Country', 'all-in-one-seo-pack' ),
54
- 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ),
55
  'state_province' => __( 'State Province', 'all-in-one-seo-pack' )
56
  ),
57
  'Products and Entertainment' => Array(
58
- 'album' => __( 'Album', 'all-in-one-seo-pack' ),
59
- 'book' => __( 'Book', 'all-in-one-seo-pack' ),
60
- 'drink' => __( 'Drink', 'all-in-one-seo-pack' ),
61
- 'food' => __( 'Food', 'all-in-one-seo-pack' ),
62
- 'game' => __( 'Game', 'all-in-one-seo-pack' ),
63
- 'movie' => __( 'Movie', 'all-in-one-seo-pack' ),
64
  'product' => __( 'Product', 'all-in-one-seo-pack' ),
65
- 'song' => __( 'Song', 'all-in-one-seo-pack' ),
66
  'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ),
67
  'episode' => __( 'Episode', 'all-in-one-seo-pack' )
68
- ),'Websites' => Array(
 
69
  'article' => __( 'Article', 'all-in-one-seo-pack' ),
70
- 'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
71
  'website' => __( 'Website', 'all-in-one-seo-pack' )
72
  )
73
  );
74
  parent::__construct();
75
 
76
- $categories = Array( 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), 'website' => __( 'Website', 'all-in-one-seo-pack' ), 'article' => __( 'Article', 'all-in-one-seo-pack' ) );
 
 
 
 
77
 
78
  $this->help_text = Array(
79
- "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' ),
80
- "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' ),
81
- "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'),
82
- "title_shortcodes" => __( "Run shortcodes that appear in social title meta tags.", 'all-in-one-seo-pack' ),
83
- "description_shortcodes"=> __( "Run shortcodes that appear in social description meta tags.", 'all-in-one-seo-pack' ),
84
- "sitename" => __( "The Site Name is the name that is used to identify your website.", 'all-in-one-seo-pack' ),
85
- "hometitle" => __( "The Home Title is the Open Graph title for your home page.", 'all-in-one-seo-pack' ),
86
- "description" => __( "The Home Description is the Open Graph description for your home page.", 'all-in-one-seo-pack' ),
87
- "homeimage" => __( "The Home Image is the Open Graph image for your home page.", 'all-in-one-seo-pack' ),
88
- "hometag" => __( "The Home Tag allows you to add a list of keywords that best describe your home page content.", 'all-in-one-seo-pack' ),
89
- "generate_descriptions" => __( "Check this and your Open Graph descriptions will be auto-generated from your content.", 'all-in-one-seo-pack' ),
90
- "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' ),
91
- "fallback" => __( "This option lets you fall back to the default image if no image could be found above.", 'all-in-one-seo-pack' ),
92
- "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' ),
93
- "dimgwidth" => __( "This option lets you set a default width for your images, where unspecified.", 'all-in-one-seo-pack' ),
94
- "dimgheight" => __( "This option lets you set a default height for your images, where unspecified.", 'all-in-one-seo-pack' ),
95
- "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' ),
96
- "categories" => __( "Set the Open Graph type for your website as either a blog or a website.", 'all-in-one-seo-pack' ),
97
- "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' ),
98
- "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' ),
99
- "imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
100
- "imageheight" => __( "Enter the height for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
101
- "video" => __( "This option lets you specify a link to the Open Graph video used on this Page or Post.", 'all-in-one-seo-pack' ),
102
- "videowidth" => __( "Enter the width for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
103
- "videoheight" => __( "Enter the height for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
104
- "defcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ),
105
- "setcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ),
106
- "twitter_site" => __( "Enter the Twitter username associated with your website here.", 'all-in-one-seo-pack' ),
107
- "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' ),
108
- "twitter_domain" => __( "Enter the name of your website here.", 'all-in-one-seo-pack' ),
109
- "gen_tags" => __( "Automatically generate article tags for Facebook type article when not provided.", 'all-in-one-seo-pack' ),
110
- "gen_keywords" => __( "Use keywords in generated article tags.", 'all-in-one-seo-pack' ),
111
- "gen_categories" => __( "Use catergories in generated article tags.", 'all-in-one-seo-pack' ),
112
- "gen_post_tags" => __( "Use post tags in generated article tags.", 'all-in-one-seo-pack' ),
113
- "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' ),
114
- "title" => __( "This is the Open Graph title of this Page or Post.", 'all-in-one-seo-pack' ),
115
- "desc" => __( "This is the Open Graph description of this Page or Post.", 'all-in-one-seo-pack' ),
116
- "category" => __( "Select the Open Graph type that best describes the content of this Page or Post.", 'all-in-one-seo-pack' ),
117
- "facebook_debug" => __( "Press this button to have Facebook re-fetch and debug this page.", 'all-in-one-seo-pack' ),
118
- "section" => __( "This Open Graph meta allows you to add a general section name that best describes this content.", 'all-in-one-seo-pack' ),
119
- "tag" => __( "This Open Graph meta allows you to add a list of keywords that best describe this content.", 'all-in-one-seo-pack' ),
120
- "facebook_publisher" => __( "Link articles to the Facebook page associated with your website.", 'all-in-one-seo-pack' ),
121
- "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' ),
122
- "person_or_org" => __( "Are the social profile links for your website for a person or an organization?", 'all-in-one-seo-pack' ),
123
- "profile_links" => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ),
124
- "social_name" => __( "Add the name of the person or organization who owns these profiles.", 'all-in-one-seo-pack' )
125
  );
126
 
127
  $this->help_anchors = Array(
128
  'generate_descriptions' => '#auto-generate-og-descriptions',
129
- 'setmeta' => '#use-aioseo-title-and-description',
130
- 'sitename' => '#site-name',
131
- 'hometitle' => '#home-title-and-description',
132
- 'description' => '#home-title-and-description',
133
- 'homeimage' => '#home-image',
134
- 'defimg' => '#select-og-image-source',
135
- 'fallback' => '#use-default-if-no-image-found',
136
- 'dimg' => '#default-og-image',
137
- 'meta_key' => '#use-custom-field-for-image',
138
- 'key' => '#facebook-admin-id',
139
- 'appid' => '#facebook-app-id',
140
- 'categories' => '#facebook-object-type',
141
- 'facebook_publisher' => '#show-facebook-publisher-on-articles',
142
- 'facebook_author' => '#show-facebook-author-on-articles',
143
- 'types' => '#enable-facebook-meta-for',
144
- 'defcard' => '#default-twitter-card',
145
- 'setcard' => '#default-twitter-card',
146
- 'twitter_site' => '#twitter-site',
147
- 'twitter_creator' => '#show-twitter-author',
148
- 'twitter_domain' => '#twitter-domain',
149
- 'scan_header' => '#scan-social-meta'
150
  );
151
 
152
- $count_desc = __( " characters. Open Graph allows up to a maximum of %s chars for the %s.", 'all-in-one-seo-pack' );
153
  $this->default_options = array(
154
- 'scan_header' => Array( 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ), 'type' => 'custom', 'save' => true ),
155
- 'setmeta' => Array( 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack'), 'type' => 'checkbox' ),
156
- 'key' => Array( 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack'), 'default' => '', 'type' => 'text' ),
157
- 'appid' => Array( 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack'), 'default' => '', 'type' => 'text'),
158
- 'title_shortcodes' => Array('name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ) ),
159
- 'description_shortcodes' => Array('name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ) ),
160
- 'sitename' => Array( 'name' => __( 'Site Name', 'all-in-one-seo-pack' ), 'default' => get_bloginfo('name'), 'type' => 'text' ),
161
- 'hometitle' => Array( 'name' => __( 'Home Title', 'all-in-one-seo-pack'),
162
- 'default' => '', 'type' => 'textarea', 'condshow' => Array( 'aiosp_opengraph_setmeta' => Array( 'lhs' => "aiosp_opengraph_setmeta", 'op' => '!=', 'rhs' => 'on' ) ) ),
163
- 'description' => Array( 'name' => __( 'Home Description', 'all-in-one-seo-pack'),
164
- 'default' => '', 'type' => 'textarea', 'condshow' => Array( 'aiosp_opengraph_setmeta' => Array( 'lhs' => "aiosp_opengraph_setmeta", 'op' => '!=', 'rhs' => 'on' ) ) ),
165
- 'homeimage' => Array( 'name' => __( 'Home Image', 'all-in-one-seo-pack' ),
166
- 'type' => 'image' ),
167
- 'hometag' => Array('name' => __( 'Home Article Tags', 'all-in-one-seo-pack' ),
168
- 'type' => 'text', 'default' => '', 'condshow' => Array( 'aiosp_opengraph_categories' => 'article' ) ),
169
- 'generate_descriptions' => Array( 'name' => __( 'Autogenerate OG Descriptions', 'all-in-one-seo-pack' ), 'default' => 1 ),
170
- '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' ) ) ),
171
- 'fallback' => Array( 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ), 'type' => 'checkbox' ),
172
- 'dimg' => Array( 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ), 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', 'type' => 'image' ),
173
- 'dimgwidth' => Array( 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ),
174
- 'type' => 'text', 'default' => '' ),
175
- 'dimgheight' => Array( 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ),
176
- 'type' => 'text', 'default' => '' ),
177
- 'meta_key' => Array( 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ), 'type' => 'text', 'default' => '' ),
178
- 'categories' => Array( 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack'),
179
- 'type' => 'radio', 'initial_options' => $categories, 'default' => 'blog' ),
180
- 'image' => Array( 'name' => __( 'Image', 'all-in-one-seo-pack' ),
181
- 'type' => 'radio', 'initial_options' => Array( 0 => '<img style="width:50px;height:auto;display:inline-block;vertical-align:bottom;" src="' . AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png' . '">' ) ),
182
- 'customimg' => Array( 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ),
183
- 'type' => 'image' ),
184
- 'imagewidth' => Array( 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ),
185
- 'type' => 'text', 'default' => '' ),
186
- 'imageheight' => Array( 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ),
187
- 'type' => 'text', 'default' => '' ),
188
- 'video' => Array( 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ),
189
- 'type' => 'text' ),
190
- 'videowidth' => Array( 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ),
191
- 'type' => 'text', 'default' => '', 'condshow' => Array( 'aioseop_opengraph_settings_video' => Array( 'lhs' => "aioseop_opengraph_settings_video", 'op' => '!=', 'rhs' => '' ) ) ),
192
- 'videoheight' => Array( 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ),
193
- 'type' => 'text', 'default' => '', 'condshow' => Array( 'aioseop_opengraph_settings_video' => Array( 'lhs' => "aioseop_opengraph_settings_video", 'op' => '!=', 'rhs' => '' ) ) ),
194
- 'defcard' => Array( 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ),
195
- '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' ),
196
- 'setcard' => Array( 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ),
197
- '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' ) */ ) ),
198
- 'twitter_site' => Array( 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ),
199
- 'type' => 'text', 'default' => '' ),
200
- 'twitter_creator'=>Array( 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ) ),
201
- 'twitter_domain'=> Array( 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ),
202
- 'type' => 'text', 'default' => '' ),
203
- 'gen_tags' => Array( 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ) ),
204
- 'gen_keywords' => Array( 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ), 'default' => 'on', 'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' ) ),
205
- 'gen_categories'=> Array( 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ), 'default' => 'on', 'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' ) ),
206
- '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' ) ),
207
- 'types' => Array( 'name' => __( 'Enable Facebook Meta for', 'all-in-one-seo-pack'),
208
- 'type' => 'multicheckbox', 'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ),
209
- 'default' => Array( 'post' => 'post', 'page' => 'page' ) ),
210
- 'title' => Array( 'name' => __( 'Title', 'all-in-one-seo-pack'),
211
- 'default' => '', 'type' => 'text', 'size' => 95, 'count' => 1, 'count_desc' => $count_desc ),
212
- 'desc' => Array( 'name' => __( 'Description', 'all-in-one-seo-pack'),
213
- 'default' => '', 'type' => 'textarea', 'cols' => 250, 'rows' => 4, 'count' => 1, 'count_desc' => $count_desc ),
214
- 'category' => Array( 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack'),
215
- 'type' => 'select', 'style' => '',
216
- 'initial_options' => $this->fb_object_types,
217
- 'default' => ''
218
- ),
219
- 'facebook_debug'=> Array( 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ), 'type' => 'html', 'save' => false,
220
- 'default' =>
221
- '<script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  jQuery(document).ready(function() {
223
  var snippet = jQuery("#aioseop_snippet_link");
224
  if ( !snippet ) {
@@ -230,79 +403,175 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
230
  });
231
  </script>
232
  <a name="aioseop_opengraph_settings_facebook_debug" id="aioseop_opengraph_settings_facebook_debug" class="button-primary" href="" target=_blank>' . __( 'Debug This Post', 'all-in-one-seo-pack' )
233
- . '</a>' ),
234
-
235
- 'section' => Array( 'name' => __( 'Article Section', 'all-in-one-seo-pack' ),
236
- 'type' => 'text', 'default' => '', 'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' ) ),
237
- 'tag' => Array( 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ),
238
- 'type' => 'text', 'default' => '', 'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' ) ),
239
- 'facebook_publisher'=>Array('name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ), 'type' => 'text', 'default' => '' ),
240
- 'facebook_author' =>Array('name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ) ),
241
- 'profile_links' =>Array('name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), 'type' => 'textarea', 'cols' => 60, 'rows' => 5 ),
242
- 'person_or_org' =>Array('name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ),
243
- 'type' => 'radio', 'initial_options' => Array( 'person' => __( 'Person', 'all-in-one-seo-pack' ), 'org' => __( 'Organization', 'all-in-one-seo-pack' ) ) ),
244
- 'social_name' =>Array('name' => __( "Associated Name", 'all-in-one-seo-pack' ), 'type' => 'text', 'default' => "" ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  );
246
 
247
  // load initial options / set defaults
248
- $this->update_options( );
249
 
250
  $display = Array();
251
- if ( isset( $this->options['aiosp_opengraph_types'] ) ) $display = $this->options['aiosp_opengraph_types'];
 
 
252
 
253
  $this->locations = array(
254
- 'opengraph' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings',
255
- 'options' => Array('scan_header', 'setmeta', 'key', 'appid', 'sitename', 'title_shortcodes', 'description_shortcodes', 'hometitle', 'description', 'homeimage', 'hometag', 'generate_descriptions', 'defimg',
256
- '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',
257
- 'gen_post_tags', 'types', 'facebook_publisher', 'facebook_author' ) ),
258
- 'settings' => Array( 'name' => __('Social Settings', 'all-in-one-seo-pack'),
259
- 'type' => 'metabox', 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings',
260
- 'options' => Array( 'title', 'desc', 'image', 'customimg', 'imagewidth', 'imageheight', 'video', 'videowidth', 'videoheight', 'category', 'facebook_debug', 'section', 'tag', 'setcard' ),
261
- 'display' => $display, 'prefix' => 'aioseop_opengraph_'
262
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  );
264
 
265
  $this->layout = Array(
266
- 'default' => Array(
267
- 'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
268
- 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
269
- 'options' => Array() // this is set below, to the remaining options -- pdb
270
- ),
271
- 'home' => Array(
272
- 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
273
- 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
274
- 'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage', 'hometag' )
275
- ),
276
- 'image' => Array(
277
- 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ),
278
- 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
279
- 'options' => Array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' )
280
- ),
281
- 'links' => Array(
282
- 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
283
- 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
284
- 'options' => Array( 'profile_links', 'person_or_org', 'social_name' )
285
- ),
286
- 'facebook' => Array(
287
- 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ),
288
- 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
289
- 'options' => Array( 'key', 'appid', 'types', 'gen_tags', 'gen_keywords', 'gen_categories', 'gen_post_tags', 'categories', 'facebook_publisher', 'facebook_author' )
290
- ),
291
- 'twitter' => Array(
292
- 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ),
293
- 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
294
- 'options' => Array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' )
295
- ),
296
- 'scan_meta' => Array(
297
- 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ),
298
- 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#scan_meta',
299
- 'options' => Array( 'scan_header' )
300
  )
 
 
 
 
 
 
 
 
 
 
 
301
  );
302
 
303
  $other_options = Array();
304
- foreach( $this->layout as $k => $v )
305
  $other_options = array_merge( $other_options, $v['options'] );
 
306
 
307
  $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
308
 
@@ -312,7 +581,9 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
312
  add_action( 'wp', Array( $this, 'type_setup' ) );
313
  }
314
 
315
- if( !is_admin() || defined( 'DOING_AJAX' ) ){ $this->do_opengraph(); }
 
 
316
 
317
  // Avoid having duplicate meta tags
318
  add_filter( 'jetpack_enable_open_graph', '__return_false' );
@@ -321,7 +592,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
321
  function settings_page_init() {
322
  add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 );
323
  $cat = $this->options["{$this->prefix}categories"];
324
- if ( !empty( $cat ) ) {
325
  if ( $cat == 'blog' ) {
326
  $show_on_front = get_option( 'show_on_front' );
327
  if ( ( $show_on_front == 'page' ) && ( get_option( 'page_on_front' ) ) ) {
@@ -329,208 +600,249 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
329
  }
330
  } elseif ( $cat == 'website' ) {
331
  $show_on_front = get_option( 'show_on_front' );
332
- if ( ( $show_on_front == 'posts' ) )
333
  $this->output_error( '<p>' . __( "Blog on front page detected, suggested Facebook Object Type is 'blog'.", 'all-in-one-seo-pack' ) . '</p>' );
 
334
  }
335
  }
336
  }
337
-
338
  function filter_options( $options, $location ) {
339
  if ( $location == 'settings' ) {
340
  $prefix = $this->get_prefix( $location ) . $location . '_';
341
  list( $legacy, $images ) = $this->get_all_images( $options );
342
  if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) {
343
  $thumbnail = $options["{$prefix}image"];
344
- if ( ctype_digit( (string)$thumbnail ) || ( $thumbnail == 'post' ) ) {
345
- if ( $thumbnail == 'post' )
346
  $thumbnail = $images['post1'];
347
- else
348
- if ( !empty( $legacy[$thumbnail] ) )
349
- $thumbnail = $legacy[$thumbnail];
350
  }
351
  $options["{$prefix}image"] = $thumbnail;
352
  }
353
  if ( empty( $options[ $prefix . 'image' ] ) ) {
354
  $img = array_keys( $images );
355
- if ( !empty( $img ) && !empty( $img[1] ) )
356
  $options[ $prefix . 'image' ] = $img[1];
 
357
  }
358
  }
 
359
  return $options;
360
  }
361
-
362
  function filter_settings( $settings, $location, $current ) {
363
  if ( $location == 'opengraph' || $location == 'settings' ) {
364
  $prefix = $this->get_prefix( $location ) . $location . '_';
365
- if ( $location == 'opengraph' ) return $settings;
366
- if ( $location == 'settings' ) {
 
 
367
  list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current );
368
- $opts = Array( 'title', 'desc' );
369
  $current_post_type = get_post_type();
370
  if ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
371
  $flat_type_list = Array();
372
- foreach( $this->fb_object_types as $k => $v ) {
373
- if ( is_array( $v ) ) {
374
- $flat_type_list = array_merge( $flat_type_list, $v );
375
- } else {
376
- $flat_type_list[$k] = $v;
377
- }
378
- }
379
- $settings[$prefix . 'category']['initial_options'] = array_merge( Array(
380
  $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - '
381
- . $flat_type_list[ $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ] ),
382
- $settings[$prefix . 'category']['initial_options'] );
 
383
  }
384
  if ( isset( $this->options["aiosp_opengraph_defcard"] ) ) {
385
- $settings[$prefix . 'setcard']['default'] = $this->options["aiosp_opengraph_defcard"];
386
- }
387
  global $aiosp;
388
  $info = $aiosp->get_page_snippet_info();
389
  extract( $info );
390
  $settings["{$prefix}title"]['placeholder'] = $title;
391
- $settings["{$prefix}desc"]['placeholder'] = $description;
392
  }
393
- if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] )
394
- foreach ( $opts as $opt )
395
  if ( isset( $settings[ $prefix . $opt ] ) ) {
396
- $settings[ $prefix . $opt ]['type'] = 'hidden';
397
- $settings[ $prefix . $opt ]['label'] = 'none';
398
  $settings[ $prefix . $opt ]['help_text'] = '';
399
  unset( $settings[ $prefix . $opt ]['count'] );
400
  }
 
 
401
  }
 
402
  return $settings;
403
  }
404
-
405
  function override_options( $options, $location, $settings ) {
406
  $opts = Array();
407
- foreach ( $settings as $k => $v ) if ( $v['save'] ) $opts[$k] = $v['default'];
408
- foreach( $options as $k => $v ) if ( $v === NULL ) unset( $options[$k] );
 
 
 
 
 
 
 
 
409
  $options = wp_parse_args( $options, $opts );
 
410
  return $options;
411
  }
412
-
413
  function filter_metabox_options( $options, $location, $post_id ) {
414
  if ( $location == 'settings' ) {
415
  $prefix = $this->get_prefix( $location ) . $location;
416
- if ( !empty( $options[$prefix . '_customimg'] ) ) {
417
  $old_options = get_post_meta( $post_id, '_' . $prefix );
418
  $prefix .= '_';
419
- if ( empty( $old_options[$prefix . 'customimg'] ) || ( $old_options[$prefix . 'customimg'] != $options[$prefix . 'customimg'] ) )
420
- $options[$prefix . 'image'] = $options[$prefix . 'customimg'];
 
421
  }
422
  }
 
423
  return $options;
424
  }
425
-
426
  /** Custom settings **/
427
  function display_custom_options( $buf, $args ) {
428
  if ( $args['name'] == 'aiosp_opengraph_scan_header' ) {
429
  $buf .= '<div class="aioseop aioseop_options aiosp_opengraph_settings"><div class="aioseop_wrapper aioseop_custom_type" id="aiosp_opengraph_scan_header_wrapper"><div class="aioseop_input" id="aiosp_opengraph_scan_header" style="padding-left:20px;">';
430
  $args['options']['type'] = 'submit';
431
- $args['attr'] = " class='button-primary' ";
432
- $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' );
433
  $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' );
434
  $buf .= '<br /><br />' . $this->get_option_html( $args );
435
  $buf .= '</div></div></div>';
436
  }
 
437
  return $buf;
438
  }
439
-
440
  function add_attributes( $output ) { // avoid having duplicate meta tags
441
  $type = $this->type;
442
- if ( empty( $type ) ) $type = 'website';
443
-
 
 
444
  $schema_types = Array(
445
- 'album' => 'MusicAlbum',
446
- 'article' => 'Article',
447
- 'bar' => 'BarOrPub',
448
- 'blog' => 'Blog',
449
- 'book' => 'Book',
450
- 'cafe' => 'CafeOrCoffeeShop',
451
- 'city' => 'City',
452
- 'country' => 'Country',
453
- 'episode' => 'Episode',
454
- 'food' => 'FoodEvent',
455
- 'game' => 'Game',
456
- 'hotel' => 'Hotel',
457
- 'landmark' => 'LandmarksOrHistoricalBuildings',
458
- 'movie' => 'Movie',
459
- 'product' => 'Product',
460
- 'profile' => 'ProfilePage',
461
  'restaurant' => 'Restaurant',
462
- 'school' => 'School',
463
- 'sport' => 'SportsEvent',
464
- 'website' => 'WebSite'
465
  );
466
-
467
- if ( !empty( $schema_types[$type] ) )
468
- $type = $schema_types[$type];
469
- else
470
  $type = 'WebSite';
471
-
472
- $attributes = apply_filters( $this->prefix . 'attributes', Array( 'itemscope', 'itemtype="http://schema.org/' . ucfirst( $type ) . '"', 'prefix="og: http://ogp.me/ns#"' ) );
473
- foreach( $attributes as $attr ) {
 
 
 
 
 
474
  if ( strpos( $output, $attr ) === false ) {
475
  $output .= "\n\t$attr ";
476
  }
477
  }
 
478
  return $output;
479
  }
480
-
481
- function add_meta( ) {
482
  global $post, $aiosp, $aioseop_options, $wp_query;
483
- $metabox = $this->get_current_options( Array(), 'settings' );
484
- $key = $this->options['aiosp_opengraph_key'];
485
- $dimg = $this->options['aiosp_opengraph_dimg'];
486
  $current_post_type = get_post_type();
487
- $title = $description = $image = $video = '';
488
- $type = $this->type;
489
- $sitename = $this->options['aiosp_opengraph_sitename'];
490
-
491
- $appid = isset($this->options['aiosp_opengraph_appid']) ? $this->options['aiosp_opengraph_appid'] : '';
492
-
493
- if ( !empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
494
  $first_page = false;
495
- if ( $aiosp->get_page_number() < 2 ) $first_page = true;
 
 
496
  } else {
497
  $first_page = true;
498
  }
499
  $url = $aiosp->aiosp_mrt_get_url( $wp_query );
500
  $url = apply_filters( 'aioseop_canonical_url', $url );
501
-
502
- $setmeta = $this->options['aiosp_opengraph_setmeta'];
503
  $social_links = '';
504
  if ( is_front_page() ) {
505
  $title = $this->options['aiosp_opengraph_hometitle'];
506
- if ( $first_page )
507
  $description = $this->options['aiosp_opengraph_description'];
508
- if ( !empty( $this->options['aiosp_opengraph_homeimage'] ) )
 
509
  $thumbnail = $this->options['aiosp_opengraph_homeimage'];
510
- else
511
  $thumbnail = $this->options['aiosp_opengraph_dimg'];
512
-
 
513
  /* If Use AIOSEO Title and Desc Selected */
514
- if( $setmeta ) {
515
  $title = $aiosp->wp_title();
516
- if ( $first_page )
517
  $description = $aiosp->get_aioseop_description( $post );
 
518
  }
519
-
520
  /* Add some defaults */
521
- if( empty($title) ) $title = get_bloginfo('name');
522
- if( empty($sitename) ) $sitename = get_bloginfo('name');
523
-
524
- if ( empty( $description ) && $first_page && ( !empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) && !empty( $post ) && !empty( $post->post_content ) && !post_password_required( $post ) )
 
 
 
 
525
  $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 );
526
-
527
- if ( empty($description) && $first_page ) $description = get_bloginfo('description');
528
- if ( $type == 'article' && ( !empty( $this->options['aiosp_opengraph_hometag'] ) ) ) {
 
 
 
529
  $tag = $this->options['aiosp_opengraph_hometag'];
530
  }
531
- if ( !empty( $this->options['aiosp_opengraph_profile_links'] ) ) {
532
  $social_links = $this->options['aiosp_opengraph_profile_links'];
533
- if ( !empty( $this->options['aiosp_opengraph_social_name'] ) ) {
534
  $social_name = $this->options['aiosp_opengraph_social_name'];
535
  }
536
  if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) {
@@ -539,226 +851,265 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
539
  $social_type = "Organization";
540
  }
541
  }
542
- } elseif ( is_singular( ) && $this->option_isset('types')
543
- && is_array( $this->options['aiosp_opengraph_types'] )
544
- && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) {
 
545
 
546
  if ( $type == 'article' ) {
547
- if ( !empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
548
  $section = $metabox['aioseop_opengraph_settings_section'];
549
  }
550
- if ( !empty( $metabox['aioseop_opengraph_settings_tag'] ) ) {
551
  $tag = $metabox['aioseop_opengraph_settings_tag'];
552
  }
553
- if ( !empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) {
554
  $publisher = $this->options['aiosp_opengraph_facebook_publisher'];
555
  }
556
  }
557
-
558
- if ( !empty( $this->options['aiosp_opengraph_twitter_domain'] ) )
559
  $domain = $this->options['aiosp_opengraph_twitter_domain'];
560
-
561
-
562
- if ( $type == 'article' && !empty( $post ) ) {
563
- if ( isset( $post->post_author ) && !empty( $this->options['aiosp_opengraph_facebook_author'] ) )
 
564
  $author = get_the_author_meta( 'facebook', $post->post_author );
565
-
566
- if ( isset( $post->post_date ) )
567
- $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date ) );
568
 
569
- if ( isset( $post->post_modified ) )
 
 
 
 
570
  $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified ) );
 
571
  }
572
 
573
- $image = $metabox['aioseop_opengraph_settings_image'];
574
- $video = $metabox['aioseop_opengraph_settings_video'];
575
- $title = $metabox['aioseop_opengraph_settings_title'];
576
  $description = $metabox['aioseop_opengraph_settings_desc'];
577
-
578
  /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */
579
  global $aiosp;
580
- if( empty( $title ) )
581
  $title = $aiosp->wp_title();
582
- if ( empty( $description ) )
 
583
  $description = trim( strip_tags( get_post_meta( $post->ID, "_aioseop_description", true ) ) );
584
-
 
585
  /* Add some defaults */
586
- if ( empty( $title ) ) $title = get_the_title();
587
- if ( empty( $description ) && ( $this->options['aiosp_opengraph_generate_descriptions'] ) && !post_password_required( $post ) )
 
 
588
  $description = $post->post_content;
589
- if ( empty( $type ) ) $type = 'article';
590
- } else return;
591
-
 
 
 
 
 
592
  if ( $type == 'article' ) {
593
- if ( !empty( $this->options['aiosp_opengraph_gen_tags'] ) ) {
594
- if ( !empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) {
595
  $keywords = $aiosp->get_main_keywords();
596
  $keywords = $this->apply_cf_fields( $keywords );
597
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
598
- if ( !empty( $keywords ) && !empty( $tag ) ) {
599
  $tag .= ',' . $keywords;
600
  } elseif ( empty( $tag ) ) {
601
  $tag = $keywords;
602
  }
603
  }
604
  $tag = $aiosp->keyword_string_to_list( $tag );
605
- if ( !empty( $this->options['aiosp_opengraph_gen_categories'] ) )
606
  $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) );
607
- if ( !empty( $this->options['aiosp_opengraph_gen_post_tags'] ) )
 
608
  $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) );
 
 
 
 
609
  }
610
- if ( !empty( $tag ) )
611
- $tag = $aiosp->clean_keyword_list( $tag );
612
  }
613
-
614
- if ( !empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) {
615
  $title = do_shortcode( $title );
616
  }
617
-
618
- if ( !empty( $description ) ) {
619
  $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) );
620
- if ( !empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) {
621
  $description = do_shortcode( $description );
622
  }
623
- $description = $aiosp->trim_excerpt_without_filters( $description, 1000 );
624
  }
625
-
626
- $title = $this->apply_cf_fields( $title );
627
  $description = $this->apply_cf_fields( $description );
628
-
629
- /* Data Validation */
630
- $title = strip_tags( esc_attr( $title ) );
631
- $sitename = strip_tags( esc_attr( $sitename ) );
632
  $description = strip_tags( esc_attr( $description ) );
633
-
634
- if ( empty( $thumbnail ) && !empty( $image ) )
635
  $thumbnail = $image;
636
-
 
637
  /* Get the first image attachment on the post */
638
  // if( empty($thumbnail) ) $thumbnail = $this->get_the_image();
639
-
640
  /* Add user supplied default image */
641
- if( empty($thumbnail) ) {
642
- if ( empty( $this->options['aiosp_opengraph_defimg'] ) )
643
  $thumbnail = $this->options['aiosp_opengraph_dimg'];
644
- else {
645
  switch ( $this->options['aiosp_opengraph_defimg'] ) {
646
- case 'featured' : $thumbnail = $this->get_the_image_by_post_thumbnail( );
647
- break;
648
- case 'attach' : $thumbnail = $this->get_the_image_by_attachment( );
649
- break;
650
- case 'content' : $thumbnail = $this->get_the_image_by_scan( );
651
- break;
652
- case 'custom' : $meta_key = $this->options['aiosp_opengraph_meta_key'];
653
- if ( !empty( $meta_key ) && !empty( $post ) ) {
654
- $meta_key = explode( ',', $meta_key );
655
- $thumbnail = $this->get_the_image_by_meta_key( Array( 'post_id' => $post->ID, 'meta_key' => $meta_key ) );
656
- }
657
- break;
658
- case 'auto' : $thumbnail = $this->get_the_image();
659
- break;
660
- case 'author' : $thumbnail = $this->get_the_image_by_author();
661
- break;
662
- default : $thumbnail = $this->options['aiosp_opengraph_dimg'];
 
 
 
 
 
 
 
 
 
 
663
  }
664
  }
665
  }
666
-
667
- if ( ( empty( $thumbnail ) && !empty( $this->options['aiosp_opengraph_fallback'] ) ) )
668
  $thumbnail = $this->options['aiosp_opengraph_dimg'];
 
669
 
670
- if ( !empty( $thumbnail ) ) $thumbnail = esc_url( $thumbnail );
 
 
671
 
672
  $width = $height = '';
673
- if ( !empty( $thumbnail ) ) {
674
- if ( !empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) )
675
  $width = $metabox['aioseop_opengraph_settings_imagewidth'];
676
- if ( !empty( $metabox['aioseop_opengraph_settings_imageheight'] ) )
 
677
  $height = $metabox['aioseop_opengraph_settings_imageheight'];
678
- if ( empty( $width ) && !empty( $this->options['aiosp_opengraph_dimgwidth'] ) )
 
679
  $width = $this->options['aiosp_opengraph_dimgwidth'];
680
- if ( empty( $height ) && !empty( $this->options['aiosp_opengraph_dimgheight'] ) )
 
681
  $height = $this->options['aiosp_opengraph_dimgheight'];
 
682
  }
683
 
684
- if ( !empty( $video ) ) {
685
- if ( !empty( $metabox['aioseop_opengraph_settings_videowidth'] ) )
686
  $videowidth = $metabox['aioseop_opengraph_settings_videowidth'];
687
- if ( !empty( $metabox['aioseop_opengraph_settings_videoheight'] ) )
688
- $videoheight = $metabox['aioseop_opengraph_settings_videoheight'];
 
 
689
  }
690
 
691
  $card = 'summary';
692
- if ( !empty( $this->options['aiosp_opengraph_defcard'] ) )
693
  $card = $this->options['aiosp_opengraph_defcard'];
694
-
695
- if ( !empty( $metabox['aioseop_opengraph_settings_setcard'] ) )
 
696
  $card = $metabox['aioseop_opengraph_settings_setcard'];
697
-
698
-
 
699
  //support for changing legacy twitter cardtype-photo to summary large image
700
- if($card == 'photo'){
701
  $card = 'summary_large_image';
702
  }
703
 
704
 
705
  $site = $domain = $creator = '';
706
 
707
- if ( !empty( $this->options['aiosp_opengraph_twitter_site'] ) )
708
  $site = $this->options['aiosp_opengraph_twitter_site'];
 
 
709
 
710
- if ( !empty( $this->options['aiosp_opengraph_twitter_domain'] ) )
711
  $domain = $this->options['aiosp_opengraph_twitter_domain'];
712
-
713
- if ( !empty( $post ) && isset( $post->post_author ) && !empty( $this->options['aiosp_opengraph_twitter_creator'] ) )
714
- $creator = get_the_author_meta( 'twitter', $post->post_author );
715
-
716
- if ( !empty( $site ) && $site[0] != '@' ) $site = '@' . $site;
717
 
718
- if ( !empty( $creator ) && $creator[0] != '@' ) $creator = '@' . $creator;
 
 
 
719
 
720
  $meta = Array(
721
- 'facebook' => Array(
722
- 'title' => 'og:title',
723
- 'type' => 'og:type',
724
- 'url' => 'og:url',
725
- 'thumbnail' => 'og:image',
726
- 'width' => 'og:image:width',
727
- 'height' => 'og:image:height',
728
- 'video' => 'og:video',
729
- 'videowidth' => 'og:video:width',
730
- 'videoheight' => 'og:video:height',
731
- 'sitename' => 'og:site_name',
732
- 'key' => 'fb:admins',
733
- 'appid' => 'fb:app_id',
734
- 'description' => 'og:description',
735
- 'section' => 'article:section',
736
- 'tag' => 'article:tag',
737
- 'publisher' => 'article:publisher',
738
- 'author' => 'article:author',
739
- 'published_time'=> 'article:published_time',
740
- 'modified_time' => 'article:modified_time',
741
- ),
742
- 'twitter' => Array(
743
- 'card' => 'twitter:card',
744
- 'site' => 'twitter:site',
745
- 'creator' => 'twitter:creator',
746
- 'domain' => 'twitter:domain',
747
- 'title' => 'twitter:title',
748
- 'description' => 'twitter:description',
749
- 'thumbnail' => 'twitter:image',
750
- ),
751
  );
752
-
753
- //Only show if "use schema.org markup is checked"
754
- if(!empty( $aioseop_options['aiosp_schema_markup'] ))
755
- $meta['google+'] = Array('thumbnail' => 'image');
756
 
 
 
 
 
757
 
758
 
759
-
760
  // Add links to testing tools
761
-
762
  /*
763
  http://developers.facebook.com/tools/debug
764
  https://dev.twitter.com/docs/cards/preview
@@ -786,45 +1137,49 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
786
  'title' => 'twitter:title',
787
  'description' => 'twitter:description',
788
  'thumbnail' => 'twitter:image'
789
-
790
  )
791
  );
792
  */
793
-
794
  $tags = Array(
795
- 'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
796
- 'twitter' => Array( 'name' => 'name', 'value' => 'content' ),
797
- 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' )
798
  );
799
-
800
- foreach ( $meta as $t => $data )
801
  foreach ( $data as $k => $v ) {
802
- if ( empty( $$k ) ) $$k = '';
 
 
803
  $filtered_value = $$k;
804
  $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k );
805
- if ( !empty( $filtered_value ) ) {
806
- if ( !is_array( $filtered_value ) )
807
  $filtered_value = Array( $filtered_value );
808
- foreach( $filtered_value as $f ) {
809
- echo '<meta ' . $tags[$t]['name'] . '="' . $v . '" ' . $tags[$t]['value'] . '="' . $f . '" />' . "\n";
 
810
  }
811
  }
812
  }
 
813
  $social_link_schema = '';
814
- if ( !empty( $social_links ) ) {
815
- $home_url = esc_url( get_home_url() );
816
  $social_links = explode( "\n", $social_links );
817
- foreach( $social_links as $k => $v ) {
818
  $v = trim( $v );
819
  if ( empty( $v ) ) {
820
- unset( $social_links[$k] );
821
  } else {
822
- $v = esc_url( $v );
823
- $social_links[$k] = $v;
824
  }
825
  }
826
- $social_links = join( '","', $social_links );
827
- $social_link_schema =<<<END
828
  <script type="application/ld+json">
829
  { "@context" : "http://schema.org",
830
  "@type" : "{$social_type}",
@@ -838,114 +1193,129 @@ END;
838
  }
839
  echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema );
840
  }
841
-
842
- function do_opengraph( ) {
843
  global $aioseop_options;
844
- if ( !empty( $aioseop_options ) && !empty( $aioseop_options['aiosp_schema_markup'] ) )
845
  add_filter( 'language_attributes', Array( $this, 'add_attributes' ) );
846
- if ( !defined( 'DOING_AJAX' ) )
847
- add_action( 'aioseop_modules_wp_head', Array( $this, 'add_meta' ), 5 );
 
 
848
  }
849
-
850
  function type_setup() {
851
  global $aiosp, $wp_query;
852
  $this->type = '';
853
  if ( $aiosp->is_static_front_page() ) {
854
- if ( !empty( $this->options ) && !empty( $this->options['aiosp_opengraph_categories'] ) )
855
  $this->type = $this->options['aiosp_opengraph_categories'];
856
- } elseif ( is_singular() && $this->option_isset('types') ) {
857
- $metabox = $this->get_current_options( Array(), 'settings' );
 
858
  $current_post_type = get_post_type();
859
- if ( !empty( $metabox['aioseop_opengraph_settings_category'] ) ) {
860
  $this->type = $metabox['aioseop_opengraph_settings_category'];
861
  } elseif ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
862
  $this->type = $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"];
863
  }
864
  }
865
  }
866
-
867
- function debug_post_types( ) {
868
  add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 3 );
869
  add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 );
870
- add_filter( $this->get_prefix( 'settings' ) . 'filter_metabox_options', Array( $this, 'filter_metabox_options' ), 10, 3 );
871
- $post_types = $this->get_post_type_titles( );
872
- $rempost = array( 'revision' => 1, 'nav_menu_item' => 1 );
873
- $post_types = array_diff_key( $post_types, $rempost );
874
- $this->default_options['types']['initial_options'] = $post_types;
875
- foreach( $post_types as $slug => $name ) {
876
- $field = $slug . '_fb_object_type';
877
- $this->default_options[$field] = Array(
878
- 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "<br />($slug)",
879
- 'type' => 'select',
880
- 'style' => '',
881
- 'initial_options' => $this->fb_object_types,
882
- 'default' => 'article',
883
- 'condshow' => Array( 'aiosp_opengraph_types\[\]' => $slug )
 
 
 
884
  );
885
- $this->help_text[$field] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' );
886
- $this->help_anchors[$field] = '#content-object-types';
887
  $this->locations['opengraph']['options'][] = $field;
888
- $this->layout['facebook']['options'][] = $field;
889
  }
890
  $this->setting_options();
891
  $this->add_help_text_links();
892
-
893
  }
894
-
895
  function get_all_images( $options = null, $p = null ) {
896
  static $img = Array();
897
- if ( !is_array( $options ) ) $options = Array();
898
- if ( !empty( $this->options['aiosp_opengraph_meta_key'] ) )
 
 
899
  $options['meta_key'] = $this->options['aiosp_opengraph_meta_key'];
 
900
  if ( empty( $img ) ) {
901
- $size = apply_filters( 'post_thumbnail_size', 'large' );
902
  $default = $this->get_the_image_by_default();
903
- if ( !empty( $default ) )
904
- $img[$default] = 0;
 
905
  $img = array_merge( $img, parent::get_all_images( $options, null ) );
906
  }
907
 
908
- if ( !empty( $options ) && !empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
909
- $img[$options['aioseop_opengraph_settings_customimg']] = 'customimg';
910
  }
911
  if ( $author_img = $this->get_the_image_by_author( $p ) ) {
912
- $image["author"] = $author_img;
913
  }
914
- $image = array_flip( $img );
915
  $images = Array();
916
- if ( !empty( $image ) )
917
- foreach( $image as $k => $v )
918
- $images[$v] = '<img height=150 src="' . $v . '">';
 
 
 
919
  return Array( $image, $images );
920
  }
921
-
922
  function get_the_image_by_author( $options = null, $p = null ) {
923
  if ( $p === null ) {
924
  global $post;
925
  } else {
926
  $post = $p;
927
  }
928
- if ( !empty( $post ) && !empty( $post->post_author ) ) {
929
- $matches = Array();
930
  $get_avatar = get_avatar( $post->post_author, 300 );
931
- if ( preg_match("/src='(.*?)'/i", $get_avatar, $matches) ) {
932
  return $matches[1];
933
  }
934
  }
 
935
  return false;
936
  }
937
-
938
  function get_the_image( $options = null, $p = null ) {
939
  $meta_key = $this->options['aiosp_opengraph_meta_key'];
 
940
  return parent::get_the_image( Array( 'meta_key' => $meta_key ), $p );
941
  }
942
-
943
  function get_the_image_by_default( $args = array() ) {
944
  return $this->options['aiosp_opengraph_dimg'];
945
  }
946
-
947
- function settings_update( ) {
948
-
949
  }
950
  }
951
  }
5
  /**
6
  * The Opengraph class.
7
  */
8
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
9
  class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
10
  var $fb_object_types;
11
  var $type;
12
 
13
+ function __construct() {
14
+ $this->name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
15
+ $this->prefix = 'aiosp_opengraph_'; // option prefix
16
+ $this->file = __FILE__; // the current file
17
  $this->fb_object_types = Array(
18
+ 'Activities' => Array(
19
  'activity' => __( 'Activity', 'all-in-one-seo-pack' ),
20
+ 'sport' => __( 'Sport', 'all-in-one-seo-pack' )
21
  ),
22
+ 'Businesses' => Array(
23
+ 'bar' => __( 'Bar', 'all-in-one-seo-pack' ),
24
+ 'company' => __( 'Company', 'all-in-one-seo-pack' ),
25
+ 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ),
26
+ 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ),
27
  'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' )
28
  ),
29
+ 'Groups' => Array(
30
+ 'cause' => __( 'Cause', 'all-in-one-seo-pack' ),
31
  'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ),
32
+ 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' )
33
  ),
34
+ 'Organizations' => Array(
35
+ 'band' => __( 'Band', 'all-in-one-seo-pack' ),
36
  'government' => __( 'Government', 'all-in-one-seo-pack' ),
37
  'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ),
38
+ 'school' => __( 'School', 'all-in-one-seo-pack' ),
39
  'university' => __( 'University', 'all-in-one-seo-pack' )
40
  ),
41
+ 'People' => Array(
42
+ 'actor' => __( 'Actor', 'all-in-one-seo-pack' ),
43
+ 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ),
44
+ 'author' => __( 'Author', 'all-in-one-seo-pack' ),
45
+ 'director' => __( 'Director', 'all-in-one-seo-pack' ),
46
+ 'musician' => __( 'Musician', 'all-in-one-seo-pack' ),
47
+ 'politician' => __( 'Politician', 'all-in-one-seo-pack' ),
48
+ 'profile' => __( 'Profile', 'all-in-one-seo-pack' ),
49
  'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' )
50
  ),
51
+ 'Places' => Array(
52
+ 'city' => __( 'City', 'all-in-one-seo-pack' ),
53
+ 'country' => __( 'Country', 'all-in-one-seo-pack' ),
54
+ 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ),
55
  'state_province' => __( 'State Province', 'all-in-one-seo-pack' )
56
  ),
57
  'Products and Entertainment' => Array(
58
+ 'album' => __( 'Album', 'all-in-one-seo-pack' ),
59
+ 'book' => __( 'Book', 'all-in-one-seo-pack' ),
60
+ 'drink' => __( 'Drink', 'all-in-one-seo-pack' ),
61
+ 'food' => __( 'Food', 'all-in-one-seo-pack' ),
62
+ 'game' => __( 'Game', 'all-in-one-seo-pack' ),
63
+ 'movie' => __( 'Movie', 'all-in-one-seo-pack' ),
64
  'product' => __( 'Product', 'all-in-one-seo-pack' ),
65
+ 'song' => __( 'Song', 'all-in-one-seo-pack' ),
66
  'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ),
67
  'episode' => __( 'Episode', 'all-in-one-seo-pack' )
68
+ ),
69
+ 'Websites' => Array(
70
  'article' => __( 'Article', 'all-in-one-seo-pack' ),
71
+ 'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
72
  'website' => __( 'Website', 'all-in-one-seo-pack' )
73
  )
74
  );
75
  parent::__construct();
76
 
77
+ $categories = Array(
78
+ 'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
79
+ 'website' => __( 'Website', 'all-in-one-seo-pack' ),
80
+ 'article' => __( 'Article', 'all-in-one-seo-pack' )
81
+ );
82
 
83
  $this->help_text = Array(
84
+ "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' ),
85
+ "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' ),
86
+ "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' ),
87
+ "title_shortcodes" => __( "Run shortcodes that appear in social title meta tags.", 'all-in-one-seo-pack' ),
88
+ "description_shortcodes" => __( "Run shortcodes that appear in social description meta tags.", 'all-in-one-seo-pack' ),
89
+ "sitename" => __( "The Site Name is the name that is used to identify your website.", 'all-in-one-seo-pack' ),
90
+ "hometitle" => __( "The Home Title is the Open Graph title for your home page.", 'all-in-one-seo-pack' ),
91
+ "description" => __( "The Home Description is the Open Graph description for your home page.", 'all-in-one-seo-pack' ),
92
+ "homeimage" => __( "The Home Image is the Open Graph image for your home page.", 'all-in-one-seo-pack' ),
93
+ "hometag" => __( "The Home Tag allows you to add a list of keywords that best describe your home page content.", 'all-in-one-seo-pack' ),
94
+ "generate_descriptions" => __( "Check this and your Open Graph descriptions will be auto-generated from your content.", 'all-in-one-seo-pack' ),
95
+ "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' ),
96
+ "fallback" => __( "This option lets you fall back to the default image if no image could be found above.", 'all-in-one-seo-pack' ),
97
+ "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' ),
98
+ "dimgwidth" => __( "This option lets you set a default width for your images, where unspecified.", 'all-in-one-seo-pack' ),
99
+ "dimgheight" => __( "This option lets you set a default height for your images, where unspecified.", 'all-in-one-seo-pack' ),
100
+ "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' ),
101
+ "categories" => __( "Set the Open Graph type for your website as either a blog or a website.", 'all-in-one-seo-pack' ),
102
+ "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' ),
103
+ "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' ),
104
+ "imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
105
+ "imageheight" => __( "Enter the height for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
106
+ "video" => __( "This option lets you specify a link to the Open Graph video used on this Page or Post.", 'all-in-one-seo-pack' ),
107
+ "videowidth" => __( "Enter the width for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
108
+ "videoheight" => __( "Enter the height for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
109
+ "defcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ),
110
+ "setcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ),
111
+ "twitter_site" => __( "Enter the Twitter username associated with your website here.", 'all-in-one-seo-pack' ),
112
+ "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' ),
113
+ "twitter_domain" => __( "Enter the name of your website here.", 'all-in-one-seo-pack' ),
114
+ "gen_tags" => __( "Automatically generate article tags for Facebook type article when not provided.", 'all-in-one-seo-pack' ),
115
+ "gen_keywords" => __( "Use keywords in generated article tags.", 'all-in-one-seo-pack' ),
116
+ "gen_categories" => __( "Use catergories in generated article tags.", 'all-in-one-seo-pack' ),
117
+ "gen_post_tags" => __( "Use post tags in generated article tags.", 'all-in-one-seo-pack' ),
118
+ "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' ),
119
+ "title" => __( "This is the Open Graph title of this Page or Post.", 'all-in-one-seo-pack' ),
120
+ "desc" => __( "This is the Open Graph description of this Page or Post.", 'all-in-one-seo-pack' ),
121
+ "category" => __( "Select the Open Graph type that best describes the content of this Page or Post.", 'all-in-one-seo-pack' ),
122
+ "facebook_debug" => __( "Press this button to have Facebook re-fetch and debug this page.", 'all-in-one-seo-pack' ),
123
+ "section" => __( "This Open Graph meta allows you to add a general section name that best describes this content.", 'all-in-one-seo-pack' ),
124
+ "tag" => __( "This Open Graph meta allows you to add a list of keywords that best describe this content.", 'all-in-one-seo-pack' ),
125
+ "facebook_publisher" => __( "Link articles to the Facebook page associated with your website.", 'all-in-one-seo-pack' ),
126
+ "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' ),
127
+ "person_or_org" => __( "Are the social profile links for your website for a person or an organization?", 'all-in-one-seo-pack' ),
128
+ "profile_links" => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ),
129
+ "social_name" => __( "Add the name of the person or organization who owns these profiles.", 'all-in-one-seo-pack' )
130
  );
131
 
132
  $this->help_anchors = Array(
133
  'generate_descriptions' => '#auto-generate-og-descriptions',
134
+ 'setmeta' => '#use-aioseo-title-and-description',
135
+ 'sitename' => '#site-name',
136
+ 'hometitle' => '#home-title-and-description',
137
+ 'description' => '#home-title-and-description',
138
+ 'homeimage' => '#home-image',
139
+ 'defimg' => '#select-og-image-source',
140
+ 'fallback' => '#use-default-if-no-image-found',
141
+ 'dimg' => '#default-og-image',
142
+ 'meta_key' => '#use-custom-field-for-image',
143
+ 'key' => '#facebook-admin-id',
144
+ 'appid' => '#facebook-app-id',
145
+ 'categories' => '#facebook-object-type',
146
+ 'facebook_publisher' => '#show-facebook-publisher-on-articles',
147
+ 'facebook_author' => '#show-facebook-author-on-articles',
148
+ 'types' => '#enable-facebook-meta-for',
149
+ 'defcard' => '#default-twitter-card',
150
+ 'setcard' => '#default-twitter-card',
151
+ 'twitter_site' => '#twitter-site',
152
+ 'twitter_creator' => '#show-twitter-author',
153
+ 'twitter_domain' => '#twitter-domain',
154
+ 'scan_header' => '#scan-social-meta'
155
  );
156
 
157
+ $count_desc = __( " characters. Open Graph allows up to a maximum of %s chars for the %s.", 'all-in-one-seo-pack' );
158
  $this->default_options = array(
159
+ 'scan_header' => Array(
160
+ 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ),
161
+ 'type' => 'custom',
162
+ 'save' => true
163
+ ),
164
+ 'setmeta' => Array(
165
+ 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ),
166
+ 'type' => 'checkbox'
167
+ ),
168
+ 'key' => Array(
169
+ 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ),
170
+ 'default' => '',
171
+ 'type' => 'text'
172
+ ),
173
+ 'appid' => Array(
174
+ 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ),
175
+ 'default' => '',
176
+ 'type' => 'text'
177
+ ),
178
+ 'title_shortcodes' => Array( 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ) ),
179
+ 'description_shortcodes' => Array( 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ) ),
180
+ 'sitename' => Array(
181
+ 'name' => __( 'Site Name', 'all-in-one-seo-pack' ),
182
+ 'default' => get_bloginfo( 'name' ),
183
+ 'type' => 'text'
184
+ ),
185
+ 'hometitle' => Array(
186
+ 'name' => __( 'Home Title', 'all-in-one-seo-pack' ),
187
+ 'default' => '',
188
+ 'type' => 'textarea',
189
+ 'condshow' => Array(
190
+ 'aiosp_opengraph_setmeta' => Array(
191
+ 'lhs' => "aiosp_opengraph_setmeta",
192
+ 'op' => '!=',
193
+ 'rhs' => 'on'
194
+ )
195
+ )
196
+ ),
197
+ 'description' => Array(
198
+ 'name' => __( 'Home Description', 'all-in-one-seo-pack' ),
199
+ 'default' => '',
200
+ 'type' => 'textarea',
201
+ 'condshow' => Array(
202
+ 'aiosp_opengraph_setmeta' => Array(
203
+ 'lhs' => "aiosp_opengraph_setmeta",
204
+ 'op' => '!=',
205
+ 'rhs' => 'on'
206
+ )
207
+ )
208
+ ),
209
+ 'homeimage' => Array(
210
+ 'name' => __( 'Home Image', 'all-in-one-seo-pack' ),
211
+ 'type' => 'image'
212
+ ),
213
+ 'hometag' => Array(
214
+ 'name' => __( 'Home Article Tags', 'all-in-one-seo-pack' ),
215
+ 'type' => 'text',
216
+ 'default' => '',
217
+ 'condshow' => Array( 'aiosp_opengraph_categories' => 'article' )
218
+ ),
219
+ 'generate_descriptions' => Array(
220
+ 'name' => __( 'Autogenerate OG Descriptions', 'all-in-one-seo-pack' ),
221
+ 'default' => 1
222
+ ),
223
+ 'defimg' => Array(
224
+ 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ),
225
+ 'type' => 'select',
226
+ 'initial_options' => Array(
227
+ '' => __( 'Default Image' ),
228
+ 'featured' => __( 'Featured Image' ),
229
+ 'attach' => __( 'First Attached Image' ),
230
+ 'content' => __( 'First Image In Content' ),
231
+ 'custom' => __( 'Image From Custom Field' ),
232
+ 'author' => __( 'Post Author Image' ),
233
+ 'auto' => __( 'First Available Image' )
234
+ )
235
+ ),
236
+ 'fallback' => Array(
237
+ 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ),
238
+ 'type' => 'checkbox'
239
+ ),
240
+ 'dimg' => Array(
241
+ 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ),
242
+ 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png',
243
+ 'type' => 'image'
244
+ ),
245
+ 'dimgwidth' => Array(
246
+ 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ),
247
+ 'type' => 'text',
248
+ 'default' => ''
249
+ ),
250
+ 'dimgheight' => Array(
251
+ 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ),
252
+ 'type' => 'text',
253
+ 'default' => ''
254
+ ),
255
+ 'meta_key' => Array(
256
+ 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ),
257
+ 'type' => 'text',
258
+ 'default' => ''
259
+ ),
260
+ 'categories' => Array(
261
+ 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
262
+ 'type' => 'radio',
263
+ 'initial_options' => $categories,
264
+ 'default' => 'blog'
265
+ ),
266
+ 'image' => Array(
267
+ 'name' => __( 'Image', 'all-in-one-seo-pack' ),
268
+ 'type' => 'radio',
269
+ 'initial_options' => Array( 0 => '<img style="width:50px;height:auto;display:inline-block;vertical-align:bottom;" src="' . AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png' . '">' )
270
+ ),
271
+ 'customimg' => Array(
272
+ 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ),
273
+ 'type' => 'image'
274
+ ),
275
+ 'imagewidth' => Array(
276
+ 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ),
277
+ 'type' => 'text',
278
+ 'default' => ''
279
+ ),
280
+ 'imageheight' => Array(
281
+ 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ),
282
+ 'type' => 'text',
283
+ 'default' => ''
284
+ ),
285
+ 'video' => Array(
286
+ 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ),
287
+ 'type' => 'text'
288
+ ),
289
+ 'videowidth' => Array(
290
+ 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ),
291
+ 'type' => 'text',
292
+ 'default' => '',
293
+ 'condshow' => Array(
294
+ 'aioseop_opengraph_settings_video' => Array(
295
+ 'lhs' => "aioseop_opengraph_settings_video",
296
+ 'op' => '!=',
297
+ 'rhs' => ''
298
+ )
299
+ )
300
+ ),
301
+ 'videoheight' => Array(
302
+ 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ),
303
+ 'type' => 'text',
304
+ 'default' => '',
305
+ 'condshow' => Array(
306
+ 'aioseop_opengraph_settings_video' => Array(
307
+ 'lhs' => "aioseop_opengraph_settings_video",
308
+ 'op' => '!=',
309
+ 'rhs' => ''
310
+ )
311
+ )
312
+ ),
313
+ 'defcard' => Array(
314
+ 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ),
315
+ 'type' => 'select',
316
+ 'initial_options' => Array(
317
+ 'summary' => __( 'Summary', 'all-in-one-seo-pack' ),
318
+ 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' )
319
+ /*, *******REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE****** 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) */
320
+ ),
321
+ 'default' => 'summary'
322
+ ),
323
+ 'setcard' => Array(
324
+ 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ),
325
+ 'type' => 'select',
326
+ 'initial_options' => Array(
327
+ 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ),
328
+ 'summary' => __( 'Summary', 'all-in-one-seo-pack' )
329
+ /*, *******REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE****** 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) */
330
+ )
331
+ ),
332
+ 'twitter_site' => Array(
333
+ 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ),
334
+ 'type' => 'text',
335
+ 'default' => ''
336
+ ),
337
+ 'twitter_creator' => Array( 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ) ),
338
+ 'twitter_domain' => Array(
339
+ 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ),
340
+ 'type' => 'text',
341
+ 'default' => ''
342
+ ),
343
+ 'gen_tags' => Array( 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ) ),
344
+ 'gen_keywords' => Array(
345
+ 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ),
346
+ 'default' => 'on',
347
+ 'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' )
348
+ ),
349
+ 'gen_categories' => Array(
350
+ 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ),
351
+ 'default' => 'on',
352
+ 'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' )
353
+ ),
354
+ 'gen_post_tags' => Array(
355
+ 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ),
356
+ 'default' => 'on',
357
+ 'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' )
358
+ ),
359
+ 'types' => Array(
360
+ 'name' => __( 'Enable Facebook Meta for', 'all-in-one-seo-pack' ),
361
+ 'type' => 'multicheckbox',
362
+ 'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ),
363
+ 'default' => Array( 'post' => 'post', 'page' => 'page' )
364
+ ),
365
+ 'title' => Array(
366
+ 'name' => __( 'Title', 'all-in-one-seo-pack' ),
367
+ 'default' => '',
368
+ 'type' => 'text',
369
+ 'size' => 95,
370
+ 'count' => 1,
371
+ 'count_desc' => $count_desc
372
+ ),
373
+ 'desc' => Array(
374
+ 'name' => __( 'Description', 'all-in-one-seo-pack' ),
375
+ 'default' => '',
376
+ 'type' => 'textarea',
377
+ 'cols' => 250,
378
+ 'rows' => 4,
379
+ 'count' => 1,
380
+ 'count_desc' => $count_desc
381
+ ),
382
+ 'category' => Array(
383
+ 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
384
+ 'type' => 'select',
385
+ 'style' => '',
386
+ 'initial_options' => $this->fb_object_types,
387
+ 'default' => ''
388
+ ),
389
+ 'facebook_debug' => Array(
390
+ 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ),
391
+ 'type' => 'html',
392
+ 'save' => false,
393
+ 'default' =>
394
+ '<script>
395
  jQuery(document).ready(function() {
396
  var snippet = jQuery("#aioseop_snippet_link");
397
  if ( !snippet ) {
403
  });
404
  </script>
405
  <a name="aioseop_opengraph_settings_facebook_debug" id="aioseop_opengraph_settings_facebook_debug" class="button-primary" href="" target=_blank>' . __( 'Debug This Post', 'all-in-one-seo-pack' )
406
+ . '</a>'
407
+ ),
408
+
409
+ 'section' => Array(
410
+ 'name' => __( 'Article Section', 'all-in-one-seo-pack' ),
411
+ 'type' => 'text',
412
+ 'default' => '',
413
+ 'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' )
414
+ ),
415
+ 'tag' => Array(
416
+ 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ),
417
+ 'type' => 'text',
418
+ 'default' => '',
419
+ 'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' )
420
+ ),
421
+ 'facebook_publisher' => Array(
422
+ 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ),
423
+ 'type' => 'text',
424
+ 'default' => ''
425
+ ),
426
+ 'facebook_author' => Array( 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ) ),
427
+ 'profile_links' => Array(
428
+ 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
429
+ 'type' => 'textarea',
430
+ 'cols' => 60,
431
+ 'rows' => 5
432
+ ),
433
+ 'person_or_org' => Array(
434
+ 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ),
435
+ 'type' => 'radio',
436
+ 'initial_options' => Array(
437
+ 'person' => __( 'Person', 'all-in-one-seo-pack' ),
438
+ 'org' => __( 'Organization', 'all-in-one-seo-pack' )
439
+ )
440
+ ),
441
+ 'social_name' => Array(
442
+ 'name' => __( "Associated Name", 'all-in-one-seo-pack' ),
443
+ 'type' => 'text',
444
+ 'default' => ""
445
+ ),
446
  );
447
 
448
  // load initial options / set defaults
449
+ $this->update_options();
450
 
451
  $display = Array();
452
+ if ( isset( $this->options['aiosp_opengraph_types'] ) ) {
453
+ $display = $this->options['aiosp_opengraph_types'];
454
+ }
455
 
456
  $this->locations = array(
457
+ 'opengraph' => Array(
458
+ 'name' => $this->name,
459
+ 'prefix' => 'aiosp_',
460
+ 'type' => 'settings',
461
+ 'options' => Array(
462
+ 'scan_header',
463
+ 'setmeta',
464
+ 'key',
465
+ 'appid',
466
+ 'sitename',
467
+ 'title_shortcodes',
468
+ 'description_shortcodes',
469
+ 'hometitle',
470
+ 'description',
471
+ 'homeimage',
472
+ 'hometag',
473
+ 'generate_descriptions',
474
+ 'defimg',
475
+ 'fallback',
476
+ 'dimg',
477
+ 'dimgwidth',
478
+ 'dimgheight',
479
+ 'meta_key',
480
+ 'categories',
481
+ 'defcard',
482
+ 'profile_links',
483
+ 'person_or_org',
484
+ 'social_name',
485
+ 'twitter_site',
486
+ 'twitter_creator',
487
+ 'twitter_domain',
488
+ 'gen_tags',
489
+ 'gen_keywords',
490
+ 'gen_categories',
491
+ 'gen_post_tags',
492
+ 'types',
493
+ 'facebook_publisher',
494
+ 'facebook_author'
495
+ )
496
+ ),
497
+ 'settings' => Array(
498
+ 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ),
499
+ 'type' => 'metabox',
500
+ 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings',
501
+ 'options' => Array(
502
+ 'title',
503
+ 'desc',
504
+ 'image',
505
+ 'customimg',
506
+ 'imagewidth',
507
+ 'imageheight',
508
+ 'video',
509
+ 'videowidth',
510
+ 'videoheight',
511
+ 'category',
512
+ 'facebook_debug',
513
+ 'section',
514
+ 'tag',
515
+ 'setcard'
516
+ ),
517
+ 'display' => $display,
518
+ 'prefix' => 'aioseop_opengraph_'
519
+ )
520
  );
521
 
522
  $this->layout = Array(
523
+ 'default' => Array(
524
+ 'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
525
+ 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
526
+ 'options' => Array() // this is set below, to the remaining options -- pdb
527
+ ),
528
+ 'home' => Array(
529
+ 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
530
+ 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
531
+ 'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage', 'hometag' )
532
+ ),
533
+ 'image' => Array(
534
+ 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ),
535
+ 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
536
+ 'options' => Array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' )
537
+ ),
538
+ 'links' => Array(
539
+ 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
540
+ 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
541
+ 'options' => Array( 'profile_links', 'person_or_org', 'social_name' )
542
+ ),
543
+ 'facebook' => Array(
544
+ 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ),
545
+ 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
546
+ 'options' => Array(
547
+ 'key',
548
+ 'appid',
549
+ 'types',
550
+ 'gen_tags',
551
+ 'gen_keywords',
552
+ 'gen_categories',
553
+ 'gen_post_tags',
554
+ 'categories',
555
+ 'facebook_publisher',
556
+ 'facebook_author'
557
  )
558
+ ),
559
+ 'twitter' => Array(
560
+ 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ),
561
+ 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
562
+ 'options' => Array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' )
563
+ ),
564
+ 'scan_meta' => Array(
565
+ 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ),
566
+ 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#scan_meta',
567
+ 'options' => Array( 'scan_header' )
568
+ )
569
  );
570
 
571
  $other_options = Array();
572
+ foreach ( $this->layout as $k => $v ) {
573
  $other_options = array_merge( $other_options, $v['options'] );
574
+ }
575
 
576
  $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
577
 
581
  add_action( 'wp', Array( $this, 'type_setup' ) );
582
  }
583
 
584
+ if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
585
+ $this->do_opengraph();
586
+ }
587
 
588
  // Avoid having duplicate meta tags
589
  add_filter( 'jetpack_enable_open_graph', '__return_false' );
592
  function settings_page_init() {
593
  add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 );
594
  $cat = $this->options["{$this->prefix}categories"];
595
+ if ( ! empty( $cat ) ) {
596
  if ( $cat == 'blog' ) {
597
  $show_on_front = get_option( 'show_on_front' );
598
  if ( ( $show_on_front == 'page' ) && ( get_option( 'page_on_front' ) ) ) {
600
  }
601
  } elseif ( $cat == 'website' ) {
602
  $show_on_front = get_option( 'show_on_front' );
603
+ if ( ( $show_on_front == 'posts' ) ) {
604
  $this->output_error( '<p>' . __( "Blog on front page detected, suggested Facebook Object Type is 'blog'.", 'all-in-one-seo-pack' ) . '</p>' );
605
+ }
606
  }
607
  }
608
  }
609
+
610
  function filter_options( $options, $location ) {
611
  if ( $location == 'settings' ) {
612
  $prefix = $this->get_prefix( $location ) . $location . '_';
613
  list( $legacy, $images ) = $this->get_all_images( $options );
614
  if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) {
615
  $thumbnail = $options["{$prefix}image"];
616
+ if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) {
617
+ if ( $thumbnail == 'post' ) {
618
  $thumbnail = $images['post1'];
619
+ } else if ( ! empty( $legacy[ $thumbnail ] ) ) {
620
+ $thumbnail = $legacy[ $thumbnail ];
621
+ }
622
  }
623
  $options["{$prefix}image"] = $thumbnail;
624
  }
625
  if ( empty( $options[ $prefix . 'image' ] ) ) {
626
  $img = array_keys( $images );
627
+ if ( ! empty( $img ) && ! empty( $img[1] ) ) {
628
  $options[ $prefix . 'image' ] = $img[1];
629
+ }
630
  }
631
  }
632
+
633
  return $options;
634
  }
635
+
636
  function filter_settings( $settings, $location, $current ) {
637
  if ( $location == 'opengraph' || $location == 'settings' ) {
638
  $prefix = $this->get_prefix( $location ) . $location . '_';
639
+ if ( $location == 'opengraph' ) {
640
+ return $settings;
641
+ }
642
+ if ( $location == 'settings' ) {
643
  list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current );
644
+ $opts = Array( 'title', 'desc' );
645
  $current_post_type = get_post_type();
646
  if ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
647
  $flat_type_list = Array();
648
+ foreach ( $this->fb_object_types as $k => $v ) {
649
+ if ( is_array( $v ) ) {
650
+ $flat_type_list = array_merge( $flat_type_list, $v );
651
+ } else {
652
+ $flat_type_list[ $k ] = $v;
653
+ }
654
+ }
655
+ $settings[ $prefix . 'category' ]['initial_options'] = array_merge( Array(
656
  $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - '
657
+ . $flat_type_list[ $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ]
658
+ ),
659
+ $settings[ $prefix . 'category' ]['initial_options'] );
660
  }
661
  if ( isset( $this->options["aiosp_opengraph_defcard"] ) ) {
662
+ $settings[ $prefix . 'setcard' ]['default'] = $this->options["aiosp_opengraph_defcard"];
663
+ }
664
  global $aiosp;
665
  $info = $aiosp->get_page_snippet_info();
666
  extract( $info );
667
  $settings["{$prefix}title"]['placeholder'] = $title;
668
+ $settings["{$prefix}desc"]['placeholder'] = $description;
669
  }
670
+ if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) {
671
+ foreach ( $opts as $opt ) {
672
  if ( isset( $settings[ $prefix . $opt ] ) ) {
673
+ $settings[ $prefix . $opt ]['type'] = 'hidden';
674
+ $settings[ $prefix . $opt ]['label'] = 'none';
675
  $settings[ $prefix . $opt ]['help_text'] = '';
676
  unset( $settings[ $prefix . $opt ]['count'] );
677
  }
678
+ }
679
+ }
680
  }
681
+
682
  return $settings;
683
  }
684
+
685
  function override_options( $options, $location, $settings ) {
686
  $opts = Array();
687
+ foreach ( $settings as $k => $v ) {
688
+ if ( $v['save'] ) {
689
+ $opts[ $k ] = $v['default'];
690
+ }
691
+ }
692
+ foreach ( $options as $k => $v ) {
693
+ if ( $v === null ) {
694
+ unset( $options[ $k ] );
695
+ }
696
+ }
697
  $options = wp_parse_args( $options, $opts );
698
+
699
  return $options;
700
  }
701
+
702
  function filter_metabox_options( $options, $location, $post_id ) {
703
  if ( $location == 'settings' ) {
704
  $prefix = $this->get_prefix( $location ) . $location;
705
+ if ( ! empty( $options[ $prefix . '_customimg' ] ) ) {
706
  $old_options = get_post_meta( $post_id, '_' . $prefix );
707
  $prefix .= '_';
708
+ if ( empty( $old_options[ $prefix . 'customimg' ] ) || ( $old_options[ $prefix . 'customimg' ] != $options[ $prefix . 'customimg' ] ) ) {
709
+ $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ];
710
+ }
711
  }
712
  }
713
+
714
  return $options;
715
  }
716
+
717
  /** Custom settings **/
718
  function display_custom_options( $buf, $args ) {
719
  if ( $args['name'] == 'aiosp_opengraph_scan_header' ) {
720
  $buf .= '<div class="aioseop aioseop_options aiosp_opengraph_settings"><div class="aioseop_wrapper aioseop_custom_type" id="aiosp_opengraph_scan_header_wrapper"><div class="aioseop_input" id="aiosp_opengraph_scan_header" style="padding-left:20px;">';
721
  $args['options']['type'] = 'submit';
722
+ $args['attr'] = " class='button-primary' ";
723
+ $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' );
724
  $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' );
725
  $buf .= '<br /><br />' . $this->get_option_html( $args );
726
  $buf .= '</div></div></div>';
727
  }
728
+
729
  return $buf;
730
  }
731
+
732
  function add_attributes( $output ) { // avoid having duplicate meta tags
733
  $type = $this->type;
734
+ if ( empty( $type ) ) {
735
+ $type = 'website';
736
+ }
737
+
738
  $schema_types = Array(
739
+ 'album' => 'MusicAlbum',
740
+ 'article' => 'Article',
741
+ 'bar' => 'BarOrPub',
742
+ 'blog' => 'Blog',
743
+ 'book' => 'Book',
744
+ 'cafe' => 'CafeOrCoffeeShop',
745
+ 'city' => 'City',
746
+ 'country' => 'Country',
747
+ 'episode' => 'Episode',
748
+ 'food' => 'FoodEvent',
749
+ 'game' => 'Game',
750
+ 'hotel' => 'Hotel',
751
+ 'landmark' => 'LandmarksOrHistoricalBuildings',
752
+ 'movie' => 'Movie',
753
+ 'product' => 'Product',
754
+ 'profile' => 'ProfilePage',
755
  'restaurant' => 'Restaurant',
756
+ 'school' => 'School',
757
+ 'sport' => 'SportsEvent',
758
+ 'website' => 'WebSite'
759
  );
760
+
761
+ if ( ! empty( $schema_types[ $type ] ) ) {
762
+ $type = $schema_types[ $type ];
763
+ } else {
764
  $type = 'WebSite';
765
+ }
766
+
767
+ $attributes = apply_filters( $this->prefix . 'attributes', Array(
768
+ 'itemscope',
769
+ 'itemtype="http://schema.org/' . ucfirst( $type ) . '"',
770
+ 'prefix="og: http://ogp.me/ns#"'
771
+ ) );
772
+ foreach ( $attributes as $attr ) {
773
  if ( strpos( $output, $attr ) === false ) {
774
  $output .= "\n\t$attr ";
775
  }
776
  }
777
+
778
  return $output;
779
  }
780
+
781
+ function add_meta() {
782
  global $post, $aiosp, $aioseop_options, $wp_query;
783
+ $metabox = $this->get_current_options( Array(), 'settings' );
784
+ $key = $this->options['aiosp_opengraph_key'];
785
+ $dimg = $this->options['aiosp_opengraph_dimg'];
786
  $current_post_type = get_post_type();
787
+ $title = $description = $image = $video = '';
788
+ $type = $this->type;
789
+ $sitename = $this->options['aiosp_opengraph_sitename'];
790
+
791
+ $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : '';
792
+
793
+ if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
794
  $first_page = false;
795
+ if ( $aiosp->get_page_number() < 2 ) {
796
+ $first_page = true;
797
+ }
798
  } else {
799
  $first_page = true;
800
  }
801
  $url = $aiosp->aiosp_mrt_get_url( $wp_query );
802
  $url = apply_filters( 'aioseop_canonical_url', $url );
803
+
804
+ $setmeta = $this->options['aiosp_opengraph_setmeta'];
805
  $social_links = '';
806
  if ( is_front_page() ) {
807
  $title = $this->options['aiosp_opengraph_hometitle'];
808
+ if ( $first_page ) {
809
  $description = $this->options['aiosp_opengraph_description'];
810
+ }
811
+ if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) {
812
  $thumbnail = $this->options['aiosp_opengraph_homeimage'];
813
+ } else {
814
  $thumbnail = $this->options['aiosp_opengraph_dimg'];
815
+ }
816
+
817
  /* If Use AIOSEO Title and Desc Selected */
818
+ if ( $setmeta ) {
819
  $title = $aiosp->wp_title();
820
+ if ( $first_page ) {
821
  $description = $aiosp->get_aioseop_description( $post );
822
+ }
823
  }
824
+
825
  /* Add some defaults */
826
+ if ( empty( $title ) ) {
827
+ $title = get_bloginfo( 'name' );
828
+ }
829
+ if ( empty( $sitename ) ) {
830
+ $sitename = get_bloginfo( 'name' );
831
+ }
832
+
833
+ if ( empty( $description ) && $first_page && ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) && ! empty( $post ) && ! empty( $post->post_content ) && ! post_password_required( $post ) ) {
834
  $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 );
835
+ }
836
+
837
+ if ( empty( $description ) && $first_page ) {
838
+ $description = get_bloginfo( 'description' );
839
+ }
840
+ if ( $type == 'article' && ( ! empty( $this->options['aiosp_opengraph_hometag'] ) ) ) {
841
  $tag = $this->options['aiosp_opengraph_hometag'];
842
  }
843
+ if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) {
844
  $social_links = $this->options['aiosp_opengraph_profile_links'];
845
+ if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) {
846
  $social_name = $this->options['aiosp_opengraph_social_name'];
847
  }
848
  if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) {
851
  $social_type = "Organization";
852
  }
853
  }
854
+ } elseif ( is_singular() && $this->option_isset( 'types' )
855
+ && is_array( $this->options['aiosp_opengraph_types'] )
856
+ && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] )
857
+ ) {
858
 
859
  if ( $type == 'article' ) {
860
+ if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
861
  $section = $metabox['aioseop_opengraph_settings_section'];
862
  }
863
+ if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) {
864
  $tag = $metabox['aioseop_opengraph_settings_tag'];
865
  }
866
+ if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) {
867
  $publisher = $this->options['aiosp_opengraph_facebook_publisher'];
868
  }
869
  }
870
+
871
+ if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
872
  $domain = $this->options['aiosp_opengraph_twitter_domain'];
873
+ }
874
+
875
+
876
+ if ( $type == 'article' && ! empty( $post ) ) {
877
+ if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
878
  $author = get_the_author_meta( 'facebook', $post->post_author );
879
+ }
 
 
880
 
881
+ if ( isset( $post->post_date ) ) {
882
+ $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date ) );
883
+ }
884
+
885
+ if ( isset( $post->post_modified ) ) {
886
  $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified ) );
887
+ }
888
  }
889
 
890
+ $image = $metabox['aioseop_opengraph_settings_image'];
891
+ $video = $metabox['aioseop_opengraph_settings_video'];
892
+ $title = $metabox['aioseop_opengraph_settings_title'];
893
  $description = $metabox['aioseop_opengraph_settings_desc'];
894
+
895
  /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */
896
  global $aiosp;
897
+ if ( empty( $title ) ) {
898
  $title = $aiosp->wp_title();
899
+ }
900
+ if ( empty( $description ) ) {
901
  $description = trim( strip_tags( get_post_meta( $post->ID, "_aioseop_description", true ) ) );
902
+ }
903
+
904
  /* Add some defaults */
905
+ if ( empty( $title ) ) {
906
+ $title = get_the_title();
907
+ }
908
+ if ( empty( $description ) && ( $this->options['aiosp_opengraph_generate_descriptions'] ) && ! post_password_required( $post ) ) {
909
  $description = $post->post_content;
910
+ }
911
+ if ( empty( $type ) ) {
912
+ $type = 'article';
913
+ }
914
+ } else {
915
+ return;
916
+ }
917
+
918
  if ( $type == 'article' ) {
919
+ if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) {
920
+ if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) {
921
  $keywords = $aiosp->get_main_keywords();
922
  $keywords = $this->apply_cf_fields( $keywords );
923
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
924
+ if ( ! empty( $keywords ) && ! empty( $tag ) ) {
925
  $tag .= ',' . $keywords;
926
  } elseif ( empty( $tag ) ) {
927
  $tag = $keywords;
928
  }
929
  }
930
  $tag = $aiosp->keyword_string_to_list( $tag );
931
+ if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) {
932
  $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) );
933
+ }
934
+ if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) {
935
  $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) );
936
+ }
937
+ }
938
+ if ( ! empty( $tag ) ) {
939
+ $tag = $aiosp->clean_keyword_list( $tag );
940
  }
 
 
941
  }
942
+
943
+ if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) {
944
  $title = do_shortcode( $title );
945
  }
946
+
947
+ if ( ! empty( $description ) ) {
948
  $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) );
949
+ if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) {
950
  $description = do_shortcode( $description );
951
  }
952
+ $description = $aiosp->trim_excerpt_without_filters( $description, 1000 );
953
  }
954
+
955
+ $title = $this->apply_cf_fields( $title );
956
  $description = $this->apply_cf_fields( $description );
957
+
958
+ /* Data Validation */
959
+ $title = strip_tags( esc_attr( $title ) );
960
+ $sitename = strip_tags( esc_attr( $sitename ) );
961
  $description = strip_tags( esc_attr( $description ) );
962
+
963
+ if ( empty( $thumbnail ) && ! empty( $image ) ) {
964
  $thumbnail = $image;
965
+ }
966
+
967
  /* Get the first image attachment on the post */
968
  // if( empty($thumbnail) ) $thumbnail = $this->get_the_image();
969
+
970
  /* Add user supplied default image */
971
+ if ( empty( $thumbnail ) ) {
972
+ if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) {
973
  $thumbnail = $this->options['aiosp_opengraph_dimg'];
974
+ } else {
975
  switch ( $this->options['aiosp_opengraph_defimg'] ) {
976
+ case 'featured' :
977
+ $thumbnail = $this->get_the_image_by_post_thumbnail();
978
+ break;
979
+ case 'attach' :
980
+ $thumbnail = $this->get_the_image_by_attachment();
981
+ break;
982
+ case 'content' :
983
+ $thumbnail = $this->get_the_image_by_scan();
984
+ break;
985
+ case 'custom' :
986
+ $meta_key = $this->options['aiosp_opengraph_meta_key'];
987
+ if ( ! empty( $meta_key ) && ! empty( $post ) ) {
988
+ $meta_key = explode( ',', $meta_key );
989
+ $thumbnail = $this->get_the_image_by_meta_key( Array(
990
+ 'post_id' => $post->ID,
991
+ 'meta_key' => $meta_key
992
+ ) );
993
+ }
994
+ break;
995
+ case 'auto' :
996
+ $thumbnail = $this->get_the_image();
997
+ break;
998
+ case 'author' :
999
+ $thumbnail = $this->get_the_image_by_author();
1000
+ break;
1001
+ default :
1002
+ $thumbnail = $this->options['aiosp_opengraph_dimg'];
1003
  }
1004
  }
1005
  }
1006
+
1007
+ if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) {
1008
  $thumbnail = $this->options['aiosp_opengraph_dimg'];
1009
+ }
1010
 
1011
+ if ( ! empty( $thumbnail ) ) {
1012
+ $thumbnail = esc_url( $thumbnail );
1013
+ }
1014
 
1015
  $width = $height = '';
1016
+ if ( ! empty( $thumbnail ) ) {
1017
+ if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) {
1018
  $width = $metabox['aioseop_opengraph_settings_imagewidth'];
1019
+ }
1020
+ if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) {
1021
  $height = $metabox['aioseop_opengraph_settings_imageheight'];
1022
+ }
1023
+ if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) {
1024
  $width = $this->options['aiosp_opengraph_dimgwidth'];
1025
+ }
1026
+ if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) {
1027
  $height = $this->options['aiosp_opengraph_dimgheight'];
1028
+ }
1029
  }
1030
 
1031
+ if ( ! empty( $video ) ) {
1032
+ if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) {
1033
  $videowidth = $metabox['aioseop_opengraph_settings_videowidth'];
1034
+ }
1035
+ if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) {
1036
+ $videoheight = $metabox['aioseop_opengraph_settings_videoheight'];
1037
+ }
1038
  }
1039
 
1040
  $card = 'summary';
1041
+ if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) {
1042
  $card = $this->options['aiosp_opengraph_defcard'];
1043
+ }
1044
+
1045
+ if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) {
1046
  $card = $metabox['aioseop_opengraph_settings_setcard'];
1047
+ }
1048
+
1049
+
1050
  //support for changing legacy twitter cardtype-photo to summary large image
1051
+ if ( $card == 'photo' ) {
1052
  $card = 'summary_large_image';
1053
  }
1054
 
1055
 
1056
  $site = $domain = $creator = '';
1057
 
1058
+ if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) {
1059
  $site = $this->options['aiosp_opengraph_twitter_site'];
1060
+ $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site );
1061
+ }
1062
 
1063
+ if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1064
  $domain = $this->options['aiosp_opengraph_twitter_domain'];
1065
+ }
 
 
 
 
1066
 
1067
+ if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) {
1068
+ $creator = get_the_author_meta( 'twitter', $post->post_author );
1069
+ $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator );
1070
+ }
1071
 
1072
  $meta = Array(
1073
+ 'facebook' => Array(
1074
+ 'title' => 'og:title',
1075
+ 'type' => 'og:type',
1076
+ 'url' => 'og:url',
1077
+ 'thumbnail' => 'og:image',
1078
+ 'width' => 'og:image:width',
1079
+ 'height' => 'og:image:height',
1080
+ 'video' => 'og:video',
1081
+ 'videowidth' => 'og:video:width',
1082
+ 'videoheight' => 'og:video:height',
1083
+ 'sitename' => 'og:site_name',
1084
+ 'key' => 'fb:admins',
1085
+ 'appid' => 'fb:app_id',
1086
+ 'description' => 'og:description',
1087
+ 'section' => 'article:section',
1088
+ 'tag' => 'article:tag',
1089
+ 'publisher' => 'article:publisher',
1090
+ 'author' => 'article:author',
1091
+ 'published_time' => 'article:published_time',
1092
+ 'modified_time' => 'article:modified_time',
1093
+ ),
1094
+ 'twitter' => Array(
1095
+ 'card' => 'twitter:card',
1096
+ 'site' => 'twitter:site',
1097
+ 'creator' => 'twitter:creator',
1098
+ 'domain' => 'twitter:domain',
1099
+ 'title' => 'twitter:title',
1100
+ 'description' => 'twitter:description',
1101
+ 'thumbnail' => 'twitter:image',
1102
+ ),
1103
  );
 
 
 
 
1104
 
1105
+ //Only show if "use schema.org markup is checked"
1106
+ if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
1107
+ $meta['google+'] = Array( 'thumbnail' => 'image' );
1108
+ }
1109
 
1110
 
 
1111
  // Add links to testing tools
1112
+
1113
  /*
1114
  http://developers.facebook.com/tools/debug
1115
  https://dev.twitter.com/docs/cards/preview
1137
  'title' => 'twitter:title',
1138
  'description' => 'twitter:description',
1139
  'thumbnail' => 'twitter:image'
1140
+
1141
  )
1142
  );
1143
  */
1144
+
1145
  $tags = Array(
1146
+ 'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
1147
+ 'twitter' => Array( 'name' => 'name', 'value' => 'content' ),
1148
+ 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' )
1149
  );
1150
+
1151
+ foreach ( $meta as $t => $data ) {
1152
  foreach ( $data as $k => $v ) {
1153
+ if ( empty( $$k ) ) {
1154
+ $$k = '';
1155
+ }
1156
  $filtered_value = $$k;
1157
  $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k );
1158
+ if ( ! empty( $filtered_value ) ) {
1159
+ if ( ! is_array( $filtered_value ) ) {
1160
  $filtered_value = Array( $filtered_value );
1161
+ }
1162
+ foreach ( $filtered_value as $f ) {
1163
+ echo '<meta ' . $tags[ $t ]['name'] . '="' . $v . '" ' . $tags[ $t ]['value'] . '="' . $f . '" />' . "\n";
1164
  }
1165
  }
1166
  }
1167
+ }
1168
  $social_link_schema = '';
1169
+ if ( ! empty( $social_links ) ) {
1170
+ $home_url = esc_url( get_home_url() );
1171
  $social_links = explode( "\n", $social_links );
1172
+ foreach ( $social_links as $k => $v ) {
1173
  $v = trim( $v );
1174
  if ( empty( $v ) ) {
1175
+ unset( $social_links[ $k ] );
1176
  } else {
1177
+ $v = esc_url( $v );
1178
+ $social_links[ $k ] = $v;
1179
  }
1180
  }
1181
+ $social_links = join( '","', $social_links );
1182
+ $social_link_schema = <<<END
1183
  <script type="application/ld+json">
1184
  { "@context" : "http://schema.org",
1185
  "@type" : "{$social_type}",
1193
  }
1194
  echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema );
1195
  }
1196
+
1197
+ function do_opengraph() {
1198
  global $aioseop_options;
1199
+ if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
1200
  add_filter( 'language_attributes', Array( $this, 'add_attributes' ) );
1201
+ }
1202
+ if ( ! defined( 'DOING_AJAX' ) ) {
1203
+ add_action( 'aioseop_modules_wp_head', Array( $this, 'add_meta' ), 5 );
1204
+ }
1205
  }
1206
+
1207
  function type_setup() {
1208
  global $aiosp, $wp_query;
1209
  $this->type = '';
1210
  if ( $aiosp->is_static_front_page() ) {
1211
+ if ( ! empty( $this->options ) && ! empty( $this->options['aiosp_opengraph_categories'] ) ) {
1212
  $this->type = $this->options['aiosp_opengraph_categories'];
1213
+ }
1214
+ } elseif ( is_singular() && $this->option_isset( 'types' ) ) {
1215
+ $metabox = $this->get_current_options( Array(), 'settings' );
1216
  $current_post_type = get_post_type();
1217
+ if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) {
1218
  $this->type = $metabox['aioseop_opengraph_settings_category'];
1219
  } elseif ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
1220
  $this->type = $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"];
1221
  }
1222
  }
1223
  }
1224
+
1225
+ function debug_post_types() {
1226
  add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 3 );
1227
  add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 );
1228
+ add_filter( $this->get_prefix( 'settings' ) . 'filter_metabox_options', Array(
1229
+ $this,
1230
+ 'filter_metabox_options'
1231
+ ), 10, 3 );
1232
+ $post_types = $this->get_post_type_titles();
1233
+ $rempost = array( 'revision' => 1, 'nav_menu_item' => 1 );
1234
+ $post_types = array_diff_key( $post_types, $rempost );
1235
+ $this->default_options['types']['initial_options'] = $post_types;
1236
+ foreach ( $post_types as $slug => $name ) {
1237
+ $field = $slug . '_fb_object_type';
1238
+ $this->default_options[ $field ] = Array(
1239
+ 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "<br />($slug)",
1240
+ 'type' => 'select',
1241
+ 'style' => '',
1242
+ 'initial_options' => $this->fb_object_types,
1243
+ 'default' => 'article',
1244
+ 'condshow' => Array( 'aiosp_opengraph_types\[\]' => $slug )
1245
  );
1246
+ $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' );
1247
+ $this->help_anchors[ $field ] = '#content-object-types';
1248
  $this->locations['opengraph']['options'][] = $field;
1249
+ $this->layout['facebook']['options'][] = $field;
1250
  }
1251
  $this->setting_options();
1252
  $this->add_help_text_links();
1253
+
1254
  }
1255
+
1256
  function get_all_images( $options = null, $p = null ) {
1257
  static $img = Array();
1258
+ if ( ! is_array( $options ) ) {
1259
+ $options = Array();
1260
+ }
1261
+ if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) {
1262
  $options['meta_key'] = $this->options['aiosp_opengraph_meta_key'];
1263
+ }
1264
  if ( empty( $img ) ) {
1265
+ $size = apply_filters( 'post_thumbnail_size', 'large' );
1266
  $default = $this->get_the_image_by_default();
1267
+ if ( ! empty( $default ) ) {
1268
+ $img[ $default ] = 0;
1269
+ }
1270
  $img = array_merge( $img, parent::get_all_images( $options, null ) );
1271
  }
1272
 
1273
+ if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
1274
+ $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg';
1275
  }
1276
  if ( $author_img = $this->get_the_image_by_author( $p ) ) {
1277
+ $image["author"] = $author_img;
1278
  }
1279
+ $image = array_flip( $img );
1280
  $images = Array();
1281
+ if ( ! empty( $image ) ) {
1282
+ foreach ( $image as $k => $v ) {
1283
+ $images[ $v ] = '<img height=150 src="' . $v . '">';
1284
+ }
1285
+ }
1286
+
1287
  return Array( $image, $images );
1288
  }
1289
+
1290
  function get_the_image_by_author( $options = null, $p = null ) {
1291
  if ( $p === null ) {
1292
  global $post;
1293
  } else {
1294
  $post = $p;
1295
  }
1296
+ if ( ! empty( $post ) && ! empty( $post->post_author ) ) {
1297
+ $matches = Array();
1298
  $get_avatar = get_avatar( $post->post_author, 300 );
1299
+ if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) {
1300
  return $matches[1];
1301
  }
1302
  }
1303
+
1304
  return false;
1305
  }
1306
+
1307
  function get_the_image( $options = null, $p = null ) {
1308
  $meta_key = $this->options['aiosp_opengraph_meta_key'];
1309
+
1310
  return parent::get_the_image( Array( 'meta_key' => $meta_key ), $p );
1311
  }
1312
+
1313
  function get_the_image_by_default( $args = array() ) {
1314
  return $this->options['aiosp_opengraph_dimg'];
1315
  }
1316
+
1317
+ function settings_update() {
1318
+
1319
  }
1320
  }
1321
  }
modules/aioseop_performance.php CHANGED
@@ -1,224 +1,283 @@
1
  <?php
2
- /**
3
- * @package All-in-One-SEO-Pack
4
- */
5
  /**
6
  * The Performance class.
 
 
7
  */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
 
 
9
  class All_in_One_SEO_Pack_Performance extends All_in_One_SEO_Pack_Module {
10
 
11
- protected $module_info = Array( );
12
 
13
  function __construct( $mod ) {
14
- $this->name = __('Performance', 'all-in-one-seo-pack'); // Human-readable name of the plugin
15
- $this->prefix = 'aiosp_performance_'; // option prefix
16
- $this->file = __FILE__; // the current file
17
  parent::__construct();
18
-
19
- $this->help_text = Array(
20
- "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' ),
21
- "execution_time" => __( "This setting allows you to raise your PHP execution time to a reasonable value.", 'all-in-one-seo-pack' ),
22
- "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' )
23
  );
24
-
25
  $this->default_options = array(
26
- 'memory_limit' => Array( 'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ),
27
- 'default' => '256M', 'type' => 'select',
28
- 'initial_options' => Array( 0 => __( "Use the system default", 'all-in-one-seo-pack' ), '32M' => '32MB', '64M' => '64MB', '128M' => '128MB', '256M' => '256MB' ) ),
29
- 'execution_time' => Array( 'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ),
30
- 'default' => '', 'type' => 'select',
31
- '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' ) ) )
32
- );
33
-
34
- $this->help_anchors = Array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  'memory_limit' => '#raise-memory-limit',
36
  'execution_time' => '#raise-execution-time',
37
- 'force_rewrites' => '#force-rewrites'
38
  );
39
-
40
  global $aiosp, $aioseop_options;
41
  if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) && $aioseop_options['aiosp_rewrite_titles'] ) {
42
- $this->default_options['force_rewrites'] = Array(
43
- 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
44
- 'default' => 1, 'type' => 'radio',
45
- 'initial_options' => Array( 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
46
- 0 => __( 'Disabled', 'all-in-one-seo-pack' ) )
47
- );
 
 
 
48
  }
49
-
50
- $this->layout = Array(
51
- 'default' => Array(
52
- 'name' => $this->name,
53
- 'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
54
- 'options' => array_keys( $this->default_options )
55
- )
56
  );
57
-
58
- $system_status = Array(
59
- 'status' => Array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
60
  );
61
-
62
- $this->layout['system_status'] = Array(
63
- 'name' => __( 'System Status', 'all-in-one-seo-pack' ),
64
- 'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
65
- 'options' => array_keys( $system_status )
66
- );
67
-
68
  $this->default_options = array_merge( $this->default_options, $system_status );
69
-
70
  $this->add_help_text_links();
71
-
72
- add_filter( $this->prefix . 'display_options', Array( $this, 'display_options_filter' ), 10, 2 );
73
- add_filter( $this->prefix . 'update_options', Array( $this, 'update_options_filter' ), 10, 2 );
74
- add_action( $this->prefix . 'settings_update', Array( $this, 'settings_update_action' ), 10, 2 );
75
  }
76
-
77
  function update_options_filter( $options, $location ) {
78
- if ( $location == null ) {
79
- if ( isset( $options[ $this->prefix . 'force_rewrites' ] ) )
80
  unset( $options[ $this->prefix . 'force_rewrites' ] );
81
  }
 
82
  return $options;
83
  }
84
-
85
  function display_options_filter( $options, $location ) {
86
  if ( $location == null ) {
87
  $options[ $this->prefix . 'force_rewrites' ] = 1;
88
  global $aiosp;
89
  if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) ) {
90
- $opts = $aiosp->get_current_options( Array(), null );
91
  $options[ $this->prefix . 'force_rewrites' ] = $opts['aiosp_force_rewrites'];
92
  }
93
  }
 
94
  return $options;
95
  }
96
-
97
  function settings_update_action( $options, $location ) {
98
- if ( $location == null ) {
99
- if ( isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) {
100
  $force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ];
101
  if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) {
102
  global $aiosp;
103
- $opts = $aiosp->get_current_options( Array(), null );
104
  $opts['aiosp_force_rewrites'] = $force_rewrites;
105
  $aiosp->update_class_option( $opts );
106
  wp_cache_flush();
107
  }
108
- }
109
  }
110
  }
111
-
112
  function add_page_hooks() {
113
  $memory_usage = memory_get_peak_usage() / 1024 / 1024;
114
  if ( $memory_usage > 32 ) {
115
  unset( $this->default_options['memory_limit']['initial_options']['32M'] );
116
- if ( $memory_usage > 64 ) unset( $this->default_options['memory_limit']['initial_options']['64M'] );
117
- if ( $memory_usage > 128 ) unset( $this->default_options['memory_limit']['initial_options']['128M'] );
118
- if ( $memory_usage > 256 ) unset( $this->default_options['memory_limit']['initial_options']['256M'] );
 
 
 
 
 
 
119
  }
120
  $this->update_options();
121
  parent::add_page_hooks();
122
  }
123
-
124
  function settings_page_init() {
125
  $this->default_options['status']['default'] = $this->get_serverinfo();
126
  }
127
-
128
  function menu_order() {
129
  return 7;
130
  }
131
-
132
  function get_serverinfo() {
133
- global $wpdb;
134
  global $wp_version;
135
 
136
- $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
137
- $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
138
- if (is_array($mysqlinfo)) $sql_mode = $mysqlinfo[0]->Value;
139
- if (empty($sql_mode)) $sql_mode = __('Not set', 'all-in-one-seo-pack' );
140
- if(ini_get('safe_mode')) $safe_mode = __('On', 'all-in-one-seo-pack' );
141
- else $safe_mode = __('Off', 'all-in-one-seo-pack' );
142
- if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'all-in-one-seo-pack' );
143
- else $allow_url_fopen = __('Off', 'all-in-one-seo-pack' );
144
- if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize');
145
- else $upload_max = __('N/A', 'all-in-one-seo-pack' );
146
- if(ini_get('post_max_size')) $post_max = ini_get('post_max_size');
147
- else $post_max = __('N/A', 'all-in-one-seo-pack' );
148
- if(ini_get('max_execution_time')) $max_execute = ini_get('max_execution_time');
149
- else $max_execute = __('N/A', 'all-in-one-seo-pack' );
150
- if(ini_get('memory_limit')) $memory_limit = ini_get('memory_limit');
151
- else $memory_limit = __('N/A', 'all-in-one-seo-pack' );
152
- if (function_exists('memory_get_usage')) $memory_usage = round(memory_get_usage() / 1024 / 1024, 2) . __(' MByte', 'all-in-one-seo-pack' );
153
- else $memory_usage = __('N/A', 'all-in-one-seo-pack' );
154
- if (is_callable('exif_read_data')) $exif = __('Yes', 'all-in-one-seo-pack' ). " ( V" . $this->substr(phpversion('exif'),0,4) . ")" ;
155
- else $exif = __('No', 'all-in-one-seo-pack' );
156
- if (is_callable('iptcparse')) $iptc = __('Yes', 'all-in-one-seo-pack' );
157
- else $iptc = __('No', 'all-in-one-seo-pack' );
158
- if (is_callable('xml_parser_create')) $xml = __('Yes', 'all-in-one-seo-pack' );
159
- else $xml = __('No', 'all-in-one-seo-pack' );
160
-
161
- if ( function_exists( 'wp_get_theme' ) ) {
162
- $theme = wp_get_theme();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  } else {
164
- $theme = get_theme( get_current_theme() );
165
  }
166
 
 
167
 
168
  if ( function_exists( 'is_multisite' ) ) {
169
  if ( is_multisite() ) {
170
- $ms = __('Yes', 'all-in-one-seo-pack' );
171
  } else {
172
- $ms = __('No', 'all-in-one-seo-pack' );
173
  }
174
 
175
- } else $ms = __('N/A', 'all-in-one-seo-pack' );
176
-
177
- $siteurl = get_option('siteurl');
178
- $homeurl = get_option('home');
179
- $db_version = get_option('db_version');
180
-
181
- $debug_info = Array(
182
- __('Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
183
- __('Server', 'all-in-one-seo-pack' ) => $_SERVER["SERVER_SOFTWARE"],
184
- __('Memory usage', 'all-in-one-seo-pack' ) => $memory_usage,
185
- __('MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion,
186
- __('SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode,
187
- __('PHP Version', 'all-in-one-seo-pack' ) => PHP_VERSION,
188
- __('PHP Safe Mode', 'all-in-one-seo-pack' ) => $safe_mode,
189
- __('PHP Allow URL fopen', 'all-in-one-seo-pack' ) => $allow_url_fopen,
190
- __('PHP Memory Limit', 'all-in-one-seo-pack' ) => $memory_limit,
191
- __('PHP Max Upload Size', 'all-in-one-seo-pack' ) => $upload_max,
192
- __('PHP Max Post Size', 'all-in-one-seo-pack' ) => $post_max,
193
- __('PHP Max Script Execute Time', 'all-in-one-seo-pack' ) => $max_execute,
194
- __('PHP Exif support', 'all-in-one-seo-pack' ) => $exif,
195
- __('PHP IPTC support', 'all-in-one-seo-pack' ) => $iptc,
196
- __('PHP XML support', 'all-in-one-seo-pack' ) => $xml,
197
- __('Site URL', 'all-in-one-seo-pack' ) => $siteurl,
198
- __('Home URL', 'all-in-one-seo-pack' ) => $homeurl,
199
- __('WordPress Version', 'all-in-one-seo-pack' ) => $wp_version,
200
- __('WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
201
- __('Multisite', 'all-in-one-seo-pack' ) => $ms,
202
- __('Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'].' '.$theme['Version']
 
 
203
  );
204
  $debug_info['Active Plugins'] = null;
205
- $active_plugins = $inactive_plugins = Array();
206
- $plugins = get_plugins();
207
- foreach ($plugins as $path => $plugin) {
208
  if ( is_plugin_active( $path ) ) {
209
- $debug_info[$plugin['Name']] = $plugin['Version'];
210
  } else {
211
- $inactive_plugins[$plugin['Name']] = $plugin['Version'];
212
  }
213
  }
214
  $debug_info['Inactive Plugins'] = null;
215
- $debug_info = array_merge( $debug_info, (array)$inactive_plugins );
216
 
217
- $mail_text = __( "All in One SEO Pack Pro Debug Info", 'all-in-one-seo-pack' ) . "\r\n------------------\r\n\r\n";
218
- $page_text = "";
219
- if ( !empty( $debug_info ) )
220
- foreach($debug_info as $name => $value) {
221
- if ($value !== null) {
222
  $page_text .= "<li><strong>$name</strong> $value</li>";
223
  $mail_text .= "$name: $value\r\n";
224
  } else {
@@ -226,40 +285,46 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
226
  $mail_text .= "\r\n$name\r\n----------\r\n";
227
  }
228
  }
 
229
 
230
- do if ( !empty( $_REQUEST['sfwd_debug_submit'] ) || !empty( $_REQUEST['sfwd_update_check'] ) ) {
231
- $nonce=$_REQUEST['sfwd_debug_nonce'];
232
- if (! wp_verify_nonce($nonce, 'sfwd-debug-nonce') ) {
233
- echo "<div class='sfwd_debug_error'>" . __( "Form submission error: verification check failed.", 'all-in-one-seo-pack' ) . "</div>";
234
- break;
235
- }
236
- if ( !empty( $_REQUEST['sfwd_update_check'] ) && $_REQUEST['sfwd_update_check'] ) {
237
- global $aioseop_update_checker;
238
- $aioseop_update_checker->checkForUpdates();
239
- echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( "%s has checked for updates.", 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ) . "</div>";
240
- break;
241
- }
242
- $email = '';
243
- if ( !empty( $_REQUEST['sfwd_debug_send_email'] ) ) $email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] );
244
- if ( $email ) {
245
- if ( wp_mail( $email, sprintf( __( "SFWD Debug Mail From Site %s.", 'all-in-one-seo-pack'), $siteurl), $mail_text ) ) {
246
- echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( "Sent to %s.", 'all-in-one-seo-pack' ), $email ) . "</div>";
 
 
 
 
 
 
247
  } else {
248
- echo "<div class='sfwd_debug_error'>" . sprintf( __( "Failed to send to %s.", 'all-in-one-seo-pack' ), $email ) . "</div>";
249
  }
250
- } else {
251
- echo "<div class='sfwd_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . "</div>";
252
  }
253
- } while(0); // control structure for use with break
254
- $nonce = wp_create_nonce('sfwd-debug-nonce');
255
- $buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n<p>\n" .
256
- '<input name="sfwd_debug_send_email" type="text" value="" placeholder="' . __( "E-mail debug information", 'all-in-one-seo-pack' ) . '"><input name="sfwd_debug_nonce" type="hidden" value="' .
257
- $nonce . '"><input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
258
-
259
- if ( AIOSEOPPRO ){
260
- $buf .= '<p><input name="sfwd_update_check" type="submit" value="' . __( 'Check For Updates', 'all-in-one-seo-pack' ) . '" class="button-primary">';
261
- }
 
262
  return $buf;
263
  }
264
  }
265
- }
1
  <?php
 
 
 
2
  /**
3
  * The Performance class.
4
+ *
5
+ * @package All-in-One-SEO-Pack
6
  */
7
+
8
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
9
+
10
  class All_in_One_SEO_Pack_Performance extends All_in_One_SEO_Pack_Module {
11
 
12
+ protected $module_info = array();
13
 
14
  function __construct( $mod ) {
15
+ $this->name = __( 'Performance', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
16
+ $this->prefix = 'aiosp_performance_'; // Option prefix.
17
+ $this->file = __FILE__; // The current file.
18
  parent::__construct();
19
+
20
+ $this->help_text = array(
21
+ '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' ),
22
+ 'execution_time' => __( 'This setting allows you to raise your PHP execution time to a reasonable value.', 'all-in-one-seo-pack' ),
23
+ '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' ),
24
  );
25
+
26
  $this->default_options = array(
27
+ 'memory_limit' => array(
28
+ 'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ),
29
+ 'default' => '256M',
30
+ 'type' => 'select',
31
+ 'initial_options' => array(
32
+ 0 => __( 'Use the system default', 'all-in-one-seo-pack' ),
33
+ '32M' => '32MB',
34
+ '64M' => '64MB',
35
+ '128M' => '128MB',
36
+ '256M' => '256MB',
37
+ ),
38
+ ),
39
+ 'execution_time' => array(
40
+ 'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ),
41
+ 'default' => '',
42
+ 'type' => 'select',
43
+ 'initial_options' => array(
44
+ '' => __( 'Use the system default', 'all-in-one-seo-pack' ),
45
+ 30 => '30s',
46
+ 60 => '1m',
47
+ 120 => '2m',
48
+ 300 => '5m',
49
+ 0 => __( 'No limit', 'all-in-one-seo-pack' ),
50
+ ),
51
+ ),
52
+ );
53
+
54
+ $this->help_anchors = array(
55
  'memory_limit' => '#raise-memory-limit',
56
  'execution_time' => '#raise-execution-time',
57
+ 'force_rewrites' => '#force-rewrites',
58
  );
59
+
60
  global $aiosp, $aioseop_options;
61
  if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) && $aioseop_options['aiosp_rewrite_titles'] ) {
62
+ $this->default_options['force_rewrites'] = array(
63
+ 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
64
+ 'default' => 1,
65
+ 'type' => 'radio',
66
+ 'initial_options' => array(
67
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
68
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' ),
69
+ ),
70
+ );
71
  }
72
+
73
+ $this->layout = array(
74
+ 'default' => array(
75
+ 'name' => $this->name,
76
+ 'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
77
+ 'options' => array_keys( $this->default_options ),
78
+ ),
79
  );
80
+
81
+ $system_status = array(
82
+ 'status' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
83
  );
84
+
85
+ $this->layout['system_status'] = array(
86
+ 'name' => __( 'System Status', 'all-in-one-seo-pack' ),
87
+ 'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
88
+ 'options' => array_keys( $system_status ),
89
+ );
90
+
91
  $this->default_options = array_merge( $this->default_options, $system_status );
92
+
93
  $this->add_help_text_links();
94
+
95
+ add_filter( $this->prefix . 'display_options', array( $this, 'display_options_filter' ), 10, 2 );
96
+ add_filter( $this->prefix . 'update_options', array( $this, 'update_options_filter' ), 10, 2 );
97
+ add_action( $this->prefix . 'settings_update', array( $this, 'settings_update_action' ), 10, 2 );
98
  }
99
+
100
  function update_options_filter( $options, $location ) {
101
+ if ( $location == null && isset( $options[ $this->prefix . 'force_rewrites' ] ) ) {
 
102
  unset( $options[ $this->prefix . 'force_rewrites' ] );
103
  }
104
+
105
  return $options;
106
  }
107
+
108
  function display_options_filter( $options, $location ) {
109
  if ( $location == null ) {
110
  $options[ $this->prefix . 'force_rewrites' ] = 1;
111
  global $aiosp;
112
  if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) ) {
113
+ $opts = $aiosp->get_current_options( array(), null );
114
  $options[ $this->prefix . 'force_rewrites' ] = $opts['aiosp_force_rewrites'];
115
  }
116
  }
117
+
118
  return $options;
119
  }
120
+
121
  function settings_update_action( $options, $location ) {
122
+ if ( $location == null && isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) {
 
123
  $force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ];
124
  if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) {
125
  global $aiosp;
126
+ $opts = $aiosp->get_current_options( array(), null );
127
  $opts['aiosp_force_rewrites'] = $force_rewrites;
128
  $aiosp->update_class_option( $opts );
129
  wp_cache_flush();
130
  }
 
131
  }
132
  }
133
+
134
  function add_page_hooks() {
135
  $memory_usage = memory_get_peak_usage() / 1024 / 1024;
136
  if ( $memory_usage > 32 ) {
137
  unset( $this->default_options['memory_limit']['initial_options']['32M'] );
138
+ if ( $memory_usage > 64 ) {
139
+ unset( $this->default_options['memory_limit']['initial_options']['64M'] );
140
+ }
141
+ if ( $memory_usage > 128 ) {
142
+ unset( $this->default_options['memory_limit']['initial_options']['128M'] );
143
+ }
144
+ if ( $memory_usage > 256 ) {
145
+ unset( $this->default_options['memory_limit']['initial_options']['256M'] );
146
+ }
147
  }
148
  $this->update_options();
149
  parent::add_page_hooks();
150
  }
151
+
152
  function settings_page_init() {
153
  $this->default_options['status']['default'] = $this->get_serverinfo();
154
  }
155
+
156
  function menu_order() {
157
  return 7;
158
  }
159
+
160
  function get_serverinfo() {
161
+ global $wpdb;
162
  global $wp_version;
163
 
164
+ $sqlversion = $wpdb->get_var( "SELECT VERSION() AS version" );
165
+ $mysqlinfo = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
166
+ if ( is_array( $mysqlinfo ) ) {
167
+ $sql_mode = $mysqlinfo[0]->Value;
168
+ }
169
+ if ( empty( $sql_mode ) ) {
170
+ $sql_mode = __( 'Not set', 'all-in-one-seo-pack' );
171
+ }
172
+ if ( ini_get( 'safe_mode' ) ) {
173
+ $safe_mode = __( 'On', 'all-in-one-seo-pack' );
174
+ } else {
175
+ $safe_mode = __( 'Off', 'all-in-one-seo-pack' );
176
+ }
177
+ if ( ini_get( 'allow_url_fopen' ) ) {
178
+ $allow_url_fopen = __( 'On', 'all-in-one-seo-pack' );
179
+ } else {
180
+ $allow_url_fopen = __( 'Off', 'all-in-one-seo-pack' );
181
+ }
182
+ if ( ini_get( 'upload_max_filesize' ) ) {
183
+ $upload_max = ini_get( 'upload_max_filesize' );
184
+ } else {
185
+ $upload_max = __( 'N/A', 'all-in-one-seo-pack' );
186
+ }
187
+ if ( ini_get( 'post_max_size' ) ) {
188
+ $post_max = ini_get( 'post_max_size' );
189
+ } else {
190
+ $post_max = __( 'N/A', 'all-in-one-seo-pack' );
191
+ }
192
+ if ( ini_get( 'max_execution_time' ) ) {
193
+ $max_execute = ini_get( 'max_execution_time' );
194
+ } else {
195
+ $max_execute = __( 'N/A', 'all-in-one-seo-pack' );
196
+ }
197
+ if ( ini_get( 'memory_limit' ) ) {
198
+ $memory_limit = ini_get( 'memory_limit' );
199
+ } else {
200
+ $memory_limit = __( 'N/A', 'all-in-one-seo-pack' );
201
+ }
202
+ if ( function_exists( 'memory_get_usage' ) ) {
203
+ $memory_usage = round( memory_get_usage() / 1024 / 1024, 2 ) . __( ' MByte', 'all-in-one-seo-pack' );
204
+ } else {
205
+ $memory_usage = __( 'N/A', 'all-in-one-seo-pack' );
206
+ }
207
+ if ( is_callable( 'exif_read_data' ) ) {
208
+ $exif = __( 'Yes', 'all-in-one-seo-pack' ) . ' ( V' . $this->substr( phpversion( 'exif' ), 0, 4 ) . ')';
209
+ } else {
210
+ $exif = __( 'No', 'all-in-one-seo-pack' );
211
+ }
212
+ if ( is_callable( 'iptcparse' ) ) {
213
+ $iptc = __( 'Yes', 'all-in-one-seo-pack' );
214
+ } else {
215
+ $iptc = __( 'No', 'all-in-one-seo-pack' );
216
+ }
217
+ if ( is_callable( 'xml_parser_create' ) ) {
218
+ $xml = __( 'Yes', 'all-in-one-seo-pack' );
219
  } else {
220
+ $xml = __( 'No', 'all-in-one-seo-pack' );
221
  }
222
 
223
+ $theme = wp_get_theme();
224
 
225
  if ( function_exists( 'is_multisite' ) ) {
226
  if ( is_multisite() ) {
227
+ $ms = __( 'Yes', 'all-in-one-seo-pack' );
228
  } else {
229
+ $ms = __( 'No', 'all-in-one-seo-pack' );
230
  }
231
 
232
+ } else {
233
+ $ms = __( 'N/A', 'all-in-one-seo-pack' );
234
+ }
235
+
236
+ $siteurl = get_option( 'siteurl' );
237
+ $homeurl = get_option( 'home' );
238
+ $db_version = get_option( 'db_version' );
239
+
240
+ $debug_info = array(
241
+ __( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
242
+ __( 'Server', 'all-in-one-seo-pack' ) => $_SERVER['SERVER_SOFTWARE'],
243
+ __( 'Memory usage', 'all-in-one-seo-pack' ) => $memory_usage,
244
+ __( 'MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion,
245
+ __( 'SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode,
246
+ __( 'PHP Version', 'all-in-one-seo-pack' ) => PHP_VERSION,
247
+ __( 'PHP Safe Mode', 'all-in-one-seo-pack' ) => $safe_mode,
248
+ __( 'PHP Allow URL fopen', 'all-in-one-seo-pack' ) => $allow_url_fopen,
249
+ __( 'PHP Memory Limit', 'all-in-one-seo-pack' ) => $memory_limit,
250
+ __( 'PHP Max Upload Size', 'all-in-one-seo-pack' ) => $upload_max,
251
+ __( 'PHP Max Post Size', 'all-in-one-seo-pack' ) => $post_max,
252
+ __( 'PHP Max Script Execute Time', 'all-in-one-seo-pack' ) => $max_execute,
253
+ __( 'PHP Exif support', 'all-in-one-seo-pack' ) => $exif,
254
+ __( 'PHP IPTC support', 'all-in-one-seo-pack' ) => $iptc,
255
+ __( 'PHP XML support', 'all-in-one-seo-pack' ) => $xml,
256
+ __( 'Site URL', 'all-in-one-seo-pack' ) => $siteurl,
257
+ __( 'Home URL', 'all-in-one-seo-pack' ) => $homeurl,
258
+ __( 'WordPress Version', 'all-in-one-seo-pack' ) => $wp_version,
259
+ __( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
260
+ __( 'Multisite', 'all-in-one-seo-pack' ) => $ms,
261
+ __( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version'],
262
  );
263
  $debug_info['Active Plugins'] = null;
264
+ $active_plugins = $inactive_plugins = array();
265
+ $plugins = get_plugins();
266
+ foreach ( $plugins as $path => $plugin ) {
267
  if ( is_plugin_active( $path ) ) {
268
+ $debug_info[ $plugin['Name'] ] = $plugin['Version'];
269
  } else {
270
+ $inactive_plugins[ $plugin['Name'] ] = $plugin['Version'];
271
  }
272
  }
273
  $debug_info['Inactive Plugins'] = null;
274
+ $debug_info = array_merge( $debug_info, (array) $inactive_plugins );
275
 
276
+ $mail_text = __( 'All in One SEO Pack Pro Debug Info', 'all-in-one-seo-pack' ) . "\r\n------------------\r\n\r\n";
277
+ $page_text = '';
278
+ if ( ! empty( $debug_info ) ) {
279
+ foreach ( $debug_info as $name => $value ) {
280
+ if ( $value !== null ) {
281
  $page_text .= "<li><strong>$name</strong> $value</li>";
282
  $mail_text .= "$name: $value\r\n";
283
  } else {
285
  $mail_text .= "\r\n$name\r\n----------\r\n";
286
  }
287
  }
288
+ }
289
 
290
+ do {
291
+ if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) || ! empty( $_REQUEST['sfwd_update_check'] ) ) {
292
+ $nonce = $_REQUEST['sfwd_debug_nonce'];
293
+ if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) {
294
+ echo "<div class='sfwd_debug_error'>" . __( 'Form submission error: verification check failed.', 'all-in-one-seo-pack' ) . '</div>';
295
+ break;
296
+ }
297
+ if ( $_REQUEST['sfwd_update_check'] ) {
298
+ global $aioseop_update_checker;
299
+ $aioseop_update_checker->checkForUpdates();
300
+ echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( '%s has checked for updates.', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ) . '</div>';
301
+ break;
302
+ }
303
+ $email = '';
304
+ if ( ! empty( $_REQUEST['sfwd_debug_send_email'] ) ) {
305
+ $email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] );
306
+ }
307
+ if ( $email ) {
308
+ if ( wp_mail( $email, sprintf( __( 'SFWD Debug Mail From Site %s.', 'all-in-one-seo-pack' ), $siteurl ), $mail_text ) ) {
309
+ echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( 'Sent to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
310
+ } else {
311
+ echo "<div class='sfwd_debug_error'>" . sprintf( __( 'Failed to send to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
312
+ }
313
  } else {
314
+ echo "<div class='sfwd_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . '</div>';
315
  }
 
 
316
  }
317
+ } while ( 0 ); // Control structure for use with break.
318
+ $nonce = wp_create_nonce( 'sfwd-debug-nonce' );
319
+ $buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n<p>\n" .
320
+ '<input name="sfwd_debug_send_email" type="text" value="" placeholder="' . __( 'E-mail debug information', 'all-in-one-seo-pack' ) . '"><input name="sfwd_debug_nonce" type="hidden" value="' .
321
+ $nonce . '"><input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
322
+
323
+ if ( AIOSEOPPRO ) {
324
+ $buf .= '<p><input name="sfwd_update_check" type="submit" value="' . __( 'Check For Updates', 'all-in-one-seo-pack' ) . '" class="button-primary">';
325
+ }
326
+
327
  return $buf;
328
  }
329
  }
330
+ }
modules/aioseop_robots.php CHANGED
@@ -1,83 +1,166 @@
1
  <?php
2
  /**
3
- * @package All-in-One-SEO-Pack
4
  */
5
  /**
6
  * The Robots class.
7
  */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
9
  class All_in_One_SEO_Pack_Robots extends All_in_One_SEO_Pack_Module {
10
 
11
- function __construct( ) {
12
- $this->name = __('Robots.txt', 'all-in-one-seo-pack'); // Human-readable name of the plugin
13
- $this->prefix = 'aiosp_robots_'; // option prefix
14
- $this->file = __FILE__; // the current file
15
  parent::__construct();
16
-
17
  $help_text = Array(
18
- 'additional'=> __('Rule Type', 'all-in-one-seo-pack'),
19
- 'useragent' => __('User Agent', 'all-in-one-seo-pack'),
20
- 'path' => __('Directory Path', 'all-in-one-seo-pack'),
21
- 'robotgen' => __('Robots.txt editor', 'all-in-one-seo-pack'),
22
  );
23
-
24
  $this->default_options = array(
25
- 'usage' => Array( 'type' => 'html', 'label' => 'none',
26
- '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' ),
27
- 'save' => false ),
28
- 'additional'=> Array( 'name' => __( 'Rule Type', 'all-in-one-seo-pack' ),
29
- 'save' => false,
30
- 'type' => 'select', 'initial_options' => Array( 'allow' => 'Allow', 'block' => 'Block' ) ),
31
- 'useragent' => Array( 'name' => __( 'User Agent', 'all-in-one-seo-pack' ),
32
- 'save' => false,
33
- 'type' => 'text' ),
34
- 'path' => Array( 'name' => __( 'Directory Path', 'all-in-one-seo-pack' ),
35
- 'save' => false,
36
- 'type' => 'text' ),
37
- 'robotgen' => Array( 'name' => __( 'Generate Robots.txt', 'all-in-one-seo-pack'),
38
- 'save' => false,
39
- 'default' => '', 'type' => 'textarea', 'cols' => 57, 'rows' => 20, 'label' => 'none', 'readonly' => 'readonly' ),
40
- 'Submit_Preview' => Array( 'type' => 'submit', 'class' => 'button-primary MRL', 'name' => __( 'Add Rule', 'all-in-one-seo-pack' ) . ' &raquo;', 'nowrap' => 1 ),
41
- 'Submit_Update' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Save Robots.txt File', 'all-in-one-seo-pack' ) . ' &raquo;', 'nowrap' => 1 ),
42
- 'Submit_Delete' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Delete Robots.txt File', 'all-in-one-seo-pack' ) . ' &raquo;', 'nowrap' => 1 ),
43
- 'optusage' => Array( 'type' => 'html', 'label' => 'none',
44
- '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' ),
45
- 'save' => false ),
46
- 'Submit_Opt_Update' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Update Robots.txt File', 'all-in-one-seo-pack' ) . ' &raquo;', 'nowrap' => 1, 'style' => 'margin-left: 20px;' ),
47
- 'Submit_Opt_Preview' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Disregard Changes', 'all-in-one-seo-pack' ) . ' &raquo;', 'nowrap' => 1),
48
- 'Submit_Optimize' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __('Optimize', 'all-in-one-seo-pack') . ' &raquo;' )
49
- );
50
-
51
- if ( !empty( $help_text ) )
52
- foreach( $help_text as $k => $v )
53
- $this->default_options[$k]['help_text'] = $v;
54
-
55
- $this->locations = array( 'generator' => Array( 'name' => "Robots.txt", 'type' => 'settings',
56
- 'options' => Array( 'usage', 'additional', 'useragent', 'path', 'Submit_Preview', 'Submit_Update', 'Submit_Delete', 'robotgen', 'optusage', 'Submit_Opt_Update', 'Submit_Opt_Preview', 'Submit_Optimize' ) ),
57
- );
58
-
59
- $this->layout = Array(
60
- 'default' => Array(
61
- 'name' => __( 'Create a Robots.txt File', 'all-in-one-seo-pack' ),
62
- 'options' => Array( 'usage', 'additional', 'useragent', 'path', 'Submit_Preview', 'Submit_Update', 'Submit_Delete', 'robotgen' ) // this is set below, to the remaining options -- pdb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  )
64
- );
65
- $this->layout['optimize'] = Array(
66
- 'name' => __( 'Optimize your Robots.txt File', 'all-in-one-seo-pack' ),
67
- 'options' => Array( 'optusage', 'Submit_Optimize' )
68
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  if ( isset( $_POST['Submit_Optimize'] ) ) {
70
- $this->layout['optimize']['options'] = Array( 'optusage', 'Submit_Opt_Update', 'Submit_Opt_Preview', 'robothtml' );
 
 
 
 
 
71
  $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' );
72
  }
73
-
74
  // load initial options / set defaults
75
- $this->update_options( );
76
-
77
- add_action( $this->prefix . 'settings_update', Array( $this, 'do_robots' ), 10, 2 );
78
- add_filter( $this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 );
79
- add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 );
80
- add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 2 );
81
  }
82
 
83
  function filter_settings( $settings, $location ) {
@@ -85,93 +168,149 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
85
  $prefix = $this->get_prefix( $location ) . $location . '_';
86
  if ( isset( $_POST['Submit_Optimize'] ) ) {
87
  if ( isset( $settings[ $prefix . 'robotgen' ] ) ) {
88
- $settings[ $prefix . 'robotgen' ]['type'] = 'hidden';
89
- $settings[ $prefix . 'robotgen' ]['label'] = 'none';
90
  $settings[ $prefix . 'robotgen' ]['help_text'] = '';
91
- $settings[ $prefix . 'robothtml'] = Array( 'name' => __( 'Robots.txt', 'all-in-one-seo-pack'),
92
- 'save' => false, 'default' => '', 'type' => 'html', 'label' => 'none', 'style' => 'margin-top:10px;' );
 
 
 
 
 
 
93
  }
94
  }
95
  }
 
96
  return $settings;
97
  }
98
-
99
  function filter_submit( $submit, $location ) {
100
  if ( $location == 'generator' ) {
101
  unset( $submit['Submit_Default'] );
102
  $submit['Submit']['type'] = 'hidden';
103
  }
 
104
  return $submit;
105
  }
106
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  function filter_options( $options, $location ) {
108
- if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_';
 
 
109
  if ( $location === 'generator' ) {
110
- $optimize = false;
111
- $robotgen = '';
112
- if ( !empty( $_POST[$prefix . 'robotgen'] ) ) $robotgen = str_replace( "\r\n", "\n", $_POST[$prefix . 'robotgen'] );
113
- if ( isset( $_POST['Submit_Preview'] ) ) $options[$prefix . 'robotgen'] = $robotgen;
114
- if ( !isset( $_POST['Submit_Preview'] ) ) {
115
- if ( isset( $_POST['Submit_Optimize'] ) && !isset( $_POST['Submit_Delete'] ) && !isset( $_POST['Submit_Update'] ) && !isset( $_POST['Submit_Opt_Update'] ) )
116
- $optimize = true;
117
- if ( !isset( $options[$prefix . 'robotgen'] ) || empty( $options[$prefix . 'robotgen'] ) ) {
118
- if ( $optimize ) $options[$prefix . 'robotgen'] = $robotgen;
119
- if ( empty( $options[$prefix . 'robotgen'] ) )
120
- $options = $this->load_files( $options, Array( 'robotgen' => 'robots.txt' ), $prefix );
 
 
 
 
 
 
 
121
  }
122
  }
123
- $access = ( get_option('blog_public') ) ? 'allow' : 'block';
124
- if ( $access ) {
125
- $allow_rule = "Sitemap: \n\n# global\nUser-agent: *\nDisallow: /xmlrpc.php\n\n";
126
- $block_rule = "# global\nUser-agent: *\nDisallow: /\n\n";
127
- if ( empty( $options[$prefix . 'robotgen'] ) ) $options[$prefix . 'robotgen'] = '';
128
- if ( isset( $_POST['Submit_Preview'] ) && ( ( $options[$prefix . 'robotgen'] == $allow_rule ) ||
129
- ( $options[$prefix . 'robotgen'] == $block_rule ) ) )
130
- $options[$prefix . 'robotgen'] = '';
131
- if ( $access === 'block' && empty( $options[$prefix . 'robotgen'] ) )
132
- $options[$prefix . 'robotgen'] .= $block_rule;
133
- elseif ( $access === 'allow' && empty( $options[$prefix . 'robotgen'] ) )
134
- $options[$prefix . 'robotgen'] .= $allow_rule;
135
  }
136
- foreach ( Array( 'ad' => 'additional', 'ua' => 'useragent', 'dp' => 'path' ) as $k => $v )
137
- if ( isset( $_POST[$prefix . $v] ) ) $$k = $_POST[$prefix . $v];
138
- if ( !empty( $ad ) && !empty( $ua ) && !empty( $dp ) ) {
139
- if ( $ad === 'allow' )
140
- $ad = "Allow: ";
141
- else
142
- $ad = "Disallow: ";
143
- $options[$prefix . 'robotgen'] .= "User-agent: $ua\n$ad $dp\n\n";
144
  }
145
- $file = explode("\n", $options[$prefix . 'robotgen'] );
146
- if ( $optimize ) {
147
- $rules = $this->parse_robots( $file );
148
- $user_agents = $this->get_robot_user_agents( $rules );
149
- foreach ($user_agents as $ua => $rules) {
150
- $user_agents[$ua]['disallow'] = $this->opt_robot_rule($rules['disallow']);
151
- $user_agents[$ua]['allow'] = $this->opt_robot_rule($rules['allow']);
152
- }
153
- $rules = $this->flatten_user_agents( $user_agents );
154
- unset($user_agents);
155
- foreach ($rules as $r) {
156
- $r['disallow'] = $this->opt_robot_rule( $r['disallow'] );
157
- $r['allow'] = $this->opt_robot_rule( $r['allow'] );
158
- }
159
- $options[$prefix . 'robotgen'] = $this->output_robots($rules);
160
- $file2 = explode("\n", $options[$prefix . 'robotgen'] );
161
- $options[$prefix . 'robothtml'] = '<table width=100%><tr><td valign=top width=45%>' . $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) ) . '</td><td><span style="font-size: xx-large">&#8594;</span></td><td valign=top>' . $this->annotate_robots_html( $file2, true, __( "Proposed Changes", 'all-in-one-seo-pack' ) ) . '</td></tr></table>';
 
 
162
  } else {
163
- $options[$prefix . 'robothtml'] = $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) );
 
 
 
 
 
 
 
 
 
 
164
  }
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
 
166
  return $options;
167
  }
168
 
169
  function do_robots( $options, $location ) {
170
- if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_';
 
 
171
  if ( $location === 'generator' ) {
172
  if ( isset( $_POST['Submit_Update'] ) || isset( $_POST['Submit_Opt_Update'] ) ) {
173
  $this->save_files( Array( 'robotgen' => 'robots.txt' ), $prefix );
174
- } elseif (isset( $_POST['Submit_Delete'] ) ) {
175
  $this->delete_files( Array( 'robotgen' => 'robots.txt' ) );
176
  }
177
  }
@@ -179,9 +318,9 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
179
 
180
  function annotate_robots_html( $file, $show_help = false, $title = '' ) {
181
  $robots = $this->annotate_robots( $file );
182
- if( !empty( $robots ) ){
183
  $buf = '<table class="widefat" ><thead>';
184
- if ( !empty( $title ) ) {
185
  $buf .= "<tr><th colspan=3>" . $title . "</th></tr>";
186
  }
187
  $buf .= '<tr class="aioseop_optimize_thread">';
@@ -190,21 +329,21 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
190
  $buf .= "<tbody>";
191
 
192
  foreach ( $robots as $r ) {
193
- $class = 'robots';
194
  $status = "#9cf975";
195
- $help = '';
196
- if ( !$r['valid'] || !$r['strict'] ) {
197
- if ( !$r['strict']) {
198
  $class .= ' quirks';
199
- $status="yellow";
200
  }
201
- if ( !$r['valid'] ) {
202
  $class .= ' invalid';
203
- $status="#f9534a";
204
  }
205
  if ( $show_help ) {
206
  $help = '<a style="cursor:pointer;" class="' . $class . '" title="Click for Help!" onclick="toggleVisibility(\'aiosp_robots_main_legend_tip\');" title="Click for Help">'
207
- . '<div class="aioseop_tip_icon"></div></a>';
208
  }
209
  }
210
  $buf .= "<tr class='entry-row {$class}'><td>{$help}</td><td><span class='entry_label'>{$r['content']}</td><td><div style='background:{$status};'></div></td></tr>";
@@ -212,184 +351,289 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
212
  $buf .= '</tbody>';
213
 
214
  $buf .= '</table>';
215
- if ( $show_help ) {
216
  $buf .= '<div class="aioseop_option_docs" id="aiosp_robots_main_legend_tip">
217
  <h3>' . __( 'Legend', 'all-in-one-seo-pack' ) . '</h3>
218
  <ul>
219
  <li>' . __( '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' ) . '</li>
220
- <li>' . __( 'The red indicator means that the syntax is invalid for a robots.txt file.', 'all-in-one-seo-pack') . '</li>
221
  </ul>
222
- <a target="_blank" rel="nofollow" href="http://wikipedia.org/wiki/Robots_exclusion_standard#Nonstandard_extensions">' . __('More Information', 'all-in-one-seo-pack') . '</a>
223
  </div>';
224
  }
225
  } else {
226
  $buf = '<p class="aioseop_error_notice" ><strong>Your Robots.txt file is either empty, cannot be found, or has invalid data.</strong></p>';
227
  }
 
228
  return $buf;
229
  }
230
 
231
  function annotate_robots( $robots ) {
232
- $state = 0;
233
- $rules = Array();
234
- foreach ($robots as $l) {
235
- $l = trim($l);
236
- if (empty($l[0])) {
237
- if ( $state > 1 ) {
238
- $rules[] = Array( 'state' => 0, 'type' => 'blank', 'content' => $l, 'valid' => true, 'strict' => true );
239
- $state = 0;
240
- }
241
- } elseif ($l[0] === '#') {
242
- if ($state < 1) $state = 1;
243
- $rules[] = Array( 'state' => $state, 'type' => 'comment', 'content' => $l, 'valid' => true, 'strict' => true );
244
- } elseif ( stripos($l, 'sitemap') === 0) {
245
- $state = 2;
246
- $rules[] = Array( 'state' => $state, 'type' => 'sitemap', 'content' => $l, 'valid' => true, 'strict' => false );
247
- } elseif ( stripos($l, 'crawl-delay') === 0) {
248
- $state = 3;
249
- $rules[] = Array( 'state' => $state, 'type' => 'crawl-delay', 'content' => $l, 'valid' => true, 'strict' => false );
250
- } elseif ( stripos($l, 'user-agent') === 0) {
251
- $state = 3;
252
- $rules[] = Array( 'state' => $state, 'type' => 'user-agent', 'content' => $l, 'valid' => true, 'strict' => true );
253
- } elseif ( stripos($l, 'useragent') === 0) {
254
- $state = 3;
255
- $rules[] = Array( 'state' => $state, 'type' => 'user-agent', 'content' => $l, 'valid' => true, 'strict' => false );
256
- } elseif ( stripos($l, 'disallow') === 0) {
257
- if ($state < 3) {
258
- $rules[] = Array( 'state' => $state, 'type' => 'disallow', 'content' => $l, 'valid' => false, 'strict' => false );
259
- continue;
260
- }
261
- $state = 3;
262
- $rules[] = Array( 'state' => $state, 'type' => 'disallow', 'content' => $l, 'valid' => true, 'strict' => true );
263
- } elseif ( stripos($l, 'allow') === 0) {
264
- if ($state < 3) {
265
- $rules[] = Array( 'state' => $state, 'type' => 'allow', 'content' => $l, 'valid' => false, 'strict' => false );
266
- continue;
267
- }
268
- $state = 3;
269
- $rules[] = Array( 'state' => $state, 'type' => 'allow', 'content' => $l, 'valid' => true, 'strict' => false );
270
- } else {
271
- $rules[] = Array( 'state' => $state, 'type' => 'unknown', 'content' => $l, 'valid' => false, 'strict' => false );
272
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  }
274
- return $rules;
 
 
275
  }
276
 
277
  function parse_annotated_robots( $robots ) {
278
- $state = 0;
279
- $rules = Array();
280
- $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
281
- $rule = Array();
282
- foreach ( $opts as $o ) $rule[$o] = Array();
283
- $blank_rule = $rule;
284
- foreach ($robots as $l) {
285
- switch ( $l['type'] ) {
286
- case 'blank':
287
- if ( $state >= 1 ) {
288
- if ( ( $state === 1 ) && ( empty($rule['user-agent'] ) ) ) $rule['user-agent'] = Array( null );
289
- $rules[] = $rule;
290
- $rule = $blank_rule;
 
291
  }
292
- continue;
293
- case 'comment':
294
- $rule['comment'][] = $l['content'];
295
- continue;
296
- case 'sitemap':
297
- $rule['sitemap'][] = trim( substr($l['content'], 8) );
298
- break;
299
- case 'crawl-delay':
300
- $rule['crawl-delay'][] = trim( substr($l['content'], 12) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  break;
302
- case 'user-agent':
303
- if ($l['strict'])
304
- $ua = trim( substr($l['content'], 11) );
305
- else
306
- $ua = trim( substr($l['content'], 10) );
307
- $rule['user-agent'][] = $ua;
308
  break;
309
- case 'disallow':
310
- if ($l['valid']) {
311
- $rule['disallow'][] = trim( substr($l['content'], 9) );
312
- break;
313
- }
314
- continue;
315
- case 'allow':
316
- if ($l['valid']) {
317
- $rule['allow'][] = trim( substr($l['content'], 6) );
318
- break;
319
- }
320
- continue;
321
- case 'unknown':
322
- default:
323
- }
324
- $state = $l['state'];
325
  }
326
- if ( ( $state === 1 ) && ( empty($rule['user-agent'] ) ) ) $rule['user-agent'] = Array( null );
327
- if ($state >= 1) $rules[] = $rule;
328
- return $rules;
 
 
 
 
 
 
 
329
  }
330
-
331
  function parse_robots( $robots ) {
332
- return $this->parse_annotated_robots ( $this->annotate_robots( $robots ) );
333
  }
334
 
335
- function get_robot_user_agents($rules) {
336
- $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
337
  $user_agents = Array();
338
- foreach ($rules as $r) {
339
- if ( !empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) $r['user-agent'] = Array( null );
340
- foreach ($r['user-agent'] as $ua) {
341
- if (!isset($user_agents[$ua])) $user_agents[$ua] = Array();
 
 
 
 
342
  foreach ( $opts as $o ) {
343
- if (!isset($user_agents[$ua][$o]))
344
- $user_agents[$ua][$o] = $r[$o];
345
- else
346
- $user_agents[$ua][$o] = array_merge( $user_agents[$ua][$o], $r[$o] );
 
347
  }
348
  }
349
  }
 
350
  return $user_agents;
351
  }
352
 
353
  function flatten_user_agents( $user_agents ) {
354
  $rules = Array();
355
- foreach ($user_agents as $ua => $r) {
356
  $r['user-agent'] = Array( $ua );
357
- $rules[] = $r;
358
  }
 
359
  return $rules;
360
  }
361
 
362
- function opt_robot_rule($dis) {
363
- if ( is_array($dis) ) { // unique rules only
364
  $dis = array_unique( $dis, SORT_STRING );
365
- $pd = null;
366
- foreach( $dis as $k => $d ) {
367
- $d = trim($d);
368
- if ( !empty($pd) && !empty($d) ) {
369
- if ( strpos( $d, $pd ) === 0 ) {
370
- unset($dis[$k]);
371
- continue; // get rid of subpaths of $pd
372
- }
373
- }
374
- $l = strlen($d);
375
- if ( ($l > 0) && ($d[$l - 1] !== '/')) continue;
376
- $pd = $d; // only allow directory paths for $pd
377
- }
 
 
378
  }
 
379
  return $dis;
380
  }
381
 
382
- function output_robots($rules) {
383
  $robots = '';
384
- foreach ($rules as $r) {
385
- foreach ( $r['comment'] as $c) $robots .= "$c\n";
386
- foreach ( $r['user-agent'] as $u) if ( $u != '' ) $robots .= "User-agent: $u\n";
387
- foreach ( $r['crawl-delay'] as $c) $robots .= "Crawl-Delay: $c\n";
388
- foreach ( $r['allow'] as $a) $robots .= "Allow: $a\n";
389
- foreach ( $r['disallow'] as $d) $robots .= "Disallow: $d\n";
390
- foreach ( $r['sitemap'] as $s) $robots .= "Sitemap: $s\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  $robots .= "\n";
392
  }
 
393
  return $robots;
394
  }
395
  }
1
  <?php
2
  /**
3
+ * @package All-in-One-SEO-Pack
4
  */
5
  /**
6
  * The Robots class.
7
  */
8
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
9
  class All_in_One_SEO_Pack_Robots extends All_in_One_SEO_Pack_Module {
10
 
11
+ function __construct() {
12
+ $this->name = __( 'Robots.txt', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
13
+ $this->prefix = 'aiosp_robots_'; // option prefix
14
+ $this->file = __FILE__; // the current file
15
  parent::__construct();
16
+
17
  $help_text = Array(
18
+ 'additional' => __( 'Rule Type', 'all-in-one-seo-pack' ),
19
+ 'useragent' => __( 'User Agent', 'all-in-one-seo-pack' ),
20
+ 'path' => __( 'Directory Path', 'all-in-one-seo-pack' ),
21
+ 'robotgen' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ),
22
  );
23
+
24
  $this->default_options = array(
25
+ 'usage' => Array(
26
+ 'type' => 'html',
27
+ 'label' => 'none',
28
+ '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' ),
29
+ 'save' => false
30
+ ),
31
+ 'additional' => Array(
32
+ 'name' => __( 'Rule Type', 'all-in-one-seo-pack' ),
33
+ 'save' => false,
34
+ 'type' => 'select',
35
+ 'initial_options' => Array( 'allow' => 'Allow', 'block' => 'Block' )
36
+ ),
37
+ 'useragent' => Array(
38
+ 'name' => __( 'User Agent', 'all-in-one-seo-pack' ),
39
+ 'save' => false,
40
+ 'type' => 'text'
41
+ ),
42
+ 'path' => Array(
43
+ 'name' => __( 'Directory Path', 'all-in-one-seo-pack' ),
44
+ 'save' => false,
45
+ 'type' => 'text'
46
+ ),
47
+ 'robotgen' => Array(
48
+ 'name' => __( 'Generate Robots.txt', 'all-in-one-seo-pack' ),
49
+ 'save' => false,
50
+ 'default' => '',
51
+ 'type' => 'textarea',
52
+ 'cols' => 57,
53
+ 'rows' => 20,
54
+ 'label' => 'none',
55
+ 'readonly' => 'readonly'
56
+ ),
57
+ 'Submit_Preview' => Array(
58
+ 'type' => 'submit',
59
+ 'class' => 'button-primary MRL',
60
+ 'name' => __( 'Add Rule', 'all-in-one-seo-pack' ) . ' &raquo;',
61
+ 'nowrap' => 1
62
+ ),
63
+ 'Submit_Update' => Array(
64
+ 'type' => 'submit',
65
+ 'class' => 'button-primary',
66
+ 'name' => __( 'Save Robots.txt File', 'all-in-one-seo-pack' ) . ' &raquo;',
67
+ 'nowrap' => 1
68
+ ),
69
+ 'Submit_Delete' => Array(
70
+ 'type' => 'submit',
71
+ 'class' => 'button-primary',
72
+ 'name' => __( 'Delete Robots.txt File', 'all-in-one-seo-pack' ) . ' &raquo;',
73
+ 'nowrap' => 1
74
+ ),
75
+ 'optusage' => Array(
76
+ 'type' => 'html',
77
+ 'label' => 'none',
78
+ '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' ),
79
+ 'save' => false
80
+ ),
81
+ 'Submit_Opt_Update' => Array(
82
+ 'type' => 'submit',
83
+ 'class' => 'button-primary',
84
+ 'name' => __( 'Update Robots.txt File', 'all-in-one-seo-pack' ) . ' &raquo;',
85
+ 'nowrap' => 1,
86
+ 'style' => 'margin-left: 20px;'
87
+ ),
88
+ 'Submit_Opt_Preview' => Array(
89
+ 'type' => 'submit',
90
+ 'class' => 'button-primary',
91
+ 'name' => __( 'Disregard Changes', 'all-in-one-seo-pack' ) . ' &raquo;',
92
+ 'nowrap' => 1
93
+ ),
94
+ 'Submit_Optimize' => Array(
95
+ 'type' => 'submit',
96
+ 'class' => 'button-primary',
97
+ 'name' => __( 'Optimize', 'all-in-one-seo-pack' ) . ' &raquo;'
98
+ )
99
+ );
100
+
101
+ if ( ! empty( $help_text ) ) {
102
+ foreach ( $help_text as $k => $v ) {
103
+ $this->default_options[ $k ]['help_text'] = $v;
104
+ }
105
+ }
106
+
107
+ $this->locations = array(
108
+ 'generator' => Array(
109
+ 'name' => "Robots.txt",
110
+ 'type' => 'settings',
111
+ 'options' => Array(
112
+ 'usage',
113
+ 'additional',
114
+ 'useragent',
115
+ 'path',
116
+ 'Submit_Preview',
117
+ 'Submit_Update',
118
+ 'Submit_Delete',
119
+ 'robotgen',
120
+ 'optusage',
121
+ 'Submit_Opt_Update',
122
+ 'Submit_Opt_Preview',
123
+ 'Submit_Optimize'
124
  )
125
+ ),
126
+ );
127
+
128
+ $this->layout = Array(
129
+ 'default' => Array(
130
+ 'name' => __( 'Create a Robots.txt File', 'all-in-one-seo-pack' ),
131
+ 'options' => Array(
132
+ 'usage',
133
+ 'additional',
134
+ 'useragent',
135
+ 'path',
136
+ 'Submit_Preview',
137
+ 'Submit_Update',
138
+ 'Submit_Delete',
139
+ 'robotgen'
140
+ ) // this is set below, to the remaining options -- pdb
141
+ )
142
+ );
143
+ $this->layout['optimize'] = Array(
144
+ 'name' => __( 'Optimize your Robots.txt File', 'all-in-one-seo-pack' ),
145
+ 'options' => Array( 'optusage', 'Submit_Optimize' )
146
+ );
147
  if ( isset( $_POST['Submit_Optimize'] ) ) {
148
+ $this->layout['optimize']['options'] = Array(
149
+ 'optusage',
150
+ 'Submit_Opt_Update',
151
+ 'Submit_Opt_Preview',
152
+ 'robothtml'
153
+ );
154
  $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' );
155
  }
156
+
157
  // load initial options / set defaults
158
+ $this->update_options();
159
+
160
+ add_action( $this->prefix . 'settings_update', Array( $this, 'do_robots' ), 10, 2 );
161
+ add_filter( $this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 );
162
+ add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 );
163
+ add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 2 );
164
  }
165
 
166
  function filter_settings( $settings, $location ) {
168
  $prefix = $this->get_prefix( $location ) . $location . '_';
169
  if ( isset( $_POST['Submit_Optimize'] ) ) {
170
  if ( isset( $settings[ $prefix . 'robotgen' ] ) ) {
171
+ $settings[ $prefix . 'robotgen' ]['type'] = 'hidden';
172
+ $settings[ $prefix . 'robotgen' ]['label'] = 'none';
173
  $settings[ $prefix . 'robotgen' ]['help_text'] = '';
174
+ $settings[ $prefix . 'robothtml' ] = Array(
175
+ 'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
176
+ 'save' => false,
177
+ 'default' => '',
178
+ 'type' => 'html',
179
+ 'label' => 'none',
180
+ 'style' => 'margin-top:10px;'
181
+ );
182
  }
183
  }
184
  }
185
+
186
  return $settings;
187
  }
188
+
189
  function filter_submit( $submit, $location ) {
190
  if ( $location == 'generator' ) {
191
  unset( $submit['Submit_Default'] );
192
  $submit['Submit']['type'] = 'hidden';
193
  }
194
+
195
  return $submit;
196
  }
197
+
198
+ /**
199
+ * Returns the sitemap filename;
200
+ * @return bool
201
+ */
202
+ function get_sitemap_filename(){
203
+
204
+ global $aioseop_options;
205
+ if ( isset( $aioseop_options[ 'modules' ][ 'aiosp_sitemap_options' ][ 'aiosp_sitemap_filename' ] ) ){
206
+ return $aioseop_options[ 'modules' ][ 'aiosp_sitemap_options' ][ 'aiosp_sitemap_filename' ];
207
+ }
208
+ return FALSE;
209
+ }
210
+
211
+ /**
212
+ * Filters the options.
213
+ *
214
+ * @todo Much of this couldn't be considered filtering options, and should be extracted to other functions.
215
+ * @since ??
216
+ * @since 2.3.6
217
+ */
218
  function filter_options( $options, $location ) {
219
+ if ( $location ) {
220
+ $prefix = $this->get_prefix( $location ) . $location . '_';
221
+ }
222
  if ( $location === 'generator' ) {
223
+ $optimize = false;
224
+ $robotgen = '';
225
+ if ( ! empty( $_POST[ $prefix . 'robotgen' ] ) ) {
226
+ $robotgen = str_replace( "\r\n", "\n", $_POST[ $prefix . 'robotgen' ] );
227
+ }
228
+ if ( isset( $_POST['Submit_Preview'] ) ) {
229
+ $options[ $prefix . 'robotgen' ] = $robotgen;
230
+ }
231
+ if ( ! isset( $_POST['Submit_Preview'] ) ) {
232
+ if ( isset( $_POST['Submit_Optimize'] ) && ! isset( $_POST['Submit_Delete'] ) && ! isset( $_POST['Submit_Update'] ) && ! isset( $_POST['Submit_Opt_Update'] ) ) {
233
+ $optimize = true;
234
+ }
235
+ if ( ! isset( $options[ $prefix . 'robotgen' ] ) || empty( $options[ $prefix . 'robotgen' ] ) ) {
236
+ if ( $optimize ) {
237
+ $options[ $prefix . 'robotgen' ] = $robotgen;
238
+ }
239
+ if ( empty( $options[ $prefix . 'robotgen' ] ) ) {
240
+ $options = $this->load_files( $options, Array( 'robotgen' => 'robots.txt' ), $prefix );
241
  }
242
  }
243
+ }
244
+ $access = ( get_option( 'blog_public' ) ) ? 'allow' : 'block';
245
+ if ( $access ) {
246
+ global $aioseop_options;
247
+ $sitemap_url = '';
248
+ $sitemap_filename = $this->get_sitemap_filename();
249
+ if( $sitemap_filename ){
250
+ $sitemapurl = trailingslashit( get_home_url() ) . $sitemap_filename . '.xml';
 
 
 
 
251
  }
252
+ $allow_rule = "Sitemap: $sitemapurl \n\n# global\nUser-agent: *\nDisallow: /xmlrpc.php\n\n";
253
+ $block_rule = "# global\nUser-agent: *\nDisallow: /\n\n";
254
+ if ( empty( $options[ $prefix . 'robotgen' ] ) ) {
255
+ $options[ $prefix . 'robotgen' ] = '';
 
 
 
 
256
  }
257
+ if ( isset( $_POST['Submit_Preview'] ) && ( ( $options[ $prefix . 'robotgen' ] == $allow_rule ) ||
258
+ ( $options[ $prefix . 'robotgen' ] == $block_rule ) )
259
+ ) {
260
+ $options[ $prefix . 'robotgen' ] = '';
261
+ }
262
+ if ( $access === 'block' && empty( $options[ $prefix . 'robotgen' ] ) ) {
263
+ $options[ $prefix . 'robotgen' ] .= $block_rule;
264
+ } elseif ( $access === 'allow' && empty( $options[ $prefix . 'robotgen' ] ) ) {
265
+ $options[ $prefix . 'robotgen' ] .= $allow_rule;
266
+ }
267
+ }
268
+ foreach ( Array( 'ad' => 'additional', 'ua' => 'useragent', 'dp' => 'path' ) as $k => $v ) {
269
+ if ( isset( $_POST[ $prefix . $v ] ) ) {
270
+ $$k = $_POST[ $prefix . $v ];
271
+ }
272
+ }
273
+ if ( ! empty( $ad ) && ! empty( $ua ) && ! empty( $dp ) ) {
274
+ if ( $ad === 'allow' ) {
275
+ $ad = "Allow: ";
276
  } else {
277
+ $ad = "Disallow: ";
278
+ }
279
+ $options[ $prefix . 'robotgen' ] .= "User-agent: $ua\n$ad $dp\n\n";
280
+ }
281
+ $file = explode( "\n", $options[ $prefix . 'robotgen' ] );
282
+ if ( $optimize ) {
283
+ $rules = $this->parse_robots( $file );
284
+ $user_agents = $this->get_robot_user_agents( $rules );
285
+ foreach ( $user_agents as $ua => $rules ) {
286
+ $user_agents[ $ua ]['disallow'] = $this->opt_robot_rule( $rules['disallow'] );
287
+ $user_agents[ $ua ]['allow'] = $this->opt_robot_rule( $rules['allow'] );
288
  }
289
+ $rules = $this->flatten_user_agents( $user_agents );
290
+ unset( $user_agents );
291
+ foreach ( $rules as $r ) {
292
+ $r['disallow'] = $this->opt_robot_rule( $r['disallow'] );
293
+ $r['allow'] = $this->opt_robot_rule( $r['allow'] );
294
+ }
295
+ $options[ $prefix . 'robotgen' ] = $this->output_robots( $rules );
296
+ $file2 = explode( "\n", $options[ $prefix . 'robotgen' ] );
297
+ $options[ $prefix . 'robothtml' ] = '<table width=100%><tr><td valign=top width=45%>' . $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) ) . '</td><td><span style="font-size: xx-large">&#8594;</span></td><td valign=top>' . $this->annotate_robots_html( $file2, true, __( "Proposed Changes", 'all-in-one-seo-pack' ) ) . '</td></tr></table>';
298
+ } else {
299
+ $options[ $prefix . 'robothtml' ] = $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) );
300
+ }
301
  }
302
+
303
  return $options;
304
  }
305
 
306
  function do_robots( $options, $location ) {
307
+ if ( $location ) {
308
+ $prefix = $this->get_prefix( $location ) . $location . '_';
309
+ }
310
  if ( $location === 'generator' ) {
311
  if ( isset( $_POST['Submit_Update'] ) || isset( $_POST['Submit_Opt_Update'] ) ) {
312
  $this->save_files( Array( 'robotgen' => 'robots.txt' ), $prefix );
313
+ } elseif ( isset( $_POST['Submit_Delete'] ) ) {
314
  $this->delete_files( Array( 'robotgen' => 'robots.txt' ) );
315
  }
316
  }
318
 
319
  function annotate_robots_html( $file, $show_help = false, $title = '' ) {
320
  $robots = $this->annotate_robots( $file );
321
+ if ( ! empty( $robots ) ) {
322
  $buf = '<table class="widefat" ><thead>';
323
+ if ( ! empty( $title ) ) {
324
  $buf .= "<tr><th colspan=3>" . $title . "</th></tr>";
325
  }
326
  $buf .= '<tr class="aioseop_optimize_thread">';
329
  $buf .= "<tbody>";
330
 
331
  foreach ( $robots as $r ) {
332
+ $class = 'robots';
333
  $status = "#9cf975";
334
+ $help = '';
335
+ if ( ! $r['valid'] || ! $r['strict'] ) {
336
+ if ( ! $r['strict'] ) {
337
  $class .= ' quirks';
338
+ $status = "yellow";
339
  }
340
+ if ( ! $r['valid'] ) {
341
  $class .= ' invalid';
342
+ $status = "#f9534a";
343
  }
344
  if ( $show_help ) {
345
  $help = '<a style="cursor:pointer;" class="' . $class . '" title="Click for Help!" onclick="toggleVisibility(\'aiosp_robots_main_legend_tip\');" title="Click for Help">'
346
+ . '<div class="aioseop_tip_icon"></div></a>';
347
  }
348
  }
349
  $buf .= "<tr class='entry-row {$class}'><td>{$help}</td><td><span class='entry_label'>{$r['content']}</td><td><div style='background:{$status};'></div></td></tr>";
351
  $buf .= '</tbody>';
352
 
353
  $buf .= '</table>';
354
+ if ( $show_help ) {
355
  $buf .= '<div class="aioseop_option_docs" id="aiosp_robots_main_legend_tip">
356
  <h3>' . __( 'Legend', 'all-in-one-seo-pack' ) . '</h3>
357
  <ul>
358
  <li>' . __( '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' ) . '</li>
359
+ <li>' . __( 'The red indicator means that the syntax is invalid for a robots.txt file.', 'all-in-one-seo-pack' ) . '</li>
360
  </ul>
361
+ <a target="_blank" rel="nofollow" href="http://wikipedia.org/wiki/Robots_exclusion_standard#Nonstandard_extensions">' . __( 'More Information', 'all-in-one-seo-pack' ) . '</a>
362
  </div>';
363
  }
364
  } else {
365
  $buf = '<p class="aioseop_error_notice" ><strong>Your Robots.txt file is either empty, cannot be found, or has invalid data.</strong></p>';
366
  }
367
+
368
  return $buf;
369
  }
370
 
371
  function annotate_robots( $robots ) {
372
+ $state = 0;
373
+ $rules = Array();
374
+ foreach ( $robots as $l ) {
375
+ $l = trim( $l );
376
+ if ( empty( $l[0] ) ) {
377
+ if ( $state > 1 ) {
378
+ $rules[] = Array(
379
+ 'state' => 0,
380
+ 'type' => 'blank',
381
+ 'content' => $l,
382
+ 'valid' => true,
383
+ 'strict' => true
384
+ );
385
+ $state = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  }
387
+ } elseif ( $l[0] === '#' ) {
388
+ if ( $state < 1 ) {
389
+ $state = 1;
390
+ }
391
+ $rules[] = Array(
392
+ 'state' => $state,
393
+ 'type' => 'comment',
394
+ 'content' => $l,
395
+ 'valid' => true,
396
+ 'strict' => true
397
+ );
398
+ } elseif ( stripos( $l, 'sitemap' ) === 0 ) {
399
+ $state = 2;
400
+ $rules[] = Array(
401
+ 'state' => $state,
402
+ 'type' => 'sitemap',
403
+ 'content' => $l,
404
+ 'valid' => true,
405
+ 'strict' => false
406
+ );
407
+ } elseif ( stripos( $l, 'crawl-delay' ) === 0 ) {
408
+ $state = 3;
409
+ $rules[] = Array(
410
+ 'state' => $state,
411
+ 'type' => 'crawl-delay',
412
+ 'content' => $l,
413
+ 'valid' => true,
414
+ 'strict' => false
415
+ );
416
+ } elseif ( stripos( $l, 'user-agent' ) === 0 ) {
417
+ $state = 3;
418
+ $rules[] = Array(
419
+ 'state' => $state,
420
+ 'type' => 'user-agent',
421
+ 'content' => $l,
422
+ 'valid' => true,
423
+ 'strict' => true
424
+ );
425
+ } elseif ( stripos( $l, 'useragent' ) === 0 ) {
426
+ $state = 3;
427
+ $rules[] = Array(
428
+ 'state' => $state,
429
+ 'type' => 'user-agent',
430
+ 'content' => $l,
431
+ 'valid' => true,
432
+ 'strict' => false
433
+ );
434
+ } elseif ( stripos( $l, 'disallow' ) === 0 ) {
435
+ if ( $state < 3 ) {
436
+ $rules[] = Array(
437
+ 'state' => $state,
438
+ 'type' => 'disallow',
439
+ 'content' => $l,
440
+ 'valid' => false,
441
+ 'strict' => false
442
+ );
443
+ continue;
444
+ }
445
+ $state = 3;
446
+ $rules[] = Array(
447
+ 'state' => $state,
448
+ 'type' => 'disallow',
449
+ 'content' => $l,
450
+ 'valid' => true,
451
+ 'strict' => true
452
+ );
453
+ } elseif ( stripos( $l, 'allow' ) === 0 ) {
454
+ if ( $state < 3 ) {
455
+ $rules[] = Array(
456
+ 'state' => $state,
457
+ 'type' => 'allow',
458
+ 'content' => $l,
459
+ 'valid' => false,
460
+ 'strict' => false
461
+ );
462
+ continue;
463
+ }
464
+ $state = 3;
465
+ $rules[] = Array(
466
+ 'state' => $state,
467
+ 'type' => 'allow',
468
+ 'content' => $l,
469
+ 'valid' => true,
470
+ 'strict' => false
471
+ );
472
+ } else {
473
+ $rules[] = Array(
474
+ 'state' => $state,
475
+ 'type' => 'unknown',
476
+ 'content' => $l,
477
+ 'valid' => false,
478
+ 'strict' => false
479
+ );
480
  }
481
+ }
482
+
483
+ return $rules;
484
  }
485
 
486
  function parse_annotated_robots( $robots ) {
487
+ $state = 0;
488
+ $rules = Array();
489
+ $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
490
+ $rule = Array();
491
+ foreach ( $opts as $o ) {
492
+ $rule[ $o ] = Array();
493
+ }
494
+ $blank_rule = $rule;
495
+ foreach ( $robots as $l ) {
496
+ switch ( $l['type'] ) {
497
+ case 'blank':
498
+ if ( $state >= 1 ) {
499
+ if ( ( $state === 1 ) && ( empty( $rule['user-agent'] ) ) ) {
500
+ $rule['user-agent'] = Array( null );
501
  }
502
+ $rules[] = $rule;
503
+ $rule = $blank_rule;
504
+ }
505
+ continue;
506
+ case 'comment':
507
+ $rule['comment'][] = $l['content'];
508
+ continue;
509
+ case 'sitemap':
510
+ $rule['sitemap'][] = trim( substr( $l['content'], 8 ) );
511
+ break;
512
+ case 'crawl-delay':
513
+ $rule['crawl-delay'][] = trim( substr( $l['content'], 12 ) );
514
+ break;
515
+ case 'user-agent':
516
+ if ( $l['strict'] ) {
517
+ $ua = trim( substr( $l['content'], 11 ) );
518
+ } else {
519
+ $ua = trim( substr( $l['content'], 10 ) );
520
+ }
521
+ $rule['user-agent'][] = $ua;
522
+ break;
523
+ case 'disallow':
524
+ if ( $l['valid'] ) {
525
+ $rule['disallow'][] = trim( substr( $l['content'], 9 ) );
526
  break;
527
+ }
528
+ continue;
529
+ case 'allow':
530
+ if ( $l['valid'] ) {
531
+ $rule['allow'][] = trim( substr( $l['content'], 6 ) );
 
532
  break;
533
+ }
534
+ continue;
535
+ case 'unknown':
536
+ default:
 
 
 
 
 
 
 
 
 
 
 
 
537
  }
538
+ $state = $l['state'];
539
+ }
540
+ if ( ( $state === 1 ) && ( empty( $rule['user-agent'] ) ) ) {
541
+ $rule['user-agent'] = Array( null );
542
+ }
543
+ if ( $state >= 1 ) {
544
+ $rules[] = $rule;
545
+ }
546
+
547
+ return $rules;
548
  }
549
+
550
  function parse_robots( $robots ) {
551
+ return $this->parse_annotated_robots( $this->annotate_robots( $robots ) );
552
  }
553
 
554
+ function get_robot_user_agents( $rules ) {
555
+ $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
556
  $user_agents = Array();
557
+ foreach ( $rules as $r ) {
558
+ if ( ! empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) {
559
+ $r['user-agent'] = Array( null );
560
+ }
561
+ foreach ( $r['user-agent'] as $ua ) {
562
+ if ( ! isset( $user_agents[ $ua ] ) ) {
563
+ $user_agents[ $ua ] = Array();
564
+ }
565
  foreach ( $opts as $o ) {
566
+ if ( ! isset( $user_agents[ $ua ][ $o ] ) ) {
567
+ $user_agents[ $ua ][ $o ] = $r[ $o ];
568
+ } else {
569
+ $user_agents[ $ua ][ $o ] = array_merge( $user_agents[ $ua ][ $o ], $r[ $o ] );
570
+ }
571
  }
572
  }
573
  }
574
+
575
  return $user_agents;
576
  }
577
 
578
  function flatten_user_agents( $user_agents ) {
579
  $rules = Array();
580
+ foreach ( $user_agents as $ua => $r ) {
581
  $r['user-agent'] = Array( $ua );
582
+ $rules[] = $r;
583
  }
584
+
585
  return $rules;
586
  }
587
 
588
+ function opt_robot_rule( $dis ) {
589
+ if ( is_array( $dis ) ) { // unique rules only
590
  $dis = array_unique( $dis, SORT_STRING );
591
+ $pd = null;
592
+ foreach ( $dis as $k => $d ) {
593
+ $d = trim( $d );
594
+ if ( ! empty( $pd ) && ! empty( $d ) ) {
595
+ if ( strpos( $d, $pd ) === 0 ) {
596
+ unset( $dis[ $k ] );
597
+ continue; // get rid of subpaths of $pd
598
+ }
599
+ }
600
+ $l = strlen( $d );
601
+ if ( ( $l > 0 ) && ( $d[ $l - 1 ] !== '/' ) ) {
602
+ continue;
603
+ }
604
+ $pd = $d; // only allow directory paths for $pd
605
+ }
606
  }
607
+
608
  return $dis;
609
  }
610
 
611
+ function output_robots( $rules ) {
612
  $robots = '';
613
+ foreach ( $rules as $r ) {
614
+ foreach ( $r['comment'] as $c ) {
615
+ $robots .= "$c\n";
616
+ }
617
+ foreach ( $r['user-agent'] as $u ) {
618
+ if ( $u != '' ) {
619
+ $robots .= "User-agent: $u\n";
620
+ }
621
+ }
622
+ foreach ( $r['crawl-delay'] as $c ) {
623
+ $robots .= "Crawl-Delay: $c\n";
624
+ }
625
+ foreach ( $r['allow'] as $a ) {
626
+ $robots .= "Allow: $a\n";
627
+ }
628
+ foreach ( $r['disallow'] as $d ) {
629
+ $robots .= "Disallow: $d\n";
630
+ }
631
+ foreach ( $r['sitemap'] as $s ) {
632
+ $robots .= "Sitemap: $s\n";
633
+ }
634
  $robots .= "\n";
635
  }
636
+
637
  return $robots;
638
  }
639
  }
modules/aioseop_sitemap.php CHANGED
@@ -1,11 +1,15 @@
1
  <?php
2
  /**
 
 
3
  * @package All-in-One-SEO-Pack
4
  */
5
- /**
6
- * The Sitemap class.
7
- */
8
- if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
 
 
9
  class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
10
  var $cache_struct = null;
11
  var $cache_home = null;
@@ -18,815 +22,1320 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
18
  var $freq;
19
  var $freq_sel;
20
  var $extra_sitemaps;
21
-
22
- function __construct( ) {
23
- if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
24
- $this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
25
- $this->prefix = 'aiosp_sitemap_'; // option prefix
26
- $this->file = __FILE__; // the current file
27
- $this->extra_sitemaps = Array();
28
- $this->extra_sitemaps = apply_filters( $this->prefix . 'extra', $this->extra_sitemaps );
 
 
 
29
  }
30
  parent::__construct();
31
- $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' );
32
-
33
- $this->help_text = Array(
34
- "filename" => __( "Specifies the name of your sitemap file. This will default to 'sitemap'.", 'all-in-one-seo-pack' ),
35
- "google" => __( "Notify Google when you update your sitemap settings.", 'all-in-one-seo-pack' ),
36
- "bing" => __("Notify Bing when you update your sitemap settings.", 'all-in-one-seo-pack' ),
37
- "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' ),
38
- "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' ),
39
- "paginate" => __( "Split long sitemaps into separate files.", 'all-in-one-seo-pack' ),
40
- "max_posts" => __( "Allows you to specify the maximum number of posts in a sitemap (up to 50,000).", 'all-in-one-seo-pack' ),
41
- "posttypes" => __( "Select which Post Types appear in your sitemap.", 'all-in-one-seo-pack' ),
42
- "taxonomies" => __( "Select which taxonomy archives appear in your sitemap", 'all-in-one-seo-pack' ),
43
- "archive" => __( "Include Date Archives in your sitemap.", 'all-in-one-seo-pack' ),
44
- "author" => __( "Include Author Archives in your sitemap.", 'all-in-one-seo-pack' ),
45
- "gzipped" => __( "Create a compressed sitemap file in .xml.gz format.", 'all-in-one-seo-pack' ),
46
- "robots" => __( "Places a link to your Sitemap.xml into your virtual Robots.txt file.", 'all-in-one-seo-pack' ),
47
- "rewrite" => __( "Places a link to the sitemap file in your virtual Robots.txt file which WordPress creates.", 'all-in-one-seo-pack' ),
48
- "noindex" => __( "Tells search engines not to index the sitemap file itself.", 'all-in-one-seo-pack' ),
49
- "debug" => __( "Use rewrites to generate your sitemap on the fly. NOTE: This is required for WordPress Multisite.", 'all-in-one-seo-pack'),
50
- "addl_url" => __( 'URL to the page.', 'all-in-one-seo-pack' ),
51
- "addl_prio" => __( 'The priority of the page.', 'all-in-one-seo-pack' ),
52
- "addl_freq" => __( 'The frequency of the page.', 'all-in-one-seo-pack' ),
53
- "addl_mod" => __( 'Last modified date of the page.', 'all-in-one-seo-pack' ),
54
- "excl_categories" => __( "Entries from these categories will be excluded from the sitemap.", 'all-in-one-seo-pack' ),
55
- "excl_pages" => __( "Use page slugs or page IDs, seperated by commas, to exclude pages from the sitemap.", 'all-in-one-seo-pack' )
56
  );
57
-
58
- $this->help_anchors = Array(
59
- 'filename' => '#filename-prefix',
60
- 'google' => '#notify-google-bing',
61
- 'bing' => '#notify-google-bing',
62
- 'indexes' => '#enable-sitemap-indexes',
63
- 'posttypes' => '#post-types-and-taxonomies',
64
- 'taxonomies' => '#post-types-and-taxonomies',
65
- 'archive' => '#include-archive-pages',
66
- 'author' => '#include-archive-pages',
67
- 'gzipped' => '#create-compressed-sitemap',
68
- 'robots' => '#link-from-virtual-robots',
69
- 'rewrite' => '#dynamically-generate-sitemap',
70
- 'addl_url' => '#additional-pages',
71
- 'addl_prio' => '#additional-pages',
72
- 'addl_freq' => '#additional-pages',
73
- 'addl_mod' => '#additional-pages',
 
 
 
74
  'excl_categories' => '#excluded-items',
75
- 'excl_pages' => '#excluded-items',
76
  );
77
 
78
  $this->default_options = array(
79
- 'filename' => Array( 'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ),
80
- 'default' => 'sitemap', 'type' => 'text', 'sanitize' => 'filename' ),
81
- 'google' => Array( 'name' => __( 'Notify Google', 'all-in-one-seo-pack') ),
82
- 'bing' => Array( 'name' => __( 'Notify Bing', 'all-in-one-seo-pack') ),
83
- 'daily_cron'=> Array( 'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ), 'type' => 'select',
84
- 'initial_options' => Array( 0 => __( 'No Schedule', 'all-in-one-seo-pack' ),
85
- 'daily' => __( 'Daily', 'all-in-one-seo-pack' ),
86
- 'weekly' => __( 'Weekly', 'all-in-one-seo-pack' ),
87
- 'monthly'=> __( 'Monthly', 'all-in-one-seo-pack' ) ),
88
- 'default' => 0 ),
89
- 'indexes' => Array( 'name' => __( 'Enable Sitemap Indexes', 'all-in-one-seo-pack' ) ),
90
- 'paginate' => Array( 'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ),
91
- 'condshow' => Array( "{$this->prefix}indexes" => 'on' ) ),
92
- 'max_posts' => Array( 'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ),
93
- 'type' => 'text', 'default' => 50000,
94
- 'condshow' => Array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ) ),
95
- 'posttypes' => Array( 'name' => __( 'Post Types', 'all-in-one-seo-pack'),
96
- 'type' => 'multicheckbox', 'default' => 'all' ),
97
- 'taxonomies'=> Array( 'name' => __( 'Taxonomies', 'all-in-one-seo-pack' ),
98
- 'type' => 'multicheckbox', 'default' => 'all' ),
99
- 'archive' => Array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ),
100
- 'author' => Array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ),
101
- 'gzipped' => Array( 'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ), 'default' => 'On' ),
102
- 'robots' => Array( 'name' => __( 'Link From Virtual Robots.txt', 'all-in-one-seo-pack' ), 'default' => 'On' ),
103
- 'rewrite' => Array( 'name' => __( 'Dynamically Generate Sitemap', 'all-in-one-seo-pack' ), 'default' => 'On' ),
104
- 'noindex' => Array( 'name' => __( 'Noindex Sitemap file', 'all-in-one-seo-pack' ),
105
- 'condshow' => Array( "{$this->prefix}rewrite" => true ) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  );
107
-
108
- $status_options = Array(
109
- 'link' => Array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
110
- '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' )
 
 
 
 
 
 
 
 
 
 
111
  );
112
-
113
- $this->layout = Array(
114
- 'status' => Array(
115
- 'name' => __( 'Sitemap Status', 'all-in-one-seo-pack' ),
116
- 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
117
- 'options' => array_keys( $status_options ) ),
118
- 'default' => Array(
119
- 'name' => $this->name,
120
- 'help_link' => '
1
  <?php
2
  /**
3
+ * Sitemap class.
4
+ *
5
  * @package All-in-One-SEO-Pack
6
  */
7
+
8
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
9
+
10
+ /**
11
+ * Class All_in_One_SEO_Pack_Sitemap
12
+ */
13
  class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
14
  var $cache_struct = null;
15
  var $cache_home = null;
22
  var $freq;
23
  var $freq_sel;
24
  var $extra_sitemaps;
25
+
26
+ /**
27
+ * All_in_One_SEO_Pack_Sitemap constructor.
28
+ */
29
+ function __construct() {
30
+ if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class.
31
+ $this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
32
+ $this->prefix = 'aiosp_sitemap_'; // Option prefix.
33
+ $this->file = __FILE__; // The current file.
34
+ $this->extra_sitemaps = array();
35
+ $this->extra_sitemaps = apply_filters( $this->prefix . 'extra', $this->extra_sitemaps );
36
  }
37
  parent::__construct();
38
+ $this->comment_string = 'Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s';
39
+
40
+ $this->help_text = array(
41
+ 'filename' => __( "Specifies the name of your sitemap file. This will default to 'sitemap'.", 'all-in-one-seo-pack' ),
42
+ 'google' => __( 'Notify Google when you update your sitemap settings.', 'all-in-one-seo-pack' ),
43
+ 'bing' => __( 'Notify Bing when you update your sitemap settings.', 'all-in-one-seo-pack' ),
44
+ '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' ),
45
+ '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' ),
46
+ 'paginate' => __( 'Split long sitemaps into separate files.', 'all-in-one-seo-pack' ),
47
+ 'max_posts' => __( 'Allows you to specify the maximum number of posts in a sitemap (up to 50,000).', 'all-in-one-seo-pack' ),
48
+ 'posttypes' => __( 'Select which Post Types appear in your sitemap.', 'all-in-one-seo-pack' ),
49
+ 'taxonomies' => __( 'Select which taxonomy archives appear in your sitemap', 'all-in-one-seo-pack' ),
50
+ 'archive' => __( 'Include Date Archives in your sitemap.', 'all-in-one-seo-pack' ),
51
+ 'author' => __( 'Include Author Archives in your sitemap.', 'all-in-one-seo-pack' ),
52
+ 'gzipped' => __( 'Create a compressed sitemap file in .xml.gz format.', 'all-in-one-seo-pack' ),
53
+ 'robots' => __( 'Places a link to your Sitemap.xml into your virtual Robots.txt file.', 'all-in-one-seo-pack' ),
54
+ 'rewrite' => __( 'Dynamically creates the XML sitemap instead of using a static file.', 'all-in-one-seo-pack' ),
55
+ 'debug' => __( 'Use rewrites to generate your sitemap on the fly. NOTE: This is required for WordPress Multisite.', 'all-in-one-seo-pack' ),
56
+ 'addl_url' => __( 'URL to the page.', 'all-in-one-seo-pack' ),
57
+ 'addl_prio' => __( 'The priority of the page.', 'all-in-one-seo-pack' ),
58
+ 'addl_freq' => __( 'The frequency of the page.', 'all-in-one-seo-pack' ),
59
+ 'addl_mod' => __( 'Last modified date of the page.', 'all-in-one-seo-pack' ),
60
+ 'excl_categories' => __( 'Entries from these categories will be excluded from the sitemap.', 'all-in-one-seo-pack' ),
61
+ 'excl_pages' => __( 'Use page slugs or page IDs, seperated by commas, to exclude pages from the sitemap.', 'all-in-one-seo-pack' ),
 
62
  );
63
+
64
+ $this->help_anchors = array(
65
+ 'filename' => '#filename-prefix',
66
+ 'google' => '#notify-google-bing',
67
+ 'bing' => '#notify-google-bing',
68
+ 'daily_cron' => '#schedule-updates',
69
+ 'indexes' => '#enable-sitemap-indexes',
70
+ 'paginate' => '#enable-sitemap-indexes',
71
+ 'max_posts' => '#enable-sitemap-indexes',
72
+ 'posttypes' => '#post-types-and-taxonomies',
73
+ 'taxonomies' => '#post-types-and-taxonomies',
74
+ 'archive' => '#include-archive-pages',
75
+ 'author' => '#include-archive-pages',
76
+ 'gzipped' => '#create-compressed-sitemap',
77
+ 'robots' => '#link-from-virtual-robots',
78
+ 'rewrite' => '#dynamically-generate-sitemap',
79
+ 'addl_url' => '#additional-pages',
80
+ 'addl_prio' => '#additional-pages',
81
+ 'addl_freq' => '#additional-pages',
82
+ 'addl_mod' => '#additional-pages',
83
  'excl_categories' => '#excluded-items',
84
+ 'excl_pages' => '#excluded-items',
85
  );
86
 
87
  $this->default_options = array(
88
+ 'filename' => array(
89
+ 'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ),
90
+ 'default' => 'sitemap',
91
+ 'type' => 'text',
92
+ 'sanitize' => 'filename',
93
+ ),
94
+ 'google' => array( 'name' => __( 'Notify Google', 'all-in-one-seo-pack' ) ),
95
+ 'bing' => array( 'name' => __( 'Notify Bing', 'all-in-one-seo-pack' ) ),
96
+ 'daily_cron' => array(
97
+ 'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ),
98
+ 'type' => 'select',
99
+ 'initial_options' => array(
100
+ 0 => __( 'No Schedule', 'all-in-one-seo-pack' ),
101
+ 'daily' => __( 'Daily', 'all-in-one-seo-pack' ),
102
+ 'weekly' => __( 'Weekly', 'all-in-one-seo-pack' ),
103
+ 'monthly' => __( 'Monthly', 'all-in-one-seo-pack' ),
104
+ ),
105
+ 'default' => 0,
106
+ ),
107
+ 'indexes' => array( 'name' => __( 'Enable Sitemap Indexes', 'all-in-one-seo-pack' ) ),
108
+ 'paginate' => array(
109
+ 'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ),
110
+ 'condshow' => array( "{$this->prefix}indexes" => 'on' ),
111
+ ),
112
+ 'max_posts' => array(
113
+ 'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ),
114
+ 'type' => 'text',
115
+ 'default' => 50000,
116
+ 'condshow' => array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ),
117
+ ),
118
+ 'posttypes' => array(
119
+ 'name' => __( 'Post Types', 'all-in-one-seo-pack' ),
120
+ 'type' => 'multicheckbox',
121
+ 'default' => 'all',
122
+ ),
123
+ 'taxonomies' => array(
124
+ 'name' => __( 'Taxonomies', 'all-in-one-seo-pack' ),
125
+ 'type' => 'multicheckbox',
126
+ 'default' => 'all',
127
+ ),
128
+ 'archive' => array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ),
129
+ 'author' => array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ),
130
+ 'gzipped' => array(
131
+ 'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ),
132
+ 'default' => 'On',
133
+ ),
134
+ 'robots' => array(
135
+ 'name' => __( 'Link From Virtual Robots.txt', 'all-in-one-seo-pack' ),
136
+ 'default' => 'On',
137
+ ),
138
+ 'rewrite' => array(
139
+ 'name' => __( 'Dynamically Generate Sitemap', 'all-in-one-seo-pack' ),
140
+ 'default' => 'On',
141
+ ),
142
  );
143
+
144
+ $status_options = array(
145
+ 'link' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
146
+ 'debug' => array(
147
+ 'name' => __( 'Debug Log', 'all-in-one-seo-pack' ),
148
+ 'default' => '',
149
+ 'type' => 'html',
150
+ 'disabled' => 'disabled',
151
+ 'save' => false,
152
+ 'label' => 'none',
153
+ 'rows' => 5,
154
+ 'cols' => 120,
155
+ 'style' => 'min-width:950px',
156
+ ),
157
  );