All in One SEO Pack - Version 2.2

Version Description

Download this release

Release Info

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

Code changes from version 2.1.7 to 2.2

aioseop_class.php CHANGED
@@ -46,6 +46,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
46
  var $ga_token;
47
  var $account_cache;
48
  var $profile_id;
 
49
 
50
  function All_in_One_SEO_Pack() {
51
  global $aioseop_options;
@@ -116,6 +117,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
116
  __( '%category_title% - The original title of the category', 'all_in_one_seo_pack' ) . '</li><li>' .
117
  __( '%category_description% - The description of the category', 'all_in_one_seo_pack' ) . '</li></ul>',
118
  "archive_title_format" =>
 
 
 
 
 
119
  __( "This controls the format of the title tag for Date Archives.<br /><a href='http://semperplugins.com/documentation/title-settings/' target='_blank'>Click here for documentation on this setting</a><br />The following macros are supported:", 'all_in_one_seo_pack' ) .
120
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all_in_one_seo_pack' ) . '</li><li>' .
121
  __( '%blog_description% - Your blog description', 'all_in_one_seo_pack' ) . '</li><li>' .
@@ -274,7 +280,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
274
  'name' => __( 'Category Title Format:', 'all_in_one_seo_pack' ),
275
  'type' => 'text', 'default' => '%category_title% | %blog_title%',
276
  'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
277
- "archive_title_format"=> Array(
 
 
 
 
278
  'name' => __( 'Date Archive Title Format:', 'all_in_one_seo_pack' ),
279
  'type' => 'text', 'default' => '%date% | %blog_title%',
280
  'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
@@ -335,7 +345,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
335
  "cposttitles" => Array(
336
  'name' => __( 'Custom titles:', 'all_in_one_seo_pack' ),
337
  'type' => 'checkbox', 'default' => 0,
338
- 'condshow' => Array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' )
339
  ),
340
  "posttypecolumns" => Array(
341
  'name' => __( 'Show Column Labels for Custom Post Types:', 'all_in_one_seo_pack' ),
@@ -547,7 +557,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
547
  'title' => Array(
548
  'name' => __( 'Title Settings', 'all_in_one_seo_pack' ),
549
  'help_link' => 'http://semperplugins.com/documentation/title-settings/',
550
- 'options' => Array( "rewrite_titles", "force_rewrites", "cap_titles", "cap_cats", "page_title_format", "post_title_format", "category_title_format", "archive_title_format", "author_title_format",
551
  "tag_title_format", "search_title_format", "description_format", "404_title_format", "paged_format" )
552
  ),
553
  'cpt' => Array(
@@ -600,9 +610,17 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
600
  function custom_output_option( $buf, $args ) {
601
  if ( $args['name'] == 'aiosp_snippet' ) {
602
  global $post, $aioseop_options, $wp_query;
 
 
 
 
 
 
 
 
 
603
  if ( is_object( $post ) ) {
604
- $post_id = $post->ID;
605
- $p = $post; $w = $wp_query;
606
  if (! $post->post_modified_gmt != '' )
607
  $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
608
  if ( $post->post_type == 'page' )
@@ -611,71 +629,82 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
611
  $wp_query->is_attachment = true;
612
  else
613
  $wp_query->is_single = true;
614
- if ( empty( $wp_query->is_front_page ) ) $wp_query->is_front_page = false;
615
  if ( get_option( 'show_on_front' ) == 'page' ) {
616
  if ( is_page() && $post->ID == get_option( 'page_on_front' ) )
617
  $wp_query->is_front_page = true;
618
  elseif ( $post->ID == get_option( 'page_for_posts' ) )
619
  $wp_query->is_home = true;
620
  }
621
-
622
- $args['options']['type'] = 'html';
623
- $args['options']['nowrap'] = false;
624
- $args['options']['save'] = false;
625
  $wp_query->queried_object = $post;
626
-
627
  if ( !empty( $post ) && !$wp_query->is_home && !$wp_query->is_front_page ) {
628
  $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
629
  if ( empty( $title ) ) $title = $post->post_title;
630
  }
631
-
632
  $title_format = '';
633
  if ( empty( $title ) ) {
634
  $title = $this->wp_title();
635
  $title_format = '%post_title%';
636
  }
637
-
638
- if ( ( $aioseop_options['aiosp_can'] ) && ( $url = $this->aiosp_mrt_get_url( $wp_query ) ) )
639
- $url = apply_filters( 'aioseop_canonical_url', $url );
640
- if ( !$url ) $url = get_permalink();
641
-
642
- $title = $this->apply_cf_fields( $title );
643
-
644
  $description = $this->get_aioseop_description( $post );
645
- $description = $this->apply_cf_fields( $description );
646
- $description = apply_filters( 'aioseop_description', $description );
647
-
648
- if ( $this->strlen( $title ) > 70 ) $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...';
649
- if ( $this->strlen( $description ) > 156 ) $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...';
650
-
651
  if ( empty( $title_format ) ) {
652
  if ( is_page() )
653
  $title_format = $aioseop_options['aiosp_page_title_format'];
654
- elseif ( is_single() )
655
- $title_format = $this->get_post_title_format();
656
  }
657
- $extra_title_len = 0;
658
- if ( empty( $title_format ) ) {
659
- $title = '<span id="aioseop_snippet_title">' . esc_attr( strip_tags( $title ) ) . '</span>';
 
 
660
  } else {
661
- $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
662
- $title_format = $this->apply_cf_fields( $title_format );
663
- $replace_title = '<span id="aioseop_snippet_title">' . esc_attr( strip_tags( $title ) ) . '</span>';
664
- $title_format = str_replace( '%post_title%', $replace_title, $title_format );
665
- $title_format = str_replace( '%page_title%', $replace_title, $title_format );
666
- $title_format = preg_replace( '/%([^%]*?)%/', '', $title_format );
667
- $title = $title_format;
668
- $extra_title_len = strlen( str_replace( $replace_title, '', $title_format ) );
669
  }
670
-
671
- $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( strip_tags( $description ) ) );
672
- $extra_title_len = (int)$extra_title_len;
673
- $args['value'] .= "<script>var aiosp_title_extra = {$extra_title_len};</script>";
674
- $buf = $this->get_option_row( $args['name'], $args['options'], $args );
675
-
676
- wp_reset_postdata();
677
- $wp_query = $w; $post = $p;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  }
 
 
 
 
 
679
  }
680
  return $buf;
681
  }
@@ -829,7 +858,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
829
  '</ul>',
830
  'type' => 'text',
831
  'default' => '%post_title% | %blog_title%',
832
- 'condshow' => Array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on', 'aiosp_cpostactive\[\]' => $p )
833
  );
834
  $this->layout['cpt']['options'][] = $field;
835
  }
@@ -848,16 +877,16 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
848
  }
849
 
850
  function add_admin_pointers() {
851
- $this->pointers['aioseop_menu_211'] = Array( 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class',
852
  'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all_in_one_seo_pack' ), AIOSEOP_VERSION )
853
  . '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! Please review your settings, as we\'re always adding new features for you!', 'all_in_one_seo_pack' ) . '</p>',
854
  'pointer_edge' => 'top',
855
  'pointer_align' => 'left',
856
  'pointer_scope' => 'global'
857
  );
858
- $this->pointers['aioseop_welcome_211'] = Array( 'pointer_target' => '#aioseop_top_button',
859
  'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all_in_one_seo_pack' ), AIOSEOP_VERSION )
860
- . '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! New since 2.1: Manage how your site appears on Facebook, Google+, and Twitter with our Social Meta module. Enable it from the Feature Manager. Remember to review your settings, we have added some new ones!', 'all_in_one_seo_pack' ) . '</p>',
861
  'pointer_edge' => 'bottom',
862
  'pointer_align' => 'left',
863
  'pointer_scope' => 'local'
@@ -906,7 +935,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
906
  $get_opts = $this->default_options( $location );
907
  foreach ( Array( 'keywords', 'description', 'title', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' ) as $f ) {
908
  $field = "aiosp_$f";
909
- $get_opts[$field] = htmlspecialchars( stripslashes( get_post_meta( $post_id, '_aioseop_' . $f, true ) ) );
 
910
  }
911
  $opts = wp_parse_args( $opts, $get_opts );
912
  return $opts;
@@ -1067,34 +1097,50 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1067
  return $p;
1068
  }
1069
 
1070
- function template_redirect() {
1071
  global $aioseop_options;
 
 
 
 
 
 
 
 
 
 
 
1072
 
1073
- if ( is_feed() ) return;
1074
- if ( aioseop_mrt_exclude_this_page() ) return;
1075
 
1076
- $post = $this->get_queried_object();
1077
 
1078
- if ( is_single() || is_page() ) {
1079
- $aiosp_disable = htmlspecialchars(stripslashes( get_post_meta( $post->ID, '_aioseop_disable', true ) ) );
1080
- if ( $aiosp_disable ) {
1081
- $aiosp_disable_analytics = htmlspecialchars(stripslashes( get_post_meta( $post->ID, '_aioseop_disable_analytics', true ) ) );
1082
- if ( !$aiosp_disable_analytics ) {
1083
- if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
1084
- remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
1085
- add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) );
1086
- }
 
1087
  }
1088
- return;
1089
- }
1090
-
1091
- if ( !empty( $aioseop_options['aiosp_cpostadvanced'] ) ) {
1092
- $wp_post_types = $aioseop_options['aiosp_cpostactive'];
1093
- if ( empty( $aioseop_options['aiosp_cpostactive'] ) ) return;
1094
- if( !is_singular( $wp_post_types ) && !is_front_page() ) return;
1095
  }
 
1096
  }
 
 
 
 
 
 
 
 
1097
 
 
 
 
1098
  if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
1099
  $force_rewrites = 1;
1100
  if ( isset( $aioseop_options['aiosp_force_rewrites'] ) )
@@ -1161,14 +1207,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1161
  }
1162
 
1163
  function wp_head() {
1164
- if ( is_feed() ) return;
1165
-
1166
- if( aioseop_mrt_exclude_this_page() ) return;
1167
 
1168
  static $aioseop_dup_counter = 0;
1169
  $aioseop_dup_counter++;
1170
  if ( $aioseop_dup_counter > 1 ) {
1171
- echo "\n<!-- Debug Warning: All in One SEO Pack Pro meta data was included again from " . current_filter() . " filter. Called {$aioseop_dup_counter} times! -->\n";
1172
  return;
1173
  }
1174
 
@@ -1182,21 +1227,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1182
  global $aioseop_options;
1183
  $meta_string = null;
1184
  $description = '';
1185
-
1186
- if ( is_single() || is_page() ) {
1187
- $aiosp_disable = htmlspecialchars( stripslashes( get_post_meta( $post->ID, '_aioseop_disable', true ) ) );
1188
- if ( $aiosp_disable ) return;
1189
- if( empty( $aioseop_options['aiosp_enablecpost'] ) ) {
1190
- $wp_post_types = get_post_types( Array( '_builtin' => true ) ); // don't display meta if SEO isn't enabled on custom post types -- pdb
1191
- if( !is_singular( $wp_post_types ) && !is_front_page() ) return;
1192
- } else {
1193
- if ( !empty( $aioseop_options['aiosp_cpostadvanced'] ) ) {
1194
- $wp_post_types = $aioseop_options['aiosp_cpostactive'];
1195
- if ( empty( $aioseop_options['aiosp_cpostactive'] ) ) return;
1196
- if( !is_singular( $wp_post_types ) && !is_front_page() ) return;
1197
- }
1198
- }
1199
- }
1200
 
1201
  $force_rewrites = 1;
1202
  if ( isset( $aioseop_options['aiosp_force_rewrites'] ) )
@@ -1237,20 +1267,17 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1237
  $blog_page = $this->get_blog_page( $post );
1238
 
1239
  if ( $is_front_page_keywords )
1240
- $keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) );
1241
- 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
1242
- $keywords = stripslashes( $this->internationalize( get_post_meta( $post->ID, "_aioseop_keywords", true ) ) );
1243
  elseif ( !empty( $blog_page ) && !$aioseop_options['aiosp_dynamic_postspage_keywords'] )
1244
  $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, "_aioseop_keywords", true ) ) );
1245
  else $keywords = $this->get_all_keywords();
1246
 
1247
- if ( is_category() && $this->show_page_description() )
1248
- $description = $this->internationalize( category_description() );
1249
- elseif ( is_tag() && $this->show_page_description() )
1250
- $description = $this->internationalize( tag_description() );
1251
- elseif ( is_tax() && $this->show_page_description() )
1252
- $description = $this->internationalize( term_description() );
1253
- elseif ( is_author() && $this->show_page_description() )
1254
  $description = $this->internationalize( get_the_author_meta( 'description' ) );
1255
  else if ( $is_front_page )
1256
  $description = trim( stripslashes( $this->internationalize( $aioseop_options['aiosp_home_description'] ) ) );
@@ -1297,7 +1324,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1297
  }
1298
  $description .= ' ' . $uniqueDesc;
1299
  }
1300
- $meta_string .= sprintf( "<meta name=\"description\" content=\"%s\" />\n", $description );
1301
  }
1302
  $keywords = $this->apply_cf_fields( $keywords );
1303
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
@@ -1307,10 +1334,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1307
  else
1308
  $togglekeywords = 0;
1309
 
1310
- if ( isset( $keywords ) && $togglekeywords == 0 && !empty( $keywords ) && !( is_home() && is_paged() ) ) {
1311
  if ( isset( $meta_string ) ) $meta_string .= "\n";
1312
  $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
1313
- $meta_string .= sprintf( "<meta name=\"keywords\" content=\"%s\" />\n", $keywords );
1314
  }
1315
 
1316
  $is_tag = is_tag();
@@ -1319,32 +1346,32 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1319
 
1320
  $robots_meta = '';
1321
 
1322
- if ( ( is_category() && !empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( !is_category() && is_archive() && !$is_tag
1323
- && ( ( is_date() && !empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && !empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
1324
- || ( $is_tag && !empty( $aioseop_options['aiosp_tags_noindex'] ) ) || ( is_search() && !empty( $aioseop_options['aiosp_search_noindex'] ) ) ) {
1325
- $robots_meta = 'noindex,follow';
1326
- } else {
1327
- if ( is_single() || is_page() ) {
1328
- $post_type = get_post_type();
1329
- $aiosp_noindex = htmlspecialchars( stripslashes( get_post_meta( $post->ID, '_aioseop_noindex', true ) ) );
1330
- $aiosp_nofollow = htmlspecialchars( stripslashes( get_post_meta( $post->ID, '_aioseop_nofollow', true ) ) );
1331
- $aiosp_noodp = htmlspecialchars( stripslashes( get_post_meta( $post->ID, '_aioseop_noodp', true ) ) );
1332
- $aiosp_noydir = htmlspecialchars( stripslashes( get_post_meta( $post->ID, '_aioseop_noydir', true ) ) );
1333
- if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || !empty( $aioseop_options['aiosp_cpostnoindex'] ) || !empty( $aioseop_options['aiosp_cpostnofollow'] ) || !empty( $aioseop_options['aiosp_paginated_noindex'] ) || !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) {
1334
- $noindex = "index";
1335
- $nofollow = "follow";
1336
- $noodp = $noydir = '';
1337
- if ( ( $aiosp_noindex == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && ( ( $page > 1 ) ) ) ||
1338
- ( ( $aiosp_noindex == '' ) && ( !empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) ) )
1339
- $noindex = "no" . $noindex;
1340
- if ( ( $aiosp_nofollow == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && ( ( $page > 1 ) ) ) ||
1341
- ( ( $aiosp_nofollow == '' ) && ( !empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) ) ) )
1342
- $nofollow = "no" . $nofollow;
1343
- if ( $aiosp_noodp ) $nofollow .= ',noodp';
1344
- if ( $aiosp_noydir ) $nofollow .= ',noydir';
1345
- $robots_meta = $noindex . ',' . $nofollow;
1346
- }
1347
  }
 
 
 
 
 
1348
  }
1349
 
1350
  if ( $robots_meta == 'index,follow' ) $robots_meta = '';
@@ -1962,9 +1989,9 @@ function aiosp_google_analytics() {
1962
  if ( !empty( $term ) )
1963
  $link = get_term_link( $term, $taxonomy );
1964
  } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
1965
- if ( is_array( $post_type ) )
1966
- $post_type = reset( $post_type );
1967
- $link = get_post_type_archive_link( $post_type );
1968
  } else {
1969
  return false;
1970
  }
@@ -2033,7 +2060,7 @@ function aiosp_google_analytics() {
2033
  }
2034
  if ( $blog_page === '' ) {
2035
  if ( $page_for_posts === '' ) $page_for_posts = get_option( 'page_for_posts' );
2036
- if ( $page_for_posts && ( !is_object( $post ) || ( $page_for_posts != $post->ID ) ) && is_home() )
2037
  $blog_page = get_post( $page_for_posts );
2038
  }
2039
  return $blog_page;
@@ -2172,6 +2199,77 @@ function aiosp_google_analytics() {
2172
  }
2173
  return $title;
2174
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2175
 
2176
  function get_post_title_format() {
2177
  global $aioseop_options;
@@ -2189,20 +2287,35 @@ function aiosp_google_analytics() {
2189
  return $title_format;
2190
  }
2191
 
2192
- function apply_post_title_format( $title, $category = '' ) {
2193
- global $post;
 
 
 
 
2194
  $title_format = $this->get_post_title_format();
2195
- $authordata = get_userdata( $post->post_author );
 
 
 
2196
  $r_title = array( '%blog_title%', '%blog_description%', '%post_title%', '%category%', '%category_title%', '%post_author_login%', '%post_author_nicename%', '%post_author_firstname%', '%post_author_lastname%' );
2197
  $d_title = array( $this->internationalize( get_bloginfo('name') ), $this->internationalize( get_bloginfo( 'description' ) ), $title, $category, $category, $authordata->user_login, $authordata->user_nicename, $this->ucwords( $authordata->first_name ), $this->ucwords( $authordata->last_name ) );
2198
  $title = trim( str_replace( $r_title, $d_title, $title_format ) );
2199
  return $title;
2200
  }
2201
 
2202
- function apply_page_title_format( $title ) {
2203
- global $aioseop_options, $post;
 
 
 
 
 
2204
  $title_format = $aioseop_options['aiosp_page_title_format'];
2205
- $authordata = get_userdata( $post->post_author );
 
 
 
2206
  $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
2207
  $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2208
  $new_title = str_replace( '%page_title%', $title, $new_title );
@@ -2219,6 +2332,7 @@ function aiosp_google_analytics() {
2219
  global $aioseop_options;
2220
  // the_search_query() is not suitable, it cannot just return
2221
  global $s, $STagging;
 
2222
  if ( is_front_page() ) {
2223
  $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
2224
  if (empty( $title ) )
@@ -2228,15 +2342,14 @@ function aiosp_google_analytics() {
2228
  if ( $post === null ) return false;
2229
  $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
2230
  if ( !empty( $title ) )
2231
- return apply_filters( 'aioseop_attachment_title', $this->apply_post_title_format( $title ) );
2232
  $title = $this->internationalize( $post->post_title );
2233
  if ( !$title )
2234
  $title = $this->internationalize( $this->get_original_title( '', false ) );
2235
- $title = get_the_title( $post->post_parent ) . ' ' . $title . ' - ' . get_option( 'blogname' );
2236
  apply_filters( 'aioseop_attachment_title', $title );
2237
  } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && !$this->is_static_posts_page() ) ) {
2238
  if ( $post === null ) return false;
2239
- // we're not in the loop :(
2240
  if ( ( $this->is_static_front_page() ) && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) {
2241
  //home title filter
2242
  return apply_filters( 'aioseop_home_page_title', $home_title );
@@ -2258,7 +2371,7 @@ function aiosp_google_analytics() {
2258
  if ( !$title )
2259
  $title = $this->internationalize( $this->get_original_title( '', false ) );
2260
 
2261
- $title = $this->apply_page_title_format( $title );
2262
  $title = $this->paged_title( $title );
2263
  $title = apply_filters( 'aioseop_title_page', $title );
2264
  if ( $this->is_static_posts_page() )
@@ -2280,7 +2393,7 @@ function aiosp_google_analytics() {
2280
  }
2281
  if ( empty( $title ) ) $title = $post->post_title;
2282
  if ( !empty( $title ) )
2283
- $title = $this->apply_post_title_format( $title, $category );
2284
  $title = $this->paged_title( $title );
2285
  return apply_filters( 'aioseop_title_single', $title );
2286
  } else if ( is_search() && isset( $s ) && !empty( $s ) ) {
@@ -2300,10 +2413,11 @@ function aiosp_google_analytics() {
2300
  $tag = $tags[0]->tag;
2301
  $tag = str_replace('-', ' ', $tag);
2302
  } else {
2303
- // wordpress > 2.3
2304
- $tag = $this->internationalize( $this->get_original_title( '', false ) );
 
2305
  }
2306
- if ($tag) {
2307
  if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
2308
  $tag = $this->capitalize( $tag );
2309
  $title_format = $aioseop_options['aiosp_tag_title_format'];
@@ -2314,19 +2428,7 @@ function aiosp_google_analytics() {
2314
  return $title;
2315
  }
2316
  } else if ( ( is_tax() || is_category() ) && !is_feed() ) {
2317
- $category_description = $this->internationalize( category_description() );
2318
- if( !empty( $aioseop_options['aiosp_cap_cats'] ) ) {
2319
- $category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) );
2320
- } else {
2321
- $category_name = $this->internationalize( single_cat_title( '', false ) );
2322
- }
2323
- $title_format = $aioseop_options['aiosp_category_title_format'];
2324
- $title = str_replace( '%category_title%', $category_name, $title_format );
2325
- $title = str_replace( '%category_description%', $category_description, $title );
2326
- $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title );
2327
- $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
2328
- $title = $this->paged_title( $title );
2329
- return $title;
2330
  } else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // simple tagging support
2331
  $tag = $STagging->search_tag;
2332
  if ( $tag ) {
@@ -2339,7 +2441,7 @@ function aiosp_google_analytics() {
2339
  $title = $this->paged_title( $title );
2340
  return $title;
2341
  }
2342
- } else if ( is_archive() ) {
2343
  if ( is_author() ) {
2344
  $author = $this->internationalize( $this->get_original_title( '', false ) );
2345
  $title_format = $aioseop_options['aiosp_author_title_format'];
@@ -2347,7 +2449,7 @@ function aiosp_google_analytics() {
2347
  } else if ( is_date() ) {
2348
  global $wp_query;
2349
  $date = $this->internationalize( $this->get_original_title( '', false ) );
2350
- $title_format = $aioseop_options['aiosp_archive_title_format'];
2351
  $new_title = str_replace( '%date%', $date, $title_format );
2352
  $day = get_query_var( 'day' );
2353
  if ( empty( $day ) ) $day = '';
@@ -2362,8 +2464,10 @@ function aiosp_google_analytics() {
2362
  $new_title = str_replace( '%monthnum%', $monthnum, $new_title );
2363
  $new_title = str_replace( '%month%', $month, $new_title );
2364
  $new_title = str_replace( '%year%', get_query_var( 'year' ), $new_title );
 
 
2365
  } else return false;
2366
- $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $new_title );
2367
  $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2368
  $title = trim( $new_title );
2369
  $title = $this->paged_title( $title );
@@ -2417,6 +2521,7 @@ function aiosp_google_analytics() {
2417
  $request = str_replace( '.htm', ' ', $request );
2418
  $request = str_replace( '.', ' ', $request );
2419
  $request = str_replace( '/', ' ', $request );
 
2420
  $request_a = explode( ' ', $request );
2421
  $request_new = array();
2422
  foreach ( $request_a as $token ) {
@@ -2446,6 +2551,7 @@ function aiosp_google_analytics() {
2446
  if ( $max < $len ) {
2447
  if ( function_exists( 'mb_strrpos' ) ) {
2448
  $pos = mb_strrpos( $text, ' ', -($len - $max) );
 
2449
  if ( $pos > $this->minimum_description_length ) {
2450
  $max = $pos;
2451
  } else {
@@ -2478,7 +2584,7 @@ function aiosp_google_analytics() {
2478
  if ( is_404() ) return null;
2479
 
2480
  // if we are on synthetic pages
2481
- if ( !is_home() && !is_page() && !is_single() && !$this->is_static_front_page() && !$this->is_static_posts_page() )
2482
  return null;
2483
 
2484
  $keywords = array();
@@ -2586,7 +2692,7 @@ function aiosp_google_analytics() {
2586
  $field = "aiosp_$f";
2587
  if ( isset( $_POST[$field] ) ) $$field = $_POST[$field];
2588
  }
2589
-
2590
  foreach ( Array( 'keywords', 'description', 'noindex', 'nofollow', 'noodp', 'noydir', 'title', 'titleatr', 'menulabel' ) as $f )
2591
  delete_post_meta( $id, "_aioseop_{$f}" );
2592
 
@@ -2649,7 +2755,7 @@ function aiosp_google_analytics() {
2649
  }
2650
  }
2651
  }
2652
-
2653
  function admin_bar_upgrade_menu() {
2654
  global $wp_admin_bar;
2655
  $wp_admin_bar->add_menu( array( 'parent' => AIOSEOP_PLUGIN_DIRNAME, 'title' => __( 'Upgrade To Pro', 'all_in_one_seo_pack' ), 'id' => 'aioseop-pro-upgrade', 'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu', 'meta' => Array( 'target' => '_blank' ) ) );
@@ -2658,7 +2764,7 @@ function aiosp_google_analytics() {
2658
  function menu_order() {
2659
  return 5;
2660
  }
2661
-
2662
  function admin_menu() {
2663
  $file = plugin_basename( __FILE__ );
2664
  $menu_name = __( 'All in One SEO', 'all_in_one_seo_pack' );
@@ -2696,6 +2802,7 @@ function aiosp_google_analytics() {
2696
  if ( isset( $this->options["aiosp_custom_menu_order"] ) )
2697
  $custom_menu_order = $this->options["aiosp_custom_menu_order"];
2698
  }
 
2699
  if ( $custom_menu_order ) {
2700
  add_filter( 'custom_menu_order', '__return_true' );
2701
  add_filter( 'menu_order', array( $this, 'set_menu_order' ) );
@@ -2755,7 +2862,7 @@ function aiosp_google_analytics() {
2755
  if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
2756
  if ( $tab_num <= 1 ) {
2757
  if ( !empty( $m[0]['callback_args']['help_link'] ) )
2758
- $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $m[0]['callback_args']['help_link'] . "'>" . __( 'Help', 'all_in_one_seo_pack' ) . "</a>";
2759
  add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] );
2760
  } elseif ( $tab_num > 1 ) {
2761
  add_meta_box( $m[0]['id'] . '_tabbed', $title, Array( $this, 'display_tabbed_metabox' ), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m );
@@ -2767,7 +2874,7 @@ function aiosp_google_analytics() {
2767
  $title = $m['title'];
2768
  if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
2769
  if ( !empty( $m['help_link'] ) )
2770
- $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $m['help_link'] . "'>" . __( 'Help', 'all_in_one_seo_pack' ) . "</a>";
2771
  add_meta_box( $m['id'], $title, $m['callback'], $m['post_type'], $m['context'], $m['priority'], $m['callback_args'] );
2772
  }
2773
  }
@@ -2863,4 +2970,3 @@ function aiosp_google_analytics() {
2863
  <?php
2864
  }
2865
  }
2866
-
46
  var $ga_token;
47
  var $account_cache;
48
  var $profile_id;
49
+ var $meta_opts = false;
50
 
51
  function All_in_One_SEO_Pack() {
52
  global $aioseop_options;
117
  __( '%category_title% - The original title of the category', 'all_in_one_seo_pack' ) . '</li><li>' .
118
  __( '%category_description% - The description of the category', 'all_in_one_seo_pack' ) . '</li></ul>',
119
  "archive_title_format" =>
120
+ __( "This controls the format of the title tag for Custom Post Archives.<br /><a href='http://semperplugins.com/documentation/title-settings/' target='_blank'>Click here for documentation on this setting</a><br />The following macros are supported:", 'all_in_one_seo_pack' ) .
121
+ '<ul><li>' . __( '%blog_title% - Your blog title', 'all_in_one_seo_pack' ) . '</li><li>' .
122
+ __( '%blog_description% - Your blog description', 'all_in_one_seo_pack' ) . '</li><li>' .
123
+ __( '%archive_title - The original archive title given by wordpress', 'all_in_one_seo_pack' ) . '</li></ul>',
124
+ "date_title_format" =>
125
  __( "This controls the format of the title tag for Date Archives.<br /><a href='http://semperplugins.com/documentation/title-settings/' target='_blank'>Click here for documentation on this setting</a><br />The following macros are supported:", 'all_in_one_seo_pack' ) .
126
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all_in_one_seo_pack' ) . '</li><li>' .
127
  __( '%blog_description% - Your blog description', 'all_in_one_seo_pack' ) . '</li><li>' .
280
  'name' => __( 'Category Title Format:', 'all_in_one_seo_pack' ),
281
  'type' => 'text', 'default' => '%category_title% | %blog_title%',
282
  'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
283
+ "archive_title_format"=> Array(
284
+ 'name' => __( 'Archive Title Format:', 'all_in_one_seo_pack' ),
285
+ 'type' => 'text', 'default' => '%archive_title% | %blog_title%',
286
+ 'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
287
+ "date_title_format"=> Array(
288
  'name' => __( 'Date Archive Title Format:', 'all_in_one_seo_pack' ),
289
  'type' => 'text', 'default' => '%date% | %blog_title%',
290
  'condshow' => Array( "aiosp_rewrite_titles" => 1 ) ),
345
  "cposttitles" => Array(
346
  'name' => __( 'Custom titles:', 'all_in_one_seo_pack' ),
347
  'type' => 'checkbox', 'default' => 0,
348
+ 'condshow' => Array( "aiosp_rewrite_titles" => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' )
349
  ),
350
  "posttypecolumns" => Array(
351
  'name' => __( 'Show Column Labels for Custom Post Types:', 'all_in_one_seo_pack' ),
557
  'title' => Array(
558
  'name' => __( 'Title Settings', 'all_in_one_seo_pack' ),
559
  'help_link' => 'http://semperplugins.com/documentation/title-settings/',
560
+ 'options' => Array( "rewrite_titles", "force_rewrites", "cap_titles", "cap_cats", "page_title_format", "post_title_format", "category_title_format", "archive_title_format", "date_title_format", "author_title_format",
561
  "tag_title_format", "search_title_format", "description_format", "404_title_format", "paged_format" )
562
  ),
563
  'cpt' => Array(
610
  function custom_output_option( $buf, $args ) {
611
  if ( $args['name'] == 'aiosp_snippet' ) {
612
  global $post, $aioseop_options, $wp_query;
613
+ $title = $url = $description = '';
614
+ $args['options']['type'] = 'html';
615
+ $args['options']['nowrap'] = false;
616
+ $args['options']['save'] = false;
617
+ $p = $post; $w = $wp_query;
618
+ if ( !is_object( $post ) ) $post = $this->get_queried_object();
619
+ if ( !is_object( $post ) && is_admin() && !empty( $_GET ) && !empty( $_GET['post_type'] ) && !empty( $_GET['taxonomy'] ) && !empty( $_GET['tag_ID'] ) ) {
620
+ $term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
621
+ }
622
  if ( is_object( $post ) ) {
623
+ $post_id = $p->ID;
 
624
  if (! $post->post_modified_gmt != '' )
625
  $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
626
  if ( $post->post_type == 'page' )
629
  $wp_query->is_attachment = true;
630
  else
631
  $wp_query->is_single = true;
632
+ if ( empty( $wp_query->is_front_page ) ) $wp_query->is_front_page = false;
633
  if ( get_option( 'show_on_front' ) == 'page' ) {
634
  if ( is_page() && $post->ID == get_option( 'page_on_front' ) )
635
  $wp_query->is_front_page = true;
636
  elseif ( $post->ID == get_option( 'page_for_posts' ) )
637
  $wp_query->is_home = true;
638
  }
 
 
 
 
639
  $wp_query->queried_object = $post;
 
640
  if ( !empty( $post ) && !$wp_query->is_home && !$wp_query->is_front_page ) {
641
  $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
642
  if ( empty( $title ) ) $title = $post->post_title;
643
  }
 
644
  $title_format = '';
645
  if ( empty( $title ) ) {
646
  $title = $this->wp_title();
647
  $title_format = '%post_title%';
648
  }
 
 
 
 
 
 
 
649
  $description = $this->get_aioseop_description( $post );
 
 
 
 
 
 
650
  if ( empty( $title_format ) ) {
651
  if ( is_page() )
652
  $title_format = $aioseop_options['aiosp_page_title_format'];
653
+ elseif ( is_single() || is_attachment() )
654
+ $title_format = $this->get_post_title_format();
655
  }
656
+ } else if ( is_object( $term ) ) {
657
+ if ( $_GET['taxonomy'] == 'category' ) {
658
+ query_posts( Array( 'cat' => $_GET['tag_ID'] ) );
659
+ } else if ( $_GET['taxonomy'] == 'post_tag' ) {
660
+ query_posts( Array( 'tag' => $term->slug ) );
661
  } else {
662
+ query_posts( Array( 'page' => '', $_GET['taxonomy'] => $term->slug, 'post_type' => $_GET['post_type'] ) );
 
 
 
 
 
 
 
663
  }
664
+ if ( empty( $this->meta_opts ) )
665
+ $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
666
+ $title = $this->get_tax_name( $_GET['taxonomy'] );
667
+ $title_format = $this->get_tax_title_format();
668
+ $opts = $this->meta_opts;
669
+ if ( !empty( $opts ) ) $description = $opts['aiosp_description'];
670
+ if ( empty( $description ) ) $description = term_description();
671
+ $description = $this->internationalize( $description );
672
+ } else return '';
673
+
674
+ if ( ( $aioseop_options['aiosp_can'] ) && ( $url = $this->aiosp_mrt_get_url( $wp_query ) ) )
675
+ $url = apply_filters( 'aioseop_canonical_url', $url );
676
+ if ( !$url ) $url = get_permalink();
677
+
678
+ $title = $this->apply_cf_fields( $title );
679
+ $description = $this->apply_cf_fields( $description );
680
+ $description = apply_filters( 'aioseop_description', $description );
681
+
682
+ wp_reset_postdata();
683
+ $wp_query = $w; $post = $p;
684
+
685
+ if ( $this->strlen( $title ) > 70 ) $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...';
686
+ if ( $this->strlen( $description ) > 156 ) $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...';
687
+
688
+ $extra_title_len = 0;
689
+ if ( empty( $title_format ) ) {
690
+ $title = '<span id="aioseop_snippet_title">' . esc_attr( strip_tags( $title ) ) . '</span>';
691
+ } else {
692
+ $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
693
+ $title_format = $this->apply_cf_fields( $title_format );
694
+ $replace_title = '<span id="aioseop_snippet_title">' . esc_attr( strip_tags( $title ) ) . '</span>';
695
+ $title_format = str_replace( '%post_title%', $replace_title, $title_format );
696
+ $title_format = str_replace( '%page_title%', $replace_title, $title_format );
697
+ $title_format = str_replace( '%category_title%', $replace_title, $title_format );
698
+ $title_format = str_replace( '%taxonomy_title%', $replace_title, $title_format );
699
+ $title_format = preg_replace( '/%([^%]*?)%/', '', $title_format );
700
+ $title = $title_format;
701
+ $extra_title_len = strlen( str_replace( $replace_title, '', $title_format ) );
702
  }
703
+
704
+ $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( strip_tags( $description ) ) );
705
+ $extra_title_len = (int)$extra_title_len;
706
+ $args['value'] .= "<script>var aiosp_title_extra = {$extra_title_len};</script>";
707
+ $buf = $this->get_option_row( $args['name'], $args['options'], $args );
708
  }
709
  return $buf;
710
  }
858
  '</ul>',
859
  'type' => 'text',
860
  'default' => '%post_title% | %blog_title%',
861
+ 'condshow' => Array( 'aiosp_rewrite_titles' => 1, 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on', 'aiosp_cposttitles' => 'on', 'aiosp_cpostactive\[\]' => $p )
862
  );
863
  $this->layout['cpt']['options'][] = $field;
864
  }
877
  }
878
 
879
  function add_admin_pointers() {
880
+ $this->pointers['aioseop_menu_220'] = Array( 'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class',
881
  'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all_in_one_seo_pack' ), AIOSEOP_VERSION )
882
  . '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! Please review your settings, as we\'re always adding new features for you!', 'all_in_one_seo_pack' ) . '</p>',
883
  'pointer_edge' => 'top',
884
  'pointer_align' => 'left',
885
  'pointer_scope' => 'global'
886
  );
887
+ $this->pointers['aioseop_welcome_220'] = Array( 'pointer_target' => '#aioseop_top_button',
888
  'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all_in_one_seo_pack' ), AIOSEOP_VERSION )
889
+ . '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! New since 2.2: Control who accesses your site with the new Robots.txt Editor and File Editor modules! Enable them from the Feature Manager. Remember to review your settings, we have added some new ones!', 'all_in_one_seo_pack' ) . '</p>',
890
  'pointer_edge' => 'bottom',
891
  'pointer_align' => 'left',
892
  'pointer_scope' => 'local'
935
  $get_opts = $this->default_options( $location );
936
  foreach ( Array( 'keywords', 'description', 'title', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel' ) as $f ) {
937
  $field = "aiosp_$f";
938
+ $meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
939
+ $get_opts[$field] = htmlspecialchars( stripslashes( $meta ) );
940
  }
941
  $opts = wp_parse_args( $opts, $get_opts );
942
  return $opts;
1097
  return $p;
1098
  }
1099
 
1100
+ function is_page_included() {
1101
  global $aioseop_options;
1102
+ if ( is_feed() ) return false;
1103
+ if ( aioseop_mrt_exclude_this_page() ) return false;
1104
+ $post = $this->get_queried_object();
1105
+ if( empty( $aioseop_options['aiosp_enablecpost'] ) ) {
1106
+ $wp_post_types = get_post_types( Array( '_builtin' => true ) ); // don't display meta if SEO isn't enabled on custom post types -- pdb
1107
+ if( !is_singular( $wp_post_types ) && !is_front_page() ) return false;
1108
+ } elseif ( !empty( $aioseop_options['aiosp_cpostadvanced'] ) ) {
1109
+ $wp_post_types = $aioseop_options['aiosp_cpostactive'];
1110
+ if ( is_singular() && !is_singular( $wp_post_types ) && !is_front_page() ) return false;
1111
+ if ( is_post_type_archive() && !is_post_type_archive( $wp_post_types ) ) return false;
1112
+ }
1113
 
1114
+ $this->meta_opts = $this->get_current_options( Array(), 'aiosp' );
 
1115
 
1116
+ $aiosp_disable = $aiosp_disable_analytics = false;
1117
 
1118
+ if ( !empty( $this->meta_opts ) ) {
1119
+ if ( isset( $this->meta_opts['aiosp_disable'] ) ) $aiosp_disable = $this->meta_opts['aiosp_disable'];
1120
+ if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) $aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics'];
1121
+ }
1122
+
1123
+ if ( $aiosp_disable ) {
1124
+ if ( !$aiosp_disable_analytics ) {
1125
+ if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
1126
+ remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
1127
+ add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) );
1128
  }
 
 
 
 
 
 
 
1129
  }
1130
+ return false;
1131
  }
1132
+
1133
+ if ( !empty( $this->meta_opts ) && $this->meta_opts['aiosp_disable'] == true ) return false;
1134
+
1135
+ return true;
1136
+ }
1137
+
1138
+ function template_redirect() {
1139
+ global $aioseop_options;
1140
 
1141
+ $post = $this->get_queried_object();
1142
+
1143
+ if ( !$this->is_page_included() ) return;
1144
  if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
1145
  $force_rewrites = 1;
1146
  if ( isset( $aioseop_options['aiosp_force_rewrites'] ) )
1207
  }
1208
 
1209
  function wp_head() {
1210
+ if ( !$this->is_page_included() ) return;
1211
+ $opts = $this->meta_opts;
 
1212
 
1213
  static $aioseop_dup_counter = 0;
1214
  $aioseop_dup_counter++;
1215
  if ( $aioseop_dup_counter > 1 ) {
1216
+ echo "\n<!-- " . sprintf( __( "Debug Warning: All in One SEO Pack meta data was included again from %s filter. Called %s times!", 'all_in_one_seo_pack' ), current_filter(), $aioseop_dup_counter ) . " -->\n";
1217
  return;
1218
  }
1219
 
1227
  global $aioseop_options;
1228
  $meta_string = null;
1229
  $description = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1230
 
1231
  $force_rewrites = 1;
1232
  if ( isset( $aioseop_options['aiosp_force_rewrites'] ) )
1267
  $blog_page = $this->get_blog_page( $post );
1268
 
1269
  if ( $is_front_page_keywords )
1270
+ $keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) );
1271
+ elseif ( ( ( $this->is_static_posts_page() ) && !$aioseop_options['aiosp_dynamic_postspage_keywords'] ) || (is_archive() || is_post_type_archive() ) ) // and if option = use page set keywords instead of keywords from recent posts
1272
+ $keywords = stripslashes( $this->internationalize( $opts["aiosp_keywords"] ) );
1273
  elseif ( !empty( $blog_page ) && !$aioseop_options['aiosp_dynamic_postspage_keywords'] )
1274
  $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, "_aioseop_keywords", true ) ) );
1275
  else $keywords = $this->get_all_keywords();
1276
 
1277
+ if ( ( is_category() || is_tag() || is_tax() ) && $this->show_page_description() ) {
1278
+ if ( empty( $description ) ) $description = term_description();
1279
+ $description = $this->internationalize( $description );
1280
+ } elseif ( is_author() && $this->show_page_description() )
 
 
 
1281
  $description = $this->internationalize( get_the_author_meta( 'description' ) );
1282
  else if ( $is_front_page )
1283
  $description = trim( stripslashes( $this->internationalize( $aioseop_options['aiosp_home_description'] ) ) );
1324
  }
1325
  $description .= ' ' . $uniqueDesc;
1326
  }
1327
+ $meta_string .= sprintf( "<meta name=\"description\" itemprop=\"description\" content=\"%s\" />\n", $description );
1328
  }
1329
  $keywords = $this->apply_cf_fields( $keywords );
1330
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
1334
  else
1335
  $togglekeywords = 0;
1336
 
1337
+ if ( isset( $keywords ) && $togglekeywords == 0 && !empty( $keywords ) && !( $is_front_page && is_paged() ) ) {
1338
  if ( isset( $meta_string ) ) $meta_string .= "\n";
1339
  $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
1340
+ $meta_string .= sprintf( "<meta name=\"keywords\" itemprop=\"keywords\" content=\"%s\" />\n", $keywords );
1341
  }
1342
 
1343
  $is_tag = is_tag();
1346
 
1347
  $robots_meta = '';
1348
 
1349
+ if ( !empty( $opts ) ) {
1350
+ $post_type = get_post_type();
1351
+ $aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
1352
+ $aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
1353
+ $aiosp_noodp = htmlspecialchars( stripslashes( $opts['aiosp_noodp'] ) );
1354
+ $aiosp_noydir = htmlspecialchars( stripslashes( $opts['aiosp_noydir'] ) );
1355
+ if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || !empty( $aioseop_options['aiosp_cpostnoindex'] ) || !empty( $aioseop_options['aiosp_cpostnofollow'] ) || !empty( $aioseop_options['aiosp_paginated_noindex'] ) || !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) {
1356
+
1357
+ $noindex = "index";
1358
+ $nofollow = "follow";
1359
+ $noodp = $noydir = '';
1360
+ if ( ( $aiosp_noindex == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && ( ( $page > 1 ) ) ) ||
1361
+ ( ( $aiosp_noindex == '' ) && ( !empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) ) )
1362
+ $noindex = "no" . $noindex;
1363
+ if ( ( $aiosp_nofollow == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && ( ( $page > 1 ) ) ) ||
1364
+ ( ( $aiosp_nofollow == '' ) && ( !empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) ) ) )
1365
+ $nofollow = "no" . $nofollow;
1366
+ if ( $aiosp_noodp ) $nofollow .= ',noodp';
1367
+ if ( $aiosp_noydir ) $nofollow .= ',noydir';
1368
+ $robots_meta = $noindex . ',' . $nofollow;
 
 
 
 
 
1369
  }
1370
+ } else {
1371
+ if ( ( is_category() && !empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( !is_category() && is_archive() && !is_tag() && !is_tax()
1372
+ && ( ( is_date() && !empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && !empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
1373
+ || ( is_tag() && !empty( $aioseop_options['aiosp_tags_noindex'] ) ) || ( is_search() && !empty( $aioseop_options['aiosp_search_noindex'] ) ) )
1374
+ $robots_meta = 'noindex,follow';
1375
  }
1376
 
1377
  if ( $robots_meta == 'index,follow' ) $robots_meta = '';
1989
  if ( !empty( $term ) )
1990
  $link = get_term_link( $term, $taxonomy );
1991
  } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
1992
+ if ( is_array( $post_type ) )
1993
+ $post_type = reset( $post_type );
1994
+ $link = get_post_type_archive_link( $post_type );
1995
  } else {
1996
  return false;
1997
  }
2060
  }
2061
  if ( $blog_page === '' ) {
2062
  if ( $page_for_posts === '' ) $page_for_posts = get_option( 'page_for_posts' );
2063
+ if ( $page_for_posts && is_home() && ( !is_object( $post ) || ( $page_for_posts != $post->ID ) ) )
2064
  $blog_page = get_post( $page_for_posts );
2065
  }
2066
  return $blog_page;
2199
  }
2200
  return $title;
2201
  }
2202
+
2203
+ function get_tax_title_format( $tax = '' ) {
2204
+ global $aioseop_options;
2205
+ if ( is_category() )
2206
+ $title_format = $aioseop_options['aiosp_category_title_format'];
2207
+ if ( empty( $title_format ) )
2208
+ $title_format = '%category_title% | %blog_title%';
2209
+ return $title_format;
2210
+ }
2211
+
2212
+ function apply_tax_title_format( $category_name, $category_description, $tax = '' ) {
2213
+ if ( empty( $tax ) ) $tax = get_query_var( 'taxonomy' );
2214
+ $title_format = $this->get_tax_title_format( $tax );
2215
+ $title = str_replace( '%taxonomy_title%', $category_name, $title_format );
2216
+ $title = str_replace( '%taxonomy_description%', $category_description, $title );
2217
+ $title = str_replace( '%category_title%', $category_name, $title );
2218
+ $title = str_replace( '%category_description%', $category_description, $title );
2219
+ $title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title );
2220
+ $title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $title );
2221
+ $title = $this->paged_title( $title );
2222
+ return $title;
2223
+ }
2224
+
2225
+ function get_tax_name( $tax ) {
2226
+ $name = '';
2227
+ if ( empty( $name ) ) $name = single_term_title( '', false );
2228
+ if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) )
2229
+ $name = $this->ucwords( $name );
2230
+ return $this->internationalize( $name );
2231
+ }
2232
+
2233
+ function get_tax_desc( $tax ) {
2234
+ $desc = '';
2235
+ if ( empty( $desc ) ) $desc = term_description( '', $tax );
2236
+ return $this->internationalize( $desc );
2237
+ }
2238
+
2239
+ function get_tax_title( $tax = '' ) {
2240
+ if ( empty( $tax ) )
2241
+ if ( is_category() )
2242
+ $tax = 'category';
2243
+ else
2244
+ $tax = get_query_var( 'taxonomy' );
2245
+ $name = $this->get_tax_name( $tax );
2246
+ $desc = $this->get_tax_desc( $tax );
2247
+ return $this->apply_tax_title_format( $name, $desc, $tax );
2248
+ }
2249
+
2250
+ function get_archive_title_format() {
2251
+ global $aioseop_options;
2252
+ $title_format = '%archive_title% | %blog_title%';
2253
+ if ( isset( $aioseop_options['aiosp_archive_title_format'] ) )
2254
+ $title_format = $aioseop_options['aiosp_archive_title_format'];
2255
+ if( !empty( $aioseop_options['aiosp_enablecpost'] ) && !empty( $aioseop_options['aiosp_cpostadvanced'] ) && !empty( $aioseop_options['aiosp_cpostactive'] ) ) {
2256
+ $wp_post_types = $aioseop_options['aiosp_cpostactive'];
2257
+ if ( is_post_type_archive( $wp_post_types ) && !empty( $aioseop_options["aiosp_cposttitles"] ) ) {
2258
+ $post_type = get_post_type();
2259
+ if ( !empty( $aioseop_options["aiosp_archive_{$post_type}_title_format"] ) )
2260
+ $title_format = $aioseop_options["aiosp_archive_{$post_type}_title_format"];
2261
+ }
2262
+ }
2263
+ return $title_format;
2264
+ }
2265
+
2266
+ function apply_archive_title_format( $title, $category = '' ) {
2267
+ $title_format = $this->get_archive_title_format();
2268
+ $r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' );
2269
+ $d_title = array( $this->internationalize( get_bloginfo('name') ), $this->internationalize( get_bloginfo( 'description' ) ), post_type_archive_title( '', false ) );
2270
+ $title = trim( str_replace( $r_title, $d_title, $title_format ) );
2271
+ return $title;
2272
+ }
2273
 
2274
  function get_post_title_format() {
2275
  global $aioseop_options;
2287
  return $title_format;
2288
  }
2289
 
2290
+ function apply_post_title_format( $title, $category = '', $p = null ) {
2291
+ if ( $p === null ) {
2292
+ global $post;
2293
+ } else {
2294
+ $post = $p;
2295
+ }
2296
  $title_format = $this->get_post_title_format();
2297
+ if ( !empty( $post ) )
2298
+ $authordata = get_userdata( $post->post_author );
2299
+ else
2300
+ $authordata = new WP_User();
2301
  $r_title = array( '%blog_title%', '%blog_description%', '%post_title%', '%category%', '%category_title%', '%post_author_login%', '%post_author_nicename%', '%post_author_firstname%', '%post_author_lastname%' );
2302
  $d_title = array( $this->internationalize( get_bloginfo('name') ), $this->internationalize( get_bloginfo( 'description' ) ), $title, $category, $category, $authordata->user_login, $authordata->user_nicename, $this->ucwords( $authordata->first_name ), $this->ucwords( $authordata->last_name ) );
2303
  $title = trim( str_replace( $r_title, $d_title, $title_format ) );
2304
  return $title;
2305
  }
2306
 
2307
+ function apply_page_title_format( $title, $p = null ) {
2308
+ global $aioseop_options;
2309
+ if ( $p === null ) {
2310
+ global $post;
2311
+ } else {
2312
+ $post = $p;
2313
+ }
2314
  $title_format = $aioseop_options['aiosp_page_title_format'];
2315
+ if ( !empty( $post ) )
2316
+ $authordata = get_userdata( $post->post_author );
2317
+ else
2318
+ $authordata = new WP_User();
2319
  $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
2320
  $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2321
  $new_title = str_replace( '%page_title%', $title, $new_title );
2332
  global $aioseop_options;
2333
  // the_search_query() is not suitable, it cannot just return
2334
  global $s, $STagging;
2335
+ $opts = $this->meta_opts;
2336
  if ( is_front_page() ) {
2337
  $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
2338
  if (empty( $title ) )
2342
  if ( $post === null ) return false;
2343
  $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
2344
  if ( !empty( $title ) )
2345
+ return apply_filters( 'aioseop_attachment_title', $this->apply_post_title_format( $title, '', $post ) );
2346
  $title = $this->internationalize( $post->post_title );
2347
  if ( !$title )
2348
  $title = $this->internationalize( $this->get_original_title( '', false ) );
2349
+ $title = get_the_title( $post->post_parent ) . ' ' . $title . ' ' . get_option( 'blogname' );
2350
  apply_filters( 'aioseop_attachment_title', $title );
2351
  } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && !$this->is_static_posts_page() ) ) {
2352
  if ( $post === null ) return false;
 
2353
  if ( ( $this->is_static_front_page() ) && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) {
2354
  //home title filter
2355
  return apply_filters( 'aioseop_home_page_title', $home_title );
2371
  if ( !$title )
2372
  $title = $this->internationalize( $this->get_original_title( '', false ) );
2373
 
2374
+ $title = $this->apply_page_title_format( $title, $post );
2375
  $title = $this->paged_title( $title );
2376
  $title = apply_filters( 'aioseop_title_page', $title );
2377
  if ( $this->is_static_posts_page() )
2393
  }
2394
  if ( empty( $title ) ) $title = $post->post_title;
2395
  if ( !empty( $title ) )
2396
+ $title = $this->apply_post_title_format( $title, $category, $post );
2397
  $title = $this->paged_title( $title );
2398
  return apply_filters( 'aioseop_title_single', $title );
2399
  } else if ( is_search() && isset( $s ) && !empty( $s ) ) {
2413
  $tag = $tags[0]->tag;
2414
  $tag = str_replace('-', ' ', $tag);
2415
  } else {
2416
+ if ( !empty( $opts ) && !empty( $opts['aiosp_title'] ) ) $tag = $opts['aiosp_title'];
2417
+ if ( empty( $tag ) ) $tag = $this->get_original_title( '', false );
2418
+ $tag = $this->internationalize( $tag );
2419
  }
2420
+ if ( $tag ) {
2421
  if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
2422
  $tag = $this->capitalize( $tag );
2423
  $title_format = $aioseop_options['aiosp_tag_title_format'];
2428
  return $title;
2429
  }
2430
  } else if ( ( is_tax() || is_category() ) && !is_feed() ) {
2431
+ return $this->get_tax_title();
 
 
 
 
 
 
 
 
 
 
 
 
2432
  } else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // simple tagging support
2433
  $tag = $STagging->search_tag;
2434
  if ( $tag ) {
2441
  $title = $this->paged_title( $title );
2442
  return $title;
2443
  }
2444
+ } else if ( is_archive() || is_post_type_archive() ) {
2445
  if ( is_author() ) {
2446
  $author = $this->internationalize( $this->get_original_title( '', false ) );
2447
  $title_format = $aioseop_options['aiosp_author_title_format'];
2449
  } else if ( is_date() ) {
2450
  global $wp_query;
2451
  $date = $this->internationalize( $this->get_original_title( '', false ) );
2452
+ $title_format = $aioseop_options['aiosp_date_title_format'];
2453
  $new_title = str_replace( '%date%', $date, $title_format );
2454
  $day = get_query_var( 'day' );
2455
  if ( empty( $day ) ) $day = '';
2464
  $new_title = str_replace( '%monthnum%', $monthnum, $new_title );
2465
  $new_title = str_replace( '%month%', $month, $new_title );
2466
  $new_title = str_replace( '%year%', get_query_var( 'year' ), $new_title );
2467
+ } else if ( is_post_type_archive() ) {
2468
+ $title = apply_filters( 'aioseop_archive_title', $this->apply_archive_title_format( $title ) );
2469
  } else return false;
2470
+ $new_title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $new_title );
2471
  $new_title = str_replace( '%blog_description%', $this->internationalize( get_bloginfo( 'description' ) ), $new_title );
2472
  $title = trim( $new_title );
2473
  $title = $this->paged_title( $title );
2521
  $request = str_replace( '.htm', ' ', $request );
2522
  $request = str_replace( '.', ' ', $request );
2523
  $request = str_replace( '/', ' ', $request );
2524
+ $request = str_replace( '-', ' ', $request );
2525
  $request_a = explode( ' ', $request );
2526
  $request_new = array();
2527
  foreach ( $request_a as $token ) {
2551
  if ( $max < $len ) {
2552
  if ( function_exists( 'mb_strrpos' ) ) {
2553
  $pos = mb_strrpos( $text, ' ', -($len - $max) );
2554
+ if ( $pos === false ) $pos = $max;
2555
  if ( $pos > $this->minimum_description_length ) {
2556
  $max = $pos;
2557
  } else {
2584
  if ( is_404() ) return null;
2585
 
2586
  // if we are on synthetic pages
2587
+ if ( !is_home() && !is_page() && !is_single() && !$this->is_static_front_page() && !$this->is_static_posts_page() && !is_archive() && !is_post_type_archive() )
2588
  return null;
2589
 
2590
  $keywords = array();
2692
  $field = "aiosp_$f";
2693
  if ( isset( $_POST[$field] ) ) $$field = $_POST[$field];
2694
  }
2695
+
2696
  foreach ( Array( 'keywords', 'description', 'noindex', 'nofollow', 'noodp', 'noydir', 'title', 'titleatr', 'menulabel' ) as $f )
2697
  delete_post_meta( $id, "_aioseop_{$f}" );
2698
 
2755
  }
2756
  }
2757
  }
2758
+
2759
  function admin_bar_upgrade_menu() {
2760
  global $wp_admin_bar;
2761
  $wp_admin_bar->add_menu( array( 'parent' => AIOSEOP_PLUGIN_DIRNAME, 'title' => __( 'Upgrade To Pro', 'all_in_one_seo_pack' ), 'id' => 'aioseop-pro-upgrade', 'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu', 'meta' => Array( 'target' => '_blank' ) ) );
2764
  function menu_order() {
2765
  return 5;
2766
  }
2767
+
2768
  function admin_menu() {
2769
  $file = plugin_basename( __FILE__ );
2770
  $menu_name = __( 'All in One SEO', 'all_in_one_seo_pack' );
2802
  if ( isset( $this->options["aiosp_custom_menu_order"] ) )
2803
  $custom_menu_order = $this->options["aiosp_custom_menu_order"];
2804
  }
2805
+
2806
  if ( $custom_menu_order ) {
2807
  add_filter( 'custom_menu_order', '__return_true' );
2808
  add_filter( 'menu_order', array( $this, 'set_menu_order' ) );
2862
  if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
2863
  if ( $tab_num <= 1 ) {
2864
  if ( !empty( $m[0]['callback_args']['help_link'] ) )
2865
+ $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $m[0]['callback_args']['help_link'] . "'><span>" . __( 'Help', 'all_in_one_seo_pack' ) . "</span></a>";
2866
  add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] );
2867
  } elseif ( $tab_num > 1 ) {
2868
  add_meta_box( $m[0]['id'] . '_tabbed', $title, Array( $this, 'display_tabbed_metabox' ), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m );
2874
  $title = $m['title'];
2875
  if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
2876
  if ( !empty( $m['help_link'] ) )
2877
+ $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $m['help_link'] . "'><span>" . __( 'Help', 'all_in_one_seo_pack' ) . "</span></a>";
2878
  add_meta_box( $m['id'], $title, $m['callback'], $m['post_type'], $m['context'], $m['priority'], $m['callback_args'] );
2879
  }
2880
  }
2970
  <?php
2971
  }
2972
  }
 
aioseop_feature_manager.php CHANGED
@@ -20,13 +20,17 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
20
  'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all_in_one_seo_pack' ) ),
21
  'opengraph' => Array( 'name' => __( 'Social Meta', 'all_in_one_seo_pack' ),
22
  'description' => __( 'Activate this feature to add Social Meta data to your site to deliver closer integration between your website/blog and Facebook, Twitter, and Google+.', 'all_in_one_seo_pack' ) ),
 
 
 
 
23
  'performance' => Array( 'name' => __( 'Performance', 'all_in_one_seo_pack' ),
24
  'description' => __( 'Optimize performance related to SEO and check your system status.', 'all_in_one_seo_pack' ),
25
  'default' => 'on' ),
26
  'importer_exporter' => Array( 'name' => __( 'Importer & Exporter', 'all_in_one_seo_pack' ),
27
  'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all_in_one_seo_pack' ) ),
28
  'coming_soon' => Array( 'name' => __( 'Coming Soon...', 'all_in_one_seo_pack' ),
29
- 'description' => __( 'File Editor', 'all_in_one_seo_pack' ),
30
  'save' => false ) );
31
 
32
  // Set up default settings fields
20
  'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all_in_one_seo_pack' ) ),
21
  'opengraph' => Array( 'name' => __( 'Social Meta', 'all_in_one_seo_pack' ),
22
  'description' => __( 'Activate this feature to add Social Meta data to your site to deliver closer integration between your website/blog and Facebook, Twitter, and Google+.', 'all_in_one_seo_pack' ) ),
23
+ 'robots' => Array( 'name' => __( 'Robots.txt', 'all_in_one_seo_pack' ),
24
+ 'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all_in_one_seo_pack' ) ),
25
+ 'file_editor' => Array( 'name' => __( 'File Editor', 'all_in_one_seo_pack' ),
26
+ 'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all_in_one_seo_pack' ) ),
27
  'performance' => Array( 'name' => __( 'Performance', 'all_in_one_seo_pack' ),
28
  'description' => __( 'Optimize performance related to SEO and check your system status.', 'all_in_one_seo_pack' ),
29
  'default' => 'on' ),
30
  'importer_exporter' => Array( 'name' => __( 'Importer & Exporter', 'all_in_one_seo_pack' ),
31
  'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all_in_one_seo_pack' ) ),
32
  'coming_soon' => Array( 'name' => __( 'Coming Soon...', 'all_in_one_seo_pack' ),
33
+ 'description' => __( 'Video Sitemap', 'all_in_one_seo_pack' ),
34
  'save' => false ) );
35
 
36
  // Set up default settings fields
aioseop_file_editor.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package All-in-One-SEO-Pack
4
+ */
5
+ /**
6
+ * The File Editor class.
7
+ */
8
+ if ( !class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
9
+ class All_in_One_SEO_Pack_File_Editor extends All_in_One_SEO_Pack_Module {
10
+
11
+ function All_in_One_SEO_Pack_File_Editor( ) {
12
+ $this->name = __('File Editor', 'all_in_one_seo_pack'); // Human-readable name of the plugin
13
+ $this->prefix = 'aiosp_file_editor_'; // option prefix
14
+ $this->file = __FILE__; // the current file
15
+ parent::__construct();
16
+ if ( isset($_REQUEST['tab'] ) )
17
+ $this->current_tab = $_REQUEST['tab'];
18
+ else
19
+ $this->current_tab = 'robots';
20
+
21
+ $help_text = Array(
22
+ 'robotfile' => __( 'Robots.txt editor', 'all_in_one_seo_pack' ),
23
+ 'htaccfile' => __( '.htaccess editor', 'all_in_one_seo_pack' )
24
+ );
25
+ $this->default_options = array(
26
+ 'robotfile' => Array( 'name' => __( 'Edit Robots.txt', 'all_in_one_seo_pack'),
27
+ 'save' => false, 'default' => '', 'type' => 'textarea', 'cols' => 70, 'rows' => 25, 'label' => 'top' ),
28
+ 'htaccfile' => Array( 'name' => __( 'Edit .htaccess', 'all_in_one_seo_pack'),
29
+ 'save' => false, 'default' => '', 'type' => 'textarea', 'cols' => 70, 'rows' => 25, 'label' => 'top' )
30
+ );
31
+
32
+ if ( !empty( $help_text ) )
33
+ foreach( $help_text as $k => $v )
34
+ $this->default_options[$k]['help_text'] = $v;
35
+ $this->tabs = Array(
36
+ 'robots' => Array( 'name' => __( 'robots.txt' ) ),
37
+ 'htaccess' => Array( 'name' => __( '.htaccess' ) )
38
+ );
39
+
40
+ $this->layout = Array(
41
+ 'robots' => Array(
42
+ 'name' => __( 'Edit robots.txt', 'all_in_one_seo_pack' ),
43
+ 'options' => Array( 'robotfile' ),
44
+ 'tab' => 'robots'
45
+ ),
46
+ 'htaccess' => Array(
47
+ 'name' => __( 'Edit .htaccess', 'all_in_one_seo_pack' ),
48
+ 'options' => Array( 'htaccfile' ),
49
+ 'tab' => 'htaccess'
50
+ )
51
+ );
52
+
53
+ $this->update_options( ); // load initial options / set defaults
54
+ }
55
+
56
+ function settings_page_init() {
57
+ add_filter($this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 );
58
+ add_filter($this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 );
59
+ }
60
+
61
+ function add_page_hooks() {
62
+ parent::add_page_hooks();
63
+ add_action($this->prefix . 'settings_update', Array($this, 'do_file_editor'), 10, 2 );
64
+ }
65
+
66
+ function filter_submit( $submit, $location ) {
67
+ unset( $submit['Submit_Default'] );
68
+ $submit['Submit']['type'] = 'hidden';
69
+ if ( $this->current_tab == 'robots' )
70
+ $submit['Submit_File_Editor'] = Array( 'type' => 'submit', 'class' => 'button-primary', 'value' => __('Update robots.txt', 'all_in_one_seo_pack') . ' &raquo;' );
71
+ elseif ( $this->current_tab == 'htaccess' )
72
+ $submit['Submit_htaccess'] = Array( 'type' => 'submit', 'class' => 'button-primary', 'value' => __('Update .htaccess', 'all_in_one_seo_pack') . ' &raquo;' );
73
+ return $submit;
74
+ }
75
+
76
+ function filter_options( $options, $location ) {
77
+ $prefix = $this->get_prefix( $location );
78
+ if ( $this->current_tab == 'robots' )
79
+ $options = $this->load_files( $options, Array( 'robotfile' => 'robots.txt' ), $prefix );
80
+ elseif ( $this->current_tab == 'htaccess' )
81
+ $options = $this->load_files( $options, Array( 'htaccfile' => '.htaccess' ), $prefix );
82
+ return $options;
83
+ }
84
+
85
+ function do_file_editor( $options, $location ) {
86
+ $prefix = $this->get_prefix( $location );
87
+ if ( $this->current_tab == 'robots' && isset($_POST['Submit_File_Editor']) && $_POST['Submit_File_Editor'] )
88
+ $this->save_files( Array( 'robotfile' => 'robots.txt' ), $prefix );
89
+ elseif ( $this->current_tab == 'htaccess' && isset($_POST['Submit_htaccess']) && $_POST['Submit_htaccess'] )
90
+ $this->save_files( Array( 'htaccfile' => '.htaccess' ), $prefix );
91
+ }
92
+ }
93
+ }
aioseop_functions.php CHANGED
@@ -25,6 +25,15 @@ if ( !function_exists( 'aioseop_activate' ) ) {
25
  }
26
  }
27
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Check if settings need to be updated / migrated from old version.
30
  */
@@ -34,14 +43,22 @@ if ( !function_exists( 'aioseop_update_settings_check' ) ) {
34
  if ( ( isset( $_POST['aioseop_migrate_options'] ) ) ||
35
  ( empty( $aioseop_options ) ) )
36
  aioseop_mrt_mkarry();
37
-
38
  // WPML has now attached to filters, read settings again so they can be translated
39
- $aioseop_options = get_option( 'aioseop_options' );
40
-
41
- if ( !empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // migrate setting for noindex archives
42
- $aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex'];
43
- unset( $aioseop_options['aiosp_archive_noindex'] );
44
- update_option( 'aioseop_options', $aioseop_options );
 
 
 
 
 
 
 
 
 
45
  }
46
  }
47
  }
@@ -187,11 +204,10 @@ if ( !function_exists( 'aioseop_ajax_save_meta' ) ) {
187
  function aioseop_ajax_save_meta() {
188
  if ( !empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] != 'undefined' ) )
189
  check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
190
- else
191
- check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
192
  $post_id = intval( $_POST['post_id'] );
193
  $new_meta = strip_tags( $_POST['new_meta'] );
194
  $target = $_POST['target_meta'];
 
195
  $result = '';
196
  if ( in_array( $target, Array( 'title', 'description', 'keywords' ) ) && current_user_can( 'edit_post', $post_id ) ) {
197
  update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
@@ -205,8 +221,9 @@ if ( !function_exists( 'aioseop_ajax_save_meta' ) ) {
205
  $label = '';
206
  $label = "<label id='aioseop_label_{$target}_{$post_id}'></label><strong><i>" . __( 'No', 'all_in_one_seo_pack' ) . ' ' . $target . '</i></strong>';
207
  endif;
 
208
  $output = $label . '<a id="' . $target . 'editlink' . $post_id . '" href="javascript:void(0);"';
209
- $output .= 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '");return false;\' title="' . __('Edit') . '">';
210
  $output .= '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a>';
211
  die( "jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . ";
212
  jQuery('div#aioseop_" . $target . "_" . $post_id . "').html(my_label).fadeIn('fast');
@@ -235,8 +252,8 @@ if ( !function_exists( 'aioseop_ajax_save_url' ) ) {
235
  parse_str( $_POST['options'], $options );
236
  foreach( $options as $k => $v ) $_POST[$k] = $v;
237
  $_POST['action'] = 'aiosp_update_module';
238
- global $aiosp, $aioseop_module_list, $aioseop_modules;
239
- aioseop_load_modules( $aioseop_module_list );
240
  $aiosp->admin_menu();
241
  $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" );
242
  $_POST['location'] = null;
@@ -258,8 +275,8 @@ if ( !function_exists( 'aioseop_ajax_delete_url' ) ) {
258
  $options = Array();
259
  $options = esc_attr( $_POST['options'] );
260
  $_POST['action'] = 'aiosp_update_module';
261
- global $aiosp, $aioseop_module_list, $aioseop_modules;
262
- aioseop_load_modules( $aioseop_module_list );
263
  $aiosp->admin_menu();
264
  $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" );
265
  $_POST['location'] = null;
@@ -376,8 +393,8 @@ if (!function_exists('aioseop_ajax_save_settings')) {
376
  parse_str( $_POST['options'], $options );
377
  $_POST = $options;
378
  $_POST['action'] = 'aiosp_update_module';
379
- global $aiosp, $aioseop_module_list, $aioseop_modules;
380
- aioseop_load_modules( $aioseop_module_list );
381
  $aiosp->admin_menu();
382
  $module = $aioseop_modules->return_module( $_POST['module'] );
383
  unset( $_POST['module'] );
@@ -398,8 +415,8 @@ if (!function_exists('aioseop_ajax_get_menu_links')) {
398
  parse_str( $_POST['options'], $options );
399
  $_POST = $options;
400
  $_POST['action'] = 'aiosp_update_module';
401
- global $aiosp, $aioseop_module_list, $aioseop_modules;
402
- aioseop_load_modules( $aioseop_module_list );
403
  $aiosp->admin_menu();
404
  if ( empty( $_POST['location'] ) ) $_POST['location'] = null;
405
  $_POST['Submit'] = 'ajax';
@@ -469,8 +486,9 @@ if ( !function_exists( 'aioseop_mrt_pccolumn' ) ) {
469
  else:
470
  $label = "<label id='aioseop_label_{$target}_{$id}'></label><strong><i>No " . $target . '</i></strong>';
471
  endif;
 
472
  print $label . '<a id="' . $target . 'editlink' . $id . '" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
473
- $id . ', "' . $target . '");return false;\' title="' . __('Edit') . '">';
474
  print "<img class='aioseop_edit_button'
475
  id='aioseop_edit_id'
476
  src='" . AIOSEOP_PLUGIN_IMAGES_URL . "cog_edit.png' /></a>";
@@ -592,6 +610,17 @@ if ( !function_exists( 'aioseop_add_contactmethods' ) ) {
592
  }
593
  }
594
 
 
 
 
 
 
 
 
 
 
 
 
595
  /***
596
  * Utility function for inserting elements into associative arrays by key
597
  */
25
  }
26
  }
27
 
28
+ if ( !function_exists( 'aioseop_get_options' ) ) {
29
+ function aioseop_get_options() {
30
+ global $aioseop_options;
31
+ $aioseop_options = get_option( 'aioseop_options' );
32
+ $aioseop_options = apply_filters( 'aioseop_get_options', $aioseop_options );
33
+ return $aioseop_options;
34
+ }
35
+ }
36
+
37
  /**
38
  * Check if settings need to be updated / migrated from old version.
39
  */
43
  if ( ( isset( $_POST['aioseop_migrate_options'] ) ) ||
44
  ( empty( $aioseop_options ) ) )
45
  aioseop_mrt_mkarry();
 
46
  // WPML has now attached to filters, read settings again so they can be translated
47
+ aioseop_get_options();
48
+ $update_options = false;
49
+ if ( !empty( $aioseop_options ) ) {
50
+ if ( !empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // migrate setting for noindex archives
51
+ $aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex'];
52
+ unset( $aioseop_options['aiosp_archive_noindex'] );
53
+ $update_options = true;
54
+ }
55
+ if ( !empty( $aioseop_options['archive_title_format'] ) && empty( $aioseop_options['date_title_format'] ) ) {
56
+ $aioseop_options['date_title_format'] = $aioseop_options['archive_title_format'];
57
+ unset( $aioseop_options['archive_title_format'] );
58
+ $update_options = true;
59
+ }
60
+ if ( $update_options )
61
+ update_option( 'aioseop_options', $aioseop_options );
62
  }
63
  }
64
  }
204
  function aioseop_ajax_save_meta() {
205
  if ( !empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] != 'undefined' ) )
206
  check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
 
 
207
  $post_id = intval( $_POST['post_id'] );
208
  $new_meta = strip_tags( $_POST['new_meta'] );
209
  $target = $_POST['target_meta'];
210
+ check_ajax_referer( 'aioseop_meta_' . $target . '_' . $post_id, '_nonce' );
211
  $result = '';
212
  if ( in_array( $target, Array( 'title', 'description', 'keywords' ) ) && current_user_can( 'edit_post', $post_id ) ) {
213
  update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
221
  $label = '';
222
  $label = "<label id='aioseop_label_{$target}_{$post_id}'></label><strong><i>" . __( 'No', 'all_in_one_seo_pack' ) . ' ' . $target . '</i></strong>';
223
  endif;
224
+ $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$post_id}" );
225
  $output = $label . '<a id="' . $target . 'editlink' . $post_id . '" href="javascript:void(0);"';
226
+ $output .= 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __('Edit') . '">';
227
  $output .= '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a>';
228
  die( "jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . ";
229
  jQuery('div#aioseop_" . $target . "_" . $post_id . "').html(my_label).fadeIn('fast');
252
  parse_str( $_POST['options'], $options );
253
  foreach( $options as $k => $v ) $_POST[$k] = $v;
254
  $_POST['action'] = 'aiosp_update_module';
255
+ global $aiosp, $aioseop_modules;
256
+ aioseop_load_modules();
257
  $aiosp->admin_menu();
258
  $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" );
259
  $_POST['location'] = null;
275
  $options = Array();
276
  $options = esc_attr( $_POST['options'] );
277
  $_POST['action'] = 'aiosp_update_module';
278
+ global $aiosp, $aioseop_modules;
279
+ aioseop_load_modules();
280
  $aiosp->admin_menu();
281
  $module = $aioseop_modules->return_module( "All_in_One_SEO_Pack_Sitemap" );
282
  $_POST['location'] = null;
393
  parse_str( $_POST['options'], $options );
394
  $_POST = $options;
395
  $_POST['action'] = 'aiosp_update_module';
396
+ global $aiosp, $aioseop_modules;
397
+ aioseop_load_modules();
398
  $aiosp->admin_menu();
399
  $module = $aioseop_modules->return_module( $_POST['module'] );
400
  unset( $_POST['module'] );
415
  parse_str( $_POST['options'], $options );
416
  $_POST = $options;
417
  $_POST['action'] = 'aiosp_update_module';
418
+ global $aiosp, $aioseop_modules;
419
+ aioseop_load_modules();
420
  $aiosp->admin_menu();
421
  if ( empty( $_POST['location'] ) ) $_POST['location'] = null;
422
  $_POST['Submit'] = 'ajax';
486
  else:
487
  $label = "<label id='aioseop_label_{$target}_{$id}'></label><strong><i>No " . $target . '</i></strong>';
488
  endif;
489
+ $nonce = wp_create_nonce( "aioseop_meta_{$target}_{$id}" );
490
  print $label . '<a id="' . $target . 'editlink' . $id . '" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
491
+ $id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __('Edit') . '">';
492
  print "<img class='aioseop_edit_button'
493
  id='aioseop_edit_id'
494
  src='" . AIOSEOP_PLUGIN_IMAGES_URL . "cog_edit.png' /></a>";
610
  }
611
  }
612
 
613
+ if ( !function_exists( 'aioseop_localize_script_data' ) ) {
614
+ function aioseop_localize_script_data() {
615
+ static $loaded = 0;
616
+ if ( !$loaded ) {
617
+ $data = apply_filters( 'aioseop_localize_script_data', Array() );
618
+ wp_localize_script( 'aioseop-module-script', 'aiosp_data', $data );
619
+ $loaded = 1;
620
+ }
621
+ }
622
+ }
623
+
624
  /***
625
  * Utility function for inserting elements into associative arrays by key
626
  */
aioseop_module.css CHANGED
@@ -14,15 +14,51 @@
14
  .aioseop_help_text_link, .aioseop_help_text_link:active {
15
  text-align: left;
16
  float: left;
17
- width: 100%;
18
  max-width: 300px;
19
- background-repeat: no-repeat;
20
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAABpElEQVR42u3WTU8TURSAYf+CO7407kgKBmkVwR1RS1qjfMQVG01sYimpQltoZ+60IL/cJ6bupmnLTGEzb/LsbjInM7mZ86SoqKioKJdec0KDS7r84oRtHqUl6lwRExhxxy0RAyJ67LPKg7TOOQktqmymnCtxSIeYH7xhoVVICNR4xrTWqDMYe7vINxfoUWHeynSJeEWurdEiYof7VqZPmyVya58RVSZ1TDTW4AVpHRDzgdzqwMQuCAzHIhI2Us6u0oF82iOhTlpHRHT53ykJbdKqMuIdmTsiZpO0Rgx5j+TBDEhIq0TMIZlrEZin7/zhG5MKnJG5axJmrUHEBc+nDDggcz0Cs3RKwhVSpgHz/8S3BJ7OOGCTzJ2QsMm0ImKmVSLmC5nbIaZGXn0iZo/MLXHJb6YVE5hWkx65VSfM8Hvqc4MmVmPIZ3JrmRYDKhmXhRHn5F6JiP4916VduvR5uciFtT92wMoclyJwzRYLrcxP7jijyvqEBbdGm4gmGzxIK3xkSDyWMCRwQ0TgmirLPEq7fKVFhy5tjtn+N1hRUVFR0b36C7aDUPHJvmrWAAAAAElFTkSuQmCC);
21
  min-width: 1px;
22
- min-height: 22px;
23
- padding-top: 10px;
24
- border: none;
25
  outline: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
  .aioseop_help_text_link img {
28
  width: 40px;
@@ -30,23 +66,30 @@
30
  }
31
  .aioseop_meta_box_help, .aioseop_meta_box_help:active {
32
  float: right;
33
- background-size: 42%;
34
- padding-left: 20px;
35
- padding-top: 5px;
36
- width: 32px;
 
 
 
37
  }
38
  .aioseop_label {
39
  color: #5F5F5F;
40
  font-weight: bold;
41
  line-height: 19px;
42
- padding-left: 50px;
43
- padding-right: 10px;
44
  display: inline-block;
45
  text-align: left;
 
 
 
 
 
46
  }
47
  .aioseop_option_div {
48
  max-height: 160px;
49
- min-height: 34px;
50
  width: 95%;
51
  overflow-y: auto;
52
  }
@@ -205,10 +248,12 @@
205
  }
206
  .aioseop_option_label {
207
  float: left;
208
- margin: 0px 0 10px 5px;
209
  min-width: 150px;
210
  width: 37%;
211
  max-width: 270px;
 
 
212
  }
213
  .aioseop_metabox_text h2 {
214
  font-size: 14px;
@@ -233,6 +278,12 @@
233
  background-color: #EEE;
234
  margin: 5px 0 5px 0 !important;
235
  }
 
 
 
 
 
 
236
  .aioseop_settings_left {
237
  float: left;
238
  padding: 0px;
@@ -262,6 +313,7 @@ body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_se
262
  .aioseop_top #aioseop-list {
263
  margin-bottom: 0px;
264
  }
 
265
  .aioseop_right_sidebar {
266
  float: right;
267
  margin-top: 35px;
@@ -274,6 +326,9 @@ body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_se
274
  #aiosp_settings_form .button-primary.hidden {
275
  display: none;
276
  }
 
 
 
277
  .All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button {
278
  height: 5px;
279
  }
@@ -360,6 +415,18 @@ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
360
  div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
361
  background-image: url(images/SocialMeta-Color-Standard.png);
362
  }
 
 
 
 
 
 
 
 
 
 
 
 
363
  div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
364
  background-image: url(images/ImporterExporter-BW-Standard.png);
365
  }
@@ -378,7 +445,8 @@ div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image {
378
  div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
379
  background-image: url(images/Default-Color-Standard.png);
380
  }
381
- .All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table {
 
382
  max-width: 500px;
383
  clear: none;
384
  }
@@ -423,6 +491,18 @@ only screen and ( min-resolution: 1.5dppx) {
423
  div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
424
  background-image: url(images/SocialMeta-Color-Retina.png);
425
  }
 
 
 
 
 
 
 
 
 
 
 
 
426
  div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
427
  background-image: url(images/ImporterExporter-BW-Retina.png);
428
  }
@@ -455,11 +535,13 @@ only screen and ( min-resolution: 1.5dppx) {
455
  }
456
  .aioseop_wrapper {
457
  width: 100%;
 
458
  }
459
  .aioseop_input {
460
  clear: left;
461
  width: 100%;
462
  padding: 5px;
 
463
  }
464
  .aioseop_option_input {
465
  float: left;
@@ -606,6 +688,7 @@ table.aioseop_table td, table.aioseop_table th {
606
  .aioseop_settings_left .postbox .inside {
607
  padding: 0;
608
  margin: 0;
 
609
  }
610
  #aiosp_settings_form .aioseop_no_label, .aioseop_no_label {
611
  float: left;
@@ -642,7 +725,7 @@ table.aioseop_table td, table.aioseop_table th {
642
  .aioseop_input input[type="checkbox"],
643
  .aioseop_input input[type="radio"] {
644
  vertical-align: text-bottom;
645
- margin: 15px 0 0 0;
646
  }
647
  #aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div {
648
  max-height: initial;
@@ -650,9 +733,56 @@ table.aioseop_table td, table.aioseop_table th {
650
  #aiosp {
651
  width: 100%;
652
  }
 
653
  .aioseop_input.aioseop_top_label .aioseop_option_input {
654
  margin: 0 0 10px 0;
655
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
  .aioseop_option_docs {
657
  width: 98%;
658
  display: none;
@@ -675,6 +805,7 @@ table.aioseop_table td, table.aioseop_table th {
675
  .aioseop_help_text ul {
676
  margin: 15px 0 0 20px;
677
  }
 
678
  .aioseop_help_text ul li {
679
  line-height: 20px;
680
  margin: 0;
@@ -733,6 +864,7 @@ table.aioseop_table td, table.aioseop_table th {
733
  border: solid 1px #CCC;
734
  background-color: rgb( 255, 255, 255 );
735
  background-color: rgba( 255, 255, 255, 0.5 );
 
736
  }
737
  .aioseop_loading {
738
  background-image: url('images/activity.gif');
@@ -755,6 +887,9 @@ table.aioseop_table td, table.aioseop_table th {
755
  form#aiosp_settings_form, .aioseop_tabs_div {
756
  padding-right: 477px;
757
  }
 
 
 
758
  /*
759
  .wrap > h2 {
760
  padding-bottom: 14px;
@@ -767,15 +902,6 @@ div.wrap > div#message.error {
767
  max-width: 540px;
768
  }
769
  */
770
- #aioseop-hosting {
771
- width: 445px;
772
- }
773
- #aioseop-hosting.postbox .inside {
774
- margin: -3px 0;
775
- }
776
- #aioseop-hosting.postbox .inside {
777
- padding: 0px;
778
- }
779
  #aiosp_settings_form ul.sfwd_debug_settings li strong {
780
  display: block;
781
  float: left;
@@ -824,9 +950,25 @@ div.sfwd_debug_error {
824
  #aiosp_performance_status_wrapper .aioseop_option_div {
825
  max-height: 420px;
826
  }
 
827
  #aioseop_coming_soon, #aioseop_coming_soon2 {
828
  padding-top: 40px;
829
  text-align: center;
830
  height: 258px;
831
  font-size: 16px;
832
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  .aioseop_help_text_link, .aioseop_help_text_link:active {
15
  text-align: left;
16
  float: left;
 
17
  max-width: 300px;
 
 
18
  min-width: 1px;
19
+ padding-top: 2px;
 
 
20
  outline: none;
21
+ color: #888;
22
+ border: 2px solid #888;
23
+ border-radius: 33px;
24
+ width: 22px;
25
+ height: 20px;
26
+ display: inline-block;
27
+ font-family: sans-serif;
28
+ }
29
+ .aioseop_help_text_link span {
30
+ position: absolute;
31
+ left: 21px;
32
+ font-size: 14px;
33
+ }
34
+ .aioseop_help_text_link:before {
35
+ content: '\a0?';
36
+ color: #888;
37
+ font-size: 19px;
38
+ }
39
+
40
+ .aioseop_help_text_link.aioseop_meta_box_help:before {
41
+ font-size: 14px;
42
+ }
43
+ .aioseop_meta_box_help > label {
44
+ position: absolute;
45
+ margin-left: 8px;
46
+ }
47
+ div.aioseop_tip_icon {
48
+ font-size: 14px;
49
+ border: 1px solid #888;
50
+ width: 1em;
51
+ text-align: center;
52
+ padding: 0px 4px;
53
+ border-radius: 12px;
54
+ box-shadow: 1px 1px 1px #888;
55
+ -webkit-border-radius: 12px;
56
+ -moz-border-radius: 12px;
57
+ -webkit-box-shadow: 1px 1px 1px #888;
58
+ -moz-box-shadow: 1px 1px 1px #888;
59
+ }
60
+ div.aioseop_tip_icon:before {
61
+ content: '?';
62
  }
63
  .aioseop_help_text_link img {
64
  width: 40px;
66
  }
67
  .aioseop_meta_box_help, .aioseop_meta_box_help:active {
68
  float: right;
69
+ padding-left: 0px;
70
+ width: 16px;
71
+ margin-right: 32px;
72
+ text-decoration: none;
73
+ height: 15px;
74
+ padding-top: 1px;
75
+ position: relative;
76
  }
77
  .aioseop_label {
78
  color: #5F5F5F;
79
  font-weight: bold;
80
  line-height: 19px;
81
+ padding-left: 20px;
 
82
  display: inline-block;
83
  text-align: left;
84
+ position: absolute;
85
+ font-family: 'Open Sans', sans-serif;
86
+ width: 26%;
87
+ min-width: 120px;
88
+ max-width: 230px;
89
  }
90
  .aioseop_option_div {
91
  max-height: 160px;
92
+ min-height: 43px;
93
  width: 95%;
94
  overflow-y: auto;
95
  }
248
  }
249
  .aioseop_option_label {
250
  float: left;
251
+ margin: 0px;
252
  min-width: 150px;
253
  width: 37%;
254
  max-width: 270px;
255
+ padding-top: 3px;
256
+ padding-bottom: 3px;
257
  }
258
  .aioseop_metabox_text h2 {
259
  font-size: 14px;
278
  background-color: #EEE;
279
  margin: 5px 0 5px 0 !important;
280
  }
281
+ /*
282
+ .aioseop input[type="button"] {
283
+ border-radius: 5px;
284
+ font-size: 15px;
285
+ }
286
+ */
287
  .aioseop_settings_left {
288
  float: left;
289
  padding: 0px;
313
  .aioseop_top #aioseop-list {
314
  margin-bottom: 0px;
315
  }
316
+
317
  .aioseop_right_sidebar {
318
  float: right;
319
  margin-top: 35px;
326
  #aiosp_settings_form .button-primary.hidden {
327
  display: none;
328
  }
329
+ form#edittag div#aiosp_titleatr_wrapper, form#edittag div#aiosp_menulabel_wrapper, form#edittag div#aiosp_sitemap_exclude_wrapper {
330
+ display: none;
331
+ }
332
  .All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button {
333
  height: 5px;
334
  }
415
  div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
416
  background-image: url(images/SocialMeta-Color-Standard.png);
417
  }
418
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image {
419
+ background-image: url(images/Robots-BW-Standard.png);
420
+ }
421
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image.active {
422
+ background-image: url(images/Robots-Color-Standard.png);
423
+ }
424
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
425
+ background-image: url(images/FileEditor-BW-Standard.png);
426
+ }
427
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
428
+ background-image: url(images/FileEditor-Color-Standard.png);
429
+ }
430
  div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
431
  background-image: url(images/ImporterExporter-BW-Standard.png);
432
  }
445
  div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image {
446
  background-image: url(images/Default-Color-Standard.png);
447
  }
448
+ .All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table,
449
+ .All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table {
450
  max-width: 500px;
451
  clear: none;
452
  }
491
  div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
492
  background-image: url(images/SocialMeta-Color-Retina.png);
493
  }
494
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image {
495
+ background-image: url(images/Robots-BW-Retina.png);
496
+ }
497
+ div.aioseop_feature#aioseop_robots .aioseop_featured_image.active {
498
+ background-image: url(images/Robots-Color-Retina.png);
499
+ }
500
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image {
501
+ background-image: url(images/FileEditor-BW-Retina.png);
502
+ }
503
+ div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active {
504
+ background-image: url(images/FileEditor-Color-Retina.png);
505
+ }
506
  div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
507
  background-image: url(images/ImporterExporter-BW-Retina.png);
508
  }
535
  }
536
  .aioseop_wrapper {
537
  width: 100%;
538
+ padding-left: 5px;
539
  }
540
  .aioseop_input {
541
  clear: left;
542
  width: 100%;
543
  padding: 5px;
544
+ display: inline;
545
  }
546
  .aioseop_option_input {
547
  float: left;
688
  .aioseop_settings_left .postbox .inside {
689
  padding: 0;
690
  margin: 0;
691
+ clear: right;
692
  }
693
  #aiosp_settings_form .aioseop_no_label, .aioseop_no_label {
694
  float: left;
725
  .aioseop_input input[type="checkbox"],
726
  .aioseop_input input[type="radio"] {
727
  vertical-align: text-bottom;
728
+ margin-top: 8px;
729
  }
730
  #aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div {
731
  max-height: initial;
733
  #aiosp {
734
  width: 100%;
735
  }
736
+
737
  .aioseop_input.aioseop_top_label .aioseop_option_input {
738
  margin: 0 0 10px 0;
739
  }
740
+
741
+ .aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div {
742
+ max-height: none;
743
+ }
744
+
745
+ /* Robots.txt styling */
746
+ #aiosp_robots_generator_robotgen_wrapper .aioseop_option_div,
747
+ #aiosp_robots_generator_robothtml_wrapper .aioseop_option_div {
748
+ max-height: none;
749
+ }
750
+ .aioseop_option_input .widefat td {
751
+ vertical-align: middle;
752
+ }
753
+ .entry-row.robots.quirks {
754
+ font-weight: bold;
755
+ opacity: 1;
756
+ }
757
+ .entry-row.robots {
758
+ opacity: 0.8;
759
+ }
760
+ .entry-row.robots.invalid {
761
+ opacity: 1;
762
+ font-weight: bold;
763
+ }
764
+ .invalid .entry_label {
765
+ font-weight: bold;
766
+ }
767
+ .column_label, .entry_label {
768
+ }
769
+ .aioseop .aioseop_option_input tbody {
770
+ background: #FCFCFC;
771
+ }
772
+ .All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody {
773
+ background: transparent;
774
+ }
775
+ .entry-row.robots div {
776
+ height: 20px;
777
+ vertical-align: middle;
778
+ width: 90%;
779
+ margin: 0 0 4px 0;
780
+ }
781
+ .robots img {
782
+ margin: 0 0 0 2px;
783
+ opacity: 0.6;
784
+ }
785
+
786
  .aioseop_option_docs {
787
  width: 98%;
788
  display: none;
805
  .aioseop_help_text ul {
806
  margin: 15px 0 0 20px;
807
  }
808
+
809
  .aioseop_help_text ul li {
810
  line-height: 20px;
811
  margin: 0;
864
  border: solid 1px #CCC;
865
  background-color: rgb( 255, 255, 255 );
866
  background-color: rgba( 255, 255, 255, 0.5 );
867
+ padding-left: 5px;
868
  }
869
  .aioseop_loading {
870
  background-image: url('images/activity.gif');
887
  form#aiosp_settings_form, .aioseop_tabs_div {
888
  padding-right: 477px;
889
  }
890
+ .aioseop_tabs_div {
891
+ margin-top: 10px;
892
+ }
893
  /*
894
  .wrap > h2 {
895
  padding-bottom: 14px;
902
  max-width: 540px;
903
  }
904
  */
 
 
 
 
 
 
 
 
 
905
  #aiosp_settings_form ul.sfwd_debug_settings li strong {
906
  display: block;
907
  float: left;
950
  #aiosp_performance_status_wrapper .aioseop_option_div {
951
  max-height: 420px;
952
  }
953
+
954
  #aioseop_coming_soon, #aioseop_coming_soon2 {
955
  padding-top: 40px;
956
  text-align: center;
957
  height: 258px;
958
  font-size: 16px;
959
  }
960
+ /*
961
+ #aioseop_coming_soon {
962
+ text-align: center;
963
+ background-color: rgba(255, 255, 255, 0.5);
964
+ }
965
+ #aioseop_coming_soon p {
966
+ padding: 0px;
967
+ margin: 0px;
968
+ font-size: 16px;
969
+ font-family: Arial,Helvetica,sans-serif;
970
+ }
971
+ #aioseop_coming_soon img {
972
+ padding-top: 40%;
973
+ }
974
+ */
aioseop_module.js CHANGED
@@ -1,6 +1,18 @@
1
- if ( typeof aioseop_data != 'undefined' ) {
2
- aioseop_data = aioseop_data.json.replace(/&quot;/g, '"');
3
- aioseop_data = jQuery.parseJSON( aioseop_data );
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
  function toggleVisibility(id) {
@@ -20,6 +32,7 @@ function countChars(field,cntfield) {
20
  }
21
 
22
  function aioseop_get_field_value( field ) {
 
23
  cur = jQuery('[name=' + field + ']');
24
  if ( cur.length == 0 ) return field;
25
  type = cur.attr('type');
@@ -110,8 +123,8 @@ function aioseop_add_condshow_handlers( index, value ) {
110
  }
111
 
112
  function aioseop_do_condshow( condshow ) {
113
- if ( typeof aioseop_data.condshow != 'undefined' ) {
114
- jQuery.each(aioseop_data.condshow, function(index, value) {
115
  aioseop_do_condshow_match( index, value );
116
  aioseop_add_condshow_handlers( index, value );
117
  });
@@ -119,9 +132,9 @@ function aioseop_do_condshow( condshow ) {
119
  }
120
 
121
  jQuery(document).ready(function(){
122
- if (typeof aioseop_data != 'undefined') {
123
- if ( typeof aioseop_data.condshow != 'undefined' ) {
124
- aioseop_do_condshow( aioseop_data.condshow );
125
  }
126
  }
127
  });
@@ -198,7 +211,7 @@ function aioseop_handle_ajax_call( action, settings, options, success) {
198
  aioseop_sack.setVar( "nonce-aioseop", jQuery('input[name="nonce-aioseop"]').val() );
199
 
200
  aioseop_sack.onError = function() {alert('Ajax error on saving.'); };
201
- aioseop_sack.runAJAX();
202
  }
203
 
204
  function aioseop_handle_post_url( action, settings, options, success) {
@@ -245,8 +258,8 @@ jQuery(document).ready(function() {
245
  jQuery(this).attr('previousValue', 'checked');
246
  }
247
  });
248
- if ( typeof aioseop_data.pointers != 'undefined' ) {
249
- jQuery.each(aioseop_data.pointers, function(index, value) {
250
  if ( value != 'undefined' && value.pointer_text != '' ) {
251
  aioseop_show_pointer( index, value );
252
  }
@@ -258,11 +271,11 @@ jQuery(document).ready(function() {
258
  return false;
259
  });
260
  */
261
- jQuery(".all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left").delegate("input[name='Submit']", "click", function(e) {
262
  e.preventDefault();
263
  return false;
264
  });
265
- jQuery(".all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager #aiosp_settings_form").delegate("input[name='Submit']", "click", function(e) {
266
  e.preventDefault();
267
  aioseop_handle_post_url('aioseop_ajax_save_settings', 'ajax_settings_message', jQuery('form#aiosp_settings_form').serialize(),
268
  function() {
@@ -299,21 +312,14 @@ jQuery(document).ready(function() {
299
  aioseop_handle_post_url('aioseop_ajax_scan_header', 'opengraph_scan_header', jQuery('div#aiosp_opengraph_scan_header').serialize() );
300
  return false;
301
  });
302
-
303
- jQuery('input[name="aiosp_sitemap_posttypes[]"][value="all"]').click(function () {
304
  jQuery(this).parents('div:eq(0)').find(':checkbox').attr('checked', this.checked);
305
  });
306
- jQuery('input[name="aiosp_sitemap_taxonomies[]"][value="all"]').click(function () {
307
- jQuery(this).parents('div:eq(0)').find(':checkbox').attr('checked', this.checked);
308
- });
309
- jQuery('input[name="aiosp_sitemap_posttypes[]"][value!="all"]').click(function () {
310
- if ( !this.checked )
311
- jQuery(this).parents('div:eq(0)').find('input[value="all"]:checkbox').attr('checked', this.checked);
312
- });
313
- jQuery('input[name="aiosp_sitemap_taxonomies[]"][value!="all"]').click(function () {
314
  if ( !this.checked )
315
  jQuery(this).parents('div:eq(0)').find('input[value="all"]:checkbox').attr('checked', this.checked);
316
  });
 
317
  jQuery(".aioseop_tab:not(:first)").hide();
318
  jQuery(".aioseop_tab:first").show();
319
  jQuery("a.aioseop_header_tab").click(function(){
1
+ if ( typeof aiosp_data != 'undefined' ) {
2
+ jQuery.each( aiosp_data, function( index, value ) {
3
+ // aiosp_data[index] = value.json.replace(/&quot;/g, '"');
4
+ // aiosp_data[index] = jQuery.parseJSON( value );
5
+ if ( index == 0 ) {
6
+ if ( typeof value.condshow == 'undefined' ) {
7
+ aiosp_data[index].condshow = [];
8
+ }
9
+ } else {
10
+ if ( typeof value.condshow != 'undefined' ) {
11
+ aiosp_data[0].condshow = jQuery.merge( aiosp_data[0].condshow, value.condshow );
12
+ }
13
+ }
14
+ });
15
+ aiosp_data = aiosp_data[0];
16
  }
17
 
18
  function toggleVisibility(id) {
32
  }
33
 
34
  function aioseop_get_field_value( field ) {
35
+ if ( field.length == 0 ) return field;
36
  cur = jQuery('[name=' + field + ']');
37
  if ( cur.length == 0 ) return field;
38
  type = cur.attr('type');
123
  }
124
 
125
  function aioseop_do_condshow( condshow ) {
126
+ if ( typeof aiosp_data.condshow != 'undefined' ) {
127
+ jQuery.each(aiosp_data.condshow, function(index, value) {
128
  aioseop_do_condshow_match( index, value );
129
  aioseop_add_condshow_handlers( index, value );
130
  });
132
  }
133
 
134
  jQuery(document).ready(function(){
135
+ if (typeof aiosp_data != 'undefined') {
136
+ if ( typeof aiosp_data.condshow != 'undefined' ) {
137
+ aioseop_do_condshow( aiosp_data.condshow );
138
  }
139
  }
140
  });
211
  aioseop_sack.setVar( "nonce-aioseop", jQuery('input[name="nonce-aioseop"]').val() );
212
 
213
  aioseop_sack.onError = function() {alert('Ajax error on saving.'); };
214
+ aioseop_sack.runAJAX();
215
  }
216
 
217
  function aioseop_handle_post_url( action, settings, options, success) {
258
  jQuery(this).attr('previousValue', 'checked');
259
  }
260
  });
261
+ if ( typeof aiosp_data.pointers != 'undefined' ) {
262
+ jQuery.each(aiosp_data.pointers, function(index, value) {
263
  if ( value != 'undefined' && value.pointer_text != '' ) {
264
  aioseop_show_pointer( index, value );
265
  }
271
  return false;
272
  });
273
  */
274
+ jQuery(".all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left").delegate("input[name='Submit']", "click", function(e) {
275
  e.preventDefault();
276
  return false;
277
  });
278
+ jQuery(".all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager #aiosp_settings_form").delegate("input[name='Submit']", "click", function(e) {
279
  e.preventDefault();
280
  aioseop_handle_post_url('aioseop_ajax_save_settings', 'ajax_settings_message', jQuery('form#aiosp_settings_form').serialize(),
281
  function() {
312
  aioseop_handle_post_url('aioseop_ajax_scan_header', 'opengraph_scan_header', jQuery('div#aiosp_opengraph_scan_header').serialize() );
313
  return false;
314
  });
315
+ jQuery( 'input[name="aiosp_sitemap_posttypes[]"][value="all"]', 'input[name="aiosp_sitemap_taxonomies[]"][value="all"]' ).click(function () {
 
316
  jQuery(this).parents('div:eq(0)').find(':checkbox').attr('checked', this.checked);
317
  });
318
+ jQuery( 'input[name="aiosp_sitemap_posttypes[]"][value!="all"]', 'input[name="aiosp_sitemap_taxonomies[]"][value!="all"]' ).click(function () {
 
 
 
 
 
 
 
319
  if ( !this.checked )
320
  jQuery(this).parents('div:eq(0)').find('input[value="all"]:checkbox').attr('checked', this.checked);
321
  });
322
+
323
  jQuery(".aioseop_tab:not(:first)").hide();
324
  jQuery(".aioseop_tab:first").show();
325
  jQuery("a.aioseop_header_tab").click(function(){
aioseop_module_class.php CHANGED
@@ -29,6 +29,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
29
  protected $script_data = null; // used for passing data to JavaScript
30
  protected $plugin_path = null;
31
  protected $pointers = Array();
 
32
 
33
  /**
34
  * Handles calls to display_settings_page_{$location}, does error checking.
@@ -693,6 +694,242 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
693
  }
694
  }
695
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
696
  /** crude approximization of whether current user is an admin */
697
  function is_admin() {
698
  return current_user_can( 'level_8' );
@@ -706,14 +943,16 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
706
  if ( function_exists( 'get_current_screen' ) )
707
  $screen = get_current_screen();
708
  if ( empty( $screen ) ) return;
709
- if ( ( $screen->base != 'post' ) && ( $screen->base != 'toplevel_page_shopp-products' ) ) return;
 
710
  foreach( $this->locations as $k => $v ) {
711
  if ( $v['type'] === 'metabox' ) {
712
  if ( isset( $v['display'] ) && !empty( $v['display'] ) ) {
713
  if ( ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) )
714
  || in_array( $screen->post_type, $v['display'] ) ) {
715
- $this->enqueue_scripts();
716
- $this->enqueue_styles();
 
717
  }
718
  }
719
  }
@@ -744,13 +983,28 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
744
  wp_enqueue_script( 'postbox' );
745
  if ( !empty( $this->pointers ) ) {
746
  wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
747
- $this->script_data['pointers'] = $this->pointers;
748
  }
749
  wp_enqueue_script( 'aioseop-module-script', $this->plugin_path['url'] . 'aioseop_module.js' );
750
  if ( !empty( $this->script_data ) ) {
751
- $data = Array( 'json' => json_encode( $this->script_data ) );
752
- wp_localize_script( 'aioseop-module-script', 'aioseop_data', $data );
 
 
 
 
 
753
  }
 
 
 
 
 
 
 
 
 
 
 
754
  }
755
 
756
  /**
@@ -781,6 +1035,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
781
  $this->pagehook = $this->substr( $hookname, 5 );
782
  add_action( "admin_print_scripts", Array( $this, 'enqueue_scripts' ) );
783
  add_action( "admin_print_styles", Array( $this, 'enqueue_styles' ) );
 
784
  add_action( $this->prefix . 'settings_header', Array( $this, 'display_tabs' ) );
785
  }
786
 
@@ -873,7 +1128,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
873
  add_action( 'save_post', array( $this, 'save_post_data' ) );
874
  add_action( 'edit_page_form', array( $this, 'save_post_data' ) );
875
  if ( isset( $v['display'] ) && !empty( $v['display'] ) ) {
876
- add_action( "admin_print_scripts", Array( $this, 'enqueue_metabox_scripts' ) );
877
  if ( $this->tabbed_metaboxes )
878
  add_filter( 'aioseop_add_post_metabox', Array( $this, 'filter_return_metaboxes' ) );
879
  foreach ( $v['display'] as $posttype ) {
@@ -888,7 +1143,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
888
  $title = $v['name'];
889
  if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
890
  if ( !empty( $v['help_link'] ) )
891
- $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'>" . __( 'Help', 'all_in_one_seo_pack' ) . "</a>";
892
  add_meta_box( $v['prefix'] . $k, $title, Array( $this, 'display_metabox' ), $posttype, $v['context'], $v['priority'], $v );
893
  }
894
  }
@@ -997,8 +1252,8 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
997
  $onload = '';
998
  if ( !empty( $options['count'] ) ) {
999
  $n++;
1000
- $attr .= " onKeyDown='countChars(document.post.$name,document.post.{$prefix}length$n)' onKeyUp='countChars(document.post.$name,document.post.{$prefix}length$n)'";
1001
- $onload = "countChars(document.post.$name,document.post.{$prefix}length$n);";
1002
  }
1003
  if ( isset( $opts['id'] ) ) $attr .= " id=\"{$opts['id']}\" ";
1004
  switch ( $options['type'] ) {
@@ -1028,7 +1283,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1028
  $count_desc = __( ' characters. Most search engines use a maximum of %s chars for the %s.', 'all_in_one_seo_pack' );
1029
  $buf .= "<br /><input readonly type='text' name='{$prefix}length$n' size='3' maxlength='3' style='width:53px;height:23px;margin:0px;padding:0px 0px 0px 10px;' value='" . $this->strlen($value) . "' />"
1030
  . sprintf( $count_desc, $size, $this->strtolower( $options['name'] ) );
1031
- if ( !empty( $onload ) ) $buf .= "<script>{$onload}</script>";
1032
  }
1033
  return $buf;
1034
  }
@@ -1078,7 +1333,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1078
  }
1079
  }
1080
  if ( !empty( $help_link ) )
1081
- echo "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $help_link . "'>" . __( 'Help', 'all_in_one_seo_pack' ) . "</a>";
1082
 
1083
  if ( !isset( $location_settings[$prefix] ) ) {
1084
  $current_options = apply_filters( "{$this->prefix}display_options", $this->get_current_options( Array(), $location, $defaults ), $location );
@@ -1264,7 +1519,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1264
  if ( !isset( $lopts['tab'] ) || ( $this->current_tab == $lopts['tab'] ) ) {
1265
  $title = $lopts['name'];
1266
  if ( !empty( $lopts['help_link'] ) )
1267
- $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'>" . __( 'Help', 'all_in_one_seo_pack' ) . "</a>";
1268
  add_meta_box( $this->get_prefix( $location ) . $l . "_metabox", $title, array($this, 'display_options' ),
1269
  "{$this->prefix}settings", 'advanced', 'default', $lopts );
1270
  }
@@ -1377,8 +1632,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
1377
  global $post;
1378
  }
1379
  if ( isset( $post ) ) {
1380
- $get_opts = '_' . $prefix . $location;
1381
- $get_opts = get_post_meta( $post->ID, $get_opts, true );
1382
  }
1383
  }
1384
  $defs = $this->default_options( $location, $defaults );
29
  protected $script_data = null; // used for passing data to JavaScript
30
  protected $plugin_path = null;
31
  protected $pointers = Array();
32
+ protected $form = 'post';
33
 
34
  /**
35
  * Handles calls to display_settings_page_{$location}, does error checking.
694
  }
695
  }
696
 
697
+ function get_all_images_by_type( $options = null, $p = null ) {
698
+ $img = Array();
699
+ if ( empty( $img ) ) {
700
+ $size = apply_filters( 'post_thumbnail_size', 'large' );
701
+
702
+ global $aioseop_options, $wp_query, $aioseop_opengraph;
703
+
704
+ if ( $p === null ) {
705
+ global $post;
706
+ } else {
707
+ $post = $p;
708
+ }
709
+
710
+ $count = 1;
711
+
712
+ if ( !empty( $post ) ) {
713
+ if ( !is_object( $post ) ) $post = get_post( $post );
714
+ if ( is_object( $post ) && function_exists('get_post_thumbnail_id' ) ) {
715
+ if ( $post->post_type == 'attachment' )
716
+ $post_thumbnail_id = $post->ID;
717
+ else
718
+ $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
719
+ if ( !empty( $post_thumbnail_id ) ) {
720
+ $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
721
+ if ( is_array( $image ) ) {
722
+ $img[] = Array( 'type' => 'featured', 'id' => $post_thumbnail_id, 'link' => $image[0] );
723
+ }
724
+ }
725
+ }
726
+
727
+ $post_id = $post->ID;
728
+ $p = $post; $w = $wp_query;
729
+
730
+ $meta_key = '';
731
+ if ( is_array( $options ) ) {
732
+ if ( isset( $options['meta_key'] ) ) {
733
+ $meta_key = $options['meta_key'];
734
+ }
735
+ }
736
+
737
+ if ( !empty( $meta_key ) && !empty( $post ) ) {
738
+ $meta_key = explode( ',', $meta_key );
739
+ $image = $this->get_the_image_by_meta_key( Array( 'post_id' => $post->ID, 'meta_key' => $meta_key ) );
740
+ if ( !empty( $image ) ) {
741
+ $img[] = Array( 'type' => 'meta_key', 'id' => $meta_key, 'link' => $image );
742
+ }
743
+ }
744
+
745
+ if (! $post->post_modified_gmt != '' )
746
+ $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
747
+ if ( $post->post_type == 'page' )
748
+ $wp_query->is_page = true;
749
+ elseif ( $post->post_type == 'attachment' )
750
+ $wp_query->is_attachment = true;
751
+ else
752
+ $wp_query->is_single = true;
753
+ if ( get_option( 'show_on_front' ) == 'page' ) {
754
+ if ( is_page() && $post->ID == get_option( 'page_on_front' ) )
755
+ $wp_query->is_front_page = true;
756
+ elseif ( $post->ID == get_option( 'page_for_posts' ) )
757
+ $wp_query->is_home = true;
758
+ }
759
+ $args['options']['type'] = 'html';
760
+ $args['options']['nowrap'] = false;
761
+ $args['options']['save'] = false;
762
+ $wp_query->queried_object = $post;
763
+
764
+ $attachments = get_children( Array( 'post_parent' => $post->ID,
765
+ 'post_status' => 'inherit',
766
+ 'post_type' => 'attachment',
767
+ 'post_mime_type' => 'image',
768
+ 'order' => 'ASC',
769
+ 'orderby' => 'menu_order ID' ) );
770
+ if ( !empty( $attachments ) )
771
+ foreach( $attachments as $id => $attachment ) {
772
+ $image = wp_get_attachment_image_src( $id, $size );
773
+ if ( is_array( $image ) ) {
774
+ $img[] = Array( 'type' => 'attachment', 'id' => $id, 'link' => $image[0] );
775
+ }
776
+ }
777
+ $matches = Array();
778
+ preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
779
+ if ( isset( $matches ) && !empty( $matches[1] ) && !empty( $matches[1][0] ) )
780
+ foreach( $matches[1] as $i => $m ) {
781
+ $img[] = Array( 'type' => 'post_content', 'id' => 'post' . $count++, 'link' => $m );
782
+ }
783
+ wp_reset_postdata();
784
+ $wp_query = $w; $post = $p;
785
+ }
786
+ }
787
+ return $img;
788
+ }
789
+
790
+ function get_all_images( $options = null, $p = null ) {
791
+ $img = $this->get_all_images_by_type( $options, $p );
792
+ $legacy = Array();
793
+ foreach( $img as $k => $v ) {
794
+ if ( $v['type'] == 'featured' ) {
795
+ $legacy[$v['link']] = 1;
796
+ } else {
797
+ $legacy[$v['link']] = $v['id'];
798
+ }
799
+ }
800
+ return $legacy;
801
+ }
802
+
803
+ /*** Thanks to Justin Tadlock for the original get-the-image code - http://themehybrid.com/plugins/get-the-image ***/
804
+
805
+ function get_the_image( $options = null, $p = null ) {
806
+
807
+ if ( $p === null ) {
808
+ global $post;
809
+ } else {
810
+ $post = $p;
811
+ }
812
+
813
+ $meta_key = '';
814
+ if ( is_array( $options ) ) {
815
+ if ( isset( $options['meta_key'] ) ) {
816
+ $meta_key = $options['meta_key'];
817
+ }
818
+ }
819
+
820
+ if ( !empty( $meta_key ) && !empty( $post ) ) {
821
+ $meta_key = explode( ',', $meta_key );
822
+ $image = $this->get_the_image_by_meta_key( Array( 'post_id' => $post->ID, 'meta_key' => $meta_key ) );
823
+ }
824
+ if ( empty( $image ) ) $image = $this->get_the_image_by_post_thumbnail( $post );
825
+ if ( empty( $image ) ) $image = $this->get_the_image_by_attachment( $post );
826
+ if ( empty( $image ) ) $image = $this->get_the_image_by_scan( $post );
827
+ if ( empty( $image ) ) $image = $this->get_the_image_by_default( $post );
828
+ return $image;
829
+ }
830
+
831
+ function get_the_image_by_default( $p = null ) {
832
+ return '';
833
+ }
834
+
835
+ function get_the_image_by_meta_key( $args = array() ) {
836
+
837
+ /* If $meta_key is not an array. */
838
+ if ( !is_array( $args['meta_key'] ) )
839
+ $args['meta_key'] = array( $args['meta_key'] );
840
+
841
+ /* Loop through each of the given meta keys. */
842
+ foreach ( $args['meta_key'] as $meta_key ) {
843
+ /* Get the image URL by the current meta key in the loop. */
844
+ $image = get_post_meta( $args['post_id'], $meta_key, true );
845
+ /* If a custom key value has been given for one of the keys, return the image URL. */
846
+ if ( !empty( $image ) )
847
+ return $image;
848
+ }
849
+ return false;
850
+ }
851
+
852
+ function get_the_image_by_post_thumbnail( $p = null ) {
853
+
854
+ if ( $p === null ) {
855
+ global $post;
856
+ } else {
857
+ $post = $p;
858
+ }
859
+
860
+ $post_thumbnail_id = null;
861
+ if ( function_exists('get_post_thumbnail_id' ) ) {
862
+ $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
863
+ }
864
+
865
+ if ( empty( $post_thumbnail_id ) )
866
+ return false;
867
+
868
+ $size = apply_filters( 'post_thumbnail_size', 'large' );
869
+ $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
870
+ return $image[0];
871
+ }
872
+
873
+ function get_the_image_by_attachment( $p = null ) {
874
+
875
+ if ( $p === null ) {
876
+ global $post;
877
+ } else {
878
+ $post = $p;
879
+ }
880
+
881
+ $attachments = get_children( Array( 'post_parent' => $post->ID,
882
+ 'post_status' => 'inherit',
883
+ 'post_type' => 'attachment',
884
+ 'post_mime_type' => 'image',
885
+ 'order' => 'ASC',
886
+ 'orderby' => 'menu_order ID' ) );
887
+
888
+ if ( empty( $attachments ) ) {
889
+ if ( 'attachment' == get_post_type( $post->ID ) ) {
890
+ $image = wp_get_attachment_image_src( $post->ID, 'large' );
891
+ }
892
+ }
893
+
894
+ /* If no attachments or image is found, return false. */
895
+ if ( empty( $attachments ) && empty( $image ) )
896
+ return false;
897
+
898
+ /* Set the default iterator to 0. */
899
+ $i = 0;
900
+
901
+ /* Loop through each attachment. Once the $order_of_image (default is '1') is reached, break the loop. */
902
+ foreach ( $attachments as $id => $attachment ) {
903
+ if ( ++$i == 1 ) {
904
+ $image = wp_get_attachment_image_src( $id, 'large' );
905
+ $alt = trim( strip_tags( get_post_field( 'post_excerpt', $id ) ) );
906
+ break;
907
+ }
908
+ }
909
+
910
+ /* Return the image URL. */
911
+ return $image[0];
912
+
913
+ }
914
+
915
+ function get_the_image_by_scan( $p = null ) {
916
+
917
+ if ( $p === null ) {
918
+ global $post;
919
+ } else {
920
+ $post = $p;
921
+ }
922
+
923
+ /* Search the post's content for the <img /> tag and get its URL. */
924
+ preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
925
+
926
+ /* If there is a match for the image, return its URL. */
927
+ if ( isset( $matches ) && !empty( $matches[1][0] ) )
928
+ return $matches[1][0];
929
+
930
+ return false;
931
+ }
932
+
933
  /** crude approximization of whether current user is an admin */
934
  function is_admin() {
935
  return current_user_can( 'level_8' );
943
  if ( function_exists( 'get_current_screen' ) )
944
  $screen = get_current_screen();
945
  if ( empty( $screen ) ) return;
946
+ if ( ( $screen->base != 'post' ) && ( $screen->base != 'edit-tags' ) && ( $screen->base != 'toplevel_page_shopp-products' ) ) return;
947
+ if ( $screen->base == 'edit-tags' ) $this->form = 'edittag';
948
  foreach( $this->locations as $k => $v ) {
949
  if ( $v['type'] === 'metabox' ) {
950
  if ( isset( $v['display'] ) && !empty( $v['display'] ) ) {
951
  if ( ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) )
952
  || in_array( $screen->post_type, $v['display'] ) ) {
953
+ add_filter( 'aioseop_localize_script_data', Array( $this, 'localize_script_data' ) );
954
+ add_action( "admin_print_scripts", Array( $this, 'enqueue_scripts' ), 20 );
955
+ add_action( "admin_print_scripts", Array( $this, 'enqueue_styles' ), 20 );
956
  }
957
  }
958
  }
983
  wp_enqueue_script( 'postbox' );
984
  if ( !empty( $this->pointers ) ) {
985
  wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
 
986
  }
987
  wp_enqueue_script( 'aioseop-module-script', $this->plugin_path['url'] . 'aioseop_module.js' );
988
  if ( !empty( $this->script_data ) ) {
989
+ aioseop_localize_script_data();
990
+ }
991
+ }
992
+
993
+ function localize_script_data( $data ) {
994
+ if ( !is_array( $data ) ) {
995
+ $data = Array( 0 => $data );
996
  }
997
+ if ( empty( $this->script_data ) ) $this->script_data = Array();
998
+ if ( !empty( $this->pointers ) )
999
+ $this->script_data['pointers'] = $this->pointers;
1000
+ if ( empty( $data[0]['condshow'] ) ) $data[0]['condshow'] = Array();
1001
+ if ( empty( $this->script_data['condshow'] ) ) $this->script_data['condshow'] = Array();
1002
+ $condshow = $this->script_data['condshow'];
1003
+ $data[0]['condshow'] = array_merge( $data[0]['condshow'], $condshow );
1004
+ unset( $this->script_data['condshow'] );
1005
+ $data[0] = array_merge( $this->script_data, $data[0] );
1006
+ $this->script_data['condshow'] = $condshow;
1007
+ return $data;
1008
  }
1009
 
1010
  /**
1035
  $this->pagehook = $this->substr( $hookname, 5 );
1036
  add_action( "admin_print_scripts", Array( $this, 'enqueue_scripts' ) );
1037
  add_action( "admin_print_styles", Array( $this, 'enqueue_styles' ) );
1038
+ add_filter( 'aioseop_localize_script_data', Array( $this, 'localize_script_data' ) );
1039
  add_action( $this->prefix . 'settings_header', Array( $this, 'display_tabs' ) );
1040
  }
1041
 
1128
  add_action( 'save_post', array( $this, 'save_post_data' ) );
1129
  add_action( 'edit_page_form', array( $this, 'save_post_data' ) );
1130
  if ( isset( $v['display'] ) && !empty( $v['display'] ) ) {
1131
+ add_action( "admin_print_scripts", Array( $this, 'enqueue_metabox_scripts' ), 5 );
1132
  if ( $this->tabbed_metaboxes )
1133
  add_filter( 'aioseop_add_post_metabox', Array( $this, 'filter_return_metaboxes' ) );
1134
  foreach ( $v['display'] as $posttype ) {
1143
  $title = $v['name'];
1144
  if ( $title != $this->plugin_name ) $title = $this->plugin_name . ' - ' . $title;
1145
  if ( !empty( $v['help_link'] ) )
1146
+ $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'><span>" . __( 'Help', 'all_in_one_seo_pack' ) . "</span></a>";
1147
  add_meta_box( $v['prefix'] . $k, $title, Array( $this, 'display_metabox' ), $posttype, $v['context'], $v['priority'], $v );
1148
  }
1149
  }
1252
  $onload = '';
1253
  if ( !empty( $options['count'] ) ) {
1254
  $n++;
1255
+ $attr .= " onKeyDown='countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)' onKeyUp='countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)'";
1256
+ $onload = "countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n);";
1257
  }
1258
  if ( isset( $opts['id'] ) ) $attr .= " id=\"{$opts['id']}\" ";
1259
  switch ( $options['type'] ) {
1283
  $count_desc = __( ' characters. Most search engines use a maximum of %s chars for the %s.', 'all_in_one_seo_pack' );
1284
  $buf .= "<br /><input readonly type='text' name='{$prefix}length$n' size='3' maxlength='3' style='width:53px;height:23px;margin:0px;padding:0px 0px 0px 10px;' value='" . $this->strlen($value) . "' />"
1285
  . sprintf( $count_desc, $size, $this->strtolower( $options['name'] ) );
1286
+ if ( !empty( $onload ) ) $buf .= "<script>jQuery( document ).ready(function() { {$onload} });</script>";
1287
  }
1288
  return $buf;
1289
  }
1333
  }
1334
  }
1335
  if ( !empty( $help_link ) )
1336
+ echo "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $help_link . "'><span>" . __( 'Help', 'all_in_one_seo_pack' ) . "</span></a>";
1337
 
1338
  if ( !isset( $location_settings[$prefix] ) ) {
1339
  $current_options = apply_filters( "{$this->prefix}display_options", $this->get_current_options( Array(), $location, $defaults ), $location );
1519
  if ( !isset( $lopts['tab'] ) || ( $this->current_tab == $lopts['tab'] ) ) {
1520
  $title = $lopts['name'];
1521
  if ( !empty( $lopts['help_link'] ) )
1522
+ $title .= "<a class='aioseop_help_text_link aioseop_meta_box_help' target='_blank' href='" . $lopts['help_link'] . "'><span>" . __( 'Help', 'all_in_one_seo_pack' ) . "</span></a>";
1523
  add_meta_box( $this->get_prefix( $location ) . $l . "_metabox", $title, array($this, 'display_options' ),
1524
  "{$this->prefix}settings", 'advanced', 'default', $lopts );
1525
  }
1632
  global $post;
1633
  }
1634
  if ( isset( $post ) ) {
1635
+ $get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
 
1636
  }
1637
  }
1638
  $defs = $this->default_options( $location, $defaults );
aioseop_opengraph.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * @package All-in-One-SEO-Pack
4
  */
5
  /**
6
  * The Opengraph class.
@@ -248,7 +248,18 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
248
  $opts = Array( 'title', 'desc' );
249
  $current_post_type = get_post_type();
250
  if ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
251
- $settings[$prefix . 'category']['initial_options'] = array_merge( Array( '' => 'Default - ' . $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ), $settings[$prefix . 'category']['initial_options'] );
 
 
 
 
 
 
 
 
 
 
 
252
  }
253
  if ( isset( $this->options["aiosp_opengraph_defcard"] ) ) {
254
  $settings[$prefix . 'setcard']['default'] = $this->options["aiosp_opengraph_defcard"];
@@ -300,11 +311,12 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
300
  $buf .= '</div></div></div>';
301
  return $buf;
302
  }
303
-
304
  function add_attributes( $output ) { // avoid having duplicate meta tags
305
  if ( !empty( $this->options[ 'aiosp_opengraph_disable_jetpack' ] ) ) {
306
  remove_action( 'wp_head', 'jetpack_og_tags' );
307
- add_filter( 'jetpack_enable_open_graph', '__return_false', 99 );
 
308
  }
309
  foreach( Array( 'xmlns="http://www.w3.org/1999/xhtml"', 'xmlns:og="http://ogp.me/ns#"', 'xmlns:fb="http://www.facebook.com/2008/fbml"' ) as $xmlns ) {
310
  if ( strpos( $output, $xmlns ) === false ) {
@@ -461,6 +473,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
461
  if ( !empty( $post ) && isset( $post->post_author ) && !empty( $this->options['aiosp_opengraph_twitter_creator'] ) )
462
  $creator = get_the_author_meta( 'twitter', $post->post_author );
463
 
 
 
 
 
464
  $meta = Array(
465
  'facebook' => Array(
466
  'title' => 'og:title',
@@ -563,80 +579,17 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
563
  $this->setting_options();
564
  }
565
 
566
- function get_all_images( $options = null ) {
567
  static $img = Array();
 
 
 
568
  if ( empty( $img ) ) {
569
  $size = apply_filters( 'post_thumbnail_size', 'large' );
570
  $default = $this->get_the_image_by_default();
571
  if ( !empty( $default ) )
572
- $img[$default] = 0;
573
- global $post, $aioseop_options, $wp_query;
574
-
575
- $count = 1;
576
-
577
- if ( !empty( $post ) ) {
578
- if ( !is_object( $post ) ) $post = get_post( $post );
579
- if ( is_object( $post ) && function_exists('get_post_thumbnail_id' ) ) {
580
- if ( $post->post_type == 'attachment' )
581
- $post_thumbnail_id = $post->ID;
582
- else
583
- $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
584
- if ( !empty( $post_thumbnail_id ) ) {
585
- $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
586
- if ( is_array( $image ) )
587
- $img[$image[0]] = 1;
588
- }
589
- }
590
-
591
- $post_id = $post->ID;
592
- $p = $post; $w = $wp_query;
593
-
594
- if ( !empty( $this->options['aiosp_opengraph_meta_key'] ) )
595
- $meta_key = $this->options['aiosp_opengraph_meta_key'];
596
- if ( !empty( $meta_key ) ) {
597
- $image = $this->get_the_image_by_meta_key( Array( 'post_id' => $post_id, 'meta_key' => $meta_key ) );
598
- if ( !empty( $image ) )
599
- $img[$image] = $meta_key;
600
- }
601
- if (! $post->post_modified_gmt != '' )
602
- $wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
603
- if ( $post->post_type == 'page' )
604
- $wp_query->is_page = true;
605
- elseif ( $post->post_type == 'attachment' )
606
- $wp_query->is_attachment = true;
607
- else
608
- $wp_query->is_single = true;
609
- if ( get_option( 'show_on_front' ) == 'page' ) {
610
- if ( is_page() && $post->ID == get_option( 'page_on_front' ) )
611
- $wp_query->is_front_page = true;
612
- elseif ( $post->ID == get_option( 'page_for_posts' ) )
613
- $wp_query->is_home = true;
614
- }
615
- $args['options']['type'] = 'html';
616
- $args['options']['nowrap'] = false;
617
- $args['options']['save'] = false;
618
- $wp_query->queried_object = $post;
619
-
620
- $attachments = get_children( Array( 'post_parent' => $post->ID,
621
- 'post_status' => 'inherit',
622
- 'post_type' => 'attachment',
623
- 'post_mime_type' => 'image',
624
- 'order' => 'ASC',
625
- 'orderby' => 'menu_order ID' ) );
626
- if ( !empty( $attachments ) )
627
- foreach( $attachments as $id => $attachment ) {
628
- $image = wp_get_attachment_image_src( $id, $size );
629
- if ( is_array( $image ) )
630
- $img[$image[0]] = $id;
631
- }
632
- $matches = Array();
633
- preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
634
- if ( isset( $matches ) && !empty( $matches[1] ) && !empty( $matches[1][0] ) )
635
- foreach( $matches[1] as $i => $m )
636
- $img[$m] = 'post' . $count++;
637
- wp_reset_postdata();
638
- $wp_query = $w; $post = $p;
639
- }
640
  }
641
 
642
  if ( !empty( $options ) && !empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
@@ -649,107 +602,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
649
  $images[$v] = '<img height=150 src="' . $v . '">';
650
  return Array( $image, $images );
651
  }
652
-
653
- /*** Thanks to Justin Tadlock for the original get-the-image code - http://themehybrid.com/plugins/get-the-image ***/
654
-
655
- function get_the_image( ) {
656
- global $post;
657
  $meta_key = $this->options['aiosp_opengraph_meta_key'];
658
- if ( !empty( $meta_key ) && !empty( $post ) ) {
659
- $meta_key = explode( ',', $meta_key );
660
- $image = $this->get_the_image_by_meta_key( Array( 'post_id' => $post->ID, 'meta_key' => $meta_key ) );
661
- }
662
- if ( empty( $image ) ) $image = $this->get_the_image_by_post_thumbnail( );
663
- if ( empty( $image ) ) $image = $this->get_the_image_by_attachment( );
664
- if ( empty( $image ) ) $image = $this->get_the_image_by_scan( );
665
- if ( empty( $image ) ) $image = $this->get_the_image_by_default( );
666
- return $image;
667
- }
668
-
669
- function get_the_image_by_meta_key( $args = array() ) {
670
-
671
- /* If $meta_key is not an array. */
672
- if ( !is_array( $args['meta_key'] ) )
673
- $args['meta_key'] = array( $args['meta_key'] );
674
-
675
- /* Loop through each of the given meta keys. */
676
- foreach ( $args['meta_key'] as $meta_key ) {
677
- /* Get the image URL by the current meta key in the loop. */
678
- $image = get_post_meta( $args['post_id'], $meta_key, true );
679
- /* If a custom key value has been given for one of the keys, return the image URL. */
680
- if ( !empty( $image ) )
681
- return $image;
682
- }
683
- return false;
684
- }
685
-
686
- function get_the_image_by_post_thumbnail( ) {
687
-
688
- global $post;
689
-
690
- $post_thumbnail_id = null;
691
- if ( function_exists('get_post_thumbnail_id' ) ) {
692
- $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
693
- }
694
-
695
- if ( empty( $post_thumbnail_id ) )
696
- return false;
697
-
698
- $size = apply_filters( 'post_thumbnail_size', 'large' );
699
- $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
700
- return $image[0];
701
- }
702
-
703
- function get_the_image_by_attachment( $args = array() ) {
704
-
705
- global $post;
706
- $attachments = get_children( Array( 'post_parent' => $post->ID,
707
- 'post_status' => 'inherit',
708
- 'post_type' => 'attachment',
709
- 'post_mime_type' => 'image',
710
- 'order' => 'ASC',
711
- 'orderby' => 'menu_order ID' ) );
712
-
713
- if ( empty( $attachments ) ) {
714
- if ( 'attachment' == get_post_type( $post->ID ) ) {
715
- $image = wp_get_attachment_image_src( $post->ID, 'large' );
716
- }
717
- }
718
-
719
- /* If no attachments or image is found, return false. */
720
- if ( empty( $attachments ) && empty( $image ) )
721
- return false;
722
-
723
- /* Set the default iterator to 0. */
724
- $i = 0;
725
-
726
- /* Loop through each attachment. Once the $order_of_image (default is '1') is reached, break the loop. */
727
- foreach ( $attachments as $id => $attachment ) {
728
- if ( ++$i == 1 ) {
729
- $image = wp_get_attachment_image_src( $id, 'large' );
730
- $alt = trim( strip_tags( get_post_field( 'post_excerpt', $id ) ) );
731
- break;
732
- }
733
- }
734
-
735
- /* Return the image URL. */
736
- return $image[0];
737
-
738
- }
739
-
740
- function get_the_image_by_scan( ) {
741
-
742
- global $post;
743
-
744
- /* Search the post's content for the <img /> tag and get its URL. */
745
- preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', get_post_field( 'post_content', $post->ID ), $matches );
746
-
747
- /* If there is a match for the image, return its URL. */
748
- if ( isset( $matches ) && !empty( $matches[1][0] ) )
749
- return $matches[1][0];
750
-
751
- return false;
752
-
753
  }
754
 
755
  function get_the_image_by_default( $args = array() ) {
1
  <?php
2
  /**
3
+ * @package All-in-One-SEO-Pack
4
  */
5
  /**
6
  * The Opengraph class.
248
  $opts = Array( 'title', 'desc' );
249
  $current_post_type = get_post_type();
250
  if ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
251
+ $flat_type_list = Array();
252
+ foreach( $this->fb_object_types as $k => $v ) {
253
+ if ( is_array( $v ) ) {
254
+ $flat_type_list = array_merge( $flat_type_list, $v );
255
+ } else {
256
+ $flat_type_list[$k] = $v;
257
+ }
258
+ }
259
+ $settings[$prefix . 'category']['initial_options'] = array_merge( Array(
260
+ $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] => __( 'Default ', 'all_in_one_seo_pack' ) . ' - '
261
+ . $flat_type_list[ $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ] ),
262
+ $settings[$prefix . 'category']['initial_options'] );
263
  }
264
  if ( isset( $this->options["aiosp_opengraph_defcard"] ) ) {
265
  $settings[$prefix . 'setcard']['default'] = $this->options["aiosp_opengraph_defcard"];
311
  $buf .= '</div></div></div>';
312
  return $buf;
313
  }
314
+
315
  function add_attributes( $output ) { // avoid having duplicate meta tags
316
  if ( !empty( $this->options[ 'aiosp_opengraph_disable_jetpack' ] ) ) {
317
  remove_action( 'wp_head', 'jetpack_og_tags' );
318
+ add_filter( 'jetpack_enable_open_graph', '__return_false', 100 );
319
+ add_filter( 'jetpack_disable_twitter_cards', '__return_false', 100 );
320
  }
321
  foreach( Array( 'xmlns="http://www.w3.org/1999/xhtml"', 'xmlns:og="http://ogp.me/ns#"', 'xmlns:fb="http://www.facebook.com/2008/fbml"' ) as $xmlns ) {
322
  if ( strpos( $output, $xmlns ) === false ) {
473
  if ( !empty( $post ) && isset( $post->post_author ) && !empty( $this->options['aiosp_opengraph_twitter_creator'] ) )
474
  $creator = get_the_author_meta( 'twitter', $post->post_author );
475
 
476
+ if ( !empty( $site ) && $site[0] != '@' ) $site = '@' . $site;
477
+
478
+ if ( !empty( $creator ) && $creator[0] != '@' ) $creator = '@' . $creator;
479
+
480
  $meta = Array(
481
  'facebook' => Array(
482
  'title' => 'og:title',
579
  $this->setting_options();
580
  }
581
 
582
+ function get_all_images( $options = null, $p = null ) {
583
  static $img = Array();
584
+ if ( !is_array( $options ) ) $options = Array();
585
+ if ( !empty( $this->options['aiosp_opengraph_meta_key'] ) )
586
+ $options['meta_key'] = $this->options['aiosp_opengraph_meta_key'];
587
  if ( empty( $img ) ) {
588
  $size = apply_filters( 'post_thumbnail_size', 'large' );
589
  $default = $this->get_the_image_by_default();
590
  if ( !empty( $default ) )
591
+ $img[$default] = 0;
592
+ $img = array_merge( $img, parent::get_all_images( $options, null ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  }
594
 
595
  if ( !empty( $options ) && !empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
602
  $images[$v] = '<img height=150 src="' . $v . '">';
603
  return Array( $image, $images );
604
  }
605
+
606
+ function get_the_image( $options = null, $p = null ) {
 
 
 
607
  $meta_key = $this->options['aiosp_opengraph_meta_key'];
608
+ return parent::get_the_image( Array( 'meta_key' => $meta_key ), $p );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
  }
610
 
611
  function get_the_image_by_default( $args = array() ) {
aioseop_robots.php ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package All-in-One-SEO-Pack
4
+ */
5
+ /**
6
+ * The Robots class.
7
+ */
8
+ if ( !class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
9
+ class All_in_One_SEO_Pack_Robots extends All_in_One_SEO_Pack_Module {
10
+
11
+ function All_in_One_SEO_Pack_Robots( ) {
12
+ $this->name = __('Robots.txt', 'all_in_one_seo_pack'); // Human-readable name of the plugin
13
+ $this->prefix = 'aiosp_robots_'; // option prefix
14
+ $this->file = __FILE__; // the current file
15
+ parent::__construct();
16
+
17
+ $help_text = Array(
18
+ 'additional'=> __('Rule Type', 'all_in_one_seo_pack'),
19
+ 'useragent' => __('User Agent', 'all_in_one_seo_pack'),
20
+ 'path' => __('Directory Path', 'all_in_one_seo_pack'),
21
+ 'robotgen' => __('Robots.txt editor', 'all_in_one_seo_pack'),
22
+ );
23
+
24
+ $this->default_options = array(
25
+ 'usage' => Array( 'type' => 'html', 'label' => 'none',
26
+ 'default' => __( 'Use the rule builder below to add rules to create a new Robots.txt file.  If you already have a Robots.txt file you should use the File Editor feature in All in One SEO Pack to edit it or you can delete your current Robots.txt file and start a new one with the rule builder below.', 'all_in_one_seo_pack' ),
27
+ 'save' => false ),
28
+ 'additional'=> Array( 'name' => __( 'Rule Type', 'all_in_one_seo_pack' ),
29
+ 'save' => false,
30
+ 'type' => 'select', 'initial_options' => Array( 'allow' => 'Allow', 'block' => 'Block' ) ),
31
+ 'useragent' => Array( 'name' => __( 'User Agent', 'all_in_one_seo_pack' ),
32
+ 'save' => false,
33
+ 'type' => 'text' ),
34
+ 'path' => Array( 'name' => __( 'Directory Path', 'all_in_one_seo_pack' ),
35
+ 'save' => false,
36
+ 'type' => 'text' ),
37
+ 'robotgen' => Array( 'name' => __( 'Generate Robots.txt', 'all_in_one_seo_pack'),
38
+ 'save' => false,
39
+ 'default' => '', 'type' => 'textarea', 'cols' => 57, 'rows' => 20, 'label' => 'none', 'readonly' => 'readonly' ),
40
+ 'Submit_Preview' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Add Rule', 'all_in_one_seo_pack' ) . ' &raquo;', 'nowrap' => 1, 'style' => 'margin-left: 20px;' ),
41
+ 'Submit_Update' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Save Robots.txt File', 'all_in_one_seo_pack' ) . ' &raquo;', 'nowrap' => 1 ),
42
+ 'Submit_Delete' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Delete Robots.txt File', 'all_in_one_seo_pack' ) . ' &raquo;', 'nowrap' => 1 ),
43
+ 'optusage' => Array( 'type' => 'html', 'label' => 'none',
44
+ 'default' => __( 'Click the Optimize button below and All in One SEO Pack will analyze your Robots.txt file to make sure it complies with the standards for Robots.txt files.  The results will be displayed in a table below.', 'all_in_one_seo_pack' ),
45
+ 'save' => false ),
46
+ 'Submit_Opt_Update' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Update Robots.txt File', 'all_in_one_seo_pack' ) . ' &raquo;', 'nowrap' => 1, 'style' => 'margin-left: 20px;' ),
47
+ 'Submit_Opt_Preview' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __( 'Disregard Changes', 'all_in_one_seo_pack' ) . ' &raquo;', 'nowrap' => 1),
48
+ 'Submit_Optimize' => Array( 'type' => 'submit', 'class' => 'button-primary', 'name' => __('Optimize', 'all_in_one_seo_pack') . ' &raquo;' )
49
+ );
50
+
51
+ if ( !empty( $help_text ) )
52
+ foreach( $help_text as $k => $v )
53
+ $this->default_options[$k]['help_text'] = $v;
54
+
55
+ $this->locations = array( 'generator' => Array( 'name' => "Robots.txt", 'type' => 'settings',
56
+ 'options' => Array( 'usage', 'additional', 'useragent', 'path', 'Submit_Preview', 'Submit_Update', 'Submit_Delete', 'robotgen', 'optusage', 'Submit_Opt_Update', 'Submit_Opt_Preview', 'Submit_Optimize' ) ),
57
+ );
58
+
59
+ $this->layout = Array(
60
+ 'default' => Array(
61
+ 'name' => __( 'Create a Robots.txt File', 'all_in_one_seo_pack' ),
62
+ 'options' => Array( 'usage', 'additional', 'useragent', 'path', 'Submit_Preview', 'Submit_Update', 'Submit_Delete', 'robotgen' ) // this is set below, to the remaining options -- pdb
63
+ )
64
+ );
65
+ $this->layout['optimize'] = Array(
66
+ 'name' => __( 'Optimize your Robots.txt File', 'all_in_one_seo_pack' ),
67
+ 'options' => Array( 'optusage', 'Submit_Optimize' )
68
+ );
69
+ if ( isset( $_POST['Submit_Optimize'] ) ) {
70
+ $this->layout['optimize']['options'] = Array( 'optusage', 'Submit_Opt_Update', 'Submit_Opt_Preview', 'robothtml' );
71
+ $this->default_options['optusage']['default'] = __( "Your Robots.txt file has been optimized.  Here are the results and recommendations.  Click the Update Robots.txt File button below to write these changes to your Robots.txt file.  Click the Disregard Changes button to ignore these recommendations and keep your current Robots.txt file.", 'all_in_one_seo_pack' );
72
+ }
73
+
74
+ // load initial options / set defaults
75
+ $this->update_options( );
76
+
77
+ add_action( $this->prefix . 'settings_update', Array( $this, 'do_robots' ), 10, 2 );
78
+ add_filter( $this->prefix . 'display_options', Array( $this, 'filter_options' ), 10, 2 );
79
+ add_filter( $this->prefix . 'submit_options', Array( $this, 'filter_submit' ), 10, 2 );
80
+ add_filter( $this->prefix . 'display_settings', Array( $this, 'filter_settings' ), 10, 2 );
81
+ }
82
+
83
+ function filter_settings( $settings, $location ) {
84
+ if ( $location == 'generator' ) {
85
+ $prefix = $this->get_prefix( $location ) . $location . '_';
86
+ if ( isset( $_POST['Submit_Optimize'] ) ) {
87
+ if ( isset( $settings[ $prefix . 'robotgen' ] ) ) {
88
+ $settings[ $prefix . 'robotgen' ]['type'] = 'hidden';
89
+ $settings[ $prefix . 'robotgen' ]['label'] = 'none';
90
+ $settings[ $prefix . 'robotgen' ]['help_text'] = '';
91
+ $settings[ $prefix . 'robothtml'] = Array( 'name' => __( 'Robots.txt', 'all_in_one_seo_pack'),
92
+ 'save' => false, 'default' => '', 'type' => 'html', 'label' => 'none', 'style' => 'margin-top:10px;' );
93
+ }
94
+ }
95
+ }
96
+ return $settings;
97
+ }
98
+
99
+ function filter_submit( $submit, $location ) {
100
+ if ( $location == 'generator' ) {
101
+ unset( $submit['Submit_Default'] );
102
+ $submit['Submit']['type'] = 'hidden';
103
+ }
104
+ return $submit;
105
+ }
106
+
107
+ function filter_options( $options, $location ) {
108
+ if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_';
109
+ if ( $location === 'generator' ) {
110
+ $optimize = false;
111
+ $robotgen = '';
112
+ if ( !empty( $_POST[$prefix . 'robotgen'] ) ) $robotgen = str_replace( "\r\n", "\n", $_POST[$prefix . 'robotgen'] );
113
+ if ( isset( $_POST['Submit_Preview'] ) ) $options[$prefix . 'robotgen'] = $robotgen;
114
+ if ( !isset( $_POST['Submit_Preview'] ) ) {
115
+ if ( isset( $_POST['Submit_Optimize'] ) && !isset( $_POST['Submit_Delete'] ) && !isset( $_POST['Submit_Update'] ) && !isset( $_POST['Submit_Opt_Update'] ) )
116
+ $optimize = true;
117
+ if ( !isset( $options[$prefix . 'robotgen'] ) || empty( $options[$prefix . 'robotgen'] ) ) {
118
+ if ( $optimize ) $options[$prefix . 'robotgen'] = $robotgen;
119
+ if ( empty( $options[$prefix . 'robotgen'] ) )
120
+ $options = $this->load_files( $options, Array( 'robotgen' => 'robots.txt' ), $prefix );
121
+ }
122
+ }
123
+ $access = ( get_option('blog_public') ) ? 'allow' : 'block';
124
+ if ( $access ) {
125
+ $allow_rule = "User-agent: *\nDisallow: /wp-admin/\nDisallow: /wp-includes/\nDisallow: /xmlrpc.php\n\n";
126
+ $block_rule = "User-agent: *\nDisallow: /\n\n";
127
+ if ( empty( $options[$prefix . 'robotgen'] ) ) $options[$prefix . 'robotgen'] = '';
128
+ if ( isset( $_POST['Submit_Preview'] ) && ( ( $options[$prefix . 'robotgen'] == $allow_rule ) ||
129
+ ( $options[$prefix . 'robotgen'] == $block_rule ) ) )
130
+ $options[$prefix . 'robotgen'] = '';
131
+ if ( $access === 'block' && empty( $options[$prefix . 'robotgen'] ) )
132
+ $options[$prefix . 'robotgen'] .= $block_rule;
133
+ elseif ( $access === 'allow' && empty( $options[$prefix . 'robotgen'] ) )
134
+ $options[$prefix . 'robotgen'] .= $allow_rule;
135
+ }
136
+ foreach ( Array( 'ad' => 'additional', 'ua' => 'useragent', 'dp' => 'path' ) as $k => $v )
137
+ if ( isset( $_POST[$prefix . $v] ) ) $$k = $_POST[$prefix . $v];
138
+ if ( !empty( $ad ) && !empty( $ua ) && !empty( $dp ) ) {
139
+ if ( $ad === 'allow' )
140
+ $ad = "Allow: ";
141
+ else
142
+ $ad = "Disallow: ";
143
+ $options[$prefix . 'robotgen'] .= "User-agent: $ua\n$ad $dp\n\n";
144
+ }
145
+ $file = explode("\n", $options[$prefix . 'robotgen'] );
146
+ if ( $optimize ) {
147
+ $rules = $this->parse_robots( $file );
148
+ $user_agents = $this->get_robot_user_agents( $rules );
149
+ foreach ($user_agents as $ua => $rules) {
150
+ $user_agents[$ua]['disallow'] = $this->opt_robot_rule($rules['disallow']);
151
+ $user_agents[$ua]['allow'] = $this->opt_robot_rule($rules['allow']);
152
+ }
153
+ $rules = $this->flatten_user_agents( $user_agents );
154
+ unset($user_agents);
155
+ foreach ($rules as $r) {
156
+ $r['disallow'] = $this->opt_robot_rule( $r['disallow'] );
157
+ $r['allow'] = $this->opt_robot_rule( $r['allow'] );
158
+ }
159
+ $options[$prefix . 'robotgen'] = $this->output_robots($rules);
160
+ $file2 = explode("\n", $options[$prefix . 'robotgen'] );
161
+ $options[$prefix . 'robothtml'] = '<table width=100%><tr><td valign=top width=45%>' . $this->annotate_robots_html( $file, true, __( "Current File", 'all_in_one_seo_pack' ) ) . '</td><td><span style="font-size: xx-large">&#8594;</span></td><td valign=top>' . $this->annotate_robots_html( $file2, true, __( "Proposed Changes", 'all_in_one_seo_pack' ) ) . '</td></tr></table>';
162
+ } else {
163
+ $options[$prefix . 'robothtml'] = $this->annotate_robots_html( $file, true, __( "Current File", 'all_in_one_seo_pack' ) );
164
+ }
165
+ }
166
+ return $options;
167
+ }
168
+
169
+ function do_robots( $options, $location ) {
170
+ if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_';
171
+ if ( $location === 'generator' ) {
172
+ if ( isset( $_POST['Submit_Update'] ) || isset( $_POST['Submit_Opt_Update'] ) ) {
173
+ $this->save_files( Array( 'robotgen' => 'robots.txt' ), $prefix );
174
+ } elseif (isset( $_POST['Submit_Delete'] ) ) {
175
+ $this->delete_files( Array( 'robotgen' => 'robots.txt' ) );
176
+ }
177
+ }
178
+ }
179
+
180
+ function annotate_robots_html( $file, $show_help = false, $title = '' ) {
181
+ $robots = $this->annotate_robots( $file );
182
+ if( !empty( $robots ) ){
183
+ $buf = '<table class="widefat" ><thead>';
184
+ if ( !empty( $title ) ) {
185
+ $buf .= "<tr><th colspan=3>" . $title . "</th></tr>";
186
+ }
187
+ $buf .= '<tr class="aioseop_optimize_thread">';
188
+ $buf .= '<th style="width:5%;"></th><th style="width:78%;"><span class="column_label" >Parameter</span></th>';
189
+ $buf .= '<th><span class="" >Status</span></th></tr></thead>';
190
+ $buf .= "<tbody>";
191
+
192
+ foreach ( $robots as $r ) {
193
+ $class = 'robots';
194
+ $status = "#9cf975";
195
+ $help = '';
196
+ if ( !$r['valid'] || !$r['strict'] ) {
197
+ if ( !$r['strict']) {
198
+ $class .= ' quirks';
199
+ $status="yellow";
200
+ }
201
+ if ( !$r['valid'] ) {
202
+ $class .= ' invalid';
203
+ $status="#f9534a";
204
+ }
205
+ if ( $show_help ) {
206
+ $help = '<a style="cursor:pointer;" class="' . $class . '" title="Click for Help!" onclick="toggleVisibility(\'aiosp_robots_main_legend_tip\');" title="Click for Help">'
207
+ . '<div class="aioseop_tip_icon"></div></a>';
208
+ }
209
+ }
210
+ $buf .= "<tr class='entry-row {$class}'><td>{$help}</td><td><span class='entry_label'>{$r['content']}</td><td><div style='background:{$status};'></div></td></tr>";
211
+ }
212
+ $buf .= '</tbody>';
213
+
214
+ $buf .= '</table>';
215
+ if ( $show_help ) {
216
+ $buf .= '<div class="aioseop_option_docs" id="aiosp_robots_main_legend_tip">
217
+ <h3>' . __( 'Legend', 'all_in_one_seo_pack' ) . '</h3>
218
+ <ul>
219
+ <li>' . __( 'The yellow indicator means that a non-standard extension was recognized; not all crawlers may recognize it or interpret it the same way. The Allow and Sitemap directives are commonly used by Google and Yahoo.', 'all_in_one_seo_pack' ) . '</li>
220
+ <li>' . __( 'The red indicator means that the syntax is invalid for a robots.txt file.', 'all_in_one_seo_pack') . '</li>
221
+ </ul>
222
+ <a target="_blank" rel="nofollow" href="http://wikipedia.org/wiki/Robots_exclusion_standard#Nonstandard_extensions">' . __('More Information', 'all_in_one_seo_pack') . '</a>
223
+ </div>';
224
+ }
225
+ } else {
226
+ $buf = '<p class="aioseop_error_notice" ><strong>Your Robots.txt file is either empty, cannot be found, or has invalid data.</strong></p>';
227
+ }
228
+ return $buf;
229
+ }
230
+
231
+ function annotate_robots( $robots ) {
232
+ $state = 0;
233
+ $rules = Array();
234
+ foreach ($robots as $l) {
235
+ $l = trim($l);
236
+ if (empty($l[0])) {
237
+ if ( $state > 1 ) {
238
+ $rules[] = Array( 'state' => 0, 'type' => 'blank', 'content' => $l, 'valid' => true, 'strict' => true );
239
+ $state = 0;
240
+ }
241
+ } elseif ($l[0] === '#') {
242
+ if ($state < 1) $state = 1;
243
+ $rules[] = Array( 'state' => $state, 'type' => 'comment', 'content' => $l, 'valid' => true, 'strict' => true );
244
+ } elseif ( stripos($l, 'sitemap') === 0) {
245
+ $state = 2;
246
+ $rules[] = Array( 'state' => $state, 'type' => 'sitemap', 'content' => $l, 'valid' => true, 'strict' => false );
247
+ } elseif ( stripos($l, 'crawl-delay') === 0) {
248
+ $state = 3;
249
+ $rules[] = Array( 'state' => $state, 'type' => 'crawl-delay', 'content' => $l, 'valid' => true, 'strict' => false );
250
+ } elseif ( stripos($l, 'user-agent') === 0) {
251
+ $state = 3;
252
+ $rules[] = Array( 'state' => $state, 'type' => 'user-agent', 'content' => $l, 'valid' => true, 'strict' => true );
253
+ } elseif ( stripos($l, 'useragent') === 0) {
254
+ $state = 3;
255
+ $rules[] = Array( 'state' => $state, 'type' => 'user-agent', 'content' => $l, 'valid' => true, 'strict' => false );
256
+ } elseif ( stripos($l, 'disallow') === 0) {
257
+ if ($state < 3) {
258
+ $rules[] = Array( 'state' => $state, 'type' => 'disallow', 'content' => $l, 'valid' => false, 'strict' => false );
259
+ continue;
260
+ }
261
+ $state = 3;
262
+ $rules[] = Array( 'state' => $state, 'type' => 'disallow', 'content' => $l, 'valid' => true, 'strict' => true );
263
+ } elseif ( stripos($l, 'allow') === 0) {
264
+ if ($state < 3) {
265
+ $rules[] = Array( 'state' => $state, 'type' => 'allow', 'content' => $l, 'valid' => false, 'strict' => false );
266
+ continue;
267
+ }
268
+ $state = 3;
269
+ $rules[] = Array( 'state' => $state, 'type' => 'allow', 'content' => $l, 'valid' => true, 'strict' => false );
270
+ } else {
271
+ $rules[] = Array( 'state' => $state, 'type' => 'unknown', 'content' => $l, 'valid' => false, 'strict' => false );
272
+ }
273
+ }
274
+ return $rules;
275
+ }
276
+
277
+ function parse_annotated_robots( $robots ) {
278
+ $state = 0;
279
+ $rules = Array();
280
+ $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
281
+ $rule = Array();
282
+ foreach ( $opts as $o ) $rule[$o] = Array();
283
+ $blank_rule = $rule;
284
+ foreach ($robots as $l) {
285
+ switch ( $l['type'] ) {
286
+ case 'blank':
287
+ if ( $state >= 1 ) {
288
+ if ( ( $state === 1 ) && ( empty($rule['user-agent'] ) ) ) $rule['user-agent'] = Array( null );
289
+ $rules[] = $rule;
290
+ $rule = $blank_rule;
291
+ }
292
+ continue;
293
+ case 'comment':
294
+ $rule['comment'][] = $l['content'];
295
+ continue;
296
+ case 'sitemap':
297
+ $rule['sitemap'][] = trim( substr($l['content'], 8) );
298
+ break;
299
+ case 'crawl-delay':
300
+ $rule['crawl-delay'][] = trim( substr($l['content'], 12) );
301
+ break;
302
+ case 'user-agent':
303
+ if ($l['strict'])
304
+ $ua = trim( substr($l['content'], 11) );
305
+ else
306
+ $ua = trim( substr($l['content'], 10) );
307
+ $rule['user-agent'][] = $ua;
308
+ break;
309
+ case 'disallow':
310
+ if ($l['valid']) {
311
+ $rule['disallow'][] = trim( substr($l['content'], 9) );
312
+ break;
313
+ }
314
+ continue;
315
+ case 'allow':
316
+ if ($l['valid']) {
317
+ $rule['allow'][] = trim( substr($l['content'], 6) );
318
+ break;
319
+ }
320
+ continue;
321
+ case 'unknown':
322
+ default:
323
+ }
324
+ $state = $l['state'];
325
+ }
326
+ if ( ( $state === 1 ) && ( empty($rule['user-agent'] ) ) ) $rule['user-agent'] = Array( null );
327
+ if ($state >= 1) $rules[] = $rule;
328
+ return $rules;
329
+ }
330
+
331
+ function parse_robots( $robots ) {
332
+ return $this->parse_annotated_robots ( $this->annotate_robots( $robots ) );
333
+ }
334
+
335
+ function get_robot_user_agents($rules) {
336
+ $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
337
+ $user_agents = Array();
338
+ foreach ($rules as $r) {
339
+ if ( !empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) $r['user-agent'] = Array( null );
340
+ foreach ($r['user-agent'] as $ua) {
341
+ if (!isset($user_agents[$ua])) $user_agents[$ua] = Array();
342
+ foreach ( $opts as $o ) {
343
+ if (!isset($user_agents[$ua][$o]))
344
+ $user_agents[$ua][$o] = $r[$o];
345
+ else
346
+ $user_agents[$ua][$o] = array_merge( $user_agents[$ua][$o], $r[$o] );
347
+ }
348
+ }
349
+ }
350
+ return $user_agents;
351
+ }
352
+
353
+ function flatten_user_agents( $user_agents ) {
354
+ $rules = Array();
355
+ foreach ($user_agents as $ua => $r) {
356
+ $r['user-agent'] = Array( $ua );
357
+ $rules[] = $r;
358
+ }
359
+ return $rules;
360
+ }
361
+
362
+ function opt_robot_rule($dis) {
363
+ if ( is_array($dis) ) { // unique rules only
364
+ $dis = array_unique( $dis, SORT_STRING );
365
+ $pd = null;
366
+ foreach( $dis as $k => $d ) {
367
+ $d = trim($d);
368
+ if ( !empty($pd) && !empty($d) ) {
369
+ if ( strpos( $d, $pd ) === 0 ) {
370
+ unset($dis[$k]);
371
+ continue; // get rid of subpaths of $pd
372
+ }
373
+ }
374
+ $l = strlen($d);
375
+ if ( ($l > 0) && ($d[$l - 1] !== '/')) continue;
376
+ $pd = $d; // only allow directory paths for $pd
377
+ }
378
+ }
379
+ return $dis;
380
+ }
381
+
382
+ function output_robots($rules) {
383
+ $robots = '';
384
+ foreach ($rules as $r) {
385
+ foreach ( $r['comment'] as $c) $robots .= "$c\n";
386
+ foreach ( $r['user-agent'] as $u) if ( $u != '' ) $robots .= "User-agent: $u\n";
387
+ foreach ( $r['crawl-delay'] as $c) $robots .= "Crawl-Delay: $c\n";
388
+ foreach ( $r['allow'] as $a) $robots .= "Allow: $a\n";
389
+ foreach ( $r['disallow'] as $d) $robots .= "Disallow: $d\n";
390
+ foreach ( $r['sitemap'] as $s) $robots .= "Sitemap: $s\n";
391
+ $robots .= "\n";
392
+ }
393
+ return $robots;
394
+ }
395
+ }
396
+ }
all_in_one_seo_pack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: All In One SEO Pack
4
  Plugin URI: http://semperfiwebdesign.com
5
  Description: Out-of-the-box SEO for your WordPress blog. <a href="admin.php?page=all-in-one-seo-pack/aioseop_class.php">Options configuration panel</a> | <a href="http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins" target="_blank">Upgrade to Pro Version</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://semperplugins.com/support/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
6
- Version: 2.1.7
7
  Author: Michael Torbert
8
  Author URI: http://michaeltorbert.com
9
  */
@@ -30,11 +30,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30
 
31
  /**
32
  * @package All-in-One-SEO-Pack
33
- * @version 2.1.7
34
  */
35
 
36
  if ( ! defined( 'AIOSEOP_VERSION' ) )
37
- define( 'AIOSEOP_VERSION', '2.1.7' );
38
 
39
  if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
40
  define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
@@ -116,7 +116,7 @@ if ( !empty( $aioseop_mem_limit ) ) {
116
  }
117
 
118
  $aiosp_activation = false;
119
- $aioseop_module_list = Array( 'sitemap', 'opengraph', 'importer_exporter', 'performance' ); // list all available modules here
120
 
121
  if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
122
  add_action( 'admin_notices', create_function( '', 'echo "<div class=\'error\'>The All In One SEO Pack class is already defined";'
@@ -133,7 +133,8 @@ $aiosp = new All_in_One_SEO_Pack();
133
 
134
  register_activation_hook( __FILE__, 'aioseop_activate' );
135
 
136
- add_action( 'after_setup_theme', 'aioseop_load_modules' );
 
137
 
138
  add_action( 'init', array( $aiosp, 'add_hooks' ) );
139
 
3
  Plugin Name: All In One SEO Pack
4
  Plugin URI: http://semperfiwebdesign.com
5
  Description: Out-of-the-box SEO for your WordPress blog. <a href="admin.php?page=all-in-one-seo-pack/aioseop_class.php">Options configuration panel</a> | <a href="http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins" target="_blank">Upgrade to Pro Version</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://semperplugins.com/support/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
6
+ Version: 2.2
7
  Author: Michael Torbert
8
  Author URI: http://michaeltorbert.com
9
  */
30
 
31
  /**
32
  * @package All-in-One-SEO-Pack
33
+ * @version 2.2
34
  */
35
 
36
  if ( ! defined( 'AIOSEOP_VERSION' ) )
37
+ define( 'AIOSEOP_VERSION', '2.2' );
38
 
39
  if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
40
  define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
116
  }
117
 
118
  $aiosp_activation = false;
119
+ $aioseop_module_list = Array( 'sitemap', 'opengraph', 'robots', 'file_editor', 'importer_exporter', 'performance' ); // list all available modules here
120
 
121
  if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
122
  add_action( 'admin_notices', create_function( '', 'echo "<div class=\'error\'>The All In One SEO Pack class is already defined";'
133
 
134
  register_activation_hook( __FILE__, 'aioseop_activate' );
135
 
136
+ add_action( 'init', 'aioseop_load_modules', 1 );
137
+ //add_action( 'after_setup_theme', 'aioseop_load_modules' );
138
 
139
  add_action( 'init', array( $aiosp, 'add_hooks' ) );
140
 
images/FileEditor-BW-Retina.png ADDED
Binary file
images/FileEditor-BW-Standard.png ADDED
Binary file
images/FileEditor-Color-Retina.png ADDED
Binary file
images/FileEditor-Color-Standard.png ADDED
Binary file
images/Robots-BW-Retina.png ADDED
Binary file
images/Robots-BW-Standard.png ADDED
Binary file
images/Robots-Color-Retina.png ADDED
Binary file
images/Robots-Color-Standard.png ADDED
Binary file
quickedit_functions.js CHANGED
@@ -1,4 +1,4 @@
1
- function aioseop_ajax_edit_meta_form( post_id, meta ) {
2
  var uform = jQuery('#aioseop_'+meta+'_' + post_id);
3
  var post_title = jQuery('#aioseop_label_' + meta + '_' + post_id).text();
4
  var element = uform.html(); var input;
@@ -15,11 +15,11 @@ function aioseop_ajax_edit_meta_form( post_id, meta ) {
15
  });
16
  jQuery('#aioseop_'+meta+'_save_' + post_id).click(function() {
17
  var new_meta = jQuery( '#aioseop_new_'+meta+'_' + post_id ).val();
18
- handle_post_meta( post_id, new_meta, meta );
19
  });
20
  }
21
 
22
- function handle_post_meta( p, t, m ) {
23
  jQuery("div#aioseop_"+m+"_"+p).fadeOut('fast', function() {
24
  var loading = '<label class="aioseop_'+m+'_loading">';
25
  loading += '<img style="width:20px;margin-right:5px;float:left" align="absmiddle" ';
@@ -34,6 +34,7 @@ function handle_post_meta( p, t, m ) {
34
  aioseop_sack.setVar( "new_meta", t );
35
  aioseop_sack.setVar( "target_meta", m );
36
  aioseop_sack.setVar( "_inline_edit", jQuery('input#_inline_edit').val() );
 
37
  aioseop_sack.onError = function() {alert('Ajax error on saving title'); };
38
  aioseop_sack.runAJAX();
39
  })
1
+ function aioseop_ajax_edit_meta_form( post_id, meta, nonce ) {
2
  var uform = jQuery('#aioseop_'+meta+'_' + post_id);
3
  var post_title = jQuery('#aioseop_label_' + meta + '_' + post_id).text();
4
  var element = uform.html(); var input;
15
  });
16
  jQuery('#aioseop_'+meta+'_save_' + post_id).click(function() {
17
  var new_meta = jQuery( '#aioseop_new_'+meta+'_' + post_id ).val();
18
+ handle_post_meta( post_id, new_meta, meta, nonce );
19
  });
20
  }
21
 
22
+ function handle_post_meta( p, t, m, n ) {
23
  jQuery("div#aioseop_"+m+"_"+p).fadeOut('fast', function() {
24
  var loading = '<label class="aioseop_'+m+'_loading">';
25
  loading += '<img style="width:20px;margin-right:5px;float:left" align="absmiddle" ';
34
  aioseop_sack.setVar( "new_meta", t );
35
  aioseop_sack.setVar( "target_meta", m );
36
  aioseop_sack.setVar( "_inline_edit", jQuery('input#_inline_edit').val() );
37
+ aioseop_sack.setVar( "_nonce", n );
38
  aioseop_sack.onError = function() {alert('Ajax error on saving title'); };
39
  aioseop_sack.runAJAX();
40
  })