119 } |
119 } |
120 |
120 |
121 if (is_single() || is_page()) { |
121 if (is_single() || is_page()) { |
122 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true))); |
122 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true))); |
123 if ($aiosp_disable) { |
123 if ($aiosp_disable) { |
|
124 $aiosp_disable_analytics = htmlspecialchars(stripcslashes( get_post_meta( $post->ID, '_aioseop_disable_analytics', true ) ) ); |
|
125 if ( $aiosp_disable_analytics ) |
|
126 remove_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) ); |
124 return; |
127 return; |
125 } |
128 } |
126 } |
129 } |
127 |
|
128 |
|
129 |
130 |
130 if ($aioseop_options['aiosp_rewrite_titles']) { |
131 if ($aioseop_options['aiosp_rewrite_titles']) { |
131 ob_start(array($this, 'output_callback_for_title')); |
132 ob_start(array($this, 'output_callback_for_title')); |
132 } |
133 } |
133 } |
134 } |
220 //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()); |
221 //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()); |
221 |
222 |
222 if (is_single() || is_page()) { |
223 if (is_single() || is_page()) { |
223 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true))); |
224 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true))); |
224 if ($aiosp_disable) { |
225 if ($aiosp_disable) { |
225 return; |
226 $aiosp_disable_analytics = htmlspecialchars(stripcslashes( get_post_meta( $post->ID, '_aioseop_disable_analytics', true ) ) ); |
|
227 if ( $aiosp_disable_analytics ) |
|
228 remove_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) ); |
|
229 return; |
226 } |
230 } |
227 } |
231 } |
228 |
232 |
229 if( $this->aioseop_mrt_exclude_this_page()==TRUE ){ |
233 if( $this->aioseop_mrt_exclude_this_page()==TRUE ) return; |
230 return; |
|
231 } |
|
232 |
234 |
233 if ($aioseop_options['aiosp_rewrite_titles']) { |
235 if ($aioseop_options['aiosp_rewrite_titles']) { |
234 // make the title rewrite as short as possible |
236 // make the title rewrite as short as possible |
235 if (function_exists('ob_list_handlers')) { |
237 if (function_exists('ob_list_handlers')) { |
236 $active_handlers = ob_list_handlers(); |
238 $active_handlers = ob_list_handlers(); |
341 } |
343 } |
342 |
344 |
343 $page_meta = stripcslashes($aioseop_options['aiosp_page_meta_tags']); |
345 $page_meta = stripcslashes($aioseop_options['aiosp_page_meta_tags']); |
344 $post_meta = stripcslashes($aioseop_options['aiosp_post_meta_tags']); |
346 $post_meta = stripcslashes($aioseop_options['aiosp_post_meta_tags']); |
345 $home_meta = stripcslashes($aioseop_options['aiosp_home_meta_tags']); |
347 $home_meta = stripcslashes($aioseop_options['aiosp_home_meta_tags']); |
346 $front_meta = stripcslashes($aioseop_options['aiosp_front_meta_tags']); |
348 $front_meta = isset( $aioseop_options['aiosp_front_meta_tags'] ) ? '' : stripcslashes( $aioseop_options['aiosp_front_meta_tags'] ); |
347 |
349 |
348 if ( is_page() && isset( $page_meta ) && !empty( $page_meta ) && ( !$is_front_page || empty( $front_meta ) ) ) { |
350 if ( is_page() && isset( $page_meta ) && !empty( $page_meta ) && ( !$is_front_page || empty( $front_meta ) ) ) { |
349 if ( isset( $meta_string ) ) $meta_string .= "\n"; |
351 if ( isset( $meta_string ) ) $meta_string .= "\n"; |
350 $meta_string .= $page_meta; |
352 $meta_string .= $page_meta; |
351 } |
353 } |
399 echo "<!-- /all in one seo pack -->\n"; |
401 echo "<!-- /all in one seo pack -->\n"; |
400 } |
402 } |
401 |
403 |
402 function aiosp_google_analytics(){ |
404 function aiosp_google_analytics(){ |
403 global $aioseop_options; |
405 global $aioseop_options; |
404 |
|
405 ?> |
406 ?> |
406 <script type="text/javascript"> |
407 <script type="text/javascript"> |
407 |
408 |
408 var _gaq = _gaq || []; |
409 var _gaq = _gaq || []; |
409 _gaq.push(['_setAccount', '<?php echo $aioseop_options['aiosp_google_analytics_id']; ?>']); |
410 _gaq.push(['_setAccount', '<?php echo $aioseop_options['aiosp_google_analytics_id']; ?>']); |
410 <?php if ( !empty( $aioseop_options['aiosp_ga_domain'] ) ) { |
411 <?php if ( !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) { |
|
412 ?> _gaq.push(['_setAllowLinker', true]); |
|
413 <?php } |
|
414 |
|
415 if ( !empty( $aioseop_options['aiosp_ga_domain'] ) ) { |
411 ?> _gaq.push(['_setDomainName', '<?php echo $aioseop_options['aiosp_ga_domain']; ?>']); |
416 ?> _gaq.push(['_setDomainName', '<?php echo $aioseop_options['aiosp_ga_domain']; ?>']); |
412 <?php |
417 <?php } ?> |
413 } |
|
414 ?> |
|
415 _gaq.push(['_trackPageview']); |
418 _gaq.push(['_trackPageview']); |
416 |
419 |
417 (function() { |
420 (function() { |
418 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
421 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
419 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
422 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
1153 return true; |
1156 return true; |
1154 } |
1157 } |
1155 |
1158 |
1156 |
1159 |
1157 function post_meta_tags($id) { |
1160 function post_meta_tags($id) { |
1158 $awmp_edit = $_POST["aiosp_edit"]; |
1161 $awmp_edit = isset( $_POST["aiosp_edit"] ) ? $_POST["aiosp_edit"] : null; |
1159 $nonce = $_POST['nonce-aioseop-edit']; |
1162 $nonce = isset( $_POST['nonce-aioseop-edit'] ) ? $_POST['nonce-aioseop-edit'] : null; |
1160 // if (!wp_verify_nonce($nonce, 'edit-aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress'); |
1163 // if (!wp_verify_nonce($nonce, 'edit-aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress'); |
1161 if (isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce')) { |
1164 if (isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce')) { |
1162 |
1165 |
1163 foreach (Array('keywords', 'description', 'title', 'meta', 'disable', 'titleatr', 'menulabel', 'togglekeywords') as $f) { |
1166 foreach (Array('keywords', 'description', 'title', 'meta', 'disable', 'disable_analytics', 'titleatr', 'menulabel', 'togglekeywords') as $f) { |
1164 $field = "aiosp_$f"; |
1167 $field = "aiosp_$f"; |
1165 if ( isset( $_POST[$field] ) ) $$field = $_POST[$field]; |
1168 if ( isset( $_POST[$field] ) ) $$field = $_POST[$field]; |
1166 } |
1169 } |
1167 if ( isset( $aiosp_keywords ) ) $keywords = $aiosp_keywords; |
1170 if ( isset( $aiosp_keywords ) ) $keywords = $aiosp_keywords; |
1168 if ( isset( $aiosp_description ) ) $description = $aiosp_description; |
1171 if ( isset( $aiosp_description ) ) $description = $aiosp_description; |
1175 delete_post_meta($id, '_aioseop_menulabel'); |
1178 delete_post_meta($id, '_aioseop_menulabel'); |
1176 |
1179 |
1177 |
1180 |
1178 if ($this->is_admin()) { |
1181 if ($this->is_admin()) { |
1179 delete_post_meta($id, '_aioseop_disable'); |
1182 delete_post_meta($id, '_aioseop_disable'); |
|
1183 delete_post_meta($id, '_aioseop_disable_analytics'); |
1180 } |
1184 } |
1181 //delete_post_meta($id, 'aiosp_meta'); |
1185 //delete_post_meta($id, 'aiosp_meta'); |
1182 |
1186 |
1183 if (isset($keywords) && !empty($keywords)) { |
1187 if (isset($keywords) && !empty($keywords)) { |
1184 add_post_meta($id, '_aioseop_keywords', $keywords); |
1188 add_post_meta($id, '_aioseop_keywords', $keywords); |
1192 if (isset($aiosp_titleatr) && !empty($aiosp_titleatr)) { |
1196 if (isset($aiosp_titleatr) && !empty($aiosp_titleatr)) { |
1193 add_post_meta($id, '_aioseop_titleatr', $aiosp_titleatr); |
1197 add_post_meta($id, '_aioseop_titleatr', $aiosp_titleatr); |
1194 } |
1198 } |
1195 if (isset($aiosp_menulabel) && !empty($aiosp_menulabel)) { |
1199 if (isset($aiosp_menulabel) && !empty($aiosp_menulabel)) { |
1196 add_post_meta($id, '_aioseop_menulabel', $aiosp_menulabel); |
1200 add_post_meta($id, '_aioseop_menulabel', $aiosp_menulabel); |
1197 } |
1201 } |
1198 if (isset($aiosp_disable) && !empty($aiosp_disable) && $this->is_admin()) { |
1202 if (isset($aiosp_disable) && !empty($aiosp_disable) && $this->is_admin()) { |
1199 add_post_meta($id, '_aioseop_disable', $aiosp_disable); |
1203 add_post_meta($id, '_aioseop_disable', $aiosp_disable); |
|
1204 } |
|
1205 if (isset($aiosp_disable_analytics) && !empty($aiosp_disable_analytics) && $this->is_admin()) { |
|
1206 add_post_meta($id, '_aioseop_disable_analytics', $aiosp_disable_analytics); |
1200 } |
1207 } |
1201 /* |
1208 /* |
1202 if (isset($aiosp_meta) && !empty($aiosp_meta)) { |
1209 if (isset($aiosp_meta) && !empty($aiosp_meta)) { |
1203 add_post_meta($id, 'aiosp_meta', $aiosp_meta); |
1210 add_post_meta($id, 'aiosp_meta', $aiosp_meta); |
1204 } |
1211 } |
1278 $keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_keywords', true))); |
1285 $keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_keywords', true))); |
1279 $title = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_title', true))); |
1286 $title = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_title', true))); |
1280 $description = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_description', true))); |
1287 $description = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_description', true))); |
1281 $aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_meta', true))); |
1288 $aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_meta', true))); |
1282 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_disable', true))); |
1289 $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_disable', true))); |
|
1290 $aiosp_disable_analytics = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_disable_analytics', true))); |
1283 $aiosp_titleatr = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_titleatr', true))); |
1291 $aiosp_titleatr = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_titleatr', true))); |
1284 $aiosp_menulabel = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_menulabel', true))); |
1292 $aiosp_menulabel = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_menulabel', true))); |
1285 |
1293 |
1286 ?> |
1294 ?> |
1287 <SCRIPT LANGUAGE="JavaScript"> |
1295 <SCRIPT LANGUAGE="JavaScript"> |
1328 </th> |
1336 </th> |
1329 <td> |
1337 <td> |
1330 <input type="checkbox" name="aiosp_disable" <?php if ($aiosp_disable) echo "checked=\"1\""; ?>/> |
1338 <input type="checkbox" name="aiosp_disable" <?php if ($aiosp_disable) echo "checked=\"1\""; ?>/> |
1331 </td> |
1339 </td> |
1332 </tr> |
1340 </tr> |
1333 |
1341 <?php if ( $aiosp_disable ) { ?> |
|
1342 <tr> |
|
1343 <th scope="row" style="text-align:right; vertical-align:top;"> |
|
1344 <?php _e('Disable Google Analytics:', 'all_in_one_seo_pack')?> |
|
1345 </th> |
|
1346 <td> |
|
1347 <input type="checkbox" name="aiosp_disable_analytics" <?php if ($aiosp_disable_analytics) echo "checked=\"1\""; ?>/> |
|
1348 </td> |
|
1349 </tr> |
|
1350 <?php } ?> |
1334 <tr> |
1351 <tr> |
1335 <th scope="row" style="text-align:right;"><?php _e('Title Attribute:', 'all_in_one_seo_pack') ?></th> |
1352 <th scope="row" style="text-align:right;"><?php _e('Title Attribute:', 'all_in_one_seo_pack') ?></th> |
1336 <td><input value="<?php echo $aiosp_titleatr ?>" type="text" name="aiosp_titleatr" size="62"/></td> |
1353 <td><input value="<?php echo $aiosp_titleatr ?>" type="text" name="aiosp_titleatr" size="62"/></td> |
1337 </tr> |
1354 </tr> |
1338 <tr> |
1355 <tr> |
1414 "aiosp_description_format"=>'%description%', |
1431 "aiosp_description_format"=>'%description%', |
1415 "aiosp_404_title_format"=>'Nothing found for %request_words%', |
1432 "aiosp_404_title_format"=>'Nothing found for %request_words%', |
1416 "aiosp_paged_format"=>' - Part %page%', |
1433 "aiosp_paged_format"=>' - Part %page%', |
1417 "aiosp_google_analytics_id"=>null, |
1434 "aiosp_google_analytics_id"=>null, |
1418 "aiosp_ga_domain"=>'', |
1435 "aiosp_ga_domain"=>'', |
|
1436 "aiosp_ga_multi_domain"=>0, |
1419 "aiosp_ga_track_outbound_links"=>0, |
1437 "aiosp_ga_track_outbound_links"=>0, |
1420 "aiosp_google_publisher"=>'', |
1438 "aiosp_google_publisher"=>'', |
1421 "aiosp_use_categories"=>0, |
1439 "aiosp_use_categories"=>0, |
1422 "aiosp_dynamic_postspage_keywords"=>1, |
1440 "aiosp_dynamic_postspage_keywords"=>1, |
1423 "aiosp_category_noindex"=>1, |
1441 "aiosp_category_noindex"=>1, |
1449 $message = __("All in One SEO Options Updated.", 'all_in_one_seo_pack'); |
1467 $message = __("All in One SEO Options Updated.", 'all_in_one_seo_pack'); |
1450 |
1468 |
1451 $options = Array( "aiosp_can", "aiosp_donate", "aiosp_home_title", "aiosp_home_description", "aiosp_home_keywords", "aiosp_max_words_excerpt", |
1469 $options = Array( "aiosp_can", "aiosp_donate", "aiosp_home_title", "aiosp_home_description", "aiosp_home_keywords", "aiosp_max_words_excerpt", |
1452 "aiosp_rewrite_titles", "aiosp_post_title_format", "aiosp_page_title_format", "aiosp_category_title_format", |
1470 "aiosp_rewrite_titles", "aiosp_post_title_format", "aiosp_page_title_format", "aiosp_category_title_format", |
1453 "aiosp_archive_title_format", "aiosp_tag_title_format", "aiosp_search_title_format", "aiosp_description_format", |
1471 "aiosp_archive_title_format", "aiosp_tag_title_format", "aiosp_search_title_format", "aiosp_description_format", |
1454 "aiosp_404_title_format", "aiosp_paged_format", "aiosp_google_publisher", "aiosp_google_analytics_id", "aiosp_ga_domain", "aiosp_ga_track_outbound_links", |
1472 "aiosp_404_title_format", "aiosp_paged_format", "aiosp_google_publisher", "aiosp_google_analytics_id", "aiosp_ga_domain", "aiosp_ga_multi_domain", "aiosp_ga_track_outbound_links", |
1455 "aiosp_use_categories", "aiosp_dynamic_postspage_keywords", "aiosp_category_noindex", "aiosp_archive_noindex", |
1473 "aiosp_use_categories", "aiosp_dynamic_postspage_keywords", "aiosp_category_noindex", "aiosp_archive_noindex", |
1456 "aiosp_tags_noindex", "aiosp_generate_descriptions", "aiosp_cap_cats", "aiosp_enablecpost", "aiosp_debug_info", |
1474 "aiosp_tags_noindex", "aiosp_generate_descriptions", "aiosp_cap_cats", "aiosp_enablecpost", "aiosp_debug_info", |
1457 "aiosp_post_meta_tags", "aiosp_page_meta_tags", "aiosp_home_meta_tags", "aiosp_front_meta_tags", "aiosp_ex_pages", "aiosp_do_log", |
1475 "aiosp_post_meta_tags", "aiosp_page_meta_tags", "aiosp_home_meta_tags", "aiosp_front_meta_tags", "aiosp_ex_pages", "aiosp_do_log", |
1458 "aiosp_enabled", "aiosp_use_tags_as_keywords", "aiosp_seopostcol", "aiosp_seocustptcol", "aiosp_posttypecolumns"); |
1476 "aiosp_enabled", "aiosp_use_tags_as_keywords", "aiosp_seopostcol", "aiosp_seocustptcol", "aiosp_posttypecolumns"); |
1459 |
1477 |
2157 </td> |
2175 </td> |
2158 </tr> |
2176 </tr> |
2159 |
2177 |
2160 <tr> |
2178 <tr> |
2161 <th scope="row" style="text-align:right; vertical-align:top;"> |
2179 <th scope="row" style="text-align:right; vertical-align:top;"> |
|
2180 <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_ga_multi_domain_tip');"> |
|
2181 <?php _e('Track Multiple Domains:', 'all_in_one_seo_pack')?> |
|
2182 </td> |
|
2183 <td> |
|
2184 <input type="checkbox" name="aiosp_ga_multi_domain" <?php if ($aioseop_options['aiosp_ga_multi_domain']) echo "checked=\"1\""; ?>"/> |
|
2185 <div style="max-width:500px; text-align:left; display:none" id="aiosp_ga_multi_domain_tip"> |
|
2186 <?php |
|
2187 _e('Enable multi-domain tracking for Google Analytics.', 'all_in_one_seo_pack'); |
|
2188 ?> |
|
2189 </div> |
|
2190 </td> |
|
2191 </tr> |
|
2192 |
|
2193 <tr> |
|
2194 <th scope="row" style="text-align:right; vertical-align:top;"> |
2162 <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_ga_track_outbound_links_tip');"> |
2195 <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_ga_track_outbound_links_tip');"> |
2163 <?php _e('Track Outbound Links:', 'all_in_one_seo_pack')?> |
2196 <?php _e('Track Outbound Links:', 'all_in_one_seo_pack')?> |
2164 </td> |
2197 </td> |
2165 <td> |
2198 <td> |
2166 <input type="checkbox" name="aiosp_ga_track_outbound_links" <?php if ($aioseop_options['aiosp_ga_track_outbound_links']) echo "checked=\"1\""; ?>/> |
2199 <input type="checkbox" name="aiosp_ga_track_outbound_links" <?php if ($aioseop_options['aiosp_ga_track_outbound_links']) echo "checked=\"1\""; ?>/> |
2377 <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_front_meta_tags_tip');"> |
2410 <a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_front_meta_tags_tip');"> |
2378 <?php _e('Additional Front Page Headers:', 'all_in_one_seo_pack')?> |
2411 <?php _e('Additional Front Page Headers:', 'all_in_one_seo_pack')?> |
2379 </a> |
2412 </a> |
2380 </td> |
2413 </td> |
2381 <td> |
2414 <td> |
2382 <textarea cols="57" rows="2" name="aiosp_front_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_front_meta_tags']); ?></textarea> |
2415 <textarea cols="57" rows="2" name="aiosp_front_meta_tags"><?php if ( isset( $aioseop_options['aiosp_front_meta_tags'] ) ) echo stripcslashes($aioseop_options['aiosp_front_meta_tags']); ?></textarea> |
2383 <div style="max-width:500px; text-align:left; display:none" id="aiosp_front_meta_tags_tip"> |
2416 <div style="max-width:500px; text-align:left; display:none" id="aiosp_front_meta_tags_tip"> |
2384 <?php |
2417 <?php |
2385 _e('What you enter here will be copied verbatim to your header on the front page. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack'); |
2418 _e('What you enter here will be copied verbatim to your header on the front page. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack'); |
2386 ?> |
2419 ?> |
2387 </div> |
2420 </div> |