All in One SEO Pack - Version 1.6

Version Description

Download this release

Release Info

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

Code changes from version 1.5.7 to 1.6

Files changed (4) hide show
  1. aioseop.class.php +1963 -0
  2. all_in_one_seo_pack.php +172 -1849
  3. images/twitter.png +0 -0
  4. readme.txt +18 -8
aioseop.class.php ADDED
@@ -0,0 +1,1963 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class All_in_One_SEO_Pack {
4
+
5
+ var $version = "1.6";
6
+
7
+ /** Max numbers of chars in auto-generated description */
8
+ var $maximum_description_length = 160;
9
+
10
+ /** Minimum number of chars an excerpt should be so that it can be used
11
+ * as description. Touch only if you know what you're doing
12
+ */
13
+ var $minimum_description_length = 1;
14
+
15
+ var $ob_start_detected = false;
16
+
17
+ var $title_start = -1;
18
+
19
+ var $title_end = -1;
20
+
21
+ /** The title before rewriting */
22
+ var $orig_title = '';
23
+
24
+ /** Temp filename for the latest version. */
25
+ // var $upgrade_filename = 'temp.zip';
26
+
27
+ /** Where to extract the downloaded newest version. */
28
+ // var $upgrade_folder;
29
+
30
+ /** Any error in upgrading. */
31
+ // var $upgrade_error;
32
+
33
+ /** Which zip to download in order to upgrade .*/
34
+ // var $upgrade_url = 'http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip';
35
+
36
+ /** Filename of log file. */
37
+ var $log_file;
38
+
39
+ /** Flag whether there should be logging. */
40
+ var $do_log;
41
+
42
+ var $wp_version;
43
+
44
+ var $aioseop_op;
45
+ //var $aioseop_options = get_option('aioseop_options');
46
+
47
+ function All_in_One_SEO_Pack() {
48
+ global $wp_version;
49
+ global $aioseop_options;
50
+ $this->wp_version = $wp_version;
51
+
52
+ $this->log_file = dirname(__FILE__) . '/all_in_one_seo_pack.log';
53
+ if ($aioseop_options['aiosp_do_log']) {
54
+ $this->do_log = true;
55
+ } else {
56
+ $this->do_log = false;
57
+ }
58
+
59
+ // $this->upgrade_filename = dirname(__FILE__) . '/' . $this->upgrade_filename;
60
+ // $this->upgrade_folder = dirname(__FILE__);
61
+ }
62
+
63
+ /**
64
+ * Convert a string to lower case
65
+ * Compatible with mb_strtolower(), an UTF-8 friendly replacement for strtolower()
66
+ */
67
+ function strtolower($str) {
68
+ global $UTF8_TABLES;
69
+ return strtr($str, $UTF8_TABLES['strtolower']);
70
+ }
71
+
72
+ /**
73
+ * Convert a string to upper case
74
+ * Compatible with mb_strtoupper(), an UTF-8 friendly replacement for strtoupper()
75
+ */
76
+ function strtoupper($str) {
77
+ global $UTF8_TABLES;
78
+ return strtr($str, $UTF8_TABLES['strtoupper']);
79
+ }
80
+
81
+
82
+ function template_redirect() {
83
+ global $wp_query;
84
+ global $aioseop_options;
85
+
86
+ $post = $wp_query->get_queried_object();
87
+
88
+ if (is_feed()) {
89
+ return;
90
+ }
91
+
92
+ if (is_single() || is_page()) {
93
+ $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true)));
94
+ if ($aiosp_disable) {
95
+ return;
96
+ }
97
+ }
98
+
99
+ if ($aioseop_options['aiosp_rewrite_titles']) {
100
+ ob_start(array($this, 'output_callback_for_title'));
101
+ }
102
+ }
103
+
104
+ function output_callback_for_title($content) {
105
+ return $this->rewrite_title($content);
106
+ }
107
+
108
+ function init() {
109
+ if (function_exists('load_plugin_textdomain')) {
110
+ if ( !defined('WP_PLUGIN_DIR') ) {
111
+ load_plugin_textdomain('all_in_one_seo_pack', str_replace( ABSPATH, '', dirname(__FILE__)));
112
+ } else {
113
+ load_plugin_textdomain('all_in_one_seo_pack', false, dirname(plugin_basename(__FILE__)));
114
+ }
115
+ }
116
+
117
+
118
+ /*
119
+ if (function_exists('load_plugin_textdomain')) {
120
+ load_plugin_textdomain('all_in_one_seo_pack', WP_PLUGIN_DIR . '/all-in-one-seo-pack');
121
+ }
122
+ */
123
+
124
+ }
125
+
126
+ function is_static_front_page() {
127
+ global $wp_query;
128
+ global $aioseop_options;
129
+ $post = $wp_query->get_queried_object();
130
+ return get_option('show_on_front') == 'page' && is_page() && $post->ID == get_option('page_on_front');
131
+ }
132
+
133
+ function is_static_posts_page() {
134
+ global $wp_query;
135
+ $post = $wp_query->get_queried_object();
136
+ return get_option('show_on_front') == 'page' && is_home() && $post->ID == get_option('page_for_posts');
137
+ }
138
+
139
+ function get_base() {
140
+ return '/'.end(explode('/', str_replace(array('\\','/all_in_one_seo_pack.php'),array('/',''),__FILE__)));
141
+ }
142
+
143
+ function seo_mrt_admin_head() {
144
+ $home = get_settings('siteurl');
145
+ $stylesheet = WP_PLUGIN_URL . '/all-in-one-seo-pack/style.css';
146
+ echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
147
+ }
148
+
149
+
150
+ function wp_head() {
151
+ if (is_feed()) {
152
+ return;
153
+ }
154
+
155
+ global $wp_query;
156
+ global $aioseop_options;
157
+ $post = $wp_query->get_queried_object();
158
+ $meta_string = null;
159
+ if($this->is_static_posts_page()){
160
+ $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
161
+
162
+ }
163
+ //echo("wp_head() " . wp_title('', false) . " is_home() => " . is_home() . ", is_page() => " . is_page() . ", is_single() => " . is_single() . ", is_static_front_page() => " . $this->is_static_front_page() . ", is_static_posts_page() => " . $this->is_static_posts_page());
164
+
165
+ if (is_single() || is_page()) {
166
+ $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true)));
167
+ if ($aiosp_disable) {
168
+ return;
169
+ }
170
+ }
171
+
172
+ if ($aioseop_options['aiosp_rewrite_titles']) {
173
+ // make the title rewrite as short as possible
174
+ if (function_exists('ob_list_handlers')) {
175
+ $active_handlers = ob_list_handlers();
176
+ } else {
177
+ $active_handlers = array();
178
+ }
179
+ if (sizeof($active_handlers) > 0 &&
180
+ strtolower($active_handlers[sizeof($active_handlers) - 1]) ==
181
+ strtolower('All_in_One_SEO_Pack::output_callback_for_title')) {
182
+ ob_end_flush();
183
+ } else {
184
+ $this->log("another plugin interfering?");
185
+ // if we get here there *could* be trouble with another plugin :(
186
+ $this->ob_start_detected = true;
187
+ if (function_exists('ob_list_handlers')) {
188
+ foreach (ob_list_handlers() as $handler) {
189
+ $this->log("detected output handler $handler");
190
+ }
191
+ }
192
+ }
193
+ }
194
+
195
+ echo "\n<!-- All in One SEO Pack $this->version by Michael Torbert of Semper Fi Web Design";
196
+ if ($this->ob_start_detected) {
197
+ echo "ob_start_detected ";
198
+ }
199
+ echo "[$this->title_start,$this->title_end] ";
200
+ echo "-->\n";
201
+ if ((is_home() && $aioseop_options['aiosp_home_keywords'] && !$this->is_static_posts_page()) || $this->is_static_front_page()) {
202
+ $keywords = trim($this->internationalize($aioseop_options['aiosp_home_keywords']));
203
+ } elseif($this->is_static_posts_page() && !$aioseop_options['aiosp_dynamic_postspage_keywords']){ // and if option = use page set keywords instead of keywords from recent posts
204
+ //$keywords = "posts keyyysss" . stripcslashes(get_post_meta($post->ID,'keywords',true));
205
+ $keywords = stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_keywords", true)));
206
+
207
+ // $keywords = $this->get_unique_keywords($keywords);
208
+
209
+ }else {
210
+ $keywords = $this->get_all_keywords();
211
+ }
212
+ if (is_single() || is_page() || $this->is_static_posts_page()) {
213
+ if ($this->is_static_front_page()) {
214
+ $description = trim(stripcslashes($this->internationalize($aioseop_options['aiosp_home_description'])));
215
+ } else {
216
+ $description = $this->get_post_description($post);
217
+ $description = apply_filters('aioseop_description',$description);
218
+ }
219
+ } else if (is_home()) {
220
+ $description = trim(stripcslashes($this->internationalize($aioseop_options['aiosp_home_description'])));
221
+ } else if (is_category()) {
222
+ $description = $this->internationalize(category_description());
223
+ }
224
+
225
+ if (isset($description) && (strlen($description) > $this->minimum_description_length) && !(is_home() && is_paged())) {
226
+ $description = trim(strip_tags($description));
227
+ $description = str_replace('"', '', $description);
228
+
229
+ // replace newlines on mac / windows?
230
+ $description = str_replace("\r\n", ' ', $description);
231
+
232
+ // maybe linux uses this alone
233
+ $description = str_replace("\n", ' ', $description);
234
+
235
+ if (isset($meta_string)) {
236
+ //$meta_string .= "\n";
237
+ } else {
238
+ $meta_string = '';
239
+ }
240
+
241
+ // description format
242
+ $description_format = $aioseop_options['aiosp_description_format'];
243
+ if (!isset($description_format) || empty($description_format)) {
244
+ $description_format = "%description%";
245
+ }
246
+ $description = str_replace('%description%', $description, $description_format);
247
+ $description = str_replace('%blog_title%', get_bloginfo('name'), $description);
248
+ $description = str_replace('%blog_description%', get_bloginfo('description'), $description);
249
+ $description = str_replace('%wp_title%', $this->get_original_title(), $description);
250
+ //$description = html_entity_decode($description, ENT_COMPAT, get_bloginfo('charset'));
251
+ if($aioseop_options['aiosp_can']){
252
+ $url = $this->aiosp_mrt_get_url($wp_query);
253
+ if ($url) {
254
+ preg_match_all('/(\d+)/', $url, $matches);
255
+ if (is_array($matches)){
256
+ $uniqueDesc = join('',$matches[0]);
257
+ }
258
+ }
259
+ $description .= ' ' . $uniqueDesc;
260
+ }
261
+ $meta_string .= sprintf("<meta name=\"description\" content=\"%s\" />", $description);
262
+ }
263
+ $keywords = apply_filters('aioseop_keywords',$keywords);
264
+ if (isset ($keywords) && !empty($keywords) && !(is_home() && is_paged())) {
265
+ if (isset($meta_string)) {
266
+ $meta_string .= "\n";
267
+ }
268
+ $meta_string .= sprintf("<meta name=\"keywords\" content=\"%s\" />", $keywords);
269
+ }
270
+
271
+ if (function_exists('is_tag')) {
272
+ $is_tag = is_tag();
273
+ }
274
+
275
+ if ((is_category() && $aioseop_options['aiosp_category_noindex']) ||
276
+ (!is_category() && is_archive() &&!$is_tag && $aioseop_options['aiosp_archive_noindex']) ||
277
+ ($aioseop_options['aiosp_tags_noindex'] && $is_tag)) {
278
+ if (isset($meta_string)) {
279
+ $meta_string .= "\n";
280
+ }
281
+ $meta_string .= '<meta name="robots" content="noindex,follow" />';
282
+ }
283
+
284
+ $page_meta = stripcslashes($aioseop_options['aiosp_page_meta_tags']);
285
+ $post_meta = stripcslashes($aioseop_options['aiosp_post_meta_tags']);
286
+ $home_meta = stripcslashes($aioseop_options['aiosp_home_meta_tags']);
287
+ if (is_page() && isset($page_meta) && !empty($page_meta) || $this->is_static_posts_page()) {
288
+ if (isset($meta_string)) {
289
+ $meta_string .= "\n";
290
+ }
291
+ echo "\n$page_meta";
292
+ }
293
+
294
+ if (is_single() && isset($post_meta) && !empty($post_meta)) {
295
+ if (isset($meta_string)) {
296
+ $meta_string .= "\n";
297
+ }
298
+ $meta_string .= "$post_meta";
299
+ }
300
+
301
+ if (is_home() && !empty($home_meta)) {
302
+ if (isset($meta_string)) {
303
+ $meta_string .= "\n";
304
+ }
305
+ $meta_string .= "$home_meta";
306
+ }
307
+
308
+ if ($meta_string != null) {
309
+ echo "$meta_string\n";
310
+ }
311
+
312
+ if($aioseop_options['aiosp_can']){
313
+ $url = $this->aiosp_mrt_get_url($wp_query);
314
+ if ($url) {
315
+ $url = apply_filters('aioseop_canonical_url',$url);
316
+
317
+ echo "".'<link rel="canonical" href="'.$url.'" />'."\n";
318
+ }
319
+ }
320
+
321
+ echo "<!-- /all in one seo pack -->\n";
322
+ }
323
+
324
+ // Thank you, Yoast de Valk, for much of this code.
325
+
326
+ function aiosp_mrt_get_url($query) {
327
+ global $aioseop_options;
328
+ if ($query->is_404 || $query->is_search) {
329
+ return false;
330
+ }
331
+ $haspost = count($query->posts) > 0;
332
+ $has_ut = function_exists('user_trailingslashit');
333
+
334
+ if (get_query_var('m')) {
335
+ $m = preg_replace('/[^0-9]/', '', get_query_var('m'));
336
+ switch (strlen($m)) {
337
+ case 4:
338
+ $link = get_year_link($m);
339
+ break;
340
+ case 6:
341
+ $link = get_month_link(substr($m, 0, 4), substr($m, 4, 2));
342
+ break;
343
+ case 8:
344
+ $link = get_day_link(substr($m, 0, 4), substr($m, 4, 2),
345
+ substr($m, 6, 2));
346
+ break;
347
+ default:
348
+ return false;
349
+ }
350
+ } elseif (($query->is_single || $query->is_page) && $haspost) {
351
+ $post = $query->posts[0];
352
+ $link = get_permalink($post->ID);
353
+ $link = $this->yoast_get_paged($link);
354
+ /* if ($page && $page > 1) {
355
+ $link = trailingslashit($link) . "page/". "$page";
356
+ if ($has_ut) {
357
+ $link = user_trailingslashit($link, 'paged');
358
+ } else {
359
+ $link .= '/';
360
+ }
361
+ }
362
+ if ($query->is_page && ('page' == get_option('show_on_front')) &&
363
+ $post->ID == get_option('page_on_front'))
364
+ {
365
+ $link = trailingslashit($link);
366
+ }*/
367
+ } elseif ($query->is_author && $haspost) {
368
+ global $wp_version;
369
+ if ($wp_version >= '2') {
370
+ $author = get_userdata(get_query_var('author'));
371
+ if ($author === false)
372
+ return false;
373
+ $link = get_author_link(false, $author->ID,
374
+ $author->user_nicename);
375
+ } else {
376
+ global $cache_userdata;
377
+ $userid = get_query_var('author');
378
+ $link = get_author_link(false, $userid,
379
+ $cache_userdata[$userid]->user_nicename);
380
+ }
381
+ } elseif ($query->is_category && $haspost) {
382
+ $link = get_category_link(get_query_var('cat'));
383
+ $link = $this->yoast_get_paged($link);
384
+ } else if ($query->is_tag && $haspost) {
385
+ $tag = get_term_by('slug',get_query_var('tag'),'post_tag');
386
+ if (!empty($tag->term_id)) {
387
+ $link = get_tag_link($tag->term_id);
388
+ }
389
+ $link = $this->yoast_get_paged($link);
390
+ } elseif ($query->is_day && $haspost) {
391
+ $link = get_day_link(get_query_var('year'),
392
+ get_query_var('monthnum'),
393
+ get_query_var('day'));
394
+ } elseif ($query->is_month && $haspost) {
395
+ $link = get_month_link(get_query_var('year'),
396
+ get_query_var('monthnum'));
397
+ } elseif ($query->is_year && $haspost) {
398
+ $link = get_year_link(get_query_var('year'));
399
+ } elseif ($query->is_home) {
400
+ if ((get_option('show_on_front') == 'page') &&
401
+ ($pageid = get_option('page_for_posts')))
402
+ {
403
+ $link = get_permalink($pageid);
404
+ $link = $this->yoast_get_paged($link);
405
+ $link = trailingslashit($link);
406
+ } else {
407
+ $link = get_option('home');
408
+ $link = $this->yoast_get_paged($link);
409
+ $link = trailingslashit($link); }
410
+ } else {
411
+ return false;
412
+ }
413
+
414
+ return $link;
415
+
416
+ }
417
+
418
+
419
+ function yoast_get_paged($link) {
420
+ $page = get_query_var('paged');
421
+ if ($page && $page > 1) {
422
+ $link = trailingslashit($link) ."page/". "$page";
423
+ if ($has_ut) {
424
+ $link = user_trailingslashit($link, 'paged');
425
+ } else {
426
+ $link .= '/';
427
+ }
428
+ }
429
+ return $link;
430
+ }
431
+
432
+
433
+ function get_post_description($post) {
434
+ $description = trim(stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_description", true))));
435
+ if (!$description) {
436
+ $description = $this->trim_excerpt_without_filters_full_length($this->internationalize($post->post_excerpt));
437
+ if (!$description && $aioseop_options["aiosp_generate_descriptions"]) {
438
+ $description = $this->trim_excerpt_without_filters($this->internationalize($post->post_content));
439
+ }
440
+ }
441
+
442
+ // "internal whitespace trim"
443
+ $description = preg_replace("/\s\s+/", " ", $description);
444
+
445
+ return $description;
446
+ }
447
+
448
+ function replace_title($content, $title) {
449
+ $title = trim(strip_tags($title));
450
+
451
+ $title_tag_start = "<title>";
452
+ $title_tag_end = "</title>";
453
+ $len_start = strlen($title_tag_start);
454
+ $len_end = strlen($title_tag_end);
455
+ $title = stripcslashes(trim($title));
456
+ $start = strpos($content, $title_tag_start);
457
+ $end = strpos($content, $title_tag_end);
458
+
459
+ $this->title_start = $start;
460
+ $this->title_end = $end;
461
+ $this->orig_title = $title;
462
+
463
+ if ($start && $end) {
464
+ $header = substr($content, 0, $start + $len_start) . $title . substr($content, $end);
465
+ } else {
466
+ // this breaks some sitemap plugins (like wpg2)
467
+ //$header = $content . "<title>$title</title>";
468
+
469
+ $header = $content;
470
+ }
471
+
472
+ return $header;
473
+ }
474
+
475
+ function internationalize($in) {
476
+ if (function_exists('langswitch_filter_langs_with_message')) {
477
+ $in = langswitch_filter_langs_with_message($in);
478
+ }
479
+ if (function_exists('polyglot_filter')) {
480
+ $in = polyglot_filter($in);
481
+ }
482
+ if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
483
+ $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($in);
484
+ }
485
+ $in = apply_filters('localization', $in);
486
+ return $in;
487
+ }
488
+
489
+ /** @return The original title as delivered by WP (well, in most cases) */
490
+ function get_original_title() {
491
+ global $wp_query;
492
+ if (!$wp_query) {
493
+ return null;
494
+ }
495
+
496
+ $post = $wp_query->get_queried_object();
497
+
498
+ // the_search_query() is not suitable, it cannot just return
499
+ global $s;
500
+
501
+ $title = null;
502
+
503
+ if (is_home()) {
504
+ $title = get_option('blogname');
505
+ } else if (is_single()) {
506
+ $title = $this->internationalize(wp_title('', false));
507
+ } else if (is_search() && isset($s) && !empty($s)) {
508
+ if (function_exists('attribute_escape')) {
509
+ $search = attribute_escape(stripcslashes($s));
510
+ } else {
511
+ $search = wp_specialchars(stripcslashes($s), true);
512
+ }
513
+ $search = $this->capitalize($search);
514
+ $title = $search;
515
+ } else if (is_category() && !is_feed()) {
516
+ $category_description = $this->internationalize(category_description());
517
+ $category_name = ucwords($this->internationalize(single_cat_title('', false)));
518
+ $title = $category_name;
519
+ } else if (is_page()) {
520
+ $title = $this->internationalize(wp_title('', false));
521
+ } else if (function_exists('is_tag') && is_tag()) {
522
+ global $utw;
523
+ if ($utw) {
524
+ $tags = $utw->GetCurrentTagSet();
525
+ $tag = $tags[0]->tag;
526
+ $tag = str_replace('-', ' ', $tag);
527
+ } else {
528
+ // wordpress > 2.3
529
+ $tag = $this->internationalize(wp_title('', false));
530
+ }
531
+ if ($tag) {
532
+ $title = $tag;
533
+ }
534
+ } else if (is_archive()) {
535
+ $title = $this->internationalize(wp_title('', false));
536
+ } else if (is_404()) {
537
+ $title_format = $aioseop_options['aiosp_404_title_format'];
538
+ $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
539
+ $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
540
+ $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
541
+ $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
542
+ $title = $new_title;
543
+ }
544
+
545
+ return trim($title);
546
+ }
547
+
548
+ function paged_title($title) {
549
+ // the page number if paged
550
+ global $paged;
551
+
552
+ // simple tagging support
553
+ global $STagging;
554
+
555
+ if (is_paged() || (isset($STagging) && $STagging->is_tag_view() && $paged)) {
556
+ $part = $this->internationalize($aioseop_options['aiosp_paged_format']);
557
+ if (isset($part) || !empty($part)) {
558
+ $part = " " . trim($part);
559
+ $part = str_replace('%page%', $paged, $part);
560
+ $this->log("paged_title() [$title] [$part]");
561
+ $title .= $part;
562
+ }
563
+ }
564
+ return $title;
565
+ }
566
+
567
+ function rewrite_title($header) {
568
+ global $aioseop_options;
569
+ global $wp_query;
570
+ if (!$wp_query) {
571
+ $header .= "<!-- no wp_query found! -->\n";
572
+ return $header;
573
+ }
574
+
575
+ $post = $wp_query->get_queried_object();
576
+
577
+ // the_search_query() is not suitable, it cannot just return
578
+ global $s;
579
+
580
+ global $STagging;
581
+
582
+ if (is_home() && !$this->is_static_posts_page()) {
583
+ $title = $this->internationalize($aioseop_options['aiosp_home_title']);
584
+ if (empty($title)) {
585
+ $title = $this->internationalize(get_option('blogname'));
586
+ }
587
+ $title = $this->paged_title($title);
588
+ $header = $this->replace_title($header, $title);
589
+ } else if (is_attachment()) {
590
+ $title = get_the_title($post->post_parent).' '.$post->post_title.' – '.get_option('blogname');
591
+ $header = $this->replace_title($header,$title);
592
+ } else if (is_single()) {
593
+ // we're not in the loop :(
594
+ $authordata = get_userdata($post->post_author);
595
+ $categories = get_the_category();
596
+ $category = '';
597
+ if (count($categories) > 0) {
598
+ $category = $categories[0]->cat_name;
599
+ }
600
+ $title = $this->internationalize(get_post_meta($post->ID, "_aioseop_title", true));
601
+ if (!$title) {
602
+ $title = $this->internationalize(get_post_meta($post->ID, "title_tag", true));
603
+ if (!$title) {
604
+ $title = $this->internationalize(wp_title('', false));
605
+ }
606
+ }
607
+ $title_format = $aioseop_options['aiosp_post_title_format'];
608
+ $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
609
+ $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
610
+ $new_title = str_replace('%post_title%', $title, $new_title);
611
+ $new_title = str_replace('%category%', $category, $new_title);
612
+ $new_title = str_replace('%category_title%', $category, $new_title);
613
+ $new_title = str_replace('%post_author_login%', $authordata->user_login, $new_title);
614
+ $new_title = str_replace('%post_author_nicename%', $authordata->user_nicename, $new_title);
615
+ $new_title = str_replace('%post_author_firstname%', ucwords($authordata->first_name), $new_title);
616
+ $new_title = str_replace('%post_author_lastname%', ucwords($authordata->last_name), $new_title);
617
+ $title = $new_title;
618
+ $title = trim($title);
619
+ $title = apply_filters('aioseop_title_single',$title);
620
+ $header = $this->replace_title($header, $title);
621
+ } else if (is_search() && isset($s) && !empty($s)) {
622
+ if (function_exists('attribute_escape')) {
623
+ $search = attribute_escape(stripcslashes($s));
624
+ } else {
625
+ $search = wp_specialchars(stripcslashes($s), true);
626
+ }
627
+ $search = $this->capitalize($search);
628
+ $title_format = $aioseop_options['aiosp_search_title_format'];
629
+ $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
630
+ $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
631
+ $title = str_replace('%search%', $search, $title);
632
+ $header = $this->replace_title($header, $title);
633
+ } else if (is_category() && !is_feed()) {
634
+ $category_description = $this->internationalize(category_description());
635
+ $category_name = ucwords($this->internationalize(single_cat_title('', false)));
636
+ $title_format = $aioseop_options['aiosp_category_title_format'];
637
+ $title = str_replace('%category_title%', $category_name, $title_format);
638
+ $title = str_replace('%category_description%', $category_description, $title);
639
+ $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title);
640
+ $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
641
+ $title = $this->paged_title($title);
642
+ $header = $this->replace_title($header, $title);
643
+ } else if (is_page() || $this->is_static_posts_page()) {
644
+ // we're not in the loop :(
645
+ $authordata = get_userdata($post->post_author);
646
+ if ($this->is_static_front_page()) {
647
+ if ($this->internationalize($aioseop_options['aiosp_home_title'])) {
648
+ $header = $this->replace_title($header, $this->internationalize($aioseop_options['aiosp_home_title']));
649
+ }
650
+ } else {
651
+ $title = $this->internationalize(get_post_meta($post->ID, "_aioseop_title", true));
652
+ if (!$title) {
653
+ $title = $this->internationalize(wp_title('', false));
654
+ }
655
+ $title_format = $aioseop_options['aiosp_page_title_format'];
656
+ $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
657
+ $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
658
+ $new_title = str_replace('%page_title%', $title, $new_title);
659
+ $new_title = str_replace('%page_author_login%', $authordata->user_login, $new_title);
660
+ $new_title = str_replace('%page_author_nicename%', $authordata->user_nicename, $new_title);
661
+ $new_title = str_replace('%page_author_firstname%', ucwords($authordata->first_name), $new_title);
662
+ $new_title = str_replace('%page_author_lastname%', ucwords($authordata->last_name), $new_title);
663
+ $title = trim($new_title);
664
+ $title = apply_filters('aioseop_title_page',$title);
665
+ $header = $this->replace_title($header, $title);
666
+ }
667
+ } else if (function_exists('is_tag') && is_tag()) {
668
+ global $utw;
669
+ if ($utw) {
670
+ $tags = $utw->GetCurrentTagSet();
671
+ $tag = $tags[0]->tag;
672
+ $tag = str_replace('-', ' ', $tag);
673
+ } else {
674
+ // wordpress > 2.3
675
+ $tag = $this->internationalize(wp_title('', false));
676
+ }
677
+ if ($tag) {
678
+ $tag = $this->capitalize($tag);
679
+ $title_format = $aioseop_options['aiosp_tag_title_format'];
680
+ $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
681
+ $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
682
+ $title = str_replace('%tag%', $tag, $title);
683
+ $title = $this->paged_title($title);
684
+ $header = $this->replace_title($header, $title);
685
+ }
686
+ } else if (isset($STagging) && $STagging->is_tag_view()) { // simple tagging support
687
+ $tag = $STagging->search_tag;
688
+ if ($tag) {
689
+ $tag = $this->capitalize($tag);
690
+ $title_format = $aioseop_options['aiosp_tag_title_format'];
691
+ $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
692
+ $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
693
+ $title = str_replace('%tag%', $tag, $title);
694
+ $title = $this->paged_title($title);
695
+ $header = $this->replace_title($header, $title);
696
+ }
697
+ } else if (is_archive()) {
698
+ $date = $this->internationalize(wp_title('', false));
699
+ $title_format = $aioseop_options['aiosp_archive_title_format'];
700
+ $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
701
+ $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
702
+ $new_title = str_replace('%date%', $date, $new_title);
703
+ $title = trim($new_title);
704
+ $title = $this->paged_title($title);
705
+ $header = $this->replace_title($header, $title);
706
+ } else if (is_404()) {
707
+ $title_format = $aioseop_options['aiosp_404_title_format'];
708
+ $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
709
+ $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
710
+ $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
711
+ $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
712
+ $new_title = str_replace('%404_title%', $this->internationalize(wp_title('', false)), $new_title);
713
+ $header = $this->replace_title($header, $new_title);
714
+ }
715
+
716
+ return $header;
717
+
718
+ }
719
+
720
+ /**
721
+ * @return User-readable nice words for a given request.
722
+ */
723
+ function request_as_words($request) {
724
+ $request = htmlspecialchars($request);
725
+ $request = str_replace('.html', ' ', $request);
726
+ $request = str_replace('.htm', ' ', $request);
727
+ $request = str_replace('.', ' ', $request);
728
+ $request = str_replace('/', ' ', $request);
729
+ $request_a = explode(' ', $request);
730
+ $request_new = array();
731
+ foreach ($request_a as $token) {
732
+ $request_new[] = ucwords(trim($token));
733
+ }
734
+ $request = implode(' ', $request_new);
735
+ return $request;
736
+ }
737
+
738
+ function capitalize($s) {
739
+ $s = trim($s);
740
+ $tokens = explode(' ', $s);
741
+ while (list($key, $val) = each($tokens)) {
742
+ $tokens[$key] = trim($tokens[$key]);
743
+ $tokens[$key] = strtoupper(substr($tokens[$key], 0, 1)) . substr($tokens[$key], 1);
744
+ }
745
+ $s = implode(' ', $tokens);
746
+ return $s;
747
+ }
748
+
749
+ function trim_excerpt_without_filters($text) {
750
+ $text = str_replace(']]>', ']]&gt;', $text);
751
+ $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
752
+ $text = strip_tags($text);
753
+ $max = $this->maximum_description_length;
754
+
755
+ if ($max < strlen($text)) {
756
+ while($text[$max] != ' ' && $max > $this->minimum_description_length) {
757
+ $max--;
758
+ }
759
+ }
760
+ $text = substr($text, 0, $max);
761
+ return trim(stripcslashes($text));
762
+ }
763
+
764
+ function trim_excerpt_without_filters_full_length($text) {
765
+ $text = str_replace(']]>', ']]&gt;', $text);
766
+ $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
767
+ $text = strip_tags($text);
768
+ return trim(stripcslashes($text));
769
+ }
770
+
771
+ /**
772
+ * @return comma-separated list of unique keywords
773
+ */
774
+ function get_all_keywords() {
775
+ global $posts;
776
+ global $aioseop_options;
777
+
778
+ if (is_404()) {
779
+ return null;
780
+ }
781
+
782
+ // if we are on synthetic pages
783
+ if (!is_home() && !is_page() && !is_single() &&!$this->is_static_front_page() && !$this->is_static_posts_page()) {
784
+ return null;
785
+ }
786
+
787
+ $keywords = array();
788
+ if (is_array($posts)) {
789
+ foreach ($posts as $post) {
790
+ if ($post) {
791
+
792
+ // custom field keywords
793
+ $keywords_a = $keywords_i = null;
794
+ $description_a = $description_i = null;
795
+
796
+ $id = (is_attachment())?($post->post_parent):($post->ID); // if attachment then use parent post id
797
+ $keywords_i = stripcslashes($this->internationalize(get_post_meta($id, "_aioseop_keywords", true)));
798
+ //$id = $post->ID;
799
+ //$keywords_i = stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_keywords", true)));
800
+ $keywords_i = str_replace('"', '', $keywords_i);
801
+ if (isset($keywords_i) && !empty($keywords_i)) {
802
+ $traverse = explode(',', $keywords_i);
803
+ foreach ($traverse as $keyword) {
804
+ $keywords[] = $keyword;
805
+ }
806
+ }
807
+
808
+ // WP 2.3 tags
809
+ if (function_exists('get_the_tags')) {
810
+ //$tags = get_the_tags($post->ID);
811
+ $tags = get_the_tags($id);
812
+ if ($tags && is_array($tags)) {
813
+ foreach ($tags as $tag) {
814
+ $keywords[] = $this->internationalize($tag->name);
815
+ }
816
+ }
817
+ }
818
+
819
+ // Ultimate Tag Warrior integration
820
+ global $utw;
821
+ if ($utw) {
822
+ $tags = $utw->GetTagsForPost($post);
823
+ if (is_array($tags)) {
824
+ foreach ($tags as $tag) {
825
+ $tag = $tag->tag;
826
+ $tag = str_replace('_',' ', $tag);
827
+ $tag = str_replace('-',' ',$tag);
828
+ $tag = stripcslashes($tag);
829
+ $keywords[] = $tag;
830
+ }
831
+ }
832
+ }
833
+
834
+ // autometa
835
+ $autometa = stripcslashes(get_post_meta($id, 'autometa', true));
836
+ //$autometa = stripcslashes(get_post_meta($post->ID, "autometa", true));
837
+ if (isset($autometa) && !empty($autometa)) {
838
+ $autometa_array = explode(' ', $autometa);
839
+ foreach ($autometa_array as $e) {
840
+ $keywords[] = $e;
841
+ }
842
+ }
843
+
844
+ if ($aioseop_options['aiosp_use_categories'] && !is_page()) {
845
+ $categories = get_the_category($id);
846
+ //$categories = get_the_category($post->ID);
847
+ foreach ($categories as $category) {
848
+ $keywords[] = $this->internationalize($category->cat_name);
849
+ }
850
+ }
851
+
852
+ }
853
+ }
854
+ }
855
+
856
+ return $this->get_unique_keywords($keywords);
857
+ }
858
+
859
+ function get_meta_keywords() {
860
+ global $posts;
861
+
862
+ $keywords = array();
863
+ if (is_array($posts)) {
864
+ foreach ($posts as $post) {
865
+ if ($post) {
866
+ // custom field keywords
867
+ $keywords_a = $keywords_i = null;
868
+ $description_a = $description_i = null;
869
+ $id = $post->ID;
870
+ $keywords_i = stripcslashes(get_post_meta($post->ID, "_aioseop_keywords", true));
871
+ $keywords_i = str_replace('"', '', $keywords_i);
872
+ if (isset($keywords_i) && !empty($keywords_i)) {
873
+ $keywords[] = $keywords_i;
874
+ }
875
+ }
876
+ }
877
+ }
878
+
879
+ return $this->get_unique_keywords($keywords);
880
+ }
881
+
882
+ function get_unique_keywords($keywords) {
883
+ $small_keywords = array();
884
+ foreach ($keywords as $word) {
885
+ if (function_exists('mb_strtolower'))
886
+ $small_keywords[] = mb_strtolower($word, get_bloginfo('charset'));
887
+ else
888
+ $small_keywords[] = $this->strtolower($word);
889
+ }
890
+ $keywords_ar = array_unique($small_keywords);
891
+ return implode(',', $keywords_ar);
892
+ }
893
+
894
+ function get_url($url) {
895
+ if (function_exists('file_get_contents')) {
896
+ $file = file_get_contents($url);
897
+ } else {
898
+ $curl = curl_init($url);
899
+ curl_setopt($curl, CURLOPT_HEADER, 0);
900
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
901
+ $file = curl_exec($curl);
902
+ curl_close($curl);
903
+ }
904
+ return $file;
905
+ }
906
+
907
+ function log($message) {
908
+ if ($this->do_log) {
909
+ error_log(date('Y-m-d H:i:s') . " " . $message . "\n", 3, $this->log_file);
910
+ }
911
+ }
912
+
913
+ function download_newest_version() {
914
+ $success = true;
915
+ $file_content = $this->get_url($this->upgrade_url);
916
+ if ($file_content === false) {
917
+ $this->upgrade_error = sprintf(__("Could not download distribution (%s)"), $this->upgrade_url);
918
+ $success = false;
919
+ } else if (strlen($file_content) < 100) {
920
+ $this->upgrade_error = sprintf(__("Could not download distribution (%s): %s"), $this->upgrade_url, $file_content);
921
+ $success = false;
922
+ } else {
923
+ $this->log(sprintf("filesize of download ZIP: %d", strlen($file_content)));
924
+ $fh = @fopen($this->upgrade_filename, 'w');
925
+ $this->log("fh is $fh");
926
+ if (!$fh) {
927
+ $this->upgrade_error = sprintf(__("Could not open %s for writing"), $this->upgrade_filename);
928
+ $this->upgrade_error .= "<br />";
929
+ $this->upgrade_error .= sprintf(__("Please make sure %s is writable"), $this->upgrade_folder);
930
+ $success = false;
931
+ } else {
932
+ $bytes_written = @fwrite($fh, $file_content);
933
+ $this->log("wrote $bytes_written bytes");
934
+ if (!$bytes_written) {
935
+ $this->upgrade_error = sprintf(__("Could not write to %s"), $this->upgrade_filename);
936
+ $success = false;
937
+ }
938
+ }
939
+ if ($success) {
940
+ fclose($fh);
941
+ }
942
+ }
943
+ return $success;
944
+ }
945
+
946
+ function install_newest_version() {
947
+ $success = $this->download_newest_version();
948
+ if ($success) {
949
+ $success = $this->extract_plugin();
950
+ unlink($this->upgrade_filename);
951
+ }
952
+ return $success;
953
+ }
954
+
955
+ function extract_plugin() {
956
+ if (!class_exists('PclZip')) {
957
+ require_once ('pclzip.lib.php');
958
+ }
959
+ $archive = new PclZip($this->upgrade_filename);
960
+ $files = $archive->extract(PCLZIP_OPT_STOP_ON_ERROR, PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_PATH, $this->upgrade_folder);
961
+ $this->log("files is $files");
962
+ if (is_array($files)) {
963
+ $num_extracted = sizeof($files);
964
+ $this->log("extracted $num_extracted files to $this->upgrade_folder");
965
+ $this->log(print_r($files, true));
966
+ return true;
967
+ } else {
968
+ $this->upgrade_error = $archive->errorInfo();
969
+ return false;
970
+ }
971
+ }
972
+
973
+ /** crude approximization of whether current user is an admin */
974
+ function is_admin() {
975
+ return current_user_can('level_8');
976
+ }
977
+
978
+
979
+ function is_directory_writable($directory) {
980
+ $filename = $directory . '/' . 'tmp_file_' . time();
981
+ $fh = @fopen($filename, 'w');
982
+ if (!$fh) {
983
+ return false;
984
+ }
985
+
986
+ $written = fwrite($fh, "test");
987
+ fclose($fh);
988
+ unlink($filename);
989
+ if ($written) {
990
+ return true;
991
+ } else {
992
+ return false;
993
+ }
994
+ }
995
+
996
+
997
+ function is_upgrade_directory_writable() {
998
+ //return $this->is_directory_writable($this->upgrade_folder);
999
+ // let's assume it is
1000
+ return true;
1001
+ }
1002
+
1003
+
1004
+ function post_meta_tags($id) {
1005
+ $awmp_edit = $_POST["aiosp_edit"];
1006
+ $nonce = $_POST['nonce-aioseop-edit'];
1007
+ // if (!wp_verify_nonce($nonce, 'edit-aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress');
1008
+ if (isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce')) {
1009
+ $keywords = $_POST["aiosp_keywords"];
1010
+ $description = $_POST["aiosp_description"];
1011
+ $title = $_POST["aiosp_title"];
1012
+ $aiosp_meta = $_POST["aiosp_meta"];
1013
+ $aiosp_disable = $_POST["aiosp_disable"];
1014
+ $aiosp_titleatr = $_POST["aiosp_titleatr"];
1015
+ $aiosp_menulabel = $_POST["aiosp_menulabel"];
1016
+
1017
+ delete_post_meta($id, '_aioseop_keywords');
1018
+ delete_post_meta($id, '_aioseop_description');
1019
+ delete_post_meta($id, '_aioseop_title');
1020
+ delete_post_meta($id, '_aioseop_titleatr');
1021
+ delete_post_meta($id, '_aioseop_menulabel');
1022
+
1023
+
1024
+ if ($this->is_admin()) {
1025
+ delete_post_meta($id, '_aioseop_disable');
1026
+ }
1027
+ //delete_post_meta($id, 'aiosp_meta');
1028
+
1029
+ if (isset($keywords) && !empty($keywords)) {
1030
+ add_post_meta($id, '_aioseop_keywords', $keywords);
1031
+ }
1032
+ if (isset($description) && !empty($description)) {
1033
+ add_post_meta($id, '_aioseop_description', $description);
1034
+ }
1035
+ if (isset($title) && !empty($title)) {
1036
+ add_post_meta($id, '_aioseop_title', $title);
1037
+ }
1038
+ if (isset($aiosp_titleatr) && !empty($aiosp_titleatr)) {
1039
+ add_post_meta($id, '_aioseop_titleatr', $aiosp_titleatr);
1040
+ }
1041
+ if (isset($aiosp_menulabel) && !empty($aiosp_menulabel)) {
1042
+ add_post_meta($id, '_aioseop_menulabel', $aiosp_menulabel);
1043
+ }
1044
+ if (isset($aiosp_disable) && !empty($aiosp_disable) && $this->is_admin()) {
1045
+ add_post_meta($id, '_aioseop_disable', $aiosp_disable);
1046
+ }
1047
+ /*
1048
+ if (isset($aiosp_meta) && !empty($aiosp_meta)) {
1049
+ add_post_meta($id, 'aiosp_meta', $aiosp_meta);
1050
+ }
1051
+ */
1052
+ }
1053
+ }
1054
+
1055
+ function edit_category($id) {
1056
+ global $wpdb;
1057
+ $id = $wpdb->escape($id);
1058
+ $awmp_edit = $_POST["aiosp_edit"];
1059
+ if (isset($awmp_edit) && !empty($awmp_edit)) {
1060
+ $keywords = $wpdb->escape($_POST["aiosp_keywords"]);
1061
+ $title = $wpdb->escape($_POST["aiosp_title"]);
1062
+ $old_category = $wpdb->get_row("select * from $this->table_categories where category_id=$id", OBJECT);
1063
+ if ($old_category) {
1064
+ $wpdb->query($wpdb->prepare("update $this->table_categories
1065
+ set meta_title='$title', meta_keywords='$keywords'
1066
+ where category_id=$id"));
1067
+ } else {
1068
+ $wpdb->query($wpdb->prepare("insert into $this->table_categories(meta_title, meta_keywords, category_id)
1069
+ values ('$title', '$keywords', $id"));
1070
+ }
1071
+ //$wpdb->query($wpdb->prepare("insert into $this->table_categories"))
1072
+ /*
1073
+ delete_post_meta($id, 'keywords');
1074
+ delete_post_meta($id, 'description');
1075
+ delete_post_meta($id, 'title');
1076
+
1077
+ if (isset($keywords) && !empty($keywords)) {
1078
+ add_post_meta($id, 'keywords', $keywords);
1079
+ }
1080
+ if (isset($description) && !empty($description)) {
1081
+ add_post_meta($id, 'description', $description);
1082
+ }
1083
+ if (isset($title) && !empty($title)) {
1084
+ add_post_meta($id, 'title', $title);
1085
+ }
1086
+ */
1087
+ }
1088
+ }
1089
+
1090
+ /**
1091
+ * @deprecated This was for the feature of dedicated meta tags for categories which never went mainstream.
1092
+ */
1093
+ function edit_category_form() {
1094
+ global $post;
1095
+ $keywords = stripcslashes(get_post_meta($post->ID, '_aioseop_keywords', true));
1096
+ $title = stripcslashes(get_post_meta($post->ID, '_aioseop_title', true));
1097
+ $description = stripcslashes(get_post_meta($post->ID, '_aioseop_description', true));
1098
+ ?>
1099
+ <input value="aiosp_edit" type="hidden" name="aiosp_edit" />
1100
+ <table class="editform" width="100%" cellspacing="2" cellpadding="5">
1101
+ <tr>
1102
+ <th width="33%" scope="row" valign="top">
1103
+ <a href="http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></a>
1104
+ </th>
1105
+ </tr>
1106
+ <tr>
1107
+ <th width="33%" scope="row" valign="top"><label for="aiosp_title"><?php _e('Title:', 'all_in_one_seo_pack') ?></label></th>
1108
+ <td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="70"/></td>
1109
+ </tr>
1110
+ <tr>
1111
+ <th width="33%" scope="row" valign="top"><label for="aiosp_keywords"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></label></th>
1112
+ <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="70"/></td>
1113
+ </tr>
1114
+ </table>
1115
+ <?php
1116
+ }
1117
+
1118
+ function add_meta_tags_textinput() {
1119
+ global $post;
1120
+ $post_id = $post;
1121
+ if (is_object($post_id)) {
1122
+ $post_id = $post_id->ID;
1123
+ }
1124
+ $keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_keywords', true)));
1125
+ $title = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_title', true)));
1126
+ $description = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_description', true)));
1127
+ $aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_meta', true)));
1128
+ $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_disable', true)));
1129
+ $aiosp_titleatr = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_titleatr', true)));
1130
+ $aiosp_menulabel = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_menulabel', true)));
1131
+
1132
+ ?>
1133
+ <SCRIPT LANGUAGE="JavaScript">
1134
+ <!-- Begin
1135
+ function countChars(field,cntfield) {
1136
+ cntfield.value = field.value.length;
1137
+ }
1138
+ // End -->
1139
+ </script>
1140
+
1141
+ <?php if (substr($this->wp_version, 0, 3) >= '2.5') { ?>
1142
+ <div id="postaiosp" class="postbox closed">
1143
+ <h3><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
1144
+ <div class="inside">
1145
+ <div id="postaiosp">
1146
+ <?php } else { ?>
1147
+ <div class="dbx-b-ox-wrapper">
1148
+ <fieldset id="seodiv" class="dbx-box">
1149
+ <div class="dbx-h-andle-wrapper">
1150
+ <h3 class="dbx-handle"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
1151
+ </div>
1152
+ <div class="dbx-c-ontent-wrapper">
1153
+ <div class="dbx-content">
1154
+ <?php } ?>
1155
+
1156
+ <a target="__blank" href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/all-in-one-seo-pack/"><?php _e('Click here for Support', 'all_in_one_seo_pack') ?></a>
1157
+ <input value="aiosp_edit" type="hidden" name="aiosp_edit" />
1158
+ <table style="margin-bottom:40px">
1159
+ <tr>
1160
+ <th style="text-align:left;" colspan="2">
1161
+ </th>
1162
+ </tr>
1163
+ <tr>
1164
+ <th scope="row" style="text-align:right;"><?php _e('Title:', 'all_in_one_seo_pack') ?></th>
1165
+ <td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="62"/></td>
1166
+ </tr>
1167
+ <tr>
1168
+ <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
1169
+ <td><textarea name="aiosp_description" rows="1" cols="60"
1170
+ onKeyDown="countChars(document.post.aiosp_description,document.post.length1)"
1171
+ onKeyUp="countChars(document.post.aiosp_description,document.post.length1)"><?php echo $description ?></textarea><br />
1172
+ <input readonly type="text" name="length1" size="3" maxlength="3" value="<?php echo strlen($description);?>" />
1173
+ <?php _e(' characters. Most search engines use a maximum of 160 chars for the description.', 'all_in_one_seo_pack') ?>
1174
+ </td>
1175
+ </tr>
1176
+ <tr>
1177
+ <th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
1178
+ <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="62"/></td>
1179
+ </tr>
1180
+ <input type="hidden" name="nonce-aioseop-edit" value="<?php echo wp_create_nonce('edit-aioseop-nonce'); ?>" />
1181
+ <?php if ($this->is_admin()) { ?>
1182
+ <tr>
1183
+ <th scope="row" style="text-align:right; vertical-align:top;">
1184
+ <?php _e('Disable on this page/post:', 'all_in_one_seo_pack')?>
1185
+ </th>
1186
+ <td>
1187
+ <input type="checkbox" name="aiosp_disable" <?php if ($aiosp_disable) echo "checked=\"1\""; ?>/>
1188
+ </td>
1189
+ </tr>
1190
+
1191
+ <tr>
1192
+ <th scope="row" style="text-align:right;"><?php _e('Title Attribute:', 'all_in_one_seo_pack') ?></th>
1193
+ <td><input value="<?php echo $aiosp_titleatr ?>" type="text" name="aiosp_titleatr" size="62"/></td>
1194
+ </tr>
1195
+
1196
+ <tr>
1197
+ <th scope="row" style="text-align:right;"><?php _e('Menu Label:', 'all_in_one_seo_pack') ?></th>
1198
+ <td><input value="<?php echo $aiosp_menulabel ?>" type="text" name="aiosp_menulabel" size="62"/></td>
1199
+ </tr>
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+ <?php } ?>
1207
+
1208
+ </table>
1209
+
1210
+ <?php if (substr($this->wp_version, 0, 3) >= '2.5') { ?>
1211
+ </div></div></div>
1212
+ <?php } else { ?>
1213
+ </div>
1214
+ </fieldset>
1215
+ </div>
1216
+ <?php } ?>
1217
+
1218
+ <?php
1219
+ }
1220
+
1221
+ function admin_menu() {
1222
+ $file = __FILE__;
1223
+
1224
+ // hack for 1.5
1225
+ if (substr($this->wp_version, 0, 3) == '1.5') {
1226
+ $file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
1227
+ }
1228
+ //add_management_page(__('All in One SEO Title', 'all_in_one_seo_pack'), __('All in One SEO', 'all_in_one_seo_pack'), 10, $file, array($this, 'management_panel'));
1229
+ add_submenu_page('options-general.php', __('All in One SEO', 'all_in_one_seo_pack'), __('All in One SEO', 'all_in_one_seo_pack'), 10, $file, array($this, 'options_panel'));
1230
+ }
1231
+
1232
+ function management_panel() {
1233
+ $message = null;
1234
+ $base_url = "edit.php?page=" . __FILE__;
1235
+ //echo($base_url);
1236
+ $type = $_REQUEST['type'];
1237
+ if (!isset($type)) {
1238
+ $type = "posts";
1239
+ }
1240
+ ?>
1241
+
1242
+ <ul class="aiosp_menu">
1243
+ <li><a href="<?php echo $base_url ?>&type=posts">Posts</a>
1244
+ </li>
1245
+ <li><a href="<?php echo $base_url ?>&type=pages">Pages</a>
1246
+ </li>
1247
+ </ul>
1248
+
1249
+ <?php
1250
+
1251
+ if ($type == "posts") {
1252
+ echo("posts");
1253
+ } elseif ($type == "pages") {
1254
+ echo("pages");
1255
+ }
1256
+
1257
+ }
1258
+
1259
+ function options_panel() {
1260
+ $message = null;
1261
+ $message_updated = __("All in One SEO Options Updated.", 'all_in_one_seo_pack');
1262
+ global $aioseop_options;
1263
+ // update options
1264
+ if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
1265
+ $nonce = $_POST['nonce-aioseop'];
1266
+ if (!wp_verify_nonce($nonce, 'aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress');
1267
+ $message = $message_updated;
1268
+ $aioseop_options['aiosp_can'] = $_POST['aiosp_can'];
1269
+ $aioseop_options['aiosp_donate'] = $_POST['aiosp_donate'];
1270
+ $aioseop_options['aiosp_home_title'] = $_POST['aiosp_home_title'];
1271
+ $aioseop_options['aiosp_home_description'] = $_POST['aiosp_home_description'];
1272
+ $aioseop_options['aiosp_home_keywords'] = $_POST['aiosp_home_keywords'];
1273
+ $aioseop_options['aiosp_max_words_excerpt'] = $_POST['aiosp_max_words_excerpt'];
1274
+ $aioseop_options['aiosp_rewrite_titles'] = $_POST['aiosp_rewrite_titles'];
1275
+ $aioseop_options['aiosp_post_title_format'] = $_POST['aiosp_post_title_format'];
1276
+ $aioseop_options['aiosp_page_title_format'] = $_POST['aiosp_page_title_format'];
1277
+ $aioseop_options['aiosp_category_title_format'] = $_POST['aiosp_category_title_format'];
1278
+ $aioseop_options['aiosp_archive_title_format'] = $_POST['aiosp_archive_title_format'];
1279
+ $aioseop_options['aiosp_tag_title_format'] = $_POST['aiosp_tag_title_format'];
1280
+ $aioseop_options['aiosp_search_title_format'] = $_POST['aiosp_search_title_format'];
1281
+ $aioseop_options['aiosp_description_format'] = $_POST['aiosp_description_format'];
1282
+ $aioseop_options['aiosp_404_title_format'] = $_POST['aiosp_404_title_format'];
1283
+ $aioseop_options['aiosp_paged_format'] = $_POST['aiosp_paged_format'];
1284
+ $aioseop_options['aiosp_use_categories'] = $_POST['aiosp_use_categories'];
1285
+ $aioseop_options['aiosp_dynamic_postspage_keywords'] = $_POST['aiosp_dynamic_postspage_keywords'];
1286
+ $aioseop_options['aiosp_category_noindex'] = $_POST['aiosp_category_noindex'];
1287
+ $aioseop_options['aiosp_archive_noindex'] = $_POST['aiosp_archive_noindex'];
1288
+ $aioseop_options['aiosp_tags_noindex'] = $_POST['aiosp_tags_noindex'];
1289
+ $aioseop_options['aiosp_generate_descriptions'] = $_POST['aiosp_generate_descriptions'];
1290
+ $aioseop_options['aiosp_debug_info'] = $_POST['aiosp_debug_info'];
1291
+ $aioseop_options['aiosp_post_meta_tags'] = $_POST['aiosp_post_meta_tags'];
1292
+ $aioseop_options['aiosp_page_meta_tags'] = $_POST['aiosp_page_meta_tags'];
1293
+ $aioseop_options['aiosp_home_meta_tags'] = $_POST['aiosp_home_meta_tags'];
1294
+ $aioseop_options['aiosp_do_log'] = $_POST['aiosp_do_log'];
1295
+ $aioseop_options['aiosp_enabled'] = $_POST['aiosp_enabled'];
1296
+
1297
+ update_option('aioseop_options', $aioseop_options);
1298
+
1299
+ if (function_exists('wp_cache_flush')) {
1300
+ wp_cache_flush();
1301
+ }
1302
+ } /*elseif ($_POST['aiosp_upgrade']) {
1303
+ $message = __("Upgraded to newest version. Please revisit the options page to make sure you see the newest version.", 'all_in_one_seo_pack');
1304
+ $success = $this->install_newest_version();
1305
+ if (!$success) {
1306
+ $message = __("Upgrade failed", 'all_in_one_seo_pack');
1307
+ if (isset($this->upgrade_error) && !empty($this->upgrade_error)) {
1308
+ $message .= ": " . $this->upgrade_error;
1309
+ } else {
1310
+ $message .= ".";
1311
+ }
1312
+ }
1313
+ }*/
1314
+
1315
+ ?>
1316
+ <?php if ($message) : ?>
1317
+ <div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
1318
+ <?php endif; ?>
1319
+ <div id="dropmessage" class="updated" style="display:none;"></div>
1320
+ <div class="wrap">
1321
+ <h2><?php _e('All in One SEO Plugin Options', 'all_in_one_seo_pack'); ?></h2>
1322
+ <p>
1323
+ <?php //_e("This is version ", 'all_in_one_seo_pack') ?><?php //_e("$this->version ", 'all_in_one_seo_pack') ?>
1324
+ &nbsp;<a target="_blank" title="<?php _e('All in One SEO Plugin Release History', 'all_in_one_seo_pack')?>"
1325
+ href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-pack-release-history/"><?php _e("Changelog", 'all_in_one_seo_pack')?>
1326
+ </a>
1327
+ | <a target="_blank" title="<?php _e('FAQ', 'all_in_one_seo_pack') ?>"
1328
+ href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/"><?php _e('FAQ', 'all_in_one_seo_pack') ?></a>
1329
+ | <a target="_blank" title="<?php _e('All in One SEO Plugin Support Forum', 'all_in_one_seo_pack') ?>"
1330
+ href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/forum/"><?php _e('Support', 'all_in_one_seo_pack') ?></a>
1331
+ | <a target="_blank" title="<?php _e('All in One SEO Plugin Translations', 'all_in_one_seo_pack') ?>"
1332
+ href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/translations-for-all-in-one-seo-pack/"><?php _e('Translations', 'all_in_one_seo_pack') ?></a>
1333
+ <br /><br />
1334
+ <a target="_blank" title="<?php echo 'Donate' ?>"
1335
+ href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8"><img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" width="" alt="Donate" /><?php //echo 'Donate' ?></a>
1336
+ | <a target="_blank" title="Amazon Wish List" href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web"><img src="https://images-na.ssl-images-amazon.com/images/G/01/gifts/registries/wishlist/v2/web/wl-btn-74-b._V46774601_.gif" width="74" alt="My Amazon.com Wish List" height="42" border="0" /></a>
1337
+ | <a target="_blank" title="<?php _e('Follow us on Twitter', 'all_in_one_seo_pack') ?>"
1338
+ href="http://twitter.com/michaeltorbert/"><img src="<?php echo WP_PLUGIN_URL; ?>/all-in-one-seo-pack/images/twitter.png" alt="<?php _e('Follow Us on Twitter', 'all_in_one_seo_pack') ?>" height="47px" /></a>
1339
+
1340
+ </p>
1341
+
1342
+
1343
+ <!--
1344
+ <p>
1345
+ <?php
1346
+ //$canwrite = $this->is_upgrade_directory_writable();
1347
+ //$canwrite = false;
1348
+ ?>
1349
+ <form class="form-table" name="dofollow" action="" method="post">
1350
+ <p class="submit">
1351
+ <input type="submit" <?php //if (!$canwrite) echo(' disabled="disabled" ');?> name="aiosp_upgrade" value="<?php //_e('One Click Upgrade', 'all_in_one_seo_pack')?> &raquo;" />
1352
+ <strong><?php //_e("(Remember: Backup early, backup often!)", 'all_in_one_seo_pack') ?></strong>
1353
+ </form>
1354
+ </p>
1355
+ <p></p>
1356
+
1357
+
1358
+ <?php //if (!$canwrite) {
1359
+ //echo("<p><strong>"); echo(sprintf(__("Please make sure that %s is writable.", 'all_in_one_seo_pack'), $this->upgrade_folder)); echo("</p></strong>");
1360
+ // } ?>
1361
+ </p>
1362
+ -->
1363
+
1364
+ <script type="text/javascript">
1365
+ <!--
1366
+ function toggleVisibility(id) {
1367
+ var e = document.getElementById(id);
1368
+ if(e.style.display == 'block')
1369
+ e.style.display = 'none';
1370
+ else
1371
+ e.style.display = 'block';
1372
+ }
1373
+ //-->
1374
+ </script>
1375
+
1376
+ <h3><?php _e('Click on option titles to get help!', 'all_in_one_seo_pack') ?></h3>
1377
+ Highest
1378
+ <?php
1379
+ $uri = "http://donations.semperfiwebdesign.com/category/highest-donations/feed/";
1380
+ include_once(ABSPATH . WPINC . '/rss.php');
1381
+ $rss = fetch_rss($uri);
1382
+ $maxitems = 5;
1383
+ if(is_array($rss->items)){
1384
+ $items = array_slice($rss->items, 0, $maxitems);
1385
+ ?>
1386
+ <ul>
1387
+ <?php if (empty($items)) echo '<li>No items</li>';
1388
+ else
1389
+ foreach ( $items as $item ) : ?>
1390
+ <li><a href='<?php echo $item['description']; ?>'
1391
+ title='<?php echo $item['title']; ?>'>
1392
+ <?php echo $item['title']; ?>
1393
+ </a></li>
1394
+ <?php endforeach; ?>
1395
+ </ul>
1396
+ <?php } ?>
1397
+ Donations
1398
+ <?php
1399
+ $uri = "http://donations.semperfiwebdesign.com/category/all-in-one-seo-pack/feed/";
1400
+ include_once(ABSPATH . WPINC . '/rss.php');
1401
+ $rss = fetch_rss($uri);
1402
+ $maxitems = 5;
1403
+ if(is_array($rss->items)){
1404
+ $items = array_slice($rss->items, 0, $maxitems);
1405
+ ?>
1406
+ <ul>
1407
+ <?php if (empty($items)) echo '<li>No items</li>';
1408
+ else
1409
+ foreach ( $items as $item ) : ?>
1410
+ <li><a href='<?php echo $item['link']; ?>'
1411
+ title='<?php echo $item['title']; ?>'>
1412
+ <?php echo $item['title']; ?>
1413
+ </a></li>
1414
+ <?php endforeach; ?>
1415
+ </ul>
1416
+ <?php } ?>
1417
+
1418
+ <?php
1419
+ global $wpdb;
1420
+ $somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'keywords'");
1421
+ $somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'title'") + $somecount;
1422
+ $somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'description'") + $somecount;
1423
+ $somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'aiosp_meta'") + $somecount;
1424
+ $somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'aiosp_disable'") + $somecount;
1425
+ if($somecount > 0){
1426
+ echo "<div class='error' style='text-align:center;'><p><strong>Your database meta needs to be updated. " . $somecount . " old fields remaining</strong> <em>(Back up your database before updating.)</em>
1427
+ <FORM action='' method='post' name='aioseop-migrate'>
1428
+ <input type='hidden' name='nonce-aioseop-migrate' value='" . wp_create_nonce('aioseop-migrate-nonce') . "' />
1429
+ <input type='submit' name='aioseop_migrate' class='button-primary' value='Update Database'>
1430
+ </FORM>
1431
+ </p></div>";
1432
+ }
1433
+
1434
+ if(!get_option('aioseop_options')){
1435
+ echo "<div class='error' style='text-align:center;'><p><strong>Your database options need to be updated.</strong><em>(Back up your database before updating.)</em>
1436
+ <FORM action='' method='post' name='aioseop-migrate-options'>
1437
+ <input type='hidden' name='nonce-aioseop-migrate-options' value='" . wp_create_nonce('aioseop-migrate-nonce-options') . "' />
1438
+ <input type='submit' name='aioseop_migrate_options' class='button-primary' value='Update Database Options'>
1439
+ </FORM>
1440
+ </p></div>";
1441
+
1442
+ }
1443
+
1444
+ ?>
1445
+
1446
+
1447
+ <form name="dofollow" action="" method="post">
1448
+ <table class="form-table">
1449
+ <?php $aioseop_options = get_option('aioseop_options'); ?>
1450
+ <?php if (!$aioseop_options['aiosp_donate']){?>
1451
+ <tr>
1452
+ <th scope="row" style="text-align:right; vertical-align:top;">
1453
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_donate_tip');">
1454
+ <?php _e('I enjoy this plugin and have made a donation:', 'all_in_one_seo_pack')?>
1455
+ </a>
1456
+ </td>
1457
+ <td>
1458
+ <input type="checkbox" name="aiosp_donate" <?php if ($aioseop_options['aiosp_donate']) echo "checked=\"1\""; ?>/>
1459
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_donate_tip">
1460
+ <?php
1461
+ _e('All donations support continued development of this free software.', 'all_in_one_seo_pack');
1462
+ ?>
1463
+ </div>
1464
+ </td>
1465
+ </tr>
1466
+ <?php } ?>
1467
+
1468
+ <tr>
1469
+ <th scope="row" style="text-align:right; vertical-align:top;">
1470
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_enabled_tip');">
1471
+ <?php _e('Plugin Status:', 'all_in_one_seo_pack')?>
1472
+ </a>
1473
+ </td>
1474
+ <td>
1475
+ <input type="radio" name="aiosp_enabled" value="1" <?php if($aioseop_options['aiosp_enabled']) echo "checked"?> > Enabled<br>
1476
+ <input type="radio" name="aiosp_enabled" value="0" <?php if(!$aioseop_options['aiosp_enabled']) echo "checked"?>> Disabled
1477
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_enabled_tip">
1478
+ <?php
1479
+ _e('All in One SEO Pack must be enabled for use.', 'all_in_one_seo_pack');
1480
+ ?>
1481
+ </div>
1482
+ </td>
1483
+ </tr>
1484
+
1485
+ <tr>
1486
+ <th scope="row" style="text-align:right; vertical-align:top;">
1487
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_title_tip');">
1488
+ <?php _e('Home Title:', 'all_in_one_seo_pack')?>
1489
+ </a>
1490
+ </td>
1491
+ <td>
1492
+ <textarea cols="57" rows="2" name="aiosp_home_title"><?php echo stripcslashes($aioseop_options['aiosp_home_title']); ?></textarea>
1493
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_title_tip">
1494
+ <?php
1495
+ _e('As the name implies, this will be the title of your homepage. This is independent of any other option. If not set, the default blog title will get used.', 'all_in_one_seo_pack');
1496
+ ?>
1497
+ </div>
1498
+ </td>
1499
+ </tr>
1500
+
1501
+ <tr>
1502
+ <th scope="row" style="text-align:right; vertical-align:top;">
1503
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_description_tip');">
1504
+ <?php _e('Home Description:', 'all_in_one_seo_pack')?>
1505
+ </a>
1506
+ </td>
1507
+ <td>
1508
+ <textarea cols="57" rows="2" name="aiosp_home_description"><?php echo stripcslashes($aioseop_options['aiosp_home_description']); ?></textarea>
1509
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_description_tip">
1510
+ <?php
1511
+ _e('The META description for your homepage. Independent of any other options, the default is no META description at all if this is not set.', 'all_in_one_seo_pack');
1512
+ ?>
1513
+ </div>
1514
+ </td>
1515
+ </tr>
1516
+
1517
+ <tr>
1518
+ <th scope="row" style="text-align:right; vertical-align:top;">
1519
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_keywords_tip');">
1520
+ <?php _e('Home Keywords (comma separated):', 'all_in_one_seo_pack')?>
1521
+ </a>
1522
+ </td>
1523
+ <td>
1524
+ <textarea cols="57" rows="2" name="aiosp_home_keywords"><?php echo stripcslashes($aioseop_options['aiosp_home_keywords']); ?></textarea>
1525
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_keywords_tip">
1526
+ <?php
1527
+ _e("A comma separated list of your most important keywords for your site that will be written as META keywords on your homepage. Don't stuff everything in here.", 'all_in_one_seo_pack');
1528
+ ?>
1529
+ </div>
1530
+ </td>
1531
+ </tr>
1532
+
1533
+ <tr>
1534
+ <th scope="row" style="text-align:right; vertical-align:top;">
1535
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_can_tip');">
1536
+ <?php _e('Canonical URLs:', 'all_in_one_seo_pack')?>
1537
+ </a>
1538
+ </td>
1539
+ <td>
1540
+ <input type="checkbox" name="aiosp_can" <?php if ($aioseop_options['aiosp_can']) echo "checked=\"1\""; ?>/>
1541
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_can_tip">
1542
+ <?php
1543
+ _e("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');
1544
+ ?>
1545
+ </div>
1546
+ </td>
1547
+ </tr>
1548
+
1549
+ <tr>
1550
+ <th scope="row" style="text-align:right; vertical-align:top;">
1551
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_rewrite_titles_tip');">
1552
+ <?php _e('Rewrite Titles:', 'all_in_one_seo_pack')?>
1553
+ </a>
1554
+ </td>
1555
+ <td>
1556
+ <input type="checkbox" name="aiosp_rewrite_titles" <?php if ($aioseop_options['aiosp_rewrite_titles']) echo "checked=\"1\""; ?>/>
1557
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_rewrite_titles_tip">
1558
+ <?php
1559
+ _e("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 window title bar and of course in the source. If set, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: The default templates puts the title tag of posts like this: “Blog Archive >> Blog Name >> Post Title” (maybe I've overdone slightly). This is far from optimal. With the default post title format, Rewrite Title rewrites this to “Post Title | Blog Name”. If you have manually defined a title (in one of the text fields for All in One SEO Plugin input) this will become the title of your post in the format string.", 'all_in_one_seo_pack');
1560
+ ?>
1561
+ </div>
1562
+ </td>
1563
+ </tr>
1564
+
1565
+ <tr>
1566
+ <th scope="row" style="text-align:right; vertical-align:top;">
1567
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_title_format_tip');">
1568
+ <?php _e('Post Title Format:', 'all_in_one_seo_pack')?>
1569
+ </a>
1570
+ </td>
1571
+ <td>
1572
+ <input size="59" name="aiosp_post_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_post_title_format']); ?>"/>
1573
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_post_title_format_tip">
1574
+ <?php
1575
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1576
+ echo('<ul>');
1577
+ echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1578
+ echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1579
+ echo('<li>'); _e('%post_title% - The original title of the post', 'all_in_one_seo_pack'); echo('</li>');
1580
+ echo('<li>'); _e('%category_title% - The (main) category of the post', 'all_in_one_seo_pack'); echo('</li>');
1581
+ echo('<li>'); _e('%category% - Alias for %category_title%', 'all_in_one_seo_pack'); echo('</li>');
1582
+ echo('<li>'); _e("%post_author_login% - This post's author' login", 'all_in_one_seo_pack'); echo('</li>');
1583
+ echo('<li>'); _e("%post_author_nicename% - This post's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
1584
+ echo('<li>'); _e("%post_author_firstname% - This post's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1585
+ echo('<li>'); _e("%post_author_lastname% - This post's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1586
+ echo('</ul>');
1587
+ ?>
1588
+ </div>
1589
+ </td>
1590
+ </tr>
1591
+
1592
+ <tr>
1593
+ <th scope="row" style="text-align:right; vertical-align:top;">
1594
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_title_format_tip');">
1595
+ <?php _e('Page Title Format:', 'all_in_one_seo_pack')?>
1596
+ </a>
1597
+ </td>
1598
+ <td>
1599
+ <input size="59" name="aiosp_page_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_page_title_format']); ?>"/>
1600
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_page_title_format_tip">
1601
+ <?php
1602
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1603
+ echo('<ul>');
1604
+ echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1605
+ echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1606
+ echo('<li>'); _e('%page_title% - The original title of the page', 'all_in_one_seo_pack'); echo('</li>');
1607
+ echo('<li>'); _e("%page_author_login% - This page's author' login", 'all_in_one_seo_pack'); echo('</li>');
1608
+ echo('<li>'); _e("%page_author_nicename% - This page's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
1609
+ echo('<li>'); _e("%page_author_firstname% - This page's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1610
+ echo('<li>'); _e("%page_author_lastname% - This page's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1611
+ echo('</ul>');
1612
+ ?>
1613
+ </div>
1614
+ </td>
1615
+ </tr>
1616
+
1617
+ <tr>
1618
+ <th scope="row" style="text-align:right; vertical-align:top;">
1619
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_title_format_tip');">
1620
+ <?php _e('Category Title Format:', 'all_in_one_seo_pack')?>
1621
+ </a>
1622
+ </td>
1623
+ <td>
1624
+ <input size="59" name="aiosp_category_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_category_title_format']); ?>"/>
1625
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_category_title_format_tip">
1626
+ <?php
1627
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1628
+ echo('<ul>');
1629
+ echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1630
+ echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1631
+ echo('<li>'); _e('%category_title% - The original title of the category', 'all_in_one_seo_pack'); echo('</li>');
1632
+ echo('<li>'); _e('%category_description% - The description of the category', 'all_in_one_seo_pack'); echo('</li>');
1633
+ echo('</ul>');
1634
+ ?>
1635
+ </div>
1636
+ </td>
1637
+ </tr>
1638
+
1639
+ <tr>
1640
+ <th scope="row" style="text-align:right; vertical-align:top;">
1641
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_title_format_tip');">
1642
+ <?php _e('Archive Title Format:', 'all_in_one_seo_pack')?>
1643
+ </a>
1644
+ </td>
1645
+ <td>
1646
+ <input size="59" name="aiosp_archive_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_archive_title_format']); ?>"/>
1647
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_archive_title_format_tip">
1648
+ <?php
1649
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1650
+ echo('<ul>');
1651
+ echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1652
+ echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1653
+ echo('<li>'); _e('%date% - The original archive title given by wordpress, e.g. "2007" or "2007 August"', 'all_in_one_seo_pack'); echo('</li>');
1654
+ echo('</ul>');
1655
+ ?>
1656
+ </div>
1657
+ </td>
1658
+ </tr>
1659
+
1660
+ <tr>
1661
+ <th scope="row" style="text-align:right; vertical-align:top;">
1662
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_tag_title_format_tip');">
1663
+ <?php _e('Tag Title Format:', 'all_in_one_seo_pack')?>
1664
+ </a>
1665
+ </td>
1666
+ <td>
1667
+ <input size="59" name="aiosp_tag_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_tag_title_format']); ?>"/>
1668
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_tag_title_format_tip">
1669
+ <?php
1670
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1671
+ echo('<ul>');
1672
+ echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1673
+ echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1674
+ echo('<li>'); _e('%tag% - The name of the tag', 'all_in_one_seo_pack'); echo('</li>');
1675
+ echo('</ul>');
1676
+ ?>
1677
+ </div>
1678
+ </td>
1679
+ </tr>
1680
+
1681
+ <tr>
1682
+ <th scope="row" style="text-align:right; vertical-align:top;">
1683
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_search_title_format_tip');">
1684
+ <?php _e('Search Title Format:', 'all_in_one_seo_pack')?>
1685
+ </a>
1686
+ </td>
1687
+ <td>
1688
+ <input size="59" name="aiosp_search_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_search_title_format']); ?>"/>
1689
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_search_title_format_tip">
1690
+ <?php
1691
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1692
+ echo('<ul>');
1693
+ echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1694
+ echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1695
+ echo('<li>'); _e('%search% - What was searched for', 'all_in_one_seo_pack'); echo('</li>');
1696
+ echo('</ul>');
1697
+ ?>
1698
+ </div>
1699
+ </td>
1700
+ </tr>
1701
+
1702
+ <tr>
1703
+ <th scope="row" style="text-align:right; vertical-align:top;">
1704
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_description_format_tip');">
1705
+ <?php _e('Description Format:', 'all_in_one_seo_pack')?>
1706
+ </a>
1707
+ </td>
1708
+ <td>
1709
+ <input size="59" name="aiosp_description_format" value="<?php echo stripcslashes($aioseop_options['aiosp_description_format']); ?>"/>
1710
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_description_format_tip">
1711
+ <?php
1712
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1713
+ echo('<ul>');
1714
+ echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1715
+ echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1716
+ echo('<li>'); _e('%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'); echo('</li>');
1717
+ echo('<li>'); _e('%wp_title% - The original wordpress title, e.g. post_title for posts', 'all_in_one_seo_pack'); echo('</li>');
1718
+ echo('</ul>');
1719
+ ?>
1720
+ </div>
1721
+ </td>
1722
+ </tr>
1723
+
1724
+ <tr>
1725
+ <th scope="row" style="text-align:right; vertical-align:top;">
1726
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_404_title_format_tip');">
1727
+ <?php _e('404 Title Format:', 'all_in_one_seo_pack')?>
1728
+ </a>
1729
+ </td>
1730
+ <td>
1731
+ <input size="59" name="aiosp_404_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_404_title_format']); ?>"/>
1732
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_404_title_format_tip">
1733
+ <?php
1734
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1735
+ echo('<ul>');
1736
+ echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1737
+ echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1738
+ echo('<li>'); _e('%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all_in_one_seo_pack'); echo('</li>');
1739
+ echo('<li>'); _e('%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all_in_one_seo_pack'); echo('</li>');
1740
+ echo('<li>'); _e('%404_title% - Additional 404 title input"', 'all_in_one_seo_pack'); echo('</li>');
1741
+ echo('</ul>');
1742
+ ?>
1743
+ </div>
1744
+ </td>
1745
+ </tr>
1746
+
1747
+ <tr>
1748
+ <th scope="row" style="text-align:right; vertical-align:top;">
1749
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_paged_format_tip');">
1750
+ <?php _e('Paged Format:', 'all_in_one_seo_pack')?>
1751
+ </a>
1752
+ </td>
1753
+ <td>
1754
+ <input size="59" name="aiosp_paged_format" value="<?php echo stripcslashes($aioseop_options['aiosp_paged_format']); ?>"/>
1755
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_paged_format_tip">
1756
+ <?php
1757
+ _e('This string gets appended/prepended to titles when they are for paged index pages (like home or archive pages).', 'all_in_one_seo_pack');
1758
+ _e('The following macros are supported:', 'all_in_one_seo_pack');
1759
+ echo('<ul>');
1760
+ echo('<li>'); _e('%page% - The page number', 'all_in_one_seo_pack'); echo('</li>');
1761
+ echo('</ul>');
1762
+ ?>
1763
+ </div>
1764
+ </td>
1765
+ </tr>
1766
+
1767
+ <tr>
1768
+ <th scope="row" style="text-align:right; vertical-align:top;">
1769
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_use_categories_tip');">
1770
+ <?php _e('Use Categories for META keywords:', 'all_in_one_seo_pack')?>
1771
+ </td>
1772
+ <td>
1773
+ <input type="checkbox" name="aiosp_use_categories" <?php if ($aioseop_options['aiosp_use_categories']) echo "checked=\"1\""; ?>/>
1774
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_use_categories_tip">
1775
+ <?php
1776
+ _e('Check this if you want your categories for a given post used as the META keywords for this post (in addition to any keywords and tags you specify on the post edit page).', 'all_in_one_seo_pack');
1777
+ ?>
1778
+ </div>
1779
+ </td>
1780
+ </tr>
1781
+
1782
+ <tr>
1783
+ <th scope="row" style="text-align:right; vertical-align:top;">
1784
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_dynamic_postspage_keywords_tip');">
1785
+ <?php _e('Dynamically Generate Keywords for Posts Page:', 'all_in_one_seo_pack')?>
1786
+ </td>
1787
+ <td>
1788
+ <input type="checkbox" name="aiosp_dynamic_postspage_keywords" <?php if ($aioseop_options['aiosp_dynamic_postspage_keywords']) echo "checked=\"1\""; ?>/>
1789
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_dynamic_postspage_keywords_tip">
1790
+ <?php
1791
+ _e('Check this if you want your keywords on a custom posts page (set it in options->reading) 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');
1792
+ ?>
1793
+ </div>
1794
+ </td>
1795
+ </tr>
1796
+
1797
+ <tr>
1798
+ <th scope="row" style="text-align:right; vertical-align:top;">
1799
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_noindex_tip');">
1800
+ <?php _e('Use noindex for Categories:', 'all_in_one_seo_pack')?>
1801
+ </a>
1802
+ </td>
1803
+ <td>
1804
+ <input type="checkbox" name="aiosp_category_noindex" <?php if ($aioseop_options['aiosp_category_noindex']) echo "checked=\"1\""; ?>/>
1805
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_category_noindex_tip">
1806
+ <?php
1807
+ _e('Check this for excluding category pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
1808
+ ?>
1809
+ </div>
1810
+ </td>
1811
+ </tr>
1812
+
1813
+ <tr>
1814
+ <th scope="row" style="text-align:right; vertical-align:top;">
1815
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_noindex_tip');">
1816
+ <?php _e('Use noindex for Archives:', 'all_in_one_seo_pack')?>
1817
+ </a>
1818
+ </td>
1819
+ <td>
1820
+ <input type="checkbox" name="aiosp_archive_noindex" <?php if ($aioseop_options['aiosp_archive_noindex']) echo "checked=\"1\""; ?>/>
1821
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_archive_noindex_tip">
1822
+ <?php
1823
+ _e('Check this for excluding archive pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
1824
+ ?>
1825
+ </div>
1826
+ </td>
1827
+ </tr>
1828
+
1829
+ <tr>
1830
+ <th scope="row" style="text-align:right; vertical-align:top;">
1831
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_tags_noindex_tip');">
1832
+ <?php _e('Use noindex for Tag Archives:', 'all_in_one_seo_pack')?>
1833
+ </a>
1834
+ </td>
1835
+ <td>
1836
+ <input type="checkbox" name="aiosp_tags_noindex" <?php if ($aioseop_options['aiosp_tags_noindex']) echo "checked=\"1\""; ?>/>
1837
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_tags_noindex_tip">
1838
+ <?php
1839
+ _e('Check this for excluding tag pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
1840
+ ?>
1841
+ </div>
1842
+ </td>
1843
+ </tr>
1844
+
1845
+ <tr>
1846
+ <th scope="row" style="text-align:right; vertical-align:top;">
1847
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_generate_descriptions_tip');">
1848
+ <?php _e('Autogenerate Descriptions:', 'all_in_one_seo_pack')?>
1849
+ </a>
1850
+ </td>
1851
+ <td>
1852
+ <input type="checkbox" name="aiosp_generate_descriptions" <?php if ($aioseop_options['aiosp_generate_descriptions']) echo "checked=\"1\""; ?>/>
1853
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_generate_descriptions_tip">
1854
+ <?php
1855
+ _e("Check this and your META descriptions will get autogenerated if there's no excerpt.", 'all_in_one_seo_pack');
1856
+ ?>
1857
+ </div>
1858
+ </td>
1859
+ </tr>
1860
+
1861
+ <tr>
1862
+ <th scope="row" style="text-align:right; vertical-align:top;">
1863
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_meta_tags_tip');">
1864
+ <?php _e('Additional Post Headers:', 'all_in_one_seo_pack')?>
1865
+ </a>
1866
+ </td>
1867
+ <td>
1868
+ <textarea cols="57" rows="2" name="aiosp_post_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_post_meta_tags']); ?></textarea>
1869
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_post_meta_tags_tip">
1870
+ <?php
1871
+ _e('What you enter here will be copied verbatim to your header on post pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
1872
+ ?>
1873
+ </div>
1874
+ </td>
1875
+ </tr>
1876
+
1877
+ <tr>
1878
+ <th scope="row" style="text-align:right; vertical-align:top;">
1879
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_meta_tags_tip');">
1880
+ <?php _e('Additional Page Headers:', 'all_in_one_seo_pack')?>
1881
+ </a>
1882
+ </td>
1883
+ <td>
1884
+ <textarea cols="57" rows="2" name="aiosp_page_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_page_meta_tags']); ?></textarea>
1885
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_page_meta_tags_tip">
1886
+ <?php
1887
+ _e('What you enter here will be copied verbatim to your header on pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
1888
+ ?>
1889
+ </div>
1890
+ </td>
1891
+ </tr>
1892
+
1893
+ <tr>
1894
+ <th scope="row" style="text-align:right; vertical-align:top;">
1895
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_meta_tags_tip');">
1896
+ <?php _e('Additional Home Headers:', 'all_in_one_seo_pack')?>
1897
+ </a>
1898
+ </td>
1899
+ <td>
1900
+ <textarea cols="57" rows="2" name="aiosp_home_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_home_meta_tags']); ?></textarea>
1901
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_meta_tags_tip">
1902
+ <?php
1903
+ _e('What you enter here will be copied verbatim to your header on the home page. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
1904
+ ?>
1905
+ </div>
1906
+ </td>
1907
+ </tr>
1908
+
1909
+ <tr>
1910
+ <th scope="row" style="text-align:right; vertical-align:top;">
1911
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'auto_social')?>" onclick="toggleVisibility('aiosp_do_log_tip');">
1912
+ <?php _e('Log important events:', 'all_in_one_seo_pack')?>
1913
+ </a>
1914
+ </td>
1915
+ <td>
1916
+ <input type="checkbox" name="aiosp_do_log" <?php if ($aioseop_options['aiosp_do_log']) echo "checked=\"1\""; ?>/>
1917
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_do_log_tip">
1918
+ <?php
1919
+ _e('Check this and SEO pack will create a log of important events (all_in_one_seo_pack.log) in its plugin directory which might help debugging it. Make sure this directory is writable.', 'all_in_one_seo_pack');
1920
+ ?>
1921
+ </div>
1922
+ </td>
1923
+ </tr>
1924
+
1925
+ <?php if ($aioseop_options['aiosp_donate']){?>
1926
+ <tr>
1927
+ <th scope="row" style="text-align:right; vertical-align:top;">
1928
+ <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_donate_tip');">
1929
+ <?php _e('Thank you for your donation:', 'all_in_one_seo_pack')?>
1930
+ </a>
1931
+ </td>
1932
+ <td>
1933
+ <input type="checkbox" name="aiosp_donate" <?php if ($aioseop_options['aiosp_donate']) echo "checked=\"1\""; ?>/>
1934
+ <div style="max-width:500px; text-align:left; display:none" id="aiosp_donate_tip">
1935
+ <?php
1936
+ _e('All donations support continued development of this free software.', 'all_in_one_seo_pack');
1937
+ ?>
1938
+ </div>
1939
+ </td>
1940
+ </tr>
1941
+ <?php } ?>
1942
+
1943
+ </table>
1944
+ <p class="submit">
1945
+ <input type="hidden" name="action" value="aiosp_update" />
1946
+ <input type="hidden" name="nonce-aioseop" value="<?php echo wp_create_nonce('aioseop-nonce'); ?>" />
1947
+ <input type="hidden" name="page_options" value="aiosp_home_description" />
1948
+ <input type="submit" class='button-primary' name="Submit" value="<?php _e('Update Options', 'all_in_one_seo_pack')?> &raquo;" />
1949
+ </p>
1950
+ <p><br />
1951
+ <strong>Check out these other great plugins!</strong><br />
1952
+ <a href="http://semperfiwebdesign.com/custom-applications/sms-text-message/" title="SMS Text Message WordPress plugin">SMS Text Message</a> - sends SMS updates to your readers<br />
1953
+ <a href="http://semperfiwebdesign.com/custom-applications/wp-security-scan/" title="WordPress Security">WordPress Security Scan</a> - provides vital security for your WordPress site
1954
+ </p>
1955
+ </form>
1956
+ </div>
1957
+ <?php
1958
+
1959
+ } // options_panel
1960
+
1961
+ }
1962
+
1963
+ ?>
all_in_one_seo_pack.php CHANGED
@@ -3,8 +3,8 @@
3
  /*
4
  Plugin Name: All in One SEO Pack
5
  Plugin URI: http://semperfiwebdesign.com
6
- Description: Out-of-the-box SEO for your Wordpress blog. <a href="options-general.php?page=all-in-one-seo-pack/all_in_one_seo_pack.php">Options configuration panel</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/" >Support</a>
7
- Version: 1.5.7
8
  Author: Michael Torbert
9
  Author URI: http://michaeltorbert.com
10
  */
@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
28
  */
29
 
30
  /*******************************************************************************************************/
 
31
 
32
  $UTF8_TABLES['strtolower'] = array(
33
  "Z" => "z", "Y" => "y", "X" => "x",
@@ -483,1872 +484,193 @@ if ( ! defined( 'WP_PLUGIN_URL' ) )
483
  if ( ! defined( 'WP_PLUGIN_DIR' ) )
484
  define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
485
 
486
- class All_in_One_SEO_Pack {
487
-
488
- var $version = "1.5.7";
489
-
490
- /** Max numbers of chars in auto-generated description */
491
- var $maximum_description_length = 160;
492
-
493
- /** Minimum number of chars an excerpt should be so that it can be used
494
- * as description. Touch only if you know what you're doing
495
- */
496
- var $minimum_description_length = 1;
497
-
498
- var $ob_start_detected = false;
499
-
500
- var $title_start = -1;
501
-
502
- var $title_end = -1;
503
-
504
- /** The title before rewriting */
505
- var $orig_title = '';
506
-
507
- /** Temp filename for the latest version. */
508
- var $upgrade_filename = 'temp.zip';
509
-
510
- /** Where to extract the downloaded newest version. */
511
- var $upgrade_folder;
512
-
513
- /** Any error in upgrading. */
514
- var $upgrade_error;
515
-
516
- /** Which zip to download in order to upgrade .*/
517
- var $upgrade_url = 'http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip';
518
-
519
- /** Filename of log file. */
520
- var $log_file;
521
-
522
- /** Flag whether there should be logging. */
523
- var $do_log;
524
-
525
- var $wp_version;
526
-
527
- function All_in_One_SEO_Pack() {
528
- global $wp_version;
529
- $this->wp_version = $wp_version;
530
-
531
- $this->log_file = dirname(__FILE__) . '/all_in_one_seo_pack.log';
532
- if (get_option('aiosp_do_log')) {
533
- $this->do_log = true;
534
- } else {
535
- $this->do_log = false;
536
- }
537
 
538
- $this->upgrade_filename = dirname(__FILE__) . '/' . $this->upgrade_filename;
539
- $this->upgrade_folder = dirname(__FILE__);
540
- }
541
-
542
- /**
543
- * Convert a string to lower case
544
- * Compatible with mb_strtolower(), an UTF-8 friendly replacement for strtolower()
545
- */
546
- function strtolower($str) {
547
- global $UTF8_TABLES;
548
- return strtr($str, $UTF8_TABLES['strtolower']);
549
- }
550
-
551
- /**
552
- * Convert a string to upper case
553
- * Compatible with mb_strtoupper(), an UTF-8 friendly replacement for strtoupper()
554
- */
555
- function strtoupper($str) {
556
- global $UTF8_TABLES;
557
- return strtr($str, $UTF8_TABLES['strtoupper']);
558
- }
559
-
560
-
561
- function template_redirect() {
562
- global $wp_query;
563
- $post = $wp_query->get_queried_object();
564
 
565
- if (is_feed()) {
566
- return;
567
- }
568
-
569
- if (is_single() || is_page()) {
570
- $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, 'aiosp_disable', true)));
571
- if ($aiosp_disable) {
572
- return;
573
- }
574
- }
575
-
576
- if (get_option('aiosp_rewrite_titles')) {
577
- ob_start(array($this, 'output_callback_for_title'));
578
- }
579
- }
580
-
581
- function output_callback_for_title($content) {
582
- return $this->rewrite_title($content);
583
- }
584
-
585
- function init() {
586
- if (function_exists('load_plugin_textdomain')) {
587
- if ( !defined('WP_PLUGIN_DIR') ) {
588
- load_plugin_textdomain('all_in_one_seo_pack', str_replace( ABSPATH, '', dirname(__FILE__)));
589
- } else {
590
- load_plugin_textdomain('all_in_one_seo_pack', false, dirname(plugin_basename(__FILE__)));
591
- }
592
- }
593
 
594
 
595
  /*
596
- if (function_exists('load_plugin_textdomain')) {
597
- load_plugin_textdomain('all_in_one_seo_pack', WP_PLUGIN_DIR . '/all-in-one-seo-pack');
598
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  */
600
 
601
- }
602
-
603
- function is_static_front_page() {
604
- global $wp_query;
605
- $post = $wp_query->get_queried_object();
606
- return get_option('show_on_front') == 'page' && is_page() && $post->ID == get_option('page_on_front');
607
- }
608
-
609
- function is_static_posts_page() {
610
- global $wp_query;
611
- $post = $wp_query->get_queried_object();
612
- return get_option('show_on_front') == 'page' && is_home() && $post->ID == get_option('page_for_posts');
613
- }
614
-
615
- function get_base() {
616
- return '/'.end(explode('/', str_replace(array('\\','/all_in_one_seo_pack.php'),array('/',''),__FILE__)));
617
- }
618
-
619
- function admin_head() {
620
- $home = get_settings('siteurl');
621
- $stylesheet = WP_PLUGIN_URL . $this->get_base() . '/css/all_in_one_seo_pack.css';
622
- echo('<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />');
623
- }
624
-
625
-
626
- function wp_head() {
627
- if (is_feed()) {
628
- return;
629
- }
630
-
631
- global $wp_query;
632
- $post = $wp_query->get_queried_object();
633
- $meta_string = null;
634
- if($this->is_static_posts_page()){
635
- $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
636
-
637
- }
638
- //echo("wp_head() " . wp_title('', false) . " is_home() => " . is_home() . ", is_page() => " . is_page() . ", is_single() => " . is_single() . ", is_static_front_page() => " . $this->is_static_front_page() . ", is_static_posts_page() => " . $this->is_static_posts_page());
639
-
640
- if (is_single() || is_page()) {
641
- $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, 'aiosp_disable', true)));
642
- if ($aiosp_disable) {
643
- return;
644
- }
645
- }
646
-
647
- if (get_option('aiosp_rewrite_titles')) {
648
- // make the title rewrite as short as possible
649
- if (function_exists('ob_list_handlers')) {
650
- $active_handlers = ob_list_handlers();
651
- } else {
652
- $active_handlers = array();
653
- }
654
- if (sizeof($active_handlers) > 0 &&
655
- strtolower($active_handlers[sizeof($active_handlers) - 1]) ==
656
- strtolower('All_in_One_SEO_Pack::output_callback_for_title')) {
657
- ob_end_flush();
658
- } else {
659
- $this->log("another plugin interfering?");
660
- // if we get here there *could* be trouble with another plugin :(
661
- $this->ob_start_detected = true;
662
- if (function_exists('ob_list_handlers')) {
663
- foreach (ob_list_handlers() as $handler) {
664
- $this->log("detected output handler $handler");
665
- }
666
- }
667
- }
668
- }
669
-
670
- echo "\n<!-- all in one seo pack $this->version ";
671
- if ($this->ob_start_detected) {
672
- echo "ob_start_detected ";
673
- }
674
- echo "[$this->title_start,$this->title_end] ";
675
- echo "-->\n";
676
- if ((is_home() && get_option('aiosp_home_keywords') && !$this->is_static_posts_page()) || $this->is_static_front_page()) {
677
- $keywords = trim($this->internationalize(get_option('aiosp_home_keywords')));
678
- } elseif($this->is_static_posts_page() && !get_option('aiosp_dynamic_postspage_keywords')){ // and if option = use page set keywords instead of keywords from recent posts
679
- //$keywords = "posts keyyysss" . stripcslashes(get_post_meta($post->ID,'keywords',true));
680
- $keywords = stripcslashes($this->internationalize(get_post_meta($post->ID, "keywords", true)));
681
-
682
- // $keywords = $this->get_unique_keywords($keywords);
683
-
684
- }else {
685
- $keywords = $this->get_all_keywords();
686
- }
687
- if (is_single() || is_page() || $this->is_static_posts_page()) {
688
- if ($this->is_static_front_page()) {
689
- $description = trim(stripcslashes($this->internationalize(get_option('aiosp_home_description'))));
690
- } else {
691
- $description = $this->get_post_description($post);
692
- }
693
- } else if (is_home()) {
694
- $description = trim(stripcslashes($this->internationalize(get_option('aiosp_home_description'))));
695
- } else if (is_category()) {
696
- $description = $this->internationalize(category_description());
697
- }
698
-
699
- if (isset($description) && (strlen($description) > $this->minimum_description_length) && !(is_home() && is_paged())) {
700
- $description = trim(strip_tags($description));
701
- $description = str_replace('"', '', $description);
702
-
703
- // replace newlines on mac / windows?
704
- $description = str_replace("\r\n", ' ', $description);
705
-
706
- // maybe linux uses this alone
707
- $description = str_replace("\n", ' ', $description);
708
-
709
- if (isset($meta_string)) {
710
- //$meta_string .= "\n";
711
- } else {
712
- $meta_string = '';
713
- }
714
-
715
- // description format
716
- $description_format = get_option('aiosp_description_format');
717
- if (!isset($description_format) || empty($description_format)) {
718
- $description_format = "%description%";
719
- }
720
- $description = str_replace('%description%', $description, $description_format);
721
- $description = str_replace('%blog_title%', get_bloginfo('name'), $description);
722
- $description = str_replace('%blog_description%', get_bloginfo('description'), $description);
723
- $description = str_replace('%wp_title%', $this->get_original_title(), $description);
724
-
725
- $meta_string .= sprintf("<meta name=\"description\" content=\"%s\" />", $description);
726
- }
727
-
728
- if (isset ($keywords) && !empty($keywords) && !(is_home() && is_paged())) {
729
- if (isset($meta_string)) {
730
- $meta_string .= "\n";
731
- }
732
- $meta_string .= sprintf("<meta name=\"keywords\" content=\"%s\" />", $keywords);
733
- }
734
-
735
- if (function_exists('is_tag')) {
736
- $is_tag = is_tag();
737
- }
738
-
739
- if ((is_category() && get_option('aiosp_category_noindex')) ||
740
- (!is_category() && is_archive() &&!$is_tag && get_option('aiosp_archive_noindex')) ||
741
- (get_option('aiosp_tags_noindex') && $is_tag)) {
742
- if (isset($meta_string)) {
743
- $meta_string .= "\n";
744
- }
745
- $meta_string .= '<meta name="robots" content="noindex,follow" />';
746
- }
747
-
748
- $page_meta = stripcslashes(get_option('aiosp_page_meta_tags'));
749
- $post_meta = stripcslashes(get_option('aiosp_post_meta_tags'));
750
- $home_meta = stripcslashes(get_option('aiosp_home_meta_tags'));
751
- if (is_page() && isset($page_meta) && !empty($page_meta) || $this->is_static_posts_page()) {
752
- if (isset($meta_string)) {
753
- $meta_string .= "\n";
754
- }
755
- echo "\n$page_meta";
756
- }
757
-
758
- if (is_single() && isset($post_meta) && !empty($post_meta)) {
759
- if (isset($meta_string)) {
760
- $meta_string .= "\n";
761
- }
762
- $meta_string .= "$post_meta";
763
- }
764
-
765
- if (is_home() && !empty($home_meta)) {
766
- if (isset($meta_string)) {
767
- $meta_string .= "\n";
768
- }
769
- $meta_string .= "$home_meta";
770
- }
771
-
772
- if ($meta_string != null) {
773
- echo "$meta_string\n";
774
- }
775
-
776
- if(get_option('aiosp_can')){
777
- $url = $this->aiosp_mrt_get_url($wp_query);
778
- if ($url) {
779
- echo "".'<link rel="canonical" href="'.$url.'" />'."\n";
780
- }
781
- }
782
-
783
- echo "<!-- /all in one seo pack -->\n";
784
- }
785
-
786
- // Thank you, Yoast de Valk, for much of this code.
787
-
788
- function aiosp_mrt_get_url($query) {
789
- if ($query->is_404 || $query->is_search) {
790
- return false;
791
- }
792
- $haspost = count($query->posts) > 0;
793
- $has_ut = function_exists('user_trailingslashit');
794
-
795
- if (get_query_var('m')) {
796
- $m = preg_replace('/[^0-9]/', '', get_query_var('m'));
797
- switch (strlen($m)) {
798
- case 4:
799
- $link = get_year_link($m);
800
- break;
801
- case 6:
802
- $link = get_month_link(substr($m, 0, 4), substr($m, 4, 2));
803
- break;
804
- case 8:
805
- $link = get_day_link(substr($m, 0, 4), substr($m, 4, 2),
806
- substr($m, 6, 2));
807
- break;
808
- default:
809
- return false;
810
- }
811
- } elseif (($query->is_single || $query->is_page) && $haspost) {
812
- $post = $query->posts[0];
813
- $link = get_permalink($post->ID);
814
- $link = $this->yoast_get_paged($link);
815
- /* if ($page && $page > 1) {
816
- $link = trailingslashit($link) . "page/". "$page";
817
- if ($has_ut) {
818
- $link = user_trailingslashit($link, 'paged');
819
- } else {
820
- $link .= '/';
821
- }
822
- }
823
- if ($query->is_page && ('page' == get_option('show_on_front')) &&
824
- $post->ID == get_option('page_on_front'))
825
- {
826
- $link = trailingslashit($link);
827
- }*/
828
- } elseif ($query->is_author && $haspost) {
829
- global $wp_version;
830
- if ($wp_version >= '2') {
831
- $author = get_userdata(get_query_var('author'));
832
- if ($author === false)
833
- return false;
834
- $link = get_author_link(false, $author->ID,
835
- $author->user_nicename);
836
- } else {
837
- global $cache_userdata;
838
- $userid = get_query_var('author');
839
- $link = get_author_link(false, $userid,
840
- $cache_userdata[$userid]->user_nicename);
841
- }
842
- } elseif ($query->is_category && $haspost) {
843
- $link = get_category_link(get_query_var('cat'));
844
- $link = $this->yoast_get_paged($link);
845
- } else if ($query->is_tag && $haspost) {
846
- $tag = get_term_by('slug',get_query_var('tag'),'post_tag');
847
- if (!empty($tag->term_id)) {
848
- $link = get_tag_link($tag->term_id);
849
- }
850
- $link = $this->yoast_get_paged($link);
851
- } elseif ($query->is_day && $haspost) {
852
- $link = get_day_link(get_query_var('year'),
853
- get_query_var('monthnum'),
854
- get_query_var('day'));
855
- } elseif ($query->is_month && $haspost) {
856
- $link = get_month_link(get_query_var('year'),
857
- get_query_var('monthnum'));
858
- } elseif ($query->is_year && $haspost) {
859
- $link = get_year_link(get_query_var('year'));
860
- } elseif ($query->is_home) {
861
- if ((get_option('show_on_front') == 'page') &&
862
- ($pageid = get_option('page_for_posts')))
863
- {
864
- $link = get_permalink($pageid);
865
- $link = $this->yoast_get_paged($link);
866
- $link = trailingslashit($link);
867
- } else {
868
- $link = get_option('home');
869
- $link = $this->yoast_get_paged($link);
870
- $link = trailingslashit($link); }
871
- } else {
872
- return false;
873
- }
874
-
875
- return $link;
876
-
877
- }
878
-
879
-
880
- function yoast_get_paged($link) {
881
- $page = get_query_var('paged');
882
- if ($page && $page > 1) {
883
- $link = trailingslashit($link) ."page/". "$page";
884
- if ($has_ut) {
885
- $link = user_trailingslashit($link, 'paged');
886
- } else {
887
- $link .= '/';
888
- }
889
- }
890
- return $link;
891
- }
892
-
893
-
894
- function get_post_description($post) {
895
- $description = trim(stripcslashes($this->internationalize(get_post_meta($post->ID, "description", true))));
896
- if (!$description) {
897
- $description = $this->trim_excerpt_without_filters_full_length($this->internationalize($post->post_excerpt));
898
- if (!$description && get_option("aiosp_generate_descriptions")) {
899
- $description = $this->trim_excerpt_without_filters($this->internationalize($post->post_content));
900
- }
901
- }
902
-
903
- // "internal whitespace trim"
904
- $description = preg_replace("/\s\s+/", " ", $description);
905
-
906
- return $description;
907
- }
908
-
909
- function replace_title($content, $title) {
910
- $title = trim(strip_tags($title));
911
-
912
- $title_tag_start = "<title>";
913
- $title_tag_end = "</title>";
914
- $len_start = strlen($title_tag_start);
915
- $len_end = strlen($title_tag_end);
916
- $title = stripcslashes(trim($title));
917
- $start = strpos($content, $title_tag_start);
918
- $end = strpos($content, $title_tag_end);
919
-
920
- $this->title_start = $start;
921
- $this->title_end = $end;
922
- $this->orig_title = $title;
923
-
924
- if ($start && $end) {
925
- $header = substr($content, 0, $start + $len_start) . $title . substr($content, $end);
926
- } else {
927
- // this breaks some sitemap plugins (like wpg2)
928
- //$header = $content . "<title>$title</title>";
929
-
930
- $header = $content;
931
- }
932
-
933
- return $header;
934
- }
935
-
936
- function internationalize($in) {
937
- if (function_exists('langswitch_filter_langs_with_message')) {
938
- $in = langswitch_filter_langs_with_message($in);
939
- }
940
- if (function_exists('polyglot_filter')) {
941
- $in = polyglot_filter($in);
942
- }
943
- if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
944
- $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($in);
945
- }
946
- $in = apply_filters('localization', $in);
947
- return $in;
948
- }
949
-
950
- /** @return The original title as delivered by WP (well, in most cases) */
951
- function get_original_title() {
952
- global $wp_query;
953
- if (!$wp_query) {
954
- return null;
955
- }
956
-
957
- $post = $wp_query->get_queried_object();
958
-
959
- // the_search_query() is not suitable, it cannot just return
960
- global $s;
961
-
962
- $title = null;
963
-
964
- if (is_home()) {
965
- $title = get_option('blogname');
966
- } else if (is_single()) {
967
- $title = $this->internationalize(wp_title('', false));
968
- } else if (is_search() && isset($s) && !empty($s)) {
969
- if (function_exists('attribute_escape')) {
970
- $search = attribute_escape(stripcslashes($s));
971
- } else {
972
- $search = wp_specialchars(stripcslashes($s), true);
973
- }
974
- $search = $this->capitalize($search);
975
- $title = $search;
976
- } else if (is_category() && !is_feed()) {
977
- $category_description = $this->internationalize(category_description());
978
- $category_name = ucwords($this->internationalize(single_cat_title('', false)));
979
- $title = $category_name;
980
- } else if (is_page()) {
981
- $title = $this->internationalize(wp_title('', false));
982
- } else if (function_exists('is_tag') && is_tag()) {
983
- global $utw;
984
- if ($utw) {
985
- $tags = $utw->GetCurrentTagSet();
986
- $tag = $tags[0]->tag;
987
- $tag = str_replace('-', ' ', $tag);
988
- } else {
989
- // wordpress > 2.3
990
- $tag = $this->internationalize(wp_title('', false));
991
- }
992
- if ($tag) {
993
- $title = $tag;
994
- }
995
- } else if (is_archive()) {
996
- $title = $this->internationalize(wp_title('', false));
997
- } else if (is_404()) {
998
- $title_format = get_option('aiosp_404_title_format');
999
- $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
1000
- $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
1001
- $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
1002
- $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
1003
- $title = $new_title;
1004
- }
1005
-
1006
- return trim($title);
1007
- }
1008
-
1009
- function paged_title($title) {
1010
- // the page number if paged
1011
- global $paged;
1012
-
1013
- // simple tagging support
1014
- global $STagging;
1015
-
1016
- if (is_paged() || (isset($STagging) && $STagging->is_tag_view() && $paged)) {
1017
- $part = $this->internationalize(get_option('aiosp_paged_format'));
1018
- if (isset($part) || !empty($part)) {
1019
- $part = " " . trim($part);
1020
- $part = str_replace('%page%', $paged, $part);
1021
- $this->log("paged_title() [$title] [$part]");
1022
- $title .= $part;
1023
- }
1024
- }
1025
- return $title;
1026
- }
1027
-
1028
- function rewrite_title($header) {
1029
- global $wp_query;
1030
- if (!$wp_query) {
1031
- $header .= "<!-- no wp_query found! -->\n";
1032
- return $header;
1033
- }
1034
-
1035
- $post = $wp_query->get_queried_object();
1036
-
1037
- // the_search_query() is not suitable, it cannot just return
1038
- global $s;
1039
-
1040
- // simple tagging support
1041
- global $STagging;
1042
 
1043
- if (is_home() && !$this->is_static_posts_page()) {
1044
- $title = $this->internationalize(get_option('aiosp_home_title'));
1045
- if (empty($title)) {
1046
- $title = $this->internationalize(get_option('blogname'));
1047
- }
1048
- $title = $this->paged_title($title);
1049
- $header = $this->replace_title($header, $title);
1050
- } else if (is_single()) {
1051
- // we're not in the loop :(
1052
- $authordata = get_userdata($post->post_author);
1053
- $categories = get_the_category();
1054
- $category = '';
1055
- if (count($categories) > 0) {
1056
- $category = $categories[0]->cat_name;
1057
- }
1058
- $title = $this->internationalize(get_post_meta($post->ID, "title", true));
1059
- if (!$title) {
1060
- $title = $this->internationalize(get_post_meta($post->ID, "title_tag", true));
1061
- if (!$title) {
1062
- $title = $this->internationalize(wp_title('', false));
1063
- }
1064
- }
1065
- $title_format = get_option('aiosp_post_title_format');
1066
- $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
1067
- $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
1068
- $new_title = str_replace('%post_title%', $title, $new_title);
1069
- $new_title = str_replace('%category%', $category, $new_title);
1070
- $new_title = str_replace('%category_title%', $category, $new_title);
1071
- $new_title = str_replace('%post_author_login%', $authordata->user_login, $new_title);
1072
- $new_title = str_replace('%post_author_nicename%', $authordata->user_nicename, $new_title);
1073
- $new_title = str_replace('%post_author_firstname%', ucwords($authordata->first_name), $new_title);
1074
- $new_title = str_replace('%post_author_lastname%', ucwords($authordata->last_name), $new_title);
1075
- $title = $new_title;
1076
- $title = trim($title);
1077
- $header = $this->replace_title($header, $title);
1078
- } else if (is_search() && isset($s) && !empty($s)) {
1079
- if (function_exists('attribute_escape')) {
1080
- $search = attribute_escape(stripcslashes($s));
1081
- } else {
1082
- $search = wp_specialchars(stripcslashes($s), true);
1083
- }
1084
- $search = $this->capitalize($search);
1085
- $title_format = get_option('aiosp_search_title_format');
1086
- $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
1087
- $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
1088
- $title = str_replace('%search%', $search, $title);
1089
- $header = $this->replace_title($header, $title);
1090
- } else if (is_category() && !is_feed()) {
1091
- $category_description = $this->internationalize(category_description());
1092
- $category_name = ucwords($this->internationalize(single_cat_title('', false)));
1093
- $title_format = get_option('aiosp_category_title_format');
1094
- $title = str_replace('%category_title%', $category_name, $title_format);
1095
- $title = str_replace('%category_description%', $category_description, $title);
1096
- $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title);
1097
- $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
1098
- $title = $this->paged_title($title);
1099
- $header = $this->replace_title($header, $title);
1100
- } else if (is_page() || $this->is_static_posts_page()) {
1101
- // we're not in the loop :(
1102
- $authordata = get_userdata($post->post_author);
1103
- if ($this->is_static_front_page()) {
1104
- if ($this->internationalize(get_option('aiosp_home_title'))) {
1105
- $header = $this->replace_title($header, $this->internationalize(get_option('aiosp_home_title')));
1106
- }
1107
- } else {
1108
- $title = $this->internationalize(get_post_meta($post->ID, "title", true));
1109
- if (!$title) {
1110
- $title = $this->internationalize(wp_title('', false));
1111
- }
1112
- $title_format = get_option('aiosp_page_title_format');
1113
- $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
1114
- $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
1115
- $new_title = str_replace('%page_title%', $title, $new_title);
1116
- $new_title = str_replace('%page_author_login%', $authordata->user_login, $new_title);
1117
- $new_title = str_replace('%page_author_nicename%', $authordata->user_nicename, $new_title);
1118
- $new_title = str_replace('%page_author_firstname%', ucwords($authordata->first_name), $new_title);
1119
- $new_title = str_replace('%page_author_lastname%', ucwords($authordata->last_name), $new_title);
1120
- $title = trim($new_title);
1121
- $header = $this->replace_title($header, $title);
1122
- }
1123
- } else if (function_exists('is_tag') && is_tag()) {
1124
- global $utw;
1125
- if ($utw) {
1126
- $tags = $utw->GetCurrentTagSet();
1127
- $tag = $tags[0]->tag;
1128
- $tag = str_replace('-', ' ', $tag);
1129
- } else {
1130
- // wordpress > 2.3
1131
- $tag = $this->internationalize(wp_title('', false));
1132
- }
1133
- if ($tag) {
1134
- $tag = $this->capitalize($tag);
1135
- $title_format = get_option('aiosp_tag_title_format');
1136
- $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
1137
- $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
1138
- $title = str_replace('%tag%', $tag, $title);
1139
- $title = $this->paged_title($title);
1140
- $header = $this->replace_title($header, $title);
1141
- }
1142
- } else if (isset($STagging) && $STagging->is_tag_view()) { // simple tagging support
1143
- $tag = $STagging->search_tag;
1144
- if ($tag) {
1145
- $tag = $this->capitalize($tag);
1146
- $title_format = get_option('aiosp_tag_title_format');
1147
- $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
1148
- $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
1149
- $title = str_replace('%tag%', $tag, $title);
1150
- $title = $this->paged_title($title);
1151
- $header = $this->replace_title($header, $title);
1152
- }
1153
- } else if (is_archive()) {
1154
- $date = $this->internationalize(wp_title('', false));
1155
- $title_format = get_option('aiosp_archive_title_format');
1156
- $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
1157
- $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
1158
- $new_title = str_replace('%date%', $date, $new_title);
1159
- $title = trim($new_title);
1160
- $title = $this->paged_title($title);
1161
- $header = $this->replace_title($header, $title);
1162
- } else if (is_404()) {
1163
- $title_format = get_option('aiosp_404_title_format');
1164
- $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
1165
- $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
1166
- $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
1167
- $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
1168
- $header = $this->replace_title($header, $new_title);
1169
- }
1170
-
1171
- return $header;
1172
 
1173
- }
1174
-
1175
- /**
1176
- * @return User-readable nice words for a given request.
1177
- */
1178
- function request_as_words($request) {
1179
- $request = htmlspecialchars($request);
1180
- $request = str_replace('.html', ' ', $request);
1181
- $request = str_replace('.htm', ' ', $request);
1182
- $request = str_replace('.', ' ', $request);
1183
- $request = str_replace('/', ' ', $request);
1184
- $request_a = explode(' ', $request);
1185
- $request_new = array();
1186
- foreach ($request_a as $token) {
1187
- $request_new[] = ucwords(trim($token));
1188
- }
1189
- $request = implode(' ', $request_new);
1190
- return $request;
1191
- }
1192
-
1193
- function capitalize($s) {
1194
- $s = trim($s);
1195
- $tokens = explode(' ', $s);
1196
- while (list($key, $val) = each($tokens)) {
1197
- $tokens[$key] = trim($tokens[$key]);
1198
- $tokens[$key] = strtoupper(substr($tokens[$key], 0, 1)) . substr($tokens[$key], 1);
1199
- }
1200
- $s = implode(' ', $tokens);
1201
- return $s;
1202
- }
1203
-
1204
- function trim_excerpt_without_filters($text) {
1205
- $text = str_replace(']]>', ']]&gt;', $text);
1206
- $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
1207
- $text = strip_tags($text);
1208
- $max = $this->maximum_description_length;
1209
-
1210
- if ($max < strlen($text)) {
1211
- while($text[$max] != ' ' && $max > $this->minimum_description_length) {
1212
- $max--;
1213
- }
1214
- }
1215
- $text = substr($text, 0, $max);
1216
- return trim(stripcslashes($text));
1217
- }
1218
 
1219
- function trim_excerpt_without_filters_full_length($text) {
1220
- $text = str_replace(']]>', ']]&gt;', $text);
1221
- $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
1222
- $text = strip_tags($text);
1223
- return trim(stripcslashes($text));
1224
  }
1225
-
1226
- /**
1227
- * @return comma-separated list of unique keywords
1228
- */
1229
- function get_all_keywords() {
1230
- global $posts;
1231
-
1232
- if (is_404()) {
1233
- return null;
1234
- }
1235
-
1236
- // if we are on synthetic pages
1237
- if (!is_home() && !is_page() && !is_single() &&!$this->is_static_front_page() && !$this->is_static_posts_page()) {
1238
- return null;
1239
- }
1240
 
1241
- $keywords = array();
1242
- if (is_array($posts)) {
1243
- foreach ($posts as $post) {
1244
- if ($post) {
1245
 
1246
- // custom field keywords
1247
- $keywords_a = $keywords_i = null;
1248
- $description_a = $description_i = null;
1249
- $id = $post->ID;
1250
- $keywords_i = stripcslashes($this->internationalize(get_post_meta($post->ID, "keywords", true)));
1251
- $keywords_i = str_replace('"', '', $keywords_i);
1252
- if (isset($keywords_i) && !empty($keywords_i)) {
1253
- $traverse = explode(',', $keywords_i);
1254
- foreach ($traverse as $keyword) {
1255
- $keywords[] = $keyword;
1256
- }
1257
- }
1258
-
1259
- // WP 2.3 tags
1260
- if (function_exists('get_the_tags')) {
1261
- $tags = get_the_tags($post->ID);
1262
- if ($tags && is_array($tags)) {
1263
- foreach ($tags as $tag) {
1264
- $keywords[] = $this->internationalize($tag->name);
1265
- }
1266
- }
1267
- }
1268
 
1269
- // Ultimate Tag Warrior integration
1270
- global $utw;
1271
- if ($utw) {
1272
- $tags = $utw->GetTagsForPost($post);
1273
- if (is_array($tags)) {
1274
- foreach ($tags as $tag) {
1275
- $tag = $tag->tag;
1276
- $tag = str_replace('_',' ', $tag);
1277
- $tag = str_replace('-',' ',$tag);
1278
- $tag = stripcslashes($tag);
1279
- $keywords[] = $tag;
1280
- }
1281
- }
1282
- }
1283
-
1284
- // autometa
1285
- $autometa = stripcslashes(get_post_meta($post->ID, "autometa", true));
1286
- if (isset($autometa) && !empty($autometa)) {
1287
- $autometa_array = explode(' ', $autometa);
1288
- foreach ($autometa_array as $e) {
1289
- $keywords[] = $e;
1290
- }
1291
- }
1292
 
1293
- if (get_option('aiosp_use_categories') && !is_page()) {
1294
- $categories = get_the_category($post->ID);
1295
- foreach ($categories as $category) {
1296
- $keywords[] = $this->internationalize($category->cat_name);
1297
- }
1298
- }
1299
 
1300
- }
1301
- }
1302
- }
1303
-
1304
- return $this->get_unique_keywords($keywords);
1305
- }
1306
-
1307
- function get_meta_keywords() {
1308
- global $posts;
1309
 
1310
- $keywords = array();
1311
- if (is_array($posts)) {
1312
- foreach ($posts as $post) {
1313
- if ($post) {
1314
- // custom field keywords
1315
- $keywords_a = $keywords_i = null;
1316
- $description_a = $description_i = null;
1317
- $id = $post->ID;
1318
- $keywords_i = stripcslashes(get_post_meta($post->ID, "keywords", true));
1319
- $keywords_i = str_replace('"', '', $keywords_i);
1320
- if (isset($keywords_i) && !empty($keywords_i)) {
1321
- $keywords[] = $keywords_i;
1322
- }
1323
- }
1324
- }
1325
- }
1326
-
1327
- return $this->get_unique_keywords($keywords);
1328
- }
1329
-
1330
- function get_unique_keywords($keywords) {
1331
- $small_keywords = array();
1332
- foreach ($keywords as $word) {
1333
- if (function_exists('mb_strtolower'))
1334
- $small_keywords[] = mb_strtolower($word);
1335
- else
1336
- $small_keywords[] = $this->strtolower($word);
1337
- }
1338
- $keywords_ar = array_unique($small_keywords);
1339
- return implode(',', $keywords_ar);
1340
- }
1341
-
1342
- function get_url($url) {
1343
- if (function_exists('file_get_contents')) {
1344
- $file = file_get_contents($url);
1345
- } else {
1346
- $curl = curl_init($url);
1347
- curl_setopt($curl, CURLOPT_HEADER, 0);
1348
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1349
- $file = curl_exec($curl);
1350
- curl_close($curl);
1351
- }
1352
- return $file;
1353
- }
1354
-
1355
- function log($message) {
1356
- if ($this->do_log) {
1357
- error_log(date('Y-m-d H:i:s') . " " . $message . "\n", 3, $this->log_file);
1358
- }
1359
- }
1360
 
1361
- function download_newest_version() {
1362
- $success = true;
1363
- $file_content = $this->get_url($this->upgrade_url);
1364
- if ($file_content === false) {
1365
- $this->upgrade_error = sprintf(__("Could not download distribution (%s)"), $this->upgrade_url);
1366
- $success = false;
1367
- } else if (strlen($file_content) < 100) {
1368
- $this->upgrade_error = sprintf(__("Could not download distribution (%s): %s"), $this->upgrade_url, $file_content);
1369
- $success = false;
1370
- } else {
1371
- $this->log(sprintf("filesize of download ZIP: %d", strlen($file_content)));
1372
- $fh = @fopen($this->upgrade_filename, 'w');
1373
- $this->log("fh is $fh");
1374
- if (!$fh) {
1375
- $this->upgrade_error = sprintf(__("Could not open %s for writing"), $this->upgrade_filename);
1376
- $this->upgrade_error .= "<br />";
1377
- $this->upgrade_error .= sprintf(__("Please make sure %s is writable"), $this->upgrade_folder);
1378
- $success = false;
1379
- } else {
1380
- $bytes_written = @fwrite($fh, $file_content);
1381
- $this->log("wrote $bytes_written bytes");
1382
- if (!$bytes_written) {
1383
- $this->upgrade_error = sprintf(__("Could not write to %s"), $this->upgrade_filename);
1384
- $success = false;
1385
- }
1386
- }
1387
- if ($success) {
1388
- fclose($fh);
1389
- }
1390
- }
1391
- return $success;
1392
- }
1393
 
1394
- function install_newest_version() {
1395
- $success = $this->download_newest_version();
1396
- if ($success) {
1397
- $success = $this->extract_plugin();
1398
- unlink($this->upgrade_filename);
1399
- }
1400
- return $success;
1401
- }
1402
 
1403
- function extract_plugin() {
1404
- if (!class_exists('PclZip')) {
1405
- require_once ('pclzip.lib.php');
1406
- }
1407
- $archive = new PclZip($this->upgrade_filename);
1408
- $files = $archive->extract(PCLZIP_OPT_STOP_ON_ERROR, PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_PATH, $this->upgrade_folder);
1409
- $this->log("files is $files");
1410
- if (is_array($files)) {
1411
- $num_extracted = sizeof($files);
1412
- $this->log("extracted $num_extracted files to $this->upgrade_folder");
1413
- $this->log(print_r($files, true));
1414
- return true;
1415
- } else {
1416
- $this->upgrade_error = $archive->errorInfo();
1417
- return false;
1418
- }
1419
- }
1420
-
1421
- /** crude approximization of whether current user is an admin */
1422
- function is_admin() {
1423
- return current_user_can('level_8');
1424
- }
1425
-
1426
- function is_directory_writable($directory) {
1427
- $filename = $directory . '/' . 'tmp_file_' . time();
1428
- $fh = @fopen($filename, 'w');
1429
- if (!$fh) {
1430
- return false;
1431
- }
1432
-
1433
- $written = fwrite($fh, "test");
1434
- fclose($fh);
1435
- unlink($filename);
1436
- if ($written) {
1437
- return true;
1438
- } else {
1439
- return false;
1440
  }
 
1441
  }
1442
 
1443
- function is_upgrade_directory_writable() {
1444
- //return $this->is_directory_writable($this->upgrade_folder);
1445
- // let's assume it is
1446
- return true;
1447
- }
1448
-
1449
- function post_meta_tags($id) {
1450
- $awmp_edit = $_POST["aiosp_edit"];
1451
- $nonce = $_POST['nonce-aioseop-edit'];
1452
- // if (!wp_verify_nonce($nonce, 'edit-aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress');
1453
- if (isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce')) {
1454
- $keywords = $_POST["aiosp_keywords"];
1455
- $description = $_POST["aiosp_description"];
1456
- $title = $_POST["aiosp_title"];
1457
- $aiosp_meta = $_POST["aiosp_meta"];
1458
- $aiosp_disable = $_POST["aiosp_disable"];
1459
-
1460
- delete_post_meta($id, 'keywords');
1461
- delete_post_meta($id, 'description');
1462
- delete_post_meta($id, 'title');
1463
- if ($this->is_admin()) {
1464
- delete_post_meta($id, 'aiosp_disable');
1465
- }
1466
- //delete_post_meta($id, 'aiosp_meta');
1467
-
1468
- if (isset($keywords) && !empty($keywords)) {
1469
- add_post_meta($id, 'keywords', $keywords);
1470
- }
1471
- if (isset($description) && !empty($description)) {
1472
- add_post_meta($id, 'description', $description);
1473
- }
1474
- if (isset($title) && !empty($title)) {
1475
- add_post_meta($id, 'title', $title);
1476
- }
1477
- if (isset($aiosp_disable) && !empty($aiosp_disable) && $this->is_admin()) {
1478
- add_post_meta($id, 'aiosp_disable', $aiosp_disable);
1479
- }
1480
- /*
1481
- if (isset($aiosp_meta) && !empty($aiosp_meta)) {
1482
- add_post_meta($id, 'aiosp_meta', $aiosp_meta);
1483
- }
1484
- */
1485
- }
1486
- }
1487
-
1488
- function edit_category($id) {
1489
- global $wpdb;
1490
- $id = $wpdb->escape($id);
1491
- $awmp_edit = $_POST["aiosp_edit"];
1492
- if (isset($awmp_edit) && !empty($awmp_edit)) {
1493
- $keywords = $wpdb->escape($_POST["aiosp_keywords"]);
1494
- $title = $wpdb->escape($_POST["aiosp_title"]);
1495
- $old_category = $wpdb->get_row("select * from $this->table_categories where category_id=$id", OBJECT);
1496
- if ($old_category) {
1497
- $wpdb->query($wpdb->prepare("update $this->table_categories
1498
- set meta_title='$title', meta_keywords='$keywords'
1499
- where category_id=$id"));
1500
- } else {
1501
- $wpdb->query($wpdb->prepare("insert into $this->table_categories(meta_title, meta_keywords, category_id)
1502
- values ('$title', '$keywords', $id"));
1503
- }
1504
- //$wpdb->query($wpdb->prepare("insert into $this->table_categories"))
1505
- /*
1506
- delete_post_meta($id, 'keywords');
1507
- delete_post_meta($id, 'description');
1508
- delete_post_meta($id, 'title');
1509
-
1510
- if (isset($keywords) && !empty($keywords)) {
1511
- add_post_meta($id, 'keywords', $keywords);
1512
- }
1513
- if (isset($description) && !empty($description)) {
1514
- add_post_meta($id, 'description', $description);
1515
- }
1516
- if (isset($title) && !empty($title)) {
1517
- add_post_meta($id, 'title', $title);
1518
- }
1519
- */
1520
- }
1521
- }
1522
 
1523
- /**
1524
- * @deprecated This was for the feature of dedicated meta tags for categories which never went mainstream.
1525
- */
1526
- function edit_category_form() {
1527
- global $post;
1528
- $keywords = stripcslashes(get_post_meta($post->ID, 'keywords', true));
1529
- $title = stripcslashes(get_post_meta($post->ID, 'title', true));
1530
- $description = stripcslashes(get_post_meta($post->ID, 'description', true));
1531
- ?>
1532
- <input value="aiosp_edit" type="hidden" name="aiosp_edit" />
1533
- <table class="editform" width="100%" cellspacing="2" cellpadding="5">
1534
- <tr>
1535
- <th width="33%" scope="row" valign="top">
1536
- <a href="http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></a>
1537
- </th>
1538
- </tr>
1539
- <tr>
1540
- <th width="33%" scope="row" valign="top"><label for="aiosp_title"><?php _e('Title:', 'all_in_one_seo_pack') ?></label></th>
1541
- <td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="70"/></td>
1542
- </tr>
1543
- <tr>
1544
- <th width="33%" scope="row" valign="top"><label for="aiosp_keywords"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></label></th>
1545
- <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="70"/></td>
1546
- </tr>
1547
- </table>
1548
- <?php
1549
- }
1550
-
1551
- function add_meta_tags_textinput() {
1552
- global $post;
1553
- $post_id = $post;
1554
- if (is_object($post_id)) {
1555
- $post_id = $post_id->ID;
1556
- }
1557
- $keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'keywords', true)));
1558
- $title = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'title', true)));
1559
- $description = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'description', true)));
1560
- $aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'aiosp_meta', true)));
1561
- $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'aiosp_disable', true)));
1562
- ?>
1563
- <SCRIPT LANGUAGE="JavaScript">
1564
- <!-- Begin
1565
- function countChars(field,cntfield) {
1566
- cntfield.value = field.value.length;
1567
- }
1568
- // End -->
1569
- </script>
1570
-
1571
- <?php if (substr($this->wp_version, 0, 3) >= '2.5') { ?>
1572
- <div id="postaiosp" class="postbox closed">
1573
- <h3><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
1574
- <div class="inside">
1575
- <div id="postaiosp">
1576
- <?php } else { ?>
1577
- <div class="dbx-b-ox-wrapper">
1578
- <fieldset id="seodiv" class="dbx-box">
1579
- <div class="dbx-h-andle-wrapper">
1580
- <h3 class="dbx-handle"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
1581
- </div>
1582
- <div class="dbx-c-ontent-wrapper">
1583
- <div class="dbx-content">
1584
- <?php } ?>
1585
-
1586
- <a target="__blank" href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/all-in-one-seo-pack/"><?php _e('Click here for Support', 'all_in_one_seo_pack') ?></a>
1587
- <input value="aiosp_edit" type="hidden" name="aiosp_edit" />
1588
- <table style="margin-bottom:40px">
1589
- <tr>
1590
- <th style="text-align:left;" colspan="2">
1591
- </th>
1592
- </tr>
1593
- <tr>
1594
- <th scope="row" style="text-align:right;"><?php _e('Title:', 'all_in_one_seo_pack') ?></th>
1595
- <td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="62"/></td>
1596
- </tr>
1597
- <tr>
1598
- <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
1599
- <td><textarea name="aiosp_description" rows="1" cols="60"
1600
- onKeyDown="countChars(document.post.aiosp_description,document.post.length1)"
1601
- onKeyUp="countChars(document.post.aiosp_description,document.post.length1)"><?php echo $description ?></textarea><br />
1602
- <input readonly type="text" name="length1" size="3" maxlength="3" value="<?php echo strlen($description);?>" />
1603
- <?php _e(' characters. Most search engines use a maximum of 160 chars for the description.', 'all_in_one_seo_pack') ?>
1604
- </td>
1605
- </tr>
1606
- <tr>
1607
- <th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
1608
- <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="62"/></td>
1609
- </tr>
1610
- <input type="hidden" name="nonce-aioseop-edit" value="<?php echo wp_create_nonce('edit-aioseop-nonce'); ?>" />
1611
- <?php if ($this->is_admin()) { ?>
1612
- <tr>
1613
- <th scope="row" style="text-align:right; vertical-align:top;">
1614
- <?php _e('Disable on this page/post:', 'all_in_one_seo_pack')?>
1615
- </th>
1616
- <td>
1617
- <input type="checkbox" name="aiosp_disable" <?php if ($aiosp_disable) echo "checked=\"1\""; ?>/>
1618
- </td>
1619
- </tr>
1620
- <?php } ?>
1621
 
1622
- </table>
1623
-
1624
- <?php if (substr($this->wp_version, 0, 3) >= '2.5') { ?>
1625
- </div></div></div>
1626
- <?php } else { ?>
1627
- </div>
1628
- </fieldset>
1629
- </div>
1630
- <?php } ?>
1631
 
1632
- <?php
1633
- }
1634
 
1635
- function admin_menu() {
1636
- $file = __FILE__;
1637
-
1638
- // hack for 1.5
1639
- if (substr($this->wp_version, 0, 3) == '1.5') {
1640
- $file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
1641
- }
1642
- //add_management_page(__('All in One SEO Title', 'all_in_one_seo_pack'), __('All in One SEO', 'all_in_one_seo_pack'), 10, $file, array($this, 'management_panel'));
1643
- add_submenu_page('options-general.php', __('All in One SEO', 'all_in_one_seo_pack'), __('All in One SEO', 'all_in_one_seo_pack'), 10, $file, array($this, 'options_panel'));
1644
- }
1645
-
1646
- function management_panel() {
1647
- $message = null;
1648
- $base_url = "edit.php?page=" . __FILE__;
1649
- //echo($base_url);
1650
- $type = $_REQUEST['type'];
1651
- if (!isset($type)) {
1652
- $type = "posts";
1653
- }
1654
- ?>
1655
 
1656
- <ul class="aiosp_menu">
1657
- <li><a href="<?php echo $base_url ?>&type=posts">Posts</a>
1658
- </li>
1659
- <li><a href="<?php echo $base_url ?>&type=pages">Pages</a>
1660
- </li>
1661
- </ul>
1662
-
1663
- <?php
1664
 
1665
- if ($type == "posts") {
1666
- echo("posts");
1667
- } elseif ($type == "pages") {
1668
- echo("pages");
1669
- }
1670
 
 
 
 
 
 
 
 
1671
  }
 
1672
 
1673
- function options_panel() {
1674
- $message = null;
1675
- $message_updated = __("All in One SEO Options Updated.", 'all_in_one_seo_pack');
1676
-
1677
- // update options
1678
- if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
1679
- $nonce = $_POST['nonce-aioseop'];
1680
- if (!wp_verify_nonce($nonce, 'aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress');
1681
- $message = $message_updated;
1682
- update_option('aiosp_can', $_POST['aiosp_can']);
1683
- update_option('aiosp_donate', $_POST['aiosp_donate']);
1684
- update_option('aiosp_home_title', $_POST['aiosp_home_title']);
1685
- update_option('aiosp_home_description', $_POST['aiosp_home_description']);
1686
- update_option('aiosp_home_keywords', $_POST['aiosp_home_keywords']);
1687
- update_option('aiosp_max_words_excerpt', $_POST['aiosp_max_words_excerpt']);
1688
- update_option('aiosp_rewrite_titles', $_POST['aiosp_rewrite_titles']);
1689
- update_option('aiosp_post_title_format', $_POST['aiosp_post_title_format']);
1690
- update_option('aiosp_page_title_format', $_POST['aiosp_page_title_format']);
1691
- update_option('aiosp_category_title_format', $_POST['aiosp_category_title_format']);
1692
- update_option('aiosp_archive_title_format', $_POST['aiosp_archive_title_format']);
1693
- update_option('aiosp_tag_title_format', $_POST['aiosp_tag_title_format']);
1694
- update_option('aiosp_search_title_format', $_POST['aiosp_search_title_format']);
1695
- update_option('aiosp_description_format', $_POST['aiosp_description_format']);
1696
- update_option('aiosp_404_title_format', $_POST['aiosp_404_title_format']);
1697
- update_option('aiosp_paged_format', $_POST['aiosp_paged_format']);
1698
- update_option('aiosp_use_categories', $_POST['aiosp_use_categories']);
1699
- update_option('aiosp_dynamic_postspage_keywords', $_POST['aiosp_dynamic_postspage_keywords']);
1700
- update_option('aiosp_category_noindex', $_POST['aiosp_category_noindex']);
1701
- update_option('aiosp_archive_noindex', $_POST['aiosp_archive_noindex']);
1702
- update_option('aiosp_tags_noindex', $_POST['aiosp_tags_noindex']);
1703
- update_option('aiosp_generate_descriptions', $_POST['aiosp_generate_descriptions']);
1704
- update_option('aiosp_debug_info', $_POST['aiosp_debug_info']);
1705
- update_option('aiosp_post_meta_tags', $_POST['aiosp_post_meta_tags']);
1706
- update_option('aiosp_page_meta_tags', $_POST['aiosp_page_meta_tags']);
1707
- update_option('aiosp_home_meta_tags', $_POST['aiosp_home_meta_tags']);
1708
- update_option('aiosp_do_log', $_POST['aiosp_do_log']);
1709
- if (function_exists('wp_cache_flush')) {
1710
- wp_cache_flush();
1711
- }
1712
- } elseif ($_POST['aiosp_upgrade']) {
1713
- $message = __("Upgraded to newest version. Please revisit the options page to make sure you see the newest version.", 'all_in_one_seo_pack');
1714
- $success = $this->install_newest_version();
1715
- if (!$success) {
1716
- $message = __("Upgrade failed", 'all_in_one_seo_pack');
1717
- if (isset($this->upgrade_error) && !empty($this->upgrade_error)) {
1718
- $message .= ": " . $this->upgrade_error;
1719
- } else {
1720
- $message .= ".";
1721
- }
1722
- }
1723
- }
1724
-
1725
- ?>
1726
- <?php if ($message) : ?>
1727
- <div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
1728
- <?php endif; ?>
1729
- <div id="dropmessage" class="updated" style="display:none;"></div>
1730
- <div class="wrap">
1731
- <h2><?php _e('All in One SEO Plugin Options', 'all_in_one_seo_pack'); ?></h2>
1732
- <p>
1733
- <?php _e("This is version ", 'all_in_one_seo_pack') ?><?php _e("$this->version ", 'all_in_one_seo_pack') ?>
1734
- &nbsp;<a target="_blank" title="<?php _e('All in One SEO Plugin Release History', 'all_in_one_seo_pack')?>"
1735
- href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-pack-release-history/"><?php _e("Changelog", 'all_in_one_seo_pack')?>
1736
- </a>
1737
- | <a target="_blank" title="<?php _e('FAQ', 'all_in_one_seo_pack') ?>"
1738
- href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/"><?php _e('FAQ', 'all_in_one_seo_pack') ?></a>
1739
- | <a target="_blank" title="<?php _e('All in One SEO Plugin Support Forum', 'all_in_one_seo_pack') ?>"
1740
- href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/forum/"><?php _e('Support', 'all_in_one_seo_pack') ?></a>
1741
- | <a target="_blank" title="<?php _e('All in One SEO Plugin Translations', 'all_in_one_seo_pack') ?>"
1742
- href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/translations-for-all-in-one-seo-pack/"><?php _e('Translations', 'all_in_one_seo_pack') ?></a>
1743
- <br /><br />
1744
- <a target="_blank" title="<?php echo 'Donate' ?>"
1745
- href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8"><img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" width="100px" alt="Donate" /><?php //echo 'Donate' ?></a>
1746
- | <a target="_blank" title="<?php _e('Follow us on', 'all_in_one_seo_pack') ?>"
1747
- href="http://twitter.com/michaeltorbert/"><?php _e('Follow us on ', 'all_in_one_seo_pack') ?><img src="http://static.twitter.com/images/twitter_logo.png" alt="<?php _e('Twitter', 'all_in_one_seo_pack') ?>" width="70px" /></a>
1748
- </p>
1749
- <p>
1750
- <?php
1751
- $canwrite = $this->is_upgrade_directory_writable();
1752
- //$canwrite = false;
1753
- ?>
1754
- <form class="form-table" name="dofollow" action="" method="post">
1755
- <p class="submit">
1756
- <input type="submit" <?php if (!$canwrite) echo(' disabled="disabled" ');?> name="aiosp_upgrade" value="<?php _e('One Click Upgrade', 'all_in_one_seo_pack')?> &raquo;" />
1757
- <strong><?php _e("(Remember: Backup early, backup often!)", 'all_in_one_seo_pack') ?></strong>
1758
- </form>
1759
- </p>
1760
- <p></p>
1761
-
1762
- <?php if (!$canwrite) {
1763
- echo("<p><strong>"); echo(sprintf(__("Please make sure that %s is writable.", 'all_in_one_seo_pack'), $this->upgrade_folder)); echo("</p></strong>");
1764
- } ?>
1765
- </p>
1766
-
1767
- <script type="text/javascript">
1768
- <!--
1769
- function toggleVisibility(id) {
1770
- var e = document.getElementById(id);
1771
- if(e.style.display == 'block')
1772
- e.style.display = 'none';
1773
- else
1774
- e.style.display = 'block';
1775
- }
1776
- //-->
1777
- </script>
1778
-
1779
- <h3><?php _e('Click on option titles to get help!', 'all_in_one_seo_pack') ?></h3>
1780
- Highest
1781
- <?php
1782
- $uri = "http://donations.semperfiwebdesign.com/category/highest-donations/feed/";
1783
- include_once(ABSPATH . WPINC . '/rss.php');
1784
- $rss = fetch_rss($uri);
1785
- $maxitems = 5;
1786
- if(is_array($rss->items)){
1787
- $items = array_slice($rss->items, 0, $maxitems);
1788
- ?>
1789
- <ul>
1790
- <?php if (empty($items)) echo '<li>No items</li>';
1791
- else
1792
- foreach ( $items as $item ) : ?>
1793
- <li><a href='<?php echo $item['description']; ?>'
1794
- title='<?php echo $item['title']; ?>'>
1795
- <?php echo $item['title']; ?>
1796
- </a></li>
1797
- <?php endforeach; ?>
1798
- </ul>
1799
- <?php } ?>
1800
- Donations
1801
- <?php
1802
- $uri = "http://donations.semperfiwebdesign.com/category/all-in-one-seo-pack/feed/";
1803
- include_once(ABSPATH . WPINC . '/rss.php');
1804
- $rss = fetch_rss($uri);
1805
- $maxitems = 5;
1806
- if(is_array($rss->items)){
1807
- $items = array_slice($rss->items, 0, $maxitems);
1808
- ?>
1809
- <ul>
1810
- <?php if (empty($items)) echo '<li>No items</li>';
1811
- else
1812
- foreach ( $items as $item ) : ?>
1813
- <li><a href='<?php echo $item['link']; ?>'
1814
- title='<?php echo $item['title']; ?>'>
1815
- <?php echo $item['title']; ?>
1816
- </a></li>
1817
- <?php endforeach; ?>
1818
- </ul>
1819
- <?php } ?>
1820
-
1821
- <form name="dofollow" action="" method="post">
1822
- <table class="form-table">
1823
-
1824
- <?php if (!get_option('aiosp_donate')){?>
1825
- <tr>
1826
- <th scope="row" style="text-align:right; vertical-align:top;">
1827
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_donate_tip');">
1828
- <?php _e('I enjoy this plugin and have made a donation:', 'all_in_one_seo_pack')?>
1829
- </a>
1830
- </td>
1831
- <td>
1832
- <input type="checkbox" name="aiosp_donate" <?php if (get_option('aiosp_donate')) echo "checked=\"1\""; ?>/>
1833
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_donate_tip">
1834
- <?php
1835
- _e('All donations support continued development of this free software.', 'all_in_one_seo_pack');
1836
- ?>
1837
- </div>
1838
- </td>
1839
- </tr>
1840
- <?php } ?>
1841
-
1842
- <tr>
1843
- <th scope="row" style="text-align:right; vertical-align:top;">
1844
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_title_tip');">
1845
- <?php _e('Home Title:', 'all_in_one_seo_pack')?>
1846
- </a>
1847
- </td>
1848
- <td>
1849
- <textarea cols="57" rows="2" name="aiosp_home_title"><?php echo stripcslashes(get_option('aiosp_home_title')); ?></textarea>
1850
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_title_tip">
1851
- <?php
1852
- _e('As the name implies, this will be the title of your homepage. This is independent of any other option. If not set, the default blog title will get used.', 'all_in_one_seo_pack');
1853
- ?>
1854
- </div>
1855
- </td>
1856
- </tr>
1857
-
1858
- <tr>
1859
- <th scope="row" style="text-align:right; vertical-align:top;">
1860
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_description_tip');">
1861
- <?php _e('Home Description:', 'all_in_one_seo_pack')?>
1862
- </a>
1863
- </td>
1864
- <td>
1865
- <textarea cols="57" rows="2" name="aiosp_home_description"><?php echo stripcslashes(get_option('aiosp_home_description')); ?></textarea>
1866
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_description_tip">
1867
- <?php
1868
- _e('The META description for your homepage. Independent of any other options, the default is no META description at all if this is not set.', 'all_in_one_seo_pack');
1869
- ?>
1870
- </div>
1871
- </td>
1872
- </tr>
1873
-
1874
- <tr>
1875
- <th scope="row" style="text-align:right; vertical-align:top;">
1876
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_keywords_tip');">
1877
- <?php _e('Home Keywords (comma separated):', 'all_in_one_seo_pack')?>
1878
- </a>
1879
- </td>
1880
- <td>
1881
- <textarea cols="57" rows="2" name="aiosp_home_keywords"><?php echo stripcslashes(get_option('aiosp_home_keywords')); ?></textarea>
1882
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_keywords_tip">
1883
- <?php
1884
- _e("A comma separated list of your most important keywords for your site that will be written as META keywords on your homepage. Don't stuff everything in here.", 'all_in_one_seo_pack');
1885
- ?>
1886
- </div>
1887
- </td>
1888
- </tr>
1889
-
1890
- <tr>
1891
- <th scope="row" style="text-align:right; vertical-align:top;">
1892
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_can_tip');">
1893
- <?php _e('Canonical URLs:', 'all_in_one_seo_pack')?>
1894
- </a>
1895
- </td>
1896
- <td>
1897
- <input type="checkbox" name="aiosp_can" <?php if (get_option('aiosp_can')) echo "checked=\"1\""; ?>/>
1898
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_can_tip">
1899
- <?php
1900
- _e("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');
1901
- ?>
1902
- </div>
1903
- </td>
1904
- </tr>
1905
-
1906
- <tr>
1907
- <th scope="row" style="text-align:right; vertical-align:top;">
1908
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_rewrite_titles_tip');">
1909
- <?php _e('Rewrite Titles:', 'all_in_one_seo_pack')?>
1910
- </a>
1911
- </td>
1912
- <td>
1913
- <input type="checkbox" name="aiosp_rewrite_titles" <?php if (get_option('aiosp_rewrite_titles')) echo "checked=\"1\""; ?>/>
1914
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_rewrite_titles_tip">
1915
- <?php
1916
- _e("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 window title bar and of course in the source. If set, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: The default templates puts the title tag of posts like this: “Blog Archive >> Blog Name >> Post Title” (maybe I've overdone slightly). This is far from optimal. With the default post title format, Rewrite Title rewrites this to “Post Title | Blog Name”. If you have manually defined a title (in one of the text fields for All in One SEO Plugin input) this will become the title of your post in the format string.", 'all_in_one_seo_pack');
1917
- ?>
1918
- </div>
1919
- </td>
1920
- </tr>
1921
-
1922
- <tr>
1923
- <th scope="row" style="text-align:right; vertical-align:top;">
1924
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_title_format_tip');">
1925
- <?php _e('Post Title Format:', 'all_in_one_seo_pack')?>
1926
- </a>
1927
- </td>
1928
- <td>
1929
- <input size="59" name="aiosp_post_title_format" value="<?php echo stripcslashes(get_option('aiosp_post_title_format')); ?>"/>
1930
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_post_title_format_tip">
1931
- <?php
1932
- _e('The following macros are supported:', 'all_in_one_seo_pack');
1933
- echo('<ul>');
1934
- echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1935
- echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1936
- echo('<li>'); _e('%post_title% - The original title of the post', 'all_in_one_seo_pack'); echo('</li>');
1937
- echo('<li>'); _e('%category_title% - The (main) category of the post', 'all_in_one_seo_pack'); echo('</li>');
1938
- echo('<li>'); _e('%category% - Alias for %category_title%', 'all_in_one_seo_pack'); echo('</li>');
1939
- echo('<li>'); _e("%post_author_login% - This post's author' login", 'all_in_one_seo_pack'); echo('</li>');
1940
- echo('<li>'); _e("%post_author_nicename% - This post's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
1941
- echo('<li>'); _e("%post_author_firstname% - This post's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1942
- echo('<li>'); _e("%post_author_lastname% - This post's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1943
- echo('</ul>');
1944
- ?>
1945
- </div>
1946
- </td>
1947
- </tr>
1948
-
1949
- <tr>
1950
- <th scope="row" style="text-align:right; vertical-align:top;">
1951
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_title_format_tip');">
1952
- <?php _e('Page Title Format:', 'all_in_one_seo_pack')?>
1953
- </a>
1954
- </td>
1955
- <td>
1956
- <input size="59" name="aiosp_page_title_format" value="<?php echo stripcslashes(get_option('aiosp_page_title_format')); ?>"/>
1957
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_page_title_format_tip">
1958
- <?php
1959
- _e('The following macros are supported:', 'all_in_one_seo_pack');
1960
- echo('<ul>');
1961
- echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1962
- echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1963
- echo('<li>'); _e('%page_title% - The original title of the page', 'all_in_one_seo_pack'); echo('</li>');
1964
- echo('<li>'); _e("%page_author_login% - This page's author' login", 'all_in_one_seo_pack'); echo('</li>');
1965
- echo('<li>'); _e("%page_author_nicename% - This page's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
1966
- echo('<li>'); _e("%page_author_firstname% - This page's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1967
- echo('<li>'); _e("%page_author_lastname% - This page's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
1968
- echo('</ul>');
1969
- ?>
1970
- </div>
1971
- </td>
1972
- </tr>
1973
-
1974
- <tr>
1975
- <th scope="row" style="text-align:right; vertical-align:top;">
1976
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_title_format_tip');">
1977
- <?php _e('Category Title Format:', 'all_in_one_seo_pack')?>
1978
- </a>
1979
- </td>
1980
- <td>
1981
- <input size="59" name="aiosp_category_title_format" value="<?php echo stripcslashes(get_option('aiosp_category_title_format')); ?>"/>
1982
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_category_title_format_tip">
1983
- <?php
1984
- _e('The following macros are supported:', 'all_in_one_seo_pack');
1985
- echo('<ul>');
1986
- echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
1987
- echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
1988
- echo('<li>'); _e('%category_title% - The original title of the category', 'all_in_one_seo_pack'); echo('</li>');
1989
- echo('<li>'); _e('%category_description% - The description of the category', 'all_in_one_seo_pack'); echo('</li>');
1990
- echo('</ul>');
1991
- ?>
1992
- </div>
1993
- </td>
1994
- </tr>
1995
-
1996
- <tr>
1997
- <th scope="row" style="text-align:right; vertical-align:top;">
1998
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_title_format_tip');">
1999
- <?php _e('Archive Title Format:', 'all_in_one_seo_pack')?>
2000
- </a>
2001
- </td>
2002
- <td>
2003
- <input size="59" name="aiosp_archive_title_format" value="<?php echo stripcslashes(get_option('aiosp_archive_title_format')); ?>"/>
2004
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_archive_title_format_tip">
2005
- <?php
2006
- _e('The following macros are supported:', 'all_in_one_seo_pack');
2007
- echo('<ul>');
2008
- echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
2009
- echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
2010
- echo('<li>'); _e('%date% - The original archive title given by wordpress, e.g. "2007" or "2007 August"', 'all_in_one_seo_pack'); echo('</li>');
2011
- echo('</ul>');
2012
- ?>
2013
- </div>
2014
- </td>
2015
- </tr>
2016
-
2017
- <tr>
2018
- <th scope="row" style="text-align:right; vertical-align:top;">
2019
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_tag_title_format_tip');">
2020
- <?php _e('Tag Title Format:', 'all_in_one_seo_pack')?>
2021
- </a>
2022
- </td>
2023
- <td>
2024
- <input size="59" name="aiosp_tag_title_format" value="<?php echo stripcslashes(get_option('aiosp_tag_title_format')); ?>"/>
2025
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_tag_title_format_tip">
2026
- <?php
2027
- _e('The following macros are supported:', 'all_in_one_seo_pack');
2028
- echo('<ul>');
2029
- echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
2030
- echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
2031
- echo('<li>'); _e('%tag% - The name of the tag', 'all_in_one_seo_pack'); echo('</li>');
2032
- echo('</ul>');
2033
- ?>
2034
- </div>
2035
- </td>
2036
- </tr>
2037
-
2038
- <tr>
2039
- <th scope="row" style="text-align:right; vertical-align:top;">
2040
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_search_title_format_tip');">
2041
- <?php _e('Search Title Format:', 'all_in_one_seo_pack')?>
2042
- </a>
2043
- </td>
2044
- <td>
2045
- <input size="59" name="aiosp_search_title_format" value="<?php echo stripcslashes(get_option('aiosp_search_title_format')); ?>"/>
2046
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_search_title_format_tip">
2047
- <?php
2048
- _e('The following macros are supported:', 'all_in_one_seo_pack');
2049
- echo('<ul>');
2050
- echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
2051
- echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
2052
- echo('<li>'); _e('%search% - What was searched for', 'all_in_one_seo_pack'); echo('</li>');
2053
- echo('</ul>');
2054
- ?>
2055
- </div>
2056
- </td>
2057
- </tr>
2058
-
2059
- <tr>
2060
- <th scope="row" style="text-align:right; vertical-align:top;">
2061
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_description_format_tip');">
2062
- <?php _e('Description Format:', 'all_in_one_seo_pack')?>
2063
- </a>
2064
- </td>
2065
- <td>
2066
- <input size="59" name="aiosp_description_format" value="<?php echo stripcslashes(get_option('aiosp_description_format')); ?>"/>
2067
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_description_format_tip">
2068
- <?php
2069
- _e('The following macros are supported:', 'all_in_one_seo_pack');
2070
- echo('<ul>');
2071
- echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
2072
- echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
2073
- echo('<li>'); _e('%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'); echo('</li>');
2074
- echo('<li>'); _e('%wp_title% - The original wordpress title, e.g. post_title for posts', 'all_in_one_seo_pack'); echo('</li>');
2075
- echo('</ul>');
2076
- ?>
2077
- </div>
2078
- </td>
2079
- </tr>
2080
-
2081
- <tr>
2082
- <th scope="row" style="text-align:right; vertical-align:top;">
2083
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_404_title_format_tip');">
2084
- <?php _e('404 Title Format:', 'all_in_one_seo_pack')?>
2085
- </a>
2086
- </td>
2087
- <td>
2088
- <input size="59" name="aiosp_404_title_format" value="<?php echo stripcslashes(get_option('aiosp_404_title_format')); ?>"/>
2089
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_404_title_format_tip">
2090
- <?php
2091
- _e('The following macros are supported:', 'all_in_one_seo_pack');
2092
- echo('<ul>');
2093
- echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
2094
- echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
2095
- echo('<li>'); _e('%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all_in_one_seo_pack'); echo('</li>');
2096
- echo('<li>'); _e('%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all_in_one_seo_pack'); echo('</li>');
2097
- echo('</ul>');
2098
- ?>
2099
- </div>
2100
- </td>
2101
- </tr>
2102
-
2103
- <tr>
2104
- <th scope="row" style="text-align:right; vertical-align:top;">
2105
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_paged_format_tip');">
2106
- <?php _e('Paged Format:', 'all_in_one_seo_pack')?>
2107
- </a>
2108
- </td>
2109
- <td>
2110
- <input size="59" name="aiosp_paged_format" value="<?php echo stripcslashes(get_option('aiosp_paged_format')); ?>"/>
2111
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_paged_format_tip">
2112
- <?php
2113
- _e('This string gets appended/prepended to titles when they are for paged index pages (like home or archive pages).', 'all_in_one_seo_pack');
2114
- _e('The following macros are supported:', 'all_in_one_seo_pack');
2115
- echo('<ul>');
2116
- echo('<li>'); _e('%page% - The page number', 'all_in_one_seo_pack'); echo('</li>');
2117
- echo('</ul>');
2118
- ?>
2119
- </div>
2120
- </td>
2121
- </tr>
2122
-
2123
- <tr>
2124
- <th scope="row" style="text-align:right; vertical-align:top;">
2125
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_use_categories_tip');">
2126
- <?php _e('Use Categories for META keywords:', 'all_in_one_seo_pack')?>
2127
- </td>
2128
- <td>
2129
- <input type="checkbox" name="aiosp_use_categories" <?php if (get_option('aiosp_use_categories')) echo "checked=\"1\""; ?>/>
2130
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_use_categories_tip">
2131
- <?php
2132
- _e('Check this if you want your categories for a given post used as the META keywords for this post (in addition to any keywords and tags you specify on the post edit page).', 'all_in_one_seo_pack');
2133
- ?>
2134
- </div>
2135
- </td>
2136
- </tr>
2137
-
2138
- <tr>
2139
- <th scope="row" style="text-align:right; vertical-align:top;">
2140
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_dynamic_postspage_keywords_tip');">
2141
- <?php _e('Dynamically Generate Keywords for Posts Page:', 'all_in_one_seo_pack')?>
2142
- </td>
2143
- <td>
2144
- <input type="checkbox" name="aiosp_dynamic_postspage_keywords" <?php if (get_option('aiosp_dynamic_postspage_keywords')) echo "checked=\"1\""; ?>/>
2145
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_dynamic_postspage_keywords_tip">
2146
- <?php
2147
- _e('Check this if you want your keywords on a custom posts page (set it in options->reading) 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');
2148
- ?>
2149
- </div>
2150
- </td>
2151
- </tr>
2152
-
2153
- <tr>
2154
- <th scope="row" style="text-align:right; vertical-align:top;">
2155
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_noindex_tip');">
2156
- <?php _e('Use noindex for Categories:', 'all_in_one_seo_pack')?>
2157
- </a>
2158
- </td>
2159
- <td>
2160
- <input type="checkbox" name="aiosp_category_noindex" <?php if (get_option('aiosp_category_noindex')) echo "checked=\"1\""; ?>/>
2161
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_category_noindex_tip">
2162
- <?php
2163
- _e('Check this for excluding category pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
2164
- ?>
2165
- </div>
2166
- </td>
2167
- </tr>
2168
-
2169
- <tr>
2170
- <th scope="row" style="text-align:right; vertical-align:top;">
2171
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_noindex_tip');">
2172
- <?php _e('Use noindex for Archives:', 'all_in_one_seo_pack')?>
2173
- </a>
2174
- </td>
2175
- <td>
2176
- <input type="checkbox" name="aiosp_archive_noindex" <?php if (get_option('aiosp_archive_noindex')) echo "checked=\"1\""; ?>/>
2177
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_archive_noindex_tip">
2178
- <?php
2179
- _e('Check this for excluding archive pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
2180
- ?>
2181
- </div>
2182
- </td>
2183
- </tr>
2184
-
2185
- <tr>
2186
- <th scope="row" style="text-align:right; vertical-align:top;">
2187
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_tags_noindex_tip');">
2188
- <?php _e('Use noindex for Tag Archives:', 'all_in_one_seo_pack')?>
2189
- </a>
2190
- </td>
2191
- <td>
2192
- <input type="checkbox" name="aiosp_tags_noindex" <?php if (get_option('aiosp_tags_noindex')) echo "checked=\"1\""; ?>/>
2193
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_tags_noindex_tip">
2194
- <?php
2195
- _e('Check this for excluding tag pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
2196
- ?>
2197
- </div>
2198
- </td>
2199
- </tr>
2200
-
2201
- <tr>
2202
- <th scope="row" style="text-align:right; vertical-align:top;">
2203
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_generate_descriptions_tip');">
2204
- <?php _e('Autogenerate Descriptions:', 'all_in_one_seo_pack')?>
2205
- </a>
2206
- </td>
2207
- <td>
2208
- <input type="checkbox" name="aiosp_generate_descriptions" <?php if (get_option('aiosp_generate_descriptions')) echo "checked=\"1\""; ?>/>
2209
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_generate_descriptions_tip">
2210
- <?php
2211
- _e("Check this and your META descriptions will get autogenerated if there's no excerpt.", 'all_in_one_seo_pack');
2212
- ?>
2213
- </div>
2214
- </td>
2215
- </tr>
2216
-
2217
- <tr>
2218
- <th scope="row" style="text-align:right; vertical-align:top;">
2219
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_meta_tags_tip');">
2220
- <?php _e('Additional Post Headers:', 'all_in_one_seo_pack')?>
2221
- </a>
2222
- </td>
2223
- <td>
2224
- <textarea cols="57" rows="2" name="aiosp_post_meta_tags"><?php echo stripcslashes(get_option('aiosp_post_meta_tags')); ?></textarea>
2225
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_post_meta_tags_tip">
2226
- <?php
2227
- _e('What you enter here will be copied verbatim to your header on post pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
2228
- ?>
2229
- </div>
2230
- </td>
2231
- </tr>
2232
-
2233
- <tr>
2234
- <th scope="row" style="text-align:right; vertical-align:top;">
2235
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_meta_tags_tip');">
2236
- <?php _e('Additional Page Headers:', 'all_in_one_seo_pack')?>
2237
- </a>
2238
- </td>
2239
- <td>
2240
- <textarea cols="57" rows="2" name="aiosp_page_meta_tags"><?php echo stripcslashes(get_option('aiosp_page_meta_tags')); ?></textarea>
2241
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_page_meta_tags_tip">
2242
- <?php
2243
- _e('What you enter here will be copied verbatim to your header on pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
2244
- ?>
2245
- </div>
2246
- </td>
2247
- </tr>
2248
 
2249
- <tr>
2250
- <th scope="row" style="text-align:right; vertical-align:top;">
2251
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_meta_tags_tip');">
2252
- <?php _e('Additional Home Headers:', 'all_in_one_seo_pack')?>
2253
- </a>
2254
- </td>
2255
- <td>
2256
- <textarea cols="57" rows="2" name="aiosp_home_meta_tags"><?php echo stripcslashes(get_option('aiosp_home_meta_tags')); ?></textarea>
2257
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_home_meta_tags_tip">
2258
- <?php
2259
- _e('What you enter here will be copied verbatim to your header on the home page. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
2260
- ?>
2261
- </div>
2262
- </td>
2263
- </tr>
2264
 
2265
- <tr>
2266
- <th scope="row" style="text-align:right; vertical-align:top;">
2267
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'auto_social')?>" onclick="toggleVisibility('aiosp_do_log_tip');">
2268
- <?php _e('Log important events:', 'all_in_one_seo_pack')?>
2269
- </a>
2270
- </td>
2271
- <td>
2272
- <input type="checkbox" name="aiosp_do_log" <?php if (get_option('aiosp_do_log')) echo "checked=\"1\""; ?>/>
2273
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_do_log_tip">
2274
- <?php
2275
- _e('Check this and SEO pack will create a log of important events (all_in_one_seo_pack.log) in its plugin directory which might help debugging it. Make sure this directory is writable.', 'all_in_one_seo_pack');
2276
- ?>
2277
- </div>
2278
- </td>
2279
- </tr>
2280
 
2281
- <?php if (get_option('aiosp_donate')){?>
2282
- <tr>
2283
- <th scope="row" style="text-align:right; vertical-align:top;">
2284
- <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_donate_tip');">
2285
- <?php _e('Thank you for your donation:', 'all_in_one_seo_pack')?>
2286
- </a>
2287
- </td>
2288
- <td>
2289
- <input type="checkbox" name="aiosp_donate" <?php if (get_option('aiosp_donate')) echo "checked=\"1\""; ?>/>
2290
- <div style="max-width:500px; text-align:left; display:none" id="aiosp_donate_tip">
2291
- <?php
2292
- _e('All donations support continued development of this free software.', 'all_in_one_seo_pack');
2293
- ?>
2294
- </div>
2295
- </td>
2296
- </tr>
2297
- <?php } ?>
2298
 
2299
- </table>
2300
- <p class="submit">
2301
- <input type="hidden" name="action" value="aiosp_update" />
2302
- <input type="hidden" name="nonce-aioseop" value="<?php echo wp_create_nonce('aioseop-nonce'); ?>" />
2303
- <input type="hidden" name="page_options" value="aiosp_home_description" />
2304
- <input type="submit" name="Submit" value="<?php _e('Update Options', 'all_in_one_seo_pack')?> &raquo;" />
2305
- </p>
2306
- <p><br />
2307
- <strong>Check out these other great plugins!</strong><br />
2308
- <a href="http://semperfiwebdesign.com/custom-applications/sms-text-message/" title="SMS Text Message WordPress plugin">SMS Text Message</a> - sends SMS updates to your readers<br />
2309
- <a href="http://semperfiwebdesign.com/custom-applications/wp-security-scan/" title="WordPress Security">WordPress Security Scan</a> - provides vital security for your WordPress site
2310
- </p>
2311
- </form>
2312
- </div>
2313
- <?php
2314
-
2315
- } // options_panel
2316
 
 
 
2317
  }
2318
 
2319
- add_option("aiosp_home_description", null, 'All in One SEO Plugin Home Description', 'yes');
2320
- add_option("aiosp_home_title", null, 'All in One SEO Plugin Home Title', 'yes');
2321
- add_option("aiosp_donate", 0, 'All in One SEO Pack Donate', 'no');
2322
- add_option("aiosp_can", 1, 'All in One SEO Pack Canonical URLs', 'yes');
2323
- add_option("aiosp_rewrite_titles", 1, 'All in One SEO Plugin Rewrite Titles', 'yes');
2324
- add_option("aiosp_use_categories", 0, 'All in One SEO Plugin Use Categories', 'yes');
2325
- add_option("aiosp_category_noindex", 1, 'All in One SEO Plugin Noindex for Categories', 'yes');
2326
- add_option("aiosp_archive_noindex", 1, 'All in One SEO Plugin Noindex for Archives', 'yes');
2327
- add_option("aiosp_tags_noindex", 0, 'All in One SEO Plugin Noindex for Tag Archives', 'yes');
2328
- add_option("aiosp_generate_descriptions", 1, 'All in One SEO Plugin Autogenerate Descriptions', 'yes');
2329
- add_option("aiosp_post_title_format", '%post_title% | %blog_title%', 'All in One SEO Plugin Post Title Format', 'yes');
2330
- add_option("aiosp_page_title_format", '%page_title% | %blog_title%', 'All in One SEO Plugin Page Title Format', 'yes');
2331
- add_option("aiosp_dynamic_postspage_keywords", 1, 'All in One SEO Plugin Dynamic Posts Page Keywords', 'yes');
2332
- add_option("aiosp_category_title_format", '%category_title% | %blog_title%', 'All in One SEO Plugin Category Title Format', 'yes');
2333
- add_option("aiosp_archive_title_format", '%date% | %blog_title%', 'All in One SEO Plugin Archive Title Format', 'yes');
2334
- add_option("aiosp_tag_title_format", '%tag% | %blog_title%', 'All in One SEO Plugin Tag Title Format', 'yes');
2335
- add_option("aiosp_search_title_format", '%search% | %blog_title%', 'All in One SEO Plugin Search Title Format', 'yes');
2336
- add_option("aiosp_description_format", '%description%', 'All in One SEO Plugin Description Format', 'yes');
2337
- add_option("aiosp_paged_format", ' - Part %page%', 'All in One SEO Plugin Paged Format', 'yes');
2338
- add_option("aiosp_404_title_format", 'Nothing found for %request_words%', 'All in One SEO Plugin 404 Title Format', 'yes');
2339
- add_option("aiosp_post_meta_tags", '', 'All in One SEO Plugin Additional Post Meta Tags', 'yes');
2340
- add_option("aiosp_page_meta_tags", '', 'All in One SEO Plugin Additional Post Meta Tags', 'yes');
2341
- add_option("aiosp_home_meta_tags", '', 'All in One SEO Plugin Additional Home Meta Tags', 'yes');
2342
- add_option("aiosp_do_log", null, 'All in One SEO Plugin write log file', 'yes');
2343
- //$role = get_role('administrator');
2344
- //$role->add_cap('Edit AIOSEOP Options');
2345
- //$role->add_cap('Edit AIOSEOP on Posts/Pages');
2346
-
2347
- $aiosp = new All_in_One_SEO_Pack();
2348
- add_action('wp_head', array($aiosp, 'wp_head'));
2349
- add_action('template_redirect', array($aiosp, 'template_redirect'));
2350
-
2351
- add_action('init', array($aiosp, 'init'));
2352
 
2353
  if (substr($aiosp->wp_version, 0, 3) < '2.5') {
2354
  add_action('dbx_post_advanced', array($aiosp, 'add_meta_tags_textinput'));
@@ -2356,21 +678,12 @@ if (substr($aiosp->wp_version, 0, 3) < '2.5') {
2356
  }
2357
 
2358
 
2359
- add_action('edit_post', array($aiosp, 'post_meta_tags'));
2360
- add_action('publish_post', array($aiosp, 'post_meta_tags'));
2361
- add_action('save_post', array($aiosp, 'post_meta_tags'));
2362
- add_action('edit_page_form', array($aiosp, 'post_meta_tags'));
2363
-
2364
- add_action('admin_menu', array($aiosp, 'admin_menu'));
2365
-
2366
 
2367
- add_action('admin_menu', 'aiosp_meta_box_add');
2368
 
2369
  function aiosp_meta_box_add() {
2370
- // Check whether the 2.5 function add_meta_box exists, and if it doesn't use 2.3 functions.
2371
  if ( function_exists('add_meta_box') ) {
2372
- add_meta_box('aiosp','All in One SEO Pack','aiosp_meta','post');
2373
- add_meta_box('aiosp','All in One SEO Pack','aiosp_meta','page');
2374
  } else {
2375
  add_action('dbx_post_advanced', array($aiosp, 'add_meta_tags_textinput'));
2376
  add_action('dbx_page_advanced', array($aiosp, 'add_meta_tags_textinput'));
@@ -2385,12 +698,13 @@ function aiosp_meta() {
2385
  if (is_object($post_id)){
2386
  $post_id = $post_id->ID;
2387
  }
2388
- $keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'keywords', true)));
2389
- $title = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'title', true)));
2390
- $description = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'description', true)));
2391
- $aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'aiosp_meta', true)));
2392
- $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'aiosp_disable', true)));
2393
-
 
2394
  ?>
2395
  <SCRIPT LANGUAGE="JavaScript">
2396
  <!-- Begin
@@ -2413,7 +727,7 @@ function aiosp_meta() {
2413
  </tr>
2414
  <tr>
2415
  <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
2416
- <td><textarea name="aiosp_description" rows="1" cols="60"
2417
  onKeyDown="countChars(document.post.aiosp_description,document.post.length1)"
2418
  onKeyUp="countChars(document.post.aiosp_description,document.post.length1)"><?php echo $description ?></textarea><br />
2419
  <input readonly type="text" name="length1" size="3" maxlength="3" value="<?php echo strlen($description);?>" />
@@ -2425,8 +739,17 @@ function aiosp_meta() {
2425
  <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="62"/></td>
2426
  </tr>
2427
  <input type="hidden" name="nonce-aioseop-edit" value="<?php echo wp_create_nonce('edit-aioseop-nonce') ?>" />
2428
-
2429
-
 
 
 
 
 
 
 
 
 
2430
  <tr>
2431
  <th scope="row" style="text-align:right; vertical-align:top;">
2432
  <?php _e('Disable on this page/post:', 'all_in_one_seo_pack')?>
3
  /*
4
  Plugin Name: All in One SEO Pack
5
  Plugin URI: http://semperfiwebdesign.com
6
+ Description: Out-of-the-box SEO for your Wordpress blog. <a href="options-general.php?page=all-in-one-seo-pack/aioseop.class.php">Options configuration panel</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperfiwebdesign.com/forum/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
7
+ Version: 1.6
8
  Author: Michael Torbert
9
  Author URI: http://michaeltorbert.com
10
  */
28
  */
29
 
30
  /*******************************************************************************************************/
31
+ register_activation_hook(__FILE__,'aioseop_activate_pl');
32
 
33
  $UTF8_TABLES['strtolower'] = array(
34
  "Z" => "z", "Y" => "y", "X" => "x",
484
  if ( ! defined( 'WP_PLUGIN_DIR' ) )
485
  define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
486
 
487
+ require_once('aioseop.class.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
 
489
+ global $aioseop_options;
490
+ $aioseop_options = get_option('aioseop_options');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
492
 
493
 
494
  /*
495
+ add_option("aiosp_home_description", null, 'All in One SEO Plugin Home Description', 'yes');
496
+ add_option("aiosp_home_title", null, 'All in One SEO Plugin Home Title', 'yes');
497
+ add_option("aiosp_donate", 0, 'All in One SEO Pack Donate', 'no');
498
+ add_option("aiosp_can", 1, 'All in One SEO Pack Canonical URLs', 'yes');
499
+ add_option("aiosp_rewrite_titles", 1, 'All in One SEO Plugin Rewrite Titles', 'yes');
500
+ add_option("aiosp_use_categories", 0, 'All in One SEO Plugin Use Categories', 'yes');
501
+ add_option("aiosp_category_noindex", 1, 'All in One SEO Plugin Noindex for Categories', 'yes');
502
+ add_option("aiosp_archive_noindex", 1, 'All in One SEO Plugin Noindex for Archives', 'yes');
503
+ add_option("aiosp_tags_noindex", 0, 'All in One SEO Plugin Noindex for Tag Archives', 'yes');
504
+ add_option("aiosp_generate_descriptions", 1, 'All in One SEO Plugin Autogenerate Descriptions', 'yes');
505
+ add_option("aiosp_post_title_format", '%post_title% | %blog_title%', 'All in One SEO Plugin Post Title Format', 'yes');
506
+ add_option("aiosp_page_title_format", '%page_title% | %blog_title%', 'All in One SEO Plugin Page Title Format', 'yes');
507
+ add_option("aiosp_dynamic_postspage_keywords", 1, 'All in One SEO Plugin Dynamic Posts Page Keywords', 'yes');
508
+ add_option("aiosp_category_title_format", '%category_title% | %blog_title%', 'All in One SEO Plugin Category Title Format', 'yes');
509
+ add_option("aiosp_archive_title_format", '%date% | %blog_title%', 'All in One SEO Plugin Archive Title Format', 'yes');
510
+ add_option("aiosp_tag_title_format", '%tag% | %blog_title%', 'All in One SEO Plugin Tag Title Format', 'yes');
511
+ add_option("aiosp_search_title_format", '%search% | %blog_title%', 'All in One SEO Plugin Search Title Format', 'yes');
512
+ add_option("aiosp_description_format", '%description%', 'All in One SEO Plugin Description Format', 'yes');
513
+ add_option("aiosp_paged_format", ' - Part %page%', 'All in One SEO Plugin Paged Format', 'yes');
514
+ add_option("aiosp_404_title_format", 'Nothing found for %request_words%', 'All in One SEO Plugin 404 Title Format', 'yes');
515
+ add_option("aiosp_post_meta_tags", '', 'All in One SEO Plugin Additional Post Meta Tags', 'yes');
516
+ add_option("aiosp_page_meta_tags", '', 'All in One SEO Plugin Additional Post Meta Tags', 'yes');
517
+ add_option("aiosp_home_meta_tags", '', 'All in One SEO Plugin Additional Home Meta Tags', 'yes');
518
+ add_option("aiosp_do_log", null, 'All in One SEO Plugin write log file', 'yes');
519
  */
520
 
521
+ //$role = get_role('administrator');
522
+ //$role->add_cap('Edit AIOSEOP Options');
523
+ //$role->add_cap('Edit AIOSEOP on Posts/Pages');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
 
525
+ ////checking to see if things need to be updated
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
 
527
+ //if_post('turn-on'){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
 
529
+ /* automattic?
530
+ if(!get_option('aioseop_options')){
531
+ aioseop_mrt_fix_meta(); //move this to the if also
532
+ aioseop_mrt_mkarry();
 
533
  }
534
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
 
536
+ if($_POST['aioseop_migrate']) aioseop_mrt_fix_meta();
537
+ if($_POST['aioseop_migrate_options']) aioseop_mrt_mkarry();
538
+ if(!get_option('aiosp_post_title_format') && !get_option('aioseop_options')) aioseop_mrt_mkarry();
 
539
 
540
+ //}end _post('turn_on')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
 
543
+ ////end checking to see if things need to be updated
 
 
 
 
 
544
 
 
 
 
 
 
 
 
 
 
545
 
546
+ function aioseop_mrt_fix_meta(){
547
+ global $wpdb;
548
+ $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_keywords' WHERE meta_key = 'keywords'");
549
+ $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_title' WHERE meta_key = 'title'");
550
+ $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_description' WHERE meta_key = 'description'");
551
+ $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_meta' WHERE meta_key = 'aiosp_meta'");
552
+ $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_disable' WHERE meta_key = 'aiosp_disable'");
553
+ echo "<div class='updated fade' style='background-color:green;border-color:green;'><p><strong>Updating SEO post meta in database.</strong></p></div";
554
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
 
556
+ function aioseop_get_version(){
557
+ return '1.6';
558
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
 
 
 
 
 
 
 
 
 
560
 
561
+ function aioseop_mrt_mkarry() {
562
+ $naioseop_options = array(
563
+ "aiosp_can"=>1,
564
+ "aiosp_donate"=>0,
565
+ "aiosp_home_title"=>null,
566
+ "aiosp_home_description"=>'',
567
+ "aiosp_home_keywords"=>null,
568
+ "aiosp_max_words_excerpt"=>'something',
569
+ "aiosp_rewrite_titles"=>1,
570
+ "aiosp_post_title_format"=>'%post_title% | %blog_title%',
571
+ "aiosp_page_title_format"=>'%page_title% | %blog_title%',
572
+ "aiosp_category_title_format"=>'%category_title% | %blog_title%',
573
+ "aiosp_archive_title_format"=>'%date% | %blog_title%',
574
+ "aiosp_tag_title_format"=>'%tag% | %blog_title%',
575
+ "aiosp_search_title_format"=>'%search% | %blog_title%',
576
+ "aiosp_description_format"=>'%description%',
577
+ "aiosp_404_title_format"=>'Nothing found for %request_words%',
578
+ "aiosp_paged_format"=>' - Part %page%',
579
+ "aiosp_use_categories"=>0,
580
+ "aiosp_dynamic_postspage_keywords"=>1,
581
+ "aiosp_category_noindex"=>1,
582
+ "aiosp_archive_noindex"=>1,
583
+ "aiosp_tags_noindex"=>0,
584
+ "aiosp_generate_descriptions"=>1,
585
+ "aiosp_debug_info"=>null,
586
+ "aiosp_post_meta_tags"=>'',
587
+ "aiosp_page_meta_tags"=>'',
588
+ "aiosp_home_meta_tags"=>'',
589
+ "aiosp_enabled" =>0,
590
+ "aiosp_do_log"=>null);
591
+
592
+ foreach( $naioseop_options as $aioseop_opt_name => $value ) {
593
+ if( $aioseop_oldval = get_option($aioseop_opt_name) ) {
594
+ $naioseop_options[$aioseop_opt_name] = $aioseop_oldval;
595
+
 
 
596
  }
597
+ delete_option($aioseop_opt_name);
598
  }
599
 
600
+ add_option('aioseop_options',$naioseop_options);
601
+ echo "<div class='updated fade' style='background-color:green;border-color:green;'><p><strong>Updating SEO configuration options in database</strong></p></div";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
 
603
+ }
604
+ //if( function_exists( 'is_site_admin' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
605
 
606
+ function aioseop_activation_notice(){
607
+ global $aioseop_options;
608
+ echo '<div class="error fade" style="background-color:red;"><p><strong>All in One SEO Pack must be configured. Go to <a href="' . admin_url( 'options-general.php?page=all-in-one-seo-pack/aioseop.class.php' ) . '">the admin page</a> to enable and configure the plugin.</strong></p></div>';
 
 
 
 
 
 
609
 
610
+ }
 
611
 
612
+ //add_action('after_plugin_row_all-in-one-seo-pack/all_in_one_seo_pack.php', 'add_plugin_row', 10, 2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
613
 
614
+ function add_plugin_row($links, $file) {
 
 
 
 
 
 
 
615
 
616
+ echo '<td colspan="5" style="background-color:yellow;">';
617
+ echo wp_remote_fopen('http://aioseop.semperfiwebdesign.com/');
618
+ echo '</td>';
 
 
619
 
620
+ }
621
+ function aioseop_activate_pl(){
622
+ if(get_option('aioseop_options')){
623
+ $aioseop_options = get_option('aioseop_options');
624
+ $aioseop_options['aiosp_enabled'] = "0";
625
+ $aioseop_options['aiosp_donate'] = "0";
626
+ update_option('aioseop_options',$aioseop_options);
627
  }
628
+ }
629
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
 
631
+ if($aioseop_options['aiosp_enabled']){
632
+ add_action('wp_list_pages', 'aioseop_list_pages');
 
 
 
 
 
 
 
 
 
 
 
 
 
633
 
634
+ }
635
+ $aiosp = new All_in_One_SEO_Pack();
636
+ add_action('edit_post', array($aiosp, 'post_meta_tags'));
637
+ add_action('publish_post', array($aiosp, 'post_meta_tags'));
638
+ add_action('save_post', array($aiosp, 'post_meta_tags'));
639
+ add_action('edit_page_form', array($aiosp, 'post_meta_tags'));
640
+ add_action('init', array($aiosp, 'init'));
641
+ add_action('wp_head', array($aiosp, 'wp_head'));
642
+ add_action('template_redirect', array($aiosp, 'template_redirect'));
643
+ //add_action('admin_head',array($aiosp, 'seo_mrt_admin_head');
644
+ add_action('admin_menu', array($aiosp, 'admin_menu'));
645
+ add_action('admin_menu', 'aiosp_meta_box_add');
 
 
 
646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
648
 
649
+ if( ($_POST['aiosp_enabled'] == null && $aioseop_options['aiosp_enabled']!='1') || $_POST['aiosp_enabled']=='0'){
650
+ add_action( 'admin_notices', 'aioseop_activation_notice');
651
  }
652
 
653
+ // Thanks to SarahG for much of the code for the following two functions
654
+ function aioseop_list_pages($content){
655
+ $url = preg_replace(array('/\//', '/\./', '/\-/'), array('\/', '\.', '\-'), get_option('siteurl'));
656
+ $pattern = '/<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">([^<]+)<\/a>/i';
657
+ return preg_replace_callback($pattern, "aioseop_filter_callback", $content);
658
+ }
659
+
660
+ function aioseop_filter_callback($matches) {
661
+ global $wpdb;
662
+ if ($matches[1] && !empty($matches[1])) $postID = $matches[1];
663
+ if (empty($postID)) $postID = get_option("page_on_front");
664
+ $title_attrib = stripslashes(get_post_meta($postID, '_aioseop_titleatr', true));
665
+ $menulabel = stripslashes(get_post_meta($postID, '_aioseop_menulabel', true));
666
+ if (empty($menulabel)) $menulabel = $matches[4];
667
+ if (!empty($title_attrib)) :
668
+ $filtered = '<li class="page_item page-item-'.$postID.$matches[2].'"><a href="'.$matches[3].'" title="'.$title_attrib.'">'.$menulabel.'</a>';
669
+ else :
670
+ $filtered = '<li class="page_item page-item-'.$postID.$matches[2].'"><a href="'.$matches[3].'">'.$menulabel.'</a>';
671
+ endif;
672
+ return $filtered;
673
+ }
 
 
 
 
 
 
 
 
 
 
 
 
674
 
675
  if (substr($aiosp->wp_version, 0, 3) < '2.5') {
676
  add_action('dbx_post_advanced', array($aiosp, 'add_meta_tags_textinput'));
678
  }
679
 
680
 
 
 
 
 
 
 
 
681
 
 
682
 
683
  function aiosp_meta_box_add() {
 
684
  if ( function_exists('add_meta_box') ) {
685
+ add_meta_box('aiosp',__('All in One SEO Pack', 'all_in_one_seo_pack'),'aiosp_meta','post');
686
+ add_meta_box('aiosp',__('All in One SEO Pack', 'all_in_one_seo_pack'),'aiosp_meta','page');
687
  } else {
688
  add_action('dbx_post_advanced', array($aiosp, 'add_meta_tags_textinput'));
689
  add_action('dbx_page_advanced', array($aiosp, 'add_meta_tags_textinput'));
698
  if (is_object($post_id)){
699
  $post_id = $post_id->ID;
700
  }
701
+ $keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_keywords', true)));
702
+ $title = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_title', true)));
703
+ $description = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_description', true)));
704
+ $aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aiosp_meta', true)));
705
+ $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aiosp_disable', true)));
706
+ $aiosp_titleatr = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_titleatr', true)));
707
+ $aiosp_menulabel = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_menulabel', true)));
708
  ?>
709
  <SCRIPT LANGUAGE="JavaScript">
710
  <!-- Begin
727
  </tr>
728
  <tr>
729
  <th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
730
+ <td><textarea name="aiosp_description" rows="3" cols="60"
731
  onKeyDown="countChars(document.post.aiosp_description,document.post.length1)"
732
  onKeyUp="countChars(document.post.aiosp_description,document.post.length1)"><?php echo $description ?></textarea><br />
733
  <input readonly type="text" name="length1" size="3" maxlength="3" value="<?php echo strlen($description);?>" />
739
  <td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="62"/></td>
740
  </tr>
741
  <input type="hidden" name="nonce-aioseop-edit" value="<?php echo wp_create_nonce('edit-aioseop-nonce') ?>" />
742
+ <?php if($post->post_type=='page'){ ?>
743
+ <tr>
744
+ <th scope="row" style="text-align:right;"><?php _e('Title Attribute:', 'all_in_one_seo_pack') ?></th>
745
+ <td><input value="<?php echo $aiosp_titleatr ?>" type="text" name="aiosp_titleatr" size="62"/></td>
746
+ </tr>
747
+
748
+ <tr>
749
+ <th scope="row" style="text-align:right;"><?php _e('Menu Label:', 'all_in_one_seo_pack') ?></th>
750
+ <td><input value="<?php echo $aiosp_menulabel ?>" type="text" name="aiosp_menulabel" size="62"/></td>
751
+ </tr>
752
+ <?php } ?>
753
  <tr>
754
  <th scope="row" style="text-align:right; vertical-align:top;">
755
  <?php _e('Disable on this page/post:', 'all_in_one_seo_pack')?>
images/twitter.png ADDED
Binary file
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: hallsofmontezuma
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: post,google,seo,meta,meta keywords,meta description,title,posts,plugin, search engine optimization
5
  Requires at least: 1.5
6
- Tested up to: 2.8
7
  Stable tag: trunk
8
 
9
  Automatically optimizes your Wordpress blog for Search Engines (Search Engine Optimization).
@@ -14,22 +14,27 @@ Automatically optimizes your Wordpress blog for Search Engines (Search Engine Op
14
 
15
  **[Download now!](http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip)**
16
 
 
 
17
  [Support](http://semperfiwebdesign.com/forum/) |
18
- [Version History](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-pack-release-history/) |
19
  [FAQ](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/)|
20
  [Translations](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/translations-for-all-in-one-seo-pack/)
21
 
22
  Some features:
23
 
24
  * Canonical URLs
 
 
 
25
  * Nonce Security
26
  * Support for CMS-style WordPress installations
27
  * Automatically optimizes your **titles** for search engines
28
  * Generates **META tags automatically**
29
  * Avoids the typical duplicate content found on Wordpress blogs
30
- * For Wordpress 2.7.1 you don't even have to look at the options, it works out-of-the-box. Just install.
 
31
  * You can override any title and set any META description and any META keywords you want.
32
- * You can fine-tune everything
33
  * Backward-Compatibility with many other plugins, like Auto Meta, Ultimate Tag Warrior and others.
34
 
35
  Be sure to check out:
@@ -42,14 +47,19 @@ Torbert](http://twitter.com/michaeltorbert/)
42
 
43
  == Installation ==
44
 
45
- 1. Unzip into your `/wp-content/plugins/` directory. If you're uploading it make sure to upload
 
 
 
46
  the top-level folder. Don't just upload all the php files and put them in `/wp-content/plugins/`.
47
  1. Activate the plugin through the 'Plugins' menu in WordPress
48
- 1. Visit your SEO options (*Options - All in One SEO*) for Wordpress 2.3.x, (*Settings - All in One SEO*) for Wordpress 2.5.x-2.7
 
49
  1. That's it!
50
 
51
- For upgrading please use the built-in one-click updater (*Options - All in One SEO*).
52
- If you have to upgrade manually simply repeat the installation steps.
 
53
 
54
  == Frequently Asked Questions ==
55
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: post,google,seo,meta,meta keywords,meta description,title,posts,plugin, search engine optimization
5
  Requires at least: 1.5
6
+ Tested up to: 2.8.1
7
  Stable tag: trunk
8
 
9
  Automatically optimizes your Wordpress blog for Search Engines (Search Engine Optimization).
14
 
15
  **[Download now!](http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip)**
16
 
17
+ **If upgrading, please back up your database first!**
18
+
19
  [Support](http://semperfiwebdesign.com/forum/) |
20
+ [Change Log](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-pack-release-history/) |
21
  [FAQ](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/)|
22
  [Translations](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/translations-for-all-in-one-seo-pack/)
23
 
24
  Some features:
25
 
26
  * Canonical URLs
27
+ * Fine tune Page Navigational Links
28
+ * Built-in API so other plugins/themes can access and extend functionality
29
+ * Provides SEO Integration for WP e-Commerce sites
30
  * Nonce Security
31
  * Support for CMS-style WordPress installations
32
  * Automatically optimizes your **titles** for search engines
33
  * Generates **META tags automatically**
34
  * Avoids the typical duplicate content found on Wordpress blogs
35
+ * For beginners, you don't even have to look at the options, it works out-of-the-box. Just install.
36
+ * For advanced users, you can fine-tune everything
37
  * You can override any title and set any META description and any META keywords you want.
 
38
  * Backward-Compatibility with many other plugins, like Auto Meta, Ultimate Tag Warrior and others.
39
 
40
  Be sure to check out:
47
 
48
  == Installation ==
49
 
50
+ You can use the built in installer and upgrader, or you can install the plugin
51
+ manually.
52
+
53
+ 1. You can either use the automatic plugin installer or your FTP program to upload it to your wp-content/plugins directory
54
  the top-level folder. Don't just upload all the php files and put them in `/wp-content/plugins/`.
55
  1. Activate the plugin through the 'Plugins' menu in WordPress
56
+ 1. Visit your SEO options (*Options - All in One SEO*) for Wordpress 2.3.x, (*Settings - All in One SEO*) for Wordpress 2.5.x-2.8.x
57
+ 1. Configure any options as desired, and then enable the plugin
58
  1. That's it!
59
 
60
+ If you have to upgrade manually simply repeat the installation steps and re-enable the plugin.
61
+
62
+ **If upgrading, please back up your database first!**
63
 
64
  == Frequently Asked Questions ==
65