All in One SEO Pack - Version 2.6.1

Version Description

Download this release

Release Info

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

Code changes from version 2.5 to 2.6.1

admin/aioseop_module_class.php CHANGED
@@ -2127,9 +2127,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
2127
  * @return string
2128
  */
2129
  function do_multi_input( $args ) {
2130
- // @codingStandardsIgnoreStart
2131
- extract( $args );
2132
- // @codingStandardsIgnoreEnd
 
 
2133
  $buf1 = '';
2134
  $type = $options['type'];
2135
 
@@ -2206,9 +2208,12 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
2206
  */
2207
  function get_option_html( $args ) {
2208
  static $n = 0;
2209
- // @codingStandardsIgnoreStart
2210
- extract( $args );
2211
- // @codingStandardsIgnoreEnd
 
 
 
2212
 
2213
  if ( $options['type'] == 'custom' ) {
2214
  return apply_filters( "{$prefix}output_option", '', $args );
@@ -2296,9 +2301,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
2296
  } elseif ( isset( $options['rows'] ) && isset( $options['cols'] ) ) {
2297
  $size = $options['rows'] * $options['cols'];
2298
  }
2299
- if ( 'Description' === $options['name'] && isset( $options['name'] ) ) {
2300
- $size = ( $size - 90 ) . '-' . $size;
2301
- }
2302
  if ( isset( $options['count_desc'] ) ) {
2303
  $count_desc = $options['count_desc'];
2304
  } else {
2127
  * @return string
2128
  */
2129
  function do_multi_input( $args ) {
2130
+ $options = $args['options'];
2131
+ $value = $args['value'];
2132
+ $name = $args['name'];
2133
+ $attr = $args['attr'];
2134
+
2135
  $buf1 = '';
2136
  $type = $options['type'];
2137
 
2208
  */
2209
  function get_option_html( $args ) {
2210
  static $n = 0;
2211
+
2212
+ $options = $args['options'];
2213
+ $value = $args['value'];
2214
+ $name = $args['name'];
2215
+ $attr = $args['attr'];
2216
+ $prefix = isset( $args['prefix'] ) ? $args['prefix'] : '';
2217
 
2218
  if ( $options['type'] == 'custom' ) {
2219
  return apply_filters( "{$prefix}output_option", '', $args );
2301
  } elseif ( isset( $options['rows'] ) && isset( $options['cols'] ) ) {
2302
  $size = $options['rows'] * $options['cols'];
2303
  }
 
 
 
2304
  if ( isset( $options['count_desc'] ) ) {
2305
  $count_desc = $options['count_desc'];
2306
  } else {
admin/display/general-metaboxes.php CHANGED
@@ -146,7 +146,7 @@ class aiosp_metaboxes {
146
  if ( AIOSEOPPRO ) {
147
  echo 'https://semperplugins.com/documentation/all-in-one-seo-pack-pro-changelog/';
148
  } else {
149
- echo 'https://semperfiwebdesign.com/blog/all-in-one-seo-pack/all-in-one-seo-pack-release-history/';
150
  }
151
  ?>
152
  "><?php _e( 'View the Changelog', 'all-in-one-seo-pack' ); ?></a></p>
146
  if ( AIOSEOPPRO ) {
147
  echo 'https://semperplugins.com/documentation/all-in-one-seo-pack-pro-changelog/';
148
  } else {
149
+ echo 'https://semperfiwebdesign.com/all-in-one-seo-pack-release-history/';
150
  }
151
  ?>
152
  "><?php _e( 'View the Changelog', 'all-in-one-seo-pack' ); ?></a></p>
admin/display/postedit.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
-
3
- // We will eventually put stuff here.
 
 
 
aioseop_class.php CHANGED
@@ -20,7 +20,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
20
  var $version = AIOSEOP_VERSION;
21
 
22
  // Max numbers of chars in auto-generated description.
23
- var $maximum_description_length = 320;
24
 
25
  // Minimum number of chars an excerpt should be so that it can be used as description.
26
  var $minimum_description_length = 1;
@@ -57,6 +57,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
57
  *
58
  * @since 2.3.14 #921 More google analytics options added.
59
  * @since 2.4.0 #1395 Longer Meta Descriptions.
 
60
  */
61
  function __construct() {
62
  global $aioseop_options;
@@ -169,7 +170,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
169
  'description_format' => __( 'This controls the format of Meta Descriptions.The following macros are supported:', 'all-in-one-seo-pack' ) .
170
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
171
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
172
- __( '%description% - This outputs the description you write for each page/post or the autogenerated description, if you have that option enabled. Auto-generated descriptions are generated from the Post Excerpt, or the first 320 characters of the post content if there is no Post Excerpt.', 'all-in-one-seo-pack' ) . '</li><li>' .
173
  __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
174
  __( '%wp_title% - The original WordPress title, e.g. post_title for posts', 'all-in-one-seo-pack' ) . '</li><li>' .
175
  __( '%current_date% - The current date (localized)', 'all-in-one-seo-pack' ) . '</li><li>' .
@@ -227,7 +228,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
227
  'paginated_noindex' => __( 'Check this to ask search engines not to index paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
228
  'paginated_nofollow' => __( 'Check this to ask search engines not to follow links from paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
229
  'skip_excerpt' => __( 'This option will auto generate your meta descriptions from your post content instead of your post excerpt. This is useful if you want to use your content for your autogenerated meta descriptions instead of the excerpt. WooCommerce users should read the documentation regarding this setting.', 'all-in-one-seo-pack' ),
230
- 'generate_descriptions' => __( 'Check this and your Meta Descriptions for any Post Type will be auto-generated using the Post Excerpt, or the first 320 characters of the post content if there is no Post Excerpt. You can overwrite any auto-generated Meta Description by editing the post or page.', 'all-in-one-seo-pack' ),
231
  'run_shortcodes' => __( 'Check this and shortcodes will get executed for descriptions auto-generated from content.', 'all-in-one-seo-pack' ),
232
  'hide_paginated_descriptions' => __( 'Check this and your Meta Descriptions will be removed from page 2 or later of paginated content.', 'all-in-one-seo-pack' ),
233
  'dont_truncate_descriptions' => __( 'Check this to prevent your Description from being truncated regardless of its length.', 'all-in-one-seo-pack' ),
@@ -367,7 +368,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
367
  'sanitize' => 'text',
368
  'count' => true,
369
  'cols' => 80,
370
- 'rows' => 4,
371
  'condshow' => array( 'aiosp_use_static_home_info' => 0 ),
372
  ),
373
  'togglekeywords' => array(
@@ -968,7 +969,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
968
  'type' => 'textarea',
969
  'count' => true,
970
  'cols' => 80,
971
- 'rows' => 4,
972
  ),
973
 
974
  'keywords' => array(
@@ -995,7 +996,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
995
  'condshow' => array( 'aiosp_disable' => 'on' ),
996
  ),
997
  ),
998
- 'display' => null,
 
999
  ),
1000
  );
1001
 
@@ -1176,13 +1178,23 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1176
  $args['options']['nowrap'] = false;
1177
  $args['options']['save'] = false;
1178
  $info = $this->get_page_snippet_info();
1179
- // @codingStandardsIgnoreStart
1180
- extract( $info );
1181
- // @codingStandardsIgnoreEnd
1182
  } else {
1183
  return '';
1184
  }
1185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1186
  if ( $this->strlen( $title ) > 70 ) {
1187
  $title = $this->trim_excerpt_without_filters(
1188
  $this->html_entity_decode( $title ),
@@ -2482,7 +2494,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2482
  $aioseop_desc = get_post_meta( $post->ID, '_aioseop_description', true );
2483
  }
2484
 
2485
- if ( empty( $aioseop_desc ) && 'on' === $aioseop_options['aiosp_generate_descriptions'] && empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) {
2486
  $truncate = true;
2487
  }
2488
 
@@ -3375,12 +3387,15 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3375
 
3376
  global $post;
3377
  $info = $this->get_page_snippet_info();
3378
- // @codingStandardsIgnoreStart
3379
- extract( $info );
3380
- // @codingStandardsIgnoreEnd
3381
- $settings[ "{$prefix}title" ]['placeholder'] = $this->html_entity_decode( $title );
3382
- $settings[ "{$prefix}description" ]['placeholder'] = $this->html_entity_decode( $description );
3383
- $settings[ "{$prefix}keywords" ]['placeholder'] = $keywords;
 
 
 
3384
  }
3385
 
3386
  if ( ! AIOSEOPPRO ) {
@@ -3625,12 +3640,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3625
  function add_hooks() {
3626
  global $aioseop_options, $aioseop_update_checker;
3627
 
3628
- // MOVED TO MAIN PLUGIN FILE IN ORDER TO FIRE SOONS
3629
- // $role = get_role( 'administrator' );
3630
- // if ( is_object( $role ) ) {
3631
- // $role->add_cap( 'aiosp_manage_seo' );
3632
- // }
3633
- aioseop_update_settings_check();
3634
  add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
3635
  if ( is_user_logged_in() && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
3636
  add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 );
@@ -3967,7 +3981,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3967
  $show_page = false;
3968
  }
3969
 
3970
- if ( $aioseop_options['aiosp_can'] ) {
3971
  $url = '';
3972
  if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) && ! is_home() ) {
3973
  $url = $opts['aiosp_custom_link'];
@@ -4121,6 +4135,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4121
  $aiosp_noindex = $aiosp_nofollow = '';
4122
  $noindex = 'index';
4123
  $nofollow = 'follow';
 
 
 
 
 
 
4124
  if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax()
4125
  && ( ( is_date() && ! empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && ! empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
4126
  || ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) )
@@ -4129,17 +4149,23 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4129
  || ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
4130
  ) {
4131
  $noindex = 'noindex';
 
 
 
 
 
 
 
 
4132
  } elseif ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) {
4133
  $post_type = get_post_type();
4134
- if ( ! empty( $opts ) ) {
4135
- $aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
4136
- $aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
4137
- }
4138
  if ( $aiosp_noindex || $aiosp_nofollow || ! empty( $aioseop_options['aiosp_cpostnoindex'] )
4139
  || ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
4140
  ) {
4141
- if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) ||
4142
- ( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) )
 
 
4143
  ) {
4144
  $noindex = 'noindex';
4145
  }
@@ -4812,7 +4838,9 @@ EOF;
4812
  $this->locations['aiosp']['display'] = array();
4813
  }
4814
  }
4815
- } else {
 
 
4816
  $this->locations['aiosp']['display'] = array( 'post', 'page' );
4817
  }
4818
 
20
  var $version = AIOSEOP_VERSION;
21
 
22
  // Max numbers of chars in auto-generated description.
23
+ var $maximum_description_length = 160;
24
 
25
  // Minimum number of chars an excerpt should be so that it can be used as description.
26
  var $minimum_description_length = 1;
57
  *
58
  * @since 2.3.14 #921 More google analytics options added.
59
  * @since 2.4.0 #1395 Longer Meta Descriptions.
60
+ * @since 2.6.1 #1694 Back to shorter meta descriptions.
61
  */
62
  function __construct() {
63
  global $aioseop_options;
170
  'description_format' => __( 'This controls the format of Meta Descriptions.The following macros are supported:', 'all-in-one-seo-pack' ) .
171
  '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
172
  __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
173
+ __( '%description% - This outputs the description you write for each page/post or the autogenerated description, if you have that option enabled. Auto-generated descriptions are generated from the Post Excerpt, or the first 160 characters of the post content if there is no Post Excerpt.', 'all-in-one-seo-pack' ) . '</li><li>' .
174
  __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
175
  __( '%wp_title% - The original WordPress title, e.g. post_title for posts', 'all-in-one-seo-pack' ) . '</li><li>' .
176
  __( '%current_date% - The current date (localized)', 'all-in-one-seo-pack' ) . '</li><li>' .
228
  'paginated_noindex' => __( 'Check this to ask search engines not to index paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
229
  'paginated_nofollow' => __( 'Check this to ask search engines not to follow links from paginated pages/posts. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
230
  'skip_excerpt' => __( 'This option will auto generate your meta descriptions from your post content instead of your post excerpt. This is useful if you want to use your content for your autogenerated meta descriptions instead of the excerpt. WooCommerce users should read the documentation regarding this setting.', 'all-in-one-seo-pack' ),
231
+ 'generate_descriptions' => __( 'Check this and your Meta Descriptions for any Post Type will be auto-generated using the Post Excerpt, or the first 160 characters of the post content if there is no Post Excerpt. You can overwrite any auto-generated Meta Description by editing the post or page.', 'all-in-one-seo-pack' ),
232
  'run_shortcodes' => __( 'Check this and shortcodes will get executed for descriptions auto-generated from content.', 'all-in-one-seo-pack' ),
233
  'hide_paginated_descriptions' => __( 'Check this and your Meta Descriptions will be removed from page 2 or later of paginated content.', 'all-in-one-seo-pack' ),
234
  'dont_truncate_descriptions' => __( 'Check this to prevent your Description from being truncated regardless of its length.', 'all-in-one-seo-pack' ),
368
  'sanitize' => 'text',
369
  'count' => true,
370
  'cols' => 80,
371
+ 'rows' => 2,
372
  'condshow' => array( 'aiosp_use_static_home_info' => 0 ),
373
  ),
374
  'togglekeywords' => array(
969
  'type' => 'textarea',
970
  'count' => true,
971
  'cols' => 80,
972
+ 'rows' => 2,
973
  ),
974
 
975
  'keywords' => array(
996
  'condshow' => array( 'aiosp_disable' => 'on' ),
997
  ),
998
  ),
999
+ // #1067: if SEO is disabled and an empty array is passed below, it will be overriden. So let's pass a post type that cannot possibly exist.
1000
+ 'display' => 'on' === $aioseop_options['aiosp_enablecpost'] ? array( $aioseop_options['aiosp_cpostactive'] ) : array( '___null___' ),
1001
  ),
1002
  );
1003
 
1178
  $args['options']['nowrap'] = false;
1179
  $args['options']['save'] = false;
1180
  $info = $this->get_page_snippet_info();
 
 
 
1181
  } else {
1182
  return '';
1183
  }
1184
 
1185
+ $args['options']['type'] = 'html';
1186
+ $args['options']['nowrap'] = false;
1187
+ $args['options']['save'] = false;
1188
+ $info = $this->get_page_snippet_info();
1189
+ $title = $info['title'];
1190
+ $description = $info['description'];
1191
+ $keywords = $info['keywords'];
1192
+ $url = $info['url'];
1193
+ $title_format = $info['title_format'];
1194
+ $category = $info['category'];
1195
+ $w = $info['w'];
1196
+ $p = $info['p'];
1197
+
1198
  if ( $this->strlen( $title ) > 70 ) {
1199
  $title = $this->trim_excerpt_without_filters(
1200
  $this->html_entity_decode( $title ),
2494
  $aioseop_desc = get_post_meta( $post->ID, '_aioseop_description', true );
2495
  }
2496
 
2497
+ if ( empty( $aioseop_desc ) && isset( $aioseop_options['aiosp_generate_descriptions'] ) && 'on' === $aioseop_options['aiosp_generate_descriptions'] && empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) {
2498
  $truncate = true;
2499
  }
2500
 
3387
 
3388
  global $post;
3389
  $info = $this->get_page_snippet_info();
3390
+
3391
+
3392
+ $title = $info['title'];
3393
+ $description = $info['description'];
3394
+ $keywords = $info['keywords'];
3395
+
3396
+ $settings["{$prefix}title"]['placeholder'] = $this->html_entity_decode( $title );
3397
+ $settings["{$prefix}description"]['placeholder'] = $this->html_entity_decode( $description );
3398
+ $settings["{$prefix}keywords"]['placeholder'] = $keywords;
3399
  }
3400
 
3401
  if ( ! AIOSEOPPRO ) {
3640
  function add_hooks() {
3641
  global $aioseop_options, $aioseop_update_checker;
3642
 
3643
+ if ( is_admin() ) {
3644
+ // this checks if the settiongs options exist and if they dont, it sets the defaults.
3645
+ // let's do this only in backend.
3646
+ aioseop_update_settings_check();
3647
+ }
 
3648
  add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
3649
  if ( is_user_logged_in() && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
3650
  add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 );
3981
  $show_page = false;
3982
  }
3983
 
3984
+ if ( isset( $aioseop_options['aiosp_can'] ) && $aioseop_options['aiosp_can'] ) {
3985
  $url = '';
3986
  if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) && ! is_home() ) {
3987
  $url = $opts['aiosp_custom_link'];
4135
  $aiosp_noindex = $aiosp_nofollow = '';
4136
  $noindex = 'index';
4137
  $nofollow = 'follow';
4138
+
4139
+ if ( ! empty( $opts ) ) {
4140
+ $aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
4141
+ $aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
4142
+ }
4143
+
4144
  if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax()
4145
  && ( ( is_date() && ! empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && ! empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
4146
  || ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) )
4149
  || ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
4150
  ) {
4151
  $noindex = 'noindex';
4152
+
4153
+ // #322: duplicating this code so that we don't step on some other entities' toes.
4154
+ if ( ( 'on' === $aiosp_nofollow ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && $page > 1 ) ||
4155
+ ( ( '' === $aiosp_nofollow ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) )
4156
+ ) {
4157
+ $nofollow = 'nofollow';
4158
+ }
4159
+ // #322: duplicating this code so that we don't step on some other entities' toes.
4160
  } elseif ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) {
4161
  $post_type = get_post_type();
 
 
 
 
4162
  if ( $aiosp_noindex || $aiosp_nofollow || ! empty( $aioseop_options['aiosp_cpostnoindex'] )
4163
  || ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
4164
  ) {
4165
+
4166
+ if ( ( 'on' === $aiosp_noindex ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) ||
4167
+ ( ( '' === $aiosp_noindex ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) )
4168
+
4169
  ) {
4170
  $noindex = 'noindex';
4171
  }
4838
  $this->locations['aiosp']['display'] = array();
4839
  }
4840
  }
4841
+ } elseif ( empty( $this->locations['aiosp']['display'] ) ) {
4842
+ // #1067: if SEO was disabled, it was always displaying for post and page. Because we are now sending an invalid post type '___null___' when SEO is disabled,
4843
+ // this else will be unreachable. Still keeping it in case there is an undiscovered path that needs this condition.
4844
  $this->locations['aiosp']['display'] = array( 'post', 'page' );
4845
  }
4846
 
all_in_one_seo_pack.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: All In One SEO Pack
5
  Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
6
  Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
7
- Version: 2.5
8
  Author: Michael Torbert
9
  Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
10
  Text Domain: all-in-one-seo-pack
@@ -32,14 +32,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
32
  * The original WordPress SEO plugin.
33
  *
34
  * @package All-in-One-SEO-Pack
35
- * @version 2.5
36
  */
37
 
38
  if ( ! defined( 'AIOSEOPPRO' ) ) {
39
  define( 'AIOSEOPPRO', false );
40
  }
41
  if ( ! defined( 'AIOSEOP_VERSION' ) ) {
42
- define( 'AIOSEOP_VERSION', '2.5' );
43
  }
44
  global $aioseop_plugin_name;
45
  $aioseop_plugin_name = 'All in One SEO Pack';
4
  Plugin Name: All In One SEO Pack
5
  Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
6
  Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
7
+ Version: 2.6.1
8
  Author: Michael Torbert
9
  Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
10
  Text Domain: all-in-one-seo-pack
32
  * The original WordPress SEO plugin.
33
  *
34
  * @package All-in-One-SEO-Pack
35
+ * @version 2.6.1
36
  */
37
 
38
  if ( ! defined( 'AIOSEOPPRO' ) ) {
39
  define( 'AIOSEOPPRO', false );
40
  }
41
  if ( ! defined( 'AIOSEOP_VERSION' ) ) {
42
+ define( 'AIOSEOP_VERSION', '2.6.1' );
43
  }
44
  global $aioseop_plugin_name;
45
  $aioseop_plugin_name = 'All in One SEO Pack';
inc/aioseop_functions.php CHANGED
@@ -53,12 +53,12 @@ if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
53
  /**
54
  * Check if settings need to be updated / migrated from old version.
55
  *
56
- * @TODO See when this is from and if we can move it elsewhere... our new db updates/upgrades class?
57
  */
58
  function aioseop_update_settings_check() {
59
  global $aioseop_options;
60
  if ( empty( $aioseop_options ) || isset( $_POST['aioseop_migrate_options'] ) ) {
61
- aioseop_mrt_mkarry();
62
  }
63
  // WPML has now attached to filters, read settings again so they can be translated.
64
  aioseop_get_options();
@@ -85,13 +85,13 @@ if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
85
  }
86
  }
87
 
88
- if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) {
89
  /**
90
- * Initialize settings to defaults.
91
  *
92
  * @TODO Should also move.
93
  */
94
- function aioseop_mrt_mkarry() {
95
  global $aiosp;
96
  global $aioseop_options;
97
  $naioseop_options = $aiosp->default_options();
53
  /**
54
  * Check if settings need to be updated / migrated from old version.
55
  *
56
+ * @TODO See when this is from and if we can move it elsewhere... our new db updates/upgrades class? This is called every single time a page is loaded both on the front-end or backend.
57
  */
58
  function aioseop_update_settings_check() {
59
  global $aioseop_options;
60
  if ( empty( $aioseop_options ) || isset( $_POST['aioseop_migrate_options'] ) ) {
61
+ aioseop_initialize_options();
62
  }
63
  // WPML has now attached to filters, read settings again so they can be translated.
64
  aioseop_get_options();
85
  }
86
  }
87
 
88
+ if ( ! function_exists( 'aioseop_initialize_options' ) ) {
89
  /**
90
+ * Initialize settings to defaults. Changed name from the abstruse 'aioseop_mrt_mkarry' to 'aioseop_initialize_options'.
91
  *
92
  * @TODO Should also move.
93
  */
94
+ function aioseop_initialize_options() {
95
  global $aiosp;
96
  global $aioseop_options;
97
  $naioseop_options = $aiosp->default_options();
inc/aiosp_calc_desc.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
-
3
- // We will eventually put stuff here.
 
 
 
inc/aiosp_calc_title.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
-
3
- // We will eventually put stuff here.
 
 
 
js/modules/aioseop_module.js CHANGED
@@ -82,7 +82,7 @@ function countChars( field, cntfield ) {
82
  cntfield.removeClass().addClass('aioseop_count_good');
83
  }
84
  } else {
85
- if ( cntfield.val() > ( field_size - 91 ) ) {
86
  cntfield.removeClass().addClass('aioseop_count_bad');
87
  } else {
88
  cntfield.removeClass().addClass('aioseop_count_good');
@@ -807,12 +807,12 @@ jQuery( document ).ready(
807
  jQuery( document ).ready(
808
  function() {
809
  // TODO: consider moving EVERYTHING that needs ready() to this function
810
- initAll( jQuery );
811
- initCounting( jQuery );
812
  }
813
  );
814
 
815
- function initAll($){
816
  if ( $( '.aiseop-date' ).length > 0 && $( '.aiseop-date' ).eq( 0 ).prop( 'type' ).toLowerCase() === 'text' ) {
817
  $( '.aiseop-date' ).datepicker(
818
  {
@@ -822,7 +822,7 @@ function initAll($){
822
  }
823
  }
824
 
825
- function initCounting($){
826
  /* count them characters */
827
  $( '.aioseop_count_chars' ).on('keyup keydown', function(){
828
  countChars( $(this).eq(0), $(this).parent().find('[name="' + $(this).attr('data-length-field') + '"]').eq(0));
82
  cntfield.removeClass().addClass('aioseop_count_good');
83
  }
84
  } else {
85
+ if ( cntfield.val() > ( field_size - 10 ) ) {
86
  cntfield.removeClass().addClass('aioseop_count_bad');
87
  } else {
88
  cntfield.removeClass().addClass('aioseop_count_good');
807
  jQuery( document ).ready(
808
  function() {
809
  // TODO: consider moving EVERYTHING that needs ready() to this function
810
+ aiospinitAll( jQuery );
811
+ aiospinitCounting( jQuery );
812
  }
813
  );
814
 
815
+ function aiospinitAll($){
816
  if ( $( '.aiseop-date' ).length > 0 && $( '.aiseop-date' ).eq( 0 ).prop( 'type' ).toLowerCase() === 'text' ) {
817
  $( '.aiseop-date' ).datepicker(
818
  {
822
  }
823
  }
824
 
825
+ function aiospinitCounting($){
826
  /* count them characters */
827
  $( '.aioseop_count_chars' ).on('keyup keydown', function(){
828
  countChars( $(this).eq(0), $(this).parent().find('[name="' + $(this).attr('data-length-field') + '"]').eq(0));
js/modules/aioseop_module.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function toggleVisibility(e){var a=document.getElementById(e);"block"==a.style.display?a.style.display="none":a.style.display="block"}function countChars(e,a){var o,t=0;"aiosp_title"==e.name&&"undefined"!=typeof aiosp_title_extra&&(t=aiosp_title_extra),a.value=e.value.length+t,(o=void 0!==e.size?e.size:e.rows*e.cols)<10||(a.value>o?(a.style.color="#fff",a.style.backgroundColor="#f00"):a.value>o-91?(a.style.color="#515151",a.style.backgroundColor="#ff0"):(a.style.color="#515151",a.style.backgroundColor="#eee"))}function aioseop_get_field_value(e){return 0==e.length?e:(cur=jQuery("[name="+e+"]"),0==cur.length?e:(type=cur.attr("type"),"checkbox"!=type&&"radio"!=type||(cur=jQuery("input[name="+e+"]:checked")),cur.val()))}function aioseop_get_field_values(e){return arr=[],cur=jQuery("[name="+e+"]"),0==cur.length?e:(type=cur.attr("type"),"checkbox"!=type&&"radio"!=type||jQuery("input[name="+e+"]:checked").each(function(){arr.push(jQuery(this).val())}),arr.length<=0&&arr.push(cur.val()),arr)}function aioseop_eval_condshow_logic(e){var a,o;if("object"==typeof e)switch(a=e.lhs,o=e.rhs,null!==a&&"object"==typeof a&&(a=aioseop_eval_condshow_logic(a)),null!==o&&"object"==typeof o&&(o=aioseop_eval_condshow_logic(o)),a=aioseop_get_field_value(a),o=aioseop_get_field_value(o),e.op){case"NOT":return!a;case"AND":return a&&o;case"OR":return a||o;case"==":return a==o;case"!=":return a!=o;default:return null}return e}function aioseop_do_condshow_match(e,a){return void 0!==a&&(matches=!0,jQuery.each(a,function(e,a){"object"==typeof a?aioseop_eval_condshow_logic(a)||(matches=!1):e.match(/\\\[\\\]/)?(cur=aioseop_get_field_values(e),jQuery.inArray(a,cur,0)<0&&(matches=!1)):(cur=aioseop_get_field_value(e),cur!=a&&(matches=!1))}),matches?jQuery("#"+e+"_wrapper").show():jQuery("#"+e+"_wrapper").hide(),matches)}function aioseop_add_condshow_handlers(e,a){void 0!==a&&jQuery.each(a,function(o,t){jQuery("[name="+o+"]").bind("change keyup",function(){aioseop_do_condshow_match(e,a)})})}function aioseop_do_condshow(e){void 0!==aiosp_data.condshow&&jQuery.each(aiosp_data.condshow,function(e,a){aioseop_do_condshow_match(e,a),aioseop_add_condshow_handlers(e,a)})}function aiosp_store_radio(){var e={};jQuery('input[type="radio"]').each(function(){jQuery(this).is(":checked")&&(e[jQuery(this).attr("name")]=jQuery(this).val()),jQuery(document).data("radioshack",e)})}function aiosp_reclick_radio(){var e=jQuery(document).data("radioshack");for(var a in e)jQuery('input[name="'+a+'"]').filter('[value="'+e[a]+'"]').trigger("click");jQuery(".wrap").unbind("mouseup")}function aioseop_handle_ajax_call(e,a,o,t){var i=new sack(ajaxurl);i.execute=1,i.method="POST",i.setVar("action",e),i.setVar("settings",a),i.setVar("options",o),void 0!==t&&(i.onCompletion=t),i.setVar("nonce-aioseop",jQuery('input[name="nonce-aioseop"]').val()),i.setVar("nonce-aioseop-edit",jQuery('input[name="nonce-aioseop-edit"]').val()),i.onError=function(){alert("Ajax error on saving.")},i.runAJAX()}function aioseop_handle_post_url(e,a,o,t){jQuery("div#aiosp_"+a).fadeOut("fast",function(){var i='<label class="aioseop_loading aioseop_'+a+'_loading"></label> Please wait...';jQuery("div#aiosp_"+a).fadeIn("fast",function(){aioseop_handle_ajax_call(e,a,o,t)}),jQuery("div#aiosp_"+a).html(i)})}function aioseop_is_overflowed(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}function aioseop_overflow_border(e){aioseop_is_overflowed(e)?e.className="aioseop_option_div aioseop_overflowed":e.className="aioseop_option_div"}function initAll(e){e(".aiseop-date").length>0&&"text"===e(".aiseop-date").eq(0).prop("type").toLowerCase()&&e(".aiseop-date").datepicker({dateFormat:"yy-mm-dd"})}"undefined"!=typeof aiosp_data&&(jQuery.each(aiosp_data,function(e,a){0==e?void 0===a.condshow&&(aiosp_data[e].condshow=[]):void 0!==a.condshow&&(aiosp_data[0].condshow=jQuery.merge(aiosp_data[0].condshow,a.condshow))}),aiosp_data=aiosp_data[0]),jQuery(document).ready(function(){"undefined"!=typeof aiosp_data&&void 0!==aiosp_data.condshow&&aioseop_do_condshow(aiosp_data.condshow),jQuery(".aioseop_upload_image_label").on("change",function(){this.checker=jQuery(this).parent().find(".aioseop_upload_image_checker"),this.checker.length>0&&this.checker.val(1)})}),jQuery.fn.aioseopImageUploader=function(e){var a=this;a.options=jQuery.extend({success:void 0},e),a.target=jQuery(a).next(),a.uploader=wp.media({title:"Choose Image",button:{text:"Choose Image"},multiple:!1}),a.onSelect=function(){var e=a.uploader.state().get("selection").first().toJSON().url;a.target.length>=0&&jQuery(a.target).val(e),void 0!==a.options.success&&a.options.success(e,a)},a.onClick=function(e){e.preventDefault(),a.uploader.open()},a.uploader.on("select",a.onSelect),jQuery(a).click(a.onClick)},jQuery(document).ready(function(e){jQuery(".aioseop_upload_image_button").each(function(){jQuery(this).aioseopImageUploader({success:function(e,a){jQuery(a).prev().length>0&&jQuery(a).prev().val(1)}})})}),jQuery(document).ready(function(){jQuery(".hndle").mousedown(function(){jQuery(".wrap").mouseup(function(){aiosp_store_radio(),setTimeout(function(){aiosp_reclick_radio()},50)})})}),jQuery(document).ready(function(){jQuery("#poststuff .aioseop_radio_type input[type='radio']").on("click",function(){var e=jQuery(this).attr("previousValue"),a=jQuery(this).attr("name");void 0!==e?"checked"==e?(jQuery(this).prop("checked",!1),jQuery(this).attr("previousValue",!1)):(jQuery("input[name="+a+"]:radio").attr("previousValue",!1),jQuery(this).attr("previousValue","checked")):jQuery(this).prop("checked")?(jQuery(this).prop("checked",!0),jQuery(this).attr("previousValue","checked")):(jQuery(this).prop("checked",!1),jQuery(this).attr("previousValue",!1))}),void 0!==aiosp_data.pointers&&jQuery.each(aiosp_data.pointers,function(e,a){"undefined"!=a&&""!=a.pointer_text&&aioseop_show_pointer(e,a)}),jQuery(".all-in-one-seo_page_all-in-one-seo-pack-modules-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left").delegate("input[name='Submit']","click",function(e){return e.preventDefault(),!1}),jQuery(".all-in-one-seo_page_all-in-one-seo-pack-modules-aioseop_feature_manager #aiosp_settings_form").delegate("input[name='Submit']","click",function(e){return e.preventDefault(),aioseop_handle_post_url("aioseop_ajax_save_settings","ajax_settings_message",jQuery("form#aiosp_settings_form").serialize(),function(){jQuery(".wp-has-current-submenu").fadeIn("fast",function(){aioseop_handle_ajax_call("aioseop_ajax_get_menu_links","ajax_settings_message",jQuery.param({target:".wp-has-current-submenu > ul"}))})}),!1}),jQuery(".all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aiosp_settings_form .aioseop_settings_left").delegate("input[name='Submit']","click",function(e){return e.preventDefault(),!1}),jQuery(".all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aiosp_settings_form").delegate("input[name='Submit']","click",function(e){return e.preventDefault(),aioseop_handle_post_url("aioseop_ajax_save_settings","ajax_settings_message",jQuery("form#aiosp_settings_form").serialize(),function(){jQuery(".wp-has-current-submenu").fadeIn("fast",function(){aioseop_handle_ajax_call("aioseop_ajax_get_menu_links","ajax_settings_message",jQuery.param({target:".wp-has-current-submenu > ul"}))})}),!1});jQuery("div#aiosp_sitemap_addl_pages_metabox").delegate("input[name='Submit']","click",function(){return aioseop_handle_post_url("aioseop_ajax_save_url","sitemap_addl_pages",jQuery("div#aiosp_sitemap_addl_pages_metabox input, div#aiosp_sitemap_addl_pages_metabox select").serialize()),!1}),jQuery("div#aiosp_video_sitemap_addl_pages_metabox").delegate("input[name='Submit']","click",function(){return aioseop_handle_post_url("aioseop_ajax_save_url","video_sitemap_addl_pages",jQuery("div#aiosp_video_sitemap_addl_pages_metabox input, div#aiosp_video_sitemap_addl_pages_metabox select").serialize()),!1}),jQuery("div#aiosp_sitemap_addl_pages_metabox").delegate("a.aiosp_delete_url","click",function(e){return e.preventDefault(),aioseop_handle_post_url("aioseop_ajax_delete_url","sitemap_addl_pages",jQuery(this).attr("title")),!1}),jQuery("div#aiosp_video_sitemap_addl_pages_metabox").delegate("a.aiosp_delete_url","click",function(e){return e.preventDefault(),aioseop_handle_post_url("aioseop_ajax_delete_url","video_sitemap_addl_pages",jQuery(this).attr("title")),!1}),jQuery("div#aiosp_opengraph_scan_header").delegate("input[name='aiosp_opengraph_scan_header']","click",function(e){return e.preventDefault(),aioseop_handle_post_url("aioseop_ajax_scan_header","opengraph_scan_header",jQuery("div#aiosp_opengraph_scan_header").serialize()),!1}),jQuery('input[name="aiosp_sitemap_posttypes[]"][value="all"], input[name="aiosp_video_sitemap_posttypes[]"][value="all"], input[name="aiosp_sitemap_taxonomies[]"][value="all"], input[name="aiosp_video_sitemap_taxonomies[]"][value="all"]').click(function(){jQuery(this).parents("div:eq(0)").find(":checkbox").prop("checked",this.checked)}),jQuery('input[name="aiosp_sitemap_posttypes[]"][value!="all"], input[name="aiosp_video_sitemap_posttypes[]"][value!="all"], input[name="aiosp_sitemap_taxonomies[]"][value!="all"], input[name="aiosp_video_sitemap_taxonomies[]"][value!="all"]').click(function(){this.checked||jQuery(this).parents("div:eq(0)").find('input[value="all"]:checkbox').prop("checked",this.checked)}),jQuery(".aioseop_tab:not(:first)").hide(),jQuery(".aioseop_tab:first").show(),jQuery("a.aioseop_header_tab").click(function(){var e=jQuery(this).attr("href").split("#")[1];return jQuery(".aioseop_tab:not(#"+e+")").hide("slow"),jQuery(".aioseop_tab#"+e).show("slow"),jQuery('.aioseop_header_tab[href!="#'+e+'"]').removeClass("active"),jQuery('.aioseop_header_tab[href="#'+e+'"]').addClass("active"),!1})}),jQuery(document).ready(function(){initAll(jQuery)});
js/quickedit_functions.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function aioseop_ajax_edit_meta_form(a,e,i){var t,o=jQuery("#aioseop_"+e+"_"+a),s=jQuery("#aioseop_label_"+e+"_"+a).text(),_=o.html();t='<textarea id="aioseop_new_'+e+"_"+a+'" style="font-size:13px;width:100%;float:left;position:relative;z-index:1;" rows=4 cols=32>'+s+"</textarea>",t+='<label style="float:left">',t+='<a class="aioseop_mpc_SEO_admin_options_edit" href="javascript:void(0);" id="aioseop_'+e+"_save_"+a+'" >',t+='<img src="'+aioseopadmin.imgUrl+'accept.png" border="0" alt="" title="'+e+'" /></a>',t+='<a class="aioseop_mpc_SEO_admin_options_edit" href="javascript:void(0);" id="aioseop_'+e+"_cancel_"+a+'" >',t+='<img src="'+aioseopadmin.imgUrl+'delete.png" border="0" alt="" title="'+e+'" /></a>',t+="</label>",o.html(t),o.attr("class","aioseop_mpc_admin_meta_options aio_editing"),jQuery("#aioseop_"+e+"_cancel_"+a).click(function(){o.html(_),o.attr("class","aioseop_mpc_admin_meta_options")}),jQuery("#aioseop_"+e+"_save_"+a).click(function(){var t=jQuery("#aioseop_new_"+e+"_"+a).val();handle_post_meta(a,t,e,i)})}function handle_post_meta(a,e,i,t){jQuery("div#aioseop_"+i+"_"+a).fadeOut("fast",function(){var o='<label class="aioseop_'+i+'_loading">';o+='<img style="width:20px;margin-right:5px;float:left" align="absmiddle" ',o+='src="'+aioseopadmin.imgUrl+'activity.gif" border="0" alt="" title="'+i+'" /></a>',o+='</label><div style="float:left">Please wait…</div>',jQuery("div#aioseop_"+i+"_"+a).fadeIn("fast",function(){var o=new sack(aioseopadmin.requestUrl);o.execute=1,o.method="POST",o.setVar("action","aioseop_ajax_save_meta"),o.setVar("post_id",a),o.setVar("new_meta",e),o.setVar("target_meta",i),o.setVar("_inline_edit",jQuery("input#_inline_edit").val()),o.setVar("_nonce",t),o.onError=function(){alert("Ajax error on saving title")},o.runAJAX()}),jQuery("div#aioseop_"+i+"_"+a).html(o),jQuery("div#aioseop_"+i+"_"+a).attr("class","aioseop_mpc_admin_meta_options")})}jQuery(document).on("click",".visibility-notice",function(){jQuery.ajax({url:ajaxurl,data:{action:"aioseo_dismiss_visibility_notice"}})}),jQuery(document).on("click",".yst_notice",function(){jQuery.ajax({url:ajaxurl,data:{action:"aioseo_dismiss_yst_notice"}})}),jQuery(document).on("click",".woo-upgrade-notice",function(){jQuery.ajax({url:ajaxurl,data:{action:"aioseo_dismiss_woo_upgrade_notice"}})}),jQuery(document).on("click",".sitemap_max_urls_notice",function(){jQuery.ajax({url:ajaxurl,data:{action:"aioseo_dismiss_sitemap_max_url_notice"}})});
js/welcome.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){a(document).on("click",".nav-tab-wrapper a",function(){return a("section").hide(),a("section").eq(a(this).index()).show(),a(this).attr("className"),!1}),a("a.nav-tab").click(function(){a("a.nav-tab").removeClass("nav-tab-active"),a(this).addClass("nav-tab-active")})}(jQuery);
modules/aioseop_feature_manager.php CHANGED
@@ -20,36 +20,51 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
20
  * @param $mod Module.
21
  */
22
  function __construct( $mod ) {
 
23
  $this->name = __( 'Feature Manager', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
24
  $this->prefix = 'aiosp_feature_manager_'; // Option prefix.
25
  $this->file = __FILE__; // The current file.
26
  parent::__construct();
27
  $this->module_info = array(
28
  'sitemap' => array(
 
 
29
  'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
30
  'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
31
  ),
32
  'opengraph' => array(
 
 
33
  'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
 
 
34
  'description' => __( 'Add Social Meta data to your site to deliver closer integration between your website/blog and social media.', 'all-in-one-seo-pack' ),
35
  ),
36
  'robots' => array(
 
37
  'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
38
  'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ),
39
  ),
40
  'file_editor' => array(
 
41
  'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
42
  'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ),
43
  ),
44
  'importer_exporter' => array(
 
 
45
  'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
46
  'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ),
47
  ),
48
  'bad_robots' => array(
 
49
  'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
 
50
  'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ),
51
  ),
52
  'performance' => array(
 
 
53
  'name' => __( 'Performance', 'all-in-one-seo-pack' ),
54
  'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
55
  'default' => 'on',
@@ -59,11 +74,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
59
  if ( AIOSEOPPRO ) {
60
 
61
  $this->module_info['coming_soon'] = array(
 
62
  'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
 
63
  'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
64
  'save' => false,
65
  );
66
  $this->module_info['video_sitemap'] = array(
 
 
67
  'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
68
  'description' => __( 'Create and manage your Video Sitemap using this feature and submit your Video Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
69
  );
@@ -72,6 +91,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
72
 
73
  $this->module_info['coming_soon'] = array(
74
  'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
 
75
  'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
76
  'save' => false,
77
  );
@@ -145,6 +165,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
145
  function filter_submit( $submit ) {
146
  $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' &raquo;';
147
  $submit['Submit']['class'] .= ' hidden';
 
148
  $submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' &raquo;';
149
 
150
  return $submit;
20
  * @param $mod Module.
21
  */
22
  function __construct( $mod ) {
23
+ /* translators: the Feature Manager allows users to (de)activate other modules of the plugin. */
24
  $this->name = __( 'Feature Manager', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
25
  $this->prefix = 'aiosp_feature_manager_'; // Option prefix.
26
  $this->file = __FILE__; // The current file.
27
  parent::__construct();
28
  $this->module_info = array(
29
  'sitemap' => array(
30
+ /* translators: the XML Sitemaps module allows users to generate a sitemap in .xml format for their website and
31
+ submit it to search engines such as Google, Bing and Yahoo. */
32
  'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
33
  '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' ),
34
  ),
35
  'opengraph' => array(
36
+ /* translators: the Social Meta module allows users to add Open Graph (OG:) meta tags to their site's post/pages
37
+ to control the appearance of them when shared on social media networks like Facebook and Twitter. */
38
  'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
39
+ /* translators: Social Meta refers to Open Graph (OG:) meta tags, which can be used to control the appearance
40
+ of a site's posts/pages when shared on social media networks like Facebook and Twitter. */
41
  'description' => __( 'Add Social Meta data to your site to deliver closer integration between your website/blog and social media.', 'all-in-one-seo-pack' ),
42
  ),
43
  'robots' => array(
44
+ /* translators: the Robots.txt module allows users to provide instructions to web robots, e.g. search engine crawlers. */
45
  'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
46
  'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ),
47
  ),
48
  'file_editor' => array(
49
+ /* translators: the File Editor module allows users to edit the robots.txt file or .htaccess file on their site. */
50
  'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
51
  'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ),
52
  ),
53
  'importer_exporter' => array(
54
+ /* translators: the Importer & Exporter module allows users to import/export their All in One SEO Pack
55
+ settings for backup purposes or when migrating their site. */
56
  'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
57
  'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ),
58
  ),
59
  'bad_robots' => array(
60
+ /* translators: the Bad Bot Blocker module allows users to block requests from user agents that are known to misbehave. */
61
  'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
62
+ /* translators: 'bots' refers to user agents/web robots that misbehave. */
63
  'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ),
64
  ),
65
  'performance' => array(
66
+ /* translators: the Performance module allows users to set certain performance related settings and
67
+ check the status of their WordPress installation. */
68
  'name' => __( 'Performance', 'all-in-one-seo-pack' ),
69
  'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
70
  'default' => 'on',
74
  if ( AIOSEOPPRO ) {
75
 
76
  $this->module_info['coming_soon'] = array(
77
+ /* translators: this refers to a feature that will be launched in the near future. */
78
  'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
79
+ /* translators: the Image SEO module allows users to optimize their images for search engines. */
80
  'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
81
  'save' => false,
82
  );
83
  $this->module_info['video_sitemap'] = array(
84
+ /*translators: the Video Sitemap module allows users to generate a sitemap with video content in .xml format
85
+ for their website and submit it to search engines such as Google, Bing and Yahoo. */
86
  'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
87
  'description' => __( 'Create and manage your Video Sitemap using this feature and submit your Video Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
88
  );
91
 
92
  $this->module_info['coming_soon'] = array(
93
  'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
94
+ /* translators: this refers to a module that is exclusively available in All in One SEO Pack Pro. */
95
  'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
96
  'save' => false,
97
  );
165
  function filter_submit( $submit ) {
166
  $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' &raquo;';
167
  $submit['Submit']['class'] .= ' hidden';
168
+ /* translators: this button deactivates all active modules of the plugin. */
169
  $submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' &raquo;';
170
 
171
  return $submit;
modules/aioseop_opengraph.php CHANGED
@@ -1,1730 +1,1740 @@
1
- <?php
2
- /**
3
- * The Opengraph class.
4
- *
5
- * @package All-in-One-SEO-Pack
6
- * @version 2.3.16
7
- */
8
- if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
9
- class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
10
- var $fb_object_types;
11
- var $type;
12
-
13
- /**
14
- * Module constructor.
15
- *
16
- * @since 2.3.14 Added display filter.
17
- * @since 2.3.16 #1066 Force init on constructor.
18
- */
19
- function __construct() {
20
- add_action( 'admin_enqueue_scripts', array( $this, 'og_admin_enqueue_scripts' ) );
21
-
22
- $this->name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
23
- $this->prefix = 'aiosp_opengraph_'; // option prefix
24
- $this->file = __FILE__; // the current file
25
- $this->fb_object_types = array(
26
- 'Activities' => array(
27
- 'activity' => __( 'Activity', 'all-in-one-seo-pack' ),
28
- 'sport' => __( 'Sport', 'all-in-one-seo-pack' ),
29
- ),
30
- 'Businesses' => array(
31
- 'bar' => __( 'Bar', 'all-in-one-seo-pack' ),
32
- 'company' => __( 'Company', 'all-in-one-seo-pack' ),
33
- 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ),
34
- 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ),
35
- 'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' ),
36
- ),
37
- 'Groups' => array(
38
- 'cause' => __( 'Cause', 'all-in-one-seo-pack' ),
39
- 'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ),
40
- 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ),
41
- ),
42
- 'Organizations' => array(
43
- 'band' => __( 'Band', 'all-in-one-seo-pack' ),
44
- 'government' => __( 'Government', 'all-in-one-seo-pack' ),
45
- 'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ),
46
- 'school' => __( 'School', 'all-in-one-seo-pack' ),
47
- 'university' => __( 'University', 'all-in-one-seo-pack' ),
48
- ),
49
- 'People' => array(
50
- 'actor' => __( 'Actor', 'all-in-one-seo-pack' ),
51
- 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ),
52
- 'author' => __( 'Author', 'all-in-one-seo-pack' ),
53
- 'director' => __( 'Director', 'all-in-one-seo-pack' ),
54
- 'musician' => __( 'Musician', 'all-in-one-seo-pack' ),
55
- 'politician' => __( 'Politician', 'all-in-one-seo-pack' ),
56
- 'profile' => __( 'Profile', 'all-in-one-seo-pack' ),
57
- 'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' ),
58
- ),
59
- 'Places' => array(
60
- 'city' => __( 'City', 'all-in-one-seo-pack' ),
61
- 'country' => __( 'Country', 'all-in-one-seo-pack' ),
62
- 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ),
63
- 'state_province' => __( 'State Province', 'all-in-one-seo-pack' ),
64
- ),
65
- 'Products and Entertainment' => array(
66
- 'album' => __( 'Album', 'all-in-one-seo-pack' ),
67
- 'book' => __( 'Book', 'all-in-one-seo-pack' ),
68
- 'drink' => __( 'Drink', 'all-in-one-seo-pack' ),
69
- 'food' => __( 'Food', 'all-in-one-seo-pack' ),
70
- 'game' => __( 'Game', 'all-in-one-seo-pack' ),
71
- 'movie' => __( 'Movie', 'all-in-one-seo-pack' ),
72
- 'product' => __( 'Product', 'all-in-one-seo-pack' ),
73
- 'song' => __( 'Song', 'all-in-one-seo-pack' ),
74
- 'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ),
75
- 'episode' => __( 'Episode', 'all-in-one-seo-pack' ),
76
- ),
77
- 'Websites' => array(
78
- 'article' => __( 'Article', 'all-in-one-seo-pack' ),
79
- 'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
80
- 'website' => __( 'Website', 'all-in-one-seo-pack' ),
81
- ),
82
- );
83
- parent::__construct();
84
-
85
- $this->help_text = array(
86
- 'setmeta' => __( 'Checking this box will use the Home Title and Home Description set in All in One SEO Pack, General Settings as the Open Graph title and description for your home page.', 'all-in-one-seo-pack' ),
87
- 'key' => __( 'Enter your Facebook Admin ID here. You can enter multiple IDs separated by a comma. You can look up your Facebook ID using this tool http://findmyfbid.com/', 'all-in-one-seo-pack' ),
88
- 'appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ),
89
- 'title_shortcodes' => __( 'Run shortcodes that appear in social title meta tags.', 'all-in-one-seo-pack' ),
90
- 'description_shortcodes' => __( 'Run shortcodes that appear in social description meta tags.', 'all-in-one-seo-pack' ),
91
- 'sitename' => __( 'The Site Name is the name that is used to identify your website.', 'all-in-one-seo-pack' ),
92
- 'hometitle' => __( 'The Home Title is the Open Graph title for your home page.', 'all-in-one-seo-pack' ),
93
- 'description' => __( 'The Home Description is the Open Graph description for your home page.', 'all-in-one-seo-pack' ),
94
- 'homeimage' => __( 'The Home Image is the Open Graph image for your home page.', 'all-in-one-seo-pack' ),
95
- 'generate_descriptions' => __( 'This option will auto generate your Open Graph descriptions from your post content instead of your post excerpt. WooCommerce users should read the documentation regarding this setting.', 'all-in-one-seo-pack' ),
96
- 'defimg' => __( 'This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.', 'all-in-one-seo-pack' ),
97
- 'fallback' => __( 'This option lets you fall back to the default image if no image could be found above.', 'all-in-one-seo-pack' ),
98
- 'dimg' => __( 'This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.', 'all-in-one-seo-pack' ),
99
- 'dimgwidth' => __( 'This option lets you set a default width for your images, where unspecified.', 'all-in-one-seo-pack' ),
100
- 'dimgheight' => __( 'This option lets you set a default height for your images, where unspecified.', 'all-in-one-seo-pack' ),
101
- 'meta_key' => __( 'Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.', 'all-in-one-seo-pack' ),
102
- 'image' => __( 'This option lets you select the Open Graph image that will be used for this Page or Post, overriding the default settings.', 'all-in-one-seo-pack' ),
103
- 'customimg' => __( 'This option lets you upload an image to use as the Open Graph image for this Page or Post.', 'all-in-one-seo-pack' ),
104
- 'imagewidth' => __( 'Enter the width for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ),
105
- 'imageheight' => __( 'Enter the height for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ),
106
- 'video' => __( 'This option lets you specify a link to the Open Graph video used on this Page or Post.', 'all-in-one-seo-pack' ),
107
- 'videowidth' => __( 'Enter the width for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ),
108
- 'videoheight' => __( 'Enter the height for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ),
109
- 'defcard' => __( 'Select the default type of Twitter Card to display.', 'all-in-one-seo-pack' ),
110
- 'setcard' => __( 'Select the Twitter Card type to use for this Page or Post, overriding the default setting.', 'all-in-one-seo-pack' ),
111
- 'twitter_site' => __( 'Enter the Twitter username associated with your website here.', 'all-in-one-seo-pack' ),
112
- 'twitter_creator' => __( 'Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.', 'all-in-one-seo-pack' ),
113
- 'twitter_domain' => __( 'Enter the name of your website here.', 'all-in-one-seo-pack' ),
114
- 'customimg_twitter' => __( 'This option lets you upload an image to use as the Twitter image for this Page or Post.', 'all-in-one-seo-pack' ),
115
- 'gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ),
116
- 'gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ),
117
- 'gen_categories' => __( 'Use categories in generated article tags.', 'all-in-one-seo-pack' ),
118
- 'gen_post_tags' => __( 'Use post tags in generated article tags.', 'all-in-one-seo-pack' ),
119
- 'types' => __( 'Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.', 'all-in-one-seo-pack' ),
120
- 'title' => __( 'This is the Open Graph title of this Page or Post.', 'all-in-one-seo-pack' ),
121
- 'desc' => __( 'This is the Open Graph description of this Page or Post.', 'all-in-one-seo-pack' ),
122
- 'category' => __( 'Select the Open Graph type that best describes the content of this Page or Post.', 'all-in-one-seo-pack' ),
123
- 'facebook_debug' => __( 'Press this button to have Facebook re-fetch and debug this page.', 'all-in-one-seo-pack' ),
124
- 'section' => __( 'This Open Graph meta allows you to add a general section name that best describes this content.', 'all-in-one-seo-pack' ),
125
- 'tag' => __( 'This Open Graph meta allows you to add a list of keywords that best describe this content.', 'all-in-one-seo-pack' ),
126
- 'facebook_publisher' => __( 'Link articles to the Facebook page associated with your website.', 'all-in-one-seo-pack' ),
127
- 'facebook_author' => __( 'Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.', 'all-in-one-seo-pack' ),
128
- 'person_or_org' => __( 'Are the social profile links for your website for a person or an organization?', 'all-in-one-seo-pack' ),
129
- 'profile_links' => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ),
130
- 'social_name' => __( 'Add the name of the person or organization who owns these profiles.', 'all-in-one-seo-pack' ),
131
- );
132
-
133
- $this->help_anchors = array(
134
- 'title_shortcodes' => '#run-shortcodes-in-title',
135
- 'description_shortcodes' => '#run-shortcodes-in-description',
136
- 'generate_descriptions' => '#auto-generate-og-descriptions',
137
- 'setmeta' => '#use-aioseo-title-and-description',
138
- 'sitename' => '#site-name',
139
- 'hometitle' => '#home-title-and-description',
140
- 'description' => '#home-title-and-description',
141
- 'homeimage' => '#home-image',
142
- 'defimg' => '#select-og-image-source',
143
- 'fallback' => '#use-default-if-no-image-found',
144
- 'dimg' => '#default-og-image',
145
- 'dimgwidth' => '#default-image-width',
146
- 'dimgheight' => '#default-image-height',
147
- 'meta_key' => '#use-custom-field-for-image',
148
- 'profile_links' => '#social-profile-links',
149
- 'person_or_org' => '#social-profile-links',
150
- 'social_name' => '#social-profile-links',
151
- 'key' => '#facebook-admin-id',
152
- 'appid' => '#facebook-app-id',
153
- 'gen_tags' => '#automatically-generate-article-tags',
154
- 'gen_keywords' => '#use-keywords-in-article-tags',
155
- 'gen_categories' => '#use-categories-in-article-tags',
156
- 'gen_post_tags' => '#use-post-tags-in-article-tags',
157
- 'facebook_publisher' => '#show-facebook-publisher-on-articles',
158
- 'facebook_author' => '#show-facebook-author-on-articles',
159
- 'types' => '#enable-facebook-meta-for',
160
- 'defcard' => '#default-twitter-card',
161
- 'twitter_site' => '#twitter-site',
162
- 'twitter_creator' => '#show-twitter-author',
163
- 'twitter_domain' => '#twitter-domain',
164
- 'scan_header' => '#scan-social-meta',
165
- 'title' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#title',
166
- 'desc' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#description',
167
- 'image' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#image',
168
- 'customimg' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-image',
169
- 'imagewidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height',
170
- 'imageheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height',
171
- 'video' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-video',
172
- 'videowidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height',
173
- 'videoheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height',
174
- 'category' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-object-type',
175
- 'facebook_debug' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-debug',
176
- 'section' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-section',
177
- 'tag' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-tags',
178
- 'setcard' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#twitter-card-type',
179
- 'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image',
180
- );
181
-
182
- if ( is_admin() ) {
183
- add_action( 'admin_init', array( $this, 'admin_init' ), 5 );
184
- } else {
185
- add_action( 'wp', array( $this, 'type_setup' ) );
186
- }
187
-
188
- if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
189
- $this->do_opengraph();
190
- }
191
- // Set variables after WordPress load.
192
- add_action( 'init', array( &$this, 'init' ), 999999 );
193
- add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags
194
- // Force refresh of Facebook cache.
195
- add_action( 'post_updated', array( &$this, 'force_fb_refresh_update' ), 10, 3 );
196
- add_action( 'transition_post_status', array( &$this, 'force_fb_refresh_transition' ), 10, 3 );
197
- add_action( 'edited_term', array( &$this, 'save_tax_data' ), 10, 3 );
198
- // Adds special filters
199
- add_filter( 'aioseop_opengraph_placeholder', array( &$this, 'filter_placeholder' ) );
200
- // Call to init to generate menus
201
- $this->init();
202
- }
203
-
204
- /**
205
- * Hook called after WordPress has been loaded.
206
- * @since 2.4.14
207
- */
208
- public function init() {
209
- $count_desc = __( ' characters. Open Graph allows up to a maximum of %1$s chars for the %2$s.', 'all-in-one-seo-pack' );
210
- // Create default options
211
- $this->default_options = array(
212
- 'scan_header' => array(
213
- 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ),
214
- 'type' => 'custom',
215
- 'save' => true,
216
- ),
217
- 'setmeta' => array(
218
- 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ),
219
- 'type' => 'checkbox',
220
- ),
221
- 'key' => array(
222
- 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ),
223
- 'default' => '',
224
- 'type' => 'text',
225
- ),
226
- 'appid' => array(
227
- 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ),
228
- 'default' => '',
229
- 'type' => 'text',
230
- ),
231
- 'title_shortcodes' => array(
232
- 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ),
233
- ),
234
- 'description_shortcodes' => array(
235
- 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ),
236
- ),
237
- 'sitename' => array(
238
- 'name' => __( 'Site Name', 'all-in-one-seo-pack' ),
239
- 'default' => get_bloginfo( 'name' ),
240
- 'type' => 'text',
241
- ),
242
- 'hometitle' => array(
243
- 'name' => __( 'Home Title', 'all-in-one-seo-pack' ),
244
- 'default' => '',
245
- 'type' => 'textarea',
246
- 'condshow' => array(
247
- 'aiosp_opengraph_setmeta' => array(
248
- 'lhs' => 'aiosp_opengraph_setmeta',
249
- 'op' => '!=',
250
- 'rhs' => 'on',
251
- ),
252
- ),
253
- ),
254
- 'description' => array(
255
- 'name' => __( 'Home Description', 'all-in-one-seo-pack' ),
256
- 'default' => '',
257
- 'type' => 'textarea',
258
- 'condshow' => array(
259
- 'aiosp_opengraph_setmeta' => array(
260
- 'lhs' => 'aiosp_opengraph_setmeta',
261
- 'op' => '!=',
262
- 'rhs' => 'on',
263
- ),
264
- ),
265
- ),
266
- 'homeimage' => array(
267
- 'name' => __( 'Home Image', 'all-in-one-seo-pack' ),
268
- 'type' => 'image',
269
- ),
270
- 'generate_descriptions' => array(
271
- 'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ),
272
- 'default' => 0,
273
- ),
274
- 'defimg' => array(
275
- 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ),
276
- 'type' => 'select',
277
- 'initial_options' => array(
278
- '' => __( 'Default Image' ),
279
- 'featured' => __( 'Featured Image' ),
280
- 'attach' => __( 'First Attached Image' ),
281
- 'content' => __( 'First Image In Content' ),
282
- 'custom' => __( 'Image From Custom Field' ),
283
- 'author' => __( 'Post Author Image' ),
284
- 'auto' => __( 'First Available Image' ),
285
- ),
286
- ),
287
- 'fallback' => array(
288
- 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ),
289
- 'type' => 'checkbox',
290
- ),
291
- 'dimg' => array(
292
- 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ),
293
- 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png',
294
- 'type' => 'image',
295
- ),
296
- 'dimgwidth' => array(
297
- 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ),
298
- 'type' => 'text',
299
- 'default' => '',
300
- ),
301
- 'dimgheight' => array(
302
- 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ),
303
- 'type' => 'text',
304
- 'default' => '',
305
- ),
306
- 'meta_key' => array(
307
- 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ),
308
- 'type' => 'text',
309
- 'default' => '',
310
- ),
311
- 'image' => array(
312
- 'name' => __( 'Image', 'all-in-one-seo-pack' ),
313
- 'type' => 'radio',
314
- 'initial_options' => array(
315
- 0 => '<img style="width:50px;height:auto;display:inline-block;vertical-align:bottom;" src="' . AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png' . '">',
316
- ),
317
- ),
318
- 'customimg' => array(
319
- 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ),
320
- 'type' => 'image',
321
- ),
322
- 'imagewidth' => array(
323
- 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ),
324
- 'type' => 'text',
325
- 'default' => '',
326
- ),
327
- 'imageheight' => array(
328
- 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ),
329
- 'type' => 'text',
330
- 'default' => '',
331
- ),
332
- 'video' => array(
333
- 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ),
334
- 'type' => 'text',
335
- ),
336
- 'videowidth' => array(
337
- 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ),
338
- 'type' => 'text',
339
- 'default' => '',
340
- 'condshow' => array(
341
- 'aioseop_opengraph_settings_video' => array(
342
- 'lhs' => 'aioseop_opengraph_settings_video',
343
- 'op' => '!=',
344
- 'rhs' => '',
345
- ),
346
- ),
347
- ),
348
- 'videoheight' => array(
349
- 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ),
350
- 'type' => 'text',
351
- 'default' => '',
352
- 'condshow' => array(
353
- 'aioseop_opengraph_settings_video' => array(
354
- 'lhs' => 'aioseop_opengraph_settings_video',
355
- 'op' => '!=',
356
- 'rhs' => '',
357
- ),
358
- ),
359
- ),
360
- 'defcard' => array(
361
- 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ),
362
- 'type' => 'select',
363
- 'default' => 'summary',
364
- 'initial_options' => array(
365
- 'summary' => __( 'Summary', 'all-in-one-seo-pack' ),
366
- 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ),
367
-
368
- /*
369
- REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE
370
- 'photo' => __( 'Photo', 'all-in-one-seo-pack' )
371
- */
372
- ),
373
- ),
374
- 'setcard' => array(
375
- 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ),
376
- 'type' => 'select',
377
- 'initial_options' => array(
378
- 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ),
379
- 'summary' => __( 'Summary', 'all-in-one-seo-pack' ),
380
-
381
- /*
382
- REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE
383
- 'photo' => __( 'Photo', 'all-in-one-seo-pack' )
384
- */
385
- ),
386
- ),
387
- 'twitter_site' => array(
388
- 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ),
389
- 'type' => 'text',
390
- 'default' => '',
391
- ),
392
- 'twitter_creator' => array(
393
- 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ),
394
- ),
395
- 'twitter_domain' => array(
396
- 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ),
397
- 'type' => 'text',
398
- 'default' => '',
399
- ),
400
- 'customimg_twitter' => array(
401
- 'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ),
402
- 'type' => 'image',
403
- ),
404
- 'gen_tags' => array(
405
- 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ),
406
- ),
407
- 'gen_keywords' => array(
408
- 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ),
409
- 'default' => 'on',
410
- 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
411
- ),
412
- 'gen_categories' => array(
413
- 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ),
414
- 'default' => 'on',
415
- 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
416
- ),
417
- 'gen_post_tags' => array(
418
- 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ),
419
- 'default' => 'on',
420
- 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
421
- ),
422
- 'types' => array(
423
- 'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ),
424
- 'type' => 'multicheckbox',
425
- 'default' => array( 'post' => 'post', 'page' => 'page' ),
426
- 'initial_options' => $this->get_post_type_titles( array( '_builtin' => false ) ),
427
- ),
428
- 'title' => array(
429
- 'name' => __( 'Title', 'all-in-one-seo-pack' ),
430
- 'default' => '',
431
- 'type' => 'text',
432
- 'size' => 95,
433
- 'count' => 1,
434
- 'count_desc' => $count_desc,
435
- ),
436
- 'desc' => array(
437
- 'name' => __( 'Description', 'all-in-one-seo-pack' ),
438
- 'default' => '',
439
- 'type' => 'textarea',
440
- 'cols' => 250,
441
- 'rows' => 4,
442
- 'count' => 1,
443
- 'count_desc' => $count_desc,
444
- ),
445
- 'category' => array(
446
- 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
447
- 'type' => 'select',
448
- 'style' => '',
449
- 'default' => '',
450
- 'initial_options' => $this->fb_object_types,
451
- ),
452
- 'facebook_debug' => array(
453
- 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ),
454
- 'type' => 'html',
455
- 'save' => false,
456
- 'default' => $this->get_facebook_debug(),
457
- ),
458
- 'section' => array(
459
- 'name' => __( 'Article Section', 'all-in-one-seo-pack' ),
460
- 'type' => 'text',
461
- 'default' => '',
462
- 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ),
463
- ),
464
- 'tag' => array(
465
- 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ),
466
- 'type' => 'text',
467
- 'default' => '',
468
- 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ),
469
- ),
470
- 'facebook_publisher' => array(
471
- 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ),
472
- 'type' => 'text',
473
- 'default' => '',
474
- ),
475
- 'facebook_author' => array(
476
- 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ),
477
- ),
478
- 'profile_links' => array(
479
- 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
480
- 'type' => 'textarea',
481
- 'cols' => 60,
482
- 'rows' => 5,
483
- ),
484
- 'person_or_org' => array(
485
- 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ),
486
- 'type' => 'radio',
487
- 'initial_options' => array(
488
- 'person' => __( 'Person', 'all-in-one-seo-pack' ),
489
- 'org' => __( 'Organization', 'all-in-one-seo-pack' ),
490
- ),
491
- ),
492
- 'social_name' => array(
493
- 'name' => __( 'Associated Name', 'all-in-one-seo-pack' ),
494
- 'type' => 'text',
495
- 'default' => '',
496
- ),
497
- );
498
- // load initial options / set defaults
499
- $this->update_options();
500
- $display = array();
501
- if ( isset( $this->options['aiosp_opengraph_types'] ) && ! empty( $this->options['aiosp_opengraph_types'] ) ) {
502
- $display = $this->options['aiosp_opengraph_types'];
503
- }
504
- $this->locations = array(
505
- 'opengraph' => array(
506
- 'name' => $this->name,
507
- 'prefix' => 'aiosp_',
508
- 'type' => 'settings',
509
- 'options' => array(
510
- 'scan_header',
511
- 'setmeta',
512
- 'key',
513
- 'appid',
514
- 'sitename',
515
- 'title_shortcodes',
516
- 'description_shortcodes',
517
- 'hometitle',
518
- 'description',
519
- 'homeimage',
520
- 'generate_descriptions',
521
- 'defimg',
522
- 'fallback',
523
- 'dimg',
524
- 'dimgwidth',
525
- 'dimgheight',
526
- 'meta_key',
527
- 'defcard',
528
- 'profile_links',
529
- 'person_or_org',
530
- 'social_name',
531
- 'twitter_site',
532
- 'twitter_creator',
533
- 'twitter_domain',
534
- 'gen_tags',
535
- 'gen_keywords',
536
- 'gen_categories',
537
- 'gen_post_tags',
538
- 'types',
539
- 'facebook_publisher',
540
- 'facebook_author',
541
- ),
542
- ),
543
- 'settings' => array(
544
- 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ),
545
- 'type' => 'metabox',
546
- 'help_link' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/',
547
- 'options' => array(
548
- 'title',
549
- 'desc',
550
- 'image',
551
- 'customimg',
552
- 'imagewidth',
553
- 'imageheight',
554
- 'video',
555
- 'videowidth',
556
- 'videoheight',
557
- 'category',
558
- 'facebook_debug',
559
- 'section',
560
- 'tag',
561
- 'setcard',
562
- 'customimg_twitter',
563
- ),
564
- 'display' => apply_filters( 'aioseop_opengraph_display', $display ),
565
- 'prefix' => 'aioseop_opengraph_',
566
- ),
567
- );
568
- $this->layout = array(
569
- 'home' => array(
570
- 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
571
- 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description',
572
- 'options' => array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ),
573
- ),
574
- 'image' => array(
575
- 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ),
576
- 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#select-og-image-source',
577
- 'options' => array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ),
578
- ),
579
- 'links' => array(
580
- 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
581
- 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#social-profile-links',
582
- 'options' => array( 'profile_links', 'person_or_org', 'social_name' ),
583
- ),
584
- 'facebook' => array(
585
- 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ),
586
- 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#facebook-settings',
587
- 'options' => array(
588
- 'key',
589
- 'appid',
590
- 'types',
591
- 'gen_tags',
592
- 'gen_keywords',
593
- 'gen_categories',
594
- 'gen_post_tags',
595
- 'facebook_publisher',
596
- 'facebook_author',
597
- ),
598
- ),
599
- 'twitter' => array(
600
- 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ),
601
- 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#default-twitter-card',
602
- 'options' => array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ),
603
- ),
604
- 'default' => array(
605
- 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ),
606
- 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/',
607
- 'options' => array(), // this is set below, to the remaining options -- pdb
608
- ),
609
- 'scan_meta' => array(
610
- 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ),
611
- 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#scan_meta',
612
- 'options' => array( 'scan_header' ),
613
- ),
614
- );
615
- $other_options = array();
616
- foreach ( $this->layout as $k => $v ) {
617
- $other_options = array_merge( $other_options, $v['options'] );
618
- }
619
-
620
- $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
621
- }
622
-
623
- /**
624
- * Forces FaceBook OpenGraph to refresh its cache when a post is changed to
625
- *
626
- * @param $new_status
627
- * @param $old_status
628
- * @param $post
629
- *
630
- * @todo this and force_fb_refresh_update can probably have the remote POST extracted out.
631
- *
632
- * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update
633
- * @since 2.3.11
634
- */
635
- function force_fb_refresh_transition( $new_status, $old_status, $post ) {
636
- if ( 'publish' !== $new_status ) {
637
- return;
638
- }
639
- if ( 'future' !== $old_status ) {
640
- return;
641
- }
642
-
643
- $current_post_type = get_post_type();
644
-
645
- // Only ping Facebook if Social SEO is enabled on this post type.
646
- if ( $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) {
647
- $post_url = aioseop_get_permalink( $post->ID );
648
- $endpoint = sprintf(
649
- 'https://graph.facebook.com/?%s', http_build_query(
650
- array(
651
- 'id' => $post_url,
652
- 'scrape' => true,
653
- )
654
- )
655
- );
656
- wp_remote_post( $endpoint, array( 'blocking' => false ) );
657
- }
658
- }
659
-
660
- /**
661
- * Forces FaceBook OpenGraph refresh on update.
662
- *
663
- * @param $post_id
664
- * @param $post_after
665
- *
666
- * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update
667
- * @since 2.3.11
668
- */
669
- function force_fb_refresh_update( $post_id, $post_after ) {
670
-
671
- $current_post_type = get_post_type();
672
-
673
- // Only ping Facebook if Social SEO is enabled on this post type.
674
- if ( 'publish' === $post_after->post_status && $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) {
675
- $post_url = aioseop_get_permalink( $post_id );
676
- $endpoint = sprintf(
677
- 'https://graph.facebook.com/?%s', http_build_query(
678
- array(
679
- 'id' => $post_url,
680
- 'scrape' => true,
681
- )
682
- )
683
- );
684
- wp_remote_post( $endpoint, array( 'blocking' => false ) );
685
- }
686
- }
687
-
688
- function settings_page_init() {
689
- add_filter( 'aiosp_output_option', array( $this, 'display_custom_options' ), 10, 2 );
690
- }
691
-
692
- function filter_options( $options, $location ) {
693
- if ( $location == 'settings' ) {
694
- $prefix = $this->get_prefix( $location ) . $location . '_';
695
- list( $legacy, $images ) = $this->get_all_images( $options );
696
- if ( isset( $options ) && isset( $options[ "{$prefix}image" ] ) ) {
697
- $thumbnail = $options[ "{$prefix}image" ];
698
- if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) {
699
- if ( $thumbnail == 'post' ) {
700
- $thumbnail = $images['post1'];
701
- } elseif ( ! empty( $legacy[ $thumbnail ] ) ) {
702
- $thumbnail = $legacy[ $thumbnail ];
703
- }
704
- }
705
- $options[ "{$prefix}image" ] = $thumbnail;
706
- }
707
- if ( empty( $options[ $prefix . 'image' ] ) ) {
708
- $img = array_keys( $images );
709
- if ( ! empty( $img ) && ! empty( $img[1] ) ) {
710
- $options[ $prefix . 'image' ] = $img[1];
711
- }
712
- }
713
- }
714
-
715
- return $options;
716
- }
717
-
718
- /**
719
- * Applies filter to module settings.
720
- *
721
- * @since 2.3.11
722
- * @since 2.4.14 Added filter for description and title placeholders.
723
- * @since 2.3.15 do_shortcode on description.
724
- *
725
- * @see [plugin]\admin\aioseop_module_class.php > display_options()
726
- */
727
- function filter_settings( $settings, $location, $current ) {
728
- global $aiosp, $post;
729
- if ( $location == 'opengraph' || $location == 'settings' ) {
730
- $prefix = $this->get_prefix( $location ) . $location . '_';
731
- if ( $location == 'opengraph' ) {
732
- return $settings;
733
- }
734
- if ( $location == 'settings' ) {
735
- list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current );
736
- $opts = array( 'title', 'desc' );
737
- $current_post_type = get_post_type();
738
- if ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) {
739
- $flat_type_list = array();
740
- foreach ( $this->fb_object_types as $k => $v ) {
741
- if ( is_array( $v ) ) {
742
- $flat_type_list = array_merge( $flat_type_list, $v );
743
- } else {
744
- $flat_type_list[ $k ] = $v;
745
- }
746
- }
747
- $settings[ $prefix . 'category' ]['initial_options'] = array_merge(
748
- array(
749
- $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - '
750
- . $flat_type_list[ $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ],
751
- ),
752
- $settings[ $prefix . 'category' ]['initial_options']
753
- );
754
- }
755
- if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) {
756
- $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard'];
757
- }
758
- $info = $aiosp->get_page_snippet_info();
759
- // @codingStandardsIgnoreStart
760
- extract( $info );
761
- // @codingStandardsIgnoreEnd
762
-
763
- // Description options
764
- if ( is_object( $post ) ) {
765
- // Always show excerpt
766
- $description = empty( $this->options['aiosp_opengraph_generate_descriptions'] )
767
- ? $aiosp->trim_excerpt_without_filters(
768
- $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ),
769
- 1000
770
- )
771
- : $aiosp->trim_excerpt_without_filters(
772
- $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ),
773
- 1000
774
- );
775
- }
776
-
777
- // Add filters
778
- $description = apply_filters( 'aioseop_description', $description );
779
- // Add placholders
780
- $settings[ "{$prefix}title" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title );
781
- $settings[ "{$prefix}desc" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description );
782
- }
783
- if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) {
784
- foreach ( $opts as $opt ) {
785
- if ( isset( $settings[ $prefix . $opt ] ) ) {
786
- $settings[ $prefix . $opt ]['type'] = 'hidden';
787
- $settings[ $prefix . $opt ]['label'] = 'none';
788
- $settings[ $prefix . $opt ]['help_text'] = '';
789
- unset( $settings[ $prefix . $opt ]['count'] );
790
- }
791
- }
792
- }
793
- }
794
-
795
- return $settings;
796
- }
797
-
798
- /**
799
- * Applies filter to module options.
800
- * These will display in the "Social Settings" object tab.
801
- * filter:{prefix}override_options
802
- *
803
- * @since 2.3.11
804
- * @since 2.4.14 Overrides empty og:type values.
805
- *
806
- * @see [plugin]\admin\aioseop_module_class.php > display_options()
807
- *
808
- * @global array $aioseop_options Plugin options.
809
- *
810
- * @param array $options Current options.
811
- * @param string $location Location where filter is called.
812
- * @param array $settings Settings.
813
- *
814
- * @return array
815
- */
816
- function override_options( $options, $location, $settings ) {
817
- global $aioseop_options;
818
- // Prepare default and prefix
819
- $prefix = $this->get_prefix( $location ) . $location . '_';
820
- $opts = array();
821
- foreach ( $settings as $k => $v ) {
822
- if ( $v['save'] ) {
823
- $opts[ $k ] = $v['default'];
824
- }
825
- }
826
- foreach ( $options as $k => $v ) {
827
- switch ( $k ) {
828
- case $prefix . 'category':
829
- if ( empty( $v ) ) {
830
- // Get post type
831
- $type = isset( get_current_screen()->post_type )
832
- ? get_current_screen()->post_type
833
- : null;
834
- // Assign default from plugin options
835
- if ( ! empty( $type )
836
- && isset( $aioseop_options['modules'] )
837
- && isset( $aioseop_options['modules']['aiosp_opengraph_options'] )
838
- && isset( $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ] )
839
- ) {
840
- $options[ $prefix . 'category' ] =
841
- $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ];
842
- }
843
- continue;
844
- }
845
- break;
846
- }
847
- if ( $v === null ) {
848
- unset( $options[ $k ] );
849
- }
850
- }
851
- $options = wp_parse_args( $options, $opts );
852
-
853
- return $options;
854
- }
855
-
856
- /**
857
- * Applies filter to metabox settings before they are saved.
858
- * Sets custom as default if a custom image is uploaded.
859
- * filter:{prefix}filter_metabox_options
860
- * filter:{prefix}filter_term_metabox_options
861
- *
862
- * @since 2.3.11
863
- * @since 2.4.14 Fixes for aioseop-pro #67 and other bugs found.
864
- *
865
- * @see [plugin]\admin\aioseop_module_class.php > save_post_data()
866
- * @see [this file] > save_tax_data()
867
- *
868
- * @param array $options List of current options.
869
- * @param string $location Location where filter is called.
870
- * @param int $id Either post_id or term_id.
871
- *
872
- * @return array
873
- */
874
- function filter_metabox_options( $options, $location, $post_id ) {
875
- if ( $location == 'settings' ) {
876
- $prefix = $this->get_prefix( $location ) . $location . '_';
877
- if ( isset( $options[ $prefix . 'customimg_checker' ] )
878
- && $options[ $prefix . 'customimg_checker' ]
879
- ) {
880
- $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ];
881
- }
882
- }
883
- return $options;
884
- }
885
-
886
- /** Custom settings **/
887
- function display_custom_options( $buf, $args ) {
888
- if ( $args['name'] == 'aiosp_opengraph_scan_header' ) {
889
- $buf .= '<div class="aioseop aioseop_options aiosp_opengraph_settings"><div class="aioseop_wrapper aioseop_custom_type" id="aiosp_opengraph_scan_header_wrapper"><div class="aioseop_input" id="aiosp_opengraph_scan_header" style="padding-left:20px;">';
890
- $args['options']['type'] = 'submit';
891
- $args['attr'] = " class='button-primary' ";
892
- $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' );
893
- $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' );
894
- $buf .= '<br /><br />' . $this->get_option_html( $args );
895
- $buf .= '</div></div></div>';
896
- }
897
-
898
- return $buf;
899
- }
900
-
901
- function add_attributes( $output ) {
902
- // avoid having duplicate meta tags
903
- $type = $this->type;
904
- if ( empty( $type ) ) {
905
- $type = 'website';
906
- }
907
-
908
- $schema_types = array(
909
- 'album' => 'MusicAlbum',
910
- 'article' => 'Article',
911
- 'bar' => 'BarOrPub',
912
- 'blog' => 'Blog',
913
- 'book' => 'Book',
914
- 'cafe' => 'CafeOrCoffeeShop',
915
- 'city' => 'City',
916
- 'country' => 'Country',
917
- 'episode' => 'Episode',
918
- 'food' => 'FoodEvent',
919
- 'game' => 'Game',
920
- 'hotel' => 'Hotel',
921
- 'landmark' => 'LandmarksOrHistoricalBuildings',
922
- 'movie' => 'Movie',
923
- 'product' => 'Product',
924
- 'profile' => 'ProfilePage',
925
- 'restaurant' => 'Restaurant',
926
- 'school' => 'School',
927
- 'sport' => 'SportsEvent',
928
- 'website' => 'WebSite',
929
- );
930
-
931
- if ( ! empty( $schema_types[ $type ] ) ) {
932
- $type = $schema_types[ $type ];
933
- } else {
934
- $type = 'WebSite';
935
- }
936
-
937
- $attributes = apply_filters(
938
- $this->prefix . 'attributes', array(
939
- 'itemscope',
940
- 'itemtype="http://schema.org/' . ucfirst( $type ) . '"',
941
- 'prefix="og: http://ogp.me/ns#"',
942
- )
943
- );
944
-
945
- foreach ( $attributes as $attr ) {
946
- if ( strpos( $output, $attr ) === false ) {
947
- $output .= "\n\t$attr ";
948
- }
949
- }
950
-
951
- return $output;
952
- }
953
-
954
- /**
955
- * Add our social meta.
956
- *
957
- * @since 1.0.0
958
- * @since 2.3.11.5 Support for multiple fb_admins.
959
- * @since 2.3.13 Adds filter:aioseop_description on description.
960
- * @since 2.4.14 Fixes for aioseop-pro #67.
961
- * @since 2.3.15 Always do_shortcode on descriptions, removed for titles.
962
- *
963
- * @global object $post Current WP_Post object.
964
- * @global object $aiosp All in one seo plugin object.
965
- * @global array $aioseop_options All in one seo plugin options.
966
- * @global object $wp_query WP_Query global instance.
967
- */
968
- function add_meta() {
969
- global $post, $aiosp, $aioseop_options, $wp_query;
970
- $metabox = $this->get_current_options( array(), 'settings' );
971
- $key = $this->options['aiosp_opengraph_key'];
972
- $dimg = $this->options['aiosp_opengraph_dimg'];
973
- $current_post_type = get_post_type();
974
- $title = $description = $image = $video = '';
975
- $type = $this->type;
976
- $sitename = $this->options['aiosp_opengraph_sitename'];
977
-
978
- $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : '';
979
-
980
- if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
981
- $first_page = false;
982
- if ( $aiosp->get_page_number() < 2 ) {
983
- $first_page = true;
984
- }
985
- } else {
986
- $first_page = true;
987
- }
988
- $url = $aiosp->aiosp_mrt_get_url( $wp_query );
989
- $url = apply_filters( 'aioseop_canonical_url', $url );
990
-
991
- $setmeta = $this->options['aiosp_opengraph_setmeta'];
992
- $social_links = '';
993
- if ( is_front_page() ) {
994
- $title = $this->options['aiosp_opengraph_hometitle'];
995
- if ( $first_page ) {
996
- $description = $this->options['aiosp_opengraph_description'];
997
- if ( empty( $description ) ) {
998
- $description = get_bloginfo( 'description' );
999
- }
1000
- }
1001
- if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) {
1002
- $thumbnail = $this->options['aiosp_opengraph_homeimage'];
1003
- } else {
1004
- $thumbnail = $this->options['aiosp_opengraph_dimg'];
1005
- }
1006
-
1007
- /* If Use AIOSEO Title and Desc Selected */
1008
- if ( $setmeta ) {
1009
- $title = $aiosp->wp_title();
1010
- if ( $first_page ) {
1011
- $description = $aiosp->get_aioseop_description( $post );
1012
- }
1013
- }
1014
-
1015
- /* Add some defaults */
1016
- if ( empty( $title ) ) {
1017
- $title = get_bloginfo( 'name' );
1018
- }
1019
- if ( empty( $sitename ) ) {
1020
- $sitename = get_bloginfo( 'name' );
1021
- }
1022
-
1023
- if ( empty( $description ) && $first_page && ! empty( $post ) && ! post_password_required( $post ) ) {
1024
-
1025
- if ( ! empty( $post->post_content ) || ! empty( $post->post_excerpt ) ) {
1026
- $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), 1000 );
1027
-
1028
- if ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) {
1029
- $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 );
1030
- }
1031
- }
1032
- }
1033
-
1034
- if ( empty( $description ) && $first_page ) {
1035
- $description = get_bloginfo( 'description' );
1036
- }
1037
- if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) {
1038
- $social_links = $this->options['aiosp_opengraph_profile_links'];
1039
- if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) {
1040
- $social_name = $this->options['aiosp_opengraph_social_name'];
1041
- } else {
1042
- $social_name = '';
1043
- }
1044
- if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) {
1045
- $social_type = 'Person';
1046
- } else {
1047
- $social_type = 'Organization';
1048
- }
1049
- }
1050
- } elseif ( is_singular() && $this->option_isset( 'types' )
1051
- && is_array( $this->options['aiosp_opengraph_types'] )
1052
- && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] )
1053
- ) {
1054
-
1055
- if ( $type == 'article' ) {
1056
- if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
1057
- $section = $metabox['aioseop_opengraph_settings_section'];
1058
- }
1059
- if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) {
1060
- $tag = $metabox['aioseop_opengraph_settings_tag'];
1061
- }
1062
- if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) {
1063
- $publisher = $this->options['aiosp_opengraph_facebook_publisher'];
1064
- }
1065
- }
1066
-
1067
- if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1068
- $domain = $this->options['aiosp_opengraph_twitter_domain'];
1069
- }
1070
-
1071
- if ( $type == 'article' && ! empty( $post ) ) {
1072
- if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
1073
- $author = get_the_author_meta( 'facebook', $post->post_author );
1074
- }
1075
-
1076
- if ( isset( $post->post_date ) ) {
1077
- $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date ) );
1078
- }
1079
-
1080
- if ( isset( $post->post_modified ) ) {
1081
- $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified ) );
1082
- }
1083
- }
1084
-
1085
- $image = $metabox['aioseop_opengraph_settings_image'];
1086
- $video = $metabox['aioseop_opengraph_settings_video'];
1087
- $title = $metabox['aioseop_opengraph_settings_title'];
1088
- $description = $metabox['aioseop_opengraph_settings_desc'];
1089
-
1090
- /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */
1091
- global $aiosp;
1092
- if ( empty( $title ) ) {
1093
- $title = $aiosp->wp_title();
1094
- }
1095
- if ( empty( $description ) ) {
1096
- $description = trim( strip_tags( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
1097
- }
1098
-
1099
- /* Add default title */
1100
- if ( empty( $title ) ) {
1101
- $title = get_the_title();
1102
- }
1103
-
1104
- // Add default description.
1105
- if ( empty( $description ) && ! post_password_required( $post ) ) {
1106
-
1107
- $description = $post->post_excerpt;
1108
-
1109
- if ( $this->options['aiosp_opengraph_generate_descriptions'] || empty( $description ) ) {
1110
- $description = $post->post_content;
1111
- }
1112
- }
1113
- if ( empty( $type ) ) {
1114
- $type = 'article';
1115
- }
1116
- } elseif ( AIOSEOPPRO && ( is_category() || is_tag() || is_tax() ) ) {
1117
- if ( isset( $this->options['aioseop_opengraph_settings_category'] ) ) {
1118
- $type = $this->options['aioseop_opengraph_settings_category'];
1119
- }
1120
- if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) {
1121
- $type = $metabox['aioseop_opengraph_settings_category'];
1122
- }
1123
- if ( $type == 'article' ) {
1124
- if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
1125
- $section = $metabox['aioseop_opengraph_settings_section'];
1126
- }
1127
- if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) {
1128
- $tag = $metabox['aioseop_opengraph_settings_tag'];
1129
- }
1130
- if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) {
1131
- $publisher = $this->options['aiosp_opengraph_facebook_publisher'];
1132
- }
1133
- }
1134
- if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1135
- $domain = $this->options['aiosp_opengraph_twitter_domain'];
1136
- }
1137
- if ( $type == 'article' && ! empty( $post ) ) {
1138
- if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
1139
- $author = get_the_author_meta( 'facebook', $post->post_author );
1140
- }
1141
- if ( isset( $post->post_date ) ) {
1142
- $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date ) );
1143
- }
1144
- if ( isset( $post->post_modified ) ) {
1145
- $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified ) );
1146
- }
1147
- }
1148
- $image = $metabox['aioseop_opengraph_settings_image'];
1149
- $video = $metabox['aioseop_opengraph_settings_video'];
1150
- $title = $metabox['aioseop_opengraph_settings_title'];
1151
- $description = $metabox['aioseop_opengraph_settings_desc'];
1152
- /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */
1153
- global $aiosp;
1154
- if ( empty( $title ) ) {
1155
- $title = $aiosp->wp_title();
1156
- }
1157
- if ( empty( $description ) ) {
1158
- $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0;
1159
- $term_id = $term_id ? $term_id : get_queried_object()->term_id;
1160
- $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) );
1161
- }
1162
- // Add default title
1163
- if ( empty( $title ) ) {
1164
- $title = get_the_title();
1165
- }
1166
- // Add default description.
1167
- if ( empty( $description ) && ! post_password_required( $post ) ) {
1168
- $description = get_queried_object()->description;
1169
- }
1170
- if ( empty( $type ) ) {
1171
- $type = 'website';
1172
- }
1173
- } elseif ( is_home() && ! is_front_page() ) {
1174
- // This is the blog page but not the homepage.
1175
- global $aiosp;
1176
- $image = $metabox['aioseop_opengraph_settings_image'];
1177
- $video = $metabox['aioseop_opengraph_settings_video'];
1178
- $title = $metabox['aioseop_opengraph_settings_title'];
1179
- $description = $metabox['aioseop_opengraph_settings_desc'];
1180
-
1181
- if ( empty( $description ) ) {
1182
- // If there's not social description, fall back to the SEO description.
1183
- $description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) );
1184
- }
1185
- if ( empty( $title ) ) {
1186
- $title = $aiosp->wp_title();
1187
- }
1188
- } else {
1189
- return;
1190
- }
1191
-
1192
- if ( $type === 'article' && ! empty( $post ) && is_singular() ) {
1193
- if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) {
1194
- if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) {
1195
- $keywords = $aiosp->get_main_keywords();
1196
- $keywords = $this->apply_cf_fields( $keywords );
1197
- $keywords = apply_filters( 'aioseop_keywords', $keywords );
1198
- if ( ! empty( $keywords ) && ! empty( $tag ) ) {
1199
- $tag .= ',' . $keywords;
1200
- } elseif ( empty( $tag ) ) {
1201
- $tag = $keywords;
1202
- }
1203
- }
1204
- $tag = $aiosp->keyword_string_to_list( $tag );
1205
- if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) {
1206
- $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) );
1207
- }
1208
- if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) {
1209
- $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) );
1210
- }
1211
- }
1212
- if ( ! empty( $tag ) ) {
1213
- $tag = $aiosp->clean_keyword_list( $tag );
1214
- }
1215
- }
1216
-
1217
- if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) {
1218
- $title = do_shortcode( $title );
1219
- }
1220
- if ( ! empty( $description ) ) {
1221
- $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) );
1222
- if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) {
1223
- $description = do_shortcode( $description );
1224
- }
1225
- $description = $aiosp->trim_excerpt_without_filters( $description, 1000 );
1226
- }
1227
-
1228
- $title = $this->apply_cf_fields( $title );
1229
- $description = $this->apply_cf_fields( $description );
1230
-
1231
- /* Data Validation */
1232
- $title = strip_tags( esc_attr( $title ) );
1233
- $sitename = strip_tags( esc_attr( $sitename ) );
1234
- $description = strip_tags( esc_attr( $description ) );
1235
-
1236
- if ( empty( $thumbnail ) && ! empty( $image ) ) {
1237
- $thumbnail = $image;
1238
- }
1239
-
1240
- // Add user supplied default image.
1241
- if ( empty( $thumbnail ) ) {
1242
- if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) {
1243
- $thumbnail = $this->options['aiosp_opengraph_dimg'];
1244
- } else {
1245
- switch ( $this->options['aiosp_opengraph_defimg'] ) {
1246
- case 'featured':
1247
- $thumbnail = $this->get_the_image_by_post_thumbnail();
1248
- break;
1249
- case 'attach':
1250
- $thumbnail = $this->get_the_image_by_attachment();
1251
- break;
1252
- case 'content':
1253
- $thumbnail = $this->get_the_image_by_scan();
1254
- break;
1255
- case 'custom':
1256
- $meta_key = $this->options['aiosp_opengraph_meta_key'];
1257
- if ( ! empty( $meta_key ) && ! empty( $post ) ) {
1258
- $meta_key = explode( ',', $meta_key );
1259
- $thumbnail = $this->get_the_image_by_meta_key(
1260
- array(
1261
- 'post_id' => $post->ID,
1262
- 'meta_key' => $meta_key,
1263
- )
1264
- );
1265
- }
1266
- break;
1267
- case 'auto':
1268
- $thumbnail = $this->get_the_image();
1269
- break;
1270
- case 'author':
1271
- $thumbnail = $this->get_the_image_by_author();
1272
- break;
1273
- default:
1274
- $thumbnail = $this->options['aiosp_opengraph_dimg'];
1275
- }
1276
- }
1277
- }
1278
-
1279
- if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) {
1280
- $thumbnail = $this->options['aiosp_opengraph_dimg'];
1281
- }
1282
-
1283
- if ( ! empty( $thumbnail ) ) {
1284
- $thumbnail = esc_url( $thumbnail );
1285
- $thumbnail = set_url_scheme( $thumbnail );
1286
- }
1287
-
1288
- $width = $height = '';
1289
- if ( ! empty( $thumbnail ) ) {
1290
- if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) {
1291
- $width = $metabox['aioseop_opengraph_settings_imagewidth'];
1292
- }
1293
- if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) {
1294
- $height = $metabox['aioseop_opengraph_settings_imageheight'];
1295
- }
1296
- if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) {
1297
- $width = $this->options['aiosp_opengraph_dimgwidth'];
1298
- }
1299
- if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) {
1300
- $height = $this->options['aiosp_opengraph_dimgheight'];
1301
- }
1302
- }
1303
-
1304
- if ( ! empty( $video ) ) {
1305
- if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) {
1306
- $videowidth = $metabox['aioseop_opengraph_settings_videowidth'];
1307
- }
1308
- if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) {
1309
- $videoheight = $metabox['aioseop_opengraph_settings_videoheight'];
1310
- }
1311
- }
1312
-
1313
- $card = 'summary';
1314
- if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) {
1315
- $card = $this->options['aiosp_opengraph_defcard'];
1316
- }
1317
-
1318
- if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) {
1319
- $card = $metabox['aioseop_opengraph_settings_setcard'];
1320
- }
1321
-
1322
- // support for changing legacy twitter cardtype-photo to summary large image
1323
- if ( $card == 'photo' ) {
1324
- $card = 'summary_large_image';
1325
- }
1326
-
1327
- $site = $domain = $creator = '';
1328
-
1329
- if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) {
1330
- $site = $this->options['aiosp_opengraph_twitter_site'];
1331
- $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site );
1332
- }
1333
-
1334
- if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1335
- $domain = $this->options['aiosp_opengraph_twitter_domain'];
1336
- }
1337
-
1338
- if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) {
1339
- $creator = get_the_author_meta( 'twitter', $post->post_author );
1340
- $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator );
1341
- }
1342
-
1343
- if ( ! empty( $thumbnail ) ) {
1344
- $twitter_thumbnail = $thumbnail; // Default Twitter image if custom isn't set.
1345
- }
1346
-
1347
- if ( isset( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) && ! empty( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) ) {
1348
- // Set Twitter image from custom.
1349
- $twitter_thumbnail = set_url_scheme( $metabox['aioseop_opengraph_settings_customimg_twitter'] );
1350
- }
1351
-
1352
- // Apply last filters.
1353
- $description = apply_filters( 'aioseop_description', $description );
1354
-
1355
- $meta = array(
1356
- 'facebook' => array(
1357
- 'title' => 'og:title',
1358
- 'type' => 'og:type',
1359
- 'url' => 'og:url',
1360
- 'thumbnail' => 'og:image',
1361
- 'width' => 'og:image:width',
1362
- 'height' => 'og:image:height',
1363
- 'video' => 'og:video',
1364
- 'videowidth' => 'og:video:width',
1365
- 'videoheight' => 'og:video:height',
1366
- 'sitename' => 'og:site_name',
1367
- 'key' => 'fb:admins',
1368
- 'appid' => 'fb:app_id',
1369
- 'description' => 'og:description',
1370
- 'section' => 'article:section',
1371
- 'tag' => 'article:tag',
1372
- 'publisher' => 'article:publisher',
1373
- 'author' => 'article:author',
1374
- 'published_time' => 'article:published_time',
1375
- 'modified_time' => 'article:modified_time',
1376
- ),
1377
- 'twitter' => array(
1378
- 'card' => 'twitter:card',
1379
- 'site' => 'twitter:site',
1380
- 'creator' => 'twitter:creator',
1381
- 'domain' => 'twitter:domain',
1382
- 'title' => 'twitter:title',
1383
- 'description' => 'twitter:description',
1384
- 'twitter_thumbnail' => 'twitter:image',
1385
- ),
1386
- );
1387
-
1388
- // Only show if "use schema.org markup is checked".
1389
- if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
1390
- $meta['google+'] = array( 'thumbnail' => 'image' );
1391
- }
1392
-
1393
- $tags = array(
1394
- 'facebook' => array( 'name' => 'property', 'value' => 'content' ),
1395
- 'twitter' => array( 'name' => 'name', 'value' => 'content' ),
1396
- 'google+' => array( 'name' => 'itemprop', 'value' => 'content' ),
1397
- );
1398
-
1399
- foreach ( $meta as $t => $data ) {
1400
- foreach ( $data as $k => $v ) {
1401
- if ( empty( $$k ) ) {
1402
- $$k = '';
1403
- }
1404
- $filtered_value = $$k;
1405
- $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k );
1406
- if ( ! empty( $filtered_value ) ) {
1407
- if ( ! is_array( $filtered_value ) ) {
1408
- $filtered_value = array( $filtered_value );
1409
- }
1410
-
1411
- /**
1412
- * This is to accomodate multiple fb:admins on separate lines.
1413
- * @TODO Eventually we'll want to put this in its own function so things like images work too.
1414
- */
1415
- if ( 'key' === $k ) {
1416
- $fbadmins = explode( ',', str_replace( ' ', '', $filtered_value[0] ) ); // Trim spaces then turn comma-separated values into an array.
1417
- foreach ( $fbadmins as $fbadmin ) {
1418
- echo '<meta ' . $tags[ $t ]['name'] . '="' . $v . '" ' . $tags[ $t ]['value'] . '="' . $fbadmin . '" />' . "\n";
1419
- }
1420
- } else {
1421
- // For everything else.
1422
- foreach ( $filtered_value as $f ) {
1423
- echo '<meta ' . $tags[ $t ]['name'] . '="' . $v . '" ' . $tags[ $t ]['value'] . '="' . $f . '" />' . "\n";
1424
- }
1425
- }
1426
- }
1427
- }
1428
- }
1429
- $social_link_schema = '';
1430
- if ( ! empty( $social_links ) ) {
1431
- $home_url = esc_url( get_home_url() );
1432
- $social_links = explode( "\n", $social_links );
1433
- foreach ( $social_links as $k => $v ) {
1434
- $v = trim( $v );
1435
- if ( empty( $v ) ) {
1436
- unset( $social_links[ $k ] );
1437
- } else {
1438
- $v = esc_url( $v );
1439
- $social_links[ $k ] = $v;
1440
- }
1441
- }
1442
- $social_links = join( '","', $social_links );
1443
- $social_link_schema = <<<END
1444
- <script type="application/ld+json">
1445
- { "@context" : "http://schema.org",
1446
- "@type" : "{$social_type}",
1447
- "name" : "{$social_name}",
1448
- "url" : "{$home_url}",
1449
- "sameAs" : ["{$social_links}"]
1450
- }
1451
- </script>
1452
-
1453
- END;
1454
- }
1455
- echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema );
1456
- }
1457
-
1458
- /**
1459
- * Do / adds opengraph properties to meta.
1460
- * @since 2.3.11
1461
- *
1462
- * @global array $aioseop_options AIOSEOP plugin options.
1463
- */
1464
- public function do_opengraph() {
1465
- global $aioseop_options;
1466
- if ( ! empty( $aioseop_options )
1467
- && ! empty( $aioseop_options['aiosp_schema_markup'] )
1468
- ) {
1469
- add_filter( 'language_attributes', array( &$this, 'add_attributes' ) );
1470
- }
1471
- if ( ! defined( 'DOING_AJAX' ) ) {
1472
- add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 );
1473
- // Add social meta to AMP plugin.
1474
- if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true ) {
1475
- add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 );
1476
- }
1477
- }
1478
- }
1479
-
1480
- /**
1481
- * Set up types.
1482
- *
1483
- * @since ?
1484
- * @since 2.3.15 Change to website for homepage and blog post index page, default to object.
1485
- */
1486
- function type_setup() {
1487
- $this->type = 'object'; // Default to type object if we don't have some other rule.
1488
-
1489
- if ( is_home() || is_front_page() ) {
1490
- $this->type = 'website'; // Home page and blog page should be website.
1491
- } elseif ( is_singular() && $this->option_isset( 'types' ) ) {
1492
- $metabox = $this->get_current_options( array(), 'settings' );
1493
- $current_post_type = get_post_type();
1494
- if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) {
1495
- $this->type = $metabox['aioseop_opengraph_settings_category'];
1496
- } elseif ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) {
1497
- $this->type = $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ];
1498
- }
1499
- }
1500
- }
1501
-
1502
- /**
1503
- * Inits hooks and others for admin init.
1504
- * action:admin_init.
1505
- *
1506
- * @since 2.3.11
1507
- * @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox.
1508
- */
1509
- function admin_init() {
1510
- add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 );
1511
- add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 );
1512
- add_filter( $this->get_prefix( 'settings' ) . 'default_options', array( &$this, 'filter_default_options' ), 10, 2 );
1513
- add_filter(
1514
- $this->get_prefix( 'settings' ) . 'filter_metabox_options', array(
1515
- &$this,
1516
- 'filter_metabox_options',
1517
- ), 10, 3
1518
- );
1519
- add_filter(
1520
- $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array(
1521
- &$this,
1522
- 'filter_metabox_options',
1523
- ), 10, 3
1524
- );
1525
- $post_types = $this->get_post_type_titles();
1526
- $rempost = array( 'revision' => 1, 'nav_menu_item' => 1, 'custom_css' => 1, 'customize_changeset' => 1 );
1527
- $post_types = array_diff_key( $post_types, $rempost );
1528
- $this->default_options['types']['initial_options'] = $post_types;
1529
- foreach ( $post_types as $slug => $name ) {
1530
- $field = $slug . '_fb_object_type';
1531
- $this->default_options[ $field ] = array(
1532
- 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "<br />($slug)",
1533
- 'type' => 'select',
1534
- 'style' => '',
1535
- 'initial_options' => $this->fb_object_types,
1536
- 'default' => 'article',
1537
- 'condshow' => array( 'aiosp_opengraph_types\[\]' => $slug ),
1538
- );
1539
- $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' );
1540
- $this->help_anchors[ $field ] = '#content-object-types';
1541
- $this->locations['opengraph']['options'][] = $field;
1542
- $this->layout['facebook']['options'][] = $field;
1543
- }
1544
- $this->setting_options();
1545
- $this->add_help_text_links();
1546
-
1547
- }
1548
-
1549
- function get_all_images( $options = null, $p = null ) {
1550
- static $img = array();
1551
- if ( ! is_array( $options ) ) {
1552
- $options = array();
1553
- }
1554
- if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) {
1555
- $options['meta_key'] = $this->options['aiosp_opengraph_meta_key'];
1556
- }
1557
- if ( empty( $img ) ) {
1558
- $size = apply_filters( 'post_thumbnail_size', 'large' );
1559
- $default = $this->get_the_image_by_default();
1560
- if ( ! empty( $default ) ) {
1561
- $default = set_url_scheme( $default );
1562
- $img[ $default ] = 0;
1563
- }
1564
- $img = array_merge( $img, parent::get_all_images( $options, null ) );
1565
- }
1566
-
1567
- if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
1568
- $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg';
1569
- }
1570
-
1571
- if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
1572
- $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg';
1573
- $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter';
1574
- }
1575
-
1576
- if ( $author_img = $this->get_the_image_by_author( $p ) ) {
1577
- $image['author'] = $author_img;
1578
- }
1579
- $image = array_flip( $img );
1580
- $images = array();
1581
- if ( ! empty( $image ) ) {
1582
- foreach ( $image as $k => $v ) {
1583
- $images[ $v ] = '<img height=150 src="' . $v . '">';
1584
- }
1585
- }
1586
-
1587
- return array( $image, $images );
1588
- }
1589
-
1590
- function get_the_image_by_author( $options = null, $p = null ) {
1591
- if ( $p === null ) {
1592
- global $post;
1593
- } else {
1594
- $post = $p;
1595
- }
1596
- if ( ! empty( $post ) && ! empty( $post->post_author ) ) {
1597
- $matches = array();
1598
- $get_avatar = get_avatar( $post->post_author, 300 );
1599
- if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) {
1600
- return $matches[1];
1601
- }
1602
- }
1603
-
1604
- return false;
1605
- }
1606
-
1607
- function get_the_image( $options = null, $p = null ) {
1608
- $meta_key = $this->options['aiosp_opengraph_meta_key'];
1609
-
1610
- return parent::get_the_image( array( 'meta_key' => $meta_key ), $p );
1611
- }
1612
-
1613
- function get_the_image_by_default( $args = array() ) {
1614
- return $this->options['aiosp_opengraph_dimg'];
1615
- }
1616
-
1617
- function settings_update() {
1618
-
1619
- }
1620
-
1621
- /**
1622
- * Enqueue our file upload scripts and styles.
1623
- * @param $hook
1624
- */
1625
- function og_admin_enqueue_scripts( $hook ) {
1626
-
1627
- if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) {
1628
- // Only enqueue if we're on the social module settings page.
1629
- return;
1630
- }
1631
-
1632
- wp_enqueue_script( 'media-upload' );
1633
- wp_enqueue_script( 'thickbox' );
1634
- wp_enqueue_style( 'thickbox' );
1635
- wp_enqueue_media();
1636
- }
1637
-
1638
- function save_tax_data( $term_id, $tt_id, $taxonomy ) {
1639
- static $update = false;
1640
- if ( $update ) {
1641
- return;
1642
- }
1643
- if ( $this->locations !== null ) {
1644
- foreach ( $this->locations as $k => $v ) {
1645
- if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) {
1646
- $opts = $this->default_options( $k );
1647
- $options = array();
1648
- $update = false;
1649
- foreach ( $opts as $l => $o ) {
1650
- if ( isset( $_POST[ $l ] ) ) {
1651
- $options[ $l ] = stripslashes_deep( $_POST[ $l ] );
1652
- $options[ $l ] = esc_attr( $options[ $l ] );
1653
- $update = true;
1654
- }
1655
- }
1656
- if ( $update ) {
1657
- $prefix = $this->get_prefix( $k );
1658
- $options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id );
1659
- update_term_meta( $term_id, '_' . $prefix . $k, $options );
1660
- }
1661
- }
1662
- }
1663
- }
1664
- }
1665
-
1666
- /**
1667
- * Returns the placeholder filtered and ready for DOM display.
1668
- * filter:aioseop_opengraph_placeholder
1669
- * @since 2.4.14
1670
- *
1671
- * @param mixed $placeholder Placeholder to be filtered.
1672
- * @param string $type Type of the value to be filtered.
1673
- *
1674
- * @return string
1675
- */
1676
- public function filter_placeholder( $placeholder, $type = 'text' ) {
1677
- return strip_tags( trim( $placeholder ) );
1678
- }
1679
-
1680
- /**
1681
- * Returns filtered default options.
1682
- * filter:{prefix}default_options
1683
- * @since 2.4.13
1684
- *
1685
- * @param array $options Default options.
1686
- * @param string $location Location.
1687
- *
1688
- * @return array
1689
- */
1690
- public function filter_default_options( $options, $location ) {
1691
- if ( $location === 'settings' ) {
1692
- $prefix = $this->get_prefix( $location ) . $location . '_';
1693
- // Add image checker as default
1694
- $options[ $prefix . 'customimg_checker' ] = 0;
1695
- }
1696
- return $options;
1697
- }
1698
-
1699
- /**
1700
- * Returns facebook debug script and link.
1701
- * @since 2.4.14
1702
- *
1703
- * @return string
1704
- */
1705
- private function get_facebook_debug() {
1706
- ob_start();
1707
- ?>
1708
- <script>
1709
- jQuery(document).ready(function() {
1710
- var snippet = jQuery("#aioseop_snippet_link");
1711
- if ( snippet.length === 0 ) {
1712
- jQuery( "#aioseop_opengraph_settings_facebook_debug_wrapper").hide();
1713
- } else {
1714
- snippet = snippet.html();
1715
- jQuery("#aioseop_opengraph_settings_facebook_debug")
1716
- .attr( "href", "https://developers.facebook.com/tools/debug/sharing/?q=" + snippet );
1717
- }
1718
- });
1719
- </script>
1720
- <a name="aioseop_opengraph_settings_facebook_debug"
1721
- id="aioseop_opengraph_settings_facebook_debug"
1722
- class="button-primary"
1723
- href=""
1724
- target="_blank"
1725
- ><?php echo __( 'Debug This Post', 'all-in-one-seo-pack' ); ?></a>
1726
- <?php
1727
- return ob_get_clean();
1728
- }
1729
- }
1730
- }
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The Opengraph class.
4
+ *
5
+ * @package All-in-One-SEO-Pack
6
+ * @version 2.3.16
7
+ */
8
+ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
9
+ class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
10
+ var $fb_object_types;
11
+ var $type;
12
+
13
+ /**
14
+ * Module constructor.
15
+ *
16
+ * @since 2.3.14 Added display filter.
17
+ * @since 2.3.16 #1066 Force init on constructor.
18
+ */
19
+ function __construct() {
20
+ add_action( 'admin_enqueue_scripts', array( $this, 'og_admin_enqueue_scripts' ) );
21
+
22
+ $this->name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
23
+ $this->prefix = 'aiosp_opengraph_'; // option prefix
24
+ $this->file = __FILE__; // the current file
25
+ $this->fb_object_types = array(
26
+ 'Activities' => array(
27
+ 'activity' => __( 'Activity', 'all-in-one-seo-pack' ),
28
+ 'sport' => __( 'Sport', 'all-in-one-seo-pack' ),
29
+ ),
30
+ 'Businesses' => array(
31
+ 'bar' => __( 'Bar', 'all-in-one-seo-pack' ),
32
+ 'company' => __( 'Company', 'all-in-one-seo-pack' ),
33
+ 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ),
34
+ 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ),
35
+ 'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' ),
36
+ ),
37
+ 'Groups' => array(
38
+ 'cause' => __( 'Cause', 'all-in-one-seo-pack' ),
39
+ 'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ),
40
+ 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ),
41
+ ),
42
+ 'Organizations' => array(
43
+ 'band' => __( 'Band', 'all-in-one-seo-pack' ),
44
+ 'government' => __( 'Government', 'all-in-one-seo-pack' ),
45
+ 'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ),
46
+ 'school' => __( 'School', 'all-in-one-seo-pack' ),
47
+ 'university' => __( 'University', 'all-in-one-seo-pack' ),
48
+ ),
49
+ 'People' => array(
50
+ 'actor' => __( 'Actor', 'all-in-one-seo-pack' ),
51
+ 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ),
52
+ 'author' => __( 'Author', 'all-in-one-seo-pack' ),
53
+ 'director' => __( 'Director', 'all-in-one-seo-pack' ),
54
+ 'musician' => __( 'Musician', 'all-in-one-seo-pack' ),
55
+ 'politician' => __( 'Politician', 'all-in-one-seo-pack' ),
56
+ 'profile' => __( 'Profile', 'all-in-one-seo-pack' ),
57
+ 'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' ),
58
+ ),
59
+ 'Places' => array(
60
+ 'city' => __( 'City', 'all-in-one-seo-pack' ),
61
+ 'country' => __( 'Country', 'all-in-one-seo-pack' ),
62
+ 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ),
63
+ 'state_province' => __( 'State Province', 'all-in-one-seo-pack' ),
64
+ ),
65
+ 'Products and Entertainment' => array(
66
+ 'album' => __( 'Album', 'all-in-one-seo-pack' ),
67
+ 'book' => __( 'Book', 'all-in-one-seo-pack' ),
68
+ 'drink' => __( 'Drink', 'all-in-one-seo-pack' ),
69
+ 'food' => __( 'Food', 'all-in-one-seo-pack' ),
70
+ 'game' => __( 'Game', 'all-in-one-seo-pack' ),
71
+ 'movie' => __( 'Movie', 'all-in-one-seo-pack' ),
72
+ 'product' => __( 'Product', 'all-in-one-seo-pack' ),
73
+ 'song' => __( 'Song', 'all-in-one-seo-pack' ),
74
+ 'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ),
75
+ 'episode' => __( 'Episode', 'all-in-one-seo-pack' ),
76
+ ),
77
+ 'Websites' => array(
78
+ 'article' => __( 'Article', 'all-in-one-seo-pack' ),
79
+ 'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
80
+ 'website' => __( 'Website', 'all-in-one-seo-pack' ),
81
+ ),
82
+ );
83
+ parent::__construct();
84
+
85
+ $this->help_text = array(
86
+ 'setmeta' => __( 'Checking this box will use the Home Title and Home Description set in All in One SEO Pack, General Settings as the Open Graph title and description for your home page.', 'all-in-one-seo-pack' ),
87
+ 'key' => __( 'Enter your Facebook Admin ID here. You can enter multiple IDs separated by a comma. You can look up your Facebook ID using this tool http://findmyfbid.com/', 'all-in-one-seo-pack' ),
88
+ 'appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ),
89
+ 'title_shortcodes' => __( 'Run shortcodes that appear in social title meta tags.', 'all-in-one-seo-pack' ),
90
+ 'description_shortcodes' => __( 'Run shortcodes that appear in social description meta tags.', 'all-in-one-seo-pack' ),
91
+ 'sitename' => __( 'The Site Name is the name that is used to identify your website.', 'all-in-one-seo-pack' ),
92
+ 'hometitle' => __( 'The Home Title is the Open Graph title for your home page.', 'all-in-one-seo-pack' ),
93
+ 'description' => __( 'The Home Description is the Open Graph description for your home page.', 'all-in-one-seo-pack' ),
94
+ 'homeimage' => __( 'The Home Image is the Open Graph image for your home page.', 'all-in-one-seo-pack' ),
95
+ 'generate_descriptions' => __( 'This option will auto generate your Open Graph descriptions from your post content instead of your post excerpt. WooCommerce users should read the documentation regarding this setting.', 'all-in-one-seo-pack' ),
96
+ 'defimg' => __( 'This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.', 'all-in-one-seo-pack' ),
97
+ 'fallback' => __( 'This option lets you fall back to the default image if no image could be found above.', 'all-in-one-seo-pack' ),
98
+ 'dimg' => __( 'This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.', 'all-in-one-seo-pack' ),
99
+ 'dimgwidth' => __( 'This option lets you set a default width for your images, where unspecified.', 'all-in-one-seo-pack' ),
100
+ 'dimgheight' => __( 'This option lets you set a default height for your images, where unspecified.', 'all-in-one-seo-pack' ),
101
+ 'meta_key' => __( 'Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.', 'all-in-one-seo-pack' ),
102
+ 'image' => __( 'This option lets you select the Open Graph image that will be used for this Page or Post, overriding the default settings.', 'all-in-one-seo-pack' ),
103
+ 'customimg' => __( 'This option lets you upload an image to use as the Open Graph image for this Page or Post.', 'all-in-one-seo-pack' ),
104
+ 'imagewidth' => __( 'Enter the width for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ),
105
+ 'imageheight' => __( 'Enter the height for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ),
106
+ 'video' => __( 'This option lets you specify a link to the Open Graph video used on this Page or Post.', 'all-in-one-seo-pack' ),
107
+ 'videowidth' => __( 'Enter the width for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ),
108
+ 'videoheight' => __( 'Enter the height for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ),
109
+ 'defcard' => __( 'Select the default type of Twitter Card to display.', 'all-in-one-seo-pack' ),
110
+ 'setcard' => __( 'Select the Twitter Card type to use for this Page or Post, overriding the default setting.', 'all-in-one-seo-pack' ),
111
+ 'twitter_site' => __( 'Enter the Twitter username associated with your website here.', 'all-in-one-seo-pack' ),
112
+ 'twitter_creator' => __( 'Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.', 'all-in-one-seo-pack' ),
113
+ 'twitter_domain' => __( 'Enter the name of your website here.', 'all-in-one-seo-pack' ),
114
+ 'customimg_twitter' => __( 'This option lets you upload an image to use as the Twitter image for this Page or Post.', 'all-in-one-seo-pack' ),
115
+ 'gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ),
116
+ 'gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ),
117
+ 'gen_categories' => __( 'Use categories in generated article tags.', 'all-in-one-seo-pack' ),
118
+ 'gen_post_tags' => __( 'Use post tags in generated article tags.', 'all-in-one-seo-pack' ),
119
+ 'types' => __( 'Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.', 'all-in-one-seo-pack' ),
120
+ 'title' => __( 'This is the Open Graph title of this Page or Post.', 'all-in-one-seo-pack' ),
121
+ 'desc' => __( 'This is the Open Graph description of this Page or Post.', 'all-in-one-seo-pack' ),
122
+ 'category' => __( 'Select the Open Graph type that best describes the content of this Page or Post.', 'all-in-one-seo-pack' ),
123
+ 'facebook_debug' => __( 'Press this button to have Facebook re-fetch and debug this page.', 'all-in-one-seo-pack' ),
124
+ 'section' => __( 'This Open Graph meta allows you to add a general section name that best describes this content.', 'all-in-one-seo-pack' ),
125
+ 'tag' => __( 'This Open Graph meta allows you to add a list of keywords that best describe this content.', 'all-in-one-seo-pack' ),
126
+ 'facebook_publisher' => __( 'Link articles to the Facebook page associated with your website.', 'all-in-one-seo-pack' ),
127
+ 'facebook_author' => __( 'Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.', 'all-in-one-seo-pack' ),
128
+ 'person_or_org' => __( 'Are the social profile links for your website for a person or an organization?', 'all-in-one-seo-pack' ),
129
+ 'profile_links' => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ),
130
+ 'social_name' => __( 'Add the name of the person or organization who owns these profiles.', 'all-in-one-seo-pack' ),
131
+ );
132
+
133
+ $this->help_anchors = array(
134
+ 'title_shortcodes' => '#run-shortcodes-in-title',
135
+ 'description_shortcodes' => '#run-shortcodes-in-description',
136
+ 'generate_descriptions' => '#auto-generate-og-descriptions',
137
+ 'setmeta' => '#use-aioseo-title-and-description',
138
+ 'sitename' => '#site-name',
139
+ 'hometitle' => '#home-title-and-description',
140
+ 'description' => '#home-title-and-description',
141
+ 'homeimage' => '#home-image',
142
+ 'defimg' => '#select-og-image-source',
143
+ 'fallback' => '#use-default-if-no-image-found',
144
+ 'dimg' => '#default-og-image',
145
+ 'dimgwidth' => '#default-image-width',
146
+ 'dimgheight' => '#default-image-height',
147
+ 'meta_key' => '#use-custom-field-for-image',
148
+ 'profile_links' => '#social-profile-links',
149
+ 'person_or_org' => '#social-profile-links',
150
+ 'social_name' => '#social-profile-links',
151
+ 'key' => '#facebook-admin-id',
152
+ 'appid' => '#facebook-app-id',
153
+ 'gen_tags' => '#automatically-generate-article-tags',
154
+ 'gen_keywords' => '#use-keywords-in-article-tags',
155
+ 'gen_categories' => '#use-categories-in-article-tags',
156
+ 'gen_post_tags' => '#use-post-tags-in-article-tags',
157
+ 'facebook_publisher' => '#show-facebook-publisher-on-articles',
158
+ 'facebook_author' => '#show-facebook-author-on-articles',
159
+ 'types' => '#enable-facebook-meta-for',
160
+ 'defcard' => '#default-twitter-card',
161
+ 'twitter_site' => '#twitter-site',
162
+ 'twitter_creator' => '#show-twitter-author',
163
+ 'twitter_domain' => '#twitter-domain',
164
+ 'scan_header' => '#scan-social-meta',
165
+ 'title' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#title',
166
+ 'desc' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#description',
167
+ 'image' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#image',
168
+ 'customimg' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-image',
169
+ 'imagewidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height',
170
+ 'imageheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height',
171
+ 'video' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-video',
172
+ 'videowidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height',
173
+ 'videoheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height',
174
+ 'category' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-object-type',
175
+ 'facebook_debug' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-debug',
176
+ 'section' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-section',
177
+ 'tag' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-tags',
178
+ 'setcard' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#twitter-card-type',
179
+ 'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image',
180
+ );
181
+
182
+ if ( is_admin() ) {
183
+ add_action( 'admin_init', array( $this, 'admin_init' ), 5 );
184
+ } else {
185
+ add_action( 'wp', array( $this, 'type_setup' ) );
186
+ }
187
+
188
+ if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
189
+ $this->do_opengraph();
190
+ }
191
+ // Set variables after WordPress load.
192
+ add_action( 'init', array( &$this, 'init' ), 999999 );
193
+ add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags
194
+ // Force refresh of Facebook cache.
195
+ add_action( 'post_updated', array( &$this, 'force_fb_refresh_update' ), 10, 3 );
196
+ add_action( 'transition_post_status', array( &$this, 'force_fb_refresh_transition' ), 10, 3 );
197
+ add_action( 'edited_term', array( &$this, 'save_tax_data' ), 10, 3 );
198
+ // Adds special filters
199
+ add_filter( 'aioseop_opengraph_placeholder', array( &$this, 'filter_placeholder' ) );
200
+ // Call to init to generate menus
201
+ $this->init();
202
+ }
203
+
204
+ /**
205
+ * Hook called after WordPress has been loaded.
206
+ *
207
+ * @since 2.4.14
208
+ */
209
+ public function init() {
210
+ $count_desc = __( ' characters. Open Graph allows up to a maximum of %1$s chars for the %2$s.', 'all-in-one-seo-pack' );
211
+ // Create default options
212
+ $this->default_options = array(
213
+ 'scan_header' => array(
214
+ 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ),
215
+ 'type' => 'custom',
216
+ 'save' => true,
217
+ ),
218
+ 'setmeta' => array(
219
+ 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ),
220
+ 'type' => 'checkbox',
221
+ ),
222
+ 'key' => array(
223
+ 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ),
224
+ 'default' => '',
225
+ 'type' => 'text',
226
+ ),
227
+ 'appid' => array(
228
+ 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ),
229
+ 'default' => '',
230
+ 'type' => 'text',
231
+ ),
232
+ 'title_shortcodes' => array(
233
+ 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ),
234
+ ),
235
+ 'description_shortcodes' => array(
236
+ 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ),
237
+ ),
238
+ 'sitename' => array(
239
+ 'name' => __( 'Site Name', 'all-in-one-seo-pack' ),
240
+ 'default' => get_bloginfo( 'name' ),
241
+ 'type' => 'text',
242
+ ),
243
+ 'hometitle' => array(
244
+ 'name' => __( 'Home Title', 'all-in-one-seo-pack' ),
245
+ 'default' => '',
246
+ 'type' => 'textarea',
247
+ 'condshow' => array(
248
+ 'aiosp_opengraph_setmeta' => array(
249
+ 'lhs' => 'aiosp_opengraph_setmeta',
250
+ 'op' => '!=',
251
+ 'rhs' => 'on',
252
+ ),
253
+ ),
254
+ ),
255
+ 'description' => array(
256
+ 'name' => __( 'Home Description', 'all-in-one-seo-pack' ),
257
+ 'default' => '',
258
+ 'type' => 'textarea',
259
+ 'condshow' => array(
260
+ 'aiosp_opengraph_setmeta' => array(
261
+ 'lhs' => 'aiosp_opengraph_setmeta',
262
+ 'op' => '!=',
263
+ 'rhs' => 'on',
264
+ ),
265
+ ),
266
+ ),
267
+ 'homeimage' => array(
268
+ 'name' => __( 'Home Image', 'all-in-one-seo-pack' ),
269
+ 'type' => 'image',
270
+ ),
271
+ 'generate_descriptions' => array(
272
+ 'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ),
273
+ 'default' => 0,
274
+ ),
275
+ 'defimg' => array(
276
+ 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ),
277
+ 'type' => 'select',
278
+ 'initial_options' => array(
279
+ '' => __( 'Default Image' ),
280
+ 'featured' => __( 'Featured Image' ),
281
+ 'attach' => __( 'First Attached Image' ),
282
+ 'content' => __( 'First Image In Content' ),
283
+ 'custom' => __( 'Image From Custom Field' ),
284
+ 'author' => __( 'Post Author Image' ),
285
+ 'auto' => __( 'First Available Image' ),
286
+ ),
287
+ ),
288
+ 'fallback' => array(
289
+ 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ),
290
+ 'type' => 'checkbox',
291
+ ),
292
+ 'dimg' => array(
293
+ 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ),
294
+ 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png',
295
+ 'type' => 'image',
296
+ ),
297
+ 'dimgwidth' => array(
298
+ 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ),
299
+ 'type' => 'text',
300
+ 'default' => '',
301
+ ),
302
+ 'dimgheight' => array(
303
+ 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ),
304
+ 'type' => 'text',
305
+ 'default' => '',
306
+ ),
307
+ 'meta_key' => array(
308
+ 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ),
309
+ 'type' => 'text',
310
+ 'default' => '',
311
+ ),
312
+ 'image' => array(
313
+ 'name' => __( 'Image', 'all-in-one-seo-pack' ),
314
+ 'type' => 'radio',
315
+ 'initial_options' => array(
316
+ 0 => '<img style="width:50px;height:auto;display:inline-block;vertical-align:bottom;" src="' . AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png' . '">',
317
+ ),
318
+ ),
319
+ 'customimg' => array(
320
+ 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ),
321
+ 'type' => 'image',
322
+ ),
323
+ 'imagewidth' => array(
324
+ 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ),
325
+ 'type' => 'text',
326
+ 'default' => '',
327
+ ),
328
+ 'imageheight' => array(
329
+ 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ),
330
+ 'type' => 'text',
331
+ 'default' => '',
332
+ ),
333
+ 'video' => array(
334
+ 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ),
335
+ 'type' => 'text',
336
+ ),
337
+ 'videowidth' => array(
338
+ 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ),
339
+ 'type' => 'text',
340
+ 'default' => '',
341
+ 'condshow' => array(
342
+ 'aioseop_opengraph_settings_video' => array(
343
+ 'lhs' => 'aioseop_opengraph_settings_video',
344
+ 'op' => '!=',
345
+ 'rhs' => '',
346
+ ),
347
+ ),
348
+ ),
349
+ 'videoheight' => array(
350
+ 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ),
351
+ 'type' => 'text',
352
+ 'default' => '',
353
+ 'condshow' => array(
354
+ 'aioseop_opengraph_settings_video' => array(
355
+ 'lhs' => 'aioseop_opengraph_settings_video',
356
+ 'op' => '!=',
357
+ 'rhs' => '',
358
+ ),
359
+ ),
360
+ ),
361
+ 'defcard' => array(
362
+ 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ),
363
+ 'type' => 'select',
364
+ 'default' => 'summary',
365
+ 'initial_options' => array(
366
+ 'summary' => __( 'Summary', 'all-in-one-seo-pack' ),
367
+ 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ),
368
+
369
+ /*
370
+ REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE
371
+ 'photo' => __( 'Photo', 'all-in-one-seo-pack' )
372
+ */
373
+ ),
374
+ ),
375
+ 'setcard' => array(
376
+ 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ),
377
+ 'type' => 'select',
378
+ 'initial_options' => array(
379
+ 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ),
380
+ 'summary' => __( 'Summary', 'all-in-one-seo-pack' ),
381
+
382
+ /*
383
+ REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE
384
+ 'photo' => __( 'Photo', 'all-in-one-seo-pack' )
385
+ */
386
+ ),
387
+ ),
388
+ 'twitter_site' => array(
389
+ 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ),
390
+ 'type' => 'text',
391
+ 'default' => '',
392
+ ),
393
+ 'twitter_creator' => array(
394
+ 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ),
395
+ ),
396
+ 'twitter_domain' => array(
397
+ 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ),
398
+ 'type' => 'text',
399
+ 'default' => '',
400
+ ),
401
+ 'customimg_twitter' => array(
402
+ 'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ),
403
+ 'type' => 'image',
404
+ ),
405
+ 'gen_tags' => array(
406
+ 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ),
407
+ ),
408
+ 'gen_keywords' => array(
409
+ 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ),
410
+ 'default' => 'on',
411
+ 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
412
+ ),
413
+ 'gen_categories' => array(
414
+ 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ),
415
+ 'default' => 'on',
416
+ 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
417
+ ),
418
+ 'gen_post_tags' => array(
419
+ 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ),
420
+ 'default' => 'on',
421
+ 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
422
+ ),
423
+ 'types' => array(
424
+ 'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ),
425
+ 'type' => 'multicheckbox',
426
+ 'default' => array( 'post' => 'post', 'page' => 'page' ),
427
+ 'initial_options' => $this->get_post_type_titles( array( '_builtin' => false ) ),
428
+ ),
429
+ 'title' => array(
430
+ 'name' => __( 'Title', 'all-in-one-seo-pack' ),
431
+ 'default' => '',
432
+ 'type' => 'text',
433
+ 'size' => 95,
434
+ 'count' => 1,
435
+ 'count_desc' => $count_desc,
436
+ ),
437
+ 'desc' => array(
438
+ 'name' => __( 'Description', 'all-in-one-seo-pack' ),
439
+ 'default' => '',
440
+ 'type' => 'textarea',
441
+ 'cols' => 250,
442
+ 'rows' => 4,
443
+ 'count' => 1,
444
+ 'count_desc' => $count_desc,
445
+ ),
446
+ 'category' => array(
447
+ 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
448
+ 'type' => 'select',
449
+ 'style' => '',
450
+ 'default' => '',
451
+ 'initial_options' => $this->fb_object_types,
452
+ ),
453
+ 'facebook_debug' => array(
454
+ 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ),
455
+ 'type' => 'html',
456
+ 'save' => false,
457
+ 'default' => $this->get_facebook_debug(),
458
+ ),
459
+ 'section' => array(
460
+ 'name' => __( 'Article Section', 'all-in-one-seo-pack' ),
461
+ 'type' => 'text',
462
+ 'default' => '',
463
+ 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ),
464
+ ),
465
+ 'tag' => array(
466
+ 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ),
467
+ 'type' => 'text',
468
+ 'default' => '',
469
+ 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ),
470
+ ),
471
+ 'facebook_publisher' => array(
472
+ 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ),
473
+ 'type' => 'text',
474
+ 'default' => '',
475
+ ),
476
+ 'facebook_author' => array(
477
+ 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ),
478
+ ),
479
+ 'profile_links' => array(
480
+ 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
481
+ 'type' => 'textarea',
482
+ 'cols' => 60,
483
+ 'rows' => 5,
484
+ ),
485
+ 'person_or_org' => array(
486
+ 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ),
487
+ 'type' => 'radio',
488
+ 'initial_options' => array(
489
+ 'person' => __( 'Person', 'all-in-one-seo-pack' ),
490
+ 'org' => __( 'Organization', 'all-in-one-seo-pack' ),
491
+ ),
492
+ ),
493
+ 'social_name' => array(
494
+ 'name' => __( 'Associated Name', 'all-in-one-seo-pack' ),
495
+ 'type' => 'text',
496
+ 'default' => '',
497
+ ),
498
+ );
499
+ // load initial options / set defaults
500
+ $this->update_options();
501
+ $display = array();
502
+ if ( isset( $this->options['aiosp_opengraph_types'] ) && ! empty( $this->options['aiosp_opengraph_types'] ) ) {
503
+ $display = $this->options['aiosp_opengraph_types'];
504
+ }
505
+ $this->locations = array(
506
+ 'opengraph' => array(
507
+ 'name' => $this->name,
508
+ 'prefix' => 'aiosp_',
509
+ 'type' => 'settings',
510
+ 'options' => array(
511
+ 'scan_header',
512
+ 'setmeta',
513
+ 'key',
514
+ 'appid',
515
+ 'sitename',
516
+ 'title_shortcodes',
517
+ 'description_shortcodes',
518
+ 'hometitle',
519
+ 'description',
520
+ 'homeimage',
521
+ 'generate_descriptions',
522
+ 'defimg',
523
+ 'fallback',
524
+ 'dimg',
525
+ 'dimgwidth',
526
+ 'dimgheight',
527
+ 'meta_key',
528
+ 'defcard',
529
+ 'profile_links',
530
+ 'person_or_org',
531
+ 'social_name',
532
+ 'twitter_site',
533
+ 'twitter_creator',
534
+ 'twitter_domain',
535
+ 'gen_tags',
536
+ 'gen_keywords',
537
+ 'gen_categories',
538
+ 'gen_post_tags',
539
+ 'types',
540
+ 'facebook_publisher',
541
+ 'facebook_author',
542
+ ),
543
+ ),
544
+ 'settings' => array(
545
+ 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ),
546
+ 'type' => 'metabox',
547
+ 'help_link' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/',
548
+ 'options' => array(
549
+ 'title',
550
+ 'desc',
551
+ 'image',
552
+ 'customimg',
553
+ 'imagewidth',
554
+ 'imageheight',
555
+ 'video',
556
+ 'videowidth',
557
+ 'videoheight',
558
+ 'category',
559
+ 'facebook_debug',
560
+ 'section',
561
+ 'tag',
562
+ 'setcard',
563
+ 'customimg_twitter',
564
+ ),
565
+ 'display' => apply_filters( 'aioseop_opengraph_display', $display ),
566
+ 'prefix' => 'aioseop_opengraph_',
567
+ ),
568
+ );
569
+ $this->layout = array(
570
+ 'home' => array(
571
+ 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
572
+ 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description',
573
+ 'options' => array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ),
574
+ ),
575
+ 'image' => array(
576
+ 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ),
577
+ 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#select-og-image-source',
578
+ 'options' => array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ),
579
+ ),
580
+ 'links' => array(
581
+ 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
582
+ 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#social-profile-links',
583
+ 'options' => array( 'profile_links', 'person_or_org', 'social_name' ),
584
+ ),
585
+ 'facebook' => array(
586
+ 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ),
587
+ 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#facebook-settings',
588
+ 'options' => array(
589
+ 'key',
590
+ 'appid',
591
+ 'types',
592
+ 'gen_tags',
593
+ 'gen_keywords',
594
+ 'gen_categories',
595
+ 'gen_post_tags',
596
+ 'facebook_publisher',
597
+ 'facebook_author',
598
+ ),
599
+ ),
600
+ 'twitter' => array(
601
+ 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ),
602
+ 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#default-twitter-card',
603
+ 'options' => array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ),
604
+ ),
605
+ 'default' => array(
606
+ 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ),
607
+ 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/',
608
+ 'options' => array(), // this is set below, to the remaining options -- pdb
609
+ ),
610
+ 'scan_meta' => array(
611
+ 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ),
612
+ 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#scan_meta',
613
+ 'options' => array( 'scan_header' ),
614
+ ),
615
+ );
616
+ $other_options = array();
617
+ foreach ( $this->layout as $k => $v ) {
618
+ $other_options = array_merge( $other_options, $v['options'] );
619
+ }
620
+
621
+ $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
622
+ }
623
+
624
+ /**
625
+ * Forces FaceBook OpenGraph to refresh its cache when a post is changed to
626
+ *
627
+ * @param $new_status
628
+ * @param $old_status
629
+ * @param $post
630
+ *
631
+ * @todo this and force_fb_refresh_update can probably have the remote POST extracted out.
632
+ *
633
+ * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update
634
+ * @since 2.3.11
635
+ */
636
+ function force_fb_refresh_transition( $new_status, $old_status, $post ) {
637
+ if ( 'publish' !== $new_status ) {
638
+ return;
639
+ }
640
+ if ( 'future' !== $old_status ) {
641
+ return;
642
+ }
643
+
644
+ $current_post_type = get_post_type();
645
+
646
+ // Only ping Facebook if Social SEO is enabled on this post type.
647
+ if ( $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) {
648
+ $post_url = aioseop_get_permalink( $post->ID );
649
+ $endpoint = sprintf(
650
+ 'https://graph.facebook.com/?%s', http_build_query(
651
+ array(
652
+ 'id' => $post_url,
653
+ 'scrape' => true,
654
+ )
655
+ )
656
+ );
657
+ wp_remote_post( $endpoint, array( 'blocking' => false ) );
658
+ }
659
+ }
660
+
661
+ /**
662
+ * Forces FaceBook OpenGraph refresh on update.
663
+ *
664
+ * @param $post_id
665
+ * @param $post_after
666
+ *
667
+ * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update
668
+ * @since 2.3.11
669
+ */
670
+ function force_fb_refresh_update( $post_id, $post_after ) {
671
+
672
+ $current_post_type = get_post_type();
673
+
674
+ // Only ping Facebook if Social SEO is enabled on this post type.
675
+ if ( 'publish' === $post_after->post_status && $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) {
676
+ $post_url = aioseop_get_permalink( $post_id );
677
+ $endpoint = sprintf(
678
+ 'https://graph.facebook.com/?%s', http_build_query(
679
+ array(
680
+ 'id' => $post_url,
681
+ 'scrape' => true,
682
+ )
683
+ )
684
+ );
685
+ wp_remote_post( $endpoint, array( 'blocking' => false ) );
686
+ }
687
+ }
688
+
689
+ function settings_page_init() {
690
+ add_filter( 'aiosp_output_option', array( $this, 'display_custom_options' ), 10, 2 );
691
+ }
692
+
693
+ function filter_options( $options, $location ) {
694
+ if ( $location == 'settings' ) {
695
+ $prefix = $this->get_prefix( $location ) . $location . '_';
696
+ list( $legacy, $images ) = $this->get_all_images( $options );
697
+ if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) {
698
+ $thumbnail = $options["{$prefix}image"];
699
+ if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) {
700
+ if ( $thumbnail == 'post' ) {
701
+ $thumbnail = $images['post1'];
702
+ } elseif ( ! empty( $legacy[ $thumbnail ] ) ) {
703
+ $thumbnail = $legacy[ $thumbnail ];
704
+ }
705
+ }
706
+ $options["{$prefix}image"] = $thumbnail;
707
+ }
708
+ if ( empty( $options[ $prefix . 'image' ] ) ) {
709
+ $img = array_keys( $images );
710
+ if ( ! empty( $img ) && ! empty( $img[1] ) ) {
711
+ $options[ $prefix . 'image' ] = $img[1];
712
+ }
713
+ }
714
+ }
715
+
716
+ return $options;
717
+ }
718
+
719
+ /**
720
+ * Applies filter to module settings.
721
+ *
722
+ * @since 2.3.11
723
+ * @since 2.4.14 Added filter for description and title placeholders.
724
+ * @since 2.3.15 do_shortcode on description.
725
+ *
726
+ * @see [plugin]\admin\aioseop_module_class.php > display_options()
727
+ */
728
+ function filter_settings( $settings, $location, $current ) {
729
+ global $aiosp, $post;
730
+ if ( $location == 'opengraph' || $location == 'settings' ) {
731
+ $prefix = $this->get_prefix( $location ) . $location . '_';
732
+ if ( $location == 'opengraph' ) {
733
+ return $settings;
734
+ }
735
+ if ( $location == 'settings' ) {
736
+ list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current );
737
+ $opts = array( 'title', 'desc' );
738
+ $current_post_type = get_post_type();
739
+ if ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) {
740
+ $flat_type_list = array();
741
+ foreach ( $this->fb_object_types as $k => $v ) {
742
+ if ( is_array( $v ) ) {
743
+ $flat_type_list = array_merge( $flat_type_list, $v );
744
+ } else {
745
+ $flat_type_list[ $k ] = $v;
746
+ }
747
+ }
748
+ $settings[ $prefix . 'category' ]['initial_options'] = array_merge(
749
+ array(
750
+ $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - '
751
+ . $flat_type_list[ $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ],
752
+ ),
753
+ $settings[ $prefix . 'category' ]['initial_options']
754
+ );
755
+ }
756
+ if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) {
757
+ $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard'];
758
+ }
759
+ $info = $aiosp->get_page_snippet_info();
760
+ $title = $info['title'];
761
+ $description = $info['description'];
762
+
763
+ // Description options
764
+ if ( is_object( $post ) ) {
765
+ // Always show excerpt
766
+ $description = empty( $this->options['aiosp_opengraph_generate_descriptions'] )
767
+ ? $aiosp->trim_excerpt_without_filters(
768
+ $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ),
769
+ 1000
770
+ )
771
+ : $aiosp->trim_excerpt_without_filters(
772
+ $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ),
773
+ 1000
774
+ );
775
+ }
776
+
777
+ // Add filters
778
+ $description = apply_filters( 'aioseop_description', $description );
779
+ // Add placholders
780
+ $settings[ "{$prefix}title" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title );
781
+ $settings[ "{$prefix}desc" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description );
782
+ }
783
+ if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) {
784
+ foreach ( $opts as $opt ) {
785
+ if ( isset( $settings[ $prefix . $opt ] ) ) {
786
+ $settings[ $prefix . $opt ]['type'] = 'hidden';
787
+ $settings[ $prefix . $opt ]['label'] = 'none';
788
+ $settings[ $prefix . $opt ]['help_text'] = '';
789
+ unset( $settings[ $prefix . $opt ]['count'] );
790
+ }
791
+ }
792
+ }
793
+ }
794
+
795
+ return $settings;
796
+ }
797
+
798
+ /**
799
+ * Applies filter to module options.
800
+ * These will display in the "Social Settings" object tab.
801
+ * filter:{prefix}override_options
802
+ *
803
+ * @since 2.3.11
804
+ * @since 2.4.14 Overrides empty og:type values.
805
+ *
806
+ * @see [plugin]\admin\aioseop_module_class.php > display_options()
807
+ *
808
+ * @global array $aioseop_options Plugin options.
809
+ *
810
+ * @param array $options Current options.
811
+ * @param string $location Location where filter is called.
812
+ * @param array $settings Settings.
813
+ *
814
+ * @return array
815
+ */
816
+ function override_options( $options, $location, $settings ) {
817
+ global $aioseop_options;
818
+ // Prepare default and prefix
819
+ $prefix = $this->get_prefix( $location ) . $location . '_';
820
+ $opts = array();
821
+
822
+ foreach ( $settings as $k => $v ) {
823
+ if ( $v['save'] ) {
824
+ $opts[ $k ] = $v['default'];
825
+ }
826
+ }
827
+ foreach ( $options as $k => $v ) {
828
+ switch ( $k ) {
829
+ case $prefix . 'category':
830
+ if ( empty( $v ) ) {
831
+ // Get post type
832
+ $type = isset( get_current_screen()->post_type )
833
+ ? get_current_screen()->post_type
834
+ : null;
835
+ // Assign default from plugin options
836
+ if ( ! empty( $type )
837
+ && isset( $aioseop_options['modules'] )
838
+ && isset( $aioseop_options['modules']['aiosp_opengraph_options'] )
839
+ && isset( $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ] )
840
+ ) {
841
+ $options[ $prefix . 'category' ] =
842
+ $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ];
843
+ }
844
+ continue;
845
+ }
846
+ break;
847
+ }
848
+ if ( $v === null ) {
849
+ unset( $options[ $k ] );
850
+ }
851
+ }
852
+ $options = wp_parse_args( $options, $opts );
853
+
854
+ return $options;
855
+ }
856
+
857
+ /**
858
+ * Applies filter to metabox settings before they are saved.
859
+ * Sets custom as default if a custom image is uploaded.
860
+ * filter:{prefix}filter_metabox_options
861
+ * filter:{prefix}filter_term_metabox_options
862
+ *
863
+ * @since 2.3.11
864
+ * @since 2.4.14 Fixes for aioseop-pro #67 and other bugs found.
865
+ *
866
+ * @see [plugin]\admin\aioseop_module_class.php > save_post_data()
867
+ * @see [this file] > save_tax_data()
868
+ *
869
+ * @param array $options List of current options.
870
+ * @param string $location Location where filter is called.
871
+ * @param int $id Either post_id or term_id.
872
+ *
873
+ * @return array
874
+ */
875
+ function filter_metabox_options( $options, $location, $post_id ) {
876
+ if ( $location == 'settings' ) {
877
+ $prefix = $this->get_prefix( $location ) . $location . '_';
878
+ if ( isset( $options[ $prefix . 'customimg_checker' ] )
879
+ && $options[ $prefix . 'customimg_checker' ]
880
+ ) {
881
+ $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ];
882
+ }
883
+ }
884
+ return $options;
885
+ }
886
+
887
+ /** Custom settings **/
888
+ function display_custom_options( $buf, $args ) {
889
+ if ( $args['name'] == 'aiosp_opengraph_scan_header' ) {
890
+ $buf .= '<div class="aioseop aioseop_options aiosp_opengraph_settings"><div class="aioseop_wrapper aioseop_custom_type" id="aiosp_opengraph_scan_header_wrapper"><div class="aioseop_input" id="aiosp_opengraph_scan_header" style="padding-left:20px;">';
891
+ $args['options']['type'] = 'submit';
892
+ $args['attr'] = " class='button-primary' ";
893
+ $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' );
894
+ $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' );
895
+ $buf .= '<br /><br />' . $this->get_option_html( $args );
896
+ $buf .= '</div></div></div>';
897
+ }
898
+
899
+ return $buf;
900
+ }
901
+
902
+ function add_attributes( $output ) {
903
+ // avoid having duplicate meta tags
904
+ $type = $this->type;
905
+ if ( empty( $type ) ) {
906
+ $type = 'website';
907
+ }
908
+
909
+ $schema_types = array(
910
+ 'album' => 'MusicAlbum',
911
+ 'article' => 'Article',
912
+ 'bar' => 'BarOrPub',
913
+ 'blog' => 'Blog',
914
+ 'book' => 'Book',
915
+ 'cafe' => 'CafeOrCoffeeShop',
916
+ 'city' => 'City',
917
+ 'country' => 'Country',
918
+ 'episode' => 'Episode',
919
+ 'food' => 'FoodEvent',
920
+ 'game' => 'Game',
921
+ 'hotel' => 'Hotel',
922
+ 'landmark' => 'LandmarksOrHistoricalBuildings',
923
+ 'movie' => 'Movie',
924
+ 'product' => 'Product',
925
+ 'profile' => 'ProfilePage',
926
+ 'restaurant' => 'Restaurant',
927
+ 'school' => 'School',
928
+ 'sport' => 'SportsEvent',
929
+ 'website' => 'WebSite',
930
+ );
931
+
932
+ if ( ! empty( $schema_types[ $type ] ) ) {
933
+ $type = $schema_types[ $type ];
934
+ } else {
935
+ $type = 'WebSite';
936
+ }
937
+
938
+ $attributes = apply_filters(
939
+ $this->prefix . 'attributes', array(
940
+ 'itemscope',
941
+ 'itemtype="http://schema.org/' . ucfirst( $type ) . '"',
942
+ 'prefix="og: http://ogp.me/ns#"',
943
+ )
944
+ );
945
+
946
+ foreach ( $attributes as $attr ) {
947
+ if ( strpos( $output, $attr ) === false ) {
948
+ $output .= "\n\t$attr ";
949
+ }
950
+ }
951
+
952
+ return $output;
953
+ }
954
+
955
+ /**
956
+ * Add our social meta.
957
+ *
958
+ * @since 1.0.0
959
+ * @since 2.3.11.5 Support for multiple fb_admins.
960
+ * @since 2.3.13 Adds filter:aioseop_description on description.
961
+ * @since 2.4.14 Fixes for aioseop-pro #67.
962
+ * @since 2.3.15 Always do_shortcode on descriptions, removed for titles.
963
+ *
964
+ * @global object $post Current WP_Post object.
965
+ * @global object $aiosp All in one seo plugin object.
966
+ * @global array $aioseop_options All in one seo plugin options.
967
+ * @global object $wp_query WP_Query global instance.
968
+ */
969
+ function add_meta() {
970
+ global $post, $aiosp, $aioseop_options, $wp_query;
971
+ $metabox = $this->get_current_options( array(), 'settings' );
972
+ $key = $this->options['aiosp_opengraph_key'];
973
+ $dimg = $this->options['aiosp_opengraph_dimg'];
974
+ $current_post_type = get_post_type();
975
+ $title = $description = $image = $video = '';
976
+ $type = $this->type;
977
+ $sitename = $this->options['aiosp_opengraph_sitename'];
978
+
979
+ $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : '';
980
+
981
+ if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
982
+ $first_page = false;
983
+ if ( $aiosp->get_page_number() < 2 ) {
984
+ $first_page = true;
985
+ }
986
+ } else {
987
+ $first_page = true;
988
+ }
989
+ $url = $aiosp->aiosp_mrt_get_url( $wp_query );
990
+ $url = apply_filters( 'aioseop_canonical_url', $url );
991
+
992
+ $setmeta = $this->options['aiosp_opengraph_setmeta'];
993
+ $social_links = '';
994
+ if ( is_front_page() ) {
995
+ $title = $this->options['aiosp_opengraph_hometitle'];
996
+ if ( $first_page ) {
997
+ $description = $this->options['aiosp_opengraph_description'];
998
+ if ( empty( $description ) ) {
999
+ $description = get_bloginfo( 'description' );
1000
+ }
1001
+ }
1002
+ if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) {
1003
+ $thumbnail = $this->options['aiosp_opengraph_homeimage'];
1004
+ } else {
1005
+ $thumbnail = $this->options['aiosp_opengraph_dimg'];
1006
+ }
1007
+
1008
+ /* If Use AIOSEO Title and Desc Selected */
1009
+ if ( $setmeta ) {
1010
+ $title = $aiosp->wp_title();
1011
+ if ( $first_page ) {
1012
+ $description = $aiosp->get_aioseop_description( $post );
1013
+ }
1014
+ }
1015
+
1016
+ /* Add some defaults */
1017
+ if ( empty( $title ) ) {
1018
+ $title = get_bloginfo( 'name' );
1019
+ }
1020
+ if ( empty( $sitename ) ) {
1021
+ $sitename = get_bloginfo( 'name' );
1022
+ }
1023
+
1024
+ if ( empty( $description ) && $first_page && ! empty( $post ) && ! post_password_required( $post ) ) {
1025
+
1026
+ if ( ! empty( $post->post_content ) || ! empty( $post->post_excerpt ) ) {
1027
+ $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), 1000 );
1028
+
1029
+ if ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) {
1030
+ $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 );
1031
+ }
1032
+ }
1033
+ }
1034
+
1035
+ if ( empty( $description ) && $first_page ) {
1036
+ $description = get_bloginfo( 'description' );
1037
+ }
1038
+ if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) {
1039
+ $social_links = $this->options['aiosp_opengraph_profile_links'];
1040
+ if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) {
1041
+ $social_name = $this->options['aiosp_opengraph_social_name'];
1042
+ } else {
1043
+ $social_name = '';
1044
+ }
1045
+ if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) {
1046
+ $social_type = 'Person';
1047
+ } else {
1048
+ $social_type = 'Organization';
1049
+ }
1050
+ }
1051
+ } elseif ( is_singular() && $this->option_isset( 'types' )
1052
+ && is_array( $this->options['aiosp_opengraph_types'] )
1053
+ && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] )
1054
+ ) {
1055
+
1056
+ if ( $type == 'article' ) {
1057
+ if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
1058
+ $section = $metabox['aioseop_opengraph_settings_section'];
1059
+ }
1060
+ if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) {
1061
+ $tag = $metabox['aioseop_opengraph_settings_tag'];
1062
+ }
1063
+ if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) {
1064
+ $publisher = $this->options['aiosp_opengraph_facebook_publisher'];
1065
+ }
1066
+ }
1067
+
1068
+ if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1069
+ $domain = $this->options['aiosp_opengraph_twitter_domain'];
1070
+ }
1071
+
1072
+ if ( $type == 'article' && ! empty( $post ) ) {
1073
+ if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
1074
+ $author = get_the_author_meta( 'facebook', $post->post_author );
1075
+ }
1076
+
1077
+ if ( isset( $post->post_date_gmt ) ) {
1078
+ $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) );
1079
+ }
1080
+
1081
+ if ( isset( $post->post_modified_gmt ) ) {
1082
+ $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) );
1083
+ }
1084
+ }
1085
+
1086
+ $image = $metabox['aioseop_opengraph_settings_image'];
1087
+ $video = $metabox['aioseop_opengraph_settings_video'];
1088
+ $title = $metabox['aioseop_opengraph_settings_title'];
1089
+ $description = $metabox['aioseop_opengraph_settings_desc'];
1090
+
1091
+ /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */
1092
+ global $aiosp;
1093
+ if ( empty( $title ) ) {
1094
+ $title = $aiosp->wp_title();
1095
+ }
1096
+ if ( empty( $description ) ) {
1097
+ $description = trim( strip_tags( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
1098
+ }
1099
+
1100
+ /* Add default title */
1101
+ if ( empty( $title ) ) {
1102
+ $title = get_the_title();
1103
+ }
1104
+
1105
+ // Add default description.
1106
+ if ( empty( $description ) && ! post_password_required( $post ) ) {
1107
+
1108
+ $description = $post->post_excerpt;
1109
+
1110
+ if ( $this->options['aiosp_opengraph_generate_descriptions'] || empty( $description ) ) {
1111
+ $description = $post->post_content;
1112
+ }
1113
+ }
1114
+ if ( empty( $type ) ) {
1115
+ $type = 'article';
1116
+ }
1117
+ } elseif ( AIOSEOPPRO && ( is_category() || is_tag() || is_tax() ) ) {
1118
+ if ( isset( $this->options['aioseop_opengraph_settings_category'] ) ) {
1119
+ $type = $this->options['aioseop_opengraph_settings_category'];
1120
+ }
1121
+ if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) {
1122
+ $type = $metabox['aioseop_opengraph_settings_category'];
1123
+ }
1124
+ if ( $type == 'article' ) {
1125
+ if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
1126
+ $section = $metabox['aioseop_opengraph_settings_section'];
1127
+ }
1128
+ if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) {
1129
+ $tag = $metabox['aioseop_opengraph_settings_tag'];
1130
+ }
1131
+ if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) {
1132
+ $publisher = $this->options['aiosp_opengraph_facebook_publisher'];
1133
+ }
1134
+ }
1135
+ if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1136
+ $domain = $this->options['aiosp_opengraph_twitter_domain'];
1137
+ }
1138
+ if ( $type == 'article' && ! empty( $post ) ) {
1139
+ if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
1140
+ $author = get_the_author_meta( 'facebook', $post->post_author );
1141
+ }
1142
+
1143
+ if ( isset( $post->post_date_gmt ) ) {
1144
+ $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) );
1145
+ }
1146
+ if ( isset( $post->post_modified_gmt ) ) {
1147
+ $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) );
1148
+ }
1149
+ }
1150
+ $image = $metabox['aioseop_opengraph_settings_image'];
1151
+ $video = $metabox['aioseop_opengraph_settings_video'];
1152
+ $title = $metabox['aioseop_opengraph_settings_title'];
1153
+ $description = $metabox['aioseop_opengraph_settings_desc'];
1154
+ /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */
1155
+ global $aiosp;
1156
+ if ( empty( $title ) ) {
1157
+ $title = $aiosp->wp_title();
1158
+ }
1159
+ if ( empty( $description ) ) {
1160
+ $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0;
1161
+ $term_id = $term_id ? $term_id : get_queried_object()->term_id;
1162
+ $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) );
1163
+ }
1164
+ // Add default title
1165
+ if ( empty( $title ) ) {
1166
+ $title = get_the_title();
1167
+ }
1168
+ // Add default description.
1169
+ if ( empty( $description ) && ! post_password_required( $post ) ) {
1170
+ $description = get_queried_object()->description;
1171
+ }
1172
+ if ( empty( $type ) ) {
1173
+ $type = 'website';
1174
+ }
1175
+ } elseif ( is_home() && ! is_front_page() ) {
1176
+ // This is the blog page but not the homepage.
1177
+ global $aiosp;
1178
+ $image = $metabox['aioseop_opengraph_settings_image'];
1179
+ $video = $metabox['aioseop_opengraph_settings_video'];
1180
+ $title = $metabox['aioseop_opengraph_settings_title'];
1181
+ $description = $metabox['aioseop_opengraph_settings_desc'];
1182
+
1183
+ if ( empty( $description ) ) {
1184
+ // If there's not social description, fall back to the SEO description.
1185
+ $description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) );
1186
+ }
1187
+ if ( empty( $title ) ) {
1188
+ $title = $aiosp->wp_title();
1189
+ }
1190
+ } else {
1191
+ return;
1192
+ }
1193
+
1194
+ if ( $type === 'article' && ! empty( $post ) && is_singular() ) {
1195
+ if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) {
1196
+ if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) {
1197
+ $keywords = $aiosp->get_main_keywords();
1198
+ $keywords = $this->apply_cf_fields( $keywords );
1199
+ $keywords = apply_filters( 'aioseop_keywords', $keywords );
1200
+ if ( ! empty( $keywords ) && ! empty( $tag ) ) {
1201
+ $tag .= ',' . $keywords;
1202
+ } elseif ( empty( $tag ) ) {
1203
+ $tag = $keywords;
1204
+ }
1205
+ }
1206
+ $tag = $aiosp->keyword_string_to_list( $tag );
1207
+ if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) {
1208
+ $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) );
1209
+ }
1210
+ if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) {
1211
+ $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) );
1212
+ }
1213
+ }
1214
+ if ( ! empty( $tag ) ) {
1215
+ $tag = $aiosp->clean_keyword_list( $tag );
1216
+ }
1217
+ }
1218
+
1219
+ if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) {
1220
+ $title = do_shortcode( $title );
1221
+ }
1222
+ if ( ! empty( $description ) ) {
1223
+ $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) );
1224
+ if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) {
1225
+ $description = do_shortcode( $description );
1226
+ }
1227
+ $description = $aiosp->trim_excerpt_without_filters( $description, 1000 );
1228
+ }
1229
+
1230
+ $title = $this->apply_cf_fields( $title );
1231
+ $description = $this->apply_cf_fields( $description );
1232
+
1233
+ /* Data Validation */
1234
+ $title = strip_tags( esc_attr( $title ) );
1235
+ $sitename = strip_tags( esc_attr( $sitename ) );
1236
+ $description = strip_tags( esc_attr( $description ) );
1237
+
1238
+ if ( empty( $thumbnail ) && ! empty( $image ) ) {
1239
+ $thumbnail = $image;
1240
+ }
1241
+
1242
+ // Add user supplied default image.
1243
+ if ( empty( $thumbnail ) ) {
1244
+ if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) {
1245
+ $thumbnail = $this->options['aiosp_opengraph_dimg'];
1246
+ } else {
1247
+ switch ( $this->options['aiosp_opengraph_defimg'] ) {
1248
+ case 'featured':
1249
+ $thumbnail = $this->get_the_image_by_post_thumbnail();
1250
+ break;
1251
+ case 'attach':
1252
+ $thumbnail = $this->get_the_image_by_attachment();
1253
+ break;
1254
+ case 'content':
1255
+ $thumbnail = $this->get_the_image_by_scan();
1256
+ break;
1257
+ case 'custom':
1258
+ $meta_key = $this->options['aiosp_opengraph_meta_key'];
1259
+ if ( ! empty( $meta_key ) && ! empty( $post ) ) {
1260
+ $meta_key = explode( ',', $meta_key );
1261
+ $thumbnail = $this->get_the_image_by_meta_key(
1262
+ array(
1263
+ 'post_id' => $post->ID,
1264
+ 'meta_key' => $meta_key,
1265
+ )
1266
+ );
1267
+ }
1268
+ break;
1269
+ case 'auto':
1270
+ $thumbnail = $this->get_the_image();
1271
+ break;
1272
+ case 'author':
1273
+ $thumbnail = $this->get_the_image_by_author();
1274
+ break;
1275
+ default:
1276
+ $thumbnail = $this->options['aiosp_opengraph_dimg'];
1277
+ }
1278
+ }
1279
+ }
1280
+
1281
+ if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) {
1282
+ $thumbnail = $this->options['aiosp_opengraph_dimg'];
1283
+ }
1284
+
1285
+ if ( ! empty( $thumbnail ) ) {
1286
+ $thumbnail = esc_url( $thumbnail );
1287
+ $thumbnail = set_url_scheme( $thumbnail );
1288
+ }
1289
+
1290
+ $width = $height = '';
1291
+ if ( ! empty( $thumbnail ) ) {
1292
+ if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) {
1293
+ $width = $metabox['aioseop_opengraph_settings_imagewidth'];
1294
+ }
1295
+ if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) {
1296
+ $height = $metabox['aioseop_opengraph_settings_imageheight'];
1297
+ }
1298
+ if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) {
1299
+ $width = $this->options['aiosp_opengraph_dimgwidth'];
1300
+ }
1301
+ if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) {
1302
+ $height = $this->options['aiosp_opengraph_dimgheight'];
1303
+ }
1304
+ }
1305
+
1306
+ if ( ! empty( $video ) ) {
1307
+ if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) {
1308
+ $videowidth = $metabox['aioseop_opengraph_settings_videowidth'];
1309
+ }
1310
+ if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) {
1311
+ $videoheight = $metabox['aioseop_opengraph_settings_videoheight'];
1312
+ }
1313
+ }
1314
+
1315
+ $card = 'summary';
1316
+ if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) {
1317
+ $card = $this->options['aiosp_opengraph_defcard'];
1318
+ }
1319
+
1320
+ if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) {
1321
+ $card = $metabox['aioseop_opengraph_settings_setcard'];
1322
+ }
1323
+
1324
+ // support for changing legacy twitter cardtype-photo to summary large image
1325
+ if ( $card == 'photo' ) {
1326
+ $card = 'summary_large_image';
1327
+ }
1328
+
1329
+ $site = $domain = $creator = '';
1330
+
1331
+ if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) {
1332
+ $site = $this->options['aiosp_opengraph_twitter_site'];
1333
+ $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site );
1334
+ }
1335
+
1336
+ if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1337
+ $domain = $this->options['aiosp_opengraph_twitter_domain'];
1338
+ }
1339
+
1340
+ if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) {
1341
+ $creator = get_the_author_meta( 'twitter', $post->post_author );
1342
+ $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator );
1343
+ }
1344
+
1345
+ if ( ! empty( $thumbnail ) ) {
1346
+ $twitter_thumbnail = $thumbnail; // Default Twitter image if custom isn't set.
1347
+ }
1348
+
1349
+ if ( isset( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) && ! empty( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) ) {
1350
+ // Set Twitter image from custom.
1351
+ $twitter_thumbnail = set_url_scheme( $metabox['aioseop_opengraph_settings_customimg_twitter'] );
1352
+ }
1353
+
1354
+ // Apply last filters.
1355
+ $description = apply_filters( 'aioseop_description', $description );
1356
+
1357
+ $meta = array(
1358
+ 'facebook' => array(
1359
+ 'title' => 'og:title',
1360
+ 'type' => 'og:type',
1361
+ 'url' => 'og:url',
1362
+ 'thumbnail' => 'og:image',
1363
+ 'width' => 'og:image:width',
1364
+ 'height' => 'og:image:height',
1365
+ 'video' => 'og:video',
1366
+ 'videowidth' => 'og:video:width',
1367
+ 'videoheight' => 'og:video:height',
1368
+ 'sitename' => 'og:site_name',
1369
+ 'key' => 'fb:admins',
1370
+ 'appid' => 'fb:app_id',
1371
+ 'description' => 'og:description',
1372
+ 'section' => 'article:section',
1373
+ 'tag' => 'article:tag',
1374
+ 'publisher' => 'article:publisher',
1375
+ 'author' => 'article:author',
1376
+ 'published_time' => 'article:published_time',
1377
+ 'modified_time' => 'article:modified_time',
1378
+ ),
1379
+ 'twitter' => array(
1380
+ 'card' => 'twitter:card',
1381
+ 'site' => 'twitter:site',
1382
+ 'creator' => 'twitter:creator',
1383
+ 'domain' => 'twitter:domain',
1384
+ 'title' => 'twitter:title',
1385
+ 'description' => 'twitter:description',
1386
+ 'twitter_thumbnail' => 'twitter:image',
1387
+ ),
1388
+ );
1389
+
1390
+ // Only show if "use schema.org markup is checked".
1391
+ if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
1392
+ $meta['google+'] = array( 'thumbnail' => 'image' );
1393
+ }
1394
+
1395
+ $tags = array(
1396
+ 'facebook' => array( 'name' => 'property', 'value' => 'content' ),
1397
+ 'twitter' => array( 'name' => 'name', 'value' => 'content' ),
1398
+ 'google+' => array( 'name' => 'itemprop', 'value' => 'content' ),
1399
+ );
1400
+
1401
+ foreach ( $meta as $t => $data ) {
1402
+ foreach ( $data as $k => $v ) {
1403
+ if ( empty( $$k ) ) {
1404
+ $$k = '';
1405
+ }
1406
+ $filtered_value = $$k;
1407
+ $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k );
1408
+ if ( ! empty( $filtered_value ) ) {
1409
+ if ( ! is_array( $filtered_value ) ) {
1410
+ $filtered_value = array( $filtered_value );
1411
+ }
1412
+
1413
+ /**
1414
+ * This is to accomodate multiple fb:admins on separate lines.
1415
+ * @TODO Eventually we'll want to put this in its own function so things like images work too.
1416
+ */
1417
+ if ( 'key' === $k ) {
1418
+ $fbadmins = explode( ',', str_replace( ' ', '', $filtered_value[0] ) ); // Trim spaces then turn comma-separated values into an array.
1419
+ foreach ( $fbadmins as $fbadmin ) {
1420
+ echo '<meta ' . $tags[ $t ]['name'] . '="' . $v . '" ' . $tags[ $t ]['value'] . '="' . $fbadmin . '" />' . "\n";
1421
+ }
1422
+ } else {
1423
+ // For everything else.
1424
+ foreach ( $filtered_value as $f ) {
1425
+ echo '<meta ' . $tags[ $t ]['name'] . '="' . $v . '" ' . $tags[ $t ]['value'] . '="' . $f . '" />' . "\n";
1426
+ }
1427
+ }
1428
+ }
1429
+ }
1430
+ }
1431
+ $social_link_schema = '';
1432
+ if ( ! empty( $social_links ) ) {
1433
+ $home_url = esc_url( get_home_url() );
1434
+ $social_links = explode( "\n", $social_links );
1435
+ foreach ( $social_links as $k => $v ) {
1436
+ $v = trim( $v );
1437
+ if ( empty( $v ) ) {
1438
+ unset( $social_links[ $k ] );
1439
+ } else {
1440
+ $v = esc_url( $v );
1441
+ $social_links[ $k ] = $v;
1442
+ }
1443
+ }
1444
+ $social_links = join( '","', $social_links );
1445
+ $social_link_schema = <<<END
1446
+ <script type="application/ld+json">
1447
+ { "@context" : "http://schema.org",
1448
+ "@type" : "{$social_type}",
1449
+ "name" : "{$social_name}",
1450
+ "url" : "{$home_url}",
1451
+ "sameAs" : ["{$social_links}"]
1452
+ }
1453
+ </script>
1454
+
1455
+ END;
1456
+ }
1457
+ echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema );
1458
+ }
1459
+
1460
+ /**
1461
+ * Do / adds opengraph properties to meta.
1462
+ * @since 2.3.11
1463
+ *
1464
+ * @global array $aioseop_options AIOSEOP plugin options.
1465
+ */
1466
+ public function do_opengraph() {
1467
+ global $aioseop_options;
1468
+ if ( ! empty( $aioseop_options )
1469
+ && ! empty( $aioseop_options['aiosp_schema_markup'] )
1470
+ ) {
1471
+ add_filter( 'language_attributes', array( &$this, 'add_attributes' ) );
1472
+ }
1473
+ if ( ! defined( 'DOING_AJAX' ) ) {
1474
+ add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 );
1475
+ // Add social meta to AMP plugin.
1476
+ if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true ) {
1477
+ add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 );
1478
+ }
1479
+ }
1480
+ }
1481
+
1482
+ /**
1483
+ * Set up types.
1484
+ *
1485
+ * @since ?
1486
+ * @since 2.3.15 Change to website for homepage and blog post index page, default to object.
1487
+ */
1488
+ function type_setup() {
1489
+ $this->type = 'object'; // Default to type object if we don't have some other rule.
1490
+
1491
+ if ( is_home() || is_front_page() ) {
1492
+ $this->type = 'website'; // Home page and blog page should be website.
1493
+ } elseif ( is_singular() && $this->option_isset( 'types' ) ) {
1494
+ $metabox = $this->get_current_options( array(), 'settings' );
1495
+ $current_post_type = get_post_type();
1496
+ if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) {
1497
+ $this->type = $metabox['aioseop_opengraph_settings_category'];
1498
+ } elseif ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) {
1499
+ $this->type = $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ];
1500
+ }
1501
+ }
1502
+ }
1503
+
1504
+ /**
1505
+ * Inits hooks and others for admin init.
1506
+ * action:admin_init.
1507
+ *
1508
+ * @since 2.3.11
1509
+ * @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox.
1510
+ */
1511
+ function admin_init() {
1512
+ add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 );
1513
+ add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 );
1514
+ add_filter( $this->get_prefix( 'settings' ) . 'default_options', array(
1515
+ &$this,
1516
+ 'filter_default_options',
1517
+ ), 10, 2 );
1518
+ add_filter(
1519
+ $this->get_prefix( 'settings' ) . 'filter_metabox_options', array(
1520
+ &$this,
1521
+ 'filter_metabox_options',
1522
+ ), 10, 3
1523
+ );
1524
+ add_filter(
1525
+ $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array(
1526
+ &$this,
1527
+ 'filter_metabox_options',
1528
+ ), 10, 3
1529
+ );
1530
+ $post_types = $this->get_post_type_titles();
1531
+ $rempost = array(
1532
+ 'revision' => 1,
1533
+ 'nav_menu_item' => 1,
1534
+ 'custom_css' => 1,
1535
+ 'customize_changeset' => 1,
1536
+ );
1537
+ $post_types = array_diff_key( $post_types, $rempost );
1538
+ $this->default_options['types']['initial_options'] = $post_types;
1539
+ foreach ( $post_types as $slug => $name ) {
1540
+ $field = $slug . '_fb_object_type';
1541
+ $this->default_options[ $field ] = array(
1542
+ 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "<br />($slug)",
1543
+ 'type' => 'select',
1544
+ 'style' => '',
1545
+ 'initial_options' => $this->fb_object_types,
1546
+ 'default' => 'article',
1547
+ 'condshow' => array( 'aiosp_opengraph_types\[\]' => $slug ),
1548
+ );
1549
+ $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' );
1550
+ $this->help_anchors[ $field ] = '#content-object-types';
1551
+ $this->locations['opengraph']['options'][] = $field;
1552
+ $this->layout['facebook']['options'][] = $field;
1553
+ }
1554
+ $this->setting_options();
1555
+ $this->add_help_text_links();
1556
+
1557
+ }
1558
+
1559
+ function get_all_images( $options = null, $p = null ) {
1560
+ static $img = array();
1561
+ if ( ! is_array( $options ) ) {
1562
+ $options = array();
1563
+ }
1564
+ if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) {
1565
+ $options['meta_key'] = $this->options['aiosp_opengraph_meta_key'];
1566
+ }
1567
+ if ( empty( $img ) ) {
1568
+ $size = apply_filters( 'post_thumbnail_size', 'large' );
1569
+ $default = $this->get_the_image_by_default();
1570
+ if ( ! empty( $default ) ) {
1571
+ $default = set_url_scheme( $default );
1572
+ $img[ $default ] = 0;
1573
+ }
1574
+ $img = array_merge( $img, parent::get_all_images( $options, null ) );
1575
+ }
1576
+
1577
+ if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
1578
+ $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg';
1579
+ }
1580
+
1581
+ if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) {
1582
+ $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg';
1583
+ $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter';
1584
+ }
1585
+
1586
+ if ( $author_img = $this->get_the_image_by_author( $p ) ) {
1587
+ $image['author'] = $author_img;
1588
+ }
1589
+ $image = array_flip( $img );
1590
+ $images = array();
1591
+ if ( ! empty( $image ) ) {
1592
+ foreach ( $image as $k => $v ) {
1593
+ $images[ $v ] = '<img height=150 src="' . $v . '">';
1594
+ }
1595
+ }
1596
+
1597
+ return array( $image, $images );
1598
+ }
1599
+
1600
+ function get_the_image_by_author( $options = null, $p = null ) {
1601
+ if ( $p === null ) {
1602
+ global $post;
1603
+ } else {
1604
+ $post = $p;
1605
+ }
1606
+ if ( ! empty( $post ) && ! empty( $post->post_author ) ) {
1607
+ $matches = array();
1608
+ $get_avatar = get_avatar( $post->post_author, 300 );
1609
+ if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) {
1610
+ return $matches[1];
1611
+ }
1612
+ }
1613
+
1614
+ return false;
1615
+ }
1616
+
1617
+ function get_the_image( $options = null, $p = null ) {
1618
+ $meta_key = $this->options['aiosp_opengraph_meta_key'];
1619
+
1620
+ return parent::get_the_image( array( 'meta_key' => $meta_key ), $p );
1621
+ }
1622
+
1623
+ function get_the_image_by_default( $args = array() ) {
1624
+ return $this->options['aiosp_opengraph_dimg'];
1625
+ }
1626
+
1627
+ function settings_update() {
1628
+
1629
+ }
1630
+
1631
+ /**
1632
+ * Enqueue our file upload scripts and styles.
1633
+ * @param $hook
1634
+ */
1635
+ function og_admin_enqueue_scripts( $hook ) {
1636
+
1637
+ if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) {
1638
+ // Only enqueue if we're on the social module settings page.
1639
+ return;
1640
+ }
1641
+
1642
+ wp_enqueue_script( 'media-upload' );
1643
+ wp_enqueue_script( 'thickbox' );
1644
+ wp_enqueue_style( 'thickbox' );
1645
+ wp_enqueue_media();
1646
+ }
1647
+
1648
+ function save_tax_data( $term_id, $tt_id, $taxonomy ) {
1649
+ static $update = false;
1650
+ if ( $update ) {
1651
+ return;
1652
+ }
1653
+ if ( $this->locations !== null ) {
1654
+ foreach ( $this->locations as $k => $v ) {
1655
+ if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) {
1656
+ $opts = $this->default_options( $k );
1657
+ $options = array();
1658
+ $update = false;
1659
+ foreach ( $opts as $l => $o ) {
1660
+ if ( isset( $_POST[ $l ] ) ) {
1661
+ $options[ $l ] = stripslashes_deep( $_POST[ $l ] );
1662
+ $options[ $l ] = esc_attr( $options[ $l ] );
1663
+ $update = true;
1664
+ }
1665
+ }
1666
+ if ( $update ) {
1667
+ $prefix = $this->get_prefix( $k );
1668
+ $options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id );
1669
+ update_term_meta( $term_id, '_' . $prefix . $k, $options );
1670
+ }
1671
+ }
1672
+ }
1673
+ }
1674
+ }
1675
+
1676
+ /**
1677
+ * Returns the placeholder filtered and ready for DOM display.
1678
+ * filter:aioseop_opengraph_placeholder
1679
+ * @since 2.4.14
1680
+ *
1681
+ * @param mixed $placeholder Placeholder to be filtered.
1682
+ * @param string $type Type of the value to be filtered.
1683
+ *
1684
+ * @return string
1685
+ */
1686
+ public function filter_placeholder( $placeholder, $type = 'text' ) {
1687
+ return strip_tags( trim( $placeholder ) );
1688
+ }
1689
+
1690
+ /**
1691
+ * Returns filtered default options.
1692
+ * filter:{prefix}default_options
1693
+ * @since 2.4.13
1694
+ *
1695
+ * @param array $options Default options.
1696
+ * @param string $location Location.
1697
+ *
1698
+ * @return array
1699
+ */
1700
+ public function filter_default_options( $options, $location ) {
1701
+ if ( $location === 'settings' ) {
1702
+ $prefix = $this->get_prefix( $location ) . $location . '_';
1703
+ // Add image checker as default
1704
+ $options[ $prefix . 'customimg_checker' ] = 0;
1705
+ }
1706
+ return $options;
1707
+ }
1708
+
1709
+ /**
1710
+ * Returns facebook debug script and link.
1711
+ * @since 2.4.14
1712
+ *
1713
+ * @return string
1714
+ */
1715
+ private function get_facebook_debug() {
1716
+ ob_start();
1717
+ ?>
1718
+ <script>
1719
+ jQuery(document).ready(function () {
1720
+ var snippet = jQuery("#aioseop_snippet_link");
1721
+ if (snippet.length === 0) {
1722
+ jQuery("#aioseop_opengraph_settings_facebook_debug_wrapper").hide();
1723
+ } else {
1724
+ snippet = snippet.html();
1725
+ jQuery("#aioseop_opengraph_settings_facebook_debug")
1726
+ .attr("href", "https://developers.facebook.com/tools/debug/sharing/?q=" + snippet);
1727
+ }
1728
+ });
1729
+ </script>
1730
+ <a name="aioseop_opengraph_settings_facebook_debug"
1731
+ id="aioseop_opengraph_settings_facebook_debug"
1732
+ class="button-primary"
1733
+ href=""
1734
+ target="_blank"
1735
+ ><?php echo __( 'Debug This Post', 'all-in-one-seo-pack' ); ?></a>
1736
+ <?php
1737
+ return ob_get_clean();
1738
+ }
1739
+ }
1740
+ }
modules/aioseop_sitemap.php CHANGED
@@ -54,7 +54,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
54
  $this->comment_string = 'Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s';
55
 
56
  $this->help_text = array(
57
- 'filename' => __( "Specifies the name of your sitemap file. This will default to 'sitemap'.", 'all-in-one-seo-pack' ),
58
  'daily_cron' => __( 'Notify search engines based on the selected schedule, and also update static sitemap daily if in use. (this uses WP-Cron, so make sure this is working properly on your server as well)', 'all-in-one-seo-pack' ),
59
  'indexes' => __( 'Organize sitemap entries into distinct files in your sitemap. Enable this only if your sitemap contains over 50,000 URLs or the file is over 5MB in size.', 'all-in-one-seo-pack' ),
60
  'max_posts' => __( 'Allows you to specify the maximum number of posts in a sitemap (up to 50,000).', 'all-in-one-seo-pack' ),
@@ -75,7 +74,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
75
  );
76
 
77
  $this->help_anchors = array(
78
- 'filename' => '#filename-prefix',
79
  'daily_cron' => '#schedule-updates',
80
  'indexes' => '#enable-sitemap-indexes',
81
  'max_posts' => '#enable-sitemap-indexes',
@@ -96,12 +94,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
96
  );
97
 
98
  $this->default_options = array(
99
- 'filename' => array(
100
- 'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ),
101
- 'default' => 'sitemap',
102
- 'type' => 'text',
103
- 'sanitize' => 'filename',
104
- ),
105
  'daily_cron' => array(
106
  'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ),
107
  'type' => 'select',
@@ -675,6 +667,22 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
675
  return false;
676
  }
677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  /**
679
  * Filter display options.
680
  *
@@ -694,7 +702,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
694
  if ( isset( $options[ $this->prefix . 'max_posts' ] ) && ( ( $options[ $this->prefix . 'max_posts' ] <= 0 ) || ( $options[ $this->prefix . 'max_posts' ] >= 50000 ) ) ) {
695
  $options[ $this->prefix . 'max_posts' ] = 50000;
696
  }
697
- $url = aioseop_home_url( '/' . $options[ $this->prefix . 'filename' ] . '.xml' );
698
 
699
  $options[ $this->prefix . 'link' ] = sprintf( __( 'Click here to %s.', 'all-in-one-seo-pack' ), '<a href="' . esc_url( $url ) . '" target="_blank">' . __( 'view your sitemap', 'all-in-one-seo-pack' ) . '</a>' );
700
  $options[ $this->prefix . 'link' ] .= __( ' Your sitemap has been created with content and images.', 'all-in-one-seo-pack' );
@@ -740,12 +748,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
740
  if ( is_array( $options[ "{$this->prefix}taxonomies" ] ) && in_array( 'all', $options[ "{$this->prefix}taxonomies" ] ) && is_array( $this->default_options['taxonomies']['initial_options'] ) ) {
741
  $options[ "{$this->prefix}taxonomies" ] = array_keys( $this->default_options['taxonomies']['initial_options'] );
742
  }
743
- $opt = $this->prefix . 'filename';
744
- if ( isset( $options[ $opt ] ) && ! empty( $options[ $opt ] ) ) {
745
- $options[ $opt ] = str_replace( '/', '', $options[ $opt ] );
746
- } else {
747
- $options[ $opt ] = 'sitemap';
748
- }
749
  if ( is_multisite() ) {
750
  $options[ $this->prefix . 'rewrite' ] = 'On';
751
  }
@@ -830,7 +832,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
830
  if ( ! $siteurl ) {
831
  $siteurl = get_home_url( $blog_id );
832
  }
833
- $url = $siteurl . '/' . $sitemap_options[ "{$this->prefix}filename" ] . '.xml';
834
  if ( $sitemap_options[ "{$this->prefix}gzipped" ] ) {
835
  $url .= '.gz';
836
  }
@@ -904,10 +906,12 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
904
  $scan1 = $scan2 = '';
905
  $files = array();
906
 
907
- if ( ! empty( $this->options[ "{$this->prefix}filename" ] ) ) {
908
- $scan1 = get_home_path() . $this->options[ "{$this->prefix}filename" ] . '*.xml';
909
- if ( ! empty( $this->options[ "{$this->prefix}gzipped" ] ) ) {
910
- $scan2 .= get_home_path() . $this->options[ "{$this->prefix}filename" ] . '*.xml.gz';
 
 
911
  }
912
 
913
  if ( empty( $scan1 ) && empty( $scan2 ) ) {
@@ -1148,15 +1152,16 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1148
  function get_rewrite_rules() {
1149
  $sitemap_rules_normal = $sitemap_rules_gzipped = array();
1150
  $sitemap_rules_normal = array(
1151
- $this->options[ "{$this->prefix}filename" ] . '.xml' => "index.php?{$this->prefix}path=root",
1152
- $this->options[ "{$this->prefix}filename" ] . '_(.+)_(\d+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]',
1153
- $this->options[ "{$this->prefix}filename" ] . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]',
1154
  );
1155
  if ( $this->options[ "{$this->prefix}gzipped" ] ) {
1156
  $sitemap_rules_gzipped = array(
1157
- $this->options[ "{$this->prefix}filename" ] . '.xml.gz' => "index.php?{$this->prefix}gzipped=1&{$this->prefix}path=root.gz",
1158
- $this->options[ "{$this->prefix}filename" ] . '_(.+)_(\d+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz&' . $this->prefix . 'page=$matches[2]',
1159
- $this->options[ "{$this->prefix}filename" ] . '_(.+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz',
 
1160
  );
1161
  }
1162
  $sitemap_rules = $sitemap_rules_gzipped + $sitemap_rules_normal;
@@ -1374,7 +1379,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1374
  if ( $this->options[ "{$this->prefix}gzipped" ] ) {
1375
  $gz .= '.gz';
1376
  }
1377
- $url = aioseop_home_url( '/' . $this->options[ "{$this->prefix}filename" ] . ".xml$gz" );
 
1378
 
1379
  return $url;
1380
  }
@@ -1451,10 +1457,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1451
  $this->do_indexed_sitemaps();
1452
  } else {
1453
  $this->log_start();
1454
- $comment = sprintf( "file '%s' statically", $this->options[ "{$this->prefix}filename" ] );
 
1455
  $sitemap = $this->do_simple_sitemap( $comment );
1456
- $this->write_sitemaps( $this->options[ "{$this->prefix}filename" ], $sitemap );
1457
- $this->log_stats( 'root', $this->options[ "{$this->prefix}gzipped" ], false );
1458
  }
1459
  } else {
1460
  delete_transient( "{$this->prefix}rules_flushed" );
@@ -1627,7 +1634,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1627
  function get_sitemap_index_filenames() {
1628
  $files = array();
1629
  $options = $this->options;
1630
- $prefix = $options[ "{$this->prefix}filename" ];
 
1631
  $suffix = '.xml';
1632
  if ( $options[ "{$this->prefix}gzipped" ] ) {
1633
  $suffix .= '.gz';
@@ -1755,9 +1763,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1755
  function do_build_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
1756
  if ( empty( $filename ) ) {
1757
  if ( 'root' === $sitemap_type ) {
1758
- $filename = $this->options[ "{$this->prefix}filename" ];
1759
  } else {
1760
- $filename = $this->options[ "{$this->prefix}filename" ] . '_' . $sitemap_type;
1761
  }
1762
  }
1763
  if ( empty( $comment ) ) {
@@ -1782,9 +1790,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1782
  function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
1783
  if ( empty( $filename ) ) {
1784
  if ( 'root' === $sitemap_type ) {
1785
- $filename = $this->options[ "{$this->prefix}filename" ];
1786
  } else {
1787
- $filename = $this->options[ "{$this->prefix}filename" ] . '_' . $sitemap_type;
1788
  }
1789
  }
1790
  if ( empty( $comment ) ) {
@@ -1833,7 +1841,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1833
  if ( ! empty( $this->options[ "{$this->prefix}indexes" ] ) && ( $post_counts[ $posttype ] > $this->max_posts ) ) {
1834
  $count = 1;
1835
  for ( $post_count = 0; $post_count < $post_counts[ $posttype ]; $post_count += $this->max_posts ) {
1836
- $this->do_write_sitemap( $posttype, $count - 1, $options[ "{$this->prefix}filename" ] . "_{$posttype}_{$count}" );
1837
  $count ++;
1838
  }
1839
  } else {
@@ -1850,7 +1858,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1850
  if ( $term_count > $this->max_posts ) {
1851
  $count = 1;
1852
  for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
1853
- $this->do_write_sitemap( $taxonomy, $tc, $options[ "{$this->prefix}filename" ] . "_{$taxonomy}_{$count}" );
1854
  $count ++;
1855
  }
1856
  } else {
@@ -2664,9 +2672,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2664
  $url = call_user_func( $linkfunc, $post );
2665
  $is_single = false;
2666
  }
2667
- $date = $post->post_modified;
2668
  if ( '0000-00-00 00:00:00' === $date ) {
2669
- $date = $post->post_date;
2670
  }
2671
  if ( '0000-00-00 00:00:00' !== $date ) {
2672
  $date = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $date ) );
@@ -2792,17 +2800,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2792
  return $images;
2793
  }
2794
 
2795
- $attached_url = false;
2796
- // Check featured image.
2797
- if ( version_compare( $wp_version, '4.4.0', '>=' ) ) {
2798
- $attached_url = get_the_post_thumbnail_url( $post->ID );
2799
- } else {
2800
- $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
2801
- if ( $post_thumbnail_id ) {
2802
- $attached_url = wp_get_attachment_image_src( $post_thumbnail_id );
2803
- }
2804
- }
2805
- if ( false !== $attached_url ) {
2806
  $images[] = $attached_url;
2807
  }
2808
 
54
  $this->comment_string = 'Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s';
55
 
56
  $this->help_text = array(
 
57
  'daily_cron' => __( 'Notify search engines based on the selected schedule, and also update static sitemap daily if in use. (this uses WP-Cron, so make sure this is working properly on your server as well)', 'all-in-one-seo-pack' ),
58
  'indexes' => __( 'Organize sitemap entries into distinct files in your sitemap. Enable this only if your sitemap contains over 50,000 URLs or the file is over 5MB in size.', 'all-in-one-seo-pack' ),
59
  'max_posts' => __( 'Allows you to specify the maximum number of posts in a sitemap (up to 50,000).', 'all-in-one-seo-pack' ),
74
  );
75
 
76
  $this->help_anchors = array(
 
77
  'daily_cron' => '#schedule-updates',
78
  'indexes' => '#enable-sitemap-indexes',
79
  'max_posts' => '#enable-sitemap-indexes',
94
  );
95
 
96
  $this->default_options = array(
 
 
 
 
 
 
97
  'daily_cron' => array(
98
  'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ),
99
  'type' => 'select',
667
  return false;
668
  }
669
 
670
+ /**
671
+ * Get the filename prefix for the sitemap file.
672
+ *
673
+ * If a value was provided when this prefix was configurable from the settings page, return that instead of the default.
674
+ *
675
+ * @return string
676
+ */
677
+ private function get_filename() {
678
+ $filename = 'sitemap';
679
+ if ( ! empty( $this->options["{$this->prefix}filename"] ) ) {
680
+ $filename = $this->options["{$this->prefix}filename"];
681
+ $filename = str_replace( '/', '', $filename );
682
+ }
683
+ return $filename;
684
+ }
685
+
686
  /**
687
  * Filter display options.
688
  *
702
  if ( isset( $options[ $this->prefix . 'max_posts' ] ) && ( ( $options[ $this->prefix . 'max_posts' ] <= 0 ) || ( $options[ $this->prefix . 'max_posts' ] >= 50000 ) ) ) {
703
  $options[ $this->prefix . 'max_posts' ] = 50000;
704
  }
705
+ $url = aioseop_home_url( '/' . $this->get_filename() . '.xml' );
706
 
707
  $options[ $this->prefix . 'link' ] = sprintf( __( 'Click here to %s.', 'all-in-one-seo-pack' ), '<a href="' . esc_url( $url ) . '" target="_blank">' . __( 'view your sitemap', 'all-in-one-seo-pack' ) . '</a>' );
708
  $options[ $this->prefix . 'link' ] .= __( ' Your sitemap has been created with content and images.', 'all-in-one-seo-pack' );
748
  if ( is_array( $options[ "{$this->prefix}taxonomies" ] ) && in_array( 'all', $options[ "{$this->prefix}taxonomies" ] ) && is_array( $this->default_options['taxonomies']['initial_options'] ) ) {
749
  $options[ "{$this->prefix}taxonomies" ] = array_keys( $this->default_options['taxonomies']['initial_options'] );
750
  }
 
 
 
 
 
 
751
  if ( is_multisite() ) {
752
  $options[ $this->prefix . 'rewrite' ] = 'On';
753
  }
832
  if ( ! $siteurl ) {
833
  $siteurl = get_home_url( $blog_id );
834
  }
835
+ $url = $siteurl . '/' . $this->get_filename() . '.xml';
836
  if ( $sitemap_options[ "{$this->prefix}gzipped" ] ) {
837
  $url .= '.gz';
838
  }
906
  $scan1 = $scan2 = '';
907
  $files = array();
908
 
909
+
910
+ $filename = $this->get_filename();
911
+ if ( ! empty( $filename ) ) {
912
+ $scan1 = get_home_path() . $filename . '*.xml';
913
+ if ( ! empty( $this->options["{$this->prefix}gzipped"] ) ) {
914
+ $scan2 .= get_home_path() . $filename . '*.xml.gz';
915
  }
916
 
917
  if ( empty( $scan1 ) && empty( $scan2 ) ) {
1152
  function get_rewrite_rules() {
1153
  $sitemap_rules_normal = $sitemap_rules_gzipped = array();
1154
  $sitemap_rules_normal = array(
1155
+ $this->get_filename() . '.xml' => "index.php?{$this->prefix}path=root",
1156
+ $this->get_filename() . '_(.+)_(\d+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]',
1157
+ $this->get_filename() . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]',
1158
  );
1159
  if ( $this->options[ "{$this->prefix}gzipped" ] ) {
1160
  $sitemap_rules_gzipped = array(
1161
+
1162
+ $this->get_filename() . '.xml.gz' => "index.php?{$this->prefix}gzipped=1&{$this->prefix}path=root.gz",
1163
+ $this->get_filename() . '_(.+)_(\d+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz&' . $this->prefix . 'page=$matches[2]',
1164
+ $this->get_filename() . '_(.+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz',
1165
  );
1166
  }
1167
  $sitemap_rules = $sitemap_rules_gzipped + $sitemap_rules_normal;
1379
  if ( $this->options[ "{$this->prefix}gzipped" ] ) {
1380
  $gz .= '.gz';
1381
  }
1382
+
1383
+ $url = aioseop_home_url( '/' . $this->get_filename() . ".xml$gz" );
1384
 
1385
  return $url;
1386
  }
1457
  $this->do_indexed_sitemaps();
1458
  } else {
1459
  $this->log_start();
1460
+
1461
+ $comment = sprintf( "file '%s' statically", $this->get_filename() );
1462
  $sitemap = $this->do_simple_sitemap( $comment );
1463
+ $this->write_sitemaps( $this->get_filename(), $sitemap );
1464
+ $this->log_stats( 'root', $this->options["{$this->prefix}gzipped"], false );
1465
  }
1466
  } else {
1467
  delete_transient( "{$this->prefix}rules_flushed" );
1634
  function get_sitemap_index_filenames() {
1635
  $files = array();
1636
  $options = $this->options;
1637
+
1638
+ $prefix = $this->get_filename();
1639
  $suffix = '.xml';
1640
  if ( $options[ "{$this->prefix}gzipped" ] ) {
1641
  $suffix .= '.gz';
1763
  function do_build_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
1764
  if ( empty( $filename ) ) {
1765
  if ( 'root' === $sitemap_type ) {
1766
+ $filename = $this->get_filename();
1767
  } else {
1768
+ $filename = $this->get_filename() . '_' . $sitemap_type;
1769
  }
1770
  }
1771
  if ( empty( $comment ) ) {
1790
  function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
1791
  if ( empty( $filename ) ) {
1792
  if ( 'root' === $sitemap_type ) {
1793
+ $filename = $this->get_filename();
1794
  } else {
1795
+ $filename = $this->get_filename() . '_' . $sitemap_type;
1796
  }
1797
  }
1798
  if ( empty( $comment ) ) {
1841
  if ( ! empty( $this->options[ "{$this->prefix}indexes" ] ) && ( $post_counts[ $posttype ] > $this->max_posts ) ) {
1842
  $count = 1;
1843
  for ( $post_count = 0; $post_count < $post_counts[ $posttype ]; $post_count += $this->max_posts ) {
1844
+ $this->do_write_sitemap( $posttype, $count - 1, $this->get_filename() . "_{$posttype}_{$count}" );
1845
  $count ++;
1846
  }
1847
  } else {
1858
  if ( $term_count > $this->max_posts ) {
1859
  $count = 1;
1860
  for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
1861
+ $this->do_write_sitemap( $taxonomy, $tc, $this->get_filename() . "_{$taxonomy}_{$count}" );
1862
  $count ++;
1863
  }
1864
  } else {
2672
  $url = call_user_func( $linkfunc, $post );
2673
  $is_single = false;
2674
  }
2675
+ $date = $post->post_modified_gmt;
2676
  if ( '0000-00-00 00:00:00' === $date ) {
2677
+ $date = $post->post_date_gmt;
2678
  }
2679
  if ( '0000-00-00 00:00:00' !== $date ) {
2680
  $date = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $date ) );
2800
  return $images;
2801
  }
2802
 
2803
+ $attached_url = get_the_post_thumbnail_url( $post->ID );
2804
+ if ( $attached_url ) {
 
 
 
 
 
 
 
 
 
2805
  $images[] = $attached_url;
2806
  }
2807
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtor
4
  Tags: seo, all in one seo, google, twitter, page, image seo, social, search engine optimization, sitemap, WordPress SEO, meta, meta description, xml sitemap, google sitemap, sitemaps, robots meta, yahoo, bing, news sitemaps, multisite, canonical, nofollow, noindex, keywords, description, webmaster tools, google webmaster tools, google analytics
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
- Stable tag: 2.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -50,7 +50,7 @@ https://www.youtube.com/watch?v=46MR4FboMaA
50
 
51
  == Changelog ==
52
 
53
- All in One SEO Pack [Changelog](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-pack-release-history/)
54
 
55
  == Frequently Asked Questions ==
56
 
4
  Tags: seo, all in one seo, google, twitter, page, image seo, social, search engine optimization, sitemap, WordPress SEO, meta, meta description, xml sitemap, google sitemap, sitemaps, robots meta, yahoo, bing, news sitemaps, multisite, canonical, nofollow, noindex, keywords, description, webmaster tools, google webmaster tools, google analytics
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
+ Stable tag: 2.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
50
 
51
  == Changelog ==
52
 
53
+ All in One SEO Pack [Changelog](https://semperfiwebdesign.com/all-in-one-seo-pack-release-history/)
54
 
55
  == Frequently Asked Questions ==
56