All in One SEO Pack - Version 2.3.5

Version Description

Download this release

Release Info

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

Code changes from version 2.3.4.2 to 2.3.5

Files changed (91) hide show
  1. CONTRIBUTING.md +0 -154
  2. admin/aioseop_module_class.php +1430 -940
  3. admin/aioseop_module_manager.php +101 -53
  4. admin/display/general-metaboxes.php +134 -88
  5. admin/display/index.php +1 -1
  6. admin/index.php +1 -1
  7. admin/meta_import.php +443 -425
  8. aioseop_class.php +4120 -2956
  9. all_in_one_seo_pack.php +277 -227
  10. css/aiosp_admin.css +71 -67
  11. css/modules/aioseop_module-rtl.css +112 -112
  12. css/modules/aioseop_module.css +1263 -1120
  13. i18n/all-in-one-seo-pack-am.mo +0 -0
  14. i18n/all-in-one-seo-pack-ar.mo +0 -0
  15. i18n/all-in-one-seo-pack-art_xemoji.mo +0 -0
  16. i18n/all-in-one-seo-pack-ary.mo +0 -0
  17. i18n/all-in-one-seo-pack-bg_BG.mo +0 -0
  18. i18n/all-in-one-seo-pack-bn_BD.mo +0 -0
  19. i18n/all-in-one-seo-pack-bs_BA.mo +0 -0
  20. i18n/all-in-one-seo-pack-ca.mo +0 -0
  21. i18n/all-in-one-seo-pack-de_DE.mo +0 -0
  22. i18n/all-in-one-seo-pack-el.mo +0 -0
  23. i18n/all-in-one-seo-pack-en_AU.mo +0 -0
  24. i18n/all-in-one-seo-pack-en_CA.mo +0 -0
  25. i18n/all-in-one-seo-pack-en_GB.mo +0 -0
  26. i18n/all-in-one-seo-pack-en_NZ.mo +0 -0
  27. i18n/all-in-one-seo-pack-en_ZA.mo +0 -0
  28. i18n/all-in-one-seo-pack-es_ES.mo +0 -0
  29. i18n/all-in-one-seo-pack-es_VE.mo +0 -0
  30. i18n/all-in-one-seo-pack-et.mo +0 -0
  31. i18n/all-in-one-seo-pack-fa_IR.mo +0 -0
  32. i18n/all-in-one-seo-pack-fi.mo +0 -0
  33. i18n/all-in-one-seo-pack-fr_CA.mo +0 -0
  34. i18n/all-in-one-seo-pack-fr_FR.mo +0 -0
  35. i18n/all-in-one-seo-pack-he_IL.mo +0 -0
  36. i18n/all-in-one-seo-pack-hi_IN.mo +0 -0
  37. i18n/all-in-one-seo-pack-hr.mo +0 -0
  38. i18n/all-in-one-seo-pack-hu_HU.mo +0 -0
  39. i18n/all-in-one-seo-pack-hy +0 -0
  40. i18n/all-in-one-seo-pack-hy.mo +0 -0
  41. i18n/all-in-one-seo-pack-id_ID.mo +0 -0
  42. i18n/all-in-one-seo-pack-it_IT.mo +0 -0
  43. i18n/all-in-one-seo-pack-ja.mo +0 -0
  44. i18n/all-in-one-seo-pack-jv_ID.mo +0 -0
  45. i18n/all-in-one-seo-pack-ko_KR.mo +0 -0
  46. i18n/all-in-one-seo-pack-lv.mo +0 -0
  47. i18n/all-in-one-seo-pack-mk_MK.mo +0 -0
  48. i18n/all-in-one-seo-pack-mn.mo +0 -0
  49. i18n/all-in-one-seo-pack-mr.mo +0 -0
  50. i18n/all-in-one-seo-pack-ms_MY.mo +0 -0
  51. i18n/all-in-one-seo-pack-nb_NO.mo +0 -0
  52. i18n/all-in-one-seo-pack-nl.mo +0 -0
  53. i18n/all-in-one-seo-pack-nl_NL.mo +0 -0
  54. i18n/all-in-one-seo-pack-nn_NO.mo +0 -0
  55. i18n/all-in-one-seo-pack-oci.mo +0 -0
  56. i18n/all-in-one-seo-pack-pa_IN.mo +0 -0
  57. i18n/all-in-one-seo-pack-pl_PL.mo +0 -0
  58. i18n/all-in-one-seo-pack-ps.mo +0 -0
  59. i18n/all-in-one-seo-pack-pt_BR.mo +0 -0
  60. i18n/all-in-one-seo-pack-pt_PT.mo +0 -0
  61. i18n/all-in-one-seo-pack-ro_RO.mo +0 -0
  62. i18n/all-in-one-seo-pack-ru_RU.mo +0 -0
  63. i18n/all-in-one-seo-pack-si_LK.mo +0 -0
  64. i18n/all-in-one-seo-pack-sl_SL.mo +0 -0
  65. i18n/all-in-one-seo-pack-sq.mo +0 -0
  66. i18n/all-in-one-seo-pack-sv_SE.mo +0 -0
  67. i18n/all-in-one-seo-pack-ta_IN.mo +0 -0
  68. i18n/all-in-one-seo-pack-tg.mo +0 -0
  69. i18n/all-in-one-seo-pack-tr_TR.mo +0 -0
  70. i18n/all-in-one-seo-pack-uk.mo +0 -0
  71. i18n/all-in-one-seo-pack-ur.mo +0 -0
  72. i18n/all-in-one-seo-pack-vi.mo +0 -0
  73. i18n/all-in-one-seo-pack-zh_CN.mo +0 -0
  74. i18n/all-in-one-seo-pack-zh_TW.mo +0 -0
  75. inc/aioseop_functions.php +483 -332
  76. inc/aioseop_updates_class.php +213 -176
  77. inc/aiosp_common.php +56 -26
  78. inc/commonstrings.php +33 -31
  79. inc/deprecated.php +186 -115
  80. inc/index.php +1 -1
  81. inc/translations.php +163 -0
  82. index.php +2 -1
  83. js/modules/aioseop_module.js +641 -345
  84. modules/aioseop_bad_robots.php +140 -76
  85. modules/aioseop_feature_manager.php +100 -62
  86. modules/aioseop_file_editor.php +105 -53
  87. modules/aioseop_importer_exporter.php +542 -251
  88. modules/aioseop_opengraph.php +909 -539
  89. modules/aioseop_performance.php +218 -146
  90. modules/aioseop_robots.php +477 -259
  91. modules/aioseop_sitemap.php +309 -191
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,212 @@ 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 +588,26 @@ 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 +634,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 +940,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 +954,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 +1027,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 +1071,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 +1105,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 +1121,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 +1268,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 +1292,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 +1359,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 +1492,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 +1760,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 +2115,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 +2160,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
+ $ua = $_SERVER['HTTP_USER_AGENT'];
428
  $uas = $this->quote_list_for_regex( $botlist );
429
+ if ( preg_match( '/' . $uas . '/i', $ua ) ) {
430
+ $ip = $_SERVER['REMOTE_ADDR'];
431
+ $hostname = gethostbyaddr( $ip );
432
  $ip_by_hostname = gethostbyname( $hostname );
433
+ if ( $ip_by_hostname == $ip ) {
434
  $hosts = array_values( $botlist );
435
+ foreach ( $hosts as $k => $h ) {
436
+ $hosts[ $k ] = preg_quote( $h ) . '$';
437
+ }
438
  $hosts = join( '|', $hosts );
439
+ if ( preg_match( '/' . $hosts . '/i', $hostname ) ) {
440
  return true;
441
+ }
442
  }
443
  }
444
+
445
  return false;
446
  }
447
  }
448
+
449
  function default_bad_bots() {
450
+ $botlist = array(
451
+ 'Abonti',
452
+ 'aggregator',
453
+ 'AhrefsBot',
454
+ 'asterias',
455
+ 'BDCbot',
456
+ 'BLEXBot',
457
+ 'BuiltBotTough',
458
+ 'Bullseye',
459
+ 'BunnySlippers',
460
+ 'ca-crawler',
461
+ 'CCBot',
462
+ 'Cegbfeieh',
463
+ 'CheeseBot',
464
+ 'CherryPicker',
465
+ 'CopyRightCheck',
466
+ 'cosmos',
467
+ 'Crescent',
468
+ 'discobot',
469
+ 'DittoSpyder',
470
+ 'DotBot',
471
+ 'Download Ninja',
472
+ 'EasouSpider',
473
+ 'EmailCollector',
474
+ 'EmailSiphon',
475
+ 'EmailWolf',
476
+ 'EroCrawler',
477
+ 'Exabot',
478
+ 'ExtractorPro',
479
+ 'Fasterfox',
480
+ 'FeedBooster',
481
+ 'Foobot',
482
+ 'Genieo',
483
+ 'grub-client',
484
+ 'Harvest',
485
+ 'hloader',
486
+ 'httplib',
487
+ 'HTTrack',
488
+ 'humanlinks',
489
+ 'ieautodiscovery',
490
+ 'InfoNaviRobot',
491
+ 'IstellaBot',
492
+ 'Java/1.',
493
+ 'JennyBot',
494
+ 'k2spider',
495
+ 'Kenjin Spider',
496
+ 'Keyword Density/0.9',
497
+ 'larbin',
498
+ 'LexiBot',
499
+ 'libWeb',
500
+ 'libwww',
501
+ 'LinkextractorPro',
502
+ 'linko',
503
+ 'LinkScan/8.1a Unix',
504
+ 'LinkWalker',
505
+ 'LNSpiderguy',
506
+ 'lwp-trivial',
507
+ 'magpie',
508
+ 'Mata Hari',
509
  'MaxPointCrawler',
510
  'MegaIndex',
511
+ 'Microsoft URL Control',
512
+ 'MIIxpc',
513
+ 'Mippin',
514
+ 'Missigua Locator',
515
+ 'Mister PiX',
516
+ 'MJ12bot',
517
+ 'moget',
518
+ 'MSIECrawler',
519
+ 'NetAnts',
520
+ 'NICErsPRO',
521
+ 'Niki-Bot',
522
+ 'NPBot',
523
+ 'Nutch',
524
+ 'Offline Explorer',
525
+ 'Openfind',
526
  'panscient.com',
527
+ 'PHP/5.{',
528
+ 'ProPowerBot/2.14',
529
+ 'ProWebWalker',
530
+ 'Python-urllib',
531
+ 'QueryN Metasearch',
532
+ 'RepoMonkey',
533
+ 'RMA',
534
  'SemrushBot',
535
+ 'SeznamBot',
536
+ 'SISTRIX',
537
+ 'sitecheck.Internetseer.com',
538
+ 'SiteSnagger',
539
+ 'SnapPreviewBot',
540
+ 'Sogou',
541
+ 'SpankBot',
542
+ 'spanner',
543
+ 'spbot',
544
+ 'Spinn3r',
545
+ 'suzuran',
546
+ 'Szukacz/1.4',
547
+ 'Teleport',
548
+ 'Telesoft',
549
+ 'The Intraformant',
550
+ 'TheNomad',
551
+ 'TightTwatBot',
552
+ 'Titan',
553
+ 'toCrawl/UrlDispatcher',
554
+ 'True_Robot',
555
+ 'turingos',
556
+ 'TurnitinBot',
557
+ 'UbiCrawler',
558
+ 'UnisterBot',
559
+ 'URLy Warning',
560
+ 'VCI',
561
+ 'WBSearchBot',
562
+ 'Web Downloader/6.9',
563
+ 'Web Image Collector',
564
+ 'WebAuto',
565
+ 'WebBandit',
566
+ 'WebCopier',
567
+ 'WebEnhancer',
568
+ 'WebmasterWorldForumBot',
569
+ 'WebReaper',
570
+ 'WebSauger',
571
+ 'Website Quester',
572
+ 'Webster Pro',
573
+ 'WebStripper',
574
+ 'WebZip',
575
+ 'Wotbox',
576
+ 'wsr-agent',
577
+ 'WWW-Collector-E',
578
+ 'Xenu',
579
+ 'Zao',
580
+ 'Zeus',
581
+ 'ZyBORG',
582
  'coccoc',
583
  'Incutio',
584
  'lmspider',
588
  'Unknown',
589
  'uptime files'
590
  );
591
+
592
  return $botlist;
593
  }
594
+
595
  function is_bad_bot() {
596
  $botlist = $this->default_bad_bots();
597
+ $botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
598
+ if ( ! empty( $botlist ) ) {
599
+ $ua = $_SERVER['HTTP_USER_AGENT'];
600
  $uas = $this->quote_list_for_regex( $botlist );
601
+ if ( preg_match( '/' . $uas . '/i', $ua ) ) {
602
  return true;
603
  }
604
  }
605
+
606
  return false;
607
  }
608
+
609
  function default_bad_referers() {
610
+ $referlist = array(
611
  'semalt.com',
612
  'kambasoft.com',
613
  'savetubevideo.com',
634
  'site3.free-share-buttons.com',
635
  'webmaster-traffic.com'
636
  );
637
+
638
  return $referlist;
639
  }
640
 
641
  function is_bad_referer() {
642
  $referlist = $this->default_bad_referers();
643
+ $referlist = apply_filters( $this->prefix . 'badreferlist', $referlist );
644
 
645
+ if ( ! empty( $referlist ) && ! empty( $_SERVER ) && ! empty( $_SERVER['HTTP_REFERER'] ) ) {
646
+ $ref = $_SERVER['HTTP_REFERER'];
647
  $regex = $this->quote_list_for_regex( $referlist );
648
+ if ( preg_match( '/' . $regex . '/i', $ref ) ) {
649
  return true;
650
  }
651
  }
652
+
653
  return false;
654
  }
655
+
656
  function allow_bot() {
657
  $allow_bot = true;
658
+ if ( ( ! $this->is_good_bot() ) && $this->is_bad_bot() && ! is_user_logged_in() ) {
659
  $allow_bot = false;
660
+ }
661
+
662
+ return apply_filters( $this->prefix . 'allow_bot', $allow_bot );
663
  }
664
 
665
  /**
666
  * Displays tabs for tabbed locations on a settings page.
667
  */
668
  function display_tabs( $location ) {
669
+ if ( ( $location != null ) && isset( $locations[ $location ]['tabs'] ) ) {
670
  $tabs = $locations['location']['tabs'];
671
+ } else {
672
  $tabs = $this->tabs;
673
+ }
674
+ if ( ! empty( $tabs ) ) {
675
+ ?>
676
+ <div class="aioseop_tabs_div"><label class="aioseop_head_nav">
677
+ <?php
678
+ foreach ( $tabs as $k => $v ) {
679
+ ?>
680
+ <a class="aioseop_head_nav_tab aioseop_head_nav_<?php if ( $this->current_tab != $k ) {
681
+ echo 'in';
682
+ } ?>active"
683
+ href="<?php echo esc_url( add_query_arg( 'tab', $k ) ); ?>"><?php echo $v['name']; ?></a>
684
+ <?php
685
+ }
686
+ ?>
687
  </label></div>
688
  <?php
689
  }
690
  }
691
+
692
  function get_object_labels( $post_objs ) {
693
+ $pt = array_keys( $post_objs );
694
+ $post_types = array();
695
+ foreach ( $pt as $p ) {
696
+ if ( ! empty( $post_objs[ $p ]->label ) ) {
697
+ $post_types[ $p ] = $post_objs[ $p ]->label;
698
+ } else {
699
+ $post_types[ $p ] = $p;
700
+ }
701
+ }
702
+
703
  return $post_types;
704
  }
705
 
706
  function get_term_labels( $post_objs ) {
707
+ $post_types = array();
708
+ foreach ( $post_objs as $p ) {
709
+ if ( ! empty( $p->name ) ) {
710
+ $post_types[ $p->term_id ] = $p->name;
711
+ }
712
+ }
713
+
714
  return $post_types;
715
  }
716
+
717
+ function get_post_type_titles( $args = array() ) {
718
  return $this->get_object_labels( get_post_types( $args, 'objects' ) );
719
  }
720
 
721
+ function get_taxonomy_titles( $args = array() ) {
722
  return $this->get_object_labels( get_taxonomies( $args, 'objects' ) );
723
  }
724
+
725
+ function get_category_titles( $args = array() ) {
726
  return $this->get_term_labels( get_categories( $args ) );
727
  }
728
+
729
  /**
730
  * Helper function for exporting settings on post data.
731
  */
732
+ function post_data_export( $prefix = '_aioseop', $query = array( 'posts_per_page' => - 1 ) ) {
733
+ $buf = '';
734
  $posts_query = new WP_Query( $query );
735
+ while ( $posts_query->have_posts() ) {
736
  $posts_query->the_post();
737
  global $post;
738
+ $guid = $post->guid;
739
+ $type = $post->post_type;
740
+ $title = $post->post_title;
741
+ $date = $post->post_date;
742
+ $data = '';
743
  $post_custom_fields = get_post_custom( $post->ID );
744
+ $has_data = null;
745
 
746
+ if ( is_array( $post_custom_fields ) ) {
747
+ foreach ( $post_custom_fields as $field_name => $field ) {
748
+ if ( ( $this->strpos( $field_name, $prefix ) === 0 ) && $field[0] ) {
749
  $has_data = true;
750
  $data .= $field_name . " = '" . $field[0] . "'\n";
751
+ }
752
  }
753
  }
754
+ if ( ! empty( $data ) ) {
755
+ $has_data = true;
756
+ }
757
 
758
+ if ( $has_data != null ) {
759
  $post_info = "\n[post_data]\n\n";
760
  $post_info .= "post_title = '" . $title . "'\n";
761
  $post_info .= "post_guid = '" . $guid . "'\n";
762
  $post_info .= "post_date = '" . $date . "'\n";
763
  $post_info .= "post_type = '" . $type . "'\n";
764
+ if ( $data ) {
765
+ $buf .= $post_info . $data . "\n";
766
+ }
767
  }
768
  }
769
  wp_reset_postdata();
770
+
771
  return $buf;
772
  }
773
+
774
  /**
775
  * Handles exporting settings data for a module.
776
  */
777
  function settings_export( $buf ) {
778
+ global $aiosp;
779
+ $post_types = null;
780
+ $has_data = null;
781
  $general_settings = null;
782
  $exporter_choices = '';
783
+ if ( ! empty( $_REQUEST['aiosp_importer_exporter_export_choices'] ) ) {
784
+ $exporter_choices = $_REQUEST['aiosp_importer_exporter_export_choices'];
785
+ }
786
+ if ( ! empty( $exporter_choices ) && is_array( $exporter_choices ) ) {
787
+ foreach ( $exporter_choices as $ex ) {
788
+ if ( $ex == 1 ) {
789
+ $general_settings = true;
790
+ }
791
+ if ( $ex == 2 && isset( $_REQUEST['aiosp_importer_exporter_export_post_types'] ) ) {
792
+ $post_types = $_REQUEST['aiosp_importer_exporter_export_post_types'];
793
  }
794
  }
795
  }
796
 
797
+ if ( ( $post_types != null ) && ( $this === $aiosp ) ) {
798
+ $buf .= $this->post_data_export( '_aioseop', array(
799
+ 'posts_per_page' => - 1,
800
+ 'post_type' => $post_types
801
+ ) );
802
+ }
803
 
804
  /* Add all active settings to settings file */
805
+ $name = $this->get_option_name();
806
  $options = $this->get_class_option();
807
+ if ( ! empty( $options ) && $general_settings != null ) {
808
  $buf .= "\n[$name]\n\n";
809
  foreach ( $options as $key => $value ) {
810
+ if ( ( $name == $this->parent_option ) && ( $key == 'modules' ) ) {
811
+ continue;
812
+ } // don't re-export all module settings -- pdb
813
+ if ( is_array( $value ) ) {
814
+ $value = "'" . str_replace( array( "'", "\n", "\r" ), array(
815
+ "\'",
816
+ '\n',
817
+ '\r'
818
+ ), trim( serialize( $value ) ) ) . "'";
819
+ } else {
820
+ $value = str_replace( array( "\n", "\r" ), array(
821
+ '\n',
822
+ '\r'
823
+ ), trim( var_export( $value, true ) ) );
824
+ }
825
  $buf .= "$key = $value\n";
826
  }
827
  }
828
+
829
  return $buf;
830
  }
831
+
832
  /**
833
  * Order for adding the menus for the aioseop_modules_add_menus hook.
834
  */
835
  function menu_order() {
836
  return 10;
837
  }
838
+
839
  /**
840
  * Print a basic error message.
841
  */
842
  function output_error( $error ) {
843
  echo "<div class='aioseop_module error'>$error</div>";
844
+
845
+ return false;
846
  }
847
+
848
  /***
849
  * Backwards compatibility - see http://php.net/manual/en/function.str-getcsv.php
850
  */
851
+ function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = "\\" ) {
852
+ $fp = fopen( 'php://memory', 'r+' );
853
  fputs( $fp, $input );
854
  rewind( $fp );
855
  $data = fgetcsv( $fp, null, $delimiter, $enclosure ); // $escape only got added in 5.3.0
856
  fclose( $fp );
857
+
858
  return $data;
859
  }
860
+
861
  /***
862
  * Helper function to convert csv in key/value pair format to an associative array.
863
  */
864
  function csv_to_array( $csv ) {
865
+ $args = array();
866
+ if ( ! function_exists( 'str_getcsv' ) ) {
867
  $v = $this->str_getcsv( $csv );
868
+ } else {
869
  $v = str_getcsv( $csv );
870
+ }
871
  $size = count( $v );
872
+ if ( is_array( $v ) && isset( $v[0] ) && $size >= 2 ) {
873
+ for ( $i = 0; $i < $size; $i += 2 ) {
874
  $args[ $v[ $i ] ] = $v[ $i + 1 ];
875
+ }
876
+ }
877
+
878
  return $args;
879
  }
880
 
881
  /** Allow modules to use WP Filesystem if available and desired, fall back to PHP filesystem access otherwise. */
882
  function use_wp_filesystem( $method = '', $form_fields = false, $url = '', $error = false ) {
883
+ if ( empty( $method ) ) {
884
  $this->credentials = request_filesystem_credentials( $url );
885
+ } else {
886
  $this->credentials = request_filesystem_credentials( $url, $method, $error, false, $form_fields );
887
+ }
888
+
889
  return $this->credentials;
890
  }
891
+
892
  /**
893
  * Wrapper function to get filesystem object.
894
  */
895
+ function get_filesystem_object() {
896
  $cred = get_transient( 'aioseop_fs_credentials' );
897
+ if ( ! empty( $cred ) ) {
898
+ $this->credentials = $cred;
899
+ }
900
+
901
+ if ( function_exists( 'WP_Filesystem' ) && WP_Filesystem( $this->credentials ) ) {
902
  global $wp_filesystem;
903
+
904
  return $wp_filesystem;
905
  } else {
906
  require_once( ABSPATH . 'wp-admin/includes/template.php' );
907
  require_once( ABSPATH . 'wp-admin/includes/screen.php' );
908
  require_once( ABSPATH . 'wp-admin/includes/file.php' );
909
 
910
+ if ( ! WP_Filesystem( $this->credentials ) ) {
911
  $this->use_wp_filesystem();
912
+ }
913
 
914
+ if ( ! empty( $this->credentials ) ) {
915
  set_transient( 'aioseop_fs_credentials', $this->credentials, 10800 );
916
+ }
917
  global $wp_filesystem;
918
+ if ( is_object( $wp_filesystem ) ) {
919
  return $wp_filesystem;
920
+ }
921
  }
922
+
923
  return false;
924
  }
925
+
926
  /**
927
  * See if a file exists using WP Filesystem.
928
  */
929
  function file_exists( $filename ) {
930
  $wpfs = $this->get_filesystem_object();
931
+ if ( is_object( $wpfs ) ) {
932
  return $wpfs->exists( $filename );
933
+ }
934
+
935
  return $wpfs;
936
  }
937
 
940
  */
941
  function is_file( $filename ) {
942
  $wpfs = $this->get_filesystem_object();
943
+ if ( is_object( $wpfs ) ) {
944
  return $wpfs->is_file( $filename );
945
+ }
946
+
947
  return $wpfs;
948
  }
949
+
950
  /**
951
  * List files in a directory using WP Filesystem.
952
  */
954
  $wpfs = $this->get_filesystem_object();
955
  if ( is_object( $wpfs ) ) {
956
  $dirlist = $wpfs->dirlist( $path );
957
+ if ( empty( $dirlist ) ) {
958
+ return $dirlist;
959
+ }
960
+
961
  return array_keys( $dirlist );
962
  }
963
+
964
+ return $wpfs;
965
  }
966
+
967
  /**
968
  * Load a file through WP Filesystem; implement basic support for offset and maxlen.
969
  */
970
+ function load_file( $filename, $use_include_path = false, $context = null, $offset = - 1, $maxlen = - 1 ) {
971
  $wpfs = $this->get_filesystem_object();
972
  if ( is_object( $wpfs ) ) {
973
+ if ( ! $wpfs->exists( $filename ) ) {
974
+ return false;
975
+ }
976
  if ( ( $offset > 0 ) || ( $maxlen >= 0 ) ) {
977
+ if ( $maxlen === 0 ) {
978
+ return '';
979
+ }
980
+ if ( $offset < 0 ) {
981
+ $offset = 0;
982
+ }
983
  $file = $wpfs->get_contents( $filename );
984
+ if ( ! is_string( $file ) || empty( $file ) ) {
985
+ return $file;
986
+ }
987
+ if ( $maxlen < 0 ) {
988
  return $this->substr( $file, $offset );
989
+ } else {
990
  return $this->substr( $file, $offset, $maxlen );
991
+ }
992
  } else {
993
  return $wpfs->get_contents( $filename );
994
  }
995
  }
996
+
997
  return false;
998
  }
999
+
1000
  /**
1001
  * Save a file through WP Filesystem.
1002
  */
1003
  function save_file( $filename, $contents ) {
1004
+ $failed_str = __( sprintf( "Failed to write file %s!\n", $filename ), 'all-in-one-seo-pack' );
1005
  $readonly_str = __( sprintf( "File %s isn't writable!\n", $filename ), 'all-in-one-seo-pack' );
1006
+ $wpfs = $this->get_filesystem_object();
1007
  if ( is_object( $wpfs ) ) {
1008
  $file_exists = $wpfs->exists( $filename );
1009
+ if ( ! $file_exists || $wpfs->is_writable( $filename ) ) {
1010
+ if ( $wpfs->put_contents( $filename, $contents ) === false ) {
1011
+ return $this->output_error( $failed_str );
1012
+ }
1013
+ } else {
1014
+ return $this->output_error( $readonly_str );
1015
+ }
1016
+
1017
  return true;
1018
  }
1019
+
1020
  return false;
1021
  }
1022
+
1023
  /**
1024
  * Delete a file through WP Filesystem.
1025
  */
1027
  $wpfs = $this->get_filesystem_object();
1028
  if ( is_object( $wpfs ) ) {
1029
  if ( $wpfs->exists( $filename ) ) {
1030
+ if ( $wpfs->delete( $filename ) === false ) {
1031
  $this->output_error( __( sprintf( "Failed to delete file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
1032
+ } else {
1033
  return true;
1034
+ }
1035
+ } else {
1036
+ $this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
1037
+ }
1038
  }
1039
+
1040
  return false;
1041
  }
1042
+
1043
  /**
1044
  * Rename a file through WP Filesystem.
1045
  */
1046
  function rename_file( $filename, $newname ) {
1047
  $wpfs = $this->get_filesystem_object();
1048
  if ( is_object( $wpfs ) ) {
1049
+ $file_exists = $wpfs->exists( $filename );
1050
  $newfile_exists = $wpfs->exists( $newname );
1051
+ if ( $file_exists && ! $newfile_exists ) {
1052
+ if ( $wpfs->move( $filename, $newname ) === false ) {
1053
  $this->output_error( __( sprintf( "Failed to rename file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
1054
+ } else {
1055
  return true;
1056
+ }
1057
  } else {
1058
+ if ( ! $file_exists ) {
1059
  $this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
1060
+ } elseif ( $newfile_exists ) {
1061
  $this->output_error( __( sprintf( "File %s already exists!\n", $newname ), 'all-in-one-seo-pack' ) );
1062
+ }
1063
  }
1064
  }
1065
+
1066
  return false;
1067
  }
1068
 
1071
  */
1072
  function load_files( $options, $opts, $prefix ) {
1073
  foreach ( $opts as $opt => $file ) {
1074
+ $opt = $prefix . $opt;
1075
+ $file = ABSPATH . $file;
1076
  $contents = $this->load_file( $file );
1077
+ if ( $contents !== false ) {
1078
+ $options[ $opt ] = $contents;
1079
+ }
1080
  }
1081
+
1082
  return $options;
1083
  }
1084
+
1085
  /**
1086
  * Save multiple files.
1087
  */
1088
  function save_files( $opts, $prefix ) {
1089
  foreach ( $opts as $opt => $file ) {
1090
  $opt = $prefix . $opt;
1091
+ if ( isset( $_POST[ $opt ] ) ) {
1092
+ $output = stripslashes_deep( $_POST[ $opt ] );
1093
+ $file = ABSPATH . $file;
1094
  $this->save_file( $file, $output );
1095
  }
1096
  }
1097
  }
1098
+
1099
  /**
1100
  * Delete multiple files.
1101
  */
1105
  $this->delete_file( $file );
1106
  }
1107
  }
1108
+
1109
  function get_all_images_by_type( $options = null, $p = null ) {
1110
+ $img = array();
1111
  if ( empty( $img ) ) {
1112
  $size = apply_filters( 'post_thumbnail_size', 'large' );
1113
 
1121
 
1122
  $count = 1;
1123
 
1124
+ if ( ! empty( $post ) ) {
1125
+ if ( ! is_object( $post ) ) {
1126
+ $post = get_post( $post );
1127
+ }
1128
+ if ( is_object( $post ) && function_exists( 'get_post_thumbnail_id' ) ) {
1129
+ if ( $post->post_type == 'attachment' ) {
1130
  $post_thumbnail_id = $post->ID;
1131
+ } else {
1132
  $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
1133
+ }
1134
+ if ( ! empty( $post_thumbnail_id ) ) {
1135
  $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
1136
  if ( is_array( $image ) ) {
1137
+ $img[] = array( 'type' => 'featured', 'id' => $post_thumbnail_id, 'link' => $image[0] );
1138
  }
1139
  }
1140
  }
1141
 
1142
  $post_id = $post->ID;
1143
+ $p = $post;
1144
+ $w = $wp_query;
1145
 
1146
  $meta_key = '';
1147
+ if ( is_array( $options ) && isset( $options['meta_key'] ) ) {
 
1148
  $meta_key = $options['meta_key'];
 
1149
  }
1150
 
1151
+ if ( ! empty( $meta_key ) && ! empty( $post ) ) {
1152
  $meta_key = explode( ',', $meta_key );
1153
+ $image = $this->get_the_image_by_meta_key( array(
1154
+ 'post_id' => $post->ID,
1155
+ 'meta_key' => $meta_key
1156
+ ) );
1157
+ if ( ! empty( $image ) ) {
1158
+ $img[] = array( 'type' => 'meta_key', 'id' => $meta_key, 'link' => $image );
1159
  }
1160
  }
1161
 
1162
+ if ( ! $post->post_modified_gmt != '' ) {
1163
  $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
1164
+ }
1165
+ if ( $post->post_type == 'page' ) {
1166
  $wp_query->is_page = true;
1167
+ } elseif ( $post->post_type == 'attachment' ) {
1168
  $wp_query->is_attachment = true;
1169
+ } else {
1170
  $wp_query->is_single = true;
1171
+ }
1172
+ if ( get_option( 'show_on_front' ) == 'page' && $post->ID == get_option( 'page_for_posts' ) ) {
1173
  $wp_query->is_home = true;
1174
  }
1175
+ $args['options']['type'] = 'html';
1176
  $args['options']['nowrap'] = false;
1177
+ $args['options']['save'] = false;
1178
+ $wp_query->queried_object = $post;
1179
+
1180
+ $attachments = get_children( array(
1181
+ 'post_parent' => $post->ID,
1182
+ 'post_status' => 'inherit',
1183
+ 'post_type' => 'attachment',
1184
+ 'post_mime_type' => 'image',
1185
+ 'order' => 'ASC',
1186
+ 'orderby' => 'menu_order ID'
1187
+ ) );
1188
+ if ( ! empty( $attachments ) ) {
1189
+ foreach ( $attachments as $id => $attachment ) {
1190
  $image = wp_get_attachment_image_src( $id, $size );
1191
  if ( is_array( $image ) ) {
1192
+ $img[] = array( 'type' => 'attachment', 'id' => $id, 'link' => $image[0] );
1193
  }
1194
  }
1195
+ }
1196
+ $matches = array();
1197
  preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
1198
+ if ( isset( $matches ) && ! empty( $matches[1] ) && ! empty( $matches[1][0] ) ) {
1199
+ foreach ( $matches[1] as $i => $m ) {
1200
+ $img[] = array( 'type' => 'post_content', 'id' => 'post' . $count ++, 'link' => $m );
1201
  }
1202
+ }
1203
  wp_reset_postdata();
1204
+ $wp_query = $w;
1205
+ $post = $p;
1206
  }
1207
  }
1208
+
1209
  return $img;
1210
  }
1211
+
1212
  function get_all_images( $options = null, $p = null ) {
1213
+ $img = $this->get_all_images_by_type( $options, $p );
1214
+ $legacy = array();
1215
+ foreach ( $img as $k => $v ) {
1216
  if ( $v['type'] == 'featured' ) {
1217
+ $legacy[ $v['link'] ] = 1;
1218
+ } else {
1219
+ $legacy[ $v['link'] ] = $v['id'];
1220
  }
1221
  }
1222
+
1223
  return $legacy;
1224
  }
1225
 
1226
  /*** Thanks to Justin Tadlock for the original get-the-image code - http://themehybrid.com/plugins/get-the-image ***/
1227
 
1228
  function get_the_image( $options = null, $p = null ) {
1229
+
1230
  if ( $p === null ) {
1231
  global $post;
1232
  } else {
1233
  $post = $p;
1234
  }
1235
+
1236
  $meta_key = '';
1237
+ if ( is_array( $options ) && isset( $options['meta_key'] ) ) {
 
1238
  $meta_key = $options['meta_key'];
 
1239
  }
1240
 
1241
+ if ( ! empty( $meta_key ) && ! empty( $post ) ) {
1242
  $meta_key = explode( ',', $meta_key );
1243
+ $image = $this->get_the_image_by_meta_key( array(
1244
+ 'post_id' => $post->ID,
1245
+ 'meta_key' => $meta_key
1246
+ ) );
1247
+ }
1248
+ if ( empty( $image ) ) {
1249
+ $image = $this->get_the_image_by_post_thumbnail( $post );
1250
+ }
1251
+ if ( empty( $image ) ) {
1252
+ $image = $this->get_the_image_by_attachment( $post );
1253
+ }
1254
+ if ( empty( $image ) ) {
1255
+ $image = $this->get_the_image_by_scan( $post );
1256
  }
1257
+ if ( empty( $image ) ) {
1258
+ $image = $this->get_the_image_by_default( $post );
1259
+ }
1260
+
1261
  return $image;
1262
  }
1263
+
1264
  function get_the_image_by_default( $p = null ) {
1265
  return '';
1266
  }
1268
  function get_the_image_by_meta_key( $args = array() ) {
1269
 
1270
  /* If $meta_key is not an array. */
1271
+ if ( ! is_array( $args['meta_key'] ) ) {
1272
  $args['meta_key'] = array( $args['meta_key'] );
1273
+ }
1274
 
1275
  /* Loop through each of the given meta keys. */
1276
  foreach ( $args['meta_key'] as $meta_key ) {
1277
  /* Get the image URL by the current meta key in the loop. */
1278
  $image = get_post_meta( $args['post_id'], $meta_key, true );
1279
  /* If a custom key value has been given for one of the keys, return the image URL. */
1280
+ if ( ! empty( $image ) ) {
1281
  return $image;
1282
+ }
1283
  }
1284
+
1285
  return false;
1286
  }
1287
 
1292
  } else {
1293
  $post = $p;
1294
  }
1295
+
1296
  $post_thumbnail_id = null;
1297
+ if ( function_exists( 'get_post_thumbnail_id' ) ) {
1298
+ $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
1299
  }
1300
 
1301
+ if ( empty( $post_thumbnail_id ) ) {
1302
  return false;
1303
+ }
1304
 
1305
+ $size = apply_filters( 'post_thumbnail_size', 'large' );
1306
+ $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
1307
+
1308
+ return $image[0];
1309
  }
1310
 
1311
  function get_the_image_by_attachment( $p = null ) {
1312
+
1313
  if ( $p === null ) {
1314
  global $post;
1315
  } else {
1316
  $post = $p;
1317
  }
1318
 
1319
+ $attachments = get_children( array(
1320
+ 'post_parent' => $post->ID,
1321
+ 'post_status' => 'inherit',
1322
+ 'post_type' => 'attachment',
1323
+ 'post_mime_type' => 'image',
1324
+ 'order' => 'ASC',
1325
+ 'orderby' => 'menu_order ID'
1326
+ ) );
1327
 
1328
+ if ( empty( $attachments ) && 'attachment' == get_post_type( $post->ID ) ) {
 
1329
  $image = wp_get_attachment_image_src( $post->ID, 'large' );
 
1330
  }
1331
 
1332
  /* If no attachments or image is found, return false. */
1333
+ if ( empty( $attachments ) && empty( $image ) ) {
1334
  return false;
1335
+ }
1336
 
1337
  /* Set the default iterator to 0. */
1338
  $i = 0;
1339
 
1340
  /* Loop through each attachment. Once the $order_of_image (default is '1') is reached, break the loop. */
1341
  foreach ( $attachments as $id => $attachment ) {
1342
+ if ( ++ $i == 1 ) {
1343
  $image = wp_get_attachment_image_src( $id, 'large' );
1344
+ $alt = trim( strip_tags( get_post_field( 'post_excerpt', $id ) ) );
1345
  break;
1346
  }
1347
  }
1348
 
1349
  /* Return the image URL. */
1350
+
1351
  return $image[0];
1352
 
1353
  }
1359
  } else {
1360
  $post = $p;
1361
  }
1362
+
1363
  /* Search the post's content for the <img /> tag and get its URL. */
1364
  preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
1365
 
1366
  /* If there is a match for the image, return its URL. */
1367
+ if ( isset( $matches ) && ! empty( $matches[1][0] ) ) {
1368
  return $matches[1][0];
1369
+ }
1370
 
1371
  return false;
1372
  }
1373
+
1374
  /** crude approximization of whether current user is an admin */
1375
  function is_admin() {
1376
  return current_user_can( 'level_8' );
1377
  }
1378
+
1379
  function help_text_helper( &$default_options, $options, $help_link = '' ) {
1380
+ foreach ( $options as $o ) {
1381
  $ht = '';
1382
+ if ( ! empty( $this->help_text[ $o ] ) ) {
1383
+ $ht = $this->help_text[ $o ];
1384
+ } elseif ( ! empty( $default_options[ $o ]['help_text'] ) ) {
1385
+ $ht = $default_options[ $o ]['help_text'];
1386
+ }
1387
+ if ( $ht && ! is_array( $ht ) ) {
1388
  $ha = '';
1389
  $hl = $help_link;
1390
  if ( strpos( $o, 'ga_' ) === 0 ) { // special case -- pdb
1391
  $hl = 'http://semperplugins.com/documentation/advanced-google-analytics-settings/';
1392
  }
1393
+ if ( ! empty( $this->help_anchors[ $o ] ) ) {
1394
+ $ha = $this->help_anchors[ $o ];
1395
+ }
1396
+ if ( ! empty( $ha ) && ( $pos = strrpos( $hl, '#' ) ) ) {
1397
  $hl = substr( $hl, 0, $pos );
1398
  }
1399
+ if ( ! empty( $ha ) && ( $ha[0] == 'h' ) ) {
1400
+ $hl = '';
 
1401
  }
1402
+ if ( ! empty( $ha ) || ! isset( $this->help_anchors[ $o ] ) ) {
1403
+ $ht .= "<br /><a href='" . $hl . $ha . "' target='_blank'>" . __( 'Click here for documentation on this setting', 'all-in-one-seo-pack' ) . '</a>';
1404
+ }
1405
+ $default_options[ $o ]['help_text'] = $ht;
1406
  }
1407
  }
1408
  }
1409
+
1410
  function add_help_text_links() {
1411
+ if ( ! empty( $this->help_text ) ) {
1412
+ foreach ( $this->layout as $k => $v ) {
1413
  $this->help_text_helper( $this->default_options, $v['options'], $v['help_link'] );
1414
  }
1415
+ if ( ! empty( $this->locations ) ) {
1416
+ foreach ( $this->locations as $k => $v ) {
1417
+ if ( ! empty( $v['default_options'] ) && ! empty( $v['options'] ) ) {
1418
+ $this->help_text_helper( $this->locations[ $k ]['default_options'], $v['options'], $v['help_link'] );
1419
  }
1420
  }
1421
+ }
1422
  }
1423
  }
1424
+
1425
  /**
1426
  * Load scripts and styles for metaboxes.
1427
+ *
1428
  * edit-tags exists only for pre 4.5 support... remove when we drop 4.5 support.
1429
  * Also, that check and others should be pulled out into their own functions
1430
  */
1431
+ function enqueue_metabox_scripts() {
1432
  $screen = '';
1433
+ if ( function_exists( 'get_current_screen' ) ) {
1434
  $screen = get_current_screen();
1435
+ }
1436
  $bail = false;
1437
+ if ( empty( $screen ) ) {
1438
+ $bail = true;
1439
+ }
1440
+ if ( ( $screen->base != 'post' ) && ( $screen->base != 'term' ) && ( $screen->base != 'edit-tags' ) && ( $screen->base != 'toplevel_page_shopp-products' ) ) {
1441
+ $bail = true;
1442
+ }
1443
  $prefix = $this->get_prefix();
1444
+ $bail = apply_filters( $prefix . 'bail_on_enqueue', $bail, $screen );
1445
+ if ( $bail ) {
1446
+ return;
1447
+ }
1448
  $this->form = 'post';
1449
+ if ( $screen->base == 'term' || $screen->base == 'edit-tags' ) {
1450
+ $this->form = 'edittag';
1451
+ }
1452
+ if ( $screen->base == 'toplevel_page_shopp-products' ) {
1453
+ $this->form = 'product';
1454
+ }
1455
  $this->form = apply_filters( $prefix . 'set_form_on_enqueue', $this->form, $screen );
1456
+ foreach ( $this->locations as $k => $v ) {
1457
+ if ( $v['type'] === 'metabox' && isset( $v['display'] ) && ! empty( $v['display'] ) ) {
 
1458
  $enqueue_scripts = false;
1459
  $enqueue_scripts = ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) ) || in_array( $screen->post_type, $v['display'] );
1460
  $enqueue_scripts = apply_filters( $prefix . 'enqueue_metabox_scripts', $enqueue_scripts, $screen, $v );
1461
  if ( $enqueue_scripts ) {
1462
+ add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
1463
+ add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ), 20 );
1464
+ add_action( 'admin_print_scripts', array( $this, 'enqueue_styles' ), 20 );
 
1465
  }
1466
  }
1467
  }
1468
  }
1469
+
1470
  /**
1471
  * Load styles for module.
1472
  */
1473
+ function enqueue_styles() {
1474
  wp_enqueue_style( 'thickbox' );
1475
+ if ( ! empty( $this->pointers ) ) {
1476
+ wp_enqueue_style( 'wp-pointer' );
1477
+ }
1478
+ wp_enqueue_style( 'aioseop-module-style', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module.css' );
1479
+ if ( function_exists( 'is_rtl' ) && is_rtl() ) {
1480
+ wp_enqueue_style( 'aioseop-module-style-rtl', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module-rtl.css', array( 'aioseop-module-style' ) );
1481
+ }
1482
  }
1483
+
1484
  /**
1485
  * Load scripts for module, can pass data to module script.
1486
  */
1487
+ function enqueue_scripts() {
1488
  wp_enqueue_script( 'sack' );
1489
  wp_enqueue_script( 'jquery' );
1490
  wp_enqueue_script( 'media-upload' );
1492
  wp_enqueue_script( 'common' );
1493
  wp_enqueue_script( 'wp-lists' );
1494
  wp_enqueue_script( 'postbox' );
1495
+ if ( ! empty( $this->pointers ) ) {
1496
  wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
1497
  }
1498
+ wp_enqueue_script( 'aioseop-module-script', AIOSEOP_PLUGIN_URL . 'js/modules/aioseop_module.js', array(), AIOSEOP_VERSION );
1499
+ if ( ! empty( $this->script_data ) ) {
1500
  aioseop_localize_script_data();
1501
  }
1502
  }
1503
+
1504
  function localize_script_data( $data ) {
1505
+ if ( ! is_array( $data ) ) {
1506
+ $data = array( 0 => $data );
1507
  }
1508
+ if ( empty( $this->script_data ) ) {
1509
+ $this->script_data = array();
1510
+ }
1511
+ if ( ! empty( $this->pointers ) ) {
1512
  $this->script_data['pointers'] = $this->pointers;
1513
+ }
1514
+ if ( empty( $data[0]['condshow'] ) ) {
1515
+ $data[0]['condshow'] = array();
1516
+ }
1517
+ if ( empty( $this->script_data['condshow'] ) ) {
1518
+ $this->script_data['condshow'] = array();
1519
+ }
1520
+ $condshow = $this->script_data['condshow'];
1521
  $data[0]['condshow'] = array_merge( $data[0]['condshow'], $condshow );
1522
  unset( $this->script_data['condshow'] );
1523
+ $data[0] = array_merge( $this->script_data, $data[0] );
1524
  $this->script_data['condshow'] = $condshow;
1525
+
1526
  return $data;
1527
  }
1528
+
1529
  /**
1530
  * Override this to run code at the beginning of the settings page.
1531
  */
1532
  function settings_page_init() {
1533
+
1534
  }
1535
+
1536
  /**
1537
  * Filter out admin pointers that have already been clicked.
1538
  */
1539
  function filter_pointers() {
1540
+ if ( ! empty( $this->pointers ) ) {
1541
  $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
1542
+ foreach ( $dismissed as $d ) {
1543
+ if ( isset( $this->pointers[ $d ] ) ) {
1544
+ unset( $this->pointers[ $d ] );
1545
+ }
1546
+ }
1547
  }
1548
  }
1549
+
1550
  /**
1551
  * Add basic hooks when on the module's page.
1552
  */
1553
  function add_page_hooks() {
1554
  $hookname = current_filter();
1555
+ if ( $this->strpos( $hookname, 'load-' ) === 0 ) {
1556
  $this->pagehook = $this->substr( $hookname, 5 );
1557
+ }
1558
+ add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ) );
1559
+ add_action( 'admin_print_styles', array( $this, 'enqueue_styles' ) );
1560
+ add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
1561
+ add_action( $this->prefix . 'settings_header', array( $this, 'display_tabs' ) );
1562
  }
1563
+
1564
  function get_admin_links() {
1565
+ if ( ! empty( $this->menu_name ) ) {
1566
  $name = $this->menu_name;
1567
+ } else {
1568
  $name = $this->name;
1569
+ }
1570
+
1571
  $hookname = plugin_basename( $this->file );
1572
+
1573
+ $links = array();
1574
+ $url = '';
1575
+ if ( function_exists( 'menu_page_url' ) ) {
1576
+ $url = menu_page_url( $hookname, 0 );
1577
+ }
1578
+ if ( empty( $url ) ) {
1579
+ $url = esc_url( admin_url( 'admin.php?page=' . $hookname ) );
1580
+ }
1581
+
1582
+ if ( $this->locations === null ) {
1583
+ array_unshift( $links, array(
1584
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
1585
+ 'title' => $name,
1586
+ 'id' => $hookname,
1587
+ 'href' => $url,
1588
+ 'order' => $this->menu_order()
1589
+ ) );
1590
+ } else {
1591
+ foreach ( $this->locations as $k => $v ) {
1592
  if ( $v['type'] === 'settings' ) {
1593
  if ( $k === 'default' ) {
1594
+ array_unshift( $links, array(
1595
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
1596
+ 'title' => $name,
1597
+ 'id' => $hookname,
1598
+ 'href' => $url,
1599
+ 'order' => $this->menu_order()
1600
+ ) );
1601
  } else {
1602
+ if ( ! empty( $v['menu_name'] ) ) {
1603
  $name = $v['menu_name'];
1604
+ } else {
1605
  $name = $v['name'];
1606
+ }
1607
+ array_unshift( $links, array(
1608
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
1609
+ 'title' => $name,
1610
+ 'id' => $this->get_prefix( $k ) . $k,
1611
+ 'href' => esc_url( admin_url( 'admin.php?page=' . $this->get_prefix( $k ) . $k ) ),
1612
+ 'order' => $this->menu_order()
1613
+ ) );
1614
  }
1615
  }
1616
  }
1617
  }
1618
+
1619
  return $links;
1620
  }
1621
+
1622
  function add_admin_bar_submenu() {
1623
  global $aioseop_admin_menu, $wp_admin_bar;
1624
+
1625
  if ( $aioseop_admin_menu ) {
1626
  $links = $this->get_admin_links();
1627
+ if ( ! empty( $links ) ) {
1628
+ foreach ( $links as $l ) {
1629
  $wp_admin_bar->add_menu( $l );
1630
+ }
1631
+ }
1632
  }
1633
  }
1634
+
1635
  /**
1636
  * Collect metabox data together for tabbed metaboxes.
1637
  */
1638
  function filter_return_metaboxes( $args ) {
1639
  return array_merge( $args, $this->post_metaboxes );
1640
  }
1641
+
1642
  /** Add submenu for module, call page hooks, set up metaboxes. */
1643
  function add_menu( $parent_slug ) {
1644
+ if ( ! empty( $this->menu_name ) ) {
1645
  $name = $this->menu_name;
1646
+ } else {
1647
  $name = $this->name;
1648
+ }
1649
  if ( $this->locations === null ) {
1650
+ $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), plugin_basename( $this->file ), array(
1651
+ $this,
1652
+ 'display_settings_page'
1653
+ ) );
1654
+ add_action( "load-{$hookname}", array( $this, 'add_page_hooks' ) );
1655
+
1656
  return true;
1657
  }
1658
+ foreach ( $this->locations as $k => $v ) {
1659
  if ( $v['type'] === 'settings' ) {
1660
  if ( $k === 'default' ) {
1661
+ if ( ! empty( $this->menu_name ) ) {
1662
  $name = $this->menu_name;
1663
+ } else {
1664
  $name = $this->name;
1665
+ }
1666
+ $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), plugin_basename( $this->file ), array(
1667
+ $this,
1668
+ 'display_settings_page'
1669
+ ) );
1670
  } else {
1671
+ if ( ! empty( $v['menu_name'] ) ) {
1672
  $name = $v['menu_name'];
1673
+ } else {
1674
  $name = $v['name'];
1675
+ }
1676
+ $hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $this->get_prefix( $k ) . $k, array(
1677
+ $this,
1678
+ "display_settings_page_$k"
1679
+ ) );
1680
  }
1681
+ add_action( "load-{$hookname}", array( $this, 'add_page_hooks' ) );
1682
  } elseif ( $v['type'] === 'metabox' ) {
1683
  $this->setting_options( $k ); // hack -- make sure this runs anyhow, for now -- pdb
1684
+ add_action( 'edit_post', array( $this, 'save_post_data' ) );
1685
+ add_action( 'publish_post', array( $this, 'save_post_data' ) );
1686
+ add_action( 'add_attachment', array( $this, 'save_post_data' ) );
1687
+ add_action( 'edit_attachment', array( $this, 'save_post_data' ) );
1688
+ add_action( 'save_post', array( $this, 'save_post_data' ) );
1689
+ add_action( 'edit_page_form', array( $this, 'save_post_data' ) );
1690
+ if ( isset( $v['display'] ) && ! empty( $v['display'] ) ) {
1691
+ add_action( 'admin_print_scripts', array( $this, 'enqueue_metabox_scripts' ), 5 );
1692
+ if ( $this->tabbed_metaboxes ) {
1693
+ add_filter( 'aioseop_add_post_metabox', array( $this, 'filter_return_metaboxes' ) );
1694
+ }
1695
  foreach ( $v['display'] as $posttype ) {
1696
  $v['location'] = $k;
1697
  $v['posttype'] = $posttype;
1698
+ if ( ! isset( $v['context'] ) ) {
1699
+ $v['context'] = 'advanced';
1700
+ }
1701
+ if ( ! isset( $v['priority'] ) ) {
1702
+ $v['priority'] = 'default';
1703
+ }
1704
  if ( $this->tabbed_metaboxes ) {
1705
+ $this->post_metaboxes[] = array(
1706
+ 'id' => $v['prefix'] . $k,
1707
+ 'title' => $v['name'],
1708
+ 'callback' => array( $this, 'display_metabox' ),
1709
+ 'post_type' => $posttype,
1710
+ 'context' => $v['context'],
1711
+ 'priority' => $v['priority'],
1712
+ 'callback_args' => $v
1713
+ );
1714
  } else {
1715
  $title = $v['name'];
1716
+ if ( $title != $this->plugin_name ) {
1717
+ $title = $this->plugin_name . ' - ' . $title;
1718
+ }
1719
+ if ( ! empty( $v['help_link'] ) ) {
1720
+ $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>';
1721
+ }
1722
+ add_meta_box( $v['prefix'] . $k, $title, array(
1723
+ $this,
1724
+ 'display_metabox'
1725
+ ), $posttype, $v['context'], $v['priority'], $v );
1726
  }
1727
  }
1728
  }
1729
  }
1730
  }
1731
  }
1732
+
1733
  /**
1734
  * Update postmeta for metabox.
1735
  */
1736
  function save_post_data( $post_id ) {
1737
  static $update = false;
1738
+ if ( $update ) {
1739
+ return;
1740
+ }
1741
  if ( $this->locations !== null ) {
1742
+ foreach ( $this->locations as $k => $v ) {
1743
+ if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) {
1744
+ $opts = $this->default_options( $k );
1745
+ $options = array();
1746
+ $update = false;
1747
  foreach ( $opts as $l => $o ) {
1748
+ if ( isset( $_POST[ $l ] ) ) {
1749
+ $options[ $l ] = stripslashes_deep( $_POST[ $l ] );
1750
+ $options[ $l ] = esc_attr( $options[ $l ] );
1751
+ $update = true;
1752
  }
1753
  }
1754
  if ( $update ) {
1755
+ $prefix = $this->get_prefix( $k );
1756
  $options = apply_filters( $prefix . 'filter_metabox_options', $options, $k, $post_id );
1757
  update_post_meta( $post_id, '_' . $prefix . $k, $options );
1758
  }
1760
  }
1761
  }
1762
  }
1763
+
1764
  /**
1765
  * Outputs radio buttons, checkboxes, selects, multiselects, handles groups.
1766
+ */
1767
  function do_multi_input( $args ) {
1768
  extract( $args );
1769
  $buf1 = '';
1770
  $type = $options['type'];
1771
  if ( ( $type == 'radio' ) || ( $type == 'checkbox' ) ) {
1772
+ $strings = array(
1773
+ 'block' => "%s\n",
1774
+ 'group' => "\t<b>%s</b><br>\n%s\n",
1775
+ 'item' => "\t<label class='aioseop_option_setting_label'><input type='$type' %s name='%s' value='%s' %s> %s</label>\n",
1776
+ 'item_args' => array( 'sel', 'name', 'v', 'attr', 'subopt' ),
1777
+ 'selected' => 'checked '
1778
+ );
1779
  } else {
1780
+ $strings = array(
1781
+ 'block' => "<select name='$name' $attr>%s\n</select>\n",
1782
+ 'group' => "\t<optgroup label='%s'>\n%s\t</optgroup>\n",
1783
+ 'item' => "\t<option %s value='%s'>%s</option>\n",
1784
+ 'item_args' => array( 'sel', 'v', 'subopt' ),
1785
+ 'selected' => 'selected '
1786
+ );
1787
  }
1788
  $setsel = $strings['selected'];
1789
+ if ( isset( $options['initial_options'] ) && is_array( $options['initial_options'] ) ) {
1790
  foreach ( $options['initial_options'] as $l => $option ) {
1791
  $is_group = is_array( $option );
1792
+ if ( ! $is_group ) {
1793
+ $option = array( $l => $option );
1794
+ }
1795
  $buf2 = '';
1796
  foreach ( $option as $v => $subopt ) {
1797
+ $sel = '';
1798
  $is_arr = is_array( $value );
1799
  if ( is_string( $v ) || is_string( $value ) ) {
1800
+ if ( is_string( $value ) ) {
1801
+ $cmp = ! strcmp( $v, $value );
1802
+ } else {
1803
+ $cmp = ! strcmp( $v, '' );
1804
+ }
1805
+ // $cmp = !strcmp( (string)$v, (string)$value );
1806
+ } else {
1807
  $cmp = ( $value == $v );
1808
+ }
1809
+ if ( ( ! $is_arr && $cmp ) || ( $is_arr && in_array( $v, $value ) ) ) {
1810
  $sel = $setsel;
1811
+ }
1812
+ $item_arr = array();
1813
+ foreach ( $strings['item_args'] as $arg ) {
1814
+ $item_arr[] = $$arg;
1815
+ }
1816
  $buf2 .= vsprintf( $strings['item'], $item_arr );
1817
  }
1818
+ if ( $is_group ) {
1819
+ $buf1 .= sprintf( $strings['group'], $l, $buf2 );
1820
+ } else {
1821
  $buf1 .= $buf2;
1822
+ }
1823
+ }
1824
  $buf1 = sprintf( $strings['block'], $buf1 );
1825
  }
1826
+
1827
  return $buf1;
1828
  }
1829
+
1830
  /**
1831
  * Outputs a setting item for settings pages and metaboxes.
1832
  */
1833
  function get_option_html( $args ) {
1834
  static $n = 0;
1835
  extract( $args );
1836
+ if ( $options['type'] == 'custom' ) {
1837
+ return apply_filters( "{$prefix}output_option", '', $args );
1838
+ }
1839
+ if ( in_array( $options['type'], array(
1840
+ 'multiselect',
1841
+ 'select',
1842
+ 'multicheckbox',
1843
+ 'radio',
1844
+ 'checkbox',
1845
+ 'textarea',
1846
+ 'text',
1847
+ 'submit',
1848
+ 'hidden'
1849
+ ) ) && is_string( $value )
1850
+ ) {
1851
  $value = esc_attr( $value );
1852
+ }
1853
+ $buf = '';
1854
  $onload = '';
1855
+ if ( ! empty( $options['count'] ) ) {
1856
+ $n ++;
1857
  $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)'";
1858
  $onload = "if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n);";
1859
  }
1860
+ if ( isset( $opts['id'] ) ) {
1861
+ $attr .= " id=\"{$opts['id']}\" ";
1862
+ }
1863
  switch ( $options['type'] ) {
1864
+ case 'multiselect':
1865
+ $attr .= ' MULTIPLE';
1866
+ $args['attr'] = $attr;
1867
+ $args['name'] = $name = "{$name}[]";
1868
+ case 'select':
1869
+ $buf .= $this->do_multi_input( $args );
1870
+ break;
1871
+ case 'multicheckbox':
1872
+ $args['name'] = $name = "{$name}[]";
1873
+ $args['options']['type'] = $options['type'] = 'checkbox';
1874
+ case 'radio':
1875
+ $buf .= $this->do_multi_input( $args );
1876
+ break;
1877
+ case 'checkbox':
1878
+ if ( $value ) {
1879
+ $attr .= ' CHECKED';
1880
+ }
1881
+ $buf .= "<input name='$name' type='{$options['type']}' $attr>\n";
1882
+ break;
1883
+ case 'textarea':
1884
+ $buf .= "<textarea name='$name' $attr>$value</textarea>";
1885
+ break;
1886
+ case 'image':
1887
+ $buf .= "<input class='aioseop_upload_image_button button-primary' type='button' value='Upload Image' style='float:left;' />" .
1888
+ "<input class='aioseop_upload_image_label' name='$name' type='text' $attr value='$value' size=57 style='float:left;clear:left;'>\n";
1889
+ break;
1890
+ case 'html':
1891
+ $buf .= $value;
1892
+ break;
1893
+ default:
1894
+ $buf .= "<input name='$name' type='{$options['type']}' $attr value='$value'>\n";
1895
+ }
1896
+ if ( ! empty( $options['count'] ) ) {
1897
  $size = 60;
1898
+ if ( isset( $options['size'] ) ) {
1899
+ $size = $options['size'];
1900
+ } elseif ( isset( $options['rows'] ) && isset( $options['cols'] ) ) {
1901
+ $size = $options['rows'] * $options['cols'];
1902
+ }
1903
+ if ( isset( $options['count_desc'] ) ) {
1904
  $count_desc = $options['count_desc'];
1905
+ } else {
1906
  $count_desc = __( ' characters. Most search engines use a maximum of %s chars for the %s.', 'all-in-one-seo-pack' );
1907
+ }
1908
+ $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 ) . "' />"
1909
+ . sprintf( $count_desc, $size, trim( $this->strtolower( $options['name'] ), ':' ) );
1910
+ if ( ! empty( $onload ) ) {
1911
+ $buf .= "<script>jQuery( document ).ready(function() { {$onload} });</script>";
1912
+ }
1913
  }
1914
+
1915
  return $buf;
1916
  }
1917
+
1918
+ 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>';
1919
+ const DISPLAY_HELP_END = '<div class="aioseop_help_text_div" style="display:none" id="%s_tip"><label class="aioseop_help_text">%s</label></div>';
1920
+ const DISPLAY_LABEL_FORMAT = '<span class="aioseop_option_label" style="text-align:%s;vertical-align:top;">%s</span>';
1921
+ const DISPLAY_TOP_LABEL = "</div>\n<div class='aioseop_input aioseop_top_label'>\n";
1922
+ 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>';
1923
+
1924
  /**
1925
  * Format a row for an option on a settings page.
1926
  */
1927
  function get_option_row( $name, $opts, $args ) {
1928
  $label_text = $input_attr = $help_text_2 = $id_attr = '';
1929
+ if ( $opts['label'] == 'top' ) {
1930
+ $align = 'left';
1931
+ } else {
1932
  $align = 'right';
1933
+ }
1934
+ if ( isset( $opts['id'] ) ) {
1935
+ $id_attr .= " id=\"{$opts['id']}_div\" ";
1936
+ }
1937
+ if ( $opts['label'] != 'none' ) {
1938
  if ( isset( $opts['help_text'] ) ) {
1939
+ $help_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_START, __( 'Click for Help!', 'all-in-one-seo-pack' ), $name, $opts['name'] );
1940
+ $help_text_2 = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_END, $name, $opts['help_text'] );
1941
+ } else {
1942
+ $help_text = $opts['name'];
1943
+ }
1944
  $label_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_LABEL_FORMAT, $align, $help_text );
1945
+ } else {
1946
+ $input_attr .= ' aioseop_no_label ';
1947
+ }
1948
+ if ( $opts['label'] == 'top' ) {
1949
+ $label_text .= All_in_One_SEO_Pack_Module::DISPLAY_TOP_LABEL;
1950
+ }
1951
  $input_attr .= " aioseop_{$opts['type']}_type";
1952
+
1953
  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 );
1954
  }
1955
+
1956
  /**
1957
  * Display options for settings pages and metaboxes, allows for filtering settings, custom display options.
1958
  */
1959
  function display_options( $location = null, $meta_args = null ) {
1960
+ static $location_settings = array();
1961
+ $defaults = null;
1962
+ $prefix = $this->get_prefix( $location );
1963
+ $help_link = '';
1964
+ if ( is_array( $meta_args['args'] ) && ! empty( $meta_args['args']['default_options'] ) ) {
1965
+ $defaults = $meta_args['args']['default_options'];
1966
+ }
1967
+ if ( ! empty( $meta_args['callback_args'] ) && ! empty( $meta_args['callback_args']['help_link'] ) ) {
1968
+ $help_link = $meta_args['callback_args']['help_link'];
1969
+ }
1970
+ if ( ! empty( $help_link ) ) {
1971
+ 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>';
1972
+ }
1973
+
1974
+ if ( ! isset( $location_settings[ $prefix ] ) ) {
1975
+ $current_options = apply_filters( "{$this->prefix}display_options", $this->get_current_options( array(), $location, $defaults ), $location );
1976
+ $settings = apply_filters( "{$this->prefix}display_settings", $this->setting_options( $location, $defaults ), $location, $current_options );
1977
+ $current_options = apply_filters( "{$this->prefix}override_options", $current_options, $location, $settings );
1978
+ $location_settings[ $prefix ]['current_options'] = $current_options;
1979
+ $location_settings[ $prefix ]['settings'] = $settings;
1980
+ } else {
1981
+ $current_options = $location_settings[ $prefix ]['current_options'];
1982
+ $settings = $location_settings[ $prefix ]['settings'];
1983
+ }
1984
+ // $opts["snippet"]["default"] = sprintf( $opts["snippet"]["default"], "foo", "bar", "moby" );
1985
+ $container = "<div class='aioseop aioseop_options {$this->prefix}settings'>";
1986
+ if ( is_array( $meta_args['args'] ) && ! empty( $meta_args['args']['options'] ) ) {
1987
+ $args = array();
1988
+ $arg_keys = array();
1989
+ foreach ( $meta_args['args']['options'] as $a ) {
1990
+ if ( ! empty( $location ) ) {
1991
+ $key = $prefix . $location . '_' . $a;
1992
+ if ( ! isset( $settings[ $key ] ) ) {
1993
+ $key = $a;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1994
  }
1995
+ } else {
1996
+ $key = $prefix . $a;
1997
+ }
1998
+ if ( isset( $settings[ $key ] ) ) {
1999
+ $arg_keys[ $key ] = 1;
2000
+ } elseif ( isset( $settings[ $a ] ) ) {
2001
+ $arg_keys[ $a ] = 1;
2002
+ }
2003
+ }
2004
+ $setting_keys = array_keys( $settings );
2005
+ foreach ( $setting_keys as $s ) {
2006
+ if ( ! empty( $arg_keys[ $s ] ) ) {
2007
+ $args[ $s ] = $settings[ $s ];
2008
+ }
2009
+ }
2010
+ } else {
2011
+ $args = $settings;
2012
+ }
2013
+ foreach ( $args as $name => $opts ) {
2014
+ $attr_list = array( 'class', 'style', 'readonly', 'disabled', 'size', 'placeholder' );
2015
+ if ( $opts['type'] == 'textarea' ) {
2016
+ $attr_list = array_merge( $attr_list, array( 'rows', 'cols' ) );
2017
+ }
2018
+ $attr = '';
2019
+ foreach ( $attr_list as $a ) {
2020
+ if ( isset( $opts[ $a ] ) ) {
2021
+ $attr .= ' ' . $a . '="' . esc_attr( $opts[ $a ] ) . '" ';
2022
  }
2023
  }
2024
+ $opt = '';
2025
+ if ( isset( $current_options[ $name ] ) ) {
2026
+ $opt = $current_options[ $name ];
2027
+ }
2028
+ if ( $opts['label'] == 'none' && $opts['type'] == 'submit' && $opts['save'] == false ) {
2029
+ $opt = $opts['name'];
2030
+ }
2031
+ if ( $opts['type'] == 'html' && empty( $opt ) && $opts['save'] == false ) {
2032
+ $opt = $opts['default'];
2033
+ }
2034
+
2035
+ $args = array(
2036
+ 'name' => $name,
2037
+ 'options' => $opts,
2038
+ 'attr' => $attr,
2039
+ 'value' => $opt,
2040
+ 'prefix' => $prefix
2041
+ );
2042
+ if ( ! empty( $opts['nowrap'] ) ) {
2043
+ echo $this->get_option_html( $args );
2044
+ } else {
2045
+ if ( $container ) {
2046
+ echo $container;
2047
+ $container = '';
2048
+ }
2049
+ echo $this->get_option_row( $name, $opts, $args );
2050
+ }
2051
+ }
2052
+ if ( ! $container ) {
2053
+ echo '</div>';
2054
+ }
2055
  }
2056
+
2057
  function sanitize_domain( $domain ) {
2058
  $domain = trim( $domain );
2059
  $domain = $this->strtolower( $domain );
2060
+ if ( $this->strpos( $domain, 'http://' ) === 0 ) {
2061
+ $domain = $this->substr( $domain, 7 );
2062
+ } elseif ( $this->strpos( $domain, 'https://' ) === 0 ) {
2063
+ $domain = $this->substr( $domain, 8 );
2064
+ }
2065
  $domain = untrailingslashit( $domain );
2066
+
2067
  return $domain;
2068
  }
2069
 
2070
  /** Sanitize options */
2071
  function sanitize_options( $location = null ) {
2072
  foreach ( $this->setting_options( $location ) as $k => $v ) {
2073
+ if ( isset( $this->options[ $k ] ) ) {
2074
+ if ( ! empty( $v['sanitize'] ) ) {
2075
  $type = $v['sanitize'];
2076
+ } else {
2077
  $type = $v['type'];
2078
+ }
2079
  switch ( $type ) {
2080
  case 'multiselect':
2081
+ case 'multicheckbox':
2082
+ $this->options[ $k ] = urlencode_deep( $this->options[ $k ] );
2083
+ break;
2084
+ case 'textarea':
2085
+ $this->options[ $k ] = wp_kses_post( $this->options[ $k ] );
2086
+ $this->options[ $k ] = htmlspecialchars( $this->options[ $k ], ENT_QUOTES );
2087
+ break;
2088
+ case 'filename':
2089
+ $this->options[ $k ] = sanitize_file_name( $this->options[ $k ] );
2090
+ break;
2091
+ case 'text':
2092
+ $this->options[ $k ] = wp_kses_post( $this->options[ $k ] );
2093
  case 'checkbox':
2094
  case 'radio':
2095
  case 'select':
2096
+ default:
2097
+ if ( ! is_array( $this->options[ $k ] ) ) {
2098
+ $this->options[ $k ] = esc_attr( $this->options[ $k ] );
2099
+ }
2100
  }
2101
  }
2102
  }
2115
  function reset_options( $location = null, $delete = false ) {
2116
  if ( $delete === true ) {
2117
  $this->delete_class_option( $delete );
2118
+ $this->options = array();
2119
  }
2120
  $default_options = $this->default_options( $location );
2121
  foreach ( $default_options as $k => $v ) {
2122
+ $this->options[ $k ] = $v;
2123
  }
2124
  $this->update_class_option( $this->options );
2125
  }
2126
+
2127
  /** handle option resetting and updating */
2128
  function handle_settings_updates( $location = null ) {
2129
  $message = '';
2130
+ if ( ( isset( $_POST['action'] ) && $_POST['action'] == 'aiosp_update_module' &&
2131
+ ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) || ! empty( $_POST['Submit'] ) ) )
2132
+ ) {
2133
  $nonce = $_POST['nonce-aioseop'];
2134
+ if ( ! wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) {
2135
+ die ( __( 'Security Check - If you receive this in error, log out and back in to WordPress', 'all-in-one-seo-pack' ) );
2136
+ }
2137
  if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) {
2138
+ $message = __( 'Options Reset.', 'all-in-one-seo-pack' );
2139
+ if ( isset( $_POST['Submit_All_Default'] ) ) {
2140
  $this->reset_options( $location, true );
2141
  do_action( 'aioseop_options_reset' );
2142
  } else {
2143
  $this->reset_options( $location );
2144
  }
2145
  }
2146
+ if ( ! empty( $_POST['Submit'] ) ) {
2147
+ $message = __( 'All in One SEO Options Updated.', 'all-in-one-seo-pack' );
2148
  $default_options = $this->default_options( $location );
2149
+ foreach ( $default_options as $k => $v ) {
2150
+ if ( isset( $_POST[ $k ] ) ) {
2151
+ $this->options[ $k ] = stripslashes_deep( $_POST[ $k ] );
2152
+ } else {
2153
+ $this->options[ $k ] = '';
2154
+ }
2155
  }
2156
  $this->sanitize_options( $location );
2157
  $this->options = apply_filters( $this->prefix . 'update_options', $this->options, $location );
2160
  }
2161
  do_action( $this->prefix . 'settings_update', $this->options, $location );
2162
  }
2163
+
2164
  return $message;
2165
  }
2166
 
2167
  /** Update / reset settings, printing options, sanitizing, posting back */
2168
  function display_settings_page( $location = null ) {
2169
+ if ( $location != null ) {
2170
+ $location_info = $this->locations[ $location ];
2171
+ }
2172
+ $name = null;
2173
+ if ( $location && isset( $location_info['name'] ) ) {
2174
+ $name = $location_info['name'];
2175
+ }
2176
+ if ( ! $name ) {
2177
+ $name = $this->name;
2178
+ }
2179
+ $message = $this->handle_settings_updates( $location );
2180
+ $this->settings_page_init();
2181
+ ?>
2182
+ <div class="wrap <?php echo get_class( $this ); ?>">
2183
+ <div id="aioseop_settings_header">
2184
+ <?php if ( ! empty( $message ) ) {
2185
+ echo "<div id=\"message\" class=\"updated fade\"><p>$message</p></div>";
2186
+ } ?>
2187
+ <div id="icon-aioseop" class="icon32"><br></div>
2188
+ <h2><?php echo $name; ?></h2>
2189
+ <div id="dropmessage" class="updated" style="display:none;"></div>
2190
+ </div>
2191
+ <?php
2192
+ do_action( 'aioseop_global_settings_header', $location );
2193
+ do_action( $this->prefix . 'settings_header', $location );
2194
+ ?>
2195
+ <form id="aiosp_settings_form" name="dofollow" enctype="multipart/form-data" action="" method="post">
2196
+ <div id="aioseop_top_button">
2197
+ <div id="aiosp_ajax_settings_message"></div>
2198
+ <?php
2199
+
2200
+ $submit_options = array(
2201
+ 'action' => array( 'type' => 'hidden', 'value' => 'aiosp_update_module' ),
2202
+ 'module' => array( 'type' => 'hidden', 'value' => get_class( $this ) ),
2203
+ 'location' => array( 'type' => 'hidden', 'value' => $location ),
2204
+ 'nonce-aioseop' => array(
2205
+ 'type' => 'hidden',
2206
+ 'value' => wp_create_nonce( 'aioseop-nonce' )
2207
+ ),
2208
+ 'page_options' => array( 'type' => 'hidden', 'value' => 'aiosp_home_description' ),
2209
+ 'Submit' => array(
2210
+ 'type' => 'submit',
2211
+ 'class' => 'button-primary',
2212
+ 'value' => __( 'Update Options', 'all-in-one-seo-pack' ) . ' &raquo;'
2213
+ ),
2214
+ 'Submit_Default' => array(
2215
+ 'type' => 'submit',
2216
+ 'class' => 'button-secondary',
2217
+ 'value' => __( sprintf( 'Reset %s Settings to Defaults', $name ), 'all-in-one-seo-pack' ) . ' &raquo;'
2218
+ )
2219
+ );
2220
+ $submit_options = apply_filters( "{$this->prefix}submit_options", $submit_options, $location );
2221
+ foreach ( $submit_options as $k => $s ) {
2222
+ if ( $s['type'] == 'submit' && $k != 'Submit' ) {
2223
+ continue;
2224
+ }
2225
+ $class = '';
2226
+ if ( isset( $s['class'] ) ) {
2227
+ $class = " class='{$s['class']}' ";
2228
+ }
2229
+ echo $this->get_option_html( array(
2230
+ 'name' => $k,
2231
+ 'options' => $s,
2232
+ 'attr' => $class,
2233
+ 'value' => $s['value']
2234
+ ) );
2235
+ }
2236
+ ?>
2237
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2238
  <div class="aioseop_options_wrapper aioseop_settings_left">
2239
+ <?php $opts = $this->get_class_option();
2240
+ if ( $opts !== false ) {
2241
+ $this->options = $opts;
2242
+ }
2243
  if ( is_array( $this->layout ) ) {
2244
+ foreach ( $this->layout as $l => $lopts ) {
2245
+ if ( ! isset( $lopts['tab'] ) || ( $this->current_tab == $lopts['tab'] ) ) {
2246
  $title = $lopts['name'];
2247
+ if ( ! empty( $lopts['help_link'] ) ) {
2248
+ $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>';
2249
+ }
2250
+ add_meta_box( $this->get_prefix( $location ) . $l . '_metabox', $title, array(
2251
+ $this,
2252
+ 'display_options'
2253
+ ),
2254
+ "{$this->prefix}settings", 'advanced', 'default', $lopts );
2255
  }
2256
  }
2257
+ } else {
2258
+ add_meta_box( $this->get_prefix( $location ) . 'metabox', $name, array(
2259
+ $this,
2260
+ 'display_options'
2261
+ ), "{$this->prefix}settings", 'advanced' );
2262
+ }
2263
  do_meta_boxes( "{$this->prefix}settings", 'advanced', $location );
2264
+ ?> <p class="submit" style="clear:both;"><?php
2265
+ foreach ( array( 'action', 'nonce-aioseop', 'page_options' ) as $submit_field ) {
2266
+ if ( isset( $submit_field ) ) {
2267
+ unset( $submit_field );
2268
+ }
2269
+ }
2270
+ foreach ( $submit_options as $k => $s ) {
2271
+ $class = '';
2272
+ if ( isset( $s['class'] ) ) {
2273
+ $class = " class='{$s['class']}' ";
2274
+ }
2275
+ echo $this->get_option_html( array(
2276
+ 'name' => $k,
2277
+ 'options' => $s,
2278
+ 'attr' => $class,
2279
+ 'value' => $s['value']
2280
+ ) );
2281
+ }
2282
+ ?> </p>
2283
+ </div>
2284
  </form>
2285
+ <?php do_action( $this->prefix . 'settings_footer', $location );
2286
+ do_action( 'aioseop_global_settings_footer', $location ); ?>
2287
+ </div> <?php
2288
  }
2289
+
2290
  /**
2291
  * Get the prefix used for a given location.
2292
  */
2293
  function get_prefix( $location = null ) {
2294
+ if ( ( $location != null ) && isset( $this->locations[ $location ]['prefix'] ) ) {
2295
+ return $this->locations[ $location ]['prefix'];
2296
+ }
2297
+
2298
  return $this->prefix;
2299
  }
2300
 
2301
  /** Sets up initial settings */
2302
  function setting_options( $location = null, $defaults = null ) {
2303
+ if ( $defaults === null ) {
2304
  $defaults = $this->default_options;
2305
+ }
2306
  $prefix = $this->get_prefix( $location );
2307
+ $opts = array();
2308
+ if ( $location == null || $this->locations[ $location ]['options'] === null ) {
2309
  $options = $defaults;
2310
+ } else {
2311
+ $options = array();
2312
+ $prefix = "{$prefix}{$location}_";
2313
+ if ( ! empty( $this->locations[ $location ]['default_options'] ) ) {
2314
+ $options = $this->locations[ $location ]['default_options'];
2315
+ }
2316
+ foreach ( $this->locations[ $location ]['options'] as $opt ) {
2317
+ if ( isset( $defaults[ $opt ] ) ) {
2318
+ $options[ $opt ] = $defaults[ $opt ];
2319
+ }
2320
+ }
2321
+ }
2322
+ if ( ! $prefix ) {
2323
+ $prefix = $this->prefix;
2324
+ }
2325
+ if ( ! empty( $options ) ) {
2326
+ foreach ( $options as $k => $v ) {
2327
+ if ( ! isset( $v['name'] ) ) {
2328
+ $v['name'] = $this->ucwords( strtr( $k, '_', ' ' ) );
2329
+ }
2330
+ if ( ! isset( $v['type'] ) ) {
2331
+ $v['type'] = 'checkbox';
2332
+ }
2333
+ if ( ! isset( $v['default'] ) ) {
2334
+ $v['default'] = null;
2335
+ }
2336
+ if ( ! isset( $v['initial_options'] ) ) {
2337
+ $v['initial_options'] = $v['default'];
2338
+ }
2339
+ if ( $v['type'] == 'custom' && ( ! isset( $v['nowrap'] ) ) ) {
2340
+ $v['nowrap'] = true;
2341
+ } elseif ( ! isset( $v['nowrap'] ) ) {
2342
+ $v['nowrap'] = null;
2343
+ }
2344
  if ( isset( $v['condshow'] ) ) {
2345
+ if ( ! is_array( $this->script_data ) ) {
2346
+ $this->script_data = array();
2347
+ }
2348
+ if ( ! isset( $this->script_data['condshow'] ) ) {
2349
+ $this->script_data['condshow'] = array();
2350
+ }
2351
+ $this->script_data['condshow'][ $prefix . $k ] = $v['condshow'];
2352
  }
2353
  if ( $v['type'] == 'submit' ) {
2354
+ if ( ! isset( $v['save'] ) ) {
2355
+ $v['save'] = false;
2356
+ }
2357
+ if ( ! isset( $v['label'] ) ) {
2358
+ $v['label'] = 'none';
2359
+ }
2360
+ if ( ! isset( $v['prefix'] ) ) {
2361
+ $v['prefix'] = false;
2362
+ }
2363
  } else {
2364
+ if ( ! isset( $v['label'] ) ) {
2365
+ $v['label'] = null;
2366
+ }
2367
  }
2368
  if ( $v['type'] == 'hidden' ) {
2369
+ if ( ! isset( $v['label'] ) ) {
2370
+ $v['label'] = 'none';
2371
+ }
2372
+ if ( ! isset( $v['prefix'] ) ) {
2373
+ $v['prefix'] = false;
2374
+ }
2375
+ }
2376
+ if ( ( $v['type'] == 'text' ) && ( ! isset( $v['size'] ) ) ) {
2377
+ $v['size'] = 57;
2378
  }
 
2379
  if ( $v['type'] == 'textarea' ) {
2380
+ if ( ! isset( $v['cols'] ) ) {
2381
+ $v['cols'] = 57;
2382
+ }
2383
+ if ( ! isset( $v['rows'] ) ) {
2384
+ $v['rows'] = 2;
2385
+ }
2386
+ }
2387
+ if ( ! isset( $v['save'] ) ) {
2388
+ $v['save'] = true;
2389
+ }
2390
+ if ( ! isset( $v['prefix'] ) ) {
2391
+ $v['prefix'] = true;
2392
+ }
2393
+ if ( $v['prefix'] ) {
2394
+ $opts[ $prefix . $k ] = $v;
2395
+ } else {
2396
+ $opts[ $k ] = $v;
2397
  }
 
 
 
 
 
 
2398
  }
2399
+ }
2400
+
2401
  return $opts;
2402
  }
2403
 
2404
  /** Generates just the default option names and values */
2405
  function default_options( $location = null, $defaults = null ) {
2406
  $options = $this->setting_options( $location, $defaults );
2407
+ $opts = array();
2408
+ foreach ( $options as $k => $v ) {
2409
+ if ( $v['save'] ) {
2410
+ $opts[ $k ] = $v['default'];
2411
+ }
2412
+ }
2413
+
2414
  return $opts;
2415
  }
2416
+
2417
  /** Gets the current options stored for a given location. */
2418
+ function get_current_options( $opts = array(), $location = null, $defaults = null, $post = null ) {
2419
+ $prefix = $this->get_prefix( $location );
2420
  $get_opts = '';
2421
+ if ( empty( $location ) ) {
2422
  $type = 'settings';
2423
+ } else {
2424
+ $type = $this->locations[ $location ]['type'];
2425
+ }
2426
  if ( $type === 'settings' ) {
2427
  $get_opts = $this->get_class_option();
2428
  } elseif ( $type == 'metabox' ) {
2429
  if ( $post == null ) {
2430
  global $post;
2431
  }
2432
+
2433
  if ( ( isset( $_GET['taxonomy'] ) && isset( $_GET['tag_ID'] ) ) || is_category() || is_tag() || is_tax() ) {
2434
 
2435
  if ( AIOSEOPPRO ) {
2436
  $get_opts = AIO_ProGeneral::getprotax( $get_opts );
2437
  }
2438
+
2439
  } elseif ( isset( $post ) ) {
2440
  $get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
2441
  }
2442
  }
2443
  $defs = $this->default_options( $location, $defaults );
2444
+ if ( $get_opts == '' ) {
2445
  $get_opts = $defs;
2446
+ } else {
2447
  $get_opts = wp_parse_args( $get_opts, $defs );
2448
+ }
2449
  $opts = wp_parse_args( $opts, $get_opts );
2450
+
2451
  return $opts;
2452
  }
2453
 
2454
  /** Updates the options array in the module; loads saved settings with get_option() or uses defaults */
2455
+ function update_options( $opts = array(), $location = null, $defaults = null ) {
2456
+ if ( $location === null ) {
2457
  $type = 'settings';
2458
+ } else {
2459
+ $type = $this->locations[ $location ][ $type ];
2460
+ }
2461
  if ( $type === 'settings' ) {
2462
  $get_opts = $this->get_class_option();
2463
  }
2464
+ if ( $get_opts === false ) {
2465
  $get_opts = $this->default_options( $location, $defaults );
2466
+ } else {
2467
+ $this->setting_options( $location, $defaults );
2468
+ } // hack -- make sure this runs anyhow, for now -- pdb
2469
  $this->options = wp_parse_args( $opts, $get_opts );
2470
  }
2471
  }
admin/aioseop_module_manager.php CHANGED
@@ -5,49 +5,70 @@
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
 
@@ -59,66 +80,93 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
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
  }
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
+
16
  // initialize module list
17
  function __construct( $mod ) {
18
  $this->modules['feature_manager'] = null;
19
+ foreach ( $mod as $m ) {
20
+ $this->modules[ $m ] = null;
21
+ }
22
+ $reset = false;
23
+ $reset_all = ( isset( $_POST['Submit_All_Default'] ) && $_POST['Submit_All_Default'] !== '' );
24
+ $reset = ( ( isset( $_POST['Submit_Default'] ) && $_POST['Submit_Default'] !== '' ) || $reset_all );
25
+ $update = ( isset( $_POST['action'] ) && $_POST['action']
26
+ && ( ( isset( $_POST['Submit'] ) && $_POST['Submit'] !== '' ) || $reset )
27
+ );
28
  if ( $update ) {
29
+ if ( $reset ) {
30
+ $this->settings_reset = true;
31
+ }
32
+ if ( $reset_all ) {
33
+ $this->settings_reset_all = true;
34
+ }
35
+ if ( $_POST['action'] === 'aiosp_update' ) {
36
+ $this->settings_update = true;
37
+ }
38
+ if ( $_POST['action'] === 'aiosp_update_module' ) {
39
+ $this->module_settings_update = true;
40
+ }
41
  }
42
  $this->do_load_module( 'feature_manager', $mod );
43
  }
44
 
45
  function return_module( $class ) {
46
  global $aiosp;
47
+ if ( $class === get_class( $aiosp ) ) {
48
+ return $aiosp;
49
+ }
50
+ if ( $class === get_class( $this ) ) {
51
+ return $this;
52
+ }
53
+ foreach ( $this->modules as $m ) {
54
+ if ( is_object( $m ) && ( $class === get_class( $m ) ) ) {
55
  return $m;
56
+ }
57
+ }
58
+
59
  return false;
60
  }
61
+
62
  function get_loaded_module_list() {
63
  $module_list = Array();
64
+ if ( ! empty( $this->modules ) ) {
65
+ foreach ( $this->modules as $k => $v ) {
66
+ if ( ! empty( $v ) ) {
67
+ $module_list[ $k ] = get_class( $v );
68
+ }
69
+ }
70
  }
71
+
72
  return $module_list;
73
  }
74
 
80
  // $this->modules[$module]
81
  function do_load_module( $mod, $args = null ) {
82
  $mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "modules/aioseop_$mod.php" );
83
+ if ( ! empty( $mod_path ) ) {
84
  require_once( $mod_path );
85
+ }
86
+ $ref = "aioseop_$mod";
87
+ $classname = 'All_in_One_SEO_Pack_' . strtr( ucwords( strtr( $mod, '_', ' ' ) ), ' ', '_' );
88
+ $classname = apply_filters( "aioseop_class_$mod", $classname );
89
+ $module_class = new $classname( $args );
90
+ $GLOBALS[ $ref ] = $module_class;
91
+ $this->modules[ $mod ] = $module_class;
92
+ if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
93
+ add_action( 'admin_bar_menu', array(
94
+ $module_class,
95
+ 'add_admin_bar_submenu'
96
+ ), 1001 + $module_class->menu_order() );
97
+ }
98
  if ( is_admin() ) {
99
+ add_action( 'aioseop_modules_add_menus', Array(
100
+ $module_class,
101
+ 'add_menu'
102
+ ), $module_class->menu_order() );
103
  add_action( 'aiosoep_options_reset', Array( $module_class, 'reset_options' ) );
104
  add_filter( 'aioseop_export_settings', Array( $module_class, 'settings_export' ) );
105
  }
106
+
107
  return true;
108
  }
109
 
110
  function load_module( $mod ) {
111
  static $feature_options = null;
112
  static $feature_prefix = null;
113
+ if ( ! is_array( $this->modules ) ) {
114
+ return false;
115
+ }
116
  $v = $this->modules[ $mod ];
117
+ if ( $v !== null ) {
118
+ return false;
119
+ } // already loaded
120
+ if ( $mod == 'performance' && ! is_super_admin() ) {
121
+ return false;
122
+ }
123
  if ( ( $mod == 'file_editor' || $mod == 'robots' )
124
+ && ( ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
125
+ || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
126
+ || ! is_super_admin() ) )
127
+ ) {
128
  return false;
129
+ }
130
  $mod_enable = false;
131
+ $fm_page = ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) &&
132
+ isset( $_REQUEST['page'] ) && $_REQUEST['page'] == trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . 'modules/aioseop_feature_manager.php' );
133
+ if ( $fm_page && ! $this->settings_reset ) {
134
+ if ( isset( $_POST["aiosp_feature_manager_enable_$mod"] ) ) {
135
+ $mod_enable = $_POST["aiosp_feature_manager_enable_$mod"];
136
+ } else {
137
+ $mod_enable = false;
138
+ }
139
  } else {
140
+ if ( $feature_prefix == null ) {
141
  $feature_prefix = $this->modules['feature_manager']->get_prefix();
142
+ }
143
+ if ( $fm_page && $this->settings_reset ) {
144
  $feature_options = $this->modules['feature_manager']->default_options();
145
+ }
146
  if ( $feature_options == null ) {
147
+ if ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) && $this->settings_reset_all ) {
148
  $feature_options = $this->modules['feature_manager']->default_options();
149
+ } else {
150
  $feature_options = $this->modules['feature_manager']->get_current_options();
151
+ }
152
  }
153
+ if ( isset( $feature_options["{$feature_prefix}enable_$mod"] ) ) {
154
  $mod_enable = $feature_options["{$feature_prefix}enable_$mod"];
155
+ }
156
+ }
157
+ if ( $mod_enable ) {
158
+ return $this->do_load_module( $mod );
159
  }
160
+
161
  return false;
162
  }
163
 
164
  function load_modules() {
165
+ if ( is_array( $this->modules ) ) {
166
+ foreach ( $this->modules as $k => $v ) {
167
  $this->load_module( $k );
168
+ }
169
+ }
170
  }
171
  }
172
  }
admin/display/general-metaboxes.php CHANGED
@@ -3,117 +3,163 @@
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 if ( get_locale() != 'en_US' ) { ?>
87
+ <div><strong>
88
+ <?php
89
 
90
+ $aiosp_trans = new AIOSEOP_Translations();
91
+
92
+ if ( $aiosp_trans->percent_translated < 100 ) {
93
+
94
+ /* 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 */
95
+ printf( __(
96
+ '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' ),
97
+ $aiosp_trans->translated_count,
98
+ $aiosp_trans->percent_translated,
99
+ $aiosp_trans->name,
100
+ "<a href=\"$aiosp_trans->translation_url\" target=\"_BLANK\">",
101
+ '</a>' );
102
+ }
103
+
104
+ ?>
105
+ </strong></div>
106
  <?php } ?>
107
  </div>
108
+ <?php
109
+ break;
110
+ case 'aioseop-list':
111
+ ?>
112
  <div class="aioseop_metabox_text">
113
+ <form
114
+ action="http://semperfiwebdesign.us1.list-manage.com/subscribe/post?u=794674d3d54fdd912f961ef14&amp;id=af0a96d3d9"
115
+ method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
116
+ target="_blank">
117
  <h2><?php _e( 'Join our mailing list for tips, tricks, and WordPress secrets.', 'all-in-one-seo-pack' ); ?></h2>
118
+ <p>
119
+ <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>
120
+ </p>
121
+ <p><input type="text" value="" name="EMAIL" class="required email" id="mce-EMAIL"
122
+ placeholder="Email Address">
123
+ <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe"
124
+ class="btn"></p>
125
+ </form>
126
  </div>
127
+ <?php
128
  break;
129
+ case 'aioseop-support':
130
+ ?>
131
+ <div class="aioseop_metabox_text">
132
+ <p>
133
+ <div class="aioseop_icon aioseop_file_icon"></div>
134
+ <a target="_blank"
135
+ href="http://semperplugins.com/documentation/"><?php _e( 'Read the All in One SEO Pack user guide', 'all-in-one-seo-pack' ); ?></a></p>
136
+ <p>
137
+ <div class="aioseop_icon aioseop_support_icon"></div>
138
+ <a target="_blank"
139
+ title="<?php _e( 'All in One SEO Pro Plugin Support Forum', 'all-in-one-seo-pack' ); ?>"
140
+ href="http://semperplugins.com/support/"><?php _e( 'Access our Premium Support Forums', 'all-in-one-seo-pack' ); ?></a></p>
141
+ <p>
142
+ <div class="aioseop_icon aioseop_cog_icon"></div>
143
+ <a target="_blank" title="<?php _e( 'All in One SEO Pro Plugin Changelog', 'all-in-one-seo-pack' ); ?>"
144
+ href="<?php if ( AIOSEOPPRO ) {
145
+ echo 'http://semperplugins.com/documentation/all-in-one-seo-pack-pro-changelog/';
146
+ } else {
147
+ echo 'http://semperfiwebdesign.com/blog/all-in-one-seo-pack/all-in-one-seo-pack-release-history/';
148
+ } ?>"><?php _e( 'View the Changelog', 'all-in-one-seo-pack' ); ?></a></p>
149
+ <p>
150
+ <div class="aioseop_icon aioseop_youtube_icon"></div>
151
+ <a target="_blank"
152
+ href="http://semperplugins.com/doc-type/video/"><?php _e( 'Watch video tutorials', 'all-in-one-seo-pack' ); ?></a></p>
153
+ <p>
154
+ <div class="aioseop_icon aioseop_book_icon"></div>
155
+ <a target="_blank"
156
+ href="http://semperplugins.com/documentation/quick-start-guide/"><?php _e( 'Getting started? Read the Beginners Guide', 'all-in-one-seo-pack' ); ?></a></p>
157
  </div>
158
+ <?php
159
+ break;
160
  }
161
+ echo '</div>';
162
  }
163
+
164
+
165
+ }
 
 
 
 
 
 
 
admin/display/index.php CHANGED
@@ -1 +1 @@
1
- <?php // Silence is golden
1
+ <?php // Silence is golden
admin/index.php CHANGED
@@ -1 +1 @@
1
- <?php // Silence is golden
1
+ <?php // Silence is golden
admin/meta_import.php CHANGED
@@ -1,57 +1,56 @@
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
  /**
@@ -59,61 +58,66 @@ function aiosp_seometa_settings_init() {
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 +130,471 @@ 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
+ 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
+ public function show_deactivate_notice() {
34
+ echo '<div class="updated"><p>', esc_html__( 'All in One SEO has been deactivated', 'all-in-one-seo-pack' ), '</p></div>';
35
+ }
36
  }
37
+ } else {
 
38
  add_action( 'init', 'mi_aioseop_yst_detected_notice_dismissed' );
39
  }
40
 
41
+ function mi_aioseop_yst_detected_notice_dismissed() {
42
  delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
43
  }
44
 
45
  /**
46
  * Register the admin menu page
47
  */
48
+ add_action( 'admin_menu', 'aiosp_seometa_settings_init' );
49
  function aiosp_seometa_settings_init() {
50
  global $_aiosp_seometa_admin_pagehook;
51
+
52
  // Add submenu page link
53
+ $_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' );
54
  }
55
 
56
  /**
58
  * data to convert values in the postmeta table from one platform to another.
59
  */
60
  function aiosp_seometa_action() {
61
+
62
  //print_r($_REQUEST);
63
+
64
+ if ( empty( $_REQUEST['_wpnonce'] ) ) {
65
  return;
66
+ }
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
+
71
  return;
72
  }
73
+
74
+ if ( $_REQUEST['platform_old'] === 'All in One SEO Pack' ) {
75
+ printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) );
76
+
77
  return;
78
  }
79
+
80
+ check_admin_referer( 'aiosp_nonce' ); // Verify nonce
81
+
82
+ if ( ! empty( $_REQUEST['analyze'] ) ) {
83
+
84
+ printf( '<h3>%s</h3>', __( 'Analysis Results', 'all-in-one-seo-pack' ) );
85
+
86
  $response = aiosp_seometa_post_meta_analyze( $_REQUEST['platform_old'], 'All in One SEO Pack' );
87
  if ( is_wp_error( $response ) ) {
88
+ printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, something went wrong. Please try again' ) );
89
+
90
  return;
91
  }
92
+
93
+ 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' );
94
  printf( '<p><b>%d</b> Compatible Records were identified</p>', $response->update );
95
  // printf( '<p>%d Compatible Records will be ignored</p>', $response->ignore );
96
+
97
+ printf( '<p><b>%s</b></p>', __( 'Compatible data:', 'all-in-one-seo-pack' ) );
98
  echo '<ol>';
99
+ foreach ( (array) $response->elements as $element ) {
100
  printf( '<li>%s</li>', $element );
101
  }
102
  echo '</ol>';
103
+
104
  return;
105
  }
106
+
107
+ printf( '<h3>%s</h3>', __( 'Conversion Results', 'all-in-one-seo-pack' ) );
108
+
109
+ $result = aiosp_seometa_post_meta_convert( stripslashes( $_REQUEST['platform_old'] ), 'All in One SEO Pack' );
110
  if ( is_wp_error( $result ) ) {
111
+ printf( '<p>%s</p>', __( 'Sorry, something went wrong. Please try again' ) );
112
+
113
  return;
114
  }
115
+
116
  printf( '<p><b>%d</b> Records were updated</p>', isset( $result->updated ) ? $result->updated : 0 );
117
  printf( '<p><b>%d</b> Records were ignored</p>', isset( $result->ignored ) ? $result->ignored : 0 );
118
+
119
  return;
120
+
121
  }
122
 
123
  /**
130
  */
131
  function aiosp_seometa_admin() {
132
  global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
133
+ ?>
134
 
135
  <div class="wrap">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
 
 
137
 
138
+ <h2><?php _e( 'Import SEO Settings', 'all-in-one-seo-pack' ); ?></h2>
 
 
 
 
 
 
 
 
 
139
 
140
+ <p><span
141
+ 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>
142
+ </p>
143
 
144
+ <p><span
145
+ 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>
146
+ </p>
147
 
148
+ <p><span
149
+ 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>
150
+ </p>
151
 
152
+ <p><span
153
+ 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>
154
+ </p>
155
 
156
+ <p><span
157
+ 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>
158
+ </p>
 
 
 
 
 
 
 
 
 
 
 
159
 
 
160
 
161
+ <form action="<?php echo admin_url( 'tools.php?page=aiosp_import' ); ?>" method="post">
162
+ <?php
163
+ wp_nonce_field( 'aiosp_nonce' );
164
 
165
+ $platform_old = ( ! isset( $_POST['platform_old'] ) ) ? '' : $_POST['platform_old'];
166
 
167
+ _e( 'Import SEO data from:', 'all-in-one-seo-pack' );
168
+ echo '<select name="platform_old">';
169
+ printf( '<option value="">%s</option>', __( 'Choose platform:', 'all-in-one-seo-pack' ) );
 
170
 
171
+ printf( '<optgroup label="%s">', __( 'Plugins', 'all-in-one-seo-pack' ) );
172
+ foreach ( $_aiosp_seometa_plugins as $platform => $data ) {
173
+ if ( $platform !== 'All in One SEO Pack' ) {
174
+ printf( '<option value="%s" %s>%s</option>', $platform, selected( $platform, $platform_old, 0 ), $platform );
175
+ }
176
+ }
177
+ printf( '</optgroup>' );
178
 
179
+ printf( '<optgroup label="%s">', __( 'Themes', 'all-in-one-seo-pack' ) );
180
+ foreach ( $_aiosp_seometa_themes as $platform => $data ) {
181
+ printf( '<option value="%s" %s>%s</option>', $platform, selected( $platform, $platform_old, 0 ), $platform );
182
+ }
183
+ printf( '</optgroup>' );
184
 
 
 
 
185
 
186
+ echo '</select>' . "\n\n";
 
 
187
 
188
+ ?>
 
 
 
189
 
190
+ <input type="submit" class="button-highlighted" name="analyze"
191
+ value="<?php _e( 'Analyze', 'genesis' ); ?>"/>
192
+ <input type="submit" class="button-primary" value="<?php _e( 'Convert', 'genesis' ) ?>"/>
193
 
194
+ </form>
195
 
196
+ <?php aiosp_seometa_action(); ?>
197
 
198
+ </div>
199
 
200
+ <?php
201
+ }
202
+
203
+
204
+ //////////////////FUNCTIONS//////////////////
205
+
206
+ /**
207
+ * This function converts $old meta_key entries in the postmeta table into $new entries.
208
+ *
209
+ * It first checks to see what records for the $new meta_key already exist,
210
+ * storing the corresponding post_id values in an array. When the conversion
211
+ * happens, rows that contain a post_id in that array will be ignored, to
212
+ * avoid duplicate $new meta_key entries.
213
+ *
214
+ * The $old entries will be left as-is if $delete_old is left false. If set
215
+ * to true, the $old entries will be deleted, rather than retained.
216
+ *
217
+ * The function returns an object for error detection, and the number of affected rows.
218
+ */
219
+ function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = false ) {
220
+
221
+ do_action( 'pre_aiosp_seometa_meta_key_convert_before', $old, $new, $delete_old );
222
+
223
+ global $wpdb;
224
+
225
+ $output = new stdClass;
226
+
227
+ if ( ! $old || ! $new ) {
228
+ $output->WP_Error = 1;
229
+
230
+ return $output;
231
  }
232
 
233
+ // See which records we need to ignore, if any
234
+ $exclude = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $new ) );
 
 
 
 
 
 
 
 
235
 
236
+ // If no records to ignore, we'll do a basic UPDATE and DELETE
237
+ if ( ! $exclude ) {
238
 
239
+ $output->updated = $wpdb->update( $wpdb->postmeta, array( 'meta_key' => $new ), array( 'meta_key' => $old ) );
240
+ $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
241
+ $output->ignored = 0;
242
 
243
+ } // Else, do a more complex UPDATE and DELETE
244
+ else {
245
 
246
+ foreach ( (array) $exclude as $key => $value ) {
247
+ $not_in[] = $value->post_id;
 
248
  }
249
+ $not_in = implode( ', ', (array) $not_in );
250
 
251
+ $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 ) );
252
+ $output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
253
+ $output->ignored = count( $exclude );
254
 
255
+ }
256
 
257
+ do_action( 'aiosp_seometa_meta_key_convert', $output, $old, $new, $delete_old );
 
 
258
 
259
+ return $output;
 
 
260
 
261
+ }
 
262
 
263
+ /**
264
+ * This function cycles through all compatible SEO entries of two platforms,
265
+ * performs a aiosp_seometa_meta_key_convert() conversion for each key, and returns
266
+ * the results as an object.
267
+ *
268
+ * It first checks for compatible entries between the two platforms. When it
269
+ * finds compatible entries, it loops through them and preforms the conversion
270
+ * on each entry.
271
+ */
272
+ function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'All in One SEO Pack', $delete_old = false ) {
273
 
274
+ do_action( 'pre_aiosp_seometa_post_meta_convert', $old_platform, $new_platform, $delete_old );
 
 
275
 
276
+ global $_aiosp_seometa_platforms;
277
 
278
+ $output = new stdClass;
279
 
280
+ if ( empty( $_aiosp_seometa_platforms[ $old_platform ] ) || empty( $_aiosp_seometa_platforms[ $new_platform ] ) ) {
281
+ $output->WP_Error = 1;
282
 
283
+ return $output;
284
  }
285
 
286
+ $output->updated = 0;
287
+ $output->deleted = 0;
288
+ $output->ignored = 0;
289
+
290
+ foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
291
 
292
+ // skip iterations where no $new analog exists
293
+ if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
294
+ continue;
295
+ }
296
 
297
+ // set $old and $new meta_key values
298
+ $old = $_aiosp_seometa_platforms[ $old_platform ][ $label ];
299
+ $new = $_aiosp_seometa_platforms[ $new_platform ][ $label ];
300
 
301
+ // convert
302
+ $result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old );
303
 
304
+ // error check
305
+ if ( is_wp_error( $result ) ) {
306
+ continue;
307
  }
308
 
309
+ // update total updated/ignored count
310
+ $output->updated += (int) $result->updated;
311
+ $output->ignored += (int) $result->ignored;
312
 
313
+ }
314
 
315
+ do_action( 'aiosp_seometa_post_meta_convert', $output, $old_platform, $new_platform, $delete_old );
 
 
316
 
317
+ return $output;
318
 
319
+ }
 
 
320
 
321
+ /**
322
+ * This function analyzes two platforms to see what Compatible elements they share,
323
+ * what data can be converted from one to the other, and which elements to ignore (future).
324
+ */
325
+ function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) {
326
 
327
+ do_action( 'pre_aiosp_seometa_post_meta_analyze', $old_platform, $new_platform );
 
 
328
 
329
+ global $wpdb, $_aiosp_seometa_platforms;
 
330
 
331
+ $output = new stdClass;
 
 
332
 
333
+ if ( empty( $_aiosp_seometa_platforms[ $old_platform ] ) || empty( $_aiosp_seometa_platforms[ $new_platform ] ) ) {
334
+ $output->WP_Error = 1;
335
 
336
+ return $output;
337
+ }
338
 
339
+ $output->update = 0;
340
+ $output->ignore = 0;
341
+ $output->elements = '';
342
+
343
+ foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
344
+
345
+ // skip iterations where no $new analog exists
346
+ if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
347
+ continue;
348
+ }
349
+
350
+ $elements[] = $label;
351
+
352
+ // see which records to ignore, if any
353
+ $ignore = 0;
354
+ // $ignore = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
355
+
356
+ // see which records to update, if any
357
+ $update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
358
+
359
+ // count items in returned arrays
360
+ // $ignore = count( (array)$ignore );
361
+ $update = count( (array) $update );
362
+
363
+ // calculate update/ignore by comparison
364
+ // $update = ( (int)$update > (int)$ignore ) ? ( (int)$update - (int)$ignore ) : 0;
365
+
366
+ // update output numbers
367
+ $output->update += (int) $update;
368
+ $output->ignore += (int) $ignore;
369
+
370
+ } // endforeach
371
+
372
+ $output->elements = $elements;
373
+
374
+ do_action( 'aiosp_seometa_post_meta_analyze', $output, $old_platform, $new_platform );
375
+
376
+ return $output;
377
+
378
+ }
379
 
 
380
 
 
 
 
 
381
  ////////////PLUGIN/////////
382
 
383
 
384
  // define('aiosp_seometa_PLUGIN_DIR', dirname(__FILE__));
385
 
386
+ //add_action( 'plugins_loaded', 'aiosp_seometa_import' );
387
+ /**
388
+ * Initialize the SEO Data Transporter plugin
389
+ */
390
+ function aiosp_seometa_import() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
 
392
+ global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
393
 
394
  /**
395
+ * The associative array of supported themes.
 
396
  */
397
+ $_aiosp_seometa_themes = array(
398
+ // alphabatized
399
+ 'Builder' => array(
400
+ 'Custom Doctitle' => '_builder_seo_title',
401
+ 'META Description' => '_builder_seo_description',
402
+ 'META Keywords' => '_builder_seo_keywords',
403
+ ),
404
+ 'Catalyst' => array(
405
+ 'Custom Doctitle' => '_catalyst_title',
406
+ 'META Description' => '_catalyst_description',
407
+ 'META Keywords' => '_catalyst_keywords',
408
+ 'noindex' => '_catalyst_noindex',
409
+ 'nofollow' => '_catalyst_nofollow',
410
+ 'noarchive' => '_catalyst_noarchive',
411
+ ),
412
+ 'Frugal' => array(
413
+ 'Custom Doctitle' => '_title',
414
+ 'META Description' => '_description',
415
+ 'META Keywords' => '_keywords',
416
+ 'noindex' => '_noindex',
417
+ 'nofollow' => '_nofollow',
418
+ ),
419
+ 'Genesis' => array(
420
+ 'Custom Doctitle' => '_genesis_title',
421
+ 'META Description' => '_genesis_description',
422
+ 'META Keywords' => '_genesis_keywords',
423
+ 'noindex' => '_genesis_noindex',
424
+ 'nofollow' => '_genesis_nofollow',
425
+ 'noarchive' => '_genesis_noarchive',
426
+ 'Canonical URI' => '_genesis_canonical_uri',
427
+ 'Custom Scripts' => '_genesis_scripts',
428
+ 'Redirect URI' => 'redirect',
429
+ ),
430
+ 'Headway' => array(
431
+ 'Custom Doctitle' => '_title',
432
+ 'META Description' => '_description',
433
+ 'META Keywords' => '_keywords',
434
+ ),
435
+ 'Hybrid' => array(
436
+ 'Custom Doctitle' => 'Title',
437
+ 'META Description' => 'Description',
438
+ 'META Keywords' => 'Keywords',
439
+ ),
440
+ 'Thesis 1.x' => array(
441
+ 'Custom Doctitle' => 'thesis_title',
442
+ 'META Description' => 'thesis_description',
443
+ 'META Keywords' => 'thesis_keywords',
444
+ 'Custom Scripts' => 'thesis_javascript_scripts',
445
+ 'Redirect URI' => 'thesis_redirect',
446
+ ),
447
+ /*
448
+ 'Thesis 2.x' => array(
449
+ 'Custom Doctitle' => '_thesis_title_tag',
450
+ 'META Description' => '_thesis_meta_description',
451
+ 'META Keywords' => '_thesis_meta_keywords',
452
+ 'Custom Scripts' => '_thesis_javascript_scripts',
453
+ 'Canonical URI' => '_thesis_canonical_link',
454
+ 'Redirect URI' => '_thesis_redirect',
455
+ ),
456
+ */
457
+ 'WooFramework' => array(
458
+ 'Custom Doctitle' => 'seo_title',
459
+ 'META Description' => 'seo_description',
460
+ 'META Keywords' => 'seo_keywords',
461
+ )
462
+ );
463
 
464
+ /**
465
+ * The associative array of supported plugins.
466
+ */
467
+ $_aiosp_seometa_plugins = array(
468
+ // alphabatized
469
+ 'Add Meta Tags' => array(
470
+ 'META Description' => 'description',
471
+ 'META Keywords' => 'keywords',
472
+ ),
473
+ 'All in One SEO Pack' => array(
474
+ 'Custom Doctitle' => '_aioseop_title',
475
+ 'META Description' => '_aioseop_description',
476
+ 'META Keywords' => '_aioseop_keywords',
477
+ ),
478
+ 'Greg\'s High Performance SEO' => array(
479
+ 'Custom Doctitle' => '_ghpseo_secondary_title',
480
+ 'META Description' => '_ghpseo_alternative_description',
481
+ 'META Keywords' => '_ghpseo_keywords',
482
+ ),
483
+ 'Headspace2' => array(
484
+ 'Custom Doctitle' => '_headspace_page_title',
485
+ 'META Description' => '_headspace_description',
486
+ 'META Keywords' => '_headspace_keywords',
487
+ 'Custom Scripts' => '_headspace_scripts',
488
+ ),
489
+ 'Infinite SEO' => array(
490
+ 'Custom Doctitle' => '_wds_title',
491
+ 'META Description' => '_wds_metadesc',
492
+ 'META Keywords' => '_wds_keywords',
493
+ 'noindex' => '_wds_meta-robots-noindex',
494
+ 'nofollow' => '_wds_meta-robots-nofollow',
495
+ 'Canonical URI' => '_wds_canonical',
496
+ 'Redirect URI' => '_wds_redirect',
497
+ ),
498
+ 'Meta SEO Pack' => array(
499
+ 'META Description' => '_msp_description',
500
+ 'META Keywords' => '_msp_keywords',
501
+ ),
502
+ 'Platinum SEO' => array(
503
+ 'Custom Doctitle' => 'title',
504
+ 'META Description' => 'description',
505
+ 'META Keywords' => 'keywords',
506
+ ),
507
+ 'SEO Title Tag' => array(
508
+ 'Custom Doctitle' => 'title_tag',
509
+ 'META Description' => 'meta_description',
510
+ ),
511
+ 'SEO Ultimate' => array(
512
+ 'Custom Doctitle' => '_su_title',
513
+ 'META Description' => '_su_description',
514
+ 'META Keywords' => '_su_keywords',
515
+ 'noindex' => '_su_meta_robots_noindex',
516
+ 'nofollow' => '_su_meta_robots_nofollow',
517
+ ),
518
+ 'Yoast SEO' => array(
519
+ 'Custom Doctitle' => '_yoast_wpseo_title',
520
+ 'META Description' => '_yoast_wpseo_metadesc',
521
+ 'META Keywords' => '_yoast_wpseo_metakeywords',
522
+ 'noindex' => '_yoast_wpseo_meta-robots-noindex',
523
+ 'nofollow' => '_yoast_wpseo_meta-robots-nofollow',
524
+ 'Canonical URI' => '_yoast_wpseo_canonical',
525
+ 'Redirect URI' => '_yoast_wpseo_redirect',
526
+ )
527
+ );
528
 
529
  /**
530
+ * The combined array of supported platforms.
531
  */
532
+ $_aiosp_seometa_platforms = array_merge( $_aiosp_seometa_themes, $_aiosp_seometa_plugins );
 
 
 
533
 
534
  /**
535
+ * Include the other elements of the plugin.
536
  */
537
+ // require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' );
538
+ // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
 
 
539
 
540
  /**
541
+ * Init hook.
542
+ *
543
+ * Hook fires after plugin functions are loaded.
544
+ *
545
+ * @since 0.9.10
546
+ *
547
  */
548
+ do_action( 'aiosp_seometa_import' );
 
549
 
550
+ }
551
+
552
+ /**
553
+ * Activation Hook
554
+ * @since 0.9.4
555
+ */
556
+ register_activation_hook( __FILE__, 'aiosp_seometa_activation_hook' );
557
+ function aiosp_seometa_activation_hook() {
558
+
559
+ // require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
560
 
561
+ aiosp_seometa_meta_key_convert( '_yoast_seo_title', 'yoast_wpseo_title', true );
562
+ aiosp_seometa_meta_key_convert( '_yoast_seo_metadesc', 'yoast_wpseo_metadesc', true );
563
+
564
+ }
565
+
566
+ /**
567
+ * Manual conversion test
568
+ */
569
+ /*
570
+ $aiosp_seometa_convert = aiosp_seometa_post_meta_convert( 'All in One SEO Pack', 'Genesis', false );
571
+ printf( '%d records were updated', $aiosp_seometa_convert->updated );
572
+ /**/
573
+
574
+ /**
575
+ * Manual analysis test
576
+ */
577
+ /*
578
+ $aiosp_seometa_analyze = aiosp_seometa_post_meta_analyze( 'All in One SEO Pack', 'Genesis' );
579
+ printf( '<p><b>%d</b> Compatible Records were identified</p>', $aiosp_seometa_analyze->update );
580
+ /**/
581
+
582
+ /**
583
+ * Delete all SEO data, from every platform
584
+ */
585
+ /*
586
+ foreach ( $_aiosp_seometa_platforms as $platform => $data ) {
587
+
588
+ foreach ( $data as $field ) {
589
+ $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $field ) );
590
+ printf( '%d %s records deleted<br />', $deleted, $field );
591
  }
 
592
 
593
+ }
594
+ /**/
595
+
596
+ /**
597
+ * Query all SEO data to find the number of records to change
598
+ */
599
 
600
 
aioseop_class.php CHANGED
@@ -2,43 +2,40 @@
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;
@@ -51,45 +48,46 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
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>' .
@@ -98,8 +96,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
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>' .
@@ -108,8 +106,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
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>' .
@@ -120,600 +118,865 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
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 +987,371 @@ 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 +1359,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 +1425,71 @@ 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,1966 +1498,2837 @@ 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 ) {
@@ -3290,10 +4336,12 @@ EOF;
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 +4349,211 @@ 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 ) {
@@ -3433,33 +4563,37 @@ EOF;
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();
@@ -3470,99 +4604,116 @@ EOF;
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' ) ); ?>
@@ -3575,51 +4726,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
  }
2
  /**
3
  * @package All-in-One-SEO-Pack
4
  */
5
+
6
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' ); // Include the module base class.
7
+
 
 
 
 
8
  class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
9
+ //The main class.
10
 
11
  /** The current version of the plugin. **/
12
+ var $version = AIOSEOP_VERSION;
13
 
14
+ /** Max numbers of chars in auto-generated description */
15
+ var $maximum_description_length = 160;
16
 
17
+ /** Minimum number of chars an excerpt should be so that it can be used
18
+ * as description. Touch only if you know what you're doing
19
+ */
20
+ var $minimum_description_length = 1;
21
 
22
  /** Whether output buffering is already being used during forced title rewrites. **/
23
+ var $ob_start_detected = false;
24
 
25
+ /** The start of the title text in the head section for forced title rewrites. **/
26
+ var $title_start = - 1;
27
 
28
+ /** The end of the title text in the head section for forced title rewrites. **/
29
+ var $title_end = - 1;
30
 
31
+ /** The title before rewriting */
32
+ var $orig_title = '';
33
 
34
+ /** Filename of log file. */
35
+ var $log_file;
36
 
37
+ /** Flag whether there should be logging. */
38
+ var $do_log;
39
 
40
  var $token;
41
  var $secret;
48
 
49
  function __construct() {
50
  global $aioseop_options;
51
+ $this->log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log'; // PHP <5.3 compatibility, once we drop support we can use __DIR___
52
 
53
+ if ( ! empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] ) {
54
  $this->do_log = true;
55
+ } else {
56
  $this->do_log = false;
57
+ }
58
 
59
+ $this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME );
60
  $this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
61
 
62
+ $this->prefix = 'aiosp_'; // option prefix
63
+ $this->option_name = 'aioseop_options';
64
  $this->store_option = true;
65
+ $this->file = __FILE__; // the current file
66
+ $blog_name = esc_attr( get_bloginfo( 'name' ) );
67
  parent::__construct();
68
 
69
  $this->help_text = Array(
70
+ 'donate' => __( 'All donations support continued development of this free software.', 'all-in-one-seo-pack' ),
71
+ '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' ),
72
+ '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' ),
73
+ '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' ),
74
+ 'customize_canonical_links' => __( 'Checking this option will allow you to customize Canonical URLs for specific posts.', 'all-in-one-seo-pack' ),
75
+ 'can_set_protocol' => __( 'Set protocol for canonical URLs.', 'all-in-one-seo-pack' ),
76
+ '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' ),
77
+ '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' ),
78
+ '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' ),
79
+ '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' ),
80
+ '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' ),
81
+ 'use_static_home_info' => __( 'Checking this option uses the title, description, and keywords set on your static Front Page.', 'all-in-one-seo-pack' ),
82
+ 'togglekeywords' => __( 'This option allows you to toggle the use of Meta Keywords throughout the whole of the site.', 'all-in-one-seo-pack' ),
83
+ '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' ),
84
+ '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' ),
85
+ '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' ),
86
+ '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' ),
87
+ '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' ),
88
+ 'cap_cats' => __( 'Check this and Category Titles will have the first letter of each word capitalized.', 'all-in-one-seo-pack' ),
89
+ 'home_page_title_format' =>
90
+ __( 'This controls the format of the title tag for your Home Page.<br />The following macros are supported:', 'all-in-one-seo-pack' )
91
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
92
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
93
  __( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
96
  __( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
97
  __( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
98
  '</ul>',
99
+ 'page_title_format' =>
100
+ __( 'This controls the format of the title tag for Pages.<br />The following macros are supported:', 'all-in-one-seo-pack' )
101
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
102
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
103
  __( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
106
  __( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
107
  __( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
108
  '</ul>',
109
+ 'post_title_format' =>
110
+ __( 'This controls the format of the title tag for Posts.<br />The following macros are supported:', 'all-in-one-seo-pack' )
111
  . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
112
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
113
  __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
118
  __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
119
  __( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
120
  '</ul>',
121
+ 'category_title_format' =>
122
+ __( 'This controls the format of the title tag for Category Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
123
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
124
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
125
  __( '%category_title% - The original title of the category', 'all-in-one-seo-pack' ) . '</li><li>' .
126
  __( '%category_description% - The description of the category', 'all-in-one-seo-pack' ) . '</li></ul>',
127
+ 'archive_title_format' =>
128
+ __( 'This controls the format of the title tag for Custom Post 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
  __( '%archive_title - The original archive title given by wordpress', 'all-in-one-seo-pack' ) . '</li></ul>',
132
+ 'date_title_format' =>
133
+ __( 'This controls the format of the title tag for Date Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
134
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
135
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
136
  __( '%date% - The original archive title given by wordpress, e.g. "2007" or "2007 August"', 'all-in-one-seo-pack' ) . '</li><li>' .
137
  __( '%day% - The original archive day given by wordpress, e.g. "17"', 'all-in-one-seo-pack' ) . '</li><li>' .
138
  __( '%month% - The original archive month given by wordpress, e.g. "August"', 'all-in-one-seo-pack' ) . '</li><li>' .
139
  __( '%year% - The original archive year given by wordpress, e.g. "2007"', 'all-in-one-seo-pack' ) . '</li></ul>',
140
+ 'author_title_format' =>
141
+ __( 'This controls the format of the title tag for Author Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
142
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
143
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
144
  __( '%author% - The original archive title given by wordpress, e.g. "Steve" or "John Smith"', 'all-in-one-seo-pack' ) . '</li></ul>',
145
+ 'tag_title_format' =>
146
+ __( 'This controls the format of the title tag for Tag Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
147
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
148
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
149
  __( '%tag% - The name of the tag', 'all-in-one-seo-pack' ) . '</li></ul>',
150
+ 'search_title_format' =>
151
+ __( 'This controls the format of the title tag for the Search page.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
152
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
153
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
154
  __( '%search% - What was searched for', 'all-in-one-seo-pack' ) . '</li></ul>',
155
+ 'description_format' => __( 'This controls the format of Meta Descriptions.The following macros are supported:', 'all-in-one-seo-pack' ) .
156
+ '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
157
+ __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
158
+ __( '%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>' .
159
+ __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
160
+ __( '%wp_title% - The original wordpress title, e.g. post_title for posts', 'all-in-one-seo-pack' ) . '</li></ul>',
161
+ '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' ) .
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
+ __( '%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all-in-one-seo-pack' ) . '</li><li>' .
165
+ __( '%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all-in-one-seo-pack' ) . '</li><li>' .
166
+ __( '%404_title% - Additional 404 title input"', 'all-in-one-seo-pack' ) . '</li></ul>',
167
+ 'paged_format' => __( 'This string gets appended/prepended to titles of paged index pages (like home or archive pages).', 'all-in-one-seo-pack' )
168
+ . __( 'The following macros are supported:', 'all-in-one-seo-pack' )
169
+ . '<ul><li>' . __( '%page% - The page number', 'all-in-one-seo-pack' ) . '</li></ul>',
170
+ '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' ),
171
+ 'cpostadvanced' => __( 'This will show or hide the advanced options for SEO for Custom Post Types.', 'all-in-one-seo-pack' ),
172
+ 'cpostactive' => __( 'Use these checkboxes to select which Post Types you want to use All in One SEO Pack with.', 'all-in-one-seo-pack' ),
173
+ 'taxactive' => __( 'Use these checkboxes to select which Taxonomies you want to use All in One SEO Pack with.', 'all-in-one-seo-pack' ),
174
+ 'cposttitles' => __( 'This allows you to set the title tags for each Custom Post Type.', 'all-in-one-seo-pack' ),
175
+ 'posttypecolumns' => __( 'This lets you select which screens display the SEO Title, SEO Keywords and SEO Description columns.', 'all-in-one-seo-pack' ),
176
+ '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' ),
177
+ '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' ),
178
+ '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' ),
179
+ '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' ),
180
+ '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' ),
181
+ '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' ),
182
+ 'google_disable_profile' => __( 'Check this to remove the Google Plus field from the user profile screen.', 'all-in-one-seo-pack' ),
183
+ 'google_author_advanced' => __( 'Enable this to display advanced options for controlling Google Plus authorship information on your website.', 'all-in-one-seo-pack' ),
184
+ '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' ),
185
+ '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' ),
186
+ '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' ),
187
+ 'google_sitelinks_search' => __( 'Add markup to display the Google Sitelinks Search Box next to your search results in Google.', 'all-in-one-seo-pack' ),
188
+ 'google_set_site_name' => __( 'Add markup to tell Google the preferred name for your website.', 'all-in-one-seo-pack' ),
189
+ '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' ),
190
+ 'google_analytics_id' => __( 'Enter your Google Analytics ID here to track visitor behavior on your site using Google Analytics.', 'all-in-one-seo-pack' ),
191
+ 'ga_use_universal_analytics' => __( 'Use the new Universal Analytics tracking code for Google Analytics.', 'all-in-one-seo-pack' ),
192
+ 'ga_advanced_options' => __( 'Check to use advanced Google Analytics options.', 'all-in-one-seo-pack' ),
193
+ 'ga_domain' => __( 'Enter your domain name without the http:// to set your cookie domain.', 'all-in-one-seo-pack' ),
194
+ 'ga_multi_domain' => __( 'Use this option to enable tracking of multiple or additional domains.', 'all-in-one-seo-pack' ),
195
+ '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' ),
196
+ 'ga_anonymize_ip' => __( 'This enables support for IP Anonymization in Google Analytics.', 'all-in-one-seo-pack' ),
197
+ 'ga_display_advertising' => __( 'This enables support for the Display Advertiser Features in Google Analytics.', 'all-in-one-seo-pack' ),
198
+ 'ga_exclude_users' => __( 'Exclude logged-in users from Google Analytics tracking by role.', 'all-in-one-seo-pack' ),
199
+ 'ga_track_outbound_links' => __( 'Check this if you want to track outbound links with Google Analytics.', 'all-in-one-seo-pack' ),
200
+ 'ga_link_attribution' => __( 'This enables support for the Enhanced Link Attribution in Google Analytics.', 'all-in-one-seo-pack' ),
201
+ 'ga_enhanced_ecommerce' => __( 'This enables support for the Enhanced Ecommerce in Google Analytics.', 'all-in-one-seo-pack' ),
202
+ 'cpostnoindex' => __( 'Set the default NOINDEX setting for each Post Type.', 'all-in-one-seo-pack' ),
203
+ 'cpostnofollow' => __( 'Set the default NOFOLLOW setting for each Post Type.', 'all-in-one-seo-pack' ),
204
+ 'category_noindex' => __( 'Check this to ask search engines not to index Category Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
205
+ 'archive_date_noindex' => __( 'Check this to ask search engines not to index Date Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
206
+ 'archive_author_noindex' => __( 'Check this to ask search engines not to index Author Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
207
+ 'tags_noindex' => __( 'Check this to ask search engines not to index Tag Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
208
+ 'search_noindex' => __( 'Check this to ask search engines not to index the Search page. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
209
+ '404_noindex' => __( 'Check this to ask search engines not to index the 404 page.', 'all-in-one-seo-pack' ),
210
+ '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' ),
211
+ 'paginated_noindex' => __( 'Check this to ask search engines not to index paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
212
+ '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' ),
213
+ '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' ),
214
+ 'cpostnoodp' => __( 'Set the default noodp setting for each Post Type.', 'all-in-one-seo-pack' ),
215
+ 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for your entire site.', 'all-in-one-seo-pack' ),
216
+ 'cpostnoydir' => __( 'Set the default noydir setting for each Post Type.', 'all-in-one-seo-pack' ),
217
+ 'skip_excerpt' => __( "Check this and your Meta Descriptions won't be generated from the excerpt.", 'all-in-one-seo-pack' ),
218
+ 'generate_descriptions' => __( 'Check this and your Meta Descriptions will be auto-generated from your excerpt or content.', 'all-in-one-seo-pack' ),
219
+ 'run_shortcodes' => __( 'Check this and shortcodes will get executed for descriptions auto-generated from content.', 'all-in-one-seo-pack' ),
220
+ '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' ),
221
+ 'dont_truncate_descriptions' => __( 'Check this to prevent your Description from being truncated regardless of its length.', 'all-in-one-seo-pack' ),
222
+ 'schema_markup' => __( 'Check this to support Schema.org markup, i.e., itemprop on supported metadata.', 'all-in-one-seo-pack' ),
223
+ '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' ),
224
+ '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' ),
225
+ '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' ),
226
+ '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' ),
227
+ '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' ),
228
+ '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' ),
229
  );
230
 
231
  $this->help_anchors = Array(
232
+ 'license_key' => '#license-key',
233
+ 'can' => '#canonical-urls',
234
+ 'no_paged_canonical_links' => '#no-pagination-for-canonical-urls',
235
+ 'customize_canonical_links' => '#enable-custom-canonical-urls',
236
+ 'use_original_title' => '#use-original-title',
237
+ 'schema_markup' => '#use-schema-markup',
238
+ 'do_log' => '#log-important-events',
239
+ 'home_title' => '#home-title',
240
+ 'home_description' => '#home-description',
241
+ 'home_keywords' => '#home-keywords',
242
+ 'togglekeywords' => '#use-keywords',
243
+ 'use_categories' => '#use-categories-for-meta-keywords',
244
+ 'use_tags_as_keywords' => '#use-tags-for-meta-keywords',
245
+ 'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page',
246
+ 'rewrite_titles' => '#rewrite-titles',
247
+ 'cap_titles' => '#capitalize-titles',
248
+ 'home_page_title_format' => '#title-format-fields',
249
+ 'page_title_format' => '#title-format-fields',
250
+ 'post_title_format' => '#title-format-fields',
251
+ 'category_title_format' => '#title-format-fields',
252
+ 'archive_title_format' => '#title-format-fields',
253
+ 'date_title_format' => '#title-format-fields',
254
+ 'author_title_format' => '#title-format-fields',
255
+ 'tag_title_format' => '#title-format-fields',
256
+ 'search_title_format' => '#title-format-fields',
257
+ '404_title_format' => '#title-format-fields',
258
+ 'enablecpost' => '#seo-for-custom-post-types',
259
+ 'cpostadvanced' => '#enable-advanced-options',
260
+ 'cpostactive' => '#seo-on-only-these-post-types',
261
+ 'taxactive' => '#seo-on-only-these-taxonomies',
262
+ 'cposttitles' => '#custom-titles',
263
+ 'posttypecolumns' => '#show-column-labels-for-custom-post-types',
264
+ 'admin_bar' => '#display-menu-in-admin-bar',
265
+ 'custom_menu_order' => '#display-menu-at-the-top',
266
+ 'google_verify' => '',
267
+ 'bing_verify' => '',
268
+ 'pinterest_verify' => '',
269
+ 'google_publisher' => '#google-plus-default-profile',
270
+ 'google_disable_profile' => '#disable-google-plus-profile',
271
+ 'google_author_advanced' => '#advanced-authorship-options',
272
+ 'google_author_location' => '#display-google-authorship',
273
+ 'google_enable_publisher' => '#display-publisher-meta-on-front-page',
274
+ 'google_specify_publisher' => '#specify-publisher-url',
275
+ 'google_analytics_id' => 'http://semperplugins.com/documentation/setting-up-google-analytics/',
276
+ 'ga_use_universal_analytics' => '#use-universal-analytics',
277
+ 'ga_domain' => '#tracking-domain',
278
+ 'ga_multi_domain' => '#track-multiple-domains-additional-domains',
279
+ 'ga_addl_domains' => '#track-multiple-domains-additional-domains',
280
+ 'ga_anonymize_ip' => '#anonymize-ip-addresses',
281
+ 'ga_display_advertising' => '#display-advertiser-tracking',
282
+ 'ga_exclude_users' => '#exclude-users-from-tracking',
283
+ 'ga_track_outbound_links' => '#track-outbound-links',
284
+ 'ga_link_attribution' => '#enhanced-link-attribution',
285
+ 'ga_enhanced_ecommerce' => '#enhanced-ecommerce',
286
+ 'cpostnoindex' => '#use-noindex-for-paginated-pages-posts',
287
+ 'cpostnofollow' => '#use-nofollow-for-paginated-pages-posts',
288
+ 'noodp' => '#exclude-site-from-the-open-directory-project',
289
+ 'noydir' => '#exclude-site-from-yahoo-directory',
290
+ 'generate_descriptions' => '#autogenerate-descriptions',
291
+ 'run_shortcodes' => '#run-shortcodes-in-autogenerated-descriptions',
292
  'hide_paginated_descriptions' => '#remove-descriptions-for-paginated-pages',
293
+ 'dont_truncate_descriptions' => '#never-shorten-long-descriptions',
294
+ 'unprotect_meta' => '#unprotect-post-meta-fields',
295
+ 'ex_pages' => '#exclude-pages',
296
+ 'post_meta_tags' => '#additional-post-headers',
297
+ 'page_meta_tags' => '#additional-page-headers',
298
+ 'front_meta_tags' => '#additional-front-page-headers',
299
+ 'home_meta_tags' => '#additional-blog-page-headers'
300
  );
301
 
302
  $meta_help_text = Array(
303
+ 'snippet' => __( 'A preview of what this page might look like in search engine results.', 'all-in-one-seo-pack' ),
304
+ 'title' => __( 'A custom title that shows up in the title tag for this page.', 'all-in-one-seo-pack' ),
305
+ 'description' => __( 'The META description for this page. This will override any autogenerated descriptions.', 'all-in-one-seo-pack' ),
306
+ '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' ),
307
+ 'custom_link' => __( 'Override the canonical URLs for this post.', 'all-in-one-seo-pack' ),
308
+ 'noindex' => __( 'Check this box to ask search engines not to index this page.', 'all-in-one-seo-pack' ),
309
+ 'nofollow' => __( 'Check this box to ask search engines not to follow links from this page.', 'all-in-one-seo-pack' ),
310
+ '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' ),
311
+ 'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for this page.', 'all-in-one-seo-pack' ),
312
+ 'titleatr' => __( 'Set the title attribute for menu links.', 'all-in-one-seo-pack' ),
313
+ 'menulabel' => __( 'Set the label for this page menu item.', 'all-in-one-seo-pack' ),
314
+ 'sitemap_exclude' => __( "Don't display this page in the sitemap.", 'all-in-one-seo-pack' ),
315
+ 'disable' => __( 'Disable SEO on this page.', 'all-in-one-seo-pack' ),
316
+ 'disable_analytics' => __( 'Disable Google Analytics on this page.', 'all-in-one-seo-pack' )
317
  );
318
 
319
  $this->default_options = array(
320
+ 'license_key' => Array(
321
  'name' => __( 'License Key:', 'all-in-one-seo-pack' ),
322
+ 'type' => 'text'
323
+ ),
324
+ 'donate' => Array(
325
+ 'name' => __( 'I enjoy this plugin and have made a donation:', 'all-in-one-seo-pack' )
326
+ ),
327
+ 'home_title' => Array(
328
+ 'name' => __( 'Home Title:', 'all-in-one-seo-pack' ),
329
+ 'default' => null,
330
+ 'type' => 'textarea',
331
+ 'sanitize' => 'text',
332
+ 'count' => true,
333
+ 'rows' => 1,
334
+ 'cols' => 60,
335
+ 'condshow' => Array( 'aiosp_use_static_home_info' => 0 )
336
+ ),
337
+ 'home_description' => Array(
338
+ 'name' => __( 'Home Description:', 'all-in-one-seo-pack' ),
339
+ 'default' => '',
340
+ 'type' => 'textarea',
341
+ 'sanitize' => 'text',
342
+ 'count' => true,
343
+ 'cols' => 80,
344
+ 'rows' => 2,
345
+ 'condshow' => Array( 'aiosp_use_static_home_info' => 0 )
346
+ ),
347
+ 'togglekeywords' => Array(
348
+ 'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ),
349
+ 'default' => 1,
350
+ 'type' => 'radio',
351
+ 'initial_options' => Array(
352
+ 0 => __( 'Enabled', 'all-in-one-seo-pack' ),
353
+ 1 => __( 'Disabled', 'all-in-one-seo-pack' )
354
+ )
355
+ ),
356
+ 'home_keywords' => Array(
357
+ 'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ),
358
+ 'default' => null,
359
+ 'type' => 'textarea',
360
+ 'sanitize' => 'text',
361
+ 'condshow' => Array( 'aiosp_togglekeywords' => 0, 'aiosp_use_static_home_info' => 0 )
362
+ ),
363
+ 'use_static_home_info' => Array(
364
+ 'name' => __( 'Use Static Front Page Instead', 'all-in-one-seo-pack' ),
365
+ 'default' => 0,
366
+ 'type' => 'radio',
367
+ 'initial_options' => Array(
368
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
369
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
370
+ )
371
+ ),
372
+ 'can' => Array(
373
+ 'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ),
374
+ 'default' => 1
375
+ ),
376
+ 'no_paged_canonical_links' => Array(
377
+ 'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ),
378
+ 'default' => 0,
379
+ 'condshow' => Array( 'aiosp_can' => 'on' )
380
+ ),
381
+ 'customize_canonical_links' => Array(
382
+ 'name' => __( 'Enable Custom Canonical URLs:', 'all-in-one-seo-pack' ),
383
+ 'default' => 0,
384
+ 'condshow' => Array( 'aiosp_can' => 'on' )
385
+ ),
386
+ 'can_set_protocol' => Array(
387
+ 'name' => __( 'Set Protocol For Canonical URLs:', 'all-in-one-seo-pack' ),
388
+ 'type' => 'radio',
389
+ 'default' => 'auto',
390
+ 'initial_options' => Array(
391
+ 'auto' => __( 'Auto', 'all-in-one-seo-pack' ),
392
+ 'http' => __( 'HTTP', 'all-in-one-seo-pack' ),
393
+ 'https' => __( 'HTTPS', 'all-in-one-seo-pack' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  ),
395
+ 'condshow' => Array( 'aiosp_can' => 'on' )
396
+ ),
397
+ 'rewrite_titles' => Array(
398
+ 'name' => __( 'Rewrite Titles:', 'all-in-one-seo-pack' ),
399
+ 'default' => 1,
400
+ 'type' => 'radio',
401
+ 'initial_options' => Array(
402
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
403
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
404
+ )
405
+ ),
406
+ 'force_rewrites' => Array(
407
+ 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
408
+ 'default' => 1,
409
+ 'type' => 'hidden',
410
+ 'prefix' => $this->prefix,
411
+ 'initial_options' => Array(
412
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
413
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
414
+ )
415
+ ),
416
+ 'use_original_title' => Array(
417
+ 'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ),
418
+ 'type' => 'radio',
419
+ 'default' => 0,
420
+ 'initial_options' => Array(
421
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
422
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
423
+ )
424
+ ),
425
+ 'cap_titles' => Array(
426
+ 'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ),
427
+ 'default' => 1
428
+ ),
429
+ 'cap_cats' => Array(
430
+ 'name' => __( 'Capitalize Category Titles:', 'all-in-one-seo-pack' ),
431
+ 'default' => 1
432
+ ),
433
+ 'home_page_title_format' => Array(
434
+ 'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
435
+ 'type' => 'text',
436
+ 'default' => '%page_title%',
437
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
438
+ ),
439
+ 'page_title_format' => Array(
440
+ 'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ),
441
+ 'type' => 'text',
442
+ 'default' => '%page_title% | %blog_title%',
443
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
444
+ ),
445
+ 'post_title_format' => Array(
446
+ 'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ),
447
+ 'type' => 'text',
448
+ 'default' => '%post_title% | %blog_title%',
449
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
450
+ ),
451
+ 'category_title_format' => Array(
452
+ 'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ),
453
+ 'type' => 'text',
454
+ 'default' => '%category_title% | %blog_title%',
455
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
456
+ ),
457
+ 'archive_title_format' => Array(
458
+ 'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ),
459
+ 'type' => 'text',
460
+ 'default' => '%archive_title% | %blog_title%',
461
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
462
+ ),
463
+ 'date_title_format' => Array(
464
+ 'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ),
465
+ 'type' => 'text',
466
+ 'default' => '%date% | %blog_title%',
467
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
468
+ ),
469
+ 'author_title_format' => Array(
470
+ 'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ),
471
+ 'type' => 'text',
472
+ 'default' => '%author% | %blog_title%',
473
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
474
+ ),
475
+ 'tag_title_format' => Array(
476
+ 'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ),
477
+ 'type' => 'text',
478
+ 'default' => '%tag% | %blog_title%',
479
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
480
+ ),
481
+ 'search_title_format' => Array(
482
+ 'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ),
483
+ 'type' => 'text',
484
+ 'default' => '%search% | %blog_title%',
485
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
486
+ ),
487
+ 'description_format' => Array(
488
+ 'name' => __( 'Description Format', 'all-in-one-seo-pack' ),
489
+ 'type' => 'text',
490
+ 'default' => '%description%',
491
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
492
+ ),
493
+ '404_title_format' => Array(
494
+ 'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ),
495
+ 'type' => 'text',
496
+ 'default' => 'Nothing found for %request_words%',
497
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
498
+ ),
499
+ 'paged_format' => Array(
500
+ 'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ),
501
+ 'type' => 'text',
502
+ 'default' => ' - Part %page%',
503
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1 )
504
+ ),
505
+ 'enablecpost' => Array(
506
+ 'name' => __( 'SEO for Custom Post Types:', 'all-in-one-seo-pack' ),
507
+ 'default' => 'on',
508
+ 'type' => 'radio',
509
+ 'initial_options' => Array(
510
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
511
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
512
+ )
513
+ ),
514
+ 'cpostactive' => Array(
515
+ 'name' => __( 'SEO on only these post types:', 'all-in-one-seo-pack' ),
516
+ 'type' => 'multicheckbox',
517
+ 'default' => array( 'post', 'page' ),
518
  'condshow' => Array( 'aiosp_enablecpost' => 'on' )
519
+ ),
520
+ 'taxactive' => Array(
521
+ 'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ),
522
+ 'type' => 'multicheckbox',
523
+ 'default' => array( 'category', 'post_tag' ),
524
  'condshow' => Array( 'aiosp_enablecpost' => 'on' )
525
+ ),
526
+ 'cpostadvanced' => Array(
527
+ 'name' => __( 'Enable Advanced Options:', 'all-in-one-seo-pack' ),
528
+ 'default' => 0,
529
+ 'type' => 'radio',
530
+ 'initial_options' => Array(
531
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
532
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
533
  ),
534
+ 'label' => null,
535
+ 'condshow' => Array( 'aiosp_enablecpost' => 'on' )
536
+ ),
537
+ 'cpostnoindex' => Array(
538
+ 'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ),
539
+ 'type' => 'multicheckbox',
540
+ 'default' => array(),
541
+ ),
542
+ 'cpostnofollow' => Array(
543
+ 'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ),
544
+ 'type' => 'multicheckbox',
545
+ 'default' => array(),
546
+ ),
547
+ 'cpostnoodp' => Array(
548
+ 'name' => __( 'Default to NOODP:', 'all-in-one-seo-pack' ),
549
+ 'type' => 'multicheckbox',
550
+ 'default' => array(),
551
+ ),
552
+ 'cpostnoydir' => Array(
553
+ 'name' => __( 'Default to NOYDIR:', 'all-in-one-seo-pack' ),
554
+ 'type' => 'multicheckbox',
555
+ 'default' => array(),
556
+ ),
557
+ 'cposttitles' => Array(
558
+ 'name' => __( 'Custom titles:', 'all-in-one-seo-pack' ),
559
+ 'type' => 'checkbox',
560
+ 'default' => 0,
561
+ 'condshow' => Array(
562
+ 'aiosp_rewrite_titles' => 1,
563
+ 'aiosp_enablecpost' => 'on',
564
+ 'aiosp_cpostadvanced' => 'on'
565
+ )
566
+ ),
567
+ 'posttypecolumns' => Array(
568
+ 'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ),
569
+ 'type' => 'multicheckbox',
570
+ 'default' => array( 'post', 'page' ),
571
+ 'condshow' => Array( 'aiosp_enablecpost' => 'on' )
572
+ ),
573
+ 'admin_bar' => Array(
574
+ 'name' => __( 'Display Menu In Admin Bar:', 'all-in-one-seo-pack' ),
575
+ 'default' => 'on',
576
+ ),
577
+ 'custom_menu_order' => Array(
578
+ 'name' => __( 'Display Menu At The Top:', 'all-in-one-seo-pack' ),
579
+ 'default' => 'on',
580
+ ),
581
+ 'google_verify' => Array(
582
+ 'name' => __( 'Google Webmaster Tools:', 'all-in-one-seo-pack' ),
583
+ 'default' => '',
584
+ 'type' => 'text'
585
+ ),
586
+ 'bing_verify' => Array(
587
+ 'name' => __( 'Bing Webmaster Center:', 'all-in-one-seo-pack' ),
588
+ 'default' => '',
589
+ 'type' => 'text'
590
+ ),
591
+ 'pinterest_verify' => Array(
592
+ 'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ),
593
+ 'default' => '',
594
+ 'type' => 'text'
595
+ ),
596
+ 'google_publisher' => Array(
597
+ 'name' => __( 'Google Plus Default Profile:', 'all-in-one-seo-pack' ),
598
+ 'default' => '',
599
+ 'type' => 'text'
600
+ ),
601
+ 'google_disable_profile' => Array(
602
+ 'name' => __( 'Disable Google Plus Profile:', 'all-in-one-seo-pack' ),
603
+ 'default' => 0,
604
+ 'type' => 'checkbox'
605
+ ),
606
+ 'google_sitelinks_search' => Array(
607
+ 'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' )
608
+ ),
609
+ 'google_set_site_name' => Array(
610
+ 'name' => __( 'Set Preferred Site Name:', 'all-in-one-seo-pack' )
611
+ ),
612
+ 'google_specify_site_name' => Array(
613
+ 'name' => __( 'Specify A Preferred Name:', 'all-in-one-seo-pack' ),
614
+ 'type' => 'text',
615
+ 'placeholder' => $blog_name,
616
+ 'condshow' => Array( 'aiosp_google_set_site_name' => 'on' )
617
+ ),
618
+ 'google_author_advanced' => Array(
619
+ 'name' => __( 'Advanced Authorship Options:', 'all-in-one-seo-pack' ),
620
+ 'default' => 0,
621
+ 'type' => 'radio',
622
+ 'initial_options' => Array(
623
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
624
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
625
  ),
626
+ 'label' => null
627
+ ),
628
+ 'google_author_location' => Array(
629
+ 'name' => __( 'Display Google Authorship:', 'all-in-one-seo-pack' ),
630
+ 'default' => array( 'all' ),
631
+ 'type' => 'multicheckbox',
632
  'condshow' => Array( 'aiosp_google_author_advanced' => 'on' )
633
+ ),
634
+ 'google_enable_publisher' => Array(
635
+ 'name' => __( 'Display Publisher Meta on Front Page:', 'all-in-one-seo-pack' ),
636
+ 'default' => 'on',
637
+ 'type' => 'radio',
638
+ 'initial_options' => Array(
639
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
640
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
641
  ),
642
+ 'condshow' => Array( 'aiosp_google_author_advanced' => 'on' )
643
+ ),
644
+ 'google_specify_publisher' => Array(
645
+ 'name' => __( 'Specify Publisher URL:', 'all-in-one-seo-pack' ),
646
+ 'type' => 'text',
647
+ 'condshow' => Array( 'aiosp_google_author_advanced' => 'on', 'aiosp_google_enable_publisher' => 'on' )
648
+ ),
649
  // "google_connect"=>Array( 'name' => __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ), ),
650
+ 'google_analytics_id' => Array(
651
+ 'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ),
652
+ 'default' => null,
653
+ 'type' => 'text',
654
+ 'placeholder' => 'UA-########-#'
655
+ ),
656
+ 'ga_use_universal_analytics' => Array(
657
+ 'name' => __( 'Use Universal Analytics:', 'all-in-one-seo-pack' ),
658
+ 'default' => 0,
659
+ 'condshow' => Array(
660
+ 'aiosp_google_analytics_id' => Array(
661
+ 'lhs' => 'aiosp_google_analytics_id',
662
+ 'op' => '!=',
663
+ 'rhs' => ''
664
+ )
665
+ )
666
+ ),
667
+ 'ga_advanced_options' => Array(
668
+ 'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ),
669
+ 'default' => 'on',
670
+ 'type' => 'radio',
671
+ 'initial_options' => Array(
672
+ 'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
673
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  ),
675
+ 'condshow' => Array(
676
+ 'aiosp_google_analytics_id' => Array(
677
+ 'lhs' => 'aiosp_google_analytics_id',
678
+ 'op' => '!=',
679
+ 'rhs' => ''
680
+ )
681
+ )
682
+ ),
683
+ 'ga_domain' => Array(
684
+ 'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ),
685
+ 'type' => 'text',
686
+ 'condshow' => Array(
687
+ 'aiosp_google_analytics_id' => Array(
688
+ 'lhs' => 'aiosp_google_analytics_id',
689
+ 'op' => '!=',
690
+ 'rhs' => ''
691
+ ),
692
+ 'aiosp_ga_advanced_options' => 'on'
693
+ )
694
+ ),
695
+ 'ga_multi_domain' => Array(
696
+ 'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ),
697
+ 'default' => 0,
698
+ 'condshow' => Array(
699
+ 'aiosp_google_analytics_id' => Array(
700
+ 'lhs' => 'aiosp_google_analytics_id',
701
+ 'op' => '!=',
702
+ 'rhs' => ''
703
+ ),
704
+ 'aiosp_ga_advanced_options' => 'on'
705
+ )
706
+ ),
707
+ 'ga_addl_domains' => Array(
708
+ 'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ),
709
+ 'type' => 'textarea',
710
+ 'condshow' => Array(
711
+ 'aiosp_google_analytics_id' => Array(
712
+ 'lhs' => 'aiosp_google_analytics_id',
713
+ 'op' => '!=',
714
+ 'rhs' => ''
715
+ ),
716
+ 'aiosp_ga_advanced_options' => 'on',
717
+ 'aiosp_ga_multi_domain' => 'on'
718
+ )
719
+ ),
720
+ 'ga_anonymize_ip' => Array(
721
+ 'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ),
722
+ 'type' => 'checkbox',
723
+ 'condshow' => Array(
724
+ 'aiosp_google_analytics_id' => Array(
725
+ 'lhs' => 'aiosp_google_analytics_id',
726
+ 'op' => '!=',
727
+ 'rhs' => ''
728
+ ),
729
+ 'aiosp_ga_advanced_options' => 'on'
730
+ )
731
+ ),
732
+ 'ga_display_advertising' => Array(
733
+ 'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ),
734
+ 'type' => 'checkbox',
735
+ 'condshow' => Array(
736
+ 'aiosp_google_analytics_id' => Array(
737
+ 'lhs' => 'aiosp_google_analytics_id',
738
+ 'op' => '!=',
739
+ 'rhs' => ''
740
+ ),
741
+ 'aiosp_ga_advanced_options' => 'on'
742
+ )
743
+ ),
744
+ 'ga_exclude_users' => Array(
745
+ 'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ),
746
+ 'type' => 'multicheckbox',
747
+ 'condshow' => Array(
748
+ 'aiosp_google_analytics_id' => Array(
749
+ 'lhs' => 'aiosp_google_analytics_id',
750
+ 'op' => '!=',
751
+ 'rhs' => ''
752
+ ),
753
+ 'aiosp_ga_advanced_options' => 'on'
754
+ )
755
+ ),
756
+ 'ga_track_outbound_links' => Array(
757
+ 'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ),
758
+ 'default' => 0,
759
+ 'condshow' => Array(
760
+ 'aiosp_google_analytics_id' => Array(
761
+ 'lhs' => 'aiosp_google_analytics_id',
762
+ 'op' => '!=',
763
+ 'rhs' => ''
764
+ ),
765
+ 'aiosp_ga_advanced_options' => 'on'
766
+ )
767
+ ),
768
+ 'ga_link_attribution' => Array(
769
+ 'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ),
770
+ 'default' => 0,
771
+ 'condshow' => Array(
772
+ 'aiosp_google_analytics_id' => Array(
773
+ 'lhs' => 'aiosp_google_analytics_id',
774
+ 'op' => '!=',
775
+ 'rhs' => ''
776
+ ),
777
+ 'aiosp_ga_advanced_options' => 'on'
778
+ )
779
+ ),
780
+ 'ga_enhanced_ecommerce' => Array(
781
+ 'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ),
782
+ 'default' => 0,
783
+ 'condshow' => Array(
784
+ 'aiosp_google_analytics_id' => Array(
785
+ 'lhs' => 'aiosp_google_analytics_id',
786
+ 'op' => '!=',
787
+ 'rhs' => ''
788
+ ),
789
+ 'aiosp_ga_use_universal_analytics' => 'on',
790
+ 'aiosp_ga_advanced_options' => 'on'
791
+ )
792
+ ),
793
+ 'use_categories' => Array(
794
+ 'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ),
795
+ 'default' => 0,
796
+ 'condshow' => Array( 'aiosp_togglekeywords' => 0 )
797
+ ),
798
+ 'use_tags_as_keywords' => Array(
799
+ 'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ),
800
+ 'default' => 1,
801
+ 'condshow' => Array( 'aiosp_togglekeywords' => 0 )
802
+ ),
803
+ 'dynamic_postspage_keywords' => Array(
804
+ 'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ),
805
+ 'default' => 1,
806
+ 'condshow' => Array( 'aiosp_togglekeywords' => 0 )
807
+ ),
808
+ 'category_noindex' => Array(
809
+ 'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ),
810
+ 'default' => 1
811
+ ),
812
+ 'archive_date_noindex' => Array(
813
+ 'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ),
814
+ 'default' => 1
815
+ ),
816
+ 'archive_author_noindex' => Array(
817
+ 'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ),
818
+ 'default' => 1
819
+ ),
820
+ 'tags_noindex' => Array(
821
+ 'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ),
822
+ 'default' => 0
823
+ ),
824
+ 'search_noindex' => Array(
825
+ 'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ),
826
+ 'default' => 0
827
+ ),
828
+ '404_noindex' => Array(
829
+ 'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ),
830
+ 'default' => 0
831
+ ),
832
+ 'tax_noindex' => Array(
833
+ 'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ),
834
+ 'type' => 'multicheckbox',
835
+ 'default' => array(),
836
+ 'condshow' => Array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' )
837
+ ),
838
+ 'paginated_noindex' => Array(
839
+ 'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ),
840
+ 'default' => 0
841
+ ),
842
+ 'paginated_nofollow' => Array(
843
+ 'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ),
844
+ 'default' => 0
845
+ ),
846
+ 'noodp' => Array(
847
+ 'name' => __( 'Exclude site from the Open Directory Project:', 'all-in-one-seo-pack' ),
848
+ 'default' => 0
849
+ ),
850
+ 'noydir' => Array(
851
+ 'name' => __( 'Exclude site from Yahoo! Directory:', 'all-in-one-seo-pack' ),
852
+ 'default' => 0
853
+ ),
854
+ 'skip_excerpt' => Array(
855
+ 'name' => __( 'Avoid Using The Excerpt In Descriptions:', 'all-in-one-seo-pack' ),
856
+ 'default' => 0
857
+ ),
858
+ 'generate_descriptions' => Array(
859
+ 'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ),
860
+ 'default' => 1
861
+ ),
862
+ 'run_shortcodes' => Array(
863
+ 'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ),
864
+ 'default' => 0,
865
+ 'condshow' => Array( 'aiosp_generate_descriptions' => 'on' )
866
+ ),
867
+ 'hide_paginated_descriptions' => Array(
868
+ 'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ),
869
+ 'default' => 0
870
+ ),
871
+ 'dont_truncate_descriptions' => Array(
872
+ 'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ),
873
+ 'default' => 0
874
+ ),
875
+ 'schema_markup' => Array(
876
+ 'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ),
877
+ 'default' => 1
878
+ ),
879
+ 'unprotect_meta' => Array(
880
+ 'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ),
881
+ 'default' => 0
882
+ ),
883
+ 'ex_pages' => Array(
884
+ 'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ),
885
+ 'type' => 'textarea',
886
+ 'default' => ''
887
+ ),
888
+ 'post_meta_tags' => Array(
889
+ 'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ),
890
+ 'type' => 'textarea',
891
+ 'default' => '',
892
+ 'sanitize' => 'default'
893
+ ),
894
+ 'page_meta_tags' => Array(
895
+ 'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ),
896
+ 'type' => 'textarea',
897
+ 'default' => '',
898
+ 'sanitize' => 'default'
899
+ ),
900
+ 'front_meta_tags' => Array(
901
+ 'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ),
902
+ 'type' => 'textarea',
903
+ 'default' => '',
904
+ 'sanitize' => 'default'
905
+ ),
906
+ 'home_meta_tags' => Array(
907
+ 'name' => __( 'Additional Blog Page Headers:', 'all-in-one-seo-pack' ),
908
+ 'type' => 'textarea',
909
+ 'default' => '',
910
+ 'sanitize' => 'default'
911
+ ),
912
+ 'do_log' => Array(
913
+ 'name' => __( 'Log important events:', 'all-in-one-seo-pack' ),
914
+ 'default' => null
915
+ ),
916
+ );
917
 
918
+ if ( AIOSEOPPRO ) {
919
+ unset( $this->default_options['donate'] );
920
+ } else {
921
+ unset( $this->default_options['license_key'] );
922
+ unset( $this->default_options['taxactive'] );
923
+ }
924
+
925
+ $this->locations = Array(
926
+ 'default' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings', 'options' => null ),
927
+ 'aiosp' => Array(
928
+ 'name' => $this->plugin_name,
929
+ 'type' => 'metabox',
930
+ 'prefix' => '',
931
+ 'help_link' => 'http://semperplugins.com/sections/postpage-settings/',
932
+ 'options' => Array(
933
+ 'edit',
934
+ 'nonce-aioseop-edit',
935
+ AIOSEOPPRO ? 'support' : 'upgrade',
936
+ 'snippet',
937
+ 'title',
938
+ 'description',
939
+ 'keywords',
940
+ 'custom_link',
941
+ 'noindex',
942
+ 'nofollow',
943
+ 'noodp',
944
+ 'noydir',
945
+ 'titleatr',
946
+ 'menulabel',
947
+ 'sitemap_exclude',
948
+ 'disable',
949
+ 'disable_analytics'
950
+ ),
951
+ 'default_options' => Array(
952
+ 'edit' => Array(
953
+ 'type' => 'hidden',
954
+ 'default' => 'aiosp_edit',
955
+ 'prefix' => true,
956
+ 'nowrap' => 1
957
+ ),
958
+ 'nonce-aioseop-edit' => Array(
959
+ 'type' => 'hidden',
960
+ 'default' => null,
961
+ 'prefix' => false,
962
+ 'nowrap' => 1
963
+ ),
964
+ 'upgrade' => Array(
965
+ 'type' => 'html',
966
+ 'label' => 'none',
967
+ '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' )
968
+ ),
969
+ 'support' => Array(
970
+ 'type' => 'html',
971
+ 'label' => 'none',
972
+ 'default' => '<a target="_blank" href="http://semperplugins.com/support/">'
973
+ . __( 'Support Forum', 'all-in-one-seo-pack' ) . '</a>'
974
+ ),
975
+ 'snippet' => Array(
976
+ 'name' => __( 'Preview Snippet', 'all-in-one-seo-pack' ),
977
+ 'type' => 'custom',
978
+ 'label' => 'top',
979
+ 'default' => '
980
  <script>
981
  jQuery(document).ready(function() {
982
  jQuery("#aiosp_title_wrapper").bind("input", function() {
987
  });
988
  });
989
  </script>
990
+ <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>'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  ),
992
+ 'title' => Array(
993
+ 'name' => __( 'Title', 'all-in-one-seo-pack' ),
994
+ 'type' => 'text',
995
+ 'count' => true,
996
+ 'size' => 60
997
  ),
998
+ 'description' => Array(
999
+ 'name' => __( 'Description', 'all-in-one-seo-pack' ),
1000
+ 'type' => 'textarea',
1001
+ 'count' => true,
1002
+ 'cols' => 80,
1003
+ 'rows' => 2
1004
  ),
1005
+
1006
+ 'keywords' => Array(
1007
+ 'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ),
1008
+ 'type' => 'text'
1009
  ),
1010
+ 'custom_link' => Array(
1011
+ 'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ),
1012
+ 'type' => 'text',
1013
+ 'size' => 60
1014
  ),
1015
+ 'noindex' => Array(
1016
+ 'name' => __( 'Robots Meta NOINDEX', 'all-in-one-seo-pack' ),
1017
+ 'default' => ''
 
1018
  ),
1019
+ 'nofollow' => Array(
1020
+ 'name' => __( 'Robots Meta NOFOLLOW', 'all-in-one-seo-pack' ),
1021
+ 'default' => ''
 
 
 
1022
  ),
1023
+ 'noodp' => Array( 'name' => __( 'Robots Meta NOODP', 'all-in-one-seo-pack' ) ),
1024
+ 'noydir' => Array( 'name' => __( 'Robots Meta NOYDIR', 'all-in-one-seo-pack' ) ),
1025
+ 'titleatr' => Array(
1026
+ 'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ),
1027
+ 'type' => 'text',
1028
+ 'size' => 60
1029
  ),
1030
+ 'menulabel' => Array(
1031
+ 'name' => __( 'Menu Label', 'all-in-one-seo-pack' ),
1032
+ 'type' => 'text',
1033
+ 'size' => 60
1034
  ),
1035
+ 'sitemap_exclude' => Array( 'name' => __( 'Exclude From Sitemap', 'all-in-one-seo-pack' ) ),
1036
+ 'disable' => Array( 'name' => __( 'Disable on this page/post', 'all-in-one-seo-pack' ) ),
1037
+ 'disable_analytics' => Array(
1038
+ 'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ),
1039
+ 'condshow' => Array( 'aiosp_disable' => 'on' )
1040
  )
1041
+ ),
1042
+ 'display' => null
1043
+ )
1044
+ );
1045
 
1046
+ if ( ! empty( $meta_help_text ) ) {
1047
+ foreach ( $meta_help_text as $k => $v ) {
1048
+ $this->locations['aiosp']['default_options'][ $k ]['help_text'] = $v;
1049
+ }
1050
+ }
1051
+
1052
+ $this->layout = Array(
1053
+ 'default' => Array(
1054
+ 'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
1055
+ 'help_link' => 'http://semperplugins.com/documentation/general-settings/',
1056
+ 'options' => Array() // this is set below, to the remaining options -- pdb
1057
+ ),
1058
+ 'home' => Array(
1059
+ 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
1060
+ 'help_link' => 'http://semperplugins.com/documentation/home-page-settings/',
1061
+ 'options' => Array( 'home_title', 'home_description', 'home_keywords', 'use_static_home_info' )
1062
+ ),
1063
+ 'title' => Array(
1064
+ 'name' => __( 'Title Settings', 'all-in-one-seo-pack' ),
1065
+ 'help_link' => 'http://semperplugins.com/documentation/title-settings/',
1066
+ 'options' => Array(
1067
+ 'rewrite_titles',
1068
+ 'force_rewrites',
1069
+ 'cap_titles',
1070
+ 'cap_cats',
1071
+ 'home_page_title_format',
1072
+ 'page_title_format',
1073
+ 'post_title_format',
1074
+ 'category_title_format',
1075
+ 'archive_title_format',
1076
+ 'date_title_format',
1077
+ 'author_title_format',
1078
+ 'tag_title_format',
1079
+ 'search_title_format',
1080
+ 'description_format',
1081
+ '404_title_format',
1082
+ 'paged_format'
1083
+ )
1084
+ ),
1085
+ 'cpt' => Array(
1086
+ 'name' => __( 'Custom Post Type Settings', 'all-in-one-seo-pack' ),
1087
+ 'help_link' => 'http://semperplugins.com/documentation/custom-post-type-settings/',
1088
+ 'options' => Array( 'enablecpost', 'cpostadvanced', 'taxactive', 'cpostactive', 'cposttitles' )
1089
+ ),
1090
+ 'display' => Array(
1091
+ 'name' => __( 'Display Settings', 'all-in-one-seo-pack' ),
1092
+ 'help_link' => 'http://semperplugins.com/documentation/display-settings/',
1093
+ 'options' => Array( 'posttypecolumns', 'admin_bar', 'custom_menu_order' )
1094
+ ),
1095
+ 'webmaster' => Array(
1096
+ 'name' => __( 'Webmaster Verification', 'all-in-one-seo-pack' ),
1097
+ 'help_link' => 'http://semperplugins.com/sections/webmaster-verification/',
1098
+ 'options' => Array( 'google_verify', 'bing_verify', 'pinterest_verify' )
1099
+ ),
1100
+ 'google' => Array(
1101
+ 'name' => __( 'Google Settings', 'all-in-one-seo-pack' ),
1102
+ 'help_link' => 'http://semperplugins.com/documentation/google-settings/',
1103
+ 'options' => Array(
1104
+ 'google_publisher',
1105
+ 'google_disable_profile',
1106
+ 'google_sitelinks_search',
1107
+ 'google_set_site_name',
1108
+ 'google_specify_site_name',
1109
+ 'google_author_advanced',
1110
+ 'google_author_location',
1111
+ 'google_enable_publisher',
1112
+ 'google_specify_publisher',
1113
+ // "google_connect",
1114
+ 'google_analytics_id',
1115
+ 'ga_use_universal_analytics',
1116
+ 'ga_advanced_options',
1117
+ 'ga_domain',
1118
+ 'ga_multi_domain',
1119
+ 'ga_addl_domains',
1120
+ 'ga_anonymize_ip',
1121
+ 'ga_display_advertising',
1122
+ 'ga_exclude_users',
1123
+ 'ga_track_outbound_links',
1124
+ 'ga_link_attribution',
1125
+ 'ga_enhanced_ecommerce'
1126
+ )
1127
+ ),
1128
+ 'noindex' => Array(
1129
+ 'name' => __( 'Noindex Settings', 'all-in-one-seo-pack' ),
1130
+ 'help_link' => 'http://semperplugins.com/documentation/noindex-settings/',
1131
+ 'options' => Array(
1132
+ 'cpostnoindex',
1133
+ 'cpostnofollow',
1134
+ 'cpostnoodp',
1135
+ 'cpostnoydir',
1136
+ 'category_noindex',
1137
+ 'archive_date_noindex',
1138
+ 'archive_author_noindex',
1139
+ 'tags_noindex',
1140
+ 'search_noindex',
1141
+ '404_noindex',
1142
+ 'tax_noindex',
1143
+ 'paginated_noindex',
1144
+ 'paginated_nofollow',
1145
+ 'noodp',
1146
+ 'noydir'
1147
+ )
1148
+ ),
1149
+ 'advanced' => Array(
1150
+ 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ),
1151
+ 'help_link' => 'http://semperplugins.com/documentation/advanced-settings/',
1152
+ 'options' => Array(
1153
+ 'generate_descriptions',
1154
+ 'skip_excerpt',
1155
+ 'run_shortcodes',
1156
+ 'hide_paginated_descriptions',
1157
+ 'dont_truncate_descriptions',
1158
+ 'unprotect_meta',
1159
+ 'ex_pages',
1160
+ 'post_meta_tags',
1161
+ 'page_meta_tags',
1162
+ 'front_meta_tags',
1163
+ 'home_meta_tags'
1164
+ )
1165
+ ),
1166
+ 'keywords' => Array(
1167
+ 'name' => __( 'Keyword Settings', 'all-in-one-seo-pack' ),
1168
+ 'help_link' => 'http://semperplugins.com/documentation/keyword-settings/',
1169
+ 'options' => Array(
1170
+ 'togglekeywords',
1171
+ 'use_categories',
1172
+ 'use_tags_as_keywords',
1173
+ 'dynamic_postspage_keywords'
1174
+ )
1175
+ )
1176
+ );
1177
+
1178
+ if ( ! AIOSEOPPRO ) {
1179
+ unset( $this->layout['cpt']['options']['2'] );
1180
+ }
1181
+
1182
+ $other_options = Array();
1183
+ foreach ( $this->layout as $k => $v ) {
1184
+ $other_options = array_merge( $other_options, $v['options'] );
1185
+ }
1186
 
1187
+ $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
 
 
1188
 
1189
+ if ( is_admin() ) {
1190
+ $this->add_help_text_links();
1191
+ add_action( 'aioseop_global_settings_header', Array( $this, 'display_right_sidebar' ) );
1192
+ add_action( 'aioseop_global_settings_footer', Array( $this, 'display_settings_footer' ) );
1193
+ add_action( 'output_option', Array( $this, 'custom_output_option' ), 10, 2 );
1194
+ add_action( 'all_admin_notices', array( $this, 'visibility_warning' ) );
1195
 
1196
+ if ( ! AIOSEOPPRO ) {
 
 
 
 
 
 
 
1197
  // add_action('all_admin_notices', array( $this, 'woo_upgrade_notice'));
1198
+ }
1199
+ }
1200
+ if ( AIOSEOPPRO ) {
1201
+ add_action( 'split_shared_term', Array( $this, 'split_shared_term' ), 10, 4 );
1202
+ }
1203
+ }
1204
 
1205
  //good candidate for pro dir
1206
+
1207
+ /*** Use custom callback for outputting snippet ***/
1208
+ function custom_output_option( $buf, $args ) {
1209
+ if ( $args['name'] == 'aiosp_snippet' ) {
1210
+ $args['options']['type'] = 'html';
1211
+ $args['options']['nowrap'] = false;
1212
+ $args['options']['save'] = false;
1213
+ $info = $this->get_page_snippet_info();
1214
+ extract( $info );
1215
+ } else {
1216
+ return '';
1217
+ }
1218
+
1219
+ if ( $this->strlen( $title ) > 70 ) {
1220
+ $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...';
1221
+ }
1222
+ if ( $this->strlen( $description ) > 156 ) {
1223
+ $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...';
1224
+ }
1225
+ $extra_title_len = 0;
1226
+ if ( empty( $title_format ) ) {
1227
+ $title = '<span id="' . $args['name'] . '_title">' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . '</span>';
1228
+ } else {
1229
+ if ( strpos( $title_format, '%blog_title%' ) !== false ) {
1230
+ $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
1231
+ }
1232
+ $title_format = $this->apply_cf_fields( $title_format );
1233
+ $replace_title = '<span id="' . $args['name'] . '_title">' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . '</span>';
1234
+ if ( strpos( $title_format, '%post_title%' ) !== false ) {
1235
+ $title_format = str_replace( '%post_title%', $replace_title, $title_format );
1236
+ }
1237
+ if ( strpos( $title_format, '%page_title%' ) !== false ) {
1238
+ $title_format = str_replace( '%page_title%', $replace_title, $title_format );
1239
+ }
1240
+ if ( $w->is_category || $w->is_tag || $w->is_tax ) {
1241
+ if ( AIOSEOPPRO ) {
1242
+ if ( ! empty( $_GET ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) {
1243
+ $term_id = intval( $_GET['tag_ID'] );
1244
+ $was_split = get_term_meta( $term_id, '_aioseop_term_was_split', true );
1245
+ if ( ! $was_split ) {
1246
+ $split_terms = wp_get_split_terms( $term_id, $_GET['taxonomy'] );
1247
+ if ( ! empty( $split_terms ) ) {
1248
+ foreach ( $split_terms as $new_tax => $new_term ) {
1249
+ $this->split_shared_term( $term_id, $new_term );
1250
+ }
1251
+ }
1252
  }
1253
  }
 
1254
  }
1255
+ if ( strpos( $title_format, '%category_title%' ) !== false ) {
1256
+ $title_format = str_replace( '%category_title%', $replace_title, $title_format );
1257
+ }
1258
+ if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) {
1259
+ $title_format = str_replace( '%taxonomy_title%', $replace_title, $title_format );
1260
+ }
1261
+ } else {
1262
+ if ( strpos( $title_format, '%category%' ) !== false ) {
1263
+ $title_format = str_replace( '%category%', $category, $title_format );
1264
+ }
1265
+ if ( strpos( $title_format, '%category_title%' ) !== false ) {
1266
+ $title_format = str_replace( '%category_title%', $category, $title_format );
1267
+ }
1268
+ if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) {
1269
+ $title_format = str_replace( '%taxonomy_title%', $category, $title_format );
1270
+ }
1271
+ if ( AIOSEOPPRO ) {
1272
+ if ( strpos( $title_format, '%tax_' ) && ! empty( $p ) ) {
1273
+ $taxes = get_object_taxonomies( $p, 'objects' );
1274
+ if ( ! empty( $taxes ) ) {
1275
+ foreach ( $taxes as $t ) {
1276
+ if ( strpos( $title_format, "%tax_{$t->name}%" ) ) {
1277
+ $terms = $this->get_all_terms( $p->ID, $t->name );
1278
+ $term = '';
1279
+ if ( count( $terms ) > 0 ) {
1280
+ $term = $terms[0];
1281
+ }
1282
+ $title_format = str_replace( "%tax_{$t->name}%", $term, $title_format );
1283
+ }
1284
  }
 
1285
  }
1286
  }
1287
+ }
1288
+ }
1289
+ if ( strpos( $title_format, '%taxonomy_description%' ) !== false ) {
1290
+ $title_format = str_replace( '%taxonomy_description%', $description, $title_format );
1291
  }
1292
 
1293
+ $title_format = preg_replace( '/%([^%]*?)%/', '', $title_format );
1294
+ $title = $title_format;
1295
+ $extra_title_len = strlen( str_replace( $replace_title, '', $title_format ) );
1296
+ }
1297
+
1298
+ $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( wp_strip_all_tags( $description ) ) );
1299
+ $extra_title_len = (int) $extra_title_len;
1300
+ $args['value'] .= "<script>var aiosp_title_extra = {$extra_title_len};</script>";
1301
+ $buf = $this->get_option_row( $args['name'], $args['options'], $args );
1302
+
1303
+ return $buf;
1304
+ }
1305
+
1306
+ //good candidate for pro dir
1307
+
1308
+ function get_page_snippet_info() {
1309
+ static $info = Array();
1310
+ if ( ! empty( $info ) ) {
1311
+ return $info;
1312
+ }
1313
+ global $post, $aioseop_options, $wp_query;
1314
+ $title = $url = $description = $term = $category = '';
1315
+ $p = $post;
1316
+ $w = $wp_query;
1317
+ if ( ! is_object( $post ) ) {
1318
+ $post = $this->get_queried_object();
1319
+ }
1320
+ if ( empty( $this->meta_opts ) ) {
1321
+ $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
1322
+ }
1323
+ if ( ! is_object( $post ) && is_admin() && ! empty( $_GET ) && ! empty( $_GET['post_type'] ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) ) {
1324
  $term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
1325
  }
1326
  if ( is_object( $post ) ) {
1327
+ $opts = $this->meta_opts;
1328
  $post_id = $p->ID;
1329
+ if ( empty( $post->post_modified_gmt ) ) {
1330
  $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
1331
+ }
1332
+ if ( $post->post_type == 'page' ) {
1333
  $wp_query->is_page = true;
1334
+ } elseif ( $post->post_type == 'attachment' ) {
1335
  $wp_query->is_attachment = true;
1336
+ } else {
1337
  $wp_query->is_single = true;
1338
+ }
1339
+ if ( empty( $this->is_front_page ) ) {
1340
+ $this->is_front_page = false;
1341
+ }
1342
+ if ( get_option( 'show_on_front' ) == 'page' ) {
1343
+ if ( is_page() && $post->ID == get_option( 'page_on_front' ) ) {
1344
  $this->is_front_page = true;
1345
+ } elseif ( $post->ID == get_option( 'page_for_posts' ) ) {
1346
  $wp_query->is_home = true;
1347
+ }
1348
  }
1349
  $wp_query->queried_object = $post;
1350
+ if ( ! empty( $post ) && ! $wp_query->is_home && ! $this->is_front_page ) {
1351
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1352
+ if ( empty( $title ) ) {
1353
+ $title = $post->post_title;
1354
+ }
1355
  }
1356
  $title_format = '';
1357
  if ( empty( $title ) ) {
1359
  }
1360
  $description = $this->get_main_description( $post );
1361
  if ( empty( $title_format ) ) {
1362
+ if ( is_page() ) {
1363
  $title_format = $aioseop_options['aiosp_page_title_format'];
1364
+ } elseif ( is_single() || is_attachment() ) {
1365
  $title_format = $this->get_post_title_format( 'post', $post );
1366
+ }
1367
  }
1368
  if ( empty( $title_format ) ) {
1369
  $title_format = '%post_title%';
1370
  }
1371
  $categories = $this->get_all_categories( $post_id );
1372
+ $category = '';
1373
+ if ( count( $categories ) > 0 ) {
1374
  $category = $categories[0];
1375
+ }
1376
  } else if ( is_object( $term ) ) {
1377
  if ( $_GET['taxonomy'] == 'category' ) {
1378
  query_posts( Array( 'cat' => $_GET['tag_ID'] ) );
1379
  } else if ( $_GET['taxonomy'] == 'post_tag' ) {
1380
  query_posts( Array( 'tag' => $term->slug ) );
1381
  } else {
1382
+ query_posts( Array(
1383
+ 'page' => '',
1384
+ $_GET['taxonomy'] => $term->slug,
1385
+ 'post_type' => $_GET['post_type']
1386
+ ) );
1387
  }
1388
+ if ( empty( $this->meta_opts ) ) {
1389
  $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
1390
+ }
1391
+ $title = $this->get_tax_name( $_GET['taxonomy'] );
1392
  $title_format = $this->get_tax_title_format();
1393
+ $opts = $this->meta_opts;
1394
+ if ( ! empty( $opts ) ) {
1395
+ $description = $opts['aiosp_description'];
1396
+ }
1397
+ if ( empty( $description ) ) {
1398
+ $description = term_description();
1399
+ }
1400
  $description = $this->internationalize( $description );
1401
  }
1402
 
1403
  $show_page = true;
1404
+ if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
1405
+ $show_page = false;
1406
+ }
1407
  if ( $aioseop_options['aiosp_can'] ) {
1408
+ if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) {
1409
+ $url = $opts['aiosp_custom_link'];
1410
+ }
1411
+ if ( empty( $url ) ) {
1412
  $url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
1413
+ }
1414
  $url = apply_filters( 'aioseop_canonical_url', $url );
1415
  }
1416
+ if ( ! $url ) {
1417
+ $url = get_permalink();
1418
+ }
1419
 
1420
+ $title = $this->apply_cf_fields( $title );
1421
  $description = $this->apply_cf_fields( $description );
1422
  $description = apply_filters( 'aioseop_description', $description );
1423
 
1425
  $keywords = $this->apply_cf_fields( $keywords );
1426
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
1427
 
1428
+ $info = Array(
1429
+ 'title' => $title,
1430
+ 'description' => $description,
1431
+ 'keywords' => $keywords,
1432
+ 'url' => $url,
1433
+ 'title_format' => $title_format,
1434
+ 'category' => $category,
1435
+ 'w' => $wp_query,
1436
+ 'p' => $post
1437
+ );
1438
  wp_reset_postdata();
1439
+ $wp_query = $w;
1440
+ $post = $p;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1441
 
1442
+ return $info;
 
 
 
1443
  }
1444
 
1445
+ function get_queried_object() {
1446
+ static $p = null;
1447
+ global $wp_query, $post;
1448
+ if ( $p !== null ) {
1449
+ return $p;
 
1450
  }
1451
+ if ( is_object( $post ) ) {
1452
+ $p = $post;
1453
+ } else {
1454
+ if ( ! $wp_query ) {
1455
+ return null;
 
 
 
 
 
 
 
 
 
1456
  }
1457
+ $p = $wp_query->get_queried_object();
1458
  }
 
1459
 
1460
+ return $p;
 
 
 
 
 
 
 
 
 
1461
  }
1462
 
1463
  function get_current_options( $opts = Array(), $location = null, $defaults = null, $post = null ) {
1464
+ if ( ( $location === 'aiosp' ) && ( $this->locations[ $location ]['type'] == 'metabox' ) ) {
1465
  if ( $post == null ) {
1466
  global $post;
1467
  }
1468
  $post_id = $post;
1469
+ if ( is_object( $post_id ) ) {
1470
  $post_id = $post_id->ID;
1471
+ }
1472
  $get_opts = $this->default_options( $location );
1473
+ $optlist = Array(
1474
+ 'keywords',
1475
+ 'description',
1476
+ 'title',
1477
+ 'custom_link',
1478
+ 'sitemap_exclude',
1479
+ 'disable',
1480
+ 'disable_analytics',
1481
+ 'noindex',
1482
+ 'nofollow',
1483
+ 'noodp',
1484
+ 'noydir',
1485
+ 'titleatr',
1486
+ 'menulabel'
1487
+ );
1488
+ if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
1489
+ unset( $optlist['custom_link'] );
1490
  }
1491
  foreach ( $optlist as $f ) {
1492
+ $meta = '';
1493
  $field = "aiosp_$f";
1494
 
1495
  if ( AIOSEOPPRO ) {
1498
  $meta = get_term_meta( $_GET['tag_ID'], '_aioseop_' . $f, true );
1499
  } else {
1500
  $queried_object = get_queried_object();
1501
+ if ( ! empty( $queried_object ) && ! empty( $queried_object->term_id ) ) {
1502
  $meta = get_term_meta( $queried_object->term_id, '_aioseop_' . $f, true );
1503
  }
1504
  }
1505
+ } else {
1506
  $meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
1507
+ }
1508
  if ( 'title' === $f || 'description' === $f ) {
1509
+ $get_opts[ $field ] = htmlspecialchars( ( $meta ) );
1510
  } else {
1511
+ $get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
1512
  }
1513
  } else {
1514
  $field = "aiosp_$f";
1515
+ $meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
1516
  if ( 'title' === $f || 'description' === $f ) {
1517
+ $get_opts[ $field ] = htmlspecialchars( ( $meta ) );
1518
  } else {
1519
+ $get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
1520
  }
1521
  }
1522
 
1523
  }
1524
  $opts = wp_parse_args( $opts, $get_opts );
1525
+
1526
  return $opts;
1527
  } else {
1528
  $options = parent::get_current_options( $opts, $location, $defaults );
1529
+
1530
  return $options;
1531
  }
1532
  }
1533
 
1534
+ function internationalize( $in ) {
1535
+ if ( function_exists( 'langswitch_filter_langs_with_message' ) ) {
1536
+ $in = langswitch_filter_langs_with_message( $in );
1537
+ }
 
 
1538
 
1539
+ if ( function_exists( 'polyglot_filter' ) ) {
1540
+ $in = polyglot_filter( $in );
1541
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1542
 
1543
+ if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
1544
+ $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
1545
+ } elseif ( function_exists( 'ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
1546
+ $in = ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
1547
+ } elseif ( function_exists( 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
1548
+ $in = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
1549
+ }
1550
 
1551
+ return apply_filters( 'localization', $in );
1552
+ }
1553
+
1554
+ /*** Used to filter wp_title(), get our title. ***/
1555
+ function wp_title() {
1556
+ global $aioseop_options;
1557
+ $title = false;
1558
+ $post = $this->get_queried_object();
1559
+ if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
1560
+ $title = $this->get_aioseop_title( $post );
1561
+ $title = $this->apply_cf_fields( $title );
1562
+ }
1563
+
1564
+ if ( $title === false ) {
1565
+ $title = $this->get_original_title();
1566
+ }
1567
+
1568
+ //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?
1569
+ // The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums
1570
+ // if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
1571
+ // $title = $this->capitalize( $title );
1572
+
1573
+ return apply_filters( 'aioseop_title', $title );
1574
+ }
1575
+
1576
+ /*** Gets the title that will be used by AIOSEOP for title rewrites or returns false. ***/
1577
+ function get_aioseop_title( $post ) {
1578
+ global $aioseop_options;
1579
+ // the_search_query() is not suitable, it cannot just return
1580
+ global $s, $STagging;
1581
+ $opts = $this->meta_opts;
1582
+ if ( is_front_page() ) {
1583
+ if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1584
+ global $post;
1585
+ if ( get_option( 'show_on_front' ) == 'page' && is_page() && $post->ID == get_option( 'page_on_front' ) ) {
1586
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1587
+ if ( ! $title ) {
1588
+ $title = $this->internationalize( $post->post_title );
1589
+ }
1590
+ if ( ! $title ) {
1591
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1592
+ }
1593
+ if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
1594
+ $title = $this->apply_page_title_format( $title, $post, $aioseop_options['aiosp_home_page_title_format'] );
1595
+ }
1596
+ $title = $this->paged_title( $title );
1597
+ $title = apply_filters( 'aioseop_home_page_title', $title );
1598
+ }
1599
+ } else {
1600
+ $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
1601
+ if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
1602
+ $title = $this->apply_page_title_format( $title, null, $aioseop_options['aiosp_home_page_title_format'] );
1603
+ }
1604
+ }
1605
+ if ( empty( $title ) ) {
1606
+ $title = $this->internationalize( get_option( 'blogname' ) ) . ' | ' . $this->internationalize( get_bloginfo( 'description' ) );
1607
+ }
1608
+
1609
+ global $post;
1610
+ $post_id = $post->ID;
1611
+
1612
+ if ( is_post_type_archive() && is_post_type_archive( 'product' ) && $post_id = woocommerce_get_page_id( 'shop' ) && $post = get_post( $post_id ) ) {
1613
+ $frontpage_id = get_option( 'page_on_front' );
1614
+
1615
+ if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1616
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1617
+ }
1618
+ //$title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
1619
+ if ( ! $title ) {
1620
+ $title = $this->internationalize( get_post_meta( $frontpage_id, '_aioseop_title', true ) );
1621
+ } //this is/was causing the first product to come through
1622
+ if ( ! $title ) {
1623
+ $title = $this->internationalize( $post->post_title );
1624
+ }
1625
+ if ( ! $title ) {
1626
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1627
+ }
1628
+
1629
+
1630
+ $title = $this->apply_page_title_format( $title, $post );
1631
+ $title = $this->paged_title( $title );
1632
+ $title = apply_filters( 'aioseop_title_page', $title );
1633
+
1634
+ return $title;
1635
+
1636
+ }
1637
+
1638
+ return $this->paged_title( $title ); //this is returned for woo
1639
+ } else if ( is_attachment() ) {
1640
+ if ( $post === null ) {
1641
+ return false;
1642
+ }
1643
+ $title = get_post_meta( $post->ID, '_aioseop_title', true );
1644
+ if ( empty( $title ) ) {
1645
+ $title = $post->post_title;
1646
+ }
1647
+ if ( empty( $title ) ) {
1648
+ $title = $this->get_original_title( '', false );
1649
+ }
1650
+ if ( empty( $title ) ) {
1651
+ $title = get_the_title( $post->post_parent );
1652
+ }
1653
+ $title = apply_filters( 'aioseop_attachment_title', $this->internationalize( $this->apply_post_title_format( $title, '', $post ) ) );
1654
+
1655
+ return $title;
1656
+ } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && ! $this->is_static_posts_page() ) ) {
1657
+ if ( $post === null ) {
1658
+ return false;
1659
+ }
1660
+ if ( ( $this->is_static_front_page() ) && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) {
1661
+ if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
1662
+ $home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] );
1663
+ }
1664
+
1665
+ //home title filter
1666
+ return apply_filters( 'aioseop_home_page_title', $home_title );
1667
+ } else {
1668
+ $page_for_posts = '';
1669
+ if ( is_home() ) {
1670
+ $page_for_posts = get_option( 'page_for_posts' );
1671
+ }
1672
+ if ( $page_for_posts ) {
1673
+ $title = $this->internationalize( get_post_meta( $page_for_posts, '_aioseop_title', true ) );
1674
+ if ( ! $title ) {
1675
+ $post_page = get_post( $page_for_posts );
1676
+ $title = $this->internationalize( $post_page->post_title );
1677
+ }
1678
+ } else {
1679
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1680
+ if ( ! $title ) {
1681
+ $title = $this->internationalize( $post->post_title );
1682
+ }
1683
+ }
1684
+ if ( ! $title ) {
1685
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1686
+ }
1687
+
1688
+ $title = $this->apply_page_title_format( $title, $post );
1689
+ $title = $this->paged_title( $title );
1690
+ $title = apply_filters( 'aioseop_title_page', $title );
1691
+ if ( $this->is_static_posts_page() ) {
1692
+ $title = apply_filters( 'single_post_title', $title );
1693
+ }
1694
+
1695
+ return $title;
1696
+ }
1697
+ } 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 ) ) ) {
1698
+ //too far down? -mrt
1699
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1700
+ if ( ! $title ) {
1701
+ $title = $this->internationalize( $post->post_title );
1702
+ }
1703
+ if ( ! $title ) {
1704
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1705
+ }
1706
+ $title = $this->apply_page_title_format( $title, $post );
1707
+ $title = $this->paged_title( $title );
1708
+ $title = apply_filters( 'aioseop_title_page', $title );
1709
+
1710
+ return $title;
1711
+ } else if ( is_single() ) {
1712
+ // we're not in the loop :(
1713
+ if ( $post === null ) {
1714
+ return false;
1715
+ }
1716
+ $categories = $this->get_all_categories();
1717
+ $category = '';
1718
+ if ( count( $categories ) > 0 ) {
1719
+ $category = $categories[0];
1720
+ }
1721
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1722
+ if ( ! $title ) {
1723
+ $title = $this->internationalize( get_post_meta( $post->ID, 'title_tag', true ) );
1724
+ if ( ! $title ) {
1725
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1726
+ }
1727
+ }
1728
+ if ( empty( $title ) ) {
1729
+ $title = $post->post_title;
1730
+ }
1731
+ if ( ! empty( $title ) ) {
1732
+ $title = $this->apply_post_title_format( $title, $category, $post );
1733
+ }
1734
+ $title = $this->paged_title( $title );
1735
+
1736
+ return apply_filters( 'aioseop_title_single', $title );
1737
+ } else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
1738
+ $search = esc_attr( stripslashes( $s ) );
1739
+ if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
1740
+ $search = $this->capitalize( $search );
1741
+ }
1742
+ $title_format = $aioseop_options['aiosp_search_title_format'];
1743
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1744
+ if ( strpos( $title, '%blog_description%' ) !== false ) {
1745
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
1746
+ }
1747
+ if ( strpos( $title, '%search%' ) !== false ) {
1748
+ $title = str_replace( '%search%', $search, $title );
1749
+ }
1750
+ $title = $this->paged_title( $title );
1751
+
1752
+ return $title;
1753
+ } else if ( is_tag() ) {
1754
+ global $utw;
1755
+ $tag = $tag_description = '';
1756
+ if ( $utw ) {
1757
+ $tags = $utw->GetCurrentTagSet();
1758
+ $tag = $tags[0]->tag;
1759
+ $tag = str_replace( '-', ' ', $tag );
1760
+ } else {
1761
+ if ( AIOSEOPPRO ) {
1762
+ if ( ! empty( $opts ) && ! empty( $opts['aiosp_title'] ) ) {
1763
+ $tag = $opts['aiosp_title'];
1764
+ }
1765
+ if ( ! empty( $opts ) ) {
1766
+ if ( ! empty( $opts['aiosp_title'] ) ) {
1767
+ $tag = $opts['aiosp_title'];
1768
+ }
1769
+ if ( ! empty( $opts['aiosp_description'] ) ) {
1770
+ $tag_description = $opts['aiosp_description'];
1771
+ }
1772
+ }
1773
+ }
1774
+ if ( empty( $tag ) ) {
1775
+ $tag = $this->get_original_title( '', false );
1776
+ }
1777
+ if ( empty( $tag_description ) ) {
1778
+ $tag_description = tag_description();
1779
+ }
1780
+ $tag = $this->internationalize( $tag );
1781
+ $tag_description = $this->internationalize( $tag_description );
1782
+ }
1783
+ if ( $tag ) {
1784
+ if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
1785
+ $tag = $this->capitalize( $tag );
1786
+ }
1787
+ $title_format = $aioseop_options['aiosp_tag_title_format'];
1788
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1789
+ if ( strpos( $title, '%blog_description%' ) !== false ) {
1790
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
1791
+ }
1792
+ if ( strpos( $title, '%tag%' ) !== false ) {
1793
+ $title = str_replace( '%tag%', $tag, $title );
1794
+ }
1795
+ if ( strpos( $title, '%tag_description%' ) !== false ) {
1796
+ $title = str_replace( '%tag_description%', $tag_description, $title );
1797
+ }
1798
+ if ( strpos( $title, '%taxonomy_description%' ) !== false ) {
1799
+ $title = str_replace( '%taxonomy_description%', $tag_description, $title );
1800
+ }
1801
+ $title = trim( wp_strip_all_tags( $title ) );
1802
+ $title = str_replace( Array( '"', "\r\n", "\n" ), Array( '&quot;', ' ', ' ' ), $title );
1803
+ $title = $this->paged_title( $title );
1804
+
1805
+ return $title;
1806
+ }
1807
+ } else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
1808
+ return $this->get_tax_title();
1809
+ } else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // simple tagging support
1810
+ $tag = $STagging->search_tag;
1811
+ if ( $tag ) {
1812
+ if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
1813
+ $tag = $this->capitalize( $tag );
1814
+ }
1815
+ $title_format = $aioseop_options['aiosp_tag_title_format'];
1816
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1817
+ if ( strpos( $title, '%blog_description%' ) !== false ) {
1818
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
1819
+ }
1820
+ if ( strpos( $title, '%tag%' ) !== false ) {
1821
+ $title = str_replace( '%tag%', $tag, $title );
1822
+ }
1823
+ $title = $this->paged_title( $title );
1824
+
1825
+ return $title;
1826
+ }
1827
+ } else if ( is_archive() || is_post_type_archive() ) {
1828
+ if ( is_author() ) {
1829
+ $author = $this->internationalize( $this->get_original_title( '', false ) );
1830
+ $title_format = $aioseop_options['aiosp_author_title_format'];
1831
+ $new_title = str_replace( '%author%', $author, $title_format );
1832
+ } else if ( is_date() ) {
1833
+ global $wp_query;
1834
+ $date = $this->internationalize( $this->get_original_title( '', false ) );
1835
+ $title_format = $aioseop_options['aiosp_date_title_format'];
1836
+ $new_title = str_replace( '%date%', $date, $title_format );
1837
+ $day = get_query_var( 'day' );
1838
+ if ( empty( $day ) ) {
1839
+ $day = '';
1840
+ }
1841
+ $new_title = str_replace( '%day%', $day, $new_title );
1842
+ $monthnum = get_query_var( 'monthnum' );
1843
+ $year = get_query_var( 'year' );
1844
+ if ( empty( $monthnum ) || is_year() ) {
1845
+ $month = '';
1846
+ $monthnum = 0;
1847
+ }
1848
+ $month = date( 'F', mktime( 0, 0, 0, (int) $monthnum, 1, (int) $year ) );
1849
+ $new_title = str_replace( '%monthnum%', $monthnum, $new_title );
1850
+ if ( strpos( $new_title, '%month%' ) !== false ) {
1851
+ $new_title = str_replace( '%month%', $month, $new_title );
1852
+ }
1853
+ if ( strpos( $new_title, '%year%' ) !== false ) {
1854
+ $new_title = str_replace( '%year%', get_query_var( 'year' ), $new_title );
1855
+ }
1856
+ } else if ( is_post_type_archive() ) {
1857
+ if ( empty( $title ) ) {
1858
+ $title = $this->get_original_title( '', false );
1859
+ }
1860
+ $new_title = apply_filters( 'aioseop_archive_title', $this->apply_archive_title_format( $title ) );
1861
+ } else {
1862
+ return false;
1863
+ }
1864
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $new_title );
1865
+ if ( strpos( $new_title, '%blog_description%' ) !== false ) {
1866
+ $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
1867
+ }
1868
+ $title = trim( $new_title );
1869
+ $title = $this->paged_title( $title );
1870
+
1871
+ return $title;
1872
+ } else if ( is_404() ) {
1873
+ $title_format = $aioseop_options['aiosp_404_title_format'];
1874
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1875
+ if ( strpos( $new_title, '%blog_description%' ) !== false ) {
1876
+ $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
1877
+ }
1878
+ if ( strpos( $new_title, '%request_url%' ) !== false ) {
1879
+ $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title );
1880
+ }
1881
+ if ( strpos( $new_title, '%request_words%' ) !== false ) {
1882
+ $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title );
1883
+ }
1884
+ if ( strpos( $new_title, '%404_title%' ) !== false ) {
1885
+ $new_title = str_replace( '%404_title%', $this->internationalize( $this->get_original_title( '', false ) ), $new_title );
1886
+ }
1887
+
1888
+ return $new_title;
1889
+ }
1890
+
1891
+ return false;
1892
+ }
1893
+
1894
+ /** @return The original title as delivered by WP (well, in most cases) */
1895
+ function get_original_title( $sep = '|', $echo = false, $seplocation = '' ) {
1896
+ global $aioseop_options;
1897
+ if ( ! empty( $aioseop_options['aiosp_use_original_title'] ) ) {
1898
+ $has_filter = has_filter( 'wp_title', Array( $this, 'wp_title' ) );
1899
+ if ( $has_filter !== false ) {
1900
+ remove_filter( 'wp_title', Array( $this, 'wp_title' ), $has_filter );
1901
+ }
1902
+ if ( current_theme_supports( 'title-tag' ) ) {
1903
+ $sep = '|';
1904
+ $echo = false;
1905
+ $seplocation = 'right';
1906
+ }
1907
+ $title = wp_title( $sep, $echo, $seplocation );
1908
+ if ( $has_filter !== false ) {
1909
+ add_filter( 'wp_title', Array( $this, 'wp_title' ), $has_filter );
1910
+ }
1911
+ if ( $title && ( $title = trim( $title ) ) ) {
1912
+ return trim( $title );
1913
+ }
1914
+ }
1915
+
1916
+ // the_search_query() is not suitable, it cannot just return
1917
+ global $s;
1918
+
1919
+ $title = null;
1920
+
1921
+ if ( is_home() ) {
1922
+ $title = get_option( 'blogname' );
1923
+ } else if ( is_single() ) {
1924
+ $title = $this->internationalize( single_post_title( '', false ) );
1925
+ } else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
1926
+ $search = esc_attr( stripslashes( $s ) );
1927
+ if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
1928
+ $search = $this->capitalize( $search );
1929
+ }
1930
+ $title = $search;
1931
+ } else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
1932
+ $category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) );
1933
+ $title = $category_name;
1934
+ } else if ( is_page() ) {
1935
+ $title = $this->internationalize( single_post_title( '', false ) );
1936
+ } else if ( is_tag() ) {
1937
+ global $utw;
1938
+ if ( $utw ) {
1939
+ $tags = $utw->GetCurrentTagSet();
1940
+ $tag = $tags[0]->tag;
1941
+ $tag = str_replace( '-', ' ', $tag );
1942
+ } else {
1943
+ // wordpress > 2.3
1944
+ $tag = $this->internationalize( single_term_title( '', false ) );
1945
+ }
1946
+ if ( $tag ) {
1947
+ $title = $tag;
1948
+ }
1949
+ } else if ( is_author() ) {
1950
+ $author = get_userdata( get_query_var( 'author' ) );
1951
+ if ( $author === false ) {
1952
+ global $wp_query;
1953
+ $author = $wp_query->get_queried_object();
1954
+ }
1955
+ if ( $author !== false ) {
1956
+ $title = $author->display_name;
1957
+ }
1958
+ } else if ( is_day() ) {
1959
+ $title = get_the_date();
1960
+ } else if ( is_month() ) {
1961
+ $title = get_the_date( 'F, Y' );
1962
+ } else if ( is_year() ) {
1963
+ $title = get_the_date( 'Y' );
1964
+ } else if ( is_archive() ) {
1965
+ $title = $this->internationalize( post_type_archive_title( '', false ) );
1966
+ } else if ( is_404() ) {
1967
+ $title_format = $aioseop_options['aiosp_404_title_format'];
1968
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1969
+ if ( strpos( $new_title, '%blog_description%' ) !== false ) {
1970
+ $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
1971
+ }
1972
+ if ( strpos( $new_title, '%request_url%' ) !== false ) {
1973
+ $new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title );
1974
+ }
1975
+ if ( strpos( $new_title, '%request_words%' ) !== false ) {
1976
+ $new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title );
1977
+ }
1978
+ $title = $new_title;
1979
+ }
1980
+
1981
+ return trim( $title );
1982
+ }
1983
+
1984
+ function capitalize( $s ) {
1985
+ $s = trim( $s );
1986
+ $tokens = explode( ' ', $s );
1987
+ while ( list( $key, $val ) = each( $tokens ) ) {
1988
+ $tokens[ $key ] = trim( $tokens[ $key ] );
1989
+ $tokens[ $key ] = $this->strtoupper( $this->substr( $tokens[ $key ], 0, 1 ) ) . $this->substr( $tokens[ $key ], 1 );
1990
+ }
1991
+ $s = implode( ' ', $tokens );
1992
+
1993
+ return $s;
1994
+ }
1995
+
1996
+ /**
1997
+ * @return User-readable nice words for a given request.
1998
+ */
1999
+ function request_as_words( $request ) {
2000
+ $request = htmlspecialchars( $request );
2001
+ $request = str_replace( '.html', ' ', $request );
2002
+ $request = str_replace( '.htm', ' ', $request );
2003
+ $request = str_replace( '.', ' ', $request );
2004
+ $request = str_replace( '/', ' ', $request );
2005
+ $request = str_replace( '-', ' ', $request );
2006
+ $request_a = explode( ' ', $request );
2007
+ $request_new = array();
2008
+ foreach ( $request_a as $token ) {
2009
+ $request_new[] = $this->ucwords( trim( $token ) );
2010
+ }
2011
+ $request = implode( ' ', $request_new );
2012
+
2013
+ return $request;
2014
+ }
2015
+
2016
+ function apply_page_title_format( $title, $p = null, $title_format = '' ) {
2017
+ global $aioseop_options;
2018
+ if ( $p === null ) {
2019
+ global $post;
2020
+ } else {
2021
+ $post = $p;
2022
+ }
2023
+ if ( empty( $title_format ) ) {
2024
+ $title_format = $aioseop_options['aiosp_page_title_format'];
2025
+ }
2026
+
2027
+ return $this->title_placeholder_helper( $title, $post, 'page', $title_format );
2028
+ }
2029
+
2030
+ function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
2031
+ if ( ! empty( $post ) ) {
2032
+ $authordata = get_userdata( $post->post_author );
2033
+ } else {
2034
+ $authordata = new WP_User();
2035
+ }
2036
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
2037
+ if ( strpos( $new_title, '%blog_description%' ) !== false ) {
2038
+ $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2039
+ }
2040
+ if ( strpos( $new_title, "%{$type}_title%" ) !== false ) {
2041
+ $new_title = str_replace( "%{$type}_title%", $title, $new_title );
2042
+ }
2043
+ if ( $type == 'post' ) {
2044
+ if ( strpos( $new_title, '%category%' ) !== false ) {
2045
+ $new_title = str_replace( '%category%', $category, $new_title );
2046
+ }
2047
+ if ( strpos( $new_title, '%category_title%' ) !== false ) {
2048
+ $new_title = str_replace( '%category_title%', $category, $new_title );
2049
+ }
2050
+ if ( strpos( $new_title, '%tax_' ) && ! empty( $post ) ) {
2051
+ $taxes = get_object_taxonomies( $post, 'objects' );
2052
+ if ( ! empty( $taxes ) ) {
2053
+ foreach ( $taxes as $t ) {
2054
+ if ( strpos( $new_title, "%tax_{$t->name}%" ) ) {
2055
+ $terms = $this->get_all_terms( $post->ID, $t->name );
2056
+ $term = '';
2057
+ if ( count( $terms ) > 0 ) {
2058
+ $term = $terms[0];
2059
+ }
2060
+ $new_title = str_replace( "%tax_{$t->name}%", $term, $new_title );
2061
+ }
2062
+ }
2063
+ }
2064
+ }
2065
+ }
2066
+ if ( strpos( $new_title, "%{$type}_author_login%" ) !== false ) {
2067
+ $new_title = str_replace( "%{$type}_author_login%", $authordata->user_login, $new_title );
2068
+ }
2069
+ if ( strpos( $new_title, "%{$type}_author_nicename%" ) !== false ) {
2070
+ $new_title = str_replace( "%{$type}_author_nicename%", $authordata->user_nicename, $new_title );
2071
+ }
2072
+ if ( strpos( $new_title, "%{$type}_author_firstname%" ) !== false ) {
2073
+ $new_title = str_replace( "%{$type}_author_firstname%", $this->ucwords( $authordata->first_name ), $new_title );
2074
+ }
2075
+ if ( strpos( $new_title, "%{$type}_author_lastname%" ) !== false ) {
2076
+ $new_title = str_replace( "%{$type}_author_lastname%", $this->ucwords( $authordata->last_name ), $new_title );
2077
+ }
2078
+ $title = trim( $new_title );
2079
+
2080
+ return $title;
2081
+ }
2082
+
2083
+ function get_all_terms( $id, $taxonomy ) {
2084
+ $keywords = Array();
2085
+ $terms = get_the_terms( $id, $taxonomy );
2086
+ if ( ! empty( $terms ) ) {
2087
+ foreach ( $terms as $term ) {
2088
+ $keywords[] = $this->internationalize( $term->name );
2089
+ }
2090
+ }
2091
+
2092
+ return $keywords;
2093
+ }
2094
+
2095
+ function paged_title( $title ) {
2096
+ // the page number if paged
2097
+ global $paged;
2098
+ global $aioseop_options;
2099
+ // simple tagging support
2100
+ global $STagging;
2101
+ $page = get_query_var( 'page' );
2102
+ if ( $paged > $page ) {
2103
+ $page = $paged;
2104
+ }
2105
+ if ( is_paged() || ( isset( $STagging ) && $STagging->is_tag_view() && $paged ) || ( $page > 1 ) ) {
2106
+ $part = $this->internationalize( $aioseop_options['aiosp_paged_format'] );
2107
+ if ( isset( $part ) || ! empty( $part ) ) {
2108
+ $part = ' ' . trim( $part );
2109
+ $part = str_replace( '%page%', $page, $part );
2110
+ $this->log( "paged_title() [$title] [$part]" );
2111
+ $title .= $part;
2112
+ }
2113
+ }
2114
+
2115
+ return $title;
2116
+ }
2117
+
2118
+ function log( $message ) {
2119
+ if ( $this->do_log ) {
2120
+ @error_log( date( 'Y-m-d H:i:s' ) . ' ' . $message . "\n", 3, $this->log_file );
2121
+ }
2122
+ }
2123
+
2124
+ function apply_post_title_format( $title, $category = '', $p = null ) {
2125
+ if ( $p === null ) {
2126
+ global $post;
2127
+ } else {
2128
+ $post = $p;
2129
+ }
2130
+ $title_format = $this->get_post_title_format( 'post', $post );
2131
+
2132
+ return $this->title_placeholder_helper( $title, $post, 'post', $title_format, $category );
2133
+ }
2134
+
2135
+ function get_post_title_format( $title_type = 'post', $p = null ) {
2136
+ global $aioseop_options;
2137
+ if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) {
2138
+ return false;
2139
+ }
2140
+ $title_format = "%{$title_type}_title% | %blog_title%";
2141
+ if ( isset( $aioseop_options["aiosp_{$title_type}_title_format"] ) ) {
2142
+ $title_format = $aioseop_options["aiosp_{$title_type}_title_format"];
2143
+ }
2144
+ if ( ! empty( $aioseop_options['aiosp_enablecpost'] ) && ! empty( $aioseop_options['aiosp_cpostactive'] ) ) {
2145
+ $wp_post_types = $aioseop_options['aiosp_cpostactive'];
2146
+ if ( ! empty( $aioseop_options['aiosp_cposttitles'] ) ) {
2147
+ if ( ( ( $title_type == 'archive' ) && is_post_type_archive( $wp_post_types ) && $prefix = "aiosp_{$title_type}_" ) ||
2148
+ ( ( $title_type == 'post' ) && $this->is_singular( $wp_post_types, $p ) && $prefix = 'aiosp_' )
2149
+ ) {
2150
+ $post_type = get_post_type( $p );
2151
+ if ( ! empty( $aioseop_options["{$prefix}{$post_type}_title_format"] ) ) {
2152
+ $title_format = $aioseop_options["{$prefix}{$post_type}_title_format"];
2153
+ }
2154
+ }
2155
+ }
2156
+ }
2157
+
2158
+ return $title_format;
2159
+ }
2160
+
2161
+ function is_singular( $post_types = Array(), $post = null ) {
2162
+ if ( ! empty( $post_types ) && is_object( $post ) ) {
2163
+ return in_array( $post->post_type, (array) $post_types );
2164
+ } else {
2165
+ return is_singular( $post_types );
2166
+ }
2167
+ }
2168
+
2169
+ function is_static_posts_page() {
2170
+ static $is_posts_page = null;
2171
+ if ( $is_posts_page !== null ) {
2172
+ return $is_posts_page;
2173
+ }
2174
+ $post = $this->get_queried_object();
2175
+ $is_posts_page = ( get_option( 'show_on_front' ) == 'page' && is_home() && ! empty( $post ) && $post->ID == get_option( 'page_for_posts' ) );
2176
+
2177
+ return $is_posts_page;
2178
+ }
2179
+
2180
+ function is_static_front_page() {
2181
+ if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) {
2182
+ return $this->is_front_page;
2183
+ }
2184
+ $post = $this->get_queried_object();
2185
+ $this->is_front_page = ( get_option( 'show_on_front' ) == 'page' && is_page() && ! empty( $post ) && $post->ID == get_option( 'page_on_front' ) );
2186
+
2187
+ return $this->is_front_page;
2188
+ }
2189
+
2190
+ function get_all_categories( $id = 0 ) {
2191
+ $keywords = Array();
2192
+ $categories = get_the_category( $id );
2193
+ if ( ! empty( $categories ) ) {
2194
+ foreach ( $categories as $category ) {
2195
+ $keywords[] = $this->internationalize( $category->cat_name );
2196
+ }
2197
+ }
2198
+
2199
+ return $keywords;
2200
+ }
2201
+
2202
+ function get_tax_title( $tax = '' ) {
2203
+ if ( AIOSEOPPRO ) {
2204
+ if ( empty( $this->meta_opts ) ) {
2205
+ $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
2206
+ }
2207
+ }
2208
+ if ( empty( $tax ) ) {
2209
+ if ( is_category() ) {
2210
+ $tax = 'category';
2211
+ } else {
2212
+ $tax = get_query_var( 'taxonomy' );
2213
+ }
2214
+ }
2215
+ $name = $this->get_tax_name( $tax );
2216
+ $desc = $this->get_tax_desc( $tax );
2217
+
2218
+ return $this->apply_tax_title_format( $name, $desc, $tax );
2219
+ }
2220
+
2221
+ // handle prev / next links
2222
+
2223
+ function get_tax_name( $tax ) {
2224
+ global $aioseop_options;
2225
+ if ( AIOSEOPPRO ) {
2226
+ $opts = $this->meta_opts;
2227
+ if ( ! empty( $opts ) ) {
2228
+ $name = $opts['aiosp_title'];
2229
+ }
2230
+ } else {
2231
+ $name = '';
2232
+ }
2233
+ if ( empty( $name ) ) {
2234
+ $name = single_term_title( '', false );
2235
+ }
2236
+ //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??
2237
+ // if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) )
2238
+ // $name = $this->ucwords( $name );
2239
+
2240
+ return $this->internationalize( $name );
2241
+ }
2242
+
2243
+ function get_tax_desc( $tax ) {
2244
+ if ( AIOSEOPPRO ) {
2245
+ $opts = $this->meta_opts;
2246
+ if ( ! empty( $opts ) ) {
2247
+ $desc = $opts['aiosp_description'];
2248
+ }
2249
+ } else {
2250
+ $desc = '';
2251
+ }
2252
+ if ( empty( $desc ) ) {
2253
+ $desc = term_description( '', $tax );
2254
+ }
2255
+
2256
+ return $this->internationalize( $desc );
2257
+ }
2258
+
2259
+ function apply_tax_title_format( $category_name, $category_description, $tax = '' ) {
2260
+ if ( empty( $tax ) ) {
2261
+ $tax = get_query_var( 'taxonomy' );
2262
+ }
2263
+ $title_format = $this->get_tax_title_format( $tax );
2264
+ $title = str_replace( '%taxonomy_title%', $category_name, $title_format );
2265
+ if ( strpos( $title, '%taxonomy_description%' ) !== false ) {
2266
+ $title = str_replace( '%taxonomy_description%', $category_description, $title );
2267
+ }
2268
+ if ( strpos( $title, '%category_title%' ) !== false ) {
2269
+ $title = str_replace( '%category_title%', $category_name, $title );
2270
+ }
2271
+ if ( strpos( $title, '%category_description%' ) !== false ) {
2272
+ $title = str_replace( '%category_description%', $category_description, $title );
2273
+ }
2274
+ if ( strpos( $title, '%blog_title%' ) !== false ) {
2275
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title );
2276
+ }
2277
+ if ( strpos( $title, '%blog_description%' ) !== false ) {
2278
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
2279
+ }
2280
+ $title = wp_strip_all_tags( $title );
2281
+
2282
+ return $this->paged_title( $title );
2283
+ }
2284
+
2285
+ function get_tax_title_format( $tax = '' ) {
2286
+ global $aioseop_options;
2287
+ if ( AIOSEOPPRO ) {
2288
+ $title_format = '%taxonomy_title% | %blog_title%';
2289
+ if ( is_category() ) {
2290
+ $title_format = $aioseop_options['aiosp_category_title_format'];
2291
+ } else {
2292
+ $taxes = $aioseop_options['aiosp_taxactive'];
2293
+ if ( empty( $tax ) ) {
2294
+ $tax = get_query_var( 'taxonomy' );
2295
+ }
2296
+ if ( ! empty( $aioseop_options["aiosp_{$tax}_tax_title_format"] ) ) {
2297
+ $title_format = $aioseop_options["aiosp_{$tax}_tax_title_format"];
2298
  }
2299
  }
2300
+ if ( empty( $title_format ) ) {
2301
+ $title_format = '%category_title% | %blog_title%';
 
 
 
2302
  }
2303
+ } else {
2304
+ $title_format = '%category_title% | %blog_title%';
2305
+ if ( ! empty( $aioseop_options['aiosp_category_title_format'] ) ) {
2306
+ $title_format = $aioseop_options['aiosp_category_title_format'];
2307
+ }
2308
+
2309
+ return $title_format;
2310
+ }
2311
+
2312
+ return $title_format;
2313
+ }
2314
+
2315
+ function apply_archive_title_format( $title, $category = '' ) {
2316
+ $title_format = $this->get_archive_title_format();
2317
+ $r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' );
2318
+ $d_title = array(
2319
+ $this->internationalize( get_bloginfo( 'name' ) ),
2320
+ $this->internationalize( get_bloginfo( 'description' ) ),
2321
+ post_type_archive_title( '', false )
2322
+ );
2323
+ $title = trim( str_replace( $r_title, $d_title, $title_format ) );
2324
+
2325
+ return $title;
2326
+ }
2327
+
2328
+ function get_archive_title_format() {
2329
+ return $this->get_post_title_format( 'archive' );
2330
+ }
2331
+
2332
+ function get_main_description( $post = null ) {
2333
+ global $aioseop_options;
2334
+ $opts = $this->meta_opts;
2335
+ $description = '';
2336
+ if ( is_author() && $this->show_page_description() ) {
2337
+ $description = $this->internationalize( get_the_author_meta( 'description' ) );
2338
+ } 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 ) ) ) {
2339
+ //$description = $this->get_post_description( $post );
2340
+ //$description = $this->apply_cf_fields( $description );
2341
+ if ( ! ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ) {
2342
+ $description = trim( ( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) ) );
2343
+ } else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2344
+ //$description = $this->get_aioseop_description( $post );
2345
+ $description = trim( ( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) ) );
2346
+ } else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2347
+ $description = $this->get_aioseop_description( $post );
2348
+ }
2349
+ } else if ( is_front_page() ) {
2350
+ $description = $this->get_aioseop_description( $post );
2351
+ } else if ( is_single() || is_page() || is_attachment() || is_home() || $this->is_static_posts_page() ) {
2352
+ $description = $this->get_aioseop_description( $post );
2353
+ } else if ( ( is_category() || is_tag() || is_tax() ) && $this->show_page_description() ) {
2354
+ if ( ! empty( $opts ) && AIOSEOPPRO ) {
2355
+ $description = $opts['aiosp_description'];
2356
+ }
2357
+ if ( empty( $description ) ) {
2358
+ $description = term_description();
2359
+ }
2360
+ $description = $this->internationalize( $description );
2361
+ }
2362
+ if ( empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) {
2363
+ $description = $this->trim_excerpt_without_filters( $description );
2364
+ }
2365
+
2366
+ return $description;
2367
+ }
2368
+
2369
+ function show_page_description() {
2370
+ global $aioseop_options;
2371
+ if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
2372
+ $page = $this->get_page_number();
2373
+ if ( ! empty( $page ) && ( $page > 1 ) ) {
2374
+ return false;
2375
+ }
2376
+ }
2377
+
2378
+ return true;
2379
+ }
2380
+
2381
+ function get_page_number() {
2382
+ $page = get_query_var( 'page' );
2383
+ if ( empty( $page ) ) {
2384
+ $page = get_query_var( 'paged' );
2385
+ }
2386
+
2387
+ return $page;
2388
+ }
2389
+
2390
+ function get_aioseop_description( $post = null ) {
2391
+ global $aioseop_options;
2392
+ if ( $post === null ) {
2393
+ $post = $GLOBALS['post'];
2394
+ }
2395
+ $blog_page = aiosp_common::get_blog_page();
2396
+ $description = '';
2397
+ if ( is_front_page() && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2398
+ $description = trim( ( $this->internationalize( $aioseop_options['aiosp_home_description'] ) ) );
2399
+ } elseif ( ! empty( $blog_page ) ) {
2400
+ $description = $this->get_post_description( $blog_page );
2401
+ }
2402
+ if ( empty( $description ) && is_object( $post ) && ! is_archive() && empty( $blog_page ) ) {
2403
+ $description = $this->get_post_description( $post );
2404
+ }
2405
+ $description = $this->apply_cf_fields( $description );
2406
+
2407
+ return $description;
2408
+ }
2409
+
2410
+ function get_post_description( $post ) {
2411
+ global $aioseop_options;
2412
+ $description = '';
2413
+ if ( ! $this->show_page_description() ) {
2414
+ return '';
2415
+ }
2416
+ $description = trim( ( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) ) );
2417
+ if ( ! empty( $post ) && post_password_required( $post ) ) {
2418
+ return $description;
2419
+ }
2420
+ if ( ! $description ) {
2421
+ if ( empty( $aioseop_options['aiosp_skip_excerpt'] ) ) {
2422
+ $description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) );
2423
+ }
2424
+ if ( ! $description && $aioseop_options['aiosp_generate_descriptions'] ) {
2425
+ $content = $post->post_content;
2426
+ if ( ! empty( $aioseop_options['aiosp_run_shortcodes'] ) ) {
2427
+ $content = do_shortcode( $content );
2428
+ }
2429
+ $content = wp_strip_all_tags( $content );
2430
+ $description = $this->trim_excerpt_without_filters( $this->internationalize( $content ) );
2431
+ }
2432
+ }
2433
+
2434
+ // "internal whitespace trim"
2435
+ $description = preg_replace( "/\s\s+/u", ' ', $description );
2436
+
2437
+ return $description;
2438
+ }
2439
+
2440
+ function trim_excerpt_without_filters_full_length( $text ) {
2441
+ $text = str_replace( ']]>', ']]&gt;', $text );
2442
+ $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
2443
+ $text = wp_strip_all_tags( $text );
2444
+
2445
+ return trim( ( $text ) );
2446
+ }
2447
+
2448
+ function trim_excerpt_without_filters( $text, $max = 0 ) {
2449
+ $text = str_replace( ']]>', ']]&gt;', $text );
2450
+ $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
2451
+ $text = wp_strip_all_tags( $text );
2452
+ // Treat other common word-break characters like a space
2453
+ $text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text );
2454
+ if ( ! $max ) {
2455
+ $max = $this->maximum_description_length;
2456
+ }
2457
+ $max_orig = $max;
2458
+ $len = $this->strlen( $text2 );
2459
+ if ( $max < $len ) {
2460
+ if ( function_exists( 'mb_strrpos' ) ) {
2461
+ $pos = mb_strrpos( $text2, ' ', - ( $len - $max ) );
2462
+ if ( $pos === false ) {
2463
+ $pos = $max;
2464
+ }
2465
+ if ( $pos > $this->minimum_description_length ) {
2466
+ $max = $pos;
2467
+ } else {
2468
+ $max = $this->minimum_description_length;
2469
+ }
2470
+ } else {
2471
+ while ( $text2[ $max ] != ' ' && $max > $this->minimum_description_length ) {
2472
+ $max --;
2473
+ }
2474
+ }
2475
+
2476
+ // probably no valid chars to break on?
2477
+ if ( $len > $max_orig && $max < intval( $max_orig / 2 ) ) {
2478
+ $max = $max_orig;
2479
+ }
2480
+ }
2481
+ $text = $this->substr( $text, 0, $max );
2482
+
2483
+ return trim( $text );
2484
+ }
2485
+
2486
+ function aiosp_mrt_get_url( $query, $show_page = true ) {
2487
+ if ( $query->is_404 || $query->is_search ) {
2488
+ return false;
2489
+ }
2490
+ $link = '';
2491
+ $haspost = count( $query->posts ) > 0;
2492
+ if ( get_query_var( 'm' ) ) {
2493
+ $m = preg_replace( '/[^0-9]/', '', get_query_var( 'm' ) );
2494
+ switch ( $this->strlen( $m ) ) {
2495
+ case 4:
2496
+ $link = get_year_link( $m );
2497
+ break;
2498
+ case 6:
2499
+ $link = get_month_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ) );
2500
+ break;
2501
+ case 8:
2502
+ $link = get_day_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ), $this->substr( $m, 6, 2 ) );
2503
+ break;
2504
+ default:
2505
+ return false;
2506
+ }
2507
+ } elseif ( ( $query->is_home && ( get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) ) {
2508
+ $link = get_permalink( $pageid );
2509
+ } elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) {
2510
+ if ( function_exists( 'icl_get_home_url' ) ) {
2511
+ $link = icl_get_home_url();
2512
+ } else {
2513
+ $link = trailingslashit( home_url() );
2514
+ }
2515
+ } elseif ( ( $query->is_single || $query->is_page ) && $haspost ) {
2516
+ $post = $query->posts[0];
2517
+ $link = get_permalink( $post->ID );
2518
+ } elseif ( $query->is_author && $haspost ) {
2519
+ $author = get_userdata( get_query_var( 'author' ) );
2520
+ if ( $author === false ) {
2521
+ return false;
2522
+ }
2523
+ $link = get_author_posts_url( $author->ID, $author->user_nicename );
2524
+ } elseif ( $query->is_category && $haspost ) {
2525
+ $link = get_category_link( get_query_var( 'cat' ) );
2526
+ } elseif ( $query->is_tag && $haspost ) {
2527
+ $tag = get_term_by( 'slug', get_query_var( 'tag' ), 'post_tag' );
2528
+ if ( ! empty( $tag->term_id ) ) {
2529
+ $link = get_tag_link( $tag->term_id );
2530
+ }
2531
+ } elseif ( $query->is_day && $haspost ) {
2532
+ $link = get_day_link( get_query_var( 'year' ),
2533
+ get_query_var( 'monthnum' ),
2534
+ get_query_var( 'day' ) );
2535
+ } elseif ( $query->is_month && $haspost ) {
2536
+ $link = get_month_link( get_query_var( 'year' ),
2537
+ get_query_var( 'monthnum' ) );
2538
+ } elseif ( $query->is_year && $haspost ) {
2539
+ $link = get_year_link( get_query_var( 'year' ) );
2540
+ } elseif ( $query->is_tax && $haspost ) {
2541
+ $taxonomy = get_query_var( 'taxonomy' );
2542
+ $term = get_query_var( 'term' );
2543
+ if ( ! empty( $term ) ) {
2544
+ $link = get_term_link( $term, $taxonomy );
2545
+ }
2546
+ } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
2547
+ if ( is_array( $post_type ) ) {
2548
+ $post_type = reset( $post_type );
2549
+ }
2550
+ $link = get_post_type_archive_link( $post_type );
2551
+ } else {
2552
+ return false;
2553
+ }
2554
+ if ( empty( $link ) || ! is_string( $link ) ) {
2555
+ return false;
2556
+ }
2557
+ if ( apply_filters( 'aioseop_canonical_url_pagination', $show_page ) ) {
2558
+ $link = $this->get_paged( $link );
2559
+ }
2560
+ if ( ! empty( $link ) ) {
2561
+ global $aioseop_options;
2562
+ if ( ! empty( $aioseop_options['aiosp_can_set_protocol'] ) && ( $aioseop_options['aiosp_can_set_protocol'] != 'auto' ) ) {
2563
+ if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) {
2564
+ $link = preg_replace( '/^https:/i', 'http:', $link );
2565
+ } elseif ( $aioseop_options['aiosp_can_set_protocol'] == 'https' ) {
2566
+ $link = preg_replace( '/^http:/i', 'https:', $link );
2567
+ }
2568
+ }
2569
+ }
2570
+
2571
+ return $link;
2572
+ }
2573
+
2574
+ function get_paged( $link ) {
2575
+ global $wp_rewrite;
2576
+ $page = $this->get_page_number();
2577
+ $page_name = 'page';
2578
+ if ( ! empty( $wp_rewrite ) && ! empty( $wp_rewrite->pagination_base ) ) {
2579
+ $page_name = $wp_rewrite->pagination_base;
2580
+ }
2581
+ if ( ! empty( $page ) && $page > 1 ) {
2582
+ if ( get_query_var( 'page' ) == $page ) {
2583
+ $link = trailingslashit( $link ) . "$page";
2584
+ } else {
2585
+ $link = trailingslashit( $link ) . trailingslashit( $page_name ) . $page;
2586
+ }
2587
+ $link = user_trailingslashit( $link, 'paged' );
2588
+ }
2589
+
2590
+ return $link;
2591
+ }
2592
+
2593
+ function get_main_keywords() {
2594
+ global $aioseop_options;
2595
+ global $aioseop_keywords;
2596
+ global $post;
2597
+ $opts = $this->meta_opts;
2598
+ if ( ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && ! $this->is_static_posts_page() ) || $this->is_static_front_page() ) ) {
2599
+ if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2600
+ $keywords = $this->get_all_keywords();
2601
+ } else {
2602
+ $keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) );
2603
  }
2604
+ } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) {
2605
+ $keywords = stripslashes( $this->internationalize( $opts['aiosp_keywords'] ) ); // and if option = use page set keywords instead of keywords from recent posts
2606
+ } elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
2607
+ $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, '_aioseop_keywords', true ) ) );
2608
+ } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) {
2609
+ $keywords = '';
2610
+ } else {
2611
+ $keywords = $this->get_all_keywords();
2612
+ }
2613
+
2614
+ return $keywords;
2615
+ }
2616
+
2617
+ /**
2618
+ * @return comma-separated list of unique keywords
2619
+ */
2620
+ function get_all_keywords() {
2621
+ global $posts;
2622
+ global $aioseop_options;
2623
+ if ( is_404() ) {
2624
+ return null;
2625
+ }
2626
+ // if we are on synthetic pages
2627
+ 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() ) {
2628
+ return null;
2629
  }
2630
+ $keywords = array();
2631
+ $opts = $this->meta_opts;
2632
+ if ( ! empty( $opts['aiosp_keywords'] ) ) {
2633
+ $traverse = $this->keyword_string_to_list( $this->internationalize( $opts['aiosp_keywords'] ) );
2634
+ if ( ! empty( $traverse ) ) {
2635
+ foreach ( $traverse as $keyword ) {
2636
+ $keywords[] = $keyword;
 
 
 
 
 
 
2637
  }
2638
  }
2639
  }
2640
+ if ( empty( $posts ) ) {
2641
+ global $post;
2642
+ $post_arr = Array( $post );
2643
+ } else {
2644
+ $post_arr = $posts;
 
 
 
2645
  }
2646
+ if ( is_array( $post_arr ) ) {
2647
+ $postcount = count( $post_arr );
2648
+ foreach ( $post_arr as $p ) {
2649
+ if ( $p ) {
2650
+ $id = $p->ID;
2651
+ if ( $postcount == 1 || ! empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
2652
+ // custom field keywords
2653
+ $keywords_i = null;
2654
+ $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) );
2655
+ if ( is_attachment() ) {
2656
+ $id = $p->post_parent;
2657
+ if ( empty( $keywords_i ) ) {
2658
+ $keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) );
2659
+ }
2660
+ }
2661
+ $traverse = $this->keyword_string_to_list( $keywords_i );
2662
+ if ( ! empty( $traverse ) ) {
2663
+ foreach ( $traverse as $keyword ) {
2664
+ $keywords[] = $keyword;
2665
+ }
2666
+ }
2667
+ }
2668
 
2669
+ if ( ! empty( $aioseop_options['aiosp_use_tags_as_keywords'] ) ) {
2670
+ $keywords = array_merge( $keywords, $this->get_all_tags( $id ) );
2671
+ }
2672
+ // autometa
2673
+ $autometa = stripslashes( get_post_meta( $id, 'autometa', true ) );
2674
+ if ( isset( $autometa ) && ! empty( $autometa ) ) {
2675
+ $autometa_array = explode( ' ', $autometa );
2676
+ foreach ( $autometa_array as $e ) {
2677
+ $keywords[] = $e;
2678
+ }
2679
+ }
2680
 
2681
+ if ( $aioseop_options['aiosp_use_categories'] && ! is_page() ) {
2682
+ $keywords = array_merge( $keywords, $this->get_all_categories( $id ) );
2683
+ }
2684
+ }
2685
+ }
 
 
 
 
2686
  }
2687
+
2688
+ return $this->get_unique_keywords( $keywords );
2689
  }
2690
 
2691
+ function keyword_string_to_list( $keywords ) {
2692
+ $traverse = Array();
2693
+ $keywords_i = str_replace( '"', '', $keywords );
2694
+ if ( isset( $keywords_i ) && ! empty( $keywords_i ) ) {
2695
+ $traverse = explode( ',', $keywords_i );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2696
  }
2697
 
2698
+ return $traverse;
2699
+ }
 
2700
 
2701
+ function get_all_tags( $id = 0 ) {
2702
+ $keywords = Array();
2703
+ $tags = get_the_tags( $id );
2704
+ if ( ! empty( $tags ) && is_array( $tags ) ) {
2705
+ foreach ( $tags as $tag ) {
2706
+ $keywords[] = $this->internationalize( $tag->name );
2707
+ }
2708
  }
2709
+ // Ultimate Tag Warrior integration
2710
+ global $utw;
2711
+ if ( $utw ) {
2712
+ $tags = $utw->GetTagsForPost( $p );
2713
+ if ( is_array( $tags ) ) {
2714
+ foreach ( $tags as $tag ) {
2715
+ $tag = $tag->tag;
2716
+ $tag = str_replace( '_', ' ', $tag );
2717
+ $tag = str_replace( '-', ' ', $tag );
2718
+ $tag = stripslashes( $tag );
2719
+ $keywords[] = $tag;
2720
  }
2721
  }
 
2722
  }
2723
 
2724
+ return $keywords;
 
 
2725
  }
2726
 
2727
+ function get_unique_keywords( $keywords ) {
2728
+ return implode( ',', $this->clean_keyword_list( $keywords ) );
2729
+ }
2730
 
2731
+ function clean_keyword_list( $keywords ) {
2732
+ $small_keywords = array();
2733
+ if ( ! is_array( $keywords ) ) {
2734
+ $keywords = $this->keyword_string_to_list( $keywords );
2735
+ }
2736
+ if ( ! empty( $keywords ) ) {
2737
+ foreach ( $keywords as $word ) {
2738
+ $small_keywords[] = trim( $this->strtolower( $word ) );
2739
+ }
2740
+ }
2741
 
2742
+ return array_unique( $small_keywords );
2743
+ }
2744
 
2745
+ function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id = '', $taxonomy = '' ) {
2746
+ $terms = $this->get_all_term_data( $term_id );
2747
+ if ( ! empty( $terms ) ) {
2748
+ $new_terms = $this->get_all_term_data( $new_term_id );
2749
+ if ( empty( $new_terms ) ) {
2750
+ foreach ( $terms as $k => $v ) {
2751
+ add_term_meta( $new_term_id, $k, $v, true );
2752
+ }
2753
+ add_term_meta( $term_id, '_aioseop_term_was_split', true, true );
2754
+ }
2755
  }
2756
  }
2757
 
2758
+ function get_all_term_data( $term_id ) {
2759
+ $terms = Array();
2760
+ $optlist = Array(
2761
+ 'keywords',
2762
+ 'description',
2763
+ 'title',
2764
+ 'custom_link',
2765
+ 'sitemap_exclude',
2766
+ 'disable',
2767
+ 'disable_analytics',
2768
+ 'noindex',
2769
+ 'nofollow',
2770
+ 'noodp',
2771
+ 'noydir',
2772
+ 'titleatr',
2773
+ 'menulabel'
2774
+ );
2775
+ foreach ( $optlist as $f ) {
2776
+ $meta = get_term_meta( $term_id, '_aioseop_' . $f, true );
2777
+ if ( ! empty( $meta ) ) {
2778
+ $terms[ '_aioseop_' . $f ] = $meta;
2779
+ }
2780
+ }
2781
+
2782
+ return $terms;
2783
  }
2784
 
2785
+ function add_page_icon() {
2786
+ wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
2787
+ wp_enqueue_style( 'wp-pointer' );
2788
+ $this->add_admin_pointers();
 
 
 
 
 
 
2789
 
2790
+
2791
+ wp_enqueue_style( 'aiosp_admin_style', AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css' );
2792
+ ?>
2793
+ <script>
2794
+ function aioseop_show_pointer(handle, value) {
2795
+ if (typeof( jQuery ) != 'undefined') {
2796
+ var p_edge = 'bottom';
2797
+ var p_align = 'center';
2798
+ if (typeof( jQuery(value.pointer_target).pointer) != 'undefined') {
2799
+ if (typeof( value.pointer_edge ) != 'undefined') p_edge = value.pointer_edge;
2800
+ if (typeof( value.pointer_align ) != 'undefined') p_align = value.pointer_align;
2801
+ jQuery(value.pointer_target).pointer({
2802
+ content: value.pointer_text,
2803
+ position: {
2804
+ edge: p_edge,
2805
+ align: p_align
2806
+ },
2807
+ close: function () {
2808
+ jQuery.post(ajaxurl, {
2809
+ pointer: handle,
2810
+ action: 'dismiss-wp-pointer'
2811
+ });
2812
+ }
2813
+ }).pointer('open');
2814
+ }
2815
+ }
2816
  }
2817
+ <?php
2818
+ if ( ! empty( $this->pointers ) ) {
2819
+ ?>
2820
+ if (typeof( jQuery ) != 'undefined') {
2821
+ jQuery(document).ready(function () {
2822
+ var admin_pointer;
2823
+ var admin_index;
2824
+ <?php
2825
+ foreach( $this->pointers as $k => $p )
2826
+ {if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) {
2827
+ ?>admin_index = "<?php echo esc_attr( $k ); ?>";
2828
+ admin_pointer = <?php echo json_encode( $p ); ?>;
2829
+ aioseop_show_pointer(admin_index, admin_pointer);
2830
+ <?php
2831
+ }}
2832
+ ?>
2833
+ });
2834
+ }
2835
+ <?php
2836
+ }
2837
+ ?>
2838
+ </script>
2839
+ <?php
2840
  }
2841
 
2842
+ function add_admin_pointers() {
2843
+ if ( AIOSEOPPRO ) {
2844
+ $this->pointers['aioseop_menu_236'] = Array(
2845
+ 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-pro-aioseop_class',
2846
+ 'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
2847
+ . '</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>',
2848
+ 'pointer_edge' => 'top',
2849
+ 'pointer_align' => 'left',
2850
+ 'pointer_scope' => 'global'
2851
+ );
2852
+ $this->pointers['aioseop_welcome_230'] = Array(
2853
+ 'pointer_target' => '#aioseop_top_button',
2854
+ 'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
2855
+ . '</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>',
2856
+ 'pointer_edge' => 'bottom',
2857
+ 'pointer_align' => 'left',
2858
+ 'pointer_scope' => 'local'
2859
+ );
2860
+ $this->filter_pointers();
2861
+ } else {
2862
+ $this->pointers['aioseop_menu_220'] = Array(
2863
+ 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class',
2864
+ 'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
2865
+ . '</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>',
2866
+ 'pointer_edge' => 'top',
2867
+ 'pointer_align' => 'left',
2868
+ 'pointer_scope' => 'global'
2869
+ );
2870
+ $this->pointers['aioseop_welcome_220'] = Array(
2871
+ 'pointer_target' => '#aioseop_top_button',
2872
+ 'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
2873
+ . '</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>',
2874
+ 'pointer_edge' => 'bottom',
2875
+ 'pointer_align' => 'left',
2876
+ 'pointer_scope' => 'local'
2877
+ );
2878
+ $this->filter_pointers();
2879
+ }
2880
  }
2881
 
2882
+ function add_page_hooks() {
 
 
 
 
 
 
2883
 
 
2884
  global $aioseop_options;
2885
 
2886
+ $post_objs = get_post_types( '', 'objects' );
2887
+ $pt = array_keys( $post_objs );
2888
+ $rempost = array( 'revision', 'nav_menu_item' );
2889
+ $pt = array_diff( $pt, $rempost );
2890
+ $post_types = Array();
2891
 
2892
+ $aiosp_enablecpost = '';
2893
+ if ( isset( $_REQUEST['aiosp_enablecpost'] ) ) {
2894
+ $aiosp_enablecpost = $_REQUEST['aiosp_enablecpost'];
2895
+ }
2896
+
2897
+ foreach ( $pt as $p ) {
2898
+ if ( ! empty( $post_objs[ $p ]->label ) ) {
2899
+ if ( $post_objs[ $p ]->_builtin && empty( $aioseop_options['aiosp_enablecpost'] ) ) {
2900
+ $post_types[ $p ] = $post_objs[ $p ]->label;
2901
+ } elseif ( ! empty( $aioseop_options['aiosp_enablecpost'] ) || $aiosp_enablecpost == 'on' ) {
2902
+ $post_types[ $p ] = $post_objs[ $p ]->label;
2903
+ }
2904
  } else {
2905
+ $post_types[ $p ] = $p;
2906
  }
2907
+ }
2908
+
2909
+ foreach ( $pt as $p ) {
2910
+ if ( ! empty( $post_objs[ $p ]->label ) ) {
2911
+ $all_post_types[ $p ] = $post_objs[ $p ]->label;
2912
+ }
2913
+ }
2914
+
2915
+ $taxes = get_taxonomies( '', 'objects' );
2916
+ $tx = array_keys( $taxes );
2917
+ $remtax = array( 'nav_menu', 'link_category', 'post_format' );
2918
+ $tx = array_diff( $tx, $remtax );
2919
+ $tax_types = Array();
2920
+ foreach ( $tx as $t ) {
2921
+ if ( ! empty( $taxes[ $t ]->label ) ) {
2922
+ $tax_types[ $t ] = $taxes[ $t ]->label;
2923
  } else {
2924
+ $taxes[ $t ] = $t;
 
 
 
 
 
 
 
 
 
 
 
 
2925
  }
2926
  }
2927
+ $this->default_options['posttypecolumns']['initial_options'] = $post_types;
2928
+ $this->default_options['cpostactive']['initial_options'] = $all_post_types;
2929
+ $this->default_options['cpostnoindex']['initial_options'] = $post_types;
2930
+ $this->default_options['cpostnofollow']['initial_options'] = $post_types;
2931
+ $this->default_options['cpostnoodp']['initial_options'] = $post_types;
2932
+ $this->default_options['cpostnoydir']['initial_options'] = $post_types;
2933
+ if ( AIOSEOPPRO ) {
2934
+ $this->default_options['taxactive']['initial_options'] = $tax_types;
2935
+ }
2936
+ $this->default_options['google_author_location']['initial_options'] = $post_types;
2937
+ $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' ) ) );
2938
+ $this->default_options['google_author_location']['default'] = array_keys( $this->default_options['google_author_location']['initial_options'] );
2939
 
2940
+ foreach ( $post_types as $p => $pt ) {
2941
+ $field = $p . '_title_format';
2942
+ $name = $post_objs[ $p ]->labels->singular_name;
2943
+ if ( ! isset( $this->default_options[ $field ] ) ) {
2944
+ $this->default_options[ $field ] = Array(
2945
+ 'name' => "$name " . __( 'Title Format:', 'all-in-one-seo-pack' ) . "<br />($p)",
2946
+ 'type' => 'text',
2947
+ 'default' => '%post_title% | %blog_title%',
2948
+ 'condshow' => Array(
2949
+ 'aiosp_rewrite_titles' => 1,
2950
+ 'aiosp_enablecpost' => 'on',
2951
+ 'aiosp_cpostadvanced' => 'on',
2952
+ 'aiosp_cposttitles' => 'on',
2953
+ 'aiosp_cpostactive\[\]' => $p
2954
+ )
2955
+ );
2956
+ $this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' )
2957
+ . '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
2958
+ __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
2959
+ __( '%post_title% - The original title of the post.', 'all-in-one-seo-pack' ) . '</li><li>';
2960
+ $taxes = get_object_taxonomies( $p, 'objects' );
2961
+ if ( ! empty( $taxes ) ) {
2962
+ foreach ( $taxes as $n => $t ) {
2963
+ $this->help_text[ $field ] .= sprintf( __( "%%tax_%s%% - This post's associated %s taxonomy title", 'all-in-one-seo-pack' ), $n, $t->label ) . '</li><li>';
2964
+ }
2965
  }
2966
+ $this->help_text[ $field ] .=
2967
+ __( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
2968
+ __( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
2969
+ __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
2970
+ __( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
2971
+ '</ul>';
2972
+ $this->help_anchors[ $field ] = '#custom-titles';
2973
+ $this->layout['cpt']['options'][] = $field;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2974
  }
2975
  }
2976
+ global $wp_roles;
2977
+ if ( ! isset( $wp_roles ) ) {
2978
+ $wp_roles = new WP_Roles();
2979
+ }
2980
+ $role_names = $wp_roles->get_names();
2981
+ ksort( $role_names );
2982
+ $this->default_options['ga_exclude_users']['initial_options'] = $role_names;
 
 
 
 
 
 
 
2983
 
2984
+ unset( $tax_types['category'] );
2985
+ unset( $tax_types['post_tag'] );
2986
+ $this->default_options['tax_noindex']['initial_options'] = $tax_types;
2987
+ if ( empty( $tax_types ) ) {
2988
+ unset( $this->default_options['tax_noindex'] );
2989
+ }
2990
 
2991
+ if ( AIOSEOPPRO ) {
2992
+ foreach ( $tax_types as $p => $pt ) {
2993
+ $field = $p . '_tax_title_format';
2994
+ $name = $pt;
2995
+ if ( ! isset( $this->default_options[ $field ] ) ) {
2996
+ $this->default_options[ $field ] = Array(
2997
+ 'name' => "$name " . __( 'Taxonomy Title Format:', 'all-in-one-seo-pack' ),
2998
+ 'type' => 'text',
2999
+ 'default' => '%taxonomy_title% | %blog_title%',
3000
+ 'condshow' => Array(
3001
+ 'aiosp_rewrite_titles' => 1,
3002
+ 'aiosp_enablecpost' => 'on',
3003
+ 'aiosp_cpostadvanced' => 'on',
3004
+ 'aiosp_cposttitles' => 'on',
3005
+ 'aiosp_taxactive\[\]' => $p
3006
+ )
3007
+ );
3008
+ $this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' ) .
3009
+ '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
3010
+ __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
3011
+ __( '%taxonomy_title% - The original title of the taxonomy', 'all-in-one-seo-pack' ) . '</li><li>' .
3012
+ __( '%taxonomy_description% - The description of the taxonomy', 'all-in-one-seo-pack' ) . '</li></ul>';
3013
+ $this->help_anchors[ $field ] = '#custom-titles';
3014
+ $this->layout['cpt']['options'][] = $field;
3015
  }
3016
  }
3017
  }
3018
+ $this->setting_options();
3019
+ $this->add_help_text_links();
 
 
3020
 
3021
+ if ( AIOSEOPPRO ) {
3022
+ global $aioseop_update_checker;
3023
+ add_action( "{$this->prefix}update_options", Array(
3024
+ $aioseop_update_checker,
3025
+ 'license_change_check'
3026
+ ), 10, 2 );
3027
+ add_action( "{$this->prefix}settings_update", Array( $aioseop_update_checker, 'update_check' ), 10, 2 );
 
 
 
 
 
 
 
3028
  }
3029
 
3030
+ add_filter( "{$this->prefix}display_options", Array( $this, 'filter_options' ), 10, 2 );
3031
+ parent::add_page_hooks();
3032
  }
3033
 
3034
+ function settings_page_init() {
3035
+ add_filter( "{$this->prefix}submit_options", Array( $this, 'filter_submit' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3036
  }
3037
 
3038
+ function enqueue_scripts() {
3039
+ add_filter( "{$this->prefix}display_settings", Array( $this, 'filter_settings' ), 10, 3 );
3040
+ add_filter( "{$this->prefix}display_options", Array( $this, 'filter_options' ), 10, 2 );
3041
+ parent::enqueue_scripts();
3042
+ }
3043
 
3044
+ function filter_submit( $submit ) {
3045
+ $submit['Submit_Default']['value'] = __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' &raquo;';
3046
+ $submit['Submit_All_Default'] = Array(
3047
+ 'type' => 'submit',
3048
+ 'class' => 'button-secondary',
3049
+ 'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' &raquo;'
3050
+ );
3051
 
3052
+ return $submit;
3053
+ }
 
 
 
3054
 
3055
+ /**
3056
+ * Handle resetting options to defaults, but preserve the license key if pro.
3057
+ */
3058
+ function reset_options( $location = null, $delete = false ) {
3059
+ if ( AIOSEOPPRO ) {
3060
+ global $aioseop_update_checker;
3061
+ }
3062
+ if ( $delete === true ) {
3063
 
3064
+ if ( AIOSEOPPRO ) {
3065
+ $license_key = '';
3066
+ if ( isset( $this->options ) && isset( $this->options['aiosp_license_key'] ) ) {
3067
+ $license_key = $this->options['aiosp_license_key'];
3068
+ }
3069
  }
 
 
 
 
 
 
 
 
3070
 
3071
+ $this->delete_class_option( $delete );
3072
 
3073
+ if ( AIOSEOPPRO ) {
3074
+ $this->options = Array( 'aiosp_license_key' => $license_key );
3075
+ } else {
3076
+ $this->options = Array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3077
  }
3078
  }
3079
+ $default_options = $this->default_options( $location );
 
 
 
 
 
 
 
3080
 
3081
+ if ( AIOSEOPPRO ) {
3082
+ foreach ( $default_options as $k => $v ) {
3083
+ if ( $k != 'aiosp_license_key' ) {
3084
+ $this->options[ $k ] = $v;
3085
+ }
3086
+ }
3087
+ $aioseop_update_checker->license_key = $this->options['aiosp_license_key'];
3088
+ } else {
3089
+ foreach ( $default_options as $k => $v ) {
3090
+ $this->options[ $k ] = $v;
 
3091
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3092
  }
3093
+ $this->update_class_option( $this->options );
 
 
 
 
 
 
 
 
3094
  }
3095
 
3096
+ function filter_settings( $settings, $location, $current ) {
3097
+ if ( $location == null ) {
3098
+ $prefix = $this->prefix;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3099
 
3100
+ foreach ( Array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt ) {
3101
+ unset( $settings["{$prefix}$opt"] );
3102
+ }
3103
 
3104
+ if ( ! class_exists( 'DOMDocument' ) ) {
3105
+ unset( $settings['{prefix}google_connect'] );
3106
+ }
3107
+ if ( AIOSEOPPRO ) {
3108
+ if ( ! empty( $this->options['aiosp_license_key'] ) ) {
3109
+ $settings['aiosp_license_key']['type'] = 'password';
3110
+ $settings['aiosp_license_key']['size'] = 38;
 
 
 
3111
  }
3112
  }
3113
+ } elseif ( $location == 'aiosp' ) {
3114
+ global $post, $aioseop_sitemap;
3115
+ $prefix = $this->get_prefix( $location ) . $location . '_';
3116
+ if ( ! empty( $post ) ) {
3117
+ $post_type = get_post_type( $post );
3118
+ if ( ! empty( $this->options['aiosp_cpostnoindex'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoindex'] ) ) ) {
3119
+ $settings["{$prefix}noindex"]['type'] = 'select';
3120
+ $settings["{$prefix}noindex"]['initial_options'] = Array(
3121
+ '' => __( 'Default - noindex', 'all-in-one-seo-pack' ),
3122
+ 'off' => __( 'index', 'all-in-one-seo-pack' ),
3123
+ 'on' => __( 'noindex', 'all-in-one-seo-pack' )
3124
+ );
3125
+ }
3126
+ if ( ! empty( $this->options['aiosp_cpostnofollow'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnofollow'] ) ) ) {
3127
+ $settings["{$prefix}nofollow"]['type'] = 'select';
3128
+ $settings["{$prefix}nofollow"]['initial_options'] = Array(
3129
+ '' => __( 'Default - nofollow', 'all-in-one-seo-pack' ),
3130
+ 'off' => __( 'follow', 'all-in-one-seo-pack' ),
3131
+ 'on' => __( 'nofollow', 'all-in-one-seo-pack' )
3132
+ );
3133
+ }
3134
+ if ( ! empty( $this->options['aiosp_cpostnoodp'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoodp'] ) ) ) {
3135
+ $settings["{$prefix}noodp"]['type'] = 'select';
3136
+ $settings["{$prefix}noodp"]['initial_options'] = Array(
3137
+ '' => __( 'Default - noodp', 'all-in-one-seo-pack' ),
3138
+ 'off' => __( 'odp', 'all-in-one-seo-pack' ),
3139
+ 'on' => __( 'noodp', 'all-in-one-seo-pack' )
3140
+ );
3141
+ }
3142
+ if ( ! empty( $this->options['aiosp_cpostnoydir'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoydir'] ) ) ) {
3143
+ $settings["{$prefix}noydir"]['type'] = 'select';
3144
+ $settings["{$prefix}noydir"]['initial_options'] = Array(
3145
+ '' => __( 'Default - noydir', 'all-in-one-seo-pack' ),
3146
+ 'off' => __( 'ydir', 'all-in-one-seo-pack' ),
3147
+ 'on' => __( 'noydir', 'all-in-one-seo-pack' )
3148
+ );
3149
+ }
3150
+ global $post;
3151
+ $info = $this->get_page_snippet_info();
3152
+ extract( $info );
3153
+ $settings["{$prefix}title"]['placeholder'] = $title;
3154
+ $settings["{$prefix}description"]['placeholder'] = $description;
3155
+ $settings["{$prefix}keywords"]['placeholder'] = $keywords;
3156
+ }
3157
 
3158
+ if ( ! AIOSEOPPRO ) {
3159
+ if ( ! current_user_can( 'update_plugins' ) ) {
3160
+ unset( $settings["{$prefix}upgrade"] );
3161
+ }
 
 
 
 
 
 
3162
  }
 
 
 
 
 
 
 
 
 
 
 
3163
 
3164
+ if ( ! is_object( $aioseop_sitemap ) ) {
3165
+ unset( $settings['aiosp_sitemap_exclude'] );
 
 
 
 
 
 
 
 
 
 
 
 
3166
  }
3167
+ if ( is_object( $post ) ) {
3168
+ if ( $post->post_type != 'page' ) {
3169
+ unset( $settings["{$prefix}titleatr"] );
3170
+ unset( $settings["{$prefix}menulabel"] );
3171
+ }
3172
+ }
3173
+ if ( ! empty( $this->options[ $this->prefix . 'togglekeywords' ] ) ) {
3174
+ unset( $settings["{$prefix}keywords"] );
3175
+ unset( $settings["{$prefix}togglekeywords"] );
3176
+ } elseif ( ! empty( $current["{$prefix}togglekeywords"] ) ) {
3177
+ unset( $settings["{$prefix}keywords"] );
3178
+ }
3179
+ if ( empty( $this->options['aiosp_can'] ) || ( empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
3180
+ unset( $settings["{$prefix}custom_link"] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3181
  }
 
 
 
 
 
3182
  }
 
 
3183
 
3184
+ return $settings;
 
 
 
 
3185
  }
3186
 
3187
+ function filter_options( $options, $location ) {
3188
+ if ( $location == 'aiosp' ) {
3189
+ global $post;
3190
+ if ( ! empty( $post ) ) {
3191
+ $prefix = $this->prefix;
3192
+ $post_type = get_post_type( $post );
3193
+ foreach ( Array( 'noindex', 'nofollow', 'noodp', 'noydir' ) as $no ) {
3194
+ if ( empty( $this->options[ 'aiosp_cpost' . $no ] ) || ( ! in_array( $post_type, $this->options[ 'aiosp_cpost' . $no ] ) ) ) {
3195
+ if ( isset( $options["{$prefix}{$no}"] ) && ( $options["{$prefix}{$no}"] != 'on' ) ) {
3196
+ unset( $options["{$prefix}{$no}"] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3197
  }
3198
  }
3199
  }
3200
  }
3201
+ }
3202
+ if ( $location == null ) {
3203
+ $prefix = $this->prefix;
3204
+ if ( isset( $options["{$prefix}rewrite_titles"] ) && ( ! empty( $options["{$prefix}rewrite_titles"] ) ) ) {
3205
+ $options["{$prefix}rewrite_titles"] = 1;
 
 
3206
  }
3207
+ if ( ( isset( $options["{$prefix}enablecpost"] ) ) && ( $options["{$prefix}enablecpost"] === '' ) ) {
3208
+ $options["{$prefix}enablecpost"] = 0;
 
3209
  }
3210
+ if ( ( isset( $options["{$prefix}use_original_title"] ) ) && ( $options["{$prefix}use_original_title"] === '' ) ) {
3211
+ $options["{$prefix}use_original_title"] = 0;
 
3212
  }
3213
+ }
3214
+
3215
+ return $options;
3216
+ }
3217
+
3218
+ function template_redirect() {
3219
+ global $aioseop_options;
3220
+
3221
+ $post = $this->get_queried_object();
3222
 
3223
+ if ( ! $this->is_page_included() ) {
3224
+ return;
3225
+ }
3226
+
3227
+ if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
3228
+ $force_rewrites = 1;
3229
+ if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) {
3230
+ $force_rewrites = $aioseop_options['aiosp_force_rewrites'];
3231
  }
3232
+ if ( $force_rewrites ) {
3233
+ ob_start( array( $this, 'output_callback_for_title' ) );
3234
+ } else {
3235
+ add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
3236
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3237
  }
 
3238
  }
3239
 
3240
+ function is_page_included() {
3241
+ global $aioseop_options;
3242
+ if ( is_feed() ) {
3243
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3244
  }
3245
+ if ( aioseop_mrt_exclude_this_page() ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3246
  return false;
3247
  }
3248
+ $post = $this->get_queried_object();
3249
+ $post_type = '';
3250
+ if ( ! empty( $post ) && ! empty( $post->post_type ) ) {
3251
+ $post_type = $post->post_type;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3252
  }
3253
+ if ( empty( $aioseop_options['aiosp_enablecpost'] ) ) {
3254
+ $wp_post_types = get_post_types( Array( '_builtin' => true ) ); // don't display meta if SEO isn't enabled on custom post types -- pdb
3255
+ if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) {
3256
+ return false;
3257
+ }
3258
+ } else {
3259
+ $wp_post_types = $aioseop_options['aiosp_cpostactive'];
3260
+ if ( empty( $wp_post_types ) ) {
3261
+ $wp_post_types = Array();
3262
+ }
3263
+ if ( AIOSEOPPRO ) {
3264
+ if ( is_tax() ) {
3265
+ if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! is_tax( $aioseop_options['aiosp_taxactive'] ) ) {
3266
+ return false;
3267
+ }
3268
+ } elseif ( is_category() ) {
3269
+ if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! in_array( 'category', $aioseop_options['aiosp_taxactive'] ) ) {
3270
+ return false;
3271
+ }
3272
+ } elseif ( is_tag() ) {
3273
+ if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! in_array( 'post_tag', $aioseop_options['aiosp_taxactive'] ) ) {
3274
+ return false;
3275
+ }
3276
+ } else if ( ! in_array( $post_type, $wp_post_types ) && ! is_front_page() && ! is_post_type_archive( $wp_post_types ) && ! is_404() ) {
3277
+ return false;
3278
+ }
3279
  } else {
3280
+ if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) {
3281
+ return false;
3282
+ }
3283
+ if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) {
3284
+ return false;
3285
+ }
3286
  }
 
 
 
 
3287
  }
3288
 
3289
+ $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
 
 
 
 
 
 
 
 
3290
 
3291
+ $aiosp_disable = $aiosp_disable_analytics = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3292
 
3293
+ if ( ! empty( $this->meta_opts ) ) {
3294
+ if ( isset( $this->meta_opts['aiosp_disable'] ) ) {
3295
+ $aiosp_disable = $this->meta_opts['aiosp_disable'];
 
 
 
 
 
 
 
 
 
 
3296
  }
3297
+ if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) {
3298
+ $aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics'];
 
 
 
 
 
3299
  }
3300
+ }
3301
+
3302
+ if ( $aiosp_disable ) {
3303
+ if ( ! $aiosp_disable_analytics ) {
3304
+ if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
3305
+ remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
3306
+ add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3307
  }
3308
  }
3309
+
3310
+ return false;
3311
  }
3312
+
3313
+ if ( ! empty( $this->meta_opts ) && $this->meta_opts['aiosp_disable'] == true ) {
3314
+ return false;
3315
+ }
3316
+
3317
+ return true;
3318
  }
3319
 
3320
+ function output_callback_for_title( $content ) {
3321
+ return $this->rewrite_title( $content );
 
 
 
3322
  }
3323
 
3324
+ /*** Used for forcing title rewrites. ***/
3325
+ function rewrite_title( $header ) {
3326
+ global $wp_query;
3327
+ if ( ! $wp_query ) {
3328
+ $header .= "<!-- no wp_query found! -->\n";
3329
+
3330
+ return $header;
3331
+ }
3332
+ $title = $this->wp_title();
3333
+ if ( ! empty( $title ) ) {
3334
+ $header = $this->replace_title( $header, $title );
3335
  }
 
 
3336
 
3337
+ return $header;
 
 
 
 
3338
  }
3339
 
3340
+ function replace_title( $content, $title ) {
3341
+ //We can probably improve this... I'm not sure half of this is even being used.
3342
+ $title = trim( strip_tags( $title ) );
3343
+ $title_tag_start = '<title';
3344
+ $title_tag_end = '</title';
3345
+ $start = $this->strpos( $content, $title_tag_start );
3346
+ $end = $this->strpos( $content, $title_tag_end );
3347
+ $this->title_start = $start;
3348
+ $this->title_end = $end;
3349
+ $this->orig_title = $title;
3350
+
3351
+ return preg_replace( '/<title([^>]*?)\s*>([^<]*?)<\/title\s*>/is', '<title\\1>' . preg_replace( '/(\$|\\\\)(?=\d)/', '\\\\\1', strip_tags( $title ) ) . '</title>', $content, 1 );
3352
  }
3353
 
3354
+ function add_hooks() {
3355
+ global $aioseop_options, $aioseop_update_checker;
3356
+
3357
+ $role = get_role( 'administrator' );
3358
+ if ( is_object( $role ) ) {
3359
+ $role->add_cap( 'aiosp_manage_seo' );
3360
  }
3361
+
3362
+ aioseop_update_settings_check();
3363
+ add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
3364
+ if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
3365
+ add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 );
3366
  }
3367
+
3368
+ if ( is_admin() ) {
3369
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
3370
+ add_action( 'admin_head', array( $this, 'add_page_icon' ) );
3371
+ add_action( 'admin_init', 'aioseop_addmycolumns', 1 );
3372
+ add_action( 'admin_init', 'aioseop_handle_ignore_notice' );
3373
+ if ( AIOSEOPPRO ) {
3374
+ if ( current_user_can( 'update_plugins' ) ) {
3375
+ add_action( 'admin_notices', Array( $aioseop_update_checker, 'key_warning' ) );
3376
+ }
3377
+ add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, Array(
3378
+ $aioseop_update_checker,
3379
+ 'add_plugin_row'
3380
+ ) );
3381
+ }
3382
+ } else {
3383
+ if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' ) {
3384
+ remove_action( 'wp_head', 'rel_canonical' );
3385
  }
3386
+ ////analytics
3387
+ if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
3388
+ add_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
3389
+ }
3390
+ add_filter( 'wp_list_pages', 'aioseop_list_pages' );
3391
+ add_action( 'wp_head', array( $this, 'wp_head' ), apply_filters( 'aioseop_wp_head_priority', 1 ) );
3392
+ add_action( 'template_redirect', array( $this, 'template_redirect' ), 0 );
3393
+ add_filter( 'wp_list_pages_excludes', 'aioseop_get_pages_start' );
3394
+ add_filter( 'get_pages', 'aioseop_get_pages' );
3395
  }
 
 
 
 
3396
  }
3397
 
3398
+ function visibility_warning() {
3399
 
3400
+ $aioseop_visibility_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
3401
+
3402
+ if ( '0' == get_option( 'blog_public' ) && empty( $aioseop_visibility_notice_dismissed ) ) {
3403
+
3404
+ printf( '
3405
+ <div id="message" class="error notice is-dismissible aioseop-notice visibility-notice">
3406
+ <p>
3407
+ <strong>%1$s</strong>
3408
+ %2$s
3409
+
3410
+ </p>
3411
+ </div>',
3412
+ __( 'Warning: You\'re blocking access to search engines.', 'all-in-one-seo-pack' ),
3413
+ 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>' ) );
3414
+
3415
+ } elseif ( '1' == get_option( 'blog_public' ) && ! empty( $aioseop_visibility_notice_dismissed ) ) {
3416
+ delete_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed' );
3417
+ }
3418
  }
3419
 
3420
+ function woo_upgrade_notice() {
3421
+
3422
+ $aioseop_woo_upgrade_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
3423
+
3424
+ if ( class_exists( 'WooCommerce' ) && empty( $aioseop_woo_upgrade_notice_dismissed ) && current_user_can( 'manage_options' ) ) {
3425
+
3426
+ printf( '
3427
+ <div id="message" class="notice-info notice is-dismissible aioseop-notice woo-upgrade-notice">
3428
+ <p>
3429
+ <strong>%1$s</strong>
3430
+ %2$s
3431
 
3432
+ </p>
3433
+ </div>',
3434
+ __( 'We\'ve detected you\'re running WooCommerce.', 'all-in-one-seo-pack' ),
3435
+ 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>' ) );
3436
+
3437
+ } elseif ( ! class_exists( 'WooCommerce' ) && ! empty( $aioseop_woo_upgrade_notice_dismissed ) ) {
3438
+ delete_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed' );
3439
+ }
3440
  }
3441
 
3442
+ function make_unique_att_desc( $description ) {
3443
+ global $wp_query;
3444
+ if ( is_attachment() ) {
3445
 
3446
+ $url = $this->aiosp_mrt_get_url( $wp_query );
3447
+ if ( $url ) {
3448
+ $matches = Array();
3449
+ preg_match_all( '/(\d+)/', $url, $matches );
3450
+ if ( is_array( $matches ) ) {
3451
+ $uniqueDesc = join( '', $matches[0] );
3452
+ }
3453
+ }
3454
+ $description .= ' ' . $uniqueDesc;
3455
 
3456
+ return $description;
 
 
 
 
 
3457
  }
 
 
3458
  }
3459
 
3460
+ function wp_head() {
3461
+ if ( ! $this->is_page_included() ) {
3462
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3463
  }
3464
+ $opts = $this->meta_opts;
3465
+ global $aioseop_update_checker, $wp_query, $aioseop_options, $posts;
3466
+ static $aioseop_dup_counter = 0;
3467
+ $aioseop_dup_counter ++;
3468
+ if ( $aioseop_dup_counter > 1 ) {
3469
+ 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";
3470
 
3471
+ return;
3472
+ }
3473
+ if ( is_home() && ! is_front_page() ) {
3474
+ $post = aiosp_common::get_blog_page();
3475
+ } else {
3476
+ $post = $this->get_queried_object();
3477
+ }
3478
+ $meta_string = null;
3479
+ $description = '';
3480
+ // logging - rewrite handler check for output buffering
3481
+ $this->check_rewrite_handler();
3482
+ if ( AIOSEOPPRO ) {
3483
+ echo "\n<!-- All in One SEO Pack Pro $this->version by Michael Torbert of Semper Fi Web Design";
3484
+ } else {
3485
+ echo "\n<!-- All in One SEO Pack $this->version by Michael Torbert of Semper Fi Web Design";
3486
+ }
3487
+ if ( $this->ob_start_detected ) {
3488
+ echo 'ob_start_detected ';
3489
+ }
3490
+ echo "[$this->title_start,$this->title_end] ";
3491
+ echo "-->\n";
3492
+ if ( AIOSEOPPRO ) {
3493
+ echo '<!-- ' . __( 'Debug String', 'all-in-one-seo-pack' ) . ': ' . $aioseop_update_checker->get_verification_code() . " -->\n";
3494
+ }
3495
+ $blog_page = aiosp_common::get_blog_page( $post );
3496
+ $save_posts = $posts;
3497
+ if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
3498
+ global $posts;
3499
+ $opts = $this->meta_opts = $this->get_current_options( Array(), 'aiosp', null, $post );
3500
+ $posts = Array();
3501
+ $posts[] = $post;
3502
+ }
3503
+ $posts = $save_posts;
3504
+ $description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) ); // get the description
3505
+ // handle the description format
3506
+ if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) {
3507
+ $description = $this->trim_description( $description );
3508
+ if ( ! isset( $meta_string ) ) {
3509
+ $meta_string = '';
3510
+ }
3511
+ // description format
3512
+ $description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) );
3513
+ $desc_attr = '';
3514
+ if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
3515
+ $desc_attr = 'itemprop="description"';
3516
+ }
3517
+ $desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr );
3518
+ $meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );
3519
+ }
3520
+ // get the keywords
3521
+ $togglekeywords = 0;
3522
+ if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) {
3523
+ $togglekeywords = $aioseop_options['aiosp_togglekeywords'];
3524
+ }
3525
+ if ( $togglekeywords == 0 && ! ( is_front_page() && is_paged() ) ) {
3526
+ $keywords = $this->get_main_keywords();
3527
+ $keywords = $this->apply_cf_fields( $keywords );
3528
+ $keywords = apply_filters( 'aioseop_keywords', $keywords );
3529
+
3530
+ if ( isset( $keywords ) && ! empty( $keywords ) ) {
3531
+ if ( isset( $meta_string ) ) {
3532
+ $meta_string .= "\n";
3533
+ }
3534
+ $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
3535
+ $key_attr = '';
3536
+ if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
3537
+ $key_attr = 'itemprop="keywords"';
3538
+ }
3539
+ $key_attr = apply_filters( 'aioseop_keywords_attributes', $key_attr );
3540
+ $meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
3541
+ }
3542
+ }
3543
+ // handle noindex, nofollow - robots meta
3544
+ $robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
3545
+ if ( ! empty( $robots_meta ) ) {
3546
+ $meta_string .= '<meta name="robots" content="' . esc_attr( $robots_meta ) . '" />' . "\n";
3547
+ }
3548
+ // handle site verification
3549
+ if ( is_front_page() ) {
3550
+ foreach (
3551
+ Array(
3552
+ 'google' => 'google-site-verification',
3553
+ 'bing' => 'msvalidate.01',
3554
+ 'pinterest' => 'p:domain_verify'
3555
+ ) as $k => $v
3556
+ ) {
3557
+ if ( ! empty( $aioseop_options["aiosp_{$k}_verify"] ) ) {
3558
+ $meta_string .= '<meta name="' . $v . '" content="' . trim( strip_tags( $aioseop_options["aiosp_{$k}_verify"] ) ) . '" />' . "\n";
3559
+ }
3560
+ }
3561
 
3562
+ // sitelinks search
3563
+ if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) || ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
3564
+ $meta_string .= $this->sitelinks_search_box() . "\n";
3565
+ }
3566
+ }
3567
+ // handle extra meta fields
3568
+ foreach ( Array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) {
3569
+ if ( ! empty( $aioseop_options["aiosp_{$meta}_tags"] ) ) {
3570
+ $$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags"] ), ENT_QUOTES );
 
 
 
 
 
 
 
 
 
 
 
3571
  } else {
3572
+ $$meta = '';
 
3573
  }
3574
+ }
3575
+ if ( is_page() && isset( $page_meta ) && ! empty( $page_meta ) && ( ! is_front_page() || empty( $front_meta ) ) ) {
3576
+ if ( isset( $meta_string ) ) {
3577
+ $meta_string .= "\n";
 
 
3578
  }
3579
+ $meta_string .= $page_meta;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3580
  }
3581
+ if ( is_single() && isset( $post_meta ) && ! empty( $post_meta ) ) {
3582
+ if ( isset( $meta_string ) ) {
3583
+ $meta_string .= "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3584
  }
3585
+ $meta_string .= $post_meta;
3586
+ }
3587
+ // handle authorship
3588
+ $authorship = $this->get_google_authorship( $post );
3589
+ $publisher = apply_filters( 'aioseop_google_publisher', $authorship['publisher'] );
3590
+ if ( ! empty( $publisher ) ) {
3591
+ $meta_string = '<link rel="publisher" href="' . esc_url( $publisher ) . '" />' . "\n" . $meta_string;
3592
+ }
3593
+ $author = apply_filters( 'aioseop_google_author', $authorship['author'] );
3594
+ if ( ! empty( $author ) ) {
3595
+ $meta_string = '<link rel="author" href="' . esc_url( $author ) . '" />' . "\n" . $meta_string;
3596
  }
 
 
3597
 
3598
+ if ( is_front_page() && ! empty( $front_meta ) ) {
3599
+ if ( isset( $meta_string ) ) {
3600
+ $meta_string .= "\n";
3601
+ }
3602
+ $meta_string .= $front_meta;
 
3603
  } else {
3604
+ if ( is_home() && ! empty( $home_meta ) ) {
3605
+ if ( isset( $meta_string ) ) {
3606
+ $meta_string .= "\n";
3607
+ }
3608
+ $meta_string .= $home_meta;
3609
+ }
3610
  }
3611
+ $prev_next = $this->get_prev_next_links( $post );
3612
+ $prev = apply_filters( 'aioseop_prev_link', $prev_next['prev'] );
3613
+ $next = apply_filters( 'aioseop_next_link', $prev_next['next'] );
3614
+ if ( ! empty( $prev ) ) {
3615
+ $meta_string .= "<link rel='prev' href='" . esc_url( $prev ) . "' />\n";
3616
+ }
3617
+ if ( ! empty( $next ) ) {
3618
+ $meta_string .= "<link rel='next' href='" . esc_url( $next ) . "' />\n";
3619
+ }
3620
+ if ( $meta_string != null ) {
3621
+ echo "$meta_string\n";
3622
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3623
 
3624
+ // handle canonical links
3625
+ $show_page = true;
3626
+ if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
3627
+ $show_page = false;
 
 
 
 
3628
  }
 
 
 
 
3629
 
3630
+ if ( $aioseop_options['aiosp_can'] ) {
3631
+ $url = '';
3632
+ if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) {
3633
+ $url = $opts['aiosp_custom_link'];
3634
+ }
3635
+ if ( empty( $url ) ) {
3636
+ $url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
3637
+ }
3638
 
3639
+ $url = $this->validate_url_scheme( $url );
3640
+
3641
+ $url = apply_filters( 'aioseop_canonical_url', $url );
3642
+ if ( ! empty( $url ) ) {
3643
+ echo '<link rel="canonical" href="' . esc_url( $url ) . '" />' . "\n";
3644
+ }
3645
+ }
3646
+ do_action( 'aioseop_modules_wp_head' );
3647
  if ( AIOSEOPPRO ) {
3648
+ echo "<!-- /all in one seo pack pro -->\n";
 
 
3649
  } else {
3650
+ echo "<!-- /all in one seo pack -->\n";
3651
  }
 
 
3652
  }
3653
 
3654
+ function check_rewrite_handler() {
3655
+ global $aioseop_options;
3656
+
3657
+ $force_rewrites = 1;
3658
+ if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) {
3659
+ $force_rewrites = $aioseop_options['aiosp_force_rewrites'];
3660
  }
 
 
 
 
 
 
 
 
 
3661
 
3662
+ if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) && $force_rewrites ) {
3663
+ // make the title rewrite as short as possible
3664
+ if ( function_exists( 'ob_list_handlers' ) ) {
3665
+ $active_handlers = ob_list_handlers();
3666
+ } else {
3667
+ $active_handlers = array();
3668
+ }
3669
+ if ( sizeof( $active_handlers ) > 0 &&
3670
+ $this->strtolower( $active_handlers[ sizeof( $active_handlers ) - 1 ] ) ==
3671
+ $this->strtolower( 'All_in_One_SEO_Pack::output_callback_for_title' )
3672
+ ) {
3673
+ ob_end_flush();
3674
+ } else {
3675
+ $this->log( 'another plugin interfering?' );
3676
+ // if we get here there *could* be trouble with another plugin :(
3677
+ $this->ob_start_detected = true;
3678
+ if ( $this->option_isset( 'rewrite_titles' ) ) { // try alternate method -- pdb
3679
+ $aioseop_options['aiosp_rewrite_titles'] = 0;
3680
+ $force_rewrites = 0;
3681
+ add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
3682
+ }
3683
+ if ( function_exists( 'ob_list_handlers' ) ) {
3684
+ foreach ( ob_list_handlers() as $handler ) {
3685
+ $this->log( "detected output handler $handler" );
3686
+ }
3687
  }
3688
  }
3689
  }
 
3690
  }
3691
 
3692
+ function trim_description( $description ) {
3693
+ $description = trim( wp_strip_all_tags( $description ) );
3694
+ $description = str_replace( '"', '&quot;', $description );
3695
+ $description = str_replace( "\r\n", ' ', $description );
3696
+ $description = str_replace( "\n", ' ', $description );
3697
 
3698
+ return $description;
 
 
 
 
 
3699
  }
3700
 
3701
+ function apply_description_format( $description, $post = null ) {
3702
+ global $aioseop_options;
3703
+ $description_format = $aioseop_options['aiosp_description_format'];
3704
+ if ( ! isset( $description_format ) || empty( $description_format ) ) {
3705
+ $description_format = '%description%';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3706
  }
3707
+ $description = str_replace( '%description%', apply_filters( 'aioseop_description_override', $description ), $description_format );
3708
+ if ( strpos( $description, '%blog_title%' ) !== false ) {
3709
+ $description = str_replace( '%blog_title%', get_bloginfo( 'name' ), $description );
 
 
 
 
 
 
 
 
 
 
3710
  }
3711
+ if ( strpos( $description, '%blog_description%' ) !== false ) {
3712
+ $description = str_replace( '%blog_description%', get_bloginfo( 'description' ), $description );
3713
+ }
3714
+ if ( strpos( $description, '%wp_title%' ) !== false ) {
3715
+ $description = str_replace( '%wp_title%', $this->get_original_title(), $description );
3716
+ }
3717
+ if ( strpos( $description, '%post_title%' ) !== false ) {
3718
+ $description = str_replace( '%post_title%', $this->get_aioseop_title( $post ), $description );
3719
+ }
3720
+
3721
+
3722
+ /*this was intended to make attachment descriptions unique if pulling from the parent... let's remove it and see if there are any problems
3723
+ *on the roadmap is to have a better hierarchy for attachment description pulling
3724
+ * if ($aioseop_options['aiosp_can']) $description = $this->make_unique_att_desc($description);
3725
+ */
3726
+
3727
+ return $description;
3728
  }
3729
 
3730
+ function get_robots_meta() {
3731
  global $aioseop_options;
3732
+ $opts = $this->meta_opts;
3733
+ $page = $this->get_page_number();
3734
+ $robots_meta = $tax_noindex = '';
3735
+ if ( isset( $aioseop_options['aiosp_tax_noindex'] ) ) {
3736
+ $tax_noindex = $aioseop_options['aiosp_tax_noindex'];
3737
+ }
3738
+
3739
+ if ( empty( $tax_noindex ) || ! is_array( $tax_noindex ) ) {
3740
+ $tax_noindex = Array();
3741
+ }
3742
+
3743
+ $aiosp_noindex = $aiosp_nofollow = $aiosp_noodp = $aiosp_noydir = '';
3744
+ $noindex = 'index';
3745
+ $nofollow = 'follow';
3746
+ if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax()
3747
+ && ( ( is_date() && ! empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && ! empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
3748
+ || ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) )
3749
+ || ( is_search() && ! empty( $aioseop_options['aiosp_search_noindex'] ) )
3750
+ || ( is_404() && ! empty( $aioseop_options['aiosp_404_noindex'] ) )
3751
+ || ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
3752
+ ) {
3753
+ $noindex = 'noindex';
3754
+ } elseif ( ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) ) {
3755
+ $post_type = get_post_type();
3756
+ if ( ! empty( $opts ) ) {
3757
+ $aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
3758
+ $aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
3759
+ $aiosp_noodp = htmlspecialchars( stripslashes( $opts['aiosp_noodp'] ) );
3760
+ $aiosp_noydir = htmlspecialchars( stripslashes( $opts['aiosp_noydir'] ) );
3761
+ }
3762
+ if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || ! empty( $aioseop_options['aiosp_cpostnoindex'] )
3763
+ || ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_cpostnoodp'] ) || ! empty( $aioseop_options['aiosp_cpostnoydir'] )
3764
+ || ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
3765
+ ) {
3766
+ if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && ( ( $page > 1 ) ) ) ||
3767
+ ( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) )
3768
+ ) {
3769
+ $noindex = 'noindex';
3770
+ }
3771
+ if ( ( $aiosp_nofollow == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && ( ( $page > 1 ) ) ) ||
3772
+ ( ( $aiosp_nofollow == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) ) )
3773
+ ) {
3774
+ $nofollow = 'nofollow';
3775
+ }
3776
+ if ( ( $aiosp_noodp == 'on' ) || ( empty( $aiosp_noodp ) && ( ! empty( $aioseop_options['aiosp_cpostnoodp'] ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoodp'] ) ) ) ) ) {
3777
+ $aiosp_noodp = true;
3778
+ } else {
3779
+ $aiosp_noodp = false;
3780
+ }
3781
+ if ( ( $aiosp_noydir == 'on' ) || ( empty( $aiosp_noydir ) && ( ! empty( $aioseop_options['aiosp_cpostnoydir'] ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoydir'] ) ) ) ) ) {
3782
+ $aiosp_noydir = true;
3783
+ } else {
3784
+ $aiosp_noydir = false;
3785
+ }
3786
+ }
3787
  }
3788
+ if ( ! empty( $aioseop_options['aiosp_noodp'] ) && $aioseop_options['aiosp_noodp'] ) {
3789
+ $aiosp_noodp = true;
3790
+ }
3791
+ if ( ! empty( $aioseop_options['aiosp_noydir'] ) && $aioseop_options['aiosp_noydir'] ) {
3792
+ $aiosp_noydir = true;
3793
+ }
3794
+ if ( $aiosp_noodp ) {
3795
+ $nofollow .= ',noodp';
3796
+ }
3797
+ if ( $aiosp_noydir ) {
3798
+ $nofollow .= ',noydir';
3799
+ }
3800
+ $robots_meta = $noindex . ',' . $nofollow;
3801
+ if ( $robots_meta == 'index,follow' ) {
3802
+ $robots_meta = '';
3803
+ }
3804
+
3805
+ return $robots_meta;
3806
  }
3807
 
3808
+ function sitelinks_search_box() {
 
3809
  global $aioseop_options;
3810
+ $home_url = esc_url( get_home_url() );
3811
+ $name_block = $search_block = '';
3812
+ if ( ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
3813
+ if ( ! empty( $aioseop_options['aiosp_google_specify_site_name'] ) ) {
3814
+ $blog_name = $aioseop_options['aiosp_google_specify_site_name'];
 
 
 
 
 
 
 
 
 
 
3815
  } else {
3816
+ $blog_name = get_bloginfo( 'name' );
 
 
3817
  }
3818
+ $blog_name = esc_attr( $blog_name );
3819
+ $name_block = <<<EOF
3820
+ "name": "{$blog_name}",
3821
+ EOF;
3822
+ }
3823
 
3824
+ if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) ) {
3825
+ $search_block = <<<EOF
3826
+ "potentialAction": {
3827
+ "@type": "SearchAction",
3828
+ "target": "{$home_url}/?s={search_term}",
3829
+ "query-input": "required name=search_term"
3830
+ },
3831
+ EOF;
3832
+ }
3833
 
3834
+ $search_box = <<<EOF
3835
+ <script type="application/ld+json">
3836
+ {
3837
+ "@context": "http://schema.org",
3838
+ "@type": "WebSite",
3839
+ EOF;
3840
+ if ( ! empty( $name_block ) ) {
3841
+ $search_box .= $name_block;
3842
+ }
3843
+ if ( ! empty( $search_block ) ) {
3844
+ $search_box .= $search_block;
3845
+ }
3846
+ $search_box .= <<<EOF
3847
+ "url": "{$home_url}/"
3848
+ }
3849
+ </script>
3850
+ EOF;
3851
 
3852
+ return apply_filters( 'aiosp_sitelinks_search_box', $search_box );
3853
+ }
 
 
 
 
 
3854
 
3855
+ function get_google_authorship( $post ) {
3856
+ global $aioseop_options;
3857
+ $page = $this->get_page_number();
3858
+ // handle authorship
3859
+ $googleplus = $publisher = $author = '';
3860
 
3861
+ if ( ! empty( $post ) && isset( $post->post_author ) && empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
3862
+ $googleplus = get_the_author_meta( 'googleplus', $post->post_author );
3863
+ }
3864
 
3865
+ if ( empty( $googleplus ) && ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
3866
+ $googleplus = $aioseop_options['aiosp_google_publisher'];
3867
+ }
 
3868
 
3869
+ if ( ( is_front_page() ) && ( $page < 2 ) ) {
3870
+ if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
3871
+ $publisher = $aioseop_options['aiosp_google_publisher'];
3872
  }
3873
 
3874
+ if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) ) {
3875
+ if ( empty( $aioseop_options['aiosp_google_enable_publisher'] ) ) {
3876
+ $publisher = '';
3877
+ } elseif ( ! empty( $aioseop_options['aiosp_google_specify_publisher'] ) ) {
3878
+ $publisher = $aioseop_options['aiosp_google_specify_publisher'];
3879
+ }
3880
+ }
3881
+ }
3882
+ if ( is_singular() && ( ! empty( $googleplus ) ) ) {
3883
+ $author = $googleplus;
3884
+ } else if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
3885
+ $author = $aioseop_options['aiosp_google_publisher'];
3886
+ }
3887
+
3888
+ if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) {
3889
+ if ( empty( $aioseop_options['aiosp_google_author_location'] ) ) {
3890
+ $aioseop_options['aiosp_google_author_location'] = Array();
3891
+ }
3892
+ if ( is_front_page() && ! in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) {
3893
+ $author = '';
3894
  } else {
3895
+ if ( in_array( 'all', $aioseop_options['aiosp_google_author_location'] ) ) {
3896
+ if ( is_singular() && ! is_singular( $aioseop_options['aiosp_google_author_location'] ) ) {
3897
+ $author = '';
 
 
 
 
 
3898
  }
3899
  } else {
3900
+ if ( ! is_singular( $aioseop_options['aiosp_google_author_location'] ) ) {
3901
+ $author = '';
3902
+ }
3903
  }
 
 
 
 
 
 
 
 
 
3904
  }
3905
+ }
3906
+
3907
+ return Array( 'publisher' => $publisher, 'author' => $author );
3908
+ }
3909
+
3910
+ function get_prev_next_links( $post = null ) {
3911
+ $prev = $next = '';
3912
+ $page = $this->get_page_number();
3913
+ if ( is_home() || is_archive() || is_paged() ) {
3914
+ global $wp_query;
3915
+ $max_page = $wp_query->max_num_pages;
3916
+ if ( $page > 1 ) {
3917
+ $prev = get_previous_posts_page_link();
 
 
 
 
 
 
 
3918
  }
3919
+ if ( $page < $max_page ) {
3920
+ $paged = $GLOBALS['paged'];
3921
+ if ( ! is_single() ) {
3922
+ if ( ! $paged ) {
3923
+ $paged = 1;
3924
+ }
3925
+ $nextpage = intval( $paged ) + 1;
3926
+ if ( ! $max_page || $max_page >= $nextpage ) {
3927
+ $next = get_pagenum_link( $nextpage );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3928
  }
3929
  }
 
 
 
 
3930
  }
3931
+ } else if ( is_page() || is_single() ) {
3932
+ $numpages = 1;
3933
+ $multipage = 0;
3934
+ $page = get_query_var( 'page' );
3935
+ if ( ! $page ) {
3936
+ $page = 1;
 
 
 
 
 
 
 
3937
  }
3938
+ if ( is_single() || is_page() || is_feed() ) {
3939
+ $more = 1;
 
 
 
 
 
 
 
 
 
 
 
3940
  }
3941
+ $content = $post->post_content;
3942
+ if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
3943
+ if ( $page > 1 ) {
3944
+ $more = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3945
  }
3946
+ $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
3947
+ $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
3948
+ $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
3949
+ // Ignore nextpage at the beginning of the content.
3950
+ if ( 0 === strpos( $content, '<!--nextpage-->' ) ) {
3951
+ $content = substr( $content, 15 );
3952
+ }
3953
+ $pages = explode( '<!--nextpage-->', $content );
3954
+ $numpages = count( $pages );
3955
+ if ( $numpages > 1 ) {
3956
+ $multipage = 1;
3957
+ }
3958
+ }
3959
+ if ( ! empty( $page ) ) {
3960
+ if ( $page > 1 ) {
3961
+ $prev = _wp_link_page( $page - 1 );
3962
+ }
3963
+ if ( $page + 1 <= $numpages ) {
3964
+ $next = _wp_link_page( $page + 1 );
3965
+ }
3966
+ }
3967
+ if ( ! empty( $prev ) ) {
3968
+ $prev = $this->substr( $prev, 9, - 2 );
3969
+ }
3970
+ if ( ! empty( $next ) ) {
3971
+ $next = $this->substr( $next, 9, - 2 );
3972
+ }
 
 
 
 
 
 
3973
  }
3974
 
3975
+ return Array( 'prev' => $prev, 'next' => $next );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3976
  }
3977
 
3978
  /**
3979
+ *
3980
+ * Validates whether the url should be https or http.
3981
+ *
3982
+ * Mainly we're just using this for canonical URLS, but eventually it may be useful for other things
3983
+ *
3984
+ * @param $url
3985
+ *
3986
+ * @return string $url
3987
+ *
3988
+ * @since 2.3.5
3989
  */
3990
+ function validate_url_scheme( $url ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3991
 
3992
+ //TODO we should check for the site setting in the case of auto
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3993
 
3994
+ global $aioseop_options;
 
 
 
 
 
3995
 
3996
+ if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) {
3997
+ $url = preg_replace( '/^https:/i', 'http:', $url );
3998
+ }
3999
+ if ( $aioseop_options['aiosp_can_set_protocol'] == 'https' ) {
4000
+ $url = preg_replace( '/^http:/i', 'https:', $url );
4001
+ }
 
 
4002
 
4003
+ return $url;
 
 
 
 
 
 
4004
  }
4005
 
4006
+ function override_options( $options, $location, $settings ) {
4007
+ if ( class_exists( 'DOMDocument' ) ) {
4008
+ $options['aiosp_google_connect'] = $settings['aiosp_google_connect']['default'];
4009
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4010
 
4011
+ return $options;
 
 
 
 
 
 
4012
  }
4013
 
4014
+ function aiosp_google_analytics() {
 
 
 
 
4015
  global $aioseop_options;
4016
+ $analytics = '';
4017
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_exclude_users'] ) ) {
4018
+ if ( is_user_logged_in() ) {
4019
+ global $current_user;
4020
+ if ( empty( $current_user ) ) {
4021
+ wp_get_current_user();
4022
+ }
4023
+ if ( ! empty( $current_user ) ) {
4024
+ $intersect = array_intersect( $aioseop_options['aiosp_ga_exclude_users'], $current_user->roles );
4025
+ if ( ! empty( $intersect ) ) {
4026
+ return;
4027
+ }
4028
+ }
4029
+ }
 
 
4030
  }
4031
+ if ( ! empty( $aioseop_options['aiosp_google_analytics_id'] ) ) {
4032
+ ob_start();
4033
+ $analytics = $this->universal_analytics();
4034
+ echo $analytics;
4035
+ if ( empty( $analytics ) ) {
4036
+ ?>
4037
+ <script type="text/javascript">
4038
+ var _gaq = _gaq || [];
4039
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
4040
+ ?> var pluginUrl =
4041
+ '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
4042
+ _gaq.push(['_require', 'inpage_linkid', pluginUrl]);
4043
+ <?php
4044
+ }
4045
+ ?> _gaq.push(['_setAccount', '<?php
4046
+ echo $aioseop_options['aiosp_google_analytics_id'];
4047
+ ?>']);
4048
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
4049
+ ?> _gaq.push(['_gat._anonymizeIp']);
4050
+ <?php
4051
+ }
4052
+ ?>
4053
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
4054
+ ?> _gaq.push(['_setAllowLinker', true]);
4055
+ <?php
4056
+ }
4057
+ ?>
4058
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
4059
+ $domain = $this->get_analytics_domain();
4060
+ ?> _gaq.push(['_setDomainName', '<?php echo $domain; ?>']);
4061
+ <?php
4062
+ }
4063
+ ?> _gaq.push(['_trackPageview']);
4064
+ (function () {
4065
+ var ga = document.createElement('script');
4066
+ ga.type = 'text/javascript';
4067
+ ga.async = true;
4068
+ <?php
4069
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
4070
+ ?> ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
4071
+ <?php
4072
+ } else {
4073
+ ?> ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
4074
+ <?php
4075
  }
4076
+ ?> var s = document.getElementsByTagName('script')[0];
4077
+ s.parentNode.insertBefore(ga, s);
4078
+ })();
4079
+ </script>
4080
+ <?php
4081
+ }
4082
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && $aioseop_options['aiosp_ga_track_outbound_links'] ) { ?>
4083
+ <script type="text/javascript">
4084
+ function recordOutboundLink(link, category, action) {
4085
+ <?php if ( ! empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { ?>
4086
+ ga('send', 'event', category, action);
4087
+ <?php }
4088
+ if ( empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { ?>
4089
+ _gat._getTrackerByName()._trackEvent(category, action);
4090
+ <?php } ?>
4091
+ if (link.target == '_blank') return true;
4092
+ setTimeout('document.location = "' + link.href + '"', 100);
4093
+ return false;
4094
+ }
4095
+ /* use regular Javascript for this */
4096
+ function getAttr(ele, attr) {
4097
+ var result = (ele.getAttribute && ele.getAttribute(attr)) || null;
4098
+ if (!result) {
4099
+ var attrs = ele.attributes;
4100
+ var length = attrs.length;
4101
+ for (var i = 0; i < length; i++)
4102
+ if (attr[i].nodeName === attr) result = attr[i].nodeValue;
4103
+ }
4104
+ return result;
4105
  }
4106
 
4107
+ function aiosp_addLoadEvent(func) {
4108
+ var oldonload = window.onload;
4109
+ if (typeof window.onload != 'function') {
4110
+ window.onload = func;
4111
+ } else {
4112
+ window.onload = function () {
4113
+ if (oldonload) {
4114
+ oldonload();
4115
+ }
4116
+ func();
4117
+ }
4118
+ }
4119
  }
 
 
 
 
 
 
 
4120
 
4121
+ function aiosp_addEvent(element, evnt, funct) {
4122
+ if (element.attachEvent)
4123
+ return element.attachEvent('on' + evnt, funct);
4124
+ else
4125
+ return element.addEventListener(evnt, funct, false);
4126
+ }
 
 
4127
 
4128
+ aiosp_addLoadEvent(function () {
4129
+ var links = document.getElementsByTagName('a');
4130
+ for (var x = 0; x < links.length; x++) {
4131
+ if (typeof links[x] == 'undefined') continue;
4132
+ aiosp_addEvent(links[x], 'onclick', function () {
4133
+ var mydomain = new RegExp(document.domain, 'i');
4134
+ href = getAttr(this, 'href');
4135
+ if (href && href.toLowerCase().indexOf('http') === 0 && !mydomain.test(href)) {
4136
+ recordOutboundLink(this, 'Outbound Links', href);
4137
+ }
4138
+ });
4139
+ }
4140
+ });
4141
+ </script>
4142
+ <?php
4143
  }
4144
+ $analytics = ob_get_clean();
4145
+ }
4146
+ echo apply_filters( 'aiosp_google_analytics', $analytics );
4147
  }
4148
 
4149
+ function universal_analytics() {
4150
+ global $aioseop_options;
4151
+ $analytics = '';
4152
+ if ( ! empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) {
4153
+ $allow_linker = $cookie_domain = $domain = $addl_domains = $domain_list = '';
4154
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) ) {
4155
+ $cookie_domain = $this->get_analytics_domain();
4156
+ }
4157
+ if ( ! empty( $cookie_domain ) ) {
4158
+ $cookie_domain = esc_js( $cookie_domain );
4159
+ $cookie_domain = "'cookieDomain': '{$cookie_domain}'";
4160
+ }
4161
+ if ( empty( $cookie_domain ) ) {
4162
+ $domain = ", 'auto'";
4163
+ }
4164
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
4165
+ $allow_linker = "'allowLinker': true";
4166
+ if ( ! empty( $aioseop_options['aiosp_ga_addl_domains'] ) ) {
4167
+ $addl_domains = trim( $aioseop_options['aiosp_ga_addl_domains'] );
4168
+ $addl_domains = preg_split( '/[\s,]+/', $addl_domains );
4169
+ if ( ! empty( $addl_domains ) ) {
4170
+ foreach ( $addl_domains as $d ) {
4171
+ $d = $this->sanitize_domain( $d );
4172
+ if ( ! empty( $d ) ) {
4173
+ if ( ! empty( $domain_list ) ) {
4174
+ $domain_list .= ', ';
4175
+ }
4176
+ $domain_list .= "'" . $d . "'";
4177
+ }
4178
+ }
4179
+ }
4180
+ }
4181
+ }
4182
+ $extra_options = '';
4183
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
4184
+ $extra_options .= "ga('require', 'displayfeatures');";
4185
+ }
4186
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_enhanced_ecommerce'] ) ) {
4187
+ if ( ! empty( $extra_options ) ) {
4188
+ $extra_options .= "\n\t\t\t";
4189
+ }
4190
+ $extra_options .= "ga('require', 'ec');";
4191
+ }
4192
+ if ( ! empty( $domain_list ) ) {
4193
+ if ( ! empty( $extra_options ) ) {
4194
+ $extra_options .= "\n\t\t\t";
4195
+ }
4196
+ $extra_options .= "ga('require', 'linker');\n\t\t\tga('linker:autoLink', [{$domain_list}] );";
4197
+ }
4198
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
4199
+ if ( ! empty( $extra_options ) ) {
4200
+ $extra_options .= "\n\t\t\t";
4201
+ }
4202
+ $extra_options .= "ga('require', 'linkid', 'linkid.js');";
4203
+ }
4204
+
4205
+ if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
4206
+ if ( ! empty( $extra_options ) ) {
4207
+ $extra_options .= "\n\t\t\t";
4208
+ }
4209
+ $extra_options .= "ga('set', 'anonymizeIp', true);";
4210
+ }
4211
+ $js_options = Array();
4212
+ foreach ( Array( 'cookie_domain', 'allow_linker' ) as $opts ) {
4213
+ if ( ! empty( $$opts ) ) {
4214
+ $js_options[] = $$opts;
4215
+ }
4216
+ }
4217
+ if ( ! empty( $js_options ) ) {
4218
+ $js_options = join( ',', $js_options );
4219
+ $js_options = ', { ' . $js_options . ' } ';
4220
+ } else {
4221
+ $js_options = '';
4222
+ }
4223
+ $analytics_id = esc_js( $aioseop_options['aiosp_google_analytics_id'] );
4224
+ $analytics = <<<EOF
4225
+ <script>
4226
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4227
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
4228
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
4229
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
4230
+
4231
+ ga('create', '{$analytics_id}'{$domain}{$js_options});
4232
+ {$extra_options}
4233
+ ga('send', 'pageview');
4234
+ </script>
4235
+
4236
+ EOF;
4237
+ }
4238
+
4239
+ return $analytics;
4240
  }
4241
 
4242
+ function get_analytics_domain() {
4243
+ global $aioseop_options;
4244
+ if ( ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
4245
+ return $this->sanitize_domain( $aioseop_options['aiosp_ga_domain'] );
4246
  }
4247
+
4248
+ return '';
4249
  }
4250
 
4251
  function save_post_data( $id ) {
4252
  $awmp_edit = $nonce = null;
4253
+ if ( empty( $_POST ) ) {
4254
+ return false;
4255
+ }
4256
+ if ( isset( $_POST['aiosp_edit'] ) ) {
4257
+ $awmp_edit = $_POST['aiosp_edit'];
4258
+ }
4259
+ if ( isset( $_POST['nonce-aioseop-edit'] ) ) {
4260
+ $nonce = $_POST['nonce-aioseop-edit'];
4261
+ }
4262
 
4263
+ if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
4264
+
4265
+ $optlist = Array(
4266
+ 'keywords',
4267
+ 'description',
4268
+ 'title',
4269
+ 'custom_link',
4270
+ 'sitemap_exclude',
4271
+ 'disable',
4272
+ 'disable_analytics',
4273
+ 'noindex',
4274
+ 'nofollow',
4275
+ 'noodp',
4276
+ 'noydir',
4277
+ 'titleatr',
4278
+ 'menulabel'
4279
+ );
4280
+ if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
4281
+ unset( $optlist['custom_link'] );
4282
  }
4283
+ foreach ( $optlist as $f ) {
4284
  $field = "aiosp_$f";
4285
+ if ( isset( $_POST[ $field ] ) ) {
4286
+ $$field = $_POST[ $field ];
4287
+ }
4288
+ }
4289
 
4290
+ $optlist = Array(
4291
+ 'keywords',
4292
+ 'description',
4293
+ 'title',
4294
+ 'custom_link',
4295
+ 'noindex',
4296
+ 'nofollow',
4297
+ 'noodp',
4298
+ 'noydir',
4299
+ 'titleatr',
4300
+ 'menulabel'
4301
+ );
4302
+ if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
4303
+ unset( $optlist['custom_link'] );
4304
  }
4305
+ foreach ( $optlist as $f ) {
4306
  delete_post_meta( $id, "_aioseop_{$f}" );
4307
+ }
4308
 
4309
+ if ( $this->is_admin() ) {
4310
+ delete_post_meta( $id, '_aioseop_sitemap_exclude' );
4311
+ delete_post_meta( $id, '_aioseop_disable' );
4312
+ delete_post_meta( $id, '_aioseop_disable_analytics' );
4313
  }
4314
 
4315
  foreach ( $optlist as $f ) {
4316
+ $var = "aiosp_$f";
4317
  $field = "_aioseop_$f";
4318
+ if ( isset( $$var ) && ! empty( $$var ) ) {
4319
+ add_post_meta( $id, $field, $$var );
4320
+ }
4321
+ }
4322
+ if ( isset( $aiosp_sitemap_exclude ) && ! empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) {
4323
+ add_post_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
4324
+ }
4325
+ if ( isset( $aiosp_disable ) && ! empty( $aiosp_disable ) && $this->is_admin() ) {
4326
+ add_post_meta( $id, '_aioseop_disable', $aiosp_disable );
4327
+ if ( isset( $aiosp_disable_analytics ) && ! empty( $aiosp_disable_analytics ) ) {
4328
+ add_post_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
4329
+ }
4330
  }
4331
+ }
4332
  }
4333
 
4334
  function display_tabbed_metabox( $post, $metabox ) {
4336
  echo '<div class="aioseop_tabs">';
4337
  $header = $this->get_metabox_header( $tabs );
4338
  echo $header;
4339
+ $active = '';
4340
+ foreach ( $tabs as $m ) {
4341
+ echo '<div id="' . $m['id'] . '" class="aioseop_tab"' . $active . '>';
4342
+ if ( ! $active ) {
4343
+ $active = ' style="display:none;"';
4344
+ }
4345
  $m['args'] = $m['callback_args'];
4346
  $m['callback'][0]->{$m['callback'][1]}( $post, $m );
4347
  echo '</div>';
4349
  echo '</div>';
4350
  }
4351
 
4352
+ function get_metabox_header( $tabs ) {
4353
+ $header = '<ul class="aioseop_header_tabs hide">';
4354
+ $active = ' active';
4355
+ foreach ( $tabs as $t ) {
4356
+ if ( $active ) {
4357
+ $title = __( 'Main Settings', 'all-in-one-seo-pack' );
4358
+ } else {
4359
+ $title = $t['title'];
4360
+ }
4361
+ $header .= '<li><label class="aioseop_header_nav"><a class="aioseop_header_tab' . $active . '" href="#' . $t['id'] . '">' . $title . '</a></label></li>';
4362
+ $active = '';
4363
+ }
4364
+ $header .= '</ul>';
4365
+
4366
+ return $header;
4367
+ }
4368
+
4369
  function admin_bar_menu() {
4370
  global $wp_admin_bar, $aioseop_admin_menu, $aioseop_options, $post;
4371
 
4372
  $toggle = '';
4373
+ if ( isset( $_POST['aiosp_use_original_title'] ) && isset( $_POST['aiosp_admin_bar'] ) ) {
4374
+ $toggle = 'on';
4375
+ }
4376
+ if ( isset( $_POST['aiosp_use_original_title'] ) && ! isset( $_POST['aiosp_admin_bar'] ) ) {
4377
+ $toggle = 'off';
4378
+ }
4379
 
4380
+ if ( ! empty( $aioseop_options['aiosp_admin_bar'] ) && $toggle != 'off' || isset( $_POST['aiosp_admin_bar'] ) ) {
4381
  $menu_slug = plugin_basename( __FILE__ );
4382
 
4383
  $url = '';
4384
+ if ( function_exists( 'menu_page_url' ) ) {
4385
+ $url = menu_page_url( $menu_slug, 0 );
4386
+ }
4387
+ if ( empty( $url ) ) {
4388
+ $url = esc_url( admin_url( 'admin.php?page=' . $menu_slug ) );
4389
+ }
4390
 
4391
+ $wp_admin_bar->add_menu( array(
4392
+ 'id' => AIOSEOP_PLUGIN_DIRNAME,
4393
+ 'title' => __( 'SEO', 'all-in-one-seo-pack' ),
4394
+ 'href' => $url
4395
+ ) );
4396
+
4397
+ if ( current_user_can( 'update_plugins' ) && ! AIOSEOPPRO ) {
4398
+ $wp_admin_bar->add_menu( array(
4399
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
4400
+ 'title' => __( 'Upgrade To Pro', 'all-in-one-seo-pack' ),
4401
+ 'id' => 'aioseop-pro-upgrade',
4402
+ 'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu',
4403
+ 'meta' => Array( 'target' => '_blank' )
4404
+ ) );
4405
  // add_action( 'admin_bar_menu', array( $this, 'admin_bar_upgrade_menu' ), 1101 );
4406
  }
4407
 
4408
  $aioseop_admin_menu = 1;
4409
+ if ( ! is_admin() && ! empty( $post ) ) {
4410
  $blog_page = aiosp_common::get_blog_page( $post );
4411
+ if ( ! empty( $blog_page ) ) {
4412
+ $post = $blog_page;
4413
+ }
4414
+ $wp_admin_bar->add_menu( array(
4415
+ 'id' => 'aiosp_edit_' . $post->ID,
4416
+ 'parent' => AIOSEOP_PLUGIN_DIRNAME,
4417
+ 'title' => __( 'Edit SEO', 'all-in-one-seo-pack' ),
4418
+ 'href' => get_edit_post_link( $post->ID ) . '#aiosp'
4419
+ ) );
4420
  }
4421
  }
4422
  }
4423
 
 
 
4424
  function menu_order() {
4425
  return 5;
4426
  }
4427
 
4428
  function display_category_metaboxes( $tax ) {
4429
  $screen = 'edit-' . $tax->taxonomy;
4430
+ ?>
4431
+ <div id="poststuff">
4432
+ <?php do_meta_boxes( '', 'advanced', $tax ); ?>
4433
+ </div>
4434
+ <?php
4435
  }
4436
 
4437
  function save_category_metaboxes( $id ) {
4438
  $awmp_edit = $nonce = null;
4439
+ if ( isset( $_POST['aiosp_edit'] ) ) {
4440
+ $awmp_edit = $_POST['aiosp_edit'];
4441
+ }
4442
+ if ( isset( $_POST['nonce-aioseop-edit'] ) ) {
4443
+ $nonce = $_POST['nonce-aioseop-edit'];
4444
+ }
4445
 
4446
+ if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
4447
+ $optlist = Array(
4448
+ 'keywords',
4449
+ 'description',
4450
+ 'title',
4451
+ 'custom_link',
4452
+ 'sitemap_exclude',
4453
+ 'disable',
4454
+ 'disable_analytics',
4455
+ 'noindex',
4456
+ 'nofollow',
4457
+ 'noodp',
4458
+ 'noydir',
4459
+ 'titleatr',
4460
+ 'menulabel'
4461
+ );
4462
+ foreach ( $optlist as $f ) {
4463
  $field = "aiosp_$f";
4464
+ if ( isset( $_POST[ $field ] ) ) {
4465
+ $$field = $_POST[ $field ];
4466
+ }
4467
+ }
4468
 
4469
+ $optlist = Array(
4470
+ 'keywords',
4471
+ 'description',
4472
+ 'title',
4473
+ 'custom_link',
4474
+ 'noindex',
4475
+ 'nofollow',
4476
+ 'noodp',
4477
+ 'noydir',
4478
+ 'titleatr',
4479
+ 'menulabel'
4480
+ );
4481
+ if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
4482
+ unset( $optlist['custom_link'] );
4483
  }
4484
+ foreach ( $optlist as $f ) {
4485
  delete_term_meta( $id, "_aioseop_{$f}" );
4486
+ }
4487
 
4488
+ if ( $this->is_admin() ) {
4489
+ delete_term_meta( $id, '_aioseop_sitemap_exclude' );
4490
+ delete_term_meta( $id, '_aioseop_disable' );
4491
+ delete_term_meta( $id, '_aioseop_disable_analytics' );
4492
  }
4493
 
4494
  foreach ( $optlist as $f ) {
4495
+ $var = "aiosp_$f";
4496
  $field = "_aioseop_$f";
4497
+ if ( isset( $$var ) && ! empty( $$var ) ) {
4498
+ add_term_meta( $id, $field, $$var );
4499
+ }
4500
+ }
4501
+ if ( isset( $aiosp_sitemap_exclude ) && ! empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) {
4502
+ add_term_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
4503
+ }
4504
+ if ( isset( $aiosp_disable ) && ! empty( $aiosp_disable ) && $this->is_admin() ) {
4505
+ add_term_meta( $id, '_aioseop_disable', $aiosp_disable );
4506
+ if ( isset( $aiosp_disable_analytics ) && ! empty( $aiosp_disable_analytics ) ) {
4507
+ add_term_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
4508
+ }
4509
  }
4510
+ }
4511
  }
4512
 
4513
  function admin_menu() {
4514
+ $file = plugin_basename( __FILE__ );
4515
  $menu_name = __( 'All in One SEO', 'all-in-one-seo-pack' );
4516
 
4517
+ $this->locations['aiosp']['default_options']['nonce-aioseop-edit']['default'] = wp_create_nonce( 'edit-aioseop-nonce' );
4518
 
4519
  $custom_menu_order = false;
4520
  global $aioseop_options;
4521
+ if ( ! isset( $aioseop_options['custom_menu_order'] ) ) {
4522
  $custom_menu_order = true;
4523
+ }
4524
 
4525
+ $this->update_options();
4526
 
4527
  $this->add_admin_pointers();
4528
+ if ( ! empty( $this->pointers ) ) {
4529
+ foreach ( $this->pointers as $k => $p ) {
4530
+ if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) {
4531
+ unset( $this->pointers[ $k ] );
4532
+ }
4533
+ }
4534
+ }
4535
 
4536
  $donated = false;
4537
  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' ) ) ) {
4538
+ if ( isset( $_POST['aiosp_donate'] ) ) {
4539
+ $donated = $_POST['aiosp_donate'];
4540
+ }
4541
+ if ( isset( $_POST['Submit'] ) ) {
4542
+ if ( isset( $_POST['aiosp_custom_menu_order'] ) ) {
4543
+ $custom_menu_order = $_POST['aiosp_custom_menu_order'];
4544
+ } else {
4545
  $custom_menu_order = false;
4546
+ }
4547
+ } else if ( ( isset( $_POST['Submit_Default'] ) ) || ( ( isset( $_POST['Submit_All_Default'] ) ) ) ) {
4548
  $custom_menu_order = true;
4549
  }
4550
  } else {
4551
+ if ( isset( $this->options['aiosp_donate'] ) ) {
4552
+ $donated = $this->options['aiosp_donate'];
4553
+ }
4554
+ if ( isset( $this->options['aiosp_custom_menu_order'] ) ) {
4555
+ $custom_menu_order = $this->options['aiosp_custom_menu_order'];
4556
+ }
4557
  }
4558
 
4559
  if ( $custom_menu_order ) {
4563
 
4564
  if ( $donated ) {
4565
  // Thank you for your donation
4566
+ $this->pointers['aioseop_donate'] = Array(
4567
+ 'pointer_target' => '#aiosp_donate_wrapper',
4568
+ 'pointer_text' => '<h3>' . __( 'Thank you!', 'all-in-one-seo-pack' )
4569
+ . '</h3><p>' . __( 'Thank you for your donation, it helps keep this plugin free and actively developed!', 'all-in-one-seo-pack' ) . '</p>'
4570
+ );
4571
  }
4572
 
4573
+ if ( ! AIOSEOPPRO ) {
4574
+ if ( ! empty( $this->pointers ) ) {
4575
+ foreach ( $this->pointers as $k => $p ) {
4576
+ if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) {
4577
+ unset( $this->pointers[ $k ] );
4578
+ }
4579
+ }
4580
+ }
4581
 
4582
+ $this->filter_pointers();
4583
  }
4584
 
4585
+ if ( ! empty( $this->options['aiosp_enablecpost'] ) && $this->options['aiosp_enablecpost'] ) {
4586
  if ( AIOSEOPPRO ) {
4587
+ $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
4588
+ if ( ! empty( $this->options['aiosp_taxactive'] ) ) {
4589
+ foreach ( $this->options['aiosp_taxactive'] as $tax ) {
4590
+ $this->locations['aiosp']['display'][] = 'edit-' . $tax;
4591
+ add_action( "{$tax}_edit_form", Array( $this, 'display_category_metaboxes' ) );
4592
+ add_action( "edited_{$tax}", Array( $this, 'save_category_metaboxes' ) );
4593
+ }
4594
  }
 
4595
  } else {
4596
+ if ( ! empty( $this->options['aiosp_cpostactive'] ) ) {
4597
  $this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
4598
  } else {
4599
  $this->locations['aiosp']['display'] = Array();
4604
  }
4605
 
4606
 
4607
+ add_menu_page( $menu_name, $menu_name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $file, Array(
4608
+ $this,
4609
+ 'display_settings_page'
4610
+ ) );
4611
 
4612
+ add_meta_box( 'aioseop-list', __( 'Join Our Mailing List', 'all-in-one-seo-pack' ), array(
4613
+ 'aiosp_metaboxes',
4614
+ 'display_extra_metaboxes'
4615
+ ), 'aioseop_metaboxes', 'normal', 'core' );
4616
+ if ( AIOSEOPPRO ) {
4617
+ add_meta_box( 'aioseop-about', __( 'About', 'all-in-one-seo-pack' ), array(
4618
+ 'aiosp_metaboxes',
4619
+ 'display_extra_metaboxes'
4620
+ ), 'aioseop_metaboxes', 'side', 'core' );
4621
  } else {
4622
+ add_meta_box( 'aioseop-about', "About <span class='Taha' style='float:right;'>Version <b>" . AIOSEOP_VERSION . '</b></span>', array(
4623
+ 'aiosp_metaboxes',
4624
+ 'display_extra_metaboxes'
4625
+ ), 'aioseop_metaboxes', 'side', 'core' );
4626
  }
4627
+ 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(
4628
+ 'aiosp_metaboxes',
4629
+ 'display_extra_metaboxes'
4630
+ ), 'aioseop_metaboxes', 'side', 'core' );
4631
 
4632
  add_action( 'aioseop_modules_add_menus', Array( $this, 'add_menu' ), 5 );
4633
  do_action( 'aioseop_modules_add_menus', $file );
4634
 
4635
  $metaboxes = apply_filters( 'aioseop_add_post_metabox', Array() );
4636
 
4637
+ if ( ! empty( $metaboxes ) ) {
4638
  if ( $this->tabbed_metaboxes ) {
4639
+ $tabs = Array();
4640
  $tab_num = 0;
4641
  foreach ( $metaboxes as $m ) {
4642
+ if ( ! isset( $tabs[ $m['post_type'] ] ) ) {
4643
+ $tabs[ $m['post_type'] ] = Array();
4644
+ }
4645
  $tabs[ $m['post_type'] ][] = $m;
4646
  }
4647
 
4648
+ if ( ! empty( $tabs ) ) {
4649
+ foreach ( $tabs as $p => $m ) {
4650
  $tab_num = count( $m );
4651
+ $title = $m[0]['title'];
4652
+ if ( $title != $this->plugin_name ) {
4653
+ $title = $this->plugin_name . ' - ' . $title;
4654
+ }
4655
  if ( $tab_num <= 1 ) {
4656
+ if ( ! empty( $m[0]['callback_args']['help_link'] ) ) {
4657
+ $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>';
4658
+ }
4659
  add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] );
4660
  } elseif ( $tab_num > 1 ) {
4661
+ add_meta_box( $m[0]['id'] . '_tabbed', $title, Array(
4662
+ $this,
4663
+ 'display_tabbed_metabox'
4664
+ ), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m );
4665
  }
4666
  }
4667
  }
4668
  } else {
4669
  foreach ( $metaboxes as $m ) {
4670
  $title = $m['title'];
4671
+ if ( $title != $this->plugin_name ) {
4672
+ $title = $this->plugin_name . ' - ' . $title;
4673
+ }
4674
+ if ( ! empty( $m['help_link'] ) ) {
4675
+ $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>';
4676
+ }
4677
  add_meta_box( $m['id'], $title, $m['callback'], $m['post_type'], $m['context'], $m['priority'], $m['callback_args'] );
4678
  }
4679
  }
4680
  }
4681
  }
4682
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4683
  function set_menu_order( $menu_order ) {
4684
  $order = array();
4685
+ $file = plugin_basename( __FILE__ );
4686
  foreach ( $menu_order as $index => $item ) {
4687
+ if ( $item != $file ) {
4688
+ $order[] = $item;
4689
+ }
4690
+ if ( $index == 0 ) {
4691
+ $order[] = $file;
4692
+ }
4693
  }
4694
+
4695
  return $order;
4696
  }
4697
 
4698
  function display_settings_header() {
4699
  }
4700
+
4701
+ function display_settings_footer() {
4702
  }
4703
 
4704
+ function display_right_sidebar() {
4705
  global $wpdb;
4706
 
4707
+ if ( ! get_option( 'aioseop_options' ) ) {
4708
  $msg = "<div style='text-align:center;'><p><strong>Your database options need to be updated.</strong><em>(Back up your database before updating.)</em>
4709
  <FORM action='' method='post' name='aioseop-migrate-options'>
4710
  <input type='hidden' name='nonce-aioseop-migrate-options' value='" . wp_create_nonce( 'aioseop-migrate-nonce-options' ) . "' />
4711
  <input type='submit' name='aioseop_migrate_options' class='button-primary' value='Update Database Options'>
4712
  </FORM>
4713
  </p></div>";
4714
+ aioseop_output_dismissable_notice( $msg, '', 'error' );
4715
  }
4716
+ ?>
4717
  <div class="aioseop_top">
4718
  <div class="aioseop_top_sidebar aioseop_options_wrapper">
4719
  <?php do_meta_boxes( 'aioseop_metaboxes', 'normal', Array( 'test' ) ); ?>
4726
  </style>
4727
  <div class="aioseop_right_sidebar aioseop_options_wrapper">
4728
 
4729
+ <div class="aioseop_sidebar">
4730
+ <?php
4731
+ do_meta_boxes( 'aioseop_metaboxes', 'side', Array( 'test' ) );
4732
+ ?>
4733
+ <script type="text/javascript">
4734
+ //<![CDATA[
4735
+ jQuery(document).ready(function ($) {
4736
+ // close postboxes that should be closed
4737
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
4738
+ // postboxes setup
4739
+ if (typeof postboxes !== 'undefined')
4740
+ postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
4741
+ });
4742
+ //]]>
4743
+ </script>
4744
+ <?php if ( ! AIOSEOPPRO ) { ?>
4745
+ <div class="aioseop_advert aioseop_nopad_all">
4746
+ <?php $adid = mt_rand( 21, 23 );
4747
+
4748
+ if ( $adid == 23 ) { ?>
4749
+ <div
4750
+ style="height: 220px; background-image: url('https://www.wincher.com/Content/Images/plugin/wp/banner30.jpg')">
4751
+ <form style="position: relative; top: 170px; left: 40px;"
4752
+ action="https://www.wincher.com/FastReg" method="post" target="_blank">
4753
+ <input type="hidden" name="adreferer" value="banner<?php echo $adid; ?>"/>
4754
+ <input type="hidden" name="referer" value="all-in-one-seo-pack"/>
4755
+ <input type="text" name="email" placeholder="Email"
4756
+ style="padding-left: 7px; height: 30px; width: 290px; border: solid 1px #DDD;"/>
4757
+ <input type="submit" name="sub" value="Sign up!"
4758
+ style="height: 30px; width: 90px; background-color: #42DA76; color: #FFF; font-weight: bold; border:none; margin-left:5px;"/>
4759
  </form></div>
4760
  <?
4761
+ } else {
4762
  ?>
4763
+ <a href="https://www.wincher.com/?referer=all-in-one-seo-pack&adreferer=banner<?php echo $adid; ?>"
4764
+ target="_blank">
4765
+ <div class=wincherad id=wincher<?php echo $adid; ?>>
 
 
 
 
 
 
4766
  </div>
4767
+ </a>
4768
+ <?php } ?>
4769
+ </div>
4770
+ <!-- Headway Themes-->
4771
+ <div class="aioseop_advert headwaythemes">
4772
+ <div>
4773
+ <h3>Drag and Drop WordPress Design</h3>
4774
+ <p><a href="http://semperfiwebdesign.com/headwayaio/" target="_blank">Headway Themes</a>
4775
+ allows you to easily create your own stunning website designs! Stop using premade themes
4776
+ start making your own design with Headway's easy to use Drag and Drop interface. All in
4777
+ One SEO Pack users have an exclusive discount by using coupon code
4778
+ <strong>SEMPERFI30</strong> at checkout.</p>
4779
+ </div>
4780
+ <a href="http://semperfiwebdesign.com/headwayaio/" target="_blank"><img
4781
+ src="<?php echo AIOSEOP_PLUGIN_IMAGES_URL; ?>headwaybanner.png"></a>
4782
+ </div>
4783
+ <?php } ?>
4784
+ </div>
4785
+ </div>
4786
+ <?php
4787
+ }
4788
 
4789
  }
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
@@ -29,70 +29,84 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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 +119,287 @@ $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 +408,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.5
7
  Author: Michael Torbert
8
  Author URI: http://michaeltorbert.com
9
  Text Domain: all-in-one-seo-pack
29
 
30
  /**
31
  * @package All-in-One-SEO-Pack
32
+ * @version 2.3.5
33
  */
34
 
35
+ if ( ! defined( 'AIOSEOPPRO' ) ) {
36
+ define( 'AIOSEOPPRO', false );
37
+ }
38
+ if ( ! defined( 'AIOSEOP_VERSION' ) ) {
39
+ define( 'AIOSEOP_VERSION', '2.3.5' );
40
+ }
41
  global $aioseop_plugin_name;
42
  $aioseop_plugin_name = 'All in One SEO Pack';
43
 
44
+ /**********
45
+ *
46
+ * All in One SEO Pack
47
+ *
48
+ *******/
49
 
50
+ if ( ! defined( 'ABSPATH' ) ) {
51
+ return;
52
+ }
53
 
54
+ if ( AIOSEOPPRO ) {
55
 
 
 
56
  add_action( 'admin_init', 'disable_all_in_one_free', 1 );
 
 
57
 
58
+ }
59
 
60
+ if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) {
61
+ define( 'AIOSEOP_PLUGIN_NAME', $aioseop_plugin_name );
62
+ }
63
 
64
  //register_activation_hook(__FILE__,'aioseop_activate_pl');
65
 
66
  if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
67
+ define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
68
+ } elseif ( AIOSEOP_PLUGIN_DIR !== plugin_dir_path( __FILE__ ) ) {
69
 
70
  //this is not a great message
71
+ /*
72
+ add_action( 'admin_notices', create_function( '', 'echo "' . "<div class='error'>" . sprintf(
73
+ __( "%s detected a conflict; please deactivate the plugin located in %s.", 'all-in-one-seo-pack' ),
74
+ $aioseop_plugin_name, AIOSEOP_PLUGIN_DIR ) . "</div>" . '";' ) );
75
+ */
76
 
77
  return;
 
 
78
  }
79
 
80
+ if ( ! defined( 'AIOSEOP_PLUGIN_BASENAME' ) ) {
81
+ define( 'AIOSEOP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
82
+ }
83
+ if ( ! defined( 'AIOSEOP_PLUGIN_DIRNAME' ) ) {
84
+ define( 'AIOSEOP_PLUGIN_DIRNAME', dirname( AIOSEOP_PLUGIN_BASENAME ) );
85
+ }
86
+ if ( ! defined( 'AIOSEOP_PLUGIN_URL' ) ) {
87
+ define( 'AIOSEOP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
88
+ }
89
+ if ( ! defined( 'AIOSEOP_PLUGIN_IMAGES_URL' ) ) {
90
+ define( 'AIOSEOP_PLUGIN_IMAGES_URL', AIOSEOP_PLUGIN_URL . 'images/' );
91
+ }
92
+ if ( ! defined( 'AIOSEOP_BASELINE_MEM_LIMIT' ) ) {
93
+ define( 'AIOSEOP_BASELINE_MEM_LIMIT', 268435456 );
94
+ } // 256MB
95
+ if ( ! defined( 'WP_CONTENT_URL' ) ) {
96
+ define( 'WP_CONTENT_URL', site_url() . '/wp-content' );
97
+ }
98
+ if ( ! defined( 'WP_ADMIN_URL' ) ) {
99
+ define( 'WP_ADMIN_URL', site_url() . '/wp-admin' );
100
+ }
101
+ if ( ! defined( 'WP_CONTENT_DIR' ) ) {
102
+ define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
103
+ }
104
+ if ( ! defined( 'WP_PLUGIN_URL' ) ) {
105
+ define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' );
106
+ }
107
+ if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
108
+ define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
109
+ }
110
 
111
  global $aiosp, $aioseop_options, $aioseop_modules, $aioseop_module_list, $aiosp_activation, $aioseop_mem_limit, $aioseop_get_pages_start, $aioseop_admin_menu;
112
  $aioseop_get_pages_start = $aioseop_admin_menu = 0;
119
 
120
  $aioseop_mem_limit = @ini_get( 'memory_limit' );
121
 
122
+ if ( ! function_exists( 'aioseop_convert_bytestring' ) ) {
123
+ /**
124
+ * @param $byte_string
125
+ *
126
+ * @return int
127
+ */
128
+ function aioseop_convert_bytestring( $byte_string ) {
129
  $num = 0;
130
+ preg_match( '/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $byte_string, $matches );
131
+ if ( ! empty( $matches ) ) {
132
+ $num = (float) $matches[1];
133
  switch ( strtoupper( $matches[2] ) ) {
134
+ case 'E':
135
+ $num *= 1024;
136
+ case 'P':
137
+ $num *= 1024;
138
+ case 'T':
139
+ $num *= 1024;
140
+ case 'G':
141
+ $num *= 1024;
142
+ case 'M':
143
+ $num *= 1024;
144
+ case 'K':
145
+ $num *= 1024;
146
  }
147
  }
148
+
149
  return intval( $num );
150
  }
151
  }
152
 
153
  if ( is_array( $aioseop_options ) && isset( $aioseop_options['modules'] ) && isset( $aioseop_options['modules']['aiosp_performance_options'] ) ) {
154
  $perf_opts = $aioseop_options['modules']['aiosp_performance_options'];
155
+ if ( isset( $perf_opts['aiosp_performance_memory_limit'] ) ) {
156
  $aioseop_mem_limit = $perf_opts['aiosp_performance_memory_limit'];
157
+ }
158
+ if ( isset( $perf_opts['aiosp_performance_execution_time'] ) && ( '' !== $perf_opts['aiosp_performance_execution_time'] ) ) {
159
+ @ini_set( 'max_execution_time', (int) $perf_opts['aiosp_performance_execution_time'] );
160
+ @set_time_limit( (int) $perf_opts['aiosp_performance_execution_time'] );
161
  }
162
  } else {
163
  $aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit );
164
+ if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit < AIOSEOP_BASELINE_MEM_LIMIT ) ) {
165
  $aioseop_mem_limit = AIOSEOP_BASELINE_MEM_LIMIT;
166
+ }
167
  }
168
 
169
+ if ( ! empty( $aioseop_mem_limit ) ) {
170
+ if ( ! is_int( $aioseop_mem_limit ) ) {
171
  $aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit );
172
+ }
173
+ if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit <= AIOSEOP_BASELINE_MEM_LIMIT ) ) {
174
  @ini_set( 'memory_limit', $aioseop_mem_limit );
175
+ }
176
  }
177
 
178
+ $aiosp_activation = false;
179
+ $aioseop_module_list = array(
180
+ 'sitemap',
181
+ 'opengraph',
182
+ 'robots',
183
+ 'file_editor',
184
+ 'importer_exporter',
185
+ 'bad_robots',
186
+ 'performance',
187
+ ); // list all available modules here
188
 
189
+ if ( AIOSEOPPRO ) {
190
  $aioseop_module_list[] = 'video_sitemap';
191
  }
192
 
193
  if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
194
  add_action( 'admin_notices', create_function( '', 'echo "<div class=\'error\'>The All In One SEO Pack class is already defined";'
195
+ . "if ( class_exists( 'ReflectionClass' ) ) { \$r = new ReflectionClass( 'All_in_One_SEO_Pack' ); echo ' in ' . \$r->getFileName(); } "
196
+ . ' echo ", preventing All In One SEO Pack from loading.</div>";' ) );
197
+
198
+ return;
199
  }
200
 
201
+ if ( AIOSEOPPRO ) {
202
+
203
+ require( AIOSEOP_PLUGIN_DIR . 'pro/sfwd_update_checker.php' );
204
  $aioseop_update_checker = new SFWD_Update_Checker(
205
+ 'http://semperplugins.com/upgrade_plugins.php',
206
+ __FILE__,
207
+ 'aioseop'
208
  );
209
+
210
+ $aioseop_update_checker->plugin_name = AIOSEOP_PLUGIN_NAME;
211
+ $aioseop_update_checker->plugin_basename = AIOSEOP_PLUGIN_BASENAME;
212
+ if ( ! empty( $aioseop_options['aiosp_license_key'] ) ) {
213
+ $aioseop_update_checker->license_key = $aioseop_options['aiosp_license_key'];
214
+ } else {
215
+ $aioseop_update_checker->license_key = '';
216
+ }
217
+ $aioseop_update_checker->options_page = 'all-in-one-seo-pack-pro/aioseop_class.php';
218
+ $aioseop_update_checker->renewal_page = 'http://semperplugins.com/all-in-one-seo-pack-pro-support-updates-renewal/';
219
+
220
+ $aioseop_update_checker->addQueryArgFilter( array( $aioseop_update_checker, 'add_secret_key' ) );
221
  }
222
 
223
 
224
+ if ( ! function_exists( 'aioseop_activate' ) ) {
 
 
 
225
  function aioseop_activate() {
226
+
227
+ //Check if we just got activated.
228
+
229
+ global $aiosp_activation;
230
+ if ( AIOSEOPPRO ) {
231
+ global $aioseop_update_checker;
232
+ }
233
+ $aiosp_activation = true;
234
 
235
  delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
236
 
237
+ if ( AIOSEOPPRO ) {
238
+ $aioseop_update_checker->checkForUpdates();
239
  }
240
  }
241
  }
242
 
243
  add_action( 'plugins_loaded', 'aioseop_init_class' );
244
 
245
+ if ( ! function_exists( 'aiosp_plugin_row_meta' ) ) {
246
 
247
+ add_filter( 'plugin_row_meta', 'aiosp_plugin_row_meta', 10, 2 );
248
 
249
+ /**
250
+ * @param $actions
251
+ * @param $plugin_file
252
+ *
253
+ * @return array
254
+ */
255
+ function aiosp_plugin_row_meta( $actions, $plugin_file ) {
256
 
257
+ if ( ! AIOSEOPPRO ) {
 
 
 
 
 
 
 
 
 
258
 
259
+ $action_links = array(
260
+ 'donatelink' => array(
261
+ 'label' => __( 'Donate', 'all-in-one-seo-pack' ),
262
+ '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',
263
+ ),
264
+ 'amazon' => array(
265
+ 'label' => __( 'Amazon Wishlist', 'all-in-one-seo-pack' ),
266
+ 'url' => 'https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web',
267
+ ),
268
 
269
+ );
270
 
271
+ } else {
272
+ $action_links = '';
273
+ }
274
 
275
+ return aiosp_action_links( $actions, $plugin_file, $action_links, 'after' );
276
+ }
277
  }
278
 
279
+ if ( ! function_exists( 'aiosp_add_action_links' ) ) {
280
 
281
 
282
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'aiosp_add_action_links', 10, 2 );
283
 
284
+ /**
285
+ * @param $actions
286
+ * @param $plugin_file
287
+ *
288
+ * @return array
289
+ */
290
+ function aiosp_add_action_links( $actions, $plugin_file ) {
291
 
292
+ $aioseop_plugin_dirname = AIOSEOP_PLUGIN_DIRNAME;
293
+ $action_links = array();
294
+ $action_links = array(
295
+ 'settings' => array(
296
+ 'label' => __( 'SEO Settings', 'all-in-one-seo-pack' ),
297
+ 'url' => get_admin_url( null, "admin.php?page=$aioseop_plugin_dirname/aioseop_class.php" ),
298
+ ),
299
 
300
+ 'forum' => array(
301
+ 'label' => __( 'Support Forum', 'all-in-one-seo-pack' ),
302
+ 'url' => 'http://semperplugins.com/support/',
303
+ ),
 
 
304
 
305
+ 'docs' => array(
306
+ 'label' => __( 'Documentation', 'all-in-one-seo-pack' ),
307
+ 'url' => 'http://semperplugins.com/documentation/',
 
 
 
 
 
 
 
 
 
 
308
  ),
309
 
310
+ );
 
 
 
 
 
311
 
312
+ unset( $actions['edit'] );
313
 
314
+ if ( ! AIOSEOPPRO ) {
315
+ $action_links['proupgrade'] =
316
+ array(
317
+ 'label' => __( 'Upgrade to Pro', 'all-in-one-seo-pack' ),
318
+ 'url' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins'
319
 
320
+ );
321
+ }
322
 
323
+ return aiosp_action_links( $actions, $plugin_file, $action_links, 'before' );
324
+ }
325
  }
326
 
327
+ if ( ! function_exists( 'aiosp_action_links' ) ) {
328
+
329
+ /**
330
+ * @param $actions
331
+ * @param $plugin_file
332
+ * @param array $action_links
333
+ * @param string $position
334
+ *
335
+ * @return array
336
+ */
337
+ function aiosp_action_links( $actions, $plugin_file, $action_links = array(), $position = 'after' ) {
338
+ static $plugin;
339
+ if ( ! isset( $plugin ) ) {
340
+ $plugin = plugin_basename( __FILE__ );
341
+ }
342
+ if ( $plugin === $plugin_file && ! empty( $action_links ) ) {
343
+ foreach ( $action_links as $key => $value ) {
344
+ $link = array( $key => '<a href="' . $value['url'] . '">' . $value['label'] . '</a>' );
345
+ if ( 'after' === $position ) {
346
+ $actions = array_merge( $actions, $link );
347
+ } else {
348
+ $actions = array_merge( $link, $actions );
349
+ }
350
+ }//foreach
351
+ }// if
352
+ return $actions;
353
+ }
354
  }
355
+
356
+ if ( ! function_exists( 'aioseop_init_class' ) ) {
357
  function aioseop_init_class() {
358
  global $aiosp;
359
  load_plugin_textdomain( 'all-in-one-seo-pack', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n/' );
360
  require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_functions.php' );
361
  require_once( AIOSEOP_PLUGIN_DIR . 'aioseop_class.php' );
362
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_updates_class.php' );
363
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/commonstrings.php' );
364
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/postedit.php' );
365
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/general-metaboxes.php' );
366
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/aiosp_common.php' );
367
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php' );
368
+ require_once( AIOSEOP_PLUGIN_DIR . 'inc/translations.php' );
369
+ require_once( AIOSEOP_PLUGIN_DIR . 'public/opengraph.php' );
370
+
371
+ if ( AIOSEOPPRO ) {
372
  require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_general.php' );
373
+ require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_class.php' );
374
+ require_once( AIOSEOP_PLUGIN_DIR . 'pro/aioseop_pro_updates_class.php' );
375
  }
376
  aiosp_seometa_import(); // call importer functions... this should be moved somewhere better
377
+
378
  $aiosp = new All_in_One_SEO_Pack();
379
+
380
  $aioseop_updates = new AIOSEOP_Updates();
381
 
382
+ if ( AIOSEOPPRO ) {
383
  $aioseop_pro_updates = new AIOSEOP_Pro_Updates();
384
  add_action( 'admin_init', array( $aioseop_pro_updates, 'version_updates' ), 12 );
385
  }
386
 
387
+ if ( aioseop_option_isset( 'aiosp_unprotect_meta' ) ) {
388
  add_filter( 'is_protected_meta', 'aioseop_unprotect_meta', 10, 3 );
389
+ }
 
 
390
 
391
  add_action( 'init', array( $aiosp, 'add_hooks' ) );
392
  add_action( 'admin_init', array( $aioseop_updates, 'version_updates' ), 11 );
393
+
394
+ if ( defined( 'DOING_AJAX' ) && ! empty( $_POST ) && ! empty( $_POST['action'] ) && 'aioseop_ajax_scan_header' === $_POST['action'] ) {
395
  remove_action( 'init', array( $aiosp, 'add_hooks' ) );
396
+ add_action( 'admin_init', 'aioseop_scan_post_header' );
397
+ add_action( 'shutdown', 'aioseop_ajax_scan_header' ); // if the action doesn't run -- pdb
398
+ include_once( ABSPATH . 'wp-admin/includes/screen.php' );
399
  global $current_screen;
400
+ if ( class_exists( 'WP_Screen' ) ) {
401
  $current_screen = WP_Screen::get( 'front' );
402
+ }
403
  }
404
  }
405
  }
408
  //add_action( 'after_setup_theme', 'aioseop_load_modules' );
409
 
410
  if ( is_admin() ) {
411
+ add_action( 'wp_ajax_aioseop_ajax_save_meta', 'aioseop_ajax_save_meta' );
412
+ add_action( 'wp_ajax_aioseop_ajax_save_url', 'aioseop_ajax_save_url' );
413
+ add_action( 'wp_ajax_aioseop_ajax_delete_url', 'aioseop_ajax_delete_url' );
414
+ add_action( 'wp_ajax_aioseop_ajax_scan_header', 'aioseop_ajax_scan_header' );
415
+ if ( AIOSEOPPRO ) {
416
  add_action( 'wp_ajax_aioseop_ajax_facebook_debug', 'aioseop_ajax_facebook_debug' );
417
  }
418
+ add_action( 'wp_ajax_aioseop_ajax_save_settings', 'aioseop_ajax_save_settings' );
419
+ add_action( 'wp_ajax_aioseop_ajax_get_menu_links', 'aioseop_ajax_get_menu_links' );
420
+ add_action( 'wp_ajax_aioseo_dismiss_yst_notice', 'aioseop_update_yst_detected_notice' );
421
+ add_action( 'wp_ajax_aioseo_dismiss_visibility_notice', 'aioseop_update_user_visibilitynotice' );
422
+ add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice', 'aioseop_woo_upgrade_notice_dismissed' );
423
+ if ( AIOSEOPPRO ) {
424
+ add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' );
425
  }
426
  }
427
 
428
+ if ( ! function_exists( 'aioseop_scan_post_header' ) ) {
429
  function aioseop_scan_post_header() {
430
  require_once( ABSPATH . WPINC . '/default-filters.php' );
431
  global $wp_query;
432
  $wp_query->query_vars['paged'] = 0;
433
+ query_posts( 'post_type=post&posts_per_page=1' );
434
+ if ( have_posts() ) {
435
+ the_post();
436
+ }
437
  }
438
  }
439
 
440
  require_once( AIOSEOP_PLUGIN_DIR . 'aioseop_init.php' );
441
 
442
+ if ( ! function_exists( 'aioseop_install' ) ) {
443
+ register_activation_hook( __FILE__, 'aioseop_install' );
444
 
445
+ function aioseop_install() {
446
+ aioseop_activate();
447
+ }
 
 
 
448
  }
449
 
450
+ if ( ! function_exists( 'disable_all_in_one_free' ) ) {
451
+ function disable_all_in_one_free() {
452
+ if ( AIOSEOPPRO && is_plugin_active( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ) ) {
453
+ deactivate_plugins( 'all-in-one-seo-pack/all_in_one_seo_pack.php' );
454
+ }
455
  }
456
+ }
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,232 @@
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 +237,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 .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: 0;
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
 
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
+ }
css/modules/aioseop_module.css CHANGED
@@ -1,1120 +1,1263 @@
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 h3 {
505
+ font-size: 17px;
506
+ margin: 0;
507
+ padding: 0 10px 5px 10px;
508
+ font-weight: normal;
509
+ font-style: normal;
510
+ font-family: "Helvetica Neue",
511
+ Helvetica,
512
+ Arial,
513
+ "Lucida Grande",
514
+ Verdana,
515
+ "Bitstream Vera Sans",
516
+ sans-serif;
517
+ }
518
+
519
+ .aioseop_feature p {
520
+ line-height: 150%;
521
+ font-size: 12px;
522
+ font-family: Georgia,
523
+ "Times New Roman",
524
+ "Bitstream Charter",
525
+ Times, serif;
526
+ margin-bottom: 20px;
527
+ color: #666;
528
+ padding: 0 10px;
529
+ }
530
+
531
+ .aioseop_feature p.aioseop_desc {
532
+ min-height: 80px;
533
+ }
534
+
535
+ .aioseop_feature .feature_button {
536
+ float: right;
537
+ margin-bottom: 10px;
538
+ margin-right: 10px;
539
+ min-width: 80px;
540
+ text-align: center;
541
+ }
542
+
543
+ .aioseop_feature .feature_button:before {
544
+ content: "Activate";
545
+ }
546
+
547
+ .aioseop_feature .active.feature_button:before {
548
+ content: "Deactivate";
549
+ }
550
+
551
+ div.aioseop_feature .aioseop_featured_image {
552
+ min-height: 100px;
553
+ background-repeat: no-repeat;
554
+ display: block;
555
+ margin: 0 auto;
556
+ width: 133px;
557
+ }
558
+
559
+ div.aioseop_feature .aioseop_featured_image {
560
+ background-image: url(../../modules/images/Default-BW-Standard.png);
561
+ }
562
+
563
+ div.aioseop_feature .aioseop_featured_image.active {
564
+ background-image: url(../../modules/images/Default-Color-Standard.png);
565
+ }
566
+
567
+ div.aioseop_feature#aioseop_sitemap .aioseop_featured_image {
568
+ background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png);
569
+ }
570
+
571
+ div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active {
572
+ background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png);
573
+ }
574
+
575
+ div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image {
576
+ background-image: url(../../modules/images/VideoSitemap-BW-Standard.png);
577
+ }
578
+
579
+ div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active {
580
+ background-image: url(../../modules/images/VideoSitemap-Color-Standard.png);
581
+ }
582
+
583
+ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
584
+ background-image: url(../../modules/images/SocialMeta-BW-Standard.png);
585
+ }
586
+
587
+ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
588
+ background-image: url(../../modules/images/SocialMeta-Color-Standard.png);
589
+ }
590
+
591
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image {
592
+ background-image: url(../../modules/images/Robots-BW-Standard.png);
593
+ }
594
+
595
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active {
596
+ background-image: url(../../modules/images/Robots-Color-Standard.png);
597
+ }
598
+
599
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
600
+ background-image: url(../../modules/images/FileEditor-BW-Standard.png);
601
+ }
602
+
603
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
604
+ background-image: url(../../modules/images/FileEditor-Color-Standard.png);
605
+ }
606
+
607
+ div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
608
+ background-image: url(../../modules/images/ImporterExporter-BW-Standard.png);
609
+ }
610
+
611
+ div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
612
+ background-image: url(../../modules/images/ImporterExporter-Color-Standard.png);
613
+ }
614
+
615
+ div.aioseop_feature#aioseop_performance .aioseop_featured_image {
616
+ background-image: url(../../modules/images/Performance-BW-Standard.png);
617
+ }
618
+
619
+ div.aioseop_feature#aioseop_performance .aioseop_featured_image.active {
620
+ background-image: url(../../modules/images/Performance-Color-Standard.png);
621
+ }
622
+
623
+ div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
624
+ background-image: url(../../modules/images/Default-Color-Standard.png);
625
+ }
626
+
627
+ div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
628
+ background-image: url(../../modules/images/Default-Color-Standard.png);
629
+ }
630
+
631
+ .All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table,
632
+ .All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table {
633
+ max-width: 500px;
634
+ clear: none;
635
+ }
636
+
637
+ .aioseop_follow_button {
638
+ min-height: 50px;
639
+ background-repeat: no-repeat;
640
+ display: inline-block;
641
+ width: 100px;
642
+ background-size: auto 50px !important;
643
+ margin-right: 0;
644
+ }
645
+
646
+ .aioseop_facebook_follow {
647
+ background-image: url(../../modules/images/facebook-follow-standard.png);
648
+ }
649
+
650
+ .aioseop_twitter_follow {
651
+ background-image: url(../../modules/images/twitter-follow-standard.png);
652
+ }
653
+
654
+ @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) {
655
+ div.aioseop_feature .aioseop_featured_image {
656
+ background-size: auto 100px !important;
657
+ }
658
+
659
+ div.aioseop_feature .aioseop_featured_image.active {
660
+ background-image: url(../../modules/images/Default-Color-Retina.png);
661
+ }
662
+
663
+ div.aioseop_feature .aioseop_featured_image {
664
+ background-image: url(../../modules/images/Default-BW-Retina.png);
665
+ }
666
+
667
+ div.aioseop_feature#aioseop_sitemap .aioseop_featured_image {
668
+ background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png);
669
+ }
670
+
671
+ div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active {
672
+ background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png);
673
+ }
674
+
675
+ div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image {
676
+ background-image: url(../../modules/images/VideoSitemap-BW-Retina.png);
677
+ }
678
+
679
+ div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active {
680
+ background-image: url(../../modules/images/VideoSitemap-Color-Retina.png);
681
+ }
682
+
683
+ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
684
+ background-image: url(../../modules/images/SocialMeta-BW-Retina.png);
685
+ }
686
+
687
+ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
688
+ background-image: url(../../modules/images/SocialMeta-Color-Retina.png);
689
+ }
690
+
691
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image {
692
+ background-image: url(../../modules/images/Robots-BW-Retina.png);
693
+ }
694
+
695
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active {
696
+ background-image: url(../../modules/images/Robots-Color-Retina.png);
697
+ }
698
+
699
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
700
+ background-image: url(../../modules/images/FileEditor-BW-Retina.png);
701
+ }
702
+
703
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
704
+ background-image: url(../../modules/images/FileEditor-Color-Retina.png);
705
+ }
706
+
707
+ div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
708
+ background-image: url(../../modules/images/ImporterExporter-BW-Retina.png);
709
+ }
710
+
711
+ div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
712
+ background-image: url(../../modules/images/ImporterExporter-Color-Retina.png);
713
+ }
714
+
715
+ div.aioseop_feature#aioseop_performance .aioseop_featured_image {
716
+ background-image: url(../../modules/images/Performance-BW-Retina.png);
717
+ }
718
+
719
+ div.aioseop_feature#aioseop_performance .aioseop_featured_image.active {
720
+ background-image: url(../../modules/images/Performance-Color-Retina.png);
721
+ }
722
+
723
+ div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
724
+ background-image: url(../../modules/images/Default-BW-Retina.png);
725
+ }
726
+
727
+ div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
728
+ background-image: url(../../modules/images/Default-BW-Retina.png);
729
+ }
730
+
731
+ .aioseop_facebook_follow {
732
+ background-image: url(../../modules/images/facebook-follow-retina.png);
733
+ }
734
+
735
+ .aioseop_twitter_follow {
736
+ background-image: url(../../modules/images/twitter-follow-retina.png);
737
+ }
738
+ }
739
+
740
+ .aioseop_options {
741
+ width: 100%;
742
+ margin: 18px 0 10px 0;
743
+ }
744
+
745
+ .aioseop_wrapper {
746
+ width: 100%;
747
+ padding-left: 5px;
748
+ }
749
+
750
+ .aioseop_input {
751
+ clear: left;
752
+ width: 100%;
753
+ padding: 5px;
754
+ display: inline;
755
+ }
756
+
757
+ .aioseop_option_input {
758
+ float: left;
759
+ width: 61%;
760
+ margin: 0;
761
+ padding-left: 1px;
762
+ min-width: 160px;
763
+ /* max-width: 900px; */
764
+ }
765
+
766
+ #aiosp div.preview_snippet {
767
+ border: 1px solid #ebebeb;
768
+ padding: 15px 15px 20px 7px;
769
+ background-color: #fff;
770
+ }
771
+
772
+ div#aioseop_snippet {
773
+ font-family: arial, sans-serif;
774
+ font-size: 13px;
775
+ }
776
+
777
+ div#aioseop_snippet > h3 {
778
+ font-size: 16px;
779
+ padding: 8px 0;
780
+ border: 0;
781
+ background: inherit;
782
+ }
783
+
784
+ div#aioseop_snippet > h3 > a {
785
+ color: #12c;
786
+ text-decoration: none;
787
+ cursor: pointer;
788
+ }
789
+
790
+ div#aioseop_snippet > div {
791
+ color: #222;
792
+ max-width: 42em;
793
+ }
794
+
795
+ div#aioseop_snippet > div > div {
796
+ display: block;
797
+ margin-bottom: 1px;
798
+ }
799
+
800
+ div#aioseop_snippet > div > div > cite {
801
+ color: #093;
802
+ font-style: normal;
803
+ }
804
+
805
+ div#aioseop_snippet > div > span {
806
+ margin: 0;
807
+ padding: 0;
808
+ border: 0;
809
+ }
810
+
811
+ #aiosp_sitemap_addl_pages,
812
+ #aiosp_video_sitemap_addl_pages {
813
+ clear: left;
814
+ margin-left: 20px;
815
+ max-width: 1072px;
816
+ }
817
+
818
+ #aiosp_sitemap_addl_pages_metabox .aioseop_wrapper,
819
+ #aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper {
820
+ width: 23%;
821
+ min-width: 165px;
822
+ display: inline-block;
823
+ max-width: 265px;
824
+ }
825
+
826
+ #aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div,
827
+ #aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div {
828
+ position: absolute;
829
+ margin: 5px 0 10px 0;
830
+ }
831
+
832
+ #aiosp_sitemap_addl_pages_metabox .aioseop_option_input,
833
+ #aiosp_video_sitemap_addl_pages_metabox .aioseop_option_input {
834
+ width: 94%;
835
+ min-width: 94%;
836
+ }
837
+
838
+ #aiosp_sitemap_addl_pages_metabox table.aioseop_table,
839
+ #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table {
840
+ width: 96%;
841
+ border: 1px solid #CCC;
842
+ margin: 5px 0 10px 0;
843
+ }
844
+
845
+ table.aioseop_table tr:nth-child(odd) {
846
+ background-color: #EEE;
847
+ }
848
+
849
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) {
850
+ background-color: rgba(238, 238, 238, 0.5);
851
+ }
852
+
853
+ table.aioseop_table td {
854
+ width: 23%;
855
+ }
856
+
857
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table {
858
+ width: 80%;
859
+ max-width: 800px;
860
+ display: block;
861
+ border-top: 1px solid #dfdfdf;
862
+ border-left: 1px solid #dfdfdf;
863
+ }
864
+
865
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table th {
866
+ width: 18%;
867
+ border-right: 1px solid #dfdfdf;
868
+ border-bottom: 1px solid #dfdfdf;
869
+ }
870
+
871
+ .All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info {
872
+ margin-top: 10px;
873
+ border: 1px solid #dfdfdf;
874
+ width: 80%;
875
+ max-width: 800px;
876
+ }
877
+
878
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th {
879
+ background: #f1f1f1;
880
+ background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9));
881
+ background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9);
882
+ background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9);
883
+ background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9);
884
+ background-image: linear-gradient(to top, #ececec, #f9f9f9);
885
+ padding: 5px;
886
+ border-bottom-color: #dfdfdf;
887
+ text-shadow: #fff 0 1px 0;
888
+ -webkit-box-shadow: 0 1px 0 #fff;
889
+ -moz-box-shadow: 0 1px 0 #fff;
890
+ box-shadow: 0 1px 0 #fff;
891
+ }
892
+
893
+ .All_in_One_SEO_Pack_Opengraph table.aioseop_table td {
894
+ border-right: 1px solid #dfdfdf;
895
+ border-bottom: 1px solid #dfdfdf;
896
+ }
897
+
898
+ #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item {
899
+ display: inline-block;
900
+ width: 30%;
901
+ vertical-align: top;
902
+ }
903
+
904
+ #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) {
905
+ font-weight: bold;
906
+ }
907
+
908
+ #aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) {
909
+ width: 70%;
910
+ }
911
+
912
+ #aiosp_sitemap_addl_pages_metabox table.aioseop_table td,
913
+ #aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td {
914
+ width: 25%;
915
+ padding-left: 5%;
916
+ }
917
+
918
+ table.aioseop_table td, table.aioseop_table th {
919
+ padding: 3px;
920
+ }
921
+
922
+ .aioseop_top_label .aioseop_option_input,
923
+ .aioseop_no_label .aioseop_option_input {
924
+ width: 100%;
925
+ }
926
+
927
+ #aiosp_settings_form .postbox {
928
+ margin: 0 0 20px 0;
929
+ }
930
+
931
+ .aioseop_settings_left .postbox {
932
+ float: left;
933
+ width: 100%;
934
+ }
935
+
936
+ .aioseop_option_setting_label {
937
+ min-height: 35px;
938
+ display: inline-block;
939
+ white-space: nowrap;
940
+ overflow: hidden;
941
+ padding-left: 1px;
942
+ max-width: 229px;
943
+ min-width: 160px;
944
+ width: 33%;
945
+ }
946
+
947
+ .aioseop_settings_left .postbox .inside {
948
+ padding: 0;
949
+ margin: 0;
950
+ clear: right;
951
+ }
952
+
953
+ #aiosp_settings_form .aioseop_no_label, .aioseop_no_label {
954
+ float: left;
955
+ width: 92%;
956
+ max-width: 100%;
957
+ margin: 0 23px 0 13px;
958
+ }
959
+
960
+ .aioseop_top_label {
961
+ width: 96%;
962
+ margin: 0 10px;
963
+ }
964
+
965
+ .aioseop_hidden_type {
966
+ margin: 0;
967
+ padding: 0;
968
+ height: 0;
969
+ }
970
+
971
+ .aioseop_module.error.below-h2 {
972
+ padding: 5px 0;
973
+ margin: 0 477px 15px 0 !important;
974
+ }
975
+
976
+ #aioseop_opengraph_settings .inside {
977
+ margin: 0;
978
+ padding: 0;
979
+ }
980
+
981
+ #aioseop_opengraph_settings_image_wrapper img {
982
+ width: auto;
983
+ height: 75px;
984
+ }
985
+
986
+ #aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label {
987
+ max-width: 160px;
988
+ min-width: 100px;
989
+ width: 30%;
990
+ }
991
+
992
+ .aioseop_input input[type="checkbox"],
993
+ .aioseop_input input[type="radio"] {
994
+ vertical-align: text-bottom;
995
+ margin-top: 8px;
996
+ }
997
+
998
+ #aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div {
999
+ max-height: initial;
1000
+ }
1001
+
1002
+ #aiosp {
1003
+ width: 100%;
1004
+ }
1005
+
1006
+ .aioseop_input.aioseop_top_label .aioseop_option_input {
1007
+ margin: 0 0 10px 0;
1008
+ }
1009
+
1010
+ .aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div {
1011
+ max-height: none;
1012
+ }
1013
+
1014
+ /* Robots.txt styling */
1015
+ #aiosp_robots_generator_robotgen_wrapper .aioseop_option_div,
1016
+ #aiosp_robots_generator_robothtml_wrapper .aioseop_option_div {
1017
+ max-height: none;
1018
+ }
1019
+
1020
+ .aioseop_option_input .widefat td {
1021
+ vertical-align: middle;
1022
+ }
1023
+
1024
+ .entry-row.robots.quirks {
1025
+ font-weight: bold;
1026
+ opacity: 1;
1027
+ }
1028
+
1029
+ .entry-row.robots {
1030
+ opacity: 0.8;
1031
+ }
1032
+
1033
+ .entry-row.robots.invalid {
1034
+ opacity: 1;
1035
+ font-weight: bold;
1036
+ }
1037
+
1038
+ .invalid .entry_label {
1039
+ font-weight: bold;
1040
+ }
1041
+
1042
+ .aioseop .aioseop_option_input tbody {
1043
+ background: #FCFCFC;
1044
+ }
1045
+
1046
+ .All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody {
1047
+ background: transparent;
1048
+ }
1049
+
1050
+ .entry-row.robots div {
1051
+ height: 20px;
1052
+ vertical-align: middle;
1053
+ width: 90%;
1054
+ margin: 0 0 4px 0;
1055
+ }
1056
+
1057
+ .robots img {
1058
+ margin: 0 0 0 2px;
1059
+ opacity: 0.6;
1060
+ }
1061
+
1062
+ .aioseop_option_docs {
1063
+ width: 98%;
1064
+ display: none;
1065
+ border: 1px solid #D3D3D3;
1066
+ margin-top: 20px;
1067
+ padding: 1%;
1068
+ background-color: #EEE;
1069
+ }
1070
+
1071
+ .aioseop_option_docs h3 {
1072
+ background: none;
1073
+ }
1074
+
1075
+ div.aioseop_notice {
1076
+ position: relative;
1077
+ }
1078
+
1079
+ div.aioseop_notice a.aioseop_dismiss_link {
1080
+ position: absolute;
1081
+ top: 10px;
1082
+ right: 10px;
1083
+ }
1084
+
1085
+ .aioseop_error_notice {
1086
+ color: #f00;
1087
+ font-weight: bold;
1088
+ }
1089
+
1090
+ .aioseop_input select {
1091
+ margin: 7px 0;
1092
+ }
1093
+
1094
+ .aioseop_help_text ul {
1095
+ margin: 15px 0 0 20px;
1096
+ }
1097
+
1098
+ .aioseop_help_text ul li {
1099
+ line-height: 20px;
1100
+ margin: 0;
1101
+ }
1102
+
1103
+ .aioseop_sidebar #side-sortables {
1104
+ width: 98%;
1105
+ }
1106
+
1107
+ #aioseop_opengraph_settings .aioseop_option_label {
1108
+ width: 30%;
1109
+ }
1110
+
1111
+ .aioseop_tabs {
1112
+ padding-top: 6px;
1113
+ }
1114
+
1115
+ .aioseop_tabs.hide,
1116
+ .aioseop_header_tabs.hide {
1117
+ display: block !important;
1118
+ }
1119
+
1120
+ .aioseop_header_tabs li {
1121
+ display: inline;
1122
+ padding: 0;
1123
+ margin: 0;
1124
+ }
1125
+
1126
+ .aioseop_header_tabs {
1127
+ margin: 0;
1128
+ }
1129
+
1130
+ .aioseop_header_nav {
1131
+ margin: 0;
1132
+ }
1133
+
1134
+ .aioseop_header_tabs li a.aioseop_header_tab.active {
1135
+ background-color: rgb(255, 255, 255);
1136
+ border-bottom-color: rgba(255, 255, 255, 0.5);
1137
+ font-weight: bold;
1138
+ }
1139
+
1140
+ .aioseop_header_tabs li a.aioseop_header_tab {
1141
+ height: 18px;
1142
+ font: 13px/18px Arial,
1143
+ Helvetica,
1144
+ sans-serif normal;
1145
+ text-decoration: none;
1146
+ margin: 5px 5px 0 0;
1147
+ padding: 4px 5px 2px;
1148
+ cursor: pointer;
1149
+ -webkit-border-top-right-radius: 3px;
1150
+ -webkit-border-top-left-radius: 3px;
1151
+ border-top-right-radius: 3px;
1152
+ border-top-left-radius: 3px;
1153
+ background-color: rgb(255, 255, 255);
1154
+ background-color: rgba(255, 255, 255, 0.5);
1155
+ border: 1px solid #ccc;
1156
+ color: #5F5F5F;
1157
+ }
1158
+
1159
+ .aioseop_header_tabs li:first-child a.aioseop_header_tab {
1160
+ border-left: solid 1px #CCC;
1161
+ margin-left: 5px;
1162
+ }
1163
+
1164
+ .aioseop_tab {
1165
+ border: solid 1px #CCC;
1166
+ background-color: rgb(255, 255, 255);
1167
+ background-color: rgba(255, 255, 255, 0.5);
1168
+ padding-left: 5px;
1169
+ }
1170
+
1171
+ .aioseop_loading {
1172
+ background-image: url('../../images/activity.gif');
1173
+ display: inline-block;
1174
+ width: 24px;
1175
+ height: 24px;
1176
+ margin: 0;
1177
+ padding: 0;
1178
+ vertical-align: bottom;
1179
+ }
1180
+
1181
+ .aiosp_delete_url {
1182
+ background-image: url('../../images/delete.png');
1183
+ display: inline-block;
1184
+ width: 16px;
1185
+ height: 16px;
1186
+ margin: 0;
1187
+ padding: 0;
1188
+ vertical-align: bottom;
1189
+ }
1190
+
1191
+ form#aiosp_settings_form,
1192
+ .aioseop_tabs_div {
1193
+ padding-right: 477px;
1194
+ }
1195
+
1196
+ .aioseop_tabs_div {
1197
+ margin-top: 10px;
1198
+ }
1199
+
1200
+ #aiosp_settings_form ul.sfwd_debug_settings li strong {
1201
+ display: block;
1202
+ float: left;
1203
+ text-align: right;
1204
+ background-color: #DDD;
1205
+ margin-right: 8px;
1206
+ padding: 1px 8px 1px 1px;
1207
+ overflow: auto;
1208
+ width: 200px;
1209
+ min-height: 16px;
1210
+ }
1211
+
1212
+ #aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong {
1213
+ background-color: #CCC;
1214
+ }
1215
+
1216
+ #aiosp_settings_form ul.sfwd_debug_settings li {
1217
+ clear: left;
1218
+ margin: 0;
1219
+ padding: 0;
1220
+ background-color: #EEE;
1221
+ overflow: auto;
1222
+ max-width: 75%;
1223
+ min-width: 800px;
1224
+ }
1225
+
1226
+ #aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) {
1227
+ background-color: #DDD;
1228
+ }
1229
+
1230
+ div.sfwd_debug_mail_sent {
1231
+ background-color: #080;
1232
+ border: 1px solid #0A0;
1233
+ margin: 10px 0 10px 0;
1234
+ width: 598px;
1235
+ color: #FFF;
1236
+ text-align: center;
1237
+ }
1238
+
1239
+ div.sfwd_debug_error {
1240
+ background-color: #F00;
1241
+ color: #FFF;
1242
+ border: 1px solid #A00;
1243
+ margin: 10px 0 10px 0;
1244
+ width: 598px;
1245
+ text-align: center;
1246
+ font-weight: bolder;
1247
+ }
1248
+
1249
+ #aiosp_performance_status_wrapper .aioseop_option_div {
1250
+ max-height: 420px;
1251
+ }
1252
+
1253
+ #aioseop_coming_soon, #aioseop_coming_soon2 {
1254
+ padding-top: 40px;
1255
+ text-align: center;
1256
+ height: 258px;
1257
+ font-size: 16px;
1258
+ }
1259
+
1260
+ .MRL {
1261
+ margin-left: 20px !important;
1262
+ margin-bottom: 10px !important;
1263
+ }
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
@@ -2,23 +2,25 @@
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
  }
@@ -26,32 +28,35 @@ if ( !function_exists( 'aioseop_get_options' ) ) {
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
  }
@@ -59,19 +64,19 @@ if ( !function_exists( 'aioseop_update_settings_check' ) ) {
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,298 +86,351 @@ 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
  }
@@ -380,76 +438,91 @@ if ( !function_exists( 'aioseop_ajax_delete_url' ) ) {
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 +531,232 @@ 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 +768,60 @@ 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;
@@ -700,44 +832,54 @@ if ( !function_exists( 'aioseop_localize_script_data' ) ) {
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
  }
@@ -745,50 +887,59 @@ if ( !function_exists( 'json_decode' ) ) {
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
- }
2
  /**
3
  * @package All-in-One-SEO-Pack
4
  */
5
+
6
  /**
7
  * Load the module manager.
8
  */
9
+ if ( ! function_exists( 'aioseop_load_modules' ) ) {
10
  function aioseop_load_modules() {
11
  global $aioseop_modules, $aioseop_module_list;
12
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_manager.php' );
13
+ $aioseop_modules = new All_in_One_SEO_Pack_Module_Manager( apply_filters( 'aioseop_module_list', $aioseop_module_list ) );
14
+ $aioseop_modules->load_modules();
15
  }
16
  }
17
 
18
+ if ( ! function_exists( 'aioseop_get_options' ) ) {
19
  function aioseop_get_options() {
20
  global $aioseop_options;
21
  $aioseop_options = get_option( 'aioseop_options' );
22
  $aioseop_options = apply_filters( 'aioseop_get_options', $aioseop_options );
23
+
24
  return $aioseop_options;
25
  }
26
  }
28
  /**
29
  * Check if settings need to be updated / migrated from old version.
30
  */
31
+ if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
32
  function aioseop_update_settings_check() {
33
  global $aioseop_options;
34
+ if ( ( isset( $_POST['aioseop_migrate_options'] ) ) ||
35
+ ( empty( $aioseop_options ) )
36
+ ) {
37
  aioseop_mrt_mkarry();
38
+ }
39
  // WPML has now attached to filters, read settings again so they can be translated
40
  aioseop_get_options();
41
  $update_options = false;
42
+ if ( ! empty( $aioseop_options ) ) {
43
+ if ( ! empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // migrate setting for noindex archives
44
  $aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex'];
45
  unset( $aioseop_options['aiosp_archive_noindex'] );
46
  $update_options = true;
47
  }
48
+ if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && empty( $aioseop_options['aiosp_date_title_format'] ) ) {
49
  $aioseop_options['aiosp_date_title_format'] = $aioseop_options['aiosp_archive_title_format'];
50
  unset( $aioseop_options['aiosp_archive_title_format'] );
51
  $update_options = true;
52
  }
53
+ if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && ( $aioseop_options['aiosp_archive_title_format'] == '%date% | %blog_title%' ) ) {
54
  $aioseop_options['aiosp_archive_title_format'] = '%archive_title% | %blog_title%';
55
+ $update_options = true;
56
  }
57
+ if ( $update_options ) {
58
  update_option( 'aioseop_options', $aioseop_options );
59
+ }
60
  }
61
  }
62
  }
64
  /**
65
  * Initialize settings to defaults.
66
  */
67
+ if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) {
68
  function aioseop_mrt_mkarry() {
69
  global $aiosp;
70
  global $aioseop_options;
71
  $naioseop_options = $aiosp->default_options();
72
 
73
+ if ( get_option( 'aiosp_post_title_format' ) ) {
74
+ foreach ( $naioseop_options as $aioseop_opt_name => $value ) {
75
+ if ( $aioseop_oldval = get_option( $aioseop_opt_name ) ) {
76
+ $naioseop_options[ $aioseop_opt_name ] = $aioseop_oldval;
77
  }
78
+ if ( $aioseop_oldval == '' ) {
79
+ $naioseop_options[ $aioseop_opt_name ] = '';
80
  }
81
  delete_option( $aioseop_opt_name );
82
  }
86
  }
87
  }
88
 
89
+ if ( ! function_exists( 'aioseop_activate_pl' ) ) {
90
  function aioseop_activate_pl() {
91
+ if ( $aioseop_options = get_option( 'aioseop_options' ) ) {
92
  $aioseop_options['aiosp_enabled'] = "0";
93
 
94
+ if ( empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
95
+ $aioseop_options['aiosp_posttypecolumns'] = array( 'post', 'page' );
96
  }
97
 
98
+ update_option( 'aioseop_options', $aioseop_options );
99
  }
100
  }
101
  }
102
 
103
+ if ( ! function_exists( 'aioseop_get_version' ) ) {
104
  function aioseop_get_version() {
105
  return AIOSEOP_VERSION;
106
  }
107
  }
108
 
109
+ if ( ! function_exists( 'aioseop_option_isset' ) ) {
110
  function aioseop_option_isset( $option ) {
111
  global $aioseop_options;
112
+
113
+ return ( ( isset( $aioseop_options[ $option ] ) ) && $aioseop_options[ $option ] );
114
  }
115
  }
116
 
117
+ if ( ! function_exists( 'aioseop_addmycolumns' ) ) {
118
  function aioseop_addmycolumns() {
119
  global $aioseop_options, $pagenow;
120
  $aiosp_posttypecolumns = Array();
121
+ if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
122
  $aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns'];
123
  }
124
+ if ( ! empty( $pagenow ) && ( $pagenow == 'upload.php' ) ) {
125
  $post_type = 'attachment';
126
+ } elseif ( ! isset( $_REQUEST['post_type'] ) ) {
127
  $post_type = 'post';
128
+ } else {
129
  $post_type = $_REQUEST['post_type'];
130
+ }
131
 
132
+ if ( is_array( $aiosp_posttypecolumns ) && in_array( $post_type, $aiosp_posttypecolumns ) ) {
133
  add_action( 'admin_head', 'aioseop_admin_head' );
134
+ if ( $post_type == 'page' ) {
135
  add_filter( 'manage_pages_columns', 'aioseop_mrt_pcolumns' );
136
+ } elseif ( $post_type == 'attachment' ) {
137
  add_filter( 'manage_media_columns', 'aioseop_mrt_pcolumns' );
138
+ } else {
139
  add_filter( 'manage_posts_columns', 'aioseop_mrt_pcolumns' );
140
+ }
141
+ if ( $post_type == 'attachment' ) {
142
  add_action( 'manage_media_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
143
+ } elseif ( is_post_type_hierarchical( $post_type ) ) {
144
  add_action( 'manage_pages_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
145
+ } else {
146
  add_action( 'manage_posts_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
147
+ }
148
  }
149
  }
150
  }
151
 
152
+ if ( ! function_exists( 'aioseop_mrt_pcolumns' ) ) {
153
  function aioseop_mrt_pcolumns( $aioseopc ) {
154
  global $aioseop_options;
155
+ $aioseopc['seotitle'] = __( 'SEO Title', 'all-in-one-seo-pack' );
156
+ $aioseopc['seodesc'] = __( 'SEO Description', 'all-in-one-seo-pack' );
157
+ if ( empty( $aioseop_options['aiosp_togglekeywords'] ) ) {
158
  $aioseopc['seokeywords'] = __( 'SEO Keywords', 'all-in-one-seo-pack' );
159
+ }
160
+
161
+ return $aioseopc;
162
  }
163
  }
164
 
165
+ if ( ! function_exists( 'aioseop_admin_head' ) ) {
166
  function aioseop_admin_head() {
167
  echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'js/quickedit_functions.js" ></script>';
168
+ ?>
169
+ <style>
170
+ .aioseop_edit_button {
171
+ margin: 0 0 0 5px;
172
+ opacity: 0.6;
173
+ width: 12px;
174
+ }
175
+
176
+ .aioseop_edit_link {
177
+ display: inline-block;
178
+ position: absolute;
179
+ }
180
+
181
+ .aioseop_mpc_SEO_admin_options_edit img {
182
+ margin: 3px 2px;
183
+ opacity: 0.7;
184
+ }
185
+
186
+ .aioseop_mpc_admin_meta_options {
187
+ float: left;
188
+ display: block;
189
+ opacity: 1;
190
+ max-height: 75px;
191
+ overflow: hidden;
192
+ width: 100%;
193
+ }
194
+
195
+ .aioseop_mpc_admin_meta_options.editing {
196
+ max-height: initial;
197
+ overflow: visible;
198
+ }
199
+
200
+ .aioseop_mpc_admin_meta_content {
201
+ float: left;
202
+ width: 100%;
203
+ margin: 0 0 10px 0;
204
+ }
205
+
206
+ td.seotitle.column-seotitle,
207
+ td.seodesc.column-seodesc,
208
+ td.seokeywords.column-seokeywords {
209
+ overflow: visible;
210
+ }
211
+
212
+ @media screen and (max-width: 782px) {
213
+ body.wp-admin th.column-seotitle, th.column-seodesc, th.column-seokeywords, td.seotitle.column-seotitle, td.seodesc.column-seodesc, td.seokeywords.column-seokeywords {
214
+ display: none;
215
+ }
216
  }
 
217
  </style>
218
  <?php wp_print_scripts( Array( 'sack' ) );
219
+ ?>
220
+ <script type="text/javascript">
221
+ //<![CDATA[
222
+ var aioseopadmin = {
223
+ blogUrl: "<?php print get_bloginfo( 'url' ); ?>",
224
+ pluginUrl: "<?php print AIOSEOP_PLUGIN_URL; ?>",
225
+ requestUrl: "<?php print WP_ADMIN_URL . '/admin-ajax.php' ?>",
226
+ imgUrl: "<?php print AIOSEOP_PLUGIN_IMAGES_URL; ?>",
227
+ Edit: "<?php _e( 'Edit', 'all-in-one-seo-pack' ); ?>",
228
+ Post: "<?php _e( 'Post', 'all-in-one-seo-pack' ); ?>",
229
+ Save: "<?php _e( 'Save', 'all-in-one-seo-pack' ); ?>",
230
+ Cancel: "<?php _e( 'Cancel', 'all-in-one-seo-pack' ); ?>",
231
+ postType: "post",
232
+ pleaseWait: "<?php _e( 'Please wait...', 'all-in-one-seo-pack' ); ?>",
233
+ slugEmpty: "<?php _e( 'Slug may not be empty!', 'all-in-one-seo-pack' ); ?>",
234
+ Revisions: "<?php _e( 'Revisions', 'all-in-one-seo-pack' ); ?>",
235
+ Time: "<?php _e( 'Insert time', 'all-in-one-seo-pack' ); ?>"
236
+ }
237
+ //]]>
238
  </script>
239
  <?php
240
  }
241
  }
242
 
243
+ if ( ! function_exists( 'aioseop_handle_ignore_notice' ) ) {
244
  function aioseop_handle_ignore_notice() {
245
 
246
+ if ( ! empty( $_GET ) ) {
247
  global $current_user;
248
  $user_id = $current_user->ID;
249
 
250
+ if ( ! empty( $_GET["aioseop_reset_notices"] ) ) {
251
  delete_user_meta( $user_id, 'aioseop_ignore_notice' );
252
  }
253
+ if ( ! empty( $_GET['aioseop_ignore_notice'] ) ) {
254
  add_user_meta( $user_id, 'aioseop_ignore_notice', $_GET['aioseop_ignore_notice'], false );
255
  }
256
  }
257
  }
258
  }
259
 
260
+ if ( ! function_exists( 'aioseop_output_notice' ) ) {
261
  function aioseop_output_notice( $message, $id = '', $class = "updated fade" ) {
262
  $class = 'aioseop_notice ' . $class;
263
+ if ( ! empty( $class ) ) {
264
+ $class = ' class="' . esc_attr( $class ) . '"';
265
+ }
266
+ if ( ! empty( $id ) ) {
267
+ $class .= ' id="' . esc_attr( $id ) . '"';
268
+ }
269
  $dismiss = ' ';
270
  echo "<div{$class}>" . wp_kses_post( $message ) . "<br class=clear /></div>";
271
+
272
  return true;
273
  }
274
  }
275
 
276
+ if ( ! function_exists( 'aioseop_output_dismissable_notice' ) ) {
277
+ function aioseop_output_dismissable_notice( $message, $id = "", $class = "updated fade" ) {
278
  global $current_user;
279
+ if ( ! empty( $current_user ) ) {
280
  $user_id = $current_user->ID;
281
+ $msgid = md5( $message );
282
+ $ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' );
283
+ if ( ! empty( $ignore ) && in_array( $msgid, $ignore ) ) {
284
+ return false;
285
+ }
286
  global $wp;
287
  $qa = Array();
288
  wp_parse_str( $_SERVER["QUERY_STRING"], $qa );
289
  $qa['aioseop_ignore_notice'] = $msgid;
290
+ $url = '?' . build_query( $qa );
291
+ $message = '<p class=alignleft>' . $message . '</p><p class="alignright"><a class="aioseop_dismiss_link" href="' . $url . '">Dismiss</a></p>';
292
  }
293
+
294
  return aioseop_output_notice( $message, $id, $class );
295
  }
296
  }
297
 
298
+ if ( ! function_exists( 'aioseop_ajax_save_meta' ) ) {
299
  function aioseop_ajax_save_meta() {
300
+ if ( ! empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] != 'undefined' ) ) {
301
  check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
302
+ }
303
+ $post_id = intval( $_POST['post_id'] );
304
  $new_meta = strip_tags( $_POST['new_meta'] );
305
+ $target = $_POST['target_meta'];
306
  check_ajax_referer( 'aioseop_meta_' . $target . '_' . $post_id, '_nonce' );
307
  $result = '';
308
+ if ( in_array( $target, Array(
309
+ 'title',
310
+ 'description',
311
+ 'keywords'
312
+ ) ) && current_user_can( 'edit_post', $post_id )
313
+ ) {
314
  update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
315
  $result = get_post_meta( $post_id, '_aioseop_' . $target, true );
316
  } else {
317
  die();
318
  }
319
+ if ( $result != '' ):
320
  $label = "<label id='aioseop_label_{$target}_{$post_id}'><span style='width: 20px;display: inline-block;'></span>" . $result . '</label>';
321
  else:
322
  $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>';
323
  endif;
324
+ $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$post_id}" );
325
  $output = '<a id="' . $target . 'editlink' . $post_id . '" class="aioseop_edit_link" href="javascript:void(0);"'
326
+ . 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">'
327
+ . '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a> ' . $label;
328
  die( "jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . ";
329
  jQuery('div#aioseop_" . $target . "_" . $post_id . "').html(my_label).fadeIn('fast');
330
  });" );
331
  }
332
  }
333
 
334
+ if ( ! function_exists( 'aioseop_ajax_init' ) ) {
335
  function aioseop_ajax_init() {
336
+ if ( ! empty( $_POST ) && ! empty( $_POST['settings'] ) && ( ! empty( $_POST['nonce-aioseop'] ) || ( ! empty( $_POST['nonce-aioseop-edit'] ) ) ) && ! empty( $_POST['options'] ) ) {
337
+ $_POST = stripslashes_deep( $_POST );
338
  $settings = esc_attr( $_POST['settings'] );
339
+ if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) ) {
340
+ define( 'AIOSEOP_AJAX_MSG_TMPL', "jQuery('div#aiosp_$settings').fadeOut('fast', function(){jQuery('div#aiosp_$settings').html('%s').fadeIn('fast');});" );
341
+ }
342
 
343
+ if ( ! wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
344
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __( "Unauthorized access; try reloading the page.", 'all-in-one-seo-pack' ) ) );
345
+ }
346
  } else {
347
+ die( 0 );
348
  }
349
  }
350
  }
351
 
352
+ function aioseop_embed_handler_html( $return, $url, $attr ) {
353
+ return AIO_ProGeneral::aioseop_embed_handler_html();
354
+ }
355
 
356
+ function aioseop_ajax_update_oembed() {
357
+ AIO_ProGeneral::aioseop_ajax_update_oembed();
358
+ }
359
 
360
+ if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {
361
  function aioseop_ajax_save_url() {
362
  aioseop_ajax_init();
363
  $options = Array();
364
  parse_str( $_POST['options'], $options );
365
+ foreach ( $options as $k => $v ) {
366
+ $_POST[ $k ] = $v;
367
+ }
368
  $_POST['action'] = 'aiosp_update_module';
369
  global $aiosp, $aioseop_modules;
370
  aioseop_load_modules();
371
  $aiosp->admin_menu();
372
+ if ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] == 'video_sitemap_addl_pages' ) ) {
373
  $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Video_Sitemap" );
374
+ } elseif ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] == 'news_sitemap_addl_pages' ) ) {
375
  $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_News_Sitemap" );
376
  } else {
377
  $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" );
378
  }
379
  $_POST['location'] = null;
380
+ $_POST['Submit'] = 'ajax';
381
  $module->add_page_hooks();
382
  $prefix = $module->get_prefix();
383
+ $_POST = $module->get_current_options( $_POST, null );
384
  $module->handle_settings_updates( null );
385
  $options = $module->get_current_options( Array(), null );
386
+ $output = $module->display_custom_options( '', Array(
387
+ 'name' => $prefix . 'addl_pages',
388
+ 'type' => 'custom',
389
+ 'save' => true,
390
+ 'value' => $options[ $prefix . 'addl_pages' ],
391
+ 'attr' => ''
392
+ ) );
393
+ $output = str_replace( "'", "\'", $output );
394
+ $output = str_replace( "\n", '\n', $output );
395
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
396
  }
397
  }
398
 
399
+ if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) {
400
  function aioseop_ajax_delete_url() {
401
  aioseop_ajax_init();
402
+ $options = Array();
403
+ $options = esc_attr( $_POST['options'] );
404
  $_POST['action'] = 'aiosp_update_module';
405
  global $aiosp, $aioseop_modules;
406
  aioseop_load_modules();
407
  $aiosp->admin_menu();
408
+ $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" );
409
  $_POST['location'] = null;
410
+ $_POST['Submit'] = 'ajax';
411
  $module->add_page_hooks();
412
+ $_POST = (Array) $module->get_current_options( $_POST, null );
413
+ if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( is_object( $_POST['aiosp_sitemap_addl_pages'] ) ) ) {
414
+ $_POST['aiosp_sitemap_addl_pages'] = (Array) $_POST['aiosp_sitemap_addl_pages'];
415
+ }
416
+ if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( ! empty( $_POST['aiosp_sitemap_addl_pages'][ $options ] ) ) ) {
417
  unset( $_POST['aiosp_sitemap_addl_pages'][ $options ] );
418
+ if ( empty( $_POST['aiosp_sitemap_addl_pages'] ) ) {
419
  $_POST['aiosp_sitemap_addl_pages'] = '';
420
+ } else {
421
  $_POST['aiosp_sitemap_addl_pages'] = json_encode( $_POST['aiosp_sitemap_addl_pages'] );
422
+ }
423
  $module->handle_settings_updates( null );
424
  $options = $module->get_current_options( Array(), null );
425
+ $output = $module->display_custom_options( '', Array(
426
+ 'name' => 'aiosp_sitemap_addl_pages',
427
+ 'type' => 'custom',
428
+ 'save' => true,
429
+ 'value' => $options['aiosp_sitemap_addl_pages'],
430
+ 'attr' => ''
431
+ ) );
432
+ $output = str_replace( "'", "\'", $output );
433
+ $output = str_replace( "\n", '\n', $output );
434
  } else {
435
  $output = sprintf( __( "Row %s not found; no rows were deleted.", 'all-in-one-seo-pack' ), esc_attr( $options ) );
436
  }
438
  }
439
  }
440
 
441
+ if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
442
 
443
  function aioseop_ajax_scan_header() {
444
  $_POST["options"] = "foo";
445
  aioseop_ajax_init();
446
  $options = Array();
447
  parse_str( $_POST['options'], $options );
448
+ foreach ( $options as $k => $v ) {
449
+ $_POST[ $k ] = $v;
450
+ }
451
+ $_POST['action'] = 'aiosp_update_module';
452
  $_POST['location'] = null;
453
+ $_POST['Submit'] = 'ajax';
454
  ob_start();
455
+ do_action( 'wp' );
456
  global $aioseop_modules;
457
  $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Opengraph" );
458
  wp_head();
459
  $output = ob_get_clean();
460
  global $aiosp;
461
+ $output = $aiosp->html_string_to_array( $output );
462
+ $meta = '';
463
  $metatags = Array(
464
+ 'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
465
+ 'twitter' => Array( 'name' => 'name', 'value' => 'value' ),
466
+ 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' )
467
  );
468
  $metadata = Array(
469
+ 'facebook' => Array(
470
+ 'title' => 'og:title',
471
+ 'type' => 'og:type',
472
+ 'url' => 'og:url',
473
+ 'thumbnail' => 'og:image',
474
+ 'sitename' => 'og:site_name',
475
+ 'key' => 'fb:admins',
476
+ 'description' => 'og:description'
477
+ ),
478
+ 'google+' => Array(
479
+ 'thumbnail' => 'image',
480
+ 'title' => 'name',
481
+ 'description' => 'description'
482
+ ),
483
+ 'twitter' => Array(
484
+ 'card' => 'twitter:card',
485
+ 'url' => 'twitter:url',
486
+ 'title' => 'twitter:title',
487
+ 'description' => 'twitter:description',
488
+ 'thumbnail' => 'twitter:image'
489
+ )
490
  );
491
+ if ( ! empty( $output ) && ! empty( $output['head'] ) && ! empty( $output['head']['meta'] ) ) {
492
+ foreach ( $output['head']['meta'] as $v ) {
493
+ if ( ! empty( $v['@attributes'] ) ) {
494
  $m = $v['@attributes'];
495
+ foreach ( $metatags as $type => $tags ) {
496
+ if ( ! empty( $m[ $tags['name'] ] ) && ! empty( $m[ $tags['value'] ] ) ) {
497
+ foreach ( $metadata[ $type ] as $tk => $tv ) {
498
+ if ( $m[ $tags['name'] ] == $tv ) {
499
+ $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";
500
+ }
501
+ }
502
+ }
503
+ }
504
  }
505
+ }
506
+ }
507
+ if ( empty( $meta ) ) {
508
+ $meta = '<span style="color:green;">' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . '</span>';
509
+ } else {
510
  $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>";
511
  $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;'>"
512
+ . "<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' )
513
+ . "</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' )
514
+ . "</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>";
515
+
516
+ foreach (
517
+ Array(
518
+ 'https://developers.facebook.com/tools/debug',
519
+ 'http://www.google.com/webmasters/tools/richsnippets',
520
+ 'https://dev.twitter.com/docs/cards/validation/validator'
521
+ ) as $link
522
+ ) {
523
  $meta .= "<a href='{$link}' target='_blank'>{$link}</a><br />";
524
  }
525
+ $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>";
526
  }
527
  $output = $meta;
528
  $output = str_replace( "'", "\'", $output );
531
  }
532
  }
533
 
534
+ if ( ! function_exists( 'aioseop_ajax_save_settings' ) ) {
535
  function aioseop_ajax_save_settings() {
536
  aioseop_ajax_init();
537
  $options = Array();
538
  parse_str( $_POST['options'], $options );
539
+ $_POST = $options;
540
  $_POST['action'] = 'aiosp_update_module';
541
  global $aiosp, $aioseop_modules;
542
  aioseop_load_modules();
543
  $aiosp->admin_menu();
544
  $module = $aioseop_modules->return_module( $_POST['module'] );
545
  unset( $_POST['module'] );
546
+ if ( empty( $_POST['location'] ) ) {
547
+ $_POST['location'] = null;
548
+ }
549
  $_POST['Submit'] = 'ajax';
550
  $module->add_page_hooks();
551
  $output = $module->handle_settings_updates( $_POST['location'] );
552
 
553
+ if ( AIOSEOPPRO ) {
554
+ $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>';
555
+ } else {
556
+ $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>';
557
+ }
558
 
559
  die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
560
  }
561
  }
562
 
563
+ if ( ! function_exists( 'aioseop_ajax_get_menu_links' ) ) {
564
  function aioseop_ajax_get_menu_links() {
565
  aioseop_ajax_init();
566
  $options = Array();
567
  parse_str( $_POST['options'], $options );
568
+ $_POST = $options;
569
  $_POST['action'] = 'aiosp_update_module';
570
  global $aiosp, $aioseop_modules;
571
  aioseop_load_modules();
572
  $aiosp->admin_menu();
573
+ if ( empty( $_POST['location'] ) ) {
574
+ $_POST['location'] = null;
575
+ }
576
  $_POST['Submit'] = 'ajax';
577
+ $modlist = $aioseop_modules->get_loaded_module_list();
578
+ $links = Array();
579
+ $link_list = Array();
580
+ $link = $aiosp->get_admin_links();
581
+ if ( ! empty( $link ) ) {
582
+ foreach ( $link as $l ) {
583
+ if ( ! empty( $l ) ) {
584
+ if ( empty( $link_list[ $l['order'] ] ) ) {
585
+ $link_list[ $l['order'] ] = Array();
586
+ }
587
+ $link_list[ $l['order'] ][ $l['title'] ] = $l['href'];
588
  }
589
+ }
590
+ }
591
+ if ( ! empty( $modlist ) ) {
592
+ foreach ( $modlist as $k => $v ) {
593
  $mod = $aioseop_modules->return_module( $v );
594
  if ( is_object( $mod ) ) {
595
  $mod->add_page_hooks();
596
  $link = $mod->get_admin_links();
597
+ foreach ( $link as $l ) {
598
+ if ( ! empty( $l ) ) {
599
+ if ( empty( $link_list[ $l['order'] ] ) ) {
600
+ $link_list[ $l['order'] ] = Array();
601
+ }
602
+ $link_list[ $l['order'] ][ $l['title'] ] = $l['href'];
603
  }
604
+ }
605
  }
606
  }
607
+ }
608
+ if ( ! empty( $link_list ) ) {
609
  ksort( $link_list );
610
+ foreach ( $link_list as $ll ) {
611
+ foreach ( $ll as $k => $v ) {
612
+ $links[ $k ] = $v;
613
+ }
614
+ }
615
  }
616
  $output = "<ul>";
617
+ if ( ! empty( $links ) ) {
618
+ foreach ( $links as $k => $v ) {
619
+ if ( $k == "Feature Manager" ) {
620
  $current = ' class="current"';
621
+ } else {
622
  $current = '';
623
+ }
624
+ $output .= "<li{$current}><a href='" . esc_url( $v ) . "'>" . esc_attr( $k ) . "</a></li>";
625
  }
626
+ }
627
  $output .= "</ul>";
628
+ die( sprintf( "jQuery('{$_POST['target']}').fadeOut('fast', function(){jQuery('{$_POST['target']}').html('%s').fadeIn('fast');});", addslashes( $output ) ) );
629
  }
630
  }
631
 
632
+ if ( ! function_exists( 'aioseop_mrt_pccolumn' ) ) {
633
+ function aioseop_mrt_pccolumn( $aioseopcn, $aioseoppi ) {
634
+ $id = $aioseoppi;
635
  $target = null;
636
+ if ( $aioseopcn == 'seotitle' ) {
637
+ $target = 'title';
638
+ }
639
+ if ( $aioseopcn == 'seokeywords' ) {
640
+ $target = 'keywords';
641
+ }
642
+ if ( $aioseopcn == 'seodesc' ) {
643
+ $target = 'description';
644
+ }
645
+ if ( ! $target ) {
646
+ return;
647
+ }
648
+ if ( current_user_can( 'edit_post', $id ) ) { ?>
649
  <div class="aioseop_mpc_admin_meta_container">
650
+ <div class="aioseop_mpc_admin_meta_options"
651
+ id="aioseop_<?php print $target; ?>_<?php echo $id; ?>"
652
+ style="float:left;">
653
+ <?php $content = strip_tags( stripslashes( get_post_meta( $id, "_aioseop_" . $target, true ) ) );
654
+ if ( ! empty( $content ) ):
655
+ $label = "<label id='aioseop_label_{$target}_{$id}'><span style='width: 20px;display: inline-block;'></span>" . $content . '</label>';
656
+ else:
657
+ $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>';
658
+ endif;
659
  $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$id}" );
660
  echo '<a id="' . $target . 'editlink' . $id . '" class="aioseop_edit_link" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
661
+ $id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">'
662
+ . "<img class='aioseop_edit_button'
663
  id='aioseop_edit_id'
664
  src='" . AIOSEOP_PLUGIN_IMAGES_URL . "cog_edit.png' /></a> " . $label;
665
+ ?>
666
  </div>
667
  </div>
668
  <?php }
669
  }
670
  }
671
 
672
+ if ( ! function_exists( 'aioseop_unprotect_meta' ) ) {
673
  function aioseop_unprotect_meta( $protected, $meta_key, $meta_type ) {
674
+ if ( isset( $meta_key ) && ( substr( $meta_key, 0, 9 ) === '_aioseop_' ) ) {
675
+ return false;
676
+ }
677
+
678
  return $protected;
679
  }
680
  }
681
 
682
+ if ( ! function_exists( 'aioseop_mrt_exclude_this_page' ) ) {
683
  function aioseop_mrt_exclude_this_page( $url = null ) {
684
  static $excluded = false;
685
  if ( $excluded === false ) {
686
  global $aioseop_options;
687
  $ex_pages = '';
688
+ if ( isset( $aioseop_options['aiosp_ex_pages'] ) ) {
689
  $ex_pages = trim( $aioseop_options['aiosp_ex_pages'] );
690
+ }
691
+ if ( ! empty( $ex_pages ) ) {
692
  $excluded = explode( ',', $ex_pages );
693
+ if ( ! empty( $excluded ) ) {
694
+ foreach ( $excluded as $k => $v ) {
695
+ $excluded[ $k ] = trim( $v );
696
+ if ( empty( $excluded[ $k ] ) ) {
697
+ unset( $excluded[ $k ] );
698
+ }
699
  }
700
+ }
701
+ if ( empty( $excluded ) ) {
702
+ $excluded = null;
703
+ }
704
  }
705
  }
706
+ if ( ! empty( $excluded ) ) {
707
+ if ( $url === null ) {
708
  $url = $_SERVER['REQUEST_URI'];
709
+ } else {
710
  $url = parse_url( $url );
711
+ if ( ! empty( $url['path'] ) ) {
712
  $url = $url['path'];
713
+ } else {
714
  return false;
715
+ }
716
+ }
717
+ if ( ! empty( $url ) ) {
718
+ foreach ( $excluded as $exedd ) {
719
+ if ( ( $exedd ) && ( stripos( $url, $exedd ) !== false ) ) {
720
+ return true;
721
+ }
722
+ }
723
  }
 
 
 
 
724
  }
725
+
726
  return false;
727
  }
728
  }
729
 
730
+ if ( ! function_exists( 'aioseop_get_pages_start' ) ) {
731
  function aioseop_get_pages_start( $excludes ) {
732
  global $aioseop_get_pages_start;
733
  $aioseop_get_pages_start = 1;
734
+
735
  return $excludes;
736
  }
737
  }
738
 
739
+ if ( ! function_exists( 'aioseop_get_pages' ) ) {
740
  function aioseop_get_pages( $pages ) {
741
  global $aioseop_get_pages_start;
742
+ if ( ! $aioseop_get_pages_start ) {
743
+ return $pages;
744
+ }
745
  foreach ( $pages as $k => $v ) {
746
+ $postID = $v->ID;
747
  $menulabel = stripslashes( get_post_meta( $postID, '_aioseop_menulabel', true ) );
748
+ if ( $menulabel ) {
749
+ $pages[ $k ]->post_title = $menulabel;
750
+ }
751
  }
752
  $aioseop_get_pages_start = 0;
753
+
754
  return $pages;
755
  }
756
  }
757
 
758
  // The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/.
759
+ if ( ! function_exists( 'aioseop_list_pages' ) ) {
760
  function aioseop_list_pages( $content ) {
761
  global $wp_version;
762
  $matches = array();
768
  } else {
769
  $pattern = '@<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">@is';
770
  }
771
+
772
  return preg_replace_callback( $pattern, "aioseop_filter_callback", $content );
773
  }
774
+
775
  return $content;
776
  }
777
  }
778
 
779
+ if ( ! function_exists( 'aioseop_filter_callback' ) ) {
780
  function aioseop_filter_callback( $matches ) {
781
+ if ( $matches[1] && ! empty( $matches[1] ) ) {
782
+ $postID = $matches[1];
783
+ }
784
+ if ( empty( $postID ) ) {
785
+ $postID = get_option( "page_on_front" );
786
+ }
787
+ $title_attrib = stripslashes( get_post_meta( $postID, '_aioseop_titleatr', true ) );
788
+ if ( empty( $title_attrib ) && ! empty( $matches[4] ) ) {
789
+ $title_attrib = $matches[4];
790
+ }
791
+ if ( ! empty( $title_attrib ) ) {
792
+ $title_attrib = ' title="' . strip_tags( $title_attrib ) . '"';
793
+ }
794
+
795
+ return '<li class="page_item page-item-' . $postID . $matches[2] . '"><a href="' . $matches[3] . '"' . $title_attrib . '>';
796
  }
797
  }
798
 
799
+ if ( ! function_exists( 'aioseop_add_contactmethods' ) ) {
800
  function aioseop_add_contactmethods( $contactmethods ) {
801
  global $aioseop_options, $aioseop_modules;
802
+ if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
803
  $contactmethods['googleplus'] = __( 'Google+', 'all-in-one-seo-pack' );
804
+ }
805
+ if ( ! empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) {
806
  $m = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' );
807
  if ( ( $m !== false ) && is_object( $m ) ) {
808
+ if ( $m->option_isset( 'twitter_creator' ) ) {
809
  $contactmethods['twitter'] = __( 'Twitter', 'all-in-one-seo-pack' );
810
+ }
811
+ if ( $m->option_isset( 'facebook_author' ) ) {
812
  $contactmethods['facebook'] = __( 'Facebook', 'all-in-one-seo-pack' );
813
+ }
814
  }
815
  }
816
+
817
  return $contactmethods;
818
  }
819
  }
820
 
821
+ if ( ! function_exists( 'aioseop_localize_script_data' ) ) {
822
  function aioseop_localize_script_data() {
823
  static $loaded = 0;
824
+ if ( ! $loaded ) {
825
  $data = apply_filters( 'aioseop_localize_script_data', Array() );
826
  wp_localize_script( 'aioseop-module-script', 'aiosp_data', $data );
827
  $loaded = 1;
832
  /***
833
  * Utility function for inserting elements into associative arrays by key
834
  */
835
+ if ( ! function_exists( 'aioseop_array_insert_after' ) ) {
836
  function aioseop_array_insert_after( $arr, $insertKey, $newValues ) {
837
+ $keys = array_keys( $arr );
838
+ $vals = array_values( $arr );
839
+ $insertAfter = array_search( $insertKey, $keys ) + 1;
840
+ $keys2 = array_splice( $keys, $insertAfter );
841
+ $vals2 = array_splice( $vals, $insertAfter );
842
+ foreach ( $newValues as $k => $v ) {
843
+ $keys[] = $k;
844
+ $vals[] = $v;
845
+ }
846
+
847
+ return array_merge( array_combine( $keys, $vals ), array_combine( $keys2, $vals2 ) );
848
  }
849
  }
850
 
851
  /***
852
  * JSON support for PHP < 5.2
853
  */
854
+ if ( ! function_exists( 'aioseop_load_json_services' ) ) {
855
  function aioseop_load_json_services() {
856
  static $services_json = null;
857
+ if ( $services_json ) {
858
+ return $services_json;
859
+ }
860
+ if ( ! class_exists( 'Services_JSON' ) ) {
861
+ require_once( 'inc/extlib/JSON.php' );
862
+ }
863
+ if ( ! $services_json ) {
864
+ $services_json = new Services_JSON();
865
+ }
866
+
867
  return $services_json;
868
  }
869
  }
870
 
871
+ if ( ! function_exists( 'json_encode' ) ) {
872
  function json_encode( $arg ) {
873
  $services_json = aioseop_load_json_services();
874
+
875
  return $services_json->encode( $arg );
876
  }
877
  }
878
 
879
+ if ( ! function_exists( 'json_decode' ) ) {
880
  function json_decode( $arg ) {
881
  $services_json = aioseop_load_json_services();
882
+
883
  return $services_json->decode( $arg );
884
  }
885
  }
887
  /***
888
  * fnmatch() doesn't exist on Windows pre PHP 5.3
889
  */
890
+ if ( ! function_exists( 'fnmatch' ) ) {
891
+ function fnmatch( $pattern, $string ) {
892
+ return preg_match( "#^" . strtr( preg_quote( $pattern, '#' ), array(
893
+ '\*' => '.*',
894
+ '\?' => '.'
895
+ ) ) . "$#i", $string );
896
+ }
897
  }
898
 
899
  /***
900
  * parse_ini_string() doesn't exist pre PHP 5.3
901
  */
902
+ if ( ! function_exists( 'parse_ini_string' ) ) {
903
  function parse_ini_string( $string, $process_sections ) {
904
+ if ( ! class_exists( 'parse_ini_filter' ) ) {
905
  /* Define our filter class */
906
+
907
  class parse_ini_filter extends php_user_filter {
908
  static $buf = '';
909
+
910
  function filter( $in, $out, &$consumed, $closing ) {
911
+ $bucket = stream_bucket_new( fopen( 'php://memory', 'wb' ), self::$buf );
912
  stream_bucket_append( $out, $bucket );
913
+
914
  return PSFS_PASS_ON;
915
  }
916
  }
917
+
918
  /* Register our filter with PHP */
919
+ if ( ! stream_filter_register( "parse_ini", "parse_ini_filter" ) ) {
920
  return false;
921
+ }
922
  }
923
  parse_ini_filter::$buf = $string;
924
+
925
  return parse_ini_file( "php://filter/read=parse_ini/resource=php://memory", $process_sections );
926
  }
927
  }
928
 
929
+ function aioseop_update_user_visibilitynotice() {
930
 
931
  update_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
932
 
933
+ }
934
 
935
+ function aioseop_update_yst_detected_notice() {
936
 
937
  update_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
938
 
939
+ }
940
 
941
+ function aioseop_woo_upgrade_notice_dismissed() {
942
 
943
  update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
944
 
945
+ }
inc/aioseop_updates_class.php CHANGED
@@ -1,176 +1,213 @@
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
+ * @author Michael Torbert.
10
+ * @author Semper Fi Web Design.
11
+ * @copyright http://semperplugins.com
12
+ * @package All-in-One-SEO-Pack.
13
+ * @version 1.0.0
14
+ */
15
+ class aioseop_updates {
16
+
17
+ /**
18
+ * Constructor
19
+ * @since 1.0.0
20
+ */
21
+ function __construct() {
22
+ }
23
+
24
+ /**
25
+ * Updates version.
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 = isset( $aioseop_options['last_active_version'] )
42
+ ? $aioseop_options['last_active_version'] : '0.0';
43
+
44
+ // Compares version to see which one is the newer.
45
+ if ( version_compare( $last_active_version, AIOSEOP_VERSION, '<' ) ) {
46
+
47
+ // Upgrades based on previous version
48
+ $this->do_version_updates( $last_active_version );
49
+
50
+ // If we're running Pro, let the Pro updater set the version.
51
+ if ( ! AIOSEOPPRO ) {
52
+
53
+ // Save the current plugin version as the new last_active_version
54
+ $aioseop_options['last_active_version'] = AIOSEOP_VERSION;
55
+ $aiosp->update_class_option( $aioseop_options );
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Perform updates that are dependent on external factors, not
61
+ * just the plugin version.
62
+ */
63
+ $this->do_feature_updates();
64
+ }
65
+
66
+
67
+ /**
68
+ * Updates version.
69
+ * TODO: the compare here should be extracted into a function
70
+ * @since 1.0.0
71
+ * @global $aioseop_options .
72
+ *
73
+ * @param String $old_version
74
+ */
75
+ function do_version_updates( $old_version ) {
76
+ global $aioseop_options;
77
+ if (
78
+ ( ! AIOSEOPPRO && version_compare( $old_version, '2.3.3', '<' ) ) ||
79
+ ( AIOSEOPPRO && version_compare( $old_version, '2.4.3', '<' ) )
80
+ ) {
81
+ $this->bad_bots_201603();
82
+ }
83
+
84
+ if (
85
+ ( ! AIOSEOPPRO && version_compare( $old_version, '2.3.4.1', '<' ) ) ||
86
+ ( AIOSEOPPRO && version_compare( $old_version, '2.4.4.1', '<' ) )
87
+ ) {
88
+ $this->bad_bots_remove_yandex_201604();
89
+ }
90
+
91
+ }
92
+
93
+ /**
94
+ * Removes overzealous 'DOC' entry which is causing false-positive bad
95
+ * bot blocking.
96
+ * @since 2.3.3
97
+ * @global $aiosp , $aioseop_options.
98
+ */
99
+ function bad_bots_201603() {
100
+ global $aiosp, $aioseop_options;
101
+
102
+ // Remove 'DOC' from bad bots list to avoid false positives
103
+ if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
104
+ $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
105
+ $list = str_replace( array(
106
+ "DOC\r\n",
107
+ "DOC\n"
108
+ ), '', $list );
109
+ $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
110
+ update_option( 'aioseop_options', $aioseop_options );
111
+ $aiosp->update_class_option( $aioseop_options );
112
+ if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
113
+ && 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules']
114
+ ) {
115
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
116
+ require_once(
117
+ AIOSEOP_PLUGIN_DIR .
118
+ 'admin/aioseop_module_class.php'
119
+ );
120
+ require_once(
121
+ AIOSEOP_PLUGIN_DIR .
122
+ 'modules/aioseop_bad_robots.php'
123
+ );
124
+ }
125
+ $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
126
+ $aiosp_reset_htaccess->generate_htaccess_blocklist();
127
+ }
128
+ if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
129
+ && extract_from_markers(
130
+ get_home_path() . '.htaccess',
131
+ 'Bad Bot Blocker' )
132
+ ) {
133
+ insert_with_markers(
134
+ get_home_path() . '.htaccess',
135
+ 'Bad Bot Blocker',
136
+ ''
137
+ );
138
+ }
139
+ }
140
+ }
141
+
142
+ // Functions for specific version milestones
143
+
144
+ /**
145
+ * Remove 'yandex' entry. This is a major Russian search engine, and no longer needs to be blocked.
146
+ * @since 2.3.4.1
147
+ * @global $aiosp , $aioseop_options.
148
+ */
149
+ function bad_bots_remove_yandex_201604() {
150
+ global $aiosp, $aioseop_options;
151
+ // Remove 'yandex' from bad bots list to avoid false positives
152
+ if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
153
+ $list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
154
+ $list = str_replace( array(
155
+ "yandex\r\n",
156
+ "yandex\n"
157
+ ), '', $list );
158
+ $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
159
+ update_option( 'aioseop_options', $aioseop_options );
160
+ $aiosp->update_class_option( $aioseop_options );
161
+
162
+ 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'] ) {
163
+
164
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
165
+ require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' );
166
+ require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php' );
167
+ }
168
+
169
+ $aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
170
+ $aiosp_reset_htaccess->generate_htaccess_blocklist();
171
+ }
172
+
173
+ if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ) {
174
+ insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
175
+ }
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Updates features.
181
+ * @since 1.0.0
182
+ * @return null
183
+ */
184
+ public function do_feature_updates() {
185
+ global $aioseop_options;
186
+
187
+ // We don't need to check all the time. Use a transient to limit frequency.
188
+ if ( get_site_transient( 'aioseop_update_check_time' ) ) {
189
+ return;
190
+ }
191
+
192
+ // If we're running Pro, let the Pro updater set the transient.
193
+ if ( ! AIOSEOPPRO ) {
194
+
195
+ // We haven't checked recently. Reset the timestamp, timeout 6 hours.
196
+ set_site_transient(
197
+ 'aioseop_update_check_time',
198
+ time(),
199
+ apply_filters( 'aioseop_update_check_time', 3600 * 6 )
200
+ );
201
+ }
202
+
203
+
204
+ /*
205
+ if ( ! ( isset( $aioseop_options['version_feature_flags']['FEATURE_NAME'] ) &&
206
+ $aioseop_options['version_feature_flags']['FEATURE_NAME'] === 'yes' ) ) {
207
+ $this->some_feature_update_method(); // sets flag to 'yes' on completion.
208
+ }
209
+ */
210
+ }
211
+
212
+
213
+ }
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,40 @@
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
+ /**
4
+ * Class AIOSP_Common_Strings
5
+ *
6
+ * This is just for Pro strings to be translated.
7
+ *
8
+ */
9
+ class AIOSP_Common_Strings {
10
 
11
+ /**
12
+ * AIOSP_Common_Strings constructor.
13
+ *
14
+ * We'll just put all the strings in the contruct for lack of a better.
15
+ *
16
+ */
17
+ private function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ //video sitemap strings
20
+ __( 'Video Sitemap', 'all-in-one-seo-pack' );
21
+ __( 'Show Only Posts With Videos', 'all-in-one-seo-pack' );
22
+ __( 'Scan Posts For Videos', 'all-in-one-seo-pack' );
23
+ __( 'Restrict Access to Video Sitemap', 'all-in-one-seo-pack' );
24
+ __( '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' );
25
+ __( 'If checked, only posts that have videos in them will be displayed on the sitemap.', 'all-in-one-seo-pack' );
26
+ __( 'Enable this option to only allow access to your sitemap by site administrators and major search engines.', 'all-in-one-seo-pack' );
27
+ __( 'You do not have access to this page; try logging in as an administrator.', 'all-in-one-seo-pack' );
28
+ __( 'Scan', 'all-in-one-seo-pack' );
29
 
30
+ //functions_class strings
31
+ __( 'Finished scanning posts', 'all-in-one-seo-pack' );
32
 
33
+ //update checker strings (incomplete... need to separate out html)
34
+ __( 'Purchase one now', 'all-in-one-seo-pack' );
35
+ __( 'License Key is not set yet or invalid. ', 'all-in-one-seo-pack' );
36
+ __( ' Need a license key?', 'all-in-one-seo-pack' );
37
+ __( 'Notice: ', 'all-in-one-seo-pack' );
38
+ __( 'Manage Licenses', 'all-in-one-seo-pack' );
39
  }
40
+ }
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 @@
1
- <?php // Silence is golden
1
+ <?php // Silence is golden
inc/translations.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *
54
+ * @return mixed
55
+ */
56
+ private function get_locale_data() {
57
+ $response = wp_remote_get( $this->url );
58
+
59
+ return $response['body'];
60
+ }
61
+
62
+
63
+ /**
64
+ *
65
+ * @since 2.3.5
66
+ *
67
+ * @param $locales
68
+ */
69
+ private function set_current_locale_data( $locales ) {
70
+
71
+ // Some locales are missing the locale code (wp_locale) so we need to check for that.
72
+
73
+ foreach ( $locales as $locale ) {
74
+
75
+ $wplocale = '';
76
+
77
+ if ( isset( $locale->wp_locale ) ) {
78
+ $wplocale = $locale->wp_locale;
79
+ }
80
+
81
+ if ( $wplocale === $this->current_locale ) {
82
+
83
+ $name = '';
84
+ $percent_translated = '';
85
+
86
+ if ( isset( $locale->name ) ) {
87
+ $name = $locale->name;
88
+ }
89
+
90
+ if ( isset( $locale->percent_translated ) ) {
91
+ $percent_translated = $locale->percent_translated;
92
+ }
93
+
94
+ $this->name = $name;
95
+ $this->wplocale = $wplocale;
96
+ $this->percent_translated = $percent_translated;
97
+ $this->slug = $locale->locale;
98
+
99
+ }
100
+ }
101
+
102
+ }
103
+
104
+ /**
105
+ *
106
+ * @since 2.3.5
107
+ *
108
+ * @param $locales
109
+ *
110
+ * @return int
111
+ */
112
+ private function count_translated_languages( $locales ) {
113
+
114
+ $count = 0;
115
+
116
+ foreach ( $locales as $locale ) {
117
+
118
+ if ( $locale->percent_translated > 0 ) {
119
+ ++ $count;
120
+ }
121
+ }
122
+
123
+ return $count;
124
+ }
125
+
126
+ /**
127
+ *
128
+ *
129
+ * @since 2.3.5
130
+ */
131
+ private function set_translation_url() {
132
+
133
+ if ( null !== $this->wplocale ) {
134
+
135
+ $url = "https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack/dev/$this->slug/default";
136
+
137
+ $this->translation_url = $url;
138
+ }
139
+
140
+ }
141
+
142
+ /**
143
+ *
144
+ * @since 2.3.5
145
+ *
146
+ */
147
+ private function init() {
148
+
149
+ $json = $this->get_locale_data();
150
+
151
+ $translation_data = json_decode( $json );
152
+
153
+ $locales = $translation_data->translation_sets;
154
+
155
+ $this->set_current_locale_data( $locales );
156
+
157
+ $this->translated_count = $this->count_translated_languages( $locales );
158
+
159
+ $this->set_translation_url();
160
+ }
161
+ }
162
+
163
+ endif; // End class_exists check.
index.php CHANGED
@@ -1 +1,2 @@
1
- <?php // Silence is golden
 
1
+ <?php
2
+ // Silence is golden
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,219 @@
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
+ * Class All_in_One_SEO_Pack_Bad_Robots
9
+ */
10
  class All_in_One_SEO_Pack_Bad_Robots extends All_in_One_SEO_Pack_Module {
11
+
12
+ /**
13
+ * All_in_One_SEO_Pack_Bad_Robots constructor.
14
+ */
15
+ function __construct() {
16
+ $this->name = __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
17
+ $this->prefix = 'aiosp_bad_robots_'; // option prefix
18
+ $this->file = __FILE__; // the current file
19
  parent::__construct();
20
+
21
  $help_text = Array(
22
+ 'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ),
23
+ 'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ),
24
+ 'track_blocks' => __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ),
25
+ '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' ),
26
+ 'edit_blocks' => __( 'Check this to edit the list of disallowed user agents for blocking bad bots.', 'all-in-one-seo-pack' ),
27
+ 'blocklist' => __( 'This is the list of disallowed user agents used for blocking bad bots.', 'all-in-one-seo-pack' ),
28
+ 'referlist' => __( 'This is the list of disallowed referers used for blocking bad bots.', 'all-in-one-seo-pack' ),
29
+ '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' ),
30
  );
31
+
32
  $this->default_options = array(
33
+ 'block_bots' => Array( 'name' => __( 'Block Bad Bots using HTTP', 'all-in-one-seo-pack' ) ),
34
+ 'block_refer' => Array( 'name' => __( 'Block Referral Spam using HTTP', 'all-in-one-seo-pack' ) ),
35
+ 'track_blocks' => Array( 'name' => __( 'Track Blocked Bots', 'all-in-one-seo-pack' ) ),
36
  'htaccess_rules' => Array( 'name' => __( 'Block Bad Bots using .htaccess', 'all-in-one-seo-pack' ) ),
37
+ 'edit_blocks' => Array( 'name' => __( 'Use Custom Blocklists', 'all-in-one-seo-pack' ) ),
38
+ 'blocklist' => Array(
39
+ 'name' => __( 'User Agent Blocklist', 'all-in-one-seo-pack' ),
40
+ 'type' => 'textarea',
41
+ 'rows' => 5,
42
+ 'cols' => 120,
43
+ 'condshow' => Array( "{$this->prefix}edit_blocks" => 'on' ),
44
+ 'default' => join( "\n", $this->default_bad_bots() )
45
+ ),
46
+ 'referlist' => Array(
47
+ 'name' => __( 'Referer Blocklist', 'all-in-one-seo-pack' ),
48
+ 'type' => 'textarea',
49
+ 'rows' => 5,
50
+ 'cols' => 120,
51
+ 'condshow' => Array(
52
+ "{$this->prefix}edit_blocks" => 'on',
53
+ "{$this->prefix}block_refer" => 'on',
54
+ ),
55
+ 'default' => join( "\n", $this->default_bad_referers() )
56
+ ),
57
+ 'blocked_log' => Array(
58
+ 'name' => __( 'Log Of Blocked Bots', 'all-in-one-seo-pack' ),
59
+ 'default' => __( 'No requests yet.', 'all-in-one-seo-pack' ),
60
+ 'type' => 'html',
61
+ 'disabled' => 'disabled',
62
+ 'save' => false,
63
+ 'label' => 'top',
64
+ 'rows' => 5,
65
+ 'cols' => 120,
66
+ 'style' => 'min-width:950px',
67
+ 'condshow' => Array( "{$this->prefix}track_blocks" => 'on' )
68
+ )
69
  );
70
+ $is_apache = false;
71
+ if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) {
72
  $is_apache = true;
73
+ add_action( $this->prefix . 'settings_update', Array( $this, 'generate_htaccess_blocklist' ), 10 );
74
  } else {
75
+ unset( $this->default_options['htaccess_rules'] );
76
+ unset( $help_text['htaccess_rules'] );
77
+ }
78
+
79
+ if ( ! empty( $help_text ) ) {
80
+ foreach ( $help_text as $k => $v ) {
81
+ $this->default_options[ $k ]['help_text'] = $v;
82
+ }
83
  }
84
+
85
+ add_filter( $this->prefix . 'display_options', Array( $this, 'filter_display_options' ) );
86
+
 
 
 
 
87
  // load initial options / set defaults
88
+ $this->update_options();
89
+
90
  if ( $this->option_isset( 'edit_blocks' ) ) {
91
+ add_filter( $this->prefix . 'badbotlist', Array( $this, 'filter_bad_botlist' ) );
92
  if ( $this->option_isset( 'block_refer' ) ) {
93
+ add_filter( $this->prefix . 'badreferlist', Array( $this, 'filter_bad_referlist' ) );
94
  }
95
  }
96
+
97
  if ( $this->option_isset( 'block_bots' ) ) {
98
+ if ( ! $this->allow_bot() ) {
99
  status_header( 503 );
100
+ $ip = $_SERVER['REMOTE_ADDR'];
101
  $user_agent = $_SERVER['HTTP_USER_AGENT'];
102
+ $this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched user agent %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $user_agent ) );
103
  exit();
104
  } elseif ( $this->option_isset( 'block_refer' ) && $this->is_bad_referer() ) {
105
  status_header( 503 );
106
+ $ip = $_SERVER['REMOTE_ADDR'];
107
  $referer = $_SERVER['HTTP_REFERER'];
108
+ $this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched referer %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $referer ) );
109
  }
110
  }
111
  }
112
+
113
  function generate_htaccess_blocklist() {
114
+ if ( ! $this->option_isset( 'htaccess_rules' ) ) {
115
 
116
  if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, '' ) ) {
117
+ aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) );
118
  } else {
119
+ aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' );
120
  }
121
+
122
  return;
123
+
124
  }
125
 
126
  if ( function_exists( 'apache_get_modules' ) ) {
127
  $modules = apache_get_modules();
128
+ foreach ( Array( 'mod_authz_host', 'mod_setenvif' ) as $m ) {
129
+ if ( ! in_array( $m, $modules ) ) {
130
+ aioseop_output_notice( sprintf( __( 'Apache module %s is required!', 'all-in-one-seo-pack' ), $m ), '', 'error' );
131
  }
132
  }
133
  }
134
  $botlist = $this->default_bad_bots();
135
+ $botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
136
+ if ( ! empty( $botlist ) ) {
137
+ $regex = $this->quote_list_for_regex( $botlist, '"' );
138
+ $htaccess = Array();
139
  $htaccess[] = 'SetEnvIfNoCase User-Agent "' . $regex . '" bad_bot';
140
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
141
  $referlist = $this->default_bad_referers();
142
+ $referlist = apply_filters( $this->prefix . 'badreferlist', $botlist );
143
+ if ( ! empty( $referlist ) ) {
144
+ $regex = $this->quote_list_for_regex( $referlist, '"' );
145
  $htaccess[] = 'SetEnvIfNoCase Referer "' . $regex . '" bad_bot';
146
  }
147
  }
148
  $htaccess[] = 'Deny from env=bad_bot';
149
  if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, $htaccess ) ) {
150
+ aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) );
151
  } else {
152
+ aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' );
153
  }
154
  } else {
155
+ aioseop_output_notice( __( 'No rules to update!', 'all-in-one-seo-pack' ), '', 'error' );
156
  }
157
  }
158
+
159
+ /**
160
+ * @param $referlist
161
+ *
162
+ * @return array
163
+ */
164
  function filter_bad_referlist( $referlist ) {
165
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
166
  $referlist = explode( "\n", $this->options["{$this->prefix}referlist"] );
167
  }
168
+
169
  return $referlist;
170
  }
171
+
172
+ /**
173
+ * @param $botlist
174
+ *
175
+ * @return array
176
+ */
177
  function filter_bad_botlist( $botlist ) {
178
  if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'blocklist' ) ) {
179
  $botlist = explode( "\n", $this->options["{$this->prefix}blocklist"] );
180
  }
181
+
182
  return $botlist;
183
  }
184
+
185
+
186
+ /**
187
+ * @param string $msg
188
+ */
189
  function blocked_message( $msg ) {
190
+ /** Updates blocked log messages. **/
191
+ if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) {
192
+ $this->options["{$this->prefix}blocked_log"] = '';
193
+ }
194
  $this->options["{$this->prefix}blocked_log"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}blocked_log"];
195
  if ( $this->strlen( $this->options["{$this->prefix}blocked_log"] ) > 4096 ) {
196
  $end = $this->strrpos( $this->options["{$this->prefix}blocked_log"], "\n" );
197
+ if ( $end === false ) {
198
+ $end = 4096;
199
+ }
200
  $this->options["{$this->prefix}blocked_log"] = $this->substr( $this->options["{$this->prefix}blocked_log"], 0, $end );
201
  }
202
  $this->update_class_option( $this->options );
203
  }
204
+
205
+
206
+ /**
207
+ * @param $options
208
+ *
209
+ * @return mixed
210
+ */
211
  function filter_display_options( $options ) {
212
+ /** Add in options for status display on settings page, sitemap rewriting on multisite. **/
213
+ if ( $this->option_isset( 'blocked_log' ) ) {
214
+ $options["{$this->prefix}blocked_log"] = '<pre>' . $options["{$this->prefix}blocked_log"] . '</pre>';
215
+ }
216
+
217
  return $options;
218
  }
219
  }
modules/aioseop_feature_manager.php CHANGED
@@ -5,51 +5,71 @@
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
@@ -60,34 +80,42 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
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' ) );
@@ -99,31 +127,41 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
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
  }
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(
20
+ 'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
21
+ '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' )
22
+ ),
23
+ 'opengraph' => Array(
24
+ 'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
25
+ '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' )
26
+ ),
27
+ 'robots' => Array(
28
+ 'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
29
+ 'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' )
30
+ ),
31
+ 'file_editor' => Array(
32
+ 'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
33
+ 'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' )
34
+ ),
35
+ 'importer_exporter' => Array(
36
+ 'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
37
+ 'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' )
38
+ ),
39
+ 'bad_robots' => Array(
40
+ 'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
41
+ 'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' )
42
+ ),
43
+ 'performance' => Array(
44
+ 'name' => __( 'Performance', 'all-in-one-seo-pack' ),
45
+ 'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
46
+ 'default' => 'on'
47
+ )
48
+ );
49
 
50
 
51
+ if ( AIOSEOPPRO ) {
52
 
53
+ $this->module_info['coming_soon'] = Array(
54
+ 'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
55
+ 'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
56
+ 'save' => false
57
+ );
58
+ $this->module_info['video_sitemap'] = Array(
59
+ 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
60
+ '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' )
61
+ );
62
 
63
 
64
+ } else {
65
 
66
+ $this->module_info['coming_soon'] = Array(
67
+ 'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
68
+ 'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
69
+ 'save' => false
70
+ );
71
 
72
+ }
73
 
74
  // Set up default settings fields
75
  // name - Human-readable name of the setting
80
  // Other supported options: class, id, style -- allows you to set these HTML attributes on the field
81
 
82
  $this->default_options = array();
83
+ $this->module_info = apply_filters( 'aioseop_module_info', $this->module_info );
84
+ $mod[] = 'coming_soon';
85
+
86
+ foreach ( $mod as $m ) {
87
+ if ( $m == 'performance' && ! is_super_admin() ) {
88
+ continue;
89
+ }
90
+ $this->default_options["enable_$m"] = Array(
91
+ 'name' => $this->module_info[ $m ]['name'],
92
+ 'help_text' => $this->module_info[ $m ]['description'],
93
+ 'type' => 'custom',
94
+ 'class' => 'aioseop_feature',
95
+ 'id' => "aioseop_$m",
96
+ 'save' => true
97
+ );
98
+
99
+ if ( ! empty( $this->module_info[ $m ]['image'] ) ) {
100
+ $this->default_options["enable_$m"]['image'] = $this->module_info[ $m ]['image'];
101
+ }
102
+ if ( ! empty( $this->module_info[ $m ] ) ) {
103
+ foreach ( Array( 'save', 'default' ) as $option ) {
104
+ if ( isset( $this->module_info[ $m ][ $option ] ) ) {
105
+ $this->default_options["enable_$m"][ $option ] = $this->module_info[ $m ][ $option ];
106
+ }
107
+ }
108
+ }
109
  }
110
  $this->layout = Array(
111
  'default' => Array(
112
+ 'name' => $this->name,
113
+ 'help_link' => 'http://semperplugins.com/documentation/feature-manager/',
114
+ 'options' => array_keys( $this->default_options )
115
+ )
116
  );
117
  // load initial options / set defaults
118
+ $this->update_options();
119
  if ( is_admin() ) {
120
  add_filter( $this->prefix . 'output_option', Array( $this, 'display_option_div' ), 10, 2 );
121
  add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ) );
127
  }
128
 
129
  function filter_submit( $submit ) {
130
+ $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' &raquo;';
131
  $submit['Submit']['class'] .= " hidden";
132
  $submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' &raquo;';
133
+
134
  return $submit;
135
  }
136
 
137
  function display_option_div( $buf, $args ) {
138
  $name = $img = $desc = $checkbox = $class = '';
139
+ if ( isset( $args['options']['help_text'] ) && ! empty( $args['options']['help_text'] ) ) {
140
  $desc .= '<p class="aioseop_desc">' . $args['options']['help_text'] . '</p>';
141
+ }
142
+ if ( $args['value'] ) {
143
+ $class = ' active';
144
+ }
145
+ if ( isset( $args['options']['image'] ) && ! empty( $args['options']['image'] ) ) {
146
  $img .= '<p><img src="' . AIOSEOP_PLUGIN_IMAGES_URL . $args['options']['image'] . '"></p>';
147
+ } else {
148
  $img .= '<p><span class="aioseop_featured_image' . $class . '"></span></p>';
149
+ }
150
 
151
  if ( $args['options']['save'] ) {
152
  $name = "<h3>{$args['options']['name']}</h3>";
153
  $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'] . '"';
154
+ if ( $args['value'] ) {
155
+ $checkbox .= " CHECKED";
156
+ }
157
  $checkbox .= '><span class="button-primary feature_button' . $class . '"></span>';
158
  } else {
159
  $name = "<b>{$args['options']['name']}</b>";
160
  }
161
+ if ( ! empty( $args['options']['id'] ) ) {
162
+ $args['attr'] .= " id='{$args['options']['id']}'";
163
+ }
164
+
165
  return $buf . "<div {$args['attr']}><label for='{$args['name']}'>{$name}{$img}{$desc}{$checkbox}</label></div>";
166
  }
167
  }
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
+ * @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
+
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 ( $this->current_tab === 'robots' ) {
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 ( $this->current_tab === 'htaccess' ) {
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 ( $this->current_tab === 'robots' ) {
124
+ $options = $this->load_files( $options, Array( 'robotfile' => 'robots.txt' ), $prefix );
125
+ } elseif ( $this->current_tab === 'htaccess' ) {
126
+ $options = $this->load_files( $options, Array( 'htaccfile' => '.htaccess' ), $prefix );
127
+ }
128
+
129
  return $options;
130
  }
131
 
132
+ /**
133
+ * @param $options
134
+ * @param $location
135
+ */
136
  function do_file_editor( $options, $location ) {
137
  $prefix = $this->get_prefix( $location );
138
+ if ( $this->current_tab === 'robots' && isset( $_POST['Submit_File_Editor'] ) && $_POST['Submit_File_Editor'] ) {
139
  $this->save_files( Array( 'robotfile' => 'robots.txt' ), $prefix );
140
+ } elseif ( $this->current_tab === 'htaccess' && 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,611 @@
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
23
+ click 'Import' to import options from a
24
+ previous state or install of All in
25
+ One SEO Pack.<br />
26
+ <a
27
+ href='http://semperplugins.com/documentation/importer-exporter-module/'
28
+ target='_blank'
29
+ >
30
+ Click here for documentation on this setting
31
+ </a>",
32
+ 'all-in-one-seo-pack'
33
+ ),
34
+ 'export_choices' => __(
35
+ "You may choose to export settings from active modules,
36
+ and content from post data.<br />
37
+ <a
38
+ href='http://semperplugins.com/documentation/importer-exporter-module/'
39
+ target='_blank'
40
+ >
41
+ Click here for documentation on this setting
42
+ </a>",
43
+ 'all-in-one-seo-pack'
44
+ ),
45
+ 'export_post_types' => __(
46
+ "Select which Post Types you want to export your
47
+ All in One SEO Pack meta data for.<br />
48
+ <a
49
+ href='http://semperplugins.com/documentation/importer-exporter-module/'
50
+ target='_blank'
51
+ >
52
+ Click here for documentation on this setting
53
+ </a>",
54
+ 'all-in-one-seo-pack'
55
+ )
56
  );
57
+ $this->warnings = Array();
58
  $this->default_options = array(
59
+ 'import_submit' => Array(
60
+ 'name' => __( 'Import', 'all-in-one-seo-pack' ),
61
+ 'default' => '',
62
+ 'type' => 'file',
63
+ 'save' => false
64
+ ),
65
+ 'export_choices' => Array(
66
+ 'name' => __( 'Export Settings', 'all-in-one-seo-pack' ),
67
+ 'type' => 'multicheckbox',
68
+ 'initial_options' => Array(
69
+ 1 => 'General Settings',
70
+ 2 => 'Post Data'
71
+ )
72
+ ),
73
+ 'export_post_types' => Array(
74
+ 'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ),
75
+ 'default' => Array(
76
+ 'post' => 'post',
77
+ 'page' => 'page'
78
+ ),
79
+ 'type' => 'multicheckbox',
80
+ 'initial_options' => $this->get_post_type_titles(
81
+ Array( '_builtin' => false )
82
+ )
83
+ ),
84
+ 'import_export_help' => Array(
85
+ 'type' => 'html',
86
+ 'label' => 'none',
87
+ 'default' => __(
88
+ 'Note: If General Settings is checked, the
89
+ General Settings, the Feature Manager settings,
90
+ and the following currently active modules will
91
+ have their settings data exported:',
92
+ 'all-in-one-seo-pack'
93
+ ) . '<br />'
94
+ )
95
  );
96
+ if ( ! empty( $help_text ) ) {
97
+ foreach ( $help_text as $k => $v ) {
98
+ $this->default_options[ $k ]['help_text'] = $v;
99
+ }
100
+ }
101
  $this->layout = Array(
102
  'default' => Array(
103
+ 'name' => $this->name,
104
+ 'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/',
105
+ 'options' => array_keys( $this->default_options )
106
+ )
107
  );
 
 
108
 
109
+ // load initial options / set defaults
110
  add_action( 'admin_init', Array( $this, 'debug_post_types' ), 5 );
111
  }
112
+
113
+
114
  function settings_page_init() {
115
+ add_filter(
116
+ $this->prefix . 'submit_options',
117
+ Array( $this, 'filter_submit' )
118
+ );
119
  }
120
+
121
+
122
+ /**
123
+ * @param $submit
124
+ *
125
+ * @return array
126
+ */
127
  function filter_submit( $submit ) {
128
+ $submit['Submit']['value'] = __(
129
+ 'Import',
130
+ 'all-in-one-seo-pack'
131
+ )
132
+ . ' &raquo;';
133
+
134
+ return Array(
135
+ 'export_submit' => Array(
136
+ 'type' => 'submit',
137
+ 'class' => 'button-primary',
138
+ 'value' => __( 'Export', 'all-in-one-seo-pack' ) . ' &raquo;'
139
+ )
140
+ ) + $submit;
141
  }
142
+
143
+
144
+ function debug_post_types() {
145
+ $post_types = $this->get_post_type_titles();
146
+ $rempost = array(
147
+ 'attachment' => 1,
148
+ 'revision' => 1,
149
+ 'nav_menu_item' => 1
150
+ );
151
+ $this->default_options['export_post_types']['initial_options'] = array_diff_key(
152
+ $post_types,
153
+ $rempost
154
+ );
155
  global $aioseop_modules;
156
+ if ( ! empty( $aioseop_modules ) ) {
157
  $modules = $aioseop_modules->get_loaded_module_list();
158
+ if ( ! empty( $modules ) && ! empty( $modules['feature_manager'] ) ) {
159
  unset( $modules['feature_manager'] );
160
+ }
161
+ if ( ! empty( $modules ) ) {
162
  $this->default_options['import_export_help']['default'] .= "<ul>\n";
163
+ foreach ( $modules as $m ) {
164
  $module = $aioseop_modules->return_module( $m );
165
+ $this->default_options['import_export_help']['default'] .=
166
+ "\t<li>" . $module->name . "</li>\n";
167
  }
168
+ $this->default_options['import_export_help']['default'] .= "\n</ul>\n";
169
+ } else {
170
+ $this->default_options['import_export_help']['default'] .= '<br />'
171
+ . __(
172
+ 'There are no other modules currently loaded!',
173
+ 'all-in-one-seo-pack'
174
+ );
175
+ }
176
  }
177
+ $this->default_options['import_export_help']['default'] .= '<br />'
178
+ . __(
179
+ 'You may change this by activating or deactivating
180
+ modules in the Feature Manager.',
181
+ 'all-in-one-seo-pack'
182
+ );
183
+ $this->update_options();
184
+ if ( ! empty( $_REQUEST['export_submit'] ) ) {
185
  $this->do_importer_exporter();
186
+ } else {
187
+ add_action(
188
+ $this->prefix . 'settings_update',
189
+ Array( $this, 'do_importer_exporter' )
190
+ );
191
+ }
192
  }
 
 
193
 
194
+
195
+ /**
196
+ * @param $args
197
+ *
198
+ * @return string
199
+ */
200
+ function importer_exporter_export( $args ) {
201
+
202
+ // Adds all settings to settings file
203
  $name = $this->get_option_name();
204
+ $buf = '[' . $this->get_option_name() . "]\n";
205
+ if ( ! empty( $this->options ) ) {
 
206
  foreach ( $this->options as $key => $value ) {
207
+ $buf .= "$key = '" . str_replace(
208
+ "'",
209
+ "\'",
210
+ trim( serialize( $value ) )
211
+ ) . "'\n";
212
  }
213
  }
214
+
215
  return $buf;
216
  }
217
+
218
+
219
+ function show_import_warnings() {
220
+
221
  echo '<div class="error fade" style="width:52%">';
222
+
223
+ if ( is_array( $this->warnings ) ) {
224
+ foreach ( $this->warnings as $warning ) {
225
+ echo "<p>{$warning}</p>";
226
  }
227
+ }
228
  echo '</div>';
229
  }
230
+
231
+
232
+ /**
233
+ * @param $array
234
+ *
235
+ * @return array
236
+ */
237
  function parse_ini_helper( $array ) {
238
+ $returnArray = array();
239
+ if ( is_array( $array ) ) {
240
+ foreach ( $array as $key => $value ) {
241
+ $e = explode( ':', $key );
242
+ if ( ! empty( $e[1] ) ) {
243
+ $x = array();
244
+ foreach ( $e as $tk => $tv ) {
245
+ $x[ $tk ] = trim( $tv );
246
+ }
247
+ $x = array_reverse( $x, true );
248
+ foreach ( $x as $k => $v ) {
249
+ $c = $x[0];
250
+ if ( empty( $returnArray[ $c ] ) ) {
251
+ $returnArray[ $c ] = array();
252
+ }
253
+ if ( isset( $returnArray[ $x[1] ] ) ) {
254
+ $returnArray[ $c ] = array_merge(
255
+ $returnArray[ $c ], $returnArray[ $x[1] ]
256
+ );
257
+ }
258
+ if ( $k === 0 ) {
259
+ $returnArray[ $c ] = array_merge(
260
+ $returnArray[ $c ], $array[ $key ]
261
+ );
262
+ }
263
+ }
264
+ } else {
265
+ $returnArray[ $key ] = $array[ $key ];
266
+ }
267
+ }
268
+ }
269
+
270
+ return $returnArray;
271
  }
272
+
273
+
274
+ /**
275
+ * @param $array
276
+ *
277
+ * @return array
278
+ */
279
  function recursive_parse( $array ) {
280
+ $returnArray = array();
281
+ if ( is_array( $array ) ) {
282
+ foreach ( $array as $key => $value ) {
283
+ if ( is_array( $value ) ) {
284
+ $array[ $key ] = $this->recursive_parse( $value );
285
+ }
286
+ $x = explode( '.', $key );
287
+ if ( ! empty( $x[1] ) ) {
288
+ $x = array_reverse( $x, true );
289
+ if ( isset( $returnArray[ $key ] ) ) {
290
+ unset( $returnArray[ $key ] );
291
+ }
292
+ if ( ! isset( $returnArray[ $x[0] ] ) ) {
293
+ $returnArray[ $x[0] ] = array();
294
+ }
295
+ $first = true;
296
+ foreach ( $x as $k => $v ) {
297
+ if ( $first === true ) {
298
+ $b = $array[ $key ];
299
+ $first = false;
300
+ }
301
+ $b = array( $v => $b );
302
+ }
303
+ $returnArray[ $x[0] ] = array_merge_recursive(
304
+ $returnArray[ $x[0] ], $b[ $x[0] ]
305
+ );
306
+ } else {
307
+ $returnArray[ $key ] = $array[ $key ];
308
+ }
309
+ }
310
+ }
311
+
312
+ return $returnArray;
313
  }
314
+
315
+
316
+ /**
317
+ * @param $assoc_arr
318
+ * @param bool $has_sections
319
+ *
320
+ * @return string
321
+ */
322
+ function get_ini_file( $assoc_arr, $has_sections = true ) {
323
+ $content = '';
324
+ if ( $has_sections ) {
325
+ foreach ( $assoc_arr as $key => $elem ) {
326
+ $content .= '[' . $key . "]\n";
327
+ foreach ( $elem as $key2 => $elem2 ) {
328
+ if ( is_array( $elem2 ) ) {
329
+ for ( $i = 0; $i < count( $elem2 ); $i ++ ) {
330
+ $content .= $key2 . "[] = \"" . $elem2[ $i ] . "\"\n";
331
+ }
332
+ } else if ( $elem2 == '' ) {
333
+ $content .= $key2 . " = \n";
334
+ } else {
335
+ $content .= $key2 . " = \"" . $elem2 . "\"\n";
336
+ }
337
+ }
338
+ }
339
+ } else {
340
+ foreach ( $assoc_arr as $key => $elem ) {
341
+ if ( is_array( $elem ) ) {
342
+ for ( $i = 0; $i < count( $elem ); $i ++ ) {
343
+ $content .= $key2 . "[] = \"" . $elem[ $i ] . "\"\n";
344
+ }
345
+ } else if ( $elem == '' ) {
346
+ $content .= $key2 . " = \n";
347
+ } else {
348
+ $content .= $key2 . " = \"" . $elem . "\"\n";
349
+ }
350
+ }
351
+ }
352
+
353
+ return $content;
354
  }
355
+
356
+
357
+ /**
358
+ * @param $string
359
+ *
360
+ * @return array
361
+ */
362
  function parse_ini_advanced( $string ) {
363
+ return $this->recursive_parse(
364
+ $this->parse_ini_helper(
365
+ parse_ini_string( $string, true )
366
+ )
367
+ );
368
  }
369
+
370
+
371
+ function do_importer_exporter() {
372
+ $submit = null;
373
+ $count = 0;
374
+ $post_exists = null;
375
+ $post_warning = null;
376
  global $aioseop_options, $aiosp, $aioseop_module_list;
377
+ if ( isset( $_REQUEST['nonce-aioseop'] ) ) {
378
+ $nonce = $_REQUEST['nonce-aioseop'];
379
+ }
380
+ $post_fields = Array(
381
+ 'keywords',
382
+ 'description',
383
+ 'title',
384
+ 'meta',
385
+ 'disable',
386
+ 'disable',
387
+ 'disable_analytics',
388
+ 'titleatr',
389
+ 'menulabel',
390
+ 'togglekeywords'
391
+ );
392
+ if ( ! empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) {
393
+ $submit = 'Import';
394
+ }
395
+ if ( ! empty( $_REQUEST['export_submit'] ) ) {
396
+ $submit = 'Export';
397
+ }
398
+ if ( ( $submit != null ) && wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) {
399
  switch ( $submit ) {
400
  case 'Import':
401
+ try {
402
+ // Parses export file
403
+ $file = $this->get_sanitized_file(
404
+ $_FILES['aiosp_importer_exporter_import_submit']['tmp_name']
405
+ );
406
+ $section = Array();
407
+ $section_label = null;
408
+ foreach ( $file as $line_number => $line ) {
409
+ $line = trim( $line );
410
  $matches = Array();
411
+ if ( empty( $line ) ) {
412
+ continue;
413
+ }
414
+ if ( $line[0] == ';' ) {
415
+ continue;
416
+ }
417
+ if ( preg_match( "/^\[(\S+)\]$/", $line, $label ) ) {
418
  $section_label = strval( $label[1] );
419
+ if ( $section_label == 'post_data' ) {
420
+ $count ++;
421
+ }
422
+ if ( ! isset( $section[ $section_label ] ) ) {
423
  $section[ $section_label ] = Array();
424
+ }
425
  } elseif ( preg_match( "/^(\S+)\s*=\s*'(.*)'$/", $line, $matches ) ) {
426
+ if ( $section_label == 'post_data' ) {
427
+ $section[ $section_label ][ $count ][ $matches[1] ] = $matches[2];
428
+ } else {
429
+ $section[ $section_label ][ $matches[1] ] = $matches[2];
430
+ }
431
  } elseif ( preg_match( "/^(\S+)\s*=\s*NULL$/", $line, $matches ) ) {
432
+ if ( $section_label == 'post_data' ) {
433
+ $section[ $section_label ][ $count ][ $matches[1] ] = null;
434
+ } else {
435
+ $section[ $section_label ][ $matches[1] ] = null;
436
+ }
437
  } else {
438
+ $this->warnings[] = sprintf(
439
+ __(
440
+ '<b>
441
+ Warning:
442
+ </b>
443
+ Line not matched:
444
+ <b>
445
+ "%s"
446
+ </b>
447
+ , On Line:
448
+ <b>
449
+ %s
450
+ </b>',
451
+ 'all-in-one-seo-pack'
452
+ ),
453
+ $line,
454
+ $line_number
455
+ );
456
  }
457
+ }
458
+
459
+ // Updates Plugin Settings
460
+ if ( is_array( $section ) ) {
461
+ foreach ( $section as $label => $module_options ) {
462
+ if ( is_array( $module_options ) ) {
463
+ foreach ( $module_options as $key => $value ) {
464
+
465
+ // Updates Post Data
466
+ if ( $label == 'post_data' ) {
467
+ $post_exists = post_exists(
468
+ $module_options[ $key ]['post_title'],
469
+ '',
470
+ $module_options[ $key ]['post_date']
471
+ );
472
+ $target = get_post( $post_exists );
473
+ if ( ( ! empty( $module_options[ $key ]['post_type'] ) )
474
+ && $post_exists != null
475
+ ) {
476
+ if ( is_array( $value ) ) {
477
+ foreach ( $value as $field_name => $field_value ) {
478
+ if ( substr( $field_name, 1, 7 ) == 'aioseop' ) {
479
+ if ( $value ) {
480
+ update_post_meta(
481
+ $target->ID,
482
+ $field_name,
483
+ maybe_unserialize( $field_value )
484
+ );
485
+ } else {
486
+ delete_post_meta(
487
+ $target->ID,
488
+ $field_name
489
+ );
490
+ }
491
+ }
492
+ }
493
+ }
494
+ $post_exists = null;
495
+ } else {
496
+ $target_title = $module_options[ $key ]['post_title'];
497
+ $post_warning = sprintf(
498
+ __(
499
+ '<b>
500
+ Warning:
501
+ </b>
502
+ This following post could not be found:
503
+ <b>
504
+ "%s"
505
+ </b>',
506
+ 'all-in-one-seo-pack'
507
+ ),
508
+ $target_title
509
+ );
510
+ }
511
+ if ( $post_warning != null ) {
512
+ $this->warnings[] = $post_warning;
513
+ $post_warning = null;
514
+ }
515
+
516
+ // Updates Module Settings
517
  } else {
518
+ $module_options[ $key ] = str_replace(
519
+ Array( "\'", '\n', '\r' ),
520
+ Array( "'", "\n", "\r" ),
521
+ maybe_unserialize( $value )
522
+ );
 
523
  }
524
+ }
525
+
526
+ // Updates Module Settings
527
+ $this->update_class_option(
528
+ $module_options,
529
+ $label
530
+ );
531
  }
 
 
532
  }
533
  }
534
+ } catch ( Exception $e ) {
535
+ $this->warnings[] = $e->getMessage();
 
 
 
 
 
536
  }
537
+
538
+ // Shows all errors found
539
+ if ( ! empty( $this->warnings ) ) {
540
+ add_action(
541
+ $this->prefix . 'settings_header',
542
+ Array( $this, 'show_import_warnings' ),
543
+ 5
544
+ );
545
+ }
546
+
547
+ break;
548
+ case 'Export':
549
+
550
+ // Creates Files Contents
551
+ $settings_file = 'settings_aioseop.ini';
552
+ $buf = '; ' . __(
553
+ 'Settings export file for All in One SEO Pack', '
554
+ all-in-one-seo-pack'
555
+ ) . "\n";
556
+
557
+ // Adds all settings to settings file
558
  $buf = $aiosp->settings_export( $buf );
559
  $buf = apply_filters( 'aioseop_export_settings', $buf );
560
+
561
+ // Sends File to browser
562
+ $strlength = strlen( $buf );
563
+ header( 'Content-type: application/ini' );
564
+ header(
565
+ "Content-Disposition:
566
+ attachment; filename=$settings_file"
567
+ );
568
+ header( 'Content-Length: ' . $strlength );
569
  echo $buf;
570
  die();
571
+ break;
572
  }
573
+ }
574
+ }
575
+
576
+
577
+ function settings_update() {
578
  }
579
+
580
+ /**
581
+ * Returns sanitized imported file.
582
+ *
583
+ * @since
584
+ *
585
+ * @param string $filename Path to where the uploaded file is located.
586
+ *
587
+ * @return array Sanitized file as array.
588
+ * @throws Exception
589
+ */
590
+ private function get_sanitized_file( $filename ) {
591
+ $file = file( $filename );
592
+ for ( $i = count( $file ) - 1; $i >= 0; -- $i ) {
593
+ // Remove insecured lines
594
+ if ( preg_match( '/\<(\?php|script)/', $file[ $i ] ) ) {
595
+ throw new Exception( __(
596
+ '<b>Security warning:</b> Your file looks compromised. Please check the file for any script-injection.',
597
+ 'all-in-one-seo-pack'
598
+ ) );
599
+ }
600
+ // Apply security filters
601
+ $file[ $i ] = strip_tags( trim( $file[ $i ] ) );
602
+ // Remove empty lines
603
+ if ( empty( $file[ $i ] ) ) {
604
+ unset( $file[ $i ] );
605
+ }
606
+ }
607
+
608
+ return $file;
609
  }
610
  }
611
  }
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
@@ -790,41 +1141,45 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
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
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
@@ -5,102 +5,126 @@
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();
@@ -108,55 +132,95 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
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();
@@ -167,58 +231,60 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
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 +292,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
- }
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(
27
+ 'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ),
28
+ 'default' => '256M',
29
+ 'type' => 'select',
30
+ 'initial_options' => Array(
31
+ 0 => __( "Use the system default", 'all-in-one-seo-pack' ),
32
+ '32M' => '32MB',
33
+ '64M' => '64MB',
34
+ '128M' => '128MB',
35
+ '256M' => '256MB'
36
+ )
37
+ ),
38
+ 'execution_time' => Array(
39
+ 'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ),
40
+ 'default' => '',
41
+ 'type' => 'select',
42
+ 'initial_options' => Array( '' => __( "Use the system default", 'all-in-one-seo-pack' ),
43
+ 30 => '30s',
44
+ 60 => '1m',
45
+ 120 => '2m',
46
+ 300 => '5m',
47
+ 0 => __( 'No limit', 'all-in-one-seo-pack' )
48
+ )
49
+ )
50
+ );
51
 
52
  $this->help_anchors = Array(
53
  'memory_limit' => '#raise-memory-limit',
54
  'execution_time' => '#raise-execution-time',
55
  'force_rewrites' => '#force-rewrites'
56
  );
57
+
58
  global $aiosp, $aioseop_options;
59
  if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) && $aioseop_options['aiosp_rewrite_titles'] ) {
60
+ $this->default_options['force_rewrites'] = Array(
61
+ 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
62
+ 'default' => 1,
63
+ 'type' => 'radio',
64
+ 'initial_options' => Array(
65
+ 1 => __( 'Enabled', 'all-in-one-seo-pack' ),
66
+ 0 => __( 'Disabled', 'all-in-one-seo-pack' )
67
+ )
68
+ );
69
  }
70
+
71
  $this->layout = Array(
72
  'default' => Array(
73
+ 'name' => $this->name,
74
+ 'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
75
+ 'options' => array_keys( $this->default_options )
76
+ )
77
  );
78
+
79
  $system_status = Array(
80
+ 'status' => Array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
81
  );
82
+
83
  $this->layout['system_status'] = Array(
84
+ 'name' => __( 'System Status', 'all-in-one-seo-pack' ),
85
+ 'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
86
+ 'options' => array_keys( $system_status )
87
+ );
88
+
89
  $this->default_options = array_merge( $this->default_options, $system_status );
90
+
91
  $this->add_help_text_links();
92
+
93
  add_filter( $this->prefix . 'display_options', Array( $this, 'display_options_filter' ), 10, 2 );
94
  add_filter( $this->prefix . 'update_options', Array( $this, 'update_options_filter' ), 10, 2 );
95
  add_action( $this->prefix . 'settings_update', Array( $this, 'settings_update_action' ), 10, 2 );
96
  }
97
+
98
  function update_options_filter( $options, $location ) {
99
  if ( $location == null ) {
100
+ if ( isset( $options[ $this->prefix . 'force_rewrites' ] ) ) {
101
  unset( $options[ $this->prefix . 'force_rewrites' ] );
102
+ }
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 ) {
123
  if ( isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) {
124
  $force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ];
125
  if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) {
126
  global $aiosp;
127
+ $opts = $aiosp->get_current_options( Array(), null );
128
  $opts['aiosp_force_rewrites'] = $force_rewrites;
129
  $aiosp->update_class_option( $opts );
130
  wp_cache_flush();
132
  }
133
  }
134
  }
135
+
136
  function add_page_hooks() {
137
  $memory_usage = memory_get_peak_usage() / 1024 / 1024;
138
  if ( $memory_usage > 32 ) {
139
  unset( $this->default_options['memory_limit']['initial_options']['32M'] );
140
+ if ( $memory_usage > 64 ) {
141
+ unset( $this->default_options['memory_limit']['initial_options']['64M'] );
142
+ }
143
+ if ( $memory_usage > 128 ) {
144
+ unset( $this->default_options['memory_limit']['initial_options']['128M'] );
145
+ }
146
+ if ( $memory_usage > 256 ) {
147
+ unset( $this->default_options['memory_limit']['initial_options']['256M'] );
148
+ }
149
  }
150
  $this->update_options();
151
  parent::add_page_hooks();
152
  }
153
+
154
  function settings_page_init() {
155
  $this->default_options['status']['default'] = $this->get_serverinfo();
156
  }
157
+
158
  function menu_order() {
159
  return 7;
160
  }
161
+
162
  function get_serverinfo() {
163
+ global $wpdb;
164
  global $wp_version;
165
 
166
+ $sqlversion = $wpdb->get_var( "SELECT VERSION() AS version" );
167
+ $mysqlinfo = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
168
+ if ( is_array( $mysqlinfo ) ) {
169
+ $sql_mode = $mysqlinfo[0]->Value;
170
+ }
171
+ if ( empty( $sql_mode ) ) {
172
+ $sql_mode = __( 'Not set', 'all-in-one-seo-pack' );
173
+ }
174
+ if ( ini_get( 'safe_mode' ) ) {
175
+ $safe_mode = __( 'On', 'all-in-one-seo-pack' );
176
+ } else {
177
+ $safe_mode = __( 'Off', 'all-in-one-seo-pack' );
178
+ }
179
+ if ( ini_get( 'allow_url_fopen' ) ) {
180
+ $allow_url_fopen = __( 'On', 'all-in-one-seo-pack' );
181
+ } else {
182
+ $allow_url_fopen = __( 'Off', 'all-in-one-seo-pack' );
183
+ }
184
+ if ( ini_get( 'upload_max_filesize' ) ) {
185
+ $upload_max = ini_get( 'upload_max_filesize' );
186
+ } else {
187
+ $upload_max = __( 'N/A', 'all-in-one-seo-pack' );
188
+ }
189
+ if ( ini_get( 'post_max_size' ) ) {
190
+ $post_max = ini_get( 'post_max_size' );
191
+ } else {
192
+ $post_max = __( 'N/A', 'all-in-one-seo-pack' );
193
+ }
194
+ if ( ini_get( 'max_execution_time' ) ) {
195
+ $max_execute = ini_get( 'max_execution_time' );
196
+ } else {
197
+ $max_execute = __( 'N/A', 'all-in-one-seo-pack' );
198
+ }
199
+ if ( ini_get( 'memory_limit' ) ) {
200
+ $memory_limit = ini_get( 'memory_limit' );
201
+ } else {
202
+ $memory_limit = __( 'N/A', 'all-in-one-seo-pack' );
203
+ }
204
+ if ( function_exists( 'memory_get_usage' ) ) {
205
+ $memory_usage = round( memory_get_usage() / 1024 / 1024, 2 ) . __( ' MByte', 'all-in-one-seo-pack' );
206
+ } else {
207
+ $memory_usage = __( 'N/A', 'all-in-one-seo-pack' );
208
+ }
209
+ if ( is_callable( 'exif_read_data' ) ) {
210
+ $exif = __( 'Yes', 'all-in-one-seo-pack' ) . " ( V" . $this->substr( phpversion( 'exif' ), 0, 4 ) . ")";
211
+ } else {
212
+ $exif = __( 'No', 'all-in-one-seo-pack' );
213
+ }
214
+ if ( is_callable( 'iptcparse' ) ) {
215
+ $iptc = __( 'Yes', 'all-in-one-seo-pack' );
216
+ } else {
217
+ $iptc = __( 'No', 'all-in-one-seo-pack' );
218
+ }
219
+ if ( is_callable( 'xml_parser_create' ) ) {
220
+ $xml = __( 'Yes', 'all-in-one-seo-pack' );
221
+ } else {
222
+ $xml = __( 'No', 'all-in-one-seo-pack' );
223
+ }
224
 
225
  if ( function_exists( 'wp_get_theme' ) ) {
226
  $theme = wp_get_theme();
231
 
232
  if ( function_exists( 'is_multisite' ) ) {
233
  if ( is_multisite() ) {
234
+ $ms = __( 'Yes', 'all-in-one-seo-pack' );
235
  } else {
236
+ $ms = __( 'No', 'all-in-one-seo-pack' );
237
  }
238
 
239
+ } else {
240
+ $ms = __( 'N/A', 'all-in-one-seo-pack' );
241
+ }
242
+
243
+ $siteurl = get_option( 'siteurl' );
244
+ $homeurl = get_option( 'home' );
245
+ $db_version = get_option( 'db_version' );
246
+
247
+ $debug_info = Array(
248
+ __( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
249
+ __( 'Server', 'all-in-one-seo-pack' ) => $_SERVER["SERVER_SOFTWARE"],
250
+ __( 'Memory usage', 'all-in-one-seo-pack' ) => $memory_usage,
251
+ __( 'MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion,
252
+ __( 'SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode,
253
+ __( 'PHP Version', 'all-in-one-seo-pack' ) => PHP_VERSION,
254
+ __( 'PHP Safe Mode', 'all-in-one-seo-pack' ) => $safe_mode,
255
+ __( 'PHP Allow URL fopen', 'all-in-one-seo-pack' ) => $allow_url_fopen,
256
+ __( 'PHP Memory Limit', 'all-in-one-seo-pack' ) => $memory_limit,
257
+ __( 'PHP Max Upload Size', 'all-in-one-seo-pack' ) => $upload_max,
258
+ __( 'PHP Max Post Size', 'all-in-one-seo-pack' ) => $post_max,
259
+ __( 'PHP Max Script Execute Time', 'all-in-one-seo-pack' ) => $max_execute,
260
+ __( 'PHP Exif support', 'all-in-one-seo-pack' ) => $exif,
261
+ __( 'PHP IPTC support', 'all-in-one-seo-pack' ) => $iptc,
262
+ __( 'PHP XML support', 'all-in-one-seo-pack' ) => $xml,
263
+ __( 'Site URL', 'all-in-one-seo-pack' ) => $siteurl,
264
+ __( 'Home URL', 'all-in-one-seo-pack' ) => $homeurl,
265
+ __( 'WordPress Version', 'all-in-one-seo-pack' ) => $wp_version,
266
+ __( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
267
+ __( 'Multisite', 'all-in-one-seo-pack' ) => $ms,
268
+ __( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version']
269
  );
270
  $debug_info['Active Plugins'] = null;
271
+ $active_plugins = $inactive_plugins = Array();
272
+ $plugins = get_plugins();
273
+ foreach ( $plugins as $path => $plugin ) {
274
  if ( is_plugin_active( $path ) ) {
275
+ $debug_info[ $plugin['Name'] ] = $plugin['Version'];
276
  } else {
277
+ $inactive_plugins[ $plugin['Name'] ] = $plugin['Version'];
278
  }
279
  }
280
  $debug_info['Inactive Plugins'] = null;
281
+ $debug_info = array_merge( $debug_info, (array) $inactive_plugins );
282
 
283
  $mail_text = __( "All in One SEO Pack Pro Debug Info", 'all-in-one-seo-pack' ) . "\r\n------------------\r\n\r\n";
284
  $page_text = "";
285
+ if ( ! empty( $debug_info ) ) {
286
+ foreach ( $debug_info as $name => $value ) {
287
+ if ( $value !== null ) {
288
  $page_text .= "<li><strong>$name</strong> $value</li>";
289
  $mail_text .= "$name: $value\r\n";
290
  } else {
292
  $mail_text .= "\r\n$name\r\n----------\r\n";
293
  }
294
  }
295
+ }
296
 
297
+ do {
298
+ if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) || ! empty( $_REQUEST['sfwd_update_check'] ) ) {
299
+ $nonce = $_REQUEST['sfwd_debug_nonce'];
300
+ if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) {
301
+ echo "<div class='sfwd_debug_error'>" . __( "Form submission error: verification check failed.", 'all-in-one-seo-pack' ) . "</div>";
302
+ break;
303
+ }
304
+ if ( ! empty( $_REQUEST['sfwd_update_check'] ) && $_REQUEST['sfwd_update_check'] ) {
305
+ global $aioseop_update_checker;
306
+ $aioseop_update_checker->checkForUpdates();
307
+ echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( "%s has checked for updates.", 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ) . "</div>";
308
+ break;
309
+ }
310
+ $email = '';
311
+ if ( ! empty( $_REQUEST['sfwd_debug_send_email'] ) ) {
312
+ $email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] );
313
+ }
314
+ if ( $email ) {
315
+ if ( wp_mail( $email, sprintf( __( "SFWD Debug Mail From Site %s.", 'all-in-one-seo-pack' ), $siteurl ), $mail_text ) ) {
316
+ echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( "Sent to %s.", 'all-in-one-seo-pack' ), $email ) . "</div>";
317
+ } else {
318
+ echo "<div class='sfwd_debug_error'>" . sprintf( __( "Failed to send to %s.", 'all-in-one-seo-pack' ), $email ) . "</div>";
319
+ }
320
  } else {
321
+ echo "<div class='sfwd_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . "</div>";
322
  }
 
 
323
  }
324
+ } while ( 0 ); // control structure for use with break
325
+ $nonce = wp_create_nonce( 'sfwd-debug-nonce' );
326
+ $buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n<p>\n" .
327
+ '<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="' .
328
+ $nonce . '"><input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
329
+
330
+ if ( AIOSEOPPRO ) {
331
+ $buf .= '<p><input name="sfwd_update_check" type="submit" value="' . __( 'Check For Updates', 'all-in-one-seo-pack' ) . '" class="button-primary">';
332
+ }
333
+
334
  return $buf;
335
  }
336
  }
337
+ }
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,123 @@ 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 +292,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 +303,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 +325,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
  function filter_options( $options, $location ) {
199
+ if ( $location ) {
200
+ $prefix = $this->get_prefix( $location ) . $location . '_';
201
+ }
202
  if ( $location === 'generator' ) {
203
+ $optimize = false;
204
+ $robotgen = '';
205
+ if ( ! empty( $_POST[ $prefix . 'robotgen' ] ) ) {
206
+ $robotgen = str_replace( "\r\n", "\n", $_POST[ $prefix . 'robotgen' ] );
207
+ }
208
+ if ( isset( $_POST['Submit_Preview'] ) ) {
209
+ $options[ $prefix . 'robotgen' ] = $robotgen;
210
+ }
211
+ if ( ! isset( $_POST['Submit_Preview'] ) ) {
212
+ if ( isset( $_POST['Submit_Optimize'] ) && ! isset( $_POST['Submit_Delete'] ) && ! isset( $_POST['Submit_Update'] ) && ! isset( $_POST['Submit_Opt_Update'] ) ) {
213
+ $optimize = true;
214
+ }
215
+ if ( ! isset( $options[ $prefix . 'robotgen' ] ) || empty( $options[ $prefix . 'robotgen' ] ) ) {
216
+ if ( $optimize ) {
217
+ $options[ $prefix . 'robotgen' ] = $robotgen;
218
+ }
219
+ if ( empty( $options[ $prefix . 'robotgen' ] ) ) {
220
+ $options = $this->load_files( $options, Array( 'robotgen' => 'robots.txt' ), $prefix );
221
  }
222
  }
223
+ }
224
+ $access = ( get_option( 'blog_public' ) ) ? 'allow' : 'block';
225
+ if ( $access ) {
226
+ $allow_rule = "Sitemap: \n\n# global\nUser-agent: *\nDisallow: /xmlrpc.php\n\n";
227
+ $block_rule = "# global\nUser-agent: *\nDisallow: /\n\n";
228
+ if ( empty( $options[ $prefix . 'robotgen' ] ) ) {
229
+ $options[ $prefix . 'robotgen' ] = '';
 
 
 
 
 
230
  }
231
+ if ( isset( $_POST['Submit_Preview'] ) && ( ( $options[ $prefix . 'robotgen' ] == $allow_rule ) ||
232
+ ( $options[ $prefix . 'robotgen' ] == $block_rule ) )
233
+ ) {
234
+ $options[ $prefix . 'robotgen' ] = '';
 
 
 
 
235
  }
236
+ if ( $access === 'block' && empty( $options[ $prefix . 'robotgen' ] ) ) {
237
+ $options[ $prefix . 'robotgen' ] .= $block_rule;
238
+ } elseif ( $access === 'allow' && empty( $options[ $prefix . 'robotgen' ] ) ) {
239
+ $options[ $prefix . 'robotgen' ] .= $allow_rule;
240
+ }
241
+ }
242
+ foreach ( Array( 'ad' => 'additional', 'ua' => 'useragent', 'dp' => 'path' ) as $k => $v ) {
243
+ if ( isset( $_POST[ $prefix . $v ] ) ) {
244
+ $$k = $_POST[ $prefix . $v ];
245
+ }
246
+ }
247
+ if ( ! empty( $ad ) && ! empty( $ua ) && ! empty( $dp ) ) {
248
+ if ( $ad === 'allow' ) {
249
+ $ad = "Allow: ";
 
 
 
250
  } else {
251
+ $ad = "Disallow: ";
252
+ }
253
+ $options[ $prefix . 'robotgen' ] .= "User-agent: $ua\n$ad $dp\n\n";
254
+ }
255
+ $file = explode( "\n", $options[ $prefix . 'robotgen' ] );
256
+ if ( $optimize ) {
257
+ $rules = $this->parse_robots( $file );
258
+ $user_agents = $this->get_robot_user_agents( $rules );
259
+ foreach ( $user_agents as $ua => $rules ) {
260
+ $user_agents[ $ua ]['disallow'] = $this->opt_robot_rule( $rules['disallow'] );
261
+ $user_agents[ $ua ]['allow'] = $this->opt_robot_rule( $rules['allow'] );
262
+ }
263
+ $rules = $this->flatten_user_agents( $user_agents );
264
+ unset( $user_agents );
265
+ foreach ( $rules as $r ) {
266
+ $r['disallow'] = $this->opt_robot_rule( $r['disallow'] );
267
+ $r['allow'] = $this->opt_robot_rule( $r['allow'] );
268
  }
269
+ $options[ $prefix . 'robotgen' ] = $this->output_robots( $rules );
270
+ $file2 = explode( "\n", $options[ $prefix . 'robotgen' ] );
271
+ $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>';
272
+ } else {
273
+ $options[ $prefix . 'robothtml' ] = $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) );
274
+ }
275
  }
276
+
277
  return $options;
278
  }
279
 
280
  function do_robots( $options, $location ) {
281
+ if ( $location ) {
282
+ $prefix = $this->get_prefix( $location ) . $location . '_';
283
+ }
284
  if ( $location === 'generator' ) {
285
  if ( isset( $_POST['Submit_Update'] ) || isset( $_POST['Submit_Opt_Update'] ) ) {
286
  $this->save_files( Array( 'robotgen' => 'robots.txt' ), $prefix );
287
+ } elseif ( isset( $_POST['Submit_Delete'] ) ) {
288
  $this->delete_files( Array( 'robotgen' => 'robots.txt' ) );
289
  }
290
  }
292
 
293
  function annotate_robots_html( $file, $show_help = false, $title = '' ) {
294
  $robots = $this->annotate_robots( $file );
295
+ if ( ! empty( $robots ) ) {
296
  $buf = '<table class="widefat" ><thead>';
297
+ if ( ! empty( $title ) ) {
298
  $buf .= "<tr><th colspan=3>" . $title . "</th></tr>";
299
  }
300
  $buf .= '<tr class="aioseop_optimize_thread">';
303
  $buf .= "<tbody>";
304
 
305
  foreach ( $robots as $r ) {
306
+ $class = 'robots';
307
  $status = "#9cf975";
308
+ $help = '';
309
+ if ( ! $r['valid'] || ! $r['strict'] ) {
310
+ if ( ! $r['strict'] ) {
311
  $class .= ' quirks';
312
+ $status = "yellow";
313
  }
314
+ if ( ! $r['valid'] ) {
315
  $class .= ' invalid';
316
+ $status = "#f9534a";
317
  }
318
  if ( $show_help ) {
319
  $help = '<a style="cursor:pointer;" class="' . $class . '" title="Click for Help!" onclick="toggleVisibility(\'aiosp_robots_main_legend_tip\');" title="Click for Help">'
320
+ . '<div class="aioseop_tip_icon"></div></a>';
321
  }
322
  }
323
  $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>";
325
  $buf .= '</tbody>';
326
 
327
  $buf .= '</table>';
328
+ if ( $show_help ) {
329
  $buf .= '<div class="aioseop_option_docs" id="aiosp_robots_main_legend_tip">
330
  <h3>' . __( 'Legend', 'all-in-one-seo-pack' ) . '</h3>
331
  <ul>
332
  <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>
333
+ <li>' . __( 'The red indicator means that the syntax is invalid for a robots.txt file.', 'all-in-one-seo-pack' ) . '</li>
334
  </ul>
335
+ <a target="_blank" rel="nofollow" href="http://wikipedia.org/wiki/Robots_exclusion_standard#Nonstandard_extensions">' . __( 'More Information', 'all-in-one-seo-pack' ) . '</a>
336
  </div>';
337
  }
338
  } else {
339
  $buf = '<p class="aioseop_error_notice" ><strong>Your Robots.txt file is either empty, cannot be found, or has invalid data.</strong></p>';
340
  }
341
+
342
  return $buf;
343
  }
344
 
345
  function annotate_robots( $robots ) {
346
+ $state = 0;
347
+ $rules = Array();
348
+ foreach ( $robots as $l ) {
349
+ $l = trim( $l );
350
+ if ( empty( $l[0] ) ) {
351
+ if ( $state > 1 ) {
352
+ $rules[] = Array(
353
+ 'state' => 0,
354
+ 'type' => 'blank',
355
+ 'content' => $l,
356
+ 'valid' => true,
357
+ 'strict' => true
358
+ );
359
+ $state = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  }
361
+ } elseif ( $l[0] === '#' ) {
362
+ if ( $state < 1 ) {
363
+ $state = 1;
364
+ }
365
+ $rules[] = Array(
366
+ 'state' => $state,
367
+ 'type' => 'comment',
368
+ 'content' => $l,
369
+ 'valid' => true,
370
+ 'strict' => true
371
+ );
372
+ } elseif ( stripos( $l, 'sitemap' ) === 0 ) {
373
+ $state = 2;
374
+ $rules[] = Array(
375
+ 'state' => $state,
376
+ 'type' => 'sitemap',
377
+ 'content' => $l,
378
+ 'valid' => true,
379
+ 'strict' => false
380
+ );
381
+ } elseif ( stripos( $l, 'crawl-delay' ) === 0 ) {
382
+ $state = 3;
383
+ $rules[] = Array(
384
+ 'state' => $state,
385
+ 'type' => 'crawl-delay',
386
+ 'content' => $l,
387
+ 'valid' => true,
388
+ 'strict' => false
389
+ );
390
+ } elseif ( stripos( $l, 'user-agent' ) === 0 ) {
391
+ $state = 3;
392
+ $rules[] = Array(
393
+ 'state' => $state,
394
+ 'type' => 'user-agent',
395
+ 'content' => $l,
396
+ 'valid' => true,
397
+ 'strict' => true
398
+ );
399
+ } elseif ( stripos( $l, 'useragent' ) === 0 ) {
400
+ $state = 3;
401
+ $rules[] = Array(
402
+ 'state' => $state,
403
+ 'type' => 'user-agent',
404
+ 'content' => $l,
405
+ 'valid' => true,
406
+ 'strict' => false
407
+ );
408
+ } elseif ( stripos( $l, 'disallow' ) === 0 ) {
409
+ if ( $state < 3 ) {
410
+ $rules[] = Array(
411
+ 'state' => $state,
412
+ 'type' => 'disallow',
413
+ 'content' => $l,
414
+ 'valid' => false,
415
+ 'strict' => false
416
+ );
417
+ continue;
418
+ }
419
+ $state = 3;
420
+ $rules[] = Array(
421
+ 'state' => $state,
422
+ 'type' => 'disallow',
423
+ 'content' => $l,
424
+ 'valid' => true,
425
+ 'strict' => true
426
+ );
427
+ } elseif ( stripos( $l, 'allow' ) === 0 ) {
428
+ if ( $state < 3 ) {
429
+ $rules[] = Array(
430
+ 'state' => $state,
431
+ 'type' => 'allow',
432
+ 'content' => $l,
433
+ 'valid' => false,
434
+ 'strict' => false
435
+ );
436
+ continue;
437
+ }
438
+ $state = 3;
439
+ $rules[] = Array(
440
+ 'state' => $state,
441
+ 'type' => 'allow',
442
+ 'content' => $l,
443
+ 'valid' => true,
444
+ 'strict' => false
445
+ );
446
+ } else {
447
+ $rules[] = Array(
448
+ 'state' => $state,
449
+ 'type' => 'unknown',
450
+ 'content' => $l,
451
+ 'valid' => false,
452
+ 'strict' => false
453
+ );
454
  }
455
+ }
456
+
457
+ return $rules;
458
  }
459
 
460
  function parse_annotated_robots( $robots ) {
461
+ $state = 0;
462
+ $rules = Array();
463
+ $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
464
+ $rule = Array();
465
+ foreach ( $opts as $o ) {
466
+ $rule[ $o ] = Array();
467
+ }
468
+ $blank_rule = $rule;
469
+ foreach ( $robots as $l ) {
470
+ switch ( $l['type'] ) {
471
+ case 'blank':
472
+ if ( $state >= 1 ) {
473
+ if ( ( $state === 1 ) && ( empty( $rule['user-agent'] ) ) ) {
474
+ $rule['user-agent'] = Array( null );
475
  }
476
+ $rules[] = $rule;
477
+ $rule = $blank_rule;
478
+ }
479
+ continue;
480
+ case 'comment':
481
+ $rule['comment'][] = $l['content'];
482
+ continue;
483
+ case 'sitemap':
484
+ $rule['sitemap'][] = trim( substr( $l['content'], 8 ) );
485
+ break;
486
+ case 'crawl-delay':
487
+ $rule['crawl-delay'][] = trim( substr( $l['content'], 12 ) );
488
+ break;
489
+ case 'user-agent':
490
+ if ( $l['strict'] ) {
491
+ $ua = trim( substr( $l['content'], 11 ) );
492
+ } else {
493
+ $ua = trim( substr( $l['content'], 10 ) );
494
+ }
495
+ $rule['user-agent'][] = $ua;
496
+ break;
497
+ case 'disallow':
498
+ if ( $l['valid'] ) {
499
+ $rule['disallow'][] = trim( substr( $l['content'], 9 ) );
500
  break;
501
+ }
502
+ continue;
503
+ case 'allow':
504
+ if ( $l['valid'] ) {
505
+ $rule['allow'][] = trim( substr( $l['content'], 6 ) );
 
506
  break;
507
+ }
508
+ continue;
509
+ case 'unknown':
510
+ default:
 
 
 
 
 
 
 
 
 
 
 
 
511
  }
512
+ $state = $l['state'];
513
+ }
514
+ if ( ( $state === 1 ) && ( empty( $rule['user-agent'] ) ) ) {
515
+ $rule['user-agent'] = Array( null );
516
+ }
517
+ if ( $state >= 1 ) {
518
+ $rules[] = $rule;
519
+ }
520
+
521
+ return $rules;
522
  }
523
+
524
  function parse_robots( $robots ) {
525
+ return $this->parse_annotated_robots( $this->annotate_robots( $robots ) );
526
  }
527
 
528
+ function get_robot_user_agents( $rules ) {
529
+ $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
530
  $user_agents = Array();
531
+ foreach ( $rules as $r ) {
532
+ if ( ! empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) {
533
+ $r['user-agent'] = Array( null );
534
+ }
535
+ foreach ( $r['user-agent'] as $ua ) {
536
+ if ( ! isset( $user_agents[ $ua ] ) ) {
537
+ $user_agents[ $ua ] = Array();
538
+ }
539
  foreach ( $opts as $o ) {
540
+ if ( ! isset( $user_agents[ $ua ][ $o ] ) ) {
541
+ $user_agents[ $ua ][ $o ] = $r[ $o ];
542
+ } else {
543
+ $user_agents[ $ua ][ $o ] = array_merge( $user_agents[ $ua ][ $o ], $r[ $o ] );
544
+ }
545
  }
546
  }
547
  }
548
+
549
  return $user_agents;
550
  }
551
 
552
  function flatten_user_agents( $user_agents ) {
553
  $rules = Array();
554
+ foreach ( $user_agents as $ua => $r ) {
555
  $r['user-agent'] = Array( $ua );
556
+ $rules[] = $r;
557
  }
558
+
559
  return $rules;
560
  }
561
 
562
+ function opt_robot_rule( $dis ) {
563
+ if ( is_array( $dis ) ) { // unique rules only
564
  $dis = array_unique( $dis, SORT_STRING );
565
+ $pd = null;
566
+ foreach ( $dis as $k => $d ) {
567
+ $d = trim( $d );
568
+ if ( ! empty( $pd ) && ! empty( $d ) ) {
569
+ if ( strpos( $d, $pd ) === 0 ) {
570
+ unset( $dis[ $k ] );
571
+ continue; // get rid of subpaths of $pd
572
+ }
573
+ }
574
+ $l = strlen( $d );
575
+ if ( ( $l > 0 ) && ( $d[ $l - 1 ] !== '/' ) ) {
576
+ continue;
577
+ }
578
+ $pd = $d; // only allow directory paths for $pd
579
+ }
580
  }
581
+
582
  return $dis;
583
  }
584
 
585
+ function output_robots( $rules ) {
586
  $robots = '';
587
+ foreach ( $rules as $r ) {
588
+ foreach ( $r['comment'] as $c ) {
589
+ $robots .= "$c\n";
590
+ }
591
+ foreach ( $r['user-agent'] as $u ) {
592
+ if ( $u != '' ) {
593
+ $robots .= "User-agent: $u\n";
594
+ }
595
+ }
596
+ foreach ( $r['crawl-delay'] as $c ) {
597
+ $robots .= "Crawl-Delay: $c\n";
598
+ }
599
+ foreach ( $r['allow'] as $a ) {
600
+ $robots .= "Allow: $a\n";
601
+ }
602
+ foreach ( $r['disallow'] as $d ) {
603
+ $robots .= "Disallow: $d\n";
604
+ }
605
+ foreach ( $r['sitemap'] as $s ) {
606
+ $robots .= "Sitemap: $s\n";
607
+ }
608
  $robots .= "\n";
609
  }
610
+
611
  return $robots;
612
  }
613
  }
modules/aioseop_sitemap.php CHANGED
@@ -5,7 +5,7 @@
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,303 +18,462 @@ 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' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
121
- 'options' => array_keys( $this->default_options )
122
- )
123
  );
124
-
125
  $prio = Array();
126
- for( $i = 0; $i <= 10; $i++ ) {
127
- $str = sprintf( "%0.1f", $i / 10.0 );
128
  $prio[ $str ] = $str;
129
  }
130
- $arr_no = Array( 'no' => __( 'Do Not Override', 'all-in-one-seo-pack' ) );
131
- $arr_sel = Array( 'sel' => __( 'Select Individual', 'all-in-one-seo-pack' ) );
132
  $this->prio_sel = array_merge( $arr_no, $arr_sel, $prio );
133
- $this->prio = array_merge( $arr_no, $prio );
134
-
135
  $freq = Array();
136
- foreach ( Array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ) as $f ) $freq[ $f ] = $f;
 
 
137
  $this->freq_sel = array_merge( $arr_no, $arr_sel, $freq );
138
- $this->freq = array_merge( $arr_no, $freq );
139
-
140
- foreach( Array( 'prio' => __( 'priority', 'all-in-one-seo-pack' ), 'freq' => __( 'frequency', 'all-in-one-seo-pack' ) ) as $k => $v ) {
141
- $s = "{$k}_options";
 
 
 
 
 
142
  $$s = Array();
143
- foreach( Array( 'homepage' => __( 'homepage', 'all-in-one-seo-pack' ),
144
- 'post' => __( 'posts', 'all-in-one-seo-pack' ),
145
- 'taxonomies' => __( 'taxonomies', 'all-in-one-seo-pack' ),
146
- 'archive' => __( 'archive pages', 'all-in-one-seo-pack' ),
147
- 'author' => __( 'author pages', 'all-in-one-seo-pack' ) ) as $opt => $val ) {
 
 
 
 
148
  $arr = $$s;
149
  if ( ( $opt == 'post' ) || ( $opt == 'taxonomies' ) ) {
150
  $iopts = $this->{"{$k}_sel"};
151
  } else {
152
  $iopts = $this->$k;
153
  }
154
-
155
- $arr[ $k . '_' . $opt ] = Array( 'name' => $this->ucwords( $val ), 'help_text' => sprintf( __( "Manually set the %s of your %s.", 'all-in-one-seo-pack' ), $v, $val ), 'type' => 'select', 'initial_options' => $iopts, 'default' => 'no' );
156
- if ( ( $opt == 'archive' ) || ( $opt == 'author' ) ) $arr[ $k . '_' . $opt ][ 'condshow' ] = Array( $this->prefix . $opt => 'on' );
 
 
 
 
 
 
 
 
157
  $$s = $arr;
158
  }
159
  }
160
-
161
  $addl_options = Array(
162
- 'addl_instructions' => Array( 'default' => '<div>' . __( 'Enter information below for any additional links for your sitemap not already managed through WordPress.', 'all-in-one-seo-pack' ) . '</div><br />', 'type' => 'html', 'label' => 'none', 'save' => false ),
163
- 'addl_url' => Array( 'name' => __( 'Page URL', 'all-in-one-seo-pack' ), 'type' => 'text', 'label' => 'top', 'save' => false ),
164
- 'addl_prio' => Array( 'name' => __( 'Page Priority', 'all-in-one-seo-pack' ), 'type' => 'select', 'initial_options' => $prio, 'label' => 'top', 'save' => false ),
165
- 'addl_freq' => Array( 'name' => __( 'Page Frequency', 'all-in-one-seo-pack' ), 'type' => 'select', 'initial_options' => $freq, 'label' => 'top', 'save' => false ),
166
- 'addl_mod' => Array( 'name' => __( 'Last Modified', 'all-in-one-seo-pack' ), 'type' => 'text', 'label' => 'top', 'save' => false ),
167
- 'addl_pages'=> Array( 'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ), 'type' => 'custom', 'save' => true ),
168
- 'Submit' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Add URL', 'all-in-one-seo-pack' ) . ' &raquo;', 'style' => 'margin-left: 20px;', 'label' => 'none', 'save' => false, 'value' => 1 )
169
- );
170
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  $excl_options = Array(
172
- 'excl_categories' => Array( 'name' => __( 'Excluded Categories', 'all-in-one-seo-pack' ), 'type' => 'multicheckbox', 'initial_options' => '' ),
173
- 'excl_pages' => Array( 'name' => __( 'Excluded Pages', 'all-in-one-seo-pack' ), 'type' => 'text' )
174
- );
175
-
 
 
 
 
176
  $this->layout['addl_pages'] = Array(
177
- 'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
178
- 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#additional-pages',
179
- 'options' => array_keys( $addl_options )
180
- );
181
-
182
  $this->layout['excl_pages'] = Array(
183
- 'name' => __( 'Excluded Items', 'all-in-one-seo-pack' ),
184
- 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#excluded-items',
185
- 'options' => array_keys( $excl_options )
186
- );
187
-
188
- $this->layout['priorities'] = Array(
189
- 'name' => __( 'Priorities', 'all-in-one-seo-pack' ),
190
- 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies',
191
- 'options' => array_keys( $prio_options )
192
- );
193
-
194
- $this->layout['frequencies'] = Array(
195
- 'name' => __( 'Frequencies', 'all-in-one-seo-pack' ),
196
- 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies',
197
- 'options' => array_keys( $freq_options )
198
- );
199
-
200
  $this->default_options = array_merge( $status_options, $this->default_options, $addl_options, $excl_options, $prio_options, $freq_options );
201
 
202
  $this->add_help_text_links();
203
-
204
  add_action( 'init', Array( $this, 'load_sitemap_options' ) );
205
- add_action( $this->prefix . 'settings_update', Array( $this, 'do_sitemaps' ) );
206
  add_filter( $this->prefix . 'display_settings', Array( $this, 'update_post_data' ) );
207
- add_filter( $this->prefix . 'display_options', Array( $this, 'filter_display_options' ) );
208
- add_filter( $this->prefix . 'update_options', Array( $this, 'filter_options' ) );
209
  add_filter( $this->prefix . 'output_option', Array( $this, 'display_custom_options' ), 10, 2 );
210
  add_action( $this->prefix . 'daily_update_cron', Array( $this, 'daily_update' ) );
211
  }
212
-
213
  // Add new intervals of a week and a month
214
  // See http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
215
  function add_cron_schedules( $schedules ) {
216
- $schedules['weekly'] = array(
217
- 'interval' => 604800, // 1 week in seconds
218
- 'display' => __( 'Once Weekly', 'all-in-one-seo-pack' )
219
- );
220
- $schedules['monthly'] = array(
221
- 'interval' => 2629740, // 1 month in seconds
222
- 'display' => __( 'Once Monthly', 'all-in-one-seo-pack' )
223
- );
224
- return $schedules;
225
- }
226
-
 
227
  function cron_update() {
228
  add_filter( 'cron_schedules', Array( $this, 'add_cron_schedules' ) );
229
- if ( !wp_next_scheduled( $this->prefix . 'daily_update_cron' ) )
230
- wp_schedule_event( time(), $this->options[$this->prefix . 'daily_cron'], $this->prefix . 'daily_update_cron' );
 
231
  }
232
-
233
  function daily_update() {
234
  $last_run = get_option( $this->prefix . 'cron_last_run' );
235
  if ( empty( $last_run ) || ( time() - $last_run > 23.5 * 60 * 60 ) ) // sanity check
 
236
  $this->do_sitemaps( __( "Daily scheduled sitemap check has finished.", 'all-in-one-seo-pack' ) );
 
237
  $last_run = time();
238
  update_option( $this->prefix . 'cron_last_run', $last_run );
239
  }
240
-
241
  /** Initialize options, after constructor **/
242
  function load_sitemap_options() {
243
  // load initial options / set defaults
244
- $this->update_options( );
245
- if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) {
246
  $this->paginate = true;
247
- if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
248
  $this->max_posts = $this->options["{$this->prefix}max_posts"];
 
249
  }
250
 
251
- if ( is_multisite() ) $this->options["{$this->prefix}rewrite"] = 'On';
 
 
252
 
253
- if ( $this->options["{$this->prefix}rewrite"] ) $this->setup_rewrites();
254
-
255
- if ( $this->option_isset( 'robots' ) )
 
 
256
  add_action( 'do_robots', Array( $this, 'do_robots' ), 100 );
257
-
258
- if ( isset( $this->options[$this->prefix . 'daily_cron'] ) && $this->options[$this->prefix . 'daily_cron'] ) {
259
- add_action( 'wp', Array( $this, 'cron_update' ) );
 
260
  } else {
261
- if ( $time = wp_next_scheduled( $this->prefix . 'daily_update_cron' ) )
262
- wp_unschedule_event( $time, $this->prefix . 'daily_update_cron' );
 
263
  }
264
  }
265
-
266
  /** Custom settings - displays boxes for add pages to sitemap option. **/
267
  function display_custom_options( $buf, $args ) {
268
  if ( $args['name'] == "{$this->prefix}addl_pages" ) {
269
  $buf .= "<div id='{$this->prefix}addl_pages'>";
270
- if ( !empty( $args['value'] ) ) {
271
  $buf .= "<table class='aioseop_table' cellpadding=0 cellspacing=0>\n";
272
  foreach ( $args['value'] as $k => $v ) {
273
- if ( is_object( $v ) ) $v = (Array)$v;
 
 
274
  $buf .= "\t<tr><td><a href='#' title='$k' class='aiosp_delete_url'></a> {$k}</td><td>{$v['prio']}</td><td>{$v['freq']}</td><td>{$v['mod']}</td></tr>\n";
275
  }
276
  $buf .= "</table>\n";
277
  }
278
  }
279
  $args['options']['type'] = 'hidden';
280
- if ( !empty( $args['value'] ) )
281
  $args['value'] = json_encode( $args['value'] );
282
- else
283
  $args['options']['type'] = 'html';
284
- if ( empty( $args['value'] ) ) $args['value'] = '';
 
 
 
285
  $buf .= $this->get_option_html( $args );
286
  $buf .= '</div>';
 
287
  return $buf;
288
  }
289
-
290
  /** Add post type details for settings once post types have been registered. **/
291
  function add_post_types() {
292
  $post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) );
293
- $taxonomy_titles = $this->get_taxonomy_titles( Array( 'public' => true ) );
294
- if ( isset( $post_type_titles['attachment'] ) ) $post_type_titles['attachment'] = __( "Media / Attachments", 'all-in-one-seo-pack' );
295
- $this->default_options['posttypes' ]['initial_options'] = array_merge( Array( 'all' => __( 'All Post Types', 'all-in-one-seo-pack' ) ), $post_type_titles );
296
- $this->default_options['taxonomies']['initial_options'] = array_merge( Array( 'all' => __( 'All Taxonomies', 'all-in-one-seo-pack' ) ), $taxonomy_titles );
297
- $this->default_options['posttypes' ]['default'] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
298
- $this->default_options['taxonomies']['default'] = array_keys( $this->default_options['taxonomies']['initial_options'] );
 
 
299
  $this->default_options['excl_categories']['initial_options'] = $this->get_category_titles();
300
- $prio_help = __( "Manually set the priority for the ", 'all-in-one-seo-pack' );
301
- $freq_help = __( "Manually set the frequency for the ", 'all-in-one-seo-pack' );
302
- $post_name = __( " Post Type", 'all-in-one-seo-pack' );
303
- $tax_name = __( " Taxonomy", 'all-in-one-seo-pack' );
304
- foreach( $post_type_titles as $k => $v
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
  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(
80
+ 'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ),
81
+ 'default' => 'sitemap',
82
+ 'type' => 'text',
83
+ 'sanitize' => 'filename'
84
+ ),
85
+ 'google' => Array( 'name' => __( 'Notify Google', 'all-in-one-seo-pack' ) ),
86
+ 'bing' => Array( 'name' => __( 'Notify Bing', 'all-in-one-seo-pack' ) ),
87
+ 'daily_cron' => Array(
88
+ 'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ),
89
+ 'type' => 'select',
90
+ 'initial_options' => Array(
91
+ 0 => __( 'No Schedule', 'all-in-one-seo-pack' ),
92
+ 'daily' => __( 'Daily', 'all-in-one-seo-pack' ),
93
+ 'weekly' => __( 'Weekly', 'all-in-one-seo-pack' ),
94
+ 'monthly' => __( 'Monthly', 'all-in-one-seo-pack' )
95
+ ),
96
+ 'default' => 0
97
+ ),
98
+ 'indexes' => Array( 'name' => __( 'Enable Sitemap Indexes', 'all-in-one-seo-pack' ) ),
99
+ 'paginate' => Array(
100
+ 'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ),
101
+ 'condshow' => Array( "{$this->prefix}indexes" => 'on' )
102
+ ),
103
+ 'max_posts' => Array(
104
+ 'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ),
105
+ 'type' => 'text',
106
+ 'default' => 50000,
107
+ 'condshow' => Array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' )
108
+ ),
109
+ 'posttypes' => Array(
110
+ 'name' => __( 'Post Types', 'all-in-one-seo-pack' ),
111
+ 'type' => 'multicheckbox',
112
+ 'default' => 'all'
113
+ ),
114
+ 'taxonomies' => Array(
115
+ 'name' => __( 'Taxonomies', 'all-in-one-seo-pack' ),
116
+ 'type' => 'multicheckbox',
117
+ 'default' => 'all'
118
+ ),
119
+ 'archive' => Array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ),
120
+ 'author' => Array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ),
121
+ 'gzipped' => Array(
122
+ 'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ),
123
+ 'default' => 'On'
124
+ ),
125
+ 'robots' => Array(
126
+ 'name' => __( 'Link From Virtual Robots.txt', 'all-in-one-seo-pack' ),
127
+ 'default' => 'On'
128
+ ),
129
+ 'rewrite' => Array(
130
+ 'name' => __( 'Dynamically Generate Sitemap', 'all-in-one-seo-pack' ),
131
+ 'default' => 'On'
132
+ ),
133
+ 'noindex' => Array(
134
+ 'name' => __( 'Noindex Sitemap file', 'all-in-one-seo-pack' ),
135
+ 'condshow' => Array( "{$this->prefix}rewrite" => true )
136
+ )
137
  );
138
+
139
  $status_options = Array(
140
+ 'link' => Array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
141
+ 'debug' => Array(
142
+ 'name' => __( 'Debug Log', 'all-in-one-seo-pack' ),
143
+ 'default' => '',
144
+ 'type' => 'html',
145
+ 'disabled' => 'disabled',
146
+ 'save' => false,
147
+ 'label' => 'none',
148
+ 'rows' => 5,
149
+ 'cols' => 120,
150
+ 'style' => 'min-width:950px'
151
+ )
152
  );
153
+
154
  $this->layout = Array(
155
+ 'status' => Array(
156
+ 'name' => __( 'Sitemap Status', 'all-in-one-seo-pack' ),
157
+ 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
158
+ 'options' => array_keys( $status_options )
159
+ ),
160
  'default' => Array(
161
+ 'name' => $this->name,
162
+ 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
163
+ 'options' => array_keys( $this->default_options )
164
+ )
165
  );
166
+
167
  $prio = Array();
168
+ for ( $i = 0; $i <= 10; $i ++ ) {
169
+ $str = sprintf( "%0.1f", $i / 10.0 );
170
  $prio[ $str ] = $str;
171
  }
172
+ $arr_no = Array( 'no' => __( 'Do Not Override', 'all-in-one-seo-pack' ) );
173
+ $arr_sel = Array( 'sel' => __( 'Select Individual', 'all-in-one-seo-pack' ) );
174
  $this->prio_sel = array_merge( $arr_no, $arr_sel, $prio );
175
+ $this->prio = array_merge( $arr_no, $prio );
176
+
177
  $freq = Array();
178
+ foreach ( Array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ) as $f ) {
179
+ $freq[ $f ] = $f;
180
+ }
181
  $this->freq_sel = array_merge( $arr_no, $arr_sel, $freq );
182
+ $this->freq = array_merge( $arr_no, $freq );
183
+
184
+ foreach (
185
+ Array(
186
+ 'prio' => __( 'priority', 'all-in-one-seo-pack' ),
187
+ 'freq' => __( 'frequency', 'all-in-one-seo-pack' )
188
+ ) as $k => $v
189
+ ) {
190
+ $s = "{$k}_options";
191
  $$s = Array();
192
+ foreach (
193
+ Array(
194
+ 'homepage' => __( 'homepage', 'all-in-one-seo-pack' ),
195
+ 'post' => __( 'posts', 'all-in-one-seo-pack' ),
196
+ 'taxonomies' => __( 'taxonomies', 'all-in-one-seo-pack' ),
197
+ 'archive' => __( 'archive pages', 'all-in-one-seo-pack' ),
198
+ 'author' => __( 'author pages', 'all-in-one-seo-pack' )
199
+ ) as $opt => $val
200
+ ) {
201
  $arr = $$s;
202
  if ( ( $opt == 'post' ) || ( $opt == 'taxonomies' ) ) {
203
  $iopts = $this->{"{$k}_sel"};
204
  } else {
205
  $iopts = $this->$k;
206
  }
207
+
208
+ $arr[ $k . '_' . $opt ] = Array(
209
+ 'name' => $this->ucwords( $val ),
210
+ 'help_text' => sprintf( __( "Manually set the %s of your %s.", 'all-in-one-seo-pack' ), $v, $val ),
211
+ 'type' => 'select',
212
+ 'initial_options' => $iopts,
213
+ 'default' => 'no'
214
+ );
215
+ if ( ( $opt == 'archive' ) || ( $opt == 'author' ) ) {
216
+ $arr[ $k . '_' . $opt ]['condshow'] = Array( $this->prefix . $opt => 'on' );
217
+ }
218
  $$s = $arr;
219
  }
220
  }
221
+
222
  $addl_options = Array(
223
+ 'addl_instructions' => Array(
224
+ 'default' => '<div>' . __( 'Enter information below for any additional links for your sitemap not already managed through WordPress.', 'all-in-one-seo-pack' ) . '</div><br />',
225
+ 'type' => 'html',
226
+ 'label' => 'none',
227
+ 'save' => false
228
+ ),
229
+ 'addl_url' => Array(
230
+ 'name' => __( 'Page URL', 'all-in-one-seo-pack' ),
231
+ 'type' => 'text',
232
+ 'label' => 'top',
233
+ 'save' => false
234
+ ),
235
+ 'addl_prio' => Array(
236
+ 'name' => __( 'Page Priority', 'all-in-one-seo-pack' ),
237
+ 'type' => 'select',
238
+ 'initial_options' => $prio,
239
+ 'label' => 'top',
240
+ 'save' => false
241
+ ),
242
+ 'addl_freq' => Array(
243
+ 'name' => __( 'Page Frequency', 'all-in-one-seo-pack' ),
244
+ 'type' => 'select',
245
+ 'initial_options' => $freq,
246
+ 'label' => 'top',
247
+ 'save' => false
248
+ ),
249
+ 'addl_mod' => Array(
250
+ 'name' => __( 'Last Modified', 'all-in-one-seo-pack' ),
251
+ 'type' => 'text',
252
+ 'label' => 'top',
253
+ 'save' => false
254
+ ),
255
+ 'addl_pages' => Array(
256
+ 'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
257
+ 'type' => 'custom',
258
+ 'save' => true
259
+ ),
260
+ 'Submit' => Array(
261
+ 'type' => 'submit',
262
+ 'class' => 'button-primary',
263
+ 'name' => __( 'Add URL', 'all-in-one-seo-pack' ) . ' &raquo;',
264
+ 'style' => 'margin-left: 20px;',
265
+ 'label' => 'none',
266
+ 'save' => false,
267
+ 'value' => 1
268
+ )
269
+ );
270
+
271
  $excl_options = Array(
272
+ 'excl_categories' => Array(
273
+ 'name' => __( 'Excluded Categories', 'all-in-one-seo-pack' ),
274
+ 'type' => 'multicheckbox',
275
+ 'initial_options' => ''
276
+ ),
277
+ 'excl_pages' => Array( 'name' => __( 'Excluded Pages', 'all-in-one-seo-pack' ), 'type' => 'text' )
278
+ );
279
+
280
  $this->layout['addl_pages'] = Array(
281
+ 'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
282
+ 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#additional-pages',
283
+ 'options' => array_keys( $addl_options )
284
+ );
285
+
286
  $this->layout['excl_pages'] = Array(
287
+ 'name' => __( 'Excluded Items', 'all-in-one-seo-pack' ),
288
+ 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#excluded-items',
289
+ 'options' => array_keys( $excl_options )
290
+ );
291
+
292
+ $this->layout['priorities'] = Array(
293
+ 'name' => __( 'Priorities', 'all-in-one-seo-pack' ),
294
+ 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies',
295
+ 'options' => array_keys( $prio_options )
296
+ );
297
+
298
+ $this->layout['frequencies'] = Array(
299
+ 'name' => __( 'Frequencies', 'all-in-one-seo-pack' ),
300
+ 'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies',
301
+ 'options' => array_keys( $freq_options )
302
+ );
303
+
304
  $this->default_options = array_merge( $status_options, $this->default_options, $addl_options, $excl_options, $prio_options, $freq_options );
305
 
306
  $this->add_help_text_links();
307
+
308
  add_action( 'init', Array( $this, 'load_sitemap_options' ) );
309
+ add_action( $this->prefix . 'settings_update', Array( $this, 'do_sitemaps' ) );
310
  add_filter( $this->prefix . 'display_settings', Array( $this, 'update_post_data' ) );
311
+ add_filter( $this->prefix . 'display_options', Array( $this, 'filter_display_options' ) );
312
+ add_filter( $this->prefix . 'update_options', Array( $this, 'filter_options' ) );
313
  add_filter( $this->prefix . 'output_option', Array( $this, 'display_custom_options' ), 10, 2 );
314
  add_action( $this->prefix . 'daily_update_cron', Array( $this, 'daily_update' ) );
315
  }
316
+
317
  // Add new intervals of a week and a month
318
  // See http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
319
  function add_cron_schedules( $schedules ) {
320
+ $schedules['weekly'] = array(
321
+ 'interval' => 604800, // 1 week in seconds
322
+ 'display' => __( 'Once Weekly', 'all-in-one-seo-pack' )
323
+ );
324
+ $schedules['monthly'] = array(
325
+ 'interval' => 2629740, // 1 month in seconds
326
+ 'display' => __( 'Once Monthly', 'all-in-one-seo-pack' )
327
+ );
328
+
329
+ return $schedules;
330
+ }
331
+
332
  function cron_update() {
333
  add_filter( 'cron_schedules', Array( $this, 'add_cron_schedules' ) );
334
+ if ( ! wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) {
335
+ wp_schedule_event( time(), $this->options[ $this->prefix . 'daily_cron' ], $this->prefix . 'daily_update_cron' );
336
+ }
337
  }
338
+
339
  function daily_update() {
340
  $last_run = get_option( $this->prefix . 'cron_last_run' );
341
  if ( empty( $last_run ) || ( time() - $last_run > 23.5 * 60 * 60 ) ) // sanity check
342
+ {
343
  $this->do_sitemaps( __( "Daily scheduled sitemap check has finished.", 'all-in-one-seo-pack' ) );
344
+ }
345
  $last_run = time();
346
  update_option( $this->prefix . 'cron_last_run', $last_run );
347
  }
348
+
349
  /** Initialize options, after constructor **/
350
  function load_sitemap_options() {
351
  // load initial options / set defaults
352
+ $this->update_options();
353
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) {
354
  $this->paginate = true;
355
+ if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) {
356
  $this->max_posts = $this->options["{$this->prefix}max_posts"];
357
+ }
358
  }
359
 
360
+ if ( is_multisite() ) {
361
+ $this->options["{$this->prefix}rewrite"] = 'On';
362
+ }
363
 
364
+ if ( $this->options["{$this->prefix}rewrite"] ) {
365
+ $this->setup_rewrites();
366
+ }
367
+
368
+ if ( $this->option_isset( 'robots' ) ) {
369
  add_action( 'do_robots', Array( $this, 'do_robots' ), 100 );
370
+ }
371
+
372
+ if ( isset( $this->options[ $this->prefix . 'daily_cron' ] ) && $this->options[ $this->prefix . 'daily_cron' ] ) {
373
+ add_action( 'wp', Array( $this, 'cron_update' ) );
374
  } else {
375
+ if ( $time = wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) {
376
+ wp_unschedule_event( $time, $this->prefix . 'daily_update_cron' );
377
+ }
378
  }
379
  }
380
+
381
  /** Custom settings - displays boxes for add pages to sitemap option. **/
382
  function display_custom_options( $buf, $args ) {
383
  if ( $args['name'] == "{$this->prefix}addl_pages" ) {
384
  $buf .= "<div id='{$this->prefix}addl_pages'>";
385
+ if ( ! empty( $args['value'] ) ) {
386
  $buf .= "<table class='aioseop_table' cellpadding=0 cellspacing=0>\n";
387
  foreach ( $args['value'] as $k => $v ) {
388
+ if ( is_object( $v ) ) {
389
+ $v = (Array) $v;
390
+ }
391
  $buf .= "\t<tr><td><a href='#' title='$k' class='aiosp_delete_url'></a> {$k}</td><td>{$v['prio']}</td><td>{$v['freq']}</td><td>{$v['mod']}</td></tr>\n";
392
  }
393
  $buf .= "</table>\n";
394
  }
395
  }
396
  $args['options']['type'] = 'hidden';
397
+ if ( ! empty( $args['value'] ) ) {
398
  $args['value'] = json_encode( $args['value'] );
399
+ } else {
400
  $args['options']['type'] = 'html';
401
+ }
402
+ if ( empty( $args['value'] ) ) {
403
+ $args['value'] = '';
404
+ }
405
  $buf .= $this->get_option_html( $args );
406
  $buf .= '</div>';
407
+
408
  return $buf;
409
  }
410
+
411
  /** Add post type details for settings once post types have been registered. **/
412
  function add_post_types() {
413
  $post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) );
414
+ $taxonomy_titles = $this->get_taxonomy_titles( Array( 'public' => true ) );
415
+ if ( isset( $post_type_titles['attachment'] ) ) {
416
+ $post_type_titles['attachment'] = __( "Media / Attachments", 'all-in-one-seo-pack' );
417
+ }
418
+ $this->default_options['posttypes']['initial_options'] = array_merge( Array( 'all' => __( 'All Post Types', 'all-in-one-seo-pack' ) ), $post_type_titles );
419
+ $this->default_options['taxonomies']['initial_options'] = array_merge( Array( 'all' => __( 'All Taxonomies', 'all-in-one-seo-pack' ) ), $taxonomy_titles );
420
+ $this->default_options['posttypes']['default'] = array_keys( $this->default_options['posttypes']['initial_options'] );
421
+ $this->default_options['taxonomies']['default'] = array_keys( $this->default_options['taxonomies']['initial_options'] );
422
  $this->default_options['excl_categories']['initial_options'] = $this->get_category_titles();