Version Description
Download this release
Release Info
Developer | hallsofmontezuma |
Plugin | All in One SEO Pack |
Version | 2.3.6 |
Comparing to | |
See all releases |
Code changes from version 2.3.4.2 to 2.3.6
- CONTRIBUTING.md +0 -154
- admin/aioseop_module_class.php +1436 -940
- admin/aioseop_module_manager.php +152 -68
- admin/display/general-metaboxes.php +138 -89
- admin/display/index.php +4 -1
- admin/index.php +4 -1
- admin/meta_import.php +455 -428
- aioseop-init.php +7 -0
- aioseop_class.php +4446 -2942
- aioseop_init.php +0 -2
- all_in_one_seo_pack.php +295 -229
- css/aiosp_admin.css +71 -67
- css/modules/aioseop_module-rtl.css +125 -111
- css/modules/aioseop_module.css +1309 -1120
- i18n/all-in-one-seo-pack-am.mo +0 -0
- i18n/all-in-one-seo-pack-ar.mo +0 -0
- i18n/all-in-one-seo-pack-art_xemoji.mo +0 -0
- i18n/all-in-one-seo-pack-ary.mo +0 -0
- i18n/all-in-one-seo-pack-bg_BG.mo +0 -0
- i18n/all-in-one-seo-pack-bn_BD.mo +0 -0
- i18n/all-in-one-seo-pack-bs_BA.mo +0 -0
- i18n/all-in-one-seo-pack-ca.mo +0 -0
- i18n/all-in-one-seo-pack-de_DE.mo +0 -0
- i18n/all-in-one-seo-pack-el.mo +0 -0
- i18n/all-in-one-seo-pack-en_AU.mo +0 -0
- i18n/all-in-one-seo-pack-en_CA.mo +0 -0
- i18n/all-in-one-seo-pack-en_GB.mo +0 -0
- i18n/all-in-one-seo-pack-en_NZ.mo +0 -0
- i18n/all-in-one-seo-pack-en_ZA.mo +0 -0
- i18n/all-in-one-seo-pack-es_ES.mo +0 -0
- i18n/all-in-one-seo-pack-es_VE.mo +0 -0
- i18n/all-in-one-seo-pack-et.mo +0 -0
- i18n/all-in-one-seo-pack-fa_IR.mo +0 -0
- i18n/all-in-one-seo-pack-fi.mo +0 -0
- i18n/all-in-one-seo-pack-fr_CA.mo +0 -0
- i18n/all-in-one-seo-pack-fr_FR.mo +0 -0
- i18n/all-in-one-seo-pack-he_IL.mo +0 -0
- i18n/all-in-one-seo-pack-hi_IN.mo +0 -0
- i18n/all-in-one-seo-pack-hr.mo +0 -0
- i18n/all-in-one-seo-pack-hu_HU.mo +0 -0
- i18n/all-in-one-seo-pack-hy +0 -0
- i18n/all-in-one-seo-pack-hy.mo +0 -0
- i18n/all-in-one-seo-pack-id_ID.mo +0 -0
- i18n/all-in-one-seo-pack-it_IT.mo +0 -0
- i18n/all-in-one-seo-pack-ja.mo +0 -0
- i18n/all-in-one-seo-pack-jv_ID.mo +0 -0
- i18n/all-in-one-seo-pack-ko_KR.mo +0 -0
- i18n/all-in-one-seo-pack-lv.mo +0 -0
- i18n/all-in-one-seo-pack-mk_MK.mo +0 -0
- i18n/all-in-one-seo-pack-mn.mo +0 -0
- i18n/all-in-one-seo-pack-mr.mo +0 -0
- i18n/all-in-one-seo-pack-ms_MY.mo +0 -0
- i18n/all-in-one-seo-pack-nb_NO.mo +0 -0
- i18n/all-in-one-seo-pack-nl.mo +0 -0
- i18n/all-in-one-seo-pack-nl_NL.mo +0 -0
- i18n/all-in-one-seo-pack-nn_NO.mo +0 -0
- i18n/all-in-one-seo-pack-oci.mo +0 -0
- i18n/all-in-one-seo-pack-pa_IN.mo +0 -0
- i18n/all-in-one-seo-pack-pl_PL.mo +0 -0
- i18n/all-in-one-seo-pack-ps.mo +0 -0
- i18n/all-in-one-seo-pack-pt_BR.mo +0 -0
- i18n/all-in-one-seo-pack-pt_PT.mo +0 -0
- i18n/all-in-one-seo-pack-ro_RO.mo +0 -0
- i18n/all-in-one-seo-pack-ru_RU.mo +0 -0
- i18n/all-in-one-seo-pack-si_LK.mo +0 -0
- i18n/all-in-one-seo-pack-sl_SL.mo +0 -0
- i18n/all-in-one-seo-pack-sq.mo +0 -0
- i18n/all-in-one-seo-pack-sv_SE.mo +0 -0
- i18n/all-in-one-seo-pack-ta_IN.mo +0 -0
- i18n/all-in-one-seo-pack-tg.mo +0 -0
- i18n/all-in-one-seo-pack-tr_TR.mo +0 -0
- i18n/all-in-one-seo-pack-uk.mo +0 -0
- i18n/all-in-one-seo-pack-ur.mo +0 -0
- i18n/all-in-one-seo-pack-vi.mo +0 -0
- i18n/all-in-one-seo-pack-zh_CN.mo +0 -0
- i18n/all-in-one-seo-pack-zh_TW.mo +0 -0
- inc/aioseop_functions.php +691 -377
- inc/aioseop_updates_class.php +216 -176
- inc/aiosp_common.php +56 -26
- inc/commonstrings.php +33 -30
- inc/compatability/compat-init.php +73 -0
- inc/deprecated.php +186 -115
- inc/index.php +4 -1
- inc/sitemap-xsl.php +190 -0
- inc/translations.php +173 -0
- index.php +4 -1
- js/modules/aioseop_module.js +641 -345
- modules/aioseop_bad_robots.php +149 -79
- modules/aioseop_feature_manager.php +143 -82
- modules/aioseop_file_editor.php +113 -61
- modules/aioseop_importer_exporter.php +503 -251
- modules/aioseop_opengraph.php +910 -540
- modules/aioseop_performance.php +235 -170
- modules/aioseop_robots.php +503 -259
- modules/aioseop_sitemap.php +153 -107
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 =
|
20 |
-
protected $help_anchors =
|
21 |
-
protected $locations = null;
|
22 |
-
protected $layout = null;
|
23 |
-
protected $tabs = null;
|
24 |
-
protected $current_tab = null;
|
25 |
-
protected $pagehook = null;
|
26 |
protected $store_option = false;
|
27 |
protected $parent_option = 'aioseop_options';
|
28 |
-
protected $post_metaboxes =
|
29 |
protected $tabbed_metaboxes = true;
|
30 |
protected $credentials = false; // used for WP Filesystem
|
31 |
-
protected $script_data = null;
|
32 |
protected $plugin_path = null;
|
33 |
-
protected $pointers =
|
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,
|
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 ) )
|
|
|
|
|
50 |
$this->plugin_name = AIOSEOP_PLUGIN_NAME;
|
51 |
-
$this->plugin_path =
|
52 |
// $this->plugin_path['dir'] = plugin_dir_path( $this->file );
|
53 |
-
$this->plugin_path['basename']
|
54 |
-
$this->plugin_path['dirname']
|
55 |
-
$this->plugin_path['url']
|
56 |
-
$this->plugin_path['images_url']
|
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'] ) )
|
86 |
-
|
|
|
|
|
|
|
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
|
123 |
-
|
|
|
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 )
|
131 |
-
|
|
|
|
|
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' )
|
144 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
235 |
function html_string_to_array( $xmlstr ) {
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
243 |
}
|
244 |
|
245 |
function xml_string_to_array( $xmlstr ) {
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
253 |
}
|
254 |
|
255 |
function domnode_to_array( $node ) {
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
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_([^%]*?)%/',
|
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' ) )
|
|
|
|
|
304 |
if ( empty( $result ) ) {
|
305 |
global $post;
|
306 |
-
if ( !empty( $post ) )
|
|
|
|
|
|
|
|
|
|
|
307 |
}
|
308 |
-
|
309 |
-
|
|
|
310 |
}
|
311 |
$result = strip_tags( $result );
|
|
|
312 |
return $result;
|
313 |
}
|
314 |
-
|
315 |
/**
|
316 |
* Returns child blogs of parent in a multisite.
|
317 |
*/
|
@@ -319,198 +373,215 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
319 |
global $wpdb, $blog_id;
|
320 |
$site_id = $wpdb->siteid;
|
321 |
if ( is_multisite() ) {
|
322 |
-
if ( $site_id != $blog_id )
|
|
|
|
|
|
|
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() )
|
334 |
-
|
335 |
-
|
336 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
343 |
-
foreach( $list as $l ) {
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
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 =
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
);
|
360 |
-
$botlist = apply_filters( $this->prefix .
|
361 |
-
if ( !empty( $botlist ) ) {
|
362 |
-
|
|
|
|
|
|
|
363 |
$uas = $this->quote_list_for_regex( $botlist );
|
364 |
-
|
365 |
-
$ip
|
366 |
-
$hostname
|
367 |
$ip_by_hostname = gethostbyname( $hostname );
|
368 |
-
|
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 =
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
'MaxPointCrawler',
|
442 |
'MegaIndex',
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
'panscient.com',
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
'SemrushBot',
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
'coccoc',
|
515 |
'Incutio',
|
516 |
'lmspider',
|
@@ -520,24 +591,29 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
520 |
'Unknown',
|
521 |
'uptime files'
|
522 |
);
|
|
|
523 |
return $botlist;
|
524 |
}
|
525 |
-
|
526 |
function is_bad_bot() {
|
527 |
$botlist = $this->default_bad_bots();
|
528 |
-
$botlist = apply_filters( $this->prefix .
|
529 |
-
if ( !empty( $botlist ) ) {
|
530 |
-
|
|
|
|
|
|
|
531 |
$uas = $this->quote_list_for_regex( $botlist );
|
532 |
-
|
533 |
return true;
|
534 |
}
|
535 |
}
|
|
|
536 |
return false;
|
537 |
}
|
538 |
-
|
539 |
function default_bad_referers() {
|
540 |
-
$referlist =
|
541 |
'semalt.com',
|
542 |
'kambasoft.com',
|
543 |
'savetubevideo.com',
|
@@ -564,247 +640,304 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
564 |
'site3.free-share-buttons.com',
|
565 |
'webmaster-traffic.com'
|
566 |
);
|
|
|
567 |
return $referlist;
|
568 |
}
|
569 |
|
570 |
function is_bad_referer() {
|
571 |
$referlist = $this->default_bad_referers();
|
572 |
-
$referlist = apply_filters( $this->prefix .
|
573 |
|
574 |
-
if ( !empty( $referlist ) && !empty( $_SERVER ) && !empty( $_SERVER['HTTP_REFERER'] ) ) {
|
575 |
-
|
576 |
$regex = $this->quote_list_for_regex( $referlist );
|
577 |
-
|
578 |
return true;
|
579 |
}
|
580 |
}
|
|
|
581 |
return false;
|
582 |
}
|
583 |
-
|
584 |
function allow_bot() {
|
585 |
$allow_bot = true;
|
586 |
-
if ( (
|
587 |
$allow_bot = false;
|
588 |
-
|
|
|
|
|
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 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
|
|
|
|
|
|
|
|
|
|
608 |
</label></div>
|
609 |
<?php
|
610 |
}
|
611 |
}
|
612 |
-
|
613 |
function get_object_labels( $post_objs ) {
|
614 |
-
$pt
|
615 |
-
$post_types =
|
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 =
|
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 =
|
633 |
return $this->get_object_labels( get_post_types( $args, 'objects' ) );
|
634 |
}
|
635 |
|
636 |
-
function get_taxonomy_titles( $args =
|
637 |
return $this->get_object_labels( get_taxonomies( $args, 'objects' ) );
|
638 |
}
|
639 |
-
|
640 |
-
function get_category_titles( $args =
|
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 =
|
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
|
654 |
-
$
|
|
|
|
|
|
|
655 |
$post_custom_fields = get_post_custom( $post->ID );
|
656 |
-
$has_data
|
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 ) &&
|
661 |
$has_data = true;
|
662 |
$data .= $field_name . " = '" . $field[0] . "'\n";
|
663 |
-
}
|
664 |
}
|
665 |
}
|
666 |
-
if ( !empty( $data ) )
|
|
|
|
|
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 )
|
|
|
|
|
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
|
687 |
-
$has_data
|
688 |
$general_settings = null;
|
689 |
$exporter_choices = '';
|
690 |
-
if ( !empty( $_REQUEST[
|
691 |
-
$exporter_choices = $_REQUEST[
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
if ( $ex ==
|
696 |
-
|
697 |
-
|
|
|
|
|
698 |
}
|
699 |
}
|
700 |
}
|
701 |
|
702 |
-
if ( ( $post_types != null ) && ( $this === $aiosp ) )
|
703 |
-
$buf .= $this->post_data_export( '_aioseop',
|
|
|
|
|
|
|
|
|
704 |
|
705 |
/* Add all active settings to settings file */
|
706 |
-
$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' ) )
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
$value = str_replace(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
735 |
}
|
736 |
-
|
737 |
/***
|
738 |
* Backwards compatibility - see http://php.net/manual/en/function.str-getcsv.php
|
739 |
*/
|
740 |
-
function str_getcsv( $input, $delimiter =
|
741 |
-
$fp = fopen(
|
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 =
|
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 ) )
|
780 |
-
|
781 |
-
|
|
|
|
|
782 |
global $wp_filesystem;
|
|
|
783 |
return $wp_filesystem;
|
784 |
} else {
|
785 |
require_once( ABSPATH . 'wp-admin/includes/template.php' );
|
786 |
require_once( ABSPATH . 'wp-admin/includes/screen.php' );
|
787 |
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
788 |
|
789 |
-
if ( !WP_Filesystem( $this->credentials ) )
|
790 |
$this->use_wp_filesystem();
|
|
|
791 |
|
792 |
-
if ( !empty( $this->credentials ) )
|
793 |
set_transient( 'aioseop_fs_credentials', $this->credentials, 10800 );
|
|
|
794 |
global $wp_filesystem;
|
795 |
-
if ( is_object( $wp_filesystem ) )
|
796 |
return $wp_filesystem;
|
|
|
797 |
}
|
|
|
798 |
return false;
|
799 |
}
|
800 |
-
|
801 |
/**
|
802 |
* See if a file exists using WP Filesystem.
|
803 |
*/
|
804 |
function file_exists( $filename ) {
|
805 |
$wpfs = $this->get_filesystem_object();
|
806 |
-
if ( is_object( $wpfs ) )
|
807 |
return $wpfs->exists( $filename );
|
|
|
|
|
808 |
return $wpfs;
|
809 |
}
|
810 |
|
@@ -813,11 +946,13 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
813 |
*/
|
814 |
function is_file( $filename ) {
|
815 |
$wpfs = $this->get_filesystem_object();
|
816 |
-
if ( is_object( $wpfs ) )
|
817 |
return $wpfs->is_file( $filename );
|
|
|
|
|
818 |
return $wpfs;
|
819 |
}
|
820 |
-
|
821 |
/**
|
822 |
* List files in a directory using WP Filesystem.
|
823 |
*/
|
@@ -825,52 +960,72 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
825 |
$wpfs = $this->get_filesystem_object();
|
826 |
if ( is_object( $wpfs ) ) {
|
827 |
$dirlist = $wpfs->dirlist( $path );
|
828 |
-
if ( empty( $dirlist ) )
|
|
|
|
|
|
|
829 |
return array_keys( $dirlist );
|
830 |
}
|
831 |
-
|
|
|
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 (
|
|
|
|
|
841 |
if ( ( $offset > 0 ) || ( $maxlen >= 0 ) ) {
|
842 |
-
if ( $maxlen === 0 )
|
843 |
-
|
|
|
|
|
|
|
|
|
844 |
$file = $wpfs->get_contents( $filename );
|
845 |
-
if ( !is_string( $file ) || empty( $file ) )
|
846 |
-
|
|
|
|
|
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
|
862 |
$readonly_str = __( sprintf( "File %s isn't writable!\n", $filename ), 'all-in-one-seo-pack' );
|
863 |
-
$wpfs
|
864 |
if ( is_object( $wpfs ) ) {
|
865 |
$file_exists = $wpfs->exists( $filename );
|
866 |
-
if (
|
867 |
-
if ( $wpfs->put_contents( $filename, $contents ) ===
|
868 |
-
|
|
|
|
|
|
|
|
|
|
|
869 |
return true;
|
870 |
}
|
|
|
871 |
return false;
|
872 |
}
|
873 |
-
|
874 |
/**
|
875 |
* Delete a file through WP Filesystem.
|
876 |
*/
|
@@ -878,35 +1033,42 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
878 |
$wpfs = $this->get_filesystem_object();
|
879 |
if ( is_object( $wpfs ) ) {
|
880 |
if ( $wpfs->exists( $filename ) ) {
|
881 |
-
if ( $wpfs->delete( $filename ) ===
|
882 |
$this->output_error( __( sprintf( "Failed to delete file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
|
883 |
-
else
|
884 |
return true;
|
885 |
-
|
|
|
|
|
|
|
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
|
897 |
$newfile_exists = $wpfs->exists( $newname );
|
898 |
-
if ( $file_exists &&
|
899 |
-
if ( $wpfs->move( $filename, $newname ) ===
|
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 (
|
905 |
$this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
|
906 |
-
elseif ( $newfile_exists )
|
907 |
$this->output_error( __( sprintf( "File %s already exists!\n", $newname ), 'all-in-one-seo-pack' ) );
|
|
|
908 |
}
|
909 |
}
|
|
|
910 |
return false;
|
911 |
}
|
912 |
|
@@ -915,28 +1077,31 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
915 |
*/
|
916 |
function load_files( $options, $opts, $prefix ) {
|
917 |
foreach ( $opts as $opt => $file ) {
|
918 |
-
$opt
|
919 |
-
$file
|
920 |
$contents = $this->load_file( $file );
|
921 |
-
if ( $contents !== false )
|
|
|
|
|
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
|
935 |
$this->save_file( $file, $output );
|
936 |
}
|
937 |
}
|
938 |
}
|
939 |
-
|
940 |
/**
|
941 |
* Delete multiple files.
|
942 |
*/
|
@@ -946,9 +1111,9 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
946 |
$this->delete_file( $file );
|
947 |
}
|
948 |
}
|
949 |
-
|
950 |
function get_all_images_by_type( $options = null, $p = null ) {
|
951 |
-
$img =
|
952 |
if ( empty( $img ) ) {
|
953 |
$size = apply_filters( 'post_thumbnail_size', 'large' );
|
954 |
|
@@ -962,123 +1127,146 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
962 |
|
963 |
$count = 1;
|
964 |
|
965 |
-
if ( !empty( $post ) ) {
|
966 |
-
if ( !is_object( $post ) )
|
967 |
-
|
968 |
-
|
|
|
|
|
969 |
$post_thumbnail_id = $post->ID;
|
970 |
-
else
|
971 |
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
|
972 |
-
|
|
|
973 |
$image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
|
974 |
if ( is_array( $image ) ) {
|
975 |
-
$img[] =
|
976 |
}
|
977 |
}
|
978 |
}
|
979 |
|
980 |
$post_id = $post->ID;
|
981 |
-
$p
|
|
|
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
|
993 |
-
|
994 |
-
|
|
|
|
|
|
|
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 |
-
|
|
|
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 |
-
|
1007 |
-
|
1008 |
$wp_query->is_home = true;
|
1009 |
}
|
1010 |
-
$args['options']['type']
|
1011 |
$args['options']['nowrap'] = false;
|
1012 |
-
$args['options']['save']
|
1013 |
-
$wp_query->queried_object
|
1014 |
-
|
1015 |
-
$attachments = get_children(
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
|
|
|
|
1023 |
$image = wp_get_attachment_image_src( $id, $size );
|
1024 |
if ( is_array( $image ) ) {
|
1025 |
-
$img[] =
|
1026 |
}
|
1027 |
}
|
1028 |
-
|
|
|
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[] =
|
1033 |
}
|
|
|
1034 |
wp_reset_postdata();
|
1035 |
-
$wp_query = $w;
|
|
|
1036 |
}
|
1037 |
}
|
|
|
1038 |
return $img;
|
1039 |
}
|
1040 |
-
|
1041 |
function get_all_images( $options = null, $p = null ) {
|
1042 |
-
$img
|
1043 |
-
$legacy =
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1074 |
}
|
1075 |
-
if ( empty( $image ) )
|
1076 |
-
|
1077 |
-
|
1078 |
-
if ( empty( $image ) )
|
|
|
|
|
|
|
1079 |
return $image;
|
1080 |
}
|
1081 |
-
|
1082 |
function get_the_image_by_default( $p = null ) {
|
1083 |
return '';
|
1084 |
}
|
@@ -1086,17 +1274,20 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1086 |
function get_the_image_by_meta_key( $args = array() ) {
|
1087 |
|
1088 |
/* If $meta_key is not an array. */
|
1089 |
-
if ( !is_array( $args['meta_key'] ) )
|
1090 |
$args['meta_key'] = array( $args['meta_key'] );
|
|
|
1091 |
|
1092 |
/* Loop through each of the given meta keys. */
|
1093 |
foreach ( $args['meta_key'] as $meta_key ) {
|
1094 |
/* Get the image URL by the current meta key in the loop. */
|
1095 |
$image = get_post_meta( $args['post_id'], $meta_key, true );
|
1096 |
/* If a custom key value has been given for one of the keys, return the image URL. */
|
1097 |
-
if ( !empty( $image ) )
|
1098 |
return $image;
|
|
|
1099 |
}
|
|
|
1100 |
return false;
|
1101 |
}
|
1102 |
|
@@ -1107,58 +1298,62 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1107 |
} else {
|
1108 |
$post = $p;
|
1109 |
}
|
1110 |
-
|
1111 |
$post_thumbnail_id = null;
|
1112 |
-
if ( function_exists('get_post_thumbnail_id' ) ) {
|
1113 |
-
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
|
1114 |
}
|
1115 |
|
1116 |
-
if ( empty( $post_thumbnail_id ) )
|
1117 |
return false;
|
|
|
|
|
|
|
|
|
1118 |
|
1119 |
-
$
|
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(
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
|
|
|
|
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 (
|
1155 |
$image = wp_get_attachment_image_src( $id, 'large' );
|
1156 |
-
$alt
|
1157 |
break;
|
1158 |
}
|
1159 |
}
|
1160 |
|
1161 |
/* Return the image URL. */
|
|
|
1162 |
return $image[0];
|
1163 |
|
1164 |
}
|
@@ -1170,113 +1365,132 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1170 |
} else {
|
1171 |
$post = $p;
|
1172 |
}
|
1173 |
-
|
1174 |
/* Search the post's content for the <img /> tag and get its URL. */
|
1175 |
preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
|
1176 |
|
1177 |
/* If there is a match for the image, return its URL. */
|
1178 |
-
if ( isset( $matches ) && !empty( $matches[1][0] ) )
|
1179 |
return $matches[1][0];
|
|
|
1180 |
|
1181 |
return false;
|
1182 |
}
|
1183 |
-
|
1184 |
/** crude approximization of whether current user is an admin */
|
1185 |
function is_admin() {
|
1186 |
return current_user_can( 'level_8' );
|
1187 |
}
|
1188 |
-
|
1189 |
function help_text_helper( &$default_options, $options, $help_link = '' ) {
|
1190 |
-
foreach( $options as $o ) {
|
1191 |
$ht = '';
|
1192 |
-
if ( !empty( $this->help_text[$o] ) )
|
1193 |
-
$ht = $this->help_text[$o];
|
1194 |
-
elseif ( !empty( $default_options[$o][
|
1195 |
-
$ht = $default_options[$o][
|
1196 |
-
|
|
|
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] ) )
|
1203 |
-
|
|
|
|
|
1204 |
$hl = substr( $hl, 0, $pos );
|
1205 |
}
|
1206 |
-
if (
|
1207 |
-
|
1208 |
-
|
|
|
|
|
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 ) )
|
1241 |
-
|
|
|
|
|
|
|
|
|
1242 |
$prefix = $this->get_prefix();
|
1243 |
-
$bail
|
1244 |
-
if ( $bail )
|
|
|
|
|
1245 |
$this->form = 'post';
|
1246 |
-
if ( $screen->base == 'term' || $screen->base == 'edit-tags' )
|
1247 |
-
|
|
|
|
|
|
|
|
|
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',
|
1257 |
-
add_action(
|
1258 |
-
add_action(
|
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 ) )
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
|
|
|
|
|
|
1274 |
}
|
1275 |
-
|
1276 |
/**
|
1277 |
* Load scripts for module, can pass data to module script.
|
1278 |
*/
|
1279 |
-
function enqueue_scripts(
|
1280 |
wp_enqueue_script( 'sack' );
|
1281 |
wp_enqueue_script( 'jquery' );
|
1282 |
wp_enqueue_script( 'media-upload' );
|
@@ -1284,198 +1498,267 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1284 |
wp_enqueue_script( 'common' );
|
1285 |
wp_enqueue_script( 'wp-lists' );
|
1286 |
wp_enqueue_script( 'postbox' );
|
1287 |
-
if ( !empty( $this->pointers ) ) {
|
1288 |
wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
|
1289 |
}
|
1290 |
-
wp_enqueue_script( 'aioseop-module-script', AIOSEOP_PLUGIN_URL . 'js/modules/aioseop_module.js',
|
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 =
|
|
|
|
|
|
|
1299 |
}
|
1300 |
-
if ( empty( $this->
|
1301 |
-
if ( !empty( $this->pointers ) )
|
1302 |
$this->script_data['pointers'] = $this->pointers;
|
1303 |
-
|
1304 |
-
if ( empty( $
|
1305 |
-
|
|
|
|
|
|
|
|
|
|
|
1306 |
$data[0]['condshow'] = array_merge( $data[0]['condshow'], $condshow );
|
1307 |
unset( $this->script_data['condshow'] );
|
1308 |
-
$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 |
-
|
1340 |
-
add_action(
|
1341 |
-
|
1342 |
-
|
|
|
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 =
|
1354 |
-
$url
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1364 |
if ( $v['type'] === 'settings' ) {
|
1365 |
if ( $k === 'default' ) {
|
1366 |
-
array_unshift( $links, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
1367 |
} else {
|
1368 |
-
if ( !empty( $v['menu_name'] ) )
|
1369 |
$name = $v['menu_name'];
|
1370 |
-
else
|
1371 |
$name = $v['name'];
|
1372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 ),
|
1406 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
1417 |
} else {
|
1418 |
-
if ( !empty( $v['menu_name'] ) )
|
1419 |
$name = $v['menu_name'];
|
1420 |
-
else
|
1421 |
$name = $v['name'];
|
1422 |
-
|
|
|
|
|
|
|
|
|
1423 |
}
|
1424 |
-
add_action( "load-{$hookname}",
|
1425 |
} elseif ( $v['type'] === 'metabox' ) {
|
1426 |
$this->setting_options( $k ); // hack -- make sure this runs anyhow, for now -- pdb
|
1427 |
-
add_action( 'edit_post',
|
1428 |
-
add_action( 'publish_post',
|
1429 |
-
add_action( 'add_attachment',
|
1430 |
-
add_action( 'edit_attachment',
|
1431 |
-
add_action( 'save_post',
|
1432 |
-
add_action( 'edit_page_form',
|
1433 |
-
if ( isset( $v['display'] ) && !empty( $v['display'] ) ) {
|
1434 |
-
add_action(
|
1435 |
-
if ( $this->tabbed_metaboxes )
|
1436 |
-
add_filter( 'aioseop_add_post_metabox',
|
|
|
1437 |
foreach ( $v['display'] as $posttype ) {
|
1438 |
$v['location'] = $k;
|
1439 |
$v['posttype'] = $posttype;
|
1440 |
-
if ( !isset($v['context']
|
1441 |
-
|
|
|
|
|
|
|
|
|
1442 |
if ( $this->tabbed_metaboxes ) {
|
1443 |
-
$this->post_metaboxes[] =
|
1444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1445 |
} else {
|
1446 |
$title = $v['name'];
|
1447 |
-
if ( $title != $this->plugin_name )
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 )
|
|
|
|
|
1464 |
if ( $this->locations !== null ) {
|
1465 |
-
foreach( $this->locations as $k => $v ) {
|
1466 |
-
if ( isset($v['type']) && ( $v['type'] === 'metabox' ) ) {
|
1467 |
-
$opts
|
1468 |
-
$options =
|
1469 |
-
$update
|
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
|
1475 |
}
|
1476 |
}
|
1477 |
if ( $update ) {
|
1478 |
-
$prefix
|
1479 |
$options = apply_filters( $prefix . 'filter_metabox_options', $options, $k, $post_id );
|
1480 |
update_post_meta( $post_id, '_' . $prefix . $k, $options );
|
1481 |
}
|
@@ -1483,244 +1766,343 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1483 |
}
|
1484 |
}
|
1485 |
}
|
1486 |
-
|
1487 |
/**
|
1488 |
* Outputs radio buttons, checkboxes, selects, multiselects, handles groups.
|
1489 |
-
*/
|
1490 |
function do_multi_input( $args ) {
|
1491 |
extract( $args );
|
1492 |
$buf1 = '';
|
1493 |
$type = $options['type'];
|
1494 |
if ( ( $type == 'radio' ) || ( $type == 'checkbox' ) ) {
|
1495 |
-
$strings =
|
1496 |
-
'block'
|
1497 |
-
'group'
|
1498 |
-
'item'
|
1499 |
-
'item_args' =>
|
1500 |
-
'selected'
|
1501 |
-
|
1502 |
} else {
|
1503 |
-
$strings =
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
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 (
|
|
|
|
|
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 |
-
|
1526 |
-
|
|
|
1527 |
$cmp = ( $value == $v );
|
1528 |
-
|
|
|
1529 |
$sel = $setsel;
|
1530 |
-
|
1531 |
-
|
|
|
|
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1553 |
$value = esc_attr( $value );
|
1554 |
-
|
|
|
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'] ) )
|
|
|
|
|
1562 |
switch ( $options['type'] ) {
|
1563 |
-
case 'multiselect':
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
case '
|
1568 |
-
|
1569 |
-
|
1570 |
-
case '
|
1571 |
-
|
1572 |
-
|
1573 |
-
case '
|
1574 |
-
|
1575 |
-
|
1576 |
-
case '
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1580 |
$size = 60;
|
1581 |
-
if ( isset( $options['size'] ) )
|
1582 |
-
|
1583 |
-
|
|
|
|
|
|
|
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 |
-
|
1588 |
-
|
1589 |
-
|
|
|
|
|
|
|
1590 |
}
|
|
|
1591 |
return $buf;
|
1592 |
}
|
1593 |
-
|
1594 |
-
const DISPLAY_HELP_START
|
1595 |
-
const DISPLAY_HELP_END
|
1596 |
-
const DISPLAY_LABEL_FORMAT
|
1597 |
-
const DISPLAY_TOP_LABEL
|
1598 |
-
const DISPLAY_ROW_TEMPLATE
|
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
|
1607 |
-
else
|
1608 |
$align = 'right';
|
1609 |
-
|
1610 |
-
if ( $opts['
|
|
|
|
|
|
|
1611 |
if ( isset( $opts['help_text'] ) ) {
|
1612 |
-
$help_text
|
1613 |
-
$help_text_2 = sprintf(
|
1614 |
-
} else
|
|
|
|
|
1615 |
$label_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_LABEL_FORMAT, $align, $help_text );
|
1616 |
-
} else
|
1617 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1688 |
}
|
1689 |
}
|
1690 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1691 |
}
|
1692 |
-
|
1693 |
function sanitize_domain( $domain ) {
|
1694 |
$domain = trim( $domain );
|
1695 |
$domain = $this->strtolower( $domain );
|
1696 |
-
if ( $this->strpos( $domain,
|
1697 |
-
|
|
|
|
|
|
|
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':
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
case '
|
|
|
|
|
|
|
|
|
1720 |
case 'checkbox':
|
1721 |
case 'radio':
|
1722 |
case 'select':
|
1723 |
-
default:
|
|
|
|
|
|
|
1724 |
}
|
1725 |
}
|
1726 |
}
|
@@ -1739,39 +2121,43 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1739 |
function reset_options( $location = null, $delete = false ) {
|
1740 |
if ( $delete === true ) {
|
1741 |
$this->delete_class_option( $delete );
|
1742 |
-
$this->options =
|
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 |
-
|
|
|
1756 |
$nonce = $_POST['nonce-aioseop'];
|
1757 |
-
if (!wp_verify_nonce($nonce, 'aioseop-nonce')
|
|
|
|
|
1758 |
if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) {
|
1759 |
-
$message = __(
|
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
|
1769 |
$default_options = $this->default_options( $location );
|
1770 |
-
foreach( $default_options as $k => $v ) {
|
1771 |
-
if ( isset( $_POST[$k] ) )
|
1772 |
-
$this->options[$k] = stripslashes_deep( $_POST[$k] );
|
1773 |
-
else
|
1774 |
-
$this->options[$k] = '';
|
|
|
1775 |
}
|
1776 |
$this->sanitize_options( $location );
|
1777 |
$this->options = apply_filters( $this->prefix . 'update_options', $this->options, $location );
|
@@ -1780,202 +2166,312 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1780 |
}
|
1781 |
do_action( $this->prefix . 'settings_update', $this->options, $location );
|
1782 |
}
|
|
|
1783 |
return $message;
|
1784 |
}
|
1785 |
|
1786 |
/** Update / reset settings, printing options, sanitizing, posting back */
|
1787 |
function display_settings_page( $location = null ) {
|
1788 |
-
|
1789 |
-
$
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
$
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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') . ' »' ),
|
1815 |
-
'Submit_Default'=> Array( 'type' => 'submit', 'class' => 'button-secondary', 'value' => __( sprintf( 'Reset %s Settings to Defaults', $name ), 'all-in-one-seo-pack') . ' »' )
|
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 |
-
|
1828 |
-
|
|
|
|
|
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' ) .
|
1835 |
-
|
1836 |
-
|
|
|
|
|
|
|
|
|
1837 |
}
|
1838 |
}
|
1839 |
-
} else
|
|
|
|
|
|
|
|
|
|
|
1840 |
do_meta_boxes( "{$this->prefix}settings", 'advanced', $location );
|
1841 |
-
?>
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1851 |
</form>
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
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
|
1872 |
-
if ( $location == null || $this->locations[$location]['options'] === null )
|
1873 |
$options = $defaults;
|
1874 |
-
else {
|
1875 |
-
$options =
|
1876 |
-
$prefix
|
1877 |
-
if ( !empty( $this->locations[$location]['default_options'] ) )
|
1878 |
-
$options = $this->locations[$location]['default_options'];
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
if (
|
1892 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1893 |
if ( isset( $v['condshow'] ) ) {
|
1894 |
-
if ( !is_array( $this->script_data ) )
|
1895 |
-
|
1896 |
-
|
|
|
|
|
|
|
|
|
1897 |
}
|
1898 |
if ( $v['type'] == 'submit' ) {
|
1899 |
-
if ( !isset($v['save'] ) )
|
1900 |
-
|
1901 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1902 |
} else {
|
1903 |
-
if ( !isset($v['label'] ) )
|
|
|
|
|
1904 |
}
|
1905 |
if ( $v['type'] == 'hidden' ) {
|
1906 |
-
if ( !isset($v['label']) )
|
1907 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1908 |
}
|
1909 |
-
if ( ( $v['type'] == 'text' ) && ( !isset( $v['size'] ) ) ) $v['size'] = 57;
|
1910 |
if ( $v['type'] == 'textarea' ) {
|
1911 |
-
if ( !isset($v['cols']))
|
1912 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
1928 |
-
foreach ( $options as $k => $v )
|
|
|
|
|
|
|
|
|
|
|
1929 |
return $opts;
|
1930 |
}
|
1931 |
-
|
1932 |
/** Gets the current options stored for a given location. */
|
1933 |
-
function get_current_options( $opts =
|
1934 |
-
$prefix
|
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 =
|
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 ===
|
1976 |
$get_opts = $this->default_options( $location, $defaults );
|
1977 |
-
else
|
1978 |
-
$this->setting_options( $location, $defaults );
|
|
|
1979 |
$this->options = wp_parse_args( $opts, $get_opts );
|
1980 |
}
|
1981 |
}
|
5 |
/**
|
6 |
* The module base class; handles settings, options, menus, metaboxes, etc.
|
7 |
*/
|
8 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
9 |
abstract class All_in_One_SEO_Pack_Module {
|
10 |
public static $instance = null;
|
11 |
protected $plugin_name;
|
16 |
protected $options;
|
17 |
protected $option_name;
|
18 |
protected $default_options;
|
19 |
+
protected $help_text = array();
|
20 |
+
protected $help_anchors = array();
|
21 |
+
protected $locations = null; // organize settings into settings pages with a menu items and/or metaboxes on post types edit screen; optional
|
22 |
+
protected $layout = null; // organize settings on a settings page into multiple, separate metaboxes; optional
|
23 |
+
protected $tabs = null; // organize layouts on a settings page into multiple, separate tabs; optional
|
24 |
+
protected $current_tab = null; // the current tab
|
25 |
+
protected $pagehook = null; // the current page hook
|
26 |
protected $store_option = false;
|
27 |
protected $parent_option = 'aioseop_options';
|
28 |
+
protected $post_metaboxes = array();
|
29 |
protected $tabbed_metaboxes = true;
|
30 |
protected $credentials = false; // used for WP Filesystem
|
31 |
+
protected $script_data = null; // used for passing data to JavaScript
|
32 |
protected $plugin_path = null;
|
33 |
+
protected $pointers = array();
|
34 |
protected $form = 'dofollow';
|
35 |
+
|
36 |
/**
|
37 |
* Handles calls to display_settings_page_{$location}, does error checking.
|
38 |
*/
|
39 |
function __call( $name, $arguments ) {
|
40 |
+
if ( $this->strpos( $name, 'display_settings_page_' ) === 0 ) {
|
41 |
return $this->display_settings_page( $this->substr( $name, 22 ) );
|
42 |
+
}
|
43 |
$error = __( sprintf( "Method %s doesn't exist", $name ), 'all-in-one-seo-pack' );
|
44 |
+
if ( class_exists( 'BadMethodCallException' ) ) {
|
45 |
throw new BadMethodCallException( $error );
|
46 |
+
}
|
47 |
throw new Exception( $error );
|
48 |
}
|
49 |
+
|
50 |
function __construct() {
|
51 |
+
if ( empty( $this->file ) ) {
|
52 |
+
$this->file = __FILE__;
|
53 |
+
}
|
54 |
$this->plugin_name = AIOSEOP_PLUGIN_NAME;
|
55 |
+
$this->plugin_path = array();
|
56 |
// $this->plugin_path['dir'] = plugin_dir_path( $this->file );
|
57 |
+
$this->plugin_path['basename'] = plugin_basename( $this->file );
|
58 |
+
$this->plugin_path['dirname'] = dirname( $this->plugin_path['basename'] );
|
59 |
+
$this->plugin_path['url'] = plugin_dir_url( $this->file );
|
60 |
+
$this->plugin_path['images_url'] = $this->plugin_path['url'] . 'images';
|
61 |
$this->script_data['plugin_path'] = $this->plugin_path;
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
* Get options for module, stored individually or together.
|
66 |
*/
|
67 |
+
function get_class_option() {
|
68 |
$option_name = $this->get_option_name();
|
69 |
if ( $this->store_option || $option_name == $this->parent_option ) {
|
70 |
return get_option( $option_name );
|
71 |
} else {
|
72 |
$option = get_option( $this->parent_option );
|
73 |
+
if ( isset( $option['modules'] ) && isset( $option['modules'][ $option_name ] ) ) {
|
74 |
+
return $option['modules'][ $option_name ];
|
75 |
+
}
|
76 |
}
|
77 |
+
|
78 |
return false;
|
79 |
}
|
80 |
|
82 |
* Update options for module, stored individually or together.
|
83 |
*/
|
84 |
function update_class_option( $option_data, $option_name = false ) {
|
85 |
+
if ( $option_name == false ) {
|
86 |
$option_name = $this->get_option_name();
|
87 |
+
}
|
88 |
if ( $this->store_option || $option_name == $this->parent_option ) {
|
89 |
return update_option( $option_name, $option_data );
|
90 |
} else {
|
91 |
$option = get_option( $this->parent_option );
|
92 |
+
if ( ! isset( $option['modules'] ) ) {
|
93 |
+
$option['modules'] = array();
|
94 |
+
}
|
95 |
+
$option['modules'][ $option_name ] = $option_data;
|
96 |
+
|
97 |
return update_option( $this->parent_option, $option );
|
98 |
}
|
99 |
}
|
100 |
+
|
101 |
/**
|
102 |
* Delete options for module, stored individually or together.
|
103 |
*/
|
107 |
delete_option( $option_name );
|
108 |
} else {
|
109 |
$option = get_option( $this->parent_option );
|
110 |
+
if ( isset( $option['modules'] ) && isset( $option['modules'][ $option_name ] ) ) {
|
111 |
+
unset( $option['modules'][ $option_name ] );
|
112 |
+
|
113 |
return update_option( $this->parent_option, $option );
|
114 |
}
|
115 |
}
|
116 |
+
|
117 |
return false;
|
118 |
}
|
119 |
|
121 |
* Get the option name with prefix.
|
122 |
*/
|
123 |
function get_option_name() {
|
124 |
+
if ( ! isset( $this->option_name ) || empty( $this->option_name ) ) {
|
125 |
$this->option_name = $this->prefix . 'options';
|
126 |
+
}
|
127 |
+
|
128 |
return $this->option_name;
|
129 |
}
|
130 |
|
133 |
*/
|
134 |
function option_isset( $option, $location = null ) {
|
135 |
$prefix = $this->get_prefix( $location );
|
136 |
+
$opt = $prefix . $option;
|
137 |
+
|
138 |
+
return ( isset( $this->options[ $opt ] ) && $this->options[ $opt ] );
|
139 |
}
|
140 |
+
|
141 |
/*** Case conversion; handle non UTF-8 encodings and fallback ***/
|
142 |
|
143 |
function convert_case( $str, $mode = 'upper' ) {
|
144 |
static $charset = null;
|
145 |
+
if ( $charset == null ) {
|
146 |
+
$charset = get_bloginfo( 'charset' );
|
147 |
+
}
|
148 |
+
$str = (string) $str;
|
149 |
if ( $mode == 'title' ) {
|
150 |
+
if ( function_exists( 'mb_convert_case' ) ) {
|
151 |
return mb_convert_case( $str, MB_CASE_TITLE, $charset );
|
152 |
+
} else {
|
153 |
return ucwords( $str );
|
154 |
+
}
|
155 |
}
|
156 |
+
|
157 |
if ( $charset == 'UTF-8' ) {
|
158 |
global $UTF8_TABLES;
|
159 |
include_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_UTF8.php' );
|
160 |
if ( is_array( $UTF8_TABLES ) ) {
|
161 |
+
if ( $mode == 'upper' ) {
|
162 |
+
return strtr( $str, $UTF8_TABLES['strtoupper'] );
|
163 |
+
}
|
164 |
+
if ( $mode == 'lower' ) {
|
165 |
+
return strtr( $str, $UTF8_TABLES['strtolower'] );
|
166 |
+
}
|
167 |
}
|
168 |
}
|
169 |
+
|
170 |
if ( $mode == 'upper' ) {
|
171 |
+
if ( function_exists( 'mb_strtoupper' ) ) {
|
172 |
return mb_strtoupper( $str, $charset );
|
173 |
+
} else {
|
174 |
return strtoupper( $str );
|
175 |
+
}
|
176 |
}
|
177 |
|
178 |
if ( $mode == 'lower' ) {
|
179 |
+
if ( function_exists( 'mb_strtolower' ) ) {
|
180 |
return mb_strtolower( $str, $charset );
|
181 |
+
} else {
|
182 |
return strtolower( $str );
|
183 |
+
}
|
184 |
}
|
185 |
+
|
186 |
return $str;
|
187 |
}
|
188 |
|
189 |
+
/**
|
190 |
* Convert a string to lower case
|
191 |
* Compatible with mb_strtolower(), an UTF-8 friendly replacement for strtolower()
|
192 |
*/
|
194 |
return $this->convert_case( $str, 'lower' );
|
195 |
}
|
196 |
|
197 |
+
/**
|
198 |
* Convert a string to upper case
|
199 |
* Compatible with mb_strtoupper(), an UTF-8 friendly replacement for strtoupper()
|
200 |
*/
|
202 |
return $this->convert_case( $str, 'upper' );
|
203 |
}
|
204 |
|
205 |
+
/**
|
206 |
* Convert a string to title case
|
207 |
* Compatible with mb_convert_case(), an UTF-8 friendly replacement for ucwords()
|
208 |
*/
|
209 |
function ucwords( $str ) {
|
210 |
return $this->convert_case( $str, 'title' );
|
211 |
}
|
212 |
+
|
213 |
/**
|
214 |
* Wrapper for strlen() - uses mb_strlen() if possible.
|
215 |
+
*/
|
216 |
function strlen( $string ) {
|
217 |
+
if ( function_exists( 'mb_strlen' ) ) {
|
218 |
return mb_strlen( $string );
|
219 |
+
}
|
220 |
+
|
221 |
return strlen( $string );
|
222 |
}
|
223 |
|
226 |
*/
|
227 |
function substr( $string, $start = 0, $length = 2147483647 ) {
|
228 |
$args = func_get_args();
|
229 |
+
if ( function_exists( 'mb_substr' ) ) {
|
230 |
return call_user_func_array( 'mb_substr', $args );
|
231 |
+
}
|
232 |
+
|
233 |
return call_user_func_array( 'substr', $args );
|
234 |
}
|
235 |
+
|
236 |
/**
|
237 |
* Wrapper for strpos() - uses mb_strpos() if possible.
|
238 |
*/
|
239 |
function strpos( $haystack, $needle, $offset = 0 ) {
|
240 |
+
if ( function_exists( 'mb_strpos' ) ) {
|
241 |
return mb_strpos( $haystack, $needle, $offset );
|
242 |
+
}
|
243 |
+
|
244 |
return strpos( $haystack, $needle, $offset );
|
245 |
}
|
246 |
+
|
247 |
/**
|
248 |
* Wrapper for strrpos() - uses mb_strrpos() if possible.
|
249 |
*/
|
250 |
function strrpos( $haystack, $needle, $offset = 0 ) {
|
251 |
+
if ( function_exists( 'mb_strrpos' ) ) {
|
252 |
return mb_strrpos( $haystack, $needle, $offset );
|
253 |
+
}
|
254 |
+
|
255 |
return strrpos( $haystack, $needle, $offset );
|
256 |
}
|
257 |
|
258 |
/**
|
259 |
+
* convert xml string to php array - useful to get a serializable value
|
260 |
+
*
|
261 |
+
* @param string $xmlstr
|
262 |
+
*
|
263 |
+
* @return array
|
264 |
+
*
|
265 |
+
* @author Adrien aka Gaarf & contributors
|
266 |
+
* @see http://gaarf.info/2009/08/13/xml-string-to-php-array/
|
267 |
+
*/
|
268 |
function html_string_to_array( $xmlstr ) {
|
269 |
+
if ( ! class_exists( 'DOMDocument' ) ) {
|
270 |
+
return array();
|
271 |
+
} else {
|
272 |
+
$doc = new DOMDocument();
|
273 |
+
$doc->loadHTML( $xmlstr );
|
274 |
+
|
275 |
+
return $this->domnode_to_array( $doc->documentElement );
|
276 |
+
}
|
277 |
}
|
278 |
|
279 |
function xml_string_to_array( $xmlstr ) {
|
280 |
+
if ( ! class_exists( 'DOMDocument' ) ) {
|
281 |
+
return array();
|
282 |
+
} else {
|
283 |
+
$doc = new DOMDocument();
|
284 |
+
$doc->loadXML( $xmlstr );
|
285 |
+
|
286 |
+
return $this->domnode_to_array( $doc->documentElement );
|
287 |
+
}
|
288 |
}
|
289 |
|
290 |
function domnode_to_array( $node ) {
|
291 |
+
switch ( $node->nodeType ) {
|
292 |
+
case XML_CDATA_SECTION_NODE:
|
293 |
+
case XML_TEXT_NODE:
|
294 |
+
return trim( $node->textContent );
|
295 |
+
break;
|
296 |
+
case XML_ELEMENT_NODE:
|
297 |
+
$output = array();
|
298 |
+
for ( $i = 0, $m = $node->childNodes->length; $i < $m; $i ++ ) {
|
299 |
+
$child = $node->childNodes->item( $i );
|
300 |
+
$v = $this->domnode_to_array( $child );
|
301 |
+
if ( isset( $child->tagName ) ) {
|
302 |
+
$t = $child->tagName;
|
303 |
+
if ( ! isset( $output[ $t ] ) ) {
|
304 |
+
$output[ $t ] = array();
|
305 |
+
}
|
306 |
+
if ( is_array( $output ) ) {
|
307 |
+
$output[ $t ][] = $v;
|
308 |
+
}
|
309 |
+
} elseif ( $v || $v === '0' ) {
|
310 |
+
$output = (string) $v;
|
311 |
+
}
|
312 |
+
}
|
313 |
+
if ( $node->attributes->length && ! is_array( $output ) ) //Has attributes but isn't an array
|
314 |
+
{
|
315 |
+
$output = array( '@content' => $output );
|
316 |
+
} //Change output into an array.
|
317 |
+
if ( is_array( $output ) ) {
|
318 |
+
if ( $node->attributes->length ) {
|
319 |
+
$a = array();
|
320 |
+
foreach ( $node->attributes as $attrName => $attrNode ) {
|
321 |
+
$a[ $attrName ] = (string) $attrNode->value;
|
322 |
+
}
|
323 |
+
$output['@attributes'] = $a;
|
324 |
+
}
|
325 |
+
foreach ( $output as $t => $v ) {
|
326 |
+
if ( is_array( $v ) && count( $v ) == 1 && $t != '@attributes' ) {
|
327 |
+
$output[ $t ] = $v[0];
|
328 |
+
}
|
329 |
+
}
|
330 |
+
}
|
331 |
+
}
|
332 |
+
if ( empty( $output ) ) {
|
333 |
+
return '';
|
334 |
+
}
|
335 |
+
|
336 |
+
return $output;
|
337 |
+
}
|
338 |
+
|
339 |
/*** adds support for using %cf_(name of field)% for using custom fields / Advanced Custom Fields in titles / descriptions etc. ***/
|
340 |
function apply_cf_fields( $format ) {
|
341 |
+
return preg_replace_callback( '/%cf_([^%]*?)%/', array( $this, 'cf_field_replace' ), $format );
|
342 |
}
|
343 |
|
344 |
function cf_field_replace( $matches ) {
|
345 |
$result = '';
|
346 |
+
if ( ! empty( $matches ) ) {
|
347 |
+
if ( ! empty( $matches[1] ) ) {
|
348 |
+
if ( function_exists( 'get_field' ) ) {
|
349 |
+
$result = get_field( $matches[1] );
|
350 |
+
}
|
351 |
if ( empty( $result ) ) {
|
352 |
global $post;
|
353 |
+
if ( ! empty( $post ) ) {
|
354 |
+
$result = get_post_meta( $post->ID, $matches[1], true );
|
355 |
+
}
|
356 |
+
}
|
357 |
+
if ( empty( $result ) ) {
|
358 |
+
$result = $matches[0];
|
359 |
}
|
360 |
+
} else {
|
361 |
+
$result = $matches[0];
|
362 |
+
}
|
363 |
}
|
364 |
$result = strip_tags( $result );
|
365 |
+
|
366 |
return $result;
|
367 |
}
|
368 |
+
|
369 |
/**
|
370 |
* Returns child blogs of parent in a multisite.
|
371 |
*/
|
373 |
global $wpdb, $blog_id;
|
374 |
$site_id = $wpdb->siteid;
|
375 |
if ( is_multisite() ) {
|
376 |
+
if ( $site_id != $blog_id ) {
|
377 |
+
return false;
|
378 |
+
}
|
379 |
+
|
380 |
return $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = {$blog_id} AND site_id != blog_id" );
|
381 |
}
|
382 |
+
|
383 |
return false;
|
384 |
}
|
385 |
+
|
386 |
/**
|
387 |
* Checks if the plugin is active on a given blog by blogid on a multisite.
|
388 |
*/
|
389 |
function is_aioseop_active_on_blog( $bid = false ) {
|
390 |
global $blog_id;
|
391 |
+
if ( empty( $bid ) || ( $bid == $blog_id ) || ! is_multisite() ) {
|
392 |
+
return true;
|
393 |
+
}
|
394 |
+
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
|
395 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
396 |
+
}
|
397 |
+
if ( is_plugin_active_for_network( AIOSEOP_PLUGIN_BASENAME ) ) {
|
398 |
+
return true;
|
399 |
+
}
|
400 |
+
|
401 |
return in_array( AIOSEOP_PLUGIN_BASENAME, (array) get_blog_option( $bid, 'active_plugins', array() ) );
|
402 |
}
|
403 |
+
|
404 |
function quote_list_for_regex( $list, $quote = '/' ) {
|
405 |
$regex = '';
|
406 |
+
$cont = 0;
|
407 |
+
foreach ( $list as $l ) {
|
408 |
+
if ( $cont ) {
|
409 |
+
$regex .= '|';
|
410 |
+
}
|
411 |
+
$cont = 1;
|
412 |
+
$regex .= preg_quote( trim( $l ), $quote );
|
413 |
}
|
414 |
+
|
415 |
return $regex;
|
416 |
}
|
417 |
+
|
418 |
// original code thanks to Sean M. Brown -- http://smbrown.wordpress.com/2009/04/29/verify-googlebot-forward-reverse-dns/
|
419 |
function is_good_bot() {
|
420 |
+
$botlist = array(
|
421 |
+
'Yahoo! Slurp' => 'crawl.yahoo.net',
|
422 |
+
'googlebot' => '.googlebot.com',
|
423 |
+
'msnbot' => 'search.msn.com'
|
424 |
);
|
425 |
+
$botlist = apply_filters( $this->prefix . 'botlist', $botlist );
|
426 |
+
if ( ! empty( $botlist ) ) {
|
427 |
+
if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
|
428 |
+
return false;
|
429 |
+
}
|
430 |
+
$ua = $_SERVER['HTTP_USER_AGENT'];
|
431 |
$uas = $this->quote_list_for_regex( $botlist );
|
432 |
+
if ( preg_match( '/' . $uas . '/i', $ua ) ) {
|
433 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
434 |
+
$hostname = gethostbyaddr( $ip );
|
435 |
$ip_by_hostname = gethostbyname( $hostname );
|
436 |
+
if ( $ip_by_hostname == $ip ) {
|
437 |
$hosts = array_values( $botlist );
|
438 |
+
foreach ( $hosts as $k => $h ) {
|
439 |
+
$hosts[ $k ] = preg_quote( $h ) . '$';
|
440 |
+
}
|
441 |
$hosts = join( '|', $hosts );
|
442 |
+
if ( preg_match( '/' . $hosts . '/i', $hostname ) ) {
|
443 |
return true;
|
444 |
+
}
|
445 |
}
|
446 |
}
|
447 |
+
|
448 |
return false;
|
449 |
}
|
450 |
}
|
451 |
+
|
452 |
function default_bad_bots() {
|
453 |
+
$botlist = array(
|
454 |
+
'Abonti',
|
455 |
+
'aggregator',
|
456 |
+
'AhrefsBot',
|
457 |
+
'asterias',
|
458 |
+
'BDCbot',
|
459 |
+
'BLEXBot',
|
460 |
+
'BuiltBotTough',
|
461 |
+
'Bullseye',
|
462 |
+
'BunnySlippers',
|
463 |
+
'ca-crawler',
|
464 |
+
'CCBot',
|
465 |
+
'Cegbfeieh',
|
466 |
+
'CheeseBot',
|
467 |
+
'CherryPicker',
|
468 |
+
'CopyRightCheck',
|
469 |
+
'cosmos',
|
470 |
+
'Crescent',
|
471 |
+
'discobot',
|
472 |
+
'DittoSpyder',
|
473 |
+
'DotBot',
|
474 |
+
'Download Ninja',
|
475 |
+
'EasouSpider',
|
476 |
+
'EmailCollector',
|
477 |
+
'EmailSiphon',
|
478 |
+
'EmailWolf',
|
479 |
+
'EroCrawler',
|
480 |
+
'Exabot',
|
481 |
+
'ExtractorPro',
|
482 |
+
'Fasterfox',
|
483 |
+
'FeedBooster',
|
484 |
+
'Foobot',
|
485 |
+
'Genieo',
|
486 |
+
'grub-client',
|
487 |
+
'Harvest',
|
488 |
+
'hloader',
|
489 |
+
'httplib',
|
490 |
+
'HTTrack',
|
491 |
+
'humanlinks',
|
492 |
+
'ieautodiscovery',
|
493 |
+
'InfoNaviRobot',
|
494 |
+
'IstellaBot',
|
495 |
+
'Java/1.',
|
496 |
+
'JennyBot',
|
497 |
+
'k2spider',
|
498 |
+
'Kenjin Spider',
|
499 |
+
'Keyword Density/0.9',
|
500 |
+
'larbin',
|
501 |
+
'LexiBot',
|
502 |
+
'libWeb',
|
503 |
+
'libwww',
|
504 |
+
'LinkextractorPro',
|
505 |
+
'linko',
|
506 |
+
'LinkScan/8.1a Unix',
|
507 |
+
'LinkWalker',
|
508 |
+
'LNSpiderguy',
|
509 |
+
'lwp-trivial',
|
510 |
+
'magpie',
|
511 |
+
'Mata Hari',
|
512 |
'MaxPointCrawler',
|
513 |
'MegaIndex',
|
514 |
+
'Microsoft URL Control',
|
515 |
+
'MIIxpc',
|
516 |
+
'Mippin',
|
517 |
+
'Missigua Locator',
|
518 |
+
'Mister PiX',
|
519 |
+
'MJ12bot',
|
520 |
+
'moget',
|
521 |
+
'MSIECrawler',
|
522 |
+
'NetAnts',
|
523 |
+
'NICErsPRO',
|
524 |
+
'Niki-Bot',
|
525 |
+
'NPBot',
|
526 |
+
'Nutch',
|
527 |
+
'Offline Explorer',
|
528 |
+
'Openfind',
|
529 |
'panscient.com',
|
530 |
+
'PHP/5.{',
|
531 |
+
'ProPowerBot/2.14',
|
532 |
+
'ProWebWalker',
|
533 |
+
'Python-urllib',
|
534 |
+
'QueryN Metasearch',
|
535 |
+
'RepoMonkey',
|
536 |
+
'RMA',
|
537 |
'SemrushBot',
|
538 |
+
'SeznamBot',
|
539 |
+
'SISTRIX',
|
540 |
+
'sitecheck.Internetseer.com',
|
541 |
+
'SiteSnagger',
|
542 |
+
'SnapPreviewBot',
|
543 |
+
'Sogou',
|
544 |
+
'SpankBot',
|
545 |
+
'spanner',
|
546 |
+
'spbot',
|
547 |
+
'Spinn3r',
|
548 |
+
'suzuran',
|
549 |
+
'Szukacz/1.4',
|
550 |
+
'Teleport',
|
551 |
+
'Telesoft',
|
552 |
+
'The Intraformant',
|
553 |
+
'TheNomad',
|
554 |
+
'TightTwatBot',
|
555 |
+
'Titan',
|
556 |
+
'toCrawl/UrlDispatcher',
|
557 |
+
'True_Robot',
|
558 |
+
'turingos',
|
559 |
+
'TurnitinBot',
|
560 |
+
'UbiCrawler',
|
561 |
+
'UnisterBot',
|
562 |
+
'URLy Warning',
|
563 |
+
'VCI',
|
564 |
+
'WBSearchBot',
|
565 |
+
'Web Downloader/6.9',
|
566 |
+
'Web Image Collector',
|
567 |
+
'WebAuto',
|
568 |
+
'WebBandit',
|
569 |
+
'WebCopier',
|
570 |
+
'WebEnhancer',
|
571 |
+
'WebmasterWorldForumBot',
|
572 |
+
'WebReaper',
|
573 |
+
'WebSauger',
|
574 |
+
'Website Quester',
|
575 |
+
'Webster Pro',
|
576 |
+
'WebStripper',
|
577 |
+
'WebZip',
|
578 |
+
'Wotbox',
|
579 |
+
'wsr-agent',
|
580 |
+
'WWW-Collector-E',
|
581 |
+
'Xenu',
|
582 |
+
'Zao',
|
583 |
+
'Zeus',
|
584 |
+
'ZyBORG',
|
585 |
'coccoc',
|
586 |
'Incutio',
|
587 |
'lmspider',
|
591 |
'Unknown',
|
592 |
'uptime files'
|
593 |
);
|
594 |
+
|
595 |
return $botlist;
|
596 |
}
|
597 |
+
|
598 |
function is_bad_bot() {
|
599 |
$botlist = $this->default_bad_bots();
|
600 |
+
$botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
|
601 |
+
if ( ! empty( $botlist ) ) {
|
602 |
+
if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
|
603 |
+
return false;
|
604 |
+
}
|
605 |
+
$ua = $_SERVER['HTTP_USER_AGENT'];
|
606 |
$uas = $this->quote_list_for_regex( $botlist );
|
607 |
+
if ( preg_match( '/' . $uas . '/i', $ua ) ) {
|
608 |
return true;
|
609 |
}
|
610 |
}
|
611 |
+
|
612 |
return false;
|
613 |
}
|
614 |
+
|
615 |
function default_bad_referers() {
|
616 |
+
$referlist = array(
|
617 |
'semalt.com',
|
618 |
'kambasoft.com',
|
619 |
'savetubevideo.com',
|
640 |
'site3.free-share-buttons.com',
|
641 |
'webmaster-traffic.com'
|
642 |
);
|
643 |
+
|
644 |
return $referlist;
|
645 |
}
|
646 |
|
647 |
function is_bad_referer() {
|
648 |
$referlist = $this->default_bad_referers();
|
649 |
+
$referlist = apply_filters( $this->prefix . 'badreferlist', $referlist );
|
650 |
|
651 |
+
if ( ! empty( $referlist ) && ! empty( $_SERVER ) && ! empty( $_SERVER['HTTP_REFERER'] ) ) {
|
652 |
+
$ref = $_SERVER['HTTP_REFERER'];
|
653 |
$regex = $this->quote_list_for_regex( $referlist );
|
654 |
+
if ( preg_match( '/' . $regex . '/i', $ref ) ) {
|
655 |
return true;
|
656 |
}
|
657 |
}
|
658 |
+
|
659 |
return false;
|
660 |
}
|
661 |
+
|
662 |
function allow_bot() {
|
663 |
$allow_bot = true;
|
664 |
+
if ( ( ! $this->is_good_bot() ) && $this->is_bad_bot() && ! is_user_logged_in() ) {
|
665 |
$allow_bot = false;
|
666 |
+
}
|
667 |
+
|
668 |
+
return apply_filters( $this->prefix . 'allow_bot', $allow_bot );
|
669 |
}
|
670 |
|
671 |
/**
|
672 |
* Displays tabs for tabbed locations on a settings page.
|
673 |
*/
|
674 |
function display_tabs( $location ) {
|
675 |
+
if ( ( $location != null ) && isset( $locations[ $location ]['tabs'] ) ) {
|
676 |
$tabs = $locations['location']['tabs'];
|
677 |
+
} else {
|
678 |
$tabs = $this->tabs;
|
679 |
+
}
|
680 |
+
if ( ! empty( $tabs ) ) {
|
681 |
+
?>
|
682 |
+
<div class="aioseop_tabs_div"><label class="aioseop_head_nav">
|
683 |
+
<?php
|
684 |
+
foreach ( $tabs as $k => $v ) {
|
685 |
+
?>
|
686 |
+
<a class="aioseop_head_nav_tab aioseop_head_nav_<?php if ( $this->current_tab != $k ) {
|
687 |
+
echo 'in';
|
688 |
+
} ?>active"
|
689 |
+
href="<?php echo esc_url( add_query_arg( 'tab', $k ) ); ?>"><?php echo $v['name']; ?></a>
|
690 |
+
<?php
|
691 |
+
}
|
692 |
+
?>
|
693 |
</label></div>
|
694 |
<?php
|
695 |
}
|
696 |
}
|
697 |
+
|
698 |
function get_object_labels( $post_objs ) {
|
699 |
+
$pt = array_keys( $post_objs );
|
700 |
+
$post_types = array();
|
701 |
+
foreach ( $pt as $p ) {
|
702 |
+
if ( ! empty( $post_objs[ $p ]->label ) ) {
|
703 |
+
$post_types[ $p ] = $post_objs[ $p ]->label;
|
704 |
+
} else {
|
705 |
+
$post_types[ $p ] = $p;
|
706 |
+
}
|
707 |
+
}
|
708 |
+
|
709 |
return $post_types;
|
710 |
}
|
711 |
|
712 |
function get_term_labels( $post_objs ) {
|
713 |
+
$post_types = array();
|
714 |
+
foreach ( $post_objs as $p ) {
|
715 |
+
if ( ! empty( $p->name ) ) {
|
716 |
+
$post_types[ $p->term_id ] = $p->name;
|
717 |
+
}
|
718 |
+
}
|
719 |
+
|
720 |
return $post_types;
|
721 |
}
|
722 |
+
|
723 |
+
function get_post_type_titles( $args = array() ) {
|
724 |
return $this->get_object_labels( get_post_types( $args, 'objects' ) );
|
725 |
}
|
726 |
|
727 |
+
function get_taxonomy_titles( $args = array() ) {
|
728 |
return $this->get_object_labels( get_taxonomies( $args, 'objects' ) );
|
729 |
}
|
730 |
+
|
731 |
+
function get_category_titles( $args = array() ) {
|
732 |
return $this->get_term_labels( get_categories( $args ) );
|
733 |
}
|
734 |
+
|
735 |
/**
|
736 |
* Helper function for exporting settings on post data.
|
737 |
*/
|
738 |
+
function post_data_export( $prefix = '_aioseop', $query = array( 'posts_per_page' => - 1 ) ) {
|
739 |
+
$buf = '';
|
740 |
$posts_query = new WP_Query( $query );
|
741 |
+
while ( $posts_query->have_posts() ) {
|
742 |
$posts_query->the_post();
|
743 |
global $post;
|
744 |
+
$guid = $post->guid;
|
745 |
+
$type = $post->post_type;
|
746 |
+
$title = $post->post_title;
|
747 |
+
$date = $post->post_date;
|
748 |
+
$data = '';
|
749 |
$post_custom_fields = get_post_custom( $post->ID );
|
750 |
+
$has_data = null;
|
751 |
|
752 |
+
if ( is_array( $post_custom_fields ) ) {
|
753 |
+
foreach ( $post_custom_fields as $field_name => $field ) {
|
754 |
+
if ( ( $this->strpos( $field_name, $prefix ) === 0 ) && $field[0] ) {
|
755 |
$has_data = true;
|
756 |
$data .= $field_name . " = '" . $field[0] . "'\n";
|
757 |
+
}
|
758 |
}
|
759 |
}
|
760 |
+
if ( ! empty( $data ) ) {
|
761 |
+
$has_data = true;
|
762 |
+
}
|
763 |
|
764 |
+
if ( $has_data != null ) {
|
765 |
$post_info = "\n[post_data]\n\n";
|
766 |
$post_info .= "post_title = '" . $title . "'\n";
|
767 |
$post_info .= "post_guid = '" . $guid . "'\n";
|
768 |
$post_info .= "post_date = '" . $date . "'\n";
|
769 |
$post_info .= "post_type = '" . $type . "'\n";
|
770 |
+
if ( $data ) {
|
771 |
+
$buf .= $post_info . $data . "\n";
|
772 |
+
}
|
773 |
}
|
774 |
}
|
775 |
wp_reset_postdata();
|
776 |
+
|
777 |
return $buf;
|
778 |
}
|
779 |
+
|
780 |
/**
|
781 |
* Handles exporting settings data for a module.
|
782 |
*/
|
783 |
function settings_export( $buf ) {
|
784 |
+
global $aiosp;
|
785 |
+
$post_types = null;
|
786 |
+
$has_data = null;
|
787 |
$general_settings = null;
|
788 |
$exporter_choices = '';
|
789 |
+
if ( ! empty( $_REQUEST['aiosp_importer_exporter_export_choices'] ) ) {
|
790 |
+
$exporter_choices = $_REQUEST['aiosp_importer_exporter_export_choices'];
|
791 |
+
}
|
792 |
+
if ( ! empty( $exporter_choices ) && is_array( $exporter_choices ) ) {
|
793 |
+
foreach ( $exporter_choices as $ex ) {
|
794 |
+
if ( $ex == 1 ) {
|
795 |
+
$general_settings = true;
|
796 |
+
}
|
797 |
+
if ( $ex == 2 && isset( $_REQUEST['aiosp_importer_exporter_export_post_types'] ) ) {
|
798 |
+
$post_types = $_REQUEST['aiosp_importer_exporter_export_post_types'];
|
799 |
}
|
800 |
}
|
801 |
}
|
802 |
|
803 |
+
if ( ( $post_types != null ) && ( $this === $aiosp ) ) {
|
804 |
+
$buf .= $this->post_data_export( '_aioseop', array(
|
805 |
+
'posts_per_page' => - 1,
|
806 |
+
'post_type' => $post_types
|
807 |
+
) );
|
808 |
+
}
|
809 |
|
810 |
/* Add all active settings to settings file */
|
811 |
+
$name = $this->get_option_name();
|
812 |
$options = $this->get_class_option();
|
813 |
+
if ( ! empty( $options ) && $general_settings != null ) {
|
814 |
$buf .= "\n[$name]\n\n";
|
815 |
foreach ( $options as $key => $value ) {
|
816 |
+
if ( ( $name == $this->parent_option ) && ( $key == 'modules' ) ) {
|
817 |
+
continue;
|
818 |
+
} // don't re-export all module settings -- pdb
|
819 |
+
if ( is_array( $value ) ) {
|
820 |
+
$value = "'" . str_replace( array( "'", "\n", "\r" ), array(
|
821 |
+
"\'",
|
822 |
+
'\n',
|
823 |
+
'\r'
|
824 |
+
), trim( serialize( $value ) ) ) . "'";
|
825 |
+
} else {
|
826 |
+
$value = str_replace( array( "\n", "\r" ), array(
|
827 |
+
'\n',
|
828 |
+
'\r'
|
829 |
+
), trim( var_export( $value, true ) ) );
|
830 |
+
}
|
831 |
$buf .= "$key = $value\n";
|
832 |
}
|
833 |
}
|
834 |
+
|
835 |
return $buf;
|
836 |
}
|
837 |
+
|
838 |
/**
|
839 |
* Order for adding the menus for the aioseop_modules_add_menus hook.
|
840 |
*/
|
841 |
function menu_order() {
|
842 |
return 10;
|
843 |
}
|
844 |
+
|
845 |
/**
|
846 |
* Print a basic error message.
|
847 |
*/
|
848 |
function output_error( $error ) {
|
849 |
echo "<div class='aioseop_module error'>$error</div>";
|
850 |
+
|
851 |
+
return false;
|
852 |
}
|
853 |
+
|
854 |
/***
|
855 |
* Backwards compatibility - see http://php.net/manual/en/function.str-getcsv.php
|
856 |
*/
|
857 |
+
function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = "\\" ) {
|
858 |
+
$fp = fopen( 'php://memory', 'r+' );
|
859 |
fputs( $fp, $input );
|
860 |
rewind( $fp );
|
861 |
$data = fgetcsv( $fp, null, $delimiter, $enclosure ); // $escape only got added in 5.3.0
|
862 |
fclose( $fp );
|
863 |
+
|
864 |
return $data;
|
865 |
}
|
866 |
+
|
867 |
/***
|
868 |
* Helper function to convert csv in key/value pair format to an associative array.
|
869 |
*/
|
870 |
function csv_to_array( $csv ) {
|
871 |
+
$args = array();
|
872 |
+
if ( ! function_exists( 'str_getcsv' ) ) {
|
873 |
$v = $this->str_getcsv( $csv );
|
874 |
+
} else {
|
875 |
$v = str_getcsv( $csv );
|
876 |
+
}
|
877 |
$size = count( $v );
|
878 |
+
if ( is_array( $v ) && isset( $v[0] ) && $size >= 2 ) {
|
879 |
+
for ( $i = 0; $i < $size; $i += 2 ) {
|
880 |
$args[ $v[ $i ] ] = $v[ $i + 1 ];
|
881 |
+
}
|
882 |
+
}
|
883 |
+
|
884 |
return $args;
|
885 |
}
|
886 |
|
887 |
/** Allow modules to use WP Filesystem if available and desired, fall back to PHP filesystem access otherwise. */
|
888 |
function use_wp_filesystem( $method = '', $form_fields = false, $url = '', $error = false ) {
|
889 |
+
if ( empty( $method ) ) {
|
890 |
$this->credentials = request_filesystem_credentials( $url );
|
891 |
+
} else {
|
892 |
$this->credentials = request_filesystem_credentials( $url, $method, $error, false, $form_fields );
|
893 |
+
}
|
894 |
+
|
895 |
return $this->credentials;
|
896 |
}
|
897 |
+
|
898 |
/**
|
899 |
* Wrapper function to get filesystem object.
|
900 |
*/
|
901 |
+
function get_filesystem_object() {
|
902 |
$cred = get_transient( 'aioseop_fs_credentials' );
|
903 |
+
if ( ! empty( $cred ) ) {
|
904 |
+
$this->credentials = $cred;
|
905 |
+
}
|
906 |
+
|
907 |
+
if ( function_exists( 'WP_Filesystem' ) && WP_Filesystem( $this->credentials ) ) {
|
908 |
global $wp_filesystem;
|
909 |
+
|
910 |
return $wp_filesystem;
|
911 |
} else {
|
912 |
require_once( ABSPATH . 'wp-admin/includes/template.php' );
|
913 |
require_once( ABSPATH . 'wp-admin/includes/screen.php' );
|
914 |
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
915 |
|
916 |
+
if ( ! WP_Filesystem( $this->credentials ) ) {
|
917 |
$this->use_wp_filesystem();
|
918 |
+
}
|
919 |
|
920 |
+
if ( ! empty( $this->credentials ) ) {
|
921 |
set_transient( 'aioseop_fs_credentials', $this->credentials, 10800 );
|
922 |
+
}
|
923 |
global $wp_filesystem;
|
924 |
+
if ( is_object( $wp_filesystem ) ) {
|
925 |
return $wp_filesystem;
|
926 |
+
}
|
927 |
}
|
928 |
+
|
929 |
return false;
|
930 |
}
|
931 |
+
|
932 |
/**
|
933 |
* See if a file exists using WP Filesystem.
|
934 |
*/
|
935 |
function file_exists( $filename ) {
|
936 |
$wpfs = $this->get_filesystem_object();
|
937 |
+
if ( is_object( $wpfs ) ) {
|
938 |
return $wpfs->exists( $filename );
|
939 |
+
}
|
940 |
+
|
941 |
return $wpfs;
|
942 |
}
|
943 |
|
946 |
*/
|
947 |
function is_file( $filename ) {
|
948 |
$wpfs = $this->get_filesystem_object();
|
949 |
+
if ( is_object( $wpfs ) ) {
|
950 |
return $wpfs->is_file( $filename );
|
951 |
+
}
|
952 |
+
|
953 |
return $wpfs;
|
954 |
}
|
955 |
+
|
956 |
/**
|
957 |
* List files in a directory using WP Filesystem.
|
958 |
*/
|
960 |
$wpfs = $this->get_filesystem_object();
|
961 |
if ( is_object( $wpfs ) ) {
|
962 |
$dirlist = $wpfs->dirlist( $path );
|
963 |
+
if ( empty( $dirlist ) ) {
|
964 |
+
return $dirlist;
|
965 |
+
}
|
966 |
+
|
967 |
return array_keys( $dirlist );
|
968 |
}
|
969 |
+
|
970 |
+
return $wpfs;
|
971 |
}
|
972 |
+
|
973 |
/**
|
974 |
* Load a file through WP Filesystem; implement basic support for offset and maxlen.
|
975 |
*/
|
976 |
+
function load_file( $filename, $use_include_path = false, $context = null, $offset = - 1, $maxlen = - 1 ) {
|
977 |
$wpfs = $this->get_filesystem_object();
|
978 |
if ( is_object( $wpfs ) ) {
|
979 |
+
if ( ! $wpfs->exists( $filename ) ) {
|
980 |
+
return false;
|
981 |
+
}
|
982 |
if ( ( $offset > 0 ) || ( $maxlen >= 0 ) ) {
|
983 |
+
if ( $maxlen === 0 ) {
|
984 |
+
return '';
|
985 |
+
}
|
986 |
+
if ( $offset < 0 ) {
|
987 |
+
$offset = 0;
|
988 |
+
}
|
989 |
$file = $wpfs->get_contents( $filename );
|
990 |
+
if ( ! is_string( $file ) || empty( $file ) ) {
|
991 |
+
return $file;
|
992 |
+
}
|
993 |
+
if ( $maxlen < 0 ) {
|
994 |
return $this->substr( $file, $offset );
|
995 |
+
} else {
|
996 |
return $this->substr( $file, $offset, $maxlen );
|
997 |
+
}
|
998 |
} else {
|
999 |
return $wpfs->get_contents( $filename );
|
1000 |
}
|
1001 |
}
|
1002 |
+
|
1003 |
return false;
|
1004 |
}
|
1005 |
+
|
1006 |
/**
|
1007 |
* Save a file through WP Filesystem.
|
1008 |
*/
|
1009 |
function save_file( $filename, $contents ) {
|
1010 |
+
$failed_str = __( sprintf( "Failed to write file %s!\n", $filename ), 'all-in-one-seo-pack' );
|
1011 |
$readonly_str = __( sprintf( "File %s isn't writable!\n", $filename ), 'all-in-one-seo-pack' );
|
1012 |
+
$wpfs = $this->get_filesystem_object();
|
1013 |
if ( is_object( $wpfs ) ) {
|
1014 |
$file_exists = $wpfs->exists( $filename );
|
1015 |
+
if ( ! $file_exists || $wpfs->is_writable( $filename ) ) {
|
1016 |
+
if ( $wpfs->put_contents( $filename, $contents ) === false ) {
|
1017 |
+
return $this->output_error( $failed_str );
|
1018 |
+
}
|
1019 |
+
} else {
|
1020 |
+
return $this->output_error( $readonly_str );
|
1021 |
+
}
|
1022 |
+
|
1023 |
return true;
|
1024 |
}
|
1025 |
+
|
1026 |
return false;
|
1027 |
}
|
1028 |
+
|
1029 |
/**
|
1030 |
* Delete a file through WP Filesystem.
|
1031 |
*/
|
1033 |
$wpfs = $this->get_filesystem_object();
|
1034 |
if ( is_object( $wpfs ) ) {
|
1035 |
if ( $wpfs->exists( $filename ) ) {
|
1036 |
+
if ( $wpfs->delete( $filename ) === false ) {
|
1037 |
$this->output_error( __( sprintf( "Failed to delete file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
|
1038 |
+
} else {
|
1039 |
return true;
|
1040 |
+
}
|
1041 |
+
} else {
|
1042 |
+
$this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
|
1043 |
+
}
|
1044 |
}
|
1045 |
+
|
1046 |
return false;
|
1047 |
}
|
1048 |
+
|
1049 |
/**
|
1050 |
* Rename a file through WP Filesystem.
|
1051 |
*/
|
1052 |
function rename_file( $filename, $newname ) {
|
1053 |
$wpfs = $this->get_filesystem_object();
|
1054 |
if ( is_object( $wpfs ) ) {
|
1055 |
+
$file_exists = $wpfs->exists( $filename );
|
1056 |
$newfile_exists = $wpfs->exists( $newname );
|
1057 |
+
if ( $file_exists && ! $newfile_exists ) {
|
1058 |
+
if ( $wpfs->move( $filename, $newname ) === false ) {
|
1059 |
$this->output_error( __( sprintf( "Failed to rename file %s!\n", $filename ), 'all-in-one-seo-pack' ) );
|
1060 |
+
} else {
|
1061 |
return true;
|
1062 |
+
}
|
1063 |
} else {
|
1064 |
+
if ( ! $file_exists ) {
|
1065 |
$this->output_error( __( sprintf( "File %s doesn't exist!\n", $filename ), 'all-in-one-seo-pack' ) );
|
1066 |
+
} elseif ( $newfile_exists ) {
|
1067 |
$this->output_error( __( sprintf( "File %s already exists!\n", $newname ), 'all-in-one-seo-pack' ) );
|
1068 |
+
}
|
1069 |
}
|
1070 |
}
|
1071 |
+
|
1072 |
return false;
|
1073 |
}
|
1074 |
|
1077 |
*/
|
1078 |
function load_files( $options, $opts, $prefix ) {
|
1079 |
foreach ( $opts as $opt => $file ) {
|
1080 |
+
$opt = $prefix . $opt;
|
1081 |
+
$file = ABSPATH . $file;
|
1082 |
$contents = $this->load_file( $file );
|
1083 |
+
if ( $contents !== false ) {
|
1084 |
+
$options[ $opt ] = $contents;
|
1085 |
+
}
|
1086 |
}
|
1087 |
+
|
1088 |
return $options;
|
1089 |
}
|
1090 |
+
|
1091 |
/**
|
1092 |
* Save multiple files.
|
1093 |
*/
|
1094 |
function save_files( $opts, $prefix ) {
|
1095 |
foreach ( $opts as $opt => $file ) {
|
1096 |
$opt = $prefix . $opt;
|
1097 |
+
if ( isset( $_POST[ $opt ] ) ) {
|
1098 |
+
$output = stripslashes_deep( $_POST[ $opt ] );
|
1099 |
+
$file = ABSPATH . $file;
|
1100 |
$this->save_file( $file, $output );
|
1101 |
}
|
1102 |
}
|
1103 |
}
|
1104 |
+
|
1105 |
/**
|
1106 |
* Delete multiple files.
|
1107 |
*/
|
1111 |
$this->delete_file( $file );
|
1112 |
}
|
1113 |
}
|
1114 |
+
|
1115 |
function get_all_images_by_type( $options = null, $p = null ) {
|
1116 |
+
$img = array();
|
1117 |
if ( empty( $img ) ) {
|
1118 |
$size = apply_filters( 'post_thumbnail_size', 'large' );
|
1119 |
|
1127 |
|
1128 |
$count = 1;
|
1129 |
|
1130 |
+
if ( ! empty( $post ) ) {
|
1131 |
+
if ( ! is_object( $post ) ) {
|
1132 |
+
$post = get_post( $post );
|
1133 |
+
}
|
1134 |
+
if ( is_object( $post ) && function_exists( 'get_post_thumbnail_id' ) ) {
|
1135 |
+
if ( $post->post_type == 'attachment' ) {
|
1136 |
$post_thumbnail_id = $post->ID;
|
1137 |
+
} else {
|
1138 |
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
|
1139 |
+
}
|
1140 |
+
if ( ! empty( $post_thumbnail_id ) ) {
|
1141 |
$image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
|
1142 |
if ( is_array( $image ) ) {
|
1143 |
+
$img[] = array( 'type' => 'featured', 'id' => $post_thumbnail_id, 'link' => $image[0] );
|
1144 |
}
|
1145 |
}
|
1146 |
}
|
1147 |
|
1148 |
$post_id = $post->ID;
|
1149 |
+
$p = $post;
|
1150 |
+
$w = $wp_query;
|
1151 |
|
1152 |
$meta_key = '';
|
1153 |
+
if ( is_array( $options ) && isset( $options['meta_key'] ) ) {
|
|
|
1154 |
$meta_key = $options['meta_key'];
|
|
|
1155 |
}
|
1156 |
|
1157 |
+
if ( ! empty( $meta_key ) && ! empty( $post ) ) {
|
1158 |
$meta_key = explode( ',', $meta_key );
|
1159 |
+
$image = $this->get_the_image_by_meta_key( array(
|
1160 |
+
'post_id' => $post->ID,
|
1161 |
+
'meta_key' => $meta_key
|
1162 |
+
) );
|
1163 |
+
if ( ! empty( $image ) ) {
|
1164 |
+
$img[] = array( 'type' => 'meta_key', 'id' => $meta_key, 'link' => $image );
|
1165 |
}
|
1166 |
}
|
1167 |
|
1168 |
+
if ( ! $post->post_modified_gmt != '' ) {
|
1169 |
$wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
|
1170 |
+
}
|
1171 |
+
if ( $post->post_type == 'page' ) {
|
1172 |
$wp_query->is_page = true;
|
1173 |
+
} elseif ( $post->post_type == 'attachment' ) {
|
1174 |
$wp_query->is_attachment = true;
|
1175 |
+
} else {
|
1176 |
$wp_query->is_single = true;
|
1177 |
+
}
|
1178 |
+
if ( get_option( 'show_on_front' ) == 'page' && $post->ID == get_option( 'page_for_posts' ) ) {
|
1179 |
$wp_query->is_home = true;
|
1180 |
}
|
1181 |
+
$args['options']['type'] = 'html';
|
1182 |
$args['options']['nowrap'] = false;
|
1183 |
+
$args['options']['save'] = false;
|
1184 |
+
$wp_query->queried_object = $post;
|
1185 |
+
|
1186 |
+
$attachments = get_children( array(
|
1187 |
+
'post_parent' => $post->ID,
|
1188 |
+
'post_status' => 'inherit',
|
1189 |
+
'post_type' => 'attachment',
|
1190 |
+
'post_mime_type' => 'image',
|
1191 |
+
'order' => 'ASC',
|
1192 |
+
'orderby' => 'menu_order ID'
|
1193 |
+
) );
|
1194 |
+
if ( ! empty( $attachments ) ) {
|
1195 |
+
foreach ( $attachments as $id => $attachment ) {
|
1196 |
$image = wp_get_attachment_image_src( $id, $size );
|
1197 |
if ( is_array( $image ) ) {
|
1198 |
+
$img[] = array( 'type' => 'attachment', 'id' => $id, 'link' => $image[0] );
|
1199 |
}
|
1200 |
}
|
1201 |
+
}
|
1202 |
+
$matches = array();
|
1203 |
preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
|
1204 |
+
if ( isset( $matches ) && ! empty( $matches[1] ) && ! empty( $matches[1][0] ) ) {
|
1205 |
+
foreach ( $matches[1] as $i => $m ) {
|
1206 |
+
$img[] = array( 'type' => 'post_content', 'id' => 'post' . $count ++, 'link' => $m );
|
1207 |
}
|
1208 |
+
}
|
1209 |
wp_reset_postdata();
|
1210 |
+
$wp_query = $w;
|
1211 |
+
$post = $p;
|
1212 |
}
|
1213 |
}
|
1214 |
+
|
1215 |
return $img;
|
1216 |
}
|
1217 |
+
|
1218 |
function get_all_images( $options = null, $p = null ) {
|
1219 |
+
$img = $this->get_all_images_by_type( $options, $p );
|
1220 |
+
$legacy = array();
|
1221 |
+
foreach ( $img as $k => $v ) {
|
1222 |
if ( $v['type'] == 'featured' ) {
|
1223 |
+
$legacy[ $v['link'] ] = 1;
|
1224 |
+
} else {
|
1225 |
+
$legacy[ $v['link'] ] = $v['id'];
|
1226 |
}
|
1227 |
}
|
1228 |
+
|
1229 |
return $legacy;
|
1230 |
}
|
1231 |
|
1232 |
/*** Thanks to Justin Tadlock for the original get-the-image code - http://themehybrid.com/plugins/get-the-image ***/
|
1233 |
|
1234 |
function get_the_image( $options = null, $p = null ) {
|
1235 |
+
|
1236 |
if ( $p === null ) {
|
1237 |
global $post;
|
1238 |
} else {
|
1239 |
$post = $p;
|
1240 |
}
|
1241 |
+
|
1242 |
$meta_key = '';
|
1243 |
+
if ( is_array( $options ) && isset( $options['meta_key'] ) ) {
|
|
|
1244 |
$meta_key = $options['meta_key'];
|
|
|
1245 |
}
|
1246 |
|
1247 |
+
if ( ! empty( $meta_key ) && ! empty( $post ) ) {
|
1248 |
$meta_key = explode( ',', $meta_key );
|
1249 |
+
$image = $this->get_the_image_by_meta_key( array(
|
1250 |
+
'post_id' => $post->ID,
|
1251 |
+
'meta_key' => $meta_key
|
1252 |
+
) );
|
1253 |
+
}
|
1254 |
+
if ( empty( $image ) ) {
|
1255 |
+
$image = $this->get_the_image_by_post_thumbnail( $post );
|
1256 |
+
}
|
1257 |
+
if ( empty( $image ) ) {
|
1258 |
+
$image = $this->get_the_image_by_attachment( $post );
|
1259 |
}
|
1260 |
+
if ( empty( $image ) ) {
|
1261 |
+
$image = $this->get_the_image_by_scan( $post );
|
1262 |
+
}
|
1263 |
+
if ( empty( $image ) ) {
|
1264 |
+
$image = $this->get_the_image_by_default( $post );
|
1265 |
+
}
|
1266 |
+
|
1267 |
return $image;
|
1268 |
}
|
1269 |
+
|
1270 |
function get_the_image_by_default( $p = null ) {
|
1271 |
return '';
|
1272 |
}
|
1274 |
function get_the_image_by_meta_key( $args = array() ) {
|
1275 |
|
1276 |
/* If $meta_key is not an array. */
|
1277 |
+
if ( ! is_array( $args['meta_key'] ) ) {
|
1278 |
$args['meta_key'] = array( $args['meta_key'] );
|
1279 |
+
}
|
1280 |
|
1281 |
/* Loop through each of the given meta keys. */
|
1282 |
foreach ( $args['meta_key'] as $meta_key ) {
|
1283 |
/* Get the image URL by the current meta key in the loop. */
|
1284 |
$image = get_post_meta( $args['post_id'], $meta_key, true );
|
1285 |
/* If a custom key value has been given for one of the keys, return the image URL. */
|
1286 |
+
if ( ! empty( $image ) ) {
|
1287 |
return $image;
|
1288 |
+
}
|
1289 |
}
|
1290 |
+
|
1291 |
return false;
|
1292 |
}
|
1293 |
|
1298 |
} else {
|
1299 |
$post = $p;
|
1300 |
}
|
1301 |
+
|
1302 |
$post_thumbnail_id = null;
|
1303 |
+
if ( function_exists( 'get_post_thumbnail_id' ) ) {
|
1304 |
+
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
|
1305 |
}
|
1306 |
|
1307 |
+
if ( empty( $post_thumbnail_id ) ) {
|
1308 |
return false;
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
$size = apply_filters( 'post_thumbnail_size', 'large' );
|
1312 |
+
$image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
|
1313 |
|
1314 |
+
return $image[0];
|
|
|
|
|
1315 |
}
|
1316 |
|
1317 |
function get_the_image_by_attachment( $p = null ) {
|
1318 |
+
|
1319 |
if ( $p === null ) {
|
1320 |
global $post;
|
1321 |
} else {
|
1322 |
$post = $p;
|
1323 |
}
|
1324 |
|
1325 |
+
$attachments = get_children( array(
|
1326 |
+
'post_parent' => $post->ID,
|
1327 |
+
'post_status' => 'inherit',
|
1328 |
+
'post_type' => 'attachment',
|
1329 |
+
'post_mime_type' => 'image',
|
1330 |
+
'order' => 'ASC',
|
1331 |
+
'orderby' => 'menu_order ID'
|
1332 |
+
) );
|
1333 |
|
1334 |
+
if ( empty( $attachments ) && 'attachment' == get_post_type( $post->ID ) ) {
|
|
|
1335 |
$image = wp_get_attachment_image_src( $post->ID, 'large' );
|
|
|
1336 |
}
|
1337 |
|
1338 |
/* If no attachments or image is found, return false. */
|
1339 |
+
if ( empty( $attachments ) && empty( $image ) ) {
|
1340 |
return false;
|
1341 |
+
}
|
1342 |
|
1343 |
/* Set the default iterator to 0. */
|
1344 |
$i = 0;
|
1345 |
|
1346 |
/* Loop through each attachment. Once the $order_of_image (default is '1') is reached, break the loop. */
|
1347 |
foreach ( $attachments as $id => $attachment ) {
|
1348 |
+
if ( ++ $i == 1 ) {
|
1349 |
$image = wp_get_attachment_image_src( $id, 'large' );
|
1350 |
+
$alt = trim( strip_tags( get_post_field( 'post_excerpt', $id ) ) );
|
1351 |
break;
|
1352 |
}
|
1353 |
}
|
1354 |
|
1355 |
/* Return the image URL. */
|
1356 |
+
|
1357 |
return $image[0];
|
1358 |
|
1359 |
}
|
1365 |
} else {
|
1366 |
$post = $p;
|
1367 |
}
|
1368 |
+
|
1369 |
/* Search the post's content for the <img /> tag and get its URL. */
|
1370 |
preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
|
1371 |
|
1372 |
/* If there is a match for the image, return its URL. */
|
1373 |
+
if ( isset( $matches ) && ! empty( $matches[1][0] ) ) {
|
1374 |
return $matches[1][0];
|
1375 |
+
}
|
1376 |
|
1377 |
return false;
|
1378 |
}
|
1379 |
+
|
1380 |
/** crude approximization of whether current user is an admin */
|
1381 |
function is_admin() {
|
1382 |
return current_user_can( 'level_8' );
|
1383 |
}
|
1384 |
+
|
1385 |
function help_text_helper( &$default_options, $options, $help_link = '' ) {
|
1386 |
+
foreach ( $options as $o ) {
|
1387 |
$ht = '';
|
1388 |
+
if ( ! empty( $this->help_text[ $o ] ) ) {
|
1389 |
+
$ht = $this->help_text[ $o ];
|
1390 |
+
} elseif ( ! empty( $default_options[ $o ]['help_text'] ) ) {
|
1391 |
+
$ht = $default_options[ $o ]['help_text'];
|
1392 |
+
}
|
1393 |
+
if ( $ht && ! is_array( $ht ) ) {
|
1394 |
$ha = '';
|
1395 |
$hl = $help_link;
|
1396 |
if ( strpos( $o, 'ga_' ) === 0 ) { // special case -- pdb
|
1397 |
$hl = 'http://semperplugins.com/documentation/advanced-google-analytics-settings/';
|
1398 |
}
|
1399 |
+
if ( ! empty( $this->help_anchors[ $o ] ) ) {
|
1400 |
+
$ha = $this->help_anchors[ $o ];
|
1401 |
+
}
|
1402 |
+
if ( ! empty( $ha ) && ( $pos = strrpos( $hl, '#' ) ) ) {
|
1403 |
$hl = substr( $hl, 0, $pos );
|
1404 |
}
|
1405 |
+
if ( ! empty( $ha ) && ( $ha[0] == 'h' ) ) {
|
1406 |
+
$hl = '';
|
1407 |
+
}
|
1408 |
+
if ( ! empty( $ha ) || ! isset( $this->help_anchors[ $o ] ) ) {
|
1409 |
+
$ht .= "<br /><a href='" . $hl . $ha . "' target='_blank'>" . __( 'Click here for documentation on this setting', 'all-in-one-seo-pack' ) . '</a>';
|
1410 |
}
|
1411 |
+
$default_options[ $o ]['help_text'] = $ht;
|
1412 |
}
|
1413 |
}
|
1414 |
}
|
1415 |
+
|
1416 |
function add_help_text_links() {
|
1417 |
+
if ( ! empty( $this->help_text ) ) {
|
1418 |
+
foreach ( $this->layout as $k => $v ) {
|
1419 |
$this->help_text_helper( $this->default_options, $v['options'], $v['help_link'] );
|
1420 |
}
|
1421 |
+
if ( ! empty( $this->locations ) ) {
|
1422 |
+
foreach ( $this->locations as $k => $v ) {
|
1423 |
+
if ( ! empty( $v['default_options'] ) && ! empty( $v['options'] ) ) {
|
1424 |
+
$this->help_text_helper( $this->locations[ $k ]['default_options'], $v['options'], $v['help_link'] );
|
1425 |
}
|
1426 |
}
|
1427 |
+
}
|
1428 |
}
|
1429 |
}
|
1430 |
+
|
1431 |
/**
|
1432 |
* Load scripts and styles for metaboxes.
|
1433 |
+
*
|
1434 |
* edit-tags exists only for pre 4.5 support... remove when we drop 4.5 support.
|
1435 |
* Also, that check and others should be pulled out into their own functions
|
1436 |
*/
|
1437 |
+
function enqueue_metabox_scripts() {
|
1438 |
$screen = '';
|
1439 |
+
if ( function_exists( 'get_current_screen' ) ) {
|
1440 |
$screen = get_current_screen();
|
1441 |
+
}
|
1442 |
$bail = false;
|
1443 |
+
if ( empty( $screen ) ) {
|
1444 |
+
$bail = true;
|
1445 |
+
}
|
1446 |
+
if ( ( $screen->base != 'post' ) && ( $screen->base != 'term' ) && ( $screen->base != 'edit-tags' ) && ( $screen->base != 'toplevel_page_shopp-products' ) ) {
|
1447 |
+
$bail = true;
|
1448 |
+
}
|
1449 |
$prefix = $this->get_prefix();
|
1450 |
+
$bail = apply_filters( $prefix . 'bail_on_enqueue', $bail, $screen );
|
1451 |
+
if ( $bail ) {
|
1452 |
+
return;
|
1453 |
+
}
|
1454 |
$this->form = 'post';
|
1455 |
+
if ( $screen->base == 'term' || $screen->base == 'edit-tags' ) {
|
1456 |
+
$this->form = 'edittag';
|
1457 |
+
}
|
1458 |
+
if ( $screen->base == 'toplevel_page_shopp-products' ) {
|
1459 |
+
$this->form = 'product';
|
1460 |
+
}
|
1461 |
$this->form = apply_filters( $prefix . 'set_form_on_enqueue', $this->form, $screen );
|
1462 |
+
foreach ( $this->locations as $k => $v ) {
|
1463 |
+
if ( $v['type'] === 'metabox' && isset( $v['display'] ) && ! empty( $v['display'] ) ) {
|
|
|
1464 |
$enqueue_scripts = false;
|
1465 |
$enqueue_scripts = ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) ) || in_array( $screen->post_type, $v['display'] );
|
1466 |
$enqueue_scripts = apply_filters( $prefix . 'enqueue_metabox_scripts', $enqueue_scripts, $screen, $v );
|
1467 |
if ( $enqueue_scripts ) {
|
1468 |
+
add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
|
1469 |
+
add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ), 20 );
|
1470 |
+
add_action( 'admin_print_scripts', array( $this, 'enqueue_styles' ), 20 );
|
|
|
1471 |
}
|
1472 |
}
|
1473 |
}
|
1474 |
}
|
1475 |
+
|
1476 |
/**
|
1477 |
* Load styles for module.
|
1478 |
*/
|
1479 |
+
function enqueue_styles() {
|
1480 |
wp_enqueue_style( 'thickbox' );
|
1481 |
+
if ( ! empty( $this->pointers ) ) {
|
1482 |
+
wp_enqueue_style( 'wp-pointer' );
|
1483 |
+
}
|
1484 |
+
wp_enqueue_style( 'aioseop-module-style', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module.css' );
|
1485 |
+
if ( function_exists( 'is_rtl' ) && is_rtl() ) {
|
1486 |
+
wp_enqueue_style( 'aioseop-module-style-rtl', AIOSEOP_PLUGIN_URL . 'css/modules/aioseop_module-rtl.css', array( 'aioseop-module-style' ) );
|
1487 |
+
}
|
1488 |
}
|
1489 |
+
|
1490 |
/**
|
1491 |
* Load scripts for module, can pass data to module script.
|
1492 |
*/
|
1493 |
+
function enqueue_scripts() {
|
1494 |
wp_enqueue_script( 'sack' );
|
1495 |
wp_enqueue_script( 'jquery' );
|
1496 |
wp_enqueue_script( 'media-upload' );
|
1498 |
wp_enqueue_script( 'common' );
|
1499 |
wp_enqueue_script( 'wp-lists' );
|
1500 |
wp_enqueue_script( 'postbox' );
|
1501 |
+
if ( ! empty( $this->pointers ) ) {
|
1502 |
wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
|
1503 |
}
|
1504 |
+
wp_enqueue_script( 'aioseop-module-script', AIOSEOP_PLUGIN_URL . 'js/modules/aioseop_module.js', array(), AIOSEOP_VERSION );
|
1505 |
+
if ( ! empty( $this->script_data ) ) {
|
1506 |
aioseop_localize_script_data();
|
1507 |
}
|
1508 |
}
|
1509 |
+
|
1510 |
function localize_script_data( $data ) {
|
1511 |
+
if ( ! is_array( $data ) ) {
|
1512 |
+
$data = array( 0 => $data );
|
1513 |
+
}
|
1514 |
+
if ( empty( $this->script_data ) ) {
|
1515 |
+
$this->script_data = array();
|
1516 |
}
|
1517 |
+
if ( ! empty( $this->pointers ) ) {
|
|
|
1518 |
$this->script_data['pointers'] = $this->pointers;
|
1519 |
+
}
|
1520 |
+
if ( empty( $data[0]['condshow'] ) ) {
|
1521 |
+
$data[0]['condshow'] = array();
|
1522 |
+
}
|
1523 |
+
if ( empty( $this->script_data['condshow'] ) ) {
|
1524 |
+
$this->script_data['condshow'] = array();
|
1525 |
+
}
|
1526 |
+
$condshow = $this->script_data['condshow'];
|
1527 |
$data[0]['condshow'] = array_merge( $data[0]['condshow'], $condshow );
|
1528 |
unset( $this->script_data['condshow'] );
|
1529 |
+
$data[0] = array_merge( $this->script_data, $data[0] );
|
1530 |
$this->script_data['condshow'] = $condshow;
|
1531 |
+
|
1532 |
return $data;
|
1533 |
}
|
1534 |
+
|
1535 |
/**
|
1536 |
* Override this to run code at the beginning of the settings page.
|
1537 |
*/
|
1538 |
function settings_page_init() {
|
1539 |
+
|
1540 |
}
|
1541 |
+
|
1542 |
/**
|
1543 |
* Filter out admin pointers that have already been clicked.
|
1544 |
*/
|
1545 |
function filter_pointers() {
|
1546 |
+
if ( ! empty( $this->pointers ) ) {
|
1547 |
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
|
1548 |
+
foreach ( $dismissed as $d ) {
|
1549 |
+
if ( isset( $this->pointers[ $d ] ) ) {
|
1550 |
+
unset( $this->pointers[ $d ] );
|
1551 |
+
}
|
1552 |
+
}
|
1553 |
}
|
1554 |
}
|
1555 |
+
|
1556 |
/**
|
1557 |
* Add basic hooks when on the module's page.
|
1558 |
*/
|
1559 |
function add_page_hooks() {
|
1560 |
$hookname = current_filter();
|
1561 |
+
if ( $this->strpos( $hookname, 'load-' ) === 0 ) {
|
1562 |
$this->pagehook = $this->substr( $hookname, 5 );
|
1563 |
+
}
|
1564 |
+
add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ) );
|
1565 |
+
add_action( 'admin_print_styles', array( $this, 'enqueue_styles' ) );
|
1566 |
+
add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
|
1567 |
+
add_action( $this->prefix . 'settings_header', array( $this, 'display_tabs' ) );
|
1568 |
}
|
1569 |
+
|
1570 |
function get_admin_links() {
|
1571 |
+
if ( ! empty( $this->menu_name ) ) {
|
1572 |
$name = $this->menu_name;
|
1573 |
+
} else {
|
1574 |
$name = $this->name;
|
1575 |
+
}
|
1576 |
+
|
1577 |
$hookname = plugin_basename( $this->file );
|
1578 |
+
|
1579 |
+
$links = array();
|
1580 |
+
$url = '';
|
1581 |
+
if ( function_exists( 'menu_page_url' ) ) {
|
1582 |
+
$url = menu_page_url( $hookname, 0 );
|
1583 |
+
}
|
1584 |
+
if ( empty( $url ) ) {
|
1585 |
+
$url = esc_url( admin_url( 'admin.php?page=' . $hookname ) );
|
1586 |
+
}
|
1587 |
+
|
1588 |
+
if ( $this->locations === null ) {
|
1589 |
+
array_unshift( $links, array(
|
1590 |
+
'parent' => AIOSEOP_PLUGIN_DIRNAME,
|
1591 |
+
'title' => $name,
|
1592 |
+
'id' => $hookname,
|
1593 |
+
'href' => $url,
|
1594 |
+
'order' => $this->menu_order()
|
1595 |
+
) );
|
1596 |
+
} else {
|
1597 |
+
foreach ( $this->locations as $k => $v ) {
|
1598 |
if ( $v['type'] === 'settings' ) {
|
1599 |
if ( $k === 'default' ) {
|
1600 |
+
array_unshift( $links, array(
|
1601 |
+
'parent' => AIOSEOP_PLUGIN_DIRNAME,
|
1602 |
+
'title' => $name,
|
1603 |
+
'id' => $hookname,
|
1604 |
+
'href' => $url,
|
1605 |
+
'order' => $this->menu_order()
|
1606 |
+
) );
|
1607 |
} else {
|
1608 |
+
if ( ! empty( $v['menu_name'] ) ) {
|
1609 |
$name = $v['menu_name'];
|
1610 |
+
} else {
|
1611 |
$name = $v['name'];
|
1612 |
+
}
|
1613 |
+
array_unshift( $links, array(
|
1614 |
+
'parent' => AIOSEOP_PLUGIN_DIRNAME,
|
1615 |
+
'title' => $name,
|
1616 |
+
'id' => $this->get_prefix( $k ) . $k,
|
1617 |
+
'href' => esc_url( admin_url( 'admin.php?page=' . $this->get_prefix( $k ) . $k ) ),
|
1618 |
+
'order' => $this->menu_order()
|
1619 |
+
) );
|
1620 |
}
|
1621 |
}
|
1622 |
}
|
1623 |
}
|
1624 |
+
|
1625 |
return $links;
|
1626 |
}
|
1627 |
+
|
1628 |
function add_admin_bar_submenu() {
|
1629 |
global $aioseop_admin_menu, $wp_admin_bar;
|
1630 |
+
|
1631 |
if ( $aioseop_admin_menu ) {
|
1632 |
$links = $this->get_admin_links();
|
1633 |
+
if ( ! empty( $links ) ) {
|
1634 |
+
foreach ( $links as $l ) {
|
1635 |
$wp_admin_bar->add_menu( $l );
|
1636 |
+
}
|
1637 |
+
}
|
1638 |
}
|
1639 |
}
|
1640 |
+
|
1641 |
/**
|
1642 |
* Collect metabox data together for tabbed metaboxes.
|
1643 |
*/
|
1644 |
function filter_return_metaboxes( $args ) {
|
1645 |
return array_merge( $args, $this->post_metaboxes );
|
1646 |
}
|
1647 |
+
|
1648 |
/** Add submenu for module, call page hooks, set up metaboxes. */
|
1649 |
function add_menu( $parent_slug ) {
|
1650 |
+
if ( ! empty( $this->menu_name ) ) {
|
1651 |
$name = $this->menu_name;
|
1652 |
+
} else {
|
1653 |
$name = $this->name;
|
1654 |
+
}
|
1655 |
if ( $this->locations === null ) {
|
1656 |
+
$hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), plugin_basename( $this->file ), array(
|
1657 |
+
$this,
|
1658 |
+
'display_settings_page'
|
1659 |
+
) );
|
1660 |
+
add_action( "load-{$hookname}", array( $this, 'add_page_hooks' ) );
|
1661 |
+
|
1662 |
return true;
|
1663 |
}
|
1664 |
+
foreach ( $this->locations as $k => $v ) {
|
1665 |
if ( $v['type'] === 'settings' ) {
|
1666 |
if ( $k === 'default' ) {
|
1667 |
+
if ( ! empty( $this->menu_name ) ) {
|
1668 |
$name = $this->menu_name;
|
1669 |
+
} else {
|
1670 |
$name = $this->name;
|
1671 |
+
}
|
1672 |
+
$hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), plugin_basename( $this->file ), array(
|
1673 |
+
$this,
|
1674 |
+
'display_settings_page'
|
1675 |
+
) );
|
1676 |
} else {
|
1677 |
+
if ( ! empty( $v['menu_name'] ) ) {
|
1678 |
$name = $v['menu_name'];
|
1679 |
+
} else {
|
1680 |
$name = $v['name'];
|
1681 |
+
}
|
1682 |
+
$hookname = add_submenu_page( $parent_slug, $name, $name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $this->get_prefix( $k ) . $k, array(
|
1683 |
+
$this,
|
1684 |
+
"display_settings_page_$k"
|
1685 |
+
) );
|
1686 |
}
|
1687 |
+
add_action( "load-{$hookname}", array( $this, 'add_page_hooks' ) );
|
1688 |
} elseif ( $v['type'] === 'metabox' ) {
|
1689 |
$this->setting_options( $k ); // hack -- make sure this runs anyhow, for now -- pdb
|
1690 |
+
add_action( 'edit_post', array( $this, 'save_post_data' ) );
|
1691 |
+
add_action( 'publish_post', array( $this, 'save_post_data' ) );
|
1692 |
+
add_action( 'add_attachment', array( $this, 'save_post_data' ) );
|
1693 |
+
add_action( 'edit_attachment', array( $this, 'save_post_data' ) );
|
1694 |
+
add_action( 'save_post', array( $this, 'save_post_data' ) );
|
1695 |
+
add_action( 'edit_page_form', array( $this, 'save_post_data' ) );
|
1696 |
+
if ( isset( $v['display'] ) && ! empty( $v['display'] ) ) {
|
1697 |
+
add_action( 'admin_print_scripts', array( $this, 'enqueue_metabox_scripts' ), 5 );
|
1698 |
+
if ( $this->tabbed_metaboxes ) {
|
1699 |
+
add_filter( 'aioseop_add_post_metabox', array( $this, 'filter_return_metaboxes' ) );
|
1700 |
+
}
|
1701 |
foreach ( $v['display'] as $posttype ) {
|
1702 |
$v['location'] = $k;
|
1703 |
$v['posttype'] = $posttype;
|
1704 |
+
if ( ! isset( $v['context'] ) ) {
|
1705 |
+
$v['context'] = 'advanced';
|
1706 |
+
}
|
1707 |
+
if ( ! isset( $v['priority'] ) ) {
|
1708 |
+
$v['priority'] = 'default';
|
1709 |
+
}
|
1710 |
if ( $this->tabbed_metaboxes ) {
|
1711 |
+
$this->post_metaboxes[] = array(
|
1712 |
+
'id' => $v['prefix'] . $k,
|
1713 |
+
'title' => $v['name'],
|
1714 |
+
'callback' => array( $this, 'display_metabox' ),
|
1715 |
+
'post_type' => $posttype,
|
1716 |
+
'context' => $v['context'],
|
1717 |
+
'priority' => $v['priority'],
|
1718 |
+
'callback_args' => $v
|
1719 |
+
);
|
1720 |
} else {
|
1721 |
$title = $v['name'];
|
1722 |
+
if ( $title != $this->plugin_name ) {
|
1723 |
+
$title = $this->plugin_name . ' - ' . $title;
|
1724 |
+
}
|
1725 |
+
if ( ! empty( $v['help_link'] ) ) {
|
1726 |
+
$title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . '</span></a>';
|
1727 |
+
}
|
1728 |
+
add_meta_box( $v['prefix'] . $k, $title, array(
|
1729 |
+
$this,
|
1730 |
+
'display_metabox'
|
1731 |
+
), $posttype, $v['context'], $v['priority'], $v );
|
1732 |
}
|
1733 |
}
|
1734 |
}
|
1735 |
}
|
1736 |
}
|
1737 |
}
|
1738 |
+
|
1739 |
/**
|
1740 |
* Update postmeta for metabox.
|
1741 |
*/
|
1742 |
function save_post_data( $post_id ) {
|
1743 |
static $update = false;
|
1744 |
+
if ( $update ) {
|
1745 |
+
return;
|
1746 |
+
}
|
1747 |
if ( $this->locations !== null ) {
|
1748 |
+
foreach ( $this->locations as $k => $v ) {
|
1749 |
+
if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) {
|
1750 |
+
$opts = $this->default_options( $k );
|
1751 |
+
$options = array();
|
1752 |
+
$update = false;
|
1753 |
foreach ( $opts as $l => $o ) {
|
1754 |
+
if ( isset( $_POST[ $l ] ) ) {
|
1755 |
+
$options[ $l ] = stripslashes_deep( $_POST[ $l ] );
|
1756 |
+
$options[ $l ] = esc_attr( $options[ $l ] );
|
1757 |
+
$update = true;
|
1758 |
}
|
1759 |
}
|
1760 |
if ( $update ) {
|
1761 |
+
$prefix = $this->get_prefix( $k );
|
1762 |
$options = apply_filters( $prefix . 'filter_metabox_options', $options, $k, $post_id );
|
1763 |
update_post_meta( $post_id, '_' . $prefix . $k, $options );
|
1764 |
}
|
1766 |
}
|
1767 |
}
|
1768 |
}
|
1769 |
+
|
1770 |
/**
|
1771 |
* Outputs radio buttons, checkboxes, selects, multiselects, handles groups.
|
1772 |
+
*/
|
1773 |
function do_multi_input( $args ) {
|
1774 |
extract( $args );
|
1775 |
$buf1 = '';
|
1776 |
$type = $options['type'];
|
1777 |
if ( ( $type == 'radio' ) || ( $type == 'checkbox' ) ) {
|
1778 |
+
$strings = array(
|
1779 |
+
'block' => "%s\n",
|
1780 |
+
'group' => "\t<b>%s</b><br>\n%s\n",
|
1781 |
+
'item' => "\t<label class='aioseop_option_setting_label'><input type='$type' %s name='%s' value='%s' %s> %s</label>\n",
|
1782 |
+
'item_args' => array( 'sel', 'name', 'v', 'attr', 'subopt' ),
|
1783 |
+
'selected' => 'checked '
|
1784 |
+
);
|
1785 |
} else {
|
1786 |
+
$strings = array(
|
1787 |
+
'block' => "<select name='$name' $attr>%s\n</select>\n",
|
1788 |
+
'group' => "\t<optgroup label='%s'>\n%s\t</optgroup>\n",
|
1789 |
+
'item' => "\t<option %s value='%s'>%s</option>\n",
|
1790 |
+
'item_args' => array( 'sel', 'v', 'subopt' ),
|
1791 |
+
'selected' => 'selected '
|
1792 |
+
);
|
1793 |
}
|
1794 |
$setsel = $strings['selected'];
|
1795 |
+
if ( isset( $options['initial_options'] ) && is_array( $options['initial_options'] ) ) {
|
1796 |
foreach ( $options['initial_options'] as $l => $option ) {
|
1797 |
$is_group = is_array( $option );
|
1798 |
+
if ( ! $is_group ) {
|
1799 |
+
$option = array( $l => $option );
|
1800 |
+
}
|
1801 |
$buf2 = '';
|
1802 |
foreach ( $option as $v => $subopt ) {
|
1803 |
+
$sel = '';
|
1804 |
$is_arr = is_array( $value );
|
1805 |
if ( is_string( $v ) || is_string( $value ) ) {
|
1806 |
+
if ( is_string( $value ) ) {
|
1807 |
+
$cmp = ! strcmp( $v, $value );
|
1808 |
+
} else {
|
1809 |
+
$cmp = ! strcmp( $v, '' );
|
1810 |
+
}
|
1811 |
+
// $cmp = !strcmp( (string)$v, (string)$value );
|
1812 |
+
} else {
|
1813 |
$cmp = ( $value == $v );
|
1814 |
+
}
|
1815 |
+
if ( ( ! $is_arr && $cmp ) || ( $is_arr && in_array( $v, $value ) ) ) {
|
1816 |
$sel = $setsel;
|
1817 |
+
}
|
1818 |
+
$item_arr = array();
|
1819 |
+
foreach ( $strings['item_args'] as $arg ) {
|
1820 |
+
$item_arr[] = $$arg;
|
1821 |
+
}
|
1822 |
$buf2 .= vsprintf( $strings['item'], $item_arr );
|
1823 |
}
|
1824 |
+
if ( $is_group ) {
|
1825 |
+
$buf1 .= sprintf( $strings['group'], $l, $buf2 );
|
1826 |
+
} else {
|
1827 |
$buf1 .= $buf2;
|
1828 |
+
}
|
1829 |
+
}
|
1830 |
$buf1 = sprintf( $strings['block'], $buf1 );
|
1831 |
}
|
1832 |
+
|
1833 |
return $buf1;
|
1834 |
}
|
1835 |
+
|
1836 |
/**
|
1837 |
* Outputs a setting item for settings pages and metaboxes.
|
1838 |
*/
|
1839 |
function get_option_html( $args ) {
|
1840 |
static $n = 0;
|
1841 |
extract( $args );
|
1842 |
+
if ( $options['type'] == 'custom' ) {
|
1843 |
+
return apply_filters( "{$prefix}output_option", '', $args );
|
1844 |
+
}
|
1845 |
+
if ( in_array( $options['type'], array(
|
1846 |
+
'multiselect',
|
1847 |
+
'select',
|
1848 |
+
'multicheckbox',
|
1849 |
+
'radio',
|
1850 |
+
'checkbox',
|
1851 |
+
'textarea',
|
1852 |
+
'text',
|
1853 |
+
'submit',
|
1854 |
+
'hidden'
|
1855 |
+
) ) && is_string( $value )
|
1856 |
+
) {
|
1857 |
$value = esc_attr( $value );
|
1858 |
+
}
|
1859 |
+
$buf = '';
|
1860 |
$onload = '';
|
1861 |
+
if ( ! empty( $options['count'] ) ) {
|
1862 |
+
$n ++;
|
1863 |
$attr .= " onKeyDown='if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)' onKeyUp='if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)'";
|
1864 |
$onload = "if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n);";
|
1865 |
}
|
1866 |
+
if ( isset( $opts['id'] ) ) {
|
1867 |
+
$attr .= " id=\"{$opts['id']}\" ";
|
1868 |
+
}
|
1869 |
switch ( $options['type'] ) {
|
1870 |
+
case 'multiselect':
|
1871 |
+
$attr .= ' MULTIPLE';
|
1872 |
+
$args['attr'] = $attr;
|
1873 |
+
$args['name'] = $name = "{$name}[]";
|
1874 |
+
case 'select':
|
1875 |
+
$buf .= $this->do_multi_input( $args );
|
1876 |
+
break;
|
1877 |
+
case 'multicheckbox':
|
1878 |
+
$args['name'] = $name = "{$name}[]";
|
1879 |
+
$args['options']['type'] = $options['type'] = 'checkbox';
|
1880 |
+
case 'radio':
|
1881 |
+
$buf .= $this->do_multi_input( $args );
|
1882 |
+
break;
|
1883 |
+
case 'checkbox':
|
1884 |
+
if ( $value ) {
|
1885 |
+
$attr .= ' CHECKED';
|
1886 |
+
}
|
1887 |
+
$buf .= "<input name='$name' type='{$options['type']}' $attr>\n";
|
1888 |
+
break;
|
1889 |
+
case 'textarea':
|
1890 |
+
$buf .= "<textarea name='$name' $attr>$value</textarea>";
|
1891 |
+
break;
|
1892 |
+
case 'image':
|
1893 |
+
$buf .= "<input class='aioseop_upload_image_button button-primary' type='button' value='Upload Image' style='float:left;' />" .
|
1894 |
+
"<input class='aioseop_upload_image_label' name='$name' type='text' $attr value='$value' size=57 style='float:left;clear:left;'>\n";
|
1895 |
+
break;
|
1896 |
+
case 'html':
|
1897 |
+
$buf .= $value;
|
1898 |
+
break;
|
1899 |
+
default:
|
1900 |
+
$buf .= "<input name='$name' type='{$options['type']}' $attr value='$value'>\n";
|
1901 |
+
}
|
1902 |
+
if ( ! empty( $options['count'] ) ) {
|
1903 |
$size = 60;
|
1904 |
+
if ( isset( $options['size'] ) ) {
|
1905 |
+
$size = $options['size'];
|
1906 |
+
} elseif ( isset( $options['rows'] ) && isset( $options['cols'] ) ) {
|
1907 |
+
$size = $options['rows'] * $options['cols'];
|
1908 |
+
}
|
1909 |
+
if ( isset( $options['count_desc'] ) ) {
|
1910 |
$count_desc = $options['count_desc'];
|
1911 |
+
} else {
|
1912 |
$count_desc = __( ' characters. Most search engines use a maximum of %s chars for the %s.', 'all-in-one-seo-pack' );
|
1913 |
+
}
|
1914 |
+
$buf .= "<br /><input readonly type='text' name='{$prefix}length$n' size='3' maxlength='3' style='width:53px;height:23px;margin:0px;padding:0px 0px 0px 10px;' value='" . $this->strlen( $value ) . "' />"
|
1915 |
+
. sprintf( $count_desc, $size, trim( $this->strtolower( $options['name'] ), ':' ) );
|
1916 |
+
if ( ! empty( $onload ) ) {
|
1917 |
+
$buf .= "<script>jQuery( document ).ready(function() { {$onload} });</script>";
|
1918 |
+
}
|
1919 |
}
|
1920 |
+
|
1921 |
return $buf;
|
1922 |
}
|
1923 |
+
|
1924 |
+
const DISPLAY_HELP_START = '<a class="aioseop_help_text_link" style="cursor:pointer;" title="%s" onclick="toggleVisibility(\'%s_tip\');"><label class="aioseop_label textinput">%s</label></a>';
|
1925 |
+
const DISPLAY_HELP_END = '<div class="aioseop_help_text_div" style="display:none" id="%s_tip"><label class="aioseop_help_text">%s</label></div>';
|
1926 |
+
const DISPLAY_LABEL_FORMAT = '<span class="aioseop_option_label" style="text-align:%s;vertical-align:top;">%s</span>';
|
1927 |
+
const DISPLAY_TOP_LABEL = "</div>\n<div class='aioseop_input aioseop_top_label'>\n";
|
1928 |
+
const DISPLAY_ROW_TEMPLATE = '<div class="aioseop_wrapper%s" id="%s_wrapper"><div class="aioseop_input">%s<span class="aioseop_option_input"><div class="aioseop_option_div" %s>%s</div>%s</span><p style="clear:left"></p></div></div>';
|
1929 |
+
|
1930 |
/**
|
1931 |
* Format a row for an option on a settings page.
|
1932 |
*/
|
1933 |
function get_option_row( $name, $opts, $args ) {
|
1934 |
$label_text = $input_attr = $help_text_2 = $id_attr = '';
|
1935 |
+
if ( $opts['label'] == 'top' ) {
|
1936 |
+
$align = 'left';
|
1937 |
+
} else {
|
1938 |
$align = 'right';
|
1939 |
+
}
|
1940 |
+
if ( isset( $opts['id'] ) ) {
|
1941 |
+
$id_attr .= " id=\"{$opts['id']}_div\" ";
|
1942 |
+
}
|
1943 |
+
if ( $opts['label'] != 'none' ) {
|
1944 |
if ( isset( $opts['help_text'] ) ) {
|
1945 |
+
$help_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_START, __( 'Click for Help!', 'all-in-one-seo-pack' ), $name, $opts['name'] );
|
1946 |
+
$help_text_2 = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_HELP_END, $name, $opts['help_text'] );
|
1947 |
+
} else {
|
1948 |
+
$help_text = $opts['name'];
|
1949 |
+
}
|
1950 |
$label_text = sprintf( All_in_One_SEO_Pack_Module::DISPLAY_LABEL_FORMAT, $align, $help_text );
|
1951 |
+
} else {
|
1952 |
+
$input_attr .= ' aioseop_no_label ';
|
1953 |
+
}
|
1954 |
+
if ( $opts['label'] == 'top' ) {
|
1955 |
+
$label_text .= All_in_One_SEO_Pack_Module::DISPLAY_TOP_LABEL;
|
1956 |
+
}
|
1957 |
$input_attr .= " aioseop_{$opts['type']}_type";
|
1958 |
+
|
1959 |
return sprintf( All_in_One_SEO_Pack_Module::DISPLAY_ROW_TEMPLATE, $input_attr, $name, $label_text, $id_attr, $this->get_option_html( $args ), $help_text_2 );
|
1960 |
}
|
1961 |
+
|
1962 |
/**
|
1963 |
* Display options for settings pages and metaboxes, allows for filtering settings, custom display options.
|
1964 |
*/
|
1965 |
function display_options( $location = null, $meta_args = null ) {
|
1966 |
+
static $location_settings = array();
|
1967 |
+
$defaults = null;
|
1968 |
+
$prefix = $this->get_prefix( $location );
|
1969 |
+
$help_link = '';
|
1970 |
+
if ( is_array( $meta_args['args'] ) && ! empty( $meta_args['args']['default_options'] ) ) {
|
1971 |
+
$defaults = $meta_args['args']['default_options'];
|
1972 |
+
}
|
1973 |
+
if ( ! empty( $meta_args['callback_args'] ) && ! empty( $meta_args['callback_args']['help_link'] ) ) {
|
1974 |
+
$help_link = $meta_args['callback_args']['help_link'];
|
1975 |
+
}
|
1976 |
+
if ( ! empty( $help_link ) ) {
|
1977 |
+
echo "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $help_link . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . '</span></a>';
|
1978 |
+
}
|
1979 |
+
|
1980 |
+
if ( ! isset( $location_settings[ $prefix ] ) ) {
|
1981 |
+
$current_options = apply_filters( "{$this->prefix}display_options", $this->get_current_options( array(), $location, $defaults ), $location );
|
1982 |
+
$settings = apply_filters( "{$this->prefix}display_settings", $this->setting_options( $location, $defaults ), $location, $current_options );
|
1983 |
+
$current_options = apply_filters( "{$this->prefix}override_options", $current_options, $location, $settings );
|
1984 |
+
$location_settings[ $prefix ]['current_options'] = $current_options;
|
1985 |
+
$location_settings[ $prefix ]['settings'] = $settings;
|
1986 |
+
} else {
|
1987 |
+
$current_options = $location_settings[ $prefix ]['current_options'];
|
1988 |
+
$settings = $location_settings[ $prefix ]['settings'];
|
1989 |
+
}
|
1990 |
+
// $opts["snippet"]["default"] = sprintf( $opts["snippet"]["default"], "foo", "bar", "moby" );
|
1991 |
+
$container = "<div class='aioseop aioseop_options {$this->prefix}settings'>";
|
1992 |
+
if ( is_array( $meta_args['args'] ) && ! empty( $meta_args['args']['options'] ) ) {
|
1993 |
+
$args = array();
|
1994 |
+
$arg_keys = array();
|
1995 |
+
foreach ( $meta_args['args']['options'] as $a ) {
|
1996 |
+
if ( ! empty( $location ) ) {
|
1997 |
+
$key = $prefix . $location . '_' . $a;
|
1998 |
+
if ( ! isset( $settings[ $key ] ) ) {
|
1999 |
+
$key = $a;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000 |
}
|
2001 |
+
} else {
|
2002 |
+
$key = $prefix . $a;
|
2003 |
+
}
|
2004 |
+
if ( isset( $settings[ $key ] ) ) {
|
2005 |
+
$arg_keys[ $key ] = 1;
|
2006 |
+
} elseif ( isset( $settings[ $a ] ) ) {
|
2007 |
+
$arg_keys[ $a ] = 1;
|
2008 |
+
}
|
2009 |
+
}
|
2010 |
+
$setting_keys = array_keys( $settings );
|
2011 |
+
foreach ( $setting_keys as $s ) {
|
2012 |
+
if ( ! empty( $arg_keys[ $s ] ) ) {
|
2013 |
+
$args[ $s ] = $settings[ $s ];
|
2014 |
+
}
|
2015 |
+
}
|
2016 |
+
} else {
|
2017 |
+
$args = $settings;
|
2018 |
+
}
|
2019 |
+
foreach ( $args as $name => $opts ) {
|
2020 |
+
$attr_list = array( 'class', 'style', 'readonly', 'disabled', 'size', 'placeholder' );
|
2021 |
+
if ( $opts['type'] == 'textarea' ) {
|
2022 |
+
$attr_list = array_merge( $attr_list, array( 'rows', 'cols' ) );
|
2023 |
+
}
|
2024 |
+
$attr = '';
|
2025 |
+
foreach ( $attr_list as $a ) {
|
2026 |
+
if ( isset( $opts[ $a ] ) ) {
|
2027 |
+
$attr .= ' ' . $a . '="' . esc_attr( $opts[ $a ] ) . '" ';
|
2028 |
}
|
2029 |
}
|
2030 |
+
$opt = '';
|
2031 |
+
if ( isset( $current_options[ $name ] ) ) {
|
2032 |
+
$opt = $current_options[ $name ];
|
2033 |
+
}
|
2034 |
+
if ( $opts['label'] == 'none' && $opts['type'] == 'submit' && $opts['save'] == false ) {
|
2035 |
+
$opt = $opts['name'];
|
2036 |
+
}
|
2037 |
+
if ( $opts['type'] == 'html' && empty( $opt ) && $opts['save'] == false ) {
|
2038 |
+
$opt = $opts['default'];
|
2039 |
+
}
|
2040 |
+
|
2041 |
+
$args = array(
|
2042 |
+
'name' => $name,
|
2043 |
+
'options' => $opts,
|
2044 |
+
'attr' => $attr,
|
2045 |
+
'value' => $opt,
|
2046 |
+
'prefix' => $prefix
|
2047 |
+
);
|
2048 |
+
if ( ! empty( $opts['nowrap'] ) ) {
|
2049 |
+
echo $this->get_option_html( $args );
|
2050 |
+
} else {
|
2051 |
+
if ( $container ) {
|
2052 |
+
echo $container;
|
2053 |
+
$container = '';
|
2054 |
+
}
|
2055 |
+
echo $this->get_option_row( $name, $opts, $args );
|
2056 |
+
}
|
2057 |
+
}
|
2058 |
+
if ( ! $container ) {
|
2059 |
+
echo '</div>';
|
2060 |
+
}
|
2061 |
}
|
2062 |
+
|
2063 |
function sanitize_domain( $domain ) {
|
2064 |
$domain = trim( $domain );
|
2065 |
$domain = $this->strtolower( $domain );
|
2066 |
+
if ( $this->strpos( $domain, 'http://' ) === 0 ) {
|
2067 |
+
$domain = $this->substr( $domain, 7 );
|
2068 |
+
} elseif ( $this->strpos( $domain, 'https://' ) === 0 ) {
|
2069 |
+
$domain = $this->substr( $domain, 8 );
|
2070 |
+
}
|
2071 |
$domain = untrailingslashit( $domain );
|
2072 |
+
|
2073 |
return $domain;
|
2074 |
}
|
2075 |
|
2076 |
/** Sanitize options */
|
2077 |
function sanitize_options( $location = null ) {
|
2078 |
foreach ( $this->setting_options( $location ) as $k => $v ) {
|
2079 |
+
if ( isset( $this->options[ $k ] ) ) {
|
2080 |
+
if ( ! empty( $v['sanitize'] ) ) {
|
2081 |
$type = $v['sanitize'];
|
2082 |
+
} else {
|
2083 |
$type = $v['type'];
|
2084 |
+
}
|
2085 |
switch ( $type ) {
|
2086 |
case 'multiselect':
|
2087 |
+
case 'multicheckbox':
|
2088 |
+
$this->options[ $k ] = urlencode_deep( $this->options[ $k ] );
|
2089 |
+
break;
|
2090 |
+
case 'textarea':
|
2091 |
+
$this->options[ $k ] = wp_kses_post( $this->options[ $k ] );
|
2092 |
+
$this->options[ $k ] = htmlspecialchars( $this->options[ $k ], ENT_QUOTES );
|
2093 |
+
break;
|
2094 |
+
case 'filename':
|
2095 |
+
$this->options[ $k ] = sanitize_file_name( $this->options[ $k ] );
|
2096 |
+
break;
|
2097 |
+
case 'text':
|
2098 |
+
$this->options[ $k ] = wp_kses_post( $this->options[ $k ] );
|
2099 |
case 'checkbox':
|
2100 |
case 'radio':
|
2101 |
case 'select':
|
2102 |
+
default:
|
2103 |
+
if ( ! is_array( $this->options[ $k ] ) ) {
|
2104 |
+
$this->options[ $k ] = esc_attr( $this->options[ $k ] );
|
2105 |
+
}
|
2106 |
}
|
2107 |
}
|
2108 |
}
|
2121 |
function reset_options( $location = null, $delete = false ) {
|
2122 |
if ( $delete === true ) {
|
2123 |
$this->delete_class_option( $delete );
|
2124 |
+
$this->options = array();
|
2125 |
}
|
2126 |
$default_options = $this->default_options( $location );
|
2127 |
foreach ( $default_options as $k => $v ) {
|
2128 |
+
$this->options[ $k ] = $v;
|
2129 |
}
|
2130 |
$this->update_class_option( $this->options );
|
2131 |
}
|
2132 |
+
|
2133 |
/** handle option resetting and updating */
|
2134 |
function handle_settings_updates( $location = null ) {
|
2135 |
$message = '';
|
2136 |
+
if ( ( isset( $_POST['action'] ) && $_POST['action'] == 'aiosp_update_module' &&
|
2137 |
+
( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) || ! empty( $_POST['Submit'] ) ) )
|
2138 |
+
) {
|
2139 |
$nonce = $_POST['nonce-aioseop'];
|
2140 |
+
if ( ! wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) {
|
2141 |
+
die ( __( 'Security Check - If you receive this in error, log out and back in to WordPress', 'all-in-one-seo-pack' ) );
|
2142 |
+
}
|
2143 |
if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) {
|
2144 |
+
$message = __( 'Options Reset.', 'all-in-one-seo-pack' );
|
2145 |
+
if ( isset( $_POST['Submit_All_Default'] ) ) {
|
2146 |
$this->reset_options( $location, true );
|
2147 |
do_action( 'aioseop_options_reset' );
|
2148 |
} else {
|
2149 |
$this->reset_options( $location );
|
2150 |
}
|
2151 |
}
|
2152 |
+
if ( ! empty( $_POST['Submit'] ) ) {
|
2153 |
+
$message = __( 'All in One SEO Options Updated.', 'all-in-one-seo-pack' );
|
2154 |
$default_options = $this->default_options( $location );
|
2155 |
+
foreach ( $default_options as $k => $v ) {
|
2156 |
+
if ( isset( $_POST[ $k ] ) ) {
|
2157 |
+
$this->options[ $k ] = stripslashes_deep( $_POST[ $k ] );
|
2158 |
+
} else {
|
2159 |
+
$this->options[ $k ] = '';
|
2160 |
+
}
|
2161 |
}
|
2162 |
$this->sanitize_options( $location );
|
2163 |
$this->options = apply_filters( $this->prefix . 'update_options', $this->options, $location );
|
2166 |
}
|
2167 |
do_action( $this->prefix . 'settings_update', $this->options, $location );
|
2168 |
}
|
2169 |
+
|
2170 |
return $message;
|
2171 |
}
|
2172 |
|
2173 |
/** Update / reset settings, printing options, sanitizing, posting back */
|
2174 |
function display_settings_page( $location = null ) {
|
2175 |
+
if ( $location != null ) {
|
2176 |
+
$location_info = $this->locations[ $location ];
|
2177 |
+
}
|
2178 |
+
$name = null;
|
2179 |
+
if ( $location && isset( $location_info['name'] ) ) {
|
2180 |
+
$name = $location_info['name'];
|
2181 |
+
}
|
2182 |
+
if ( ! $name ) {
|
2183 |
+
$name = $this->name;
|
2184 |
+
}
|
2185 |
+
$message = $this->handle_settings_updates( $location );
|
2186 |
+
$this->settings_page_init();
|
2187 |
+
?>
|
2188 |
+
<div class="wrap <?php echo get_class( $this ); ?>">
|
2189 |
+
<div id="aioseop_settings_header">
|
2190 |
+
<?php if ( ! empty( $message ) ) {
|
2191 |
+
echo "<div id=\"message\" class=\"updated fade\"><p>$message</p></div>";
|
2192 |
+
} ?>
|
2193 |
+
<div id="icon-aioseop" class="icon32"><br></div>
|
2194 |
+
<h2><?php echo $name; ?></h2>
|
2195 |
+
<div id="dropmessage" class="updated" style="display:none;"></div>
|
2196 |
+
</div>
|
2197 |
+
<?php
|
2198 |
+
do_action( 'aioseop_global_settings_header', $location );
|
2199 |
+
do_action( $this->prefix . 'settings_header', $location );
|
2200 |
+
?>
|
2201 |
+
<form id="aiosp_settings_form" name="dofollow" enctype="multipart/form-data" action="" method="post">
|
2202 |
+
<div id="aioseop_top_button">
|
2203 |
+
<div id="aiosp_ajax_settings_message"></div>
|
2204 |
+
<?php
|
2205 |
+
|
2206 |
+
$submit_options = array(
|
2207 |
+
'action' => array( 'type' => 'hidden', 'value' => 'aiosp_update_module' ),
|
2208 |
+
'module' => array( 'type' => 'hidden', 'value' => get_class( $this ) ),
|
2209 |
+
'location' => array( 'type' => 'hidden', 'value' => $location ),
|
2210 |
+
'nonce-aioseop' => array(
|
2211 |
+
'type' => 'hidden',
|
2212 |
+
'value' => wp_create_nonce( 'aioseop-nonce' )
|
2213 |
+
),
|
2214 |
+
'page_options' => array( 'type' => 'hidden', 'value' => 'aiosp_home_description' ),
|
2215 |
+
'Submit' => array(
|
2216 |
+
'type' => 'submit',
|
2217 |
+
'class' => 'button-primary',
|
2218 |
+
'value' => __( 'Update Options', 'all-in-one-seo-pack' ) . ' »'
|
2219 |
+
),
|
2220 |
+
'Submit_Default' => array(
|
2221 |
+
'type' => 'submit',
|
2222 |
+
'class' => 'button-secondary',
|
2223 |
+
'value' => __( sprintf( 'Reset %s Settings to Defaults', $name ), 'all-in-one-seo-pack' ) . ' »'
|
2224 |
+
)
|
2225 |
+
);
|
2226 |
+
$submit_options = apply_filters( "{$this->prefix}submit_options", $submit_options, $location );
|
2227 |
+
foreach ( $submit_options as $k => $s ) {
|
2228 |
+
if ( $s['type'] == 'submit' && $k != 'Submit' ) {
|
2229 |
+
continue;
|
2230 |
+
}
|
2231 |
+
$class = '';
|
2232 |
+
if ( isset( $s['class'] ) ) {
|
2233 |
+
$class = " class='{$s['class']}' ";
|
2234 |
+
}
|
2235 |
+
echo $this->get_option_html( array(
|
2236 |
+
'name' => $k,
|
2237 |
+
'options' => $s,
|
2238 |
+
'attr' => $class,
|
2239 |
+
'value' => $s['value']
|
2240 |
+
) );
|
2241 |
+
}
|
2242 |
+
?>
|
2243 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2244 |
<div class="aioseop_options_wrapper aioseop_settings_left">
|
2245 |
+
<?php $opts = $this->get_class_option();
|
2246 |
+
if ( $opts !== false ) {
|
2247 |
+
$this->options = $opts;
|
2248 |
+
}
|
2249 |
if ( is_array( $this->layout ) ) {
|
2250 |
+
foreach ( $this->layout as $l => $lopts ) {
|
2251 |
+
if ( ! isset( $lopts['tab'] ) || ( $this->current_tab == $lopts['tab'] ) ) {
|
2252 |
$title = $lopts['name'];
|
2253 |
+
if ( ! empty( $lopts['help_link'] ) ) {
|
2254 |
+
$title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'><span>" . __( 'Help', 'all-in-one-seo-pack' ) . '</span></a>';
|
2255 |
+
}
|
2256 |
+
add_meta_box( $this->get_prefix( $location ) . $l . '_metabox', $title, array(
|
2257 |
+
$this,
|
2258 |
+
'display_options'
|
2259 |
+
),
|
2260 |
+
"{$this->prefix}settings", 'advanced', 'default', $lopts );
|
2261 |
}
|
2262 |
}
|
2263 |
+
} else {
|
2264 |
+
add_meta_box( $this->get_prefix( $location ) . 'metabox', $name, array(
|
2265 |
+
$this,
|
2266 |
+
'display_options'
|
2267 |
+
), "{$this->prefix}settings", 'advanced' );
|
2268 |
+
}
|
2269 |
do_meta_boxes( "{$this->prefix}settings", 'advanced', $location );
|
2270 |
+
?> <p class="submit" style="clear:both;"><?php
|
2271 |
+
foreach ( array( 'action', 'nonce-aioseop', 'page_options' ) as $submit_field ) {
|
2272 |
+
if ( isset( $submit_field ) ) {
|
2273 |
+
unset( $submit_field );
|
2274 |
+
}
|
2275 |
+
}
|
2276 |
+
foreach ( $submit_options as $k => $s ) {
|
2277 |
+
$class = '';
|
2278 |
+
if ( isset( $s['class'] ) ) {
|
2279 |
+
$class = " class='{$s['class']}' ";
|
2280 |
+
}
|
2281 |
+
echo $this->get_option_html( array(
|
2282 |
+
'name' => $k,
|
2283 |
+
'options' => $s,
|
2284 |
+
'attr' => $class,
|
2285 |
+
'value' => $s['value']
|
2286 |
+
) );
|
2287 |
+
}
|
2288 |
+
?> </p>
|
2289 |
+
</div>
|
2290 |
</form>
|
2291 |
+
<?php do_action( $this->prefix . 'settings_footer', $location );
|
2292 |
+
do_action( 'aioseop_global_settings_footer', $location ); ?>
|
2293 |
+
</div> <?php
|
2294 |
}
|
2295 |
+
|
2296 |
/**
|
2297 |
* Get the prefix used for a given location.
|
2298 |
*/
|
2299 |
function get_prefix( $location = null ) {
|
2300 |
+
if ( ( $location != null ) && isset( $this->locations[ $location ]['prefix'] ) ) {
|
2301 |
+
return $this->locations[ $location ]['prefix'];
|
2302 |
+
}
|
2303 |
+
|
2304 |
return $this->prefix;
|
2305 |
}
|
2306 |
|
2307 |
/** Sets up initial settings */
|
2308 |
function setting_options( $location = null, $defaults = null ) {
|
2309 |
+
if ( $defaults === null ) {
|
2310 |
$defaults = $this->default_options;
|
2311 |
+
}
|
2312 |
$prefix = $this->get_prefix( $location );
|
2313 |
+
$opts = array();
|
2314 |
+
if ( $location == null || $this->locations[ $location ]['options'] === null ) {
|
2315 |
$options = $defaults;
|
2316 |
+
} else {
|
2317 |
+
$options = array();
|
2318 |
+
$prefix = "{$prefix}{$location}_";
|
2319 |
+
if ( ! empty( $this->locations[ $location ]['default_options'] ) ) {
|
2320 |
+
$options = $this->locations[ $location ]['default_options'];
|
2321 |
+
}
|
2322 |
+
foreach ( $this->locations[ $location ]['options'] as $opt ) {
|
2323 |
+
if ( isset( $defaults[ $opt ] ) ) {
|
2324 |
+
$options[ $opt ] = $defaults[ $opt ];
|
2325 |
+
}
|
2326 |
+
}
|
2327 |
+
}
|
2328 |
+
if ( ! $prefix ) {
|
2329 |
+
$prefix = $this->prefix;
|
2330 |
+
}
|
2331 |
+
if ( ! empty( $options ) ) {
|
2332 |
+
foreach ( $options as $k => $v ) {
|
2333 |
+
if ( ! isset( $v['name'] ) ) {
|
2334 |
+
$v['name'] = $this->ucwords( strtr( $k, '_', ' ' ) );
|
2335 |
+
}
|
2336 |
+
if ( ! isset( $v['type'] ) ) {
|
2337 |
+
$v['type'] = 'checkbox';
|
2338 |
+
}
|
2339 |
+
if ( ! isset( $v['default'] ) ) {
|
2340 |
+
$v['default'] = null;
|
2341 |
+
}
|
2342 |
+
if ( ! isset( $v['initial_options'] ) ) {
|
2343 |
+
$v['initial_options'] = $v['default'];
|
2344 |
+
}
|
2345 |
+
if ( $v['type'] == 'custom' && ( ! isset( $v['nowrap'] ) ) ) {
|
2346 |
+
$v['nowrap'] = true;
|
2347 |
+
} elseif ( ! isset( $v['nowrap'] ) ) {
|
2348 |
+
$v['nowrap'] = null;
|
2349 |
+
}
|
2350 |
if ( isset( $v['condshow'] ) ) {
|
2351 |
+
if ( ! is_array( $this->script_data ) ) {
|
2352 |
+
$this->script_data = array();
|
2353 |
+
}
|
2354 |
+
if ( ! isset( $this->script_data['condshow'] ) ) {
|
2355 |
+
$this->script_data['condshow'] = array();
|
2356 |
+
}
|
2357 |
+
$this->script_data['condshow'][ $prefix . $k ] = $v['condshow'];
|
2358 |
}
|
2359 |
if ( $v['type'] == 'submit' ) {
|
2360 |
+
if ( ! isset( $v['save'] ) ) {
|
2361 |
+
$v['save'] = false;
|
2362 |
+
}
|
2363 |
+
if ( ! isset( $v['label'] ) ) {
|
2364 |
+
$v['label'] = 'none';
|
2365 |
+
}
|
2366 |
+
if ( ! isset( $v['prefix'] ) ) {
|
2367 |
+
$v['prefix'] = false;
|
2368 |
+
}
|
2369 |
} else {
|
2370 |
+
if ( ! isset( $v['label'] ) ) {
|
2371 |
+
$v['label'] = null;
|
2372 |
+
}
|
2373 |
}
|
2374 |
if ( $v['type'] == 'hidden' ) {
|
2375 |
+
if ( ! isset( $v['label'] ) ) {
|
2376 |
+
$v['label'] = 'none';
|
2377 |
+
}
|
2378 |
+
if ( ! isset( $v['prefix'] ) ) {
|
2379 |
+
$v['prefix'] = false;
|
2380 |
+
}
|
2381 |
+
}
|
2382 |
+
if ( ( $v['type'] == 'text' ) && ( ! isset( $v['size'] ) ) ) {
|
2383 |
+
$v['size'] = 57;
|
2384 |
}
|
|
|
2385 |
if ( $v['type'] == 'textarea' ) {
|
2386 |
+
if ( ! isset( $v['cols'] ) ) {
|
2387 |
+
$v['cols'] = 57;
|
2388 |
+
}
|
2389 |
+
if ( ! isset( $v['rows'] ) ) {
|
2390 |
+
$v['rows'] = 2;
|
2391 |
+
}
|
2392 |
+
}
|
2393 |
+
if ( ! isset( $v['save'] ) ) {
|
2394 |
+
$v['save'] = true;
|
2395 |
+
}
|
2396 |
+
if ( ! isset( $v['prefix'] ) ) {
|
2397 |
+
$v['prefix'] = true;
|
2398 |
+
}
|
2399 |
+
if ( $v['prefix'] ) {
|
2400 |
+
$opts[ $prefix . $k ] = $v;
|
2401 |
+
} else {
|
2402 |
+
$opts[ $k ] = $v;
|
2403 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2404 |
}
|
2405 |
+
}
|
2406 |
+
|
2407 |
return $opts;
|
2408 |
}
|
2409 |
|
2410 |
/** Generates just the default option names and values */
|
2411 |
function default_options( $location = null, $defaults = null ) {
|
2412 |
$options = $this->setting_options( $location, $defaults );
|
2413 |
+
$opts = array();
|
2414 |
+
foreach ( $options as $k => $v ) {
|
2415 |
+
if ( $v['save'] ) {
|
2416 |
+
$opts[ $k ] = $v['default'];
|
2417 |
+
}
|
2418 |
+
}
|
2419 |
+
|
2420 |
return $opts;
|
2421 |
}
|
2422 |
+
|
2423 |
/** Gets the current options stored for a given location. */
|
2424 |
+
function get_current_options( $opts = array(), $location = null, $defaults = null, $post = null ) {
|
2425 |
+
$prefix = $this->get_prefix( $location );
|
2426 |
$get_opts = '';
|
2427 |
+
if ( empty( $location ) ) {
|
2428 |
$type = 'settings';
|
2429 |
+
} else {
|
2430 |
+
$type = $this->locations[ $location ]['type'];
|
2431 |
+
}
|
2432 |
if ( $type === 'settings' ) {
|
2433 |
$get_opts = $this->get_class_option();
|
2434 |
} elseif ( $type == 'metabox' ) {
|
2435 |
if ( $post == null ) {
|
2436 |
global $post;
|
2437 |
}
|
2438 |
+
|
2439 |
if ( ( isset( $_GET['taxonomy'] ) && isset( $_GET['tag_ID'] ) ) || is_category() || is_tag() || is_tax() ) {
|
2440 |
|
2441 |
if ( AIOSEOPPRO ) {
|
2442 |
$get_opts = AIO_ProGeneral::getprotax( $get_opts );
|
2443 |
}
|
2444 |
+
|
2445 |
} elseif ( isset( $post ) ) {
|
2446 |
$get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
|
2447 |
}
|
2448 |
}
|
2449 |
$defs = $this->default_options( $location, $defaults );
|
2450 |
+
if ( $get_opts == '' ) {
|
2451 |
$get_opts = $defs;
|
2452 |
+
} else {
|
2453 |
$get_opts = wp_parse_args( $get_opts, $defs );
|
2454 |
+
}
|
2455 |
$opts = wp_parse_args( $opts, $get_opts );
|
2456 |
+
|
2457 |
return $opts;
|
2458 |
}
|
2459 |
|
2460 |
/** Updates the options array in the module; loads saved settings with get_option() or uses defaults */
|
2461 |
+
function update_options( $opts = array(), $location = null, $defaults = null ) {
|
2462 |
+
if ( $location === null ) {
|
2463 |
$type = 'settings';
|
2464 |
+
} else {
|
2465 |
+
$type = $this->locations[ $location ][ $type ];
|
2466 |
+
}
|
2467 |
if ( $type === 'settings' ) {
|
2468 |
$get_opts = $this->get_class_option();
|
2469 |
}
|
2470 |
+
if ( $get_opts === false ) {
|
2471 |
$get_opts = $this->default_options( $location, $defaults );
|
2472 |
+
} else {
|
2473 |
+
$this->setting_options( $location, $defaults );
|
2474 |
+
} // hack -- make sure this runs anyhow, for now -- pdb
|
2475 |
$this->options = wp_parse_args( $opts, $get_opts );
|
2476 |
}
|
2477 |
}
|
admin/aioseop_module_manager.php
CHANGED
@@ -1,124 +1,208 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
-
*/
|
5 |
/**
|
6 |
* The Module Manager.
|
|
|
|
|
|
|
|
|
|
|
7 |
*/
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
class All_in_One_SEO_Pack_Module_Manager {
|
10 |
-
protected $modules =
|
11 |
protected $settings_update = false;
|
12 |
protected $settings_reset = false;
|
13 |
protected $settings_reset_all = false;
|
14 |
protected $module_settings_update = false;
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
function __construct( $mod ) {
|
|
|
17 |
$this->modules['feature_manager'] = null;
|
18 |
-
foreach ( $mod as $m )
|
19 |
-
|
20 |
-
|
21 |
-
$reset
|
22 |
-
$
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
if ( $update ) {
|
26 |
-
if ( $reset )
|
27 |
-
|
28 |
-
|
29 |
-
if ( $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
$this->do_load_module( 'feature_manager', $mod );
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
function return_module( $class ) {
|
35 |
global $aiosp;
|
36 |
-
if (
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
40 |
return $m;
|
|
|
|
|
|
|
41 |
return false;
|
42 |
}
|
43 |
-
|
|
|
|
|
|
|
44 |
function get_loaded_module_list() {
|
45 |
-
$module_list =
|
46 |
-
if ( !empty( $this->modules ) ) {
|
47 |
-
foreach( $this->modules as $k => $v )
|
48 |
-
if ( !empty( $v ) )
|
49 |
-
$module_list[$k] = get_class( $v );
|
|
|
|
|
50 |
}
|
|
|
51 |
return $module_list;
|
52 |
}
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
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 |
-
|
65 |
-
$
|
66 |
-
$classname
|
67 |
-
$
|
68 |
-
$
|
69 |
-
$
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
72 |
if ( is_admin() ) {
|
73 |
-
add_action( 'aioseop_modules_add_menus',
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
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 ) )
|
|
|
|
|
84 |
$v = $this->modules[ $mod ];
|
85 |
-
if (
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
91 |
return false;
|
|
|
92 |
$mod_enable = false;
|
93 |
-
$fm_page
|
94 |
-
|
95 |
-
if ( $fm_page &&
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
100 |
} else {
|
101 |
-
if ( $feature_prefix
|
102 |
$feature_prefix = $this->modules['feature_manager']->get_prefix();
|
103 |
-
|
|
|
104 |
$feature_options = $this->modules['feature_manager']->default_options();
|
105 |
-
|
106 |
-
|
|
|
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 )
|
|
|
|
|
|
|
115 |
return false;
|
116 |
}
|
117 |
|
118 |
function load_modules() {
|
119 |
-
if ( is_array( $this->modules ) )
|
120 |
-
foreach( $this->modules as $k => $v )
|
121 |
$this->load_module( $k );
|
|
|
|
|
122 |
}
|
123 |
}
|
124 |
}
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/**
|
3 |
* The Module Manager.
|
4 |
+
*
|
5 |
+
* Mostly we're activating and deactivating modules/features.
|
6 |
+
*
|
7 |
+
* @package All-in-One-SEO-Pack
|
8 |
+
* @since 2.0
|
9 |
*/
|
10 |
+
|
11 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class All_in_One_SEO_Pack_Module_Manager
|
15 |
+
*/
|
16 |
class All_in_One_SEO_Pack_Module_Manager {
|
17 |
+
protected $modules = array();
|
18 |
protected $settings_update = false;
|
19 |
protected $settings_reset = false;
|
20 |
protected $settings_reset_all = false;
|
21 |
protected $module_settings_update = false;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* All_in_One_SEO_Pack_Module_Manager constructor.
|
25 |
+
*
|
26 |
+
* Initialize module list.
|
27 |
+
*
|
28 |
+
* @param $mod Modules.
|
29 |
+
*/
|
30 |
function __construct( $mod ) {
|
31 |
+
|
32 |
$this->modules['feature_manager'] = null;
|
33 |
+
foreach ( $mod as $m ) {
|
34 |
+
$this->modules[ $m ] = null;
|
35 |
+
}
|
36 |
+
$reset = false;
|
37 |
+
$reset_all = ( isset( $_POST['Submit_All_Default'] ) && '' !== $_POST['Submit_All_Default'] );
|
38 |
+
$reset = ( ( isset( $_POST['Submit_Default'] ) && '' !== $_POST['Submit_Default'] ) || $reset_all );
|
39 |
+
$update = ( isset( $_POST['action'] ) && $_POST['action']
|
40 |
+
&& ( ( isset( $_POST['Submit'] ) && '' !== $_POST['Submit'] ) || $reset )
|
41 |
+
);
|
42 |
if ( $update ) {
|
43 |
+
if ( $reset ) {
|
44 |
+
$this->settings_reset = true;
|
45 |
+
}
|
46 |
+
if ( $reset_all ) {
|
47 |
+
$this->settings_reset_all = true;
|
48 |
+
}
|
49 |
+
if ( 'aiosp_update' === $_POST['action'] ) {
|
50 |
+
$this->settings_update = true;
|
51 |
+
}
|
52 |
+
if ( 'aiosp_update_module' === $_POST['action'] ) {
|
53 |
+
$this->module_settings_update = true;
|
54 |
+
}
|
55 |
}
|
56 |
$this->do_load_module( 'feature_manager', $mod );
|
57 |
}
|
58 |
|
59 |
+
/**
|
60 |
+
* Return module.
|
61 |
+
*
|
62 |
+
* @param $class
|
63 |
+
*
|
64 |
+
* @return $this|bool|mixed
|
65 |
+
*/
|
66 |
function return_module( $class ) {
|
67 |
global $aiosp;
|
68 |
+
if ( get_class( $aiosp ) === $class ) {
|
69 |
+
return $aiosp;
|
70 |
+
}
|
71 |
+
if ( get_class( $aiosp ) === $class ) {
|
72 |
+
return $this;
|
73 |
+
}
|
74 |
+
foreach ( $this->modules as $m ) {
|
75 |
+
if ( is_object( $m ) && ( get_class( $m ) === $class ) ) {
|
76 |
return $m;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
return false;
|
81 |
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @return array
|
85 |
+
*/
|
86 |
function get_loaded_module_list() {
|
87 |
+
$module_list = array();
|
88 |
+
if ( ! empty( $this->modules ) ) {
|
89 |
+
foreach ( $this->modules as $k => $v ) {
|
90 |
+
if ( ! empty( $v ) ) {
|
91 |
+
$module_list[ $k ] = get_class( $v );
|
92 |
+
}
|
93 |
+
}
|
94 |
}
|
95 |
+
|
96 |
return $module_list;
|
97 |
}
|
98 |
|
99 |
+
/**
|
100 |
+
* @param $mod Module.
|
101 |
+
* @param null $args
|
102 |
+
*
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
function do_load_module( $mod, $args = null ) {
|
106 |
+
// Module name is used for these automatic settings:
|
107 |
+
// The aiosp_enable_$module settings - whether each plugin is active or not.
|
108 |
+
// The name of the .php file containing the module - aioseop_$module.php.
|
109 |
+
// The name of the class - All_in_One_SEO_Pack_$Module.
|
110 |
+
// The global $aioseop_$module.
|
111 |
+
// $this->modules[$module].
|
112 |
+
|
113 |
$mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "modules/aioseop_$mod.php" );
|
114 |
+
if ( ! empty( $mod_path ) ) {
|
115 |
require_once( $mod_path );
|
116 |
+
}
|
117 |
+
$ref = "aioseop_$mod";
|
118 |
+
$classname = 'All_in_One_SEO_Pack_' . strtr( ucwords( strtr( $mod, '_', ' ' ) ), ' ', '_' );
|
119 |
+
$classname = apply_filters( "aioseop_class_$mod", $classname );
|
120 |
+
$module_class = new $classname( $args );
|
121 |
+
$GLOBALS[ $ref ] = $module_class;
|
122 |
+
$this->modules[ $mod ] = $module_class;
|
123 |
+
if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
|
124 |
+
add_action( 'admin_bar_menu', array(
|
125 |
+
$module_class,
|
126 |
+
'add_admin_bar_submenu',
|
127 |
+
), 1001 + $module_class->menu_order() );
|
128 |
+
}
|
129 |
if ( is_admin() ) {
|
130 |
+
add_action( 'aioseop_modules_add_menus', array(
|
131 |
+
$module_class,
|
132 |
+
'add_menu',
|
133 |
+
), $module_class->menu_order() );
|
134 |
+
add_action( 'aiosoep_options_reset', array( $module_class, 'reset_options' ) );
|
135 |
+
add_filter( 'aioseop_export_settings', array( $module_class, 'settings_export' ) );
|
136 |
}
|
137 |
+
|
138 |
return true;
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* @param $mod
|
143 |
+
*
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
function load_module( $mod ) {
|
147 |
static $feature_options = null;
|
148 |
static $feature_prefix = null;
|
149 |
+
if ( ! is_array( $this->modules ) ) {
|
150 |
+
return false;
|
151 |
+
}
|
152 |
$v = $this->modules[ $mod ];
|
153 |
+
if ( null !== $v ) {
|
154 |
+
return false;
|
155 |
+
} // Already loaded.
|
156 |
+
if ( 'performance' === $mod && ! is_super_admin() ) {
|
157 |
+
return false;
|
158 |
+
}
|
159 |
+
if ( ( 'file_editor' === $mod || 'robots' === $mod )
|
160 |
+
&& ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
|
161 |
+
|| ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
|
162 |
+
|| ! is_super_admin() )
|
163 |
+
) {
|
164 |
return false;
|
165 |
+
}
|
166 |
$mod_enable = false;
|
167 |
+
$fm_page = ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) &&
|
168 |
+
isset( $_REQUEST['page'] ) && trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . 'modules/aioseop_feature_manager.php' === $_REQUEST['page'] );
|
169 |
+
if ( $fm_page && ! $this->settings_reset ) {
|
170 |
+
if ( isset( $_POST["aiosp_feature_manager_enable_$mod"] ) ) {
|
171 |
+
$mod_enable = $_POST["aiosp_feature_manager_enable_$mod"];
|
172 |
+
} else {
|
173 |
+
$mod_enable = false;
|
174 |
+
}
|
175 |
} else {
|
176 |
+
if ( null === $feature_prefix ) {
|
177 |
$feature_prefix = $this->modules['feature_manager']->get_prefix();
|
178 |
+
}
|
179 |
+
if ( $fm_page && $this->settings_reset ) {
|
180 |
$feature_options = $this->modules['feature_manager']->default_options();
|
181 |
+
}
|
182 |
+
if ( null === $feature_options ) {
|
183 |
+
if ( $this->module_settings_update && $this->settings_reset_all && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
|
184 |
$feature_options = $this->modules['feature_manager']->default_options();
|
185 |
+
} else {
|
186 |
$feature_options = $this->modules['feature_manager']->get_current_options();
|
187 |
+
}
|
188 |
}
|
189 |
+
if ( isset( $feature_options["{$feature_prefix}enable_$mod"] ) ) {
|
190 |
$mod_enable = $feature_options["{$feature_prefix}enable_$mod"];
|
191 |
+
}
|
192 |
}
|
193 |
+
if ( $mod_enable ) {
|
194 |
+
return $this->do_load_module( $mod );
|
195 |
+
}
|
196 |
+
|
197 |
return false;
|
198 |
}
|
199 |
|
200 |
function load_modules() {
|
201 |
+
if ( is_array( $this->modules ) ) {
|
202 |
+
foreach ( $this->modules as $k => $v ) {
|
203 |
$this->load_module( $k );
|
204 |
+
}
|
205 |
+
}
|
206 |
}
|
207 |
}
|
208 |
}
|
admin/display/general-metaboxes.php
CHANGED
@@ -3,117 +3,166 @@
|
|
3 |
/**
|
4 |
* @package All-in-One-SEO-Pack
|
5 |
*/
|
6 |
-
|
7 |
class aiosp_metaboxes {
|
8 |
-
|
|
|
|
|
|
|
9 |
function __construct() {
|
10 |
//construct
|
11 |
|
12 |
}
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
static function display_extra_metaboxes( $add, $meta ) {
|
21 |
echo "<div class='aioseop_metabox_wrapper' >";
|
22 |
switch ( $meta['id'] ) {
|
23 |
-
case
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
href="http://semperfiwebdesign.com/">Semper Fi Web Design</a>' ); ?>.</p>
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
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' );
|
42 |
-
|
43 |
-
|
|
|
44 |
<?php
|
45 |
-
|
46 |
-
|
47 |
<div>
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
59 |
|
60 |
<div class="aioseop_metabox_feature">
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
<?php } ?>
|
79 |
</div>
|
80 |
-
|
81 |
-
|
82 |
-
case
|
83 |
-
|
84 |
<div class="aioseop_metabox_text">
|
85 |
-
|
86 |
-
|
|
|
|
|
87 |
<h2><?php _e( 'Join our mailing list for tips, tricks, and WordPress secrets.', 'all-in-one-seo-pack' ); ?></h2>
|
88 |
-
<p
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
92 |
</div>
|
93 |
-
|
94 |
break;
|
95 |
-
|
96 |
-
|
97 |
-
<
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
</div>
|
105 |
-
|
106 |
-
|
107 |
}
|
108 |
-
echo
|
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¤cy_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¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">
|
72 |
+
<img src="<?php echo AIOSEOP_PLUGIN_URL; ?>images/donate.jpg"
|
73 |
+
alt="<?php _e( 'Donate with Paypal', 'all-in-one-seo-pack' ); ?>"/> </a>
|
74 |
+
<a target="_blank" title="Amazon Wish List"
|
75 |
+
href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web">
|
76 |
+
<img src="<?php echo AIOSEOP_PLUGIN_URL; ?>images/amazon.jpg"
|
77 |
+
alt="<?php _e( 'My Amazon Wish List', 'all-in-one-seo-pack' ); ?>"/> </a>
|
78 |
+
<?php } ?>
|
79 |
+
|
80 |
+
<a target="_blank" title="<?php _e( 'Follow us on Facebook', 'all-in-one-seo-pack' ); ?>"
|
81 |
+
href="https://www.facebook.com/aioseopack/"><span
|
82 |
+
class="aioseop_follow_button aioseop_facebook_follow"></span></a>
|
83 |
+
<a target="_blank" title="<?php _e( 'Follow us on Twitter', 'all-in-one-seo-pack' ); ?>"
|
84 |
+
href="https://twitter.com/aioseopack"><span
|
85 |
+
class="aioseop_follow_button aioseop_twitter_follow"></span></a>
|
86 |
+
</div><?php
|
87 |
+
|
88 |
+
$aiosp_trans = new AIOSEOP_Translations();
|
89 |
+
// Eventually if nothing is returned we should just remove this section.
|
90 |
+
|
91 |
+
if ( get_locale() != 'en_US' ) { ?>
|
92 |
+
<div><strong>
|
93 |
+
<?php
|
94 |
+
|
95 |
+
if ( $aiosp_trans->percent_translated < 100 ) {
|
96 |
+
|
97 |
+
/* translators: %1$s expands to the number of languages All in One SEO Pack has been translated into. $2%s to the percentage translated of the current language, $3%s to the language name, %4$s and %5$s to anchor tags with link to translation page at translate.wordpress.org */
|
98 |
+
printf( __(
|
99 |
+
'All in One SEO Pack has been translated into %1$s languages, but currently the %3$s translation is only %2$s percent complete. %4$s Click here %5$s to help get it to 100 percent.', 'all-in-one-seo-pack' ),
|
100 |
+
$aiosp_trans->translated_count,
|
101 |
+
$aiosp_trans->percent_translated,
|
102 |
+
$aiosp_trans->name,
|
103 |
+
"<a href=\"$aiosp_trans->translation_url\" target=\"_BLANK\">",
|
104 |
+
'</a>' );
|
105 |
+
}
|
106 |
+
|
107 |
+
?>
|
108 |
+
</strong></div>
|
109 |
<?php } ?>
|
110 |
</div>
|
111 |
+
<?php
|
112 |
+
break;
|
113 |
+
case 'aioseop-list':
|
114 |
+
?>
|
115 |
<div class="aioseop_metabox_text">
|
116 |
+
<form
|
117 |
+
action="http://semperfiwebdesign.us1.list-manage.com/subscribe/post?u=794674d3d54fdd912f961ef14&id=af0a96d3d9"
|
118 |
+
method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
|
119 |
+
target="_blank">
|
120 |
<h2><?php _e( 'Join our mailing list for tips, tricks, and WordPress secrets.', 'all-in-one-seo-pack' ); ?></h2>
|
121 |
+
<p>
|
122 |
+
<i><?php _e( 'Sign up today and receive a free copy of the e-book 5 SEO Tips for WordPress ($39 value).', 'all-in-one-seo-pack' ); ?></i>
|
123 |
+
</p>
|
124 |
+
<p><input type="text" value="" name="EMAIL" class="required email" id="mce-EMAIL"
|
125 |
+
placeholder="Email Address">
|
126 |
+
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe"
|
127 |
+
class="btn"></p>
|
128 |
+
</form>
|
129 |
</div>
|
130 |
+
<?php
|
131 |
break;
|
132 |
+
case 'aioseop-support':
|
133 |
+
?>
|
134 |
+
<div class="aioseop_metabox_text">
|
135 |
+
<p>
|
136 |
+
<div class="aioseop_icon aioseop_file_icon"></div>
|
137 |
+
<a target="_blank"
|
138 |
+
href="http://semperplugins.com/documentation/"><?php _e( 'Read the All in One SEO Pack user guide', 'all-in-one-seo-pack' ); ?></a></p>
|
139 |
+
<p>
|
140 |
+
<div class="aioseop_icon aioseop_support_icon"></div>
|
141 |
+
<a target="_blank"
|
142 |
+
title="<?php _e( 'All in One SEO Pro Plugin Support Forum', 'all-in-one-seo-pack' ); ?>"
|
143 |
+
href="http://semperplugins.com/support/"><?php _e( 'Access our Premium Support Forums', 'all-in-one-seo-pack' ); ?></a></p>
|
144 |
+
<p>
|
145 |
+
<div class="aioseop_icon aioseop_cog_icon"></div>
|
146 |
+
<a target="_blank" title="<?php _e( 'All in One SEO Pro Plugin Changelog', 'all-in-one-seo-pack' ); ?>"
|
147 |
+
href="<?php if ( AIOSEOPPRO ) {
|
148 |
+
echo 'http://semperplugins.com/documentation/all-in-one-seo-pack-pro-changelog/';
|
149 |
+
} else {
|
150 |
+
echo 'http://semperfiwebdesign.com/blog/all-in-one-seo-pack/all-in-one-seo-pack-release-history/';
|
151 |
+
} ?>"><?php _e( 'View the Changelog', 'all-in-one-seo-pack' ); ?></a></p>
|
152 |
+
<p>
|
153 |
+
<div class="aioseop_icon aioseop_youtube_icon"></div>
|
154 |
+
<a target="_blank"
|
155 |
+
href="http://semperplugins.com/doc-type/video/"><?php _e( 'Watch video tutorials', 'all-in-one-seo-pack' ); ?></a></p>
|
156 |
+
<p>
|
157 |
+
<div class="aioseop_icon aioseop_book_icon"></div>
|
158 |
+
<a target="_blank"
|
159 |
+
href="http://semperplugins.com/documentation/quick-start-guide/"><?php _e( 'Getting started? Read the Beginners Guide', 'all-in-one-seo-pack' ); ?></a></p>
|
160 |
</div>
|
161 |
+
<?php
|
162 |
+
break;
|
163 |
}
|
164 |
+
echo '</div>';
|
165 |
}
|
166 |
+
|
167 |
+
|
168 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/display/index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
admin/index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
admin/meta_import.php
CHANGED
@@ -1,119 +1,131 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if( class_exists( 'WPSEO_Import_Hooks' )){
|
4 |
-
class WPSEO_Import_AIOSEO_Hooks extends WPSEO_Import_Hooks {
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
|
|
|
|
|
|
9 |
|
10 |
-
|
11 |
-
|
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 |
-
|
20 |
|
21 |
-
|
22 |
|
23 |
-
echo '<div class="
|
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 |
-
|
35 |
-
|
|
|
36 |
}
|
37 |
-
}
|
38 |
-
}else{
|
39 |
add_action( 'init', 'mi_aioseop_yst_detected_notice_dismissed' );
|
40 |
}
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
43 |
delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
-
*
|
|
|
|
|
48 |
*/
|
49 |
-
add_action('admin_menu', 'aiosp_seometa_settings_init');
|
50 |
function aiosp_seometa_settings_init() {
|
51 |
global $_aiosp_seometa_admin_pagehook;
|
52 |
-
|
53 |
-
//
|
54 |
-
$_aiosp_seometa_admin_pagehook = add_submenu_page('tools.php', __('Import SEO Data','all-in-one-seo-pack'), __('SEO Data Import','all-in-one-seo-pack'), 'manage_options', 'aiosp_import', 'aiosp_seometa_admin');
|
55 |
}
|
|
|
|
|
56 |
|
57 |
/**
|
58 |
-
*
|
59 |
-
*
|
|
|
60 |
*/
|
61 |
function aiosp_seometa_action() {
|
62 |
-
|
63 |
-
|
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 (
|
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…', '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 |
-
//
|
93 |
-
|
94 |
-
printf( '<p><b>%s</b></p>', __('Compatible data:', 'all-in-one-seo-pack') );
|
95 |
echo '<ol>';
|
96 |
-
foreach ( (array)$response->elements as $element ) {
|
97 |
printf( '<li>%s</li>', $element );
|
98 |
}
|
99 |
echo '</ol>';
|
100 |
-
|
101 |
return;
|
102 |
}
|
103 |
-
|
104 |
-
printf( '<h3>%s</h3>', __('Conversion Results', 'all-in-one-seo-pack') );
|
105 |
-
|
106 |
-
$result = aiosp_seometa_post_meta_convert( stripslashes($_REQUEST['platform_old']), 'All in One SEO Pack' );
|
107 |
if ( is_wp_error( $result ) ) {
|
108 |
-
printf( '<p>%s</p>', __('Sorry, something went wrong. Please try again') );
|
|
|
109 |
return;
|
110 |
}
|
111 |
-
|
112 |
printf( '<p><b>%d</b> Records were updated</p>', isset( $result->updated ) ? $result->updated : 0 );
|
113 |
printf( '<p><b>%d</b> Records were ignored</p>', isset( $result->ignored ) ? $result->ignored : 0 );
|
114 |
-
|
115 |
-
return;
|
116 |
-
|
117 |
}
|
118 |
|
119 |
/**
|
@@ -126,457 +138,472 @@ function aiosp_seometa_action() {
|
|
126 |
*/
|
127 |
function aiosp_seometa_admin() {
|
128 |
global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
|
129 |
-
?>
|
130 |
|
131 |
<div class="wrap">
|
132 |
-
|
133 |
-
<?php screen_icon('tools'); ?>
|
134 |
-
<h2><?php _e('Import SEO Settings', 'all-in-one-seo-pack'); ?></h2>
|
135 |
-
|
136 |
-
<p><span class="description"><?php printf( __('Use the drop down below to choose which plugin or theme you wish to import SEO data from.', 'all-in-one-seo-pack') ); ?></span></p>
|
137 |
-
|
138 |
-
<p><span class="description"><?php printf( __('Click "Analyze" for a list of SEO data that can be imported into All in One SEO Pack, along with the number of records that will be imported.', 'all-in-one-seo-pack') ); ?></span></p>
|
139 |
-
|
140 |
-
<p><span class="description"><strong><?php printf( __('Please Note: ') ); ?></strong><?php printf( __('Some plugins and themes do not share similar data, or they store data in a non-standard way. If we cannot import this data, it will remain unchanged in your database. Any compatible SEO data will be displayed for you to review. If a post or page already has SEO data in All in One SEO Pack, we will not import data from another plugin/theme.', 'all-in-one-seo-pack') ); ?></span></p>
|
141 |
-
|
142 |
-
<p><span class="description"><?php printf( __('Click "Convert" to perform the import. After the import has completed, you will be alerted to how many records were imported, and how many records had to be ignored, based on the criteria above.', 'all-in-one-seo-pack') ); ?></span></p>
|
143 |
-
|
144 |
-
<p><span class="row-title"><?php printf( esc_html__('Before performing an import, we strongly recommend that you make a backup of your site. We use and recommend %s BackupBuddy %s for backups.', 'all-in-one-seo-pack'), sprintf( '<a target="_blank" href="%s">', esc_url( 'http://semperfiwebdesign.com/backupbuddy/' ) ), '</a>' ); ?></span></p>
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
<form action="<?php echo admin_url('tools.php?page=aiosp_import'); ?>" method="post">
|
149 |
-
<?php
|
150 |
-
wp_nonce_field('aiosp_nonce');
|
151 |
-
|
152 |
-
$platform_old = (!isset($_POST['platform_old'])) ? '' : $_POST['platform_old'];
|
153 |
-
|
154 |
-
_e('Import SEO data from:', 'all-in-one-seo-pack');
|
155 |
-
echo '<select name="platform_old">';
|
156 |
-
printf( '<option value="">%s</option>', __('Choose platform:', 'all-in-one-seo-pack') );
|
157 |
-
|
158 |
-
printf( '<optgroup label="%s">', __('Plugins', 'all-in-one-seo-pack') );
|
159 |
-
foreach ( $_aiosp_seometa_plugins as $platform => $data ) {
|
160 |
-
if($platform != "All in One SEO Pack") printf( '<option value="%s" %s>%s</option>', $platform, selected($platform, $platform_old, 0), $platform );
|
161 |
-
}
|
162 |
-
printf( '</optgroup>' );
|
163 |
-
|
164 |
-
printf( '<optgroup label="%s">', __('Themes', 'all-in-one-seo-pack') );
|
165 |
-
foreach ( $_aiosp_seometa_themes as $platform => $data ) {
|
166 |
-
printf( '<option value="%s" %s>%s</option>', $platform, selected($platform, $platform_old, 0), $platform );
|
167 |
-
}
|
168 |
-
printf( '</optgroup>' );
|
169 |
-
|
170 |
|
171 |
-
|
172 |
-
echo '</select>' . "\n\n";
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
<input type="submit" class="button-highlighted" name="analyze" value="<?php _e('Analyze', 'genesis'); ?>" />
|
177 |
-
<input type="submit" class="button-primary" value="<?php _e('Convert', 'genesis') ?>" />
|
178 |
-
|
179 |
-
</form>
|
180 |
-
|
181 |
-
<?php aiosp_seometa_action(); ?>
|
182 |
-
|
183 |
-
</div>
|
184 |
|
185 |
-
|
186 |
-
|
|
|
187 |
|
|
|
|
|
|
|
188 |
|
|
|
|
|
|
|
189 |
|
190 |
-
|
|
|
|
|
191 |
|
192 |
-
|
193 |
-
|
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 |
-
|
|
|
|
|
210 |
|
211 |
-
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
}
|
217 |
|
218 |
-
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
223 |
|
224 |
-
|
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 |
-
|
233 |
-
|
234 |
-
|
235 |
-
$not_in = implode(', ', (array)$not_in );
|
236 |
|
237 |
-
|
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 |
-
|
244 |
|
245 |
-
|
|
|
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 |
-
|
261 |
|
262 |
-
|
263 |
|
264 |
-
|
|
|
265 |
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
|
|
270 |
|
271 |
-
|
272 |
-
|
|
|
|
|
|
|
273 |
$output->ignored = 0;
|
274 |
|
275 |
-
|
|
|
276 |
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
280 |
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
|
285 |
-
|
286 |
-
$result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old );
|
287 |
|
288 |
-
|
289 |
-
if ( is_wp_error( $result ) )
|
290 |
-
continue;
|
291 |
|
292 |
-
|
293 |
-
$output->updated = $output->updated + (int)$result->updated;
|
294 |
-
$output->ignored = $output->ignored + (int)$result->ignored;
|
295 |
|
296 |
-
|
297 |
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
-
|
301 |
|
302 |
-
|
303 |
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) {
|
309 |
|
310 |
-
|
|
|
311 |
|
312 |
-
|
|
|
|
|
313 |
|
314 |
-
|
315 |
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
}
|
320 |
|
321 |
-
$
|
322 |
-
$
|
323 |
-
$
|
324 |
|
325 |
-
|
|
|
326 |
|
327 |
-
|
328 |
-
|
329 |
-
|
|
|
330 |
|
331 |
-
|
|
|
|
|
332 |
|
333 |
-
|
334 |
-
$ignore = 0;
|
335 |
-
// $ignore = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
|
336 |
|
337 |
-
|
338 |
-
$update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
|
339 |
|
340 |
-
|
341 |
-
// $ignore = count( (array)$ignore );
|
342 |
-
$update = count( (array)$update );
|
343 |
|
344 |
-
|
345 |
-
// $update = ( (int)$update > (int)$ignore ) ? ( (int)$update - (int)$ignore ) : 0;
|
346 |
|
347 |
-
|
348 |
-
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
|
351 |
-
|
352 |
|
353 |
-
|
354 |
|
355 |
-
|
|
|
356 |
|
357 |
return $output;
|
358 |
-
|
359 |
}
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
////////////PLUGIN/////////
|
364 |
|
|
|
|
|
|
|
365 |
|
366 |
-
|
367 |
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
function aiosp_seometa_import() {
|
373 |
|
374 |
-
|
375 |
|
376 |
-
|
377 |
-
|
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 |
-
|
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 |
-
|
513 |
-
|
514 |
-
$_aiosp_seometa_platforms = array_merge( $_aiosp_seometa_themes, $_aiosp_seometa_plugins );
|
515 |
|
516 |
-
|
517 |
-
|
518 |
-
*/
|
519 |
-
// require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' );
|
520 |
-
// require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
|
521 |
|
522 |
-
|
523 |
-
|
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 |
-
|
542 |
|
543 |
-
|
544 |
-
aiosp_seometa_meta_key_convert( '_yoast_seo_metadesc', 'yoast_wpseo_metadesc', true );
|
545 |
|
546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
|
548 |
/**
|
549 |
-
*
|
550 |
*/
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
|
556 |
/**
|
557 |
-
*
|
558 |
*/
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
|
564 |
/**
|
565 |
-
*
|
566 |
*/
|
567 |
-
|
568 |
-
foreach ( $_aiosp_seometa_platforms as $platform => $data ) {
|
569 |
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
}
|
576 |
-
/**/
|
577 |
|
578 |
/**
|
579 |
-
*
|
|
|
|
|
|
|
|
|
|
|
580 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
|
582 |
|
1 |
<?php
|
2 |
|
3 |
+
if ( class_exists( 'WPSEO_Import_Hooks' ) ) {
|
|
|
4 |
|
5 |
+
/**
|
6 |
+
* Class WPSEO_Import_AIOSEO_Hooks
|
7 |
+
*
|
8 |
+
* @TODO Move this elsewhere.
|
9 |
+
*/
|
10 |
+
class WPSEO_Import_AIOSEO_Hooks extends WPSEO_Import_Hooks {
|
11 |
+
|
12 |
+
protected $plugin_file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
|
13 |
+
|
14 |
+
protected $deactivation_listener = 'deactivate_aioseo';
|
15 |
|
16 |
+
/**
|
17 |
+
* Show notice the old plugin is installed and offer to import its data.
|
18 |
+
*/
|
19 |
+
public function show_import_settings_notice() {
|
20 |
|
21 |
+
$yoasturl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'wpseo-import' ) ), admin_url( 'admin.php?page=wpseo_tools&tool=import-export&import=1&importaioseo=1#top#import-seo' ) );
|
22 |
+
$aiourl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'aiosp-import' ) ), admin_url( 'tools.php?page=aiosp_import' ) );
|
|
|
23 |
|
24 |
+
$aioseop_yst_detected_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
|
|
|
|
|
25 |
|
26 |
+
if ( empty( $aioseop_yst_detected_notice_dismissed ) ) {
|
27 |
|
28 |
+
echo '<div class="notice notice-warning row-title is-dismissible yst_notice"><p>', sprintf( esc_html__( 'The plugin Yoast SEO has been detected. Do you want to %simport its settings%s into All in One SEO Pack?', 'all-in-one-seo-pack' ), sprintf( '<a href="%s">', esc_url( $aiourl ) ), '</a>' ), '</p></div>';
|
29 |
|
30 |
+
}
|
31 |
|
32 |
+
echo '<div class="error"><p>', sprintf( esc_html__( 'The plugin All-In-One-SEO has been detected. Do you want to %simport its settings%s?', 'wordpress-seo' ), sprintf( '<a href="%s">', esc_url( $yoasturl ) ), '</a>' ), '</p></div>';
|
33 |
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
public function show_deactivate_notice() {
|
37 |
+
echo '<div class="updated"><p>', esc_html__( 'All in One SEO has been deactivated', 'all-in-one-seo-pack' ), '</p></div>';
|
38 |
+
}
|
39 |
}
|
40 |
+
} else {
|
|
|
41 |
add_action( 'init', 'mi_aioseop_yst_detected_notice_dismissed' );
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Deletes the stored dismissal of the notice.
|
46 |
+
*
|
47 |
+
* This should only happen after reactivating after being deactivated.
|
48 |
+
*/
|
49 |
+
function mi_aioseop_yst_detected_notice_dismissed() {
|
50 |
delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
+
* Init for settings import class.
|
55 |
+
*
|
56 |
+
* At the moment we just register the admin menu page.
|
57 |
*/
|
|
|
58 |
function aiosp_seometa_settings_init() {
|
59 |
global $_aiosp_seometa_admin_pagehook;
|
60 |
+
|
61 |
+
// TODO Put this in with the rest of the import/export stuff.
|
62 |
+
$_aiosp_seometa_admin_pagehook = add_submenu_page( 'tools.php', __( 'Import SEO Data', 'all-in-one-seo-pack' ), __( 'SEO Data Import', 'all-in-one-seo-pack' ), 'manage_options', 'aiosp_import', 'aiosp_seometa_admin' );
|
63 |
}
|
64 |
+
add_action( 'admin_menu', 'aiosp_seometa_settings_init' );
|
65 |
+
|
66 |
|
67 |
/**
|
68 |
+
* Intercept POST data from the form submission.
|
69 |
+
*
|
70 |
+
* Use the intercepted data to convert values in the postmeta table from one platform to another.
|
71 |
*/
|
72 |
function aiosp_seometa_action() {
|
73 |
+
|
74 |
+
if ( empty( $_REQUEST['_wpnonce'] ) ) {
|
|
|
|
|
75 |
return;
|
76 |
+
}
|
77 |
+
|
78 |
if ( empty( $_REQUEST['platform_old'] ) ) {
|
79 |
+
printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) );
|
80 |
+
|
81 |
return;
|
82 |
}
|
83 |
+
|
84 |
+
if ( 'All in One SEO Pack' === $_REQUEST['platform_old'] ) {
|
85 |
+
printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) );
|
86 |
+
|
87 |
return;
|
88 |
}
|
89 |
+
|
90 |
+
check_admin_referer( 'aiosp_nonce' ); // Verify nonce. TODO We should make this better.
|
91 |
+
|
92 |
+
if ( ! empty( $_REQUEST['analyze'] ) ) {
|
93 |
+
|
94 |
+
printf( '<h3>%s</h3>', __( 'Analysis Results', 'all-in-one-seo-pack' ) );
|
95 |
+
|
96 |
$response = aiosp_seometa_post_meta_analyze( $_REQUEST['platform_old'], 'All in One SEO Pack' );
|
97 |
if ( is_wp_error( $response ) ) {
|
98 |
+
printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, something went wrong. Please try again' ) );
|
99 |
+
|
100 |
return;
|
101 |
}
|
102 |
+
|
103 |
+
printf( __( '<p>Analyzing records in a %s to %s conversion…', 'all-in-one-seo-pack' ), esc_html( $_POST['platform_old'] ), 'All in One SEO Pack' );
|
104 |
printf( '<p><b>%d</b> Compatible Records were identified</p>', $response->update );
|
105 |
+
// printf( '<p>%d Compatible Records will be ignored</p>', $response->ignore );
|
106 |
+
|
107 |
+
printf( '<p><b>%s</b></p>', __( 'Compatible data:', 'all-in-one-seo-pack' ) );
|
108 |
echo '<ol>';
|
109 |
+
foreach ( (array) $response->elements as $element ) {
|
110 |
printf( '<li>%s</li>', $element );
|
111 |
}
|
112 |
echo '</ol>';
|
113 |
+
|
114 |
return;
|
115 |
}
|
116 |
+
|
117 |
+
printf( '<h3>%s</h3>', __( 'Conversion Results', 'all-in-one-seo-pack' ) );
|
118 |
+
|
119 |
+
$result = aiosp_seometa_post_meta_convert( stripslashes( $_REQUEST['platform_old'] ), 'All in One SEO Pack' );
|
120 |
if ( is_wp_error( $result ) ) {
|
121 |
+
printf( '<p>%s</p>', __( 'Sorry, something went wrong. Please try again' ) );
|
122 |
+
|
123 |
return;
|
124 |
}
|
125 |
+
|
126 |
printf( '<p><b>%d</b> Records were updated</p>', isset( $result->updated ) ? $result->updated : 0 );
|
127 |
printf( '<p><b>%d</b> Records were ignored</p>', isset( $result->ignored ) ? $result->ignored : 0 );
|
128 |
+
|
|
|
|
|
129 |
}
|
130 |
|
131 |
/**
|
138 |
*/
|
139 |
function aiosp_seometa_admin() {
|
140 |
global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
|
141 |
+
?>
|
142 |
|
143 |
<div class="wrap">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
|
|
|
|
145 |
|
146 |
+
<h2><?php _e( 'Import SEO Settings', 'all-in-one-seo-pack' ); ?></h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
+
<p><span
|
149 |
+
class="description"><?php printf( __( 'Use the drop down below to choose which plugin or theme you wish to import SEO data from.', 'all-in-one-seo-pack' ) ); ?></span>
|
150 |
+
</p>
|
151 |
|
152 |
+
<p><span
|
153 |
+
class="description"><?php printf( __( 'Click "Analyze" for a list of SEO data that can be imported into All in One SEO Pack, along with the number of records that will be imported.', 'all-in-one-seo-pack' ) ); ?></span>
|
154 |
+
</p>
|
155 |
|
156 |
+
<p><span
|
157 |
+
class="description"><strong><?php printf( __( 'Please Note: ' ) ); ?></strong><?php printf( __( 'Some plugins and themes do not share similar data, or they store data in a non-standard way. If we cannot import this data, it will remain unchanged in your database. Any compatible SEO data will be displayed for you to review. If a post or page already has SEO data in All in One SEO Pack, we will not import data from another plugin/theme.', 'all-in-one-seo-pack' ) ); ?></span>
|
158 |
+
</p>
|
159 |
|
160 |
+
<p><span
|
161 |
+
class="description"><?php printf( __( 'Click "Convert" to perform the import. After the import has completed, you will be alerted to how many records were imported, and how many records had to be ignored, based on the criteria above.', 'all-in-one-seo-pack' ) ); ?></span>
|
162 |
+
</p>
|
163 |
|
164 |
+
<p><span
|
165 |
+
class="row-title"><?php printf( esc_html__( 'Before performing an import, we strongly recommend that you make a backup of your site. We use and recommend %s BackupBuddy %s for backups.', 'all-in-one-seo-pack' ), sprintf( '<a target="_blank" href="%s">', esc_url( 'http://semperfiwebdesign.com/backupbuddy/' ) ), '</a>' ); ?></span>
|
166 |
+
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
|
|
168 |
|
169 |
+
<form action="<?php echo admin_url( 'tools.php?page=aiosp_import' ); ?>" method="post">
|
170 |
+
<?php
|
171 |
+
wp_nonce_field( 'aiosp_nonce' );
|
172 |
|
173 |
+
$platform_old = ( ! isset( $_POST['platform_old'] ) ) ? '' : $_POST['platform_old'];
|
174 |
|
175 |
+
_e( 'Import SEO data from:', 'all-in-one-seo-pack' );
|
176 |
+
echo '<select name="platform_old">';
|
177 |
+
printf( '<option value="">%s</option>', __( 'Choose platform:', 'all-in-one-seo-pack' ) );
|
|
|
178 |
|
179 |
+
printf( '<optgroup label="%s">', __( 'Plugins', 'all-in-one-seo-pack' ) );
|
180 |
+
foreach ( $_aiosp_seometa_plugins as $platform => $data ) {
|
181 |
+
if ( 'All in One SEO Pack' !== $platform ) {
|
182 |
+
printf( '<option value="%s" %s>%s</option>', $platform, selected( $platform, $platform_old, 0 ), $platform );
|
183 |
+
}
|
184 |
+
}
|
185 |
+
printf( '</optgroup>' );
|
186 |
|
187 |
+
printf( '<optgroup label="%s">', __( 'Themes', 'all-in-one-seo-pack' ) );
|
188 |
+
foreach ( $_aiosp_seometa_themes as $platform => $data ) {
|
189 |
+
printf( '<option value="%s" %s>%s</option>', $platform, selected( $platform, $platform_old, 0 ), $platform );
|
190 |
+
}
|
191 |
+
printf( '</optgroup>' );
|
192 |
|
193 |
+
echo '</select>' . "\n\n";
|
|
|
|
|
194 |
|
195 |
+
?>
|
|
|
|
|
196 |
|
197 |
+
<input type="submit" class="button-highlighted" name="analyze"
|
198 |
+
value="<?php _e( 'Analyze', 'genesis' ); ?>"/>
|
199 |
+
<input type="submit" class="button-primary" value="<?php _e( 'Convert', 'genesis' ) ?>"/>
|
|
|
200 |
|
201 |
+
</form>
|
|
|
|
|
202 |
|
203 |
+
<?php aiosp_seometa_action(); ?>
|
204 |
|
205 |
+
</div>
|
206 |
|
207 |
+
<?php
|
208 |
+
}
|
209 |
|
210 |
+
/**
|
211 |
+
* Convert old meta_key entries in the post meta table into new entries.
|
212 |
+
*
|
213 |
+
* First check to see what records for $new already exist, storing the corresponding post_id values in an array.
|
214 |
+
* When the conversion happens, ignore rows that contain a post_id, to avoid duplicate entries.
|
215 |
+
*
|
216 |
+
*
|
217 |
+
* @param string $old Old meta_key entries.
|
218 |
+
* @param string $new New meta_key entries.
|
219 |
+
* @param bool $delete_old Whether to delete the old entries.
|
220 |
+
*
|
221 |
+
* @return stdClass Object for error detection, and the number of affected rows.
|
222 |
+
*/
|
223 |
+
function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = false ) {
|
224 |
|
225 |
+
do_action( 'pre_aiosp_seometa_meta_key_convert_before', $old, $new, $delete_old );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
+
global $wpdb;
|
228 |
|
229 |
+
$output = new stdClass;
|
230 |
|
231 |
+
if ( ! $old || ! $new ) {
|
232 |
+
$output->WP_Error = 1;
|
233 |
|
234 |
+
return $output;
|
235 |
+
}
|
236 |
+
|
237 |
+
// See which records we need to ignore, if any.
|
238 |
+
$exclude = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $new ) );
|
239 |
|
240 |
+
// If no records to ignore, we'll do a basic UPDATE and DELETE.
|
241 |
+
if ( ! $exclude ) {
|
242 |
+
|
243 |
+
$output->updated = $wpdb->update( $wpdb->postmeta, array( 'meta_key' => $new ), array( 'meta_key' => $old ) );
|
244 |
+
$output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
|
245 |
$output->ignored = 0;
|
246 |
|
247 |
+
} // Else, do a more complex UPDATE and DELETE.
|
248 |
+
else {
|
249 |
|
250 |
+
foreach ( (array) $exclude as $key => $value ) {
|
251 |
+
$not_in[] = $value->post_id;
|
252 |
+
}
|
253 |
+
$not_in = implode( ', ', (array) $not_in );
|
254 |
|
255 |
+
$output->updated = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_key = %s WHERE meta_key = %s AND post_id NOT IN ($not_in)", $new, $old ) );
|
256 |
+
$output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
|
257 |
+
$output->ignored = count( $exclude );
|
258 |
|
259 |
+
}
|
|
|
260 |
|
261 |
+
do_action( 'aiosp_seometa_meta_key_convert', $output, $old, $new, $delete_old );
|
|
|
|
|
262 |
|
263 |
+
return $output;
|
|
|
|
|
264 |
|
265 |
+
}
|
266 |
|
267 |
+
/**
|
268 |
+
* Convert old to new postmeta.
|
269 |
+
*
|
270 |
+
* Cycle through all compatible SEO entries of two platforms and aiosp_seometa_meta_key_convert conversion for each key.
|
271 |
+
*
|
272 |
+
* @param string $old_platform
|
273 |
+
* @param string $new_platform
|
274 |
+
* @param bool $delete_old
|
275 |
+
*
|
276 |
+
* @return stdClass Results object.
|
277 |
+
*/
|
278 |
+
function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'All in One SEO Pack', $delete_old = false ) {
|
279 |
|
280 |
+
do_action( 'pre_aiosp_seometa_post_meta_convert', $old_platform, $new_platform, $delete_old );
|
281 |
|
282 |
+
global $_aiosp_seometa_platforms;
|
283 |
|
284 |
+
$output = new stdClass;
|
285 |
+
|
286 |
+
if ( empty( $_aiosp_seometa_platforms[ $old_platform ] ) || empty( $_aiosp_seometa_platforms[ $new_platform ] ) ) {
|
287 |
+
$output->WP_Error = 1;
|
|
|
288 |
|
289 |
+
return $output;
|
290 |
+
}
|
291 |
|
292 |
+
$output->updated = 0;
|
293 |
+
$output->deleted = 0;
|
294 |
+
$output->ignored = 0;
|
295 |
|
296 |
+
foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
|
297 |
|
298 |
+
// Skip iterations where no $new analog exists.
|
299 |
+
if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
|
300 |
+
continue;
|
301 |
}
|
302 |
|
303 |
+
// Set $old and $new meta_key values.
|
304 |
+
$old = $_aiosp_seometa_platforms[ $old_platform ][ $label ];
|
305 |
+
$new = $_aiosp_seometa_platforms[ $new_platform ][ $label ];
|
306 |
|
307 |
+
// Convert.
|
308 |
+
$result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old );
|
309 |
|
310 |
+
// Error check.
|
311 |
+
if ( is_wp_error( $result ) ) {
|
312 |
+
continue;
|
313 |
+
}
|
314 |
|
315 |
+
// Update total updated/ignored count.
|
316 |
+
$output->updated += (int) $result->updated;
|
317 |
+
$output->ignored += (int) $result->ignored;
|
318 |
|
319 |
+
}
|
|
|
|
|
320 |
|
321 |
+
do_action( 'aiosp_seometa_post_meta_convert', $output, $old_platform, $new_platform, $delete_old );
|
|
|
322 |
|
323 |
+
return $output;
|
|
|
|
|
324 |
|
325 |
+
}
|
|
|
326 |
|
327 |
+
/**
|
328 |
+
* Analyze two platforms to find shared and compatible elements.
|
329 |
+
*
|
330 |
+
* See what data can be converted from one to the other.
|
331 |
+
*
|
332 |
+
* @param string $old_platform
|
333 |
+
* @param string $new_platform
|
334 |
+
*
|
335 |
+
* @return stdClass
|
336 |
+
*/
|
337 |
+
function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) {
|
338 |
+
// TODO Figure out which elements to ignore.
|
339 |
+
do_action( 'pre_aiosp_seometa_post_meta_analyze', $old_platform, $new_platform );
|
340 |
|
341 |
+
global $wpdb, $_aiosp_seometa_platforms;
|
342 |
|
343 |
+
$output = new stdClass;
|
344 |
|
345 |
+
if ( empty( $_aiosp_seometa_platforms[ $old_platform ] ) || empty( $_aiosp_seometa_platforms[ $new_platform ] ) ) {
|
346 |
+
$output->WP_Error = 1;
|
347 |
|
348 |
return $output;
|
|
|
349 |
}
|
|
|
|
|
|
|
|
|
350 |
|
351 |
+
$output->update = 0;
|
352 |
+
$output->ignore = 0;
|
353 |
+
$output->elements = '';
|
354 |
|
355 |
+
foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
|
356 |
|
357 |
+
// Skip iterations where no $new analog exists.
|
358 |
+
if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
|
359 |
+
continue;
|
360 |
+
}
|
|
|
361 |
|
362 |
+
$elements[] = $label;
|
363 |
|
364 |
+
// See which records to ignore, if any.
|
365 |
+
$ignore = 0;
|
366 |
+
// $ignore = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
|
368 |
+
// See which records to update, if any.
|
369 |
+
$update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
+
// Count items in returned arrays.
|
372 |
+
// $ignore = count( (array)$ignore );
|
373 |
+
$update = count( (array) $update );
|
|
|
374 |
|
375 |
+
// Calculate update/ignore by comparison.
|
376 |
+
// $update = ( (int)$update > (int)$ignore ) ? ( (int)$update - (int)$ignore ) : 0;
|
|
|
|
|
|
|
377 |
|
378 |
+
// update output numbers
|
379 |
+
$output->update += (int) $update;
|
380 |
+
$output->ignore += (int) $ignore;
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
|
382 |
}
|
383 |
|
384 |
+
$output->elements = $elements;
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
+
do_action( 'aiosp_seometa_post_meta_analyze', $output, $old_platform, $new_platform );
|
387 |
|
388 |
+
return $output;
|
|
|
389 |
|
390 |
+
}
|
391 |
+
|
392 |
+
|
393 |
+
// define('aiosp_seometa_PLUGIN_DIR', dirname(__FILE__));
|
394 |
+
|
395 |
+
//add_action( 'plugins_loaded', 'aiosp_seometa_import' );
|
396 |
+
/**
|
397 |
+
* Initialize the SEO Data Transporter plugin
|
398 |
+
*/
|
399 |
+
function aiosp_seometa_import() {
|
400 |
+
|
401 |
+
global $_aiosp_seometa_themes, $_aiosp_seometa_plugins, $_aiosp_seometa_platforms;
|
402 |
|
403 |
/**
|
404 |
+
* The associative array of supported themes.
|
405 |
*/
|
406 |
+
$_aiosp_seometa_themes = array(
|
407 |
+
// alphabatized
|
408 |
+
'Builder' => array(
|
409 |
+
'Custom Doctitle' => '_builder_seo_title',
|
410 |
+
'META Description' => '_builder_seo_description',
|
411 |
+
'META Keywords' => '_builder_seo_keywords',
|
412 |
+
),
|
413 |
+
'Catalyst' => array(
|
414 |
+
'Custom Doctitle' => '_catalyst_title',
|
415 |
+
'META Description' => '_catalyst_description',
|
416 |
+
'META Keywords' => '_catalyst_keywords',
|
417 |
+
'noindex' => '_catalyst_noindex',
|
418 |
+
'nofollow' => '_catalyst_nofollow',
|
419 |
+
'noarchive' => '_catalyst_noarchive',
|
420 |
+
),
|
421 |
+
'Frugal' => array(
|
422 |
+
'Custom Doctitle' => '_title',
|
423 |
+
'META Description' => '_description',
|
424 |
+
'META Keywords' => '_keywords',
|
425 |
+
'noindex' => '_noindex',
|
426 |
+
'nofollow' => '_nofollow',
|
427 |
+
),
|
428 |
+
'Genesis' => array(
|
429 |
+
'Custom Doctitle' => '_genesis_title',
|
430 |
+
'META Description' => '_genesis_description',
|
431 |
+
'META Keywords' => '_genesis_keywords',
|
432 |
+
'noindex' => '_genesis_noindex',
|
433 |
+
'nofollow' => '_genesis_nofollow',
|
434 |
+
'noarchive' => '_genesis_noarchive',
|
435 |
+
'Canonical URI' => '_genesis_canonical_uri',
|
436 |
+
'Custom Scripts' => '_genesis_scripts',
|
437 |
+
'Redirect URI' => 'redirect',
|
438 |
+
),
|
439 |
+
'Headway' => array(
|
440 |
+
'Custom Doctitle' => '_title',
|
441 |
+
'META Description' => '_description',
|
442 |
+
'META Keywords' => '_keywords',
|
443 |
+
),
|
444 |
+
'Hybrid' => array(
|
445 |
+
'Custom Doctitle' => 'Title',
|
446 |
+
'META Description' => 'Description',
|
447 |
+
'META Keywords' => 'Keywords',
|
448 |
+
),
|
449 |
+
'Thesis 1.x' => array(
|
450 |
+
'Custom Doctitle' => 'thesis_title',
|
451 |
+
'META Description' => 'thesis_description',
|
452 |
+
'META Keywords' => 'thesis_keywords',
|
453 |
+
'Custom Scripts' => 'thesis_javascript_scripts',
|
454 |
+
'Redirect URI' => 'thesis_redirect',
|
455 |
+
),
|
456 |
+
/*
|
457 |
+
'Thesis 2.x' => array(
|
458 |
+
'Custom Doctitle' => '_thesis_title_tag',
|
459 |
+
'META Description' => '_thesis_meta_description',
|
460 |
+
'META Keywords' => '_thesis_meta_keywords',
|
461 |
+
'Custom Scripts' => '_thesis_javascript_scripts',
|
462 |
+
'Canonical URI' => '_thesis_canonical_link',
|
463 |
+
'Redirect URI' => '_thesis_redirect',
|
464 |
+
),
|
465 |
+
*/
|
466 |
+
'WooFramework' => array(
|
467 |
+
'Custom Doctitle' => 'seo_title',
|
468 |
+
'META Description' => 'seo_description',
|
469 |
+
'META Keywords' => 'seo_keywords',
|
470 |
+
),
|
471 |
+
);
|
472 |
|
473 |
/**
|
474 |
+
* The associative array of supported plugins.
|
475 |
*/
|
476 |
+
$_aiosp_seometa_plugins = array(
|
477 |
+
// alphabatized
|
478 |
+
'Add Meta Tags' => array(
|
479 |
+
'META Description' => 'description',
|
480 |
+
'META Keywords' => 'keywords',
|
481 |
+
),
|
482 |
+
'All in One SEO Pack' => array(
|
483 |
+
'Custom Doctitle' => '_aioseop_title',
|
484 |
+
'META Description' => '_aioseop_description',
|
485 |
+
'META Keywords' => '_aioseop_keywords',
|
486 |
+
),
|
487 |
+
'Greg\'s High Performance SEO' => array(
|
488 |
+
'Custom Doctitle' => '_ghpseo_secondary_title',
|
489 |
+
'META Description' => '_ghpseo_alternative_description',
|
490 |
+
'META Keywords' => '_ghpseo_keywords',
|
491 |
+
),
|
492 |
+
'Headspace2' => array(
|
493 |
+
'Custom Doctitle' => '_headspace_page_title',
|
494 |
+
'META Description' => '_headspace_description',
|
495 |
+
'META Keywords' => '_headspace_keywords',
|
496 |
+
'Custom Scripts' => '_headspace_scripts',
|
497 |
+
),
|
498 |
+
'Infinite SEO' => array(
|
499 |
+
'Custom Doctitle' => '_wds_title',
|
500 |
+
'META Description' => '_wds_metadesc',
|
501 |
+
'META Keywords' => '_wds_keywords',
|
502 |
+
'noindex' => '_wds_meta-robots-noindex',
|
503 |
+
'nofollow' => '_wds_meta-robots-nofollow',
|
504 |
+
'Canonical URI' => '_wds_canonical',
|
505 |
+
'Redirect URI' => '_wds_redirect',
|
506 |
+
),
|
507 |
+
'Meta SEO Pack' => array(
|
508 |
+
'META Description' => '_msp_description',
|
509 |
+
'META Keywords' => '_msp_keywords',
|
510 |
+
),
|
511 |
+
'Platinum SEO' => array(
|
512 |
+
'Custom Doctitle' => 'title',
|
513 |
+
'META Description' => 'description',
|
514 |
+
'META Keywords' => 'keywords',
|
515 |
+
),
|
516 |
+
'SEO Title Tag' => array(
|
517 |
+
'Custom Doctitle' => 'title_tag',
|
518 |
+
'META Description' => 'meta_description',
|
519 |
+
),
|
520 |
+
'SEO Ultimate' => array(
|
521 |
+
'Custom Doctitle' => '_su_title',
|
522 |
+
'META Description' => '_su_description',
|
523 |
+
'META Keywords' => '_su_keywords',
|
524 |
+
'noindex' => '_su_meta_robots_noindex',
|
525 |
+
'nofollow' => '_su_meta_robots_nofollow',
|
526 |
+
),
|
527 |
+
'Yoast SEO' => array(
|
528 |
+
'Custom Doctitle' => '_yoast_wpseo_title',
|
529 |
+
'META Description' => '_yoast_wpseo_metadesc',
|
530 |
+
'META Keywords' => '_yoast_wpseo_metakeywords',
|
531 |
+
'noindex' => '_yoast_wpseo_meta-robots-noindex',
|
532 |
+
'nofollow' => '_yoast_wpseo_meta-robots-nofollow',
|
533 |
+
'Canonical URI' => '_yoast_wpseo_canonical',
|
534 |
+
'Redirect URI' => '_yoast_wpseo_redirect',
|
535 |
+
),
|
536 |
+
);
|
537 |
|
538 |
/**
|
539 |
+
* The combined array of supported platforms.
|
540 |
*/
|
541 |
+
$_aiosp_seometa_platforms = array_merge( $_aiosp_seometa_themes, $_aiosp_seometa_plugins );
|
|
|
542 |
|
543 |
+
/**
|
544 |
+
* Include the other elements of the plugin.
|
545 |
+
*/
|
546 |
+
// require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' );
|
547 |
+
// require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
|
|
|
|
|
548 |
|
549 |
/**
|
550 |
+
* Init hook.
|
551 |
+
*
|
552 |
+
* Hook fires after plugin functions are loaded.
|
553 |
+
*
|
554 |
+
* @since 0.9.10
|
555 |
+
*
|
556 |
*/
|
557 |
+
do_action( 'aiosp_seometa_import' );
|
558 |
+
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Activation Hook
|
563 |
+
* @since 0.9.4
|
564 |
+
*/
|
565 |
+
register_activation_hook( __FILE__, 'aiosp_seometa_activation_hook' );
|
566 |
+
function aiosp_seometa_activation_hook() {
|
567 |
+
|
568 |
+
// require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
|
569 |
+
|
570 |
+
aiosp_seometa_meta_key_convert( '_yoast_seo_title', 'yoast_wpseo_title', true );
|
571 |
+
aiosp_seometa_meta_key_convert( '_yoast_seo_metadesc', 'yoast_wpseo_metadesc', true );
|
572 |
+
|
573 |
+
}
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Manual conversion test
|
577 |
+
*/
|
578 |
+
/*
|
579 |
+
$aiosp_seometa_convert = aiosp_seometa_post_meta_convert( 'All in One SEO Pack', 'Genesis', false );
|
580 |
+
printf( '%d records were updated', $aiosp_seometa_convert->updated );
|
581 |
+
/**/
|
582 |
+
|
583 |
+
/**
|
584 |
+
* Manual analysis test
|
585 |
+
*/
|
586 |
+
/*
|
587 |
+
$aiosp_seometa_analyze = aiosp_seometa_post_meta_analyze( 'All in One SEO Pack', 'Genesis' );
|
588 |
+
printf( '<p><b>%d</b> Compatible Records were identified</p>', $aiosp_seometa_analyze->update );
|
589 |
+
/**/
|
590 |
+
|
591 |
+
/**
|
592 |
+
* Delete all SEO data, from every platform
|
593 |
+
*/
|
594 |
+
/*
|
595 |
+
foreach ( $_aiosp_seometa_platforms as $platform => $data ) {
|
596 |
+
|
597 |
+
foreach ( $data as $field ) {
|
598 |
+
$deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $field ) );
|
599 |
+
printf( '%d %s records deleted<br />', $deleted, $field );
|
600 |
+
}
|
601 |
+
|
602 |
+
}
|
603 |
+
/**/
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Query all SEO data to find the number of records to change
|
607 |
+
*/
|
608 |
|
609 |
|
aioseop-init.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* We'll eventually put stuff in here from the main plugin file.
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
+
*
|
7 |
+
*/
|
aioseop_class.php
CHANGED
@@ -1,44 +1,47 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
|
|
|
|
3 |
* @package All-in-One-SEO-Pack
|
4 |
*/
|
|
|
|
|
|
|
5 |
/**
|
6 |
-
*
|
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 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
*/
|
23 |
-
var $minimum_description_length = 1;
|
24 |
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
|
43 |
var $token;
|
44 |
var $secret;
|
@@ -49,67 +52,69 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
49 |
var $meta_opts = false;
|
50 |
var $is_front_page = null;
|
51 |
|
|
|
|
|
|
|
52 |
function __construct() {
|
53 |
global $aioseop_options;
|
54 |
-
$this->log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log';
|
55 |
|
56 |
-
if ( !empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] )
|
57 |
$this->do_log = true;
|
58 |
-
else
|
59 |
$this->do_log = false;
|
|
|
60 |
|
61 |
-
$this->name
|
62 |
$this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
|
63 |
|
64 |
-
$this->prefix
|
65 |
-
$this->option_name
|
66 |
$this->store_option = true;
|
67 |
-
$this->file
|
68 |
-
$blog_name
|
69 |
parent::__construct();
|
70 |
|
71 |
-
$this->help_text =
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
__(
|
93 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
94 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
95 |
__( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
|
96 |
__( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
97 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
98 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
99 |
-
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>'
|
100 |
-
|
101 |
-
|
102 |
-
__( "This controls the format of the title tag for Pages.<br />The following macros are supported:", 'all-in-one-seo-pack' )
|
103 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
104 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
105 |
__( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
|
106 |
__( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
107 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
108 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
109 |
-
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>'
|
110 |
-
|
111 |
-
|
112 |
-
__( "This controls the format of the title tag for Posts.<br />The following macros are supported:", 'all-in-one-seo-pack' )
|
113 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
114 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
115 |
__( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -118,602 +123,866 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
118 |
__( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
119 |
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
120 |
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
121 |
-
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>'
|
122 |
-
|
123 |
-
|
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 |
-
|
130 |
-
__(
|
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 |
-
|
135 |
-
__(
|
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 |
-
|
143 |
-
__(
|
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 |
-
|
148 |
-
__(
|
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 |
-
|
153 |
-
__(
|
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 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
'noodp'
|
216 |
-
'cpostnoodp'
|
217 |
-
'noydir'
|
218 |
-
'cpostnoydir'
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
);
|
232 |
|
233 |
-
$this->help_anchors =
|
234 |
-
'license_key'
|
235 |
-
'can'
|
236 |
-
'no_paged_canonical_links'
|
237 |
-
'customize_canonical_links'
|
238 |
-
'use_original_title'
|
239 |
-
'schema_markup'
|
240 |
-
'do_log'
|
241 |
-
'home_title'
|
242 |
-
'home_description'
|
243 |
-
'home_keywords'
|
244 |
-
'togglekeywords'
|
245 |
-
'use_categories'
|
246 |
-
'use_tags_as_keywords'
|
247 |
-
'dynamic_postspage_keywords'
|
248 |
-
'rewrite_titles'
|
249 |
-
'cap_titles'
|
250 |
-
'home_page_title_format'
|
251 |
-
'page_title_format'
|
252 |
-
'post_title_format'
|
253 |
-
'category_title_format'
|
254 |
-
'archive_title_format'
|
255 |
-
'date_title_format'
|
256 |
-
'author_title_format'
|
257 |
-
'tag_title_format'
|
258 |
-
'search_title_format'
|
259 |
-
'404_title_format'
|
260 |
-
'enablecpost'
|
261 |
-
'cpostadvanced'
|
262 |
-
'cpostactive'
|
263 |
-
'taxactive'
|
264 |
-
'cposttitles'
|
265 |
-
'posttypecolumns'
|
266 |
-
'admin_bar'
|
267 |
-
'custom_menu_order'
|
268 |
-
'google_verify'
|
269 |
-
'bing_verify'
|
270 |
-
'pinterest_verify'
|
271 |
-
'google_publisher'
|
272 |
-
'google_disable_profile'
|
273 |
-
'google_author_advanced'
|
274 |
-
'google_author_location'
|
275 |
-
'google_enable_publisher'
|
276 |
-
'google_specify_publisher'
|
277 |
-
'google_analytics_id'
|
278 |
-
'ga_use_universal_analytics'
|
279 |
-
'ga_domain'
|
280 |
-
'ga_multi_domain'
|
281 |
-
'ga_addl_domains'
|
282 |
-
'ga_anonymize_ip'
|
283 |
-
'ga_display_advertising'
|
284 |
-
'ga_exclude_users'
|
285 |
-
'ga_track_outbound_links'
|
286 |
-
'ga_link_attribution'
|
287 |
-
'ga_enhanced_ecommerce'
|
288 |
-
'cpostnoindex'
|
289 |
-
'cpostnofollow'
|
290 |
-
'noodp'
|
291 |
-
'noydir'
|
292 |
-
'generate_descriptions'
|
293 |
-
'run_shortcodes'
|
294 |
'hide_paginated_descriptions' => '#remove-descriptions-for-paginated-pages',
|
295 |
-
'dont_truncate_descriptions'
|
296 |
-
'unprotect_meta'
|
297 |
-
'ex_pages'
|
298 |
-
'post_meta_tags'
|
299 |
-
'page_meta_tags'
|
300 |
-
'front_meta_tags'
|
301 |
-
'home_meta_tags'
|
302 |
);
|
303 |
|
304 |
-
$meta_help_text =
|
305 |
-
'snippet'
|
306 |
-
'title'
|
307 |
-
'description'
|
308 |
-
'keywords'
|
309 |
-
'custom_link'
|
310 |
-
'noindex'
|
311 |
-
'nofollow'
|
312 |
-
'noodp'
|
313 |
-
'noydir'
|
314 |
-
'titleatr'
|
315 |
-
'menulabel'
|
316 |
-
'sitemap_exclude'
|
317 |
-
'disable'
|
318 |
-
'disable_analytics'
|
319 |
);
|
320 |
|
321 |
$this->default_options = array(
|
322 |
-
|
323 |
'name' => __( 'License Key:', 'all-in-one-seo-pack' ),
|
324 |
-
'type' => 'text'
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
'
|
331 |
-
'
|
332 |
-
|
333 |
-
'
|
334 |
-
'
|
335 |
-
'
|
336 |
-
'
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
'
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
'
|
346 |
-
'
|
347 |
-
'condshow' =>
|
348 |
-
|
349 |
-
|
350 |
-
'
|
351 |
-
'
|
352 |
-
'
|
353 |
-
|
354 |
-
|
355 |
-
|
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 |
-
|
376 |
-
|
377 |
-
'
|
378 |
-
'
|
379 |
-
'
|
380 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
),
|
382 |
-
|
383 |
-
|
|
|
384 |
'default' => 1,
|
385 |
-
|
386 |
-
|
387 |
-
'
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
),
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
|
|
|
|
|
|
396 |
),
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
'
|
401 |
-
|
402 |
-
'
|
403 |
-
'
|
404 |
-
|
405 |
-
|
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 |
-
|
457 |
-
|
458 |
-
'
|
459 |
-
'
|
|
|
|
|
|
|
|
|
460 |
),
|
461 |
-
|
462 |
-
|
463 |
-
'
|
464 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
),
|
466 |
-
|
467 |
-
|
468 |
-
'
|
469 |
-
'
|
470 |
-
|
471 |
-
'
|
472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
),
|
474 |
-
|
475 |
-
'
|
476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
),
|
478 |
-
|
479 |
-
|
480 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
),
|
482 |
-
|
483 |
-
|
484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
),
|
486 |
-
|
487 |
-
|
488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
),
|
490 |
-
|
491 |
-
|
492 |
-
'
|
493 |
-
'
|
|
|
|
|
|
|
|
|
494 |
),
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
),
|
502 |
-
|
503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
),
|
505 |
-
|
506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
),
|
508 |
-
|
509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
),
|
511 |
-
|
512 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
),
|
514 |
-
|
515 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
),
|
517 |
-
|
518 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
),
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
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 |
-
|
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 |
-
|
544 |
-
|
545 |
-
'
|
546 |
-
'
|
547 |
-
|
548 |
-
|
|
|
|
|
|
|
|
|
|
|
549 |
),
|
550 |
-
|
551 |
-
|
552 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
),
|
554 |
-
|
555 |
-
|
556 |
-
'name'
|
557 |
-
'default'
|
558 |
-
|
559 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
'default' => 0,
|
561 |
-
|
562 |
-
|
563 |
-
'name'
|
564 |
-
'default' =>
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
'
|
569 |
-
|
570 |
-
|
571 |
-
'
|
572 |
-
'
|
573 |
-
|
574 |
-
'
|
|
|
|
|
|
|
575 |
'default' => 0,
|
576 |
-
|
577 |
-
|
578 |
-
|
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 |
-
|
597 |
-
|
598 |
-
'name'
|
599 |
'default' => 0,
|
600 |
-
|
601 |
-
|
602 |
-
'name'
|
603 |
'default' => 0,
|
604 |
-
|
605 |
-
|
606 |
-
'name'
|
607 |
'default' => 0,
|
608 |
-
|
609 |
-
|
610 |
-
'name'
|
611 |
'default' => 1,
|
612 |
-
|
613 |
-
|
614 |
-
'name'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
615 |
'default' => 1,
|
616 |
-
|
617 |
-
|
618 |
-
'name'
|
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 |
-
|
662 |
-
|
663 |
-
'name'
|
664 |
-
'
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
'
|
670 |
-
'default'
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
'
|
676 |
-
'
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
'
|
682 |
-
'
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
'
|
688 |
-
'
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
|
|
|
|
|
|
693 |
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
<script>
|
718 |
jQuery(document).ready(function() {
|
719 |
jQuery("#aiosp_title_wrapper").bind("input", function() {
|
@@ -724,172 +993,379 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
724 |
});
|
725 |
});
|
726 |
</script>
|
727 |
-
<div class="preview_snippet"><div id="aioseop_snippet"><h3><a>%s</a></h3><div><div><cite id="aioseop_snippet_link">%s</cite></div><span id="aioseop_snippet_description">%s</span></div></div></div>'
|
728 |
-
'title' => Array( 'name' => __( 'Title', 'all-in-one-seo-pack' ), 'type' => 'text', 'count' => true, 'size' => 60 ),
|
729 |
-
'description' => Array( 'name' => __( 'Description', 'all-in-one-seo-pack' ), 'type' => 'textarea', 'count' => true, 'cols' => 80, 'rows' => 2 ),
|
730 |
-
|
731 |
-
'keywords' => Array( 'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ), 'type' => 'text' ),
|
732 |
-
'custom_link' => Array( 'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ),
|
733 |
-
'noindex' => Array( 'name' => __( "Robots Meta NOINDEX", 'all-in-one-seo-pack' ), 'default' => '' ),
|
734 |
-
'nofollow' => Array( 'name' => __( "Robots Meta NOFOLLOW", 'all-in-one-seo-pack' ), 'default' => '' ),
|
735 |
-
'noodp' => Array( 'name' => __( "Robots Meta NOODP", 'all-in-one-seo-pack' ) ),
|
736 |
-
'noydir' => Array( 'name' => __( "Robots Meta NOYDIR", 'all-in-one-seo-pack' ) ),
|
737 |
-
'titleatr' => Array( 'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ),
|
738 |
-
'menulabel' => Array( 'name' => __( 'Menu Label', 'all-in-one-seo-pack' ), 'type' => 'text', 'size' => 60 ),
|
739 |
-
'sitemap_exclude' => Array( 'name' => __( 'Exclude From Sitemap', 'all-in-one-seo-pack' ) ),
|
740 |
-
'disable' => Array( 'name' => __( 'Disable on this page/post', 'all-in-one-seo-pack' ) ),
|
741 |
-
'disable_analytics' => Array( 'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ), 'condshow' => Array( 'aiosp_disable' => 'on' ) ) ),
|
742 |
-
'display' => null )
|
743 |
-
);
|
744 |
-
|
745 |
-
if ( !empty( $meta_help_text ) )
|
746 |
-
foreach( $meta_help_text as $k => $v )
|
747 |
-
$this->locations['aiosp']['default_options'][$k]['help_text'] = $v;
|
748 |
-
|
749 |
-
$this->layout = Array(
|
750 |
-
'default' => Array(
|
751 |
-
'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
|
752 |
-
'help_link' => 'http://semperplugins.com/documentation/general-settings/',
|
753 |
-
'options' => Array() // this is set below, to the remaining options -- pdb
|
754 |
),
|
755 |
-
|
756 |
-
'name'
|
757 |
-
'
|
758 |
-
'
|
|
|
759 |
),
|
760 |
-
|
761 |
-
'name'
|
762 |
-
'
|
763 |
-
'
|
764 |
-
|
|
|
765 |
),
|
766 |
-
|
767 |
-
|
768 |
-
'
|
769 |
-
'
|
|
|
|
|
|
|
|
|
|
|
770 |
),
|
771 |
-
|
772 |
-
'name'
|
773 |
-
'
|
774 |
-
'options' => Array( "posttypecolumns", "admin_bar", "custom_menu_order" )
|
775 |
),
|
776 |
-
|
777 |
-
'name'
|
778 |
-
'
|
779 |
-
'options' => Array( "google_verify", "bing_verify", "pinterest_verify" )
|
780 |
),
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
'
|
785 |
-
|
786 |
-
|
787 |
),
|
788 |
-
|
789 |
-
'name' => __( '
|
790 |
-
'
|
791 |
-
'
|
792 |
),
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
'
|
|
|
797 |
),
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
)
|
803 |
-
);
|
804 |
|
805 |
-
|
806 |
-
|
807 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
|
809 |
-
|
810 |
-
|
811 |
-
|
|
|
|
|
|
|
812 |
|
813 |
-
|
|
|
|
|
|
|
|
|
|
|
814 |
|
815 |
-
if (
|
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 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
|
831 |
-
//good candidate for pro dir
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
839 |
}
|
840 |
}
|
841 |
-
return $terms;
|
842 |
}
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 =
|
860 |
-
if ( !empty( $info ) )
|
861 |
return $info;
|
|
|
862 |
global $post, $aioseop_options, $wp_query;
|
863 |
$title = $url = $description = $term = $category = '';
|
864 |
-
$p
|
865 |
-
|
866 |
-
if (
|
867 |
-
$
|
868 |
-
|
|
|
|
|
|
|
|
|
869 |
$term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
|
870 |
}
|
871 |
if ( is_object( $post ) ) {
|
872 |
-
$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 |
-
|
|
|
877 |
$wp_query->is_page = true;
|
878 |
-
elseif ( $post->post_type
|
879 |
$wp_query->is_attachment = true;
|
880 |
-
else
|
881 |
$wp_query->is_single = true;
|
882 |
-
|
883 |
-
if
|
884 |
-
|
|
|
|
|
|
|
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 ) &&
|
891 |
-
$title = $this->internationalize( get_post_meta( $post->ID,
|
892 |
-
if ( empty( $title ) )
|
|
|
|
|
893 |
}
|
894 |
$title_format = '';
|
895 |
if ( empty( $title ) ) {
|
@@ -897,47 +1373,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']
|
914 |
-
query_posts(
|
915 |
-
} else if ( $_GET['taxonomy']
|
916 |
-
query_posts(
|
917 |
} else {
|
918 |
-
query_posts(
|
|
|
|
|
|
|
|
|
919 |
}
|
920 |
-
if ( empty( $this->meta_opts ) )
|
921 |
-
$this->meta_opts = $this->get_current_options(
|
922 |
-
|
|
|
923 |
$title_format = $this->get_tax_title_format();
|
924 |
-
$opts
|
925 |
-
if ( !empty( $opts ) )
|
926 |
-
|
|
|
|
|
|
|
|
|
927 |
$description = $this->internationalize( $description );
|
928 |
}
|
929 |
|
930 |
$show_page = true;
|
931 |
-
if ( !empty( $aioseop_options[
|
|
|
|
|
932 |
if ( $aioseop_options['aiosp_can'] ) {
|
933 |
-
if ( !empty( $aioseop_options['aiosp_customize_canonical_links'] ) && !empty( $opts['aiosp_custom_link'] ) )
|
934 |
-
|
|
|
|
|
935 |
$url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
|
|
|
936 |
$url = apply_filters( 'aioseop_canonical_url', $url );
|
937 |
}
|
938 |
-
if (
|
|
|
|
|
939 |
|
940 |
-
$title
|
941 |
$description = $this->apply_cf_fields( $description );
|
942 |
$description = apply_filters( 'aioseop_description', $description );
|
943 |
|
@@ -945,376 +1439,82 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
945 |
$keywords = $this->apply_cf_fields( $keywords );
|
946 |
$keywords = apply_filters( 'aioseop_keywords', $keywords );
|
947 |
|
948 |
-
$info =
|
949 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
950 |
wp_reset_postdata();
|
951 |
-
$wp_query = $w;
|
952 |
-
|
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 |
-
|
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' ) . ' »';
|
1262 |
-
$submit['Submit_All_Default'] = Array( 'type' => 'submit', 'class' => 'button-secondary', 'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' »' );
|
1263 |
-
return $submit;
|
1264 |
}
|
1265 |
|
1266 |
/**
|
1267 |
-
*
|
1268 |
*/
|
1269 |
-
function
|
1270 |
-
|
1271 |
-
|
|
|
|
|
1272 |
}
|
1273 |
-
if ( $
|
1274 |
-
|
1275 |
-
|
1276 |
-
$
|
1277 |
-
|
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 |
-
|
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 |
-
|
1304 |
-
|
1305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
1313 |
-
|
1314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1315 |
}
|
1316 |
foreach ( $optlist as $f ) {
|
1317 |
-
$meta
|
1318 |
$field = "aiosp_$f";
|
1319 |
|
1320 |
if ( AIOSEOPPRO ) {
|
@@ -1323,1977 +1523,3146 @@ global $aioseop_options;
|
|
1323 |
$meta = get_term_meta( $_GET['tag_ID'], '_aioseop_' . $f, true );
|
1324 |
} else {
|
1325 |
$queried_object = get_queried_object();
|
1326 |
-
if ( !empty( $queried_object ) && !empty( $queried_object->term_id ) ) {
|
1327 |
$meta = get_term_meta( $queried_object->term_id, '_aioseop_' . $f, true );
|
1328 |
}
|
1329 |
}
|
1330 |
-
} else
|
1331 |
$meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
|
|
|
1332 |
if ( 'title' === $f || 'description' === $f ) {
|
1333 |
-
$get_opts[$field] = htmlspecialchars(
|
1334 |
} else {
|
1335 |
-
$get_opts[$field] = htmlspecialchars( stripslashes( $meta ) );
|
1336 |
}
|
1337 |
} else {
|
1338 |
$field = "aiosp_$f";
|
1339 |
-
$meta
|
1340 |
if ( 'title' === $f || 'description' === $f ) {
|
1341 |
-
$get_opts[$field] = htmlspecialchars(
|
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 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
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 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
}
|
1405 |
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
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 |
-
|
|
|
1425 |
}
|
1426 |
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
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 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1463 |
}
|
1464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1465 |
}
|
1466 |
|
1467 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1468 |
global $aioseop_options;
|
1469 |
-
if (
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
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 |
-
$
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1489 |
} else {
|
1490 |
-
|
1491 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1492 |
}
|
|
|
|
|
|
|
1493 |
}
|
1494 |
-
|
1495 |
-
|
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 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
|
|
|
|
|
|
|
|
1509 |
}
|
1510 |
}
|
1511 |
-
return false;
|
1512 |
}
|
1513 |
|
1514 |
-
|
1515 |
-
|
1516 |
-
return true;
|
1517 |
}
|
1518 |
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
|
|
|
|
|
|
|
|
1534 |
}
|
1535 |
-
}
|
1536 |
|
1537 |
-
|
1538 |
-
return $this->rewrite_title( $content );
|
1539 |
}
|
1540 |
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
if (
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
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 |
-
|
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 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
1592 |
global $aioseop_options;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1593 |
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1597 |
|
1598 |
-
|
1599 |
-
|
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 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
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 |
-
|
1679 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1680 |
}
|
1681 |
}
|
1682 |
-
return Array( 'prev' => $prev, 'next' => $next );
|
1683 |
-
}
|
1684 |
|
1685 |
-
|
1686 |
-
|
1687 |
-
$page = $this->get_page_number();
|
1688 |
-
// handle authorship
|
1689 |
-
$googleplus = $publisher = $author = '';
|
1690 |
|
1691 |
-
|
1692 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1693 |
|
1694 |
-
|
1695 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1696 |
|
1697 |
-
|
1698 |
-
|
1699 |
-
$publisher = $aioseop_options['aiosp_google_publisher'];
|
1700 |
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1706 |
}
|
|
|
1707 |
}
|
1708 |
}
|
1709 |
-
|
1710 |
-
$author = $googleplus;
|
1711 |
-
else if ( !empty( $aioseop_options['aiosp_google_publisher'] ) )
|
1712 |
-
$author = $aioseop_options['aiosp_google_publisher'];
|
1713 |
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1727 |
}
|
1728 |
}
|
1729 |
|
1730 |
-
return
|
1731 |
}
|
1732 |
|
1733 |
-
function
|
1734 |
-
|
1735 |
-
|
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 |
-
|
1751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1752 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1753 |
}
|
1754 |
|
1755 |
-
function
|
1756 |
-
|
1757 |
-
$aioseop_woo_upgrade_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
|
1758 |
|
1759 |
-
|
1760 |
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
|
1772 |
-
|
1773 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1774 |
}
|
1775 |
-
|
1776 |
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
if ( isset( $aioseop_options['aiosp_tax_noindex'] ) ) $tax_noindex = $aioseop_options['aiosp_tax_noindex'];
|
1783 |
|
1784 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1785 |
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
if (
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
$aiosp_noydir = false;
|
1821 |
}
|
1822 |
}
|
1823 |
-
|
1824 |
-
if ( !
|
1825 |
-
|
1826 |
-
|
1827 |
-
$
|
1828 |
-
|
1829 |
-
|
1830 |
-
}
|
1831 |
|
1832 |
-
|
1833 |
-
|
1834 |
-
$
|
1835 |
-
$
|
1836 |
-
|
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 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1858 |
}
|
1859 |
-
|
1860 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1861 |
}
|
1862 |
-
return $description;
|
1863 |
-
}
|
1864 |
|
1865 |
-
|
1866 |
-
|
1867 |
-
$description = str_replace( '"', '"', $description );
|
1868 |
-
$description = str_replace( "\r\n", ' ', $description );
|
1869 |
-
$description = str_replace( "\n", ' ', $description );
|
1870 |
-
return $description;
|
1871 |
}
|
1872 |
|
1873 |
-
function
|
1874 |
-
|
1875 |
-
|
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 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1890 |
|
1891 |
-
return $
|
1892 |
}
|
1893 |
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1904 |
}
|
1905 |
}
|
1906 |
-
$description .= ' ' . $uniqueDesc;
|
1907 |
-
return $description;
|
1908 |
-
}
|
1909 |
-
}
|
1910 |
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
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 |
-
$
|
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 |
-
|
1932 |
-
}
|
1933 |
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
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 |
-
$
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
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 |
-
|
2083 |
}
|
2084 |
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
|
|
|
|
|
|
|
|
2091 |
|
2092 |
-
|
2093 |
-
|
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 |
-
|
2104 |
-
|
|
|
2105 |
}
|
2106 |
-
if (
|
2107 |
-
|
2108 |
-
|
2109 |
-
$
|
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 |
-
|
2124 |
-
|
2125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2126 |
}
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
|
|
|
|
2130 |
}
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
}
|
2135 |
-
if (
|
2136 |
-
if (
|
2137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2138 |
}
|
|
|
2139 |
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2143 |
}
|
2144 |
-
$
|
2145 |
-
|
2146 |
-
if ( !empty( $$opts ) ) $js_options[] = $$opts;
|
2147 |
}
|
2148 |
-
if (
|
2149 |
-
$
|
2150 |
-
|
2151 |
-
|
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 |
-
|
2161 |
-
|
2162 |
-
ga('send', 'pageview');
|
2163 |
-
</script>
|
2164 |
|
2165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2166 |
}
|
2167 |
-
return $analytics;
|
2168 |
-
}
|
2169 |
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
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 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
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 |
-
|
2244 |
-
|
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 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2304 |
} else {
|
2305 |
-
$
|
|
|
|
|
|
|
|
|
|
|
2306 |
}
|
2307 |
-
$blog_name = esc_attr( $blog_name );
|
2308 |
-
$name_block=<<<EOF
|
2309 |
-
"name": "{$blog_name}",
|
2310 |
-
EOF;
|
2311 |
}
|
2312 |
|
2313 |
-
|
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 |
-
$
|
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 |
-
|
2340 |
-
|
2341 |
-
|
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 |
-
|
2354 |
-
|
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 |
-
}
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
2409 |
}
|
2410 |
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
|
|
|
|
2416 |
}
|
2417 |
|
2418 |
-
|
2419 |
-
|
2420 |
-
|
2421 |
-
|
2422 |
-
|
2423 |
-
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
2429 |
}
|
2430 |
-
return $link;
|
2431 |
-
}
|
2432 |
|
2433 |
-
|
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 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
|
2446 |
-
|
2447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2448 |
}
|
2449 |
|
2450 |
-
function
|
2451 |
-
global $aioseop_options;
|
2452 |
-
|
2453 |
-
|
2454 |
-
|
2455 |
-
|
2456 |
-
|
2457 |
-
|
2458 |
-
|
|
|
|
|
|
|
|
|
2459 |
}
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2468 |
}
|
|
|
|
|
|
|
|
|
|
|
2469 |
}
|
2470 |
-
|
2471 |
-
// "internal whitespace trim"
|
2472 |
-
$description = preg_replace( "/\s\s+/u", " ", $description );
|
2473 |
-
return $description;
|
2474 |
}
|
2475 |
|
|
|
2476 |
|
2477 |
-
|
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 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
|
|
|
|
2503 |
|
2504 |
-
|
|
|
|
|
2505 |
}
|
2506 |
|
2507 |
-
function
|
2508 |
-
if ( function_exists( 'langswitch_filter_langs_with_message' ) )
|
2509 |
-
$in = langswitch_filter_langs_with_message( $in );
|
2510 |
|
2511 |
-
|
2512 |
-
$in = polyglot_filter( $in );
|
2513 |
|
2514 |
-
if (
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
-
|
|
|
|
|
|
|
|
|
|
|
2521 |
|
2522 |
-
|
|
|
|
|
2523 |
}
|
2524 |
|
2525 |
-
/**
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
2529 |
-
|
2530 |
-
|
2531 |
-
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
|
|
|
|
|
|
|
|
|
|
2536 |
}
|
2537 |
-
$
|
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 |
-
|
2545 |
-
|
2546 |
|
2547 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2548 |
|
2549 |
-
|
2550 |
-
|
2551 |
-
|
2552 |
-
$
|
2553 |
-
} else
|
2554 |
-
$
|
2555 |
-
|
2556 |
-
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2572 |
}
|
2573 |
-
|
2574 |
-
|
2575 |
-
$
|
2576 |
-
if (
|
2577 |
-
|
2578 |
-
$author = $wp_query->get_queried_object();
|
2579 |
}
|
2580 |
-
|
2581 |
-
|
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 |
-
|
2599 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2600 |
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
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 |
-
|
2619 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2620 |
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
$title_format = $aioseop_options['aiosp_category_title_format'];
|
2627 |
} else {
|
2628 |
-
$
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
$
|
|
|
2633 |
}
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
2659 |
-
|
2660 |
-
if (
|
2661 |
-
|
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 |
-
|
2673 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2674 |
|
2675 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2676 |
if ( AIOSEOPPRO ) {
|
2677 |
-
|
2678 |
-
if ( !empty( $opts ) )
|
2679 |
-
$desc = $opts['aiosp_description'];
|
2680 |
} else {
|
2681 |
-
|
2682 |
}
|
2683 |
-
if ( empty( $desc ) ) $desc = term_description( '', $tax );
|
2684 |
-
return $this->internationalize( $desc );
|
2685 |
}
|
2686 |
|
2687 |
-
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
2703 |
-
|
2704 |
-
|
2705 |
-
|
2706 |
-
|
2707 |
-
|
2708 |
-
|
2709 |
-
$
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
2714 |
-
|
2715 |
-
|
2716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2717 |
}
|
2718 |
}
|
2719 |
}
|
2720 |
-
return $title_format;
|
2721 |
}
|
2722 |
|
2723 |
-
|
2724 |
-
|
2725 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2726 |
|
2727 |
-
|
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 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
-
|
2739 |
-
|
2740 |
-
|
2741 |
-
|
2742 |
-
|
2743 |
-
|
2744 |
-
|
2745 |
-
|
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 |
-
|
2760 |
-
|
2761 |
-
|
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 |
-
|
2774 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2775 |
}
|
2776 |
|
2777 |
-
|
|
|
|
|
|
|
2778 |
global $aioseop_options;
|
2779 |
-
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2783 |
}
|
2784 |
-
if ( empty( $
|
2785 |
-
$
|
2786 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2787 |
}
|
2788 |
|
2789 |
-
|
2790 |
-
|
|
|
|
|
2791 |
global $aioseop_options;
|
2792 |
-
|
2793 |
-
|
2794 |
-
$
|
2795 |
-
|
2796 |
-
|
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 |
-
$
|
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 |
-
|
2813 |
-
|
|
|
|
|
|
|
2814 |
|
2815 |
-
|
2816 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2817 |
|
2818 |
-
|
2819 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2820 |
|
2821 |
-
|
2822 |
-
|
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 |
-
|
2832 |
-
|
2833 |
-
|
2834 |
-
return $title;
|
2835 |
|
|
|
|
|
|
|
2836 |
}
|
2837 |
|
2838 |
-
|
2839 |
-
|
2840 |
-
|
2841 |
-
|
2842 |
-
|
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 |
-
}
|
2880 |
-
|
2881 |
-
$
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
2888 |
-
|
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 (
|
2901 |
-
|
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 (
|
2924 |
-
|
2925 |
-
|
2926 |
-
|
2927 |
-
|
|
|
|
|
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( '"', ' ', ' ' ), $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 |
-
|
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 |
-
* @
|
|
|
|
|
3043 |
*/
|
3044 |
-
function
|
3045 |
-
$
|
3046 |
-
$
|
3047 |
-
|
3048 |
-
|
3049 |
-
|
3050 |
-
|
3051 |
-
|
3052 |
-
|
3053 |
-
|
3054 |
-
|
3055 |
-
|
3056 |
-
|
3057 |
-
|
3058 |
-
|
3059 |
-
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
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( ']]>', ']]>', $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 |
-
}
|
3090 |
-
|
3091 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3092 |
}
|
3093 |
}
|
3094 |
-
|
3095 |
-
|
3096 |
-
|
3097 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3098 |
}
|
3099 |
}
|
3100 |
-
$text = $this->substr( $text, 0, $max );
|
3101 |
-
return trim( $text );
|
3102 |
-
}
|
3103 |
|
3104 |
-
|
3105 |
-
$text = str_replace( ']]>', ']]>', $text );
|
3106 |
-
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
3107 |
-
$text = wp_strip_all_tags( $text );
|
3108 |
-
return trim( ( $text ) );
|
3109 |
}
|
3110 |
|
3111 |
-
|
3112 |
-
|
3113 |
-
|
3114 |
-
|
3115 |
-
|
3116 |
-
|
3117 |
-
|
3118 |
-
|
|
|
|
|
|
|
|
|
|
|
3119 |
|
3120 |
-
|
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 |
-
|
3130 |
-
|
3131 |
-
|
3132 |
-
|
3133 |
-
|
3134 |
-
|
3135 |
-
|
3136 |
-
|
3137 |
-
|
3138 |
-
|
3139 |
-
|
3140 |
-
|
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 |
-
|
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 |
-
* @
|
|
|
|
|
|
|
|
|
3162 |
*/
|
3163 |
-
function
|
3164 |
-
|
3165 |
-
|
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 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
|
3181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3182 |
}
|
3183 |
-
|
3184 |
-
|
3185 |
-
|
3186 |
-
|
3187 |
-
|
3188 |
-
|
3189 |
-
|
3190 |
-
|
3191 |
-
|
3192 |
-
|
3193 |
-
|
3194 |
-
|
3195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3196 |
}
|
3197 |
-
|
3198 |
-
|
3199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3200 |
}
|
3201 |
|
3202 |
-
|
3203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
3214 |
-
|
3215 |
-
|
3216 |
-
|
3217 |
-
|
3218 |
-
|
3219 |
-
return $this->get_unique_keywords( $keywords );
|
3220 |
-
}
|
3221 |
|
3222 |
-
|
3223 |
-
|
3224 |
-
|
3225 |
-
|
3226 |
-
|
3227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3228 |
}
|
3229 |
-
|
|
|
|
|
3230 |
}
|
3231 |
|
3232 |
-
|
3233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3234 |
}
|
3235 |
|
3236 |
-
|
3237 |
-
|
3238 |
-
|
|
|
|
|
|
|
|
|
3239 |
}
|
|
|
|
|
3240 |
}
|
3241 |
|
|
|
|
|
|
|
|
|
|
|
3242 |
function save_post_data( $id ) {
|
3243 |
$awmp_edit = $nonce = null;
|
3244 |
-
if ( empty( $_POST ) )
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
|
|
|
|
|
|
|
|
3249 |
|
3250 |
-
|
3251 |
-
|
3252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3253 |
}
|
3254 |
-
|
3255 |
$field = "aiosp_$f";
|
3256 |
-
if ( isset( $_POST[$field] ) )
|
3257 |
-
|
|
|
|
|
3258 |
|
3259 |
-
$optlist =
|
3260 |
-
|
3261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3262 |
}
|
3263 |
-
foreach ( $optlist as $f )
|
3264 |
delete_post_meta( $id, "_aioseop_{$f}" );
|
|
|
3265 |
|
3266 |
-
|
3267 |
-
|
3268 |
-
|
3269 |
-
|
3270 |
}
|
3271 |
|
3272 |
foreach ( $optlist as $f ) {
|
3273 |
-
$var
|
3274 |
$field = "_aioseop_$f";
|
3275 |
-
if ( isset( $$var ) && !empty( $$var ) )
|
3276 |
-
|
3277 |
-
|
3278 |
-
if (isset( $aiosp_sitemap_exclude ) && !empty( $aiosp_sitemap_exclude ) && $this->is_admin() )
|
3279 |
-
add_post_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
|
3280 |
-
if (isset( $aiosp_disable ) && !empty( $aiosp_disable ) && $this->is_admin() ) {
|
3281 |
-
add_post_meta( $id, '_aioseop_disable', $aiosp_disable );
|
3282 |
-
if (isset( $aiosp_disable_analytics ) && !empty( $aiosp_disable_analytics ) )
|
3283 |
-
add_post_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
|
3284 |
}
|
3285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3286 |
}
|
3287 |
|
|
|
|
|
|
|
|
|
3288 |
function display_tabbed_metabox( $post, $metabox ) {
|
3289 |
$tabs = $metabox['args'];
|
3290 |
echo '<div class="aioseop_tabs">';
|
3291 |
$header = $this->get_metabox_header( $tabs );
|
3292 |
echo $header;
|
3293 |
-
$active =
|
3294 |
-
foreach( $tabs as $m ) {
|
3295 |
-
echo '<div id="'
|
3296 |
-
if (
|
|
|
|
|
3297 |
$m['args'] = $m['callback_args'];
|
3298 |
$m['callback'][0]->{$m['callback'][1]}( $post, $m );
|
3299 |
echo '</div>';
|
@@ -3301,129 +4670,225 @@ EOF;
|
|
3301 |
echo '</div>';
|
3302 |
}
|
3303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3304 |
function admin_bar_menu() {
|
3305 |
global $wp_admin_bar, $aioseop_admin_menu, $aioseop_options, $post;
|
3306 |
|
3307 |
$toggle = '';
|
3308 |
-
if ( isset($_POST['aiosp_use_original_title']) && isset($_POST['aiosp_admin_bar']) )
|
3309 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
3316 |
-
|
3317 |
-
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
|
3322 |
-
|
3323 |
-
|
3324 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 ) )
|
3331 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
3345 |
-
|
3346 |
-
|
3347 |
-
|
|
|
3348 |
}
|
3349 |
|
|
|
|
|
|
|
3350 |
function save_category_metaboxes( $id ) {
|
3351 |
$awmp_edit = $nonce = null;
|
3352 |
-
if ( isset( $_POST[
|
3353 |
-
|
|
|
|
|
|
|
|
|
3354 |
|
3355 |
-
|
3356 |
-
$optlist =
|
3357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3358 |
$field = "aiosp_$f";
|
3359 |
-
if ( isset( $_POST[$field] ) )
|
3360 |
-
|
|
|
|
|
3361 |
|
3362 |
-
$optlist =
|
3363 |
-
|
3364 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3365 |
}
|
3366 |
-
foreach ( $optlist as $f )
|
3367 |
delete_term_meta( $id, "_aioseop_{$f}" );
|
|
|
3368 |
|
3369 |
-
|
3370 |
-
|
3371 |
-
|
3372 |
-
|
3373 |
}
|
3374 |
|
3375 |
foreach ( $optlist as $f ) {
|
3376 |
-
$var
|
3377 |
$field = "_aioseop_$f";
|
3378 |
-
if ( isset( $$var ) && !empty( $$var ) )
|
3379 |
-
|
3380 |
-
|
3381 |
-
|
3382 |
-
|
3383 |
-
|
3384 |
-
|
3385 |
-
|
3386 |
-
|
|
|
|
|
|
|
3387 |
}
|
3388 |
-
|
3389 |
}
|
3390 |
|
3391 |
function admin_menu() {
|
3392 |
-
$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[
|
3408 |
-
unset( $this->pointers[$k] );
|
|
|
|
|
|
|
3409 |
|
3410 |
$donated = false;
|
3411 |
-
if (
|
3412 |
-
if ( isset( $_POST[
|
3413 |
-
$donated = $_POST[
|
3414 |
-
|
3415 |
-
|
3416 |
-
|
3417 |
-
|
|
|
3418 |
$custom_menu_order = false;
|
3419 |
-
|
|
|
3420 |
$custom_menu_order = true;
|
3421 |
}
|
3422 |
} else {
|
3423 |
-
if ( isset( $this->options[
|
3424 |
-
$donated = $this->options[
|
3425 |
-
|
3426 |
-
|
|
|
|
|
3427 |
}
|
3428 |
|
3429 |
if ( $custom_menu_order ) {
|
@@ -3432,140 +4897,166 @@ EOF;
|
|
3432 |
}
|
3433 |
|
3434 |
if ( $donated ) {
|
3435 |
-
// Thank you for your donation
|
3436 |
-
$this->pointers['aioseop_donate'] =
|
3437 |
-
|
3438 |
-
|
3439 |
-
|
|
|
3440 |
}
|
3441 |
|
3442 |
-
if ( !AIOSEOPPRO ){
|
3443 |
-
|
3444 |
-
|
3445 |
-
|
3446 |
-
|
|
|
|
|
|
|
3447 |
|
3448 |
-
|
3449 |
}
|
3450 |
|
3451 |
-
if ( !empty( $this->options['aiosp_enablecpost'] ) && $this->options['aiosp_enablecpost'] ) {
|
3452 |
if ( AIOSEOPPRO ) {
|
3453 |
-
|
3454 |
-
|
3455 |
-
|
3456 |
-
|
3457 |
-
|
3458 |
-
|
|
|
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'] =
|
3466 |
}
|
3467 |
}
|
3468 |
} else {
|
3469 |
-
$this->locations['aiosp']['display'] =
|
3470 |
}
|
3471 |
|
3472 |
|
3473 |
-
|
|
|
|
|
|
|
3474 |
|
3475 |
-
add_meta_box('aioseop-list', __(
|
3476 |
-
|
3477 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3478 |
} else {
|
3479 |
-
add_meta_box('aioseop-about', "About <span class='Taha' style='float:right;'>Version <b>" . AIOSEOP_VERSION .
|
|
|
|
|
|
|
3480 |
}
|
3481 |
-
add_meta_box('aioseop-support', __(
|
|
|
|
|
|
|
3482 |
|
3483 |
-
add_action( 'aioseop_modules_add_menus',
|
3484 |
do_action( 'aioseop_modules_add_menus', $file );
|
3485 |
|
3486 |
-
$metaboxes = apply_filters( 'aioseop_add_post_metabox',
|
3487 |
|
3488 |
-
if ( !empty( $metaboxes ) ) {
|
3489 |
if ( $this->tabbed_metaboxes ) {
|
3490 |
-
$tabs
|
3491 |
$tab_num = 0;
|
3492 |
foreach ( $metaboxes as $m ) {
|
3493 |
-
if ( !isset( $tabs[ $m['post_type'] ] ) )
|
|
|
|
|
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
|
3501 |
-
if ( $title != $this->plugin_name )
|
|
|
|
|
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' ) .
|
|
|
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,
|
|
|
|
|
|
|
3508 |
}
|
3509 |
}
|
3510 |
}
|
3511 |
} else {
|
3512 |
foreach ( $metaboxes as $m ) {
|
3513 |
$title = $m['title'];
|
3514 |
-
if ( $title != $this->plugin_name )
|
3515 |
-
|
3516 |
-
|
|
|
|
|
|
|
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 |
-
|
3524 |
-
|
3525 |
-
|
3526 |
-
|
3527 |
-
|
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
|
3541 |
foreach ( $menu_order as $index => $item ) {
|
3542 |
-
if ( $item != $file )
|
3543 |
-
|
|
|
|
|
|
|
|
|
3544 |
}
|
|
|
3545 |
return $order;
|
3546 |
}
|
3547 |
|
3548 |
function display_settings_header() {
|
3549 |
}
|
3550 |
-
|
|
|
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,
|
3564 |
}
|
3565 |
-
?>
|
3566 |
<div class="aioseop_top">
|
3567 |
<div class="aioseop_top_sidebar aioseop_options_wrapper">
|
3568 |
-
<?php do_meta_boxes( 'aioseop_metaboxes', 'normal',
|
3569 |
</div>
|
3570 |
</div>
|
3571 |
<style>
|
@@ -3575,51 +5066,64 @@ EOF;
|
|
3575 |
</style>
|
3576 |
<div class="aioseop_right_sidebar aioseop_options_wrapper">
|
3577 |
|
3578 |
-
|
3579 |
-
|
3580 |
-
|
3581 |
-
|
3582 |
-
|
3583 |
-
|
3584 |
-
|
3585 |
-
|
3586 |
-
|
3587 |
-
|
3588 |
-
|
3589 |
-
|
3590 |
-
|
3591 |
-
|
3592 |
-
|
3593 |
-
|
3594 |
-
|
3595 |
-
|
3596 |
-
|
3597 |
-
|
3598 |
-
|
3599 |
-
|
3600 |
-
|
3601 |
-
|
3602 |
-
|
3603 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3604 |
<?
|
3605 |
-
}else{
|
3606 |
?>
|
3607 |
-
<a href="https://www.wincher.com/?referer=all-in-one-seo-pack&adreferer=banner<?php echo $adid; ?>"
|
3608 |
-
|
3609 |
-
|
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 |
-
|
3618 |
-
|
3619 |
-
|
3620 |
-
|
3621 |
-
|
3622 |
-
|
3623 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3624 |
|
3625 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* All in One SEO Pack Main Class file.
|
4 |
+
*
|
5 |
+
* Main class file, to be broken up later.
|
6 |
+
*
|
7 |
* @package All-in-One-SEO-Pack
|
8 |
*/
|
9 |
+
|
10 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' ); // Include the module base class.
|
11 |
+
|
12 |
/**
|
13 |
+
* Class All_in_One_SEO_Pack
|
14 |
+
*
|
|
|
|
|
15 |
* The main class.
|
16 |
*/
|
17 |
class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
18 |
|
19 |
+
// Current version of the plugin.
|
20 |
+
var $version = AIOSEOP_VERSION;
|
21 |
|
22 |
+
// Max numbers of chars in auto-generated description.
|
23 |
+
var $maximum_description_length = 160;
|
24 |
|
25 |
+
// Minimum number of chars an excerpt should be so that it can be used as description.
|
26 |
+
var $minimum_description_length = 1;
|
|
|
|
|
27 |
|
28 |
+
// Whether output buffering is already being used during forced title rewrites.
|
29 |
+
var $ob_start_detected = false;
|
30 |
|
31 |
+
// The start of the title text in the head section for forced title rewrites.
|
32 |
+
var $title_start = - 1;
|
33 |
|
34 |
+
// The end of the title text in the head section for forced title rewrites.
|
35 |
+
var $title_end = - 1;
|
36 |
|
37 |
+
// The title before rewriting.
|
38 |
+
var $orig_title = '';
|
39 |
|
40 |
+
// Filename of log file.
|
41 |
+
var $log_file;
|
42 |
|
43 |
+
// Flag whether there should be logging.
|
44 |
+
var $do_log;
|
45 |
|
46 |
var $token;
|
47 |
var $secret;
|
52 |
var $meta_opts = false;
|
53 |
var $is_front_page = null;
|
54 |
|
55 |
+
/**
|
56 |
+
* All_in_One_SEO_Pack constructor.
|
57 |
+
*/
|
58 |
function __construct() {
|
59 |
global $aioseop_options;
|
60 |
+
$this->log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log'; // PHP <5.3 compatibility, once we drop support we can use __DIR___.
|
61 |
|
62 |
+
if ( ! empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] ) {
|
63 |
$this->do_log = true;
|
64 |
+
} else {
|
65 |
$this->do_log = false;
|
66 |
+
}
|
67 |
|
68 |
+
$this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME );
|
69 |
$this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
|
70 |
|
71 |
+
$this->prefix = 'aiosp_'; // Option prefix.
|
72 |
+
$this->option_name = 'aioseop_options';
|
73 |
$this->store_option = true;
|
74 |
+
$this->file = __FILE__; // The current file.
|
75 |
+
$blog_name = esc_attr( get_bloginfo( 'name' ) );
|
76 |
parent::__construct();
|
77 |
|
78 |
+
$this->help_text = array(
|
79 |
+
'donate' => __( 'All donations support continued development of this free software.', 'all-in-one-seo-pack' ),
|
80 |
+
'license_key' => __( 'This will be the license key received when the product was purchased. This is used for automatic upgrades.', 'all-in-one-seo-pack' ),
|
81 |
+
'can' => __( "This option will automatically generate Canonical URLs for your entire WordPress installation. This will help to prevent duplicate content penalties by <a href=\'http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html\' target=\'_blank\'>Google</a>.", 'all-in-one-seo-pack' ),
|
82 |
+
'no_paged_canonical_links' => __( 'Checking this option will set the Canonical URL for all paginated content to the first page.', 'all-in-one-seo-pack' ),
|
83 |
+
'customize_canonical_links' => __( 'Checking this option will allow you to customize Canonical URLs for specific posts.', 'all-in-one-seo-pack' ),
|
84 |
+
'can_set_protocol' => __( 'Set protocol for canonical URLs.', 'all-in-one-seo-pack' ),
|
85 |
+
'use_original_title' => __( 'Use wp_title to get the title used by the theme; this is disabled by default. If you use this option, set your title formats appropriately, as your theme might try to do its own title SEO as well.', 'all-in-one-seo-pack' ),
|
86 |
+
'do_log' => __( 'Check this and All in One SEO Pack will create a log of important events (all-in-one-seo-pack.log) in its plugin directory which might help debugging. Make sure this directory is writable.', 'all-in-one-seo-pack' ),
|
87 |
+
'home_title' => __( 'As the name implies, this will be the Meta Title of your homepage. This is independent of any other option. If not set, the default Site Title (found in WordPress under Settings, General, Site Title) will be used.', 'all-in-one-seo-pack' ),
|
88 |
+
'home_description' => __( 'This will be the Meta Description for your homepage. This is independent of any other option. The default is no Meta Description at all if this is not set.', 'all-in-one-seo-pack' ),
|
89 |
+
'home_keywords' => __( 'Enter a comma separated list of your most important keywords for your site that will be written as Meta Keywords on your homepage. Do not stuff everything in here.', 'all-in-one-seo-pack' ),
|
90 |
+
'use_static_home_info' => __( 'Checking this option uses the title, description, and keywords set on your static Front Page.', 'all-in-one-seo-pack' ),
|
91 |
+
'togglekeywords' => __( 'This option allows you to toggle the use of Meta Keywords throughout the whole of the site.', 'all-in-one-seo-pack' ),
|
92 |
+
'use_categories' => __( 'Check this if you want your categories for a given post used as the Meta Keywords for this post (in addition to any keywords you specify on the Edit Post screen).', 'all-in-one-seo-pack' ),
|
93 |
+
'use_tags_as_keywords' => __( 'Check this if you want your tags for a given post used as the Meta Keywords for this post (in addition to any keywords you specify on the Edit Post screen).', 'all-in-one-seo-pack' ),
|
94 |
+
'dynamic_postspage_keywords' => __( 'Check this if you want your keywords on your Posts page (set in WordPress under Settings, Reading, Front Page Displays) and your archive pages to be dynamically generated from the keywords of the posts showing on that page. If unchecked, it will use the keywords set in the edit page screen for the posts page.', 'all-in-one-seo-pack' ),
|
95 |
+
'rewrite_titles' => __( "Note that this is all about the title tag. This is what you see in your browser's window title bar. This is NOT visible on a page, only in the title bar and in the source code. If enabled, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: Using the default post title format below, Rewrite Titles will write all post titles as 'Post Title | Blog Name'. If you have manually defined a title using All in One SEO Pack, this will become the title of your post in the format string.", 'all-in-one-seo-pack' ),
|
96 |
+
'cap_titles' => __( 'Check this and Search Page Titles and Tag Page Titles will have the first letter of each word capitalized.', 'all-in-one-seo-pack' ),
|
97 |
+
'cap_cats' => __( 'Check this and Category Titles will have the first letter of each word capitalized.', 'all-in-one-seo-pack' ),
|
98 |
+
'home_page_title_format' =>
|
99 |
+
__( 'This controls the format of the title tag for your Home Page.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
100 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
101 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
102 |
__( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
|
103 |
__( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
104 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
105 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
106 |
+
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
|
107 |
+
'page_title_format' =>
|
108 |
+
__( 'This controls the format of the title tag for Pages.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
|
|
109 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
110 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
111 |
__( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
|
112 |
__( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
113 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
114 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
115 |
+
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
|
116 |
+
'post_title_format' =>
|
117 |
+
__( 'This controls the format of the title tag for Posts.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
|
|
118 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
119 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
120 |
__( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
123 |
__( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
124 |
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
125 |
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
126 |
+
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
|
127 |
+
'category_title_format' =>
|
128 |
+
__( 'This controls the format of the title tag for Category Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
|
|
129 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
130 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
131 |
__( '%category_title% - The original title of the category', 'all-in-one-seo-pack' ) . '</li><li>' .
|
132 |
__( '%category_description% - The description of the category', 'all-in-one-seo-pack' ) . '</li></ul>',
|
133 |
+
'archive_title_format' =>
|
134 |
+
__( 'This controls the format of the title tag for Custom Post Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
135 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
136 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
137 |
__( '%archive_title - The original archive title given by wordpress', 'all-in-one-seo-pack' ) . '</li></ul>',
|
138 |
+
'date_title_format' =>
|
139 |
+
__( 'This controls the format of the title tag for Date Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
140 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
141 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
142 |
__( '%date% - The original archive title given by wordpress, e.g. "2007" or "2007 August"', 'all-in-one-seo-pack' ) . '</li><li>' .
|
143 |
__( '%day% - The original archive day given by wordpress, e.g. "17"', 'all-in-one-seo-pack' ) . '</li><li>' .
|
144 |
__( '%month% - The original archive month given by wordpress, e.g. "August"', 'all-in-one-seo-pack' ) . '</li><li>' .
|
145 |
__( '%year% - The original archive year given by wordpress, e.g. "2007"', 'all-in-one-seo-pack' ) . '</li></ul>',
|
146 |
+
'author_title_format' =>
|
147 |
+
__( 'This controls the format of the title tag for Author Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
148 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
149 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
150 |
__( '%author% - The original archive title given by wordpress, e.g. "Steve" or "John Smith"', 'all-in-one-seo-pack' ) . '</li></ul>',
|
151 |
+
'tag_title_format' =>
|
152 |
+
__( 'This controls the format of the title tag for Tag Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
153 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
154 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
155 |
__( '%tag% - The name of the tag', 'all-in-one-seo-pack' ) . '</li></ul>',
|
156 |
+
'search_title_format' =>
|
157 |
+
__( 'This controls the format of the title tag for the Search page.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
158 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
159 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
160 |
__( '%search% - What was searched for', 'all-in-one-seo-pack' ) . '</li></ul>',
|
161 |
+
'description_format' => __( 'This controls the format of Meta Descriptions.The following macros are supported:', 'all-in-one-seo-pack' ) .
|
162 |
+
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
163 |
+
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
164 |
+
__( '%description% - The original description as determined by the plugin, e.g. the excerpt if one is set or an auto-generated one if that option is set', 'all-in-one-seo-pack' ) . '</li><li>' .
|
165 |
+
__( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
166 |
+
__( '%wp_title% - The original wordpress title, e.g. post_title for posts', 'all-in-one-seo-pack' ) . '</li></ul>',
|
167 |
+
'404_title_format' => __( 'This controls the format of the title tag for the 404 page.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
168 |
+
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
169 |
+
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
170 |
+
__( '%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all-in-one-seo-pack' ) . '</li><li>' .
|
171 |
+
__( '%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all-in-one-seo-pack' ) . '</li><li>' .
|
172 |
+
__( '%404_title% - Additional 404 title input"', 'all-in-one-seo-pack' ) . '</li></ul>',
|
173 |
+
'paged_format' => __( 'This string gets appended/prepended to titles of paged index pages (like home or archive pages).', 'all-in-one-seo-pack' )
|
174 |
+
. __( 'The following macros are supported:', 'all-in-one-seo-pack' )
|
175 |
+
. '<ul><li>' . __( '%page% - The page number', 'all-in-one-seo-pack' ) . '</li></ul>',
|
176 |
+
'enablecpost' => __( 'Check this if you want to use All in One SEO Pack with any Custom Post Types on this site.', 'all-in-one-seo-pack' ),
|
177 |
+
'cpostadvanced' => __( 'This will show or hide the advanced options for SEO for Custom Post Types.', 'all-in-one-seo-pack' ),
|
178 |
+
'cpostactive' => __( 'Use these checkboxes to select which Post Types you want to use All in One SEO Pack with.', 'all-in-one-seo-pack' ),
|
179 |
+
'taxactive' => __( 'Use these checkboxes to select which Taxonomies you want to use All in One SEO Pack with.', 'all-in-one-seo-pack' ),
|
180 |
+
'cposttitles' => __( 'This allows you to set the title tags for each Custom Post Type.', 'all-in-one-seo-pack' ),
|
181 |
+
'posttypecolumns' => __( 'This lets you select which screens display the SEO Title, SEO Keywords and SEO Description columns.', 'all-in-one-seo-pack' ),
|
182 |
+
'admin_bar' => __( 'Check this to add All in One SEO Pack to the Admin Bar for easy access to your SEO settings.', 'all-in-one-seo-pack' ),
|
183 |
+
'custom_menu_order' => __( 'Check this to move the All in One SEO Pack menu item to the top of your WordPress Dashboard menu.', 'all-in-one-seo-pack' ),
|
184 |
+
'google_verify' => __( "Enter your verification code here to verify your site with Google Webmaster Tools.<br /><a href='http://semperplugins.com/documentation/google-webmaster-tools-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
|
185 |
+
'bing_verify' => __( "Enter your verification code here to verify your site with Bing Webmaster Tools.<br /><a href='http://semperplugins.com/documentation/bing-webmaster-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
|
186 |
+
'pinterest_verify' => __( "Enter your verification code here to verify your site with Pinterest.<br /><a href='http://semperplugins.com/documentation/pinterest-site-verification/' target='_blank'>Click here for documentation on this setting</a>", 'all-in-one-seo-pack' ),
|
187 |
+
'google_publisher' => __( 'Enter your Google+ Profile URL here to add the rel=“author” tag to your site for Google authorship. It is recommended that the URL you enter here should be your personal Google+ profile. Use the Advanced Authorship Options below if you want greater control over the use of authorship.', 'all-in-one-seo-pack' ),
|
188 |
+
'google_disable_profile' => __( 'Check this to remove the Google Plus field from the user profile screen.', 'all-in-one-seo-pack' ),
|
189 |
+
'google_author_advanced' => __( 'Enable this to display advanced options for controlling Google Plus authorship information on your website.', 'all-in-one-seo-pack' ),
|
190 |
+
'google_author_location' => __( 'This option allows you to control which types of pages you want to display rel=\"author\" on for Google authorship. The options include the Front Page (the homepage of your site), Posts, Pages, and any Custom Post Types. The Everywhere Else option includes 404, search, categories, tags, custom taxonomies, date archives, author archives and any other page template.', 'all-in-one-seo-pack' ),
|
191 |
+
'google_enable_publisher' => __( 'This option allows you to control whether rel=\"publisher\" is displayed on the homepage of your site. Google recommends using this if the site is a business website.', 'all-in-one-seo-pack' ),
|
192 |
+
'google_specify_publisher' => __( 'The Google+ profile you enter here will appear on your homepage only as the rel=\"publisher\" tag. It is recommended that the URL you enter here should be the Google+ profile for your business.', 'all-in-one-seo-pack' ),
|
193 |
+
'google_sitelinks_search' => __( 'Add markup to display the Google Sitelinks Search Box next to your search results in Google.', 'all-in-one-seo-pack' ),
|
194 |
+
'google_set_site_name' => __( 'Add markup to tell Google the preferred name for your website.', 'all-in-one-seo-pack' ),
|
195 |
+
'google_connect' => __( 'Press the connect button to connect with Google Analytics; or if already connected, press the disconnect button to disable and remove any stored analytics credentials.', 'all-in-one-seo-pack' ),
|
196 |
+
'google_analytics_id' => __( 'Enter your Google Analytics ID here to track visitor behavior on your site using Google Analytics.', 'all-in-one-seo-pack' ),
|
197 |
+
'ga_use_universal_analytics' => __( 'Use the new Universal Analytics tracking code for Google Analytics.', 'all-in-one-seo-pack' ),
|
198 |
+
'ga_advanced_options' => __( 'Check to use advanced Google Analytics options.', 'all-in-one-seo-pack' ),
|
199 |
+
'ga_domain' => __( 'Enter your domain name without the http:// to set your cookie domain.', 'all-in-one-seo-pack' ),
|
200 |
+
'ga_multi_domain' => __( 'Use this option to enable tracking of multiple or additional domains.', 'all-in-one-seo-pack' ),
|
201 |
+
'ga_addl_domains' => __( 'Add a list of additional domains to track here. Enter one domain name per line without the http://.', 'all-in-one-seo-pack' ),
|
202 |
+
'ga_anonymize_ip' => __( 'This enables support for IP Anonymization in Google Analytics.', 'all-in-one-seo-pack' ),
|
203 |
+
'ga_display_advertising' => __( 'This enables support for the Display Advertiser Features in Google Analytics.', 'all-in-one-seo-pack' ),
|
204 |
+
'ga_exclude_users' => __( 'Exclude logged-in users from Google Analytics tracking by role.', 'all-in-one-seo-pack' ),
|
205 |
+
'ga_track_outbound_links' => __( 'Check this if you want to track outbound links with Google Analytics.', 'all-in-one-seo-pack' ),
|
206 |
+
'ga_link_attribution' => __( 'This enables support for the Enhanced Link Attribution in Google Analytics.', 'all-in-one-seo-pack' ),
|
207 |
+
'ga_enhanced_ecommerce' => __( 'This enables support for the Enhanced Ecommerce in Google Analytics.', 'all-in-one-seo-pack' ),
|
208 |
+
'cpostnoindex' => __( 'Set the default NOINDEX setting for each Post Type.', 'all-in-one-seo-pack' ),
|
209 |
+
'cpostnofollow' => __( 'Set the default NOFOLLOW setting for each Post Type.', 'all-in-one-seo-pack' ),
|
210 |
+
'category_noindex' => __( 'Check this to ask search engines not to index Category Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
211 |
+
'archive_date_noindex' => __( 'Check this to ask search engines not to index Date Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
212 |
+
'archive_author_noindex' => __( 'Check this to ask search engines not to index Author Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
213 |
+
'tags_noindex' => __( 'Check this to ask search engines not to index Tag Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
214 |
+
'search_noindex' => __( 'Check this to ask search engines not to index the Search page. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
215 |
+
'404_noindex' => __( 'Check this to ask search engines not to index the 404 page.', 'all-in-one-seo-pack' ),
|
216 |
+
'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' ),
|
217 |
+
'paginated_noindex' => __( 'Check this to ask search engines not to index paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
218 |
+
'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' ),
|
219 |
+
'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' ),
|
220 |
+
'cpostnoodp' => __( 'Set the default noodp setting for each Post Type.', 'all-in-one-seo-pack' ),
|
221 |
+
'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for your entire site.', 'all-in-one-seo-pack' ),
|
222 |
+
'cpostnoydir' => __( 'Set the default noydir setting for each Post Type.', 'all-in-one-seo-pack' ),
|
223 |
+
'skip_excerpt' => __( "Check this and your Meta Descriptions won't be generated from the excerpt.", 'all-in-one-seo-pack' ),
|
224 |
+
'generate_descriptions' => __( 'Check this and your Meta Descriptions will be auto-generated from your excerpt or content.', 'all-in-one-seo-pack' ),
|
225 |
+
'run_shortcodes' => __( 'Check this and shortcodes will get executed for descriptions auto-generated from content.', 'all-in-one-seo-pack' ),
|
226 |
+
'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' ),
|
227 |
+
'dont_truncate_descriptions' => __( 'Check this to prevent your Description from being truncated regardless of its length.', 'all-in-one-seo-pack' ),
|
228 |
+
'schema_markup' => __( 'Check this to support Schema.org markup, i.e., itemprop on supported metadata.', 'all-in-one-seo-pack' ),
|
229 |
+
'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' ),
|
230 |
+
'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' ),
|
231 |
+
'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' ),
|
232 |
+
'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' ),
|
233 |
+
'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' ),
|
234 |
+
'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' ),
|
235 |
);
|
236 |
|
237 |
+
$this->help_anchors = array(
|
238 |
+
'license_key' => '#license-key',
|
239 |
+
'can' => '#canonical-urls',
|
240 |
+
'no_paged_canonical_links' => '#no-pagination-for-canonical-urls',
|
241 |
+
'customize_canonical_links' => '#enable-custom-canonical-urls',
|
242 |
+
'use_original_title' => '#use-original-title',
|
243 |
+
'schema_markup' => '#use-schema-markup',
|
244 |
+
'do_log' => '#log-important-events',
|
245 |
+
'home_title' => '#home-title',
|
246 |
+
'home_description' => '#home-description',
|
247 |
+
'home_keywords' => '#home-keywords',
|
248 |
+
'togglekeywords' => '#use-keywords',
|
249 |
+
'use_categories' => '#use-categories-for-meta-keywords',
|
250 |
+
'use_tags_as_keywords' => '#use-tags-for-meta-keywords',
|
251 |
+
'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page',
|
252 |
+
'rewrite_titles' => '#rewrite-titles',
|
253 |
+
'cap_titles' => '#capitalize-titles',
|
254 |
+
'home_page_title_format' => '#title-format-fields',
|
255 |
+
'page_title_format' => '#title-format-fields',
|
256 |
+
'post_title_format' => '#title-format-fields',
|
257 |
+
'category_title_format' => '#title-format-fields',
|
258 |
+
'archive_title_format' => '#title-format-fields',
|
259 |
+
'date_title_format' => '#title-format-fields',
|
260 |
+
'author_title_format' => '#title-format-fields',
|
261 |
+
'tag_title_format' => '#title-format-fields',
|
262 |
+
'search_title_format' => '#title-format-fields',
|
263 |
+
'404_title_format' => '#title-format-fields',
|
264 |
+
'enablecpost' => '#seo-for-custom-post-types',
|
265 |
+
'cpostadvanced' => '#enable-advanced-options',
|
266 |
+
'cpostactive' => '#seo-on-only-these-post-types',
|
267 |
+
'taxactive' => '#seo-on-only-these-taxonomies',
|
268 |
+
'cposttitles' => '#custom-titles',
|
269 |
+
'posttypecolumns' => '#show-column-labels-for-custom-post-types',
|
270 |
+
'admin_bar' => '#display-menu-in-admin-bar',
|
271 |
+
'custom_menu_order' => '#display-menu-at-the-top',
|
272 |
+
'google_verify' => '',
|
273 |
+
'bing_verify' => '',
|
274 |
+
'pinterest_verify' => '',
|
275 |
+
'google_publisher' => '#google-plus-default-profile',
|
276 |
+
'google_disable_profile' => '#disable-google-plus-profile',
|
277 |
+
'google_author_advanced' => '#advanced-authorship-options',
|
278 |
+
'google_author_location' => '#display-google-authorship',
|
279 |
+
'google_enable_publisher' => '#display-publisher-meta-on-front-page',
|
280 |
+
'google_specify_publisher' => '#specify-publisher-url',
|
281 |
+
'google_analytics_id' => 'http://semperplugins.com/documentation/setting-up-google-analytics/',
|
282 |
+
'ga_use_universal_analytics' => '#use-universal-analytics',
|
283 |
+
'ga_domain' => '#tracking-domain',
|
284 |
+
'ga_multi_domain' => '#track-multiple-domains-additional-domains',
|
285 |
+
'ga_addl_domains' => '#track-multiple-domains-additional-domains',
|
286 |
+
'ga_anonymize_ip' => '#anonymize-ip-addresses',
|
287 |
+
'ga_display_advertising' => '#display-advertiser-tracking',
|
288 |
+
'ga_exclude_users' => '#exclude-users-from-tracking',
|
289 |
+
'ga_track_outbound_links' => '#track-outbound-links',
|
290 |
+
'ga_link_attribution' => '#enhanced-link-attribution',
|
291 |
+
'ga_enhanced_ecommerce' => '#enhanced-ecommerce',
|
292 |
+
'cpostnoindex' => '#use-noindex-for-paginated-pages-posts',
|
293 |
+
'cpostnofollow' => '#use-nofollow-for-paginated-pages-posts',
|
294 |
+
'noodp' => '#exclude-site-from-the-open-directory-project',
|
295 |
+
'noydir' => '#exclude-site-from-yahoo-directory',
|
296 |
+
'generate_descriptions' => '#autogenerate-descriptions',
|
297 |
+
'run_shortcodes' => '#run-shortcodes-in-autogenerated-descriptions',
|
298 |
'hide_paginated_descriptions' => '#remove-descriptions-for-paginated-pages',
|
299 |
+
'dont_truncate_descriptions' => '#never-shorten-long-descriptions',
|
300 |
+
'unprotect_meta' => '#unprotect-post-meta-fields',
|
301 |
+
'ex_pages' => '#exclude-pages',
|
302 |
+
'post_meta_tags' => '#additional-post-headers',
|
303 |
+
'page_meta_tags' => '#additional-page-headers',
|
304 |
+
'front_meta_tags' => '#additional-front-page-headers',
|
305 |
+
'home_meta_tags' => '#additional-blog-page-headers',
|
306 |
);
|
307 |
|
308 |
+
$meta_help_text = array(
|
309 |
+
'snippet' => __( 'A preview of what this page might look like in search engine results.', 'all-in-one-seo-pack' ),
|
310 |
+
'title' => __( 'A custom title that shows up in the title tag for this page.', 'all-in-one-seo-pack' ),
|
311 |
+
'description' => __( 'The META description for this page. This will override any autogenerated descriptions.', 'all-in-one-seo-pack' ),
|
312 |
+
'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' ),
|
313 |
+
'custom_link' => __( 'Override the canonical URLs for this post.', 'all-in-one-seo-pack' ),
|
314 |
+
'noindex' => __( 'Check this box to ask search engines not to index this page.', 'all-in-one-seo-pack' ),
|
315 |
+
'nofollow' => __( 'Check this box to ask search engines not to follow links from this page.', 'all-in-one-seo-pack' ),
|
316 |
+
'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' ),
|
317 |
+
'noydir' => __( 'Check this box to ask Yahoo! not to use descriptions from the Yahoo! directory for this page.', 'all-in-one-seo-pack' ),
|
318 |
+
'titleatr' => __( 'Set the title attribute for menu links.', 'all-in-one-seo-pack' ),
|
319 |
+
'menulabel' => __( 'Set the label for this page menu item.', 'all-in-one-seo-pack' ),
|
320 |
+
'sitemap_exclude' => __( "Don't display this page in the sitemap.", 'all-in-one-seo-pack' ),
|
321 |
+
'disable' => __( 'Disable SEO on this page.', 'all-in-one-seo-pack' ),
|
322 |
+
'disable_analytics' => __( 'Disable Google Analytics on this page.', 'all-in-one-seo-pack' ),
|
323 |
);
|
324 |
|
325 |
$this->default_options = array(
|
326 |
+
'license_key' => array(
|
327 |
'name' => __( 'License Key:', 'all-in-one-seo-pack' ),
|
328 |
+
'type' => 'text',
|
329 |
+
),
|
330 |
+
'donate' => array(
|
331 |
+
'name' => __( 'I enjoy this plugin and have made a donation:', 'all-in-one-seo-pack' ),
|
332 |
+
),
|
333 |
+
'home_title' => array(
|
334 |
+
'name' => __( 'Home Title:', 'all-in-one-seo-pack' ),
|
335 |
+
'default' => null,
|
336 |
+
'type' => 'textarea',
|
337 |
+
'sanitize' => 'text',
|
338 |
+
'count' => true,
|
339 |
+
'rows' => 1,
|
340 |
+
'cols' => 60,
|
341 |
+
'condshow' => array( 'aiosp_use_static_home_info' => 0 ),
|
342 |
+
),
|
343 |
+
'home_description' => array(
|
344 |
+
'name' => __( 'Home Description:', 'all-in-one-seo-pack' ),
|
345 |
+
'default' => '',
|
346 |
+
'type' => 'textarea',
|
347 |
+
'sanitize' => 'text',
|
348 |
+
'count' => true,
|
349 |
+
'cols' => 80,
|
350 |
+
'rows' => 2,
|
351 |
+
'condshow' => array( 'aiosp_use_static_home_info' => 0 ),
|
352 |
+
),
|
353 |
+
'togglekeywords' => array(
|
354 |
+
'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ),
|
355 |
+
'default' => 1,
|
356 |
+
'type' => 'radio',
|
357 |
+
'initial_options' => array(
|
358 |
+
0 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
359 |
+
1 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
),
|
361 |
+
),
|
362 |
+
'home_keywords' => array(
|
363 |
+
'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ),
|
364 |
+
'default' => null,
|
365 |
+
'type' => 'textarea',
|
366 |
+
'sanitize' => 'text',
|
367 |
+
'condshow' => array( 'aiosp_togglekeywords' => 0, 'aiosp_use_static_home_info' => 0 ),
|
368 |
+
),
|
369 |
+
'use_static_home_info' => array(
|
370 |
+
'name' => __( 'Use Static Front Page Instead', 'all-in-one-seo-pack' ),
|
371 |
+
'default' => 0,
|
372 |
+
'type' => 'radio',
|
373 |
+
'initial_options' => array(
|
374 |
+
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
375 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
376 |
),
|
377 |
+
),
|
378 |
+
'can' => array(
|
379 |
+
'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ),
|
380 |
'default' => 1,
|
381 |
+
),
|
382 |
+
'no_paged_canonical_links' => array(
|
383 |
+
'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ),
|
384 |
+
'default' => 0,
|
385 |
+
'condshow' => array( 'aiosp_can' => 'on' ),
|
386 |
+
),
|
387 |
+
'customize_canonical_links' => array(
|
388 |
+
'name' => __( 'Enable Custom Canonical URLs:', 'all-in-one-seo-pack' ),
|
389 |
+
'default' => 0,
|
390 |
+
'condshow' => array( 'aiosp_can' => 'on' ),
|
391 |
+
),
|
392 |
+
'can_set_protocol' => array(
|
393 |
+
'name' => __( 'Set Protocol For Canonical URLs:', 'all-in-one-seo-pack' ),
|
394 |
+
'type' => 'radio',
|
395 |
+
'default' => 'auto',
|
396 |
+
'initial_options' => array(
|
397 |
+
'auto' => __( 'Auto', 'all-in-one-seo-pack' ),
|
398 |
+
'http' => __( 'HTTP', 'all-in-one-seo-pack' ),
|
399 |
+
'https' => __( 'HTTPS', 'all-in-one-seo-pack' ),
|
400 |
),
|
401 |
+
'condshow' => array( 'aiosp_can' => 'on' ),
|
402 |
+
),
|
403 |
+
'rewrite_titles' => array(
|
404 |
+
'name' => __( 'Rewrite Titles:', 'all-in-one-seo-pack' ),
|
405 |
+
'default' => 1,
|
406 |
+
'type' => 'radio',
|
407 |
+
'initial_options' => array(
|
408 |
+
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
409 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
410 |
),
|
411 |
+
),
|
412 |
+
'force_rewrites' => array(
|
413 |
+
'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
|
414 |
+
'default' => 1,
|
415 |
+
'type' => 'hidden',
|
416 |
+
'prefix' => $this->prefix,
|
417 |
+
'initial_options' => array(
|
418 |
+
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
419 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
),
|
421 |
+
),
|
422 |
+
'use_original_title' => array(
|
423 |
+
'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ),
|
424 |
+
'type' => 'radio',
|
425 |
+
'default' => 0,
|
426 |
+
'initial_options' => array(
|
427 |
+
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
428 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
429 |
),
|
430 |
+
),
|
431 |
+
'cap_titles' => array(
|
432 |
+
'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ),
|
433 |
+
'default' => 1,
|
434 |
+
),
|
435 |
+
'cap_cats' => array(
|
436 |
+
'name' => __( 'Capitalize Category Titles:', 'all-in-one-seo-pack' ),
|
437 |
+
'default' => 1,
|
438 |
+
),
|
439 |
+
'home_page_title_format' => array(
|
440 |
+
'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
|
441 |
+
'type' => 'text',
|
442 |
+
'default' => '%page_title%',
|
443 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
444 |
+
),
|
445 |
+
'page_title_format' => array(
|
446 |
+
'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ),
|
447 |
+
'type' => 'text',
|
448 |
+
'default' => '%page_title% | %blog_title%',
|
449 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
450 |
+
),
|
451 |
+
'post_title_format' => array(
|
452 |
+
'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ),
|
453 |
+
'type' => 'text',
|
454 |
+
'default' => '%post_title% | %blog_title%',
|
455 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
456 |
+
),
|
457 |
+
'category_title_format' => array(
|
458 |
+
'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ),
|
459 |
+
'type' => 'text',
|
460 |
+
'default' => '%category_title% | %blog_title%',
|
461 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
462 |
+
),
|
463 |
+
'archive_title_format' => array(
|
464 |
+
'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ),
|
465 |
+
'type' => 'text',
|
466 |
+
'default' => '%archive_title% | %blog_title%',
|
467 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
468 |
+
),
|
469 |
+
'date_title_format' => array(
|
470 |
+
'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ),
|
471 |
+
'type' => 'text',
|
472 |
+
'default' => '%date% | %blog_title%',
|
473 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
474 |
+
),
|
475 |
+
'author_title_format' => array(
|
476 |
+
'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ),
|
477 |
+
'type' => 'text',
|
478 |
+
'default' => '%author% | %blog_title%',
|
479 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
480 |
+
),
|
481 |
+
'tag_title_format' => array(
|
482 |
+
'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ),
|
483 |
+
'type' => 'text',
|
484 |
+
'default' => '%tag% | %blog_title%',
|
485 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
486 |
+
),
|
487 |
+
'search_title_format' => array(
|
488 |
+
'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ),
|
489 |
+
'type' => 'text',
|
490 |
+
'default' => '%search% | %blog_title%',
|
491 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
492 |
+
),
|
493 |
+
'description_format' => array(
|
494 |
+
'name' => __( 'Description Format', 'all-in-one-seo-pack' ),
|
495 |
+
'type' => 'text',
|
496 |
+
'default' => '%description%',
|
497 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
498 |
+
),
|
499 |
+
'404_title_format' => array(
|
500 |
+
'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ),
|
501 |
+
'type' => 'text',
|
502 |
+
'default' => 'Nothing found for %request_words%',
|
503 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
504 |
+
),
|
505 |
+
'paged_format' => array(
|
506 |
+
'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ),
|
507 |
+
'type' => 'text',
|
508 |
+
'default' => ' - Part %page%',
|
509 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
510 |
+
),
|
511 |
+
'enablecpost' => array(
|
512 |
+
'name' => __( 'SEO for Custom Post Types:', 'all-in-one-seo-pack' ),
|
513 |
+
'default' => 'on',
|
514 |
+
'type' => 'radio',
|
515 |
+
'initial_options' => array(
|
516 |
+
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
517 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
518 |
),
|
519 |
+
),
|
520 |
+
'cpostactive' => array(
|
521 |
+
'name' => __( 'SEO on only these post types:', 'all-in-one-seo-pack' ),
|
522 |
+
'type' => 'multicheckbox',
|
523 |
+
'default' => array( 'post', 'page' ),
|
524 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on' ),
|
525 |
+
),
|
526 |
+
'taxactive' => array(
|
527 |
+
'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ),
|
528 |
+
'type' => 'multicheckbox',
|
529 |
+
'default' => array( 'category', 'post_tag' ),
|
530 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on' ),
|
531 |
+
),
|
532 |
+
'cpostadvanced' => array(
|
533 |
+
'name' => __( 'Enable Advanced Options:', 'all-in-one-seo-pack' ),
|
534 |
+
'default' => 0,
|
535 |
+
'type' => 'radio',
|
536 |
+
'initial_options' => array(
|
537 |
+
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
538 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
539 |
),
|
540 |
+
'label' => null,
|
541 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on' ),
|
542 |
+
),
|
543 |
+
'cpostnoindex' => array(
|
544 |
+
'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ),
|
545 |
+
'type' => 'multicheckbox',
|
546 |
+
'default' => array(),
|
547 |
+
),
|
548 |
+
'cpostnofollow' => array(
|
549 |
+
'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ),
|
550 |
+
'type' => 'multicheckbox',
|
551 |
+
'default' => array(),
|
552 |
+
),
|
553 |
+
'cpostnoodp' => array(
|
554 |
+
'name' => __( 'Default to NOODP:', 'all-in-one-seo-pack' ),
|
555 |
+
'type' => 'multicheckbox',
|
556 |
+
'default' => array(),
|
557 |
+
),
|
558 |
+
'cpostnoydir' => array(
|
559 |
+
'name' => __( 'Default to NOYDIR:', 'all-in-one-seo-pack' ),
|
560 |
+
'type' => 'multicheckbox',
|
561 |
+
'default' => array(),
|
562 |
+
),
|
563 |
+
'cposttitles' => array(
|
564 |
+
'name' => __( 'Custom titles:', 'all-in-one-seo-pack' ),
|
565 |
+
'type' => 'checkbox',
|
566 |
+
'default' => 0,
|
567 |
+
'condshow' => array(
|
568 |
+
'aiosp_rewrite_titles' => 1,
|
569 |
+
'aiosp_enablecpost' => 'on',
|
570 |
+
'aiosp_cpostadvanced' => 'on',
|
571 |
),
|
572 |
+
),
|
573 |
+
'posttypecolumns' => array(
|
574 |
+
'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ),
|
575 |
+
'type' => 'multicheckbox',
|
576 |
+
'default' => array( 'post', 'page' ),
|
577 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on' ),
|
578 |
+
),
|
579 |
+
'admin_bar' => array(
|
580 |
+
'name' => __( 'Display Menu In Admin Bar:', 'all-in-one-seo-pack' ),
|
581 |
+
'default' => 'on',
|
582 |
+
),
|
583 |
+
'custom_menu_order' => array(
|
584 |
+
'name' => __( 'Display Menu At The Top:', 'all-in-one-seo-pack' ),
|
585 |
+
'default' => 'on',
|
586 |
+
),
|
587 |
+
'google_verify' => array(
|
588 |
+
'name' => __( 'Google Webmaster Tools:', 'all-in-one-seo-pack' ),
|
589 |
+
'default' => '',
|
590 |
+
'type' => 'text',
|
591 |
+
),
|
592 |
+
'bing_verify' => array(
|
593 |
+
'name' => __( 'Bing Webmaster Center:', 'all-in-one-seo-pack' ),
|
594 |
+
'default' => '',
|
595 |
+
'type' => 'text',
|
596 |
+
),
|
597 |
+
'pinterest_verify' => array(
|
598 |
+
'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ),
|
599 |
+
'default' => '',
|
600 |
+
'type' => 'text',
|
601 |
+
),
|
602 |
+
'google_publisher' => array(
|
603 |
+
'name' => __( 'Google Plus Default Profile:', 'all-in-one-seo-pack' ),
|
604 |
+
'default' => '',
|
605 |
+
'type' => 'text',
|
606 |
+
),
|
607 |
+
'google_disable_profile' => array(
|
608 |
+
'name' => __( 'Disable Google Plus Profile:', 'all-in-one-seo-pack' ),
|
609 |
+
'default' => 0,
|
610 |
+
'type' => 'checkbox',
|
611 |
+
),
|
612 |
+
'google_sitelinks_search' => array(
|
613 |
+
'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' ),
|
614 |
+
),
|
615 |
+
'google_set_site_name' => array(
|
616 |
+
'name' => __( 'Set Preferred Site Name:', 'all-in-one-seo-pack' ),
|
617 |
+
),
|
618 |
+
'google_specify_site_name' => array(
|
619 |
+
'name' => __( 'Specify A Preferred Name:', 'all-in-one-seo-pack' ),
|
620 |
+
'type' => 'text',
|
621 |
+
'placeholder' => $blog_name,
|
622 |
+
'condshow' => array( 'aiosp_google_set_site_name' => 'on' ),
|
623 |
+
),
|
624 |
+
'google_author_advanced' => array(
|
625 |
+
'name' => __( 'Advanced Authorship Options:', 'all-in-one-seo-pack' ),
|
626 |
+
'default' => 0,
|
627 |
+
'type' => 'radio',
|
628 |
+
'initial_options' => array(
|
629 |
+
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
630 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
631 |
),
|
632 |
+
'label' => null,
|
633 |
+
),
|
634 |
+
'google_author_location' => array(
|
635 |
+
'name' => __( 'Display Google Authorship:', 'all-in-one-seo-pack' ),
|
636 |
+
'default' => array( 'all' ),
|
637 |
+
'type' => 'multicheckbox',
|
638 |
+
'condshow' => array( 'aiosp_google_author_advanced' => 'on' ),
|
639 |
+
),
|
640 |
+
'google_enable_publisher' => array(
|
641 |
+
'name' => __( 'Display Publisher Meta on Front Page:', 'all-in-one-seo-pack' ),
|
642 |
+
'default' => 'on',
|
643 |
+
'type' => 'radio',
|
644 |
+
'initial_options' => array(
|
645 |
+
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
646 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
647 |
),
|
648 |
+
'condshow' => array( 'aiosp_google_author_advanced' => 'on' ),
|
649 |
+
),
|
650 |
+
'google_specify_publisher' => array(
|
651 |
+
'name' => __( 'Specify Publisher URL:', 'all-in-one-seo-pack' ),
|
652 |
+
'type' => 'text',
|
653 |
+
'condshow' => array( 'aiosp_google_author_advanced' => 'on', 'aiosp_google_enable_publisher' => 'on' ),
|
654 |
+
),
|
655 |
+
// "google_connect"=>array( 'name' => __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ), ),
|
656 |
+
'google_analytics_id' => array(
|
657 |
+
'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ),
|
658 |
+
'default' => null,
|
659 |
+
'type' => 'text',
|
660 |
+
'placeholder' => 'UA-########-#',
|
661 |
+
),
|
662 |
+
'ga_use_universal_analytics' => array(
|
663 |
+
'name' => __( 'Use Universal Analytics:', 'all-in-one-seo-pack' ),
|
664 |
+
'default' => 0,
|
665 |
+
'condshow' => array(
|
666 |
+
'aiosp_google_analytics_id' => array(
|
667 |
+
'lhs' => 'aiosp_google_analytics_id',
|
668 |
+
'op' => '!=',
|
669 |
+
'rhs' => '',
|
670 |
+
),
|
671 |
),
|
672 |
+
),
|
673 |
+
'ga_advanced_options' => array(
|
674 |
+
'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ),
|
675 |
+
'default' => 'on',
|
676 |
+
'type' => 'radio',
|
677 |
+
'initial_options' => array(
|
678 |
+
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
679 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
680 |
),
|
681 |
+
'condshow' => array(
|
682 |
+
'aiosp_google_analytics_id' => array(
|
683 |
+
'lhs' => 'aiosp_google_analytics_id',
|
684 |
+
'op' => '!=',
|
685 |
+
'rhs' => '',
|
686 |
+
),
|
687 |
),
|
688 |
+
),
|
689 |
+
'ga_domain' => array(
|
690 |
+
'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ),
|
691 |
+
'type' => 'text',
|
692 |
+
'condshow' => array(
|
693 |
+
'aiosp_google_analytics_id' => array(
|
694 |
+
'lhs' => 'aiosp_google_analytics_id',
|
695 |
+
'op' => '!=',
|
696 |
+
'rhs' => '',
|
697 |
+
),
|
698 |
+
'aiosp_ga_advanced_options' => 'on',
|
699 |
),
|
700 |
+
),
|
701 |
+
'ga_multi_domain' => array(
|
702 |
+
'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ),
|
703 |
+
'default' => 0,
|
704 |
+
'condshow' => array(
|
705 |
+
'aiosp_google_analytics_id' => array(
|
706 |
+
'lhs' => 'aiosp_google_analytics_id',
|
707 |
+
'op' => '!=',
|
708 |
+
'rhs' => '',
|
709 |
+
),
|
710 |
+
'aiosp_ga_advanced_options' => 'on',
|
711 |
),
|
712 |
+
),
|
713 |
+
'ga_addl_domains' => array(
|
714 |
+
'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ),
|
715 |
+
'type' => 'textarea',
|
716 |
+
'condshow' => array(
|
717 |
+
'aiosp_google_analytics_id' => array(
|
718 |
+
'lhs' => 'aiosp_google_analytics_id',
|
719 |
+
'op' => '!=',
|
720 |
+
'rhs' => '',
|
721 |
+
),
|
722 |
+
'aiosp_ga_advanced_options' => 'on',
|
723 |
+
'aiosp_ga_multi_domain' => 'on',
|
724 |
),
|
725 |
+
),
|
726 |
+
'ga_anonymize_ip' => array(
|
727 |
+
'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ),
|
728 |
+
'type' => 'checkbox',
|
729 |
+
'condshow' => array(
|
730 |
+
'aiosp_google_analytics_id' => array(
|
731 |
+
'lhs' => 'aiosp_google_analytics_id',
|
732 |
+
'op' => '!=',
|
733 |
+
'rhs' => '',
|
734 |
+
),
|
735 |
+
'aiosp_ga_advanced_options' => 'on',
|
736 |
),
|
737 |
+
),
|
738 |
+
'ga_display_advertising' => array(
|
739 |
+
'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ),
|
740 |
+
'type' => 'checkbox',
|
741 |
+
'condshow' => array(
|
742 |
+
'aiosp_google_analytics_id' => array(
|
743 |
+
'lhs' => 'aiosp_google_analytics_id',
|
744 |
+
'op' => '!=',
|
745 |
+
'rhs' => '',
|
746 |
+
),
|
747 |
+
'aiosp_ga_advanced_options' => 'on',
|
748 |
),
|
749 |
+
),
|
750 |
+
'ga_exclude_users' => array(
|
751 |
+
'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ),
|
752 |
+
'type' => 'multicheckbox',
|
753 |
+
'condshow' => array(
|
754 |
+
'aiosp_google_analytics_id' => array(
|
755 |
+
'lhs' => 'aiosp_google_analytics_id',
|
756 |
+
'op' => '!=',
|
757 |
+
'rhs' => '',
|
758 |
+
),
|
759 |
+
'aiosp_ga_advanced_options' => 'on',
|
760 |
),
|
761 |
+
),
|
762 |
+
'ga_track_outbound_links' => array(
|
763 |
+
'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ),
|
764 |
+
'default' => 0,
|
765 |
+
'condshow' => array(
|
766 |
+
'aiosp_google_analytics_id' => array(
|
767 |
+
'lhs' => 'aiosp_google_analytics_id',
|
768 |
+
'op' => '!=',
|
769 |
+
'rhs' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
),
|
771 |
+
'aiosp_ga_advanced_options' => 'on',
|
|
|
|
|
772 |
),
|
773 |
+
),
|
774 |
+
'ga_link_attribution' => array(
|
775 |
+
'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ),
|
776 |
+
'default' => 0,
|
777 |
+
'condshow' => array(
|
778 |
+
'aiosp_google_analytics_id' => array(
|
779 |
+
'lhs' => 'aiosp_google_analytics_id',
|
780 |
+
'op' => '!=',
|
781 |
+
'rhs' => '',
|
782 |
+
),
|
783 |
+
'aiosp_ga_advanced_options' => 'on',
|
784 |
),
|
785 |
+
),
|
786 |
+
'ga_enhanced_ecommerce' => array(
|
787 |
+
'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ),
|
788 |
+
'default' => 0,
|
789 |
+
'condshow' => array(
|
790 |
+
'aiosp_google_analytics_id' => array(
|
791 |
+
'lhs' => 'aiosp_google_analytics_id',
|
792 |
+
'op' => '!=',
|
793 |
+
'rhs' => '',
|
794 |
+
),
|
795 |
+
'aiosp_ga_use_universal_analytics' => 'on',
|
796 |
+
'aiosp_ga_advanced_options' => 'on',
|
797 |
),
|
798 |
+
),
|
799 |
+
'use_categories' => array(
|
800 |
+
'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ),
|
801 |
+
'default' => 0,
|
802 |
+
'condshow' => array( 'aiosp_togglekeywords' => 0 ),
|
803 |
+
),
|
804 |
+
'use_tags_as_keywords' => array(
|
805 |
+
'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ),
|
806 |
+
'default' => 1,
|
807 |
+
'condshow' => array( 'aiosp_togglekeywords' => 0 ),
|
808 |
+
),
|
809 |
+
'dynamic_postspage_keywords' => array(
|
810 |
+
'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ),
|
811 |
+
'default' => 1,
|
812 |
+
'condshow' => array( 'aiosp_togglekeywords' => 0 ),
|
813 |
+
),
|
814 |
+
'category_noindex' => array(
|
815 |
+
'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ),
|
816 |
+
'default' => 1,
|
817 |
+
),
|
818 |
+
'archive_date_noindex' => array(
|
819 |
+
'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ),
|
820 |
+
'default' => 1,
|
821 |
+
),
|
822 |
+
'archive_author_noindex' => array(
|
823 |
+
'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ),
|
824 |
+
'default' => 1,
|
825 |
+
),
|
826 |
+
'tags_noindex' => array(
|
827 |
+
'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ),
|
828 |
'default' => 0,
|
829 |
+
),
|
830 |
+
'search_noindex' => array(
|
831 |
+
'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ),
|
832 |
+
'default' => 0,
|
833 |
+
),
|
834 |
+
'404_noindex' => array(
|
835 |
+
'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ),
|
836 |
+
'default' => 0,
|
837 |
+
),
|
838 |
+
'tax_noindex' => array(
|
839 |
+
'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ),
|
840 |
+
'type' => 'multicheckbox',
|
841 |
+
'default' => array(),
|
842 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' ),
|
843 |
+
),
|
844 |
+
'paginated_noindex' => array(
|
845 |
+
'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ),
|
846 |
'default' => 0,
|
847 |
+
),
|
848 |
+
'paginated_nofollow' => array(
|
849 |
+
'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
850 |
'default' => 0,
|
851 |
+
),
|
852 |
+
'noodp' => array(
|
853 |
+
'name' => __( 'Exclude site from the Open Directory Project:', 'all-in-one-seo-pack' ),
|
854 |
'default' => 0,
|
855 |
+
),
|
856 |
+
'noydir' => array(
|
857 |
+
'name' => __( 'Exclude site from Yahoo! Directory:', 'all-in-one-seo-pack' ),
|
858 |
'default' => 0,
|
859 |
+
),
|
860 |
+
'skip_excerpt' => array(
|
861 |
+
'name' => __( 'Avoid Using The Excerpt In Descriptions:', 'all-in-one-seo-pack' ),
|
862 |
'default' => 0,
|
863 |
+
),
|
864 |
+
'generate_descriptions' => array(
|
865 |
+
'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ),
|
866 |
'default' => 1,
|
867 |
+
),
|
868 |
+
'run_shortcodes' => array(
|
869 |
+
'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ),
|
870 |
+
'default' => 0,
|
871 |
+
'condshow' => array( 'aiosp_generate_descriptions' => 'on' ),
|
872 |
+
),
|
873 |
+
'hide_paginated_descriptions' => array(
|
874 |
+
'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ),
|
875 |
+
'default' => 0,
|
876 |
+
),
|
877 |
+
'dont_truncate_descriptions' => array(
|
878 |
+
'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ),
|
879 |
+
'default' => 0,
|
880 |
+
),
|
881 |
+
'schema_markup' => array(
|
882 |
+
'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ),
|
883 |
'default' => 1,
|
884 |
+
),
|
885 |
+
'unprotect_meta' => array(
|
886 |
+
'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
887 |
'default' => 0,
|
888 |
+
),
|
889 |
+
'ex_pages' => array(
|
890 |
+
'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ),
|
891 |
+
'type' => 'textarea',
|
892 |
+
'default' => '',
|
893 |
+
),
|
894 |
+
'post_meta_tags' => array(
|
895 |
+
'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ),
|
896 |
+
'type' => 'textarea',
|
897 |
+
'default' => '',
|
898 |
+
'sanitize' => 'default',
|
899 |
+
),
|
900 |
+
'page_meta_tags' => array(
|
901 |
+
'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ),
|
902 |
+
'type' => 'textarea',
|
903 |
+
'default' => '',
|
904 |
+
'sanitize' => 'default',
|
905 |
+
),
|
906 |
+
'front_meta_tags' => array(
|
907 |
+
'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ),
|
908 |
+
'type' => 'textarea',
|
909 |
+
'default' => '',
|
910 |
+
'sanitize' => 'default',
|
911 |
+
),
|
912 |
+
'home_meta_tags' => array(
|
913 |
+
'name' => __( 'Additional Blog Page Headers:', 'all-in-one-seo-pack' ),
|
914 |
+
'type' => 'textarea',
|
915 |
+
'default' => '',
|
916 |
+
'sanitize' => 'default',
|
917 |
+
),
|
918 |
+
'do_log' => array(
|
919 |
+
'name' => __( 'Log important events:', 'all-in-one-seo-pack' ),
|
920 |
+
'default' => null,
|
921 |
+
),
|
922 |
+
);
|
923 |
|
924 |
+
if ( AIOSEOPPRO ) {
|
925 |
+
unset( $this->default_options['donate'] );
|
926 |
+
} else {
|
927 |
+
unset( $this->default_options['license_key'] );
|
928 |
+
unset( $this->default_options['taxactive'] );
|
929 |
+
}
|
930 |
+
|
931 |
+
$this->locations = array(
|
932 |
+
'default' => array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings', 'options' => null ),
|
933 |
+
'aiosp' => array(
|
934 |
+
'name' => $this->plugin_name,
|
935 |
+
'type' => 'metabox',
|
936 |
+
'prefix' => '',
|
937 |
+
'help_link' => 'http://semperplugins.com/sections/postpage-settings/',
|
938 |
+
'options' => array(
|
939 |
+
'edit',
|
940 |
+
'nonce-aioseop-edit',
|
941 |
+
AIOSEOPPRO ? 'support' : 'upgrade',
|
942 |
+
'snippet',
|
943 |
+
'title',
|
944 |
+
'description',
|
945 |
+
'keywords',
|
946 |
+
'custom_link',
|
947 |
+
'noindex',
|
948 |
+
'nofollow',
|
949 |
+
'noodp',
|
950 |
+
'noydir',
|
951 |
+
'titleatr',
|
952 |
+
'menulabel',
|
953 |
+
'sitemap_exclude',
|
954 |
+
'disable',
|
955 |
+
'disable_analytics',
|
956 |
+
),
|
957 |
+
'default_options' => array(
|
958 |
+
'edit' => array(
|
959 |
+
'type' => 'hidden',
|
960 |
+
'default' => 'aiosp_edit',
|
961 |
+
'prefix' => true,
|
962 |
+
'nowrap' => 1,
|
963 |
+
),
|
964 |
+
'nonce-aioseop-edit' => array(
|
965 |
+
'type' => 'hidden',
|
966 |
+
'default' => null,
|
967 |
+
'prefix' => false,
|
968 |
+
'nowrap' => 1,
|
969 |
+
),
|
970 |
+
'upgrade' => array(
|
971 |
+
'type' => 'html',
|
972 |
+
'label' => 'none',
|
973 |
+
'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' ),
|
974 |
+
),
|
975 |
+
'support' => array(
|
976 |
+
'type' => 'html',
|
977 |
+
'label' => 'none',
|
978 |
+
'default' => '<a target="_blank" href="https://semperplugins.com/support/">'
|
979 |
+
. __( 'Support Forum', 'all-in-one-seo-pack' ) . '</a>',
|
980 |
+
),
|
981 |
+
'snippet' => array(
|
982 |
+
'name' => __( 'Preview Snippet', 'all-in-one-seo-pack' ),
|
983 |
+
'type' => 'custom',
|
984 |
+
'label' => 'top',
|
985 |
+
'default' => '
|
986 |
<script>
|
987 |
jQuery(document).ready(function() {
|
988 |
jQuery("#aiosp_title_wrapper").bind("input", function() {
|
993 |
});
|
994 |
});
|
995 |
</script>
|
996 |
+
<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>',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
997 |
),
|
998 |
+
'title' => array(
|
999 |
+
'name' => __( 'Title', 'all-in-one-seo-pack' ),
|
1000 |
+
'type' => 'text',
|
1001 |
+
'count' => true,
|
1002 |
+
'size' => 60,
|
1003 |
),
|
1004 |
+
'description' => array(
|
1005 |
+
'name' => __( 'Description', 'all-in-one-seo-pack' ),
|
1006 |
+
'type' => 'textarea',
|
1007 |
+
'count' => true,
|
1008 |
+
'cols' => 80,
|
1009 |
+
'rows' => 2,
|
1010 |
),
|
1011 |
+
|
1012 |
+
'keywords' => array(
|
1013 |
+
'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ),
|
1014 |
+
'type' => 'text',
|
1015 |
+
),
|
1016 |
+
'custom_link' => array(
|
1017 |
+
'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ),
|
1018 |
+
'type' => 'text',
|
1019 |
+
'size' => 60,
|
1020 |
),
|
1021 |
+
'noindex' => array(
|
1022 |
+
'name' => __( 'Robots Meta NOINDEX', 'all-in-one-seo-pack' ),
|
1023 |
+
'default' => '',
|
|
|
1024 |
),
|
1025 |
+
'nofollow' => array(
|
1026 |
+
'name' => __( 'Robots Meta NOFOLLOW', 'all-in-one-seo-pack' ),
|
1027 |
+
'default' => '',
|
|
|
1028 |
),
|
1029 |
+
'noodp' => array( 'name' => __( 'Robots Meta NOODP', 'all-in-one-seo-pack' ) ),
|
1030 |
+
'noydir' => array( 'name' => __( 'Robots Meta NOYDIR', 'all-in-one-seo-pack' ) ),
|
1031 |
+
'titleatr' => array(
|
1032 |
+
'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ),
|
1033 |
+
'type' => 'text',
|
1034 |
+
'size' => 60,
|
1035 |
),
|
1036 |
+
'menulabel' => array(
|
1037 |
+
'name' => __( 'Menu Label', 'all-in-one-seo-pack' ),
|
1038 |
+
'type' => 'text',
|
1039 |
+
'size' => 60,
|
1040 |
),
|
1041 |
+
'sitemap_exclude' => array( 'name' => __( 'Exclude From Sitemap', 'all-in-one-seo-pack' ) ),
|
1042 |
+
'disable' => array( 'name' => __( 'Disable on this page/post', 'all-in-one-seo-pack' ) ),
|
1043 |
+
'disable_analytics' => array(
|
1044 |
+
'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ),
|
1045 |
+
'condshow' => array( 'aiosp_disable' => 'on' ),
|
1046 |
),
|
1047 |
+
),
|
1048 |
+
'display' => null,
|
1049 |
+
),
|
1050 |
+
);
|
|
|
|
|
1051 |
|
1052 |
+
if ( ! empty( $meta_help_text ) ) {
|
1053 |
+
foreach ( $meta_help_text as $k => $v ) {
|
1054 |
+
$this->locations['aiosp']['default_options'][ $k ]['help_text'] = $v;
|
1055 |
+
}
|
1056 |
+
}
|
1057 |
+
|
1058 |
+
$this->layout = array(
|
1059 |
+
'default' => array(
|
1060 |
+
'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
|
1061 |
+
'help_link' => 'https://semperplugins.com/documentation/general-settings/',
|
1062 |
+
'options' => array(), // This is set below, to the remaining options -- pdb.
|
1063 |
+
),
|
1064 |
+
'home' => array(
|
1065 |
+
'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
|
1066 |
+
'help_link' => 'https://semperplugins.com/documentation/home-page-settings/',
|
1067 |
+
'options' => array( 'home_title', 'home_description', 'home_keywords', 'use_static_home_info' ),
|
1068 |
+
),
|
1069 |
+
'title' => array(
|
1070 |
+
'name' => __( 'Title Settings', 'all-in-one-seo-pack' ),
|
1071 |
+
'help_link' => 'https://semperplugins.com/documentation/title-settings/',
|
1072 |
+
'options' => array(
|
1073 |
+
'rewrite_titles',
|
1074 |
+
'force_rewrites',
|
1075 |
+
'cap_titles',
|
1076 |
+
'cap_cats',
|
1077 |
+
'home_page_title_format',
|
1078 |
+
'page_title_format',
|
1079 |
+
'post_title_format',
|
1080 |
+
'category_title_format',
|
1081 |
+
'archive_title_format',
|
1082 |
+
'date_title_format',
|
1083 |
+
'author_title_format',
|
1084 |
+
'tag_title_format',
|
1085 |
+
'search_title_format',
|
1086 |
+
'description_format',
|
1087 |
+
'404_title_format',
|
1088 |
+
'paged_format',
|
1089 |
+
),
|
1090 |
+
),
|
1091 |
+
'cpt' => array(
|
1092 |
+
'name' => __( 'Custom Post Type Settings', 'all-in-one-seo-pack' ),
|
1093 |
+
'help_link' => 'http://semperplugins.com/documentation/custom-post-type-settings/',
|
1094 |
+
'options' => array( 'enablecpost', 'cpostadvanced', 'taxactive', 'cpostactive', 'cposttitles' ),
|
1095 |
+
),
|
1096 |
+
'display' => array(
|
1097 |
+
'name' => __( 'Display Settings', 'all-in-one-seo-pack' ),
|
1098 |
+
'help_link' => 'http://semperplugins.com/documentation/display-settings/',
|
1099 |
+
'options' => array( 'posttypecolumns', 'admin_bar', 'custom_menu_order' ),
|
1100 |
+
),
|
1101 |
+
'webmaster' => array(
|
1102 |
+
'name' => __( 'Webmaster Verification', 'all-in-one-seo-pack' ),
|
1103 |
+
'help_link' => 'http://semperplugins.com/sections/webmaster-verification/',
|
1104 |
+
'options' => array( 'google_verify', 'bing_verify', 'pinterest_verify' ),
|
1105 |
+
),
|
1106 |
+
'google' => array(
|
1107 |
+
'name' => __( 'Google Settings', 'all-in-one-seo-pack' ),
|
1108 |
+
'help_link' => 'http://semperplugins.com/documentation/google-settings/',
|
1109 |
+
'options' => array(
|
1110 |
+
'google_publisher',
|
1111 |
+
'google_disable_profile',
|
1112 |
+
'google_sitelinks_search',
|
1113 |
+
'google_set_site_name',
|
1114 |
+
'google_specify_site_name',
|
1115 |
+
'google_author_advanced',
|
1116 |
+
'google_author_location',
|
1117 |
+
'google_enable_publisher',
|
1118 |
+
'google_specify_publisher',
|
1119 |
+
// "google_connect",
|
1120 |
+
'google_analytics_id',
|
1121 |
+
'ga_use_universal_analytics',
|
1122 |
+
'ga_advanced_options',
|
1123 |
+
'ga_domain',
|
1124 |
+
'ga_multi_domain',
|
1125 |
+
'ga_addl_domains',
|
1126 |
+
'ga_anonymize_ip',
|
1127 |
+
'ga_display_advertising',
|
1128 |
+
'ga_exclude_users',
|
1129 |
+
'ga_track_outbound_links',
|
1130 |
+
'ga_link_attribution',
|
1131 |
+
'ga_enhanced_ecommerce',
|
1132 |
+
),
|
1133 |
+
),
|
1134 |
+
'noindex' => array(
|
1135 |
+
'name' => __( 'Noindex Settings', 'all-in-one-seo-pack' ),
|
1136 |
+
'help_link' => 'http://semperplugins.com/documentation/noindex-settings/',
|
1137 |
+
'options' => array(
|
1138 |
+
'cpostnoindex',
|
1139 |
+
'cpostnofollow',
|
1140 |
+
'cpostnoodp',
|
1141 |
+
'cpostnoydir',
|
1142 |
+
'category_noindex',
|
1143 |
+
'archive_date_noindex',
|
1144 |
+
'archive_author_noindex',
|
1145 |
+
'tags_noindex',
|
1146 |
+
'search_noindex',
|
1147 |
+
'404_noindex',
|
1148 |
+
'tax_noindex',
|
1149 |
+
'paginated_noindex',
|
1150 |
+
'paginated_nofollow',
|
1151 |
+
'noodp',
|
1152 |
+
'noydir',
|
1153 |
+
),
|
1154 |
+
),
|
1155 |
+
'advanced' => array(
|
1156 |
+
'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ),
|
1157 |
+
'help_link' => 'http://semperplugins.com/documentation/advanced-settings/',
|
1158 |
+
'options' => array(
|
1159 |
+
'generate_descriptions',
|
1160 |
+
'skip_excerpt',
|
1161 |
+
'run_shortcodes',
|
1162 |
+
'hide_paginated_descriptions',
|
1163 |
+
'dont_truncate_descriptions',
|
1164 |
+
'unprotect_meta',
|
1165 |
+
'ex_pages',
|
1166 |
+
'post_meta_tags',
|
1167 |
+
'page_meta_tags',
|
1168 |
+
'front_meta_tags',
|
1169 |
+
'home_meta_tags',
|
1170 |
+
),
|
1171 |
+
),
|
1172 |
+
'keywords' => array(
|
1173 |
+
'name' => __( 'Keyword Settings', 'all-in-one-seo-pack' ),
|
1174 |
+
'help_link' => 'http://semperplugins.com/documentation/keyword-settings/',
|
1175 |
+
'options' => array(
|
1176 |
+
'togglekeywords',
|
1177 |
+
'use_categories',
|
1178 |
+
'use_tags_as_keywords',
|
1179 |
+
'dynamic_postspage_keywords',
|
1180 |
+
),
|
1181 |
+
),
|
1182 |
+
);
|
1183 |
+
|
1184 |
+
if ( ! AIOSEOPPRO ) {
|
1185 |
+
unset( $this->layout['cpt']['options']['2'] );
|
1186 |
+
}
|
1187 |
|
1188 |
+
$other_options = array();
|
1189 |
+
foreach ( $this->layout as $k => $v ) {
|
1190 |
+
$other_options = array_merge( $other_options, $v['options'] );
|
1191 |
+
}
|
1192 |
+
|
1193 |
+
$this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
|
1194 |
|
1195 |
+
if ( is_admin() ) {
|
1196 |
+
$this->add_help_text_links();
|
1197 |
+
add_action( 'aioseop_global_settings_header', array( $this, 'display_right_sidebar' ) );
|
1198 |
+
add_action( 'aioseop_global_settings_footer', array( $this, 'display_settings_footer' ) );
|
1199 |
+
add_action( 'output_option', array( $this, 'custom_output_option' ), 10, 2 );
|
1200 |
+
add_action( 'all_admin_notices', array( $this, 'visibility_warning' ) );
|
1201 |
|
1202 |
+
if ( ! AIOSEOPPRO ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1203 |
// add_action('all_admin_notices', array( $this, 'woo_upgrade_notice'));
|
1204 |
+
}
|
1205 |
+
}
|
1206 |
+
if ( AIOSEOPPRO ) {
|
1207 |
+
add_action( 'split_shared_term', array( $this, 'split_shared_term' ), 10, 4 );
|
1208 |
+
}
|
1209 |
+
}
|
1210 |
|
1211 |
+
//good candidate for pro dir
|
1212 |
+
|
1213 |
+
/**
|
1214 |
+
* Use custom callback for outputting snippet
|
1215 |
+
*
|
1216 |
+
* @param $buf
|
1217 |
+
* @param $args
|
1218 |
+
*
|
1219 |
+
* @return string
|
1220 |
+
*/
|
1221 |
+
function custom_output_option( $buf, $args ) {
|
1222 |
+
if ( 'aiosp_snippet' === $args['name'] ) {
|
1223 |
+
$args['options']['type'] = 'html';
|
1224 |
+
$args['options']['nowrap'] = false;
|
1225 |
+
$args['options']['save'] = false;
|
1226 |
+
$info = $this->get_page_snippet_info();
|
1227 |
+
extract( $info );
|
1228 |
+
} else {
|
1229 |
+
return '';
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
if ( $this->strlen( $title ) > 70 ) {
|
1233 |
+
$title = $this->trim_excerpt_without_filters( $title, 70 ) . '...';
|
1234 |
+
}
|
1235 |
+
if ( $this->strlen( $description ) > 156 ) {
|
1236 |
+
$description = $this->trim_excerpt_without_filters( $description, 156 ) . '...';
|
1237 |
+
}
|
1238 |
+
$extra_title_len = 0;
|
1239 |
+
if ( empty( $title_format ) ) {
|
1240 |
+
$title = '<span id="' . $args['name'] . '_title">' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . '</span>';
|
1241 |
+
} else {
|
1242 |
+
if ( strpos( $title_format, '%blog_title%' ) !== false ) {
|
1243 |
+
$title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
|
1244 |
+
}
|
1245 |
+
$title_format = $this->apply_cf_fields( $title_format );
|
1246 |
+
$replace_title = '<span id="' . $args['name'] . '_title">' . esc_attr( wp_strip_all_tags( html_entity_decode( $title ) ) ) . '</span>';
|
1247 |
+
if ( strpos( $title_format, '%post_title%' ) !== false ) {
|
1248 |
+
$title_format = str_replace( '%post_title%', $replace_title, $title_format );
|
1249 |
+
}
|
1250 |
+
if ( strpos( $title_format, '%page_title%' ) !== false ) {
|
1251 |
+
$title_format = str_replace( '%page_title%', $replace_title, $title_format );
|
1252 |
+
}
|
1253 |
+
if ( $w->is_category || $w->is_tag || $w->is_tax ) {
|
1254 |
+
if ( AIOSEOPPRO && ! empty( $_GET ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) {
|
1255 |
+
$term_id = intval( $_GET['tag_ID'] );
|
1256 |
+
$was_split = get_term_meta( $term_id, '_aioseop_term_was_split', true );
|
1257 |
+
if ( ! $was_split ) {
|
1258 |
+
$split_terms = wp_get_split_terms( $term_id, $_GET['taxonomy'] );
|
1259 |
+
if ( ! empty( $split_terms ) ) {
|
1260 |
+
foreach ( $split_terms as $new_tax => $new_term ) {
|
1261 |
+
$this->split_shared_term( $term_id, $new_term );
|
1262 |
+
}
|
1263 |
}
|
1264 |
}
|
|
|
1265 |
}
|
1266 |
+
if ( strpos( $title_format, '%category_title%' ) !== false ) {
|
1267 |
+
$title_format = str_replace( '%category_title%', $replace_title, $title_format );
|
1268 |
+
}
|
1269 |
+
if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) {
|
1270 |
+
$title_format = str_replace( '%taxonomy_title%', $replace_title, $title_format );
|
1271 |
+
}
|
1272 |
+
} else {
|
1273 |
+
if ( strpos( $title_format, '%category%' ) !== false ) {
|
1274 |
+
$title_format = str_replace( '%category%', $category, $title_format );
|
1275 |
+
}
|
1276 |
+
if ( strpos( $title_format, '%category_title%' ) !== false ) {
|
1277 |
+
$title_format = str_replace( '%category_title%', $category, $title_format );
|
1278 |
+
}
|
1279 |
+
if ( strpos( $title_format, '%taxonomy_title%' ) !== false ) {
|
1280 |
+
$title_format = str_replace( '%taxonomy_title%', $category, $title_format );
|
1281 |
+
}
|
1282 |
+
if ( AIOSEOPPRO ) {
|
1283 |
+
if ( strpos( $title_format, '%tax_' ) && ! empty( $p ) ) {
|
1284 |
+
$taxes = get_object_taxonomies( $p, 'objects' );
|
1285 |
+
if ( ! empty( $taxes ) ) {
|
1286 |
+
foreach ( $taxes as $t ) {
|
1287 |
+
if ( strpos( $title_format, "%tax_{$t->name}%" ) ) {
|
1288 |
+
$terms = $this->get_all_terms( $p->ID, $t->name );
|
1289 |
+
$term = '';
|
1290 |
+
if ( count( $terms ) > 0 ) {
|
1291 |
+
$term = $terms[0];
|
1292 |
+
}
|
1293 |
+
$title_format = str_replace( "%tax_{$t->name}%", $term, $title_format );
|
1294 |
+
}
|
1295 |
}
|
|
|
1296 |
}
|
1297 |
}
|
1298 |
+
}
|
1299 |
}
|
1300 |
+
if ( strpos( $title_format, '%taxonomy_description%' ) !== false ) {
|
1301 |
+
$title_format = str_replace( '%taxonomy_description%', $description, $title_format );
|
1302 |
+
}
|
1303 |
+
|
1304 |
+
$title_format = preg_replace( '/%([^%]*?)%/', '', $title_format );
|
1305 |
+
$title = $title_format;
|
1306 |
+
$extra_title_len = strlen( str_replace( $replace_title, '', $title_format ) );
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
$args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( wp_strip_all_tags( $description ) ) );
|
1310 |
+
$extra_title_len = (int) $extra_title_len;
|
1311 |
+
$args['value'] .= "<script>var aiosp_title_extra = {$extra_title_len};</script>";
|
1312 |
+
$buf = $this->get_option_row( $args['name'], $args['options'], $args );
|
1313 |
+
|
1314 |
+
return $buf;
|
1315 |
+
}
|
1316 |
|
1317 |
+
//good candidate for pro dir
|
1318 |
+
|
1319 |
+
/**
|
1320 |
+
* @return array
|
1321 |
+
*/
|
1322 |
function get_page_snippet_info() {
|
1323 |
+
static $info = array();
|
1324 |
+
if ( ! empty( $info ) ) {
|
1325 |
return $info;
|
1326 |
+
}
|
1327 |
global $post, $aioseop_options, $wp_query;
|
1328 |
$title = $url = $description = $term = $category = '';
|
1329 |
+
$p = $post;
|
1330 |
+
$w = $wp_query;
|
1331 |
+
if ( ! is_object( $post ) ) {
|
1332 |
+
$post = $this->get_queried_object();
|
1333 |
+
}
|
1334 |
+
if ( empty( $this->meta_opts ) ) {
|
1335 |
+
$this->meta_opts = $this->get_current_options( array(), 'aiosp' );
|
1336 |
+
}
|
1337 |
+
if ( ! is_object( $post ) && is_admin() && ! empty( $_GET ) && ! empty( $_GET['post_type'] ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) ) {
|
1338 |
$term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
|
1339 |
}
|
1340 |
if ( is_object( $post ) ) {
|
1341 |
+
$opts = $this->meta_opts;
|
1342 |
$post_id = $p->ID;
|
1343 |
+
if ( empty( $post->post_modified_gmt ) ) {
|
1344 |
$wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
|
1345 |
+
}
|
1346 |
+
if ( 'page' === $post->post_type ) {
|
1347 |
$wp_query->is_page = true;
|
1348 |
+
} elseif ( 'attachment' === $post->post_type ) {
|
1349 |
$wp_query->is_attachment = true;
|
1350 |
+
} else {
|
1351 |
$wp_query->is_single = true;
|
1352 |
+
}
|
1353 |
+
if ( empty( $this->is_front_page ) ) {
|
1354 |
+
$this->is_front_page = false;
|
1355 |
+
}
|
1356 |
+
if ( 'page' === get_option( 'show_on_front' ) ) {
|
1357 |
+
if ( is_page() && $post->ID == get_option( 'page_on_front' ) ) {
|
1358 |
$this->is_front_page = true;
|
1359 |
+
} elseif ( $post->ID == get_option( 'page_for_posts' ) ) {
|
1360 |
$wp_query->is_home = true;
|
1361 |
+
}
|
1362 |
}
|
1363 |
$wp_query->queried_object = $post;
|
1364 |
+
if ( ! empty( $post ) && ! $wp_query->is_home && ! $this->is_front_page ) {
|
1365 |
+
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1366 |
+
if ( empty( $title ) ) {
|
1367 |
+
$title = $post->post_title;
|
1368 |
+
}
|
1369 |
}
|
1370 |
$title_format = '';
|
1371 |
if ( empty( $title ) ) {
|
1373 |
}
|
1374 |
$description = $this->get_main_description( $post );
|
1375 |
if ( empty( $title_format ) ) {
|
1376 |
+
if ( is_page() ) {
|
1377 |
$title_format = $aioseop_options['aiosp_page_title_format'];
|
1378 |
+
} elseif ( is_single() || is_attachment() ) {
|
1379 |
$title_format = $this->get_post_title_format( 'post', $post );
|
1380 |
+
}
|
1381 |
}
|
1382 |
if ( empty( $title_format ) ) {
|
1383 |
$title_format = '%post_title%';
|
1384 |
}
|
1385 |
$categories = $this->get_all_categories( $post_id );
|
1386 |
+
$category = '';
|
1387 |
+
if ( count( $categories ) > 0 ) {
|
1388 |
$category = $categories[0];
|
1389 |
+
}
|
1390 |
} else if ( is_object( $term ) ) {
|
1391 |
+
if ( 'category' === $_GET['taxonomy'] ) {
|
1392 |
+
query_posts( array( 'cat' => $_GET['tag_ID'] ) );
|
1393 |
+
} else if ( 'post_tag' === $_GET['taxonomy'] ) {
|
1394 |
+
query_posts( array( 'tag' => $term->slug ) );
|
1395 |
} else {
|
1396 |
+
query_posts( array(
|
1397 |
+
'page' => '',
|
1398 |
+
$_GET['taxonomy'] => $term->slug,
|
1399 |
+
'post_type' => $_GET['post_type'],
|
1400 |
+
) );
|
1401 |
}
|
1402 |
+
if ( empty( $this->meta_opts ) ) {
|
1403 |
+
$this->meta_opts = $this->get_current_options( array(), 'aiosp' );
|
1404 |
+
}
|
1405 |
+
$title = $this->get_tax_name( $_GET['taxonomy'] );
|
1406 |
$title_format = $this->get_tax_title_format();
|
1407 |
+
$opts = $this->meta_opts;
|
1408 |
+
if ( ! empty( $opts ) ) {
|
1409 |
+
$description = $opts['aiosp_description'];
|
1410 |
+
}
|
1411 |
+
if ( empty( $description ) ) {
|
1412 |
+
$description = term_description();
|
1413 |
+
}
|
1414 |
$description = $this->internationalize( $description );
|
1415 |
}
|
1416 |
|
1417 |
$show_page = true;
|
1418 |
+
if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
|
1419 |
+
$show_page = false;
|
1420 |
+
}
|
1421 |
if ( $aioseop_options['aiosp_can'] ) {
|
1422 |
+
if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) {
|
1423 |
+
$url = $opts['aiosp_custom_link'];
|
1424 |
+
}
|
1425 |
+
if ( empty( $url ) ) {
|
1426 |
$url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
|
1427 |
+
}
|
1428 |
$url = apply_filters( 'aioseop_canonical_url', $url );
|
1429 |
}
|
1430 |
+
if ( ! $url ) {
|
1431 |
+
$url = get_permalink();
|
1432 |
+
}
|
1433 |
|
1434 |
+
$title = $this->apply_cf_fields( $title );
|
1435 |
$description = $this->apply_cf_fields( $description );
|
1436 |
$description = apply_filters( 'aioseop_description', $description );
|
1437 |
|
1439 |
$keywords = $this->apply_cf_fields( $keywords );
|
1440 |
$keywords = apply_filters( 'aioseop_keywords', $keywords );
|
1441 |
|
1442 |
+
$info = array(
|
1443 |
+
'title' => $title,
|
1444 |
+
'description' => $description,
|
1445 |
+
'keywords' => $keywords,
|
1446 |
+
'url' => $url,
|
1447 |
+
'title_format' => $title_format,
|
1448 |
+
'category' => $category,
|
1449 |
+
'w' => $wp_query,
|
1450 |
+
'p' => $post,
|
1451 |
+
);
|
1452 |
wp_reset_postdata();
|
1453 |
+
$wp_query = $w;
|
1454 |
+
$post = $p;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1455 |
|
1456 |
+
return $info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1457 |
}
|
1458 |
|
1459 |
/**
|
1460 |
+
* @return null|object|WP_Post
|
1461 |
*/
|
1462 |
+
function get_queried_object() {
|
1463 |
+
static $p = null;
|
1464 |
+
global $wp_query, $post;
|
1465 |
+
if ( null !== $p ) {
|
1466 |
+
return $p;
|
1467 |
}
|
1468 |
+
if ( is_object( $post ) ) {
|
1469 |
+
$p = $post;
|
1470 |
+
} else {
|
1471 |
+
if ( ! $wp_query ) {
|
1472 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1473 |
}
|
1474 |
+
$p = $wp_query->get_queried_object();
|
1475 |
}
|
|
|
1476 |
|
1477 |
+
return $p;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1478 |
}
|
1479 |
|
1480 |
+
/**
|
1481 |
+
* @param array $opts
|
1482 |
+
* @param null $location
|
1483 |
+
* @param null $defaults
|
1484 |
+
* @param null $post
|
1485 |
+
*
|
1486 |
+
* @return array
|
1487 |
+
*/
|
1488 |
+
function get_current_options( $opts = array(), $location = null, $defaults = null, $post = null ) {
|
1489 |
+
if ( ( 'aiosp' === $location) && ( 'metabox' == $this->locations[ $location ]['type'] ) ) {
|
1490 |
+
if ( null === $post ) {
|
1491 |
global $post;
|
1492 |
}
|
1493 |
$post_id = $post;
|
1494 |
+
if ( is_object( $post_id ) ) {
|
1495 |
$post_id = $post_id->ID;
|
1496 |
+
}
|
1497 |
$get_opts = $this->default_options( $location );
|
1498 |
+
$optlist = array(
|
1499 |
+
'keywords',
|
1500 |
+
'description',
|
1501 |
+
'title',
|
1502 |
+
'custom_link',
|
1503 |
+
'sitemap_exclude',
|
1504 |
+
'disable',
|
1505 |
+
'disable_analytics',
|
1506 |
+
'noindex',
|
1507 |
+
'nofollow',
|
1508 |
+
'noodp',
|
1509 |
+
'noydir',
|
1510 |
+
'titleatr',
|
1511 |
+
'menulabel',
|
1512 |
+
);
|
1513 |
+
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
1514 |
+
unset( $optlist['custom_link'] );
|
1515 |
}
|
1516 |
foreach ( $optlist as $f ) {
|
1517 |
+
$meta = '';
|
1518 |
$field = "aiosp_$f";
|
1519 |
|
1520 |
if ( AIOSEOPPRO ) {
|
1523 |
$meta = get_term_meta( $_GET['tag_ID'], '_aioseop_' . $f, true );
|
1524 |
} else {
|
1525 |
$queried_object = get_queried_object();
|
1526 |
+
if ( ! empty( $queried_object ) && ! empty( $queried_object->term_id ) ) {
|
1527 |
$meta = get_term_meta( $queried_object->term_id, '_aioseop_' . $f, true );
|
1528 |
}
|
1529 |
}
|
1530 |
+
} else {
|
1531 |
$meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
|
1532 |
+
}
|
1533 |
if ( 'title' === $f || 'description' === $f ) {
|
1534 |
+
$get_opts[ $field ] = htmlspecialchars( $meta );
|
1535 |
} else {
|
1536 |
+
$get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
|
1537 |
}
|
1538 |
} else {
|
1539 |
$field = "aiosp_$f";
|
1540 |
+
$meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
|
1541 |
if ( 'title' === $f || 'description' === $f ) {
|
1542 |
+
$get_opts[ $field ] = htmlspecialchars( $meta );
|
1543 |
} else {
|
1544 |
+
$get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
|
1545 |
}
|
1546 |
}
|
1547 |
|
1548 |
}
|
1549 |
$opts = wp_parse_args( $opts, $get_opts );
|
1550 |
+
|
1551 |
return $opts;
|
1552 |
} else {
|
1553 |
$options = parent::get_current_options( $opts, $location, $defaults );
|
1554 |
+
|
1555 |
return $options;
|
1556 |
}
|
1557 |
}
|
1558 |
|
1559 |
+
/**
|
1560 |
+
* @param $in
|
1561 |
+
*
|
1562 |
+
* @return mixed|void
|
1563 |
+
*/
|
1564 |
+
function internationalize( $in ) {
|
1565 |
+
if ( function_exists( 'langswitch_filter_langs_with_message' ) ) {
|
1566 |
+
$in = langswitch_filter_langs_with_message( $in );
|
1567 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1568 |
|
1569 |
+
if ( function_exists( 'polyglot_filter' ) ) {
|
1570 |
+
$in = polyglot_filter( $in );
|
1571 |
+
}
|
|
|
1572 |
|
1573 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
1574 |
+
$in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
|
1575 |
+
} elseif ( function_exists( 'ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
1576 |
+
$in = ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
|
1577 |
+
} elseif ( function_exists( 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
1578 |
+
$in = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage( $in );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1579 |
}
|
1580 |
+
|
1581 |
+
return apply_filters( 'localization', $in );
|
1582 |
}
|
1583 |
|
1584 |
+
/*** Used to filter wp_title(), get our title. ***/
|
1585 |
+
function wp_title() {
|
1586 |
+
global $aioseop_options;
|
1587 |
+
$title = false;
|
1588 |
+
$post = $this->get_queried_object();
|
1589 |
+
if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
|
1590 |
+
$title = $this->get_aioseop_title( $post );
|
1591 |
+
$title = $this->apply_cf_fields( $title );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1592 |
}
|
|
|
|
|
1593 |
|
1594 |
+
if ( false === $title ) {
|
1595 |
+
$title = $this->get_original_title();
|
1596 |
+
}
|
1597 |
|
1598 |
+
// 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?
|
1599 |
+
// The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums
|
1600 |
+
// if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
|
1601 |
+
// $title = $this->capitalize( $title );
|
1602 |
+
|
1603 |
+
return apply_filters( 'aioseop_title', $title );
|
1604 |
+
}
|
1605 |
+
|
1606 |
+
/**
|
1607 |
+
* Gets the title that will be used by AIOSEOP for title rewrites or returns false.
|
1608 |
+
*
|
1609 |
+
* @param $post
|
1610 |
+
*
|
1611 |
+
* @return bool|string
|
1612 |
+
*/
|
1613 |
+
function get_aioseop_title( $post ) {
|
1614 |
+
global $aioseop_options;
|
1615 |
+
// the_search_query() is not suitable, it cannot just return.
|
1616 |
+
global $s, $STagging;
|
1617 |
+
$opts = $this->meta_opts;
|
1618 |
+
if ( is_front_page() ) {
|
1619 |
+
if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
1620 |
+
global $post;
|
1621 |
+
if ( get_option( 'show_on_front' ) == 'page' && is_page() && $post->ID == get_option( 'page_on_front' ) ) {
|
1622 |
+
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1623 |
+
if ( ! $title ) {
|
1624 |
+
$title = $this->internationalize( $post->post_title );
|
1625 |
+
}
|
1626 |
+
if ( ! $title ) {
|
1627 |
+
$title = $this->internationalize( $this->get_original_title( '', false ) );
|
1628 |
+
}
|
1629 |
+
if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
|
1630 |
+
$title = $this->apply_page_title_format( $title, $post, $aioseop_options['aiosp_home_page_title_format'] );
|
1631 |
+
}
|
1632 |
+
$title = $this->paged_title( $title );
|
1633 |
+
$title = apply_filters( 'aioseop_home_page_title', $title );
|
1634 |
+
}
|
1635 |
+
} else {
|
1636 |
+
$title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
|
1637 |
+
if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
|
1638 |
+
$title = $this->apply_page_title_format( $title, null, $aioseop_options['aiosp_home_page_title_format'] );
|
1639 |
+
}
|
1640 |
+
}
|
1641 |
+
if ( empty( $title ) ) {
|
1642 |
+
$title = $this->internationalize( get_option( 'blogname' ) ) . ' | ' . $this->internationalize( get_bloginfo( 'description' ) );
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
global $post;
|
1646 |
+
$post_id = $post->ID;
|
1647 |
+
|
1648 |
+
if ( is_post_type_archive() && is_post_type_archive( 'product' ) && $post_id = woocommerce_get_page_id( 'shop' ) && $post = get_post( $post_id ) ) {
|
1649 |
+
$frontpage_id = get_option( 'page_on_front' );
|
1650 |
+
|
1651 |
+
if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
1652 |
+
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1653 |
+
}
|
1654 |
+
// $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
|
1655 |
+
if ( ! $title ) {
|
1656 |
+
$title = $this->internationalize( get_post_meta( $frontpage_id, '_aioseop_title', true ) );
|
1657 |
+
} // This is/was causing the first product to come through.
|
1658 |
+
if ( ! $title ) {
|
1659 |
+
$title = $this->internationalize( $post->post_title );
|
1660 |
+
}
|
1661 |
+
if ( ! $title ) {
|
1662 |
+
$title = $this->internationalize( $this->get_original_title( '', false ) );
|
1663 |
+
}
|
1664 |
+
|
1665 |
+
$title = $this->apply_page_title_format( $title, $post );
|
1666 |
+
$title = $this->paged_title( $title );
|
1667 |
+
$title = apply_filters( 'aioseop_title_page', $title );
|
1668 |
+
|
1669 |
+
return $title;
|
1670 |
+
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
return $this->paged_title( $title ); //this is returned for woo
|
1674 |
+
} else if ( is_attachment() ) {
|
1675 |
+
if ( null === $post ) {
|
1676 |
+
return false;
|
1677 |
+
}
|
1678 |
+
$title = get_post_meta( $post->ID, '_aioseop_title', true );
|
1679 |
+
if ( empty( $title ) ) {
|
1680 |
+
$title = $post->post_title;
|
1681 |
+
}
|
1682 |
+
if ( empty( $title ) ) {
|
1683 |
+
$title = $this->get_original_title( '', false );
|
1684 |
+
}
|
1685 |
+
if ( empty( $title ) ) {
|
1686 |
+
$title = get_the_title( $post->post_parent );
|
1687 |
+
}
|
1688 |
+
$title = apply_filters( 'aioseop_attachment_title', $this->internationalize( $this->apply_post_title_format( $title, '', $post ) ) );
|
1689 |
+
|
1690 |
+
return $title;
|
1691 |
+
} else if ( is_page() || $this->is_static_posts_page() || ( is_home() && ! $this->is_static_posts_page() ) ) {
|
1692 |
+
if ( null === $post ) {
|
1693 |
+
return false;
|
1694 |
+
}
|
1695 |
+
if ( $this->is_static_front_page() && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) {
|
1696 |
+
if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
|
1697 |
+
$home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] );
|
1698 |
+
}
|
1699 |
+
|
1700 |
+
// Home title filter.
|
1701 |
+
return apply_filters( 'aioseop_home_page_title', $home_title );
|
1702 |
+
} else {
|
1703 |
+
$page_for_posts = '';
|
1704 |
+
if ( is_home() ) {
|
1705 |
+
$page_for_posts = get_option( 'page_for_posts' );
|
1706 |
+
}
|
1707 |
+
if ( $page_for_posts ) {
|
1708 |
+
$title = $this->internationalize( get_post_meta( $page_for_posts, '_aioseop_title', true ) );
|
1709 |
+
if ( ! $title ) {
|
1710 |
+
$post_page = get_post( $page_for_posts );
|
1711 |
+
$title = $this->internationalize( $post_page->post_title );
|
1712 |
+
}
|
1713 |
+
} else {
|
1714 |
+
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1715 |
+
if ( ! $title ) {
|
1716 |
+
$title = $this->internationalize( $post->post_title );
|
1717 |
+
}
|
1718 |
+
}
|
1719 |
+
if ( ! $title ) {
|
1720 |
+
$title = $this->internationalize( $this->get_original_title( '', false ) );
|
1721 |
+
}
|
1722 |
+
|
1723 |
+
$title = $this->apply_page_title_format( $title, $post );
|
1724 |
+
$title = $this->paged_title( $title );
|
1725 |
+
$title = apply_filters( 'aioseop_title_page', $title );
|
1726 |
+
if ( $this->is_static_posts_page() ) {
|
1727 |
+
$title = apply_filters( 'single_post_title', $title );
|
1728 |
+
}
|
1729 |
+
|
1730 |
+
return $title;
|
1731 |
+
}
|
1732 |
+
} 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 ) ) ) {
|
1733 |
+
// Too far down? -mrt.
|
1734 |
+
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1735 |
+
if ( ! $title ) {
|
1736 |
+
$title = $this->internationalize( $post->post_title );
|
1737 |
+
}
|
1738 |
+
if ( ! $title ) {
|
1739 |
+
$title = $this->internationalize( $this->get_original_title( '', false ) );
|
1740 |
+
}
|
1741 |
+
$title = $this->apply_page_title_format( $title, $post );
|
1742 |
+
$title = $this->paged_title( $title );
|
1743 |
+
$title = apply_filters( 'aioseop_title_page', $title );
|
1744 |
+
|
1745 |
+
return $title;
|
1746 |
+
} else if ( is_single() ) {
|
1747 |
+
// We're not in the loop :(.
|
1748 |
+
if ( null === $post ) {
|
1749 |
+
return false;
|
1750 |
+
}
|
1751 |
+
$categories = $this->get_all_categories();
|
1752 |
+
$category = '';
|
1753 |
+
if ( count( $categories ) > 0 ) {
|
1754 |
+
$category = $categories[0];
|
1755 |
+
}
|
1756 |
+
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1757 |
+
if ( ! $title ) {
|
1758 |
+
$title = $this->internationalize( get_post_meta( $post->ID, 'title_tag', true ) );
|
1759 |
+
if ( ! $title ) {
|
1760 |
+
$title = $this->internationalize( $this->get_original_title( '', false ) );
|
1761 |
+
}
|
1762 |
+
}
|
1763 |
+
if ( empty( $title ) ) {
|
1764 |
+
$title = $post->post_title;
|
1765 |
+
}
|
1766 |
+
if ( ! empty( $title ) ) {
|
1767 |
+
$title = $this->apply_post_title_format( $title, $category, $post );
|
1768 |
+
}
|
1769 |
+
$title = $this->paged_title( $title );
|
1770 |
+
|
1771 |
+
return apply_filters( 'aioseop_title_single', $title );
|
1772 |
+
} else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
|
1773 |
+
$search = esc_attr( stripslashes( $s ) );
|
1774 |
+
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1775 |
+
$search = $this->capitalize( $search );
|
1776 |
+
}
|
1777 |
+
$title_format = $aioseop_options['aiosp_search_title_format'];
|
1778 |
+
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1779 |
+
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
1780 |
+
$title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
|
1781 |
+
}
|
1782 |
+
if ( strpos( $title, '%search%' ) !== false ) {
|
1783 |
+
$title = str_replace( '%search%', $search, $title );
|
1784 |
+
}
|
1785 |
+
$title = $this->paged_title( $title );
|
1786 |
+
|
1787 |
+
return $title;
|
1788 |
+
} else if ( is_tag() ) {
|
1789 |
+
global $utw;
|
1790 |
+
$tag = $tag_description = '';
|
1791 |
+
if ( $utw ) {
|
1792 |
+
$tags = $utw->GetCurrentTagSet();
|
1793 |
+
$tag = $tags[0]->tag;
|
1794 |
+
$tag = str_replace( '-', ' ', $tag );
|
1795 |
+
} else {
|
1796 |
+
if ( AIOSEOPPRO ) {
|
1797 |
+
if ( ! empty( $opts ) && ! empty( $opts['aiosp_title'] ) ) {
|
1798 |
+
$tag = $opts['aiosp_title'];
|
1799 |
+
}
|
1800 |
+
if ( ! empty( $opts ) ) {
|
1801 |
+
if ( ! empty( $opts['aiosp_title'] ) ) {
|
1802 |
+
$tag = $opts['aiosp_title'];
|
1803 |
+
}
|
1804 |
+
if ( ! empty( $opts['aiosp_description'] ) ) {
|
1805 |
+
$tag_description = $opts['aiosp_description'];
|
1806 |
+
}
|
1807 |
+
}
|
1808 |
+
}
|
1809 |
+
if ( empty( $tag ) ) {
|
1810 |
+
$tag = $this->get_original_title( '', false );
|
1811 |
+
}
|
1812 |
+
if ( empty( $tag_description ) ) {
|
1813 |
+
$tag_description = tag_description();
|
1814 |
+
}
|
1815 |
+
$tag = $this->internationalize( $tag );
|
1816 |
+
$tag_description = $this->internationalize( $tag_description );
|
1817 |
+
}
|
1818 |
+
if ( $tag ) {
|
1819 |
+
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1820 |
+
$tag = $this->capitalize( $tag );
|
1821 |
+
}
|
1822 |
+
$title_format = $aioseop_options['aiosp_tag_title_format'];
|
1823 |
+
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1824 |
+
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
1825 |
+
$title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
|
1826 |
+
}
|
1827 |
+
if ( strpos( $title, '%tag%' ) !== false ) {
|
1828 |
+
$title = str_replace( '%tag%', $tag, $title );
|
1829 |
+
}
|
1830 |
+
if ( strpos( $title, '%tag_description%' ) !== false ) {
|
1831 |
+
$title = str_replace( '%tag_description%', $tag_description, $title );
|
1832 |
+
}
|
1833 |
+
if ( strpos( $title, '%taxonomy_description%' ) !== false ) {
|
1834 |
+
$title = str_replace( '%taxonomy_description%', $tag_description, $title );
|
1835 |
+
}
|
1836 |
+
$title = trim( wp_strip_all_tags( $title ) );
|
1837 |
+
$title = str_replace( array( '"', "\r\n", "\n" ), array( '"', ' ', ' ' ), $title );
|
1838 |
+
$title = $this->paged_title( $title );
|
1839 |
+
|
1840 |
+
return $title;
|
1841 |
+
}
|
1842 |
+
} else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
|
1843 |
+
return $this->get_tax_title();
|
1844 |
+
} else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // Simple tagging support.
|
1845 |
+
$tag = $STagging->search_tag;
|
1846 |
+
if ( $tag ) {
|
1847 |
+
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1848 |
+
$tag = $this->capitalize( $tag );
|
1849 |
+
}
|
1850 |
+
$title_format = $aioseop_options['aiosp_tag_title_format'];
|
1851 |
+
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1852 |
+
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
1853 |
+
$title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
|
1854 |
+
}
|
1855 |
+
if ( strpos( $title, '%tag%' ) !== false ) {
|
1856 |
+
$title = str_replace( '%tag%', $tag, $title );
|
1857 |
+
}
|
1858 |
+
$title = $this->paged_title( $title );
|
1859 |
+
|
1860 |
+
return $title;
|
1861 |
+
}
|
1862 |
+
} else if ( is_archive() || is_post_type_archive() ) {
|
1863 |
+
if ( is_author() ) {
|
1864 |
+
$author = $this->internationalize( $this->get_original_title( '', false ) );
|
1865 |
+
$title_format = $aioseop_options['aiosp_author_title_format'];
|
1866 |
+
$new_title = str_replace( '%author%', $author, $title_format );
|
1867 |
+
} else if ( is_date() ) {
|
1868 |
+
global $wp_query;
|
1869 |
+
$date = $this->internationalize( $this->get_original_title( '', false ) );
|
1870 |
+
$title_format = $aioseop_options['aiosp_date_title_format'];
|
1871 |
+
$new_title = str_replace( '%date%', $date, $title_format );
|
1872 |
+
$day = get_query_var( 'day' );
|
1873 |
+
if ( empty( $day ) ) {
|
1874 |
+
$day = '';
|
1875 |
+
}
|
1876 |
+
$new_title = str_replace( '%day%', $day, $new_title );
|
1877 |
+
$monthnum = get_query_var( 'monthnum' );
|
1878 |
+
$year = get_query_var( 'year' );
|
1879 |
+
if ( empty( $monthnum ) || is_year() ) {
|
1880 |
+
$month = '';
|
1881 |
+
$monthnum = 0;
|
1882 |
+
}
|
1883 |
+
$month = date( 'F', mktime( 0, 0, 0, (int) $monthnum, 1, (int) $year ) );
|
1884 |
+
$new_title = str_replace( '%monthnum%', $monthnum, $new_title );
|
1885 |
+
if ( strpos( $new_title, '%month%' ) !== false ) {
|
1886 |
+
$new_title = str_replace( '%month%', $month, $new_title );
|
1887 |
+
}
|
1888 |
+
if ( strpos( $new_title, '%year%' ) !== false ) {
|
1889 |
+
$new_title = str_replace( '%year%', get_query_var( 'year' ), $new_title );
|
1890 |
+
}
|
1891 |
+
} else if ( is_post_type_archive() ) {
|
1892 |
+
if ( empty( $title ) ) {
|
1893 |
+
$title = $this->get_original_title( '', false );
|
1894 |
+
}
|
1895 |
+
$new_title = apply_filters( 'aioseop_archive_title', $this->apply_archive_title_format( $title ) );
|
1896 |
+
} else {
|
1897 |
+
return false;
|
1898 |
+
}
|
1899 |
+
$new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $new_title );
|
1900 |
+
if ( strpos( $new_title, '%blog_description%' ) !== false ) {
|
1901 |
+
$new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
|
1902 |
+
}
|
1903 |
+
$title = trim( $new_title );
|
1904 |
+
$title = $this->paged_title( $title );
|
1905 |
+
|
1906 |
+
return $title;
|
1907 |
+
} else if ( is_404() ) {
|
1908 |
+
$title_format = $aioseop_options['aiosp_404_title_format'];
|
1909 |
+
$new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1910 |
+
if ( strpos( $new_title, '%blog_description%' ) !== false ) {
|
1911 |
+
$new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
|
1912 |
+
}
|
1913 |
+
if ( strpos( $new_title, '%request_url%' ) !== false ) {
|
1914 |
+
$new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title );
|
1915 |
+
}
|
1916 |
+
if ( strpos( $new_title, '%request_words%' ) !== false ) {
|
1917 |
+
$new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title );
|
1918 |
+
}
|
1919 |
+
if ( strpos( $new_title, '%404_title%' ) !== false ) {
|
1920 |
+
$new_title = str_replace( '%404_title%', $this->internationalize( $this->get_original_title( '', false ) ), $new_title );
|
1921 |
+
}
|
1922 |
+
|
1923 |
+
return $new_title;
|
1924 |
+
}
|
1925 |
+
|
1926 |
+
return false;
|
1927 |
+
}
|
1928 |
+
|
1929 |
+
/**
|
1930 |
+
* @param string $sep
|
1931 |
+
* @param bool $echo
|
1932 |
+
* @param string $seplocation
|
1933 |
+
*
|
1934 |
+
* @return The original title as delivered by WP (well, in most cases).
|
1935 |
+
*/
|
1936 |
+
function get_original_title( $sep = '|', $echo = false, $seplocation = '' ) {
|
1937 |
+
global $aioseop_options;
|
1938 |
+
if ( ! empty( $aioseop_options['aiosp_use_original_title'] ) ) {
|
1939 |
+
$has_filter = has_filter( 'wp_title', array( $this, 'wp_title' ) );
|
1940 |
+
if ( false !== $has_filter ) {
|
1941 |
+
remove_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter );
|
1942 |
+
}
|
1943 |
+
if ( current_theme_supports( 'title-tag' ) ) {
|
1944 |
+
$sep = '|';
|
1945 |
+
$echo = false;
|
1946 |
+
$seplocation = 'right';
|
1947 |
+
}
|
1948 |
+
$title = wp_title( $sep, $echo, $seplocation );
|
1949 |
+
if ( false !== $has_filter ) {
|
1950 |
+
add_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter );
|
1951 |
+
}
|
1952 |
+
if ( $title && ( $title = trim( $title ) ) ) {
|
1953 |
+
return trim( $title );
|
1954 |
+
}
|
1955 |
+
}
|
1956 |
+
|
1957 |
+
// the_search_query() is not suitable, it cannot just return.
|
1958 |
+
global $s;
|
1959 |
+
|
1960 |
+
$title = null;
|
1961 |
+
|
1962 |
+
if ( is_home() ) {
|
1963 |
+
$title = get_option( 'blogname' );
|
1964 |
+
} else if ( is_single() ) {
|
1965 |
+
$title = $this->internationalize( single_post_title( '', false ) );
|
1966 |
+
} else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
|
1967 |
+
$search = esc_attr( stripslashes( $s ) );
|
1968 |
+
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1969 |
+
$search = $this->capitalize( $search );
|
1970 |
+
}
|
1971 |
+
$title = $search;
|
1972 |
+
} else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
|
1973 |
+
$category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) );
|
1974 |
+
$title = $category_name;
|
1975 |
+
} else if ( is_page() ) {
|
1976 |
+
$title = $this->internationalize( single_post_title( '', false ) );
|
1977 |
+
} else if ( is_tag() ) {
|
1978 |
+
global $utw;
|
1979 |
+
if ( $utw ) {
|
1980 |
+
$tags = $utw->GetCurrentTagSet();
|
1981 |
+
$tag = $tags[0]->tag;
|
1982 |
+
$tag = str_replace( '-', ' ', $tag );
|
1983 |
+
} else {
|
1984 |
+
// For WordPress > 2.3.
|
1985 |
+
$tag = $this->internationalize( single_term_title( '', false ) );
|
1986 |
+
}
|
1987 |
+
if ( $tag ) {
|
1988 |
+
$title = $tag;
|
1989 |
+
}
|
1990 |
+
} else if ( is_author() ) {
|
1991 |
+
$author = get_userdata( get_query_var( 'author' ) );
|
1992 |
+
if ( $author === false ) {
|
1993 |
+
global $wp_query;
|
1994 |
+
$author = $wp_query->get_queried_object();
|
1995 |
+
}
|
1996 |
+
if ( $author !== false ) {
|
1997 |
+
$title = $author->display_name;
|
1998 |
+
}
|
1999 |
+
} else if ( is_day() ) {
|
2000 |
+
$title = get_the_date();
|
2001 |
+
} else if ( is_month() ) {
|
2002 |
+
$title = get_the_date( 'F, Y' );
|
2003 |
+
} else if ( is_year() ) {
|
2004 |
+
$title = get_the_date( 'Y' );
|
2005 |
+
} else if ( is_archive() ) {
|
2006 |
+
$title = $this->internationalize( post_type_archive_title( '', false ) );
|
2007 |
+
} else if ( is_404() ) {
|
2008 |
+
$title_format = $aioseop_options['aiosp_404_title_format'];
|
2009 |
+
$new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
2010 |
+
if ( strpos( $new_title, '%blog_description%' ) !== false ) {
|
2011 |
+
$new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
|
2012 |
+
}
|
2013 |
+
if ( strpos( $new_title, '%request_url%' ) !== false ) {
|
2014 |
+
$new_title = str_replace( '%request_url%', $_SERVER['REQUEST_URI'], $new_title );
|
2015 |
+
}
|
2016 |
+
if ( strpos( $new_title, '%request_words%' ) !== false ) {
|
2017 |
+
$new_title = str_replace( '%request_words%', $this->request_as_words( $_SERVER['REQUEST_URI'] ), $new_title );
|
2018 |
+
}
|
2019 |
+
$title = $new_title;
|
2020 |
+
}
|
2021 |
+
|
2022 |
+
return trim( $title );
|
2023 |
+
}
|
2024 |
+
|
2025 |
+
/**
|
2026 |
+
* @param $s
|
2027 |
+
*
|
2028 |
+
* @return string
|
2029 |
+
*/
|
2030 |
+
function capitalize( $s ) {
|
2031 |
+
$s = trim( $s );
|
2032 |
+
$tokens = explode( ' ', $s );
|
2033 |
+
while ( list( $key, $val ) = each( $tokens ) ) {
|
2034 |
+
$tokens[ $key ] = trim( $tokens[ $key ] );
|
2035 |
+
$tokens[ $key ] = $this->strtoupper( $this->substr( $tokens[ $key ], 0, 1 ) ) . $this->substr( $tokens[ $key ], 1 );
|
2036 |
+
}
|
2037 |
+
$s = implode( ' ', $tokens );
|
2038 |
+
|
2039 |
+
return $s;
|
2040 |
+
}
|
2041 |
+
|
2042 |
+
/**
|
2043 |
+
* @param $request
|
2044 |
+
*
|
2045 |
+
* @return User -readable nice words for a given request.
|
2046 |
+
*/
|
2047 |
+
function request_as_words( $request ) {
|
2048 |
+
$request = htmlspecialchars( $request );
|
2049 |
+
$request = str_replace( '.html', ' ', $request );
|
2050 |
+
$request = str_replace( '.htm', ' ', $request );
|
2051 |
+
$request = str_replace( '.', ' ', $request );
|
2052 |
+
$request = str_replace( '/', ' ', $request );
|
2053 |
+
$request = str_replace( '-', ' ', $request );
|
2054 |
+
$request_a = explode( ' ', $request );
|
2055 |
+
$request_new = array();
|
2056 |
+
foreach ( $request_a as $token ) {
|
2057 |
+
$request_new[] = $this->ucwords( trim( $token ) );
|
2058 |
+
}
|
2059 |
+
$request = implode( ' ', $request_new );
|
2060 |
+
|
2061 |
+
return $request;
|
2062 |
+
}
|
2063 |
+
|
2064 |
+
/**
|
2065 |
+
* @param $title
|
2066 |
+
* @param null $p
|
2067 |
+
* @param string $title_format
|
2068 |
+
*
|
2069 |
+
* @return string
|
2070 |
+
*/
|
2071 |
+
function apply_page_title_format( $title, $p = null, $title_format = '' ) {
|
2072 |
+
global $aioseop_options;
|
2073 |
+
if ( $p === null ) {
|
2074 |
+
global $post;
|
2075 |
+
} else {
|
2076 |
+
$post = $p;
|
2077 |
+
}
|
2078 |
+
if ( empty( $title_format ) ) {
|
2079 |
+
$title_format = $aioseop_options['aiosp_page_title_format'];
|
2080 |
+
}
|
2081 |
+
|
2082 |
+
return $this->title_placeholder_helper( $title, $post, 'page', $title_format );
|
2083 |
+
}
|
2084 |
+
|
2085 |
+
/**
|
2086 |
+
* @param $title
|
2087 |
+
* @param $post
|
2088 |
+
* @param string $type
|
2089 |
+
* @param string $title_format
|
2090 |
+
* @param string $category
|
2091 |
+
*
|
2092 |
+
* @return string
|
2093 |
+
*/
|
2094 |
+
function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
|
2095 |
+
if ( ! empty( $post ) ) {
|
2096 |
+
$authordata = get_userdata( $post->post_author );
|
2097 |
+
} else {
|
2098 |
+
$authordata = new WP_User();
|
2099 |
+
}
|
2100 |
+
$new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
2101 |
+
if ( strpos( $new_title, '%blog_description%' ) !== false ) {
|
2102 |
+
$new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
|
2103 |
+
}
|
2104 |
+
if ( strpos( $new_title, "%{$type}_title%" ) !== false ) {
|
2105 |
+
$new_title = str_replace( "%{$type}_title%", $title, $new_title );
|
2106 |
+
}
|
2107 |
+
if ( $type == 'post' ) {
|
2108 |
+
if ( strpos( $new_title, '%category%' ) !== false ) {
|
2109 |
+
$new_title = str_replace( '%category%', $category, $new_title );
|
2110 |
+
}
|
2111 |
+
if ( strpos( $new_title, '%category_title%' ) !== false ) {
|
2112 |
+
$new_title = str_replace( '%category_title%', $category, $new_title );
|
2113 |
+
}
|
2114 |
+
if ( strpos( $new_title, '%tax_' ) && ! empty( $post ) ) {
|
2115 |
+
$taxes = get_object_taxonomies( $post, 'objects' );
|
2116 |
+
if ( ! empty( $taxes ) ) {
|
2117 |
+
foreach ( $taxes as $t ) {
|
2118 |
+
if ( strpos( $new_title, "%tax_{$t->name}%" ) ) {
|
2119 |
+
$terms = $this->get_all_terms( $post->ID, $t->name );
|
2120 |
+
$term = '';
|
2121 |
+
if ( count( $terms ) > 0 ) {
|
2122 |
+
$term = $terms[0];
|
2123 |
+
}
|
2124 |
+
$new_title = str_replace( "%tax_{$t->name}%", $term, $new_title );
|
2125 |
+
}
|
2126 |
+
}
|
2127 |
+
}
|
2128 |
+
}
|
2129 |
+
}
|
2130 |
+
if ( strpos( $new_title, "%{$type}_author_login%" ) !== false ) {
|
2131 |
+
$new_title = str_replace( "%{$type}_author_login%", $authordata->user_login, $new_title );
|
2132 |
+
}
|
2133 |
+
if ( strpos( $new_title, "%{$type}_author_nicename%" ) !== false ) {
|
2134 |
+
$new_title = str_replace( "%{$type}_author_nicename%", $authordata->user_nicename, $new_title );
|
2135 |
+
}
|
2136 |
+
if ( strpos( $new_title, "%{$type}_author_firstname%" ) !== false ) {
|
2137 |
+
$new_title = str_replace( "%{$type}_author_firstname%", $this->ucwords( $authordata->first_name ), $new_title );
|
2138 |
+
}
|
2139 |
+
if ( strpos( $new_title, "%{$type}_author_lastname%" ) !== false ) {
|
2140 |
+
$new_title = str_replace( "%{$type}_author_lastname%", $this->ucwords( $authordata->last_name ), $new_title );
|
2141 |
+
}
|
2142 |
+
$title = trim( $new_title );
|
2143 |
+
|
2144 |
+
return $title;
|
2145 |
+
}
|
2146 |
+
|
2147 |
+
/**
|
2148 |
+
* @param $id
|
2149 |
+
* @param $taxonomy
|
2150 |
+
*
|
2151 |
+
* @return array
|
2152 |
+
*/
|
2153 |
+
function get_all_terms( $id, $taxonomy ) {
|
2154 |
+
$keywords = array();
|
2155 |
+
$terms = get_the_terms( $id, $taxonomy );
|
2156 |
+
if ( ! empty( $terms ) ) {
|
2157 |
+
foreach ( $terms as $term ) {
|
2158 |
+
$keywords[] = $this->internationalize( $term->name );
|
2159 |
+
}
|
2160 |
+
}
|
2161 |
+
|
2162 |
+
return $keywords;
|
2163 |
+
}
|
2164 |
+
|
2165 |
+
/**
|
2166 |
+
* @param $title
|
2167 |
+
*
|
2168 |
+
* @return string
|
2169 |
+
*/
|
2170 |
+
function paged_title( $title ) {
|
2171 |
+
// The page number if paged.
|
2172 |
+
global $paged;
|
2173 |
+
global $aioseop_options;
|
2174 |
+
// Simple tagging support.
|
2175 |
+
global $STagging;
|
2176 |
+
$page = get_query_var( 'page' );
|
2177 |
+
if ( $paged > $page ) {
|
2178 |
+
$page = $paged;
|
2179 |
+
}
|
2180 |
+
if ( is_paged() || ( isset( $STagging ) && $STagging->is_tag_view() && $paged ) || ( $page > 1 ) ) {
|
2181 |
+
$part = $this->internationalize( $aioseop_options['aiosp_paged_format'] );
|
2182 |
+
if ( isset( $part ) || ! empty( $part ) ) {
|
2183 |
+
$part = ' ' . trim( $part );
|
2184 |
+
$part = str_replace( '%page%', $page, $part );
|
2185 |
+
$this->log( "paged_title() [$title] [$part]" );
|
2186 |
+
$title .= $part;
|
2187 |
+
}
|
2188 |
+
}
|
2189 |
+
|
2190 |
+
return $title;
|
2191 |
+
}
|
2192 |
+
|
2193 |
+
/**
|
2194 |
+
* @param $message
|
2195 |
+
*/
|
2196 |
+
function log( $message ) {
|
2197 |
+
if ( $this->do_log ) {
|
2198 |
+
@error_log( date( 'Y-m-d H:i:s' ) . ' ' . $message . "\n", 3, $this->log_file );
|
2199 |
+
}
|
2200 |
+
}
|
2201 |
+
|
2202 |
+
/**
|
2203 |
+
* @param $title
|
2204 |
+
* @param string $category
|
2205 |
+
* @param null $p
|
2206 |
+
*
|
2207 |
+
* @return string
|
2208 |
+
*/
|
2209 |
+
function apply_post_title_format( $title, $category = '', $p = null ) {
|
2210 |
+
if ( $p === null ) {
|
2211 |
+
global $post;
|
2212 |
+
} else {
|
2213 |
+
$post = $p;
|
2214 |
+
}
|
2215 |
+
$title_format = $this->get_post_title_format( 'post', $post );
|
2216 |
+
|
2217 |
+
return $this->title_placeholder_helper( $title, $post, 'post', $title_format, $category );
|
2218 |
+
}
|
2219 |
+
|
2220 |
+
/**
|
2221 |
+
* @param string $title_type
|
2222 |
+
* @param null $p
|
2223 |
+
*
|
2224 |
+
* @return bool|string
|
2225 |
+
*/
|
2226 |
+
function get_post_title_format( $title_type = 'post', $p = null ) {
|
2227 |
+
global $aioseop_options;
|
2228 |
+
if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) {
|
2229 |
+
return false;
|
2230 |
+
}
|
2231 |
+
$title_format = "%{$title_type}_title% | %blog_title%";
|
2232 |
+
if ( isset( $aioseop_options["aiosp_{$title_type}_title_format"] ) ) {
|
2233 |
+
$title_format = $aioseop_options["aiosp_{$title_type}_title_format"];
|
2234 |
+
}
|
2235 |
+
if ( ! empty( $aioseop_options['aiosp_enablecpost'] ) && ! empty( $aioseop_options['aiosp_cpostactive'] ) ) {
|
2236 |
+
$wp_post_types = $aioseop_options['aiosp_cpostactive'];
|
2237 |
+
if ( ! empty( $aioseop_options['aiosp_cposttitles'] ) ) {
|
2238 |
+
if ( ( ( $title_type == 'archive' ) && is_post_type_archive( $wp_post_types ) && $prefix = "aiosp_{$title_type}_" ) ||
|
2239 |
+
( ( $title_type == 'post' ) && $this->is_singular( $wp_post_types, $p ) && $prefix = 'aiosp_' )
|
2240 |
+
) {
|
2241 |
+
$post_type = get_post_type( $p );
|
2242 |
+
if ( ! empty( $aioseop_options["{$prefix}{$post_type}_title_format"] ) ) {
|
2243 |
+
$title_format = $aioseop_options["{$prefix}{$post_type}_title_format"];
|
2244 |
+
}
|
2245 |
+
}
|
2246 |
+
}
|
2247 |
+
}
|
2248 |
+
|
2249 |
+
return $title_format;
|
2250 |
+
}
|
2251 |
+
|
2252 |
+
/**
|
2253 |
+
* @param array $post_types
|
2254 |
+
* @param null $post
|
2255 |
+
*
|
2256 |
+
* @return bool
|
2257 |
+
*/
|
2258 |
+
function is_singular( $post_types = array(), $post = null ) {
|
2259 |
+
if ( ! empty( $post_types ) && is_object( $post ) ) {
|
2260 |
+
return in_array( $post->post_type, (array) $post_types );
|
2261 |
+
} else {
|
2262 |
+
return is_singular( $post_types );
|
2263 |
+
}
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
/**
|
2267 |
+
* @return bool|null
|
2268 |
+
*/
|
2269 |
+
function is_static_posts_page() {
|
2270 |
+
static $is_posts_page = null;
|
2271 |
+
if ( $is_posts_page !== null ) {
|
2272 |
+
return $is_posts_page;
|
2273 |
+
}
|
2274 |
+
$post = $this->get_queried_object();
|
2275 |
+
$is_posts_page = ( get_option( 'show_on_front' ) == 'page' && is_home() && ! empty( $post ) && $post->ID == get_option( 'page_for_posts' ) );
|
2276 |
+
|
2277 |
+
return $is_posts_page;
|
2278 |
+
}
|
2279 |
+
|
2280 |
+
/**
|
2281 |
+
* @return bool|null
|
2282 |
+
*/
|
2283 |
+
function is_static_front_page() {
|
2284 |
+
if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) {
|
2285 |
+
return $this->is_front_page;
|
2286 |
+
}
|
2287 |
+
$post = $this->get_queried_object();
|
2288 |
+
$this->is_front_page = ( get_option( 'show_on_front' ) == 'page' && is_page() && ! empty( $post ) && $post->ID == get_option( 'page_on_front' ) );
|
2289 |
+
|
2290 |
+
return $this->is_front_page;
|
2291 |
+
}
|
2292 |
+
|
2293 |
+
/**
|
2294 |
+
* @param int $id
|
2295 |
+
*
|
2296 |
+
* @return array
|
2297 |
+
*/
|
2298 |
+
function get_all_categories( $id = 0 ) {
|
2299 |
+
$keywords = array();
|
2300 |
+
$categories = get_the_category( $id );
|
2301 |
+
if ( ! empty( $categories ) ) {
|
2302 |
+
foreach ( $categories as $category ) {
|
2303 |
+
$keywords[] = $this->internationalize( $category->cat_name );
|
2304 |
+
}
|
2305 |
+
}
|
2306 |
+
|
2307 |
+
return $keywords;
|
2308 |
+
}
|
2309 |
+
|
2310 |
+
/**
|
2311 |
+
* @param string $tax
|
2312 |
+
*
|
2313 |
+
* @return string
|
2314 |
+
*/
|
2315 |
+
function get_tax_title( $tax = '' ) {
|
2316 |
+
if ( AIOSEOPPRO ) {
|
2317 |
+
if ( empty( $this->meta_opts ) ) {
|
2318 |
+
$this->meta_opts = $this->get_current_options( array(), 'aiosp' );
|
2319 |
+
}
|
2320 |
}
|
2321 |
+
if ( empty( $tax ) ) {
|
2322 |
+
if ( is_category() ) {
|
2323 |
+
$tax = 'category';
|
2324 |
+
} else {
|
2325 |
+
$tax = get_query_var( 'taxonomy' );
|
2326 |
+
}
|
2327 |
+
}
|
2328 |
+
$name = $this->get_tax_name( $tax );
|
2329 |
+
$desc = $this->get_tax_desc( $tax );
|
2330 |
+
|
2331 |
+
return $this->apply_tax_title_format( $name, $desc, $tax );
|
2332 |
}
|
2333 |
|
2334 |
+
// Handle prev / next links.
|
2335 |
+
|
2336 |
+
/**
|
2337 |
+
* @param $tax
|
2338 |
+
*
|
2339 |
+
* @return mixed|void
|
2340 |
+
*/
|
2341 |
+
function get_tax_name( $tax ) {
|
2342 |
global $aioseop_options;
|
2343 |
+
if ( AIOSEOPPRO ) {
|
2344 |
+
$opts = $this->meta_opts;
|
2345 |
+
if ( ! empty( $opts ) ) {
|
2346 |
+
$name = $opts['aiosp_title'];
|
2347 |
+
}
|
|
|
|
|
|
|
|
|
2348 |
} else {
|
2349 |
+
$name = '';
|
2350 |
+
}
|
2351 |
+
if ( empty( $name ) ) {
|
2352 |
+
$name = single_term_title( '', false );
|
2353 |
+
}
|
2354 |
+
// 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?
|
2355 |
+
// if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) )
|
2356 |
+
// $name = $this->ucwords( $name );
|
2357 |
+
|
2358 |
+
return $this->internationalize( $name );
|
2359 |
+
}
|
2360 |
+
|
2361 |
+
/**
|
2362 |
+
* @param $tax
|
2363 |
+
*
|
2364 |
+
* @return mixed|void
|
2365 |
+
*/
|
2366 |
+
function get_tax_desc( $tax ) {
|
2367 |
+
if ( AIOSEOPPRO ) {
|
2368 |
+
$opts = $this->meta_opts;
|
2369 |
+
if ( ! empty( $opts ) ) {
|
2370 |
+
$desc = $opts['aiosp_description'];
|
2371 |
+
}
|
2372 |
+
} else {
|
2373 |
+
$desc = '';
|
2374 |
+
}
|
2375 |
+
if ( empty( $desc ) ) {
|
2376 |
+
$desc = term_description( '', $tax );
|
2377 |
+
}
|
2378 |
+
|
2379 |
+
return $this->internationalize( $desc );
|
2380 |
+
}
|
2381 |
+
|
2382 |
+
/**
|
2383 |
+
* @param $category_name
|
2384 |
+
* @param $category_description
|
2385 |
+
* @param string $tax
|
2386 |
+
*
|
2387 |
+
* @return string
|
2388 |
+
*/
|
2389 |
+
function apply_tax_title_format( $category_name, $category_description, $tax = '' ) {
|
2390 |
+
if ( empty( $tax ) ) {
|
2391 |
+
$tax = get_query_var( 'taxonomy' );
|
2392 |
+
}
|
2393 |
+
$title_format = $this->get_tax_title_format( $tax );
|
2394 |
+
$title = str_replace( '%taxonomy_title%', $category_name, $title_format );
|
2395 |
+
if ( strpos( $title, '%taxonomy_description%' ) !== false ) {
|
2396 |
+
$title = str_replace( '%taxonomy_description%', $category_description, $title );
|
2397 |
+
}
|
2398 |
+
if ( strpos( $title, '%category_title%' ) !== false ) {
|
2399 |
+
$title = str_replace( '%category_title%', $category_name, $title );
|
2400 |
+
}
|
2401 |
+
if ( strpos( $title, '%category_description%' ) !== false ) {
|
2402 |
+
$title = str_replace( '%category_description%', $category_description, $title );
|
2403 |
+
}
|
2404 |
+
if ( strpos( $title, '%blog_title%' ) !== false ) {
|
2405 |
+
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title );
|
2406 |
+
}
|
2407 |
+
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
2408 |
+
$title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
|
2409 |
+
}
|
2410 |
+
$title = wp_strip_all_tags( $title );
|
2411 |
+
|
2412 |
+
return $this->paged_title( $title );
|
2413 |
+
}
|
2414 |
+
|
2415 |
+
/**
|
2416 |
+
* @param string $tax
|
2417 |
+
*
|
2418 |
+
* @return string
|
2419 |
+
*/
|
2420 |
+
function get_tax_title_format( $tax = '' ) {
|
2421 |
+
global $aioseop_options;
|
2422 |
+
if ( AIOSEOPPRO ) {
|
2423 |
+
$title_format = '%taxonomy_title% | %blog_title%';
|
2424 |
+
if ( is_category() ) {
|
2425 |
+
$title_format = $aioseop_options['aiosp_category_title_format'];
|
2426 |
+
} else {
|
2427 |
+
$taxes = $aioseop_options['aiosp_taxactive'];
|
2428 |
+
if ( empty( $tax ) ) {
|
2429 |
+
$tax = get_query_var( 'taxonomy' );
|
2430 |
+
}
|
2431 |
+
if ( ! empty( $aioseop_options["aiosp_{$tax}_tax_title_format"] ) ) {
|
2432 |
+
$title_format = $aioseop_options["aiosp_{$tax}_tax_title_format"];
|
2433 |
+
}
|
2434 |
+
}
|
2435 |
+
if ( empty( $title_format ) ) {
|
2436 |
+
$title_format = '%category_title% | %blog_title%';
|
2437 |
+
}
|
2438 |
+
} else {
|
2439 |
+
$title_format = '%category_title% | %blog_title%';
|
2440 |
+
if ( ! empty( $aioseop_options['aiosp_category_title_format'] ) ) {
|
2441 |
+
$title_format = $aioseop_options['aiosp_category_title_format'];
|
2442 |
+
}
|
2443 |
+
|
2444 |
+
return $title_format;
|
2445 |
+
}
|
2446 |
+
|
2447 |
+
return $title_format;
|
2448 |
+
}
|
2449 |
+
|
2450 |
+
/**
|
2451 |
+
* @param $title
|
2452 |
+
* @param string $category
|
2453 |
+
*
|
2454 |
+
* @return string
|
2455 |
+
*/
|
2456 |
+
function apply_archive_title_format( $title, $category = '' ) {
|
2457 |
+
$title_format = $this->get_archive_title_format();
|
2458 |
+
$r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' );
|
2459 |
+
$d_title = array(
|
2460 |
+
$this->internationalize( get_bloginfo( 'name' ) ),
|
2461 |
+
$this->internationalize( get_bloginfo( 'description' ) ),
|
2462 |
+
post_type_archive_title( '', false ),
|
2463 |
+
);
|
2464 |
+
$title = trim( str_replace( $r_title, $d_title, $title_format ) );
|
2465 |
+
|
2466 |
+
return $title;
|
2467 |
+
}
|
2468 |
+
|
2469 |
+
/**
|
2470 |
+
* @return bool|string
|
2471 |
+
*/
|
2472 |
+
function get_archive_title_format() {
|
2473 |
+
return $this->get_post_title_format( 'archive' );
|
2474 |
+
}
|
2475 |
+
|
2476 |
+
/**
|
2477 |
+
* @param null $post
|
2478 |
+
*
|
2479 |
+
* @return mixed|string|void
|
2480 |
+
*/
|
2481 |
+
function get_main_description( $post = null ) {
|
2482 |
+
global $aioseop_options;
|
2483 |
+
$opts = $this->meta_opts;
|
2484 |
+
$description = '';
|
2485 |
+
if ( is_author() && $this->show_page_description() ) {
|
2486 |
+
$description = $this->internationalize( get_the_author_meta( 'description' ) );
|
2487 |
+
} 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 ) ) ) {
|
2488 |
+
// $description = $this->get_post_description( $post );
|
2489 |
+
// $description = $this->apply_cf_fields( $description );
|
2490 |
+
if ( ! ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ) {
|
2491 |
+
$description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
|
2492 |
+
} else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2493 |
+
// $description = $this->get_aioseop_description( $post );
|
2494 |
+
$description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
|
2495 |
+
} else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2496 |
+
$description = $this->get_aioseop_description( $post );
|
2497 |
+
}
|
2498 |
+
} else if ( is_front_page() ) {
|
2499 |
+
$description = $this->get_aioseop_description( $post );
|
2500 |
+
} else if ( is_single() || is_page() || is_attachment() || is_home() || $this->is_static_posts_page() ) {
|
2501 |
+
$description = $this->get_aioseop_description( $post );
|
2502 |
+
} else if ( ( is_category() || is_tag() || is_tax() ) && $this->show_page_description() ) {
|
2503 |
+
if ( ! empty( $opts ) && AIOSEOPPRO ) {
|
2504 |
+
$description = $opts['aiosp_description'];
|
2505 |
+
}
|
2506 |
+
if ( empty( $description ) ) {
|
2507 |
+
$description = term_description();
|
2508 |
+
}
|
2509 |
+
$description = $this->internationalize( $description );
|
2510 |
+
}
|
2511 |
+
if ( empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) {
|
2512 |
+
$description = $this->trim_excerpt_without_filters( $description );
|
2513 |
+
}
|
2514 |
+
|
2515 |
+
return $description;
|
2516 |
+
}
|
2517 |
+
|
2518 |
+
/**
|
2519 |
+
* @return bool
|
2520 |
+
*/
|
2521 |
+
function show_page_description() {
|
2522 |
+
global $aioseop_options;
|
2523 |
+
if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
|
2524 |
+
$page = $this->get_page_number();
|
2525 |
+
if ( ! empty( $page ) && ( $page > 1 ) ) {
|
2526 |
+
return false;
|
2527 |
+
}
|
2528 |
+
}
|
2529 |
+
|
2530 |
+
return true;
|
2531 |
+
}
|
2532 |
+
|
2533 |
+
/**
|
2534 |
+
* @return mixed
|
2535 |
+
*/
|
2536 |
+
function get_page_number() {
|
2537 |
+
$page = get_query_var( 'page' );
|
2538 |
+
if ( empty( $page ) ) {
|
2539 |
+
$page = get_query_var( 'paged' );
|
2540 |
+
}
|
2541 |
+
|
2542 |
+
return $page;
|
2543 |
+
}
|
2544 |
+
|
2545 |
+
/**
|
2546 |
+
* @param null $post
|
2547 |
+
*
|
2548 |
+
* @return mixed|string
|
2549 |
+
*/
|
2550 |
+
function get_aioseop_description( $post = null ) {
|
2551 |
+
global $aioseop_options;
|
2552 |
+
if ( null === $post ) {
|
2553 |
+
$post = $GLOBALS['post'];
|
2554 |
+
}
|
2555 |
+
$blog_page = aiosp_common::get_blog_page();
|
2556 |
+
$description = '';
|
2557 |
+
if ( is_front_page() && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2558 |
+
$description = trim( $this->internationalize( $aioseop_options['aiosp_home_description'] ) );
|
2559 |
+
} elseif ( ! empty( $blog_page ) ) {
|
2560 |
+
$description = $this->get_post_description( $blog_page );
|
2561 |
+
}
|
2562 |
+
if ( empty( $description ) && is_object( $post ) && ! is_archive() && empty( $blog_page ) ) {
|
2563 |
+
$description = $this->get_post_description( $post );
|
2564 |
+
}
|
2565 |
+
$description = $this->apply_cf_fields( $description );
|
2566 |
+
|
2567 |
+
return $description;
|
2568 |
+
}
|
2569 |
+
|
2570 |
+
/**
|
2571 |
+
* @param $post
|
2572 |
+
*
|
2573 |
+
* @return mixed|string
|
2574 |
+
*/
|
2575 |
+
function get_post_description( $post ) {
|
2576 |
+
global $aioseop_options;
|
2577 |
+
$description = '';
|
2578 |
+
if ( ! $this->show_page_description() ) {
|
2579 |
+
return '';
|
2580 |
+
}
|
2581 |
+
$description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
|
2582 |
+
if ( ! empty( $post ) && post_password_required( $post ) ) {
|
2583 |
+
return $description;
|
2584 |
+
}
|
2585 |
+
if ( ! $description ) {
|
2586 |
+
if ( empty( $aioseop_options['aiosp_skip_excerpt'] ) ) {
|
2587 |
+
$description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) );
|
2588 |
+
}
|
2589 |
+
if ( ! $description && isset( $aioseop_options['aiosp_generate_descriptions'] ) && $aioseop_options['aiosp_generate_descriptions'] ) {
|
2590 |
+
$content = $post->post_content;
|
2591 |
+
if ( ! empty( $aioseop_options['aiosp_run_shortcodes'] ) ) {
|
2592 |
+
$content = do_shortcode( $content );
|
2593 |
+
}
|
2594 |
+
$content = wp_strip_all_tags( $content );
|
2595 |
+
$description = $this->trim_excerpt_without_filters( $this->internationalize( $content ) );
|
2596 |
+
}
|
2597 |
+
}
|
2598 |
+
|
2599 |
+
// Internal whitespace trim.
|
2600 |
+
$description = preg_replace( '/\s\s+/u', ' ', $description );
|
2601 |
+
|
2602 |
+
return $description;
|
2603 |
+
}
|
2604 |
+
|
2605 |
+
/**
|
2606 |
+
* @param $text
|
2607 |
+
*
|
2608 |
+
* @return string
|
2609 |
+
*/
|
2610 |
+
function trim_excerpt_without_filters_full_length( $text ) {
|
2611 |
+
$text = str_replace( ']]>', ']]>', $text );
|
2612 |
+
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
2613 |
+
$text = wp_strip_all_tags( $text );
|
2614 |
+
|
2615 |
+
return trim( $text );
|
2616 |
+
}
|
2617 |
+
|
2618 |
+
/**
|
2619 |
+
* @param $text
|
2620 |
+
* @param int $max
|
2621 |
+
*
|
2622 |
+
* @return string
|
2623 |
+
*/
|
2624 |
+
function trim_excerpt_without_filters( $text, $max = 0 ) {
|
2625 |
+
$text = str_replace( ']]>', ']]>', $text );
|
2626 |
+
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
2627 |
+
$text = wp_strip_all_tags( $text );
|
2628 |
+
// Treat other common word-break characters like a space.
|
2629 |
+
$text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text );
|
2630 |
+
if ( ! $max ) {
|
2631 |
+
$max = $this->maximum_description_length;
|
2632 |
+
}
|
2633 |
+
$max_orig = $max;
|
2634 |
+
$len = $this->strlen( $text2 );
|
2635 |
+
if ( $max < $len ) {
|
2636 |
+
if ( function_exists( 'mb_strrpos' ) ) {
|
2637 |
+
$pos = mb_strrpos( $text2, ' ', - ( $len - $max ) );
|
2638 |
+
if ( false === $pos ) {
|
2639 |
+
$pos = $max;
|
2640 |
+
}
|
2641 |
+
if ( $pos > $this->minimum_description_length ) {
|
2642 |
+
$max = $pos;
|
2643 |
+
} else {
|
2644 |
+
$max = $this->minimum_description_length;
|
2645 |
+
}
|
2646 |
+
} else {
|
2647 |
+
while ( ' ' != $text2[ $max ] && $max > $this->minimum_description_length ) {
|
2648 |
+
$max --;
|
2649 |
+
}
|
2650 |
+
}
|
2651 |
+
|
2652 |
+
// Probably no valid chars to break on?
|
2653 |
+
if ( $len > $max_orig && $max < intval( $max_orig / 2 ) ) {
|
2654 |
+
$max = $max_orig;
|
2655 |
+
}
|
2656 |
+
}
|
2657 |
+
$text = $this->substr( $text, 0, $max );
|
2658 |
+
|
2659 |
+
return trim( $text );
|
2660 |
+
}
|
2661 |
+
|
2662 |
+
/**
|
2663 |
+
* @param $query
|
2664 |
+
* @param bool $show_page
|
2665 |
+
*
|
2666 |
+
* @return bool|false|string
|
2667 |
+
*/
|
2668 |
+
function aiosp_mrt_get_url( $query, $show_page = true ) {
|
2669 |
+
if ( $query->is_404 || $query->is_search ) {
|
2670 |
+
return false;
|
2671 |
+
}
|
2672 |
+
$link = '';
|
2673 |
+
$haspost = count( $query->posts ) > 0;
|
2674 |
+
if ( get_query_var( 'm' ) ) {
|
2675 |
+
$m = preg_replace( '/[^0-9]/', '', get_query_var( 'm' ) );
|
2676 |
+
switch ( $this->strlen( $m ) ) {
|
2677 |
+
case 4:
|
2678 |
+
$link = get_year_link( $m );
|
2679 |
+
break;
|
2680 |
+
case 6:
|
2681 |
+
$link = get_month_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ) );
|
2682 |
+
break;
|
2683 |
+
case 8:
|
2684 |
+
$link = get_day_link( $this->substr( $m, 0, 4 ), $this->substr( $m, 4, 2 ), $this->substr( $m, 6, 2 ) );
|
2685 |
+
break;
|
2686 |
+
default:
|
2687 |
+
return false;
|
2688 |
+
}
|
2689 |
+
} elseif ( $query->is_home && ( get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) {
|
2690 |
+
$link = get_permalink( $pageid );
|
2691 |
+
} elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) {
|
2692 |
+
if ( function_exists( 'icl_get_home_url' ) ) {
|
2693 |
+
$link = icl_get_home_url();
|
2694 |
} else {
|
2695 |
+
$link = trailingslashit( home_url() );
|
2696 |
+
}
|
2697 |
+
} elseif ( ( $query->is_single || $query->is_page ) && $haspost ) {
|
2698 |
+
$post = $query->posts[0];
|
2699 |
+
$link = get_permalink( $post->ID );
|
2700 |
+
} elseif ( $query->is_author && $haspost ) {
|
2701 |
+
$author = get_userdata( get_query_var( 'author' ) );
|
2702 |
+
if ( false === $author ) {
|
2703 |
+
return false;
|
2704 |
+
}
|
2705 |
+
$link = get_author_posts_url( $author->ID, $author->user_nicename );
|
2706 |
+
} elseif ( $query->is_category && $haspost ) {
|
2707 |
+
$link = get_category_link( get_query_var( 'cat' ) );
|
2708 |
+
} elseif ( $query->is_tag && $haspost ) {
|
2709 |
+
$tag = get_term_by( 'slug', get_query_var( 'tag' ), 'post_tag' );
|
2710 |
+
if ( ! empty( $tag->term_id ) ) {
|
2711 |
+
$link = get_tag_link( $tag->term_id );
|
2712 |
+
}
|
2713 |
+
} elseif ( $query->is_day && $haspost ) {
|
2714 |
+
$link = get_day_link( get_query_var( 'year' ),
|
2715 |
+
get_query_var( 'monthnum' ),
|
2716 |
+
get_query_var( 'day' ) );
|
2717 |
+
} elseif ( $query->is_month && $haspost ) {
|
2718 |
+
$link = get_month_link( get_query_var( 'year' ),
|
2719 |
+
get_query_var( 'monthnum' ) );
|
2720 |
+
} elseif ( $query->is_year && $haspost ) {
|
2721 |
+
$link = get_year_link( get_query_var( 'year' ) );
|
2722 |
+
} elseif ( $query->is_tax && $haspost ) {
|
2723 |
+
$taxonomy = get_query_var( 'taxonomy' );
|
2724 |
+
$term = get_query_var( 'term' );
|
2725 |
+
if ( ! empty( $term ) ) {
|
2726 |
+
$link = get_term_link( $term, $taxonomy );
|
2727 |
+
}
|
2728 |
+
} elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
|
2729 |
+
if ( is_array( $post_type ) ) {
|
2730 |
+
$post_type = reset( $post_type );
|
2731 |
}
|
2732 |
+
$link = get_post_type_archive_link( $post_type );
|
2733 |
+
} else {
|
2734 |
+
return false;
|
2735 |
}
|
2736 |
+
if ( empty( $link ) || ! is_string( $link ) ) {
|
2737 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
2738 |
}
|
2739 |
+
if ( apply_filters( 'aioseop_canonical_url_pagination', $show_page ) ) {
|
2740 |
+
$link = $this->get_paged( $link );
|
2741 |
+
}
|
2742 |
+
if ( ! empty( $link ) ) {
|
2743 |
+
global $aioseop_options;
|
2744 |
+
if ( isset( $aioseop_options['aiosp_can_set_protocol'] ) && ( 'auto' !== $aioseop_options['aiosp_can_set_protocol'] ) ) {
|
2745 |
+
if ( 'http' === $aioseop_options['aiosp_can_set_protocol'] ) {
|
2746 |
+
$link = preg_replace( '/^https:/i', 'http:', $link );
|
2747 |
+
} elseif ( 'https' === $aioseop_options['aiosp_can_set_protocol'] ) {
|
2748 |
+
$link = preg_replace( '/^http:/i', 'https:', $link );
|
2749 |
}
|
2750 |
}
|
|
|
2751 |
}
|
2752 |
|
2753 |
+
return $link;
|
|
|
|
|
2754 |
}
|
2755 |
|
2756 |
+
/**
|
2757 |
+
* @param $link
|
2758 |
+
*
|
2759 |
+
* @return string
|
2760 |
+
*/
|
2761 |
+
function get_paged( $link ) {
|
2762 |
+
global $wp_rewrite;
|
2763 |
+
$page = $this->get_page_number();
|
2764 |
+
$page_name = 'page';
|
2765 |
+
if ( ! empty( $wp_rewrite ) && ! empty( $wp_rewrite->pagination_base ) ) {
|
2766 |
+
$page_name = $wp_rewrite->pagination_base;
|
2767 |
+
}
|
2768 |
+
if ( ! empty( $page ) && $page > 1 ) {
|
2769 |
+
if ( $page == get_query_var( 'page' ) ) {
|
2770 |
+
$link = trailingslashit( $link ) . "$page";
|
2771 |
+
} else {
|
2772 |
+
$link = trailingslashit( $link ) . trailingslashit( $page_name ) . $page;
|
2773 |
+
}
|
2774 |
+
$link = user_trailingslashit( $link, 'paged' );
|
2775 |
}
|
|
|
2776 |
|
2777 |
+
return $link;
|
|
|
2778 |
}
|
2779 |
|
2780 |
+
/**
|
2781 |
+
* @return comma|string
|
2782 |
+
*/
|
2783 |
+
function get_main_keywords() {
|
2784 |
+
global $aioseop_options;
|
2785 |
+
global $aioseop_keywords;
|
2786 |
+
global $post;
|
2787 |
+
$opts = $this->meta_opts;
|
2788 |
+
if ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && ! $this->is_static_posts_page() ) || $this->is_static_front_page() ) {
|
2789 |
+
if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2790 |
+
$keywords = $this->get_all_keywords();
|
2791 |
+
} else {
|
2792 |
+
$keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2793 |
}
|
2794 |
+
} elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) {
|
2795 |
+
$keywords = stripslashes( $this->internationalize( $opts['aiosp_keywords'] ) ); // And if option = use page set keywords instead of keywords from recent posts.
|
2796 |
+
} elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
|
2797 |
+
$keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, '_aioseop_keywords', true ) ) );
|
2798 |
+
} elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) {
|
2799 |
+
$keywords = '';
|
2800 |
} else {
|
2801 |
+
$keywords = $this->get_all_keywords();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2802 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2803 |
|
2804 |
+
return $keywords;
|
|
|
|
|
|
|
|
|
|
|
2805 |
}
|
2806 |
|
2807 |
+
/**
|
2808 |
+
* @return comma-separated list of unique keywords
|
2809 |
+
*/
|
2810 |
+
function get_all_keywords() {
|
2811 |
+
global $posts;
|
2812 |
global $aioseop_options;
|
2813 |
+
if ( is_404() ) {
|
2814 |
+
return null;
|
2815 |
+
}
|
2816 |
+
// If we are on synthetic pages.
|
2817 |
+
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() ) {
|
2818 |
+
return null;
|
2819 |
+
}
|
2820 |
+
$keywords = array();
|
2821 |
+
$opts = $this->meta_opts;
|
2822 |
+
if ( ! empty( $opts['aiosp_keywords'] ) ) {
|
2823 |
+
$traverse = $this->keyword_string_to_list( $this->internationalize( $opts['aiosp_keywords'] ) );
|
2824 |
+
if ( ! empty( $traverse ) ) {
|
2825 |
+
foreach ( $traverse as $keyword ) {
|
2826 |
+
$keywords[] = $keyword;
|
2827 |
+
}
|
2828 |
+
}
|
2829 |
+
}
|
2830 |
+
if ( empty( $posts ) ) {
|
2831 |
+
global $post;
|
2832 |
+
$post_arr = array( $post );
|
2833 |
+
} else {
|
2834 |
+
$post_arr = $posts;
|
2835 |
+
}
|
2836 |
+
if ( is_array( $post_arr ) ) {
|
2837 |
+
$postcount = count( $post_arr );
|
2838 |
+
foreach ( $post_arr as $p ) {
|
2839 |
+
if ( $p ) {
|
2840 |
+
$id = $p->ID;
|
2841 |
+
if ( 1 == $postcount || ! empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
|
2842 |
+
// Custom field keywords.
|
2843 |
+
$keywords_i = null;
|
2844 |
+
$keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) );
|
2845 |
+
if ( is_attachment() ) {
|
2846 |
+
$id = $p->post_parent;
|
2847 |
+
if ( empty( $keywords_i ) ) {
|
2848 |
+
$keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) );
|
2849 |
+
}
|
2850 |
+
}
|
2851 |
+
$traverse = $this->keyword_string_to_list( $keywords_i );
|
2852 |
+
if ( ! empty( $traverse ) ) {
|
2853 |
+
foreach ( $traverse as $keyword ) {
|
2854 |
+
$keywords[] = $keyword;
|
2855 |
+
}
|
2856 |
+
}
|
2857 |
+
}
|
2858 |
|
2859 |
+
if ( ! empty( $aioseop_options['aiosp_use_tags_as_keywords'] ) ) {
|
2860 |
+
$keywords = array_merge( $keywords, $this->get_all_tags( $id ) );
|
2861 |
+
}
|
2862 |
+
// Autometa.
|
2863 |
+
$autometa = stripslashes( get_post_meta( $id, 'autometa', true ) );
|
2864 |
+
if ( isset( $autometa ) && ! empty( $autometa ) ) {
|
2865 |
+
$autometa_array = explode( ' ', $autometa );
|
2866 |
+
foreach ( $autometa_array as $e ) {
|
2867 |
+
$keywords[] = $e;
|
2868 |
+
}
|
2869 |
+
}
|
2870 |
|
2871 |
+
if ( isset( $aioseop_options['aiosp_use_categories'] ) && $aioseop_options['aiosp_use_categories'] && ! is_page() ) {
|
2872 |
+
$keywords = array_merge( $keywords, $this->get_all_categories( $id ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2873 |
}
|
2874 |
}
|
2875 |
}
|
2876 |
}
|
2877 |
+
|
2878 |
+
return $this->get_unique_keywords( $keywords );
|
2879 |
}
|
2880 |
|
2881 |
+
/**
|
2882 |
+
* @param $keywords
|
2883 |
+
*
|
2884 |
+
* @return array
|
2885 |
+
*/
|
2886 |
+
function keyword_string_to_list( $keywords ) {
|
2887 |
+
$traverse = array();
|
2888 |
+
$keywords_i = str_replace( '"', '', $keywords );
|
2889 |
+
if ( isset( $keywords_i ) && ! empty( $keywords_i ) ) {
|
2890 |
+
$traverse = explode( ',', $keywords_i );
|
2891 |
+
}
|
2892 |
+
|
2893 |
+
return $traverse;
|
2894 |
+
}
|
2895 |
+
|
2896 |
+
/**
|
2897 |
+
* @param int $id
|
2898 |
+
*
|
2899 |
+
* @return array
|
2900 |
+
*/
|
2901 |
+
function get_all_tags( $id = 0 ) {
|
2902 |
+
$keywords = array();
|
2903 |
+
$tags = get_the_tags( $id );
|
2904 |
+
if ( ! empty( $tags ) && is_array( $tags ) ) {
|
2905 |
+
foreach ( $tags as $tag ) {
|
2906 |
+
$keywords[] = $this->internationalize( $tag->name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2907 |
}
|
2908 |
+
}
|
2909 |
+
// Ultimate Tag Warrior integration.
|
2910 |
+
global $utw;
|
2911 |
+
if ( $utw ) {
|
2912 |
+
$tags = $utw->GetTagsForPost( $p );
|
2913 |
+
if ( is_array( $tags ) ) {
|
2914 |
+
foreach ( $tags as $tag ) {
|
2915 |
+
$tag = $tag->tag;
|
2916 |
+
$tag = str_replace( '_', ' ', $tag );
|
2917 |
+
$tag = str_replace( '-', ' ', $tag );
|
2918 |
+
$tag = stripslashes( $tag );
|
2919 |
+
$keywords[] = $tag;
|
2920 |
+
}
|
2921 |
}
|
2922 |
}
|
|
|
|
|
2923 |
|
2924 |
+
return $keywords;
|
2925 |
+
}
|
|
|
|
|
|
|
2926 |
|
2927 |
+
/**
|
2928 |
+
* @param $keywords
|
2929 |
+
*
|
2930 |
+
* @return string
|
2931 |
+
*/
|
2932 |
+
function get_unique_keywords( $keywords ) {
|
2933 |
+
return implode( ',', $this->clean_keyword_list( $keywords ) );
|
2934 |
+
}
|
2935 |
|
2936 |
+
/**
|
2937 |
+
* @param $keywords
|
2938 |
+
*
|
2939 |
+
* @return array
|
2940 |
+
*/
|
2941 |
+
function clean_keyword_list( $keywords ) {
|
2942 |
+
$small_keywords = array();
|
2943 |
+
if ( ! is_array( $keywords ) ) {
|
2944 |
+
$keywords = $this->keyword_string_to_list( $keywords );
|
2945 |
+
}
|
2946 |
+
if ( ! empty( $keywords ) ) {
|
2947 |
+
foreach ( $keywords as $word ) {
|
2948 |
+
$small_keywords[] = trim( $this->strtolower( $word ) );
|
2949 |
+
}
|
2950 |
+
}
|
2951 |
|
2952 |
+
return array_unique( $small_keywords );
|
2953 |
+
}
|
|
|
2954 |
|
2955 |
+
/**
|
2956 |
+
* @param $term_id
|
2957 |
+
* @param $new_term_id
|
2958 |
+
* @param string $term_taxonomy_id
|
2959 |
+
* @param string $taxonomy
|
2960 |
+
*/
|
2961 |
+
function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id = '', $taxonomy = '' ) {
|
2962 |
+
$terms = $this->get_all_term_data( $term_id );
|
2963 |
+
if ( ! empty( $terms ) ) {
|
2964 |
+
$new_terms = $this->get_all_term_data( $new_term_id );
|
2965 |
+
if ( empty( $new_terms ) ) {
|
2966 |
+
foreach ( $terms as $k => $v ) {
|
2967 |
+
add_term_meta( $new_term_id, $k, $v, true );
|
2968 |
}
|
2969 |
+
add_term_meta( $term_id, '_aioseop_term_was_split', true, true );
|
2970 |
}
|
2971 |
}
|
2972 |
+
}
|
|
|
|
|
|
|
2973 |
|
2974 |
+
/**
|
2975 |
+
* @param $term_id
|
2976 |
+
*
|
2977 |
+
* @return array
|
2978 |
+
*/
|
2979 |
+
function get_all_term_data( $term_id ) {
|
2980 |
+
$terms = array();
|
2981 |
+
$optlist = array(
|
2982 |
+
'keywords',
|
2983 |
+
'description',
|
2984 |
+
'title',
|
2985 |
+
'custom_link',
|
2986 |
+
'sitemap_exclude',
|
2987 |
+
'disable',
|
2988 |
+
'disable_analytics',
|
2989 |
+
'noindex',
|
2990 |
+
'nofollow',
|
2991 |
+
'noodp',
|
2992 |
+
'noydir',
|
2993 |
+
'titleatr',
|
2994 |
+
'menulabel',
|
2995 |
+
);
|
2996 |
+
foreach ( $optlist as $f ) {
|
2997 |
+
$meta = get_term_meta( $term_id, '_aioseop_' . $f, true );
|
2998 |
+
if ( ! empty( $meta ) ) {
|
2999 |
+
$terms[ '_aioseop_' . $f ] = $meta;
|
3000 |
}
|
3001 |
}
|
3002 |
|
3003 |
+
return $terms;
|
3004 |
}
|
3005 |
|
3006 |
+
function add_page_icon() {
|
3007 |
+
wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
|
3008 |
+
wp_enqueue_style( 'wp-pointer' );
|
3009 |
+
$this->add_admin_pointers();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3010 |
|
3011 |
+
wp_enqueue_style( 'aiosp_admin_style', AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css' );
|
3012 |
+
?>
|
3013 |
+
<script>
|
3014 |
+
function aioseop_show_pointer(handle, value) {
|
3015 |
+
if (typeof( jQuery ) != 'undefined') {
|
3016 |
+
var p_edge = 'bottom';
|
3017 |
+
var p_align = 'center';
|
3018 |
+
if (typeof( jQuery(value.pointer_target).pointer) != 'undefined') {
|
3019 |
+
if (typeof( value.pointer_edge ) != 'undefined') p_edge = value.pointer_edge;
|
3020 |
+
if (typeof( value.pointer_align ) != 'undefined') p_align = value.pointer_align;
|
3021 |
+
jQuery(value.pointer_target).pointer({
|
3022 |
+
content: value.pointer_text,
|
3023 |
+
position: {
|
3024 |
+
edge: p_edge,
|
3025 |
+
align: p_align
|
3026 |
+
},
|
3027 |
+
close: function () {
|
3028 |
+
jQuery.post(ajaxurl, {
|
3029 |
+
pointer: handle,
|
3030 |
+
action: 'dismiss-wp-pointer'
|
3031 |
+
});
|
3032 |
+
}
|
3033 |
+
}).pointer('open');
|
3034 |
+
}
|
3035 |
+
}
|
3036 |
}
|
3037 |
+
<?php
|
3038 |
+
if ( ! empty( $this->pointers ) ) {
|
3039 |
+
?>
|
3040 |
+
if (typeof( jQuery ) != 'undefined') {
|
3041 |
+
jQuery(document).ready(function () {
|
3042 |
+
var admin_pointer;
|
3043 |
+
var admin_index;
|
3044 |
+
<?php
|
3045 |
+
foreach ( $this->pointers as $k => $p )
|
3046 |
+
{if ( ! empty( $p['pointer_scope'] ) && ( 'global' === $p['pointer_scope'] ) ) {
|
3047 |
+
?>admin_index = "<?php echo esc_attr( $k ); ?>";
|
3048 |
+
admin_pointer = <?php echo json_encode( $p ); ?>;
|
3049 |
+
aioseop_show_pointer(admin_index, admin_pointer);
|
3050 |
+
<?php
|
3051 |
+
}
|
3052 |
+
} ?>
|
3053 |
+
});
|
3054 |
+
}
|
3055 |
+
<?php } ?>
|
3056 |
+
</script>
|
3057 |
+
<?php
|
3058 |
+
}
|
3059 |
+
|
3060 |
+
function add_admin_pointers() {
|
3061 |
+
if ( AIOSEOPPRO ) {
|
3062 |
+
$this->pointers['aioseop_menu_236'] = array(
|
3063 |
+
'pointer_target' => '#toplevel_page_all-in-one-seo-pack-pro-aioseop_class',
|
3064 |
+
'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
3065 |
+
. '</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>',
|
3066 |
+
'pointer_edge' => 'top',
|
3067 |
+
'pointer_align' => 'left',
|
3068 |
+
'pointer_scope' => 'global',
|
3069 |
+
);
|
3070 |
+
$this->pointers['aioseop_welcome_230'] = array(
|
3071 |
+
'pointer_target' => '#aioseop_top_button',
|
3072 |
+
'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
3073 |
+
. '</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>',
|
3074 |
+
'pointer_edge' => 'bottom',
|
3075 |
+
'pointer_align' => 'left',
|
3076 |
+
'pointer_scope' => 'local',
|
3077 |
+
);
|
3078 |
+
$this->filter_pointers();
|
3079 |
+
} else {
|
3080 |
+
$this->pointers['aioseop_menu_220'] = array(
|
3081 |
+
'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class',
|
3082 |
+
'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
3083 |
+
. '</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>',
|
3084 |
+
'pointer_edge' => 'top',
|
3085 |
+
'pointer_align' => 'left',
|
3086 |
+
'pointer_scope' => 'global',
|
3087 |
+
);
|
3088 |
+
$this->pointers['aioseop_welcome_220'] = array(
|
3089 |
+
'pointer_target' => '#aioseop_top_button',
|
3090 |
+
'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
3091 |
+
. '</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>',
|
3092 |
+
'pointer_edge' => 'bottom',
|
3093 |
+
'pointer_align' => 'left',
|
3094 |
+
'pointer_scope' => 'local',
|
3095 |
+
);
|
3096 |
+
$this->filter_pointers();
|
3097 |
+
}
|
3098 |
}
|
3099 |
|
3100 |
+
function add_page_hooks() {
|
|
|
|
|
3101 |
|
3102 |
+
global $aioseop_options;
|
3103 |
|
3104 |
+
$post_objs = get_post_types( '', 'objects' );
|
3105 |
+
$pt = array_keys( $post_objs );
|
3106 |
+
$rempost = array( 'revision', 'nav_menu_item' );
|
3107 |
+
$pt = array_diff( $pt, $rempost );
|
3108 |
+
$post_types = array();
|
3109 |
|
3110 |
+
$aiosp_enablecpost = '';
|
3111 |
+
if ( isset( $_REQUEST['aiosp_enablecpost'] ) ) {
|
3112 |
+
$aiosp_enablecpost = $_REQUEST['aiosp_enablecpost'];
|
3113 |
+
}
|
3114 |
|
3115 |
+
foreach ( $pt as $p ) {
|
3116 |
+
if ( ! empty( $post_objs[ $p ]->label ) ) {
|
3117 |
+
if ( $post_objs[ $p ]->_builtin && empty( $aioseop_options['aiosp_enablecpost'] ) ) {
|
3118 |
+
$post_types[ $p ] = $post_objs[ $p ]->label;
|
3119 |
+
} elseif ( ! empty( $aioseop_options['aiosp_enablecpost'] ) || $aiosp_enablecpost == 'on' ) {
|
3120 |
+
$post_types[ $p ] = $post_objs[ $p ]->label;
|
3121 |
+
}
|
3122 |
+
} else {
|
3123 |
+
$post_types[ $p ] = $p;
|
3124 |
}
|
3125 |
+
}
|
3126 |
|
3127 |
+
foreach ( $pt as $p ) {
|
3128 |
+
if ( ! empty( $post_objs[ $p ]->label ) ) {
|
3129 |
+
$all_post_types[ $p ] = $post_objs[ $p ]->label;
|
3130 |
+
}
|
3131 |
+
}
|
|
|
3132 |
|
3133 |
+
$taxes = get_taxonomies( '', 'objects' );
|
3134 |
+
$tx = array_keys( $taxes );
|
3135 |
+
$remtax = array( 'nav_menu', 'link_category', 'post_format' );
|
3136 |
+
$tx = array_diff( $tx, $remtax );
|
3137 |
+
$tax_types = array();
|
3138 |
+
foreach ( $tx as $t ) {
|
3139 |
+
if ( ! empty( $taxes[ $t ]->label ) ) {
|
3140 |
+
$tax_types[ $t ] = $taxes[ $t ]->label;
|
3141 |
+
} else {
|
3142 |
+
$taxes[ $t ] = $t;
|
3143 |
+
}
|
3144 |
+
}
|
3145 |
+
$this->default_options['posttypecolumns']['initial_options'] = $post_types;
|
3146 |
+
$this->default_options['cpostactive']['initial_options'] = $all_post_types;
|
3147 |
+
$this->default_options['cpostnoindex']['initial_options'] = $post_types;
|
3148 |
+
$this->default_options['cpostnofollow']['initial_options'] = $post_types;
|
3149 |
+
$this->default_options['cpostnoodp']['initial_options'] = $post_types;
|
3150 |
+
$this->default_options['cpostnoydir']['initial_options'] = $post_types;
|
3151 |
+
if ( AIOSEOPPRO ) {
|
3152 |
+
$this->default_options['taxactive']['initial_options'] = $tax_types;
|
3153 |
+
}
|
3154 |
+
$this->default_options['google_author_location']['initial_options'] = $post_types;
|
3155 |
+
$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' ) ) );
|
3156 |
+
$this->default_options['google_author_location']['default'] = array_keys( $this->default_options['google_author_location']['initial_options'] );
|
3157 |
|
3158 |
+
foreach ( $post_types as $p => $pt ) {
|
3159 |
+
$field = $p . '_title_format';
|
3160 |
+
$name = $post_objs[ $p ]->labels->singular_name;
|
3161 |
+
if ( ! isset( $this->default_options[ $field ] ) ) {
|
3162 |
+
$this->default_options[ $field ] = array(
|
3163 |
+
'name' => "$name " . __( 'Title Format:', 'all-in-one-seo-pack' ) . "<br />($p)",
|
3164 |
+
'type' => 'text',
|
3165 |
+
'default' => '%post_title% | %blog_title%',
|
3166 |
+
'condshow' => array(
|
3167 |
+
'aiosp_rewrite_titles' => 1,
|
3168 |
+
'aiosp_enablecpost' => 'on',
|
3169 |
+
'aiosp_cpostadvanced' => 'on',
|
3170 |
+
'aiosp_cposttitles' => 'on',
|
3171 |
+
'aiosp_cpostactive\[\]' => $p,
|
3172 |
+
),
|
3173 |
+
);
|
3174 |
+
$this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' )
|
3175 |
+
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
3176 |
+
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
3177 |
+
__( '%post_title% - The original title of the post.', 'all-in-one-seo-pack' ) . '</li><li>';
|
3178 |
+
$taxes = get_object_taxonomies( $p, 'objects' );
|
3179 |
+
if ( ! empty( $taxes ) ) {
|
3180 |
+
foreach ( $taxes as $n => $t ) {
|
3181 |
+
$this->help_text[ $field ] .= sprintf( __( "%%tax_%s%% - This post's associated %s taxonomy title", 'all-in-one-seo-pack' ), $n, $t->label ) . '</li><li>';
|
3182 |
+
}
|
3183 |
+
}
|
3184 |
+
$this->help_text[ $field ] .=
|
3185 |
+
__( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3186 |
+
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3187 |
+
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3188 |
+
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
|
3189 |
+
'</ul>';
|
3190 |
+
$this->help_anchors[ $field ] = '#custom-titles';
|
3191 |
+
$this->layout['cpt']['options'][] = $field;
|
|
|
3192 |
}
|
3193 |
}
|
3194 |
+
global $wp_roles;
|
3195 |
+
if ( ! isset( $wp_roles ) ) {
|
3196 |
+
$wp_roles = new WP_Roles();
|
3197 |
+
}
|
3198 |
+
$role_names = $wp_roles->get_names();
|
3199 |
+
ksort( $role_names );
|
3200 |
+
$this->default_options['ga_exclude_users']['initial_options'] = $role_names;
|
|
|
3201 |
|
3202 |
+
unset( $tax_types['category'] );
|
3203 |
+
unset( $tax_types['post_tag'] );
|
3204 |
+
$this->default_options['tax_noindex']['initial_options'] = $tax_types;
|
3205 |
+
if ( empty( $tax_types ) ) {
|
3206 |
+
unset( $this->default_options['tax_noindex'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3207 |
}
|
3208 |
+
|
3209 |
+
if ( AIOSEOPPRO ) {
|
3210 |
+
foreach ( $tax_types as $p => $pt ) {
|
3211 |
+
$field = $p . '_tax_title_format';
|
3212 |
+
$name = $pt;
|
3213 |
+
if ( ! isset( $this->default_options[ $field ] ) ) {
|
3214 |
+
$this->default_options[ $field ] = array(
|
3215 |
+
'name' => "$name " . __( 'Taxonomy Title Format:', 'all-in-one-seo-pack' ),
|
3216 |
+
'type' => 'text',
|
3217 |
+
'default' => '%taxonomy_title% | %blog_title%',
|
3218 |
+
'condshow' => array(
|
3219 |
+
'aiosp_rewrite_titles' => 1,
|
3220 |
+
'aiosp_enablecpost' => 'on',
|
3221 |
+
'aiosp_cpostadvanced' => 'on',
|
3222 |
+
'aiosp_cposttitles' => 'on',
|
3223 |
+
'aiosp_taxactive\[\]' => $p,
|
3224 |
+
),
|
3225 |
+
);
|
3226 |
+
$this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' ) .
|
3227 |
+
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
3228 |
+
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
3229 |
+
__( '%taxonomy_title% - The original title of the taxonomy', 'all-in-one-seo-pack' ) . '</li><li>' .
|
3230 |
+
__( '%taxonomy_description% - The description of the taxonomy', 'all-in-one-seo-pack' ) . '</li></ul>';
|
3231 |
+
$this->help_anchors[ $field ] = '#custom-titles';
|
3232 |
+
$this->layout['cpt']['options'][] = $field;
|
3233 |
+
}
|
3234 |
+
}
|
3235 |
}
|
3236 |
+
$this->setting_options();
|
3237 |
+
$this->add_help_text_links();
|
3238 |
+
|
3239 |
+
if ( AIOSEOPPRO ) {
|
3240 |
+
global $aioseop_update_checker;
|
3241 |
+
add_action( "{$this->prefix}update_options", array(
|
3242 |
+
$aioseop_update_checker,
|
3243 |
+
'license_change_check',
|
3244 |
+
), 10, 2 );
|
3245 |
+
add_action( "{$this->prefix}settings_update", array( $aioseop_update_checker, 'update_check' ), 10, 2 );
|
3246 |
}
|
|
|
|
|
3247 |
|
3248 |
+
add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 );
|
3249 |
+
parent::add_page_hooks();
|
|
|
|
|
|
|
|
|
3250 |
}
|
3251 |
|
3252 |
+
function settings_page_init() {
|
3253 |
+
add_filter( "{$this->prefix}submit_options", array( $this, 'filter_submit' ) );
|
3254 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3255 |
|
3256 |
+
function enqueue_scripts() {
|
3257 |
+
add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 );
|
3258 |
+
add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 );
|
3259 |
+
parent::enqueue_scripts();
|
3260 |
+
}
|
3261 |
|
3262 |
+
/**
|
3263 |
+
* @param $submit
|
3264 |
+
*
|
3265 |
+
* @return mixed
|
3266 |
+
*/
|
3267 |
+
function filter_submit( $submit ) {
|
3268 |
+
$submit['Submit_Default']['value'] = __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' »';
|
3269 |
+
$submit['Submit_All_Default'] = array(
|
3270 |
+
'type' => 'submit',
|
3271 |
+
'class' => 'button-secondary',
|
3272 |
+
'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' »',
|
3273 |
+
);
|
3274 |
|
3275 |
+
return $submit;
|
3276 |
}
|
3277 |
|
3278 |
+
/**
|
3279 |
+
* Handle resetting options to defaults, but preserve the license key if pro.
|
3280 |
+
*
|
3281 |
+
* @param null $location
|
3282 |
+
* @param bool $delete
|
3283 |
+
*/
|
3284 |
+
function reset_options( $location = null, $delete = false ) {
|
3285 |
+
if ( AIOSEOPPRO ) {
|
3286 |
+
global $aioseop_update_checker;
|
3287 |
+
}
|
3288 |
+
if ( $delete === true ) {
|
3289 |
+
|
3290 |
+
if ( AIOSEOPPRO ) {
|
3291 |
+
$license_key = '';
|
3292 |
+
if ( isset( $this->options ) && isset( $this->options['aiosp_license_key'] ) ) {
|
3293 |
+
$license_key = $this->options['aiosp_license_key'];
|
3294 |
}
|
3295 |
}
|
|
|
|
|
|
|
|
|
3296 |
|
3297 |
+
$this->delete_class_option( $delete );
|
3298 |
+
|
3299 |
+
if ( AIOSEOPPRO ) {
|
3300 |
+
$this->options = array( 'aiosp_license_key' => $license_key );
|
|
|
|
|
|
|
|
|
3301 |
} else {
|
3302 |
+
$this->options = array();
|
3303 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3304 |
}
|
3305 |
+
$default_options = $this->default_options( $location );
|
|
|
3306 |
|
3307 |
+
if ( AIOSEOPPRO ) {
|
3308 |
+
foreach ( $default_options as $k => $v ) {
|
3309 |
+
if ( $k != 'aiosp_license_key' ) {
|
3310 |
+
$this->options[ $k ] = $v;
|
3311 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3312 |
}
|
3313 |
+
$aioseop_update_checker->license_key = $this->options['aiosp_license_key'];
|
3314 |
+
} else {
|
3315 |
+
foreach ( $default_options as $k => $v ) {
|
3316 |
+
$this->options[ $k ] = $v;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3317 |
}
|
|
|
|
|
|
|
|
|
|
|
3318 |
}
|
3319 |
+
$this->update_class_option( $this->options );
|
3320 |
}
|
3321 |
|
3322 |
+
/**
|
3323 |
+
* @param $settings
|
3324 |
+
* @param $location
|
3325 |
+
* @param $current
|
3326 |
+
*
|
3327 |
+
* @return mixed
|
3328 |
+
*/
|
3329 |
+
function filter_settings( $settings, $location, $current ) {
|
3330 |
+
if ( $location == null ) {
|
3331 |
+
$prefix = $this->prefix;
|
3332 |
|
3333 |
+
foreach ( array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt ) {
|
3334 |
+
unset( $settings["{$prefix}$opt"] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3335 |
}
|
3336 |
+
|
3337 |
+
if ( ! class_exists( 'DOMDocument' ) ) {
|
3338 |
+
unset( $settings['{prefix}google_connect'] );
|
3339 |
}
|
3340 |
+
if ( AIOSEOPPRO ) {
|
3341 |
+
if ( ! empty( $this->options['aiosp_license_key'] ) ) {
|
3342 |
+
$settings['aiosp_license_key']['type'] = 'password';
|
3343 |
+
$settings['aiosp_license_key']['size'] = 38;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3344 |
}
|
3345 |
}
|
3346 |
+
} elseif ( $location == 'aiosp' ) {
|
3347 |
+
global $post, $aioseop_sitemap;
|
3348 |
+
$prefix = $this->get_prefix( $location ) . $location . '_';
|
3349 |
+
if ( ! empty( $post ) ) {
|
3350 |
+
$post_type = get_post_type( $post );
|
3351 |
+
if ( ! empty( $this->options['aiosp_cpostnoindex'] ) && in_array( $post_type, $this->options['aiosp_cpostnoindex'] ) ) {
|
3352 |
+
$settings["{$prefix}noindex"]['type'] = 'select';
|
3353 |
+
$settings["{$prefix}noindex"]['initial_options'] = array(
|
3354 |
+
'' => __( 'Default - noindex', 'all-in-one-seo-pack' ),
|
3355 |
+
'off' => __( 'index', 'all-in-one-seo-pack' ),
|
3356 |
+
'on' => __( 'noindex', 'all-in-one-seo-pack' ),
|
3357 |
+
);
|
3358 |
+
}
|
3359 |
+
if ( ! empty( $this->options['aiosp_cpostnofollow'] ) && in_array( $post_type, $this->options['aiosp_cpostnofollow'] ) ) {
|
3360 |
+
$settings["{$prefix}nofollow"]['type'] = 'select';
|
3361 |
+
$settings["{$prefix}nofollow"]['initial_options'] = array(
|
3362 |
+
'' => __( 'Default - nofollow', 'all-in-one-seo-pack' ),
|
3363 |
+
'off' => __( 'follow', 'all-in-one-seo-pack' ),
|
3364 |
+
'on' => __( 'nofollow', 'all-in-one-seo-pack' ),
|
3365 |
+
);
|
3366 |
+
}
|
3367 |
+
if ( ! empty( $this->options['aiosp_cpostnoodp'] ) && in_array( $post_type, $this->options['aiosp_cpostnoodp'] ) ) {
|
3368 |
+
$settings["{$prefix}noodp"]['type'] = 'select';
|
3369 |
+
$settings["{$prefix}noodp"]['initial_options'] = array(
|
3370 |
+
'' => __( 'Default - noodp', 'all-in-one-seo-pack' ),
|
3371 |
+
'off' => __( 'odp', 'all-in-one-seo-pack' ),
|
3372 |
+
'on' => __( 'noodp', 'all-in-one-seo-pack' ),
|
3373 |
+
);
|
3374 |
+
}
|
3375 |
+
if ( ! empty( $this->options['aiosp_cpostnoydir'] ) && in_array( $post_type, $this->options['aiosp_cpostnoydir'] ) ) {
|
3376 |
+
$settings["{$prefix}noydir"]['type'] = 'select';
|
3377 |
+
$settings["{$prefix}noydir"]['initial_options'] = array(
|
3378 |
+
'' => __( 'Default - noydir', 'all-in-one-seo-pack' ),
|
3379 |
+
'off' => __( 'ydir', 'all-in-one-seo-pack' ),
|
3380 |
+
'on' => __( 'noydir', 'all-in-one-seo-pack' ),
|
3381 |
+
);
|
3382 |
+
}
|
3383 |
+
global $post;
|
3384 |
+
$info = $this->get_page_snippet_info();
|
3385 |
+
extract( $info );
|
3386 |
+
$settings["{$prefix}title"]['placeholder'] = $title;
|
3387 |
+
$settings["{$prefix}description"]['placeholder'] = $description;
|
3388 |
+
$settings["{$prefix}keywords"]['placeholder'] = $keywords;
|
3389 |
}
|
3390 |
+
|
3391 |
+
if ( ! AIOSEOPPRO ) {
|
3392 |
+
if ( ! current_user_can( 'update_plugins' ) ) {
|
3393 |
+
unset( $settings["{$prefix}upgrade"] );
|
3394 |
+
}
|
3395 |
}
|
3396 |
+
|
3397 |
+
if ( ! is_object( $aioseop_sitemap ) ) {
|
3398 |
+
unset( $settings['aiosp_sitemap_exclude'] );
|
3399 |
}
|
3400 |
+
if ( is_object( $post ) ) {
|
3401 |
+
if ( $post->post_type != 'page' ) {
|
3402 |
+
unset( $settings["{$prefix}titleatr"] );
|
3403 |
+
unset( $settings["{$prefix}menulabel"] );
|
3404 |
+
}
|
3405 |
+
}
|
3406 |
+
if ( ! empty( $this->options[ $this->prefix . 'togglekeywords' ] ) ) {
|
3407 |
+
unset( $settings["{$prefix}keywords"] );
|
3408 |
+
unset( $settings["{$prefix}togglekeywords"] );
|
3409 |
+
} elseif ( ! empty( $current["{$prefix}togglekeywords"] ) ) {
|
3410 |
+
unset( $settings["{$prefix}keywords"] );
|
3411 |
+
}
|
3412 |
+
if ( empty( $this->options['aiosp_can'] ) || empty( $this->options['aiosp_customize_canonical_links'] ) ) {
|
3413 |
+
unset( $settings["{$prefix}custom_link"] );
|
3414 |
}
|
3415 |
+
}
|
3416 |
|
3417 |
+
return $settings;
|
3418 |
+
}
|
3419 |
+
|
3420 |
+
/**
|
3421 |
+
* @param $options
|
3422 |
+
* @param $location
|
3423 |
+
*
|
3424 |
+
* @return mixed
|
3425 |
+
*/
|
3426 |
+
function filter_options( $options, $location ) {
|
3427 |
+
if ( $location == 'aiosp' ) {
|
3428 |
+
global $post;
|
3429 |
+
if ( ! empty( $post ) ) {
|
3430 |
+
$prefix = $this->prefix;
|
3431 |
+
$post_type = get_post_type( $post );
|
3432 |
+
foreach ( array( 'noindex', 'nofollow', 'noodp', 'noydir' ) as $no ) {
|
3433 |
+
if ( empty( $this->options[ 'aiosp_cpost' . $no ] ) || ( ! in_array( $post_type, $this->options[ 'aiosp_cpost' . $no ] ) ) ) {
|
3434 |
+
if ( isset( $options["{$prefix}{$no}"] ) && ( $options["{$prefix}{$no}"] != 'on' ) ) {
|
3435 |
+
unset( $options["{$prefix}{$no}"] );
|
3436 |
+
}
|
3437 |
+
}
|
3438 |
+
}
|
3439 |
+
}
|
3440 |
+
}
|
3441 |
+
if ( $location == null ) {
|
3442 |
+
$prefix = $this->prefix;
|
3443 |
+
if ( isset( $options["{$prefix}rewrite_titles"] ) && ( ! empty( $options["{$prefix}rewrite_titles"] ) ) ) {
|
3444 |
+
$options["{$prefix}rewrite_titles"] = 1;
|
3445 |
}
|
3446 |
+
if ( isset( $options["{$prefix}enablecpost"] ) && ( $options["{$prefix}enablecpost"] === '' ) ) {
|
3447 |
+
$options["{$prefix}enablecpost"] = 0;
|
|
|
3448 |
}
|
3449 |
+
if ( isset( $options["{$prefix}use_original_title"] ) && ( $options["{$prefix}use_original_title"] === '' ) ) {
|
3450 |
+
$options["{$prefix}use_original_title"] = 0;
|
3451 |
+
}
|
3452 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3453 |
|
3454 |
+
return $options;
|
3455 |
+
}
|
|
|
|
|
3456 |
|
3457 |
+
function template_redirect() {
|
3458 |
+
global $aioseop_options;
|
3459 |
+
|
3460 |
+
$post = $this->get_queried_object();
|
3461 |
+
|
3462 |
+
if ( ! $this->is_page_included() ) {
|
3463 |
+
return;
|
3464 |
}
|
|
|
|
|
3465 |
|
3466 |
+
if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
|
3467 |
+
$force_rewrites = 1;
|
3468 |
+
if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) {
|
3469 |
+
$force_rewrites = $aioseop_options['aiosp_force_rewrites'];
|
3470 |
+
}
|
3471 |
+
if ( $force_rewrites ) {
|
3472 |
+
ob_start( array( $this, 'output_callback_for_title' ) );
|
3473 |
+
} else {
|
3474 |
+
add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
|
3475 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3476 |
}
|
|
|
|
|
|
|
|
|
3477 |
}
|
3478 |
+
|
3479 |
+
/**
|
3480 |
+
* @return bool
|
3481 |
+
*/
|
3482 |
+
function is_page_included() {
|
3483 |
+
global $aioseop_options;
|
3484 |
+
if ( is_feed() ) {
|
|
|
|
|
|
|
|
|
3485 |
return false;
|
3486 |
}
|
3487 |
+
if ( aioseop_mrt_exclude_this_page() ) {
|
3488 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3489 |
}
|
3490 |
+
$post = $this->get_queried_object();
|
3491 |
+
$post_type = '';
|
3492 |
+
if ( ! empty( $post ) && ! empty( $post->post_type ) ) {
|
3493 |
+
$post_type = $post->post_type;
|
3494 |
+
}
|
3495 |
+
if ( empty( $aioseop_options['aiosp_enablecpost'] ) ) {
|
3496 |
+
$wp_post_types = get_post_types( array( '_builtin' => true ) ); // Don't display meta if SEO isn't enabled on custom post types -- pdb.
|
3497 |
+
if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) {
|
3498 |
+
return false;
|
3499 |
+
}
|
3500 |
+
} else {
|
3501 |
+
$wp_post_types = $aioseop_options['aiosp_cpostactive'];
|
3502 |
+
if ( empty( $wp_post_types ) ) {
|
3503 |
+
$wp_post_types = array();
|
3504 |
+
}
|
3505 |
+
if ( AIOSEOPPRO ) {
|
3506 |
+
if ( is_tax() ) {
|
3507 |
+
if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! is_tax( $aioseop_options['aiosp_taxactive'] ) ) {
|
3508 |
+
return false;
|
3509 |
+
}
|
3510 |
+
} elseif ( is_category() ) {
|
3511 |
+
if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! in_array( 'category', $aioseop_options['aiosp_taxactive'] ) ) {
|
3512 |
+
return false;
|
3513 |
+
}
|
3514 |
+
} elseif ( is_tag() ) {
|
3515 |
+
if ( empty( $aioseop_options['aiosp_taxactive'] ) || ! in_array( 'post_tag', $aioseop_options['aiosp_taxactive'] ) ) {
|
3516 |
+
return false;
|
3517 |
+
}
|
3518 |
+
} else if ( ! in_array( $post_type, $wp_post_types ) && ! is_front_page() && ! is_post_type_archive( $wp_post_types ) && ! is_404() ) {
|
3519 |
+
return false;
|
3520 |
+
}
|
3521 |
} else {
|
3522 |
+
if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) {
|
3523 |
+
return false;
|
3524 |
+
}
|
3525 |
+
if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) {
|
3526 |
+
return false;
|
3527 |
+
}
|
3528 |
}
|
|
|
|
|
|
|
|
|
3529 |
}
|
3530 |
|
3531 |
+
$this->meta_opts = $this->get_current_options( array(), 'aiosp' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3532 |
|
3533 |
+
$aiosp_disable = $aiosp_disable_analytics = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3534 |
|
3535 |
+
if ( ! empty( $this->meta_opts ) ) {
|
3536 |
+
if ( isset( $this->meta_opts['aiosp_disable'] ) ) {
|
3537 |
+
$aiosp_disable = $this->meta_opts['aiosp_disable'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3538 |
}
|
3539 |
+
if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) {
|
3540 |
+
$aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics'];
|
|
|
|
|
|
|
|
|
|
|
3541 |
}
|
3542 |
+
}
|
3543 |
+
|
3544 |
+
if ( $aiosp_disable ) {
|
3545 |
+
if ( ! $aiosp_disable_analytics ) {
|
3546 |
+
if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
|
3547 |
+
remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
|
3548 |
+
add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3549 |
}
|
3550 |
}
|
3551 |
+
|
3552 |
+
return false;
|
3553 |
}
|
3554 |
+
|
3555 |
+
if ( ! empty( $this->meta_opts ) && $this->meta_opts['aiosp_disable'] == true ) {
|
3556 |
+
return false;
|
3557 |
+
}
|
3558 |
+
|
3559 |
+
return true;
|
3560 |
}
|
3561 |
|
3562 |
+
/**
|
3563 |
+
* @param $content
|
3564 |
+
*
|
3565 |
+
* @return mixed|string
|
3566 |
+
*/
|
3567 |
+
function output_callback_for_title( $content ) {
|
3568 |
+
return $this->rewrite_title( $content );
|
3569 |
}
|
3570 |
|
3571 |
+
/**
|
3572 |
+
* Used for forcing title rewrites.
|
3573 |
+
*
|
3574 |
+
* @param $header
|
3575 |
+
*
|
3576 |
+
* @return mixed|string
|
3577 |
+
*/
|
3578 |
+
function rewrite_title( $header ) {
|
3579 |
+
global $wp_query;
|
3580 |
+
if ( ! $wp_query ) {
|
3581 |
+
$header .= "<!-- no wp_query found! -->\n";
|
3582 |
+
|
3583 |
+
return $header;
|
3584 |
+
}
|
3585 |
+
$title = $this->wp_title();
|
3586 |
+
if ( ! empty( $title ) ) {
|
3587 |
+
$header = $this->replace_title( $header, $title );
|
3588 |
}
|
|
|
|
|
3589 |
|
3590 |
+
return $header;
|
|
|
|
|
|
|
|
|
3591 |
}
|
3592 |
|
3593 |
+
/**
|
3594 |
+
* @param $content
|
3595 |
+
* @param $title
|
3596 |
+
*
|
3597 |
+
* @return mixed
|
3598 |
+
*/
|
3599 |
+
function replace_title( $content, $title ) {
|
3600 |
+
// We can probably improve this... I'm not sure half of this is even being used.
|
3601 |
+
$title = trim( strip_tags( $title ) );
|
3602 |
+
$title_tag_start = '<title';
|
3603 |
+
$title_tag_end = '</title';
|
3604 |
+
$start = $this->strpos( $content, $title_tag_start );
|
3605 |
+
$end = $this->strpos( $content, $title_tag_end );
|
3606 |
+
$this->title_start = $start;
|
3607 |
+
$this->title_end = $end;
|
3608 |
+
$this->orig_title = $title;
|
3609 |
+
|
3610 |
+
return preg_replace( '/<title([^>]*?)\s*>([^<]*?)<\/title\s*>/is', '<title\\1>' . preg_replace( '/(\$|\\\\)(?=\d)/', '\\\\\1', strip_tags( $title ) ) . '</title>', $content, 1 );
|
3611 |
}
|
3612 |
|
3613 |
+
function add_hooks() {
|
3614 |
+
global $aioseop_options, $aioseop_update_checker;
|
3615 |
+
|
3616 |
+
// MOVED TO MAIN PLUGIN FILE IN ORDER TO FIRE SOONS
|
3617 |
+
//$role = get_role( 'administrator' );
|
3618 |
+
//if ( is_object( $role ) ) {
|
3619 |
+
// $role->add_cap( 'aiosp_manage_seo' );
|
3620 |
+
//}
|
3621 |
+
|
3622 |
+
aioseop_update_settings_check();
|
3623 |
+
add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
|
3624 |
+
if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
|
3625 |
+
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 );
|
3626 |
}
|
3627 |
+
|
3628 |
+
if ( is_admin() ) {
|
3629 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
3630 |
+
add_action( 'admin_head', array( $this, 'add_page_icon' ) );
|
3631 |
+
add_action( 'admin_init', 'aioseop_addmycolumns', 1 );
|
3632 |
+
add_action( 'admin_init', 'aioseop_handle_ignore_notice' );
|
3633 |
+
if ( AIOSEOPPRO ) {
|
3634 |
+
if ( current_user_can( 'update_plugins' ) ) {
|
3635 |
+
add_action( 'admin_notices', array( $aioseop_update_checker, 'key_warning' ) );
|
3636 |
+
}
|
3637 |
+
add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, array(
|
3638 |
+
$aioseop_update_checker,
|
3639 |
+
'add_plugin_row',
|
3640 |
+
) );
|
3641 |
+
}
|
3642 |
+
} else {
|
3643 |
+
if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' ) {
|
3644 |
+
remove_action( 'wp_head', 'rel_canonical' );
|
3645 |
+
}
|
3646 |
+
// Analytics.
|
3647 |
+
if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
|
3648 |
+
add_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
|
3649 |
}
|
3650 |
+
add_filter( 'wp_list_pages', 'aioseop_list_pages' );
|
3651 |
+
add_action( 'wp_head', array( $this, 'wp_head' ), apply_filters( 'aioseop_wp_head_priority', 1 ) );
|
3652 |
+
add_action( 'template_redirect', array( $this, 'template_redirect' ), 0 );
|
3653 |
+
add_filter( 'wp_list_pages_excludes', 'aioseop_get_pages_start' );
|
3654 |
+
add_filter( 'get_pages', 'aioseop_get_pages' );
|
3655 |
}
|
|
|
|
|
|
|
|
|
3656 |
}
|
3657 |
|
3658 |
+
function visibility_warning() {
|
3659 |
|
3660 |
+
$aioseop_visibility_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3661 |
|
3662 |
+
if ( '0' == get_option( 'blog_public' ) && empty( $aioseop_visibility_notice_dismissed ) ) {
|
3663 |
+
|
3664 |
+
printf( '
|
3665 |
+
<div id="message" class="error notice is-dismissible aioseop-notice visibility-notice">
|
3666 |
+
<p>
|
3667 |
+
<strong>%1$s</strong>
|
3668 |
+
%2$s
|
3669 |
+
|
3670 |
+
</p>
|
3671 |
+
</div>',
|
3672 |
+
__( 'Warning: You\'re blocking access to search engines.', 'all-in-one-seo-pack' ),
|
3673 |
+
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>' ) );
|
3674 |
|
3675 |
+
} elseif ( '1' == get_option( 'blog_public' ) && ! empty( $aioseop_visibility_notice_dismissed ) ) {
|
3676 |
+
delete_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed' );
|
3677 |
+
}
|
3678 |
}
|
3679 |
|
3680 |
+
function woo_upgrade_notice() {
|
|
|
|
|
3681 |
|
3682 |
+
$aioseop_woo_upgrade_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
|
|
|
3683 |
|
3684 |
+
if ( class_exists( 'WooCommerce' ) && empty( $aioseop_woo_upgrade_notice_dismissed ) && current_user_can( 'manage_options' ) ) {
|
3685 |
+
|
3686 |
+
printf( '
|
3687 |
+
<div id="message" class="notice-info notice is-dismissible aioseop-notice woo-upgrade-notice">
|
3688 |
+
<p>
|
3689 |
+
<strong>%1$s</strong>
|
3690 |
+
%2$s
|
3691 |
+
|
3692 |
+
</p>
|
3693 |
+
</div>',
|
3694 |
+
__( 'We\'ve detected you\'re running WooCommerce.', 'all-in-one-seo-pack' ),
|
3695 |
+
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>' ) );
|
3696 |
|
3697 |
+
} elseif ( ! class_exists( 'WooCommerce' ) && ! empty( $aioseop_woo_upgrade_notice_dismissed ) ) {
|
3698 |
+
delete_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed' );
|
3699 |
+
}
|
3700 |
}
|
3701 |
|
3702 |
+
/**
|
3703 |
+
* @param $description
|
3704 |
+
*
|
3705 |
+
* @return string
|
3706 |
+
*/
|
3707 |
+
function make_unique_att_desc( $description ) {
|
3708 |
+
global $wp_query;
|
3709 |
+
if ( is_attachment() ) {
|
3710 |
+
|
3711 |
+
$url = $this->aiosp_mrt_get_url( $wp_query );
|
3712 |
+
if ( $url ) {
|
3713 |
+
$matches = array();
|
3714 |
+
preg_match_all( '/(\d+)/', $url, $matches );
|
3715 |
+
if ( is_array( $matches ) ) {
|
3716 |
+
$uniqueDesc = join( '', $matches[0] );
|
3717 |
+
}
|
3718 |
}
|
3719 |
+
$description .= ' ' . $uniqueDesc;
|
|
|
|
|
|
|
|
|
3720 |
}
|
3721 |
|
3722 |
+
return $description;
|
3723 |
+
}
|
3724 |
|
3725 |
+
function wp_head() {
|
3726 |
+
if ( ! $this->is_page_included() ) {
|
3727 |
+
return;
|
3728 |
+
}
|
3729 |
+
$opts = $this->meta_opts;
|
3730 |
+
global $aioseop_update_checker, $wp_query, $aioseop_options, $posts;
|
3731 |
+
static $aioseop_dup_counter = 0;
|
3732 |
+
$aioseop_dup_counter ++;
|
3733 |
+
if ( $aioseop_dup_counter > 1 ) {
|
3734 |
+
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";
|
3735 |
|
3736 |
+
return;
|
3737 |
+
}
|
3738 |
+
if ( is_home() && ! is_front_page() ) {
|
3739 |
+
$post = aiosp_common::get_blog_page();
|
3740 |
+
} else {
|
3741 |
+
$post = $this->get_queried_object();
|
3742 |
+
}
|
3743 |
+
$meta_string = null;
|
3744 |
+
$description = '';
|
3745 |
+
// Logging - rewrite handler check for output buffering.
|
3746 |
+
$this->check_rewrite_handler();
|
3747 |
+
if ( AIOSEOPPRO ) {
|
3748 |
+
echo "\n<!-- All in One SEO Pack Pro $this->version by Michael Torbert of Semper Fi Web Design";
|
3749 |
+
} else {
|
3750 |
+
echo "\n<!-- All in One SEO Pack $this->version by Michael Torbert of Semper Fi Web Design";
|
3751 |
+
}
|
3752 |
+
if ( $this->ob_start_detected ) {
|
3753 |
+
echo 'ob_start_detected ';
|
3754 |
+
}
|
3755 |
+
echo "[$this->title_start,$this->title_end] ";
|
3756 |
+
echo "-->\n";
|
3757 |
+
if ( AIOSEOPPRO ) {
|
3758 |
+
echo '<!-- ' . __( 'Debug String', 'all-in-one-seo-pack' ) . ': ' . $aioseop_update_checker->get_verification_code() . " -->\n";
|
3759 |
+
}
|
3760 |
+
$blog_page = aiosp_common::get_blog_page( $post );
|
3761 |
+
$save_posts = $posts;
|
3762 |
+
if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
|
3763 |
+
global $posts;
|
3764 |
+
$opts = $this->meta_opts = $this->get_current_options( array(), 'aiosp', null, $post );
|
3765 |
+
$posts = array();
|
3766 |
+
$posts[] = $post;
|
3767 |
+
}
|
3768 |
+
$posts = $save_posts;
|
3769 |
+
$description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) ); // Get the description.
|
3770 |
+
// Handle the description format.
|
3771 |
+
if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) {
|
3772 |
+
$description = $this->trim_description( $description );
|
3773 |
+
if ( ! isset( $meta_string ) ) {
|
3774 |
+
$meta_string = '';
|
3775 |
}
|
3776 |
+
// Description format.
|
3777 |
+
$description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) );
|
3778 |
+
$desc_attr = '';
|
3779 |
+
if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
|
3780 |
+
$desc_attr = 'itemprop="description"';
|
|
|
3781 |
}
|
3782 |
+
$desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr );
|
3783 |
+
$meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3784 |
}
|
3785 |
+
// Get the keywords.
|
3786 |
+
$togglekeywords = 0;
|
3787 |
+
if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) {
|
3788 |
+
$togglekeywords = $aioseop_options['aiosp_togglekeywords'];
|
3789 |
+
}
|
3790 |
+
if ( $togglekeywords == 0 && ! ( is_front_page() && is_paged() ) ) {
|
3791 |
+
$keywords = $this->get_main_keywords();
|
3792 |
+
$keywords = $this->apply_cf_fields( $keywords );
|
3793 |
+
$keywords = apply_filters( 'aioseop_keywords', $keywords );
|
3794 |
+
|
3795 |
+
if ( isset( $keywords ) && ! empty( $keywords ) ) {
|
3796 |
+
if ( isset( $meta_string ) ) {
|
3797 |
+
$meta_string .= "\n";
|
3798 |
+
}
|
3799 |
+
$keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
|
3800 |
+
$key_attr = '';
|
3801 |
+
if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
|
3802 |
+
$key_attr = 'itemprop="keywords"';
|
3803 |
+
}
|
3804 |
+
$key_attr = apply_filters( 'aioseop_keywords_attributes', $key_attr );
|
3805 |
+
$meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
|
3806 |
+
}
|
3807 |
+
}
|
3808 |
+
// Handle noindex, nofollow - robots meta.
|
3809 |
+
$robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
|
3810 |
+
if ( ! empty( $robots_meta ) ) {
|
3811 |
+
$meta_string .= '<meta name="robots" content="' . esc_attr( $robots_meta ) . '" />' . "\n";
|
3812 |
+
}
|
3813 |
+
// Handle site verification.
|
3814 |
+
if ( is_front_page() ) {
|
3815 |
+
foreach (
|
3816 |
+
array(
|
3817 |
+
'google' => 'google-site-verification',
|
3818 |
+
'bing' => 'msvalidate.01',
|
3819 |
+
'pinterest' => 'p:domain_verify',
|
3820 |
+
) as $k => $v
|
3821 |
+
) {
|
3822 |
+
if ( ! empty( $aioseop_options["aiosp_{$k}_verify"] ) ) {
|
3823 |
+
$meta_string .= '<meta name="' . $v . '" content="' . trim( strip_tags( $aioseop_options["aiosp_{$k}_verify"] ) ) . '" />' . "\n";
|
3824 |
+
}
|
3825 |
+
}
|
3826 |
|
3827 |
+
// Sitelinks search.
|
3828 |
+
if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) || ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
|
3829 |
+
$meta_string .= $this->sitelinks_search_box() . "\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3830 |
}
|
3831 |
}
|
3832 |
+
// Handle extra meta fields.
|
3833 |
+
foreach ( array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) {
|
3834 |
+
if ( ! empty( $aioseop_options["aiosp_{$meta}_tags"] ) ) {
|
3835 |
+
$$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags"] ), ENT_QUOTES );
|
3836 |
+
} else {
|
3837 |
+
$$meta = '';
|
3838 |
+
}
|
3839 |
+
}
|
3840 |
+
if ( is_page() && isset( $page_meta ) && ! empty( $page_meta ) && ( ! is_front_page() || empty( $front_meta ) ) ) {
|
3841 |
+
if ( isset( $meta_string ) ) {
|
3842 |
+
$meta_string .= "\n";
|
3843 |
+
}
|
3844 |
+
$meta_string .= $page_meta;
|
3845 |
+
}
|
3846 |
+
if ( is_single() && isset( $post_meta ) && ! empty( $post_meta ) ) {
|
3847 |
+
if ( isset( $meta_string ) ) {
|
3848 |
+
$meta_string .= "\n";
|
3849 |
+
}
|
3850 |
+
$meta_string .= $post_meta;
|
3851 |
+
}
|
3852 |
+
// Handle authorship.
|
3853 |
+
$authorship = $this->get_google_authorship( $post );
|
3854 |
+
$publisher = apply_filters( 'aioseop_google_publisher', $authorship['publisher'] );
|
3855 |
+
if ( ! empty( $publisher ) ) {
|
3856 |
+
$meta_string = '<link rel="publisher" href="' . esc_url( $publisher ) . '" />' . "\n" . $meta_string;
|
3857 |
+
}
|
3858 |
+
$author = apply_filters( 'aioseop_google_author', $authorship['author'] );
|
3859 |
+
if ( ! empty( $author ) ) {
|
3860 |
+
$meta_string = '<link rel="author" href="' . esc_url( $author ) . '" />' . "\n" . $meta_string;
|
3861 |
+
}
|
3862 |
|
3863 |
+
if ( is_front_page() && ! empty( $front_meta ) ) {
|
3864 |
+
if ( isset( $meta_string ) ) {
|
3865 |
+
$meta_string .= "\n";
|
3866 |
+
}
|
3867 |
+
$meta_string .= $front_meta;
|
|
|
3868 |
} else {
|
3869 |
+
if ( is_home() && ! empty( $home_meta ) ) {
|
3870 |
+
if ( isset( $meta_string ) ) {
|
3871 |
+
$meta_string .= "\n";
|
3872 |
+
}
|
3873 |
+
$meta_string .= $home_meta;
|
3874 |
+
}
|
3875 |
}
|
3876 |
+
$prev_next = $this->get_prev_next_links( $post );
|
3877 |
+
$prev = apply_filters( 'aioseop_prev_link', $prev_next['prev'] );
|
3878 |
+
$next = apply_filters( 'aioseop_next_link', $prev_next['next'] );
|
3879 |
+
if ( ! empty( $prev ) ) {
|
3880 |
+
$meta_string .= "<link rel='prev' href='" . esc_url( $prev ) . "' />\n";
|
3881 |
+
}
|
3882 |
+
if ( ! empty( $next ) ) {
|
3883 |
+
$meta_string .= "<link rel='next' href='" . esc_url( $next ) . "' />\n";
|
3884 |
+
}
|
3885 |
+
if ( $meta_string != null ) {
|
3886 |
+
echo "$meta_string\n";
|
3887 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3888 |
|
3889 |
+
// Handle canonical links.
|
3890 |
+
$show_page = true;
|
3891 |
+
if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
|
3892 |
+
$show_page = false;
|
|
|
|
|
|
|
|
|
3893 |
}
|
|
|
|
|
|
|
|
|
3894 |
|
3895 |
+
if ( $aioseop_options['aiosp_can'] ) {
|
3896 |
+
$url = '';
|
3897 |
+
if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) {
|
3898 |
+
$url = $opts['aiosp_custom_link'];
|
3899 |
+
}
|
3900 |
+
if ( empty( $url ) ) {
|
3901 |
+
$url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
|
3902 |
+
}
|
3903 |
|
3904 |
+
$url = $this->validate_url_scheme( $url );
|
3905 |
+
|
3906 |
+
$url = apply_filters( 'aioseop_canonical_url', $url );
|
3907 |
+
if ( ! empty( $url ) ) {
|
3908 |
+
echo '<link rel="canonical" href="' . esc_url( $url ) . '" />' . "\n";
|
3909 |
+
}
|
3910 |
+
}
|
3911 |
+
do_action( 'aioseop_modules_wp_head' );
|
3912 |
if ( AIOSEOPPRO ) {
|
3913 |
+
echo "<!-- /all in one seo pack pro -->\n";
|
|
|
|
|
3914 |
} else {
|
3915 |
+
echo "<!-- /all in one seo pack -->\n";
|
3916 |
}
|
|
|
|
|
3917 |
}
|
3918 |
|
3919 |
+
/**
|
3920 |
+
* Check rewrite handler.
|
3921 |
+
*/
|
3922 |
+
function check_rewrite_handler() {
|
3923 |
+
global $aioseop_options;
|
3924 |
+
|
3925 |
+
$force_rewrites = 1;
|
3926 |
+
if ( isset( $aioseop_options['aiosp_force_rewrites'] ) ) {
|
3927 |
+
$force_rewrites = $aioseop_options['aiosp_force_rewrites'];
|
3928 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3929 |
|
3930 |
+
if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) && $force_rewrites ) {
|
3931 |
+
// Make the title rewrite as short as possible.
|
3932 |
+
if ( function_exists( 'ob_list_handlers' ) ) {
|
3933 |
+
$active_handlers = ob_list_handlers();
|
3934 |
+
} else {
|
3935 |
+
$active_handlers = array();
|
3936 |
+
}
|
3937 |
+
if ( sizeof( $active_handlers ) > 0 &&
|
3938 |
+
$this->strtolower( $active_handlers[ sizeof( $active_handlers ) - 1 ] ) ==
|
3939 |
+
$this->strtolower( 'All_in_One_SEO_Pack::output_callback_for_title' )
|
3940 |
+
) {
|
3941 |
+
ob_end_flush();
|
3942 |
+
} else {
|
3943 |
+
$this->log( 'another plugin interfering?' );
|
3944 |
+
// If we get here there *could* be trouble with another plugin :(.
|
3945 |
+
$this->ob_start_detected = true;
|
3946 |
+
if ( $this->option_isset( 'rewrite_titles' ) ) { // Try alternate method -- pdb.
|
3947 |
+
$aioseop_options['aiosp_rewrite_titles'] = 0;
|
3948 |
+
$force_rewrites = 0;
|
3949 |
+
add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
|
3950 |
+
}
|
3951 |
+
if ( function_exists( 'ob_list_handlers' ) ) {
|
3952 |
+
foreach ( ob_list_handlers() as $handler ) {
|
3953 |
+
$this->log( "detected output handler $handler" );
|
3954 |
+
}
|
3955 |
}
|
3956 |
}
|
3957 |
}
|
|
|
3958 |
}
|
3959 |
|
3960 |
+
/**
|
3961 |
+
* @param $description
|
3962 |
+
*
|
3963 |
+
* @return mixed|string
|
3964 |
+
*/
|
3965 |
+
function trim_description( $description ) {
|
3966 |
+
$description = trim( wp_strip_all_tags( $description ) );
|
3967 |
+
$description = str_replace( '"', '"', $description );
|
3968 |
+
$description = str_replace( "\r\n", ' ', $description );
|
3969 |
+
$description = str_replace( "\n", ' ', $description );
|
3970 |
|
3971 |
+
return $description;
|
|
|
|
|
|
|
|
|
|
|
3972 |
}
|
3973 |
|
3974 |
+
/**
|
3975 |
+
* @param $description
|
3976 |
+
* @param null $post
|
3977 |
+
*
|
3978 |
+
* @return mixed
|
3979 |
+
*/
|
3980 |
+
function apply_description_format( $description, $post = null ) {
|
3981 |
+
global $aioseop_options;
|
3982 |
+
$description_format = $aioseop_options['aiosp_description_format'];
|
3983 |
+
if ( ! isset( $description_format ) || empty( $description_format ) ) {
|
3984 |
+
$description_format = '%description%';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3985 |
}
|
3986 |
+
$description = str_replace( '%description%', apply_filters( 'aioseop_description_override', $description ), $description_format );
|
3987 |
+
if ( strpos( $description, '%blog_title%' ) !== false ) {
|
3988 |
+
$description = str_replace( '%blog_title%', get_bloginfo( 'name' ), $description );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3989 |
}
|
3990 |
+
if ( strpos( $description, '%blog_description%' ) !== false ) {
|
3991 |
+
$description = str_replace( '%blog_description%', get_bloginfo( 'description' ), $description );
|
3992 |
+
}
|
3993 |
+
if ( strpos( $description, '%wp_title%' ) !== false ) {
|
3994 |
+
$description = str_replace( '%wp_title%', $this->get_original_title(), $description );
|
3995 |
+
}
|
3996 |
+
if ( strpos( $description, '%post_title%' ) !== false ) {
|
3997 |
+
$description = str_replace( '%post_title%', $this->get_aioseop_title( $post ), $description );
|
3998 |
+
}
|
3999 |
+
|
4000 |
+
|
4001 |
+
/*this was intended to make attachment descriptions unique if pulling from the parent... let's remove it and see if there are any problems
|
4002 |
+
*on the roadmap is to have a better hierarchy for attachment description pulling
|
4003 |
+
* if ($aioseop_options['aiosp_can']) $description = $this->make_unique_att_desc($description);
|
4004 |
+
*/
|
4005 |
+
|
4006 |
+
return $description;
|
4007 |
}
|
4008 |
|
4009 |
+
/**
|
4010 |
+
* @return string
|
4011 |
+
*/
|
4012 |
+
function get_robots_meta() {
|
4013 |
global $aioseop_options;
|
4014 |
+
$opts = $this->meta_opts;
|
4015 |
+
$page = $this->get_page_number();
|
4016 |
+
$robots_meta = $tax_noindex = '';
|
4017 |
+
if ( isset( $aioseop_options['aiosp_tax_noindex'] ) ) {
|
4018 |
+
$tax_noindex = $aioseop_options['aiosp_tax_noindex'];
|
4019 |
+
}
|
4020 |
+
|
4021 |
+
if ( empty( $tax_noindex ) || ! is_array( $tax_noindex ) ) {
|
4022 |
+
$tax_noindex = array();
|
4023 |
+
}
|
4024 |
+
|
4025 |
+
$aiosp_noindex = $aiosp_nofollow = $aiosp_noodp = $aiosp_noydir = '';
|
4026 |
+
$noindex = 'index';
|
4027 |
+
$nofollow = 'follow';
|
4028 |
+
if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax()
|
4029 |
+
&& ( ( is_date() && ! empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && ! empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
|
4030 |
+
|| ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) )
|
4031 |
+
|| ( is_search() && ! empty( $aioseop_options['aiosp_search_noindex'] ) )
|
4032 |
+
|| ( is_404() && ! empty( $aioseop_options['aiosp_404_noindex'] ) )
|
4033 |
+
|| ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
|
4034 |
+
) {
|
4035 |
+
$noindex = 'noindex';
|
4036 |
+
} elseif ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) {
|
4037 |
+
$post_type = get_post_type();
|
4038 |
+
if ( ! empty( $opts ) ) {
|
4039 |
+
$aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
|
4040 |
+
$aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
|
4041 |
+
$aiosp_noodp = htmlspecialchars( stripslashes( $opts['aiosp_noodp'] ) );
|
4042 |
+
$aiosp_noydir = htmlspecialchars( stripslashes( $opts['aiosp_noydir'] ) );
|
4043 |
+
}
|
4044 |
+
if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || ! empty( $aioseop_options['aiosp_cpostnoindex'] )
|
4045 |
+
|| ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_cpostnoodp'] ) || ! empty( $aioseop_options['aiosp_cpostnoydir'] )
|
4046 |
+
|| ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
|
4047 |
+
) {
|
4048 |
+
if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) ||
|
4049 |
+
( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) )
|
4050 |
+
) {
|
4051 |
+
$noindex = 'noindex';
|
4052 |
+
}
|
4053 |
+
if ( ( $aiosp_nofollow == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && $page > 1 ) ||
|
4054 |
+
( ( $aiosp_nofollow == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) )
|
4055 |
+
) {
|
4056 |
+
$nofollow = 'nofollow';
|
4057 |
+
}
|
4058 |
+
if ( ( $aiosp_noodp == 'on' ) || ( empty( $aiosp_noodp ) && ( ! empty( $aioseop_options['aiosp_cpostnoodp'] ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoodp'] ) ) ) ) {
|
4059 |
+
$aiosp_noodp = true;
|
4060 |
+
} else {
|
4061 |
+
$aiosp_noodp = false;
|
4062 |
+
}
|
4063 |
+
if ( ( $aiosp_noydir == 'on' ) || ( empty( $aiosp_noydir ) && ( ! empty( $aioseop_options['aiosp_cpostnoydir'] ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoydir'] ) ) ) ) {
|
4064 |
+
$aiosp_noydir = true;
|
4065 |
+
} else {
|
4066 |
+
$aiosp_noydir = false;
|
4067 |
+
}
|
4068 |
+
}
|
4069 |
+
}
|
4070 |
+
if ( ! empty( $aioseop_options['aiosp_noodp'] ) && $aioseop_options['aiosp_noodp'] ) {
|
4071 |
+
$aiosp_noodp = true;
|
4072 |
}
|
4073 |
+
if ( ! empty( $aioseop_options['aiosp_noydir'] ) && $aioseop_options['aiosp_noydir'] ) {
|
4074 |
+
$aiosp_noydir = true;
|
4075 |
+
}
|
4076 |
+
if ( $aiosp_noodp ) {
|
4077 |
+
$nofollow .= ',noodp';
|
4078 |
+
}
|
4079 |
+
if ( $aiosp_noydir ) {
|
4080 |
+
$nofollow .= ',noydir';
|
4081 |
+
}
|
4082 |
+
$robots_meta = $noindex . ',' . $nofollow;
|
4083 |
+
if ( $robots_meta == 'index,follow' ) {
|
4084 |
+
$robots_meta = '';
|
4085 |
+
}
|
4086 |
+
|
4087 |
+
return $robots_meta;
|
4088 |
}
|
4089 |
|
4090 |
+
/**
|
4091 |
+
* @return mixed|void
|
4092 |
+
*/
|
4093 |
+
function sitelinks_search_box() {
|
4094 |
global $aioseop_options;
|
4095 |
+
$home_url = esc_url( get_home_url() );
|
4096 |
+
$name_block = $search_block = '';
|
4097 |
+
if ( ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
|
4098 |
+
if ( ! empty( $aioseop_options['aiosp_google_specify_site_name'] ) ) {
|
4099 |
+
$blog_name = $aioseop_options['aiosp_google_specify_site_name'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4100 |
} else {
|
4101 |
+
$blog_name = get_bloginfo( 'name' );
|
|
|
|
|
4102 |
}
|
4103 |
+
$blog_name = esc_attr( $blog_name );
|
4104 |
+
$name_block = <<<EOF
|
4105 |
+
"name": "{$blog_name}",
|
4106 |
+
EOF;
|
4107 |
+
}
|
4108 |
|
4109 |
+
if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) ) {
|
4110 |
+
$search_block = <<<EOF
|
4111 |
+
"potentialAction": {
|
4112 |
+
"@type": "SearchAction",
|
4113 |
+
"target": "{$home_url}/?s={search_term}",
|
4114 |
+
"query-input": "required name=search_term"
|
4115 |
+
},
|
4116 |
+
EOF;
|
4117 |
+
}
|
4118 |
|
4119 |
+
$search_box = <<<EOF
|
4120 |
+
<script type="application/ld+json">
|
4121 |
+
{
|
4122 |
+
"@context": "http://schema.org",
|
4123 |
+
"@type": "WebSite",
|
4124 |
+
EOF;
|
4125 |
+
if ( ! empty( $name_block ) ) {
|
4126 |
+
$search_box .= $name_block;
|
4127 |
+
}
|
4128 |
+
if ( ! empty( $search_block ) ) {
|
4129 |
+
$search_box .= $search_block;
|
4130 |
+
}
|
4131 |
+
$search_box .= <<<EOF
|
4132 |
+
"url": "{$home_url}/"
|
4133 |
+
}
|
4134 |
+
</script>
|
4135 |
+
EOF;
|
4136 |
|
4137 |
+
return apply_filters( 'aiosp_sitelinks_search_box', $search_box );
|
4138 |
+
}
|
|
|
|
|
|
|
|
|
|
|
4139 |
|
4140 |
+
/**
|
4141 |
+
* @param $post
|
4142 |
+
*
|
4143 |
+
* @return array
|
4144 |
+
*/
|
4145 |
+
function get_google_authorship( $post ) {
|
4146 |
+
global $aioseop_options;
|
4147 |
+
$page = $this->get_page_number();
|
4148 |
+
// Handle authorship.
|
4149 |
+
$googleplus = $publisher = $author = '';
|
4150 |
|
4151 |
+
if ( ! empty( $post ) && isset( $post->post_author ) && empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
|
4152 |
+
$googleplus = get_the_author_meta( 'googleplus', $post->post_author );
|
4153 |
+
}
|
4154 |
|
4155 |
+
if ( empty( $googleplus ) && ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
|
4156 |
+
$googleplus = $aioseop_options['aiosp_google_publisher'];
|
4157 |
+
}
|
|
|
4158 |
|
4159 |
+
if ( is_front_page() && ( $page < 2 ) ) {
|
4160 |
+
if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
|
4161 |
+
$publisher = $aioseop_options['aiosp_google_publisher'];
|
4162 |
}
|
4163 |
|
4164 |
+
if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) ) {
|
4165 |
+
if ( empty( $aioseop_options['aiosp_google_enable_publisher'] ) ) {
|
4166 |
+
$publisher = '';
|
4167 |
+
} elseif ( ! empty( $aioseop_options['aiosp_google_specify_publisher'] ) ) {
|
4168 |
+
$publisher = $aioseop_options['aiosp_google_specify_publisher'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4170 |
}
|
4171 |
+
}
|
4172 |
+
if ( is_singular() && ( ! empty( $googleplus ) ) ) {
|
4173 |
+
$author = $googleplus;
|
4174 |
+
} else if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
|
4175 |
+
$author = $aioseop_options['aiosp_google_publisher'];
|
4176 |
+
}
|
4177 |
+
|
4178 |
+
if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) {
|
4179 |
+
if ( empty( $aioseop_options['aiosp_google_author_location'] ) ) {
|
4180 |
+
$aioseop_options['aiosp_google_author_location'] = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4181 |
}
|
4182 |
+
if ( is_front_page() && ! in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) {
|
4183 |
+
$author = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4184 |
} else {
|
4185 |
+
if ( in_array( 'all', $aioseop_options['aiosp_google_author_location'] ) ) {
|
4186 |
+
if ( is_singular() && ! is_singular( $aioseop_options['aiosp_google_author_location'] ) ) {
|
4187 |
+
$author = '';
|
4188 |
+
}
|
4189 |
+
} else {
|
4190 |
+
if ( ! is_singular( $aioseop_options['aiosp_google_author_location'] ) ) {
|
4191 |
+
$author = '';
|
4192 |
}
|
4193 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4195 |
}
|
4196 |
|
4197 |
+
return array( 'publisher' => $publisher, 'author' => $author );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4198 |
}
|
4199 |
|
4200 |
/**
|
4201 |
+
* @param null $post
|
4202 |
+
*
|
4203 |
+
* @return array
|
4204 |
*/
|
4205 |
+
function get_prev_next_links( $post = null ) {
|
4206 |
+
$prev = $next = '';
|
4207 |
+
$page = $this->get_page_number();
|
4208 |
+
if ( is_home() || is_archive() || is_paged() ) {
|
4209 |
+
global $wp_query;
|
4210 |
+
$max_page = $wp_query->max_num_pages;
|
4211 |
+
if ( $page > 1 ) {
|
4212 |
+
$prev = get_previous_posts_page_link();
|
4213 |
+
}
|
4214 |
+
if ( $page < $max_page ) {
|
4215 |
+
$paged = $GLOBALS['paged'];
|
4216 |
+
if ( ! is_single() ) {
|
4217 |
+
if ( ! $paged ) {
|
4218 |
+
$paged = 1;
|
4219 |
+
}
|
4220 |
+
$nextpage = intval( $paged ) + 1;
|
4221 |
+
if ( ! $max_page || $max_page >= $nextpage ) {
|
4222 |
+
$next = get_pagenum_link( $nextpage );
|
4223 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4224 |
}
|
4225 |
+
}
|
4226 |
+
} else if ( is_page() || is_single() ) {
|
4227 |
+
$numpages = 1;
|
4228 |
+
$multipage = 0;
|
4229 |
+
$page = get_query_var( 'page' );
|
4230 |
+
if ( ! $page ) {
|
4231 |
+
$page = 1;
|
4232 |
+
}
|
4233 |
+
if ( is_single() || is_page() || is_feed() ) {
|
4234 |
+
$more = 1;
|
4235 |
+
}
|
4236 |
+
$content = $post->post_content;
|
4237 |
+
if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
|
4238 |
+
if ( $page > 1 ) {
|
4239 |
+
$more = 1;
|
4240 |
+
}
|
4241 |
+
$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
|
4242 |
+
$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
|
4243 |
+
$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
|
4244 |
+
// Ignore nextpage at the beginning of the content.
|
4245 |
+
if ( 0 === strpos( $content, '<!--nextpage-->' ) ) {
|
4246 |
+
$content = substr( $content, 15 );
|
4247 |
+
}
|
4248 |
+
$pages = explode( '<!--nextpage-->', $content );
|
4249 |
+
$numpages = count( $pages );
|
4250 |
+
if ( $numpages > 1 ) {
|
4251 |
+
$multipage = 1;
|
4252 |
}
|
4253 |
}
|
4254 |
+
if ( ! empty( $page ) ) {
|
4255 |
+
if ( $page > 1 ) {
|
4256 |
+
$prev = _wp_link_page( $page - 1 );
|
4257 |
+
}
|
4258 |
+
if ( $page + 1 <= $numpages ) {
|
4259 |
+
$next = _wp_link_page( $page + 1 );
|
4260 |
+
}
|
4261 |
+
}
|
4262 |
+
if ( ! empty( $prev ) ) {
|
4263 |
+
$prev = $this->substr( $prev, 9, - 2 );
|
4264 |
+
}
|
4265 |
+
if ( ! empty( $next ) ) {
|
4266 |
+
$next = $this->substr( $next, 9, - 2 );
|
4267 |
}
|
4268 |
}
|
|
|
|
|
|
|
4269 |
|
4270 |
+
return array( 'prev' => $prev, 'next' => $next );
|
|
|
|
|
|
|
|
|
4271 |
}
|
4272 |
|
4273 |
+
/**
|
4274 |
+
*
|
4275 |
+
* Validates whether the url should be https or http.
|
4276 |
+
*
|
4277 |
+
* Mainly we're just using this for canonical URLS, but eventually it may be useful for other things
|
4278 |
+
*
|
4279 |
+
* @param $url
|
4280 |
+
*
|
4281 |
+
* @return string $url
|
4282 |
+
*
|
4283 |
+
* @since 2.3.5
|
4284 |
+
*/
|
4285 |
+
function validate_url_scheme( $url ) {
|
4286 |
|
4287 |
+
// TODO we should check for the site setting in the case of auto.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4288 |
|
4289 |
+
global $aioseop_options;
|
4290 |
+
|
4291 |
+
if( ! isset( $aioseop_options['aiosp_can_set_protocol'] ) ){
|
4292 |
+
return $url; // Just send the url back if there's nothing there.
|
4293 |
+
}
|
4294 |
+
|
4295 |
+
if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) {
|
4296 |
+
$url = preg_replace( '/^https:/i', 'http:', $url );
|
4297 |
+
}
|
4298 |
+
if ( $aioseop_options['aiosp_can_set_protocol'] == 'https' ) {
|
4299 |
+
$url = preg_replace( '/^http:/i', 'https:', $url );
|
4300 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4301 |
|
4302 |
+
return $url;
|
|
|
|
|
|
|
|
|
|
|
|
|
4303 |
}
|
4304 |
|
4305 |
/**
|
4306 |
+
* @param $options
|
4307 |
+
* @param $location
|
4308 |
+
* @param $settings
|
4309 |
+
*
|
4310 |
+
* @return mixed
|
4311 |
*/
|
4312 |
+
function override_options( $options, $location, $settings ) {
|
4313 |
+
if ( class_exists( 'DOMDocument' ) ) {
|
4314 |
+
$options['aiosp_google_connect'] = $settings['aiosp_google_connect']['default'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4315 |
}
|
4316 |
+
|
4317 |
+
return $options;
|
4318 |
+
}
|
4319 |
+
|
4320 |
+
function aiosp_google_analytics() {
|
4321 |
+
global $aioseop_options;
|
4322 |
+
$analytics = '';
|
4323 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_exclude_users'] ) ) {
|
4324 |
+
if ( is_user_logged_in() ) {
|
4325 |
+
global $current_user;
|
4326 |
+
if ( empty( $current_user ) ) {
|
4327 |
+
wp_get_current_user();
|
4328 |
+
}
|
4329 |
+
if ( ! empty( $current_user ) ) {
|
4330 |
+
$intersect = array_intersect( $aioseop_options['aiosp_ga_exclude_users'], $current_user->roles );
|
4331 |
+
if ( ! empty( $intersect ) ) {
|
4332 |
+
return;
|
4333 |
+
}
|
4334 |
+
}
|
4335 |
+
}
|
4336 |
}
|
4337 |
+
if ( ! empty( $aioseop_options['aiosp_google_analytics_id'] ) ) {
|
4338 |
+
ob_start();
|
4339 |
+
$analytics = $this->universal_analytics();
|
4340 |
+
echo $analytics;
|
4341 |
+
if ( empty( $analytics ) ) {
|
4342 |
+
?>
|
4343 |
+
<script type="text/javascript">
|
4344 |
+
var _gaq = _gaq || [];
|
4345 |
+
<?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
|
4346 |
+
?> var pluginUrl =
|
4347 |
+
'//www.google-analytics.com/plugins/ga/inpage_linkid.js';
|
4348 |
+
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
|
4349 |
+
<?php
|
4350 |
+
}
|
4351 |
+
?> _gaq.push(['_setAccount', '<?php
|
4352 |
+
echo $aioseop_options['aiosp_google_analytics_id'];
|
4353 |
+
?>']);
|
4354 |
+
<?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
|
4355 |
+
?> _gaq.push(['_gat._anonymizeIp']);
|
4356 |
+
<?php
|
4357 |
+
}
|
4358 |
+
?>
|
4359 |
+
<?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
|
4360 |
+
?> _gaq.push(['_setAllowLinker', true]);
|
4361 |
+
<?php
|
4362 |
+
}
|
4363 |
+
?>
|
4364 |
+
<?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
|
4365 |
+
$domain = $this->get_analytics_domain();
|
4366 |
+
?> _gaq.push(['_setDomainName', '<?php echo $domain; ?>']);
|
4367 |
+
<?php
|
4368 |
+
}
|
4369 |
+
?> _gaq.push(['_trackPageview']);
|
4370 |
+
(function () {
|
4371 |
+
var ga = document.createElement('script');
|
4372 |
+
ga.type = 'text/javascript';
|
4373 |
+
ga.async = true;
|
4374 |
+
<?php
|
4375 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
|
4376 |
+
?> ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
|
4377 |
+
<?php
|
4378 |
+
} else {
|
4379 |
+
?> ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
4380 |
+
<?php
|
4381 |
}
|
4382 |
+
?> var s = document.getElementsByTagName('script')[0];
|
4383 |
+
s.parentNode.insertBefore(ga, s);
|
4384 |
+
})();
|
4385 |
+
</script>
|
4386 |
+
<?php
|
4387 |
+
}
|
4388 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && $aioseop_options['aiosp_ga_track_outbound_links'] ) { ?>
|
4389 |
+
<script type="text/javascript">
|
4390 |
+
function recordOutboundLink(link, category, action) {
|
4391 |
+
<?php if ( ! empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { ?>
|
4392 |
+
ga('send', 'event', category, action);
|
4393 |
+
<?php }
|
4394 |
+
if ( empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) { ?>
|
4395 |
+
_gat._getTrackerByName()._trackEvent(category, action);
|
4396 |
+
<?php } ?>
|
4397 |
+
if (link.target == '_blank') return true;
|
4398 |
+
setTimeout('document.location = "' + link.href + '"', 100);
|
4399 |
+
return false;
|
4400 |
+
}
|
4401 |
+
/* use regular Javascript for this */
|
4402 |
+
function getAttr(ele, attr) {
|
4403 |
+
var result = (ele.getAttribute && ele.getAttribute(attr)) || null;
|
4404 |
+
if (!result) {
|
4405 |
+
var attrs = ele.attributes;
|
4406 |
+
var length = attrs.length;
|
4407 |
+
for (var i = 0; i < length; i++)
|
4408 |
+
if (attr[i].nodeName === attr) result = attr[i].nodeValue;
|
4409 |
+
}
|
4410 |
+
return result;
|
4411 |
}
|
4412 |
|
4413 |
+
function aiosp_addLoadEvent(func) {
|
4414 |
+
var oldonload = window.onload;
|
4415 |
+
if (typeof window.onload != 'function') {
|
4416 |
+
window.onload = func;
|
4417 |
+
} else {
|
4418 |
+
window.onload = function () {
|
4419 |
+
if (oldonload) {
|
4420 |
+
oldonload();
|
4421 |
+
}
|
4422 |
+
func();
|
4423 |
+
}
|
4424 |
+
}
|
4425 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4426 |
|
4427 |
+
function aiosp_addEvent(element, evnt, funct) {
|
4428 |
+
if (element.attachEvent)
|
4429 |
+
return element.attachEvent('on' + evnt, funct);
|
4430 |
+
else
|
4431 |
+
return element.addEventListener(evnt, funct, false);
|
4432 |
+
}
|
|
|
|
|
4433 |
|
4434 |
+
aiosp_addLoadEvent(function () {
|
4435 |
+
var links = document.getElementsByTagName('a');
|
4436 |
+
for (var x = 0; x < links.length; x++) {
|
4437 |
+
if (typeof links[x] == 'undefined') continue;
|
4438 |
+
aiosp_addEvent(links[x], 'onclick', function () {
|
4439 |
+
var mydomain = new RegExp(document.domain, 'i');
|
4440 |
+
href = getAttr(this, 'href');
|
4441 |
+
if (href && href.toLowerCase().indexOf('http') === 0 && !mydomain.test(href)) {
|
4442 |
+
recordOutboundLink(this, 'Outbound Links', href);
|
4443 |
+
}
|
4444 |
+
});
|
4445 |
+
}
|
4446 |
+
});
|
4447 |
+
</script>
|
4448 |
+
<?php
|
4449 |
}
|
4450 |
+
$analytics = ob_get_clean();
|
4451 |
+
}
|
4452 |
+
echo apply_filters( 'aiosp_google_analytics', $analytics );
|
4453 |
}
|
4454 |
|
4455 |
+
/**
|
4456 |
+
* @return string
|
4457 |
+
*/
|
4458 |
+
function universal_analytics() {
|
4459 |
+
global $aioseop_options;
|
4460 |
+
$analytics = '';
|
4461 |
+
if ( ! empty( $aioseop_options['aiosp_ga_use_universal_analytics'] ) ) {
|
4462 |
+
$allow_linker = $cookie_domain = $domain = $addl_domains = $domain_list = '';
|
4463 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) ) {
|
4464 |
+
$cookie_domain = $this->get_analytics_domain();
|
4465 |
+
}
|
4466 |
+
if ( ! empty( $cookie_domain ) ) {
|
4467 |
+
$cookie_domain = esc_js( $cookie_domain );
|
4468 |
+
$cookie_domain = "'cookieDomain': '{$cookie_domain}'";
|
4469 |
+
}
|
4470 |
+
if ( empty( $cookie_domain ) ) {
|
4471 |
+
$domain = ", 'auto'";
|
4472 |
+
}
|
4473 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
|
4474 |
+
$allow_linker = "'allowLinker': true";
|
4475 |
+
if ( ! empty( $aioseop_options['aiosp_ga_addl_domains'] ) ) {
|
4476 |
+
$addl_domains = trim( $aioseop_options['aiosp_ga_addl_domains'] );
|
4477 |
+
$addl_domains = preg_split( '/[\s,]+/', $addl_domains );
|
4478 |
+
if ( ! empty( $addl_domains ) ) {
|
4479 |
+
foreach ( $addl_domains as $d ) {
|
4480 |
+
$d = $this->sanitize_domain( $d );
|
4481 |
+
if ( ! empty( $d ) ) {
|
4482 |
+
if ( ! empty( $domain_list ) ) {
|
4483 |
+
$domain_list .= ', ';
|
4484 |
+
}
|
4485 |
+
$domain_list .= "'" . $d . "'";
|
4486 |
+
}
|
4487 |
+
}
|
4488 |
+
}
|
4489 |
+
}
|
4490 |
+
}
|
4491 |
+
$extra_options = '';
|
4492 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
|
4493 |
+
$extra_options .= "ga('require', 'displayfeatures');";
|
4494 |
+
}
|
4495 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_enhanced_ecommerce'] ) ) {
|
4496 |
+
if ( ! empty( $extra_options ) ) {
|
4497 |
+
$extra_options .= "\n\t\t\t";
|
4498 |
+
}
|
4499 |
+
$extra_options .= "ga('require', 'ec');";
|
4500 |
+
}
|
4501 |
+
if ( ! empty( $domain_list ) ) {
|
4502 |
+
if ( ! empty( $extra_options ) ) {
|
4503 |
+
$extra_options .= "\n\t\t\t";
|
4504 |
+
}
|
4505 |
+
$extra_options .= "ga('require', 'linker');\n\t\t\tga('linker:autoLink', [{$domain_list}] );";
|
4506 |
+
}
|
4507 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
|
4508 |
+
if ( ! empty( $extra_options ) ) {
|
4509 |
+
$extra_options .= "\n\t\t\t";
|
4510 |
+
}
|
4511 |
+
$extra_options .= "ga('require', 'linkid', 'linkid.js');";
|
4512 |
+
}
|
4513 |
+
|
4514 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
|
4515 |
+
if ( ! empty( $extra_options ) ) {
|
4516 |
+
$extra_options .= "\n\t\t\t";
|
4517 |
+
}
|
4518 |
+
$extra_options .= "ga('set', 'anonymizeIp', true);";
|
4519 |
+
}
|
4520 |
+
$js_options = array();
|
4521 |
+
foreach ( array( 'cookie_domain', 'allow_linker' ) as $opts ) {
|
4522 |
+
if ( ! empty( $$opts ) ) {
|
4523 |
+
$js_options[] = $$opts;
|
4524 |
+
}
|
4525 |
+
}
|
4526 |
+
if ( ! empty( $js_options ) ) {
|
4527 |
+
$js_options = join( ',', $js_options );
|
4528 |
+
$js_options = ', { ' . $js_options . ' } ';
|
4529 |
+
} else {
|
4530 |
+
$js_options = '';
|
4531 |
+
}
|
4532 |
+
$analytics_id = esc_js( $aioseop_options['aiosp_google_analytics_id'] );
|
4533 |
+
$analytics = <<<EOF
|
4534 |
+
<script>
|
4535 |
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
4536 |
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
4537 |
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
4538 |
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
4539 |
+
|
4540 |
+
ga('create', '{$analytics_id}'{$domain}{$js_options});
|
4541 |
+
{$extra_options}
|
4542 |
+
ga('send', 'pageview');
|
4543 |
+
</script>
|
4544 |
+
|
4545 |
+
EOF;
|
4546 |
+
}
|
4547 |
+
|
4548 |
+
return $analytics;
|
4549 |
}
|
4550 |
|
4551 |
+
/**
|
4552 |
+
* @return mixed|string
|
4553 |
+
*/
|
4554 |
+
function get_analytics_domain() {
|
4555 |
+
global $aioseop_options;
|
4556 |
+
if ( ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
|
4557 |
+
return $this->sanitize_domain( $aioseop_options['aiosp_ga_domain'] );
|
4558 |
}
|
4559 |
+
|
4560 |
+
return '';
|
4561 |
}
|
4562 |
|
4563 |
+
/**
|
4564 |
+
* @param $id
|
4565 |
+
*
|
4566 |
+
* @return bool
|
4567 |
+
*/
|
4568 |
function save_post_data( $id ) {
|
4569 |
$awmp_edit = $nonce = null;
|
4570 |
+
if ( empty( $_POST ) ) {
|
4571 |
+
return false;
|
4572 |
+
}
|
4573 |
+
if ( isset( $_POST['aiosp_edit'] ) ) {
|
4574 |
+
$awmp_edit = $_POST['aiosp_edit'];
|
4575 |
+
}
|
4576 |
+
if ( isset( $_POST['nonce-aioseop-edit'] ) ) {
|
4577 |
+
$nonce = $_POST['nonce-aioseop-edit'];
|
4578 |
+
}
|
4579 |
|
4580 |
+
if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
|
4581 |
+
|
4582 |
+
$optlist = array(
|
4583 |
+
'keywords',
|
4584 |
+
'description',
|
4585 |
+
'title',
|
4586 |
+
'custom_link',
|
4587 |
+
'sitemap_exclude',
|
4588 |
+
'disable',
|
4589 |
+
'disable_analytics',
|
4590 |
+
'noindex',
|
4591 |
+
'nofollow',
|
4592 |
+
'noodp',
|
4593 |
+
'noydir',
|
4594 |
+
'titleatr',
|
4595 |
+
'menulabel',
|
4596 |
+
);
|
4597 |
+
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4598 |
+
unset( $optlist['custom_link'] );
|
4599 |
}
|
4600 |
+
foreach ( $optlist as $f ) {
|
4601 |
$field = "aiosp_$f";
|
4602 |
+
if ( isset( $_POST[ $field ] ) ) {
|
4603 |
+
$$field = $_POST[ $field ];
|
4604 |
+
}
|
4605 |
+
}
|
4606 |
|
4607 |
+
$optlist = array(
|
4608 |
+
'keywords',
|
4609 |
+
'description',
|
4610 |
+
'title',
|
4611 |
+
'custom_link',
|
4612 |
+
'noindex',
|
4613 |
+
'nofollow',
|
4614 |
+
'noodp',
|
4615 |
+
'noydir',
|
4616 |
+
'titleatr',
|
4617 |
+
'menulabel',
|
4618 |
+
);
|
4619 |
+
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4620 |
+
unset( $optlist['custom_link'] );
|
4621 |
}
|
4622 |
+
foreach ( $optlist as $f ) {
|
4623 |
delete_post_meta( $id, "_aioseop_{$f}" );
|
4624 |
+
}
|
4625 |
|
4626 |
+
if ( $this->is_admin() ) {
|
4627 |
+
delete_post_meta( $id, '_aioseop_sitemap_exclude' );
|
4628 |
+
delete_post_meta( $id, '_aioseop_disable' );
|
4629 |
+
delete_post_meta( $id, '_aioseop_disable_analytics' );
|
4630 |
}
|
4631 |
|
4632 |
foreach ( $optlist as $f ) {
|
4633 |
+
$var = "aiosp_$f";
|
4634 |
$field = "_aioseop_$f";
|
4635 |
+
if ( isset( $$var ) && ! empty( $$var ) ) {
|
4636 |
+
add_post_meta( $id, $field, $$var );
|
4637 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
4638 |
}
|
4639 |
+
if ( isset( $aiosp_sitemap_exclude ) && ! empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) {
|
4640 |
+
add_post_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
|
4641 |
+
}
|
4642 |
+
if ( isset( $aiosp_disable ) && ! empty( $aiosp_disable ) && $this->is_admin() ) {
|
4643 |
+
add_post_meta( $id, '_aioseop_disable', $aiosp_disable );
|
4644 |
+
if ( isset( $aiosp_disable_analytics ) && ! empty( $aiosp_disable_analytics ) ) {
|
4645 |
+
add_post_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
|
4646 |
+
}
|
4647 |
+
}
|
4648 |
+
}
|
4649 |
}
|
4650 |
|
4651 |
+
/**
|
4652 |
+
* @param $post
|
4653 |
+
* @param $metabox
|
4654 |
+
*/
|
4655 |
function display_tabbed_metabox( $post, $metabox ) {
|
4656 |
$tabs = $metabox['args'];
|
4657 |
echo '<div class="aioseop_tabs">';
|
4658 |
$header = $this->get_metabox_header( $tabs );
|
4659 |
echo $header;
|
4660 |
+
$active = '';
|
4661 |
+
foreach ( $tabs as $m ) {
|
4662 |
+
echo '<div id="' . $m['id'] . '" class="aioseop_tab"' . $active . '>';
|
4663 |
+
if ( ! $active ) {
|
4664 |
+
$active = ' style="display:none;"';
|
4665 |
+
}
|
4666 |
$m['args'] = $m['callback_args'];
|
4667 |
$m['callback'][0]->{$m['callback'][1]}( $post, $m );
|
4668 |
echo '</div>';
|
4670 |
echo '</div>';
|
4671 |
}
|
4672 |
|
4673 |
+
/**
|
4674 |
+
* @param $tabs
|
4675 |
+
*
|
4676 |
+
* @return string
|
4677 |
+
*/
|
4678 |
+
function get_metabox_header( $tabs ) {
|
4679 |
+
$header = '<ul class="aioseop_header_tabs hide">';
|
4680 |
+
$active = ' active';
|
4681 |
+
foreach ( $tabs as $t ) {
|
4682 |
+
if ( $active ) {
|
4683 |
+
$title = __( 'Main Settings', 'all-in-one-seo-pack' );
|
4684 |
+
} else {
|
4685 |
+
$title = $t['title'];
|
4686 |
+
}
|
4687 |
+
$header .= '<li><label class="aioseop_header_nav"><a class="aioseop_header_tab' . $active . '" href="#' . $t['id'] . '">' . $title . '</a></label></li>';
|
4688 |
+
$active = '';
|
4689 |
+
}
|
4690 |
+
$header .= '</ul>';
|
4691 |
+
|
4692 |
+
return $header;
|
4693 |
+
}
|
4694 |
+
|
4695 |
function admin_bar_menu() {
|
4696 |
global $wp_admin_bar, $aioseop_admin_menu, $aioseop_options, $post;
|
4697 |
|
4698 |
$toggle = '';
|
4699 |
+
if ( isset( $_POST['aiosp_use_original_title'] ) && isset( $_POST['aiosp_admin_bar'] ) ) {
|
4700 |
+
$toggle = 'on';
|
4701 |
+
}
|
4702 |
+
if ( isset( $_POST['aiosp_use_original_title'] ) && ! isset( $_POST['aiosp_admin_bar'] ) ) {
|
4703 |
+
$toggle = 'off';
|
4704 |
+
}
|
4705 |
|
4706 |
+
if ( ! empty( $aioseop_options['aiosp_admin_bar'] ) && $toggle != 'off' || isset( $_POST['aiosp_admin_bar'] ) ) {
|
4707 |
$menu_slug = plugin_basename( __FILE__ );
|
4708 |
|
4709 |
$url = '';
|
4710 |
+
if ( function_exists( 'menu_page_url' ) ) {
|
4711 |
+
$url = menu_page_url( $menu_slug, 0 );
|
4712 |
+
}
|
4713 |
+
if ( empty( $url ) ) {
|
4714 |
+
$url = esc_url( admin_url( 'admin.php?page=' . $menu_slug ) );
|
4715 |
+
}
|
4716 |
|
4717 |
+
$wp_admin_bar->add_menu( array(
|
4718 |
+
'id' => AIOSEOP_PLUGIN_DIRNAME,
|
4719 |
+
'title' => __( 'SEO', 'all-in-one-seo-pack' ),
|
4720 |
+
'href' => $url,
|
4721 |
+
) );
|
4722 |
+
|
4723 |
+
if ( current_user_can( 'update_plugins' ) && ! AIOSEOPPRO ) {
|
4724 |
+
$wp_admin_bar->add_menu( array(
|
4725 |
+
'parent' => AIOSEOP_PLUGIN_DIRNAME,
|
4726 |
+
'title' => __( 'Upgrade To Pro', 'all-in-one-seo-pack' ),
|
4727 |
+
'id' => 'aioseop-pro-upgrade',
|
4728 |
+
'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu',
|
4729 |
+
'meta' => array( 'target' => '_blank' ),
|
4730 |
+
) );
|
4731 |
+
// add_action( 'admin_bar_menu', array( $this, 'admin_bar_upgrade_menu' ), 1101 );
|
4732 |
}
|
4733 |
|
4734 |
$aioseop_admin_menu = 1;
|
4735 |
+
if ( ! is_admin() && ! empty( $post ) ) {
|
4736 |
$blog_page = aiosp_common::get_blog_page( $post );
|
4737 |
+
if ( ! empty( $blog_page ) ) {
|
4738 |
+
$post = $blog_page;
|
4739 |
+
}
|
4740 |
+
$wp_admin_bar->add_menu( array(
|
4741 |
+
'id' => 'aiosp_edit_' . $post->ID,
|
4742 |
+
'parent' => AIOSEOP_PLUGIN_DIRNAME,
|
4743 |
+
'title' => __( 'Edit SEO', 'all-in-one-seo-pack' ),
|
4744 |
+
'href' => get_edit_post_link( $post->ID ) . '#aiosp',
|
4745 |
+
) );
|
4746 |
}
|
4747 |
}
|
4748 |
}
|
4749 |
|
4750 |
+
/**
|
4751 |
+
* Order for adding the menus for the aioseop_modules_add_menus hook.
|
4752 |
+
*/
|
4753 |
function menu_order() {
|
4754 |
return 5;
|
4755 |
}
|
4756 |
|
4757 |
+
/**
|
4758 |
+
* @param $tax
|
4759 |
+
*/
|
4760 |
function display_category_metaboxes( $tax ) {
|
4761 |
$screen = 'edit-' . $tax->taxonomy;
|
4762 |
+
?>
|
4763 |
+
<div id="poststuff">
|
4764 |
+
<?php do_meta_boxes( '', 'advanced', $tax ); ?>
|
4765 |
+
</div>
|
4766 |
+
<?php
|
4767 |
}
|
4768 |
|
4769 |
+
/**
|
4770 |
+
* @param $id
|
4771 |
+
*/
|
4772 |
function save_category_metaboxes( $id ) {
|
4773 |
$awmp_edit = $nonce = null;
|
4774 |
+
if ( isset( $_POST['aiosp_edit'] ) ) {
|
4775 |
+
$awmp_edit = $_POST['aiosp_edit'];
|
4776 |
+
}
|
4777 |
+
if ( isset( $_POST['nonce-aioseop-edit'] ) ) {
|
4778 |
+
$nonce = $_POST['nonce-aioseop-edit'];
|
4779 |
+
}
|
4780 |
|
4781 |
+
if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
|
4782 |
+
$optlist = array(
|
4783 |
+
'keywords',
|
4784 |
+
'description',
|
4785 |
+
'title',
|
4786 |
+
'custom_link',
|
4787 |
+
'sitemap_exclude',
|
4788 |
+
'disable',
|
4789 |
+
'disable_analytics',
|
4790 |
+
'noindex',
|
4791 |
+
'nofollow',
|
4792 |
+
'noodp',
|
4793 |
+
'noydir',
|
4794 |
+
'titleatr',
|
4795 |
+
'menulabel',
|
4796 |
+
);
|
4797 |
+
foreach ( $optlist as $f ) {
|
4798 |
$field = "aiosp_$f";
|
4799 |
+
if ( isset( $_POST[ $field ] ) ) {
|
4800 |
+
$$field = $_POST[ $field ];
|
4801 |
+
}
|
4802 |
+
}
|
4803 |
|
4804 |
+
$optlist = array(
|
4805 |
+
'keywords',
|
4806 |
+
'description',
|
4807 |
+
'title',
|
4808 |
+
'custom_link',
|
4809 |
+
'noindex',
|
4810 |
+
'nofollow',
|
4811 |
+
'noodp',
|
4812 |
+
'noydir',
|
4813 |
+
'titleatr',
|
4814 |
+
'menulabel',
|
4815 |
+
);
|
4816 |
+
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4817 |
+
unset( $optlist['custom_link'] );
|
4818 |
}
|
4819 |
+
foreach ( $optlist as $f ) {
|
4820 |
delete_term_meta( $id, "_aioseop_{$f}" );
|
4821 |
+
}
|
4822 |
|
4823 |
+
if ( $this->is_admin() ) {
|
4824 |
+
delete_term_meta( $id, '_aioseop_sitemap_exclude' );
|
4825 |
+
delete_term_meta( $id, '_aioseop_disable' );
|
4826 |
+
delete_term_meta( $id, '_aioseop_disable_analytics' );
|
4827 |
}
|
4828 |
|
4829 |
foreach ( $optlist as $f ) {
|
4830 |
+
$var = "aiosp_$f";
|
4831 |
$field = "_aioseop_$f";
|
4832 |
+
if ( isset( $$var ) && ! empty( $$var ) ) {
|
4833 |
+
add_term_meta( $id, $field, $$var );
|
4834 |
+
}
|
4835 |
+
}
|
4836 |
+
if ( isset( $aiosp_sitemap_exclude ) && ! empty( $aiosp_sitemap_exclude ) && $this->is_admin() ) {
|
4837 |
+
add_term_meta( $id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude );
|
4838 |
+
}
|
4839 |
+
if ( isset( $aiosp_disable ) && ! empty( $aiosp_disable ) && $this->is_admin() ) {
|
4840 |
+
add_term_meta( $id, '_aioseop_disable', $aiosp_disable );
|
4841 |
+
if ( isset( $aiosp_disable_analytics ) && ! empty( $aiosp_disable_analytics ) ) {
|
4842 |
+
add_term_meta( $id, '_aioseop_disable_analytics', $aiosp_disable_analytics );
|
4843 |
+
}
|
4844 |
}
|
4845 |
+
}
|
4846 |
}
|
4847 |
|
4848 |
function admin_menu() {
|
4849 |
+
$file = plugin_basename( __FILE__ );
|
4850 |
$menu_name = __( 'All in One SEO', 'all-in-one-seo-pack' );
|
4851 |
|
4852 |
+
$this->locations['aiosp']['default_options']['nonce-aioseop-edit']['default'] = wp_create_nonce( 'edit-aioseop-nonce' );
|
4853 |
|
4854 |
$custom_menu_order = false;
|
4855 |
global $aioseop_options;
|
4856 |
+
if ( ! isset( $aioseop_options['custom_menu_order'] ) ) {
|
4857 |
$custom_menu_order = true;
|
4858 |
+
}
|
4859 |
|
4860 |
+
$this->update_options();
|
4861 |
|
4862 |
$this->add_admin_pointers();
|
4863 |
+
if ( ! empty( $this->pointers ) ) {
|
4864 |
+
foreach ( $this->pointers as $k => $p ) {
|
4865 |
+
if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) {
|
4866 |
+
unset( $this->pointers[ $k ] );
|
4867 |
+
}
|
4868 |
+
}
|
4869 |
+
}
|
4870 |
|
4871 |
$donated = false;
|
4872 |
+
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' ) ) {
|
4873 |
+
if ( isset( $_POST['aiosp_donate'] ) ) {
|
4874 |
+
$donated = $_POST['aiosp_donate'];
|
4875 |
+
}
|
4876 |
+
if ( isset( $_POST['Submit'] ) ) {
|
4877 |
+
if ( isset( $_POST['aiosp_custom_menu_order'] ) ) {
|
4878 |
+
$custom_menu_order = $_POST['aiosp_custom_menu_order'];
|
4879 |
+
} else {
|
4880 |
$custom_menu_order = false;
|
4881 |
+
}
|
4882 |
+
} else if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) {
|
4883 |
$custom_menu_order = true;
|
4884 |
}
|
4885 |
} else {
|
4886 |
+
if ( isset( $this->options['aiosp_donate'] ) ) {
|
4887 |
+
$donated = $this->options['aiosp_donate'];
|
4888 |
+
}
|
4889 |
+
if ( isset( $this->options['aiosp_custom_menu_order'] ) ) {
|
4890 |
+
$custom_menu_order = $this->options['aiosp_custom_menu_order'];
|
4891 |
+
}
|
4892 |
}
|
4893 |
|
4894 |
if ( $custom_menu_order ) {
|
4897 |
}
|
4898 |
|
4899 |
if ( $donated ) {
|
4900 |
+
// Thank you for your donation.
|
4901 |
+
$this->pointers['aioseop_donate'] = array(
|
4902 |
+
'pointer_target' => '#aiosp_donate_wrapper',
|
4903 |
+
'pointer_text' => '<h3>' . __( 'Thank you!', 'all-in-one-seo-pack' )
|
4904 |
+
. '</h3><p>' . __( 'Thank you for your donation, it helps keep this plugin free and actively developed!', 'all-in-one-seo-pack' ) . '</p>',
|
4905 |
+
);
|
4906 |
}
|
4907 |
|
4908 |
+
if ( ! AIOSEOPPRO ) {
|
4909 |
+
if ( ! empty( $this->pointers ) ) {
|
4910 |
+
foreach ( $this->pointers as $k => $p ) {
|
4911 |
+
if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) {
|
4912 |
+
unset( $this->pointers[ $k ] );
|
4913 |
+
}
|
4914 |
+
}
|
4915 |
+
}
|
4916 |
|
4917 |
+
$this->filter_pointers();
|
4918 |
}
|
4919 |
|
4920 |
+
if ( ! empty( $this->options['aiosp_enablecpost'] ) && $this->options['aiosp_enablecpost'] ) {
|
4921 |
if ( AIOSEOPPRO ) {
|
4922 |
+
$this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
|
4923 |
+
if ( ! empty( $this->options['aiosp_taxactive'] ) ) {
|
4924 |
+
foreach ( $this->options['aiosp_taxactive'] as $tax ) {
|
4925 |
+
$this->locations['aiosp']['display'][] = 'edit-' . $tax;
|
4926 |
+
add_action( "{$tax}_edit_form", array( $this, 'display_category_metaboxes' ) );
|
4927 |
+
add_action( "edited_{$tax}", array( $this, 'save_category_metaboxes' ) );
|
4928 |
+
}
|
4929 |
}
|
|
|
4930 |
} else {
|
4931 |
+
if ( ! empty( $this->options['aiosp_cpostactive'] ) ) {
|
4932 |
$this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
|
4933 |
} else {
|
4934 |
+
$this->locations['aiosp']['display'] = array();
|
4935 |
}
|
4936 |
}
|
4937 |
} else {
|
4938 |
+
$this->locations['aiosp']['display'] = array( 'post', 'page' );
|
4939 |
}
|
4940 |
|
4941 |
|
4942 |
+
add_menu_page( $menu_name, $menu_name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $file, array(
|
4943 |
+
$this,
|
4944 |
+
'display_settings_page',
|
4945 |
+
) );
|
4946 |
|
4947 |
+
add_meta_box( 'aioseop-list', __( 'Join Our Mailing List', 'all-in-one-seo-pack' ), array(
|
4948 |
+
'aiosp_metaboxes',
|
4949 |
+
'display_extra_metaboxes',
|
4950 |
+
), 'aioseop_metaboxes', 'normal', 'core' );
|
4951 |
+
if ( AIOSEOPPRO ) {
|
4952 |
+
add_meta_box( 'aioseop-about', __( 'About', 'all-in-one-seo-pack' ), array(
|
4953 |
+
'aiosp_metaboxes',
|
4954 |
+
'display_extra_metaboxes',
|
4955 |
+
), 'aioseop_metaboxes', 'side', 'core' );
|
4956 |
} else {
|
4957 |
+
add_meta_box( 'aioseop-about', "About <span class='Taha' style='float:right;'>Version <b>" . AIOSEOP_VERSION . '</b></span>', array(
|
4958 |
+
'aiosp_metaboxes',
|
4959 |
+
'display_extra_metaboxes',
|
4960 |
+
), 'aioseop_metaboxes', 'side', 'core' );
|
4961 |
}
|
4962 |
+
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(
|
4963 |
+
'aiosp_metaboxes',
|
4964 |
+
'display_extra_metaboxes',
|
4965 |
+
), 'aioseop_metaboxes', 'side', 'core' );
|
4966 |
|
4967 |
+
add_action( 'aioseop_modules_add_menus', array( $this, 'add_menu' ), 5 );
|
4968 |
do_action( 'aioseop_modules_add_menus', $file );
|
4969 |
|
4970 |
+
$metaboxes = apply_filters( 'aioseop_add_post_metabox', array() );
|
4971 |
|
4972 |
+
if ( ! empty( $metaboxes ) ) {
|
4973 |
if ( $this->tabbed_metaboxes ) {
|
4974 |
+
$tabs = array();
|
4975 |
$tab_num = 0;
|
4976 |
foreach ( $metaboxes as $m ) {
|
4977 |
+
if ( ! isset( $tabs[ $m['post_type'] ] ) ) {
|
4978 |
+
$tabs[ $m['post_type'] ] = array();
|
4979 |
+
}
|
4980 |
$tabs[ $m['post_type'] ][] = $m;
|
4981 |
}
|
4982 |
|
4983 |
+
if ( ! empty( $tabs ) ) {
|
4984 |
+
foreach ( $tabs as $p => $m ) {
|
4985 |
$tab_num = count( $m );
|
4986 |
+
$title = $m[0]['title'];
|
4987 |
+
if ( $title != $this->plugin_name ) {
|
4988 |
+
$title = $this->plugin_name . ' - ' . $title;
|
4989 |
+
}
|
4990 |
if ( $tab_num <= 1 ) {
|
4991 |
+
if ( ! empty( $m[0]['callback_args']['help_link'] ) ) {
|
4992 |
+
$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>';
|
4993 |
+
}
|
4994 |
add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] );
|
4995 |
} elseif ( $tab_num > 1 ) {
|
4996 |
+
add_meta_box( $m[0]['id'] . '_tabbed', $title, array(
|
4997 |
+
$this,
|
4998 |
+
'display_tabbed_metabox',
|
4999 |
+
), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m );
|
5000 |
}
|
5001 |
}
|
5002 |
}
|
5003 |
} else {
|
5004 |
foreach ( $metaboxes as $m ) {
|
5005 |
$title = $m['title'];
|
5006 |
+
if ( $title != $this->plugin_name ) {
|
5007 |
+
$title = $this->plugin_name . ' - ' . $title;
|
5008 |
+
}
|
5009 |
+
if ( ! empty( $m['help_link'] ) ) {
|
5010 |
+
$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>';
|
5011 |
+
}
|
5012 |
add_meta_box( $m['id'], $title, $m['callback'], $m['post_type'], $m['context'], $m['priority'], $m['callback_args'] );
|
5013 |
}
|
5014 |
}
|
5015 |
}
|
5016 |
}
|
5017 |
|
5018 |
+
/**
|
5019 |
+
* @param $menu_order
|
5020 |
+
*
|
5021 |
+
* @return array
|
5022 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5023 |
function set_menu_order( $menu_order ) {
|
5024 |
$order = array();
|
5025 |
+
$file = plugin_basename( __FILE__ );
|
5026 |
foreach ( $menu_order as $index => $item ) {
|
5027 |
+
if ( $item != $file ) {
|
5028 |
+
$order[] = $item;
|
5029 |
+
}
|
5030 |
+
if ( $index == 0 ) {
|
5031 |
+
$order[] = $file;
|
5032 |
+
}
|
5033 |
}
|
5034 |
+
|
5035 |
return $order;
|
5036 |
}
|
5037 |
|
5038 |
function display_settings_header() {
|
5039 |
}
|
5040 |
+
|
5041 |
+
function display_settings_footer() {
|
5042 |
}
|
5043 |
|
5044 |
+
function display_right_sidebar() {
|
5045 |
global $wpdb;
|
5046 |
|
5047 |
+
if ( ! get_option( 'aioseop_options' ) ) {
|
5048 |
$msg = "<div style='text-align:center;'><p><strong>Your database options need to be updated.</strong><em>(Back up your database before updating.)</em>
|
5049 |
<FORM action='' method='post' name='aioseop-migrate-options'>
|
5050 |
<input type='hidden' name='nonce-aioseop-migrate-options' value='" . wp_create_nonce( 'aioseop-migrate-nonce-options' ) . "' />
|
5051 |
<input type='submit' name='aioseop_migrate_options' class='button-primary' value='Update Database Options'>
|
5052 |
</FORM>
|
5053 |
</p></div>";
|
5054 |
+
aioseop_output_dismissable_notice( $msg, '', 'error' );
|
5055 |
}
|
5056 |
+
?>
|
5057 |
<div class="aioseop_top">
|
5058 |
<div class="aioseop_top_sidebar aioseop_options_wrapper">
|
5059 |
+
<?php do_meta_boxes( 'aioseop_metaboxes', 'normal', array( 'test' ) ); ?>
|
5060 |
</div>
|
5061 |
</div>
|
5062 |
<style>
|
5066 |
</style>
|
5067 |
<div class="aioseop_right_sidebar aioseop_options_wrapper">
|
5068 |
|
5069 |
+
<div class="aioseop_sidebar">
|
5070 |
+
<?php
|
5071 |
+
do_meta_boxes( 'aioseop_metaboxes', 'side', array( 'test' ) );
|
5072 |
+
?>
|
5073 |
+
<script type="text/javascript">
|
5074 |
+
//<![CDATA[
|
5075 |
+
jQuery(document).ready(function ($) {
|
5076 |
+
// Close postboxes that should be closed.
|
5077 |
+
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
5078 |
+
// Postboxes setup.
|
5079 |
+
if (typeof postboxes !== 'undefined')
|
5080 |
+
postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
|
5081 |
+
});
|
5082 |
+
//]]>
|
5083 |
+
</script>
|
5084 |
+
<?php if ( ! AIOSEOPPRO ) { ?>
|
5085 |
+
<div class="aioseop_advert aioseop_nopad_all">
|
5086 |
+
<?php $adid = mt_rand( 21, 23 );
|
5087 |
+
|
5088 |
+
if ( $adid == 23 ) { ?>
|
5089 |
+
<div
|
5090 |
+
style="height: 220px; background-image: url('https://www.wincher.com/Content/Images/plugin/wp/banner30.jpg')">
|
5091 |
+
<form style="position: relative; top: 170px; left: 40px;"
|
5092 |
+
action="https://www.wincher.com/FastReg" method="post" target="_blank">
|
5093 |
+
<input type="hidden" name="adreferer" value="banner<?php echo $adid; ?>"/>
|
5094 |
+
<input type="hidden" name="referer" value="all-in-one-seo-pack"/>
|
5095 |
+
<input type="text" name="email" placeholder="Email"
|
5096 |
+
style="padding-left: 7px; height: 30px; width: 290px; border: solid 1px #DDD;"/>
|
5097 |
+
<input type="submit" name="sub" value="Sign up!"
|
5098 |
+
style="height: 30px; width: 90px; background-color: #42DA76; color: #FFF; font-weight: bold; border:none; margin-left:5px;"/>
|
5099 |
+
</form>
|
5100 |
+
</div>
|
5101 |
<?
|
5102 |
+
} else {
|
5103 |
?>
|
5104 |
+
<a href="https://www.wincher.com/?referer=all-in-one-seo-pack&adreferer=banner<?php echo $adid; ?>"
|
5105 |
+
target="_blank">
|
5106 |
+
<div class=wincherad id=wincher<?php echo $adid; ?>>
|
|
|
|
|
|
|
|
|
|
|
|
|
5107 |
</div>
|
5108 |
+
</a>
|
5109 |
+
<?php } ?>
|
5110 |
+
</div>
|
5111 |
+
<div class="aioseop_advert headwaythemes">
|
5112 |
+
<div>
|
5113 |
+
<h3>Drag and Drop WordPress Design</h3>
|
5114 |
+
<p><a href="http://semperfiwebdesign.com/headwayaio/" target="_blank">Headway Themes</a>
|
5115 |
+
allows you to easily create your own stunning website designs! Stop using premade themes
|
5116 |
+
start making your own design with Headway's easy to use Drag and Drop interface. All in
|
5117 |
+
One SEO Pack users have an exclusive discount by using coupon code
|
5118 |
+
<strong>SEMPERFI30</strong> at checkout.</p>
|
5119 |
+
</div>
|
5120 |
+
<a href="http://semperfiwebdesign.com/headwayaio/" target="_blank"><img
|
5121 |
+
src="<?php echo AIOSEOP_PLUGIN_IMAGES_URL; ?>headwaybanner.png"></a>
|
5122 |
+
</div>
|
5123 |
+
<?php } ?>
|
5124 |
+
</div>
|
5125 |
+
</div>
|
5126 |
+
<?php
|
5127 |
+
}
|
5128 |
|
5129 |
}
|
aioseop_init.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
all_in_one_seo_pack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: All In One SEO Pack
|
4 |
Plugin URI: http://semperfiwebdesign.com
|
5 |
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. Almost 30 million downloads since 2007.
|
6 |
-
Version: 2.3.
|
7 |
Author: Michael Torbert
|
8 |
Author URI: http://michaeltorbert.com
|
9 |
Text Domain: all-in-one-seo-pack
|
@@ -11,7 +11,7 @@ Domain Path: /i18n/
|
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
-
Copyright (C) 2007-2016 Michael Torbert, semperfiwebdesign.com
|
15 |
|
16 |
This program is free software; you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
@@ -28,71 +28,98 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
28 |
*/
|
29 |
|
30 |
/**
|
|
|
|
|
|
|
31 |
* @package All-in-One-SEO-Pack
|
32 |
-
* @version 2.3.
|
33 |
*/
|
34 |
|
35 |
-
if(!defined('AIOSEOPPRO'))
|
36 |
-
|
|
|
|
|
|
|
|
|
37 |
global $aioseop_plugin_name;
|
38 |
$aioseop_plugin_name = 'All in One SEO Pack';
|
39 |
|
40 |
-
|
41 |
-
*
|
42 |
-
|
43 |
-
*
|
44 |
-
*******/
|
45 |
|
46 |
-
if ( ! defined( 'ABSPATH' ) )
|
|
|
|
|
47 |
|
|
|
48 |
|
49 |
-
if( AIOSEOPPRO ){
|
50 |
-
|
51 |
add_action( 'admin_init', 'disable_all_in_one_free', 1 );
|
52 |
-
|
53 |
}
|
54 |
|
55 |
-
|
|
|
|
|
|
|
|
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
|
|
|
|
59 |
|
|
|
60 |
if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
|
61 |
-
|
62 |
-
} elseif ( AIOSEOP_PLUGIN_DIR
|
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 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
if ( ! defined( '
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
if ( ! defined( '
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
if ( ! defined( '
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
global $aiosp, $aioseop_options, $aioseop_modules, $aioseop_module_list, $aiosp_activation, $aioseop_mem_limit, $aioseop_get_pages_start, $aioseop_admin_menu;
|
98 |
$aioseop_get_pages_start = $aioseop_admin_menu = 0;
|
@@ -105,253 +132,290 @@ $aioseop_options = get_option( 'aioseop_options' );
|
|
105 |
|
106 |
$aioseop_mem_limit = @ini_get( 'memory_limit' );
|
107 |
|
108 |
-
if ( !function_exists( 'aioseop_convert_bytestring' ) ) {
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
110 |
$num = 0;
|
111 |
-
preg_match( '/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $
|
112 |
-
if ( !empty( $matches ) ) {
|
113 |
-
$num = (
|
114 |
switch ( strtoupper( $matches[2] ) ) {
|
115 |
-
case 'E':
|
116 |
-
|
117 |
-
case '
|
118 |
-
|
119 |
-
case '
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
132 |
-
|
133 |
-
@
|
|
|
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 |
-
|
|
|
145 |
@ini_set( 'memory_limit', $aioseop_mem_limit );
|
|
|
146 |
}
|
147 |
|
148 |
-
$aiosp_activation
|
149 |
-
$aioseop_module_list =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
158 |
-
|
159 |
-
|
|
|
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 |
-
|
167 |
-
|
168 |
-
|
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->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
}
|
183 |
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
*/
|
188 |
-
if ( !function_exists( 'aioseop_activate' ) ) {
|
189 |
function aioseop_activate() {
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
|
198 |
delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
|
199 |
|
200 |
-
|
201 |
-
|
202 |
}
|
203 |
}
|
204 |
}
|
205 |
|
206 |
add_action( 'plugins_loaded', 'aioseop_init_class' );
|
207 |
|
|
|
208 |
|
|
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
213 |
|
214 |
-
|
215 |
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
-
|
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¤cy_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 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
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 |
-
|
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 |
-
|
279 |
-
|
280 |
-
|
281 |
|
282 |
-
);
|
283 |
-
}
|
284 |
|
285 |
-
|
|
|
286 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
}
|
288 |
|
289 |
-
if(!function_exists('aiosp_action_links')) {
|
290 |
|
291 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
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'] ) &&
|
348 |
remove_action( 'init', array( $aiosp, 'add_hooks' ) );
|
349 |
-
add_action('admin_init', 'aioseop_scan_post_header' );
|
350 |
-
add_action('shutdown', 'aioseop_ajax_scan_header' ); // if the action doesn't run -- pdb
|
351 |
-
include_once(ABSPATH . 'wp-admin/includes/screen.php');
|
352 |
global $current_screen;
|
353 |
-
if ( class_exists( 'WP_Screen' ) )
|
354 |
$current_screen = WP_Screen::get( 'front' );
|
|
|
355 |
}
|
356 |
}
|
357 |
}
|
@@ -360,47 +424,49 @@ add_action( 'init', 'aioseop_load_modules', 1 );
|
|
360 |
//add_action( 'after_setup_theme', 'aioseop_load_modules' );
|
361 |
|
362 |
if ( is_admin() ) {
|
363 |
-
add_action( 'wp_ajax_aioseop_ajax_save_meta',
|
364 |
-
add_action( 'wp_ajax_aioseop_ajax_save_url',
|
365 |
-
add_action( 'wp_ajax_aioseop_ajax_delete_url',
|
366 |
-
add_action( 'wp_ajax_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'
|
373 |
-
add_action( 'wp_ajax_aioseo_dismiss_visibility_notice'
|
374 |
-
add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice'
|
375 |
-
if(AIOSEOPPRO){
|
376 |
-
add_action( 'wp_ajax_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())
|
|
|
|
|
387 |
}
|
388 |
}
|
389 |
|
390 |
-
require_once( AIOSEOP_PLUGIN_DIR . '
|
391 |
-
|
392 |
|
393 |
-
if(!function_exists('aioseop_install')){
|
394 |
-
register_activation_hook( __FILE__, 'aioseop_install' );
|
395 |
|
396 |
-
function aioseop_install(){
|
397 |
-
|
398 |
-
}
|
399 |
}
|
400 |
|
401 |
-
if(!function_exists('disable_all_in_one_free')){
|
402 |
-
function disable_all_in_one_free(){
|
403 |
-
|
404 |
-
|
|
|
405 |
}
|
406 |
-
}
|
3 |
Plugin Name: All In One SEO Pack
|
4 |
Plugin URI: http://semperfiwebdesign.com
|
5 |
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. Almost 30 million downloads since 2007.
|
6 |
+
Version: 2.3.6
|
7 |
Author: Michael Torbert
|
8 |
Author URI: http://michaeltorbert.com
|
9 |
Text Domain: all-in-one-seo-pack
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
+
Copyright (C) 2007-2016 Michael Torbert, https://semperfiwebdesign.com
|
15 |
|
16 |
This program is free software; you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
28 |
*/
|
29 |
|
30 |
/**
|
31 |
+
* All in One SEO Pack.
|
32 |
+
* The original WordPress SEO plugin.
|
33 |
+
*
|
34 |
* @package All-in-One-SEO-Pack
|
35 |
+
* @version 2.3.6
|
36 |
*/
|
37 |
|
38 |
+
if ( ! defined( 'AIOSEOPPRO' ) ) {
|
39 |
+
define( 'AIOSEOPPRO', false );
|
40 |
+
}
|
41 |
+
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
|
42 |
+
define( 'AIOSEOP_VERSION', '2.3.6' );
|
43 |
+
}
|
44 |
global $aioseop_plugin_name;
|
45 |
$aioseop_plugin_name = 'All in One SEO Pack';
|
46 |
|
47 |
+
/**
|
48 |
+
* DO NOT EDIT BELOW THIS LINE.
|
49 |
+
*/
|
|
|
|
|
50 |
|
51 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
52 |
+
return;
|
53 |
+
}
|
54 |
|
55 |
+
if ( AIOSEOPPRO ) {
|
56 |
|
|
|
|
|
57 |
add_action( 'admin_init', 'disable_all_in_one_free', 1 );
|
58 |
+
|
59 |
}
|
60 |
|
61 |
+
function aiosp_add_cap(){
|
62 |
+
/*
|
63 |
+
TODO we should put this into an install script. We just need to make sure it runs soon enough and we need to make
|
64 |
+
sure people updating from previous versions have access to it.
|
65 |
+
*/
|
66 |
|
67 |
+
$role = get_role( 'administrator' );
|
68 |
+
if ( is_object( $role ) ) {
|
69 |
+
$role->add_cap( 'aiosp_manage_seo' );
|
70 |
+
}
|
71 |
+
}
|
72 |
+
add_action( 'plugins_loaded', 'aiosp_add_cap' );
|
73 |
|
74 |
+
if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) {
|
75 |
+
define( 'AIOSEOP_PLUGIN_NAME', $aioseop_plugin_name );
|
76 |
+
}
|
77 |
|
78 |
+
// Do we need this? register_activation_hook(__FILE__,'aioseop_activate_pl');.
|
79 |
if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
|
80 |
+
define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
81 |
+
} elseif ( AIOSEOP_PLUGIN_DIR !== plugin_dir_path( __FILE__ ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
/*
|
84 |
+
This is not a great message.
|
85 |
+
add_action( 'admin_notices', create_function( '', 'echo "' . "<div class='error'>" . sprintf(
|
86 |
+
__( "%s detected a conflict; please deactivate the plugin located in %s.", 'all-in-one-seo-pack' ),
|
87 |
+
$aioseop_plugin_name, AIOSEOP_PLUGIN_DIR ) . "</div>" . '";' ) );
|
88 |
+
*/
|
89 |
|
90 |
+
return;
|
91 |
}
|
92 |
|
93 |
+
if ( ! defined( 'AIOSEOP_PLUGIN_BASENAME' ) ) {
|
94 |
+
define( 'AIOSEOP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
95 |
+
}
|
96 |
+
if ( ! defined( 'AIOSEOP_PLUGIN_DIRNAME' ) ) {
|
97 |
+
define( 'AIOSEOP_PLUGIN_DIRNAME', dirname( AIOSEOP_PLUGIN_BASENAME ) );
|
98 |
+
}
|
99 |
+
if ( ! defined( 'AIOSEOP_PLUGIN_URL' ) ) {
|
100 |
+
define( 'AIOSEOP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
101 |
+
}
|
102 |
+
if ( ! defined( 'AIOSEOP_PLUGIN_IMAGES_URL' ) ) {
|
103 |
+
define( 'AIOSEOP_PLUGIN_IMAGES_URL', AIOSEOP_PLUGIN_URL . 'images/' );
|
104 |
+
}
|
105 |
+
if ( ! defined( 'AIOSEOP_BASELINE_MEM_LIMIT' ) ) {
|
106 |
+
define( 'AIOSEOP_BASELINE_MEM_LIMIT', 268435456 );
|
107 |
+
} // 256MB
|
108 |
+
if ( ! defined( 'WP_CONTENT_URL' ) ) {
|
109 |
+
define( 'WP_CONTENT_URL', site_url() . '/wp-content' );
|
110 |
+
}
|
111 |
+
if ( ! defined( 'WP_ADMIN_URL' ) ) {
|
112 |
+
define( 'WP_ADMIN_URL', site_url() . '/wp-admin' );
|
113 |
+
}
|
114 |
+
if ( ! defined( 'WP_CONTENT_DIR' ) ) {
|
115 |
+
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
116 |
+
}
|
117 |
+
if ( ! defined( 'WP_PLUGIN_URL' ) ) {
|
118 |
+
define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' );
|
119 |
+
}
|
120 |
+
if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
|
121 |
+
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
|
122 |
+
}
|
123 |
|
124 |
global $aiosp, $aioseop_options, $aioseop_modules, $aioseop_module_list, $aiosp_activation, $aioseop_mem_limit, $aioseop_get_pages_start, $aioseop_admin_menu;
|
125 |
$aioseop_get_pages_start = $aioseop_admin_menu = 0;
|
132 |
|
133 |
$aioseop_mem_limit = @ini_get( 'memory_limit' );
|
134 |
|
135 |
+
if ( ! function_exists( 'aioseop_convert_bytestring' ) ) {
|
136 |
+
/**
|
137 |
+
* @param $byte_string
|
138 |
+
*
|
139 |
+
* @return int
|
140 |
+
*/
|
141 |
+
function aioseop_convert_bytestring( $byte_string ) {
|
142 |
$num = 0;
|
143 |
+
preg_match( '/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $byte_string, $matches );
|
144 |
+
if ( ! empty( $matches ) ) {
|
145 |
+
$num = (float) $matches[1];
|
146 |
switch ( strtoupper( $matches[2] ) ) {
|
147 |
+
case 'E':
|
148 |
+
$num *= 1024;
|
149 |
+
case 'P':
|
150 |
+
$num *= 1024;
|
151 |
+
case 'T':
|
152 |
+
$num *= 1024;
|
153 |
+
case 'G':
|
154 |
+
$num *= 1024;
|
155 |
+
case 'M':
|
156 |
+
$num *= 1024;
|
157 |
+
case 'K':
|
158 |
+
$num *= 1024;
|
159 |
}
|
160 |
}
|
161 |
+
|
162 |
return intval( $num );
|
163 |
}
|
164 |
}
|
165 |
|
166 |
if ( is_array( $aioseop_options ) && isset( $aioseop_options['modules'] ) && isset( $aioseop_options['modules']['aiosp_performance_options'] ) ) {
|
167 |
$perf_opts = $aioseop_options['modules']['aiosp_performance_options'];
|
168 |
+
if ( isset( $perf_opts['aiosp_performance_memory_limit'] ) ) {
|
169 |
$aioseop_mem_limit = $perf_opts['aiosp_performance_memory_limit'];
|
170 |
+
}
|
171 |
+
if ( isset( $perf_opts['aiosp_performance_execution_time'] ) && ( '' !== $perf_opts['aiosp_performance_execution_time'] ) ) {
|
172 |
+
@ini_set( 'max_execution_time', (int) $perf_opts['aiosp_performance_execution_time'] );
|
173 |
+
@set_time_limit( (int) $perf_opts['aiosp_performance_execution_time'] );
|
174 |
}
|
175 |
} else {
|
176 |
$aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit );
|
177 |
+
if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit < AIOSEOP_BASELINE_MEM_LIMIT ) ) {
|
178 |
$aioseop_mem_limit = AIOSEOP_BASELINE_MEM_LIMIT;
|
179 |
+
}
|
180 |
}
|
181 |
|
182 |
+
if ( ! empty( $aioseop_mem_limit ) ) {
|
183 |
+
if ( ! is_int( $aioseop_mem_limit ) ) {
|
184 |
$aioseop_mem_limit = aioseop_convert_bytestring( $aioseop_mem_limit );
|
185 |
+
}
|
186 |
+
if ( ( $aioseop_mem_limit > 0 ) && ( $aioseop_mem_limit <= AIOSEOP_BASELINE_MEM_LIMIT ) ) {
|
187 |
@ini_set( 'memory_limit', $aioseop_mem_limit );
|
188 |
+
}
|
189 |
}
|
190 |
|
191 |
+
$aiosp_activation = false;
|
192 |
+
$aioseop_module_list = array(
|
193 |
+
'sitemap',
|
194 |
+
'opengraph',
|
195 |
+
'robots',
|
196 |
+
'file_editor',
|
197 |
+
'importer_exporter',
|
198 |
+
'bad_robots',
|
199 |
+
'performance',
|
200 |
+
); // list all available modules here
|
201 |
|
202 |
+
if ( AIOSEOPPRO ) {
|
203 |
$aioseop_module_list[] = 'video_sitemap';
|
204 |
}
|
205 |
|
206 |
if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
|
207 |
add_action( 'admin_notices', create_function( '', 'echo "<div class=\'error\'>The All In One SEO Pack class is already defined";'
|
208 |
+
. "if ( class_exists( 'ReflectionClass' ) ) { \$r = new ReflectionClass( 'All_in_One_SEO_Pack' ); echo ' in ' . \$r->getFileName(); } "
|
209 |
+
. ' echo ", preventing All In One SEO Pack from loading.</div>";' ) );
|
210 |
+
|
211 |
+
return;
|
212 |
}
|
213 |
|
214 |
+
if ( AIOSEOPPRO ) {
|
215 |
+
|
216 |
+
require( AIOSEOP_PLUGIN_DIR . 'pro/sfwd_update_checker.php' );
|
217 |
$aioseop_update_checker = new SFWD_Update_Checker(
|
218 |
+
'http://semperplugins.com/upgrade_plugins.php',
|
219 |
+
__FILE__,
|
220 |
+
'aioseop'
|
221 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
+
$aioseop_update_checker->plugin_name = AIOSEOP_PLUGIN_NAME;
|
224 |
+
$aioseop_update_checker->plugin_basename = AIOSEOP_PLUGIN_BASENAME;
|
225 |
+
if ( ! empty( $aioseop_options['aiosp_license_key'] ) ) {
|
226 |
+
$aioseop_update_checker->license_key = $aioseop_options['aiosp_license_key'];
|
227 |
+
} else {
|
228 |
+
$aioseop_update_checker->license_key = '';
|
229 |
+
}
|
230 |
+
$aioseop_update_checker->options_page = 'all-in-one-seo-pack-pro/aioseop_class.php';
|
231 |
+
$aioseop_update_checker->renewal_page = 'http://semperplugins.com/all-in-one-seo-pack-pro-support-updates-renewal/';
|
232 |
+
|
233 |
+
$aioseop_update_checker->addQueryArgFilter( array( $aioseop_update_checker, 'add_secret_key' ) );
|
234 |
}
|
235 |
|
236 |
|
237 |
+
if ( ! function_exists( 'aioseop_activate' ) ) {
|
238 |
+
|
|
|
|
|
239 |
function aioseop_activate() {
|
240 |
+
|
241 |
+
//Check if we just got activated.
|
242 |
+
global $aiosp_activation;
|
243 |
+
if ( AIOSEOPPRO ) {
|
244 |
+
global $aioseop_update_checker;
|
245 |
+
}
|
246 |
+
$aiosp_activation = true;
|
247 |
|
248 |
delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
|
249 |
|
250 |
+
if ( AIOSEOPPRO ) {
|
251 |
+
$aioseop_update_checker->checkForUpdates();
|
252 |
}
|
253 |
}
|
254 |
}
|
255 |
|
256 |
add_action( 'plugins_loaded', 'aioseop_init_class' );
|
257 |
|
258 |
+
if ( ! function_exists( 'aiosp_plugin_row_meta' ) ) {
|
259 |
|
260 |
+
add_filter( 'plugin_row_meta', 'aiosp_plugin_row_meta', 10, 2 );
|
261 |
|
262 |
+
/**
|
263 |
+
* @param $actions
|
264 |
+
* @param $plugin_file
|
265 |
+
*
|
266 |
+
* @return array
|
267 |
+
*/
|
268 |
+
function aiosp_plugin_row_meta( $actions, $plugin_file ) {
|
269 |
|
270 |
+
if ( ! AIOSEOPPRO ) {
|
271 |
|
272 |
+
$action_links = array(
|
273 |
+
'donatelink' => array(
|
274 |
+
'label' => __( 'Donate', 'all-in-one-seo-pack' ),
|
275 |
+
'url' => 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8',
|
276 |
+
),
|
277 |
+
'amazon' => array(
|
278 |
+
'label' => __( 'Amazon Wishlist', 'all-in-one-seo-pack' ),
|
279 |
+
'url' => 'https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web',
|
280 |
+
),
|
281 |
|
282 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
+
} else {
|
285 |
+
$action_links = '';
|
286 |
+
}
|
287 |
|
288 |
+
return aiosp_action_links( $actions, $plugin_file, $action_links, 'after' );
|
289 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
}
|
291 |
|
292 |
+
if ( ! function_exists( 'aiosp_add_action_links' ) ) {
|
293 |
|
294 |
|
295 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'aiosp_add_action_links', 10, 2 );
|
296 |
|
297 |
+
/**
|
298 |
+
* @param $actions
|
299 |
+
* @param $plugin_file
|
300 |
+
*
|
301 |
+
* @return array
|
302 |
+
*/
|
303 |
+
function aiosp_add_action_links( $actions, $plugin_file ) {
|
304 |
|
305 |
+
$aioseop_plugin_dirname = AIOSEOP_PLUGIN_DIRNAME;
|
306 |
+
$action_links = array();
|
307 |
+
$action_links = array(
|
308 |
+
'settings' => array(
|
309 |
+
'label' => __( 'SEO Settings', 'all-in-one-seo-pack' ),
|
310 |
+
'url' => get_admin_url( null, "admin.php?page=$aioseop_plugin_dirname/aioseop_class.php" ),
|
311 |
+
),
|
312 |
|
313 |
+
'forum' => array(
|
314 |
+
'label' => __( 'Support Forum', 'all-in-one-seo-pack' ),
|
315 |
+
'url' => 'http://semperplugins.com/support/',
|
316 |
+
),
|
|
|
|
|
317 |
|
318 |
+
'docs' => array(
|
319 |
+
'label' => __( 'Documentation', 'all-in-one-seo-pack' ),
|
320 |
+
'url' => 'http://semperplugins.com/documentation/',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
),
|
322 |
|
323 |
+
);
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
+
unset( $actions['edit'] );
|
326 |
|
327 |
+
if ( ! AIOSEOPPRO ) {
|
328 |
+
$action_links['proupgrade'] =
|
329 |
+
array(
|
330 |
+
'label' => __( 'Upgrade to Pro', 'all-in-one-seo-pack' ),
|
331 |
+
'url' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins',
|
332 |
|
333 |
+
);
|
334 |
+
}
|
335 |
|
336 |
+
return aiosp_action_links( $actions, $plugin_file, $action_links, 'before' );
|
337 |
+
}
|
338 |
}
|
339 |
+
|
340 |
+
if ( ! function_exists( 'aiosp_action_links' ) ) {
|
341 |
+
|
342 |
+
/**
|
343 |
+
* @param $actions
|
344 |
+
* @param $plugin_file
|
345 |
+
* @param array $action_links
|
346 |
+
* @param string $position
|
347 |
+
*
|
348 |
+
* @return array
|
349 |
+
*/
|
350 |
+
function aiosp_action_links( $actions, $plugin_file, $action_links = array(), $position = 'after' ) {
|
351 |
+
static $plugin;
|
352 |
+
if ( ! isset( $plugin ) ) {
|
353 |
+
$plugin = plugin_basename( __FILE__ );
|
354 |
+
}
|
355 |
+
if ( $plugin === $plugin_file && ! empty( $action_links ) ) {
|
356 |
+
foreach ( $action_links as $key => $value ) {
|
357 |
+
$link = array( $key => '<a href="' . $value['url'] . '">' . $value['label'] . '</a>' );
|
358 |
+
if ( 'after' === $position ) {
|
359 |
+
$actions = array_merge( $actions, $link );
|
360 |
+
} else {
|
361 |
+
$actions = array_merge( $link, $actions );
|
362 |
+
}
|
363 |
+
}//foreach
|
364 |
+
}// if
|
365 |
+
return $actions;
|
366 |
+
}
|
367 |
}
|
368 |
|
|
|
369 |
|
370 |
+
if ( ! function_exists( 'aioseop_init_class' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
function aioseop_init_class() {
|
372 |
global $aiosp;
|
373 |
load_plugin_textdomain( 'all-in-one-seo-pack', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n/' );
|
374 |
require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_functions.php' );
|
375 |
require_once( AIOSEOP_PLUGIN_DIR . 'aioseop_class.php' );
|
376 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/aioseop_updates_class.php' );
|
377 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/commonstrings.php' );
|
378 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/postedit.php' );
|
379 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'admin/display/general-metaboxes.php' );
|
380 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/aiosp_common.php' );
|
381 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php' );
|
382 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/translations.php' );
|
383 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'public/opengraph.php' );
|
384 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/compat-init.php');
|
385 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'public/front.php' );
|
386 |
+
|
387 |
+
if ( AIOSEOPPRO ) {
|
388 |
require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_general.php' );
|
389 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_class.php' );
|
390 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'pro/aioseop_pro_updates_class.php' );
|
391 |
}
|
392 |
aiosp_seometa_import(); // call importer functions... this should be moved somewhere better
|
393 |
+
|
394 |
$aiosp = new All_in_One_SEO_Pack();
|
395 |
+
|
396 |
$aioseop_updates = new AIOSEOP_Updates();
|
397 |
|
398 |
+
if ( AIOSEOPPRO ) {
|
399 |
$aioseop_pro_updates = new AIOSEOP_Pro_Updates();
|
400 |
add_action( 'admin_init', array( $aioseop_pro_updates, 'version_updates' ), 12 );
|
401 |
}
|
402 |
|
403 |
+
if ( aioseop_option_isset( 'aiosp_unprotect_meta' ) ) {
|
404 |
add_filter( 'is_protected_meta', 'aioseop_unprotect_meta', 10, 3 );
|
405 |
+
}
|
|
|
|
|
406 |
|
407 |
add_action( 'init', array( $aiosp, 'add_hooks' ) );
|
408 |
add_action( 'admin_init', array( $aioseop_updates, 'version_updates' ), 11 );
|
409 |
+
|
410 |
+
if ( defined( 'DOING_AJAX' ) && ! empty( $_POST ) && ! empty( $_POST['action'] ) && 'aioseop_ajax_scan_header' === $_POST['action'] ) {
|
411 |
remove_action( 'init', array( $aiosp, 'add_hooks' ) );
|
412 |
+
add_action( 'admin_init', 'aioseop_scan_post_header' );
|
413 |
+
add_action( 'shutdown', 'aioseop_ajax_scan_header' ); // if the action doesn't run -- pdb
|
414 |
+
include_once( ABSPATH . 'wp-admin/includes/screen.php' );
|
415 |
global $current_screen;
|
416 |
+
if ( class_exists( 'WP_Screen' ) ) {
|
417 |
$current_screen = WP_Screen::get( 'front' );
|
418 |
+
}
|
419 |
}
|
420 |
}
|
421 |
}
|
424 |
//add_action( 'after_setup_theme', 'aioseop_load_modules' );
|
425 |
|
426 |
if ( is_admin() ) {
|
427 |
+
add_action( 'wp_ajax_aioseop_ajax_save_meta', 'aioseop_ajax_save_meta' );
|
428 |
+
add_action( 'wp_ajax_aioseop_ajax_save_url', 'aioseop_ajax_save_url' );
|
429 |
+
add_action( 'wp_ajax_aioseop_ajax_delete_url', 'aioseop_ajax_delete_url' );
|
430 |
+
add_action( 'wp_ajax_aioseop_ajax_scan_header', 'aioseop_ajax_scan_header' );
|
431 |
+
if ( AIOSEOPPRO ) {
|
432 |
add_action( 'wp_ajax_aioseop_ajax_facebook_debug', 'aioseop_ajax_facebook_debug' );
|
433 |
}
|
434 |
+
add_action( 'wp_ajax_aioseop_ajax_save_settings', 'aioseop_ajax_save_settings' );
|
435 |
+
add_action( 'wp_ajax_aioseop_ajax_get_menu_links', 'aioseop_ajax_get_menu_links' );
|
436 |
+
add_action( 'wp_ajax_aioseo_dismiss_yst_notice', 'aioseop_update_yst_detected_notice' );
|
437 |
+
add_action( 'wp_ajax_aioseo_dismiss_visibility_notice', 'aioseop_update_user_visibilitynotice' );
|
438 |
+
add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice', 'aioseop_woo_upgrade_notice_dismissed' );
|
439 |
+
if ( AIOSEOPPRO ) {
|
440 |
+
add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' );
|
441 |
}
|
442 |
}
|
443 |
|
444 |
+
if ( ! function_exists( 'aioseop_scan_post_header' ) ) {
|
445 |
function aioseop_scan_post_header() {
|
446 |
require_once( ABSPATH . WPINC . '/default-filters.php' );
|
447 |
global $wp_query;
|
448 |
$wp_query->query_vars['paged'] = 0;
|
449 |
+
query_posts( 'post_type=post&posts_per_page=1' );
|
450 |
+
if ( have_posts() ) {
|
451 |
+
the_post();
|
452 |
+
}
|
453 |
}
|
454 |
}
|
455 |
|
456 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'aioseop-init.php' );
|
|
|
457 |
|
458 |
+
if ( ! function_exists( 'aioseop_install' ) ) {
|
459 |
+
register_activation_hook( __FILE__, 'aioseop_install' );
|
460 |
|
461 |
+
function aioseop_install() {
|
462 |
+
aioseop_activate();
|
463 |
+
}
|
464 |
}
|
465 |
|
466 |
+
if ( ! function_exists( 'disable_all_in_one_free' ) ) {
|
467 |
+
function disable_all_in_one_free() {
|
468 |
+
if ( AIOSEOPPRO && is_plugin_active( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ) ) {
|
469 |
+
deactivate_plugins( 'all-in-one-seo-pack/all_in_one_seo_pack.php' );
|
470 |
+
}
|
471 |
}
|
472 |
+
}
|
css/aiosp_admin.css
CHANGED
@@ -1,72 +1,76 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
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 |
-
|
39 |
-
|
40 |
-
|
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 |
-
|
46 |
-
|
47 |
-
|
48 |
-
-moz-background-size: 16px 48px !important;
|
49 |
-
background-size: 16px 48px !important;
|
50 |
-
}
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
-moz-background-size: 16px 48px !important;
|
56 |
-
background-size: 16px 48px !important;
|
57 |
-
}
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image {
|
2 |
+
background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important;
|
3 |
+
}
|
4 |
+
|
5 |
+
#toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image {
|
6 |
+
background: url(../images/shield-sprite-16.png) no-repeat 8px 6px !important;
|
7 |
+
}
|
8 |
+
|
9 |
+
#toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image img {
|
10 |
+
display: none;
|
11 |
+
}
|
12 |
+
|
13 |
+
#toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image img {
|
14 |
+
display: none;
|
15 |
+
}
|
16 |
+
|
17 |
+
#adminmenu #toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image:before {
|
18 |
+
content: '';
|
19 |
+
}
|
20 |
+
|
21 |
+
#toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image:before {
|
22 |
+
content: '' !important;
|
23 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
#toplevel_page_all-in-one-seo-pack-pro-aioseop_class:hover .wp-menu-image, #toplevel_page_all-in-one-seo-pack-pro-aioseop_class.wp-has-current-submenu .wp-menu-image {
|
26 |
+
background-position: 8px -26px !important;
|
27 |
+
}
|
|
|
|
|
|
|
28 |
|
29 |
+
#toplevel_page_all-in-one-seo-pack-aioseop_class:hover .wp-menu-image, #toplevel_page_all-in-one-seo-pack-aioseop_class.wp-has-current-submenu .wp-menu-image {
|
30 |
+
background-position: 8px -26px !important;
|
31 |
+
}
|
|
|
|
|
|
|
32 |
|
33 |
+
#icon-aioseop.icon32 {
|
34 |
+
background: url(../images/shield32.png) no-repeat left top !important;
|
35 |
+
}
|
|
|
|
|
|
|
36 |
|
37 |
+
#aioseop_settings_header #message {
|
38 |
+
padding: 5px 0px 5px 50px;
|
39 |
+
background-image: url(../images/update32.png);
|
40 |
+
background-repeat: no-repeat;
|
41 |
+
background-position: 10px;
|
42 |
+
font-size: 14px;
|
43 |
+
min-height: 32px;
|
44 |
+
clear: none;
|
45 |
+
}
|
46 |
|
47 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and ( min--moz-device-pixel-ratio: 1.5), only screen and ( -o-min-device-pixel-ratio: 3/2), only screen and ( min-device-pixel-ratio: 1.5), only screen and ( min-resolution: 1.5dppx) {
|
48 |
+
|
49 |
+
#toplevel_page_all-in-one-seo-pack-pro-aioseop_class .wp-menu-image {
|
50 |
+
background-image: url('../images/shield-sprite-32.png') !important;
|
51 |
+
-webkit-background-size: 16px 48px !important;
|
52 |
+
-moz-background-size: 16px 48px !important;
|
53 |
+
background-size: 16px 48px !important;
|
54 |
+
}
|
55 |
+
|
56 |
+
#toplevel_page_all-in-one-seo-pack-aioseop_class .wp-menu-image {
|
57 |
+
background-image: url('../images/shield-sprite-32.png') !important;
|
58 |
+
-webkit-background-size: 16px 48px !important;
|
59 |
+
-moz-background-size: 16px 48px !important;
|
60 |
+
background-size: 16px 48px !important;
|
61 |
+
}
|
62 |
+
|
63 |
+
#icon-aioseop.icon32 {
|
64 |
+
background-image: url('../images/shield64.png') !important;
|
65 |
+
-webkit-background-size: 32px 32px !important;
|
66 |
+
-moz-background-size: 32px 32px !important;
|
67 |
+
background-size: 32px 32px !important;
|
68 |
+
}
|
69 |
+
|
70 |
+
#aioseop_settings_header #message {
|
71 |
+
background-image: url(../images/update64.png) !important;
|
72 |
+
-webkit-background-size: 32px 32px !important;
|
73 |
+
-moz-background-size: 32px 32px !important;
|
74 |
+
background-size: 32px 32px !important;
|
75 |
+
}
|
76 |
+
}
|
css/modules/aioseop_module-rtl.css
CHANGED
@@ -1,232 +1,246 @@
|
|
1 |
* {
|
2 |
-
|
3 |
}
|
4 |
|
5 |
.form-table.aioseop {
|
6 |
-
|
7 |
}
|
8 |
|
9 |
.form-table.aioseop th {
|
10 |
-
|
11 |
-
|
12 |
}
|
13 |
|
14 |
.aioseop_help_text_link,
|
15 |
.aioseop_help_text_link:active {
|
16 |
-
|
17 |
-
|
18 |
}
|
19 |
|
20 |
.aioseop_help_text_link span {
|
21 |
-
|
22 |
}
|
23 |
|
24 |
.aioseop_meta_box_help > label {
|
25 |
-
|
26 |
-
|
27 |
}
|
28 |
|
29 |
.aioseop_help_text_link img {
|
30 |
-
|
31 |
}
|
32 |
|
33 |
.aioseop_meta_box_help,
|
34 |
.aioseop_meta_box_help:active {
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
}
|
40 |
|
41 |
.aioseop_label {
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
}
|
47 |
|
48 |
.aioseop input[type="text"] {
|
49 |
-
|
50 |
}
|
51 |
|
52 |
.aioseop textarea {
|
53 |
-
|
54 |
}
|
55 |
|
56 |
.aioseop_help_text_div {
|
57 |
-
|
58 |
-
|
59 |
}
|
60 |
|
61 |
.aioseop_help_text {
|
62 |
-
|
63 |
-
|
64 |
}
|
65 |
|
66 |
.aioseop_head_nav {
|
67 |
-
|
68 |
}
|
69 |
|
70 |
.aioseop_head_nav_tab {
|
71 |
-
|
72 |
-
|
73 |
}
|
74 |
|
75 |
.aioseop_head_nav_tab:first-child {
|
76 |
-
|
77 |
}
|
78 |
|
79 |
.aioseop_header {
|
80 |
-
|
81 |
-
|
82 |
}
|
83 |
|
84 |
.aioseop_nopad {
|
85 |
-
|
86 |
}
|
87 |
|
88 |
.aioseop_adverts {
|
89 |
-
|
90 |
}
|
91 |
|
92 |
.aioseop_content {
|
93 |
-
|
94 |
}
|
95 |
|
96 |
#aiosp_feature_manager_metabox.postbox {
|
97 |
-
|
98 |
}
|
99 |
|
100 |
.aioseop_sidebar {
|
101 |
-
|
102 |
-
|
103 |
}
|
104 |
|
105 |
.aioseop_option_label {
|
106 |
-
|
107 |
-
|
108 |
}
|
109 |
|
110 |
.aioseop_settings_left {
|
111 |
-
|
112 |
}
|
113 |
|
114 |
.aioseop_option_input {
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
}
|
122 |
|
123 |
.aioseop_top {
|
124 |
-
|
125 |
}
|
126 |
|
127 |
.aioseop_right_sidebar {
|
128 |
-
|
129 |
}
|
130 |
|
131 |
div.aioseop_feature {
|
132 |
-
|
133 |
}
|
134 |
|
135 |
-
.aioseop_feature
|
136 |
float: left;
|
137 |
margin-right: 0;
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
.aioseop_follow_button {
|
142 |
-
|
143 |
-
|
144 |
}
|
145 |
|
146 |
.aioseop_wrapper {
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
}
|
151 |
|
152 |
.aioseop_input {
|
153 |
-
|
154 |
}
|
155 |
|
156 |
#aiosp div.preview_snippet {
|
157 |
-
|
158 |
}
|
159 |
|
160 |
#aiosp_sitemap_addl_pages,
|
161 |
#aiosp_video_sitemap_addl_pages {
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
}
|
166 |
|
167 |
.All_in_One_SEO_Pack_Opengraph table.aioseop_table {
|
168 |
-
|
169 |
-
|
170 |
}
|
171 |
|
172 |
.All_in_One_SEO_Pack_Opengraph table.aioseop_table th {
|
173 |
-
|
174 |
-
|
175 |
}
|
176 |
|
177 |
.All_in_One_SEO_Pack_Opengraph table.aioseop_table td {
|
178 |
-
|
179 |
-
|
180 |
}
|
181 |
|
182 |
#aiosp_sitemap_addl_pages_metabox table.aioseop_table td,
|
183 |
#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td {
|
184 |
-
|
185 |
-
|
186 |
}
|
187 |
|
188 |
.aioseop_settings_left .postbox {
|
189 |
-
|
190 |
}
|
191 |
|
192 |
.aioseop_option_setting_label {
|
193 |
-
|
194 |
-
|
195 |
}
|
196 |
|
197 |
.aioseop_settings_left .postbox .inside {
|
198 |
-
|
199 |
}
|
200 |
|
201 |
-
.postbox h2
|
202 |
-
|
203 |
}
|
204 |
|
205 |
#aiosp_settings_form .aioseop_no_label,
|
206 |
.aioseop_no_label {
|
207 |
-
|
208 |
-
|
209 |
}
|
210 |
|
211 |
.aioseop_module.error.below-h2 {
|
212 |
-
|
213 |
}
|
214 |
|
215 |
.robots img {
|
216 |
-
|
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 |
-
|
223 |
}
|
224 |
|
225 |
div.aioseop_notice a.aioseop_dismiss_link {
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
}
|
231 |
|
232 |
/*
|
@@ -237,65 +251,65 @@ div.aioseop_notice a.aioseop_dismiss_link {
|
|
237 |
|
238 |
}*/
|
239 |
.aioseop_help_text ul {
|
240 |
-
|
241 |
}
|
242 |
|
243 |
.aioseop_header_tabs li a.aioseop_header_tab {
|
244 |
-
|
245 |
}
|
246 |
|
247 |
.aioseop_header_tabs li:first-child a.aioseop_header_tab {
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
}
|
253 |
|
254 |
.aioseop_tab {
|
255 |
-
|
256 |
-
|
257 |
}
|
258 |
|
259 |
form#aiosp_settings_form,
|
260 |
.aioseop_tabs_div {
|
261 |
-
|
262 |
-
|
263 |
}
|
264 |
|
265 |
#aiosp_settings_form ul.sfwd_debug_settings li strong {
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
}
|
273 |
|
274 |
#aiosp_settings_form ul.sfwd_debug_settings li {
|
275 |
-
|
276 |
}
|
277 |
|
278 |
.aioseop_advert {
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
}
|
283 |
|
284 |
.aioseop_advert form input {
|
285 |
-
|
286 |
}
|
287 |
|
288 |
.MRL {
|
289 |
-
|
290 |
-
|
291 |
}
|
292 |
|
293 |
.aioseop_upload_image_label {
|
294 |
-
|
295 |
-
|
296 |
}
|
297 |
|
298 |
.aioseop_upload_image_button {
|
299 |
-
|
300 |
-
|
301 |
-
}
|
1 |
* {
|
2 |
+
direction: rtl !important
|
3 |
}
|
4 |
|
5 |
.form-table.aioseop {
|
6 |
+
clear: none
|
7 |
}
|
8 |
|
9 |
.form-table.aioseop th {
|
10 |
+
padding: 10px 9px 12px 0;
|
11 |
+
direction: rtl
|
12 |
}
|
13 |
|
14 |
.aioseop_help_text_link,
|
15 |
.aioseop_help_text_link:active {
|
16 |
+
text-align: right;
|
17 |
+
float: right
|
18 |
}
|
19 |
|
20 |
.aioseop_help_text_link span {
|
21 |
+
left: -60px;
|
22 |
}
|
23 |
|
24 |
.aioseop_meta_box_help > label {
|
25 |
+
margin-left: 0;
|
26 |
+
margin-right: 8px
|
27 |
}
|
28 |
|
29 |
.aioseop_help_text_link img {
|
30 |
+
float: left
|
31 |
}
|
32 |
|
33 |
.aioseop_meta_box_help,
|
34 |
.aioseop_meta_box_help:active {
|
35 |
+
float: left;
|
36 |
+
padding-left: 0;
|
37 |
+
margin-right: 0;
|
38 |
+
margin-left: 64px
|
39 |
}
|
40 |
|
41 |
.aioseop_label {
|
42 |
+
padding-left: 0;
|
43 |
+
padding-right: 20px;
|
44 |
+
text-align: right;
|
45 |
+
direction: rtl
|
46 |
}
|
47 |
|
48 |
.aioseop input[type="text"] {
|
49 |
+
padding: 2px 10px 2px 0
|
50 |
}
|
51 |
|
52 |
.aioseop textarea {
|
53 |
+
padding: 10px 10px 0 0
|
54 |
}
|
55 |
|
56 |
.aioseop_help_text_div {
|
57 |
+
text-align: right;
|
58 |
+
margin: 8px 0 10px 0
|
59 |
}
|
60 |
|
61 |
.aioseop_help_text {
|
62 |
+
float: right;
|
63 |
+
clear: right
|
64 |
}
|
65 |
|
66 |
.aioseop_head_nav {
|
67 |
+
float: right
|
68 |
}
|
69 |
|
70 |
.aioseop_head_nav_tab {
|
71 |
+
margin: 0 15px 0 0;
|
72 |
+
float: right
|
73 |
}
|
74 |
|
75 |
.aioseop_head_nav_tab:first-child {
|
76 |
+
margin-right: 0
|
77 |
}
|
78 |
|
79 |
.aioseop_header {
|
80 |
+
float: right;
|
81 |
+
clear: right
|
82 |
}
|
83 |
|
84 |
.aioseop_nopad {
|
85 |
+
padding-right: 0
|
86 |
}
|
87 |
|
88 |
.aioseop_adverts {
|
89 |
+
float: left
|
90 |
}
|
91 |
|
92 |
.aioseop_content {
|
93 |
+
clear: right
|
94 |
}
|
95 |
|
96 |
#aiosp_feature_manager_metabox.postbox {
|
97 |
+
float: right
|
98 |
}
|
99 |
|
100 |
.aioseop_sidebar {
|
101 |
+
margin-left: 0;
|
102 |
+
margin-right: 10px
|
103 |
}
|
104 |
|
105 |
.aioseop_option_label {
|
106 |
+
float: right !important;
|
107 |
+
clear: right !important;
|
108 |
}
|
109 |
|
110 |
.aioseop_settings_left {
|
111 |
+
float: right;
|
112 |
}
|
113 |
|
114 |
.aioseop_option_input {
|
115 |
+
float: left; /*clear: right !important;*/
|
116 |
+
padding-left: 0;
|
117 |
+
padding-right: 1px;
|
118 |
+
margin-bottom: 20px;
|
119 |
+
width: 60%;
|
120 |
+
min-width: 160px;
|
121 |
}
|
122 |
|
123 |
.aioseop_top {
|
124 |
+
margin: 10px 0 0 10px
|
125 |
}
|
126 |
|
127 |
.aioseop_right_sidebar {
|
128 |
+
float: left
|
129 |
}
|
130 |
|
131 |
div.aioseop_feature {
|
132 |
+
float: right
|
133 |
}
|
134 |
|
135 |
+
.aioseop_feature #free-flag {
|
136 |
float: left;
|
137 |
margin-right: 0;
|
138 |
+
background: none repeat scroll 0 0 #D23D46;
|
139 |
+
color: #FFFFFF;
|
140 |
+
padding: 5px 12px;
|
141 |
+
position: relative;
|
142 |
+
}
|
143 |
+
|
144 |
+
.aioseop_feature #free-flag:before,
|
145 |
+
.aioseop_feature #free-flag:after {
|
146 |
+
display: none;
|
147 |
+
}
|
148 |
+
|
149 |
+
.aioseop_feature .feature_button {
|
150 |
+
float: left;
|
151 |
+
margin-right: 0;
|
152 |
+
margin-left: 10px
|
153 |
}
|
154 |
|
155 |
.aioseop_follow_button {
|
156 |
+
margin-right: 0;
|
157 |
+
margin-left: 5px
|
158 |
}
|
159 |
|
160 |
.aioseop_wrapper {
|
161 |
+
padding-left: 0;
|
162 |
+
padding-right: 5px;
|
163 |
+
direction: rtl
|
164 |
}
|
165 |
|
166 |
.aioseop_input {
|
167 |
+
clear: left
|
168 |
}
|
169 |
|
170 |
#aiosp div.preview_snippet {
|
171 |
+
padding: 15px 7px 20px 15px
|
172 |
}
|
173 |
|
174 |
#aiosp_sitemap_addl_pages,
|
175 |
#aiosp_video_sitemap_addl_pages {
|
176 |
+
clear: right;
|
177 |
+
margin-left: 0;
|
178 |
+
margin-right: 20px
|
179 |
}
|
180 |
|
181 |
.All_in_One_SEO_Pack_Opengraph table.aioseop_table {
|
182 |
+
border-left: 0 solid #dfdfdf;
|
183 |
+
border-right: 1px solid #dfdfdf
|
184 |
}
|
185 |
|
186 |
.All_in_One_SEO_Pack_Opengraph table.aioseop_table th {
|
187 |
+
border-right: 0 solid #dfdfdf;
|
188 |
+
border-left: 1px solid #dfdfdf
|
189 |
}
|
190 |
|
191 |
.All_in_One_SEO_Pack_Opengraph table.aioseop_table td {
|
192 |
+
border-right: 0 solid #dfdfdf;
|
193 |
+
border-left: 1px solid #dfdfdf
|
194 |
}
|
195 |
|
196 |
#aiosp_sitemap_addl_pages_metabox table.aioseop_table td,
|
197 |
#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td {
|
198 |
+
padding-left: 0;
|
199 |
+
padding-right: 5%
|
200 |
}
|
201 |
|
202 |
.aioseop_settings_left .postbox {
|
203 |
+
float: right
|
204 |
}
|
205 |
|
206 |
.aioseop_option_setting_label {
|
207 |
+
padding-left: 0;
|
208 |
+
padding-right: 1px
|
209 |
}
|
210 |
|
211 |
.aioseop_settings_left .postbox .inside {
|
212 |
+
clear: left
|
213 |
}
|
214 |
|
215 |
+
.postbox h2 .Taha {
|
216 |
+
float: left !important;
|
217 |
}
|
218 |
|
219 |
#aiosp_settings_form .aioseop_no_label,
|
220 |
.aioseop_no_label {
|
221 |
+
float: right;
|
222 |
+
margin: 0 13px 0 23px
|
223 |
}
|
224 |
|
225 |
.aioseop_module.error.below-h2 {
|
226 |
+
margin: 0 0 15px 477px !important
|
227 |
}
|
228 |
|
229 |
.robots img {
|
230 |
+
margin: 0 2px 0 0
|
231 |
}
|
232 |
|
233 |
/* Robots.txt styling */
|
234 |
#aiosp_robots_generator_robotgen_wrapper .aioseop_option_div,
|
235 |
#aiosp_robots_generator_robothtml_wrapper .aioseop_option_div {
|
236 |
+
margin-top: 10px;
|
237 |
}
|
238 |
|
239 |
div.aioseop_notice a.aioseop_dismiss_link {
|
240 |
+
position: absolute;
|
241 |
+
top: 10px;
|
242 |
+
left: 10px;
|
243 |
+
text-align: left;
|
244 |
}
|
245 |
|
246 |
/*
|
251 |
|
252 |
}*/
|
253 |
.aioseop_help_text ul {
|
254 |
+
margin: 15px 20px 0 0
|
255 |
}
|
256 |
|
257 |
.aioseop_header_tabs li a.aioseop_header_tab {
|
258 |
+
margin: 5px 0 0 5px
|
259 |
}
|
260 |
|
261 |
.aioseop_header_tabs li:first-child a.aioseop_header_tab {
|
262 |
+
border-left: solid 0 #CCC;
|
263 |
+
border-right: solid 1px #CCC;
|
264 |
+
margin-left: 0;
|
265 |
+
margin-right: 5px
|
266 |
}
|
267 |
|
268 |
.aioseop_tab {
|
269 |
+
padding-left: 0;
|
270 |
+
padding-right: 5px
|
271 |
}
|
272 |
|
273 |
form#aiosp_settings_form,
|
274 |
.aioseop_tabs_div {
|
275 |
+
padding-right: 0;
|
276 |
+
padding-left: 477px
|
277 |
}
|
278 |
|
279 |
#aiosp_settings_form ul.sfwd_debug_settings li strong {
|
280 |
+
float: right;
|
281 |
+
text-align: left;
|
282 |
+
margin-right: 0;
|
283 |
+
margin-left: 8px;
|
284 |
+
padding-right: 0;
|
285 |
+
padding-left: 8px
|
286 |
}
|
287 |
|
288 |
#aiosp_settings_form ul.sfwd_debug_settings li {
|
289 |
+
clear: right
|
290 |
}
|
291 |
|
292 |
.aioseop_advert {
|
293 |
+
direction: rtl;
|
294 |
+
float: right;
|
295 |
+
z-index: 999999
|
296 |
}
|
297 |
|
298 |
.aioseop_advert form input {
|
299 |
+
float: left
|
300 |
}
|
301 |
|
302 |
.MRL {
|
303 |
+
margin-left: 0 !important;
|
304 |
+
margin-right: 20px !important;
|
305 |
}
|
306 |
|
307 |
.aioseop_upload_image_label {
|
308 |
+
clear: right !important;
|
309 |
+
float: none !important;
|
310 |
}
|
311 |
|
312 |
.aioseop_upload_image_button {
|
313 |
+
float: right !important;
|
314 |
+
margin-bottom: 5px !important;
|
315 |
+
}
|
css/modules/aioseop_module.css
CHANGED
@@ -1,1120 +1,1309 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
.form-table.aioseop
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
.
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
.
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
.
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
}
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
.
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
}
|
237 |
-
|
238 |
-
.
|
239 |
-
|
240 |
-
}
|
241 |
-
|
242 |
-
.
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
}
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
}
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
}
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
}
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
}
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
}
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
}
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
}
|
343 |
-
|
344 |
-
.
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
}
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
.
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
}
|
380 |
-
|
381 |
-
.
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
}
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
}
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
#
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
}
|
415 |
-
|
416 |
-
.
|
417 |
-
|
418 |
-
}
|
419 |
-
|
420 |
-
.
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
}
|
428 |
-
|
429 |
-
#
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
}
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
}
|
464 |
-
|
465 |
-
|
466 |
-
margin:
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
}
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
}
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
background
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
}
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
}
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
}
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
}
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
}
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
.
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
}
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
}
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
#
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
}
|
719 |
-
|
720 |
-
#
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
#
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
}
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
.
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
}
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
.
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
.
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
}
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
}
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
}
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
}
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
.
|
860 |
-
.
|
861 |
-
|
862 |
-
|
863 |
-
}
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
}
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
.
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
}
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
}
|
950 |
-
|
951 |
-
.
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
.
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
.
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
}
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
}
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Controls all the styling of the plugin.
|
3 |
+
*
|
4 |
+
* @author Michael Torbert.
|
5 |
+
* @author Semper Fi Web Design.
|
6 |
+
* @copyright http://semperplugins.com
|
7 |
+
* @package All-in-One-SEO-Pack.
|
8 |
+
*/
|
9 |
+
|
10 |
+
.form-table.aioseop {
|
11 |
+
clear: none;
|
12 |
+
}
|
13 |
+
|
14 |
+
.form-table.aioseop td {
|
15 |
+
vertical-align: top;
|
16 |
+
padding: 16px 0 10px 0;
|
17 |
+
line-height: 20px;
|
18 |
+
font-size: 12px;
|
19 |
+
}
|
20 |
+
|
21 |
+
.form-table.aioseop th {
|
22 |
+
width: 200px;
|
23 |
+
padding: 10px 0 12px 9px;
|
24 |
+
}
|
25 |
+
|
26 |
+
.aioseop_help_text_link,
|
27 |
+
.aioseop_help_text_link:active {
|
28 |
+
text-align: left;
|
29 |
+
float: left;
|
30 |
+
max-width: 300px;
|
31 |
+
min-width: 1px;
|
32 |
+
padding-top: 2px;
|
33 |
+
outline: none;
|
34 |
+
color: #888;
|
35 |
+
border: 2px solid #888;
|
36 |
+
border-radius: 33px;
|
37 |
+
width: 22px;
|
38 |
+
height: 20px;
|
39 |
+
font-family: sans-serif;
|
40 |
+
}
|
41 |
+
|
42 |
+
.aioseop_help_text_link span {
|
43 |
+
position: absolute;
|
44 |
+
left: 21px;
|
45 |
+
font-size: 14px;
|
46 |
+
}
|
47 |
+
|
48 |
+
.aioseop_help_text_link:before {
|
49 |
+
content: '\a0?';
|
50 |
+
color: #888;
|
51 |
+
font-size: 19px;
|
52 |
+
}
|
53 |
+
|
54 |
+
#aioseop-support .aioseop_metabox_text,
|
55 |
+
#aioseop-support a {
|
56 |
+
font-size: 14px;
|
57 |
+
color: #000;
|
58 |
+
text-decoration: none;
|
59 |
+
}
|
60 |
+
|
61 |
+
.aioseop_icon {
|
62 |
+
display: inline-block;
|
63 |
+
width: 40px;
|
64 |
+
height: 40px;
|
65 |
+
background-repeat: no-repeat;
|
66 |
+
background-size: 100%;
|
67 |
+
vertical-align: middle;
|
68 |
+
margin: 10px;
|
69 |
+
}
|
70 |
+
|
71 |
+
.aioseop_book_icon {
|
72 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==);
|
73 |
+
}
|
74 |
+
|
75 |
+
.aioseop_cog_icon {
|
76 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAeFBMVEUAAAAAn+MAnOIAn+cAneIAneEAn+MAnuEAneIAnuAAnuAAneEAn+cAn+QAn98AnuEAn98AneAAneEAneAAnOIAnuAAnuEAnuAAneEAn+EAnuEAnuAAneEAneAAneAAn+QAnuEAnuABnuEAneAAn+EAnuIAnuMBnuHeY3dlAAAAJ3RSTlMAQFAAYIAAkADP3wAgMACgEACfrwC/X++PbwAAcODwALDAANAATz8hP00ZAAACHklEQVR4Xq3XbWObIBAHcPAJJRjJVmtso4vL2vv+33AzJO2J/LuE9PfGFyR4HHiAgCQxyRMiYEtGTL5BBGzJiVEviIAtFTH6FRGowdBC/QsQqKGhhebeIdTkqe+LwFbkqew2SGyDftDKz12Q2AXYlhgeA46AD/G5oyD9zJO0zIEhvXd91L0mSPcmnZlek0nPhHu4mKu2ov+q2rZzOWE5kBRBFjNRzDRFqD6X8oGiHK5fo+0oSmcv06goknLfQk3RzHkaWwIGlUhrZaIGAto5iQn6uyw+yAFOpSgUTDEHJqqZc5DR2rgqw8lIa7mbRkkMLOOBoWZlWYrynwzGzx1C/3cdlEcvf7sgL5MTq8rGz22QNwjDP+cGBYBDOC6qcnLTNqQCeRbuYdEU4In47YjL84RSwEk+Tq8qT7xvhMc5eXsj78Buga866O4dQrXs4OEk3jaNTWC1Cfc43nSa0MQ0fCFFLWXL9saWFjQMgFOfEUR+zsl1KWeRBaWr3e7c01q3Lmld+FfiSVFQ/2ehp6B8IzaorGvJ8q8Jl/ViIkDv396tfX/bawKm81J+eGtLH91cX+xIUUZ7XYmPHTBmA0U4feMh6zqVwzTe8ubQvmBoUJeDphoIGtT5tVaq0Ttopvyom4M4xqz8YGXhiCLAnIKhg8N2iA30cLzrxmJH/H4cASejrjzcFHXpwrcukwIiRQZv2QICtjQP352/9fYuC+Qv593CTVvcgwkAAAAASUVORK5CYII=);
|
77 |
+
}
|
78 |
+
|
79 |
+
.aioseop_file_icon {
|
80 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==);
|
81 |
+
}
|
82 |
+
|
83 |
+
.aioseop_help_icon {
|
84 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAflBMVEUAAAAAn98AnuIAn+EAneAAnuAAnuAAn+QAn+QAneEAnuAAnuAAn+EAnuAAnuEAneAAn+cAneAAnuAAn98AnOIAnuEAneIAn+MAnuEAnuEAn+EAneIAneEAneEAnuEAn+MAneAAneEAnuMAnOIAn+cAneEBnuEAneAAnuMBnuEoGewkAAAAKXRSTlMAEE9/r7/fADCPzwBv718AIPDAAFCwYEAAoAAAn4CQAOAAPwAAcADQAFP96WQAAAMNSURBVHhelZcNc5swDIatBghpoCGEj9Jij2XLMv3/P7glkoNtZJo+d+0lhBOveSXZUjHgZZOkGf4nS5PNC5wiKPFqvnvFgNddvpVQy0tQZCiSFfCEAtiUGKXcwFcB3kpcpXx791HetypFn2NdH9EnrX67KPdL46g/tl3PeqHvWidM2fxyUM7n3fzgof8R0A9zjN3PGTV/HB+6teg66EeIUQqQIGOiSQMGmeRgUQfGPn/Ktyv0k9UQKrCxWzitAq3V6dvYIDG8f8mAROO6ULF/3ecTaHazcvIgjTw/PxfFeVFErCHd31C3fx2v39cKGy6qLKyA1tGr/v8BLWDyb3OLqiw+XGCiq8DFxIvypMKIHqMXvaeLmmyEkn1xSTCAjWcMS7gruFD+eo/QuEC7AYCy+nJXkC1/r5A4Gq2NrQCvjMnL7OZCLggY3KoAI5jMEvKt2hohBYK3wiveuwx8i3qn/uvVf0O2Hh5MnLwOZMTrXgGt4OCi7RuyXNg1F1oDqEZIQh2K6oUALalSWqgiIwUIM4VVqZZvdlkE7QQFFLRVNS3l5NLZarMkgkx6ebWiNPqzSu9nEkM2KDZhjbykh+19KKri3+LkIxLhVlE/E4CaAjsd4AYo9zJkR9huGF7CtPYSX9FyXG4XFHe2UQIt9fIGa6NNJBErX2r35O0wp7KEbZYSNpVtMYngSpbZYoI1G9YClFzOp+vKS6jviLFJ+fWgDralfZO5peW2xX8LKB9NdTtxsQuc7/wV0OTv/YRyiUuIugCls7FwizffsXHgzcRurjEjYgH8zdVKyODZJUDGAuxZubNnt5BIgMQ7YNyowy2c0XfCqyNX6HzE2Ve8A28+nmDDHaJyD9sNChpkxvCYRxgkEjitAkl40AzPjxm7KdNnSAzLgaNFZhcVATtkBmliGaTJSJ6mBnnkMWgpx+XAMZZoMbGZqXEHm6Q4sxA4F4k7DEkjD1PVGJCmGFDLQ5elO+Iqx7B/q88A0FKI+DSlBLMuE4pMF3h6+DZXDLia6PAtA41u67uUqW51E02uf46zvXx+HY4YAAAAAElFTkSuQmCC);
|
85 |
+
}
|
86 |
+
|
87 |
+
.aioseop_support_icon {
|
88 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAe1BMVEUAAAAAn98AnuIAn+EAneAAnuAAnuABnuEAn98An+QAneEAnuAAn+QAn+EAnuAAnuEAneAAnuEAneIAn+MAn+cAn+cAnuEAnuEAnOIAneEAneEAnOIAnuAAneEAn+MAneAAneEAneIAnuEAnuIAneAAnuAAneABnuEAnuPdwDkgAAAAKXRSTlMAEE9/r7/f/wAwj88Ab+9f0JBgQCAAALBQcAAAAJ8AAIAAoADgwPAAP4Dl7rAAAALsSURBVHgBtdcBc6I6EAfwRCH/KjUSTCW2eHK8kHff/xM+Dg5NlsTTOu830xmc0BhJdtllKXy1znKBgciz9Yq/JbC3mM22AFFsN+8x7H2B7wSixI4/sAK+lkiSa/63CfbXfy9VddAfA32oVHmdYn8MsaNP55jUhpOFmRqTXH/4mP/BSExOnxEnTKT58jDveouZaCIEZltvWna7POPm8GPhgJtzbIIMnvq4UMOTXWZsvjgjoD8IjcCZrkAh1H4SLUIq3EYDQjSEBGH8XdASVPUzUIGS2jsHORbyJpC8gzWDChGaPsL4ItnwxyUiuuPqnBdAkW9X/3SIkPxPMLWIkZJcL7XTNnKJb5J8XMEJ33YaVyCQYJUZ0tjGKIsE8XsXNuNUFpStvFMQGR4Xvhlyoppi51AjUAcZhdPRIVzr8UCzYzEfS91afxOJDle2Hc9IBaBoGMdg/raq/3s49/NPm/6TGQDl5Up3DoCN5G9uAbjOO6AlAMPa8Zd4JI0kP55k41EAWlaT+w0Ae4mytyAenQDUrCcZsCMr8igydADQM0ECrydf4zEA+uZGAygYBv96ivF4RG3GffNgsJiAfr439v9MUN7/CeXFgwGzrz1Eu9hG9eQ2Rg+SaKJE5CB1y6Ps7h1ld/FMR9mEm6vPEoCIBZMAIM/e8xoTQRjO+5y8fT0ZJvlc5PwJ57fymlDWMloBLKoHsb4mlPLCLnNKyxDIwpRGR72UtsEgUhoKrx7bR4Z3c1J9Tyft7ep3Wl9t04l/rFBefrFwh29y/N7L1TlynXy5JpbQHY3qS6Dslfnq4guYa+UXC4xBj4W+CSTvYFMEuOeLLKf9Ytssd5hw6TJv9FKhOeqeK3W7ZcNRP1Nsd7GOpXu83O/iLY8ij5CwmKlUz2TcIy2PIy2PT/eYZLRV5fsMk542XaHK3VrV/a+p7fu1uzWyjiZs9pPgrUOSa6ONJ8FPFlH2xB9uvlUJolTJ5juOm7buLQa2r1uvkSX+A/xd+1xZLxG0AAAAAElFTkSuQmCC);
|
89 |
+
}
|
90 |
+
|
91 |
+
.aioseop_youtube_icon {
|
92 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAARVBMVEUAAAAAn+cAn+EAneAAnuABnuEAn+cAn98AneEAn98AnOIAnuAAnOIAneIAneIAnuEAnuEAneEAnuEBnuEAn+QAneAAneCXjc90AAAAF3RSTlMAIG+vz/8AEJ8AUO8AYACgAHCwADDw0E/SOHoAAAEBSURBVHgB7dbBjsIgGATgH+UvCAso3fL+j7rDYZMerGGZQ5NNv8TrREZLRy47F3O7Wx1m7zezAMjSOa9/5t2jkweEqBNi+ALBJ+mklHOWnINOC/0buKjTokMHRQnlKUYpRl5HBQ32KFXfW783HVDFHgWsrg0EWNEDK4z0+yEAEhuAIsgAFMEFQOECILEBKIIMQBFcABQuABIbgCLIABTBBUBhAzx5BEuWGM/9GT35V7bkwxTPfZw9eaVZ8lKN517rI8NHmr43cPyufXi5Rh1Q+dc7PTAWduI83abTNteHJjvz6KEJYeoU2+/UBVcm+tuNbTCv2nRYq2k/9ylXwL8I+AGj+lzlceKDYQAAAABJRU5ErkJggg==);
|
93 |
+
}
|
94 |
+
|
95 |
+
.aioseop_help_text_link.aioseop_meta_box_help:before {
|
96 |
+
font-size: 14px;
|
97 |
+
}
|
98 |
+
|
99 |
+
.aioseop_meta_box_help > label {
|
100 |
+
position: absolute;
|
101 |
+
margin-left: 8px;
|
102 |
+
}
|
103 |
+
|
104 |
+
div.aioseop_tip_icon {
|
105 |
+
font-size: 14px;
|
106 |
+
border: 1px solid #888;
|
107 |
+
width: 1em;
|
108 |
+
text-align: center;
|
109 |
+
padding: 0 4px;
|
110 |
+
-webkit-border-radius: 12px;
|
111 |
+
-moz-border-radius: 12px;
|
112 |
+
-webkit-box-shadow: 1px 1px 1px #888;
|
113 |
+
-moz-box-shadow: 1px 1px 1px #888;
|
114 |
+
box-shadow: 1px 1px 1px #888;
|
115 |
+
border-radius: 12px;
|
116 |
+
}
|
117 |
+
|
118 |
+
div.aioseop_tip_icon:before {
|
119 |
+
content: '?';
|
120 |
+
}
|
121 |
+
|
122 |
+
.aioseop_help_text_link img {
|
123 |
+
width: 40px;
|
124 |
+
float: left;
|
125 |
+
}
|
126 |
+
|
127 |
+
.aioseop_meta_box_help,
|
128 |
+
.aioseop_meta_box_help:active {
|
129 |
+
float: right;
|
130 |
+
padding-left: 0;
|
131 |
+
width: 16px;
|
132 |
+
margin-right: 32px;
|
133 |
+
text-decoration: none;
|
134 |
+
height: 15px;
|
135 |
+
padding-top: 1px;
|
136 |
+
position: relative;
|
137 |
+
}
|
138 |
+
|
139 |
+
.aioseop_label {
|
140 |
+
color: #5F5F5F;
|
141 |
+
font-weight: bold;
|
142 |
+
line-height: 19px;
|
143 |
+
padding-left: 10px; /*changed from 20px to 10px for certain language support*/
|
144 |
+
display: inline-block;
|
145 |
+
text-align: left;
|
146 |
+
position: absolute;
|
147 |
+
font-family: 'Open Sans', sans-serif;
|
148 |
+
width: 26%;
|
149 |
+
min-width: 120px;
|
150 |
+
max-width: 230px;
|
151 |
+
}
|
152 |
+
|
153 |
+
.aioseop_option_div {
|
154 |
+
max-height: 160px;
|
155 |
+
min-height: 43px;
|
156 |
+
width: 95%;
|
157 |
+
overflow-y: auto;
|
158 |
+
}
|
159 |
+
|
160 |
+
.aioseop_overflowed {
|
161 |
+
border: 1px solid #e1e1e1;
|
162 |
+
}
|
163 |
+
|
164 |
+
.aioseop input[type="text"] {
|
165 |
+
color: #515151;
|
166 |
+
height: 35px;
|
167 |
+
padding: 10px 0 10px 10px;
|
168 |
+
font-size: 14px;
|
169 |
+
width: 95%;
|
170 |
+
max-width: 600px;
|
171 |
+
}
|
172 |
+
|
173 |
+
.aioseop textarea {
|
174 |
+
color: #515151;
|
175 |
+
padding: 10px 0 0 10px;
|
176 |
+
margin: 0;
|
177 |
+
font-size: 14px;
|
178 |
+
line-height: 25px;
|
179 |
+
width: 95%;
|
180 |
+
max-width: 600px;
|
181 |
+
}
|
182 |
+
|
183 |
+
.aioseop_help_text_div {
|
184 |
+
text-align: left;
|
185 |
+
width: 100%;
|
186 |
+
margin: 10px 0 10px 0;
|
187 |
+
}
|
188 |
+
|
189 |
+
.aioseop_help_text {
|
190 |
+
font-size: 12px;
|
191 |
+
float: left;
|
192 |
+
clear: left;
|
193 |
+
color: #797979;
|
194 |
+
line-height: 15px;
|
195 |
+
font-style: italic;
|
196 |
+
}
|
197 |
+
|
198 |
+
.aioseop_head_tagline {
|
199 |
+
color: #5F5F5F;
|
200 |
+
font-size: 13px;
|
201 |
+
}
|
202 |
+
|
203 |
+
.aioseop_head_nav {
|
204 |
+
float: left;
|
205 |
+
font-size: 18px;
|
206 |
+
margin: 0 0 16px 0;
|
207 |
+
font-family: "HelveticaNeue-Light",
|
208 |
+
"Helvetica Neue Light",
|
209 |
+
"Helvetica Neue",
|
210 |
+
sans-serif;
|
211 |
+
border-bottom: 1px solid #CCC;
|
212 |
+
width: 100%;
|
213 |
+
}
|
214 |
+
|
215 |
+
.aioseop_head_nav_tab {
|
216 |
+
padding: 10px 15px 10px 15px;
|
217 |
+
margin: 0 0 0 15px;
|
218 |
+
border-radius: 4px 4px 0 0;
|
219 |
+
border: 1px solid #CCC;
|
220 |
+
border-bottom: 0 white;
|
221 |
+
float: left;
|
222 |
+
opacity: 0.5;
|
223 |
+
color: black;
|
224 |
+
text-shadow: white 0 1px 0;
|
225 |
+
text-decoration: none;
|
226 |
+
}
|
227 |
+
|
228 |
+
.aioseop_head_nav_tab.aioseop_head_nav_active {
|
229 |
+
opacity: 1;
|
230 |
+
margin-bottom: -1px;
|
231 |
+
border-width: 1px;
|
232 |
+
}
|
233 |
+
|
234 |
+
.aioseop_head_nav_tab:first-child {
|
235 |
+
margin-left: 0;
|
236 |
+
}
|
237 |
+
|
238 |
+
.aioseop_head_nav_tab:hover {
|
239 |
+
opacity: 1;
|
240 |
+
}
|
241 |
+
|
242 |
+
.aioseop_header {
|
243 |
+
float: left;
|
244 |
+
clear: left;
|
245 |
+
}
|
246 |
+
|
247 |
+
.aioseop_advert {
|
248 |
+
padding: 10px;
|
249 |
+
margin-bottom: 30px;
|
250 |
+
border: 1px solid #DDD;
|
251 |
+
height: 200px;
|
252 |
+
width: 423px;
|
253 |
+
}
|
254 |
+
|
255 |
+
.headwaythemes {
|
256 |
+
background-color: #FFFFFF;
|
257 |
+
padding-bottom: 110px;
|
258 |
+
height: 125px;
|
259 |
+
}
|
260 |
+
|
261 |
+
.aioseop_nopad {
|
262 |
+
padding-left: 0;
|
263 |
+
padding-top: 0;
|
264 |
+
}
|
265 |
+
|
266 |
+
.aioseop_nopad_all {
|
267 |
+
padding: 0;
|
268 |
+
height: 220px;
|
269 |
+
width: 445px;
|
270 |
+
margin-bottom: 20px;
|
271 |
+
border: none;
|
272 |
+
}
|
273 |
+
|
274 |
+
.aioseop_adverts {
|
275 |
+
float: right;
|
276 |
+
}
|
277 |
+
|
278 |
+
.wincherad {
|
279 |
+
width: 100%;
|
280 |
+
height: 100%;
|
281 |
+
background-size: 100%;
|
282 |
+
background-repeat: no-repeat;
|
283 |
+
margin-bottom: 0;
|
284 |
+
border: none;
|
285 |
+
}
|
286 |
+
|
287 |
+
#wincher21 {
|
288 |
+
background-image: url(../../modules/images/banner21.jpg);
|
289 |
+
}
|
290 |
+
|
291 |
+
#wincher22 {
|
292 |
+
background-image: url(../../modules/images/banner22.jpg);
|
293 |
+
}
|
294 |
+
|
295 |
+
.aioseop_content {
|
296 |
+
min-width: 760px;
|
297 |
+
clear: left;
|
298 |
+
}
|
299 |
+
|
300 |
+
.aioseop_options_wrapper {
|
301 |
+
}
|
302 |
+
|
303 |
+
.aioseop_options_wrapper .hndle {
|
304 |
+
font-size: 15px;
|
305 |
+
font-family: Georgia,
|
306 |
+
"Times New Roman",
|
307 |
+
"Bitstream Charter",
|
308 |
+
Times,
|
309 |
+
serif;
|
310 |
+
font-weight: normal;
|
311 |
+
padding: 7px 10px;
|
312 |
+
margin: 0;
|
313 |
+
line-height: 1;
|
314 |
+
}
|
315 |
+
|
316 |
+
.aioseop_options_wrapper .submit input.button-primary {
|
317 |
+
margin-bottom: 5px;
|
318 |
+
}
|
319 |
+
|
320 |
+
#aiosp_feature_manager_metabox.postbox {
|
321 |
+
margin-top: 20px;
|
322 |
+
float: left;
|
323 |
+
}
|
324 |
+
|
325 |
+
.aioseop_advert p {
|
326 |
+
margin: 25px 0 25px 0;
|
327 |
+
}
|
328 |
+
|
329 |
+
.aioseop_options_wrapper .postarea {
|
330 |
+
border-color: #DFDFDF;
|
331 |
+
-moz-box-shadow: inset 0 1px 0 #fff;
|
332 |
+
-webkit-box-shadow: inset 0 1px 0 #fff;
|
333 |
+
box-shadow: inset 0 1px 0 #fff;
|
334 |
+
-moz-border-radius: 3px;
|
335 |
+
-webkit-border-radius: 3px;
|
336 |
+
border-radius: 3px;
|
337 |
+
}
|
338 |
+
|
339 |
+
.aioseop_advert h3 {
|
340 |
+
padding: 0;
|
341 |
+
margin-top: 6px;
|
342 |
+
}
|
343 |
+
|
344 |
+
.aioseop_metabox_text p {
|
345 |
+
margin: 0 0 0 0;
|
346 |
+
width: 101%;
|
347 |
+
}
|
348 |
+
|
349 |
+
.aioseop_sidebar {
|
350 |
+
width: 457px;
|
351 |
+
margin-left: 10px;
|
352 |
+
}
|
353 |
+
|
354 |
+
.aioseop_metabox_text {
|
355 |
+
margin-bottom: 0;
|
356 |
+
}
|
357 |
+
|
358 |
+
.aioseop_metabox_wrapper {
|
359 |
+
padding: 0;
|
360 |
+
}
|
361 |
+
|
362 |
+
.aioseop_metabox_text *:last-child {
|
363 |
+
margin: 0;
|
364 |
+
}
|
365 |
+
|
366 |
+
.aioseop_metabox_feature {
|
367 |
+
margin-top: 20px;
|
368 |
+
}
|
369 |
+
|
370 |
+
.aioseop_option_label {
|
371 |
+
float: left;
|
372 |
+
margin: 0;
|
373 |
+
min-width: 150px;
|
374 |
+
width: 37%;
|
375 |
+
max-width: 270px;
|
376 |
+
padding-top: 3px;
|
377 |
+
padding-bottom: 3px;
|
378 |
+
height: 67px !important; /*added for certain language support*/
|
379 |
+
}
|
380 |
+
|
381 |
+
.aioseop_metabox_text h2 {
|
382 |
+
font-size: 14px;
|
383 |
+
padding: 0;
|
384 |
+
font-weight: bold;
|
385 |
+
line-height: 29px;
|
386 |
+
}
|
387 |
+
|
388 |
+
#aioseop-about {
|
389 |
+
width: 443px;
|
390 |
+
margin-bottom: 20px;
|
391 |
+
}
|
392 |
+
|
393 |
+
#aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 {
|
394 |
+
font-size: 13px;
|
395 |
+
}
|
396 |
+
|
397 |
+
.aioseop_sidebar #mc-embedded-subscribe-form {
|
398 |
+
margin: 0 0 10px 0;
|
399 |
+
background: white;
|
400 |
+
padding: 10px 10px;
|
401 |
+
border: 1px solid #DDD;
|
402 |
+
}
|
403 |
+
|
404 |
+
.aioseop input[readonly] {
|
405 |
+
background-color: #EEE;
|
406 |
+
margin: 5px 0 5px 0 !important;
|
407 |
+
}
|
408 |
+
|
409 |
+
.aioseop_settings_left {
|
410 |
+
float: left;
|
411 |
+
padding: 0;
|
412 |
+
margin: 0;
|
413 |
+
width: 100%;
|
414 |
+
}
|
415 |
+
|
416 |
+
body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left {
|
417 |
+
margin-top: 20px;
|
418 |
+
}
|
419 |
+
|
420 |
+
body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left {
|
421 |
+
margin-top: 20px;
|
422 |
+
}
|
423 |
+
|
424 |
+
#aioseop_top_button {
|
425 |
+
margin-top: 5px;
|
426 |
+
height: 30px;
|
427 |
+
}
|
428 |
+
|
429 |
+
#aioseop-list #mce-EMAIL {
|
430 |
+
margin-top: 5px;
|
431 |
+
width: 250px;
|
432 |
+
}
|
433 |
+
|
434 |
+
.aioseop_top {
|
435 |
+
margin: 10px 10px 0 0;
|
436 |
+
/* margin: 10px 477px 0px 0px; */
|
437 |
+
}
|
438 |
+
|
439 |
+
.aioseop_top #aioseop-list {
|
440 |
+
margin-bottom: 0;
|
441 |
+
}
|
442 |
+
|
443 |
+
.aioseop_right_sidebar {
|
444 |
+
float: right;
|
445 |
+
margin-top: 35px;
|
446 |
+
}
|
447 |
+
|
448 |
+
#aiosp_settings_form .button-primary.hidden {
|
449 |
+
display: none;
|
450 |
+
}
|
451 |
+
|
452 |
+
form#edittag div#aiosp_titleatr_wrapper,
|
453 |
+
form#edittag div#aiosp_menulabel_wrapper,
|
454 |
+
form#edittag div#aiosp_sitemap_exclude_wrapper {
|
455 |
+
display: none;
|
456 |
+
}
|
457 |
+
|
458 |
+
.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button {
|
459 |
+
height: 5px;
|
460 |
+
position: absolute;
|
461 |
+
top: 0;
|
462 |
+
width: 97%;
|
463 |
+
}
|
464 |
+
|
465 |
+
.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > .aioseop_settings_left {
|
466 |
+
margin-top: 10px;
|
467 |
+
}
|
468 |
+
|
469 |
+
.All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper {
|
470 |
+
margin-top: 10px;
|
471 |
+
}
|
472 |
+
|
473 |
+
div#aiosp_feature_manager_metabox .inside {
|
474 |
+
padding: 8px;
|
475 |
+
}
|
476 |
+
|
477 |
+
div.aioseop_feature {
|
478 |
+
position: relative;
|
479 |
+
display: inline-block;
|
480 |
+
float: left;
|
481 |
+
vertical-align: top;
|
482 |
+
width: 240px;
|
483 |
+
height: 288px;
|
484 |
+
margin: 8px;
|
485 |
+
border: 1px solid #DEDEDE;
|
486 |
+
-moz-border-radius: 3px;
|
487 |
+
-webkit-border-radius: 3px;
|
488 |
+
border-radius: 3px;
|
489 |
+
background: white;
|
490 |
+
padding: 10px 0 0;
|
491 |
+
-webkit-box-shadow: inset 0 1px 0 #fff,
|
492 |
+
inset 0 0 20px rgba(0, 0, 0, 0.05),
|
493 |
+
0 1px 2px rgba(0, 0, 0, 0.1);
|
494 |
+
-moz-box-shadow: inset 0 1px 0 #fff,
|
495 |
+
inset 0 0 20px rgba(0, 0, 0, 0.05),
|
496 |
+
0 1px 2px rgba(0, 0, 0, 0.1);
|
497 |
+
box-shadow: inset 0 1px 0 #fff,
|
498 |
+
inset 0 0 20px rgba(0, 0, 0, 0.05),
|
499 |
+
0 1px 2px rgba(0, 0, 0, 0.1);
|
500 |
+
-webkit-transition-duration: .4s;
|
501 |
+
-moz-transition-duration: .4s;
|
502 |
+
}
|
503 |
+
|
504 |
+
.aioseop_feature #free-flag {
|
505 |
+
float: right;
|
506 |
+
margin-right: -7px;
|
507 |
+
background: none repeat scroll 0 0 #D23D46;
|
508 |
+
color: #FFFFFF;
|
509 |
+
padding: 5px 12px 6px 5px;
|
510 |
+
position: relative;
|
511 |
+
}
|
512 |
+
|
513 |
+
.aioseop_feature #free-flag:before {
|
514 |
+
border-color: #D23D46 #D23D46 #D23D46 transparent;
|
515 |
+
border-style: solid;
|
516 |
+
border-width: 14px 4px 15px 10px;
|
517 |
+
content: "";
|
518 |
+
left: -14px;
|
519 |
+
position: absolute;
|
520 |
+
top: 0;
|
521 |
+
}
|
522 |
+
|
523 |
+
.aioseop_feature #free-flag:after {
|
524 |
+
border-color: #892026 transparent transparent;
|
525 |
+
border-style: solid;
|
526 |
+
border-width: 6px 6px 6px 0;
|
527 |
+
bottom: -12px;
|
528 |
+
content: "";
|
529 |
+
position: absolute;
|
530 |
+
right: 0;
|
531 |
+
}
|
532 |
+
|
533 |
+
#aioseop_coming_soon #free-flag {
|
534 |
+
display: none;
|
535 |
+
}
|
536 |
+
|
537 |
+
.aioseop_feature h3 {
|
538 |
+
font-size: 17px;
|
539 |
+
margin: 0;
|
540 |
+
padding: 0 10px 5px 10px;
|
541 |
+
font-weight: normal;
|
542 |
+
font-style: normal;
|
543 |
+
font-family: "Helvetica Neue",
|
544 |
+
Helvetica,
|
545 |
+
Arial,
|
546 |
+
"Lucida Grande",
|
547 |
+
Verdana,
|
548 |
+
"Bitstream Vera Sans",
|
549 |
+
sans-serif;
|
550 |
+
}
|
551 |
+
|
552 |
+
.aioseop_feature p {
|
553 |
+
line-height: 150%;
|
554 |
+
font-size: 12px;
|
555 |
+
font-family: Georgia,
|
556 |
+
"Times New Roman",
|
557 |
+
"Bitstream Charter",
|
558 |
+
Times, serif;
|
559 |
+
margin-bottom: 20px;
|
560 |
+
color: #666;
|
561 |
+
padding: 0 10px;
|
562 |
+
}
|
563 |
+
|
564 |
+
.aioseop_feature p.aioseop_desc {
|
565 |
+
min-height: 80px;
|
566 |
+
}
|
567 |
+
|
568 |
+
.aioseop_feature .feature_button {
|
569 |
+
float: right;
|
570 |
+
margin-bottom: 10px;
|
571 |
+
margin-right: 10px;
|
572 |
+
min-width: 80px;
|
573 |
+
text-align: center;
|
574 |
+
}
|
575 |
+
|
576 |
+
.aioseop_feature .feature_button:before {
|
577 |
+
content: "Activate";
|
578 |
+
}
|
579 |
+
|
580 |
+
.aioseop_feature .active.feature_button:before {
|
581 |
+
content: "Deactivate";
|
582 |
+
}
|
583 |
+
|
584 |
+
div.aioseop_feature .aioseop_featured_image {
|
585 |
+
min-height: 100px;
|
586 |
+
background-repeat: no-repeat;
|
587 |
+
display: block;
|
588 |
+
margin: 0 auto;
|
589 |
+
width: 133px;
|
590 |
+
}
|
591 |
+
|
592 |
+
div.aioseop_feature .aioseop_featured_image {
|
593 |
+
background-image: url(../../modules/images/Default-BW-Standard.png);
|
594 |
+
}
|
595 |
+
|
596 |
+
div.aioseop_feature .aioseop_featured_image.active {
|
597 |
+
background-image: url(../../modules/images/Default-Color-Standard.png);
|
598 |
+
}
|
599 |
+
|
600 |
+
div.aioseop_feature#aioseop_sitemap .aioseop_featured_image {
|
601 |
+
background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png);
|
602 |
+
}
|
603 |
+
|
604 |
+
div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active {
|
605 |
+
background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png);
|
606 |
+
}
|
607 |
+
|
608 |
+
div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image {
|
609 |
+
background-image: url(../../modules/images/VideoSitemap-BW-Standard.png);
|
610 |
+
}
|
611 |
+
|
612 |
+
div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active {
|
613 |
+
background-image: url(../../modules/images/VideoSitemap-Color-Standard.png);
|
614 |
+
}
|
615 |
+
|
616 |
+
div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
|
617 |
+
background-image: url(../../modules/images/SocialMeta-BW-Standard.png);
|
618 |
+
}
|
619 |
+
|
620 |
+
div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
|
621 |
+
background-image: url(../../modules/images/SocialMeta-Color-Standard.png);
|
622 |
+
}
|
623 |
+
|
624 |
+
div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image {
|
625 |
+
background-image: url(../../modules/images/Robots-BW-Standard.png);
|
626 |
+
}
|
627 |
+
|
628 |
+
div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active {
|
629 |
+
background-image: url(../../modules/images/Robots-Color-Standard.png);
|
630 |
+
}
|
631 |
+
|
632 |
+
div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
|
633 |
+
background-image: url(../../modules/images/FileEditor-BW-Standard.png);
|
634 |
+
}
|
635 |
+
|
636 |
+
div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
|
637 |
+
background-image: url(../../modules/images/FileEditor-Color-Standard.png);
|
638 |
+
}
|
639 |
+
|
640 |
+
div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
|
641 |
+
background-image: url(../../modules/images/ImporterExporter-BW-Standard.png);
|
642 |
+
}
|
643 |
+
|
644 |
+
div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
|
645 |
+
background-image: url(../../modules/images/ImporterExporter-Color-Standard.png);
|
646 |
+
}
|
647 |
+
|
648 |
+
div.aioseop_feature#aioseop_performance .aioseop_featured_image {
|
649 |
+
background-image: url(../../modules/images/Performance-BW-Standard.png);
|
650 |
+
}
|
651 |
+
|
652 |
+
div.aioseop_feature#aioseop_performance .aioseop_featured_image.active {
|
653 |
+
background-image: url(../../modules/images/Performance-Color-Standard.png);
|
654 |
+
}
|
655 |
+
|
656 |
+
div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
|
657 |
+
background-image: url(../../modules/images/Default-Color-Standard.png);
|
658 |
+
}
|
659 |
+
|
660 |
+
div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
|
661 |
+
background-image: url(../../modules/images/Default-Color-Standard.png);
|
662 |
+
}
|
663 |
+
|
664 |
+
.All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table,
|
665 |
+
.All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table {
|
666 |
+
max-width: 500px;
|
667 |
+
clear: none;
|
668 |
+
}
|
669 |
+
|
670 |
+
.aioseop_follow_button {
|
671 |
+
min-height: 50px;
|
672 |
+
background-repeat: no-repeat;
|
673 |
+
display: inline-block;
|
674 |
+
width: 100px;
|
675 |
+
background-size: auto 50px !important;
|
676 |
+
margin-right: 0;
|
677 |
+
}
|
678 |
+
|
679 |
+
.aioseop_facebook_follow {
|
680 |
+
background-image: url(../../modules/images/facebook-follow-standard.png);
|
681 |
+
}
|
682 |
+
|
683 |
+
.aioseop_twitter_follow {
|
684 |
+
background-image: url(../../modules/images/twitter-follow-standard.png);
|
685 |
+
}
|
686 |
+
|
687 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and ( min--moz-device-pixel-ratio: 1.5), only screen and ( -o-min-device-pixel-ratio: 3/2), only screen and ( min-device-pixel-ratio: 1.5), only screen and ( min-resolution: 1.5dppx) {
|
688 |
+
div.aioseop_feature .aioseop_featured_image {
|
689 |
+
background-size: auto 100px !important;
|
690 |
+
}
|
691 |
+
|
692 |
+
div.aioseop_feature .aioseop_featured_image.active {
|
693 |
+
background-image: url(../../modules/images/Default-Color-Retina.png);
|
694 |
+
}
|
695 |
+
|
696 |
+
div.aioseop_feature .aioseop_featured_image {
|
697 |
+
background-image: url(../../modules/images/Default-BW-Retina.png);
|
698 |
+
}
|
699 |
+
|
700 |
+
div.aioseop_feature#aioseop_sitemap .aioseop_featured_image {
|
701 |
+
background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png);
|
702 |
+
}
|
703 |
+
|
704 |
+
div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active {
|
705 |
+
background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png);
|
706 |
+
}
|
707 |
+
|
708 |
+
div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image {
|
709 |
+
background-image: url(../../modules/images/VideoSitemap-BW-Retina.png);
|
710 |
+
}
|
711 |
+
|
712 |
+
div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active {
|
713 |
+
background-image: url(../../modules/images/VideoSitemap-Color-Retina.png);
|
714 |
+
}
|
715 |
+
|
716 |
+
div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
|
717 |
+
background-image: url(../../modules/images/SocialMeta-BW-Retina.png);
|
718 |
+
}
|
719 |
+
|
720 |
+
div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
|
721 |
+
background-image: url(../../modules/images/SocialMeta-Color-Retina.png);
|
722 |
+
}
|
723 |
+
|
724 |
+
div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image {
|
725 |
+
background-image: url(../../modules/images/Robots-BW-Retina.png);
|
726 |
+
}
|
727 |
+
|
728 |
+
div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active {
|
729 |
+
background-image: url(../../modules/images/Robots-Color-Retina.png);
|
730 |
+
}
|
731 |
+
|
732 |
+
div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
|
733 |
+
background-image: url(../../modules/images/FileEditor-BW-Retina.png);
|
734 |
+
}
|
735 |
+
|
736 |
+
div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
|
737 |
+
background-image: url(../../modules/images/FileEditor-Color-Retina.png);
|
738 |
+
}
|
739 |
+
|
740 |
+
div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
|
741 |
+
background-image: url(../../modules/images/ImporterExporter-BW-Retina.png);
|
742 |
+
}
|
743 |
+
|
744 |
+
div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
|
745 |
+
background-image: url(../../modules/images/ImporterExporter-Color-Retina.png);
|
746 |
+
}
|
747 |
+
|
748 |
+
div.aioseop_feature#aioseop_performance .aioseop_featured_image {
|
749 |
+
background-image: url(../../modules/images/Performance-BW-Retina.png);
|
750 |
+
}
|
751 |
+
|
752 |
+
div.aioseop_feature#aioseop_performance .aioseop_featured_image.active {
|
753 |
+
background-image: url(../../modules/images/Performance-Color-Retina.png);
|
754 |
+
}
|
755 |
+
|
756 |
+
div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
|
757 |
+
background-image: url(../../modules/images/Default-BW-Retina.png);
|
758 |
+
}
|
759 |
+
|
760 |
+
div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
|
761 |
+
background-image: url(../../modules/images/Default-BW-Retina.png);
|
762 |
+
}
|
763 |
+
|
764 |
+
.aioseop_facebook_follow {
|
765 |
+
background-image: url(../../modules/images/facebook-follow-retina.png);
|
766 |
+
}
|
767 |
+
|
768 |
+
.aioseop_twitter_follow {
|
769 |
+
background-image: url(../../modules/images/twitter-follow-retina.png);
|
770 |
+
}
|
771 |
+
}
|
772 |
+
|
773 |
+
.aioseop_options {
|
774 |
+
width: 100%;
|
775 |
+
margin: 18px 0 10px 0;
|
776 |
+
}
|
777 |
+
|
778 |
+
.aioseop_wrapper {
|
779 |
+
width: 100%;
|
780 |
+
padding-left: 5px;
|
781 |
+
}
|
782 |
+
|
783 |
+
.aioseop_input {
|
784 |
+
clear: left;
|
785 |
+
width: 100%;
|
786 |
+
padding: 5px;
|
787 |
+
display: inline;
|
788 |
+
}
|
789 |
+
|
790 |
+
.aioseop_option_input {
|
791 |
+
float: left;
|
792 |
+
width: 61%;
|
793 |
+
margin: 0;
|
794 |
+
padding-left: 1px;
|
795 |
+
min-width: 160px;
|
796 |
+
/* max-width: 900px; */
|
797 |
+
}
|
798 |
+
|
799 |
+
#aiosp div.preview_snippet {
|
800 |
+
border: 1px solid #ebebeb;
|
801 |
+
padding: 15px 15px 20px 7px;
|
802 |
+
background-color: #fff;
|
803 |
+
}
|
804 |
+
|
805 |
+
div#aioseop_snippet {
|
806 |
+
font-family: arial, sans-serif;
|
807 |
+
font-size: 13px;
|
808 |
+
}
|
809 |
+
|
810 |
+
div#aioseop_snippet > h3 {
|
811 |
+
font-size: 16px;
|
812 |
+
padding: 8px 0;
|
813 |
+
border: 0;
|
814 |
+
background: inherit;
|
815 |
+
}
|
816 |
+
|
817 |
+
div#aioseop_snippet > h3 > a {
|
818 |
+
color: #12c;
|
819 |
+
text-decoration: none;
|
820 |
+
cursor: pointer;
|
821 |
+
}
|
822 |
+
|
823 |
+
div#aioseop_snippet > div {
|
824 |
+
color: #222;
|
825 |
+
max-width: 42em;
|
826 |
+
}
|
827 |
+
|
828 |
+
div#aioseop_snippet > div > div {
|
829 |
+
display: block;
|
830 |
+
margin-bottom: 1px;
|
831 |
+
}
|
832 |
+
|
833 |
+
div#aioseop_snippet > div > div > cite {
|
834 |
+
color: #093;
|
835 |
+
font-style: normal;
|
836 |
+
}
|
837 |
+
|
838 |
+
div#aioseop_snippet > div > span {
|
839 |
+
margin: 0;
|
840 |
+
padding: 0;
|
841 |
+
border: 0;
|
842 |
+
}
|
843 |
+
|
844 |
+
#aiosp_sitemap_addl_pages,
|
845 |
+
#aiosp_video_sitemap_addl_pages {
|
846 |
+
clear: left;
|
847 |
+
margin-left: 20px;
|
848 |
+
max-width: 1072px;
|
849 |
+
}
|
850 |
+
|
851 |
+
#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper,
|
852 |
+
#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper {
|
853 |
+
width: 23%;
|
854 |
+
min-width: 165px;
|
855 |
+
display: inline-block;
|
856 |
+
max-width: 265px;
|
857 |
+
}
|
858 |
+
|
859 |
+
#aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div,
|
860 |
+
#aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div {
|
861 |
+
position: absolute;
|
862 |
+
margin: 5px 0 10px 0;
|
863 |
+
}
|
864 |
+
|
865 |
+
#aiosp_sitemap_addl_pages_metabox .aioseop_option_input,
|
866 |
+
#aiosp_video_sitemap_addl_pages_metabox .aioseop_option_input {
|
867 |
+
width: 94%;
|
868 |
+
min-width: 94%;
|
869 |
+
}
|
870 |
+
|
871 |
+
#aiosp_sitemap_addl_pages_metabox table.aioseop_table,
|
872 |
+
#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table {
|
873 |
+
width: 96%;
|
874 |
+
border: 1px solid #CCC;
|
875 |
+
margin: 5px 0 10px 0;
|
876 |
+
}
|
877 |
+
|
878 |
+
table.aioseop_table tr:nth-child(odd) {
|
879 |
+
background-color: #EEE;
|
880 |
+
}
|
881 |
+
|
882 |
+
.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) {
|
883 |
+
background-color: rgba(238, 238, 238, 0.5);
|
884 |
+
}
|
885 |
+
|
886 |
+
table.aioseop_table td {
|
887 |
+
width: 23%;
|
888 |
+
}
|
889 |
+
|
890 |
+
.All_in_One_SEO_Pack_Opengraph table.aioseop_table {
|
891 |
+
width: 80%;
|
892 |
+
max-width: 800px;
|
893 |
+
display: block;
|
894 |
+
border-top: 1px solid #dfdfdf;
|
895 |
+
border-left: 1px solid #dfdfdf;
|
896 |
+
}
|
897 |
+
|
898 |
+
.All_in_One_SEO_Pack_Opengraph table.aioseop_table th {
|
899 |
+
width: 18%;
|
900 |
+
border-right: 1px solid #dfdfdf;
|
901 |
+
border-bottom: 1px solid #dfdfdf;
|
902 |
+
}
|
903 |
+
|
904 |
+
.All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info {
|
905 |
+
margin-top: 10px;
|
906 |
+
border: 1px solid #dfdfdf;
|
907 |
+
width: 80%;
|
908 |
+
max-width: 800px;
|
909 |
+
}
|
910 |
+
|
911 |
+
.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th {
|
912 |
+
background: #f1f1f1;
|
913 |
+
background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9));
|
914 |
+
background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9);
|
915 |
+
background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9);
|
916 |
+
background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9);
|
917 |
+
background-image: linear-gradient(to top, #ececec, #f9f9f9);
|
918 |
+
padding: 5px;
|
919 |
+
border-bottom-color: #dfdfdf;
|
920 |
+
text-shadow: #fff 0 1px 0;
|
921 |
+
-webkit-box-shadow: 0 1px 0 #fff;
|
922 |
+
-moz-box-shadow: 0 1px 0 #fff;
|
923 |
+
box-shadow: 0 1px 0 #fff;
|
924 |
+
}
|
925 |
+
|
926 |
+
.All_in_One_SEO_Pack_Opengraph table.aioseop_table td {
|
927 |
+
border-right: 1px solid #dfdfdf;
|
928 |
+
border-bottom: 1px solid #dfdfdf;
|
929 |
+
}
|
930 |
+
|
931 |
+
#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item {
|
932 |
+
display: inline-block;
|
933 |
+
width: 30%;
|
934 |
+
vertical-align: top;
|
935 |
+
}
|
936 |
+
|
937 |
+
#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) {
|
938 |
+
font-weight: bold;
|
939 |
+
}
|
940 |
+
|
941 |
+
#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) {
|
942 |
+
width: 70%;
|
943 |
+
}
|
944 |
+
|
945 |
+
#aiosp_sitemap_addl_pages_metabox table.aioseop_table td,
|
946 |
+
#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td {
|
947 |
+
width: 25%;
|
948 |
+
padding-left: 5%;
|
949 |
+
}
|
950 |
+
|
951 |
+
table.aioseop_table td, table.aioseop_table th {
|
952 |
+
padding: 3px;
|
953 |
+
}
|
954 |
+
|
955 |
+
.aioseop_top_label .aioseop_option_input,
|
956 |
+
.aioseop_no_label .aioseop_option_input {
|
957 |
+
width: 100%;
|
958 |
+
}
|
959 |
+
|
960 |
+
#aiosp_settings_form .postbox {
|
961 |
+
margin: 0 0 20px 0;
|
962 |
+
}
|
963 |
+
|
964 |
+
.aioseop_settings_left .postbox {
|
965 |
+
float: left;
|
966 |
+
width: 100%;
|
967 |
+
}
|
968 |
+
|
969 |
+
.aioseop_option_setting_label {
|
970 |
+
min-height: 35px;
|
971 |
+
display: inline-block;
|
972 |
+
white-space: nowrap;
|
973 |
+
overflow: hidden;
|
974 |
+
padding-left: 1px;
|
975 |
+
max-width: 229px;
|
976 |
+
min-width: 160px;
|
977 |
+
width: 33%;
|
978 |
+
}
|
979 |
+
|
980 |
+
.aioseop_settings_left .postbox .inside {
|
981 |
+
padding: 0;
|
982 |
+
margin: 0;
|
983 |
+
clear: right;
|
984 |
+
}
|
985 |
+
|
986 |
+
#aiosp_settings_form .aioseop_no_label, .aioseop_no_label {
|
987 |
+
float: left;
|
988 |
+
width: 92%;
|
989 |
+
max-width: 100%;
|
990 |
+
margin: 0 23px 0 13px;
|
991 |
+
}
|
992 |
+
|
993 |
+
.aioseop_top_label {
|
994 |
+
width: 96%;
|
995 |
+
margin: 0 10px;
|
996 |
+
}
|
997 |
+
|
998 |
+
.aioseop_hidden_type {
|
999 |
+
margin: 0;
|
1000 |
+
padding: 0;
|
1001 |
+
height: 0;
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
.aioseop_module.error.below-h2 {
|
1005 |
+
padding: 5px 0;
|
1006 |
+
margin: 0 477px 15px 0 !important;
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
#aioseop_opengraph_settings .inside {
|
1010 |
+
margin: 0;
|
1011 |
+
padding: 0;
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
#aioseop_opengraph_settings_image_wrapper img {
|
1015 |
+
width: auto;
|
1016 |
+
height: 75px;
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
#aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label {
|
1020 |
+
max-width: 160px;
|
1021 |
+
min-width: 100px;
|
1022 |
+
width: 30%;
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
.aioseop_input input[type="checkbox"],
|
1026 |
+
.aioseop_input input[type="radio"] {
|
1027 |
+
vertical-align: text-bottom;
|
1028 |
+
margin-top: 8px;
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
#aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div {
|
1032 |
+
max-height: initial;
|
1033 |
+
}
|
1034 |
+
|
1035 |
+
#aiosp {
|
1036 |
+
width: 100%;
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
.aioseop_input.aioseop_top_label .aioseop_option_input {
|
1040 |
+
margin: 0 0 10px 0;
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
.aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div {
|
1044 |
+
max-height: none;
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
/* Robots.txt styling */
|
1048 |
+
#aiosp_robots_generator_robotgen_wrapper .aioseop_option_div,
|
1049 |
+
#aiosp_robots_generator_robothtml_wrapper .aioseop_option_div {
|
1050 |
+
max-height: none;
|
1051 |
+
}
|
1052 |
+
|
1053 |
+
.aioseop_option_input .widefat td {
|
1054 |
+
vertical-align: middle;
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
.entry-row.robots.quirks {
|
1058 |
+
font-weight: bold;
|
1059 |
+
opacity: 1;
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
.entry-row.robots {
|
1063 |
+
opacity: 0.8;
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
.entry-row.robots.invalid {
|
1067 |
+
opacity: 1;
|
1068 |
+
font-weight: bold;
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
.invalid .entry_label {
|
1072 |
+
font-weight: bold;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
.aioseop .aioseop_option_input tbody {
|
1076 |
+
background: #FCFCFC;
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
.All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody {
|
1080 |
+
background: transparent;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
.entry-row.robots div {
|
1084 |
+
height: 20px;
|
1085 |
+
vertical-align: middle;
|
1086 |
+
width: 90%;
|
1087 |
+
margin: 0 0 4px 0;
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
.robots img {
|
1091 |
+
margin: 0 0 0 2px;
|
1092 |
+
opacity: 0.6;
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
.aioseop_option_docs {
|
1096 |
+
width: 98%;
|
1097 |
+
display: none;
|
1098 |
+
border: 1px solid #D3D3D3;
|
1099 |
+
margin-top: 20px;
|
1100 |
+
padding: 1%;
|
1101 |
+
background-color: #EEE;
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
.aioseop_option_docs h3 {
|
1105 |
+
background: none;
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
div.aioseop_notice {
|
1109 |
+
position: relative;
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
div.aioseop_notice a.aioseop_dismiss_link {
|
1113 |
+
position: absolute;
|
1114 |
+
top: 10px;
|
1115 |
+
right: 10px;
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
.aioseop_error_notice {
|
1119 |
+
color: #f00;
|
1120 |
+
font-weight: bold;
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
.aioseop_input select {
|
1124 |
+
margin: 7px 0;
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
.aioseop_help_text ul {
|
1128 |
+
margin: 15px 0 0 20px;
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
.aioseop_help_text ul li {
|
1132 |
+
line-height: 20px;
|
1133 |
+
margin: 0;
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
.aioseop_sidebar #side-sortables {
|
1137 |
+
width: 98%;
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
#aioseop_opengraph_settings .aioseop_option_label {
|
1141 |
+
width: 30%;
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
.aioseop_tabs {
|
1145 |
+
padding-top: 6px;
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
.aioseop_tabs.hide,
|
1149 |
+
.aioseop_header_tabs.hide {
|
1150 |
+
display: block !important;
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
.aioseop_header_tabs li {
|
1154 |
+
display: inline;
|
1155 |
+
padding: 0;
|
1156 |
+
margin: 0;
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
.aioseop_header_tabs {
|
1160 |
+
margin: 0;
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
.aioseop_header_nav {
|
1164 |
+
margin: 0;
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
.aioseop_header_tabs li a.aioseop_header_tab.active {
|
1168 |
+
background-color: rgb(255, 255, 255);
|
1169 |
+
border-bottom-color: rgba(255, 255, 255, 0.5);
|
1170 |
+
font-weight: bold;
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
.aioseop_header_tabs li a.aioseop_header_tab {
|
1174 |
+
height: 18px;
|
1175 |
+
font: 13px/18px Arial,
|
1176 |
+
Helvetica,
|
1177 |
+
sans-serif normal;
|
1178 |
+
text-decoration: none;
|
1179 |
+
margin: 5px 5px 0 0;
|
1180 |
+
padding: 4px 5px 2px;
|
1181 |
+
cursor: pointer;
|
1182 |
+
-webkit-border-top-right-radius: 3px;
|
1183 |
+
-webkit-border-top-left-radius: 3px;
|
1184 |
+
border-top-right-radius: 3px;
|
1185 |
+
border-top-left-radius: 3px;
|
1186 |
+
background-color: rgb(255, 255, 255);
|
1187 |
+
background-color: rgba(255, 255, 255, 0.5);
|
1188 |
+
border: 1px solid #ccc;
|
1189 |
+
color: #5F5F5F;
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
/* Fix for Chrome */
|
1193 |
+
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
1194 |
+
|
1195 |
+
.aioseop_header_tabs li a.aioseop_header_tab {
|
1196 |
+
padding-bottom: 0;
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
/* Fix for Safari */
|
1201 |
+
_:-webkit-full-screen:not(:root:root), .aioseop_header_tabs li a.aioseop_header_tab {
|
1202 |
+
padding-bottom: 2px;
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
.aioseop_header_tabs li:first-child a.aioseop_header_tab {
|
1206 |
+
border-left: solid 1px #CCC;
|
1207 |
+
margin-left: 5px;
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
.aioseop_tab {
|
1211 |
+
border: solid 1px #CCC;
|
1212 |
+
background-color: rgb(255, 255, 255);
|
1213 |
+
background-color: rgba(255, 255, 255, 0.5);
|
1214 |
+
padding-left: 5px;
|
1215 |
+
}
|
1216 |
+
|
1217 |
+
.aioseop_loading {
|
1218 |
+
background-image: url('../../images/activity.gif');
|
1219 |
+
display: inline-block;
|
1220 |
+
width: 24px;
|
1221 |
+
height: 24px;
|
1222 |
+
margin: 0;
|
1223 |
+
padding: 0;
|
1224 |
+
vertical-align: bottom;
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
.aiosp_delete_url {
|
1228 |
+
background-image: url('../../images/delete.png');
|
1229 |
+
display: inline-block;
|
1230 |
+
width: 16px;
|
1231 |
+
height: 16px;
|
1232 |
+
margin: 0;
|
1233 |
+
padding: 0;
|
1234 |
+
vertical-align: bottom;
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
form#aiosp_settings_form,
|
1238 |
+
.aioseop_tabs_div {
|
1239 |
+
padding-right: 477px;
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
.aioseop_tabs_div {
|
1243 |
+
margin-top: 10px;
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
#aiosp_settings_form ul.sfwd_debug_settings li strong {
|
1247 |
+
display: block;
|
1248 |
+
float: left;
|
1249 |
+
text-align: right;
|
1250 |
+
background-color: #DDD;
|
1251 |
+
margin-right: 8px;
|
1252 |
+
padding: 1px 8px 1px 1px;
|
1253 |
+
overflow: auto;
|
1254 |
+
width: 200px;
|
1255 |
+
min-height: 16px;
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong {
|
1259 |
+
background-color: #CCC;
|
1260 |
+
}
|
1261 |
+
|
1262 |
+
#aiosp_settings_form ul.sfwd_debug_settings li {
|
1263 |
+
clear: left;
|
1264 |
+
margin: 0;
|
1265 |
+
padding: 0;
|
1266 |
+
background-color: #EEE;
|
1267 |
+
overflow: auto;
|
1268 |
+
max-width: 75%;
|
1269 |
+
min-width: 800px;
|
1270 |
+
}
|
1271 |
+
|
1272 |
+
#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) {
|
1273 |
+
background-color: #DDD;
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
div.sfwd_debug_mail_sent {
|
1277 |
+
background-color: #080;
|
1278 |
+
border: 1px solid #0A0;
|
1279 |
+
margin: 10px 0 10px 0;
|
1280 |
+
width: 598px;
|
1281 |
+
color: #FFF;
|
1282 |
+
text-align: center;
|
1283 |
+
}
|
1284 |
+
|
1285 |
+
div.sfwd_debug_error {
|
1286 |
+
background-color: #F00;
|
1287 |
+
color: #FFF;
|
1288 |
+
border: 1px solid #A00;
|
1289 |
+
margin: 10px 0 10px 0;
|
1290 |
+
width: 598px;
|
1291 |
+
text-align: center;
|
1292 |
+
font-weight: bolder;
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
#aiosp_performance_status_wrapper .aioseop_option_div {
|
1296 |
+
max-height: 420px;
|
1297 |
+
}
|
1298 |
+
|
1299 |
+
#aioseop_coming_soon, #aioseop_coming_soon2 {
|
1300 |
+
padding-top: 40px;
|
1301 |
+
text-align: center;
|
1302 |
+
height: 258px;
|
1303 |
+
font-size: 16px;
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
.MRL {
|
1307 |
+
margin-left: 20px !important;
|
1308 |
+
margin-bottom: 10px !important;
|
1309 |
+
}
|
i18n/all-in-one-seo-pack-am.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-ar.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-art_xemoji.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-ary.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-bg_BG.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-bn_BD.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-bs_BA.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-ca.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-de_DE.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-el.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-en_AU.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-en_CA.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-en_GB.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-en_NZ.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-en_ZA.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-es_ES.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-es_VE.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-et.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-fa_IR.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-fi.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-fr_CA.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-fr_FR.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-he_IL.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-hi_IN.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-hr.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-hu_HU.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-hy
DELETED
Binary file
|
i18n/all-in-one-seo-pack-hy.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-id_ID.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-it_IT.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-ja.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-jv_ID.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-ko_KR.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-lv.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-mk_MK.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-mn.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-mr.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-ms_MY.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-nb_NO.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-nl.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-nl_NL.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-nn_NO.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-oci.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-pa_IN.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-pl_PL.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-ps.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-pt_BR.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-pt_PT.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-ro_RO.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-ru_RU.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-si_LK.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-sl_SL.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-sq.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-sv_SE.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-ta_IN.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-tg.mo
ADDED
Binary file
|
i18n/all-in-one-seo-pack-tr_TR.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-uk.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-ur.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-vi.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-zh_CN.mo
CHANGED
Binary file
|
i18n/all-in-one-seo-pack-zh_TW.mo
CHANGED
Binary file
|
inc/aioseop_functions.php
CHANGED
@@ -1,77 +1,91 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
|
|
|
|
3 |
* @package All-in-One-SEO-Pack
|
4 |
*/
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
9 |
function aioseop_load_modules() {
|
10 |
global $aioseop_modules, $aioseop_module_list;
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
}
|
15 |
}
|
16 |
|
17 |
-
if ( !function_exists( 'aioseop_get_options' ) ) {
|
|
|
|
|
|
|
18 |
function aioseop_get_options() {
|
19 |
global $aioseop_options;
|
20 |
$aioseop_options = get_option( 'aioseop_options' );
|
21 |
$aioseop_options = apply_filters( 'aioseop_get_options', $aioseop_options );
|
|
|
22 |
return $aioseop_options;
|
23 |
}
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
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 |
-
|
|
|
36 |
aioseop_get_options();
|
37 |
$update_options = false;
|
38 |
-
if ( !empty( $aioseop_options ) ) {
|
39 |
-
if ( !empty( $aioseop_options['aiosp_archive_noindex'] ) ) { //
|
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']
|
50 |
$aioseop_options['aiosp_archive_title_format'] = '%archive_title% | %blog_title%';
|
51 |
-
$update_options
|
52 |
}
|
53 |
-
if ( $update_options )
|
54 |
update_option( 'aioseop_options', $aioseop_options );
|
|
|
55 |
}
|
56 |
}
|
57 |
}
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
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 |
-
|
70 |
-
if( $aioseop_oldval = get_option( $aioseop_opt_name ) ) {
|
71 |
-
$naioseop_options[$aioseop_opt_name] = $aioseop_oldval;
|
72 |
}
|
73 |
-
if( $aioseop_oldval == '' ) {
|
74 |
-
$naioseop_options[$aioseop_opt_name] = '';
|
75 |
}
|
76 |
delete_option( $aioseop_opt_name );
|
77 |
}
|
@@ -81,375 +95,500 @@ if ( !function_exists( 'aioseop_mrt_mkarry' ) ) {
|
|
81 |
}
|
82 |
}
|
83 |
|
84 |
-
if ( !function_exists( 'aioseop_activate_pl' ) ) {
|
|
|
|
|
|
|
85 |
function aioseop_activate_pl() {
|
86 |
-
if( $aioseop_options = get_option( 'aioseop_options' ) ) {
|
87 |
-
$aioseop_options['aiosp_enabled'] =
|
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 |
-
|
|
|
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
|
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
|
128 |
add_filter( 'manage_pages_columns', 'aioseop_mrt_pcolumns' );
|
129 |
-
elseif ( $post_type
|
130 |
add_filter( 'manage_media_columns', 'aioseop_mrt_pcolumns' );
|
131 |
-
else
|
132 |
add_filter( 'manage_posts_columns', 'aioseop_mrt_pcolumns' );
|
133 |
-
|
|
|
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 |
-
|
147 |
-
|
148 |
-
|
149 |
$aioseopc['seokeywords'] = __( 'SEO Keywords', 'all-in-one-seo-pack' );
|
150 |
-
|
|
|
|
|
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 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
-
}
|
198 |
</style>
|
199 |
<?php wp_print_scripts( Array( 'sack' ) );
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
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[
|
225 |
delete_user_meta( $user_id, 'aioseop_ignore_notice' );
|
226 |
}
|
227 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
$class = 'aioseop_notice ' . $class;
|
237 |
-
if ( !empty( $class ) )
|
238 |
-
|
|
|
|
|
|
|
|
|
239 |
$dismiss = ' ';
|
240 |
-
echo "<div{$class}>" . wp_kses_post( $message ) .
|
|
|
241 |
return true;
|
242 |
}
|
243 |
}
|
244 |
|
245 |
-
if ( !function_exists( 'aioseop_output_dismissable_notice' ) ) {
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
global $current_user;
|
248 |
-
if ( !empty( $current_user ) ) {
|
249 |
$user_id = $current_user->ID;
|
250 |
-
$msgid
|
251 |
-
$ignore
|
252 |
-
if ( !empty( $ignore ) && in_array( $msgid, $ignore ) )
|
|
|
|
|
253 |
global $wp;
|
254 |
$qa = Array();
|
255 |
-
wp_parse_str( $_SERVER[
|
256 |
$qa['aioseop_ignore_notice'] = $msgid;
|
257 |
-
$url
|
258 |
-
$message
|
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']
|
267 |
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
|
268 |
-
|
|
|
269 |
$new_meta = strip_tags( $_POST['new_meta'] );
|
270 |
-
$target
|
271 |
check_ajax_referer( 'aioseop_meta_' . $target . '_' . $post_id, '_nonce' );
|
272 |
$result = '';
|
273 |
-
if ( in_array( $target, Array(
|
|
|
|
|
|
|
|
|
|
|
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
|
285 |
$output = '<a id="' . $target . 'editlink' . $post_id . '" class="aioseop_edit_link" href="javascript:void(0);"'
|
286 |
-
|
287 |
-
|
288 |
-
die( "jQuery('div#aioseop_" . $target .
|
289 |
-
jQuery('div#aioseop_" . $target .
|
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
|
298 |
$settings = esc_attr( $_POST['settings'] );
|
299 |
-
if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) )
|
300 |
-
|
|
|
301 |
|
302 |
-
if ( !wp_verify_nonce($_POST['nonce-aioseop'], 'aioseop-nonce') )
|
303 |
-
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __(
|
|
|
304 |
} else {
|
305 |
-
die(0);
|
306 |
}
|
307 |
}
|
308 |
}
|
309 |
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
|
314 |
-
|
315 |
-
|
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 )
|
|
|
|
|
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']
|
329 |
-
$module = $aioseop_modules->return_module(
|
330 |
-
} elseif ( !empty( $_POST['settings'] ) && ( $_POST['settings']
|
331 |
-
$module = $aioseop_modules->return_module(
|
332 |
} else {
|
333 |
-
$module = $aioseop_modules->return_module(
|
334 |
}
|
335 |
$_POST['location'] = null;
|
336 |
-
$_POST['Submit']
|
337 |
$module->add_page_hooks();
|
338 |
$prefix = $module->get_prefix();
|
339 |
-
$_POST
|
340 |
$module->handle_settings_updates( null );
|
341 |
$options = $module->get_current_options( Array(), null );
|
342 |
-
$output
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
353 |
-
$options
|
354 |
$_POST['action'] = 'aiosp_update_module';
|
355 |
global $aiosp, $aioseop_modules;
|
356 |
aioseop_load_modules();
|
357 |
$aiosp->admin_menu();
|
358 |
-
$module
|
359 |
$_POST['location'] = null;
|
360 |
-
$_POST['Submit']
|
361 |
$module->add_page_hooks();
|
362 |
-
$_POST = (Array)$module->get_current_options( $_POST, null );
|
363 |
-
if ( !empty( $_POST['aiosp_sitemap_addl_pages'] ) &&
|
364 |
-
$_POST['aiosp_sitemap_addl_pages'] = (Array)$_POST['aiosp_sitemap_addl_pages'];
|
365 |
-
|
|
|
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
|
374 |
-
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
} else {
|
377 |
-
$output = sprintf( __(
|
378 |
}
|
379 |
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
|
380 |
}
|
381 |
}
|
382 |
|
383 |
-
if ( !function_exists( 'aioseop_ajax_scan_header' ) ) {
|
384 |
|
385 |
function aioseop_ajax_scan_header() {
|
386 |
-
$_POST[
|
387 |
aioseop_ajax_init();
|
388 |
$options = Array();
|
389 |
parse_str( $_POST['options'], $options );
|
390 |
-
foreach( $options as $k => $v )
|
391 |
-
|
|
|
|
|
392 |
$_POST['location'] = null;
|
393 |
-
$_POST['Submit']
|
394 |
ob_start();
|
395 |
-
do_action('wp');
|
396 |
global $aioseop_modules;
|
397 |
-
$module = $aioseop_modules->return_module(
|
398 |
wp_head();
|
399 |
$output = ob_get_clean();
|
400 |
global $aiosp;
|
401 |
-
$output
|
402 |
-
$meta
|
403 |
$metatags = Array(
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
);
|
408 |
$metadata = Array(
|
409 |
-
'facebook'
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
'google+'
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
'twitter'
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
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 ) ) .
|
|
|
|
|
|
|
|
|
440 |
}
|
441 |
-
|
442 |
-
|
443 |
-
|
|
|
|
|
|
|
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 |
-
|
446 |
-
|
447 |
-
|
448 |
|
449 |
-
foreach
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
$meta .= "<a href='{$link}' target='_blank'>{$link}</a><br />";
|
451 |
}
|
452 |
-
$meta .=
|
453 |
}
|
454 |
$output = $meta;
|
455 |
$output = str_replace( "'", "\'", $output );
|
@@ -458,188 +597,273 @@ if ( !function_exists( 'aioseop_ajax_scan_header' ) ) {
|
|
458 |
}
|
459 |
}
|
460 |
|
461 |
-
if (!function_exists('aioseop_ajax_save_settings')) {
|
|
|
462 |
function aioseop_ajax_save_settings() {
|
463 |
aioseop_ajax_init();
|
464 |
$options = Array();
|
465 |
parse_str( $_POST['options'], $options );
|
466 |
-
$_POST
|
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'] ) )
|
|
|
|
|
474 |
$_POST['Submit'] = 'ajax';
|
475 |
$module->add_page_hooks();
|
476 |
$output = $module->handle_settings_updates( $_POST['location'] );
|
477 |
|
478 |
-
if( AIOSEOPPRO ){
|
479 |
-
|
480 |
-
|
481 |
-
|
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
|
494 |
$_POST['action'] = 'aiosp_update_module';
|
495 |
global $aiosp, $aioseop_modules;
|
496 |
aioseop_load_modules();
|
497 |
$aiosp->admin_menu();
|
498 |
-
if ( empty( $_POST['location'] ) )
|
|
|
|
|
499 |
$_POST['Submit'] = 'ajax';
|
500 |
-
$modlist
|
501 |
-
$links
|
502 |
-
$link_list
|
503 |
-
$link
|
504 |
-
if ( !empty( $link ) )
|
505 |
-
foreach( $link as $l )
|
506 |
-
if ( !empty( $l ) ) {
|
507 |
-
if ( empty( $link_list[$l['order']] ) )
|
508 |
-
|
|
|
|
|
509 |
}
|
510 |
-
|
511 |
-
|
|
|
|
|
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']] ) )
|
519 |
-
|
|
|
|
|
520 |
}
|
|
|
521 |
}
|
522 |
}
|
523 |
-
|
|
|
524 |
ksort( $link_list );
|
525 |
-
foreach( $link_list as $ll )
|
526 |
-
foreach( $ll as $k => $v )
|
527 |
-
$links[$k] = $v;
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
|
|
|
|
533 |
$current = ' class="current"';
|
534 |
-
else
|
535 |
$current = '';
|
536 |
-
|
|
|
537 |
}
|
538 |
-
|
539 |
-
|
|
|
540 |
}
|
541 |
}
|
542 |
|
543 |
-
if ( !function_exists( 'aioseop_mrt_pccolumn' ) ) {
|
544 |
-
|
545 |
-
|
|
|
|
|
|
|
|
|
|
|
546 |
$target = null;
|
547 |
-
if( $aioseopcn
|
548 |
-
|
549 |
-
|
550 |
-
if (
|
551 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
<div class="aioseop_mpc_admin_meta_container">
|
553 |
-
<div
|
554 |
-
|
555 |
-
|
556 |
-
<?php $content = strip_tags( stripslashes( get_post_meta( $id,
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
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 |
-
|
565 |
-
|
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_' ) )
|
|
|
|
|
|
|
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 |
-
|
|
|
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] ) )
|
|
|
|
|
596 |
}
|
597 |
-
|
|
|
|
|
|
|
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 (
|
|
|
|
|
631 |
foreach ( $pages as $k => $v ) {
|
632 |
-
$postID
|
633 |
$menulabel = stripslashes( get_post_meta( $postID, '_aioseop_menulabel', true ) );
|
634 |
-
if ( $menulabel )
|
|
|
|
|
635 |
}
|
636 |
$aioseop_get_pages_start = 0;
|
|
|
637 |
return $pages;
|
638 |
}
|
639 |
}
|
640 |
|
641 |
// The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/.
|
642 |
-
if ( !function_exists( 'aioseop_list_pages' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
643 |
function aioseop_list_pages( $content ) {
|
644 |
global $wp_version;
|
645 |
$matches = array();
|
@@ -651,45 +875,73 @@ if ( !function_exists( 'aioseop_list_pages' ) ) {
|
|
651 |
} else {
|
652 |
$pattern = '@<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">@is';
|
653 |
}
|
654 |
-
|
|
|
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] ) )
|
663 |
-
|
664 |
-
|
665 |
-
if ( empty( $
|
666 |
-
|
667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
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 |
-
|
|
|
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 (
|
693 |
$data = apply_filters( 'aioseop_localize_script_data', Array() );
|
694 |
wp_localize_script( 'aioseop-module-script', 'aiosp_data', $data );
|
695 |
$loaded = 1;
|
@@ -697,98 +949,160 @@ if ( !function_exists( 'aioseop_localize_script_data' ) ) {
|
|
697 |
}
|
698 |
}
|
699 |
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
704 |
function aioseop_array_insert_after( $arr, $insertKey, $newValues ) {
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
|
|
715 |
}
|
716 |
}
|
717 |
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
|
|
|
|
|
|
722 |
function aioseop_load_json_services() {
|
723 |
static $services_json = null;
|
724 |
-
if ( $services_json )
|
725 |
-
|
726 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
727 |
return $services_json;
|
728 |
}
|
729 |
}
|
730 |
|
731 |
-
if ( !function_exists( 'json_encode' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
732 |
function json_encode( $arg ) {
|
733 |
$services_json = aioseop_load_json_services();
|
|
|
734 |
return $services_json->encode( $arg );
|
735 |
}
|
736 |
}
|
737 |
|
738 |
-
if ( !function_exists( 'json_decode' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
739 |
function json_decode( $arg ) {
|
740 |
$services_json = aioseop_load_json_services();
|
|
|
741 |
return $services_json->decode( $arg );
|
742 |
}
|
743 |
}
|
744 |
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
752 |
}
|
753 |
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
|
|
|
|
|
|
|
|
|
|
758 |
function parse_ini_string( $string, $process_sections ) {
|
759 |
-
|
760 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
770 |
-
|
|
|
771 |
return false;
|
|
|
772 |
}
|
773 |
parse_ini_filter::$buf = $string;
|
774 |
-
|
|
|
775 |
}
|
776 |
}
|
777 |
|
778 |
-
function aioseop_update_user_visibilitynotice(){
|
779 |
|
780 |
update_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
|
|
|
781 |
|
782 |
-
|
783 |
-
|
784 |
-
function aioseop_update_yst_detected_notice(){
|
785 |
|
786 |
update_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
|
|
|
787 |
|
788 |
-
|
789 |
-
|
790 |
-
function aioseop_woo_upgrade_notice_dismissed(){
|
791 |
|
792 |
update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
|
793 |
-
|
794 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* General functions file.
|
4 |
+
*
|
5 |
+
* We'll eventually move these to a better place, and figure out ones not being used anymore.
|
6 |
+
*
|
7 |
* @package All-in-One-SEO-Pack
|
8 |
*/
|
9 |
+
|
10 |
+
if ( ! function_exists( 'aioseop_load_modules' ) ) {
|
11 |
+
/**
|
12 |
+
* Load the module manager.
|
13 |
+
*/
|
14 |
function aioseop_load_modules() {
|
15 |
global $aioseop_modules, $aioseop_module_list;
|
16 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_manager.php' );
|
17 |
+
$aioseop_modules = new All_in_One_SEO_Pack_Module_Manager( apply_filters( 'aioseop_module_list', $aioseop_module_list ) );
|
18 |
+
$aioseop_modules->load_modules();
|
19 |
}
|
20 |
}
|
21 |
|
22 |
+
if ( ! function_exists( 'aioseop_get_options' ) ) {
|
23 |
+
/**
|
24 |
+
* @return mixed|void
|
25 |
+
*/
|
26 |
function aioseop_get_options() {
|
27 |
global $aioseop_options;
|
28 |
$aioseop_options = get_option( 'aioseop_options' );
|
29 |
$aioseop_options = apply_filters( 'aioseop_get_options', $aioseop_options );
|
30 |
+
|
31 |
return $aioseop_options;
|
32 |
}
|
33 |
}
|
34 |
|
35 |
+
if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
|
36 |
+
/**
|
37 |
+
* Check if settings need to be updated / migrated from old version.
|
38 |
+
*
|
39 |
+
* @TODO See when this is from and if we can move it elsewhere... our new db updates/upgrades class?
|
40 |
+
*/
|
41 |
function aioseop_update_settings_check() {
|
42 |
global $aioseop_options;
|
43 |
+
if ( empty( $aioseop_options ) || isset( $_POST['aioseop_migrate_options'] ) ) {
|
|
|
44 |
aioseop_mrt_mkarry();
|
45 |
+
}
|
46 |
+
// WPML has now attached to filters, read settings again so they can be translated.
|
47 |
aioseop_get_options();
|
48 |
$update_options = false;
|
49 |
+
if ( ! empty( $aioseop_options ) ) {
|
50 |
+
if ( ! empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // Migrate setting for noindex archives.
|
51 |
$aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex'];
|
52 |
unset( $aioseop_options['aiosp_archive_noindex'] );
|
53 |
$update_options = true;
|
54 |
}
|
55 |
+
if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && empty( $aioseop_options['aiosp_date_title_format'] ) ) {
|
56 |
$aioseop_options['aiosp_date_title_format'] = $aioseop_options['aiosp_archive_title_format'];
|
57 |
unset( $aioseop_options['aiosp_archive_title_format'] );
|
58 |
$update_options = true;
|
59 |
}
|
60 |
+
if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && ( $aioseop_options['aiosp_archive_title_format'] === '%date% | %blog_title%' ) ) {
|
61 |
$aioseop_options['aiosp_archive_title_format'] = '%archive_title% | %blog_title%';
|
62 |
+
$update_options = true;
|
63 |
}
|
64 |
+
if ( $update_options ) {
|
65 |
update_option( 'aioseop_options', $aioseop_options );
|
66 |
+
}
|
67 |
}
|
68 |
}
|
69 |
}
|
70 |
|
71 |
+
if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) {
|
72 |
+
/**
|
73 |
+
* Initialize settings to defaults.
|
74 |
+
*
|
75 |
+
* @TODO Should also move.
|
76 |
+
*/
|
77 |
function aioseop_mrt_mkarry() {
|
78 |
global $aiosp;
|
79 |
global $aioseop_options;
|
80 |
$naioseop_options = $aiosp->default_options();
|
81 |
|
82 |
+
if ( get_option( 'aiosp_post_title_format' ) ) {
|
83 |
+
foreach ( $naioseop_options as $aioseop_opt_name => $value ) {
|
84 |
+
if ( $aioseop_oldval = get_option( $aioseop_opt_name ) ) {
|
85 |
+
$naioseop_options[ $aioseop_opt_name ] = $aioseop_oldval;
|
86 |
}
|
87 |
+
if ( $aioseop_oldval == '' ) {
|
88 |
+
$naioseop_options[ $aioseop_opt_name ] = '';
|
89 |
}
|
90 |
delete_option( $aioseop_opt_name );
|
91 |
}
|
95 |
}
|
96 |
}
|
97 |
|
98 |
+
if ( ! function_exists( 'aioseop_activate_pl' ) ) {
|
99 |
+
/**
|
100 |
+
* @TODO see if this still gets used.
|
101 |
+
*/
|
102 |
function aioseop_activate_pl() {
|
103 |
+
if ( $aioseop_options = get_option( 'aioseop_options' ) ) {
|
104 |
+
$aioseop_options['aiosp_enabled'] = '0';
|
105 |
|
106 |
+
if ( empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
|
107 |
+
$aioseop_options['aiosp_posttypecolumns'] = array( 'post', 'page' );
|
108 |
}
|
109 |
|
110 |
+
update_option( 'aioseop_options', $aioseop_options );
|
111 |
}
|
112 |
}
|
113 |
}
|
114 |
|
115 |
+
if ( ! function_exists( 'aioseop_get_version' ) ) {
|
116 |
+
/**
|
117 |
+
* Returns the version.
|
118 |
+
*
|
119 |
+
* I'm not sure why we have BOTH a function and a constant for this. -mrt
|
120 |
+
*
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
function aioseop_get_version() {
|
124 |
return AIOSEOP_VERSION;
|
125 |
}
|
126 |
}
|
127 |
|
128 |
+
if ( ! function_exists( 'aioseop_option_isset' ) ) {
|
129 |
+
/**
|
130 |
+
* Checks if an option isset.
|
131 |
+
*
|
132 |
+
* @param $option
|
133 |
+
*
|
134 |
+
* @return bool
|
135 |
+
*/
|
136 |
function aioseop_option_isset( $option ) {
|
137 |
global $aioseop_options;
|
138 |
+
|
139 |
+
return ( isset( $aioseop_options[ $option ] ) && $aioseop_options[ $option ] );
|
140 |
}
|
141 |
}
|
142 |
|
143 |
+
if ( ! function_exists( 'aioseop_addmycolumns' ) ) {
|
144 |
+
/**
|
145 |
+
* Adds posttype columns.
|
146 |
+
*
|
147 |
+
* @TODO We should see if this is still being used, and move it either way.
|
148 |
+
*/
|
149 |
function aioseop_addmycolumns() {
|
150 |
global $aioseop_options, $pagenow;
|
151 |
$aiosp_posttypecolumns = Array();
|
152 |
+
if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
|
153 |
$aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns'];
|
154 |
}
|
155 |
+
if ( ! empty( $pagenow ) && ( $pagenow === 'upload.php' ) ) {
|
156 |
$post_type = 'attachment';
|
157 |
+
} elseif ( ! isset( $_REQUEST['post_type'] ) ) {
|
158 |
$post_type = 'post';
|
159 |
+
} else {
|
160 |
$post_type = $_REQUEST['post_type'];
|
161 |
+
}
|
162 |
|
163 |
+
if ( is_array( $aiosp_posttypecolumns ) && in_array( $post_type, $aiosp_posttypecolumns ) ) {
|
164 |
add_action( 'admin_head', 'aioseop_admin_head' );
|
165 |
+
if ( $post_type === 'page' ) {
|
166 |
add_filter( 'manage_pages_columns', 'aioseop_mrt_pcolumns' );
|
167 |
+
} elseif ( $post_type === 'attachment' ) {
|
168 |
add_filter( 'manage_media_columns', 'aioseop_mrt_pcolumns' );
|
169 |
+
} else {
|
170 |
add_filter( 'manage_posts_columns', 'aioseop_mrt_pcolumns' );
|
171 |
+
}
|
172 |
+
if ( $post_type === 'attachment' ) {
|
173 |
add_action( 'manage_media_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
|
174 |
+
} elseif ( is_post_type_hierarchical( $post_type ) ) {
|
175 |
add_action( 'manage_pages_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
|
176 |
+
} else {
|
177 |
add_action( 'manage_posts_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
|
178 |
+
}
|
179 |
}
|
180 |
}
|
181 |
}
|
182 |
|
183 |
+
if ( ! function_exists( 'aioseop_mrt_pcolumns' ) ) {
|
184 |
+
|
185 |
+
/**
|
186 |
+
* @param $aioseopc
|
187 |
+
*
|
188 |
+
* @return mixed
|
189 |
+
*/
|
190 |
function aioseop_mrt_pcolumns( $aioseopc ) {
|
191 |
global $aioseop_options;
|
192 |
+
$aioseopc['seotitle'] = __( 'SEO Title', 'all-in-one-seo-pack' );
|
193 |
+
$aioseopc['seodesc'] = __( 'SEO Description', 'all-in-one-seo-pack' );
|
194 |
+
if ( empty( $aioseop_options['aiosp_togglekeywords'] ) ) {
|
195 |
$aioseopc['seokeywords'] = __( 'SEO Keywords', 'all-in-one-seo-pack' );
|
196 |
+
}
|
197 |
+
|
198 |
+
return $aioseopc;
|
199 |
}
|
200 |
}
|
201 |
|
202 |
+
if ( ! function_exists( 'aioseop_admin_head' ) ) {
|
203 |
+
|
204 |
function aioseop_admin_head() {
|
205 |
echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'js/quickedit_functions.js" ></script>';
|
206 |
+
?>
|
207 |
+
<style>
|
208 |
+
.aioseop_edit_button {
|
209 |
+
margin: 0 0 0 5px;
|
210 |
+
opacity: 0.6;
|
211 |
+
width: 12px;
|
212 |
+
}
|
213 |
+
|
214 |
+
.aioseop_edit_link {
|
215 |
+
display: inline-block;
|
216 |
+
position: absolute;
|
217 |
+
}
|
218 |
+
|
219 |
+
.aioseop_mpc_SEO_admin_options_edit img {
|
220 |
+
margin: 3px 2px;
|
221 |
+
opacity: 0.7;
|
222 |
+
}
|
223 |
+
|
224 |
+
.aioseop_mpc_admin_meta_options {
|
225 |
+
float: left;
|
226 |
+
display: block;
|
227 |
+
opacity: 1;
|
228 |
+
max-height: 75px;
|
229 |
+
overflow: hidden;
|
230 |
+
width: 100%;
|
231 |
+
}
|
232 |
+
|
233 |
+
.aioseop_mpc_admin_meta_options.editing {
|
234 |
+
max-height: initial;
|
235 |
+
overflow: visible;
|
236 |
+
}
|
237 |
+
|
238 |
+
.aioseop_mpc_admin_meta_content {
|
239 |
+
float: left;
|
240 |
+
width: 100%;
|
241 |
+
margin: 0 0 10px 0;
|
242 |
+
}
|
243 |
+
|
244 |
+
td.seotitle.column-seotitle,
|
245 |
+
td.seodesc.column-seodesc,
|
246 |
+
td.seokeywords.column-seokeywords {
|
247 |
+
overflow: visible;
|
248 |
+
}
|
249 |
+
|
250 |
+
@media screen and (max-width: 782px) {
|
251 |
+
body.wp-admin th.column-seotitle, th.column-seodesc, th.column-seokeywords, td.seotitle.column-seotitle, td.seodesc.column-seodesc, td.seokeywords.column-seokeywords {
|
252 |
+
display: none;
|
253 |
+
}
|
254 |
}
|
|
|
255 |
</style>
|
256 |
<?php wp_print_scripts( Array( 'sack' ) );
|
257 |
+
?>
|
258 |
+
<script type="text/javascript">
|
259 |
+
//<![CDATA[
|
260 |
+
var aioseopadmin = {
|
261 |
+
blogUrl: "<?php print get_bloginfo( 'url' ); ?>",
|
262 |
+
pluginUrl: "<?php print AIOSEOP_PLUGIN_URL; ?>",
|
263 |
+
requestUrl: "<?php print WP_ADMIN_URL . '/admin-ajax.php' ?>",
|
264 |
+
imgUrl: "<?php print AIOSEOP_PLUGIN_IMAGES_URL; ?>",
|
265 |
+
Edit: "<?php _e( 'Edit', 'all-in-one-seo-pack' ); ?>",
|
266 |
+
Post: "<?php _e( 'Post', 'all-in-one-seo-pack' ); ?>",
|
267 |
+
Save: "<?php _e( 'Save', 'all-in-one-seo-pack' ); ?>",
|
268 |
+
Cancel: "<?php _e( 'Cancel', 'all-in-one-seo-pack' ); ?>",
|
269 |
+
postType: "post",
|
270 |
+
pleaseWait: "<?php _e( 'Please wait...', 'all-in-one-seo-pack' ); ?>",
|
271 |
+
slugEmpty: "<?php _e( 'Slug may not be empty!', 'all-in-one-seo-pack' ); ?>",
|
272 |
+
Revisions: "<?php _e( 'Revisions', 'all-in-one-seo-pack' ); ?>",
|
273 |
+
Time: "<?php _e( 'Insert time', 'all-in-one-seo-pack' ); ?>"
|
274 |
+
}
|
275 |
+
//]]>
|
276 |
</script>
|
277 |
<?php
|
278 |
}
|
279 |
}
|
280 |
|
281 |
+
if ( ! function_exists( 'aioseop_handle_ignore_notice' ) ) {
|
282 |
+
|
283 |
function aioseop_handle_ignore_notice() {
|
284 |
|
285 |
+
if ( ! empty( $_GET ) ) {
|
286 |
global $current_user;
|
287 |
$user_id = $current_user->ID;
|
288 |
|
289 |
+
if ( ! empty( $_GET['aioseop_reset_notices'] ) ) {
|
290 |
delete_user_meta( $user_id, 'aioseop_ignore_notice' );
|
291 |
}
|
292 |
+
if ( ! empty( $_GET['aioseop_ignore_notice'] ) ) {
|
293 |
add_user_meta( $user_id, 'aioseop_ignore_notice', $_GET['aioseop_ignore_notice'], false );
|
294 |
}
|
295 |
}
|
296 |
}
|
297 |
}
|
298 |
|
299 |
+
if ( ! function_exists( 'aioseop_output_notice' ) ) {
|
300 |
+
|
301 |
+
/**
|
302 |
+
* @param $message
|
303 |
+
* @param string $id
|
304 |
+
* @param string $class
|
305 |
+
*
|
306 |
+
* @return bool
|
307 |
+
*/
|
308 |
+
function aioseop_output_notice( $message, $id = '', $class = 'updated fade' ) {
|
309 |
$class = 'aioseop_notice ' . $class;
|
310 |
+
if ( ! empty( $class ) ) {
|
311 |
+
$class = ' class="' . esc_attr( $class ) . '"';
|
312 |
+
}
|
313 |
+
if ( ! empty( $id ) ) {
|
314 |
+
$class .= ' id="' . esc_attr( $id ) . '"';
|
315 |
+
}
|
316 |
$dismiss = ' ';
|
317 |
+
echo "<div{$class}>" . wp_kses_post( $message ) . '<br class=clear /></div>';
|
318 |
+
|
319 |
return true;
|
320 |
}
|
321 |
}
|
322 |
|
323 |
+
if ( ! function_exists( 'aioseop_output_dismissable_notice' ) ) {
|
324 |
+
|
325 |
+
/**
|
326 |
+
* @param $message
|
327 |
+
* @param string $id
|
328 |
+
* @param string $class
|
329 |
+
*
|
330 |
+
* @return bool
|
331 |
+
*/
|
332 |
+
function aioseop_output_dismissable_notice( $message, $id = '', $class = 'updated fade' ) {
|
333 |
global $current_user;
|
334 |
+
if ( ! empty( $current_user ) ) {
|
335 |
$user_id = $current_user->ID;
|
336 |
+
$msgid = md5( $message );
|
337 |
+
$ignore = get_user_meta( $user_id, 'aioseop_ignore_notice' );
|
338 |
+
if ( ! empty( $ignore ) && in_array( $msgid, $ignore ) ) {
|
339 |
+
return false;
|
340 |
+
}
|
341 |
global $wp;
|
342 |
$qa = Array();
|
343 |
+
wp_parse_str( $_SERVER['QUERY_STRING'], $qa );
|
344 |
$qa['aioseop_ignore_notice'] = $msgid;
|
345 |
+
$url = '?' . build_query( $qa );
|
346 |
+
$message = '<p class=alignleft>' . $message . '</p><p class="alignright"><a class="aioseop_dismiss_link" href="' . $url . '">Dismiss</a></p>';
|
347 |
}
|
348 |
+
|
349 |
return aioseop_output_notice( $message, $id, $class );
|
350 |
}
|
351 |
}
|
352 |
|
353 |
+
if ( ! function_exists( 'aioseop_ajax_save_meta' ) ) {
|
354 |
+
|
355 |
function aioseop_ajax_save_meta() {
|
356 |
+
if ( ! empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] !== 'undefined' ) ) {
|
357 |
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
|
358 |
+
}
|
359 |
+
$post_id = intval( $_POST['post_id'] );
|
360 |
$new_meta = strip_tags( $_POST['new_meta'] );
|
361 |
+
$target = $_POST['target_meta'];
|
362 |
check_ajax_referer( 'aioseop_meta_' . $target . '_' . $post_id, '_nonce' );
|
363 |
$result = '';
|
364 |
+
if ( in_array( $target, Array(
|
365 |
+
'title',
|
366 |
+
'description',
|
367 |
+
'keywords',
|
368 |
+
) ) && current_user_can( 'edit_post', $post_id )
|
369 |
+
) {
|
370 |
update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
|
371 |
$result = get_post_meta( $post_id, '_aioseop_' . $target, true );
|
372 |
} else {
|
373 |
die();
|
374 |
}
|
375 |
+
if ( $result != '' ):
|
376 |
$label = "<label id='aioseop_label_{$target}_{$post_id}'><span style='width: 20px;display: inline-block;'></span>" . $result . '</label>';
|
377 |
else:
|
378 |
$label = "<label id='aioseop_label_{$target}_{$post_id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __( 'No', 'all-in-one-seo-pack' ) . ' ' . $target . '</i></strong>';
|
379 |
endif;
|
380 |
+
$nonce = wp_create_nonce( "aioseop_meta_{$target}_{$post_id}" );
|
381 |
$output = '<a id="' . $target . 'editlink' . $post_id . '" class="aioseop_edit_link" href="javascript:void(0);"'
|
382 |
+
. 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">'
|
383 |
+
. '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a> ' . $label;
|
384 |
+
die( "jQuery('div#aioseop_" . $target . '_' . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . ";
|
385 |
+
jQuery('div#aioseop_" . $target . '_' . $post_id . "').html(my_label).fadeIn('fast');
|
386 |
});" );
|
387 |
}
|
388 |
}
|
389 |
|
390 |
+
if ( ! function_exists( 'aioseop_ajax_init' ) ) {
|
391 |
+
|
392 |
function aioseop_ajax_init() {
|
393 |
+
if ( ! empty( $_POST ) && ! empty( $_POST['settings'] ) && ( ! empty( $_POST['nonce-aioseop'] ) || ( ! empty( $_POST['nonce-aioseop-edit'] ) ) ) && ! empty( $_POST['options'] ) ) {
|
394 |
+
$_POST = stripslashes_deep( $_POST );
|
395 |
$settings = esc_attr( $_POST['settings'] );
|
396 |
+
if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) ) {
|
397 |
+
define( 'AIOSEOP_AJAX_MSG_TMPL', "jQuery('div#aiosp_$settings').fadeOut('fast', function(){jQuery('div#aiosp_$settings').html('%s').fadeIn('fast');});" );
|
398 |
+
}
|
399 |
|
400 |
+
if ( ! wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
|
401 |
+
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __( 'Unauthorized access; try reloading the page.', 'all-in-one-seo-pack' ) ) );
|
402 |
+
}
|
403 |
} else {
|
404 |
+
die( 0 );
|
405 |
}
|
406 |
}
|
407 |
}
|
408 |
|
409 |
+
/**
|
410 |
+
* @param $return
|
411 |
+
* @param $url
|
412 |
+
* @param $attr
|
413 |
+
*
|
414 |
+
* @return mixed
|
415 |
+
*/
|
416 |
+
function aioseop_embed_handler_html( $return, $url, $attr ) {
|
417 |
+
return AIO_ProGeneral::aioseop_embed_handler_html();
|
418 |
+
}
|
419 |
|
420 |
+
function aioseop_ajax_update_oembed() {
|
421 |
+
AIO_ProGeneral::aioseop_ajax_update_oembed();
|
422 |
+
}
|
423 |
+
|
424 |
+
if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {
|
425 |
|
|
|
426 |
function aioseop_ajax_save_url() {
|
427 |
aioseop_ajax_init();
|
428 |
$options = Array();
|
429 |
parse_str( $_POST['options'], $options );
|
430 |
+
foreach ( $options as $k => $v ) {
|
431 |
+
$_POST[ $k ] = $v;
|
432 |
+
}
|
433 |
$_POST['action'] = 'aiosp_update_module';
|
434 |
global $aiosp, $aioseop_modules;
|
435 |
aioseop_load_modules();
|
436 |
$aiosp->admin_menu();
|
437 |
+
if ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'video_sitemap_addl_pages' ) ) {
|
438 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Video_Sitemap' );
|
439 |
+
} elseif ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'news_sitemap_addl_pages' ) ) {
|
440 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_News_Sitemap' );
|
441 |
} else {
|
442 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' );
|
443 |
}
|
444 |
$_POST['location'] = null;
|
445 |
+
$_POST['Submit'] = 'ajax';
|
446 |
$module->add_page_hooks();
|
447 |
$prefix = $module->get_prefix();
|
448 |
+
$_POST = $module->get_current_options( $_POST, null );
|
449 |
$module->handle_settings_updates( null );
|
450 |
$options = $module->get_current_options( Array(), null );
|
451 |
+
$output = $module->display_custom_options( '', Array(
|
452 |
+
'name' => $prefix . 'addl_pages',
|
453 |
+
'type' => 'custom',
|
454 |
+
'save' => true,
|
455 |
+
'value' => $options[ $prefix . 'addl_pages' ],
|
456 |
+
'attr' => '',
|
457 |
+
) );
|
458 |
+
$output = str_replace( "'", "\'", $output );
|
459 |
+
$output = str_replace( "\n", '\n', $output );
|
460 |
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
|
461 |
}
|
462 |
}
|
463 |
|
464 |
+
if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) {
|
465 |
+
|
466 |
function aioseop_ajax_delete_url() {
|
467 |
aioseop_ajax_init();
|
468 |
+
$options = Array();
|
469 |
+
$options = esc_attr( $_POST['options'] );
|
470 |
$_POST['action'] = 'aiosp_update_module';
|
471 |
global $aiosp, $aioseop_modules;
|
472 |
aioseop_load_modules();
|
473 |
$aiosp->admin_menu();
|
474 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' );
|
475 |
$_POST['location'] = null;
|
476 |
+
$_POST['Submit'] = 'ajax';
|
477 |
$module->add_page_hooks();
|
478 |
+
$_POST = (Array) $module->get_current_options( $_POST, null );
|
479 |
+
if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && is_object( $_POST['aiosp_sitemap_addl_pages'] ) ) {
|
480 |
+
$_POST['aiosp_sitemap_addl_pages'] = (Array) $_POST['aiosp_sitemap_addl_pages'];
|
481 |
+
}
|
482 |
+
if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( ! empty( $_POST['aiosp_sitemap_addl_pages'][ $options ] ) ) ) {
|
483 |
unset( $_POST['aiosp_sitemap_addl_pages'][ $options ] );
|
484 |
+
if ( empty( $_POST['aiosp_sitemap_addl_pages'] ) ) {
|
485 |
$_POST['aiosp_sitemap_addl_pages'] = '';
|
486 |
+
} else {
|
487 |
$_POST['aiosp_sitemap_addl_pages'] = json_encode( $_POST['aiosp_sitemap_addl_pages'] );
|
488 |
+
}
|
489 |
$module->handle_settings_updates( null );
|
490 |
$options = $module->get_current_options( Array(), null );
|
491 |
+
$output = $module->display_custom_options( '', Array(
|
492 |
+
'name' => 'aiosp_sitemap_addl_pages',
|
493 |
+
'type' => 'custom',
|
494 |
+
'save' => true,
|
495 |
+
'value' => $options['aiosp_sitemap_addl_pages'],
|
496 |
+
'attr' => '',
|
497 |
+
) );
|
498 |
+
$output = str_replace( "'", "\'", $output );
|
499 |
+
$output = str_replace( "\n", '\n', $output );
|
500 |
} else {
|
501 |
+
$output = sprintf( __( 'Row %s not found; no rows were deleted.', 'all-in-one-seo-pack' ), esc_attr( $options ) );
|
502 |
}
|
503 |
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
|
504 |
}
|
505 |
}
|
506 |
|
507 |
+
if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
508 |
|
509 |
function aioseop_ajax_scan_header() {
|
510 |
+
$_POST['options'] = 'foo';
|
511 |
aioseop_ajax_init();
|
512 |
$options = Array();
|
513 |
parse_str( $_POST['options'], $options );
|
514 |
+
foreach ( $options as $k => $v ) {
|
515 |
+
$_POST[ $k ] = $v;
|
516 |
+
}
|
517 |
+
$_POST['action'] = 'aiosp_update_module';
|
518 |
$_POST['location'] = null;
|
519 |
+
$_POST['Submit'] = 'ajax';
|
520 |
ob_start();
|
521 |
+
do_action( 'wp' );
|
522 |
global $aioseop_modules;
|
523 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' );
|
524 |
wp_head();
|
525 |
$output = ob_get_clean();
|
526 |
global $aiosp;
|
527 |
+
$output = $aiosp->html_string_to_array( $output );
|
528 |
+
$meta = '';
|
529 |
$metatags = Array(
|
530 |
+
'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
|
531 |
+
'twitter' => Array( 'name' => 'name', 'value' => 'value' ),
|
532 |
+
'google+' => Array( 'name' => 'itemprop', 'value' => 'content' ),
|
533 |
);
|
534 |
$metadata = Array(
|
535 |
+
'facebook' => Array(
|
536 |
+
'title' => 'og:title',
|
537 |
+
'type' => 'og:type',
|
538 |
+
'url' => 'og:url',
|
539 |
+
'thumbnail' => 'og:image',
|
540 |
+
'sitename' => 'og:site_name',
|
541 |
+
'key' => 'fb:admins',
|
542 |
+
'description' => 'og:description',
|
543 |
+
),
|
544 |
+
'google+' => Array(
|
545 |
+
'thumbnail' => 'image',
|
546 |
+
'title' => 'name',
|
547 |
+
'description' => 'description',
|
548 |
+
),
|
549 |
+
'twitter' => Array(
|
550 |
+
'card' => 'twitter:card',
|
551 |
+
'url' => 'twitter:url',
|
552 |
+
'title' => 'twitter:title',
|
553 |
+
'description' => 'twitter:description',
|
554 |
+
'thumbnail' => 'twitter:image',
|
555 |
+
),
|
556 |
);
|
557 |
+
if ( ! empty( $output ) && ! empty( $output['head'] ) && ! empty( $output['head']['meta'] ) ) {
|
558 |
+
foreach ( $output['head']['meta'] as $v ) {
|
559 |
+
if ( ! empty( $v['@attributes'] ) ) {
|
560 |
$m = $v['@attributes'];
|
561 |
+
foreach ( $metatags as $type => $tags ) {
|
562 |
+
if ( ! empty( $m[ $tags['name'] ] ) && ! empty( $m[ $tags['value'] ] ) ) {
|
563 |
+
foreach ( $metadata[ $type ] as $tk => $tv ) {
|
564 |
+
if ( $m[ $tags['name'] ] == $tv ) {
|
565 |
+
$meta .= "<tr><th style='color:red;'>" . sprintf( __( 'Duplicate %s Meta' ), ucwords( $type ) ) . '</th><td>' . ucwords( $tk ) . "</td><td>{$m[$tags['name']]}</td><td>{$m[$tags['value']]}</td></tr>\n";
|
566 |
+
}
|
567 |
+
}
|
568 |
+
}
|
569 |
+
}
|
570 |
}
|
571 |
+
}
|
572 |
+
}
|
573 |
+
if ( empty( $meta ) ) {
|
574 |
+
$meta = '<span style="color:green;">' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . '</span>';
|
575 |
+
} else {
|
576 |
+
$meta = "<table cellspacing=0 cellpadding=0 width=80% class='aioseop_table'><tr class='aioseop_table_header'><th>Meta For Site</th><th>Kind of Meta</th><th>Element Name</th><th>Element Value</th></tr>" . $meta . '</table>';
|
577 |
$meta .= "<p><div class='aioseop_meta_info'><h3 style='padding:5px;margin-bottom:0px;'>" . __( 'What Does This Mean?', 'all-in-one-seo-pack' ) . "</h3><div style='padding:5px;padding-top:0px;'>"
|
578 |
+
. '<p>' . __( 'All in One SEO Pack has detected that a plugin(s) or theme is also outputting social meta tags on your site. You can view this social meta in the source code of your site (check your browser help for instructions on how to view source code).', 'all-in-one-seo-pack' )
|
579 |
+
. '</p><p>' . __( 'You may prefer to use the social meta tags that are being output by the other plugin(s) or theme. If so, then you should deactivate this Social Meta feature in All in One SEO Pack Feature Manager.', 'all-in-one-seo-pack' )
|
580 |
+
. '</p><p>' . __( 'You should avoid duplicate social meta tags. You can use these free tools from Facebook, Google and Twitter to validate your social meta and check for errors:', 'all-in-one-seo-pack' ) . '</p>';
|
581 |
|
582 |
+
foreach (
|
583 |
+
Array(
|
584 |
+
'https://developers.facebook.com/tools/debug',
|
585 |
+
'http://www.google.com/webmasters/tools/richsnippets',
|
586 |
+
'https://dev.twitter.com/docs/cards/validation/validator',
|
587 |
+
) as $link
|
588 |
+
) {
|
589 |
$meta .= "<a href='{$link}' target='_blank'>{$link}</a><br />";
|
590 |
}
|
591 |
+
$meta .= '<p>' . __( 'Please refer to the document for each tool for help in using these to debug your social meta.', 'all-in-one-seo-pack' ) . '</div></div>';
|
592 |
}
|
593 |
$output = $meta;
|
594 |
$output = str_replace( "'", "\'", $output );
|
597 |
}
|
598 |
}
|
599 |
|
600 |
+
if ( ! function_exists( 'aioseop_ajax_save_settings' ) ) {
|
601 |
+
|
602 |
function aioseop_ajax_save_settings() {
|
603 |
aioseop_ajax_init();
|
604 |
$options = Array();
|
605 |
parse_str( $_POST['options'], $options );
|
606 |
+
$_POST = $options;
|
607 |
$_POST['action'] = 'aiosp_update_module';
|
608 |
global $aiosp, $aioseop_modules;
|
609 |
aioseop_load_modules();
|
610 |
$aiosp->admin_menu();
|
611 |
$module = $aioseop_modules->return_module( $_POST['module'] );
|
612 |
unset( $_POST['module'] );
|
613 |
+
if ( empty( $_POST['location'] ) ) {
|
614 |
+
$_POST['location'] = null;
|
615 |
+
}
|
616 |
$_POST['Submit'] = 'ajax';
|
617 |
$module->add_page_hooks();
|
618 |
$output = $module->handle_settings_updates( $_POST['location'] );
|
619 |
|
620 |
+
if ( AIOSEOPPRO ) {
|
621 |
+
$output = '<div id="aioseop_settings_header"><div id="message" class="updated fade"><p>' . $output . '</p></div></div><style>body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { margin-top: 45px !important; }</style>';
|
622 |
+
} else {
|
623 |
+
$output = '<div id="aioseop_settings_header"><div id="message" class="updated fade"><p>' . $output . '</p></div></div><style>body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { margin-top: 45px !important; }</style>';
|
624 |
+
}
|
625 |
|
626 |
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
|
627 |
}
|
628 |
}
|
629 |
|
630 |
+
if ( ! function_exists( 'aioseop_ajax_get_menu_links' ) ) {
|
631 |
+
|
632 |
function aioseop_ajax_get_menu_links() {
|
633 |
aioseop_ajax_init();
|
634 |
$options = Array();
|
635 |
parse_str( $_POST['options'], $options );
|
636 |
+
$_POST = $options;
|
637 |
$_POST['action'] = 'aiosp_update_module';
|
638 |
global $aiosp, $aioseop_modules;
|
639 |
aioseop_load_modules();
|
640 |
$aiosp->admin_menu();
|
641 |
+
if ( empty( $_POST['location'] ) ) {
|
642 |
+
$_POST['location'] = null;
|
643 |
+
}
|
644 |
$_POST['Submit'] = 'ajax';
|
645 |
+
$modlist = $aioseop_modules->get_loaded_module_list();
|
646 |
+
$links = Array();
|
647 |
+
$link_list = Array();
|
648 |
+
$link = $aiosp->get_admin_links();
|
649 |
+
if ( ! empty( $link ) ) {
|
650 |
+
foreach ( $link as $l ) {
|
651 |
+
if ( ! empty( $l ) ) {
|
652 |
+
if ( empty( $link_list[ $l['order'] ] ) ) {
|
653 |
+
$link_list[ $l['order'] ] = Array();
|
654 |
+
}
|
655 |
+
$link_list[ $l['order'] ][ $l['title'] ] = $l['href'];
|
656 |
}
|
657 |
+
}
|
658 |
+
}
|
659 |
+
if ( ! empty( $modlist ) ) {
|
660 |
+
foreach ( $modlist as $k => $v ) {
|
661 |
$mod = $aioseop_modules->return_module( $v );
|
662 |
if ( is_object( $mod ) ) {
|
663 |
$mod->add_page_hooks();
|
664 |
$link = $mod->get_admin_links();
|
665 |
+
foreach ( $link as $l ) {
|
666 |
+
if ( ! empty( $l ) ) {
|
667 |
+
if ( empty( $link_list[ $l['order'] ] ) ) {
|
668 |
+
$link_list[ $l['order'] ] = Array();
|
669 |
+
}
|
670 |
+
$link_list[ $l['order'] ][ $l['title'] ] = $l['href'];
|
671 |
}
|
672 |
+
}
|
673 |
}
|
674 |
}
|
675 |
+
}
|
676 |
+
if ( ! empty( $link_list ) ) {
|
677 |
ksort( $link_list );
|
678 |
+
foreach ( $link_list as $ll ) {
|
679 |
+
foreach ( $ll as $k => $v ) {
|
680 |
+
$links[ $k ] = $v;
|
681 |
+
}
|
682 |
+
}
|
683 |
+
}
|
684 |
+
$output = '<ul>';
|
685 |
+
if ( ! empty( $links ) ) {
|
686 |
+
foreach ( $links as $k => $v ) {
|
687 |
+
if ( $k === 'Feature Manager' ) {
|
688 |
$current = ' class="current"';
|
689 |
+
} else {
|
690 |
$current = '';
|
691 |
+
}
|
692 |
+
$output .= "<li{$current}><a href='" . esc_url( $v ) . "'>" . esc_attr( $k ) . '</a></li>';
|
693 |
}
|
694 |
+
}
|
695 |
+
$output .= '</ul>';
|
696 |
+
die( sprintf( "jQuery('{$_POST['target']}').fadeOut('fast', function(){jQuery('{$_POST['target']}').html('%s').fadeIn('fast');});", addslashes( $output ) ) );
|
697 |
}
|
698 |
}
|
699 |
|
700 |
+
if ( ! function_exists( 'aioseop_mrt_pccolumn' ) ) {
|
701 |
+
|
702 |
+
/**
|
703 |
+
* @param $aioseopcn
|
704 |
+
* @param $aioseoppi
|
705 |
+
*/
|
706 |
+
function aioseop_mrt_pccolumn( $aioseopcn, $aioseoppi ) {
|
707 |
+
$id = $aioseoppi;
|
708 |
$target = null;
|
709 |
+
if ( $aioseopcn === 'seotitle' ) {
|
710 |
+
$target = 'title';
|
711 |
+
}
|
712 |
+
if ( $aioseopcn === 'seokeywords' ) {
|
713 |
+
$target = 'keywords';
|
714 |
+
}
|
715 |
+
if ( $aioseopcn === 'seodesc' ) {
|
716 |
+
$target = 'description';
|
717 |
+
}
|
718 |
+
if ( ! $target ) {
|
719 |
+
return;
|
720 |
+
}
|
721 |
+
if ( current_user_can( 'edit_post', $id ) ) { ?>
|
722 |
<div class="aioseop_mpc_admin_meta_container">
|
723 |
+
<div class="aioseop_mpc_admin_meta_options"
|
724 |
+
id="aioseop_<?php print $target; ?>_<?php echo $id; ?>"
|
725 |
+
style="float:left;">
|
726 |
+
<?php $content = strip_tags( stripslashes( get_post_meta( $id, '_aioseop_' . $target, true ) ) );
|
727 |
+
if ( ! empty( $content ) ):
|
728 |
+
$label = "<label id='aioseop_label_{$target}_{$id}'><span style='width: 20px;display: inline-block;'></span>" . $content . '</label>';
|
729 |
+
else:
|
730 |
+
$label = "<label id='aioseop_label_{$target}_{$id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __( 'No', 'all-in-one-seo-pack' ) . ' ' . $target . '</i></strong>';
|
731 |
+
endif;
|
732 |
$nonce = wp_create_nonce( "aioseop_meta_{$target}_{$id}" );
|
733 |
echo '<a id="' . $target . 'editlink' . $id . '" class="aioseop_edit_link" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
|
734 |
+
$id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">'
|
735 |
+
. "<img class='aioseop_edit_button'
|
736 |
id='aioseop_edit_id'
|
737 |
src='" . AIOSEOP_PLUGIN_IMAGES_URL . "cog_edit.png' /></a> " . $label;
|
738 |
+
?>
|
739 |
</div>
|
740 |
</div>
|
741 |
<?php }
|
742 |
}
|
743 |
}
|
744 |
|
745 |
+
if ( ! function_exists( 'aioseop_unprotect_meta' ) ) {
|
746 |
+
|
747 |
+
/**
|
748 |
+
* @param $protected
|
749 |
+
* @param $meta_key
|
750 |
+
* @param $meta_type
|
751 |
+
*
|
752 |
+
* @return bool
|
753 |
+
*/
|
754 |
function aioseop_unprotect_meta( $protected, $meta_key, $meta_type ) {
|
755 |
+
if ( isset( $meta_key ) && ( substr( $meta_key, 0, 9 ) === '_aioseop_' ) ) {
|
756 |
+
return false;
|
757 |
+
}
|
758 |
+
|
759 |
return $protected;
|
760 |
}
|
761 |
}
|
762 |
|
763 |
+
if ( ! function_exists( 'aioseop_mrt_exclude_this_page' ) ) {
|
764 |
+
|
765 |
+
/**
|
766 |
+
* @param null $url
|
767 |
+
*
|
768 |
+
* @return bool
|
769 |
+
*/
|
770 |
function aioseop_mrt_exclude_this_page( $url = null ) {
|
771 |
static $excluded = false;
|
772 |
if ( $excluded === false ) {
|
773 |
global $aioseop_options;
|
774 |
$ex_pages = '';
|
775 |
+
if ( isset( $aioseop_options['aiosp_ex_pages'] ) ) {
|
776 |
$ex_pages = trim( $aioseop_options['aiosp_ex_pages'] );
|
777 |
+
}
|
778 |
+
if ( ! empty( $ex_pages ) ) {
|
779 |
$excluded = explode( ',', $ex_pages );
|
780 |
+
if ( ! empty( $excluded ) ) {
|
781 |
+
foreach ( $excluded as $k => $v ) {
|
782 |
+
$excluded[ $k ] = trim( $v );
|
783 |
+
if ( empty( $excluded[ $k ] ) ) {
|
784 |
+
unset( $excluded[ $k ] );
|
785 |
+
}
|
786 |
}
|
787 |
+
}
|
788 |
+
if ( empty( $excluded ) ) {
|
789 |
+
$excluded = null;
|
790 |
+
}
|
791 |
}
|
792 |
}
|
793 |
+
if ( ! empty( $excluded ) ) {
|
794 |
+
if ( $url === null ) {
|
795 |
$url = $_SERVER['REQUEST_URI'];
|
796 |
+
} else {
|
797 |
$url = parse_url( $url );
|
798 |
+
if ( ! empty( $url['path'] ) ) {
|
799 |
$url = $url['path'];
|
800 |
+
} else {
|
801 |
return false;
|
802 |
+
}
|
803 |
+
}
|
804 |
+
if ( ! empty( $url ) ) {
|
805 |
+
foreach ( $excluded as $exedd ) {
|
806 |
+
if ( $exedd && ( stripos( $url, $exedd ) !== false ) ) {
|
807 |
+
return true;
|
808 |
+
}
|
809 |
+
}
|
810 |
}
|
|
|
|
|
|
|
|
|
811 |
}
|
812 |
+
|
813 |
return false;
|
814 |
}
|
815 |
}
|
816 |
|
817 |
+
if ( ! function_exists( 'aioseop_get_pages_start' ) ) {
|
818 |
+
|
819 |
+
/**
|
820 |
+
* @param $excludes
|
821 |
+
*
|
822 |
+
* @return mixed
|
823 |
+
*/
|
824 |
function aioseop_get_pages_start( $excludes ) {
|
825 |
global $aioseop_get_pages_start;
|
826 |
$aioseop_get_pages_start = 1;
|
827 |
+
|
828 |
return $excludes;
|
829 |
}
|
830 |
}
|
831 |
|
832 |
+
if ( ! function_exists( 'aioseop_get_pages' ) ) {
|
833 |
+
|
834 |
+
/**
|
835 |
+
* @param $pages
|
836 |
+
*
|
837 |
+
* @return mixed
|
838 |
+
*/
|
839 |
function aioseop_get_pages( $pages ) {
|
840 |
global $aioseop_get_pages_start;
|
841 |
+
if ( ! $aioseop_get_pages_start ) {
|
842 |
+
return $pages;
|
843 |
+
}
|
844 |
foreach ( $pages as $k => $v ) {
|
845 |
+
$postID = $v->ID;
|
846 |
$menulabel = stripslashes( get_post_meta( $postID, '_aioseop_menulabel', true ) );
|
847 |
+
if ( $menulabel ) {
|
848 |
+
$pages[ $k ]->post_title = $menulabel;
|
849 |
+
}
|
850 |
}
|
851 |
$aioseop_get_pages_start = 0;
|
852 |
+
|
853 |
return $pages;
|
854 |
}
|
855 |
}
|
856 |
|
857 |
// The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/.
|
858 |
+
if ( ! function_exists( 'aioseop_list_pages' ) ) {
|
859 |
+
/**
|
860 |
+
* Adds stuff to the HTML in list_pages.
|
861 |
+
* @TODO See if we still use, or even want, these functions.
|
862 |
+
*
|
863 |
+
* @param $content
|
864 |
+
*
|
865 |
+
* @return mixed
|
866 |
+
*/
|
867 |
function aioseop_list_pages( $content ) {
|
868 |
global $wp_version;
|
869 |
$matches = array();
|
875 |
} else {
|
876 |
$pattern = '@<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">@is';
|
877 |
}
|
878 |
+
|
879 |
+
return preg_replace_callback( $pattern, 'aioseop_filter_callback', $content );
|
880 |
}
|
881 |
+
|
882 |
return $content;
|
883 |
}
|
884 |
}
|
885 |
|
886 |
+
if ( ! function_exists( 'aioseop_filter_callback' ) ) {
|
887 |
+
|
888 |
+
/**
|
889 |
+
* @param $matches
|
890 |
+
*
|
891 |
+
* @return string
|
892 |
+
*/
|
893 |
function aioseop_filter_callback( $matches ) {
|
894 |
+
if ( $matches[1] && ! empty( $matches[1] ) ) {
|
895 |
+
$postID = $matches[1];
|
896 |
+
}
|
897 |
+
if ( empty( $postID ) ) {
|
898 |
+
$postID = get_option( 'page_on_front' );
|
899 |
+
}
|
900 |
+
$title_attrib = stripslashes( get_post_meta( $postID, '_aioseop_titleatr', true ) );
|
901 |
+
if ( empty( $title_attrib ) && ! empty( $matches[4] ) ) {
|
902 |
+
$title_attrib = $matches[4];
|
903 |
+
}
|
904 |
+
if ( ! empty( $title_attrib ) ) {
|
905 |
+
$title_attrib = ' title="' . strip_tags( $title_attrib ) . '"';
|
906 |
+
}
|
907 |
+
|
908 |
+
return '<li class="page_item page-item-' . $postID . $matches[2] . '"><a href="' . $matches[3] . '"' . $title_attrib . '>';
|
909 |
}
|
910 |
}
|
911 |
|
912 |
+
if ( ! function_exists( 'aioseop_add_contactmethods' ) ) {
|
913 |
+
|
914 |
+
/**
|
915 |
+
* @param $contactmethods
|
916 |
+
*
|
917 |
+
* @return mixed
|
918 |
+
*/
|
919 |
function aioseop_add_contactmethods( $contactmethods ) {
|
920 |
global $aioseop_options, $aioseop_modules;
|
921 |
+
if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
|
922 |
$contactmethods['googleplus'] = __( 'Google+', 'all-in-one-seo-pack' );
|
923 |
+
}
|
924 |
+
if ( ! empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) {
|
925 |
$m = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' );
|
926 |
if ( ( $m !== false ) && is_object( $m ) ) {
|
927 |
+
if ( $m->option_isset( 'twitter_creator' ) ) {
|
928 |
$contactmethods['twitter'] = __( 'Twitter', 'all-in-one-seo-pack' );
|
929 |
+
}
|
930 |
+
if ( $m->option_isset( 'facebook_author' ) ) {
|
931 |
$contactmethods['facebook'] = __( 'Facebook', 'all-in-one-seo-pack' );
|
932 |
+
}
|
933 |
}
|
934 |
}
|
935 |
+
|
936 |
return $contactmethods;
|
937 |
}
|
938 |
}
|
939 |
|
940 |
+
if ( ! function_exists( 'aioseop_localize_script_data' ) ) {
|
941 |
+
|
942 |
function aioseop_localize_script_data() {
|
943 |
static $loaded = 0;
|
944 |
+
if ( ! $loaded ) {
|
945 |
$data = apply_filters( 'aioseop_localize_script_data', Array() );
|
946 |
wp_localize_script( 'aioseop-module-script', 'aiosp_data', $data );
|
947 |
$loaded = 1;
|
949 |
}
|
950 |
}
|
951 |
|
952 |
+
if ( ! function_exists( 'aioseop_array_insert_after' ) ) {
|
953 |
+
/**
|
954 |
+
* Utility function for inserting elements into associative arrays by key.
|
955 |
+
*
|
956 |
+
* @param $arr
|
957 |
+
* @param $insertKey
|
958 |
+
* @param $newValues
|
959 |
+
*
|
960 |
+
* @return array
|
961 |
+
*/
|
962 |
function aioseop_array_insert_after( $arr, $insertKey, $newValues ) {
|
963 |
+
$keys = array_keys( $arr );
|
964 |
+
$vals = array_values( $arr );
|
965 |
+
$insertAfter = array_search( $insertKey, $keys ) + 1;
|
966 |
+
$keys2 = array_splice( $keys, $insertAfter );
|
967 |
+
$vals2 = array_splice( $vals, $insertAfter );
|
968 |
+
foreach ( $newValues as $k => $v ) {
|
969 |
+
$keys[] = $k;
|
970 |
+
$vals[] = $v;
|
971 |
+
}
|
972 |
+
|
973 |
+
return array_merge( array_combine( $keys, $vals ), array_combine( $keys2, $vals2 ) );
|
974 |
}
|
975 |
}
|
976 |
|
977 |
+
if ( ! function_exists( 'aioseop_load_json_services' ) ) {
|
978 |
+
/**
|
979 |
+
* JSON support for PHP < 5.2.
|
980 |
+
*
|
981 |
+
* @TODO Do we really need to support < PHP 5.2 with the following functions??
|
982 |
+
* @return null|Services_JSON
|
983 |
+
*/
|
984 |
function aioseop_load_json_services() {
|
985 |
static $services_json = null;
|
986 |
+
if ( $services_json ) {
|
987 |
+
return $services_json;
|
988 |
+
}
|
989 |
+
if ( ! class_exists( 'Services_JSON' ) ) {
|
990 |
+
require_once( 'inc/extlib/JSON.php' );
|
991 |
+
}
|
992 |
+
if ( ! $services_json ) {
|
993 |
+
$services_json = new Services_JSON();
|
994 |
+
}
|
995 |
+
|
996 |
return $services_json;
|
997 |
}
|
998 |
}
|
999 |
|
1000 |
+
if ( ! function_exists( 'json_encode' ) ) {
|
1001 |
+
|
1002 |
+
/**
|
1003 |
+
* @param $arg
|
1004 |
+
*
|
1005 |
+
* @return mixed
|
1006 |
+
*/
|
1007 |
function json_encode( $arg ) {
|
1008 |
$services_json = aioseop_load_json_services();
|
1009 |
+
|
1010 |
return $services_json->encode( $arg );
|
1011 |
}
|
1012 |
}
|
1013 |
|
1014 |
+
if ( ! function_exists( 'json_decode' ) ) {
|
1015 |
+
|
1016 |
+
/**
|
1017 |
+
* @param $arg
|
1018 |
+
*
|
1019 |
+
* @return mixed
|
1020 |
+
*/
|
1021 |
function json_decode( $arg ) {
|
1022 |
$services_json = aioseop_load_json_services();
|
1023 |
+
|
1024 |
return $services_json->decode( $arg );
|
1025 |
}
|
1026 |
}
|
1027 |
|
1028 |
+
if ( ! function_exists( 'fnmatch' ) ) {
|
1029 |
+
/**
|
1030 |
+
* Support for fnmatch() doesn't exist on Windows pre PHP 5.3.
|
1031 |
+
*
|
1032 |
+
* @param $pattern
|
1033 |
+
* @param $string
|
1034 |
+
*
|
1035 |
+
* @return int
|
1036 |
+
*/
|
1037 |
+
function fnmatch( $pattern, $string ) {
|
1038 |
+
return preg_match( '#^' . strtr( preg_quote( $pattern, '#' ), array(
|
1039 |
+
'\*' => '.*',
|
1040 |
+
'\?' => '.',
|
1041 |
+
) ) . "$#i", $string );
|
1042 |
+
}
|
1043 |
}
|
1044 |
|
1045 |
+
if ( ! function_exists( 'parse_ini_string' ) ) {
|
1046 |
+
/**
|
1047 |
+
* Parse_ini_string() doesn't exist pre PHP 5.3.
|
1048 |
+
*
|
1049 |
+
* @param $string
|
1050 |
+
* @param $process_sections
|
1051 |
+
*
|
1052 |
+
* @return array|bool
|
1053 |
+
*/
|
1054 |
function parse_ini_string( $string, $process_sections ) {
|
1055 |
+
|
1056 |
+
if ( ! class_exists( 'parse_ini_filter' ) ) {
|
1057 |
+
|
1058 |
+
/**
|
1059 |
+
* Class parse_ini_filter
|
1060 |
+
*
|
1061 |
+
* Define our filter class.
|
1062 |
+
*/
|
1063 |
class parse_ini_filter extends php_user_filter {
|
1064 |
static $buf = '';
|
1065 |
+
|
1066 |
+
/**
|
1067 |
+
* The actual filter for parsing.
|
1068 |
+
*
|
1069 |
+
* @param $in
|
1070 |
+
* @param $out
|
1071 |
+
* @param $consumed
|
1072 |
+
* @param $closing
|
1073 |
+
*
|
1074 |
+
* @return int
|
1075 |
+
*/
|
1076 |
function filter( $in, $out, &$consumed, $closing ) {
|
1077 |
+
$bucket = stream_bucket_new( fopen( 'php://memory', 'wb' ), self::$buf );
|
1078 |
stream_bucket_append( $out, $bucket );
|
1079 |
+
|
1080 |
return PSFS_PASS_ON;
|
1081 |
}
|
1082 |
}
|
1083 |
+
|
1084 |
+
// Register our filter with PHP.
|
1085 |
+
if ( ! stream_filter_register( 'parse_ini', 'parse_ini_filter' ) ) {
|
1086 |
return false;
|
1087 |
+
}
|
1088 |
}
|
1089 |
parse_ini_filter::$buf = $string;
|
1090 |
+
|
1091 |
+
return parse_ini_file( 'php://filter/read=parse_ini/resource=php://memory', $process_sections );
|
1092 |
}
|
1093 |
}
|
1094 |
|
1095 |
+
function aioseop_update_user_visibilitynotice() {
|
1096 |
|
1097 |
update_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
|
1098 |
+
}
|
1099 |
|
1100 |
+
function aioseop_update_yst_detected_notice() {
|
|
|
|
|
1101 |
|
1102 |
update_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
|
1103 |
+
}
|
1104 |
|
1105 |
+
function aioseop_woo_upgrade_notice_dismissed() {
|
|
|
|
|
1106 |
|
1107 |
update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
|
1108 |
+
}
|
|
inc/aioseop_updates_class.php
CHANGED
@@ -1,176 +1,216 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
if (
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
insert_with_markers(
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
$
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
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 = '0.0';
|
42 |
+
if( isset( $aioseop_options['last_active_version'] ) ){
|
43 |
+
$last_active_version = $aioseop_options['last_active_version'] ;
|
44 |
+
}
|
45 |
+
|
46 |
+
// Compares version to see which one is the newer.
|
47 |
+
if ( version_compare( $last_active_version, AIOSEOP_VERSION, '<' ) ) {
|
48 |
+
|
49 |
+
// Upgrades based on previous version
|
50 |
+
do_action('before_doing_aioseop_updates');
|
51 |
+
$this->do_version_updates( $last_active_version );
|
52 |
+
do_action('after_doing_aioseop_updates');
|
53 |
+
// If we're running Pro, let the Pro updater set the version.
|
54 |
+
if ( ! AIOSEOPPRO ) {
|
55 |
+
|
56 |
+
// Save the current plugin version as the new last_active_version
|
57 |
+
$aioseop_options['last_active_version'] = AIOSEOP_VERSION;
|
58 |
+
$aiosp->update_class_option( $aioseop_options );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Perform updates that are dependent on external factors, not
|
64 |
+
* just the plugin version.
|
65 |
+
*/
|
66 |
+
$this->do_feature_updates();
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Updates version.
|
72 |
+
* TODO: the compare here should be extracted into a function
|
73 |
+
* @since 1.0.0
|
74 |
+
* @global $aioseop_options .
|
75 |
+
*
|
76 |
+
* @param String $old_version
|
77 |
+
*/
|
78 |
+
function do_version_updates( $old_version ) {
|
79 |
+
global $aioseop_options;
|
80 |
+
if (
|
81 |
+
( ! AIOSEOPPRO && version_compare( $old_version, '2.3.3', '<' ) ) ||
|
82 |
+
( AIOSEOPPRO && version_compare( $old_version, '2.4.3', '<' ) )
|
83 |
+
) {
|
84 |
+
$this->bad_bots_201603();
|
85 |
+
}
|
86 |
+
|
87 |
+
if (
|
88 |
+
( ! AIOSEOPPRO && version_compare( $old_version, '2.3.4.1', '<' ) ) ||
|
89 |
+
( AIOSEOPPRO && version_compare( $old_version, '2.4.4.1', '<' ) )
|
90 |
+
) {
|
91 |
+
$this->bad_bots_remove_yandex_201604();
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Removes overzealous 'DOC' entry which is causing false-positive bad
|
98 |
+
* bot blocking.
|
99 |
+
* @since 2.3.3
|
100 |
+
* @global $aiosp , $aioseop_options.
|
101 |
+
*/
|
102 |
+
function bad_bots_201603() {
|
103 |
+
global $aiosp, $aioseop_options;
|
104 |
+
|
105 |
+
// Remove 'DOC' from bad bots list to avoid false positives
|
106 |
+
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
|
107 |
+
$list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
|
108 |
+
$list = str_replace( array(
|
109 |
+
"DOC\r\n",
|
110 |
+
"DOC\n"
|
111 |
+
), '', $list );
|
112 |
+
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
|
113 |
+
update_option( 'aioseop_options', $aioseop_options );
|
114 |
+
$aiosp->update_class_option( $aioseop_options );
|
115 |
+
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
|
116 |
+
&& 'on' === $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules']
|
117 |
+
) {
|
118 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
119 |
+
require_once(
|
120 |
+
AIOSEOP_PLUGIN_DIR .
|
121 |
+
'admin/aioseop_module_class.php'
|
122 |
+
);
|
123 |
+
require_once(
|
124 |
+
AIOSEOP_PLUGIN_DIR .
|
125 |
+
'modules/aioseop_bad_robots.php'
|
126 |
+
);
|
127 |
+
}
|
128 |
+
$aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
|
129 |
+
$aiosp_reset_htaccess->generate_htaccess_blocklist();
|
130 |
+
}
|
131 |
+
if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
|
132 |
+
&& extract_from_markers(
|
133 |
+
get_home_path() . '.htaccess',
|
134 |
+
'Bad Bot Blocker' )
|
135 |
+
) {
|
136 |
+
insert_with_markers(
|
137 |
+
get_home_path() . '.htaccess',
|
138 |
+
'Bad Bot Blocker',
|
139 |
+
''
|
140 |
+
);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
// Functions for specific version milestones
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Remove 'yandex' entry. This is a major Russian search engine, and no longer needs to be blocked.
|
149 |
+
* @since 2.3.4.1
|
150 |
+
* @global $aiosp , $aioseop_options.
|
151 |
+
*/
|
152 |
+
function bad_bots_remove_yandex_201604() {
|
153 |
+
global $aiosp, $aioseop_options;
|
154 |
+
// Remove 'yandex' from bad bots list to avoid false positives
|
155 |
+
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
|
156 |
+
$list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
|
157 |
+
$list = str_replace( array(
|
158 |
+
"yandex\r\n",
|
159 |
+
"yandex\n"
|
160 |
+
), '', $list );
|
161 |
+
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
|
162 |
+
update_option( 'aioseop_options', $aioseop_options );
|
163 |
+
$aiosp->update_class_option( $aioseop_options );
|
164 |
+
|
165 |
+
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'] ) {
|
166 |
+
|
167 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
168 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' );
|
169 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'modules/aioseop_bad_robots.php' );
|
170 |
+
}
|
171 |
+
|
172 |
+
$aiosp_reset_htaccess = new All_in_One_SEO_Pack_Bad_Robots;
|
173 |
+
$aiosp_reset_htaccess->generate_htaccess_blocklist();
|
174 |
+
}
|
175 |
+
|
176 |
+
if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] ) && extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' ) ) {
|
177 |
+
insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Updates features.
|
184 |
+
* @since 1.0.0
|
185 |
+
* @return null
|
186 |
+
*/
|
187 |
+
public function do_feature_updates() {
|
188 |
+
global $aioseop_options;
|
189 |
+
|
190 |
+
// We don't need to check all the time. Use a transient to limit frequency.
|
191 |
+
if ( get_site_transient( 'aioseop_update_check_time' ) ) {
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
|
195 |
+
// If we're running Pro, let the Pro updater set the transient.
|
196 |
+
if ( ! AIOSEOPPRO ) {
|
197 |
+
|
198 |
+
// We haven't checked recently. Reset the timestamp, timeout 6 hours.
|
199 |
+
set_site_transient(
|
200 |
+
'aioseop_update_check_time',
|
201 |
+
time(),
|
202 |
+
apply_filters( 'aioseop_update_check_time', 3600 * 6 )
|
203 |
+
);
|
204 |
+
}
|
205 |
+
|
206 |
+
|
207 |
+
/*
|
208 |
+
if ( ! ( isset( $aioseop_options['version_feature_flags']['FEATURE_NAME'] ) &&
|
209 |
+
$aioseop_options['version_feature_flags']['FEATURE_NAME'] === 'yes' ) ) {
|
210 |
+
$this->some_feature_update_method(); // sets flag to 'yes' on completion.
|
211 |
+
}
|
212 |
+
*/
|
213 |
+
}
|
214 |
+
|
215 |
+
|
216 |
+
}
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
//construct
|
11 |
}
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
14 |
static function get_blog_page( $p = null ) {
|
15 |
static $blog_page = '';
|
16 |
static $page_for_posts = '';
|
17 |
-
if (
|
18 |
global $post;
|
19 |
} else {
|
20 |
$post = $p;
|
21 |
}
|
22 |
-
if (
|
23 |
-
if (
|
24 |
-
|
|
|
|
|
25 |
$blog_page = get_post( $page_for_posts );
|
|
|
26 |
}
|
|
|
27 |
return $blog_page;
|
28 |
}
|
29 |
-
|
30 |
-
|
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 )
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
45 |
$hyperlink = '<a ';
|
46 |
-
if( $target )
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
$hyperlink .= "href=\"$url\">$anchor</a>";
|
49 |
|
50 |
return $hyperlink;
|
51 |
}
|
52 |
-
|
53 |
-
static function get_upgrade_url(){
|
54 |
//put build URL stuff in here
|
55 |
}
|
56 |
-
|
57 |
-
}
|
3 |
/**
|
4 |
* @package All-in-One-SEO-Pack
|
5 |
*/
|
|
|
6 |
class aiosp_common {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* aiosp_common constructor.
|
10 |
+
*
|
11 |
+
* These are commonly used functions that can be pulled from anywhere.
|
12 |
+
* (or in some cases they're functions waiting for a home)
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
function __construct() {
|
16 |
//construct
|
17 |
}
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @param null $p
|
22 |
+
*
|
23 |
+
* @return array|null|string|WP_Post
|
24 |
+
*/
|
25 |
static function get_blog_page( $p = null ) {
|
26 |
static $blog_page = '';
|
27 |
static $page_for_posts = '';
|
28 |
+
if ( null === $p ) {
|
29 |
global $post;
|
30 |
} else {
|
31 |
$post = $p;
|
32 |
}
|
33 |
+
if ( '' === $blog_page ) {
|
34 |
+
if ( '' === $page_for_posts ) {
|
35 |
+
$page_for_posts = get_option( 'page_for_posts' );
|
36 |
+
}
|
37 |
+
if ( $page_for_posts && is_home() && ( ! is_object( $post ) || ( $page_for_posts !== $post->ID ) ) ) {
|
38 |
$blog_page = get_post( $page_for_posts );
|
39 |
+
}
|
40 |
}
|
41 |
+
|
42 |
return $blog_page;
|
43 |
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param string $location
|
47 |
+
* @param string $title
|
48 |
+
* @param string $anchor
|
49 |
+
* @param string $target
|
50 |
+
* @param string $class
|
51 |
+
* @param string $id
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
static function get_upgrade_hyperlink( $location = '', $title = '', $anchor = '', $target = '', $class = '', $id = '' ) {
|
56 |
+
|
57 |
$affiliate_id = '';
|
|
|
|
|
|
|
58 |
|
59 |
+
//call during plugins_loaded
|
60 |
+
$affiliate_id = apply_filters( 'aiosp_aff_id', $affiliate_id );
|
61 |
|
62 |
//build URL
|
63 |
$url = 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/';
|
64 |
+
if ( $location ) {
|
65 |
+
$url .= '?loc=' . $location;
|
66 |
+
}
|
67 |
+
if ( $affiliate_id ) {
|
68 |
+
$url .= "?ap_id=$affiliate_id";
|
69 |
+
}
|
70 |
+
|
71 |
+
//build hyperlink
|
72 |
$hyperlink = '<a ';
|
73 |
+
if ( $target ) {
|
74 |
+
$hyperlink .= "target=\"$target\" ";
|
75 |
+
}
|
76 |
+
if ( $title ) {
|
77 |
+
$hyperlink .= "title=\"$title\" ";
|
78 |
+
}
|
79 |
$hyperlink .= "href=\"$url\">$anchor</a>";
|
80 |
|
81 |
return $hyperlink;
|
82 |
}
|
83 |
+
|
84 |
+
static function get_upgrade_url() {
|
85 |
//put build URL stuff in here
|
86 |
}
|
87 |
+
}
|
|
inc/commonstrings.php
CHANGED
@@ -1,38 +1,41 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
__( 'Scan Posts For Videos', 'all-in-one-seo-pack' );
|
11 |
-
__( 'Restrict Access to Video Sitemap', 'all-in-one-seo-pack' );
|
12 |
-
__( 'Press the Scan button to scan your posts for videos! Do this if video content from a post or posts is not showing up in your sitemap.', 'all-in-one-seo-pack' );
|
13 |
-
__( 'If checked, only posts that have videos in them will be displayed on the sitemap.', 'all-in-one-seo-pack' );
|
14 |
-
__( 'Enable this option to only allow access to your sitemap by site administrators and major search engines.', 'all-in-one-seo-pack' );
|
15 |
-
__( 'You do not have access to this page; try logging in as an administrator.' , 'all-in-one-seo-pack' );
|
16 |
-
__( 'Scan', 'all-in-one-seo-pack' );
|
17 |
-
|
18 |
-
//functions_class strings
|
19 |
-
__( 'Finished scanning posts', 'all-in-one-seo-pack' );
|
20 |
-
|
21 |
-
//update checker strings (incomplete... need to separate out html)
|
22 |
-
__( 'Purchase one now', 'all-in-one-seo-pack' );
|
23 |
-
__( 'License Key is not set yet or invalid. ', 'all-in-one-seo-pack' );
|
24 |
-
__( ' Need a license key?', 'all-in-one-seo-pack' );
|
25 |
-
__("Notice: ", 'all-in-one-seo-pack' );
|
26 |
-
__( 'Manage Licenses', 'all-in-one-seo-pack' );
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
|
|
|
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Class AIOSP_Common_Strings
|
4 |
+
*
|
5 |
+
* This is just for Pro strings to be translated.
|
6 |
+
*
|
7 |
+
* @package All-in-One-SEO-Pack
|
8 |
+
*/
|
9 |
|
10 |
+
class AIOSP_Common_Strings {
|
11 |
|
12 |
+
/**
|
13 |
+
* AIOSP_Common_Strings constructor.
|
14 |
+
*
|
15 |
+
* We'll just put all the strings in the contruct for lack of a better.
|
16 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
private function __construct() {
|
19 |
|
20 |
+
// Video sitemap strings.
|
21 |
+
__( 'Video Sitemap', 'all-in-one-seo-pack' );
|
22 |
+
__( 'Show Only Posts With Videos', 'all-in-one-seo-pack' );
|
23 |
+
__( 'Scan Posts For Videos', 'all-in-one-seo-pack' );
|
24 |
+
__( 'Restrict Access to Video Sitemap', 'all-in-one-seo-pack' );
|
25 |
+
__( 'Press the Scan button to scan your posts for videos! Do this if video content from a post or posts is not showing up in your sitemap.', 'all-in-one-seo-pack' );
|
26 |
+
__( 'If checked, only posts that have videos in them will be displayed on the sitemap.', 'all-in-one-seo-pack' );
|
27 |
+
__( 'Enable this option to only allow access to your sitemap by site administrators and major search engines.', 'all-in-one-seo-pack' );
|
28 |
+
__( 'You do not have access to this page; try logging in as an administrator.', 'all-in-one-seo-pack' );
|
29 |
+
__( 'Scan', 'all-in-one-seo-pack' );
|
30 |
|
31 |
+
// These are functions_class strings.
|
32 |
+
__( 'Finished scanning posts', 'all-in-one-seo-pack' );
|
33 |
|
34 |
+
// Update checker strings (incomplete... need to separate out html).
|
35 |
+
__( 'Purchase one now', 'all-in-one-seo-pack' );
|
36 |
+
__( 'License Key is not set yet or invalid. ', 'all-in-one-seo-pack' );
|
37 |
+
__( ' Need a license key?', 'all-in-one-seo-pack' );
|
38 |
+
__( 'Notice: ', 'all-in-one-seo-pack' );
|
39 |
+
__( 'Manage Licenses', 'all-in-one-seo-pack' );
|
40 |
}
|
41 |
+
}
|
inc/compatability/compat-init.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Initiates compatibility code with other plugins/themes
|
4 |
+
*
|
5 |
+
* Eventually we'll have subclasses for each.
|
6 |
+
*
|
7 |
+
* @package All-in-One-SEO-Pack
|
8 |
+
* @since 2.3.6
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Compatibility' ) ) {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class All_in_One_SEO_Pack_Compatibility
|
15 |
+
*
|
16 |
+
* @since 2.3.6
|
17 |
+
*/
|
18 |
+
class All_in_One_SEO_Pack_Compatibility {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* All_in_One_SEO_Pack_Compatibility constructor.
|
22 |
+
*
|
23 |
+
* @since 2.3.6
|
24 |
+
*/
|
25 |
+
public function __construct() {
|
26 |
+
|
27 |
+
$this->load_compatibility_classes();
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Load Compatibility Hooks.
|
33 |
+
*
|
34 |
+
* @since 2.3.6
|
35 |
+
*/
|
36 |
+
public function load_compatibility_hooks() {
|
37 |
+
// We'll use this until we set up out classes.
|
38 |
+
if ( class_exists( 'jetpack' ) ) {
|
39 |
+
|
40 |
+
add_filter( 'jetpack_get_available_modules', array( $this, 'remove_jetpack_sitemap' ) );
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Remove Jetpack's sitemap.
|
46 |
+
*
|
47 |
+
* @param array $modules All the Jetpack modules.
|
48 |
+
*
|
49 |
+
* @since 2.3.6
|
50 |
+
* @return mixed
|
51 |
+
*/
|
52 |
+
public function remove_jetpack_sitemap( $modules ) {
|
53 |
+
// Remove Jetpack's sitemap.
|
54 |
+
unset( $modules['sitemaps'] );
|
55 |
+
|
56 |
+
return $modules;
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Load Compatibility classes.
|
62 |
+
*
|
63 |
+
* @since 2.3.6
|
64 |
+
*/
|
65 |
+
public function load_compatibility_classes() {
|
66 |
+
// Eventually we'll load our other classes from here.
|
67 |
+
$this->load_compatibility_hooks();
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
$aiosp_compat = new All_in_One_SEO_Pack_Compatibility();
|
inc/deprecated.php
CHANGED
@@ -1,46 +1,53 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
function oauth_init() {
|
4 |
-
if ( !is_user_logged_in() || !current_user_can( 'aiosp_manage_seo' ) )
|
5 |
-
|
6 |
-
|
7 |
-
$
|
8 |
-
$
|
9 |
-
|
10 |
-
|
|
|
|
|
11 |
$manual_ua = 1;
|
12 |
}
|
13 |
-
} elseif ( !empty( $preload["{$this->prefix}google_connect"] ) ) {
|
14 |
$manual_ua = 1;
|
15 |
}
|
16 |
-
if ( !empty( $manual_ua ) ) {
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
}
|
22 |
}
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
26 |
}
|
27 |
-
foreach (
|
28 |
-
if ( !empty( $preload["{$this->prefix}{$v}"]) ) {
|
29 |
-
$this->$v = $preload["{$this->prefix}{$v}"];
|
30 |
}
|
31 |
}
|
32 |
-
$callback_url =
|
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
|
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 (
|
43 |
-
if ( !empty( $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
|
55 |
$profiles = $this->account_cache['profiles'];
|
56 |
} else {
|
57 |
-
$this->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
|
65 |
$response = wp_remote_retrieve_body( $data );
|
66 |
-
$xml
|
67 |
-
$ua
|
68 |
-
$profiles =
|
69 |
-
if ( !empty( $xml[
|
70 |
-
$rec
|
71 |
-
$results =
|
72 |
-
if ( !empty( $xml[
|
73 |
-
$results = $xml[
|
74 |
-
else
|
75 |
-
$results[] = $xml[
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
case '
|
|
|
|
|
|
|
|
|
|
|
81 |
case 'dxp:property':
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
87 |
}
|
88 |
-
$ua[$rec['title']]
|
89 |
$profiles[ $rec['ga:webPropertyId'] ] = $rec['ga:profileId'];
|
90 |
}
|
91 |
}
|
92 |
-
$this->account_cache
|
93 |
-
$this->account_cache['ua']
|
94 |
-
$this->account_cache['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
|
103 |
-
if ( !empty( $xml ) && !empty( $xml[
|
104 |
$error = 'Error: ';
|
105 |
-
if ( !empty( $xml[
|
106 |
-
$error .= $xml[
|
107 |
} else {
|
108 |
-
foreach( $xml[
|
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[
|
118 |
-
$this->default_options[
|
119 |
-
$this->default_options[
|
120 |
-
$this->default_options[
|
121 |
-
$this->default_options[
|
122 |
-
$this->default_options[
|
123 |
-
$this->default_options[
|
124 |
add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 );
|
125 |
} else {
|
126 |
-
$this->default_options[
|
127 |
-
$this->default_options[
|
128 |
-
$this->default_options[
|
129 |
-
$url
|
130 |
-
$this->default_options[
|
131 |
-
foreach (
|
132 |
-
if ( !empty( $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[
|
139 |
-
$this->profile_id = $this->account_cache[
|
140 |
}
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
function oauth_get_data( $oauth_url, $args = null ) {
|
144 |
-
if ( !class_exists( 'OAuthConsumer' ) )
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
$req_token = new OAuthConsumer( $this->token, $this->secret );
|
147 |
-
$req
|
|
|
148 |
return wp_remote_get( $req->to_url() );
|
149 |
}
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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' ) )
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
164 |
$args['oauth_verifier'] = $oauth_verifier;
|
165 |
-
$oauth_access_token
|
166 |
-
$reqData
|
167 |
-
$reqOAuthData
|
|
|
168 |
return $reqOAuthData;
|
169 |
}
|
170 |
|
|
|
|
|
|
|
|
|
|
|
171 |
function oauth_connect( $count = 0 ) {
|
172 |
global $aiosp_activation;
|
173 |
-
if ( !class_exists( 'OAuthConsumer' ) )
|
174 |
-
|
175 |
-
|
176 |
-
$
|
177 |
-
$
|
178 |
-
$
|
179 |
-
$
|
180 |
-
$
|
|
|
|
|
181 |
if ( $aiosp_activation ) {
|
182 |
$oauth_current = false;
|
183 |
} else {
|
184 |
-
$oauth_current = get_transient(
|
185 |
}
|
186 |
-
if ( !empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) {
|
187 |
return $oauth_authorize . '?oauth_token=' . $this->token;
|
188 |
} else {
|
189 |
-
set_transient(
|
190 |
unset( $this->token );
|
191 |
unset( $this->secret );
|
192 |
}
|
193 |
$args = array(
|
194 |
-
'scope'
|
195 |
-
'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __('Google Analytics', 'all-in-one-seo-pack')
|
196 |
);
|
197 |
if ( AIOSEOPPRO ) {
|
198 |
-
|
199 |
} else {
|
200 |
-
$req_req = $this->oauth_get_creds( $oauth_request_token,
|
201 |
}
|
202 |
-
$reqData
|
203 |
$reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) );
|
204 |
-
if ( !empty( $reqOAuthData['oauth_token'] ) )
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
207 |
$url = $oauth_authorize . "?oauth_token={$this->token}";
|
208 |
} else {
|
209 |
-
if (
|
210 |
return $this->oauth_connect( 1 );
|
211 |
}
|
212 |
}
|
|
|
213 |
return $url;
|
214 |
-
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* @return bool
|
5 |
+
*/
|
6 |
function oauth_init() {
|
7 |
+
if ( ! is_user_logged_in() || ! current_user_can( 'aiosp_manage_seo' ) ) {
|
8 |
+
return false;
|
9 |
+
}
|
10 |
+
$this->token = 'anonymous';
|
11 |
+
$this->secret = 'anonymous';
|
12 |
+
$preload = $this->get_class_option();
|
13 |
+
$manual_ua = '';
|
14 |
+
if ( ! empty( $_POST ) ) {
|
15 |
+
if ( ! empty( $_POST[ "{$this->prefix}google_connect" ] ) ) {
|
16 |
$manual_ua = 1;
|
17 |
}
|
18 |
+
} elseif ( ! empty( $preload[ "{$this->prefix}google_connect" ] ) ) {
|
19 |
$manual_ua = 1;
|
20 |
}
|
21 |
+
if ( ! empty( $manual_ua ) ) {
|
22 |
+
foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) {
|
23 |
+
if ( ! empty( $preload[ "{$this->prefix}{$v}" ] ) ) {
|
24 |
+
unset( $preload[ "{$this->prefix}{$v}" ] );
|
25 |
+
unset( $this->$v );
|
|
|
26 |
}
|
27 |
+
}
|
28 |
+
$this->update_class_option( $preload );
|
29 |
+
$this->update_options();
|
30 |
+
//return;
|
31 |
}
|
32 |
+
foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) {
|
33 |
+
if ( ! empty( $preload[ "{$this->prefix}{$v}" ] ) ) {
|
34 |
+
$this->$v = $preload[ "{$this->prefix}{$v}" ];
|
35 |
}
|
36 |
}
|
37 |
+
$callback_url = null;
|
38 |
+
if ( ! empty( $_REQUEST['oauth_verifier'] ) ) {
|
39 |
$this->verifier = $_REQUEST['oauth_verifier'];
|
40 |
+
if ( ! empty( $_REQUEST['oauth_token'] ) ) {
|
41 |
+
if ( isset( $this->token ) && $this->token === $_REQUEST['oauth_token'] ) {
|
42 |
$this->access_token = $this->oauth_get_token( $this->verifier );
|
43 |
+
if ( is_array( $this->access_token ) && ! empty( $this->access_token['oauth_token'] ) ) {
|
44 |
unset( $this->token );
|
45 |
unset( $this->secret );
|
46 |
$this->ga_token = $this->access_token['oauth_token'];
|
47 |
+
foreach ( array( 'token', 'secret', 'access_token', 'ga_token' ) as $v ) {
|
48 |
+
if ( ! empty( $this->$v ) ) {
|
49 |
+
$preload[ "{$this->prefix}{$v}" ] = $this->$v;
|
50 |
+
}
|
51 |
}
|
52 |
$this->update_class_option( $preload );
|
53 |
}
|
56 |
exit;
|
57 |
}
|
58 |
}
|
59 |
+
if ( ! empty( $this->ga_token ) ) {
|
60 |
+
if ( ! empty( $this->account_cache ) ) {
|
61 |
+
$ua = $this->account_cache['ua'];
|
62 |
$profiles = $this->account_cache['profiles'];
|
63 |
} else {
|
64 |
+
$this->token = $this->access_token['oauth_token'];
|
65 |
$this->secret = $this->access_token['oauth_token_secret'];
|
66 |
|
67 |
+
$data = $this->oauth_get_data( 'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' );
|
68 |
|
69 |
$http_code = wp_remote_retrieve_response_code( $data );
|
70 |
|
71 |
+
if ( 200 === $http_code ) {
|
72 |
$response = wp_remote_retrieve_body( $data );
|
73 |
+
$xml = $this->xml_string_to_array( $response );
|
74 |
+
$ua = array();
|
75 |
+
$profiles = array();
|
76 |
+
if ( ! empty( $xml['entry'] ) ) {
|
77 |
+
$rec = array();
|
78 |
+
$results = array();
|
79 |
+
if ( ! empty( $xml['entry'][0] ) ) {
|
80 |
+
$results = $xml['entry'];
|
81 |
+
} else {
|
82 |
+
$results[] = $xml['entry'];
|
83 |
+
}
|
84 |
+
foreach ( $results as $r ) {
|
85 |
+
foreach ( $r as $k => $v )
|
86 |
+
switch ( $k ) {
|
87 |
+
case 'id':
|
88 |
+
$rec['id'] = $v;
|
89 |
+
break;
|
90 |
+
case 'title':
|
91 |
+
$rec['title'] = $v['@content'];
|
92 |
+
break;
|
93 |
case 'dxp:property':
|
94 |
+
$attr = array();
|
95 |
+
foreach ( $v as $a => $f ) {
|
96 |
+
if ( is_array( $f ) && ! empty( $f['@attributes'] ) ) {
|
97 |
+
$rec[ $f['@attributes']['name'] ] = $f['@attributes']['value'];
|
98 |
+
}
|
99 |
+
}
|
100 |
+
break;
|
101 |
}
|
102 |
+
$ua[ $rec['title'] ] = array( $rec['ga:webPropertyId'] => $rec['ga:webPropertyId'] );
|
103 |
$profiles[ $rec['ga:webPropertyId'] ] = $rec['ga:profileId'];
|
104 |
}
|
105 |
}
|
106 |
+
$this->account_cache = array();
|
107 |
+
$this->account_cache['ua'] = $ua;
|
108 |
+
$this->account_cache['profiles'] = $profiles;
|
109 |
$preload["{$this->prefix}account_cache"] = $this->account_cache;
|
110 |
} else {
|
111 |
unset( $this->token );
|
113 |
unset( $this->ga_token );
|
114 |
unset( $preload["{$this->prefix}ga_token"] ); // error condition here -- pdb
|
115 |
$response = wp_remote_retrieve_body( $data );
|
116 |
+
$xml = $this->xml_string_to_array( $response );
|
117 |
+
if ( ! empty( $xml ) && ! empty( $xml['error'] ) ) {
|
118 |
$error = 'Error: ';
|
119 |
+
if ( ! empty( $xml['error']['internalReason'] ) ) {
|
120 |
+
$error .= $xml['error']['internalReason'];
|
121 |
} else {
|
122 |
+
foreach ( $xml['error'] as $k => $v ) {
|
123 |
$error .= "$k: $v\n";
|
124 |
+
}
|
125 |
}
|
126 |
$this->output_error( $error );
|
127 |
}
|
128 |
}
|
129 |
}
|
130 |
}
|
131 |
+
if ( ! empty( $this->ga_token ) ) {
|
132 |
+
$this->default_options['google_analytics_id']['type'] = 'select';
|
133 |
+
$this->default_options['google_analytics_id']['initial_options'] = $ua;
|
134 |
+
$this->default_options['google_connect']['type'] = 'html';
|
135 |
+
$this->default_options['google_connect']['nolabel'] = 1;
|
136 |
+
$this->default_options['google_connect']['save'] = true;
|
137 |
+
$this->default_options['google_connect']['name'] = __( 'Disconnect From Google Analytics', 'all-in-one-seo-pack' );
|
138 |
+
$this->default_options['google_connect']['default'] = "<input name='aiosp_google_connect' type=submit class='button-primary' value='" . __( 'Remove Stored Credentials', 'all-in-one-seo-pack' ) . "'>";
|
139 |
add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 );
|
140 |
} else {
|
141 |
+
$this->default_options['google_connect']['type'] = 'html';
|
142 |
+
$this->default_options['google_connect']['nolabel'] = 1;
|
143 |
+
$this->default_options['google_connect']['save'] = false;
|
144 |
+
$url = $this->oauth_connect();
|
145 |
+
$this->default_options['google_connect']['default'] = "<a href='{$url}' class='button-primary'>" . __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ) . '</a>';
|
146 |
+
foreach ( array( 'token', 'secret', 'access_token', 'ga_token', 'account_cache' ) as $v ) {
|
147 |
+
if ( ! empty( $this->$v ) ) {
|
148 |
+
$preload["{$this->prefix}{$v}"] = $this->$v;
|
149 |
+
}
|
150 |
}
|
151 |
}
|
152 |
$this->update_class_option( $preload );
|
153 |
+
$this->update_options();
|
154 |
// $url = $this->report_query();
|
155 |
+
if ( ! empty( $this->account_cache ) && ! empty( $this->options["{$this->prefix}google_analytics_id"] ) && ! empty( $this->account_cache['profiles'][ $this->options["{$this->prefix}google_analytics_id"] ] ) ) {
|
156 |
+
$this->profile_id = $this->account_cache['profiles'][ $this->options["{$this->prefix}google_analytics_id"] ];
|
157 |
}
|
158 |
}
|
159 |
|
160 |
+
/**
|
161 |
+
* @param $oauth_url
|
162 |
+
* @param null $args
|
163 |
+
*
|
164 |
+
* @return array|WP_Error
|
165 |
+
*/
|
166 |
function oauth_get_data( $oauth_url, $args = null ) {
|
167 |
+
if ( ! class_exists( 'OAuthConsumer' ) ) {
|
168 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
|
169 |
+
}
|
170 |
+
if ( $args === null ) {
|
171 |
+
$args = Array(
|
172 |
+
'scope' => 'https://www.googleapis.com/auth/analytics.readonly',
|
173 |
+
'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' )
|
174 |
+
);
|
175 |
+
}
|
176 |
$req_token = new OAuthConsumer( $this->token, $this->secret );
|
177 |
+
$req = $this->oauth_get_creds( $oauth_url, $req_token, $args );
|
178 |
+
|
179 |
return wp_remote_get( $req->to_url() );
|
180 |
}
|
181 |
|
182 |
+
/**
|
183 |
+
* @param $oauth_url
|
184 |
+
* @param null $req_token
|
185 |
+
* @param array $args
|
186 |
+
* @param null $callback
|
187 |
+
*
|
188 |
+
* @return OAuthRequest
|
189 |
+
*/
|
190 |
+
function oauth_get_creds( $oauth_url, $req_token = null, $args = array(), $callback = null ) {
|
191 |
+
if ( ! class_exists( 'OAuthConsumer' ) ) {
|
192 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
|
193 |
+
}
|
194 |
+
if ( ! empty( $callback ) ) {
|
195 |
+
$args['oauth_callback'] = $callback;
|
196 |
+
}
|
197 |
+
if ( empty( $this->sig_method ) ) {
|
198 |
+
$this->sig_method = new OAuthSignatureMethod_HMAC_SHA1();
|
199 |
+
}
|
200 |
+
if ( empty( $this->consumer ) ) {
|
201 |
+
$this->consumer = new OAuthCOnsumer( 'anonymous', 'anonymous' );
|
202 |
+
}
|
203 |
+
$req_req = OAuthRequest::from_consumer_and_token( $this->consumer, $req_token, 'GET', $oauth_url, $args );
|
204 |
$req_req->sign_request( $this->sig_method, $this->consumer, $req_token );
|
205 |
+
|
206 |
return $req_req;
|
207 |
}
|
208 |
|
209 |
+
/**
|
210 |
+
* @param $oauth_verifier
|
211 |
+
*
|
212 |
+
* @return array
|
213 |
+
*/
|
214 |
function oauth_get_token( $oauth_verifier ) {
|
215 |
+
if ( ! class_exists( 'OAuthConsumer' ) ) {
|
216 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
|
217 |
+
}
|
218 |
+
$args = array(
|
219 |
+
'scope' => 'https://www.google.com/analytics/feeds/',
|
220 |
+
'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' )
|
221 |
+
);
|
222 |
$args['oauth_verifier'] = $oauth_verifier;
|
223 |
+
$oauth_access_token = 'https://www.google.com/accounts/OAuthGetAccessToken';
|
224 |
+
$reqData = $this->oauth_get_data( $oauth_access_token, $args );
|
225 |
+
$reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) );
|
226 |
+
|
227 |
return $reqOAuthData;
|
228 |
}
|
229 |
|
230 |
+
/**
|
231 |
+
* @param int $count
|
232 |
+
*
|
233 |
+
* @return string
|
234 |
+
*/
|
235 |
function oauth_connect( $count = 0 ) {
|
236 |
global $aiosp_activation;
|
237 |
+
if ( ! class_exists( 'OAuthConsumer' ) ) {
|
238 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/extlib/OAuth.php' );
|
239 |
+
}
|
240 |
+
$url = '';
|
241 |
+
$callback_url = null;
|
242 |
+
$consumer_key = 'anonymous';
|
243 |
+
$consumer_secret = 'anonymous';
|
244 |
+
$oauth_request_token = 'https://www.google.com/accounts/OAuthGetRequestToken';
|
245 |
+
$oauth_authorize = 'https://www.google.com/accounts/OAuthAuthorizeToken';
|
246 |
+
$oauth_access_token = 'https://www.google.com/accounts/OAuthGetAccessToken';
|
247 |
if ( $aiosp_activation ) {
|
248 |
$oauth_current = false;
|
249 |
} else {
|
250 |
+
$oauth_current = get_transient( 'aioseop_oauth_current' );
|
251 |
}
|
252 |
+
if ( ! empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) {
|
253 |
return $oauth_authorize . '?oauth_token=' . $this->token;
|
254 |
} else {
|
255 |
+
set_transient( 'aioseop_oauth_current', 1, 3600 );
|
256 |
unset( $this->token );
|
257 |
unset( $this->secret );
|
258 |
}
|
259 |
$args = array(
|
260 |
+
'scope' => 'https://www.google.com/analytics/feeds/',
|
261 |
+
'xoauth_displayname' => AIOSEOP_PLUGIN_NAME . ' ' . __( 'Google Analytics', 'all-in-one-seo-pack' )
|
262 |
);
|
263 |
if ( AIOSEOPPRO ) {
|
264 |
+
$req_req = $this->oauth_get_creds( $oauth_request_token, null, $args, admin_url( 'admin.php?page=all-in-one-seo-pack-pro/aioseop_class.php' ) );
|
265 |
} else {
|
266 |
+
$req_req = $this->oauth_get_creds( $oauth_request_token, null, $args, admin_url( 'admin.php?page=all-in-one-seo-pack/aioseop_class.php' ) );
|
267 |
}
|
268 |
+
$reqData = wp_remote_get( $req_req->to_url() );
|
269 |
$reqOAuthData = OAuthUtil::parse_parameters( wp_remote_retrieve_body( $reqData ) );
|
270 |
+
if ( ! empty( $reqOAuthData['oauth_token'] ) ) {
|
271 |
+
$this->token = $reqOAuthData['oauth_token'];
|
272 |
+
}
|
273 |
+
if ( ! empty( $reqOAuthData['oauth_token_secret'] ) ) {
|
274 |
+
$this->secret = $reqOAuthData['oauth_token_secret'];
|
275 |
+
}
|
276 |
+
if ( ! empty( $this->token ) && ( $this->token != 'anonymous' ) && $oauth_current ) {
|
277 |
$url = $oauth_authorize . "?oauth_token={$this->token}";
|
278 |
} else {
|
279 |
+
if ( ! $count ) {
|
280 |
return $this->oauth_connect( 1 );
|
281 |
}
|
282 |
}
|
283 |
+
|
284 |
return $url;
|
285 |
+
}
|
inc/index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
inc/sitemap-xsl.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sitemap XSL.
|
4 |
+
*
|
5 |
+
* Dynamically generates the XML Sitemap's XSL file.
|
6 |
+
*
|
7 |
+
* @package All-in-One-SEO-Pack
|
8 |
+
*
|
9 |
+
* @since 2.3.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
13 |
+
?>
|
14 |
+
<xsl:stylesheet version="2.0"
|
15 |
+
xmlns:html="http://www.w3.org/TR/REC-html40"
|
16 |
+
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
|
17 |
+
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
18 |
+
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
19 |
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
20 |
+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
21 |
+
<xsl:template match="/">
|
22 |
+
<xsl:variable name="fileType">
|
23 |
+
<xsl:choose>
|
24 |
+
<xsl:when test="//sitemap:url">Sitemap</xsl:when>
|
25 |
+
<xsl:otherwise>SitemapIndex</xsl:otherwise>
|
26 |
+
</xsl:choose>
|
27 |
+
</xsl:variable>
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
29 |
+
<head>
|
30 |
+
<title>
|
31 |
+
<xsl:choose><xsl:when test="$fileType='Sitemap'">Sitemap</xsl:when>
|
32 |
+
<xsl:otherwise>Sitemap Index</xsl:otherwise>
|
33 |
+
</xsl:choose>
|
34 |
+
</title>
|
35 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
36 |
+
<style type="text/css">
|
37 |
+
body {
|
38 |
+
margin: 0;
|
39 |
+
font-family: Helvetica, Arial, sans-serif;
|
40 |
+
font-size: 68.5%;
|
41 |
+
}
|
42 |
+
#content-head {
|
43 |
+
background-color: #4275f4;
|
44 |
+
padding: 20px 40px;
|
45 |
+
}
|
46 |
+
#content-head h1,
|
47 |
+
#content-head p,
|
48 |
+
#content-head a {
|
49 |
+
color: #fff;
|
50 |
+
font-size: 1.2em;
|
51 |
+
}
|
52 |
+
#content-head h1 {
|
53 |
+
font-size: 2em;
|
54 |
+
}
|
55 |
+
table {
|
56 |
+
margin: 20px 40px;
|
57 |
+
border: none;
|
58 |
+
border-collapse: collapse;
|
59 |
+
}
|
60 |
+
table {
|
61 |
+
font-size: 1em;
|
62 |
+
width: 75%;
|
63 |
+
}
|
64 |
+
th {
|
65 |
+
border-bottom: 1px solid #ccc;
|
66 |
+
text-align: left;
|
67 |
+
padding: 15px 5px;
|
68 |
+
font-size: 14px;
|
69 |
+
}
|
70 |
+
td {
|
71 |
+
padding: 10px 5px;
|
72 |
+
border-left: 3px solid #fff;
|
73 |
+
}
|
74 |
+
tr.stripe {
|
75 |
+
background-color: #f7f7f7;
|
76 |
+
}
|
77 |
+
</style>
|
78 |
+
</head>
|
79 |
+
<body>
|
80 |
+
<div id="content">
|
81 |
+
<div id="content-head">
|
82 |
+
<h1>XML Sitemap</h1>
|
83 |
+
<p>Generated by <a href="https://semperplugins.com">All in One </a> <a href="https://semperplugins.com/all-in-one-seo-pack-pro-version/">SEO</a>, this is an XML Sitemap, meant to be consumed by search engines like Google or Bing.<br/>
|
84 |
+
You can find more information about XML sitemaps at <a href="http://sitemaps.org">sitemaps.org</a>.</p>
|
85 |
+
<p><xsl:choose>
|
86 |
+
<xsl:when test="$fileType='Sitemap'">
|
87 |
+
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"></xsl:value-of> URLs</xsl:when>
|
88 |
+
<xsl:otherwise>This sitemap index contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"></xsl:value-of> sitemaps</xsl:otherwise>
|
89 |
+
</xsl:choose></p>
|
90 |
+
</div>
|
91 |
+
<xsl:choose>
|
92 |
+
<xsl:when test="$fileType='Sitemap'">
|
93 |
+
<xsl:call-template name="sitemapTable"/></xsl:when>
|
94 |
+
<xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise>
|
95 |
+
</xsl:choose>
|
96 |
+
|
97 |
+
</div>
|
98 |
+
</body>
|
99 |
+
</html>
|
100 |
+
</xsl:template>
|
101 |
+
<xsl:template name="siteindexTable">
|
102 |
+
<table cellpadding="3">
|
103 |
+
<thead>
|
104 |
+
<tr>
|
105 |
+
<th width="50%">URL</th>
|
106 |
+
<th>LastChange</th>
|
107 |
+
</tr>
|
108 |
+
</thead>
|
109 |
+
<tbody>
|
110 |
+
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
111 |
+
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
112 |
+
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
113 |
+
<tr>
|
114 |
+
<xsl:if test="position() mod 2 != 1">
|
115 |
+
<xsl:attribute name="class">stripe</xsl:attribute>
|
116 |
+
</xsl:if>
|
117 |
+
<td>
|
118 |
+
<xsl:variable name="itemURL">
|
119 |
+
<xsl:value-of select="sitemap:loc"/>
|
120 |
+
</xsl:variable>
|
121 |
+
<a href="{$itemURL}">
|
122 |
+
<xsl:value-of select="sitemap:loc"/>
|
123 |
+
</a>
|
124 |
+
</td>
|
125 |
+
<td>
|
126 |
+
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
</xsl:for-each>
|
130 |
+
</tbody>
|
131 |
+
</table>
|
132 |
+
</xsl:template>
|
133 |
+
<xsl:template name="sitemapTable">
|
134 |
+
<table cellpadding="3">
|
135 |
+
<thead>
|
136 |
+
<tr>
|
137 |
+
<th width="50%">URL</th>
|
138 |
+
<th>Priority</th>
|
139 |
+
<th>Change Frequency</th>
|
140 |
+
<th>LastChange</th>
|
141 |
+
</tr>
|
142 |
+
</thead>
|
143 |
+
<tbody>
|
144 |
+
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
145 |
+
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
146 |
+
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
147 |
+
<tr>
|
148 |
+
<xsl:if test="position() mod 2 != 1">
|
149 |
+
<xsl:attribute name="class">stripe</xsl:attribute>
|
150 |
+
</xsl:if>
|
151 |
+
<td>
|
152 |
+
<xsl:variable name="itemURL">
|
153 |
+
<xsl:value-of select="sitemap:loc"/>
|
154 |
+
</xsl:variable>
|
155 |
+
<a href="{$itemURL}">
|
156 |
+
<xsl:value-of select="sitemap:loc"/>
|
157 |
+
</a>
|
158 |
+
<xsl:variable name="thumbURL">
|
159 |
+
<xsl:value-of select="video:video/video:thumbnail_loc"/>
|
160 |
+
</xsl:variable>
|
161 |
+
<xsl:variable name="playURL">
|
162 |
+
<xsl:value-of select="video:video/video:player_loc"/>
|
163 |
+
</xsl:variable>
|
164 |
+
<xsl:if test="$thumbURL != ''">
|
165 |
+
<a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
|
166 |
+
</xsl:if>
|
167 |
+
</td>
|
168 |
+
<td>
|
169 |
+
<xsl:if test="string(number(sitemap:priority))!='NaN'">
|
170 |
+
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
171 |
+
</xsl:if>
|
172 |
+
</td>
|
173 |
+
<td>
|
174 |
+
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
|
175 |
+
</td>
|
176 |
+
<td>
|
177 |
+
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
178 |
+
</td>
|
179 |
+
<td>
|
180 |
+
|
181 |
+
|
182 |
+
|
183 |
+
</td>
|
184 |
+
</tr>
|
185 |
+
</xsl:for-each>
|
186 |
+
</tbody>
|
187 |
+
</table>
|
188 |
+
</xsl:template>
|
189 |
+
</xsl:stylesheet>
|
190 |
+
<?php
|
inc/translations.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'AIOSEOP_Translations' ) ) :
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class AIOSEOP_Translations
|
7 |
+
*
|
8 |
+
* @since 2.3.5
|
9 |
+
*/
|
10 |
+
class AIOSEOP_Translations {
|
11 |
+
|
12 |
+
public $current_locale = '';
|
13 |
+
|
14 |
+
public $url = 'https://translate.wordpress.org/api/projects/wp-plugins/all-in-one-seo-pack/dev';
|
15 |
+
|
16 |
+
public $name = '';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Loop through the locale info.
|
20 |
+
*
|
21 |
+
* @since 2.3.5
|
22 |
+
* @access public
|
23 |
+
* @var string $wplocale Information for a particular locale (in loop)
|
24 |
+
*/
|
25 |
+
public $wplocale = '';
|
26 |
+
|
27 |
+
public $translated_count = 0;
|
28 |
+
|
29 |
+
public $translation_url = 'https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack';
|
30 |
+
|
31 |
+
public $slug = '';
|
32 |
+
|
33 |
+
public $percent_translated = '';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* AIOSEOP_Translations constructor.
|
37 |
+
*
|
38 |
+
* @since 2.3.5
|
39 |
+
*
|
40 |
+
*/
|
41 |
+
public function __construct() {
|
42 |
+
|
43 |
+
$this->current_locale = get_locale();
|
44 |
+
|
45 |
+
$this->init();
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Fetch locale data from WP.
|
51 |
+
*
|
52 |
+
* @since 2.3.5
|
53 |
+
* @since 2.3.6 Return FALSE on WP_Error object.
|
54 |
+
*
|
55 |
+
* @return mixed
|
56 |
+
*/
|
57 |
+
private function get_locale_data() {
|
58 |
+
$response = wp_remote_get( $this->url );
|
59 |
+
|
60 |
+
if(is_wp_error($response)){
|
61 |
+
return FALSE;
|
62 |
+
}
|
63 |
+
|
64 |
+
return $response['body'];
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
/**
|
69 |
+
*
|
70 |
+
* @since 2.3.5
|
71 |
+
*
|
72 |
+
* @param $locales
|
73 |
+
*/
|
74 |
+
private function set_current_locale_data( $locales ) {
|
75 |
+
|
76 |
+
// Some locales are missing the locale code (wp_locale) so we need to check for that.
|
77 |
+
|
78 |
+
foreach ( $locales as $locale ) {
|
79 |
+
|
80 |
+
$wplocale = '';
|
81 |
+
|
82 |
+
if ( isset( $locale->wp_locale ) ) {
|
83 |
+
$wplocale = $locale->wp_locale;
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( $wplocale === $this->current_locale ) {
|
87 |
+
|
88 |
+
$name = '';
|
89 |
+
$percent_translated = '';
|
90 |
+
|
91 |
+
if ( isset( $locale->name ) ) {
|
92 |
+
$name = $locale->name;
|
93 |
+
}
|
94 |
+
|
95 |
+
if ( isset( $locale->percent_translated ) ) {
|
96 |
+
$percent_translated = $locale->percent_translated;
|
97 |
+
}
|
98 |
+
|
99 |
+
$this->name = $name;
|
100 |
+
$this->wplocale = $wplocale;
|
101 |
+
$this->percent_translated = $percent_translated;
|
102 |
+
$this->slug = $locale->locale;
|
103 |
+
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
*
|
111 |
+
* @since 2.3.5
|
112 |
+
*
|
113 |
+
* @param $locales
|
114 |
+
*
|
115 |
+
* @return int
|
116 |
+
*/
|
117 |
+
private function count_translated_languages( $locales ) {
|
118 |
+
|
119 |
+
$count = 0;
|
120 |
+
|
121 |
+
foreach ( $locales as $locale ) {
|
122 |
+
|
123 |
+
if ( $locale->percent_translated > 0 ) {
|
124 |
+
++ $count;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
return $count;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
*
|
133 |
+
*
|
134 |
+
* @since 2.3.5
|
135 |
+
*/
|
136 |
+
private function set_translation_url() {
|
137 |
+
|
138 |
+
if ( null !== $this->wplocale ) {
|
139 |
+
|
140 |
+
$url = "https://translate.wordpress.org/projects/wp-plugins/all-in-one-seo-pack/dev/$this->slug/default";
|
141 |
+
|
142 |
+
$this->translation_url = $url;
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
*
|
149 |
+
* @since 2.3.5
|
150 |
+
* @since 2.3.6 Return FALSE on WP_Error object in get_locale_data().
|
151 |
+
*
|
152 |
+
*/
|
153 |
+
private function init() {
|
154 |
+
|
155 |
+
$json = $this->get_locale_data();
|
156 |
+
|
157 |
+
if( $json === FALSE ){
|
158 |
+
return FALSE;
|
159 |
+
}
|
160 |
+
|
161 |
+
$translation_data = json_decode( $json );
|
162 |
+
|
163 |
+
$locales = $translation_data->translation_sets;
|
164 |
+
|
165 |
+
$this->set_current_locale_data( $locales );
|
166 |
+
|
167 |
+
$this->translated_count = $this->count_translated_languages( $locales );
|
168 |
+
|
169 |
+
$this->set_translation_url();
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
endif; // End class_exists check.
|
index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
js/modules/aioseop_module.js
CHANGED
@@ -1,345 +1,641 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
if (
|
60 |
-
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
if (
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
}
|
159 |
-
|
160 |
-
}
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
}
|
180 |
-
|
181 |
-
//
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
}
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
*
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
}
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
if ( typeof
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
}
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
});
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
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(/"/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&TB_iframe=true' );
|
258 |
+
return false;
|
259 |
+
});
|
260 |
+
aioseopStoreSendToEditor = window.send_to_editor;
|
261 |
+
aioseopNewSendToEditor = function(html) {
|
262 |
+
imgurl = jQuery( 'img',html ).attr( 'src' );
|
263 |
+
if ( typeof( imgurl ) !== undefined )
|
264 |
+
image_field.val( imgurl );
|
265 |
+
tb_remove();
|
266 |
+
window.send_to_editor = aioseopStoreSendToEditor;
|
267 |
+
};
|
268 |
+
});
|
269 |
+
|
270 |
+
/**
|
271 |
+
* @summary workaround for bug that causes radio inputs to lose settings when meta box is dragged.
|
272 |
+
*
|
273 |
+
* props to commentluv for this fix
|
274 |
+
* @author commentluv.
|
275 |
+
* @link http://core.trac.wordpress.org/ticket/16972
|
276 |
+
* @since 1.0.0
|
277 |
+
*/
|
278 |
+
jQuery( document ).ready(function() {
|
279 |
+
|
280 |
+
// listen for drag drop of metaboxes , bind mousedown to .hndle so it only fires when starting to drag
|
281 |
+
jQuery( '.hndle' ).mousedown(function() {
|
282 |
+
|
283 |
+
// set live event listener for mouse up on the content .wrap and wait a tick to give the dragged div time to settle before firing the reclick function
|
284 |
+
jQuery( '.wrap').mouseup(function() {
|
285 |
+
aiosp_store_radio();
|
286 |
+
setTimeout( 'aiosp_reclick_radio();', 50 );
|
287 |
+
});
|
288 |
+
})
|
289 |
+
});
|
290 |
+
|
291 |
+
/**
|
292 |
+
* @summary Stores object of all radio buttons that are checked for entire form.
|
293 |
+
*
|
294 |
+
* @since 1.0.0
|
295 |
+
*/
|
296 |
+
function aiosp_store_radio() {
|
297 |
+
var radioshack = {};
|
298 |
+
jQuery( 'input[type="radio"]' ).each(function() {
|
299 |
+
if( jQuery( this ).is( ':checked' ) ) {
|
300 |
+
radioshack[ jQuery( this ).attr( 'name' ) ] = jQuery( this ).val();
|
301 |
+
}
|
302 |
+
jQuery( document ).data( 'radioshack', radioshack );
|
303 |
+
});
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* @summary Detects mouseup and restore all radio buttons that were checked.
|
308 |
+
*
|
309 |
+
* @since 1.0.0
|
310 |
+
*/
|
311 |
+
function aiosp_reclick_radio() {
|
312 |
+
|
313 |
+
// gets the object of checked radio button names and values
|
314 |
+
var radios = jQuery( document ).data( 'radioshack' );
|
315 |
+
|
316 |
+
//steps thru each object element and trigger a click on it's corresponding radio button
|
317 |
+
for( key in radios ) {
|
318 |
+
jQuery( 'input[name="' + key + '"]' )
|
319 |
+
.filter( '[value="' + radios[ key ]+ '"]' )
|
320 |
+
.trigger( 'click' );
|
321 |
+
}
|
322 |
+
// unbinds the event listener on .wrap (prevents clicks on inputs from triggering function)
|
323 |
+
jQuery( '.wrap' ).unbind( 'mouseup' );
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* @summary Handdles ajax call.
|
328 |
+
*
|
329 |
+
* @since 1.0.0
|
330 |
+
* @param $action.
|
331 |
+
* @param $setting.
|
332 |
+
* @param $options.
|
333 |
+
* @param $success.
|
334 |
+
*/
|
335 |
+
function aioseop_handle_ajax_call( action, settings, options, success ) {
|
336 |
+
var aioseop_sack = new sack( ajaxurl );
|
337 |
+
aioseop_sack.execute = 1;
|
338 |
+
aioseop_sack.method = 'POST';
|
339 |
+
aioseop_sack.setVar( "action", action );
|
340 |
+
aioseop_sack.setVar( "settings", settings );
|
341 |
+
aioseop_sack.setVar( "options", options );
|
342 |
+
if ( typeof success != 'undefined' ) {
|
343 |
+
aioseop_sack.onCompletion = success;
|
344 |
+
}
|
345 |
+
aioseop_sack.setVar(
|
346 |
+
"nonce-aioseop",
|
347 |
+
jQuery( 'input[name="nonce-aioseop"]' ).val()
|
348 |
+
);
|
349 |
+
aioseop_sack.setVar(
|
350 |
+
"nonce-aioseop-edit",
|
351 |
+
jQuery( 'input[name="nonce-aioseop-edit"]' ).val()
|
352 |
+
);
|
353 |
+
aioseop_sack.onError = function() {
|
354 |
+
alert( 'Ajax error on saving.' );
|
355 |
+
};
|
356 |
+
aioseop_sack.runAJAX();
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* @summary Handdles posts URL.
|
361 |
+
*
|
362 |
+
* @since 1.0.0
|
363 |
+
* @param $action.
|
364 |
+
* @param $setting.
|
365 |
+
* @param $options.
|
366 |
+
* @param $success.
|
367 |
+
*/
|
368 |
+
function aioseop_handle_post_url( action, settings, options, success) {
|
369 |
+
jQuery("div#aiosp_"+settings).fadeOut('fast', function() {
|
370 |
+
var loading = '<label class="aioseop_loading aioseop_' + settings + '_loading"></label> Please wait...';
|
371 |
+
jQuery( "div#aiosp_"+ settings ).fadeIn( 'fast', function() {
|
372 |
+
aioseop_handle_ajax_call( action, settings, options, success);
|
373 |
+
});
|
374 |
+
jQuery( "div#aiosp_" + settings ).html( loading );
|
375 |
+
})
|
376 |
+
};
|
377 |
+
|
378 |
+
/**
|
379 |
+
* @summary Handles when AIOSEOP is overflowed.
|
380 |
+
*
|
381 |
+
* @since 1.0.0
|
382 |
+
* @param $element.
|
383 |
+
* @return mixed.
|
384 |
+
*/
|
385 |
+
function aioseop_is_overflowed( element ) {
|
386 |
+
return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* @summary Handles when overflowed border.
|
391 |
+
*
|
392 |
+
* @since 1.0.0
|
393 |
+
* @param $el.
|
394 |
+
*/
|
395 |
+
function aioseop_overflow_border( el ) {
|
396 |
+
if ( aioseop_is_overflowed( el ) ) {
|
397 |
+
el.className = 'aioseop_option_div aioseop_overflowed';
|
398 |
+
} else {
|
399 |
+
el.className = 'aioseop_option_div';
|
400 |
+
}
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* @since 1.0.0
|
405 |
+
* @return mixed.
|
406 |
+
*/
|
407 |
+
jQuery( document ).ready(function() {
|
408 |
+
jQuery( "#poststuff .aioseop_radio_type input[type='radio']" ).on( 'click', function() {
|
409 |
+
var previousValue = jQuery( this ).attr( 'previousValue' );
|
410 |
+
var name = jQuery( this ).attr( 'name' );
|
411 |
+
if ( typeof previousValue == 'undefined' ) {
|
412 |
+
if ( jQuery( this ).prop( "checked" ) ) {
|
413 |
+
jQuery( this ).prop( 'checked', true );
|
414 |
+
jQuery( this ).attr( 'previousValue', 'checked' );
|
415 |
+
} else {
|
416 |
+
jQuery( this ).prop( 'checked', false );
|
417 |
+
jQuery( this ).attr( 'previousValue', false );
|
418 |
+
}
|
419 |
+
return;
|
420 |
+
}
|
421 |
+
if ( previousValue == 'checked' ) {
|
422 |
+
jQuery( this ).prop( 'checked', false );
|
423 |
+
jQuery( this ).attr( 'previousValue', false );
|
424 |
+
} else {
|
425 |
+
jQuery( "input[name=" + name + "]:radio" )
|
426 |
+
.attr( 'previousValue', false );
|
427 |
+
jQuery( this ).attr( 'previousValue', 'checked' );
|
428 |
+
}
|
429 |
+
});
|
430 |
+
if ( typeof aiosp_data.pointers != 'undefined' ) {
|
431 |
+
|
432 |
+
/**
|
433 |
+
* @since 1.0.0
|
434 |
+
* @param $index.
|
435 |
+
* @param $value.
|
436 |
+
* @return mixed.
|
437 |
+
*/
|
438 |
+
jQuery.each( aiosp_data.pointers, function( index, value ) {
|
439 |
+
if ( value != 'undefined' && value.pointer_text != '' ) {
|
440 |
+
aioseop_show_pointer( index, value );
|
441 |
+
}
|
442 |
+
});
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* @since 1.0.0
|
447 |
+
* @param $e.
|
448 |
+
* @return boolean.
|
449 |
+
*/
|
450 |
+
jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-modules-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left" )
|
451 |
+
.delegate("input[name='Submit']", "click", function( e ) {
|
452 |
+
e.preventDefault();
|
453 |
+
return false;
|
454 |
+
});
|
455 |
+
|
456 |
+
/**
|
457 |
+
* @since 1.0.0
|
458 |
+
* @param $e.
|
459 |
+
* @return boolean.
|
460 |
+
*/
|
461 |
+
jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-modules-aioseop_feature_manager #aiosp_settings_form" )
|
462 |
+
.delegate( "input[name='Submit']", "click", function( e ) {
|
463 |
+
e.preventDefault();
|
464 |
+
aioseop_handle_post_url(
|
465 |
+
'aioseop_ajax_save_settings',
|
466 |
+
'ajax_settings_message',
|
467 |
+
jQuery( 'form#aiosp_settings_form' ).serialize(),
|
468 |
+
function() {
|
469 |
+
jQuery( '.wp-has-current-submenu' ).fadeIn( 'fast', function() {
|
470 |
+
aioseop_handle_ajax_call(
|
471 |
+
'aioseop_ajax_get_menu_links',
|
472 |
+
'ajax_settings_message',
|
473 |
+
jQuery.param( {target: '.wp-has-current-submenu > ul'} )
|
474 |
+
);
|
475 |
+
});
|
476 |
+
} );
|
477 |
+
return false;
|
478 |
+
});
|
479 |
+
|
480 |
+
/**
|
481 |
+
* @since 1.0.0
|
482 |
+
* @param $e.
|
483 |
+
* @return boolean.
|
484 |
+
*/
|
485 |
+
jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left" )
|
486 |
+
.delegate("input[name='Submit']", "click", function( e ) {
|
487 |
+
e.preventDefault();
|
488 |
+
return false;
|
489 |
+
});
|
490 |
+
|
491 |
+
/**
|
492 |
+
* @since 1.0.0
|
493 |
+
* @param $e.
|
494 |
+
* @return boolean.
|
495 |
+
*/
|
496 |
+
jQuery( ".all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aiosp_settings_form" )
|
497 |
+
.delegate( "input[name='Submit']", "click", function( e ) {
|
498 |
+
e.preventDefault();
|
499 |
+
aioseop_handle_post_url(
|
500 |
+
'aioseop_ajax_save_settings',
|
501 |
+
'ajax_settings_message',
|
502 |
+
jQuery( 'form#aiosp_settings_form' ).serialize(),
|
503 |
+
function() {
|
504 |
+
jQuery( '.wp-has-current-submenu' ).fadeIn( 'fast', function() {
|
505 |
+
aioseop_handle_ajax_call(
|
506 |
+
'aioseop_ajax_get_menu_links',
|
507 |
+
'ajax_settings_message',
|
508 |
+
jQuery.param( {target: '.wp-has-current-submenu > ul'} )
|
509 |
+
);
|
510 |
+
});
|
511 |
+
} );
|
512 |
+
return false;
|
513 |
+
});
|
514 |
+
|
515 |
+
var selectors =
|
516 |
+
"div.aioseop_multicheckbox_type div.aioseop_option_div, #aiosp_sitemap_debug div.aioseop_option_div, #aiosp_performance_status div.aioseop_option_div";
|
517 |
+
|
518 |
+
/**
|
519 |
+
* @since 1.0.0
|
520 |
+
* @return boolean.
|
521 |
+
*/
|
522 |
+
jQuery( "div#aiosp_sitemap_addl_pages_metabox" )
|
523 |
+
.delegate( "input[name='Submit']", "click", function() {
|
524 |
+
aioseop_handle_post_url(
|
525 |
+
'aioseop_ajax_save_url',
|
526 |
+
'sitemap_addl_pages',
|
527 |
+
jQuery( 'div#aiosp_sitemap_addl_pages_metabox input, div#aiosp_sitemap_addl_pages_metabox select' )
|
528 |
+
.serialize()
|
529 |
+
);
|
530 |
+
return false;
|
531 |
+
});
|
532 |
+
|
533 |
+
/**
|
534 |
+
* @since 1.0.0
|
535 |
+
* @return boolean.
|
536 |
+
*/
|
537 |
+
jQuery( "div#aiosp_video_sitemap_addl_pages_metabox" )
|
538 |
+
.delegate( "input[name='Submit']", "click", function() {
|
539 |
+
aioseop_handle_post_url(
|
540 |
+
'aioseop_ajax_save_url',
|
541 |
+
'video_sitemap_addl_pages',
|
542 |
+
jQuery( 'div#aiosp_video_sitemap_addl_pages_metabox input, div#aiosp_video_sitemap_addl_pages_metabox select')
|
543 |
+
.serialize()
|
544 |
+
);
|
545 |
+
return false;
|
546 |
+
});
|
547 |
+
|
548 |
+
/**
|
549 |
+
* @since 1.0.0
|
550 |
+
* @param $e.
|
551 |
+
* @return boolean.
|
552 |
+
*/
|
553 |
+
jQuery( "div#aiosp_sitemap_addl_pages_metabox" )
|
554 |
+
.delegate("a.aiosp_delete_url", "click", function( e ) {
|
555 |
+
e.preventDefault();
|
556 |
+
aioseop_handle_post_url(
|
557 |
+
'aioseop_ajax_delete_url',
|
558 |
+
'sitemap_addl_pages',
|
559 |
+
jQuery( this ).attr( "title" )
|
560 |
+
);
|
561 |
+
return false;
|
562 |
+
});
|
563 |
+
|
564 |
+
/**
|
565 |
+
* @since 1.0.0
|
566 |
+
* @param $e.
|
567 |
+
* @return boolean.
|
568 |
+
*/
|
569 |
+
jQuery( "div#aiosp_video_sitemap_addl_pages_metabox" )
|
570 |
+
.delegate( "a.aiosp_delete_url", "click", function( e ) {
|
571 |
+
e.preventDefault();
|
572 |
+
aioseop_handle_post_url(
|
573 |
+
'aioseop_ajax_delete_url',
|
574 |
+
'video_sitemap_addl_pages',
|
575 |
+
jQuery( this ).attr( "title" )
|
576 |
+
);
|
577 |
+
return false;
|
578 |
+
});
|
579 |
+
|
580 |
+
/**
|
581 |
+
* @since 1.0.0
|
582 |
+
* @param $e.
|
583 |
+
* @return boolean.
|
584 |
+
*/
|
585 |
+
jQuery( "div#aiosp_opengraph_scan_header" )
|
586 |
+
.delegate( "input[name='aiosp_opengraph_scan_header']", "click", function( e ) {
|
587 |
+
e.preventDefault();
|
588 |
+
aioseop_handle_post_url(
|
589 |
+
'aioseop_ajax_scan_header',
|
590 |
+
'opengraph_scan_header',
|
591 |
+
jQuery( 'div#aiosp_opengraph_scan_header' ).serialize()
|
592 |
+
);
|
593 |
+
return false;
|
594 |
+
});
|
595 |
+
|
596 |
+
/**
|
597 |
+
* @since 1.0.0
|
598 |
+
*/
|
599 |
+
jQuery( 'input[name="aiosp_sitemap_posttypes[]"][value="all"], input[name="aiosp_video_sitemap_posttypes[]"][value="all"], input[name="aiosp_sitemap_taxonomies[]"][value="all"], input[name="aiosp_video_sitemap_taxonomies[]"][value="all"]' )
|
600 |
+
.click(function() {
|
601 |
+
jQuery( this )
|
602 |
+
.parents( 'div:eq(0)' )
|
603 |
+
.find( ':checkbox' )
|
604 |
+
.prop( 'checked', this.checked );
|
605 |
+
});
|
606 |
+
|
607 |
+
/**
|
608 |
+
* @since 1.0.0
|
609 |
+
*/
|
610 |
+
jQuery( 'input[name="aiosp_sitemap_posttypes[]"][value!="all"], input[name="aiosp_video_sitemap_posttypes[]"][value!="all"], input[name="aiosp_sitemap_taxonomies[]"][value!="all"], input[name="aiosp_video_sitemap_taxonomies[]"][value!="all"]' )
|
611 |
+
.click(function () {
|
612 |
+
if ( ! this.checked )
|
613 |
+
jQuery( this )
|
614 |
+
.parents( 'div:eq(0)' )
|
615 |
+
.find( 'input[value="all"]:checkbox' )
|
616 |
+
.prop( 'checked', this.checked );
|
617 |
+
});
|
618 |
+
|
619 |
+
/**
|
620 |
+
* @since 1.0.0
|
621 |
+
*/
|
622 |
+
jQuery( ".aioseop_tab:not(:first)" ).hide();
|
623 |
+
|
624 |
+
/**
|
625 |
+
* @since 1.0.0
|
626 |
+
*/
|
627 |
+
jQuery( ".aioseop_tab:first" ).show();
|
628 |
+
|
629 |
+
/**
|
630 |
+
* @since 1.0.0
|
631 |
+
* @return boolean.
|
632 |
+
*/
|
633 |
+
jQuery( "a.aioseop_header_tab" ).click(function() {
|
634 |
+
var stringref = jQuery( this ).attr( "href" ).split( '#' )[1];
|
635 |
+
jQuery( '.aioseop_tab:not(#' + stringref + ')' ).hide( 'slow' );
|
636 |
+
jQuery( '.aioseop_tab#' + stringref ).show( 'slow' );
|
637 |
+
jQuery( '.aioseop_header_tab[href!="#'+ stringref +'"]' ).removeClass( 'active' );
|
638 |
+
jQuery( '.aioseop_header_tab[href="#' + stringref +'"]' ).addClass( 'active' );
|
639 |
+
return false;
|
640 |
+
});
|
641 |
+
});
|
modules/aioseop_bad_robots.php
CHANGED
@@ -1,155 +1,225 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
*/
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
9 |
class All_in_One_SEO_Pack_Bad_Robots extends All_in_One_SEO_Pack_Module {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
parent::__construct();
|
15 |
-
|
16 |
-
$help_text =
|
17 |
-
'block_bots'
|
18 |
-
'block_refer'
|
19 |
-
'track_blocks'=>
|
20 |
-
'htaccess_rules'=>__( 'Block bad robots via
|
21 |
-
'edit_blocks'
|
22 |
-
'blocklist'
|
23 |
-
'referlist'
|
24 |
-
'blocked_log'
|
25 |
);
|
26 |
-
|
27 |
$this->default_options = array(
|
28 |
-
'block_bots'
|
29 |
-
'block_refer'
|
30 |
-
'track_blocks'
|
31 |
-
'htaccess_rules' =>
|
32 |
-
'edit_blocks'
|
33 |
-
'blocklist'
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
);
|
37 |
-
$is_apache
|
38 |
-
if (
|
39 |
$is_apache = true;
|
40 |
-
add_action( $this->prefix . 'settings_update',
|
41 |
} else {
|
42 |
-
unset( $this->default_options[
|
43 |
-
unset( $help_text[
|
44 |
}
|
45 |
-
|
46 |
-
if ( !empty( $help_text ) )
|
47 |
-
foreach( $help_text as $k => $v )
|
48 |
-
$this->default_options[$k]['help_text'] = $v;
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
55 |
if ( $this->option_isset( 'edit_blocks' ) ) {
|
56 |
-
add_filter( $this->prefix . 'badbotlist',
|
57 |
if ( $this->option_isset( 'block_refer' ) ) {
|
58 |
-
add_filter( $this->prefix . 'badreferlist',
|
59 |
}
|
60 |
}
|
61 |
-
|
62 |
if ( $this->option_isset( 'block_bots' ) ) {
|
63 |
-
if (
|
64 |
status_header( 503 );
|
65 |
-
$ip
|
66 |
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
67 |
-
$this->blocked_message( sprintf( __(
|
68 |
exit();
|
69 |
} elseif ( $this->option_isset( 'block_refer' ) && $this->is_bad_referer() ) {
|
70 |
status_header( 503 );
|
71 |
-
$ip
|
72 |
$referer = $_SERVER['HTTP_REFERER'];
|
73 |
-
$this->blocked_message( sprintf( __(
|
74 |
}
|
75 |
}
|
76 |
}
|
77 |
-
|
78 |
function generate_htaccess_blocklist() {
|
79 |
-
if (
|
80 |
|
81 |
if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, '' ) ) {
|
82 |
-
aioseop_output_notice( __(
|
83 |
} else {
|
84 |
-
aioseop_output_notice( __(
|
85 |
}
|
86 |
-
|
87 |
return;
|
88 |
-
|
89 |
}
|
90 |
|
91 |
if ( function_exists( 'apache_get_modules' ) ) {
|
92 |
$modules = apache_get_modules();
|
93 |
-
foreach(
|
94 |
-
if ( !in_array( $m, $modules ) ) {
|
95 |
-
aioseop_output_notice( sprintf( __(
|
96 |
}
|
97 |
}
|
98 |
}
|
99 |
$botlist = $this->default_bad_bots();
|
100 |
-
$botlist = apply_filters( $this->prefix .
|
101 |
-
if ( !empty( $botlist ) ) {
|
102 |
-
$regex
|
103 |
-
$htaccess
|
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 .
|
108 |
-
if ( !empty( $referlist ) ) {
|
109 |
-
$regex
|
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( __(
|
116 |
} else {
|
117 |
-
aioseop_output_notice( __(
|
118 |
}
|
119 |
} else {
|
120 |
-
aioseop_output_notice( __(
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
139 |
function blocked_message( $msg ) {
|
140 |
-
if ( empty( $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 (
|
|
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
function filter_display_options( $options ) {
|
152 |
-
|
|
|
|
|
|
|
|
|
153 |
return $options;
|
154 |
}
|
155 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* @package All-in-One-SEO-Pack
|
4 |
*/
|
5 |
+
|
6 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class All_in_One_SEO_Pack_Bad_Robots
|
10 |
+
*/
|
11 |
class All_in_One_SEO_Pack_Bad_Robots extends All_in_One_SEO_Pack_Module {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* All_in_One_SEO_Pack_Bad_Robots constructor.
|
15 |
+
*/
|
16 |
+
function __construct() {
|
17 |
+
$this->name = __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
|
18 |
+
$this->prefix = 'aiosp_bad_robots_'; // Option prefix.
|
19 |
+
$this->file = __FILE__; // The current file.
|
20 |
parent::__construct();
|
21 |
+
|
22 |
+
$help_text = array(
|
23 |
+
'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ),
|
24 |
+
'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ),
|
25 |
+
'track_blocks' => __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ),
|
26 |
+
'htaccess_rules' => __( 'Block bad robots via Apache .htaccess rules. Warning: this will change your web server configuration, make sure you are able to edit this file manually as well.', 'all-in-one-seo-pack' ),
|
27 |
+
'edit_blocks' => __( 'Check this to edit the list of disallowed user agents for blocking bad bots.', 'all-in-one-seo-pack' ),
|
28 |
+
'blocklist' => __( 'This is the list of disallowed user agents used for blocking bad bots.', 'all-in-one-seo-pack' ),
|
29 |
+
'referlist' => __( 'This is the list of disallowed referers used for blocking bad bots.', 'all-in-one-seo-pack' ),
|
30 |
+
'blocked_log' => __( 'Shows log of most recent requests from blocked bots. Note: this will not track any bots that were already blocked at the web server / .htaccess level.', 'all-in-one-seo-pack' ),
|
31 |
);
|
32 |
+
|
33 |
$this->default_options = array(
|
34 |
+
'block_bots' => array( 'name' => __( 'Block Bad Bots using HTTP', 'all-in-one-seo-pack' ) ),
|
35 |
+
'block_refer' => array( 'name' => __( 'Block Referral Spam using HTTP', 'all-in-one-seo-pack' ) ),
|
36 |
+
'track_blocks' => array( 'name' => __( 'Track Blocked Bots', 'all-in-one-seo-pack' ) ),
|
37 |
+
'htaccess_rules' => array( 'name' => __( 'Block Bad Bots using .htaccess', 'all-in-one-seo-pack' ) ),
|
38 |
+
'edit_blocks' => array( 'name' => __( 'Use Custom Blocklists', 'all-in-one-seo-pack' ) ),
|
39 |
+
'blocklist' => array(
|
40 |
+
'name' => __( 'User Agent Blocklist', 'all-in-one-seo-pack' ),
|
41 |
+
'type' => 'textarea',
|
42 |
+
'rows' => 5,
|
43 |
+
'cols' => 120,
|
44 |
+
'condshow' => array( "{$this->prefix}edit_blocks" => 'on' ),
|
45 |
+
'default' => join( "\n", $this->default_bad_bots() ),
|
46 |
+
),
|
47 |
+
'referlist' => array(
|
48 |
+
'name' => __( 'Referer Blocklist', 'all-in-one-seo-pack' ),
|
49 |
+
'type' => 'textarea',
|
50 |
+
'rows' => 5,
|
51 |
+
'cols' => 120,
|
52 |
+
'condshow' => array(
|
53 |
+
"{$this->prefix}edit_blocks" => 'on',
|
54 |
+
"{$this->prefix}block_refer" => 'on',
|
55 |
+
),
|
56 |
+
'default' => join( "\n", $this->default_bad_referers() ),
|
57 |
+
),
|
58 |
+
'blocked_log' => array(
|
59 |
+
'name' => __( 'Log Of Blocked Bots', 'all-in-one-seo-pack' ),
|
60 |
+
'default' => __( 'No requests yet.', 'all-in-one-seo-pack' ),
|
61 |
+
'type' => 'html',
|
62 |
+
'disabled' => 'disabled',
|
63 |
+
'save' => false,
|
64 |
+
'label' => 'top',
|
65 |
+
'rows' => 5,
|
66 |
+
'cols' => 120,
|
67 |
+
'style' => 'min-width:950px',
|
68 |
+
'condshow' => array( "{$this->prefix}track_blocks" => 'on' ),
|
69 |
+
),
|
70 |
);
|
71 |
+
$is_apache = false;
|
72 |
+
if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) {
|
73 |
$is_apache = true;
|
74 |
+
add_action( $this->prefix . 'settings_update', array( $this, 'generate_htaccess_blocklist' ), 10 );
|
75 |
} else {
|
76 |
+
unset( $this->default_options['htaccess_rules'] );
|
77 |
+
unset( $help_text['htaccess_rules'] );
|
78 |
}
|
79 |
+
|
80 |
+
if ( ! empty( $help_text ) ) {
|
81 |
+
foreach ( $help_text as $k => $v ) {
|
82 |
+
$this->default_options[ $k ]['help_text'] = $v;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
add_filter( $this->prefix . 'display_options', array( $this, 'filter_display_options' ) );
|
87 |
+
|
88 |
+
// Load initial options / set defaults,
|
89 |
+
$this->update_options();
|
90 |
+
|
91 |
if ( $this->option_isset( 'edit_blocks' ) ) {
|
92 |
+
add_filter( $this->prefix . 'badbotlist', array( $this, 'filter_bad_botlist' ) );
|
93 |
if ( $this->option_isset( 'block_refer' ) ) {
|
94 |
+
add_filter( $this->prefix . 'badreferlist', array( $this, 'filter_bad_referlist' ) );
|
95 |
}
|
96 |
}
|
97 |
+
|
98 |
if ( $this->option_isset( 'block_bots' ) ) {
|
99 |
+
if ( ! $this->allow_bot() ) {
|
100 |
status_header( 503 );
|
101 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
102 |
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
103 |
+
$this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched user agent %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $user_agent ) );
|
104 |
exit();
|
105 |
} elseif ( $this->option_isset( 'block_refer' ) && $this->is_bad_referer() ) {
|
106 |
status_header( 503 );
|
107 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
108 |
$referer = $_SERVER['HTTP_REFERER'];
|
109 |
+
$this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched referer %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $referer ) );
|
110 |
}
|
111 |
}
|
112 |
}
|
113 |
+
|
114 |
function generate_htaccess_blocklist() {
|
115 |
+
if ( ! $this->option_isset( 'htaccess_rules' ) ) {
|
116 |
|
117 |
if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, '' ) ) {
|
118 |
+
aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) );
|
119 |
} else {
|
120 |
+
aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' );
|
121 |
}
|
122 |
+
|
123 |
return;
|
124 |
+
|
125 |
}
|
126 |
|
127 |
if ( function_exists( 'apache_get_modules' ) ) {
|
128 |
$modules = apache_get_modules();
|
129 |
+
foreach ( array( 'mod_authz_host', 'mod_setenvif' ) as $m ) {
|
130 |
+
if ( ! in_array( $m, $modules ) ) {
|
131 |
+
aioseop_output_notice( sprintf( __( 'Apache module %s is required!', 'all-in-one-seo-pack' ), $m ), '', 'error' );
|
132 |
}
|
133 |
}
|
134 |
}
|
135 |
$botlist = $this->default_bad_bots();
|
136 |
+
$botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
|
137 |
+
if ( ! empty( $botlist ) ) {
|
138 |
+
$regex = $this->quote_list_for_regex( $botlist, '"' );
|
139 |
+
$htaccess = array();
|
140 |
$htaccess[] = 'SetEnvIfNoCase User-Agent "' . $regex . '" bad_bot';
|
141 |
if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
|
142 |
$referlist = $this->default_bad_referers();
|
143 |
+
$referlist = apply_filters( $this->prefix . 'badreferlist', $botlist );
|
144 |
+
if ( ! empty( $referlist ) ) {
|
145 |
+
$regex = $this->quote_list_for_regex( $referlist, '"' );
|
146 |
$htaccess[] = 'SetEnvIfNoCase Referer "' . $regex . '" bad_bot';
|
147 |
}
|
148 |
}
|
149 |
$htaccess[] = 'Deny from env=bad_bot';
|
150 |
if ( insert_with_markers( get_home_path() . '.htaccess', $this->name, $htaccess ) ) {
|
151 |
+
aioseop_output_notice( __( 'Updated .htaccess rules.', 'all-in-one-seo-pack' ) );
|
152 |
} else {
|
153 |
+
aioseop_output_notice( __( 'Failed to update .htaccess rules!', 'all-in-one-seo-pack' ), '', 'error' );
|
154 |
}
|
155 |
} else {
|
156 |
+
aioseop_output_notice( __( 'No rules to update!', 'all-in-one-seo-pack' ), '', 'error' );
|
157 |
}
|
158 |
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @param $referlist
|
162 |
+
*
|
163 |
+
* @return array
|
164 |
+
*/
|
165 |
function filter_bad_referlist( $referlist ) {
|
166 |
if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
|
167 |
$referlist = explode( "\n", $this->options["{$this->prefix}referlist"] );
|
168 |
}
|
169 |
+
|
170 |
return $referlist;
|
171 |
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* @param $botlist
|
175 |
+
*
|
176 |
+
* @return array
|
177 |
+
*/
|
178 |
function filter_bad_botlist( $botlist ) {
|
179 |
if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'blocklist' ) ) {
|
180 |
$botlist = explode( "\n", $this->options["{$this->prefix}blocklist"] );
|
181 |
}
|
182 |
+
|
183 |
return $botlist;
|
184 |
}
|
185 |
+
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Updates blocked message.
|
189 |
+
*
|
190 |
+
* @param string $msg
|
191 |
+
*/
|
192 |
function blocked_message( $msg ) {
|
193 |
+
if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) {
|
194 |
+
$this->options["{$this->prefix}blocked_log"] = '';
|
195 |
+
}
|
196 |
$this->options["{$this->prefix}blocked_log"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}blocked_log"];
|
197 |
if ( $this->strlen( $this->options["{$this->prefix}blocked_log"] ) > 4096 ) {
|
198 |
$end = $this->strrpos( $this->options["{$this->prefix}blocked_log"], "\n" );
|
199 |
+
if ( false === $end ) {
|
200 |
+
$end = 4096;
|
201 |
+
}
|
202 |
$this->options["{$this->prefix}blocked_log"] = $this->substr( $this->options["{$this->prefix}blocked_log"], 0, $end );
|
203 |
}
|
204 |
$this->update_class_option( $this->options );
|
205 |
}
|
206 |
+
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Filter display options.
|
210 |
+
*
|
211 |
+
* Add in options for status display on settings page, sitemap rewriting on multisite.
|
212 |
+
*
|
213 |
+
* @param $options
|
214 |
+
*
|
215 |
+
* @return mixed
|
216 |
+
*/
|
217 |
function filter_display_options( $options ) {
|
218 |
+
|
219 |
+
if ( $this->option_isset( 'blocked_log' ) ) {
|
220 |
+
$options["{$this->prefix}blocked_log"] = '<pre>' . $options["{$this->prefix}blocked_log"] . '</pre>';
|
221 |
+
}
|
222 |
+
|
223 |
return $options;
|
224 |
}
|
225 |
}
|
modules/aioseop_feature_manager.php
CHANGED
@@ -1,130 +1,191 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
-
*/
|
5 |
/**
|
6 |
* The Feature Manager class.
|
|
|
|
|
7 |
*/
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
class All_in_One_SEO_Pack_Feature_Manager extends All_in_One_SEO_Pack_Module {
|
10 |
|
11 |
-
protected $module_info =
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
function __construct( $mod ) {
|
14 |
-
$this->name
|
15 |
-
$this->prefix = 'aiosp_feature_manager_';
|
16 |
-
$this->file
|
17 |
parent::__construct();
|
18 |
-
$this->module_info =
|
19 |
-
'sitemap'
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
'
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
'
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
'
|
32 |
-
|
33 |
-
|
34 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
|
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
|
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 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
|
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
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 =
|
83 |
-
'default' =>
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
);
|
89 |
-
//
|
90 |
-
$this->update_options(
|
91 |
if ( is_admin() ) {
|
92 |
-
add_filter( $this->prefix . 'output_option',
|
93 |
-
add_filter( $this->prefix . 'submit_options',
|
94 |
}
|
95 |
}
|
96 |
|
|
|
|
|
|
|
|
|
|
|
97 |
function menu_order() {
|
98 |
return 20;
|
99 |
}
|
100 |
|
|
|
|
|
|
|
|
|
|
|
101 |
function filter_submit( $submit ) {
|
102 |
-
$submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' )
|
103 |
-
$submit['Submit']['class'] .=
|
104 |
$submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' »';
|
|
|
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 |
-
|
113 |
-
if (
|
|
|
|
|
|
|
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[
|
121 |
-
if ($args['value'])
|
|
|
|
|
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'] ) )
|
127 |
-
|
|
|
|
|
|
|
128 |
}
|
129 |
}
|
130 |
}
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/**
|
3 |
* The Feature Manager class.
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class All_in_One_SEO_Pack_Feature_Manager
|
12 |
+
*/
|
13 |
class All_in_One_SEO_Pack_Feature_Manager extends All_in_One_SEO_Pack_Module {
|
14 |
|
15 |
+
protected $module_info = array();
|
16 |
|
17 |
+
/**
|
18 |
+
* All_in_One_SEO_Pack_Feature_Manager constructor.
|
19 |
+
*
|
20 |
+
* @param $mod Module.
|
21 |
+
*/
|
22 |
function __construct( $mod ) {
|
23 |
+
$this->name = __( 'Feature Manager', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
|
24 |
+
$this->prefix = 'aiosp_feature_manager_'; // Option prefix.
|
25 |
+
$this->file = __FILE__; // The current file.
|
26 |
parent::__construct();
|
27 |
+
$this->module_info = array(
|
28 |
+
'sitemap' => array(
|
29 |
+
'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
|
30 |
+
'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
|
31 |
+
),
|
32 |
+
'opengraph' => array(
|
33 |
+
'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
|
34 |
+
'description' => __( 'Activate this feature to add Social Meta data to your site to deliver closer integration between your website/blog and Facebook, Twitter, and Google+.', 'all-in-one-seo-pack' ),
|
35 |
+
),
|
36 |
+
'robots' => array(
|
37 |
+
'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
|
38 |
+
'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ),
|
39 |
+
),
|
40 |
+
'file_editor' => array(
|
41 |
+
'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
|
42 |
+
'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ),
|
43 |
+
),
|
44 |
+
'importer_exporter' => array(
|
45 |
+
'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
|
46 |
+
'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ),
|
47 |
+
),
|
48 |
+
'bad_robots' => array(
|
49 |
+
'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
|
50 |
+
'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ),
|
51 |
+
),
|
52 |
+
'performance' => array(
|
53 |
+
'name' => __( 'Performance', 'all-in-one-seo-pack' ),
|
54 |
+
'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
|
55 |
+
'default' => 'on',
|
56 |
+
),
|
57 |
+
);
|
58 |
|
59 |
+
if ( AIOSEOPPRO ) {
|
60 |
|
61 |
+
$this->module_info['coming_soon'] = array(
|
62 |
+
'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
|
63 |
+
'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
|
64 |
+
'save' => false,
|
65 |
+
);
|
66 |
+
$this->module_info['video_sitemap'] = array(
|
67 |
+
'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
|
68 |
+
'description' => __( 'Create and manage your Video Sitemap using this feature and submit your Video Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
|
69 |
+
);
|
70 |
|
71 |
+
} else {
|
|
|
|
|
|
|
|
|
72 |
|
73 |
+
$this->module_info['coming_soon'] = array(
|
74 |
+
'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
|
75 |
+
'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
|
76 |
+
'save' => false,
|
77 |
+
);
|
78 |
|
79 |
+
}
|
80 |
|
81 |
+
// Set up default settings fields.
|
82 |
+
// Name - Human-readable name of the setting.
|
83 |
+
// Help_text - Inline documentation for the setting.
|
84 |
+
// Type - Type of field; this defaults to checkbox; currently supported types are checkbox, text, select, multiselect.
|
85 |
+
// Default - Default value of the field.
|
86 |
+
// Initial_options - Initial option list used for selects and multiselects.
|
87 |
+
// Other supported options: class, id, style -- allows you to set these HTML attributes on the field.
|
88 |
|
89 |
+
$this->default_options = array();
|
90 |
+
$this->module_info = apply_filters( 'aioseop_module_info', $this->module_info );
|
91 |
+
$mod[] = 'coming_soon';
|
92 |
|
93 |
+
foreach ( $mod as $m ) {
|
94 |
+
if ( 'performance' === $m && ! is_super_admin() ) {
|
95 |
+
continue;
|
96 |
+
}
|
97 |
+
$this->default_options["enable_$m"] = array(
|
98 |
+
'name' => $this->module_info[ $m ]['name'],
|
99 |
+
'help_text' => $this->module_info[ $m ]['description'],
|
100 |
+
'type' => 'custom',
|
101 |
+
'class' => 'aioseop_feature',
|
102 |
+
'id' => "aioseop_$m",
|
103 |
+
'save' => true,
|
104 |
+
);
|
105 |
|
106 |
+
if ( ! empty( $this->module_info[ $m ]['image'] ) ) {
|
107 |
+
$this->default_options["enable_$m"]['image'] = $this->module_info[ $m ]['image'];
|
108 |
+
}
|
109 |
+
if ( ! empty( $this->module_info[ $m ] ) ) {
|
110 |
+
foreach ( array( 'save', 'default' ) as $option ) {
|
111 |
+
if ( isset( $this->module_info[ $m ][ $option ] ) ) {
|
112 |
+
$this->default_options["enable_$m"][ $option ] = $this->module_info[ $m ][ $option ];
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
+
$this->layout = array(
|
118 |
+
'default' => array(
|
119 |
+
'name' => $this->name,
|
120 |
+
'help_link' => 'http://semperplugins.com/documentation/feature-manager/',
|
121 |
+
'options' => array_keys( $this->default_options ),
|
122 |
+
),
|
123 |
);
|
124 |
+
// Load initial options / set defaults.
|
125 |
+
$this->update_options();
|
126 |
if ( is_admin() ) {
|
127 |
+
add_filter( $this->prefix . 'output_option', array( $this, 'display_option_div' ), 10, 2 );
|
128 |
+
add_filter( $this->prefix . 'submit_options', array( $this, 'filter_submit' ) );
|
129 |
}
|
130 |
}
|
131 |
|
132 |
+
/**
|
133 |
+
* Determines the menu order.
|
134 |
+
*
|
135 |
+
* @return int
|
136 |
+
*/
|
137 |
function menu_order() {
|
138 |
return 20;
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* @param $submit
|
143 |
+
*
|
144 |
+
* @return mixed
|
145 |
+
*/
|
146 |
function filter_submit( $submit ) {
|
147 |
+
$submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' »';
|
148 |
+
$submit['Submit']['class'] .= ' hidden';
|
149 |
$submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' »';
|
150 |
+
|
151 |
return $submit;
|
152 |
}
|
153 |
|
154 |
+
/**
|
155 |
+
* @param $buf
|
156 |
+
* @param $args
|
157 |
+
*
|
158 |
+
* @return string
|
159 |
+
*/
|
160 |
function display_option_div( $buf, $args ) {
|
161 |
$name = $img = $desc = $checkbox = $class = '';
|
162 |
+
if ( isset( $args['options']['help_text'] ) && ! empty( $args['options']['help_text'] ) ) {
|
163 |
$desc .= '<p class="aioseop_desc">' . $args['options']['help_text'] . '</p>';
|
164 |
+
}
|
165 |
+
if ( $args['value'] ) {
|
166 |
+
$class = ' active';
|
167 |
+
}
|
168 |
+
if ( isset( $args['options']['image'] ) && ! empty( $args['options']['image'] ) ) {
|
169 |
$img .= '<p><img src="' . AIOSEOP_PLUGIN_IMAGES_URL . $args['options']['image'] . '"></p>';
|
170 |
+
} else {
|
171 |
$img .= '<p><span class="aioseop_featured_image' . $class . '"></span></p>';
|
172 |
+
}
|
173 |
|
174 |
if ( $args['options']['save'] ) {
|
175 |
$name = "<h3>{$args['options']['name']}</h3>";
|
176 |
+
$checkbox .= '<input type="checkbox" onchange="jQuery(\'#' . $args['options']['id'] . ' .aioseop_featured_image, #' . $args['options']['id'] . ' .feature_button\').toggleClass(\'active\', this.checked);jQuery(\'input[name=Submit]\').trigger(\'click\');" style="display:none;" id="' . $args['name'] . '" name="' . $args['name'] . '"';
|
177 |
+
if ( $args['value'] ) {
|
178 |
+
$checkbox .= ' CHECKED';
|
179 |
+
}
|
180 |
$checkbox .= '><span class="button-primary feature_button' . $class . '"></span>';
|
181 |
} else {
|
182 |
$name = "<b>{$args['options']['name']}</b>";
|
183 |
}
|
184 |
+
if ( ! empty( $args['options']['id'] ) ) {
|
185 |
+
$args['attr'] .= " id='{$args['options']['id']}'";
|
186 |
+
}
|
187 |
+
|
188 |
+
return $buf . "<div {$args['attr']}><label for='{$args['name']}'><div id='free-flag'>FREE</div>{$name}{$img}{$desc}{$checkbox}</label></div>";
|
189 |
}
|
190 |
}
|
191 |
}
|
modules/aioseop_file_editor.php
CHANGED
@@ -1,93 +1,145 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
-
*
|
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 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
15 |
parent::__construct();
|
16 |
-
|
|
|
17 |
$this->current_tab = $_REQUEST['tab'];
|
18 |
-
|
19 |
-
$this->current_tab = 'robots';
|
20 |
|
21 |
-
$help_text
|
22 |
-
'robotfile'
|
23 |
-
'htaccfile'
|
24 |
);
|
25 |
$this->default_options = array(
|
26 |
-
|
27 |
-
|
28 |
-
'
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
);
|
31 |
|
32 |
-
if ( !empty( $help_text ) )
|
33 |
-
foreach( $help_text as $k => $v )
|
34 |
-
$this->default_options[$k]['help_text'] = $v;
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
)
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
),
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
'
|
50 |
-
)
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
54 |
}
|
55 |
-
|
56 |
function settings_page_init() {
|
57 |
-
add_filter($this->prefix . 'display_options',
|
58 |
-
add_filter($this->prefix . 'submit_options',
|
59 |
}
|
60 |
-
|
61 |
function add_page_hooks() {
|
62 |
parent::add_page_hooks();
|
63 |
-
add_action($this->prefix . 'settings_update',
|
64 |
}
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
function filter_submit( $submit, $location ) {
|
67 |
unset( $submit['Submit_Default'] );
|
68 |
$submit['Submit']['type'] = 'hidden';
|
69 |
-
if ( $this->current_tab
|
70 |
-
$submit['Submit_File_Editor']
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
return $submit;
|
74 |
}
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
function filter_options( $options, $location ) {
|
77 |
$prefix = $this->get_prefix( $location );
|
78 |
-
if ( $this->current_tab
|
79 |
-
$options = $this->load_files( $options,
|
80 |
-
elseif ( $this->current_tab
|
81 |
-
$options = $this->load_files( $options,
|
|
|
|
|
82 |
return $options;
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
85 |
function do_file_editor( $options, $location ) {
|
86 |
$prefix = $this->get_prefix( $location );
|
87 |
-
if ( $this->current_tab
|
88 |
-
$this->save_files(
|
89 |
-
elseif ( $this->current_tab
|
90 |
-
$this->save_files(
|
|
|
91 |
}
|
92 |
}
|
93 |
-
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
+
* The File Editor class.
|
5 |
+
*
|
6 |
+
* @package All-in-One-SEO-Pack
|
|
|
7 |
*/
|
8 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class All_in_One_SEO_Pack_File_Editor
|
12 |
+
*/
|
13 |
class All_in_One_SEO_Pack_File_Editor extends All_in_One_SEO_Pack_Module {
|
14 |
|
15 |
+
/**
|
16 |
+
* All_in_One_SEO_Pack_File_Editor constructor.
|
17 |
+
*/
|
18 |
+
function __construct() {
|
19 |
+
$this->name = __( 'File Editor', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
|
20 |
+
$this->prefix = 'aiosp_file_editor_'; // option prefix
|
21 |
+
$this->file = __FILE__; // the current file
|
22 |
parent::__construct();
|
23 |
+
$this->current_tab = 'robots';
|
24 |
+
if ( isset( $_REQUEST['tab'] ) ) {
|
25 |
$this->current_tab = $_REQUEST['tab'];
|
26 |
+
}
|
|
|
27 |
|
28 |
+
$help_text = array(
|
29 |
+
'robotfile' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ),
|
30 |
+
'htaccfile' => __( '.htaccess editor', 'all-in-one-seo-pack' ),
|
31 |
);
|
32 |
$this->default_options = array(
|
33 |
+
'robotfile' => array(
|
34 |
+
'name' => __( 'Edit Robots.txt', 'all-in-one-seo-pack' ),
|
35 |
+
'save' => false,
|
36 |
+
'default' => '',
|
37 |
+
'type' => 'textarea',
|
38 |
+
'cols' => 70,
|
39 |
+
'rows' => 25,
|
40 |
+
'label' => 'top',
|
41 |
+
),
|
42 |
+
'htaccfile' => array(
|
43 |
+
'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
|
44 |
+
'save' => false,
|
45 |
+
'default' => '',
|
46 |
+
'type' => 'textarea',
|
47 |
+
'cols' => 70,
|
48 |
+
'rows' => 25,
|
49 |
+
'label' => 'top',
|
50 |
+
),
|
51 |
);
|
52 |
|
53 |
+
if ( ! empty( $help_text ) ) {
|
54 |
+
foreach ( $help_text as $k => $v ) {
|
55 |
+
$this->default_options[ $k ]['help_text'] = $v;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
$this->tabs = array(
|
59 |
+
'robots' => array( 'name' => __( 'robots.txt' ) ),
|
60 |
+
'htaccess' => array( 'name' => __( '.htaccess' ) ),
|
61 |
+
);
|
62 |
+
|
63 |
+
$this->layout = array(
|
64 |
+
'robots' => array(
|
65 |
+
'name' => __( 'Edit robots.txt', 'all-in-one-seo-pack' ),
|
66 |
+
'options' => array( 'robotfile' ),
|
67 |
+
'tab' => 'robots',
|
68 |
+
),
|
69 |
+
'htaccess' => array(
|
70 |
+
'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
|
71 |
+
'options' => array( 'htaccfile' ),
|
72 |
+
'tab' => 'htaccess',
|
73 |
+
),
|
74 |
+
);
|
75 |
+
|
76 |
+
$this->update_options(); // load initial options / set defaults
|
77 |
}
|
78 |
+
|
79 |
function settings_page_init() {
|
80 |
+
add_filter( $this->prefix . 'display_options', array( $this, 'filter_options' ), 10, 2 );
|
81 |
+
add_filter( $this->prefix . 'submit_options', array( $this, 'filter_submit' ), 10, 2 );
|
82 |
}
|
83 |
+
|
84 |
function add_page_hooks() {
|
85 |
parent::add_page_hooks();
|
86 |
+
add_action( $this->prefix . 'settings_update', array( $this, 'do_file_editor' ), 10, 2 );
|
87 |
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param $submit
|
91 |
+
* @param $location
|
92 |
+
*
|
93 |
+
* @return mixed
|
94 |
+
*/
|
95 |
function filter_submit( $submit, $location ) {
|
96 |
unset( $submit['Submit_Default'] );
|
97 |
$submit['Submit']['type'] = 'hidden';
|
98 |
+
if ( 'robots' === $this->current_tab ) {
|
99 |
+
$submit['Submit_File_Editor'] = array(
|
100 |
+
'type' => 'submit',
|
101 |
+
'class' => 'button-primary',
|
102 |
+
'value' => __( 'Update robots.txt', 'all-in-one-seo-pack' ) . ' »',
|
103 |
+
);
|
104 |
+
} elseif ( 'htaccess' === $this->current_tab ) {
|
105 |
+
$submit['Submit_htaccess'] = array(
|
106 |
+
'type' => 'submit',
|
107 |
+
'class' => 'button-primary',
|
108 |
+
'value' => __( 'Update .htaccess', 'all-in-one-seo-pack' ) . ' »',
|
109 |
+
);
|
110 |
+
}
|
111 |
+
|
112 |
return $submit;
|
113 |
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @param $options
|
117 |
+
* @param $location
|
118 |
+
*
|
119 |
+
* @return mixed
|
120 |
+
*/
|
121 |
function filter_options( $options, $location ) {
|
122 |
$prefix = $this->get_prefix( $location );
|
123 |
+
if ( 'robots' === $this->current_tab ) {
|
124 |
+
$options = $this->load_files( $options, array( 'robotfile' => 'robots.txt' ), $prefix );
|
125 |
+
} elseif ( 'htaccess' === $this->current_tab ) {
|
126 |
+
$options = $this->load_files( $options, array( 'htaccfile' => '.htaccess' ), $prefix );
|
127 |
+
}
|
128 |
+
|
129 |
return $options;
|
130 |
}
|
131 |
|
132 |
+
/**
|
133 |
+
* @param $options This seems to be unused.
|
134 |
+
* @param $location
|
135 |
+
*/
|
136 |
function do_file_editor( $options, $location ) {
|
137 |
$prefix = $this->get_prefix( $location );
|
138 |
+
if ( 'robots' === $this->current_tab && isset( $_POST['Submit_File_Editor'] ) && $_POST['Submit_File_Editor'] ) {
|
139 |
+
$this->save_files( array( 'robotfile' => 'robots.txt' ), $prefix );
|
140 |
+
} elseif ( 'htaccess' === $this->current_tab && isset( $_POST['Submit_htaccess'] ) && $_POST['Submit_htaccess'] ) {
|
141 |
+
$this->save_files( array( 'htaccfile' => '.htaccess' ), $prefix );
|
142 |
+
}
|
143 |
}
|
144 |
}
|
145 |
+
}
|
modules/aioseop_importer_exporter.php
CHANGED
@@ -1,320 +1,572 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
class All_in_One_SEO_Pack_Importer_Exporter extends All_in_One_SEO_Pack_Module {
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
parent::__construct();
|
16 |
-
$help_text
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
);
|
21 |
-
$this->warnings
|
22 |
$this->default_options = array(
|
23 |
-
|
24 |
-
'
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
);
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
$this->layout = Array(
|
40 |
'default' => Array(
|
41 |
-
|
42 |
-
|
43 |
-
|
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(
|
|
|
|
|
|
|
54 |
}
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
function filter_submit( $submit ) {
|
57 |
-
$submit['Submit']['value'] = __(
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
$
|
66 |
-
$
|
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 |
-
|
|
|
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'] .=
|
|
|
78 |
}
|
79 |
-
|
80 |
-
} else
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
-
$this->default_options['import_export_help']['default'] .= '<br />'
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
86 |
$this->do_importer_exporter();
|
87 |
-
else
|
88 |
-
add_action(
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
-
|
91 |
-
function importer_exporter_export( $args ){
|
92 |
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
$name = $this->get_option_name();
|
95 |
-
|
96 |
-
|
97 |
-
if( !empty( $this->options ) ) {
|
98 |
foreach ( $this->options as $key => $value ) {
|
99 |
-
$buf .= "$key = '" . str_replace(
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
}
|
|
|
102 |
return $buf;
|
103 |
}
|
104 |
-
|
105 |
-
|
|
|
|
|
106 |
echo '<div class="error fade" style="width:52%">';
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
}
|
111 |
}
|
|
|
112 |
echo '</div>';
|
113 |
}
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
function parse_ini_helper( $array ) {
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
144 |
}
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
function recursive_parse( $array ) {
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
|
|
|
|
|
|
177 |
}
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
function parse_ini_advanced( $string ) {
|
210 |
-
return $this->recursive_parse(
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
-
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
215 |
global $aioseop_options, $aiosp, $aioseop_module_list;
|
216 |
-
if ( isset( $_REQUEST['nonce-aioseop'] ) )
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
switch ( $submit ) {
|
222 |
case 'Import':
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
228 |
$matches = Array();
|
229 |
-
if ( empty( $line ) )
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
|
|
232 |
$section_label = strval( $label[1] );
|
233 |
-
if ( $section_label == 'post_data')
|
234 |
-
|
|
|
|
|
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[
|
239 |
-
else
|
240 |
-
$section[ $section_label ][ $matches[
|
|
|
241 |
} elseif ( preg_match( "/^(\S+)\s*=\s*NULL$/", $line, $matches ) ) {
|
242 |
-
if( $section_label == 'post_data' )
|
243 |
-
$section[ $section_label ][$count][ $matches[
|
244 |
-
else
|
245 |
-
$section[ $section_label ][ $matches[
|
|
|
246 |
} else {
|
247 |
-
$this->warnings[] = sprintf(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
}
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
} else {
|
269 |
-
$
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
$post_warning = null;
|
275 |
}
|
276 |
-
|
277 |
-
|
278 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
$buf = $aiosp->settings_export( $buf );
|
302 |
$buf = apply_filters( 'aioseop_export_settings', $buf );
|
303 |
-
|
304 |
-
|
305 |
-
$strlength = strlen($buf);
|
306 |
-
header(
|
307 |
-
header(
|
308 |
-
|
309 |
-
|
|
|
|
|
310 |
echo $buf;
|
311 |
die();
|
312 |
-
|
313 |
}
|
314 |
-
}
|
|
|
|
|
|
|
|
|
315 |
}
|
316 |
-
|
317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
}
|
319 |
}
|
320 |
}
|
1 |
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
4 |
+
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class All_in_One_SEO_Pack_Importer_Exporter
|
8 |
+
*/
|
9 |
class All_in_One_SEO_Pack_Importer_Exporter extends All_in_One_SEO_Pack_Module {
|
10 |
|
11 |
+
|
12 |
+
/**
|
13 |
+
* All_in_One_SEO_Pack_Importer_Exporter constructor.
|
14 |
+
*/
|
15 |
+
function __construct() {
|
16 |
+
$this->name = __( 'Importer & Exporter', 'all-in-one-seo-pack' ); // Human-readable name of the module
|
17 |
+
$this->prefix = 'aiosp_importer_exporter_'; // option prefix
|
18 |
+
$this->file = __FILE__;
|
19 |
parent::__construct();
|
20 |
+
$help_text = Array(
|
21 |
+
'import_submit' => __(
|
22 |
+
"Select a valid All in One SEO Pack ini file and click 'Import' to import options from a previous state or install of All in One SEO Pack.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
|
23 |
+
'all-in-one-seo-pack'
|
24 |
+
),
|
25 |
+
'export_choices' => __(
|
26 |
+
"You may choose to export settings from active modules, and content from post data.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
|
27 |
+
'all-in-one-seo-pack'
|
28 |
+
),
|
29 |
+
'export_post_types' => __(
|
30 |
+
"Select which Post Types you want to export your All in One SEO Pack meta data for.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
|
31 |
+
'all-in-one-seo-pack'
|
32 |
+
)
|
33 |
);
|
34 |
+
$this->warnings = Array();
|
35 |
$this->default_options = array(
|
36 |
+
'import_submit' => Array(
|
37 |
+
'name' => __( 'Import', 'all-in-one-seo-pack' ),
|
38 |
+
'default' => '',
|
39 |
+
'type' => 'file',
|
40 |
+
'save' => false
|
41 |
+
),
|
42 |
+
'export_choices' => Array(
|
43 |
+
'name' => __( 'Export Settings', 'all-in-one-seo-pack' ),
|
44 |
+
'type' => 'multicheckbox',
|
45 |
+
'initial_options' => Array(
|
46 |
+
1 => 'General Settings',
|
47 |
+
2 => 'Post Data'
|
48 |
+
)
|
49 |
+
),
|
50 |
+
'export_post_types' => Array(
|
51 |
+
'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ),
|
52 |
+
'default' => Array(
|
53 |
+
'post' => 'post',
|
54 |
+
'page' => 'page'
|
55 |
+
),
|
56 |
+
'type' => 'multicheckbox',
|
57 |
+
'initial_options' => $this->get_post_type_titles(
|
58 |
+
Array( '_builtin' => false )
|
59 |
+
)
|
60 |
+
),
|
61 |
+
'import_export_help' => Array(
|
62 |
+
'type' => 'html',
|
63 |
+
'label' => 'none',
|
64 |
+
'default' => __(
|
65 |
+
'Note: If General Settings is checked, the
|
66 |
+
General Settings, the Feature Manager settings,
|
67 |
+
and the following currently active modules will
|
68 |
+
have their settings data exported:',
|
69 |
+
'all-in-one-seo-pack'
|
70 |
+
) . '<br />'
|
71 |
+
)
|
72 |
);
|
73 |
+
if ( ! empty( $help_text ) ) {
|
74 |
+
foreach ( $help_text as $k => $v ) {
|
75 |
+
$this->default_options[ $k ]['help_text'] = $v;
|
76 |
+
}
|
77 |
+
}
|
78 |
$this->layout = Array(
|
79 |
'default' => Array(
|
80 |
+
'name' => $this->name,
|
81 |
+
'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/',
|
82 |
+
'options' => array_keys( $this->default_options )
|
83 |
+
)
|
84 |
);
|
|
|
|
|
85 |
|
86 |
+
// load initial options / set defaults
|
87 |
add_action( 'admin_init', Array( $this, 'debug_post_types' ), 5 );
|
88 |
}
|
89 |
+
|
90 |
+
|
91 |
function settings_page_init() {
|
92 |
+
add_filter(
|
93 |
+
$this->prefix . 'submit_options',
|
94 |
+
Array( $this, 'filter_submit' )
|
95 |
+
);
|
96 |
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @param $submit
|
101 |
+
*
|
102 |
+
* @return array
|
103 |
+
*/
|
104 |
function filter_submit( $submit ) {
|
105 |
+
$submit['Submit']['value'] = __(
|
106 |
+
'Import',
|
107 |
+
'all-in-one-seo-pack'
|
108 |
+
)
|
109 |
+
. ' »';
|
110 |
+
|
111 |
+
return Array(
|
112 |
+
'export_submit' => Array(
|
113 |
+
'type' => 'submit',
|
114 |
+
'class' => 'button-primary',
|
115 |
+
'value' => __( 'Export', 'all-in-one-seo-pack' ) . ' »'
|
116 |
+
)
|
117 |
+
) + $submit;
|
118 |
}
|
119 |
+
|
120 |
+
|
121 |
+
function debug_post_types() {
|
122 |
+
$post_types = $this->get_post_type_titles();
|
123 |
+
$rempost = array(
|
124 |
+
'attachment' => 1,
|
125 |
+
'revision' => 1,
|
126 |
+
'nav_menu_item' => 1
|
127 |
+
);
|
128 |
+
$this->default_options['export_post_types']['initial_options'] = array_diff_key(
|
129 |
+
$post_types,
|
130 |
+
$rempost
|
131 |
+
);
|
132 |
global $aioseop_modules;
|
133 |
+
if ( ! empty( $aioseop_modules ) ) {
|
134 |
$modules = $aioseop_modules->get_loaded_module_list();
|
135 |
+
if ( ! empty( $modules ) && ! empty( $modules['feature_manager'] ) ) {
|
136 |
unset( $modules['feature_manager'] );
|
137 |
+
}
|
138 |
+
if ( ! empty( $modules ) ) {
|
139 |
$this->default_options['import_export_help']['default'] .= "<ul>\n";
|
140 |
+
foreach ( $modules as $m ) {
|
141 |
$module = $aioseop_modules->return_module( $m );
|
142 |
+
$this->default_options['import_export_help']['default'] .=
|
143 |
+
"\t<li>" . $module->name . "</li>\n";
|
144 |
}
|
145 |
+
$this->default_options['import_export_help']['default'] .= "\n</ul>\n";
|
146 |
+
} else {
|
147 |
+
$this->default_options['import_export_help']['default'] .= '<br />'
|
148 |
+
. __(
|
149 |
+
'There are no other modules currently loaded!',
|
150 |
+
'all-in-one-seo-pack'
|
151 |
+
);
|
152 |
+
}
|
153 |
}
|
154 |
+
$this->default_options['import_export_help']['default'] .= '<br />'
|
155 |
+
. __(
|
156 |
+
'You may change this by activating or deactivating
|
157 |
+
modules in the Feature Manager.',
|
158 |
+
'all-in-one-seo-pack'
|
159 |
+
);
|
160 |
+
$this->update_options();
|
161 |
+
if ( ! empty( $_REQUEST['export_submit'] ) ) {
|
162 |
$this->do_importer_exporter();
|
163 |
+
} else {
|
164 |
+
add_action(
|
165 |
+
$this->prefix . 'settings_update',
|
166 |
+
Array( $this, 'do_importer_exporter' )
|
167 |
+
);
|
168 |
+
}
|
169 |
}
|
|
|
|
|
170 |
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @param $args
|
174 |
+
*
|
175 |
+
* @return string
|
176 |
+
*/
|
177 |
+
function importer_exporter_export( $args ) {
|
178 |
+
|
179 |
+
// Adds all settings to settings file
|
180 |
$name = $this->get_option_name();
|
181 |
+
$buf = '[' . $this->get_option_name() . "]\n";
|
182 |
+
if ( ! empty( $this->options ) ) {
|
|
|
183 |
foreach ( $this->options as $key => $value ) {
|
184 |
+
$buf .= "$key = '" . str_replace(
|
185 |
+
"'",
|
186 |
+
"\'",
|
187 |
+
trim( serialize( $value ) )
|
188 |
+
) . "'\n";
|
189 |
}
|
190 |
}
|
191 |
+
|
192 |
return $buf;
|
193 |
}
|
194 |
+
|
195 |
+
|
196 |
+
function show_import_warnings() {
|
197 |
+
|
198 |
echo '<div class="error fade" style="width:52%">';
|
199 |
+
|
200 |
+
if ( is_array( $this->warnings ) ) {
|
201 |
+
foreach ( $this->warnings as $warning ) {
|
202 |
+
echo "<p>{$warning}</p>";
|
203 |
}
|
204 |
+
}
|
205 |
echo '</div>';
|
206 |
}
|
207 |
+
|
208 |
+
|
209 |
+
/**
|
210 |
+
* @param $array
|
211 |
+
*
|
212 |
+
* @return array
|
213 |
+
*/
|
214 |
function parse_ini_helper( $array ) {
|
215 |
+
$returnArray = array();
|
216 |
+
if ( is_array( $array ) ) {
|
217 |
+
foreach ( $array as $key => $value ) {
|
218 |
+
$e = explode( ':', $key );
|
219 |
+
if ( ! empty( $e[1] ) ) {
|
220 |
+
$x = array();
|
221 |
+
foreach ( $e as $tk => $tv ) {
|
222 |
+
$x[ $tk ] = trim( $tv );
|
223 |
+
}
|
224 |
+
$x = array_reverse( $x, true );
|
225 |
+
foreach ( $x as $k => $v ) {
|
226 |
+
$c = $x[0];
|
227 |
+
if ( empty( $returnArray[ $c ] ) ) {
|
228 |
+
$returnArray[ $c ] = array();
|
229 |
+
}
|
230 |
+
if ( isset( $returnArray[ $x[1] ] ) ) {
|
231 |
+
$returnArray[ $c ] = array_merge(
|
232 |
+
$returnArray[ $c ], $returnArray[ $x[1] ]
|
233 |
+
);
|
234 |
+
}
|
235 |
+
if ( $k === 0 ) {
|
236 |
+
$returnArray[ $c ] = array_merge(
|
237 |
+
$returnArray[ $c ], $array[ $key ]
|
238 |
+
);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
} else {
|
242 |
+
$returnArray[ $key ] = $array[ $key ];
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
return $returnArray;
|
248 |
}
|
249 |
+
|
250 |
+
|
251 |
+
/**
|
252 |
+
* @param $array
|
253 |
+
*
|
254 |
+
* @return array
|
255 |
+
*/
|
256 |
function recursive_parse( $array ) {
|
257 |
+
$returnArray = array();
|
258 |
+
if ( is_array( $array ) ) {
|
259 |
+
foreach ( $array as $key => $value ) {
|
260 |
+
if ( is_array( $value ) ) {
|
261 |
+
$array[ $key ] = $this->recursive_parse( $value );
|
262 |
+
}
|
263 |
+
$x = explode( '.', $key );
|
264 |
+
if ( ! empty( $x[1] ) ) {
|
265 |
+
$x = array_reverse( $x, true );
|
266 |
+
if ( isset( $returnArray[ $key ] ) ) {
|
267 |
+
unset( $returnArray[ $key ] );
|
268 |
+
}
|
269 |
+
if ( ! isset( $returnArray[ $x[0] ] ) ) {
|
270 |
+
$returnArray[ $x[0] ] = array();
|
271 |
+
}
|
272 |
+
$first = true;
|
273 |
+
foreach ( $x as $k => $v ) {
|
274 |
+
if ( $first === true ) {
|
275 |
+
$b = $array[ $key ];
|
276 |
+
$first = false;
|
277 |
+
}
|
278 |
+
$b = array( $v => $b );
|
279 |
+
}
|
280 |
+
$returnArray[ $x[0] ] = array_merge_recursive(
|
281 |
+
$returnArray[ $x[0] ], $b[ $x[0] ]
|
282 |
+
);
|
283 |
+
} else {
|
284 |
+
$returnArray[ $key ] = $array[ $key ];
|
285 |
+
}
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
return $returnArray;
|
290 |
}
|
291 |
+
|
292 |
+
|
293 |
+
/**
|
294 |
+
* @param $assoc_arr
|
295 |
+
* @param bool $has_sections
|
296 |
+
*
|
297 |
+
* @return string
|
298 |
+
*/
|
299 |
+
function get_ini_file( $assoc_arr, $has_sections = true ) {
|
300 |
+
$content = '';
|
301 |
+
if ( $has_sections ) {
|
302 |
+
foreach ( $assoc_arr as $key => $elem ) {
|
303 |
+
$content .= '[' . $key . "]\n";
|
304 |
+
foreach ( $elem as $key2 => $elem2 ) {
|
305 |
+
if ( is_array( $elem2 ) ) {
|
306 |
+
for ( $i = 0; $i < count( $elem2 ); $i ++ ) {
|
307 |
+
$content .= $key2 . "[] = \"" . $elem2[ $i ] . "\"\n";
|
308 |
+
}
|
309 |
+
} else if ( $elem2 == '' ) {
|
310 |
+
$content .= $key2 . " = \n";
|
311 |
+
} else {
|
312 |
+
$content .= $key2 . " = \"" . $elem2 . "\"\n";
|
313 |
+
}
|
314 |
+
}
|
315 |
+
}
|
316 |
+
} else {
|
317 |
+
foreach ( $assoc_arr as $key => $elem ) {
|
318 |
+
if ( is_array( $elem ) ) {
|
319 |
+
for ( $i = 0; $i < count( $elem ); $i ++ ) {
|
320 |
+
$content .= $key2 . "[] = \"" . $elem[ $i ] . "\"\n";
|
321 |
+
}
|
322 |
+
} else if ( $elem == '' ) {
|
323 |
+
$content .= $key2 . " = \n";
|
324 |
+
} else {
|
325 |
+
$content .= $key2 . " = \"" . $elem . "\"\n";
|
326 |
+
}
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
return $content;
|
331 |
}
|
332 |
+
|
333 |
+
|
334 |
+
/**
|
335 |
+
* @param $string
|
336 |
+
*
|
337 |
+
* @return array
|
338 |
+
*/
|
339 |
function parse_ini_advanced( $string ) {
|
340 |
+
return $this->recursive_parse(
|
341 |
+
$this->parse_ini_helper(
|
342 |
+
parse_ini_string( $string, true )
|
343 |
+
)
|
344 |
+
);
|
345 |
}
|
346 |
+
|
347 |
+
|
348 |
+
function do_importer_exporter() {
|
349 |
+
$submit = null;
|
350 |
+
$count = 0;
|
351 |
+
$post_exists = null;
|
352 |
+
$post_warning = null;
|
353 |
global $aioseop_options, $aiosp, $aioseop_module_list;
|
354 |
+
if ( isset( $_REQUEST['nonce-aioseop'] ) ) {
|
355 |
+
$nonce = $_REQUEST['nonce-aioseop'];
|
356 |
+
}
|
357 |
+
$post_fields = Array(
|
358 |
+
'keywords',
|
359 |
+
'description',
|
360 |
+
'title',
|
361 |
+
'meta',
|
362 |
+
'disable',
|
363 |
+
'disable',
|
364 |
+
'disable_analytics',
|
365 |
+
'titleatr',
|
366 |
+
'menulabel',
|
367 |
+
'togglekeywords'
|
368 |
+
);
|
369 |
+
if ( ! empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) {
|
370 |
+
$submit = 'Import';
|
371 |
+
}
|
372 |
+
if ( ! empty( $_REQUEST['export_submit'] ) ) {
|
373 |
+
$submit = 'Export';
|
374 |
+
}
|
375 |
+
if ( ( $submit != null ) && wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) {
|
376 |
switch ( $submit ) {
|
377 |
case 'Import':
|
378 |
+
try {
|
379 |
+
// Parses export file
|
380 |
+
$file = $this->get_sanitized_file(
|
381 |
+
$_FILES['aiosp_importer_exporter_import_submit']['tmp_name']
|
382 |
+
);
|
383 |
+
$section = Array();
|
384 |
+
$section_label = null;
|
385 |
+
foreach ( $file as $line_number => $line ) {
|
386 |
+
$line = trim( $line );
|
387 |
$matches = Array();
|
388 |
+
if ( empty( $line ) ) {
|
389 |
+
continue;
|
390 |
+
}
|
391 |
+
if ( $line[0] == ';' ) {
|
392 |
+
continue;
|
393 |
+
}
|
394 |
+
if ( preg_match( "/^\[(\S+)\]$/", $line, $label ) ) {
|
395 |
$section_label = strval( $label[1] );
|
396 |
+
if ( $section_label == 'post_data' ) {
|
397 |
+
$count ++;
|
398 |
+
}
|
399 |
+
if ( ! isset( $section[ $section_label ] ) ) {
|
400 |
$section[ $section_label ] = Array();
|
401 |
+
}
|
402 |
} elseif ( preg_match( "/^(\S+)\s*=\s*'(.*)'$/", $line, $matches ) ) {
|
403 |
+
if ( $section_label == 'post_data' ) {
|
404 |
+
$section[ $section_label ][ $count ][ $matches[1] ] = $matches[2];
|
405 |
+
} else {
|
406 |
+
$section[ $section_label ][ $matches[1] ] = $matches[2];
|
407 |
+
}
|
408 |
} elseif ( preg_match( "/^(\S+)\s*=\s*NULL$/", $line, $matches ) ) {
|
409 |
+
if ( $section_label == 'post_data' ) {
|
410 |
+
$section[ $section_label ][ $count ][ $matches[1] ] = null;
|
411 |
+
} else {
|
412 |
+
$section[ $section_label ][ $matches[1] ] = null;
|
413 |
+
}
|
414 |
} else {
|
415 |
+
$this->warnings[] = sprintf(
|
416 |
+
__(
|
417 |
+
'<b>Warning:</b> Line not matched: <b>"%s"</b>, On Line: <b>%s</b>',
|
418 |
+
'all-in-one-seo-pack'
|
419 |
+
),
|
420 |
+
$line,
|
421 |
+
$line_number
|
422 |
+
);
|
423 |
}
|
424 |
+
}
|
425 |
+
|
426 |
+
// Updates Plugin Settings
|
427 |
+
if ( is_array( $section ) ) {
|
428 |
+
foreach ( $section as $label => $module_options ) {
|
429 |
+
if ( is_array( $module_options ) ) {
|
430 |
+
foreach ( $module_options as $key => $value ) {
|
431 |
+
|
432 |
+
// Updates Post Data
|
433 |
+
if ( $label == 'post_data' ) {
|
434 |
+
$post_exists = post_exists(
|
435 |
+
$module_options[ $key ]['post_title'],
|
436 |
+
'',
|
437 |
+
$module_options[ $key ]['post_date']
|
438 |
+
);
|
439 |
+
$target = get_post( $post_exists );
|
440 |
+
if ( ( ! empty( $module_options[ $key ]['post_type'] ) )
|
441 |
+
&& $post_exists != null
|
442 |
+
) {
|
443 |
+
if ( is_array( $value ) ) {
|
444 |
+
foreach ( $value as $field_name => $field_value ) {
|
445 |
+
if ( substr( $field_name, 1, 7 ) == 'aioseop' ) {
|
446 |
+
if ( $value ) {
|
447 |
+
update_post_meta(
|
448 |
+
$target->ID,
|
449 |
+
$field_name,
|
450 |
+
maybe_unserialize( $field_value )
|
451 |
+
);
|
452 |
+
} else {
|
453 |
+
delete_post_meta(
|
454 |
+
$target->ID,
|
455 |
+
$field_name
|
456 |
+
);
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
}
|
461 |
+
$post_exists = null;
|
462 |
+
} else {
|
463 |
+
$target_title = $module_options[ $key ]['post_title'];
|
464 |
+
$post_warning = sprintf(
|
465 |
+
__(
|
466 |
+
'<b>Warning:</b> This following post could not be found: <b>"%s"</b>',
|
467 |
+
'all-in-one-seo-pack'
|
468 |
+
),
|
469 |
+
$target_title
|
470 |
+
);
|
471 |
+
}
|
472 |
+
if ( $post_warning != null ) {
|
473 |
+
$this->warnings[] = $post_warning;
|
474 |
+
$post_warning = null;
|
475 |
+
}
|
476 |
+
|
477 |
+
// Updates Module Settings
|
478 |
} else {
|
479 |
+
$module_options[ $key ] = str_replace(
|
480 |
+
Array( "\'", '\n', '\r' ),
|
481 |
+
Array( "'", "\n", "\r" ),
|
482 |
+
maybe_unserialize( $value )
|
483 |
+
);
|
|
|
484 |
}
|
485 |
+
}
|
486 |
+
|
487 |
+
// Updates Module Settings
|
488 |
+
$this->update_class_option(
|
489 |
+
$module_options,
|
490 |
+
$label
|
491 |
+
);
|
492 |
}
|
|
|
|
|
493 |
}
|
494 |
}
|
495 |
+
} catch ( Exception $e ) {
|
496 |
+
$this->warnings[] = $e->getMessage();
|
|
|
|
|
|
|
|
|
|
|
497 |
}
|
498 |
+
|
499 |
+
// Shows all errors found
|
500 |
+
if ( ! empty( $this->warnings ) ) {
|
501 |
+
add_action(
|
502 |
+
$this->prefix . 'settings_header',
|
503 |
+
Array( $this, 'show_import_warnings' ),
|
504 |
+
5
|
505 |
+
);
|
506 |
+
}
|
507 |
+
|
508 |
+
break;
|
509 |
+
case 'Export':
|
510 |
+
|
511 |
+
// Creates Files Contents
|
512 |
+
$settings_file = 'settings_aioseop.ini';
|
513 |
+
$buf = '; ' . __(
|
514 |
+
'Settings export file for All in One SEO Pack', '
|
515 |
+
all-in-one-seo-pack'
|
516 |
+
) . "\n";
|
517 |
+
|
518 |
+
// Adds all settings to settings file
|
519 |
$buf = $aiosp->settings_export( $buf );
|
520 |
$buf = apply_filters( 'aioseop_export_settings', $buf );
|
521 |
+
|
522 |
+
// Sends File to browser
|
523 |
+
$strlength = strlen( $buf );
|
524 |
+
header( 'Content-type: application/ini' );
|
525 |
+
header(
|
526 |
+
"Content-Disposition:
|
527 |
+
attachment; filename=$settings_file"
|
528 |
+
);
|
529 |
+
header( 'Content-Length: ' . $strlength );
|
530 |
echo $buf;
|
531 |
die();
|
532 |
+
break;
|
533 |
}
|
534 |
+
}
|
535 |
+
}
|
536 |
+
|
537 |
+
|
538 |
+
function settings_update() {
|
539 |
}
|
540 |
+
|
541 |
+
/**
|
542 |
+
* Returns sanitized imported file.
|
543 |
+
*
|
544 |
+
* @since
|
545 |
+
*
|
546 |
+
* @param string $filename Path to where the uploaded file is located.
|
547 |
+
*
|
548 |
+
* @return array Sanitized file as array.
|
549 |
+
* @throws Exception
|
550 |
+
*/
|
551 |
+
private function get_sanitized_file( $filename ) {
|
552 |
+
$file = file( $filename );
|
553 |
+
for ( $i = count( $file ) - 1; $i >= 0; -- $i ) {
|
554 |
+
// Remove insecured lines
|
555 |
+
if ( preg_match( '/\<(\?php|script)/', $file[ $i ] ) ) {
|
556 |
+
throw new Exception( __(
|
557 |
+
'<b>Security warning:</b> Your file looks compromised. Please check the file for any script-injection.',
|
558 |
+
'all-in-one-seo-pack'
|
559 |
+
) );
|
560 |
+
}
|
561 |
+
// Apply security filters
|
562 |
+
$file[ $i ] = strip_tags( trim( $file[ $i ] ) );
|
563 |
+
// Remove empty lines
|
564 |
+
if ( empty( $file[ $i ] ) ) {
|
565 |
+
unset( $file[ $i ] );
|
566 |
+
}
|
567 |
+
}
|
568 |
+
|
569 |
+
return $file;
|
570 |
}
|
571 |
}
|
572 |
}
|
modules/aioseop_opengraph.php
CHANGED
@@ -5,220 +5,393 @@
|
|
5 |
/**
|
6 |
* The Opengraph class.
|
7 |
*/
|
8 |
-
if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
9 |
class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
|
10 |
var $fb_object_types;
|
11 |
var $type;
|
12 |
|
13 |
-
function __construct(
|
14 |
-
$this->name
|
15 |
-
$this->prefix
|
16 |
-
$this->file
|
17 |
$this->fb_object_types = Array(
|
18 |
-
'Activities'
|
19 |
'activity' => __( 'Activity', 'all-in-one-seo-pack' ),
|
20 |
-
'sport'
|
21 |
),
|
22 |
-
'Businesses'
|
23 |
-
'bar'
|
24 |
-
'company'
|
25 |
-
'cafe'
|
26 |
-
'hotel'
|
27 |
'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' )
|
28 |
),
|
29 |
-
'Groups'
|
30 |
-
'cause'
|
31 |
'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ),
|
32 |
-
'sports_team'
|
33 |
),
|
34 |
-
'Organizations'
|
35 |
-
'band'
|
36 |
'government' => __( 'Government', 'all-in-one-seo-pack' ),
|
37 |
'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ),
|
38 |
-
'school'
|
39 |
'university' => __( 'University', 'all-in-one-seo-pack' )
|
40 |
),
|
41 |
-
'People'
|
42 |
-
'actor'
|
43 |
-
'athlete'
|
44 |
-
'author'
|
45 |
-
'director'
|
46 |
-
'musician'
|
47 |
-
'politician'
|
48 |
-
'profile'
|
49 |
'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' )
|
50 |
),
|
51 |
-
'Places'
|
52 |
-
'city'
|
53 |
-
'country'
|
54 |
-
'landmark'
|
55 |
'state_province' => __( 'State Province', 'all-in-one-seo-pack' )
|
56 |
),
|
57 |
'Products and Entertainment' => Array(
|
58 |
-
'album'
|
59 |
-
'book'
|
60 |
-
'drink'
|
61 |
-
'food'
|
62 |
-
'game'
|
63 |
-
'movie'
|
64 |
'product' => __( 'Product', 'all-in-one-seo-pack' ),
|
65 |
-
'song'
|
66 |
'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ),
|
67 |
'episode' => __( 'Episode', 'all-in-one-seo-pack' )
|
68 |
-
),
|
|
|
69 |
'article' => __( 'Article', 'all-in-one-seo-pack' ),
|
70 |
-
'blog'
|
71 |
'website' => __( 'Website', 'all-in-one-seo-pack' )
|
72 |
)
|
73 |
);
|
74 |
parent::__construct();
|
75 |
|
76 |
-
$categories = Array(
|
|
|
|
|
|
|
|
|
77 |
|
78 |
$this->help_text = Array(
|
79 |
-
"setmeta"
|
80 |
-
"key"
|
81 |
-
"appid"
|
82 |
-
"title_shortcodes"
|
83 |
-
"description_shortcodes"=> __( "Run shortcodes that appear in social description meta tags.", 'all-in-one-seo-pack' ),
|
84 |
-
"sitename"
|
85 |
-
"hometitle"
|
86 |
-
"description"
|
87 |
-
"homeimage"
|
88 |
-
"hometag"
|
89 |
-
"generate_descriptions"
|
90 |
-
"defimg"
|
91 |
-
"fallback"
|
92 |
-
"dimg"
|
93 |
-
"dimgwidth"
|
94 |
-
"dimgheight"
|
95 |
-
"meta_key"
|
96 |
-
"categories"
|
97 |
-
"image"
|
98 |
-
"customimg"
|
99 |
-
"imagewidth"
|
100 |
-
"imageheight"
|
101 |
-
"video"
|
102 |
-
"videowidth"
|
103 |
-
"videoheight"
|
104 |
-
"defcard"
|
105 |
-
"setcard"
|
106 |
-
"twitter_site"
|
107 |
-
"twitter_creator"
|
108 |
-
"twitter_domain"
|
109 |
-
"gen_tags"
|
110 |
-
"gen_keywords"
|
111 |
-
"gen_categories"
|
112 |
-
"gen_post_tags"
|
113 |
-
"types"
|
114 |
-
"title"
|
115 |
-
"desc"
|
116 |
-
"category"
|
117 |
-
"facebook_debug"
|
118 |
-
"section"
|
119 |
-
"tag"
|
120 |
-
"facebook_publisher"
|
121 |
-
"facebook_author"
|
122 |
-
"person_or_org"
|
123 |
-
"profile_links"
|
124 |
-
"social_name"
|
125 |
);
|
126 |
|
127 |
$this->help_anchors = Array(
|
128 |
'generate_descriptions' => '#auto-generate-og-descriptions',
|
129 |
-
'setmeta'
|
130 |
-
'sitename'
|
131 |
-
'hometitle'
|
132 |
-
'description'
|
133 |
-
'homeimage'
|
134 |
-
'defimg'
|
135 |
-
'fallback'
|
136 |
-
'dimg'
|
137 |
-
'meta_key'
|
138 |
-
'key'
|
139 |
-
'appid'
|
140 |
-
'categories'
|
141 |
-
'facebook_publisher'
|
142 |
-
'facebook_author'
|
143 |
-
'types'
|
144 |
-
'defcard'
|
145 |
-
'setcard'
|
146 |
-
'twitter_site'
|
147 |
-
'twitter_creator'
|
148 |
-
'twitter_domain'
|
149 |
-
'scan_header'
|
150 |
);
|
151 |
|
152 |
-
$count_desc
|
153 |
$this->default_options = array(
|
154 |
-
|
155 |
-
'
|
156 |
-
'
|
157 |
-
'
|
158 |
-
|
159 |
-
|
160 |
-
'
|
161 |
-
'
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
'
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
'
|
170 |
-
'
|
171 |
-
'
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
'
|
178 |
-
'
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
'
|
183 |
-
|
184 |
-
'
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
'
|
195 |
-
|
196 |
-
'
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
'
|
206 |
-
'
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
'
|
211 |
-
|
212 |
-
'
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
'
|
220 |
-
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
'
|
238 |
-
|
239 |
-
'
|
240 |
-
'
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
);
|
246 |
|
247 |
// load initial options / set defaults
|
248 |
-
$this->update_options(
|
249 |
|
250 |
$display = Array();
|
251 |
-
if ( isset( $this->options['aiosp_opengraph_types'] ) )
|
|
|
|
|
252 |
|
253 |
$this->locations = array(
|
254 |
-
'opengraph'
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
);
|
264 |
|
265 |
$this->layout = Array(
|
266 |
-
'default'
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
'home'
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
'image'
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
'links'
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
'facebook'
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
'
|
293 |
-
'
|
294 |
-
'
|
295 |
-
|
296 |
-
|
297 |
-
'
|
298 |
-
'
|
299 |
-
'
|
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' ) ){
|
|
|
|
|
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 |
-
|
349 |
-
|
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' )
|
366 |
-
|
|
|
|
|
367 |
list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current );
|
368 |
-
$opts
|
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 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
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 |
-
|
382 |
-
|
|
|
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']
|
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']
|
397 |
-
$settings[ $prefix . $opt ]['label']
|
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 )
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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']
|
432 |
-
$args['value']
|
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 ) )
|
443 |
-
|
|
|
|
|
444 |
$schema_types = Array(
|
445 |
-
'album'
|
446 |
-
'article'
|
447 |
-
'bar'
|
448 |
-
'blog'
|
449 |
-
'book'
|
450 |
-
'cafe'
|
451 |
-
'city'
|
452 |
-
'country'
|
453 |
-
'episode'
|
454 |
-
'food'
|
455 |
-
'game'
|
456 |
-
'hotel'
|
457 |
-
'landmark'
|
458 |
-
'movie'
|
459 |
-
'product'
|
460 |
-
'profile'
|
461 |
'restaurant' => 'Restaurant',
|
462 |
-
'school'
|
463 |
-
'sport'
|
464 |
-
'website'
|
465 |
);
|
466 |
-
|
467 |
-
if ( !empty( $schema_types[$type] ) )
|
468 |
-
$type = $schema_types[$type];
|
469 |
-
else
|
470 |
$type = 'WebSite';
|
471 |
-
|
472 |
-
|
473 |
-
|
|
|
|
|
|
|
|
|
|
|
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
|
484 |
-
$key
|
485 |
-
$dimg
|
486 |
$current_post_type = get_post_type();
|
487 |
-
$title
|
488 |
-
$type
|
489 |
-
$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 )
|
|
|
|
|
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
|
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 |
-
|
|
|
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) )
|
522 |
-
|
523 |
-
|
524 |
-
if ( empty( $
|
|
|
|
|
|
|
|
|
525 |
$description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 );
|
526 |
-
|
527 |
-
|
528 |
-
if (
|
|
|
|
|
|
|
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(
|
543 |
-
|
544 |
-
|
|
|
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 |
-
|
563 |
-
|
|
|
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->
|
|
|
|
|
|
|
|
|
570 |
$modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified ) );
|
|
|
571 |
}
|
572 |
|
573 |
-
$image
|
574 |
-
$video
|
575 |
-
$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 |
-
|
|
|
583 |
$description = trim( strip_tags( get_post_meta( $post->ID, "_aioseop_description", true ) ) );
|
584 |
-
|
|
|
585 |
/* Add some defaults */
|
586 |
-
if ( empty( $title ) )
|
587 |
-
|
|
|
|
|
588 |
$description = $post->post_content;
|
589 |
-
|
590 |
-
|
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 |
-
|
|
|
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
|
627 |
$description = $this->apply_cf_fields( $description );
|
628 |
-
|
629 |
-
/* Data Validation */
|
630 |
-
$title
|
631 |
-
$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'
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
case '
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 ) )
|
|
|
|
|
671 |
|
672 |
$width = $height = '';
|
673 |
-
if ( !empty( $thumbnail ) ) {
|
674 |
-
if ( !empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) )
|
675 |
$width = $metabox['aioseop_opengraph_settings_imagewidth'];
|
676 |
-
|
|
|
677 |
$height = $metabox['aioseop_opengraph_settings_imageheight'];
|
678 |
-
|
|
|
679 |
$width = $this->options['aiosp_opengraph_dimgwidth'];
|
680 |
-
|
|
|
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 |
-
|
688 |
-
|
|
|
|
|
689 |
}
|
690 |
|
691 |
$card = 'summary';
|
692 |
-
if ( !empty( $this->options['aiosp_opengraph_defcard'] ) )
|
693 |
$card = $this->options['aiosp_opengraph_defcard'];
|
694 |
-
|
695 |
-
|
|
|
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( $
|
|
|
|
|
|
|
719 |
|
720 |
$meta = Array(
|
721 |
-
'facebook'
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
'twitter'
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
);
|
752 |
-
|
753 |
-
//Only show if "use schema.org markup is checked"
|
754 |
-
if(!empty( $aioseop_options['aiosp_schema_markup'] ))
|
755 |
-
$meta['google+'] = Array('thumbnail' => 'image');
|
756 |
|
|
|
|
|
|
|
|
|
757 |
|
758 |
|
759 |
-
|
760 |
// Add links to testing tools
|
761 |
-
|
762 |
/*
|
763 |
http://developers.facebook.com/tools/debug
|
764 |
https://dev.twitter.com/docs/cards/preview
|
@@ -786,45 +1137,49 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
786 |
'title' => 'twitter:title',
|
787 |
'description' => 'twitter:description',
|
788 |
'thumbnail' => 'twitter:image'
|
789 |
-
|
790 |
)
|
791 |
);
|
792 |
*/
|
793 |
-
|
794 |
$tags = Array(
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
);
|
799 |
-
|
800 |
-
foreach ( $meta as $t => $data )
|
801 |
foreach ( $data as $k => $v ) {
|
802 |
-
if ( empty( $$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 |
-
|
809 |
-
|
|
|
810 |
}
|
811 |
}
|
812 |
}
|
|
|
813 |
$social_link_schema = '';
|
814 |
-
if ( !empty( $social_links ) ) {
|
815 |
-
$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
|
823 |
-
$social_links[$k] = $v;
|
824 |
}
|
825 |
}
|
826 |
-
$social_links
|
827 |
-
$social_link_schema
|
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 |
-
|
847 |
-
|
|
|
|
|
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 |
-
|
857 |
-
|
|
|
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(
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
$
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
|
|
|
|
|
|
884 |
);
|
885 |
-
$this->help_text[$field]
|
886 |
-
$this->help_anchors[$field]
|
887 |
$this->locations['opengraph']['options'][] = $field;
|
888 |
-
$this->layout['facebook']['options'][]
|
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 ) )
|
898 |
-
|
|
|
|
|
899 |
$options['meta_key'] = $this->options['aiosp_opengraph_meta_key'];
|
|
|
900 |
if ( empty( $img ) ) {
|
901 |
-
$size
|
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
|
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
|
930 |
$get_avatar = get_avatar( $post->post_author, 300 );
|
931 |
-
if ( preg_match("/src='(.*?)'/i", $get_avatar, $matches) ) {
|
932 |
return $matches[1];
|
933 |
}
|
934 |
}
|
|
|
935 |
return false;
|
936 |
}
|
937 |
-
|
938 |
function get_the_image( $options = null, $p = null ) {
|
939 |
$meta_key = $this->options['aiosp_opengraph_meta_key'];
|
|
|
940 |
return parent::get_the_image( Array( 'meta_key' => $meta_key ), $p );
|
941 |
}
|
942 |
-
|
943 |
function get_the_image_by_default( $args = array() ) {
|
944 |
return $this->options['aiosp_opengraph_dimg'];
|
945 |
}
|
946 |
-
|
947 |
-
function settings_update(
|
948 |
-
|
949 |
}
|
950 |
}
|
951 |
}
|
5 |
/**
|
6 |
* The Opengraph class.
|
7 |
*/
|
8 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
9 |
class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
|
10 |
var $fb_object_types;
|
11 |
var $type;
|
12 |
|
13 |
+
function __construct() {
|
14 |
+
$this->name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
|
15 |
+
$this->prefix = 'aiosp_opengraph_'; // option prefix
|
16 |
+
$this->file = __FILE__; // the current file
|
17 |
$this->fb_object_types = Array(
|
18 |
+
'Activities' => Array(
|
19 |
'activity' => __( 'Activity', 'all-in-one-seo-pack' ),
|
20 |
+
'sport' => __( 'Sport', 'all-in-one-seo-pack' )
|
21 |
),
|
22 |
+
'Businesses' => Array(
|
23 |
+
'bar' => __( 'Bar', 'all-in-one-seo-pack' ),
|
24 |
+
'company' => __( 'Company', 'all-in-one-seo-pack' ),
|
25 |
+
'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ),
|
26 |
+
'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ),
|
27 |
'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' )
|
28 |
),
|
29 |
+
'Groups' => Array(
|
30 |
+
'cause' => __( 'Cause', 'all-in-one-seo-pack' ),
|
31 |
'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ),
|
32 |
+
'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' )
|
33 |
),
|
34 |
+
'Organizations' => Array(
|
35 |
+
'band' => __( 'Band', 'all-in-one-seo-pack' ),
|
36 |
'government' => __( 'Government', 'all-in-one-seo-pack' ),
|
37 |
'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ),
|
38 |
+
'school' => __( 'School', 'all-in-one-seo-pack' ),
|
39 |
'university' => __( 'University', 'all-in-one-seo-pack' )
|
40 |
),
|
41 |
+
'People' => Array(
|
42 |
+
'actor' => __( 'Actor', 'all-in-one-seo-pack' ),
|
43 |
+
'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ),
|
44 |
+
'author' => __( 'Author', 'all-in-one-seo-pack' ),
|
45 |
+
'director' => __( 'Director', 'all-in-one-seo-pack' ),
|
46 |
+
'musician' => __( 'Musician', 'all-in-one-seo-pack' ),
|
47 |
+
'politician' => __( 'Politician', 'all-in-one-seo-pack' ),
|
48 |
+
'profile' => __( 'Profile', 'all-in-one-seo-pack' ),
|
49 |
'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' )
|
50 |
),
|
51 |
+
'Places' => Array(
|
52 |
+
'city' => __( 'City', 'all-in-one-seo-pack' ),
|
53 |
+
'country' => __( 'Country', 'all-in-one-seo-pack' ),
|
54 |
+
'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ),
|
55 |
'state_province' => __( 'State Province', 'all-in-one-seo-pack' )
|
56 |
),
|
57 |
'Products and Entertainment' => Array(
|
58 |
+
'album' => __( 'Album', 'all-in-one-seo-pack' ),
|
59 |
+
'book' => __( 'Book', 'all-in-one-seo-pack' ),
|
60 |
+
'drink' => __( 'Drink', 'all-in-one-seo-pack' ),
|
61 |
+
'food' => __( 'Food', 'all-in-one-seo-pack' ),
|
62 |
+
'game' => __( 'Game', 'all-in-one-seo-pack' ),
|
63 |
+
'movie' => __( 'Movie', 'all-in-one-seo-pack' ),
|
64 |
'product' => __( 'Product', 'all-in-one-seo-pack' ),
|
65 |
+
'song' => __( 'Song', 'all-in-one-seo-pack' ),
|
66 |
'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ),
|
67 |
'episode' => __( 'Episode', 'all-in-one-seo-pack' )
|
68 |
+
),
|
69 |
+
'Websites' => Array(
|
70 |
'article' => __( 'Article', 'all-in-one-seo-pack' ),
|
71 |
+
'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
|
72 |
'website' => __( 'Website', 'all-in-one-seo-pack' )
|
73 |
)
|
74 |
);
|
75 |
parent::__construct();
|
76 |
|
77 |
+
$categories = Array(
|
78 |
+
'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
|
79 |
+
'website' => __( 'Website', 'all-in-one-seo-pack' ),
|
80 |
+
'article' => __( 'Article', 'all-in-one-seo-pack' )
|
81 |
+
);
|
82 |
|
83 |
$this->help_text = Array(
|
84 |
+
"setmeta" => __( "Checking this box will use the Home Title and Home Description set in All in One SEO Pack, General Settings as the Open Graph title and description for your home page.", 'all-in-one-seo-pack' ),
|
85 |
+
"key" => __( "Enter your Facebook Admin ID here. Information about how to get your Facebook Admin ID can be found at https://developers.facebook.com/docs/platforminsights/domains", 'all-in-one-seo-pack' ),
|
86 |
+
"appid" => __( "Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/platforminsights/domains", 'all-in-one-seo-pack' ),
|
87 |
+
"title_shortcodes" => __( "Run shortcodes that appear in social title meta tags.", 'all-in-one-seo-pack' ),
|
88 |
+
"description_shortcodes" => __( "Run shortcodes that appear in social description meta tags.", 'all-in-one-seo-pack' ),
|
89 |
+
"sitename" => __( "The Site Name is the name that is used to identify your website.", 'all-in-one-seo-pack' ),
|
90 |
+
"hometitle" => __( "The Home Title is the Open Graph title for your home page.", 'all-in-one-seo-pack' ),
|
91 |
+
"description" => __( "The Home Description is the Open Graph description for your home page.", 'all-in-one-seo-pack' ),
|
92 |
+
"homeimage" => __( "The Home Image is the Open Graph image for your home page.", 'all-in-one-seo-pack' ),
|
93 |
+
"hometag" => __( "The Home Tag allows you to add a list of keywords that best describe your home page content.", 'all-in-one-seo-pack' ),
|
94 |
+
"generate_descriptions" => __( "Check this and your Open Graph descriptions will be auto-generated from your content.", 'all-in-one-seo-pack' ),
|
95 |
+
"defimg" => __( "This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.", 'all-in-one-seo-pack' ),
|
96 |
+
"fallback" => __( "This option lets you fall back to the default image if no image could be found above.", 'all-in-one-seo-pack' ),
|
97 |
+
"dimg" => __( "This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.", 'all-in-one-seo-pack' ),
|
98 |
+
"dimgwidth" => __( "This option lets you set a default width for your images, where unspecified.", 'all-in-one-seo-pack' ),
|
99 |
+
"dimgheight" => __( "This option lets you set a default height for your images, where unspecified.", 'all-in-one-seo-pack' ),
|
100 |
+
"meta_key" => __( "Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.", 'all-in-one-seo-pack' ),
|
101 |
+
"categories" => __( "Set the Open Graph type for your website as either a blog or a website.", 'all-in-one-seo-pack' ),
|
102 |
+
"image" => __( "This option lets you select the Open Graph image that will be used for this Page or Post, overriding the default settings.", 'all-in-one-seo-pack' ),
|
103 |
+
"customimg" => __( "This option lets you upload an image to use as the Open Graph image for this Page or Post.", 'all-in-one-seo-pack' ),
|
104 |
+
"imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
|
105 |
+
"imageheight" => __( "Enter the height for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
|
106 |
+
"video" => __( "This option lets you specify a link to the Open Graph video used on this Page or Post.", 'all-in-one-seo-pack' ),
|
107 |
+
"videowidth" => __( "Enter the width for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
|
108 |
+
"videoheight" => __( "Enter the height for your Open Graph video in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
|
109 |
+
"defcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ),
|
110 |
+
"setcard" => __( "Select the default type of Twitter card to display.", 'all-in-one-seo-pack' ),
|
111 |
+
"twitter_site" => __( "Enter the Twitter username associated with your website here.", 'all-in-one-seo-pack' ),
|
112 |
+
"twitter_creator" => __( "Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.", 'all-in-one-seo-pack' ),
|
113 |
+
"twitter_domain" => __( "Enter the name of your website here.", 'all-in-one-seo-pack' ),
|
114 |
+
"gen_tags" => __( "Automatically generate article tags for Facebook type article when not provided.", 'all-in-one-seo-pack' ),
|
115 |
+
"gen_keywords" => __( "Use keywords in generated article tags.", 'all-in-one-seo-pack' ),
|
116 |
+
"gen_categories" => __( "Use catergories in generated article tags.", 'all-in-one-seo-pack' ),
|
117 |
+
"gen_post_tags" => __( "Use post tags in generated article tags.", 'all-in-one-seo-pack' ),
|
118 |
+
"types" => __( "Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.", 'all-in-one-seo-pack' ),
|
119 |
+
"title" => __( "This is the Open Graph title of this Page or Post.", 'all-in-one-seo-pack' ),
|
120 |
+
"desc" => __( "This is the Open Graph description of this Page or Post.", 'all-in-one-seo-pack' ),
|
121 |
+
"category" => __( "Select the Open Graph type that best describes the content of this Page or Post.", 'all-in-one-seo-pack' ),
|
122 |
+
"facebook_debug" => __( "Press this button to have Facebook re-fetch and debug this page.", 'all-in-one-seo-pack' ),
|
123 |
+
"section" => __( "This Open Graph meta allows you to add a general section name that best describes this content.", 'all-in-one-seo-pack' ),
|
124 |
+
"tag" => __( "This Open Graph meta allows you to add a list of keywords that best describe this content.", 'all-in-one-seo-pack' ),
|
125 |
+
"facebook_publisher" => __( "Link articles to the Facebook page associated with your website.", 'all-in-one-seo-pack' ),
|
126 |
+
"facebook_author" => __( "Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.", 'all-in-one-seo-pack' ),
|
127 |
+
"person_or_org" => __( "Are the social profile links for your website for a person or an organization?", 'all-in-one-seo-pack' ),
|
128 |
+
"profile_links" => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ),
|
129 |
+
"social_name" => __( "Add the name of the person or organization who owns these profiles.", 'all-in-one-seo-pack' )
|
130 |
);
|
131 |
|
132 |
$this->help_anchors = Array(
|
133 |
'generate_descriptions' => '#auto-generate-og-descriptions',
|
134 |
+
'setmeta' => '#use-aioseo-title-and-description',
|
135 |
+
'sitename' => '#site-name',
|
136 |
+
'hometitle' => '#home-title-and-description',
|
137 |
+
'description' => '#home-title-and-description',
|
138 |
+
'homeimage' => '#home-image',
|
139 |
+
'defimg' => '#select-og-image-source',
|
140 |
+
'fallback' => '#use-default-if-no-image-found',
|
141 |
+
'dimg' => '#default-og-image',
|
142 |
+
'meta_key' => '#use-custom-field-for-image',
|
143 |
+
'key' => '#facebook-admin-id',
|
144 |
+
'appid' => '#facebook-app-id',
|
145 |
+
'categories' => '#facebook-object-type',
|
146 |
+
'facebook_publisher' => '#show-facebook-publisher-on-articles',
|
147 |
+
'facebook_author' => '#show-facebook-author-on-articles',
|
148 |
+
'types' => '#enable-facebook-meta-for',
|
149 |
+
'defcard' => '#default-twitter-card',
|
150 |
+
'setcard' => '#default-twitter-card',
|
151 |
+
'twitter_site' => '#twitter-site',
|
152 |
+
'twitter_creator' => '#show-twitter-author',
|
153 |
+
'twitter_domain' => '#twitter-domain',
|
154 |
+
'scan_header' => '#scan-social-meta'
|
155 |
);
|
156 |
|
157 |
+
$count_desc = __( " characters. Open Graph allows up to a maximum of %s chars for the %s.", 'all-in-one-seo-pack' );
|
158 |
$this->default_options = array(
|
159 |
+
'scan_header' => Array(
|
160 |
+
'name' => __( 'Scan Header', 'all-in-one-seo-pack' ),
|
161 |
+
'type' => 'custom',
|
162 |
+
'save' => true
|
163 |
+
),
|
164 |
+
'setmeta' => Array(
|
165 |
+
'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ),
|
166 |
+
'type' => 'checkbox'
|
167 |
+
),
|
168 |
+
'key' => Array(
|
169 |
+
'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ),
|
170 |
+
'default' => '',
|
171 |
+
'type' => 'text'
|
172 |
+
),
|
173 |
+
'appid' => Array(
|
174 |
+
'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ),
|
175 |
+
'default' => '',
|
176 |
+
'type' => 'text'
|
177 |
+
),
|
178 |
+
'title_shortcodes' => Array( 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ) ),
|
179 |
+
'description_shortcodes' => Array( 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ) ),
|
180 |
+
'sitename' => Array(
|
181 |
+
'name' => __( 'Site Name', 'all-in-one-seo-pack' ),
|
182 |
+
'default' => get_bloginfo( 'name' ),
|
183 |
+
'type' => 'text'
|
184 |
+
),
|
185 |
+
'hometitle' => Array(
|
186 |
+
'name' => __( 'Home Title', 'all-in-one-seo-pack' ),
|
187 |
+
'default' => '',
|
188 |
+
'type' => 'textarea',
|
189 |
+
'condshow' => Array(
|
190 |
+
'aiosp_opengraph_setmeta' => Array(
|
191 |
+
'lhs' => "aiosp_opengraph_setmeta",
|
192 |
+
'op' => '!=',
|
193 |
+
'rhs' => 'on'
|
194 |
+
)
|
195 |
+
)
|
196 |
+
),
|
197 |
+
'description' => Array(
|
198 |
+
'name' => __( 'Home Description', 'all-in-one-seo-pack' ),
|
199 |
+
'default' => '',
|
200 |
+
'type' => 'textarea',
|
201 |
+
'condshow' => Array(
|
202 |
+
'aiosp_opengraph_setmeta' => Array(
|
203 |
+
'lhs' => "aiosp_opengraph_setmeta",
|
204 |
+
'op' => '!=',
|
205 |
+
'rhs' => 'on'
|
206 |
+
)
|
207 |
+
)
|
208 |
+
),
|
209 |
+
'homeimage' => Array(
|
210 |
+
'name' => __( 'Home Image', 'all-in-one-seo-pack' ),
|
211 |
+
'type' => 'image'
|
212 |
+
),
|
213 |
+
'hometag' => Array(
|
214 |
+
'name' => __( 'Home Article Tags', 'all-in-one-seo-pack' ),
|
215 |
+
'type' => 'text',
|
216 |
+
'default' => '',
|
217 |
+
'condshow' => Array( 'aiosp_opengraph_categories' => 'article' )
|
218 |
+
),
|
219 |
+
'generate_descriptions' => Array(
|
220 |
+
'name' => __( 'Autogenerate OG Descriptions', 'all-in-one-seo-pack' ),
|
221 |
+
'default' => 1
|
222 |
+
),
|
223 |
+
'defimg' => Array(
|
224 |
+
'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ),
|
225 |
+
'type' => 'select',
|
226 |
+
'initial_options' => Array(
|
227 |
+
'' => __( 'Default Image' ),
|
228 |
+
'featured' => __( 'Featured Image' ),
|
229 |
+
'attach' => __( 'First Attached Image' ),
|
230 |
+
'content' => __( 'First Image In Content' ),
|
231 |
+
'custom' => __( 'Image From Custom Field' ),
|
232 |
+
'author' => __( 'Post Author Image' ),
|
233 |
+
'auto' => __( 'First Available Image' )
|
234 |
+
)
|
235 |
+
),
|
236 |
+
'fallback' => Array(
|
237 |
+
'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ),
|
238 |
+
'type' => 'checkbox'
|
239 |
+
),
|
240 |
+
'dimg' => Array(
|
241 |
+
'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ),
|
242 |
+
'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png',
|
243 |
+
'type' => 'image'
|
244 |
+
),
|
245 |
+
'dimgwidth' => Array(
|
246 |
+
'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ),
|
247 |
+
'type' => 'text',
|
248 |
+
'default' => ''
|
249 |
+
),
|
250 |
+
'dimgheight' => Array(
|
251 |
+
'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ),
|
252 |
+
'type' => 'text',
|
253 |
+
'default' => ''
|
254 |
+
),
|
255 |
+
'meta_key' => Array(
|
256 |
+
'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ),
|
257 |
+
'type' => 'text',
|
258 |
+
'default' => ''
|
259 |
+
),
|
260 |
+
'categories' => Array(
|
261 |
+
'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
|
262 |
+
'type' => 'radio',
|
263 |
+
'initial_options' => $categories,
|
264 |
+
'default' => 'blog'
|
265 |
+
),
|
266 |
+
'image' => Array(
|
267 |
+
'name' => __( 'Image', 'all-in-one-seo-pack' ),
|
268 |
+
'type' => 'radio',
|
269 |
+
'initial_options' => Array( 0 => '<img style="width:50px;height:auto;display:inline-block;vertical-align:bottom;" src="' . AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png' . '">' )
|
270 |
+
),
|
271 |
+
'customimg' => Array(
|
272 |
+
'name' => __( 'Custom Image', 'all-in-one-seo-pack' ),
|
273 |
+
'type' => 'image'
|
274 |
+
),
|
275 |
+
'imagewidth' => Array(
|
276 |
+
'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ),
|
277 |
+
'type' => 'text',
|
278 |
+
'default' => ''
|
279 |
+
),
|
280 |
+
'imageheight' => Array(
|
281 |
+
'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ),
|
282 |
+
'type' => 'text',
|
283 |
+
'default' => ''
|
284 |
+
),
|
285 |
+
'video' => Array(
|
286 |
+
'name' => __( 'Custom Video', 'all-in-one-seo-pack' ),
|
287 |
+
'type' => 'text'
|
288 |
+
),
|
289 |
+
'videowidth' => Array(
|
290 |
+
'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ),
|
291 |
+
'type' => 'text',
|
292 |
+
'default' => '',
|
293 |
+
'condshow' => Array(
|
294 |
+
'aioseop_opengraph_settings_video' => Array(
|
295 |
+
'lhs' => "aioseop_opengraph_settings_video",
|
296 |
+
'op' => '!=',
|
297 |
+
'rhs' => ''
|
298 |
+
)
|
299 |
+
)
|
300 |
+
),
|
301 |
+
'videoheight' => Array(
|
302 |
+
'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ),
|
303 |
+
'type' => 'text',
|
304 |
+
'default' => '',
|
305 |
+
'condshow' => Array(
|
306 |
+
'aioseop_opengraph_settings_video' => Array(
|
307 |
+
'lhs' => "aioseop_opengraph_settings_video",
|
308 |
+
'op' => '!=',
|
309 |
+
'rhs' => ''
|
310 |
+
)
|
311 |
+
)
|
312 |
+
),
|
313 |
+
'defcard' => Array(
|
314 |
+
'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ),
|
315 |
+
'type' => 'select',
|
316 |
+
'initial_options' => Array(
|
317 |
+
'summary' => __( 'Summary', 'all-in-one-seo-pack' ),
|
318 |
+
'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' )
|
319 |
+
/*, *******REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE****** 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) */
|
320 |
+
),
|
321 |
+
'default' => 'summary'
|
322 |
+
),
|
323 |
+
'setcard' => Array(
|
324 |
+
'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ),
|
325 |
+
'type' => 'select',
|
326 |
+
'initial_options' => Array(
|
327 |
+
'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ),
|
328 |
+
'summary' => __( 'Summary', 'all-in-one-seo-pack' )
|
329 |
+
/*, *******REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE****** 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) */
|
330 |
+
)
|
331 |
+
),
|
332 |
+
'twitter_site' => Array(
|
333 |
+
'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ),
|
334 |
+
'type' => 'text',
|
335 |
+
'default' => ''
|
336 |
+
),
|
337 |
+
'twitter_creator' => Array( 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ) ),
|
338 |
+
'twitter_domain' => Array(
|
339 |
+
'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ),
|
340 |
+
'type' => 'text',
|
341 |
+
'default' => ''
|
342 |
+
),
|
343 |
+
'gen_tags' => Array( 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ) ),
|
344 |
+
'gen_keywords' => Array(
|
345 |
+
'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ),
|
346 |
+
'default' => 'on',
|
347 |
+
'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' )
|
348 |
+
),
|
349 |
+
'gen_categories' => Array(
|
350 |
+
'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ),
|
351 |
+
'default' => 'on',
|
352 |
+
'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' )
|
353 |
+
),
|
354 |
+
'gen_post_tags' => Array(
|
355 |
+
'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ),
|
356 |
+
'default' => 'on',
|
357 |
+
'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' )
|
358 |
+
),
|
359 |
+
'types' => Array(
|
360 |
+
'name' => __( 'Enable Facebook Meta for', 'all-in-one-seo-pack' ),
|
361 |
+
'type' => 'multicheckbox',
|
362 |
+
'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ),
|
363 |
+
'default' => Array( 'post' => 'post', 'page' => 'page' )
|
364 |
+
),
|
365 |
+
'title' => Array(
|
366 |
+
'name' => __( 'Title', 'all-in-one-seo-pack' ),
|
367 |
+
'default' => '',
|
368 |
+
'type' => 'text',
|
369 |
+
'size' => 95,
|
370 |
+
'count' => 1,
|
371 |
+
'count_desc' => $count_desc
|
372 |
+
),
|
373 |
+
'desc' => Array(
|
374 |
+
'name' => __( 'Description', 'all-in-one-seo-pack' ),
|
375 |
+
'default' => '',
|
376 |
+
'type' => 'textarea',
|
377 |
+
'cols' => 250,
|
378 |
+
'rows' => 4,
|
379 |
+
'count' => 1,
|
380 |
+
'count_desc' => $count_desc
|
381 |
+
),
|
382 |
+
'category' => Array(
|
383 |
+
'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
|
384 |
+
'type' => 'select',
|
385 |
+
'style' => '',
|
386 |
+
'initial_options' => $this->fb_object_types,
|
387 |
+
'default' => ''
|
388 |
+
),
|
389 |
+
'facebook_debug' => Array(
|
390 |
+
'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ),
|
391 |
+
'type' => 'html',
|
392 |
+
'save' => false,
|
393 |
+
'default' =>
|
394 |
+
'<script>
|
395 |
jQuery(document).ready(function() {
|
396 |
var snippet = jQuery("#aioseop_snippet_link");
|
397 |
if ( !snippet ) {
|
403 |
});
|
404 |
</script>
|
405 |
<a name="aioseop_opengraph_settings_facebook_debug" id="aioseop_opengraph_settings_facebook_debug" class="button-primary" href="" target=_blank>' . __( 'Debug This Post', 'all-in-one-seo-pack' )
|
406 |
+
. '</a>'
|
407 |
+
),
|
408 |
+
|
409 |
+
'section' => Array(
|
410 |
+
'name' => __( 'Article Section', 'all-in-one-seo-pack' ),
|
411 |
+
'type' => 'text',
|
412 |
+
'default' => '',
|
413 |
+
'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' )
|
414 |
+
),
|
415 |
+
'tag' => Array(
|
416 |
+
'name' => __( 'Article Tags', 'all-in-one-seo-pack' ),
|
417 |
+
'type' => 'text',
|
418 |
+
'default' => '',
|
419 |
+
'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' )
|
420 |
+
),
|
421 |
+
'facebook_publisher' => Array(
|
422 |
+
'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ),
|
423 |
+
'type' => 'text',
|
424 |
+
'default' => ''
|
425 |
+
),
|
426 |
+
'facebook_author' => Array( 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ) ),
|
427 |
+
'profile_links' => Array(
|
428 |
+
'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
|
429 |
+
'type' => 'textarea',
|
430 |
+
'cols' => 60,
|
431 |
+
'rows' => 5
|
432 |
+
),
|
433 |
+
'person_or_org' => Array(
|
434 |
+
'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ),
|
435 |
+
'type' => 'radio',
|
436 |
+
'initial_options' => Array(
|
437 |
+
'person' => __( 'Person', 'all-in-one-seo-pack' ),
|
438 |
+
'org' => __( 'Organization', 'all-in-one-seo-pack' )
|
439 |
+
)
|
440 |
+
),
|
441 |
+
'social_name' => Array(
|
442 |
+
'name' => __( "Associated Name", 'all-in-one-seo-pack' ),
|
443 |
+
'type' => 'text',
|
444 |
+
'default' => ""
|
445 |
+
),
|
446 |
);
|
447 |
|
448 |
// load initial options / set defaults
|
449 |
+
$this->update_options();
|
450 |
|
451 |
$display = Array();
|
452 |
+
if ( isset( $this->options['aiosp_opengraph_types'] ) ) {
|
453 |
+
$display = $this->options['aiosp_opengraph_types'];
|
454 |
+
}
|
455 |
|
456 |
$this->locations = array(
|
457 |
+
'opengraph' => Array(
|
458 |
+
'name' => $this->name,
|
459 |
+
'prefix' => 'aiosp_',
|
460 |
+
'type' => 'settings',
|
461 |
+
'options' => Array(
|
462 |
+
'scan_header',
|
463 |
+
'setmeta',
|
464 |
+
'key',
|
465 |
+
'appid',
|
466 |
+
'sitename',
|
467 |
+
'title_shortcodes',
|
468 |
+
'description_shortcodes',
|
469 |
+
'hometitle',
|
470 |
+
'description',
|
471 |
+
'homeimage',
|
472 |
+
'hometag',
|
473 |
+
'generate_descriptions',
|
474 |
+
'defimg',
|
475 |
+
'fallback',
|
476 |
+
'dimg',
|
477 |
+
'dimgwidth',
|
478 |
+
'dimgheight',
|
479 |
+
'meta_key',
|
480 |
+
'categories',
|
481 |
+
'defcard',
|
482 |
+
'profile_links',
|
483 |
+
'person_or_org',
|
484 |
+
'social_name',
|
485 |
+
'twitter_site',
|
486 |
+
'twitter_creator',
|
487 |
+
'twitter_domain',
|
488 |
+
'gen_tags',
|
489 |
+
'gen_keywords',
|
490 |
+
'gen_categories',
|
491 |
+
'gen_post_tags',
|
492 |
+
'types',
|
493 |
+
'facebook_publisher',
|
494 |
+
'facebook_author'
|
495 |
+
)
|
496 |
+
),
|
497 |
+
'settings' => Array(
|
498 |
+
'name' => __( 'Social Settings', 'all-in-one-seo-pack' ),
|
499 |
+
'type' => 'metabox',
|
500 |
+
'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings',
|
501 |
+
'options' => Array(
|
502 |
+
'title',
|
503 |
+
'desc',
|
504 |
+
'image',
|
505 |
+
'customimg',
|
506 |
+
'imagewidth',
|
507 |
+
'imageheight',
|
508 |
+
'video',
|
509 |
+
'videowidth',
|
510 |
+
'videoheight',
|
511 |
+
'category',
|
512 |
+
'facebook_debug',
|
513 |
+
'section',
|
514 |
+
'tag',
|
515 |
+
'setcard'
|
516 |
+
),
|
517 |
+
'display' => $display,
|
518 |
+
'prefix' => 'aioseop_opengraph_'
|
519 |
+
)
|
520 |
);
|
521 |
|
522 |
$this->layout = Array(
|
523 |
+
'default' => Array(
|
524 |
+
'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
|
525 |
+
'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
|
526 |
+
'options' => Array() // this is set below, to the remaining options -- pdb
|
527 |
+
),
|
528 |
+
'home' => Array(
|
529 |
+
'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
|
530 |
+
'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
|
531 |
+
'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage', 'hometag' )
|
532 |
+
),
|
533 |
+
'image' => Array(
|
534 |
+
'name' => __( 'Image Settings', 'all-in-one-seo-pack' ),
|
535 |
+
'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
|
536 |
+
'options' => Array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' )
|
537 |
+
),
|
538 |
+
'links' => Array(
|
539 |
+
'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
|
540 |
+
'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
|
541 |
+
'options' => Array( 'profile_links', 'person_or_org', 'social_name' )
|
542 |
+
),
|
543 |
+
'facebook' => Array(
|
544 |
+
'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ),
|
545 |
+
'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
|
546 |
+
'options' => Array(
|
547 |
+
'key',
|
548 |
+
'appid',
|
549 |
+
'types',
|
550 |
+
'gen_tags',
|
551 |
+
'gen_keywords',
|
552 |
+
'gen_categories',
|
553 |
+
'gen_post_tags',
|
554 |
+
'categories',
|
555 |
+
'facebook_publisher',
|
556 |
+
'facebook_author'
|
557 |
)
|
558 |
+
),
|
559 |
+
'twitter' => Array(
|
560 |
+
'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ),
|
561 |
+
'help_link' => 'http://semperplugins.com/documentation/social-meta-module/',
|
562 |
+
'options' => Array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' )
|
563 |
+
),
|
564 |
+
'scan_meta' => Array(
|
565 |
+
'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ),
|
566 |
+
'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#scan_meta',
|
567 |
+
'options' => Array( 'scan_header' )
|
568 |
+
)
|
569 |
);
|
570 |
|
571 |
$other_options = Array();
|
572 |
+
foreach ( $this->layout as $k => $v ) {
|
573 |
$other_options = array_merge( $other_options, $v['options'] );
|
574 |
+
}
|
575 |
|
576 |
$this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
|
577 |
|
581 |
add_action( 'wp', Array( $this, 'type_setup' ) );
|
582 |
}
|
583 |
|
584 |
+
if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
|
585 |
+
$this->do_opengraph();
|
586 |
+
}
|
587 |
|
588 |
// Avoid having duplicate meta tags
|
589 |
add_filter( 'jetpack_enable_open_graph', '__return_false' );
|
592 |
function settings_page_init() {
|
593 |
add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 );
|
594 |
$cat = $this->options["{$this->prefix}categories"];
|
595 |
+
if ( ! empty( $cat ) ) {
|
596 |
if ( $cat == 'blog' ) {
|
597 |
$show_on_front = get_option( 'show_on_front' );
|
598 |
if ( ( $show_on_front == 'page' ) && ( get_option( 'page_on_front' ) ) ) {
|
600 |
}
|
601 |
} elseif ( $cat == 'website' ) {
|
602 |
$show_on_front = get_option( 'show_on_front' );
|
603 |
+
if ( ( $show_on_front == 'posts' ) ) {
|
604 |
$this->output_error( '<p>' . __( "Blog on front page detected, suggested Facebook Object Type is 'blog'.", 'all-in-one-seo-pack' ) . '</p>' );
|
605 |
+
}
|
606 |
}
|
607 |
}
|
608 |
}
|
609 |
+
|
610 |
function filter_options( $options, $location ) {
|
611 |
if ( $location == 'settings' ) {
|
612 |
$prefix = $this->get_prefix( $location ) . $location . '_';
|
613 |
list( $legacy, $images ) = $this->get_all_images( $options );
|
614 |
if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) {
|
615 |
$thumbnail = $options["{$prefix}image"];
|
616 |
+
if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) {
|
617 |
+
if ( $thumbnail == 'post' ) {
|
618 |
$thumbnail = $images['post1'];
|
619 |
+
} else if ( ! empty( $legacy[ $thumbnail ] ) ) {
|
620 |
+
$thumbnail = $legacy[ $thumbnail ];
|
621 |
+
}
|
622 |
}
|
623 |
$options["{$prefix}image"] = $thumbnail;
|
624 |
}
|
625 |
if ( empty( $options[ $prefix . 'image' ] ) ) {
|
626 |
$img = array_keys( $images );
|
627 |
+
if ( ! empty( $img ) && ! empty( $img[1] ) ) {
|
628 |
$options[ $prefix . 'image' ] = $img[1];
|
629 |
+
}
|
630 |
}
|
631 |
}
|
632 |
+
|
633 |
return $options;
|
634 |
}
|
635 |
+
|
636 |
function filter_settings( $settings, $location, $current ) {
|
637 |
if ( $location == 'opengraph' || $location == 'settings' ) {
|
638 |
$prefix = $this->get_prefix( $location ) . $location . '_';
|
639 |
+
if ( $location == 'opengraph' ) {
|
640 |
+
return $settings;
|
641 |
+
}
|
642 |
+
if ( $location == 'settings' ) {
|
643 |
list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current );
|
644 |
+
$opts = Array( 'title', 'desc' );
|
645 |
$current_post_type = get_post_type();
|
646 |
if ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
|
647 |
$flat_type_list = Array();
|
648 |
+
foreach ( $this->fb_object_types as $k => $v ) {
|
649 |
+
if ( is_array( $v ) ) {
|
650 |
+
$flat_type_list = array_merge( $flat_type_list, $v );
|
651 |
+
} else {
|
652 |
+
$flat_type_list[ $k ] = $v;
|
653 |
+
}
|
654 |
+
}
|
655 |
+
$settings[ $prefix . 'category' ]['initial_options'] = array_merge( Array(
|
656 |
$this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - '
|
657 |
+
. $flat_type_list[ $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ]
|
658 |
+
),
|
659 |
+
$settings[ $prefix . 'category' ]['initial_options'] );
|
660 |
}
|
661 |
if ( isset( $this->options["aiosp_opengraph_defcard"] ) ) {
|
662 |
+
$settings[ $prefix . 'setcard' ]['default'] = $this->options["aiosp_opengraph_defcard"];
|
663 |
+
}
|
664 |
global $aiosp;
|
665 |
$info = $aiosp->get_page_snippet_info();
|
666 |
extract( $info );
|
667 |
$settings["{$prefix}title"]['placeholder'] = $title;
|
668 |
+
$settings["{$prefix}desc"]['placeholder'] = $description;
|
669 |
}
|
670 |
+
if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) {
|
671 |
+
foreach ( $opts as $opt ) {
|
672 |
if ( isset( $settings[ $prefix . $opt ] ) ) {
|
673 |
+
$settings[ $prefix . $opt ]['type'] = 'hidden';
|
674 |
+
$settings[ $prefix . $opt ]['label'] = 'none';
|
675 |
$settings[ $prefix . $opt ]['help_text'] = '';
|
676 |
unset( $settings[ $prefix . $opt ]['count'] );
|
677 |
}
|
678 |
+
}
|
679 |
+
}
|
680 |
}
|
681 |
+
|
682 |
return $settings;
|
683 |
}
|
684 |
+
|
685 |
function override_options( $options, $location, $settings ) {
|
686 |
$opts = Array();
|
687 |
+
foreach ( $settings as $k => $v ) {
|
688 |
+
if ( $v['save'] ) {
|
689 |
+
$opts[ $k ] = $v['default'];
|
690 |
+
}
|
691 |
+
}
|
692 |
+
foreach ( $options as $k => $v ) {
|
693 |
+
if ( $v === null ) {
|
694 |
+
unset( $options[ $k ] );
|
695 |
+
}
|
696 |
+
}
|
697 |
$options = wp_parse_args( $options, $opts );
|
698 |
+
|
699 |
return $options;
|
700 |
}
|
701 |
+
|
702 |
function filter_metabox_options( $options, $location, $post_id ) {
|
703 |
if ( $location == 'settings' ) {
|
704 |
$prefix = $this->get_prefix( $location ) . $location;
|
705 |
+
if ( ! empty( $options[ $prefix . '_customimg' ] ) ) {
|
706 |
$old_options = get_post_meta( $post_id, '_' . $prefix );
|
707 |
$prefix .= '_';
|
708 |
+
if ( empty( $old_options[ $prefix . 'customimg' ] ) || ( $old_options[ $prefix . 'customimg' ] != $options[ $prefix . 'customimg' ] ) ) {
|
709 |
+
$options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ];
|
710 |
+
}
|
711 |
}
|
712 |
}
|
713 |
+
|
714 |
return $options;
|
715 |
}
|
716 |
+
|
717 |
/** Custom settings **/
|
718 |
function display_custom_options( $buf, $args ) {
|
719 |
if ( $args['name'] == 'aiosp_opengraph_scan_header' ) {
|
720 |
$buf .= '<div class="aioseop aioseop_options aiosp_opengraph_settings"><div class="aioseop_wrapper aioseop_custom_type" id="aiosp_opengraph_scan_header_wrapper"><div class="aioseop_input" id="aiosp_opengraph_scan_header" style="padding-left:20px;">';
|
721 |
$args['options']['type'] = 'submit';
|
722 |
+
$args['attr'] = " class='button-primary' ";
|
723 |
+
$args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' );
|
724 |
$buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' );
|
725 |
$buf .= '<br /><br />' . $this->get_option_html( $args );
|
726 |
$buf .= '</div></div></div>';
|
727 |
}
|
728 |
+
|
729 |
return $buf;
|
730 |
}
|
731 |
+
|
732 |
function add_attributes( $output ) { // avoid having duplicate meta tags
|
733 |
$type = $this->type;
|
734 |
+
if ( empty( $type ) ) {
|
735 |
+
$type = 'website';
|
736 |
+
}
|
737 |
+
|
738 |
$schema_types = Array(
|
739 |
+
'album' => 'MusicAlbum',
|
740 |
+
'article' => 'Article',
|
741 |
+
'bar' => 'BarOrPub',
|
742 |
+
'blog' => 'Blog',
|
743 |
+
'book' => 'Book',
|
744 |
+
'cafe' => 'CafeOrCoffeeShop',
|
745 |
+
'city' => 'City',
|
746 |
+
'country' => 'Country',
|
747 |
+
'episode' => 'Episode',
|
748 |
+
'food' => 'FoodEvent',
|
749 |
+
'game' => 'Game',
|
750 |
+
'hotel' => 'Hotel',
|
751 |
+
'landmark' => 'LandmarksOrHistoricalBuildings',
|
752 |
+
'movie' => 'Movie',
|
753 |
+
'product' => 'Product',
|
754 |
+
'profile' => 'ProfilePage',
|
755 |
'restaurant' => 'Restaurant',
|
756 |
+
'school' => 'School',
|
757 |
+
'sport' => 'SportsEvent',
|
758 |
+
'website' => 'WebSite'
|
759 |
);
|
760 |
+
|
761 |
+
if ( ! empty( $schema_types[ $type ] ) ) {
|
762 |
+
$type = $schema_types[ $type ];
|
763 |
+
} else {
|
764 |
$type = 'WebSite';
|
765 |
+
}
|
766 |
+
|
767 |
+
$attributes = apply_filters( $this->prefix . 'attributes', Array(
|
768 |
+
'itemscope',
|
769 |
+
'itemtype="http://schema.org/' . ucfirst( $type ) . '"',
|
770 |
+
'prefix="og: http://ogp.me/ns#"'
|
771 |
+
) );
|
772 |
+
foreach ( $attributes as $attr ) {
|
773 |
if ( strpos( $output, $attr ) === false ) {
|
774 |
$output .= "\n\t$attr ";
|
775 |
}
|
776 |
}
|
777 |
+
|
778 |
return $output;
|
779 |
}
|
780 |
+
|
781 |
+
function add_meta() {
|
782 |
global $post, $aiosp, $aioseop_options, $wp_query;
|
783 |
+
$metabox = $this->get_current_options( Array(), 'settings' );
|
784 |
+
$key = $this->options['aiosp_opengraph_key'];
|
785 |
+
$dimg = $this->options['aiosp_opengraph_dimg'];
|
786 |
$current_post_type = get_post_type();
|
787 |
+
$title = $description = $image = $video = '';
|
788 |
+
$type = $this->type;
|
789 |
+
$sitename = $this->options['aiosp_opengraph_sitename'];
|
790 |
+
|
791 |
+
$appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : '';
|
792 |
+
|
793 |
+
if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
|
794 |
$first_page = false;
|
795 |
+
if ( $aiosp->get_page_number() < 2 ) {
|
796 |
+
$first_page = true;
|
797 |
+
}
|
798 |
} else {
|
799 |
$first_page = true;
|
800 |
}
|
801 |
$url = $aiosp->aiosp_mrt_get_url( $wp_query );
|
802 |
$url = apply_filters( 'aioseop_canonical_url', $url );
|
803 |
+
|
804 |
+
$setmeta = $this->options['aiosp_opengraph_setmeta'];
|
805 |
$social_links = '';
|
806 |
if ( is_front_page() ) {
|
807 |
$title = $this->options['aiosp_opengraph_hometitle'];
|
808 |
+
if ( $first_page ) {
|
809 |
$description = $this->options['aiosp_opengraph_description'];
|
810 |
+
}
|
811 |
+
if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) {
|
812 |
$thumbnail = $this->options['aiosp_opengraph_homeimage'];
|
813 |
+
} else {
|
814 |
$thumbnail = $this->options['aiosp_opengraph_dimg'];
|
815 |
+
}
|
816 |
+
|
817 |
/* If Use AIOSEO Title and Desc Selected */
|
818 |
+
if ( $setmeta ) {
|
819 |
$title = $aiosp->wp_title();
|
820 |
+
if ( $first_page ) {
|
821 |
$description = $aiosp->get_aioseop_description( $post );
|
822 |
+
}
|
823 |
}
|
824 |
+
|
825 |
/* Add some defaults */
|
826 |
+
if ( empty( $title ) ) {
|
827 |
+
$title = get_bloginfo( 'name' );
|
828 |
+
}
|
829 |
+
if ( empty( $sitename ) ) {
|
830 |
+
$sitename = get_bloginfo( 'name' );
|
831 |
+
}
|
832 |
+
|
833 |
+
if ( empty( $description ) && $first_page && ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) && ! empty( $post ) && ! empty( $post->post_content ) && ! post_password_required( $post ) ) {
|
834 |
$description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 );
|
835 |
+
}
|
836 |
+
|
837 |
+
if ( empty( $description ) && $first_page ) {
|
838 |
+
$description = get_bloginfo( 'description' );
|
839 |
+
}
|
840 |
+
if ( $type == 'article' && ( ! empty( $this->options['aiosp_opengraph_hometag'] ) ) ) {
|
841 |
$tag = $this->options['aiosp_opengraph_hometag'];
|
842 |
}
|
843 |
+
if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) {
|
844 |
$social_links = $this->options['aiosp_opengraph_profile_links'];
|
845 |
+
if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) {
|
846 |
$social_name = $this->options['aiosp_opengraph_social_name'];
|
847 |
}
|
848 |
if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) {
|
851 |
$social_type = "Organization";
|
852 |
}
|
853 |
}
|
854 |
+
} elseif ( is_singular() && $this->option_isset( 'types' )
|
855 |
+
&& is_array( $this->options['aiosp_opengraph_types'] )
|
856 |
+
&& in_array( $current_post_type, $this->options['aiosp_opengraph_types'] )
|
857 |
+
) {
|
858 |
|
859 |
if ( $type == 'article' ) {
|
860 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
|
861 |
$section = $metabox['aioseop_opengraph_settings_section'];
|
862 |
}
|
863 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) {
|
864 |
$tag = $metabox['aioseop_opengraph_settings_tag'];
|
865 |
}
|
866 |
+
if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) {
|
867 |
$publisher = $this->options['aiosp_opengraph_facebook_publisher'];
|
868 |
}
|
869 |
}
|
870 |
+
|
871 |
+
if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
|
872 |
$domain = $this->options['aiosp_opengraph_twitter_domain'];
|
873 |
+
}
|
874 |
+
|
875 |
+
|
876 |
+
if ( $type == 'article' && ! empty( $post ) ) {
|
877 |
+
if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
|
878 |
$author = get_the_author_meta( 'facebook', $post->post_author );
|
879 |
+
}
|
|
|
|
|
880 |
|
881 |
+
if ( isset( $post->post_date ) ) {
|
882 |
+
$published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date ) );
|
883 |
+
}
|
884 |
+
|
885 |
+
if ( isset( $post->post_modified ) ) {
|
886 |
$modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified ) );
|
887 |
+
}
|
888 |
}
|
889 |
|
890 |
+
$image = $metabox['aioseop_opengraph_settings_image'];
|
891 |
+
$video = $metabox['aioseop_opengraph_settings_video'];
|
892 |
+
$title = $metabox['aioseop_opengraph_settings_title'];
|
893 |
$description = $metabox['aioseop_opengraph_settings_desc'];
|
894 |
+
|
895 |
/* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */
|
896 |
global $aiosp;
|
897 |
+
if ( empty( $title ) ) {
|
898 |
$title = $aiosp->wp_title();
|
899 |
+
}
|
900 |
+
if ( empty( $description ) ) {
|
901 |
$description = trim( strip_tags( get_post_meta( $post->ID, "_aioseop_description", true ) ) );
|
902 |
+
}
|
903 |
+
|
904 |
/* Add some defaults */
|
905 |
+
if ( empty( $title ) ) {
|
906 |
+
$title = get_the_title();
|
907 |
+
}
|
908 |
+
if ( empty( $description ) && ( $this->options['aiosp_opengraph_generate_descriptions'] ) && ! post_password_required( $post ) ) {
|
909 |
$description = $post->post_content;
|
910 |
+
}
|
911 |
+
if ( empty( $type ) ) {
|
912 |
+
$type = 'article';
|
913 |
+
}
|
914 |
+
} else {
|
915 |
+
return;
|
916 |
+
}
|
917 |
+
|
918 |
if ( $type == 'article' ) {
|
919 |
+
if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) {
|
920 |
+
if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) {
|
921 |
$keywords = $aiosp->get_main_keywords();
|
922 |
$keywords = $this->apply_cf_fields( $keywords );
|
923 |
$keywords = apply_filters( 'aioseop_keywords', $keywords );
|
924 |
+
if ( ! empty( $keywords ) && ! empty( $tag ) ) {
|
925 |
$tag .= ',' . $keywords;
|
926 |
} elseif ( empty( $tag ) ) {
|
927 |
$tag = $keywords;
|
928 |
}
|
929 |
}
|
930 |
$tag = $aiosp->keyword_string_to_list( $tag );
|
931 |
+
if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) {
|
932 |
$tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) );
|
933 |
+
}
|
934 |
+
if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) {
|
935 |
$tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) );
|
936 |
+
}
|
937 |
+
}
|
938 |
+
if ( ! empty( $tag ) ) {
|
939 |
+
$tag = $aiosp->clean_keyword_list( $tag );
|
940 |
}
|
|
|
|
|
941 |
}
|
942 |
+
|
943 |
+
if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) {
|
944 |
$title = do_shortcode( $title );
|
945 |
}
|
946 |
+
|
947 |
+
if ( ! empty( $description ) ) {
|
948 |
$description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) );
|
949 |
+
if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) {
|
950 |
$description = do_shortcode( $description );
|
951 |
}
|
952 |
+
$description = $aiosp->trim_excerpt_without_filters( $description, 1000 );
|
953 |
}
|
954 |
+
|
955 |
+
$title = $this->apply_cf_fields( $title );
|
956 |
$description = $this->apply_cf_fields( $description );
|
957 |
+
|
958 |
+
/* Data Validation */
|
959 |
+
$title = strip_tags( esc_attr( $title ) );
|
960 |
+
$sitename = strip_tags( esc_attr( $sitename ) );
|
961 |
$description = strip_tags( esc_attr( $description ) );
|
962 |
+
|
963 |
+
if ( empty( $thumbnail ) && ! empty( $image ) ) {
|
964 |
$thumbnail = $image;
|
965 |
+
}
|
966 |
+
|
967 |
/* Get the first image attachment on the post */
|
968 |
// if( empty($thumbnail) ) $thumbnail = $this->get_the_image();
|
969 |
+
|
970 |
/* Add user supplied default image */
|
971 |
+
if ( empty( $thumbnail ) ) {
|
972 |
+
if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) {
|
973 |
$thumbnail = $this->options['aiosp_opengraph_dimg'];
|
974 |
+
} else {
|
975 |
switch ( $this->options['aiosp_opengraph_defimg'] ) {
|
976 |
+
case 'featured' :
|
977 |
+
$thumbnail = $this->get_the_image_by_post_thumbnail();
|
978 |
+
break;
|
979 |
+
case 'attach' :
|
980 |
+
$thumbnail = $this->get_the_image_by_attachment();
|
981 |
+
break;
|
982 |
+
case 'content' :
|
983 |
+
$thumbnail = $this->get_the_image_by_scan();
|
984 |
+
break;
|
985 |
+
case 'custom' :
|
986 |
+
$meta_key = $this->options['aiosp_opengraph_meta_key'];
|
987 |
+
if ( ! empty( $meta_key ) && ! empty( $post ) ) {
|
988 |
+
$meta_key = explode( ',', $meta_key );
|
989 |
+
$thumbnail = $this->get_the_image_by_meta_key( Array(
|
990 |
+
'post_id' => $post->ID,
|
991 |
+
'meta_key' => $meta_key
|
992 |
+
) );
|
993 |
+
}
|
994 |
+
break;
|
995 |
+
case 'auto' :
|
996 |
+
$thumbnail = $this->get_the_image();
|
997 |
+
break;
|
998 |
+
case 'author' :
|
999 |
+
$thumbnail = $this->get_the_image_by_author();
|
1000 |
+
break;
|
1001 |
+
default :
|
1002 |
+
$thumbnail = $this->options['aiosp_opengraph_dimg'];
|
1003 |
}
|
1004 |
}
|
1005 |
}
|
1006 |
+
|
1007 |
+
if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) {
|
1008 |
$thumbnail = $this->options['aiosp_opengraph_dimg'];
|
1009 |
+
}
|
1010 |
|
1011 |
+
if ( ! empty( $thumbnail ) ) {
|
1012 |
+
$thumbnail = esc_url( $thumbnail );
|
1013 |
+
}
|
1014 |
|
1015 |
$width = $height = '';
|
1016 |
+
if ( ! empty( $thumbnail ) ) {
|
1017 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) {
|
1018 |
$width = $metabox['aioseop_opengraph_settings_imagewidth'];
|
1019 |
+
}
|
1020 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) {
|
1021 |
$height = $metabox['aioseop_opengraph_settings_imageheight'];
|
1022 |
+
}
|
1023 |
+
if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) {
|
1024 |
$width = $this->options['aiosp_opengraph_dimgwidth'];
|
1025 |
+
}
|
1026 |
+
if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) {
|
1027 |
$height = $this->options['aiosp_opengraph_dimgheight'];
|
1028 |
+
}
|
1029 |
}
|
1030 |
|
1031 |
+
if ( ! empty( $video ) ) {
|
1032 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) {
|
1033 |
$videowidth = $metabox['aioseop_opengraph_settings_videowidth'];
|
1034 |
+
}
|
1035 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) {
|
1036 |
+
$videoheight = $metabox['aioseop_opengraph_settings_videoheight'];
|
1037 |
+
}
|
1038 |
}
|
1039 |
|
1040 |
$card = 'summary';
|
1041 |
+
if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) {
|
1042 |
$card = $this->options['aiosp_opengraph_defcard'];
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) {
|
1046 |
$card = $metabox['aioseop_opengraph_settings_setcard'];
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
|
1050 |
//support for changing legacy twitter cardtype-photo to summary large image
|
1051 |
+
if ( $card == 'photo' ) {
|
1052 |
$card = 'summary_large_image';
|
1053 |
}
|
1054 |
|
1055 |
|
1056 |
$site = $domain = $creator = '';
|
1057 |
|
1058 |
+
if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) {
|
1059 |
$site = $this->options['aiosp_opengraph_twitter_site'];
|
1060 |
+
$site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site );
|
1061 |
+
}
|
1062 |
|
1063 |
+
if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
|
1064 |
$domain = $this->options['aiosp_opengraph_twitter_domain'];
|
1065 |
+
}
|
|
|
|
|
|
|
|
|
1066 |
|
1067 |
+
if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) {
|
1068 |
+
$creator = get_the_author_meta( 'twitter', $post->post_author );
|
1069 |
+
$creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator );
|
1070 |
+
}
|
1071 |
|
1072 |
$meta = Array(
|
1073 |
+
'facebook' => Array(
|
1074 |
+
'title' => 'og:title',
|
1075 |
+
'type' => 'og:type',
|
1076 |
+
'url' => 'og:url',
|
1077 |
+
'thumbnail' => 'og:image',
|
1078 |
+
'width' => 'og:image:width',
|
1079 |
+
'height' => 'og:image:height',
|
1080 |
+
'video' => 'og:video',
|
1081 |
+
'videowidth' => 'og:video:width',
|
1082 |
+
'videoheight' => 'og:video:height',
|
1083 |
+
'sitename' => 'og:site_name',
|
1084 |
+
'key' => 'fb:admins',
|
1085 |
+
'appid' => 'fb:app_id',
|
1086 |
+
'description' => 'og:description',
|
1087 |
+
'section' => 'article:section',
|
1088 |
+
'tag' => 'article:tag',
|
1089 |
+
'publisher' => 'article:publisher',
|
1090 |
+
'author' => 'article:author',
|
1091 |
+
'published_time' => 'article:published_time',
|
1092 |
+
'modified_time' => 'article:modified_time',
|
1093 |
+
),
|
1094 |
+
'twitter' => Array(
|
1095 |
+
'card' => 'twitter:card',
|
1096 |
+
'site' => 'twitter:site',
|
1097 |
+
'creator' => 'twitter:creator',
|
1098 |
+
'domain' => 'twitter:domain',
|
1099 |
+
'title' => 'twitter:title',
|
1100 |
+
'description' => 'twitter:description',
|
1101 |
+
'thumbnail' => 'twitter:image',
|
1102 |
+
),
|
1103 |
);
|
|
|
|
|
|
|
|
|
1104 |
|
1105 |
+
//Only show if "use schema.org markup is checked"
|
1106 |
+
if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
|
1107 |
+
$meta['google+'] = Array( 'thumbnail' => 'image' );
|
1108 |
+
}
|
1109 |
|
1110 |
|
|
|
1111 |
// Add links to testing tools
|
1112 |
+
|
1113 |
/*
|
1114 |
http://developers.facebook.com/tools/debug
|
1115 |
https://dev.twitter.com/docs/cards/preview
|
1137 |
'title' => 'twitter:title',
|
1138 |
'description' => 'twitter:description',
|
1139 |
'thumbnail' => 'twitter:image'
|
1140 |
+
|
1141 |
)
|
1142 |
);
|
1143 |
*/
|
1144 |
+
|
1145 |
$tags = Array(
|
1146 |
+
'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
|
1147 |
+
'twitter' => Array( 'name' => 'name', 'value' => 'content' ),
|
1148 |
+
'google+' => Array( 'name' => 'itemprop', 'value' => 'content' )
|
1149 |
);
|
1150 |
+
|
1151 |
+
foreach ( $meta as $t => $data ) {
|
1152 |
foreach ( $data as $k => $v ) {
|
1153 |
+
if ( empty( $$k ) ) {
|
1154 |
+
$$k = '';
|
1155 |
+
}
|
1156 |
$filtered_value = $$k;
|
1157 |
$filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k );
|
1158 |
+
if ( ! empty( $filtered_value ) ) {
|
1159 |
+
if ( ! is_array( $filtered_value ) ) {
|
1160 |
$filtered_value = Array( $filtered_value );
|
1161 |
+
}
|
1162 |
+
foreach ( $filtered_value as $f ) {
|
1163 |
+
echo '<meta ' . $tags[ $t ]['name'] . '="' . $v . '" ' . $tags[ $t ]['value'] . '="' . $f . '" />' . "\n";
|
1164 |
}
|
1165 |
}
|
1166 |
}
|
1167 |
+
}
|
1168 |
$social_link_schema = '';
|
1169 |
+
if ( ! empty( $social_links ) ) {
|
1170 |
+
$home_url = esc_url( get_home_url() );
|
1171 |
$social_links = explode( "\n", $social_links );
|
1172 |
+
foreach ( $social_links as $k => $v ) {
|
1173 |
$v = trim( $v );
|
1174 |
if ( empty( $v ) ) {
|
1175 |
+
unset( $social_links[ $k ] );
|
1176 |
} else {
|
1177 |
+
$v = esc_url( $v );
|
1178 |
+
$social_links[ $k ] = $v;
|
1179 |
}
|
1180 |
}
|
1181 |
+
$social_links = join( '","', $social_links );
|
1182 |
+
$social_link_schema = <<<END
|
1183 |
<script type="application/ld+json">
|
1184 |
{ "@context" : "http://schema.org",
|
1185 |
"@type" : "{$social_type}",
|
1193 |
}
|
1194 |
echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema );
|
1195 |
}
|
1196 |
+
|
1197 |
+
function do_opengraph() {
|
1198 |
global $aioseop_options;
|
1199 |
+
if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
|
1200 |
add_filter( 'language_attributes', Array( $this, 'add_attributes' ) );
|
1201 |
+
}
|
1202 |
+
if ( ! defined( 'DOING_AJAX' ) ) {
|
1203 |
+
add_action( 'aioseop_modules_wp_head', Array( $this, 'add_meta' ), 5 );
|
1204 |
+
}
|
1205 |
}
|
1206 |
+
|
1207 |
function type_setup() {
|
1208 |
global $aiosp, $wp_query;
|
1209 |
$this->type = '';
|
1210 |
if ( $aiosp->is_static_front_page() ) {
|
1211 |
+
if ( ! empty( $this->options ) && ! empty( $this->options['aiosp_opengraph_categories'] ) ) {
|
1212 |
$this->type = $this->options['aiosp_opengraph_categories'];
|
1213 |
+
}
|
1214 |
+
} elseif ( is_singular() && $this->option_isset( 'types' ) ) {
|
1215 |
+
$metabox = $this->get_current_options( Array(), 'settings' );
|
1216 |
$current_post_type = get_post_type();
|
1217 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) {
|
1218 |
$this->type = $metabox['aioseop_opengraph_settings_category'];
|
1219 |
} elseif ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
|
1220 |
$this->type = $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"];
|
1221 |
}
|
1222 |
}
|
1223 |
}
|
1224 |
+
|
1225 |
+
function debug_post_types() {
|
1226 |
add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 3 );
|
1227 |
add_filter( $this->prefix . 'override_options', Array( $this, 'override_options' ), 10, 3 );
|
1228 |
+
add_filter( $this->get_prefix( 'settings' ) . 'filter_metabox_options', Array(
|
1229 |
+
$this,
|
1230 |
+
'filter_metabox_options'
|
1231 |
+
), 10, 3 );
|
1232 |
+
$post_types = $this->get_post_type_titles();
|
1233 |
+
$rempost = array( 'revision' => 1, 'nav_menu_item' => 1 );
|
1234 |
+
$post_types = array_diff_key( $post_types, $rempost );
|
1235 |
+
$this->default_options['types']['initial_options'] = $post_types;
|
1236 |
+
foreach ( $post_types as $slug => $name ) {
|
1237 |
+
$field = $slug . '_fb_object_type';
|
1238 |
+
$this->default_options[ $field ] = Array(
|
1239 |
+
'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "<br />($slug)",
|
1240 |
+
'type' => 'select',
|
1241 |
+
'style' => '',
|
1242 |
+
'initial_options' => $this->fb_object_types,
|
1243 |
+
'default' => 'article',
|
1244 |
+
'condshow' => Array( 'aiosp_opengraph_types\[\]' => $slug )
|
1245 |
);
|
1246 |
+
$this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' );
|
1247 |
+
$this->help_anchors[ $field ] = '#content-object-types';
|
1248 |
$this->locations['opengraph']['options'][] = $field;
|
1249 |
+
$this->layout['facebook']['options'][] = $field;
|
1250 |
}
|
1251 |
$this->setting_options();
|
1252 |
$this->add_help_text_links();
|
1253 |
+
|
1254 |
}
|
1255 |
+
|
1256 |
function get_all_images( $options = null, $p = null ) {
|
1257 |
static $img = Array();
|
1258 |
+
if ( ! is_array( $options ) ) {
|
1259 |
+
$options = Array();
|
1260 |
+
}
|
1261 |
+
if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) {
|
1262 |
$options['meta_key'] = $this->options['aiosp_opengraph_meta_key'];
|
1263 |
+
}
|
1264 |
if ( empty( $img ) ) {
|
1265 |
+
$size = apply_filters( 'post_thumbnail_size', 'large' );
|
1266 |
$default = $this->get_the_image_by_default();
|
1267 |
+
if ( ! empty( $default ) ) {
|
1268 |
+
$img[ $default ] = 0;
|
1269 |
+
}
|
1270 |
$img = array_merge( $img, parent::get_all_images( $options, null ) );
|
1271 |
}
|
1272 |
|
1273 |
+
if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
|
1274 |
+
$img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg';
|
1275 |
}
|
1276 |
if ( $author_img = $this->get_the_image_by_author( $p ) ) {
|
1277 |
+
$image["author"] = $author_img;
|
1278 |
}
|
1279 |
+
$image = array_flip( $img );
|
1280 |
$images = Array();
|
1281 |
+
if ( ! empty( $image ) ) {
|
1282 |
+
foreach ( $image as $k => $v ) {
|
1283 |
+
$images[ $v ] = '<img height=150 src="' . $v . '">';
|
1284 |
+
}
|
1285 |
+
}
|
1286 |
+
|
1287 |
return Array( $image, $images );
|
1288 |
}
|
1289 |
+
|
1290 |
function get_the_image_by_author( $options = null, $p = null ) {
|
1291 |
if ( $p === null ) {
|
1292 |
global $post;
|
1293 |
} else {
|
1294 |
$post = $p;
|
1295 |
}
|
1296 |
+
if ( ! empty( $post ) && ! empty( $post->post_author ) ) {
|
1297 |
+
$matches = Array();
|
1298 |
$get_avatar = get_avatar( $post->post_author, 300 );
|
1299 |
+
if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) {
|
1300 |
return $matches[1];
|
1301 |
}
|
1302 |
}
|
1303 |
+
|
1304 |
return false;
|
1305 |
}
|
1306 |
+
|
1307 |
function get_the_image( $options = null, $p = null ) {
|
1308 |
$meta_key = $this->options['aiosp_opengraph_meta_key'];
|
1309 |
+
|
1310 |
return parent::get_the_image( Array( 'meta_key' => $meta_key ), $p );
|
1311 |
}
|
1312 |
+
|
1313 |
function get_the_image_by_default( $args = array() ) {
|
1314 |
return $this->options['aiosp_opengraph_dimg'];
|
1315 |
}
|
1316 |
+
|
1317 |
+
function settings_update() {
|
1318 |
+
|
1319 |
}
|
1320 |
}
|
1321 |
}
|
modules/aioseop_performance.php
CHANGED
@@ -1,224 +1,283 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
-
*/
|
5 |
/**
|
6 |
* The Performance class.
|
|
|
|
|
7 |
*/
|
8 |
-
|
|
|
|
|
9 |
class All_in_One_SEO_Pack_Performance extends All_in_One_SEO_Pack_Module {
|
10 |
|
11 |
-
protected $module_info =
|
12 |
|
13 |
function __construct( $mod ) {
|
14 |
-
$this->name
|
15 |
-
$this->prefix = 'aiosp_performance_';
|
16 |
-
$this->file
|
17 |
parent::__construct();
|
18 |
-
|
19 |
-
$this->help_text =
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
);
|
24 |
-
|
25 |
$this->default_options = array(
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
'
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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']
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
48 |
}
|
49 |
-
|
50 |
-
$this->layout =
|
51 |
-
'default' =>
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
);
|
57 |
-
|
58 |
-
$system_status =
|
59 |
-
|
60 |
);
|
61 |
-
|
62 |
-
$this->layout['system_status'] =
|
63 |
-
|
64 |
-
|
65 |
-
|
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',
|
73 |
-
add_filter( $this->prefix . 'update_options',
|
74 |
-
add_action( $this->prefix . 'settings_update',
|
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
|
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
|
104 |
$opts['aiosp_force_rewrites'] = $force_rewrites;
|
105 |
$aiosp->update_class_option( $opts );
|
106 |
wp_cache_flush();
|
107 |
}
|
108 |
-
}
|
109 |
}
|
110 |
}
|
111 |
-
|
112 |
function add_page_hooks() {
|
113 |
$memory_usage = memory_get_peak_usage() / 1024 / 1024;
|
114 |
if ( $memory_usage > 32 ) {
|
115 |
unset( $this->default_options['memory_limit']['initial_options']['32M'] );
|
116 |
-
if ( $memory_usage > 64 )
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
134 |
global $wp_version;
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
} else {
|
164 |
-
$
|
165 |
}
|
166 |
|
|
|
167 |
|
168 |
if ( function_exists( 'is_multisite' ) ) {
|
169 |
if ( is_multisite() ) {
|
170 |
-
$ms = __('Yes', 'all-in-one-seo-pack' );
|
171 |
} else {
|
172 |
-
$ms = __('No', 'all-in-one-seo-pack' );
|
173 |
}
|
174 |
|
175 |
-
} else
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
$
|
180 |
-
|
181 |
-
$
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
__('
|
198 |
-
__('
|
199 |
-
__('
|
200 |
-
__('
|
201 |
-
__('
|
202 |
-
__('
|
|
|
|
|
203 |
);
|
204 |
$debug_info['Active Plugins'] = null;
|
205 |
-
$active_plugins
|
206 |
-
$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
|
216 |
|
217 |
-
$mail_text = __(
|
218 |
-
$page_text =
|
219 |
-
if ( !empty( $debug_info ) )
|
220 |
-
foreach($debug_info as $name => $value) {
|
221 |
-
if ($value !== null) {
|
222 |
$page_text .= "<li><strong>$name</strong> $value</li>";
|
223 |
$mail_text .= "$name: $value\r\n";
|
224 |
} else {
|
@@ -226,40 +285,46 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
226 |
$mail_text .= "\r\n$name\r\n----------\r\n";
|
227 |
}
|
228 |
}
|
|
|
229 |
|
230 |
-
do
|
231 |
-
$
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
} else {
|
248 |
-
echo "<div class='sfwd_debug_error'>" .
|
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); //
|
254 |
-
$nonce = wp_create_nonce('sfwd-debug-nonce');
|
255 |
-
$buf
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
262 |
return $buf;
|
263 |
}
|
264 |
}
|
265 |
-
}
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/**
|
3 |
* The Performance class.
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
9 |
+
|
10 |
class All_in_One_SEO_Pack_Performance extends All_in_One_SEO_Pack_Module {
|
11 |
|
12 |
+
protected $module_info = array();
|
13 |
|
14 |
function __construct( $mod ) {
|
15 |
+
$this->name = __( 'Performance', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
|
16 |
+
$this->prefix = 'aiosp_performance_'; // Option prefix.
|
17 |
+
$this->file = __FILE__; // The current file.
|
18 |
parent::__construct();
|
19 |
+
|
20 |
+
$this->help_text = array(
|
21 |
+
'memory_limit' => __( 'This setting allows you to raise your PHP memory limit to a reasonable value. Note: WordPress core and other WordPress plugins may also change the value of the memory limit.', 'all-in-one-seo-pack' ),
|
22 |
+
'execution_time' => __( 'This setting allows you to raise your PHP execution time to a reasonable value.', 'all-in-one-seo-pack' ),
|
23 |
+
'force_rewrites' => __( 'Use output buffering to ensure that the title gets rewritten. Enable this option if you run into issues with the title tag being set by your theme or another plugin.', 'all-in-one-seo-pack' ),
|
24 |
);
|
25 |
+
|
26 |
$this->default_options = array(
|
27 |
+
'memory_limit' => array(
|
28 |
+
'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ),
|
29 |
+
'default' => '256M',
|
30 |
+
'type' => 'select',
|
31 |
+
'initial_options' => array(
|
32 |
+
0 => __( 'Use the system default', 'all-in-one-seo-pack' ),
|
33 |
+
'32M' => '32MB',
|
34 |
+
'64M' => '64MB',
|
35 |
+
'128M' => '128MB',
|
36 |
+
'256M' => '256MB',
|
37 |
+
),
|
38 |
+
),
|
39 |
+
'execution_time' => array(
|
40 |
+
'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ),
|
41 |
+
'default' => '',
|
42 |
+
'type' => 'select',
|
43 |
+
'initial_options' => array(
|
44 |
+
'' => __( 'Use the system default', 'all-in-one-seo-pack' ),
|
45 |
+
30 => '30s',
|
46 |
+
60 => '1m',
|
47 |
+
120 => '2m',
|
48 |
+
300 => '5m',
|
49 |
+
0 => __( 'No limit', 'all-in-one-seo-pack' ),
|
50 |
+
),
|
51 |
+
),
|
52 |
+
);
|
53 |
+
|
54 |
+
$this->help_anchors = array(
|
55 |
'memory_limit' => '#raise-memory-limit',
|
56 |
'execution_time' => '#raise-execution-time',
|
57 |
+
'force_rewrites' => '#force-rewrites',
|
58 |
);
|
59 |
+
|
60 |
global $aiosp, $aioseop_options;
|
61 |
if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) && $aioseop_options['aiosp_rewrite_titles'] ) {
|
62 |
+
$this->default_options['force_rewrites'] = array(
|
63 |
+
'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
|
64 |
+
'default' => 1,
|
65 |
+
'type' => 'radio',
|
66 |
+
'initial_options' => array(
|
67 |
+
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
68 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
69 |
+
),
|
70 |
+
);
|
71 |
}
|
72 |
+
|
73 |
+
$this->layout = array(
|
74 |
+
'default' => array(
|
75 |
+
'name' => $this->name,
|
76 |
+
'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
|
77 |
+
'options' => array_keys( $this->default_options ),
|
78 |
+
),
|
79 |
);
|
80 |
+
|
81 |
+
$system_status = array(
|
82 |
+
'status' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
|
83 |
);
|
84 |
+
|
85 |
+
$this->layout['system_status'] = array(
|
86 |
+
'name' => __( 'System Status', 'all-in-one-seo-pack' ),
|
87 |
+
'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
|
88 |
+
'options' => array_keys( $system_status ),
|
89 |
+
);
|
90 |
+
|
91 |
$this->default_options = array_merge( $this->default_options, $system_status );
|
92 |
+
|
93 |
$this->add_help_text_links();
|
94 |
+
|
95 |
+
add_filter( $this->prefix . 'display_options', array( $this, 'display_options_filter' ), 10, 2 );
|
96 |
+
add_filter( $this->prefix . 'update_options', array( $this, 'update_options_filter' ), 10, 2 );
|
97 |
+
add_action( $this->prefix . 'settings_update', array( $this, 'settings_update_action' ), 10, 2 );
|
98 |
}
|
99 |
+
|
100 |
function update_options_filter( $options, $location ) {
|
101 |
+
if ( $location == null && isset( $options[ $this->prefix . 'force_rewrites' ] ) ) {
|
|
|
102 |
unset( $options[ $this->prefix . 'force_rewrites' ] );
|
103 |
}
|
104 |
+
|
105 |
return $options;
|
106 |
}
|
107 |
+
|
108 |
function display_options_filter( $options, $location ) {
|
109 |
if ( $location == null ) {
|
110 |
$options[ $this->prefix . 'force_rewrites' ] = 1;
|
111 |
global $aiosp;
|
112 |
if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) ) {
|
113 |
+
$opts = $aiosp->get_current_options( array(), null );
|
114 |
$options[ $this->prefix . 'force_rewrites' ] = $opts['aiosp_force_rewrites'];
|
115 |
}
|
116 |
}
|
117 |
+
|
118 |
return $options;
|
119 |
}
|
120 |
+
|
121 |
function settings_update_action( $options, $location ) {
|
122 |
+
if ( $location == null && isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) {
|
|
|
123 |
$force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ];
|
124 |
if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) {
|
125 |
global $aiosp;
|
126 |
+
$opts = $aiosp->get_current_options( array(), null );
|
127 |
$opts['aiosp_force_rewrites'] = $force_rewrites;
|
128 |
$aiosp->update_class_option( $opts );
|
129 |
wp_cache_flush();
|
130 |
}
|
|
|
131 |
}
|
132 |
}
|
133 |
+
|
134 |
function add_page_hooks() {
|
135 |
$memory_usage = memory_get_peak_usage() / 1024 / 1024;
|
136 |
if ( $memory_usage > 32 ) {
|
137 |
unset( $this->default_options['memory_limit']['initial_options']['32M'] );
|
138 |
+
if ( $memory_usage > 64 ) {
|
139 |
+
unset( $this->default_options['memory_limit']['initial_options']['64M'] );
|
140 |
+
}
|
141 |
+
if ( $memory_usage > 128 ) {
|
142 |
+
unset( $this->default_options['memory_limit']['initial_options']['128M'] );
|
143 |
+
}
|
144 |
+
if ( $memory_usage > 256 ) {
|
145 |
+
unset( $this->default_options['memory_limit']['initial_options']['256M'] );
|
146 |
+
}
|
147 |
}
|
148 |
$this->update_options();
|
149 |
parent::add_page_hooks();
|
150 |
}
|
151 |
+
|
152 |
function settings_page_init() {
|
153 |
$this->default_options['status']['default'] = $this->get_serverinfo();
|
154 |
}
|
155 |
+
|
156 |
function menu_order() {
|
157 |
return 7;
|
158 |
}
|
159 |
+
|
160 |
function get_serverinfo() {
|
161 |
+
global $wpdb;
|
162 |
global $wp_version;
|
163 |
|
164 |
+
$sqlversion = $wpdb->get_var( "SELECT VERSION() AS version" );
|
165 |
+
$mysqlinfo = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
|
166 |
+
if ( is_array( $mysqlinfo ) ) {
|
167 |
+
$sql_mode = $mysqlinfo[0]->Value;
|
168 |
+
}
|
169 |
+
if ( empty( $sql_mode ) ) {
|
170 |
+
$sql_mode = __( 'Not set', 'all-in-one-seo-pack' );
|
171 |
+
}
|
172 |
+
if ( ini_get( 'safe_mode' ) ) {
|
173 |
+
$safe_mode = __( 'On', 'all-in-one-seo-pack' );
|
174 |
+
} else {
|
175 |
+
$safe_mode = __( 'Off', 'all-in-one-seo-pack' );
|
176 |
+
}
|
177 |
+
if ( ini_get( 'allow_url_fopen' ) ) {
|
178 |
+
$allow_url_fopen = __( 'On', 'all-in-one-seo-pack' );
|
179 |
+
} else {
|
180 |
+
$allow_url_fopen = __( 'Off', 'all-in-one-seo-pack' );
|
181 |
+
}
|
182 |
+
if ( ini_get( 'upload_max_filesize' ) ) {
|
183 |
+
$upload_max = ini_get( 'upload_max_filesize' );
|
184 |
+
} else {
|
185 |
+
$upload_max = __( 'N/A', 'all-in-one-seo-pack' );
|
186 |
+
}
|
187 |
+
if ( ini_get( 'post_max_size' ) ) {
|
188 |
+
$post_max = ini_get( 'post_max_size' );
|
189 |
+
} else {
|
190 |
+
$post_max = __( 'N/A', 'all-in-one-seo-pack' );
|
191 |
+
}
|
192 |
+
if ( ini_get( 'max_execution_time' ) ) {
|
193 |
+
$max_execute = ini_get( 'max_execution_time' );
|
194 |
+
} else {
|
195 |
+
$max_execute = __( 'N/A', 'all-in-one-seo-pack' );
|
196 |
+
}
|
197 |
+
if ( ini_get( 'memory_limit' ) ) {
|
198 |
+
$memory_limit = ini_get( 'memory_limit' );
|
199 |
+
} else {
|
200 |
+
$memory_limit = __( 'N/A', 'all-in-one-seo-pack' );
|
201 |
+
}
|
202 |
+
if ( function_exists( 'memory_get_usage' ) ) {
|
203 |
+
$memory_usage = round( memory_get_usage() / 1024 / 1024, 2 ) . __( ' MByte', 'all-in-one-seo-pack' );
|
204 |
+
} else {
|
205 |
+
$memory_usage = __( 'N/A', 'all-in-one-seo-pack' );
|
206 |
+
}
|
207 |
+
if ( is_callable( 'exif_read_data' ) ) {
|
208 |
+
$exif = __( 'Yes', 'all-in-one-seo-pack' ) . ' ( V' . $this->substr( phpversion( 'exif' ), 0, 4 ) . ')';
|
209 |
+
} else {
|
210 |
+
$exif = __( 'No', 'all-in-one-seo-pack' );
|
211 |
+
}
|
212 |
+
if ( is_callable( 'iptcparse' ) ) {
|
213 |
+
$iptc = __( 'Yes', 'all-in-one-seo-pack' );
|
214 |
+
} else {
|
215 |
+
$iptc = __( 'No', 'all-in-one-seo-pack' );
|
216 |
+
}
|
217 |
+
if ( is_callable( 'xml_parser_create' ) ) {
|
218 |
+
$xml = __( 'Yes', 'all-in-one-seo-pack' );
|
219 |
} else {
|
220 |
+
$xml = __( 'No', 'all-in-one-seo-pack' );
|
221 |
}
|
222 |
|
223 |
+
$theme = wp_get_theme();
|
224 |
|
225 |
if ( function_exists( 'is_multisite' ) ) {
|
226 |
if ( is_multisite() ) {
|
227 |
+
$ms = __( 'Yes', 'all-in-one-seo-pack' );
|
228 |
} else {
|
229 |
+
$ms = __( 'No', 'all-in-one-seo-pack' );
|
230 |
}
|
231 |
|
232 |
+
} else {
|
233 |
+
$ms = __( 'N/A', 'all-in-one-seo-pack' );
|
234 |
+
}
|
235 |
+
|
236 |
+
$siteurl = get_option( 'siteurl' );
|
237 |
+
$homeurl = get_option( 'home' );
|
238 |
+
$db_version = get_option( 'db_version' );
|
239 |
+
|
240 |
+
$debug_info = array(
|
241 |
+
__( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
|
242 |
+
__( 'Server', 'all-in-one-seo-pack' ) => $_SERVER['SERVER_SOFTWARE'],
|
243 |
+
__( 'Memory usage', 'all-in-one-seo-pack' ) => $memory_usage,
|
244 |
+
__( 'MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion,
|
245 |
+
__( 'SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode,
|
246 |
+
__( 'PHP Version', 'all-in-one-seo-pack' ) => PHP_VERSION,
|
247 |
+
__( 'PHP Safe Mode', 'all-in-one-seo-pack' ) => $safe_mode,
|
248 |
+
__( 'PHP Allow URL fopen', 'all-in-one-seo-pack' ) => $allow_url_fopen,
|
249 |
+
__( 'PHP Memory Limit', 'all-in-one-seo-pack' ) => $memory_limit,
|
250 |
+
__( 'PHP Max Upload Size', 'all-in-one-seo-pack' ) => $upload_max,
|
251 |
+
__( 'PHP Max Post Size', 'all-in-one-seo-pack' ) => $post_max,
|
252 |
+
__( 'PHP Max Script Execute Time', 'all-in-one-seo-pack' ) => $max_execute,
|
253 |
+
__( 'PHP Exif support', 'all-in-one-seo-pack' ) => $exif,
|
254 |
+
__( 'PHP IPTC support', 'all-in-one-seo-pack' ) => $iptc,
|
255 |
+
__( 'PHP XML support', 'all-in-one-seo-pack' ) => $xml,
|
256 |
+
__( 'Site URL', 'all-in-one-seo-pack' ) => $siteurl,
|
257 |
+
__( 'Home URL', 'all-in-one-seo-pack' ) => $homeurl,
|
258 |
+
__( 'WordPress Version', 'all-in-one-seo-pack' ) => $wp_version,
|
259 |
+
__( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
|
260 |
+
__( 'Multisite', 'all-in-one-seo-pack' ) => $ms,
|
261 |
+
__( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version'],
|
262 |
);
|
263 |
$debug_info['Active Plugins'] = null;
|
264 |
+
$active_plugins = $inactive_plugins = array();
|
265 |
+
$plugins = get_plugins();
|
266 |
+
foreach ( $plugins as $path => $plugin ) {
|
267 |
if ( is_plugin_active( $path ) ) {
|
268 |
+
$debug_info[ $plugin['Name'] ] = $plugin['Version'];
|
269 |
} else {
|
270 |
+
$inactive_plugins[ $plugin['Name'] ] = $plugin['Version'];
|
271 |
}
|
272 |
}
|
273 |
$debug_info['Inactive Plugins'] = null;
|
274 |
+
$debug_info = array_merge( $debug_info, (array) $inactive_plugins );
|
275 |
|
276 |
+
$mail_text = __( 'All in One SEO Pack Pro Debug Info', 'all-in-one-seo-pack' ) . "\r\n------------------\r\n\r\n";
|
277 |
+
$page_text = '';
|
278 |
+
if ( ! empty( $debug_info ) ) {
|
279 |
+
foreach ( $debug_info as $name => $value ) {
|
280 |
+
if ( $value !== null ) {
|
281 |
$page_text .= "<li><strong>$name</strong> $value</li>";
|
282 |
$mail_text .= "$name: $value\r\n";
|
283 |
} else {
|
285 |
$mail_text .= "\r\n$name\r\n----------\r\n";
|
286 |
}
|
287 |
}
|
288 |
+
}
|
289 |
|
290 |
+
do {
|
291 |
+
if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) || ! empty( $_REQUEST['sfwd_update_check'] ) ) {
|
292 |
+
$nonce = $_REQUEST['sfwd_debug_nonce'];
|
293 |
+
if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) {
|
294 |
+
echo "<div class='sfwd_debug_error'>" . __( 'Form submission error: verification check failed.', 'all-in-one-seo-pack' ) . '</div>';
|
295 |
+
break;
|
296 |
+
}
|
297 |
+
if ( $_REQUEST['sfwd_update_check'] ) {
|
298 |
+
global $aioseop_update_checker;
|
299 |
+
$aioseop_update_checker->checkForUpdates();
|
300 |
+
echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( '%s has checked for updates.', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ) . '</div>';
|
301 |
+
break;
|
302 |
+
}
|
303 |
+
$email = '';
|
304 |
+
if ( ! empty( $_REQUEST['sfwd_debug_send_email'] ) ) {
|
305 |
+
$email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] );
|
306 |
+
}
|
307 |
+
if ( $email ) {
|
308 |
+
if ( wp_mail( $email, sprintf( __( 'SFWD Debug Mail From Site %s.', 'all-in-one-seo-pack' ), $siteurl ), $mail_text ) ) {
|
309 |
+
echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( 'Sent to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
|
310 |
+
} else {
|
311 |
+
echo "<div class='sfwd_debug_error'>" . sprintf( __( 'Failed to send to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
|
312 |
+
}
|
313 |
} else {
|
314 |
+
echo "<div class='sfwd_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . '</div>';
|
315 |
}
|
|
|
|
|
316 |
}
|
317 |
+
} while ( 0 ); // Control structure for use with break.
|
318 |
+
$nonce = wp_create_nonce( 'sfwd-debug-nonce' );
|
319 |
+
$buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n<p>\n" .
|
320 |
+
'<input name="sfwd_debug_send_email" type="text" value="" placeholder="' . __( 'E-mail debug information', 'all-in-one-seo-pack' ) . '"><input name="sfwd_debug_nonce" type="hidden" value="' .
|
321 |
+
$nonce . '"><input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
|
322 |
+
|
323 |
+
if ( AIOSEOPPRO ) {
|
324 |
+
$buf .= '<p><input name="sfwd_update_check" type="submit" value="' . __( 'Check For Updates', 'all-in-one-seo-pack' ) . '" class="button-primary">';
|
325 |
+
}
|
326 |
+
|
327 |
return $buf;
|
328 |
}
|
329 |
}
|
330 |
+
}
|
modules/aioseop_robots.php
CHANGED
@@ -1,83 +1,166 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
*/
|
5 |
/**
|
6 |
* The Robots class.
|
7 |
*/
|
8 |
-
if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
9 |
class All_in_One_SEO_Pack_Robots extends All_in_One_SEO_Pack_Module {
|
10 |
|
11 |
-
function __construct(
|
12 |
-
$this->name
|
13 |
-
$this->prefix = 'aiosp_robots_';
|
14 |
-
$this->file
|
15 |
parent::__construct();
|
16 |
-
|
17 |
$help_text = Array(
|
18 |
-
'additional'=> __('Rule Type', 'all-in-one-seo-pack'),
|
19 |
-
'useragent'
|
20 |
-
'path'
|
21 |
-
'robotgen'
|
22 |
);
|
23 |
-
|
24 |
$this->default_options = array(
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
'
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
'
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
'
|
41 |
-
|
42 |
-
|
43 |
-
'
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
'
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
)
|
64 |
-
)
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
if ( isset( $_POST['Submit_Optimize'] ) ) {
|
70 |
-
$this->layout['optimize']['options']
|
|
|
|
|
|
|
|
|
|
|
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',
|
78 |
-
add_filter( $this->prefix . 'display_options',
|
79 |
-
add_filter( $this->prefix . 'submit_options',
|
80 |
-
add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 2 );
|
81 |
}
|
82 |
|
83 |
function filter_settings( $settings, $location ) {
|
@@ -85,93 +168,149 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
85 |
$prefix = $this->get_prefix( $location ) . $location . '_';
|
86 |
if ( isset( $_POST['Submit_Optimize'] ) ) {
|
87 |
if ( isset( $settings[ $prefix . 'robotgen' ] ) ) {
|
88 |
-
$settings[ $prefix . 'robotgen' ]['type']
|
89 |
-
$settings[ $prefix . 'robotgen' ]['label']
|
90 |
$settings[ $prefix . 'robotgen' ]['help_text'] = '';
|
91 |
-
$settings[ $prefix . 'robothtml']
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 )
|
|
|
|
|
109 |
if ( $location === 'generator' ) {
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
}
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
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 |
-
|
137 |
-
|
138 |
-
if (
|
139 |
-
|
140 |
-
$ad = "Allow: ";
|
141 |
-
else
|
142 |
-
$ad = "Disallow: ";
|
143 |
-
$options[$prefix . 'robotgen'] .= "User-agent: $ua\n$ad $dp\n\n";
|
144 |
}
|
145 |
-
$
|
146 |
-
|
147 |
-
|
148 |
-
$
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
$
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
162 |
} else {
|
163 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
|
|
166 |
return $options;
|
167 |
}
|
168 |
|
169 |
function do_robots( $options, $location ) {
|
170 |
-
if ( $location )
|
|
|
|
|
171 |
if ( $location === 'generator' ) {
|
172 |
if ( isset( $_POST['Submit_Update'] ) || isset( $_POST['Submit_Opt_Update'] ) ) {
|
173 |
$this->save_files( Array( 'robotgen' => 'robots.txt' ), $prefix );
|
174 |
-
} elseif (isset( $_POST['Submit_Delete'] ) ) {
|
175 |
$this->delete_files( Array( 'robotgen' => 'robots.txt' ) );
|
176 |
}
|
177 |
}
|
@@ -179,9 +318,9 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
179 |
|
180 |
function annotate_robots_html( $file, $show_help = false, $title = '' ) {
|
181 |
$robots = $this->annotate_robots( $file );
|
182 |
-
if( !empty( $robots ) ){
|
183 |
$buf = '<table class="widefat" ><thead>';
|
184 |
-
if ( !empty( $title ) ) {
|
185 |
$buf .= "<tr><th colspan=3>" . $title . "</th></tr>";
|
186 |
}
|
187 |
$buf .= '<tr class="aioseop_optimize_thread">';
|
@@ -190,21 +329,21 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
190 |
$buf .= "<tbody>";
|
191 |
|
192 |
foreach ( $robots as $r ) {
|
193 |
-
$class
|
194 |
$status = "#9cf975";
|
195 |
-
$help
|
196 |
-
if (
|
197 |
-
if (
|
198 |
$class .= ' quirks';
|
199 |
-
$status="yellow";
|
200 |
}
|
201 |
-
if (
|
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 |
-
|
208 |
}
|
209 |
}
|
210 |
$buf .= "<tr class='entry-row {$class}'><td>{$help}</td><td><span class='entry_label'>{$r['content']}</td><td><div style='background:{$status};'></div></td></tr>";
|
@@ -212,184 +351,289 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
212 |
$buf .= '</tbody>';
|
213 |
|
214 |
$buf .= '</table>';
|
215 |
-
if ( $show_help ) {
|
216 |
$buf .= '<div class="aioseop_option_docs" id="aiosp_robots_main_legend_tip">
|
217 |
<h3>' . __( 'Legend', 'all-in-one-seo-pack' ) . '</h3>
|
218 |
<ul>
|
219 |
<li>' . __( 'The yellow indicator means that a non-standard extension was recognized; not all crawlers may recognize it or interpret it the same way. The Allow and Sitemap directives are commonly used by Google and Yahoo.', 'all-in-one-seo-pack' ) . '</li>
|
220 |
-
<li>' . __( 'The red indicator means that the syntax is invalid for a robots.txt file.', 'all-in-one-seo-pack') . '</li>
|
221 |
</ul>
|
222 |
-
<a target="_blank" rel="nofollow" href="http://wikipedia.org/wiki/Robots_exclusion_standard#Nonstandard_extensions">' . __('More Information', 'all-in-one-seo-pack') . '</a>
|
223 |
</div>';
|
224 |
}
|
225 |
} else {
|
226 |
$buf = '<p class="aioseop_error_notice" ><strong>Your Robots.txt file is either empty, cannot be found, or has invalid data.</strong></p>';
|
227 |
}
|
|
|
228 |
return $buf;
|
229 |
}
|
230 |
|
231 |
function annotate_robots( $robots ) {
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
$state
|
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 |
-
|
|
|
|
|
275 |
}
|
276 |
|
277 |
function parse_annotated_robots( $robots ) {
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
$
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
291 |
}
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
break;
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
$rule['user-agent'][] = $ua;
|
308 |
break;
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
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 |
-
|
327 |
-
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
}
|
330 |
-
|
331 |
function parse_robots( $robots ) {
|
332 |
-
return $this->parse_annotated_robots
|
333 |
}
|
334 |
|
335 |
-
function get_robot_user_agents($rules) {
|
336 |
-
$opts
|
337 |
$user_agents = Array();
|
338 |
-
foreach ($rules as $r) {
|
339 |
-
if ( !empty( $r['sitemap'] ) && empty( $r['user-agent'] ) )
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
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[]
|
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 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
|
|
|
|
378 |
}
|
|
|
379 |
return $dis;
|
380 |
}
|
381 |
|
382 |
-
function output_robots($rules) {
|
383 |
$robots = '';
|
384 |
-
foreach ($rules as $r) {
|
385 |
-
foreach ( $r['comment']
|
386 |
-
|
387 |
-
|
388 |
-
foreach ( $r['
|
389 |
-
|
390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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' ) . ' »',
|
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' ) . ' »',
|
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' ) . ' »',
|
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' ) . ' »',
|
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' ) . ' »',
|
92 |
+
'nowrap' => 1
|
93 |
+
),
|
94 |
+
'Submit_Optimize' => Array(
|
95 |
+
'type' => 'submit',
|
96 |
+
'class' => 'button-primary',
|
97 |
+
'name' => __( 'Optimize', 'all-in-one-seo-pack' ) . ' »'
|
98 |
+
)
|
99 |
+
);
|
100 |
+
|
101 |
+
if ( ! empty( $help_text ) ) {
|
102 |
+
foreach ( $help_text as $k => $v ) {
|
103 |
+
$this->default_options[ $k ]['help_text'] = $v;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->locations = array(
|
108 |
+
'generator' => Array(
|
109 |
+
'name' => "Robots.txt",
|
110 |
+
'type' => 'settings',
|
111 |
+
'options' => Array(
|
112 |
+
'usage',
|
113 |
+
'additional',
|
114 |
+
'useragent',
|
115 |
+
'path',
|
116 |
+
'Submit_Preview',
|
117 |
+
'Submit_Update',
|
118 |
+
'Submit_Delete',
|
119 |
+
'robotgen',
|
120 |
+
'optusage',
|
121 |
+
'Submit_Opt_Update',
|
122 |
+
'Submit_Opt_Preview',
|
123 |
+
'Submit_Optimize'
|
124 |
)
|
125 |
+
),
|
126 |
+
);
|
127 |
+
|
128 |
+
$this->layout = Array(
|
129 |
+
'default' => Array(
|
130 |
+
'name' => __( 'Create a Robots.txt File', 'all-in-one-seo-pack' ),
|
131 |
+
'options' => Array(
|
132 |
+
'usage',
|
133 |
+
'additional',
|
134 |
+
'useragent',
|
135 |
+
'path',
|
136 |
+
'Submit_Preview',
|
137 |
+
'Submit_Update',
|
138 |
+
'Submit_Delete',
|
139 |
+
'robotgen'
|
140 |
+
) // this is set below, to the remaining options -- pdb
|
141 |
+
)
|
142 |
+
);
|
143 |
+
$this->layout['optimize'] = Array(
|
144 |
+
'name' => __( 'Optimize your Robots.txt File', 'all-in-one-seo-pack' ),
|
145 |
+
'options' => Array( 'optusage', 'Submit_Optimize' )
|
146 |
+
);
|
147 |
if ( isset( $_POST['Submit_Optimize'] ) ) {
|
148 |
+
$this->layout['optimize']['options'] = Array(
|
149 |
+
'optusage',
|
150 |
+
'Submit_Opt_Update',
|
151 |
+
'Submit_Opt_Preview',
|
152 |
+
'robothtml'
|
153 |
+
);
|
154 |
$this->default_options['optusage']['default'] = __( "Your Robots.txt file has been optimized. Here are the results and recommendations. Click the Update Robots.txt File button below to write these changes to your Robots.txt file. Click the Disregard Changes button to ignore these recommendations and keep your current Robots.txt file.", 'all-in-one-seo-pack' );
|
155 |
}
|
156 |
+
|
157 |
// load initial options / set defaults
|
158 |
+
$this->update_options();
|
159 |
+
|
160 |
+
add_action( $this->prefix . 'settings_update', Array( $this, 'do_robots' ), 10, 2 );
|
161 |
+
add_filter( $this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 );
|
162 |
+
add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 );
|
163 |
+
add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 2 );
|
164 |
}
|
165 |
|
166 |
function filter_settings( $settings, $location ) {
|
168 |
$prefix = $this->get_prefix( $location ) . $location . '_';
|
169 |
if ( isset( $_POST['Submit_Optimize'] ) ) {
|
170 |
if ( isset( $settings[ $prefix . 'robotgen' ] ) ) {
|
171 |
+
$settings[ $prefix . 'robotgen' ]['type'] = 'hidden';
|
172 |
+
$settings[ $prefix . 'robotgen' ]['label'] = 'none';
|
173 |
$settings[ $prefix . 'robotgen' ]['help_text'] = '';
|
174 |
+
$settings[ $prefix . 'robothtml' ] = Array(
|
175 |
+
'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
|
176 |
+
'save' => false,
|
177 |
+
'default' => '',
|
178 |
+
'type' => 'html',
|
179 |
+
'label' => 'none',
|
180 |
+
'style' => 'margin-top:10px;'
|
181 |
+
);
|
182 |
}
|
183 |
}
|
184 |
}
|
185 |
+
|
186 |
return $settings;
|
187 |
}
|
188 |
+
|
189 |
function filter_submit( $submit, $location ) {
|
190 |
if ( $location == 'generator' ) {
|
191 |
unset( $submit['Submit_Default'] );
|
192 |
$submit['Submit']['type'] = 'hidden';
|
193 |
}
|
194 |
+
|
195 |
return $submit;
|
196 |
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Returns the sitemap filename;
|
200 |
+
* @return bool
|
201 |
+
*/
|
202 |
+
function get_sitemap_filename(){
|
203 |
+
|
204 |
+
global $aioseop_options;
|
205 |
+
if ( isset( $aioseop_options[ 'modules' ][ 'aiosp_sitemap_options' ][ 'aiosp_sitemap_filename' ] ) ){
|
206 |
+
return $aioseop_options[ 'modules' ][ 'aiosp_sitemap_options' ][ 'aiosp_sitemap_filename' ];
|
207 |
+
}
|
208 |
+
return FALSE;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Filters the options.
|
213 |
+
*
|
214 |
+
* @todo Much of this couldn't be considered filtering options, and should be extracted to other functions.
|
215 |
+
* @since ??
|
216 |
+
* @since 2.3.6
|
217 |
+
*/
|
218 |
function filter_options( $options, $location ) {
|
219 |
+
if ( $location ) {
|
220 |
+
$prefix = $this->get_prefix( $location ) . $location . '_';
|
221 |
+
}
|
222 |
if ( $location === 'generator' ) {
|
223 |
+
$optimize = false;
|
224 |
+
$robotgen = '';
|
225 |
+
if ( ! empty( $_POST[ $prefix . 'robotgen' ] ) ) {
|
226 |
+
$robotgen = str_replace( "\r\n", "\n", $_POST[ $prefix . 'robotgen' ] );
|
227 |
+
}
|
228 |
+
if ( isset( $_POST['Submit_Preview'] ) ) {
|
229 |
+
$options[ $prefix . 'robotgen' ] = $robotgen;
|
230 |
+
}
|
231 |
+
if ( ! isset( $_POST['Submit_Preview'] ) ) {
|
232 |
+
if ( isset( $_POST['Submit_Optimize'] ) && ! isset( $_POST['Submit_Delete'] ) && ! isset( $_POST['Submit_Update'] ) && ! isset( $_POST['Submit_Opt_Update'] ) ) {
|
233 |
+
$optimize = true;
|
234 |
+
}
|
235 |
+
if ( ! isset( $options[ $prefix . 'robotgen' ] ) || empty( $options[ $prefix . 'robotgen' ] ) ) {
|
236 |
+
if ( $optimize ) {
|
237 |
+
$options[ $prefix . 'robotgen' ] = $robotgen;
|
238 |
+
}
|
239 |
+
if ( empty( $options[ $prefix . 'robotgen' ] ) ) {
|
240 |
+
$options = $this->load_files( $options, Array( 'robotgen' => 'robots.txt' ), $prefix );
|
241 |
}
|
242 |
}
|
243 |
+
}
|
244 |
+
$access = ( get_option( 'blog_public' ) ) ? 'allow' : 'block';
|
245 |
+
if ( $access ) {
|
246 |
+
global $aioseop_options;
|
247 |
+
$sitemap_url = '';
|
248 |
+
$sitemap_filename = $this->get_sitemap_filename();
|
249 |
+
if( $sitemap_filename ){
|
250 |
+
$sitemapurl = trailingslashit( get_home_url() ) . $sitemap_filename . '.xml';
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
+
$allow_rule = "Sitemap: $sitemapurl \n\n# global\nUser-agent: *\nDisallow: /xmlrpc.php\n\n";
|
253 |
+
$block_rule = "# global\nUser-agent: *\nDisallow: /\n\n";
|
254 |
+
if ( empty( $options[ $prefix . 'robotgen' ] ) ) {
|
255 |
+
$options[ $prefix . 'robotgen' ] = '';
|
|
|
|
|
|
|
|
|
256 |
}
|
257 |
+
if ( isset( $_POST['Submit_Preview'] ) && ( ( $options[ $prefix . 'robotgen' ] == $allow_rule ) ||
|
258 |
+
( $options[ $prefix . 'robotgen' ] == $block_rule ) )
|
259 |
+
) {
|
260 |
+
$options[ $prefix . 'robotgen' ] = '';
|
261 |
+
}
|
262 |
+
if ( $access === 'block' && empty( $options[ $prefix . 'robotgen' ] ) ) {
|
263 |
+
$options[ $prefix . 'robotgen' ] .= $block_rule;
|
264 |
+
} elseif ( $access === 'allow' && empty( $options[ $prefix . 'robotgen' ] ) ) {
|
265 |
+
$options[ $prefix . 'robotgen' ] .= $allow_rule;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
foreach ( Array( 'ad' => 'additional', 'ua' => 'useragent', 'dp' => 'path' ) as $k => $v ) {
|
269 |
+
if ( isset( $_POST[ $prefix . $v ] ) ) {
|
270 |
+
$$k = $_POST[ $prefix . $v ];
|
271 |
+
}
|
272 |
+
}
|
273 |
+
if ( ! empty( $ad ) && ! empty( $ua ) && ! empty( $dp ) ) {
|
274 |
+
if ( $ad === 'allow' ) {
|
275 |
+
$ad = "Allow: ";
|
276 |
} else {
|
277 |
+
$ad = "Disallow: ";
|
278 |
+
}
|
279 |
+
$options[ $prefix . 'robotgen' ] .= "User-agent: $ua\n$ad $dp\n\n";
|
280 |
+
}
|
281 |
+
$file = explode( "\n", $options[ $prefix . 'robotgen' ] );
|
282 |
+
if ( $optimize ) {
|
283 |
+
$rules = $this->parse_robots( $file );
|
284 |
+
$user_agents = $this->get_robot_user_agents( $rules );
|
285 |
+
foreach ( $user_agents as $ua => $rules ) {
|
286 |
+
$user_agents[ $ua ]['disallow'] = $this->opt_robot_rule( $rules['disallow'] );
|
287 |
+
$user_agents[ $ua ]['allow'] = $this->opt_robot_rule( $rules['allow'] );
|
288 |
}
|
289 |
+
$rules = $this->flatten_user_agents( $user_agents );
|
290 |
+
unset( $user_agents );
|
291 |
+
foreach ( $rules as $r ) {
|
292 |
+
$r['disallow'] = $this->opt_robot_rule( $r['disallow'] );
|
293 |
+
$r['allow'] = $this->opt_robot_rule( $r['allow'] );
|
294 |
+
}
|
295 |
+
$options[ $prefix . 'robotgen' ] = $this->output_robots( $rules );
|
296 |
+
$file2 = explode( "\n", $options[ $prefix . 'robotgen' ] );
|
297 |
+
$options[ $prefix . 'robothtml' ] = '<table width=100%><tr><td valign=top width=45%>' . $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) ) . '</td><td><span style="font-size: xx-large">→</span></td><td valign=top>' . $this->annotate_robots_html( $file2, true, __( "Proposed Changes", 'all-in-one-seo-pack' ) ) . '</td></tr></table>';
|
298 |
+
} else {
|
299 |
+
$options[ $prefix . 'robothtml' ] = $this->annotate_robots_html( $file, true, __( "Current File", 'all-in-one-seo-pack' ) );
|
300 |
+
}
|
301 |
}
|
302 |
+
|
303 |
return $options;
|
304 |
}
|
305 |
|
306 |
function do_robots( $options, $location ) {
|
307 |
+
if ( $location ) {
|
308 |
+
$prefix = $this->get_prefix( $location ) . $location . '_';
|
309 |
+
}
|
310 |
if ( $location === 'generator' ) {
|
311 |
if ( isset( $_POST['Submit_Update'] ) || isset( $_POST['Submit_Opt_Update'] ) ) {
|
312 |
$this->save_files( Array( 'robotgen' => 'robots.txt' ), $prefix );
|
313 |
+
} elseif ( isset( $_POST['Submit_Delete'] ) ) {
|
314 |
$this->delete_files( Array( 'robotgen' => 'robots.txt' ) );
|
315 |
}
|
316 |
}
|
318 |
|
319 |
function annotate_robots_html( $file, $show_help = false, $title = '' ) {
|
320 |
$robots = $this->annotate_robots( $file );
|
321 |
+
if ( ! empty( $robots ) ) {
|
322 |
$buf = '<table class="widefat" ><thead>';
|
323 |
+
if ( ! empty( $title ) ) {
|
324 |
$buf .= "<tr><th colspan=3>" . $title . "</th></tr>";
|
325 |
}
|
326 |
$buf .= '<tr class="aioseop_optimize_thread">';
|
329 |
$buf .= "<tbody>";
|
330 |
|
331 |
foreach ( $robots as $r ) {
|
332 |
+
$class = 'robots';
|
333 |
$status = "#9cf975";
|
334 |
+
$help = '';
|
335 |
+
if ( ! $r['valid'] || ! $r['strict'] ) {
|
336 |
+
if ( ! $r['strict'] ) {
|
337 |
$class .= ' quirks';
|
338 |
+
$status = "yellow";
|
339 |
}
|
340 |
+
if ( ! $r['valid'] ) {
|
341 |
$class .= ' invalid';
|
342 |
+
$status = "#f9534a";
|
343 |
}
|
344 |
if ( $show_help ) {
|
345 |
$help = '<a style="cursor:pointer;" class="' . $class . '" title="Click for Help!" onclick="toggleVisibility(\'aiosp_robots_main_legend_tip\');" title="Click for Help">'
|
346 |
+
. '<div class="aioseop_tip_icon"></div></a>';
|
347 |
}
|
348 |
}
|
349 |
$buf .= "<tr class='entry-row {$class}'><td>{$help}</td><td><span class='entry_label'>{$r['content']}</td><td><div style='background:{$status};'></div></td></tr>";
|
351 |
$buf .= '</tbody>';
|
352 |
|
353 |
$buf .= '</table>';
|
354 |
+
if ( $show_help ) {
|
355 |
$buf .= '<div class="aioseop_option_docs" id="aiosp_robots_main_legend_tip">
|
356 |
<h3>' . __( 'Legend', 'all-in-one-seo-pack' ) . '</h3>
|
357 |
<ul>
|
358 |
<li>' . __( 'The yellow indicator means that a non-standard extension was recognized; not all crawlers may recognize it or interpret it the same way. The Allow and Sitemap directives are commonly used by Google and Yahoo.', 'all-in-one-seo-pack' ) . '</li>
|
359 |
+
<li>' . __( 'The red indicator means that the syntax is invalid for a robots.txt file.', 'all-in-one-seo-pack' ) . '</li>
|
360 |
</ul>
|
361 |
+
<a target="_blank" rel="nofollow" href="http://wikipedia.org/wiki/Robots_exclusion_standard#Nonstandard_extensions">' . __( 'More Information', 'all-in-one-seo-pack' ) . '</a>
|
362 |
</div>';
|
363 |
}
|
364 |
} else {
|
365 |
$buf = '<p class="aioseop_error_notice" ><strong>Your Robots.txt file is either empty, cannot be found, or has invalid data.</strong></p>';
|
366 |
}
|
367 |
+
|
368 |
return $buf;
|
369 |
}
|
370 |
|
371 |
function annotate_robots( $robots ) {
|
372 |
+
$state = 0;
|
373 |
+
$rules = Array();
|
374 |
+
foreach ( $robots as $l ) {
|
375 |
+
$l = trim( $l );
|
376 |
+
if ( empty( $l[0] ) ) {
|
377 |
+
if ( $state > 1 ) {
|
378 |
+
$rules[] = Array(
|
379 |
+
'state' => 0,
|
380 |
+
'type' => 'blank',
|
381 |
+
'content' => $l,
|
382 |
+
'valid' => true,
|
383 |
+
'strict' => true
|
384 |
+
);
|
385 |
+
$state = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
}
|
387 |
+
} elseif ( $l[0] === '#' ) {
|
388 |
+
if ( $state < 1 ) {
|
389 |
+
$state = 1;
|
390 |
+
}
|
391 |
+
$rules[] = Array(
|
392 |
+
'state' => $state,
|
393 |
+
'type' => 'comment',
|
394 |
+
'content' => $l,
|
395 |
+
'valid' => true,
|
396 |
+
'strict' => true
|
397 |
+
);
|
398 |
+
} elseif ( stripos( $l, 'sitemap' ) === 0 ) {
|
399 |
+
$state = 2;
|
400 |
+
$rules[] = Array(
|
401 |
+
'state' => $state,
|
402 |
+
'type' => 'sitemap',
|
403 |
+
'content' => $l,
|
404 |
+
'valid' => true,
|
405 |
+
'strict' => false
|
406 |
+
);
|
407 |
+
} elseif ( stripos( $l, 'crawl-delay' ) === 0 ) {
|
408 |
+
$state = 3;
|
409 |
+
$rules[] = Array(
|
410 |
+
'state' => $state,
|
411 |
+
'type' => 'crawl-delay',
|
412 |
+
'content' => $l,
|
413 |
+
'valid' => true,
|
414 |
+
'strict' => false
|
415 |
+
);
|
416 |
+
} elseif ( stripos( $l, 'user-agent' ) === 0 ) {
|
417 |
+
$state = 3;
|
418 |
+
$rules[] = Array(
|
419 |
+
'state' => $state,
|
420 |
+
'type' => 'user-agent',
|
421 |
+
'content' => $l,
|
422 |
+
'valid' => true,
|
423 |
+
'strict' => true
|
424 |
+
);
|
425 |
+
} elseif ( stripos( $l, 'useragent' ) === 0 ) {
|
426 |
+
$state = 3;
|
427 |
+
$rules[] = Array(
|
428 |
+
'state' => $state,
|
429 |
+
'type' => 'user-agent',
|
430 |
+
'content' => $l,
|
431 |
+
'valid' => true,
|
432 |
+
'strict' => false
|
433 |
+
);
|
434 |
+
} elseif ( stripos( $l, 'disallow' ) === 0 ) {
|
435 |
+
if ( $state < 3 ) {
|
436 |
+
$rules[] = Array(
|
437 |
+
'state' => $state,
|
438 |
+
'type' => 'disallow',
|
439 |
+
'content' => $l,
|
440 |
+
'valid' => false,
|
441 |
+
'strict' => false
|
442 |
+
);
|
443 |
+
continue;
|
444 |
+
}
|
445 |
+
$state = 3;
|
446 |
+
$rules[] = Array(
|
447 |
+
'state' => $state,
|
448 |
+
'type' => 'disallow',
|
449 |
+
'content' => $l,
|
450 |
+
'valid' => true,
|
451 |
+
'strict' => true
|
452 |
+
);
|
453 |
+
} elseif ( stripos( $l, 'allow' ) === 0 ) {
|
454 |
+
if ( $state < 3 ) {
|
455 |
+
$rules[] = Array(
|
456 |
+
'state' => $state,
|
457 |
+
'type' => 'allow',
|
458 |
+
'content' => $l,
|
459 |
+
'valid' => false,
|
460 |
+
'strict' => false
|
461 |
+
);
|
462 |
+
continue;
|
463 |
+
}
|
464 |
+
$state = 3;
|
465 |
+
$rules[] = Array(
|
466 |
+
'state' => $state,
|
467 |
+
'type' => 'allow',
|
468 |
+
'content' => $l,
|
469 |
+
'valid' => true,
|
470 |
+
'strict' => false
|
471 |
+
);
|
472 |
+
} else {
|
473 |
+
$rules[] = Array(
|
474 |
+
'state' => $state,
|
475 |
+
'type' => 'unknown',
|
476 |
+
'content' => $l,
|
477 |
+
'valid' => false,
|
478 |
+
'strict' => false
|
479 |
+
);
|
480 |
}
|
481 |
+
}
|
482 |
+
|
483 |
+
return $rules;
|
484 |
}
|
485 |
|
486 |
function parse_annotated_robots( $robots ) {
|
487 |
+
$state = 0;
|
488 |
+
$rules = Array();
|
489 |
+
$opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
|
490 |
+
$rule = Array();
|
491 |
+
foreach ( $opts as $o ) {
|
492 |
+
$rule[ $o ] = Array();
|
493 |
+
}
|
494 |
+
$blank_rule = $rule;
|
495 |
+
foreach ( $robots as $l ) {
|
496 |
+
switch ( $l['type'] ) {
|
497 |
+
case 'blank':
|
498 |
+
if ( $state >= 1 ) {
|
499 |
+
if ( ( $state === 1 ) && ( empty( $rule['user-agent'] ) ) ) {
|
500 |
+
$rule['user-agent'] = Array( null );
|
501 |
}
|
502 |
+
$rules[] = $rule;
|
503 |
+
$rule = $blank_rule;
|
504 |
+
}
|
505 |
+
continue;
|
506 |
+
case 'comment':
|
507 |
+
$rule['comment'][] = $l['content'];
|
508 |
+
continue;
|
509 |
+
case 'sitemap':
|
510 |
+
$rule['sitemap'][] = trim( substr( $l['content'], 8 ) );
|
511 |
+
break;
|
512 |
+
case 'crawl-delay':
|
513 |
+
$rule['crawl-delay'][] = trim( substr( $l['content'], 12 ) );
|
514 |
+
break;
|
515 |
+
case 'user-agent':
|
516 |
+
if ( $l['strict'] ) {
|
517 |
+
$ua = trim( substr( $l['content'], 11 ) );
|
518 |
+
} else {
|
519 |
+
$ua = trim( substr( $l['content'], 10 ) );
|
520 |
+
}
|
521 |
+
$rule['user-agent'][] = $ua;
|
522 |
+
break;
|
523 |
+
case 'disallow':
|
524 |
+
if ( $l['valid'] ) {
|
525 |
+
$rule['disallow'][] = trim( substr( $l['content'], 9 ) );
|
526 |
break;
|
527 |
+
}
|
528 |
+
continue;
|
529 |
+
case 'allow':
|
530 |
+
if ( $l['valid'] ) {
|
531 |
+
$rule['allow'][] = trim( substr( $l['content'], 6 ) );
|
|
|
532 |
break;
|
533 |
+
}
|
534 |
+
continue;
|
535 |
+
case 'unknown':
|
536 |
+
default:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
}
|
538 |
+
$state = $l['state'];
|
539 |
+
}
|
540 |
+
if ( ( $state === 1 ) && ( empty( $rule['user-agent'] ) ) ) {
|
541 |
+
$rule['user-agent'] = Array( null );
|
542 |
+
}
|
543 |
+
if ( $state >= 1 ) {
|
544 |
+
$rules[] = $rule;
|
545 |
+
}
|
546 |
+
|
547 |
+
return $rules;
|
548 |
}
|
549 |
+
|
550 |
function parse_robots( $robots ) {
|
551 |
+
return $this->parse_annotated_robots( $this->annotate_robots( $robots ) );
|
552 |
}
|
553 |
|
554 |
+
function get_robot_user_agents( $rules ) {
|
555 |
+
$opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
|
556 |
$user_agents = Array();
|
557 |
+
foreach ( $rules as $r ) {
|
558 |
+
if ( ! empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) {
|
559 |
+
$r['user-agent'] = Array( null );
|
560 |
+
}
|
561 |
+
foreach ( $r['user-agent'] as $ua ) {
|
562 |
+
if ( ! isset( $user_agents[ $ua ] ) ) {
|
563 |
+
$user_agents[ $ua ] = Array();
|
564 |
+
}
|
565 |
foreach ( $opts as $o ) {
|
566 |
+
if ( ! isset( $user_agents[ $ua ][ $o ] ) ) {
|
567 |
+
$user_agents[ $ua ][ $o ] = $r[ $o ];
|
568 |
+
} else {
|
569 |
+
$user_agents[ $ua ][ $o ] = array_merge( $user_agents[ $ua ][ $o ], $r[ $o ] );
|
570 |
+
}
|
571 |
}
|
572 |
}
|
573 |
}
|
574 |
+
|
575 |
return $user_agents;
|
576 |
}
|
577 |
|
578 |
function flatten_user_agents( $user_agents ) {
|
579 |
$rules = Array();
|
580 |
+
foreach ( $user_agents as $ua => $r ) {
|
581 |
$r['user-agent'] = Array( $ua );
|
582 |
+
$rules[] = $r;
|
583 |
}
|
584 |
+
|
585 |
return $rules;
|
586 |
}
|
587 |
|
588 |
+
function opt_robot_rule( $dis ) {
|
589 |
+
if ( is_array( $dis ) ) { // unique rules only
|
590 |
$dis = array_unique( $dis, SORT_STRING );
|
591 |
+
$pd = null;
|
592 |
+
foreach ( $dis as $k => $d ) {
|
593 |
+
$d = trim( $d );
|
594 |
+
if ( ! empty( $pd ) && ! empty( $d ) ) {
|
595 |
+
if ( strpos( $d, $pd ) === 0 ) {
|
596 |
+
unset( $dis[ $k ] );
|
597 |
+
continue; // get rid of subpaths of $pd
|
598 |
+
}
|
599 |
+
}
|
600 |
+
$l = strlen( $d );
|
601 |
+
if ( ( $l > 0 ) && ( $d[ $l - 1 ] !== '/' ) ) {
|
602 |
+
continue;
|
603 |
+
}
|
604 |
+
$pd = $d; // only allow directory paths for $pd
|
605 |
+
}
|
606 |
}
|
607 |
+
|
608 |
return $dis;
|
609 |
}
|
610 |
|
611 |
+
function output_robots( $rules ) {
|
612 |
$robots = '';
|
613 |
+
foreach ( $rules as $r ) {
|
614 |
+
foreach ( $r['comment'] as $c ) {
|
615 |
+
$robots .= "$c\n";
|
616 |
+
}
|
617 |
+
foreach ( $r['user-agent'] as $u ) {
|
618 |
+
if ( $u != '' ) {
|
619 |
+
$robots .= "User-agent: $u\n";
|
620 |
+
}
|
621 |
+
}
|
622 |
+
foreach ( $r['crawl-delay'] as $c ) {
|
623 |
+
$robots .= "Crawl-Delay: $c\n";
|
624 |
+
}
|
625 |
+
foreach ( $r['allow'] as $a ) {
|
626 |
+
$robots .= "Allow: $a\n";
|
627 |
+
}
|
628 |
+
foreach ( $r['disallow'] as $d ) {
|
629 |
+
$robots .= "Disallow: $d\n";
|
630 |
+
}
|
631 |
+
foreach ( $r['sitemap'] as $s ) {
|
632 |
+
$robots .= "Sitemap: $s\n";
|
633 |
+
}
|
634 |
$robots .= "\n";
|
635 |
}
|
636 |
+
|
637 |
return $robots;
|
638 |
}
|
639 |
}
|
modules/aioseop_sitemap.php
CHANGED
@@ -1,11 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package All-in-One-SEO-Pack
|
4 |
*/
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
9 |
class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
|
10 |
var $cache_struct = null;
|
11 |
var $cache_home = null;
|
@@ -18,815 +22,1290 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
18 |
var $freq;
|
19 |
var $freq_sel;
|
20 |
var $extra_sitemaps;
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$this->
|
28 |
-
$this->
|
|
|
|
|
|
|
29 |
}
|
30 |
parent::__construct();
|
31 |
-
$this->comment_string =
|
32 |
-
|
33 |
-
$this->help_text =
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
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 =
|
59 |
-
'filename'
|
60 |
-
'google'
|
61 |
-
'bing'
|
62 |
-
'
|
63 |
-
'
|
64 |
-
'
|
65 |
-
'
|
66 |
-
'
|
67 |
-
'
|
68 |
-
'
|
69 |
-
'
|
70 |
-
'
|
71 |
-
'
|
72 |
-
'
|
73 |
-
'
|
|
|
|
|
|
|
74 |
'excl_categories' => '#excluded-items',
|
75 |
-
'excl_pages'
|
76 |
);
|
77 |
|
78 |
$this->default_options = array(
|
79 |
-
|
80 |
-
|
81 |
-
'
|
82 |
-
'
|
83 |
-
'
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
'
|
90 |
-
'
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
'
|
101 |
-
'
|
102 |
-
|
103 |
-
|
104 |
-
'
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
);
|
107 |
-
|
108 |
-
$status_options =
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
);
|
112 |
-
|
113 |
-
$this->layout =
|
114 |
-
'status'
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
)
|
|
|
123 |
);
|
124 |
-
|
125 |
-
$prio =
|
126 |
-
for( $i = 0; $i <= 10; $i++ ) {
|
127 |
-
$str
|
128 |
$prio[ $str ] = $str;
|
129 |
}
|
130 |
-
$arr_no
|
131 |
-
$arr_sel
|
132 |
$this->prio_sel = array_merge( $arr_no, $arr_sel, $prio );
|
133 |
-
$this->prio
|
134 |
-
|
135 |
-
|
136 |
-
foreach ( Array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ) as $f ) $freq[ $f ] = $f;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Sitemap class.
|
4 |
+
*
|
5 |
* @package All-in-One-SEO-Pack
|
6 |
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class All_in_One_SEO_Pack_Sitemap
|
12 |
+
*/
|
13 |
class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
|
14 |
var $cache_struct = null;
|
15 |
var $cache_home = null;
|
22 |
var $freq;
|
23 |
var $freq_sel;
|
24 |
var $extra_sitemaps;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* All_in_One_SEO_Pack_Sitemap constructor.
|
28 |
+
*/
|
29 |
+
function __construct() {
|
30 |
+
if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class.
|
31 |
+
$this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
|
32 |
+
$this->prefix = 'aiosp_sitemap_'; // Option prefix.
|
33 |
+
$this->file = __FILE__; // The current file.
|
34 |
+
$this->extra_sitemaps = array();
|
35 |
+
$this->extra_sitemaps = apply_filters( $this->prefix . 'extra', $this->extra_sitemaps );
|
36 |
}
|
37 |
parent::__construct();
|
38 |
+
$this->comment_string = 'Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s';
|
39 |
+
|
40 |
+
$this->help_text = array(
|
41 |
+
'filename' => __( "Specifies the name of your sitemap file. This will default to 'sitemap'.", 'all-in-one-seo-pack' ),
|
42 |
+
'google' => __( 'Notify Google when you update your sitemap settings.', 'all-in-one-seo-pack' ),
|
43 |
+
'bing' => __( 'Notify Bing when you update your sitemap settings.', 'all-in-one-seo-pack' ),
|
44 |
+
'daily_cron' => __( 'Notify search engines based on the selected schedule, and also update static sitemap daily if in use. (this uses WP-Cron, so make sure this is working properly on your server as well)', 'all-in-one-seo-pack' ),
|
45 |
+
'indexes' => __( 'Organize sitemap entries into distinct files in your sitemap. Enable this only if your sitemap contains over 50,000 URLs or the file is over 5MB in size.', 'all-in-one-seo-pack' ),
|
46 |
+
'paginate' => __( 'Split long sitemaps into separate files.', 'all-in-one-seo-pack' ),
|
47 |
+
'max_posts' => __( 'Allows you to specify the maximum number of posts in a sitemap (up to 50,000).', 'all-in-one-seo-pack' ),
|
48 |
+
'posttypes' => __( 'Select which Post Types appear in your sitemap.', 'all-in-one-seo-pack' ),
|
49 |
+
'taxonomies' => __( 'Select which taxonomy archives appear in your sitemap', 'all-in-one-seo-pack' ),
|
50 |
+
'archive' => __( 'Include Date Archives in your sitemap.', 'all-in-one-seo-pack' ),
|
51 |
+
'author' => __( 'Include Author Archives in your sitemap.', 'all-in-one-seo-pack' ),
|
52 |
+
'gzipped' => __( 'Create a compressed sitemap file in .xml.gz format.', 'all-in-one-seo-pack' ),
|
53 |
+
'robots' => __( 'Places a link to your Sitemap.xml into your virtual Robots.txt file.', 'all-in-one-seo-pack' ),
|
54 |
+
'rewrite' => __( 'Dynamically creates the XML sitemap instead of using a static file.', 'all-in-one-seo-pack' ),
|
55 |
+
'debug' => __( 'Use rewrites to generate your sitemap on the fly. NOTE: This is required for WordPress Multisite.', 'all-in-one-seo-pack' ),
|
56 |
+
'addl_url' => __( 'URL to the page.', 'all-in-one-seo-pack' ),
|
57 |
+
'addl_prio' => __( 'The priority of the page.', 'all-in-one-seo-pack' ),
|
58 |
+
'addl_freq' => __( 'The frequency of the page.', 'all-in-one-seo-pack' ),
|
59 |
+
'addl_mod' => __( 'Last modified date of the page.', 'all-in-one-seo-pack' ),
|
60 |
+
'excl_categories' => __( 'Entries from these categories will be excluded from the sitemap.', 'all-in-one-seo-pack' ),
|
61 |
+
'excl_pages' => __( 'Use page slugs or page IDs, seperated by commas, to exclude pages from the sitemap.', 'all-in-one-seo-pack' ),
|
|
|
62 |
);
|
63 |
+
|
64 |
+
$this->help_anchors = array(
|
65 |
+
'filename' => '#filename-prefix',
|
66 |
+
'google' => '#notify-google-bing',
|
67 |
+
'bing' => '#notify-google-bing',
|
68 |
+
'daily_cron' => '#schedule-updates',
|
69 |
+
'indexes' => '#enable-sitemap-indexes',
|
70 |
+
'paginate' => '#enable-sitemap-indexes',
|
71 |
+
'max_posts' => '#enable-sitemap-indexes',
|
72 |
+
'posttypes' => '#post-types-and-taxonomies',
|
73 |
+
'taxonomies' => '#post-types-and-taxonomies',
|
74 |
+
'archive' => '#include-archive-pages',
|
75 |
+
'author' => '#include-archive-pages',
|
76 |
+
'gzipped' => '#create-compressed-sitemap',
|
77 |
+
'robots' => '#link-from-virtual-robots',
|
78 |
+
'rewrite' => '#dynamically-generate-sitemap',
|
79 |
+
'addl_url' => '#additional-pages',
|
80 |
+
'addl_prio' => '#additional-pages',
|
81 |
+
'addl_freq' => '#additional-pages',
|
82 |
+
'addl_mod' => '#additional-pages',
|
83 |
'excl_categories' => '#excluded-items',
|
84 |
+
'excl_pages' => '#excluded-items',
|
85 |
);
|
86 |
|
87 |
$this->default_options = array(
|
88 |
+
'filename' => array(
|
89 |
+
'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ),
|
90 |
+
'default' => 'sitemap',
|
91 |
+
'type' => 'text',
|
92 |
+
'sanitize' => 'filename',
|
93 |
+
),
|
94 |
+
'google' => array( 'name' => __( 'Notify Google', 'all-in-one-seo-pack' ) ),
|
95 |
+
'bing' => array( 'name' => __( 'Notify Bing', 'all-in-one-seo-pack' ) ),
|
96 |
+
'daily_cron' => array(
|
97 |
+
'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ),
|
98 |
+
'type' => 'select',
|
99 |
+
'initial_options' => array(
|
100 |
+
0 => __( 'No Schedule', 'all-in-one-seo-pack' ),
|
101 |
+
'daily' => __( 'Daily', 'all-in-one-seo-pack' ),
|
102 |
+
'weekly' => __( 'Weekly', 'all-in-one-seo-pack' ),
|
103 |
+
'monthly' => __( 'Monthly', 'all-in-one-seo-pack' ),
|
104 |
+
),
|
105 |
+
'default' => 0,
|
106 |
+
),
|
107 |
+
'indexes' => array( 'name' => __( 'Enable Sitemap Indexes', 'all-in-one-seo-pack' ) ),
|
108 |
+
'paginate' => array(
|
109 |
+
'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ),
|
110 |
+
'condshow' => array( "{$this->prefix}indexes" => 'on' ),
|
111 |
+
),
|
112 |
+
'max_posts' => array(
|
113 |
+
'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ),
|
114 |
+
'type' => 'text',
|
115 |
+
'default' => 50000,
|
116 |
+
'condshow' => array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ),
|
117 |
+
),
|
118 |
+
'posttypes' => array(
|
119 |
+
'name' => __( 'Post Types', 'all-in-one-seo-pack' ),
|
120 |
+
'type' => 'multicheckbox',
|
121 |
+
'default' => 'all',
|
122 |
+
),
|
123 |
+
'taxonomies' => array(
|
124 |
+
'name' => __( 'Taxonomies', 'all-in-one-seo-pack' ),
|
125 |
+
'type' => 'multicheckbox',
|
126 |
+
'default' => 'all',
|
127 |
+
),
|
128 |
+
'archive' => array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ),
|
129 |
+
'author' => array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ),
|
130 |
+
'gzipped' => array(
|
131 |
+
'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ),
|
132 |
+
'default' => 'On',
|
133 |
+
),
|
134 |
+
'robots' => array(
|
135 |
+
'name' => __( 'Link From Virtual Robots.txt', 'all-in-one-seo-pack' ),
|
136 |
+
'default' => 'On',
|
137 |
+
),
|
138 |
+
'rewrite' => array(
|
139 |
+
'name' => __( 'Dynamically Generate Sitemap', 'all-in-one-seo-pack' ),
|
140 |
+
'default' => 'On',
|
141 |
+
),
|
142 |
);
|
143 |
+
|
144 |
+
$status_options = array(
|
145 |
+
'link' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
|
146 |
+
'debug' => array(
|
147 |
+
'name' => __( 'Debug Log', 'all-in-one-seo-pack' ),
|
148 |
+
'default' => '',
|
149 |
+
'type' => 'html',
|
150 |
+
'disabled' => 'disabled',
|
151 |
+
'save' => false,
|
152 |
+
'label' => 'none',
|
153 |
+
'rows' => 5,
|
154 |
+
'cols' => 120,
|
155 |
+
'style' => 'min-width:950px',
|
156 |
+
),
|
157 |
);
|
158 |
+
|
159 |
+
$this->layout = array(
|
160 |
+
'status' => array(
|
161 |
+
'name' => __( 'Sitemap Status', 'all-in-one-seo-pack' ),
|
162 |
+
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
|
163 |
+
'options' => array_keys( $status_options ),
|
164 |
+
),
|
165 |
+
'default' => array(
|
166 |
+
'name' => $this->name,
|
167 |
+
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
|
168 |
+
'options' => array_keys( $this->default_options ),
|
169 |
+
),
|
170 |
);
|
171 |
+
|
172 |
+
$prio = array();
|
173 |
+
for ( $i = 0; $i <= 10; $i ++ ) {
|
174 |
+
$str = sprintf( '%0.1f', $i / 10.0 );
|
175 |
$prio[ $str ] = $str;
|
176 |
}
|
177 |
+
$arr_no = array( 'no' => __( 'Do Not Override', 'all-in-one-seo-pack' ) );
|
178 |
+
$arr_sel = array( 'sel' => __( 'Select Individual', 'all-in-one-seo-pack' ) );
|
179 |
$this->prio_sel = array_merge( $arr_no, $arr_sel, $prio );
|
180 |
+
$this->prio = array_merge( $arr_no, $prio );
|
181 |
+
|
182 |
+
|
|