The SEO Framework - Version 3.0.6

Version Description

  • Lionize =

Release date

  • May 6th, 2018

Summarized:

  • TSF now integrates completely with attachment pages.
  • Non-personalized Facebook profile links can now be set via the Social SEO settings and user's Authorial Info settings.
  • Seven bugs have been fixed, mainly involving descriptions and the sitemap.
  • The plugin now suggests, once, that you can use Focus keywords via the Extension Manager.

For everyone, about the suggestion:

  • We believe not everyone is up-to-date yet with the current progression of the extensions. Some of which can help you out greatly with SEO.
  • So, from this update, all sites will get a one-time-only auto-dismissing suggestion for TSFEM.
  • This suggestion has many conditions attached before being shown. So, it's likely you won't ever see it.
  • We understand that not everyone welcomes this introduction. However, this suggestion is to help this plugin and your site grow, from which we all will benefit.

For developers, about descriptions:

  • If you're using description-related filters or functions from TSF on your sites, check out the detailed "for developers" log.
  • Many functions have been silently deprecated, and you should now use simple caller functions.
  • No action is needed from your side until the next major release (ETA July 2018).

For developers, about titles ETA July 2018:

  • In the next major release, we're going to change how we handle titles.
  • This change won't affect users directly. But it will allow us to manipulate the titles better.
  • For more information, view and subscribe to issue 202.

View the detailed log.

Download this release

Release Info

Developer Cybr
Plugin Icon 128x128 The SEO Framework
Version 3.0.6
Comparing to
See all releases

Code changes from version 3.0.5 to 3.0.6

autodescription.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: The SEO Framework
4
* Plugin URI: https://theseoframework.com/
5
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.
6
- * Version: 3.0.5
7
* Author: Sybre Waaijer
8
* Author URI: https://theseoframework.com/
9
* License: GPLv3
@@ -33,10 +33,11 @@ defined( 'ABSPATH' ) or die;
33
//* Debug. Not to be used on production websites as it dumps and/or disables all kinds of stuff everywhere.
34
// add_action( 'plugins_loaded', function() { if ( is_super_admin() ) {
35
// if ( is_admin() ) {
36
- // define( 'THE_SEO_FRAMEWORK_DEBUG', true );
37
// define( 'THE_SEO_FRAMEWORK_DEBUG_HIDDEN', true );
38
// define( 'THE_SEO_FRAMEWORK_DISABLE_TRANSIENTS', true );
39
- // update_option( 'the_seo_framework_upgraded_db_version', '0' );
40
// add_filter( 'the_seo_framework_use_object_cache', '__return_false' );
41
// }
42
// }},0);
@@ -51,7 +52,7 @@ defined( 'ABSPATH' ) or die;
51
*
52
* @since 1.0.0
53
*/
54
- define( 'THE_SEO_FRAMEWORK_VERSION', '3.0.5' );
55
56
/**
57
* The plugin Database version.
@@ -60,7 +61,7 @@ define( 'THE_SEO_FRAMEWORK_VERSION', '3.0.5' );
60
*
61
* @since 2.7.0
62
*/
63
- define( 'THE_SEO_FRAMEWORK_DB_VERSION', '3001' );
64
65
/**
66
* The plugin options database option_name.
3
* Plugin Name: The SEO Framework
4
* Plugin URI: https://theseoframework.com/
5
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.
6
+ * Version: 3.0.6
7
* Author: Sybre Waaijer
8
* Author URI: https://theseoframework.com/
9
* License: GPLv3
33
//* Debug. Not to be used on production websites as it dumps and/or disables all kinds of stuff everywhere.
34
// add_action( 'plugins_loaded', function() { if ( is_super_admin() ) {
35
// if ( is_admin() ) {
36
+ // define( 'THE_SEO_FRAMEWORK_DEBUG', true );
37
// define( 'THE_SEO_FRAMEWORK_DEBUG_HIDDEN', true );
38
// define( 'THE_SEO_FRAMEWORK_DISABLE_TRANSIENTS', true );
39
+ // update_option( 'the_seo_framework_upgraded_db_version', '3060' );
40
+ // update_option( 'the_seo_framework_tested_upgrade_version', '0' );
41
// add_filter( 'the_seo_framework_use_object_cache', '__return_false' );
42
// }
43
// }},0);
52
*
53
* @since 1.0.0
54
*/
55
+ define( 'THE_SEO_FRAMEWORK_VERSION', '3.0.6' );
56
57
/**
58
* The plugin Database version.
61
*
62
* @since 2.7.0
63
*/
64
+ define( 'THE_SEO_FRAMEWORK_DB_VERSION', '3060' );
65
66
/**
67
* The plugin options database option_name.
inc/classes/admin-init.class.php CHANGED
@@ -126,6 +126,7 @@ class Admin_Init extends Init {
126
* Enqueues scripts.
127
*
128
* @since 2.0.2
129
*
130
* @param string $hook The current page hook.
131
*/
@@ -140,8 +141,11 @@ class Admin_Init extends Init {
140
//* Register the script.
141
$this->_register_admin_javascript();
142
143
- if ( $this->is_post_edit() || $this->is_seo_settings_page() )
144
\wp_enqueue_media();
145
146
if ( $this->is_seo_settings_page() )
147
\wp_enqueue_script( 'wp-color-picker' );
@@ -221,7 +225,7 @@ class Admin_Init extends Init {
221
$id = $this->get_the_real_ID();
222
$blog_name = $this->get_blogname();
223
$description = $this->get_blogdescription();
224
- $object_title = '';
225
$additions = '';
226
227
$use_additions = (bool) $this->get_option( 'homepage_tagline' );
@@ -261,7 +265,7 @@ class Admin_Init extends Init {
261
if ( isset( $this->page_base_file ) && $this->page_base_file ) {
262
// We're somewhere within default WordPress pages.
263
if ( $this->is_static_frontpage( $id ) ) {
264
- $object_title = $this->get_option( 'homepage_title' ) ?: $blog_name;
265
$title_location = $this->get_option( 'home_title_location' );
266
$ishome = true;
267
@@ -278,7 +282,7 @@ class Admin_Init extends Init {
278
'get_custom_field' => false,
279
);
280
281
- $object_title = $this->title( '', '', '', $generated_doctitle_args );
282
283
if ( $title_add_additions ) {
284
$additions = $blog_name;
@@ -290,13 +294,13 @@ class Admin_Init extends Init {
290
} elseif ( $is_term_edit ) {
291
//* Category or Tag.
292
if ( isset( $GLOBALS['current_screen']->taxonomy ) && $id ) {
293
- $object_title = $this->single_term_title( '', false, $this->fetch_the_term( $id ) );
294
$additions = $title_add_additions ? $blog_name : '';
295
}
296
} else {
297
//* We're in a special place.
298
// Can't fetch title.
299
- $object_title = '';
300
$additions = $title_add_additions ? $blog_name : '';
301
}
302
} elseif ( $is_settings_page ) {
@@ -309,7 +313,7 @@ class Admin_Init extends Init {
309
// Home is a blog.
310
$inpost_title = '';
311
}
312
- $object_title = $inpost_title ?: $blog_name;
313
$additions = $home_tagline ?: $description;
314
}
315
@@ -361,7 +365,8 @@ class Admin_Init extends Init {
361
'pixelsUsed' => $has_input ? \__( '%1$d out of %2$d pixels are used.', 'autodescription' ) : '',
362
),
363
'params' => array(
364
- 'objectTitle' => $object_title,
365
'titleAdditions' => $additions,
366
'blogDescription' => $description,
367
'termName' => $term_name,
@@ -569,7 +574,6 @@ class Admin_Init extends Init {
569
$color = $colors[2];
570
$color_accent = $colors[3];
571
572
- // TODO fix this.
573
// $bg_alt_font = '#' . $this->get_relative_fontcolor( $bg );
574
$bg_accent_alt_font = '#' . $this->get_relative_fontcolor( $bg_accent );
575
126
* Enqueues scripts.
127
*
128
* @since 2.0.2
129
+ * @since 3.0.6 Now attaches the post ID to `wp_enqueue_media` on post edit.
130
*
131
* @param string $hook The current page hook.
132
*/
141
//* Register the script.
142
$this->_register_admin_javascript();
143
144
+ if ( $this->is_post_edit() ) {
145
+ \wp_enqueue_media( array( 'post' => $this->get_the_real_admin_ID() ) );
146
+ } elseif ( $this->is_seo_settings_page() ) {
147
\wp_enqueue_media();
148
+ }
149
150
if ( $this->is_seo_settings_page() )
151
\wp_enqueue_script( 'wp-color-picker' );
225
$id = $this->get_the_real_ID();
226
$blog_name = $this->get_blogname();
227
$description = $this->get_blogdescription();
228
+ $default_title = '';
229
$additions = '';
230
231
$use_additions = (bool) $this->get_option( 'homepage_tagline' );
265
if ( isset( $this->page_base_file ) && $this->page_base_file ) {
266
// We're somewhere within default WordPress pages.
267
if ( $this->is_static_frontpage( $id ) ) {
268
+ $default_title = $this->get_option( 'homepage_title' ) ?: $blog_name;
269
$title_location = $this->get_option( 'home_title_location' );
270
$ishome = true;
271
282
'get_custom_field' => false,
283
);
284
285
+ $default_title = $this->title( '', '', '', $generated_doctitle_args );
286
287
if ( $title_add_additions ) {
288
$additions = $blog_name;
294
} elseif ( $is_term_edit ) {
295
//* Category or Tag.
296
if ( isset( $GLOBALS['current_screen']->taxonomy ) && $id ) {
297
+ $default_title = $this->single_term_title( '', false, $this->fetch_the_term( $id ) );
298
$additions = $title_add_additions ? $blog_name : '';
299
}
300
} else {
301
//* We're in a special place.
302
// Can't fetch title.
303
+ $default_title = '';
304
$additions = $title_add_additions ? $blog_name : '';
305
}
306
} elseif ( $is_settings_page ) {
313
// Home is a blog.
314
$inpost_title = '';
315
}
316
+ $default_title = $inpost_title ?: $blog_name;
317
$additions = $home_tagline ?: $description;
318
}
319
365
'pixelsUsed' => $has_input ? \__( '%1$d out of %2$d pixels are used.', 'autodescription' ) : '',
366
),
367
'params' => array(
368
+ 'objectTitle' => $default_title,
369
+ 'defaultTitle' => $default_title,
370
'titleAdditions' => $additions,
371
'blogDescription' => $description,
372
'termName' => $term_name,
574
$color = $colors[2];
575
$color_accent = $colors[3];
576
577
// $bg_alt_font = '#' . $this->get_relative_fontcolor( $bg );
578
$bg_accent_alt_font = '#' . $this->get_relative_fontcolor( $bg_accent );
579
inc/classes/cache.class.php CHANGED
@@ -159,6 +159,7 @@ class Cache extends Sitemaps {
159
160
//* Excluded IDs cache.
161
\add_action( 'save_post', array( $this, 'delete_excluded_ids_cache' ) );
162
163
$run = true;
164
}
@@ -777,6 +778,7 @@ class Cache extends Sitemaps {
777
$query = '';
778
779
//* TODO figure out why this check is here... admin compat maybe?
780
if ( function_exists( 'get_search_query' ) ) {
781
$search_query = \get_search_query( $_escaped = true );
782
159
160
//* Excluded IDs cache.
161
\add_action( 'save_post', array( $this, 'delete_excluded_ids_cache' ) );
162
+ \add_action( 'edit_attachment', array( $this, 'delete_excluded_ids_cache' ) );
163
164
$run = true;
165
}
778
$query = '';
779
780
//* TODO figure out why this check is here... admin compat maybe?
781
+ //! TODO convert the search query to a hash: search_(hash)... encode first!
782
if ( function_exists( 'get_search_query' ) ) {
783
$search_query = \get_search_query( $_escaped = true );
784
inc/classes/core.class.php CHANGED
@@ -115,9 +115,6 @@ class Core {
115
* Latest Class. Doesn't have parent.
116
*/
117
protected function __construct() {
118
-
119
- \add_action( 'current_screen', array( $this, 'post_type_support' ), 0 );
120
-
121
if ( $this->the_seo_framework_debug ) {
122
123
$debug_instance = Debug::get_instance();
@@ -205,36 +202,6 @@ class Core {
205
return round( $i );
206
}
207
208
- /**
209
- * Adds post type support for The SEO Framework.
210
- *
211
- * @since 2.1.6
212
- */
213
- public function post_type_support() {
214
-
215
- $defaults = array(
216
- 'post',
217
- 'page',
218
- 'product',
219
- 'forum',
220
- 'topic',
221
- 'jetpack-testimonial',
222
- 'jetpack-portfolio',
223
- );
224
-
225
- /**
226
- * Applies filters the_seo_framework_supported_post_types : Array The supported post types.
227
- * @since 2.3.1
228
- */
229
- $post_types = (array) \apply_filters( 'the_seo_framework_supported_post_types', $defaults );
230
-
231
- $types = \wp_parse_args( $defaults, $post_types );
232
-
233
- foreach ( $types as $type ) {
234
- \add_post_type_support( $type, array( 'autodescription-meta' ) );
235
- }
236
- }
237
-
238
/**
239
* Adds link from plugins page to SEO Settings page.
240
*
@@ -290,6 +257,7 @@ class Core {
290
* Also loads scripts and styles if out of The SEO Framework's context.
291
*
292
* @since 2.6.0
293
*
294
* @param string $message The notice message. Expected to be escaped if $escape is false.
295
* @param string $type The notice type : 'updated', 'error', 'warning'. Expected to be escaped.
@@ -302,9 +270,6 @@ class Core {
302
if ( empty( $message ) )
303
return '';
304
305
- if ( $escape )
306
- $message = \esc_html( $message );
307
-
308
//* Make sure the scripts are loaded.
309
$this->init_admin_scripts( true );
310
@@ -315,7 +280,7 @@ class Core {
315
316
$notice = '<div class="notice ' . \esc_attr( $type ) . ' tsf-notice ' . $a11y . '"><p>';
317
$notice .= '<a class="hide-if-no-js tsf-dismiss" title="' . \esc_attr__( 'Dismiss', 'autodescription' ) . '"></a>';
318
- $notice .= '<strong>' . $message . '</strong>';
319
$notice .= '</p></div>';
320
321
return $notice;
@@ -627,7 +592,7 @@ class Core {
627
*
628
* @param bool $guess : If true, the timezone will be guessed from the
629
* WordPress core gmt_offset option.
630
- * @return string PHP Timezone String.
631
*/
632
public function get_timezone_string( $guess = false ) {
633
@@ -672,6 +637,7 @@ class Core {
672
* Sets and resets the timezone.
673
*
674
* @since 2.6.0
675
*
676
* @param string $tzstring Optional. The PHP Timezone string. Best to leave empty to always get a correct one.
677
* @link http://php.net/manual/en/timezones.php
@@ -692,7 +658,7 @@ class Core {
692
return date_default_timezone_set( $old_tz );
693
694
if ( empty( $tzstring ) )
695
- $tzstring = $this->get_timezone_string( true );
696
697
return date_default_timezone_set( $tzstring );
698
}
115
* Latest Class. Doesn't have parent.
116
*/
117
protected function __construct() {
118
if ( $this->the_seo_framework_debug ) {
119
120
$debug_instance = Debug::get_instance();
202
return round( $i );
203
}
204
205
/**
206
* Adds link from plugins page to SEO Settings page.
207
*
257
* Also loads scripts and styles if out of The SEO Framework's context.
258
*
259
* @since 2.6.0
260
+ * @since 3.0.6 The messages are no longer auto-styled to "strong".
261
*
262
* @param string $message The notice message. Expected to be escaped if $escape is false.
263
* @param string $type The notice type : 'updated', 'error', 'warning'. Expected to be escaped.
270
if ( empty( $message ) )
271
return '';
272
273
//* Make sure the scripts are loaded.
274
$this->init_admin_scripts( true );
275
280
281
$notice = '<div class="notice ' . \esc_attr( $type ) . ' tsf-notice ' . $a11y . '"><p>';
282
$notice .= '<a class="hide-if-no-js tsf-dismiss" title="' . \esc_attr__( 'Dismiss', 'autodescription' ) . '"></a>';
283
+ $notice .= $escape ? \esc_html( $message ) : $message;
284
$notice .= '</p></div>';
285
286
return $notice;
592
*
593
* @param bool $guess : If true, the timezone will be guessed from the
594
* WordPress core gmt_offset option.
595
+ * @return string PHP Timezone String. May be empty (thus invalid).
596
*/
597
public function get_timezone_string( $guess = false ) {
598
637
* Sets and resets the timezone.
638
*
639
* @since 2.6.0
640
+ * @since 3.0.6 Now uses the old timezone string when a new one can't be generated.
641
*
642
* @param string $tzstring Optional. The PHP Timezone string. Best to leave empty to always get a correct one.
643
* @link http://php.net/manual/en/timezones.php
658
return date_default_timezone_set( $old_tz );
659
660
if ( empty( $tzstring ) )
661
+ $tzstring = $this->get_timezone_string( true ) ?: $old_tz;
662
663
return date_default_timezone_set( $tzstring );
664
}
inc/classes/detect.class.php CHANGED
@@ -44,6 +44,7 @@ class Detect extends Render {
44
/**
45
* Determines if we're doing ajax.
46
*
47
* @since 2.9.0
48
* @staticvar bool $cache
49
*
@@ -126,6 +127,7 @@ class Detect extends Render {
126
* Filterable list of conflicting plugins.
127
*
128
* @since 2.6.0
129
* @credits JetPack for most code.
130
*
131
* @return array List of conflicting plugins.
@@ -157,7 +159,6 @@ class Detect extends Render {
157
'Facebook Open Graph Meta Tags for WordPress' => 'wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php',
158
'Facebook Thumb Fixer' => 'facebook-thumb-fixer/_facebook-thumb-fixer.php',
159
'Fedmichs Facebook Open Graph Meta' => 'facebook-and-digg-thumbnail-generator/facebook-and-digg-thumbnail-generator.php',
160
- 'Header and Footer' => 'header-footer/plugin.php',
161
'NextGEN Facebook OG' => 'nextgen-facebook/nextgen-facebook.php',
162
'Open Graph' => 'opengraph/opengraph.php',
163
'Open Graph Protocol Framework' => 'open-graph-protocol-framework/open-graph-protocol-framework.php',
44
/**
45
* Determines if we're doing ajax.
46
*
47
+ * @todo use wp_doing_ajax() in a future version. Requires WP 4.7+.
48
* @since 2.9.0
49
* @staticvar bool $cache
50
*
127
* Filterable list of conflicting plugins.
128
*
129
* @since 2.6.0
130
+ * @TODO consider removing "Header and Footer"
131
* @credits JetPack for most code.
132
*
133
* @return array List of conflicting plugins.
159
'Facebook Open Graph Meta Tags for WordPress' => 'wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php',
160
'Facebook Thumb Fixer' => 'facebook-thumb-fixer/_facebook-thumb-fixer.php',
161
'Fedmichs Facebook Open Graph Meta' => 'facebook-and-digg-thumbnail-generator/facebook-and-digg-thumbnail-generator.php',
162
'NextGEN Facebook OG' => 'nextgen-facebook/nextgen-facebook.php',
163
'Open Graph' => 'opengraph/opengraph.php',
164
'Open Graph Protocol Framework' => 'open-graph-protocol-framework/open-graph-protocol-framework.php',
inc/classes/doing-it-right.class.php CHANGED
@@ -760,6 +760,7 @@ class Doing_It_Right extends Generate_Ldjson {
760
*
761
* @since 2.6.0
762
* @since 2.9.0 Now also returns noindex value.
763
* @staticvar array $data
764
*
765
* @param array $args The term args.
@@ -782,7 +783,7 @@ class Doing_It_Right extends Generate_Ldjson {
782
$data = $this->get_term_meta( $term_id );
783
784
$title_custom_field = isset( $data['doctitle'] ) ? $data['doctitle'] : '';
785
- $description_custom_field = isset( $data['description'] ) ? $data['description'] : '';
786
$noindex = isset( $data['noindex'] ) ? $data['noindex'] : '';
787
$nofollow = isset( $data['nofollow'] ) ? $data['nofollow'] : '';
788
$noarchive = isset( $data['noarchive'] ) ? $data['noarchive'] : '';
@@ -795,21 +796,13 @@ class Doing_It_Right extends Generate_Ldjson {
795
}
796
797
$description_is_from_custom_field = (bool) $description_custom_field;
798
if ( $description_is_from_custom_field ) {
799
- $taxonomy = ! empty( $term->taxonomy ) ? $term->taxonomy : '';
800
- $description_args = $taxonomy ? array( 'id' => $term_id, 'taxonomy' => $term->taxonomy, 'get_custom_field' => true ) : array( 'get_custom_field' => true );
801
-
802
- $description = $this->generate_description( '', $description_args );
803
} else {
804
- $taxonomy = ! empty( $term->taxonomy ) ? $term->taxonomy : '';
805
- $description_args = $taxonomy ? array( 'id' => $term_id, 'taxonomy' => $term->taxonomy, 'get_custom_field' => false ) : array( 'get_custom_field' => false );
806
-
807
- $description = $this->generate_description( '', $description_args );
808
}
809
810
- /**
811
- * No longer uses is_checked. As it strict checks 1/0 strings.
812
- */
813
$noindex = (bool) $noindex;
814
$nofollow = (bool) $nofollow;
815
$noarchive = (bool) $noarchive;
@@ -830,6 +823,7 @@ class Doing_It_Right extends Generate_Ldjson {
830
*
831
* @since 2.6.0
832
* @since 2.9.0 Now also returns noindex value.
833
* @staticvar array $data
834
*
835
* @param array $args The post args.
@@ -849,14 +843,14 @@ class Doing_It_Right extends Generate_Ldjson {
849
$page_on_front = $this->is_static_frontpage( $post_id );
850
851
$title_custom_field = $this->get_custom_field( '_genesis_title', $post_id );
852
- $description_custom_field = $this->get_custom_field( '_genesis_description', $post_id );
853
$noindex = $this->get_custom_field( '_genesis_noindex', $post_id );
854
$nofollow = $this->get_custom_field( '_genesis_nofollow', $post_id );
855
$noarchive = $this->get_custom_field( '_genesis_noarchive', $post_id );
856
857
if ( $page_on_front ) {
858
$title_custom_field = $this->get_option( 'homepage_title' ) ?: $title_custom_field;
859
- $description_custom_field = $this->get_option( 'homepage_description' ) ?: $description_custom_field;
860
$noindex = $this->get_option( 'homepage_noindex' ) ?: $nofollow;
861
$nofollow = $this->get_option( 'homepage_nofollow' ) ?: $nofollow;
862
$noarchive = $this->get_option( 'homepage_noarchive' ) ?: $noarchive;
@@ -870,10 +864,11 @@ class Doing_It_Right extends Generate_Ldjson {
870
}
871
872
$description_is_from_custom_field = (bool) $description_custom_field;
873
if ( $description_is_from_custom_field ) {
874
- $description = $this->generate_description( '', array( 'id' => $post_id, 'get_custom_field' => true ) );
875
} else {
876
- $description = $this->generate_description( '', array( 'id' => $post_id, 'get_custom_field' => false ) );
877
}
878
879
$noindex = (bool) $noindex;
@@ -1435,10 +1430,10 @@ class Doing_It_Right extends Generate_Ldjson {
1435
$arc_notice = $archive_i18n . ' ' . sprintf( \esc_attr__( "Search Engines aren't allowed to archive this %s.", 'autodescription' ), $post_low );
1436
$arc_class = $unknown;
1437
$archived = false;
1438
- $arc_but = true;
1439
} else {
1440
$arc_notice = $archive_i18n . ' ' . sprintf( \esc_attr__( 'Search Engines are allowed to archive this %s.', 'autodescription' ), $post_low );
1441
$arc_class = $good;
1442
}
1443
1444
/**
@@ -1449,7 +1444,7 @@ class Doing_It_Right extends Generate_Ldjson {
1449
if ( $this->is_option_checked( 'site_noarchive' ) ) {
1450
$but_and = isset( $arc_but ) ? $and_i18n : $but_i18n;
1451
1452
- $arc_notice .= '<br>' . sprintf( \esc_attr__( "But you've discouraged archiving for the whole site.", 'autodescription' ), $but_and );
1453
$arc_class = $unknown;
1454
$arc_but = true;
1455
760
*
761
* @since 2.6.0
762
* @since 2.9.0 Now also returns noindex value.
763
+ * @since 3.0.6 Now considers custom field filters for the description.
764
* @staticvar array $data
765
*
766
* @param array $args The term args.
783
$data = $this->get_term_meta( $term_id );
784
785
$title_custom_field = isset( $data['doctitle'] ) ? $data['doctitle'] : '';
786
+ $description_custom_field = $this->get_description_from_custom_field( $term_id );
787
$noindex = isset( $data['noindex'] ) ? $data['noindex'] : '';
788
$nofollow = isset( $data['nofollow'] ) ? $data['nofollow'] : '';
789
$noarchive = isset( $data['noarchive'] ) ? $data['noarchive'] : '';
796
}
797
798
$description_is_from_custom_field = (bool) $description_custom_field;
799
+ //= Call sanitized version.
800
if ( $description_is_from_custom_field ) {
801
+ $description = $this->get_description_from_custom_field( $term_id );
802
} else {
803
+ $description = $this->get_generated_description( $term_id );
804
}
805
806
$noindex = (bool) $noindex;
807
$nofollow = (bool) $nofollow;
808
$noarchive = (bool) $noarchive;
823
*
824
* @since 2.6.0
825
* @since 2.9.0 Now also returns noindex value.
826
+ * @since 3.0.6 Now considers custom field filters for the description.
827
* @staticvar array $data
828
*
829
* @param array $args The post args.
843
$page_on_front = $this->is_static_frontpage( $post_id );
844
845
$title_custom_field = $this->get_custom_field( '_genesis_title', $post_id );
846
+ $description_custom_field = $this->get_description_from_custom_field( $post_id );
847
$noindex = $this->get_custom_field( '_genesis_noindex', $post_id );
848
$nofollow = $this->get_custom_field( '_genesis_nofollow', $post_id );
849
$noarchive = $this->get_custom_field( '_genesis_noarchive', $post_id );
850
851
if ( $page_on_front ) {
852
$title_custom_field = $this->get_option( 'homepage_title' ) ?: $title_custom_field;
853
+ // $description_custom_field = $description_custom_field; // We already got this.
854
$noindex = $this->get_option( 'homepage_noindex' ) ?: $nofollow;
855
$nofollow = $this->get_option( 'homepage_nofollow' ) ?: $nofollow;
856
$noarchive = $this->get_option( 'homepage_noarchive' ) ?: $noarchive;
864
}
865
866
$description_is_from_custom_field = (bool) $description_custom_field;
867
+ //= Call sanitized version.
868
if ( $description_is_from_custom_field ) {
869
+ $description = $this->get_description_from_custom_field( $post_id );
870
} else {
871
+ $description = $this->get_generated_description( $post_id );
872
}
873
874
$noindex = (bool) $noindex;
1430
$arc_notice = $archive_i18n . ' ' . sprintf( \esc_attr__( "Search Engines aren't allowed to archive this %s.", 'autodescription' ), $post_low );
1431
$arc_class = $unknown;
1432
$archived = false;
1433
} else {
1434
$arc_notice = $archive_i18n . ' ' . sprintf( \esc_attr__( 'Search Engines are allowed to archive this %s.', 'autodescription' ), $post_low );
1435
$arc_class = $good;
1436
+ $arc_but = true;
1437
}
1438
1439
/**
1444
if ( $this->is_option_checked( 'site_noarchive' ) ) {
1445
$but_and = isset( $arc_but ) ? $and_i18n : $but_i18n;
1446
1447
+ $arc_notice .= '<br>' . sprintf( \esc_attr__( "%s you've discouraged archiving for the whole site.", 'autodescription' ), $but_and );
1448
$arc_class = $unknown;
1449
$arc_but = true;
1450
inc/classes/generate-description.class.php CHANGED
@@ -39,15 +39,83 @@ class Generate_Description extends Generate {
39
parent::__construct();
40
}
41
42
/**
43
* Returns the Twitter meta description. Falls back to Open Graph description.
44
*
45
* @since 3.0.4
46
* @uses $this->get_open_graph_description()
47
*
48
- * @param int|null $id The post or term ID. Falls back to queried ID.
49
* @param bool $escape Whether to escape the description.
50
- * @return string Twitter Description.
51
*/
52
public function get_twitter_description( $id = null, $escape = true ) {
53
@@ -66,9 +134,9 @@ class Generate_Description extends Generate {
66
* @since 3.0.4
67
* @uses $this->get_generated_open_graph_description()
68
*
69
- * @param int|null $id The post or term ID. Falls back to queried ID.
70
* @param bool $escape Whether to escape the description.
71
- * @return string Open Graph Description.
72
*/
73
public function get_open_graph_description( $id = null, $escape = true ) {
74
@@ -81,15 +149,40 @@ class Generate_Description extends Generate {
81
return $escape ? $this->escape_description( $desc ) : $desc;
82
}
83
84
/**
85
* Returns the autogenerated open graph meta description. Falls back to meta description.
86
*
87
* @since 3.0.4
88
* @uses $this->get_generated_open_graph_description()
89
*
90
- * @param int|null $id The post or term ID. Falls back to queried ID.
91
* @param bool $escape Whether to escape the description.
92
- * @return string Autogenerated Twitter Description.
93
*/
94
public function get_generated_twitter_description( $id = null, $escape = true ) {
95
return $this->get_generated_open_graph_description( $id, $escape );
@@ -102,9 +195,9 @@ class Generate_Description extends Generate {
102
* @uses $this->generate_description()
103
* @staticvar array $cache
104
*
105
- * @param int|null $id The post or term ID. Falls back to queried ID.
106
* @param bool $escape Whether to escape the description.
107
- * @return string Autogenerated Open Graph Description.
108
*/
109
public function get_generated_open_graph_description( $id = null, $escape = true ) {
110
@@ -125,6 +218,9 @@ class Generate_Description extends Generate {
125
*
126
* @since 1.0.0
127
* @since 2.9.0 Added two filters.
128
*
129
* @param string $description The optional description to simply parse.
130
* @param array $args description args : {
@@ -154,6 +250,8 @@ class Generate_Description extends Generate {
154
* Filters the description from custom field, if any.
155
*
156
* @since 2.9.0
157
*
158
* @param string $description The description.
159
* @param array $args The description arguments.
@@ -198,6 +296,8 @@ class Generate_Description extends Generate {
198
* Parses and sanitizes description arguments.
199
*
200
* @since 2.5.0
201
*
202
* @param array $args required The passed arguments.
203
* @param array $defaults The default arguments.
@@ -229,6 +329,8 @@ class Generate_Description extends Generate {
229
*
230
* @since 2.5.0
231
* @since 3.0.4 Added escape parameter.
232
*
233
* @param array $defaults The description defaults.
234
* @param array $args The input args.
@@ -256,6 +358,8 @@ class Generate_Description extends Generate {
256
*
257
* @since 2.6.0
258
* @since 2.9.2 Now passes args to filter.
259
*
260
* @param array $args required The passed arguments.
261
* @return array $args parsed args.
@@ -283,6 +387,8 @@ class Generate_Description extends Generate {
283
* Creates description from custom fields.
284
*
285
* @since 2.4.1
286
*
287
* @param array $args description args : {
288
* @param int $id the term or page id.
@@ -323,7 +429,8 @@ class Generate_Description extends Generate {
323
* @since 2.6.0
324
* @since 2.9.0 1. Removed $args['taxonomy'] check.
325
* 2. Added $this->is_archive() check.
326
- * Use $this->description_from_custom_field() instead.
327
*
328
* @param array $args Description args.
329
* @return string The Description
@@ -342,7 +449,8 @@ class Generate_Description extends Generate {
342
* Fetches Singular Description from custom field.
343
*
344
* @since 2.6.0
345
- * Use $this->description_from_custom_field() instead.
346
*
347
* @param int $id The page ID.
348
* @return string The Description
@@ -362,7 +470,8 @@ class Generate_Description extends Generate {
362
* Fetch Archive Description from custom field.
363
*
364
* @since 2.6.0
365
- * Use $this->description_from_custom_field() instead.
366
*
367
* @param array $args
368
* @return string The Description
@@ -390,11 +499,13 @@ class Generate_Description extends Generate {
390
* @since 2.3.3
391
* @since 3.0.0 No longer checks for protected posts.
392
* Check is moved to $this->generate_the_description().
393
*
394
* @param array $args description args : {
395
* @param int $id the term or page id.
396
* @param string $taxonomy taxonomy name.
397
- * @param bool $is_home We're generating for the home page.
398
* @param bool $get_custom_field Do not fetch custom title when false.
399
* @param bool $social Generate Social Description when true.
400
* }
@@ -434,6 +545,8 @@ class Generate_Description extends Generate {
434
* @since 2.8.0 : The output is always trimmed if $escape is false.
435
* : The cache will no longer be maintained on previews or search.
436
* @since 3.0.0 : Now checks for protected posts.
437
*
438
* @param array $args description args : {
439
* @param int $id the term or page id.
@@ -639,6 +752,8 @@ class Generate_Description extends Generate {
639
* Generates the home page description.
640
*
641
* @since 2.6.0
642
*
643
* @param bool $custom_field whether to check the Custom Field.
644
* @param bool $escape Whether to escape the output.
@@ -686,7 +801,7 @@ class Generate_Description extends Generate {
686
* @since 2.6.0
687
* @since 2.7.0 Removed cache.
688
* Whether an excerpt is available is no longer part of this check.
689
- *
690
* @param int $id The current page or post ID.
691
* @param object|string $term The current Term.
692
* @return bool Whether to add description additions.
@@ -753,9 +868,12 @@ class Generate_Description extends Generate {
753
*
754
* @since 2.6.0
755
* @since 2.9.2 Added filter.
756
* @staticvar array $title string of titles.
757
* @staticvar string $on
758
* @access private
759
*
760
* @param int $id The post or term ID
761
* @param object|string $term The term object
@@ -773,8 +891,8 @@ class Generate_Description extends Generate {
773
774
if ( $ignore || $this->add_description_additions( $id, $term ) ) {
775
776
- if ( ! isset( $title[ $id ] ) ) {
777
- $title[ $id ] = $this->generate_description_title( $id, $term, $this->is_real_front_page() );
778
}
779
780
if ( $ignore || $this->is_option_checked( 'description_blogname' ) ) {
@@ -795,7 +913,7 @@ class Generate_Description extends Generate {
795
//* Already cached.
796
$sep = $this->get_description_separator();
797
} else {
798
- $title[ $id ] = '';
799
$on = '';
800
$blogname = '';
801
$sep = '';
@@ -814,7 +932,7 @@ class Generate_Description extends Generate {
814
*/
815
$data = \apply_filters_ref_array( 'the_seo_framework_generated_description_additions', array(
816
array(
817
- 'title' => $title[ $id ],
818
'on' => $on,
819
'blogname' => $blogname,
820
'sep' => $sep,
@@ -825,7 +943,7 @@ class Generate_Description extends Generate {
825
) );
826
} else {
827
$data = array(
828
- 'title' => $title[ $id ],
829
'on' => $on,
830
'blogname' => $blogname,
831
'sep' => $sep,
@@ -839,6 +957,8 @@ class Generate_Description extends Generate {
839
* Generates the Title for description.
840
*
841
* @since 2.5.2
842
*
843
* @param int $id The page ID.
844
* @param object|string $term The term object.
@@ -850,6 +970,8 @@ class Generate_Description extends Generate {
850
if ( '' === $id )
851
$id = $this->get_the_real_ID();
852
853
if ( $page_on_front || $this->is_front_page_by_id( $id ) ) :
854
$title = $this->get_home_page_tagline();
855
else :
@@ -894,7 +1016,7 @@ class Generate_Description extends Generate {
894
* @since 2.2.8
895
*/
896
/* translators: Front-end output. */
897
- $title = empty( $title ) ? $this->untitled() : trim( $title );
898
899
return $title;
900
}
39
parent::__construct();
40
}
41
42
+ /**
43
+ * Returns the meta description from custom fields. Falls back to autogenerated description.
44
+ *
45
+ * @since 3.0.6
46
+ * @uses $this->get_description_from_custom_field()
47
+ * @uses $this->get_generated_description()
48
+ *
49
+ * @param int|null $id The post or term ID. Falls back to queried ID if null.
50
+ * @param bool $escape Whether to escape the description.
51
+ * @return string The real description output.
52
+ */
53
+ public function get_description( $id = null, $escape = true ) {
54
+
55
+ if ( is_null( $id ) )
56
+ $id = $this->get_the_real_ID();
57
+
58
+ $desc = $this->get_description_from_custom_field( $id )
59
+ ?: $this->get_generated_description( $id, false );
60
+
61
+ return $escape ? $this->escape_description( $desc ) : $desc;
62
+ }
63
+
64
+ /**
65
+ * Returns the custom user-inputted description.
66
+ *
67
+ * @since 3.0.6
68
+ * @uses $this->get_generated_open_graph_description()
69
+ *
70
+ * @param int|null $id The post or term ID. Falls back to queried ID if null.
71
+ * @param bool $escape Whether to escape the description.
72
+ * @return string The custom field description.
73
+ */
74
+ public function get_description_from_custom_field( $id = null, $escape = true ) {
75
+
76
+ if ( is_null( $id ) )
77
+ $id = $this->get_the_real_ID();
78
+
79
+ $desc = '';
80
+
81
+ if ( $this->is_front_page_by_id( $id ) ) {
82
+ $desc = $this->get_option( 'homepage_description' );
83
+ }
84
+ if ( ! $desc ) {
85
+ if ( $this->is_singular( $id ) ) {
86
+ $desc = $this->get_custom_field( '_genesis_description', $id );
87
+ } elseif ( $id ) {
88
+ $data = $this->get_term_meta( $id );
89
+ $desc = ! empty( $data['description'] ) ? $data['description'] : '';
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Applies filters 'the_seo_framework_custom_field_description' : string
95
+ *
96
+ * Filters the description from custom field, if any.
97
+ *
98
+ * @since 2.9.0
99
+ * @since 3.0.6 1. Duplicated from $this->generate_description() (to be deprecated)
100
+ * 2. Removed all arguments but the 'id' argument.
101
+ *
102
+ * @param string $desc The description.
103
+ * @param array $args The description arguments.
104
+ */
105
+ $desc = (string) \apply_filters( 'the_seo_framework_custom_field_description', $desc, array( 'id' => $id ) );
106
+
107
+ return $escape ? $this->escape_description( $desc ) : $desc;
108
+ }
109
+
110
/**
111
* Returns the Twitter meta description. Falls back to Open Graph description.
112
*
113
* @since 3.0.4
114
* @uses $this->get_open_graph_description()
115
*
116
+ * @param int|null $id The post or term ID. Falls back to queried ID if null.
117
* @param bool $escape Whether to escape the description.
118
+ * @return string The real Twitter description output.
119
*/
120
public function get_twitter_description( $id = null, $escape = true ) {
121
134
* @since 3.0.4
135
* @uses $this->get_generated_open_graph_description()
136
*
137
+ * @param int|null $id The post or term ID. Falls back to queried ID if null.
138
* @param bool $escape Whether to escape the description.
139
+ * @return string The real Open Graph description output.
140
*/
141
public function get_open_graph_description( $id = null, $escape = true ) {
142
149
return $escape ? $this->escape_description( $desc ) : $desc;
150
}
151
152
+ /**
153
+ * Returns the autogenerated meta description.
154
+ *
155
+ * @since 3.0.6
156
+ * @uses $this->generate_description()
157
+ * @staticvar array $cache
158
+ *
159
+ * @param int|null $id The post or term ID. Falls back to queried ID if null.
160
+ * @param bool $escape Whether to escape the description.
161
+ * @return string The generated description output.
162
+ */
163
+ public function get_generated_description( $id = null, $escape = true ) {
164
+
165
+ if ( is_null( $id ) )
166
+ $id = $this->get_the_real_ID();
167
+
168
+ static $cache = array();
169
+
170
+ $desc = isset( $cache[ $id ] )
171
+ ? $cache[ $id ]
172
+ : $cache[ $id ] = $this->generate_description( '', array( 'id' => $id, 'social' => false, 'get_custom_field' => false, 'escape' => false ) );
173
+
174
+ return $escape ? $this->escape_description( $desc ) : $desc;
175
+ }
176
+
177
/**
178
* Returns the autogenerated open graph meta description. Falls back to meta description.
179
*
180
* @since 3.0.4
181
* @uses $this->get_generated_open_graph_description()
182
*
183
+ * @param int|null $id The post or term ID. Falls back to queried ID if null.
184
* @param bool $escape Whether to escape the description.
185
+ * @return string The generated Twitter description output.
186
*/
187
public function get_generated_twitter_description( $id = null, $escape = true ) {
188
return $this->get_generated_open_graph_description( $id, $escape );
195
* @uses $this->generate_description()
196
* @staticvar array $cache
197
*
198
+ * @param int|null $id The post or term ID. Falls back to queried ID if null.
199
* @param bool $escape Whether to escape the description.
200
+ * @return string The generated Open Graph description output.
201
*/
202
public function get_generated_open_graph_description( $id = null, $escape = true ) {
203
218
*
219
* @since 1.0.0
220
* @since 2.9.0 Added two filters.
221
+ * @since 3.0.6 Silently deprecated.
222
+ * @deprecated Use `get_description()` instead.
223
+ * @deprecated Use `get_generated_description()` instead.
224
*
225
* @param string $description The optional description to simply parse.
226
* @param array $args description args : {
250
* Filters the description from custom field, if any.
251
*
252
* @since 2.9.0
253
+ * NOTE: MOVED!!
254
+ * @see get_description_from_custom_field()
255
*
256
* @param string $description The description.
257
* @param array $args The description arguments.
296
* Parses and sanitizes description arguments.
297
*
298
* @since 2.5.0
299
+ * @since 3.0.6 Silently deprecated.
300
+ * @deprecated
301
*
302
* @param array $args required The passed arguments.
303
* @param array $defaults The default arguments.
329
*
330
* @since 2.5.0
331
* @since 3.0.4 Added escape parameter.
332
+ * @since 3.0.6 Silently deprecated.
333
+ * @deprecated
334
*
335
* @param array $defaults The description defaults.
336
* @param array $args The input args.
358
*
359
* @since 2.6.0
360
* @since 2.9.2 Now passes args to filter.
361
+ * @since 3.0.6 Silently deprecated.
362
+ * @deprecated
363
*
364
* @param array $args required The passed arguments.
365
* @return array $args parsed args.
387
* Creates description from custom fields.
388
*
389
* @since 2.4.1
390
+ * @since 3.0.6 Silently deprecated.
391
+ * @deprecated Use `get_description_from_custom_field()` instead.
392
*
393
* @param array $args description args : {
394
* @param int $id the term or page id.
429
* @since 2.6.0
430
* @since 2.9.0 1. Removed $args['taxonomy'] check.
431
* 2. Added $this->is_archive() check.
432
+ * @since 3.0.6 Silently deprecated.
433
+ * @deprecated Use `get_description_from_custom_field()` instead.
434
*
435
* @param array $args Description args.
436
* @return string The Description
449
* Fetches Singular Description from custom field.
450
*
451
* @since 2.6.0
452
+ * @since 3.0.6 Silently deprecated.
453
+ * @deprecated Use `get_description_from_custom_field()` instead.
454
*
455
* @param int $id The page ID.
456
* @return string The Description
470
* Fetch Archive Description from custom field.
471
*
472
* @since 2.6.0
473
+ * @since 3.0.6 Silently deprecated.
474
+ * @deprecated Use `get_description_from_custom_field()` instead.
475
*
476
* @param array $args
477
* @return string The Description
499
* @since 2.3.3
500
* @since 3.0.0 No longer checks for protected posts.
501
* Check is moved to $this->generate_the_description().
502
+ * @since 3.0.6 Silently deprecated.
503
+ * @deprecated Use `get_generated_description()` instead.
504
*
505
* @param array $args description args : {
506
* @param int $id the term or page id.
507
* @param string $taxonomy taxonomy name.
508
+ * @param bool $is_home Whether we're generating for the home page.
509
* @param bool $get_custom_field Do not fetch custom title when false.
510
* @param bool $social Generate Social Description when true.
511
* }
545
* @since 2.8.0 : The output is always trimmed if $escape is false.
546
* : The cache will no longer be maintained on previews or search.
547
* @since 3.0.0 : Now checks for protected posts.
548
+ * @since 3.0.6 Silently deprecated.
549
+ * @deprecated Use `get_generated_description()` instead.
550
*
551
* @param array $args description args : {
552
* @param int $id the term or page id.
752
* Generates the home page description.
753
*
754
* @since 2.6.0
755
+ * @since 3.0.6 Silently deprecated.
756
+ * @deprecated Use `generate_description()` in combination with `get_custom_field( '_genesis_description' )` instead.
757
*
758
* @param bool $custom_field whether to check the Custom Field.
759
* @param bool $escape Whether to escape the output.
801
* @since 2.6.0
802
* @since 2.7.0 Removed cache.
803
* Whether an excerpt is available is no longer part of this check.
804
+
805
* @param int $id The current page or post ID.
806
* @param object|string $term The current Term.
807
* @return bool Whether to add description additions.
868
*
869
* @since 2.6.0
870
* @since 2.9.2 Added filter.
871
+ * @since 3.0.6 The $ignore parameter is now considered in caching.
872
* @staticvar array $title string of titles.
873
* @staticvar string $on
874
* @access private
875
+ * @TODO deprecate and rewrite -- or completely remove.
876
+ * @see https://github.com/sybrew/the-seo-framework/issues/282
877
*
878
* @param int $id The post or term ID
879
* @param object|string $term The term object
891
892
if ( $ignore || $this->add_description_additions( $id, $term ) ) {
893
894
+ if ( ! isset( $title[ $id ][ $ignore ] ) ) {
895
+ $title[ $id ][ $ignore ] = $this->generate_description_title( $id, $term, $this->is_real_front_page() );
896
}
897
898
if ( $ignore || $this->is_option_checked( 'description_blogname' ) ) {
913
//* Already cached.
914
$sep = $this->get_description_separator();
915
} else {
916
+ $title[ $id ][ $ignore ] = '';
917
$on = '';
918
$blogname = '';
919
$sep = '';
932
*/
933
$data = \apply_filters_ref_array( 'the_seo_framework_generated_description_additions', array(
934
array(
935
+ 'title' => $title[ $id ][ $ignore ],
936
'on' => $on,
937
'blogname' => $blogname,
938
'sep' => $sep,
943
) );
944
} else {
945
$data = array(
946
+ 'title' => $title[ $id ][ $ignore ],
947
'on' => $on,
948
'blogname' => $blogname,
949
'sep' => $sep,
957
* Generates the Title for description.
958
*
959
* @since 2.5.2
960
+ * @since 3.0.6 Silently deprecated.
961
+ * @deprecated
962
*
963
* @param int $id The page ID.
964
* @param object|string $term The term object.
970
if ( '' === $id )
971
$id = $this->get_the_real_ID();
972
973
+ $title = '';
974
+
975
if ( $page_on_front || $this->is_front_page_by_id( $id ) ) :
976
$title = $this->get_home_page_tagline();
977
else :
1016
* @since 2.2.8
1017
*/
1018
/* translators: Front-end output. */
1019
+ $title = trim( $title ) ?: $this->untitled();
1020
1021
return $title;
1022
}
inc/classes/generate-image.class.php CHANGED
@@ -132,6 +132,7 @@ class Generate_Image extends Generate_Url {
132
* Returns social image URL and sets $this->image_dimensions.
133
*
134
* @since 2.9.0
135
*
136
* @todo listen to attached images within post.
137
* @todo listen to archive images.
@@ -166,11 +167,16 @@ class Generate_Image extends Generate_Url {
166
goto end;
167
}
168
169
- //* 3. Fetch image from featured.
170
if ( $all_allowed || false === in_array( 'featured', $args['disallowed'], true ) ) {
171
if ( $image = $this->get_social_image_url_from_post_thumbnail( $args['post_id'], $args, true ) )
172
goto end;
173
}
174
}
175
176
if ( $args['skip_fallback'] )
@@ -273,11 +279,16 @@ class Generate_Image extends Generate_Url {
273
* @param mixed $size The image size
274
* @param bool $icon Fetch Image icon
275
* @param bool 'skip_fallback' Whether to skip fallback images.
276
- * @param array $disallowed Disallowed image types : {
277
* array (
278
- * string 'featured'
279
- * string 'header'
280
- * string 'icon'
281
* )
282
* }
283
* @param bool 'escape' Whether to escape output.
@@ -481,6 +492,32 @@ class Generate_Image extends Generate_Url {
481
return $src;
482
}
483
484
/**
485
* Fetches images id's from WooCommerce gallery
486
*
132
* Returns social image URL and sets $this->image_dimensions.
133
*
134
* @since 2.9.0
135
+ * @since 3.0.6 Added attachment page compatibility.
136
*
137
* @todo listen to attached images within post.
138
* @todo listen to archive images.
167
goto end;
168
}
169
170
+ //* 3.a. Fetch image from featured.
171
if ( $all_allowed || false === in_array( 'featured', $args['disallowed'], true ) ) {
172
if ( $image = $this->get_social_image_url_from_post_thumbnail( $args['post_id'], $args, true ) )
173
goto end;
174
}
175
+ //* 3.b. Fetch image from attachment page.
176
+ if ( $all_allowed || false === in_array( 'attachment', $args['disallowed'], true ) ) {
177
+ if ( $image = $this->get_social_image_url_from_attachment( $args['post_id'], $args, true ) )
178
+ goto end;
179
+ }
180
}
181
182
if ( $args['skip_fallback'] )
279
* @param mixed $size The image size
280
* @param bool $icon Fetch Image icon
281
* @param bool 'skip_fallback' Whether to skip fallback images.
282
+ * @param array $disallowed Disallowed image types : Allowed values {
283
* array (
284
+ * 'homemeta',
285
+ * 'postmeta',
286
+ * 'featured',
287
+ * 'attachment',
288
+ * 'option',
289
+ * 'header',
290
+ * 'logo',
291
+ * 'icon',
292
* )
293
* }
294
* @param bool 'escape' Whether to escape output.
492
return $src;
493
}
494
495
+ /**
496
+ * Returns the social image URL from an attachment page.
497
+ *
498
+ * @since 3.0.6
499
+ *
500
+ * @param int $id The post ID. Required.
501
+ * @param array $args The image args.
502
+ * @param bool $set_og_dimensions Whether to set Open Graph image dimensions.
503
+ * @return string The attachment URL.
504
+ */
505
+ public function get_social_image_url_from_attachment( $id, $args = array(), $set_og_dimensions = false ) {
506
+
507
+ if ( ! \wp_attachment_is_image( $id ) )
508
+ return '';
509
+
510
+ $args = $this->reparse_image_args( $args );
511
+ $args['get_the_real_ID'] = true;
512
+
513
+ $src = $this->parse_og_image( $id, $args, $set_og_dimensions );
514
+
515
+ if ( $src && $this->matches_this_domain( $src ) )
516
+ $src = $this->set_preferred_url_scheme( $src );
517
+
518
+ return $src;
519
+ }
520
+
521
/**
522
* Fetches images id's from WooCommerce gallery
523
*
inc/classes/generate.class.php CHANGED
@@ -395,7 +395,7 @@ class Generate extends User_Data {
395
if ( isset( $cache ) )
396
return $cache;
397
398
- if ( ! $this->description_from_cache( true ) ) {
399
$retval = array();
400
} elseif ( ! $this->title_from_cache( '', '', '', true ) ) {
401
$retval = array();
395
if ( isset( $cache ) )
396
return $cache;
397
398
+ if ( ! $this->get_twitter_description() ) {
399
$retval = array();
400
} elseif ( ! $this->title_from_cache( '', '', '', true ) ) {
401
$retval = array();
inc/classes/init.class.php CHANGED
@@ -181,6 +181,7 @@ class Init extends Query {
181
182
//* Save post data.
183
\add_action( 'save_post', array( $this, 'inpost_seo_save' ), 1, 2 );
184
\add_action( 'save_post', array( $this, '_save_inpost_primary_term' ), 1, 2 );
185
186
//* Enqueues admin scripts.
@@ -557,8 +558,6 @@ class Init extends Query {
557
return;
558
}
559
560
- $allow_external = $this->allow_external_redirect();
561
-
562
/**
563
* Applies filters 'the_seo_framework_redirect_status_code' : Absolute integer.
564
*
@@ -571,7 +570,7 @@ class Init extends Query {
571
if ( $redirect_type > 399 || $redirect_type < 300 )
572
$this->_doing_it_wrong( __METHOD__, 'You should use 3xx HTTP Status Codes. Recommended 301 and 302.', '2.8.0' );
573
574
- if ( false === $allow_external ) {
575
//= Only HTTP/HTTPS and home URLs are allowed.
576
$path = $this->set_url_scheme( $url, 'relative' );
577
$url = \trailingslashit( $this->get_home_host() ) . ltrim( $path, ' /' );
@@ -625,7 +624,7 @@ class Init extends Query {
625
626
if ( $this->is_subdirectory_installation() || $home_path ) {
627
$output .= '# This is an invalid robots.txt location.' . "\r\n";
628
- $output .= '# Please visit: ' . \esc_url( trailingslashit( $this->set_preferred_url_scheme( $this->get_home_host() ) ) . 'robots.txt' ) . "\r\n";
629
$output .= "\r\n";
630
}
631
181
182
//* Save post data.
183
\add_action( 'save_post', array( $this, 'inpost_seo_save' ), 1, 2 );
184
+ \add_action( 'edit_attachment', array( $this, 'inattachment_seo_save' ), 1 );
185
\add_action( 'save_post', array( $this, '_save_inpost_primary_term' ), 1, 2 );
186
187
//* Enqueues admin scripts.
558
return;
559
}
560
561
/**
562
* Applies filters 'the_seo_framework_redirect_status_code' : Absolute integer.
563
*
570
if ( $redirect_type > 399 || $redirect_type < 300 )
571
$this->_doing_it_wrong( __METHOD__, 'You should use 3xx HTTP Status Codes. Recommended 301 and 302.', '2.8.0' );
572
573
+ if ( ! $this->allow_external_redirect() ) {
574
//= Only HTTP/HTTPS and home URLs are allowed.
575
$path = $this->set_url_scheme( $url, 'relative' );
576
$url = \trailingslashit( $this->get_home_host() ) . ltrim( $path, ' /' );
624
625
if ( $this->is_subdirectory_installation() || $home_path ) {
626
$output .= '# This is an invalid robots.txt location.' . "\r\n";
627
+ $output .= '# Please visit: ' . \esc_url( \trailingslashit( $this->set_preferred_url_scheme( $this->get_home_host() ) ) . 'robots.txt' ) . "\r\n";
628
$output .= "\r\n";
629
}
630
inc/classes/inpost.class.php CHANGED
@@ -457,11 +457,12 @@ class Inpost extends Profile {
457
'get_custom_field' => false,
458
);
459
460
- $generated_description_args = array(
461
- 'id' => $post_id,
462
- 'is_home' => true,
463
- 'get_custom_field' => true,
464
- );
465
} elseif ( $this->is_blog_page( $post_id ) ) {
466
//* Page for posts.
467
$generated_doctitle_args = array(
@@ -469,24 +470,16 @@ class Inpost extends Profile {
469
'meta' => true,
470
'get_custom_field' => false,
471
);
472
-
473
- $generated_description_args = array(
474
- 'id' => $post_id,
475
- 'page_for_posts' => true,
476
- );
477
} else {
478
$generated_doctitle_args = array(
479
'placeholder' => true,
480
'meta' => true,
481
'get_custom_field' => false,
482
);
483
-
484
- $generated_description_args = array(
485
- 'id' => $post_id,
486
- );
487
}
488
$generated_doctitle = $this->title( '', '', '', $generated_doctitle_args );
489
- $generated_description = $this->generate_description( '', $generated_description_args );
490
491
/**
492
* Start Title vars
@@ -523,30 +516,6 @@ class Inpost extends Profile {
523
}
524
}
525
526
- /**
527
- * Start Description vars
528
- */
529
-
530
- //* Fetch description from option.
531
- $description = $this->get_custom_field( '_genesis_description' );
532
-
533
- /**
534
- * Calculate current description length
535
- *
536
- * Reworked.
537
- * @since 2.3.4
538
- */
539
- if ( $is_static_frontpage ) {
540
- //* The homepage description takes precedence.
541
- if ( $description ) {
542
- $desc_len_pre = $this->get_option( 'homepage_description' ) ?: $description;
543
- } else {
544
- $desc_len_pre = $this->get_option( 'homepage_description' ) ?: $generated_description;
545
- }
546
- } else {
547
- $desc_len_pre = $description ?: $generated_description;
548
- }
549
-
550
/**
551
* Convert to what Google outputs.
552
*
@@ -554,7 +523,7 @@ class Inpost extends Profile {
554
* @since 2.3.4
555
*/
556
$tit_len_parsed = html_entity_decode( $tit_len_pre );
557
- $desc_len_parsed = html_entity_decode( $desc_len_pre );
558
559
/**
560
* Generate static placeholder for when title or description is emptied
457
'get_custom_field' => false,
458
);
459
460
+ $_home_desc_from_option = $this->get_option( 'homepage_description' );
461
+ if ( $_home_desc_from_option ) {
462
+ $generated_description = $this->escape_description( $_home_desc_from_option );
463
+ } else {
464
+ $generated_description = $this->get_generated_description( $post_id );
465
+ }
466
} elseif ( $this->is_blog_page( $post_id ) ) {
467
//* Page for posts.
468
$generated_doctitle_args = array(
470
'meta' => true,
471
'get_custom_field' => false,
472
);
473
+ $generated_description = $this->get_generated_description( $post_id );
474
} else {
475
$generated_doctitle_args = array(
476
'placeholder' => true,
477
'meta' => true,
478
'get_custom_field' => false,
479
);
480
+ $generated_description = $this->get_generated_description( $post_id );
481
}
482
$generated_doctitle = $this->title( '', '', '', $generated_doctitle_args );
483
484
/**
485
* Start Title vars
516
}
517
}
518
519
/**
520
* Convert to what Google outputs.
521
*
523
* @since 2.3.4
524
*/
525
$tit_len_parsed = html_entity_decode( $tit_len_pre );
526
+ $desc_len_parsed = html_entity_decode( $this->get_description( $post_id ) );
527
528
/**
529
* Generate static placeholder for when title or description is emptied
inc/classes/load.class.php CHANGED
@@ -58,11 +58,8 @@ final class Load extends Feed implements Debug_Interface {
58
59
static $count = 0;
60
61
- if ( $count > 0 ) {
62
return null;
63
- }
64
-
65
- $count++;
66
67
//* Setup debug vars before initializing parents.
68
$this->init_debug_vars();
58
59
static $count = 0;
60
61
+ if ( $count++ )
62
return null;
63
64
//* Setup debug vars before initializing parents.
65
$this->init_debug_vars();
inc/classes/post-data.class.php CHANGED
@@ -79,7 +79,23 @@ class Post_Data extends Detect {
79
}
80
81
/**
82
- * Save the SEO settings when we save a post or page.
83
* Some values get sanitized, the rest are pulled from identically named subkeys in the $_POST['autodescription'] array.
84
*
85
* @since 2.0.0
@@ -142,7 +158,7 @@ class Post_Data extends Detect {
142
* Also, they will only cause bugs.
143
* Query parameters are also only used when no pretty permalinks are used. Which is bad.
144
*/
145
- $data[ $key ] = $this->s_url( $value );
146
continue 2;
147
148
case '_social_image_id' :
79
}
80
81
/**
82
+ * Saves the SEO settings when we save an attachment.
83
+ *
84
+ * This is a passthrough method for `inpost_seo_save()`.
85
+ * Sanity check is handled at `save_custom_fields()`, which `inpost_seo_save()` uses.
86
+ *
87
+ * @since 3.0.6
88
+ * @uses $this->inpost_seo_save()
89
+ *
90
+ * @param integer $post_id Post ID.
91
+ * @return void
92
+ */
93
+ public function inattachment_seo_save( $post_id ) {
94
+ $this->inpost_seo_save( $post_id, \get_post( $post_id ) );
95
+ }
96
+
97
+ /**
98
+ * Saves the SEO settings when we save a post or page.
99
* Some values get sanitized, the rest are pulled from identically named subkeys in the $_POST['autodescription'] array.
100
*
101
* @since 2.0.0
158
* Also, they will only cause bugs.
159
* Query parameters are also only used when no pretty permalinks are used. Which is bad.
160
*/
161
+ $data[ $key ] = $this->s_url_query( $value );
162
continue 2;
163
164
case '_social_image_id' :
inc/classes/render.class.php CHANGED
@@ -101,6 +101,8 @@ class Render extends Admin_Init {
101
* Must be called inside the loop
102
*
103
* @since 2.2.2
104
* @staticvar array $description_cache
105
*
106
* @return string The description
@@ -203,7 +205,8 @@ class Render extends Admin_Init {
203
* Renders the description meta tag.
204
*
205
* @since 1.3.0
206
- * @uses $this->description_from_cache()
207
* @uses $this->detect_seo_plugins()
208
*
209
* @return string The description meta tag.
@@ -218,7 +221,7 @@ class Render extends Admin_Init {
218
* @since 2.3.0
219
* @since 2.7.0 : Added output within filter.
220
*/
221
- $description = (string) \apply_filters( 'the_seo_framework_description_output', $this->description_from_cache(), $this->get_the_real_ID() );
222
223
if ( $description )
224
return '<meta name="description" content="' . \esc_attr( $description ) . '" />' . "\r\n";
101
* Must be called inside the loop
102
*
103
* @since 2.2.2
104
+ * @deprecated
105
+ * @since 3.0.6 Silently deprecated.
106
* @staticvar array $description_cache
107
*
108
* @return string The description
205
* Renders the description meta tag.
206
*
207
* @since 1.3.0
208
+ * @since 3.0.6 No longer uses $this->description_from_cache()
209
+ * @uses $this->get_description()
210
* @uses $this->detect_seo_plugins()
211
*
212
* @return string The description meta tag.
221
* @since 2.3.0
222
* @since 2.7.0 : Added output within filter.
223
*/
224
+ $description = (string) \apply_filters( 'the_seo_framework_description_output', $this->get_description(), $this->get_the_real_ID() );
225
226
if ( $description )
227
return '<meta name="description" content="' . \esc_attr( $description ) . '" />' . "\r\n";
inc/classes/sanitize.class.php CHANGED
@@ -82,6 +82,7 @@ class Sanitize extends Admin_Pages {
82
* Handles settings field update POST actions.
83
*
84
* @since 2.8.0
85
*
86
* @return void Early if nonce failed.
87
*/
@@ -101,6 +102,19 @@ class Sanitize extends Admin_Pages {
101
//* Flush transients after options have changed.
102
\add_action( "update_option_{$this->settings_field}", array( $this, 'delete_main_cache' ) );
103
\add_action( "update_option_{$this->settings_field}", array( $this, 'reinitialize_rewrite' ), 11 );
104
}
105
106
/**
@@ -1014,7 +1028,7 @@ class Sanitize extends Admin_Pages {
1014
}
1015
1016
/**
1017
- * Makes URLs safe.
1018
*
1019
* @since 2.2.2
1020
* @since 2.8.0 Method is now public.
@@ -1035,7 +1049,7 @@ class Sanitize extends Admin_Pages {
1035
}
1036
1037
/**
1038
- * Makes URLs safe and removes query args.
1039
*
1040
* @since 2.2.8
1041
* @since 2.8.0 Method is now public.
@@ -1105,10 +1119,10 @@ class Sanitize extends Admin_Pages {
1105
*
1106
* @since 2.2.2
1107
* @since 2.8.0 Method is now public.
1108
- * @since 3.0.0 Now removed '@' from the URL path.
1109
*
1110
- * @param string $new_value String with potentially wrong Twitter username.
1111
- * @return string String with 'correct' Twitter username
1112
*/
1113
public function s_facebook_profile( $new_value ) {
1114
@@ -1120,7 +1134,21 @@ class Sanitize extends Admin_Pages {
1120
$link = 'https://www.facebook.com/' . $this->s_relative_url( $link );
1121
$link = rtrim( $link, ' /' );
1122
1123
- return $this->s_url( $link );
1124
}
1125
1126
/**
@@ -1172,6 +1200,7 @@ class Sanitize extends Admin_Pages {
1172
*
1173
* @since 2.2.4
1174
* @since 2.8.0 Method is now public.
1175
*
1176
* @param string $new_value String with potentially unwanted redirect URL.
1177
* @return string The Sanitized Redirect URL
@@ -1182,24 +1211,22 @@ class Sanitize extends Admin_Pages {
1182
1183
if ( $url ) :
1184
1185
- $allow_external = $this->allow_external_redirect();
1186
-
1187
/**
1188
* Sanitize the redirect URL to only a relative link and removes first slash
1189
* @requires WP 4.1.0 and up to prevent adding upon itself.
1190
*/
1191
- if ( ! $allow_external )
1192
$url = $this->s_relative_url( $url );
1193
1194
//* URL pattern excluding path.
1195
- $pattern = '/'
1196
- . '((((http)(s)?)?)\:)?' // 1: maybe http: https:
1197
- . '(\/\/)?' // 2: maybe slash slash
1198
- . '((www.)?)' // 3: maybe www.
1199
- . '(.*\.[a-zA-Z0-9]*)' // 4: any legal domain with tld
1200
- . '(?:\/)?' // 5: trailing slash
1201
- . '/'
1202
- ;
1203
1204
//* If link is relative, make it full again
1205
if ( ! preg_match( $pattern, $url ) ) {
@@ -1215,11 +1242,11 @@ class Sanitize extends Admin_Pages {
1215
* @param array : { 'url' => The full URL built from $path, 'scheme' => The preferred scheme }
1216
* @param string $path the URL path.
1217
*/
1218
- $filter = (array) \apply_filters( 'the_seo_framework_sanitize_redirect_args', array(), $path );
1219
1220
- if ( $filter ) {
1221
- $url = $filter['url'];
1222
- $scheme = $filter['scheme'];
1223
} else {
1224
$url = \trailingslashit( $this->get_homepage_permalink() ) . ltrim( $path, ' /' );
1225
$scheme = $this->is_ssl() ? 'https' : 'http';
@@ -1236,14 +1263,15 @@ class Sanitize extends Admin_Pages {
1236
* Applies filters 'the_seo_framework_301_noqueries'
1237
*
1238
* @since 2.5.0
1239
* @param bool $noqueries
1240
*/
1241
- $noqueries = (bool) \apply_filters( 'the_seo_framework_301_noqueries', true );
1242
1243
/**
1244
* Remove queries from the URL
1245
*
1246
- * Returns plain Home URL if $allow_external is set to false and only a query has been supplied
1247
* But that's okay. The URL was rogue anyway :)
1248
*/
1249
if ( $noqueries ) {
@@ -1258,7 +1286,7 @@ class Sanitize extends Admin_Pages {
1258
/**
1259
* Allow query string parameters. XSS safe.
1260
*/
1261
- $new_value = \esc_url_raw( $url );
1262
}
1263
1264
//* Save url
82
* Handles settings field update POST actions.
83
*
84
* @since 2.8.0
85
+ * @since 3.0.6 Now updates db version, too.
86
*
87
* @return void Early if nonce failed.
88
*/
102
//* Flush transients after options have changed.
103
\add_action( "update_option_{$this->settings_field}", array( $this, 'delete_main_cache' ) );
104
\add_action( "update_option_{$this->settings_field}", array( $this, 'reinitialize_rewrite' ), 11 );
105
+ \add_action( "update_option_{$this->settings_field}", array( $this, 'update_db_version' ), 12 );
106
+ }
107
+
108
+ /**
109
+ * Updates the database version to the defined one.
110
+ *
111
+ * This prevents errors when users go back to an earlier version, where options
112
+ * might be different from a future one.
113
+ *
114
+ * @since 3.0.6
115
+ */
116
+ public function update_db_version() {
117
+ \update_option( 'the_seo_framework_upgraded_db_version', THE_SEO_FRAMEWORK_DB_VERSION );
118
}
119
120
/**
1028
}
1029
1030
/**
1031
+ * Makes URLs safe and removes query args.
1032
*
1033
* @since 2.2.2
1034
* @since 2.8.0 Method is now public.
1049
}
1050
1051
/**
1052
+ * Makes URLs safe, maintaining queries.
1053
*
1054
* @since 2.2.8
1055
* @since 2.8.0 Method is now public.
1119
*
1120
* @since 2.2.2
1121
* @since 2.8.0 Method is now public.
1122
+ * @since 3.0.6 Now allows a sole query argument when profile.php is used.
1123
*
1124
+ * @param string $new_value String with potentially wrong Facebook profile URL.
1125
+ * @return string String with 'correct' Facebook profile URL.
1126
*/
1127
public function s_facebook_profile( $new_value ) {
1128
1134
$link = 'https://www.facebook.com/' . $this->s_relative_url( $link );
1135
$link = rtrim( $link, ' /' );
1136
1137
+ if ( strpos( $link, 'profile.php' ) ) {
1138
+ //= Gets query parameters.
1139
+ $q = strtok( substr( $link, strpos( $link, '?' ) ), '?' );
1140
+ parse_str( $q, $r );
1141
+ if ( isset( $r['id'] ) ) {
1142
+ $link = 'https://www.facebook.com/profile.php?id=' . \absint( $r['id'] );
1143
+ $link = $this->s_url_query( $link );
1144
+ } else {
1145
+ $link = '';
1146
+ }
1147
+ } else {
1148
+ $link = $this->s_url( $link );
1149
+ }
1150
+
1151
+ return $link;
1152
}
1153
1154
/**
1200
*
1201
* @since 2.2.4
1202
* @since 2.8.0 Method is now public.
1203
+ * @since 3.0.6 Noqueries is now disabled by default.
1204
*
1205
* @param string $new_value String with potentially unwanted redirect URL.
1206
* @return string The Sanitized Redirect URL
1211
1212
if ( $url ) :
1213
1214
/**
1215
* Sanitize the redirect URL to only a relative link and removes first slash
1216
* @requires WP 4.1.0 and up to prevent adding upon itself.
1217
*/
1218
+ if ( ! $this->allow_external_redirect() )
1219
$url = $this->s_relative_url( $url );
1220
1221
//* URL pattern excluding path.
1222
+ $pattern = '/'
1223
+ . '((((http)(s)?)?)\:)?' // 1: maybe http: https:
1224
+ . '(\/\/)?' // 2: maybe slash slash
1225
+ . '((www.)?)' // 3: maybe www.
1226
+ . '(.*\.[a-zA-Z0-9]*)' // 4: any legal domain with tld
1227
+ . '(?:\/)?' // 5: maybe trailing slash
1228
+ . '/'
1229
+ ;
1230
1231
//* If link is relative, make it full again
1232
if ( ! preg_match( $pattern, $url ) ) {
1242
* @param array : { 'url' => The full URL built from $path, 'scheme' => The preferred scheme }
1243
* @param string $path the URL path.
1244
*/
1245
+ $custom_sanitize = (array) \apply_filters( 'the_seo_framework_sanitize_redirect_args', array(), $path );
1246
1247
+ if ( $custom_sanitize ) {
1248
+ $url = $custom_sanitize['url'];
1249
+ $scheme = $custom_sanitize['scheme'];
1250
} else {
1251
$url = \trailingslashit( $this->get_homepage_permalink() ) . ltrim( $path, ' /' );
1252
$scheme = $this->is_ssl() ? 'https' : 'http';
1263
* Applies filters 'the_seo_framework_301_noqueries'
1264
*
1265
* @since 2.5.0
1266
+ * @since 3.0.6 Now false by default.
1267
* @param bool $noqueries
1268
*/
1269
+ $noqueries = (bool) \apply_filters( 'the_seo_framework_301_noqueries', false );
1270
1271
/**
1272
* Remove queries from the URL
1273
*
1274
+ * Returns plain Home URL if $this->allow_external_redirect() is set to false and only a query has been supplied
1275
* But that's okay. The URL was rogue anyway :)
1276
*/
1277
if ( $noqueries ) {
1286
/**
1287
* Allow query string parameters. XSS safe.
1288
*/
1289
+ $new_value = $this->s_url_query( $url );
1290
}
1291
1292
//* Save url
inc/classes/sitemaps.class.php CHANGED
@@ -236,7 +236,6 @@ class Sitemaps extends Metaboxes {
236
}
237
238
$this->the_seo_framework_debug and $freed_memory = $memory - memory_get_usage();
239
-
240
}
241
242
/**
@@ -513,6 +512,7 @@ class Sitemaps extends Metaboxes {
513
* Create sitemap.xml content transient.
514
*
515
* @since 2.6.0
516
*
517
* @param string|bool $content required The sitemap transient content.
518
* @return string The sitemap content.
@@ -529,7 +529,8 @@ class Sitemaps extends Metaboxes {
529
*/
530
$expiration = WEEK_IN_SECONDS;
531
532
- $this->set_transient( $this->sitemap_transient, $sitemap_content, $expiration );
533
}
534
535
return $sitemap_content;
@@ -608,7 +609,7 @@ class Sitemaps extends Metaboxes {
608
'has_password' => false,
609
'fields' => 'ids',
610
'cache_results' => false,
611
- 'suppress_filters' => true,
612
'no_found_rows' => true,
613
);
614
@@ -616,6 +617,7 @@ class Sitemaps extends Metaboxes {
616
* Applies filters 'the_seo_framework_sitemap_pages_query_args' : array
617
*
618
* @since 2.8.0
619
*
620
* @param array $args The new query arguments.
621
* @param array $defaults The default query arguments
@@ -633,7 +635,7 @@ class Sitemaps extends Metaboxes {
633
$page_on_front_id = (int) \get_option( 'page_on_front' );
634
$page_for_posts_id = (int) \get_option( 'page_for_posts' );
635
636
- $id_on_front = $page_on_front ? $page_on_front_id : (int) $page_for_posts_id;
637
638
//* Remove ID on front from list and add frontpage to list.
639
if ( $page_on_front && false !== $key_on_front = array_search( $id_on_front, $latest_pages, true ) ) {
@@ -780,7 +782,7 @@ class Sitemaps extends Metaboxes {
780
'has_password' => false,
781
'fields' => 'ids',
782
'cache_results' => false,
783
- 'suppress_filters' => true,
784
'no_found_rows' => true,
785
);
786
@@ -788,6 +790,7 @@ class Sitemaps extends Metaboxes {
788
* Applies filters 'the_seo_framework_sitemap_posts_query_args' : array
789
*
790
* @since 2.8.0
791
*
792
* @param array $args The new query arguments.
793
* @param array $defaults The default query arguments
@@ -894,7 +897,7 @@ class Sitemaps extends Metaboxes {
894
'has_password' => false,
895
'fields' => 'ids',
896
'cache_results' => false,
897
- 'suppress_filters' => true,
898
'no_found_rows' => true,
899
);
900
@@ -902,6 +905,7 @@ class Sitemaps extends Metaboxes {
902
* Applies filters 'the_seo_framework_sitemap_cpt_query_args' : array
903
*
904
* @since 2.8.0
905
*
906
* @param array $args The new query arguments.
907
* @param array $defaults The default query arguments
@@ -1040,6 +1044,7 @@ class Sitemaps extends Metaboxes {
1040
* The URL also isn't checked, nor the position.
1041
*
1042
* @since 3.0.4
1043
*
1044
* @param int $id The post ID to check. When 0, the custom field will not be checked.
1045
* @return bool True if included, false otherwise.
@@ -1049,7 +1054,7 @@ class Sitemaps extends Metaboxes {
1049
static $excluded = null;
1050
if ( null === $excluded ) {
1051
/**
1052
- * Applies filters the_seo_framework_sitemap_exclude_ids : array of id's
1053
*
1054
* @since 2.5.2
1055
* @since 2.8.0 : No longer accepts '0' as entry.
@@ -1063,8 +1068,7 @@ class Sitemaps extends Metaboxes {
1063
}
1064
}
1065
1066
- $included = empty( $excluded[ $id ] );
1067
- if ( $included && $id ) {
1068
$included = ! $this->get_custom_field( '_genesis_noindex', $id );
1069
}
1070
236
}
237
238
$this->the_seo_framework_debug and $freed_memory = $memory - memory_get_usage();
239
}
240
241
/**
512
* Create sitemap.xml content transient.
513
*
514
* @since 2.6.0
515
+ * @since 3.0.6 Now only sets transient when the option is checked.
516
*
517
* @param string|bool $content required The sitemap transient content.
518
* @return string The sitemap content.
529
*/
530
$expiration = WEEK_IN_SECONDS;
531
532
+ if ( $this->is_option_checked( 'cache_sitemap' ) )
533
+ $this->set_transient( $this->sitemap_transient, $sitemap_content, $expiration );
534
}
535
536
return $sitemap_content;
609
'has_password' => false,
610
'fields' => 'ids',
611
'cache_results' => false,
612
+ 'suppress_filters' => false,
613
'no_found_rows' => true,
614
);
615
617
* Applies filters 'the_seo_framework_sitemap_pages_query_args' : array
618
*
619
* @since 2.8.0
620
+ * @since 3.0.6: $args['suppress_filters'] now defaults to false.
621
*
622
* @param array $args The new query arguments.
623
* @param array $defaults The default query arguments
635
$page_on_front_id = (int) \get_option( 'page_on_front' );
636
$page_for_posts_id = (int) \get_option( 'page_for_posts' );
637
638
+ $id_on_front = $page_on_front ? $page_on_front_id : $page_for_posts_id;
639
640
//* Remove ID on front from list and add frontpage to list.
641
if ( $page_on_front && false !== $key_on_front = array_search( $id_on_front, $latest_pages, true ) ) {
782
'has_password' => false,
783
'fields' => 'ids',
784
'cache_results' => false,
785
+ 'suppress_filters' => false,
786
'no_found_rows' => true,
787
);
788
790
* Applies filters 'the_seo_framework_sitemap_posts_query_args' : array
791
*
792
* @since 2.8.0
793
+ * @since 3.0.6: $args['suppress_filters'] now defaults to false.
794
*
795
* @param array $args The new query arguments.
796
* @param array $defaults The default query arguments
897
'has_password' => false,
898
'fields' => 'ids',
899
'cache_results' => false,
900
+ 'suppress_filters' => false,
901
'no_found_rows' => true,
902
);
903
905
* Applies filters 'the_seo_framework_sitemap_cpt_query_args' : array
906
*
907
* @since 2.8.0
908
+ * @since 3.0.6: $args['suppress_filters'] now defaults to false.
909
*
910
* @param array $args The new query arguments.
911
* @param array $defaults The default query arguments
1044
* The URL also isn't checked, nor the position.
1045
*
1046
* @since 3.0.4
1047
+ * @since 3.1.0 : First filter value now works as intended.
1048
*
1049
* @param int $id The post ID to check. When 0, the custom field will not be checked.
1050
* @return bool True if included, false otherwise.
1054
static $excluded = null;
1055
if ( null === $excluded ) {
1056
/**
1057
+ * Applies filters the_seo_framework_sitemap_exclude_ids : sequential array of id's
1058
*
1059
* @since 2.5.2
1060
* @since 2.8.0 : No longer accepts '0' as entry.
1068
}
1069
}
1070
1071
+ if ( ! isset( $excluded[ $id ] ) && $id ) {
1072
$included = ! $this->get_custom_field( '_genesis_noindex', $id );
1073
}
1074
inc/functions/optionsapi.php CHANGED
@@ -178,6 +178,8 @@ function the_seo_framework_title_from_cache( $title = null ) {
178
* Fetch description from cache. Only works within Loop.
179
*
180
* @since 2.4.2
181
*
182
* @param bool $social Fetch social description.
183
* @return string|null The current page description.
178
* Fetch description from cache. Only works within Loop.
179
*
180
* @since 2.4.2
181
+ * @deprecated
182
+ * @since 3.0.6 Silently deprecated.
183
*
184
* @param bool $social Fetch social description.
185
* @return string|null The current page description.
inc/functions/tsfem-suggestion.php ADDED
@@ -0,0 +1,197 @@
1
+ <?php
2
+ /**
3
+ * The SEO Framework plugin
4
+ * Copyright (C) 2018 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License version 3 as published
8
+ * by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ defined( 'THE_SEO_FRAMEWORK_PLUGIN_BASENAME' ) or die;
20
+
21
+ /**
22
+ * This file holds functions for installing TSFEM.
23
+ * This file will only be called ONCE on plugin install, or upgrade from pre-v3.0.6.
24
+ *
25
+ * @since 3.0.6
26
+ * @access private
27
+ */
28
+
29
+ /**
30
+ * Prepares a "look at TSFEM" notification to ALL applicable plugin users on upgrade;
31
+ * when:
32
+ * 0. The upgrade happens when an applicable user is on the admin pages. (always true w/ default actions)
33
+ * 1. The constant 'TSF_DISABLE_SUGGESTIONS' is not defined or false.
34
+ * 2. The current dashboard is the main site's.
35
+ * 3. The applicable user can install plugins.
36
+ * 4. TSFEM isn't already installed.
37
+ * 5. PHP and WP requirements of TSFEM are met.
38
+ * This notice is automatically dismissed, and can be ignored without reappearing.
39
+ *
40
+ * @since 3.0.6
41
+ * @access private
42
+ * @uses the_seo_framework_add_upgrade_notice();
43
+ */
44
+ function the_seo_framework_load_extension_manager_suggestion() {
45
+
46
+ //? 1
47
+ if ( defined( 'TSF_DISABLE_SUGGESTIONS' ) && TSF_DISABLE_SUGGESTIONS ) return;
48
+ //? 2
49
+ if ( ! is_main_site() ) return;
50
+ //? 3
51
+ if ( ! current_user_can( 'install_plugins' ) ) return;
52
+ //? 4a
53
+ if ( defined( 'TSF_EXTENSION_MANAGER_VERSION' ) ) return;
54
+ //= PHP<5.5 can't write in empty()
55
+ $plugin = get_plugins( '/the-seo-framework-extension-manager' );
56
+ //? 4b
57
+ if ( ! empty( $plugin ) ) return;
58
+
59
+ /** @source https://github.com/sybrew/The-SEO-Framework-Extension-Manager/blob/34674828a9e79bf72584e23aaa4a82ea1f154229/bootstrap/envtest.php#L51-L62 */
60
+ $_req = array(
61
+ 'php' => array(
62
+ '5.5' => 50521,
63
+ '5.6' => 50605,
64
+ ),
65
+ 'wp' => '37965',
66
+ );
67
+ $envtest = false;
68
+
69
+ ! defined( 'PHP_VERSION_ID' ) || PHP_VERSION_ID < $_req['php']['5.5'] and $envtest = 1
70
+ or PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < $_req['php']['5.6'] and $envtest = 2
71
+ or $GLOBALS['wp_db_version'] < $_req['wp'] and $envtest = 3
72
+ or $envtest = true;
73
+
74
+ //? 5
75
+ if ( true !== $envtest ) return;
76
+
77
+ the_seo_framework_enqueue_installer_scripts();
78
+
79
+ add_action( 'admin_notices', 'the_seo_framework_suggest_extension_manager' );
80
+ }
81
+
82
+ /**
83
+ * Outputs "look at TSFEM" notification to ALL applicable plugin users on upgrade.
84
+ *
85
+ * @since 3.0.6
86
+ * @access private
87
+ */
88
+ function the_seo_framework_suggest_extension_manager() {
89
+
90
+ $plugin_slug = 'the-seo-framework-extension-manager';
91
+ $em_text = __( 'Extension Manager', 'autodescription' );
92
+
93
+ /**
94
+ * @source https://github.com/WordPress/WordPress/blob/4.9-branch/wp-admin/import.php#L162-L178
95
+ * @uses Spaghetti.
96
+ * @see WP Core class Plugin_Installer_Skin
97
+ */
98
+ $url = add_query_arg( array(
99
+ 'tab' => 'plugin-information',
100
+ 'plugin' => $plugin_slug,
101
+ 'from' => 'plugins',
102
+ 'TB_iframe' => 'true',
103
+ 'width' => 600,
104
+ 'height' => 550,
105
+ ), network_admin_url( 'plugin-install.php' ) );
106
+ $tsfem_details_link = sprintf(
107
+ '<a href="%1$s" id=tsf-tsfem-tb class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
108
+ esc_url( $url ),
109
+ /* translators: %s: Plugin name */
110
+ esc_attr( sprintf( __( 'More information about %s', 'autodescription' ), $em_text ) ),
111
+ esc_html( $em_text )
112
+ );
113
+ $suggestion = sprintf(
114
+ /* translators: 1. "A feature, e.g. Focus keywords", 2: Extension Manager. */
115
+ esc_html__( 'Looking for %1$s? Try out the %2$s for free.', 'autodescription' ),
116
+ sprintf(
117
+ '<strong>%s</strong>',
118
+ esc_html__( 'Focus keywords', 'autodescription' )
119
+ ),
120
+ $tsfem_details_link
121
+ );
122
+
123
+ /**
124
+ * @source https://github.com/WordPress/WordPress/blob/4.9-branch/wp-admin/import.php#L125-L138
125
+ * @uses Bolognese sauce.
126
+ * @see The closest bowl of spaghetti. Or WordPress\Administration\wp.updates/updates.js
127
+ * This joke was brought to you by the incomplete API of WP Shiny Updates, where
128
+ * WP's import.php has been directly injected into, rather than "calling" it via its API.
129
+ * Therefore, leaving the incompleteness undiscovered internally.
130
+ * @TODO Open core track ticket.
131
+ */
132
+ $url = wp_nonce_url( add_query_arg( array(
133
+ 'action' => 'install-plugin',
134
+ 'plugin' => $plugin_slug,
135
+ 'from' => 'plugins',
136
+ ), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug );
137
+ $action = sprintf(
138
+ '<a href="%1$s" id=tsf-tsfem-install class="install-now button button-small" data-slug="%2$s" data-name="%3$s" aria-label="%4$s">%5$s</a>',
139
+ esc_url( $url ),
140
+ esc_attr( $plugin_slug ),
141
+ esc_attr( $em_text ),
142
+ /* translators: %s: Extension Manager */
143
+ esc_attr( sprintf( __( 'Install the %s', 'autodescription' ), $em_text ) ),
144
+ esc_html__( 'Install Now', 'autodescription' )
145
+ );
146
+
147
+ $text = is_rtl() ? $action . ' ' . $suggestion : $suggestion . ' ' . $action;
148
+
149
+ //= This loads the JS files.
150
+ the_seo_framework()->do_dismissible_notice( $text, 'updated', false, false );
151
+ }
152
+
153
+ /**
154
+ * Loads scripts for TSFEM "Shiny Updates" implementation for WP 4.6 and later.
155
+ *
156
+ * @since 3.0.6
157
+ * @access private
158
+ */
159
+ function the_seo_framework_enqueue_installer_scripts() {
160
+
161
+ $deps = array(
162
+ 'plugin-install',
163
+ 'updates',
164
+ );
165
+ $scriptname = 'tsfinstaller';
166
+ $suffix = the_seo_framework()->script_debug ? '' : '.min';
167
+
168
+ $strings = array(
169
+ 'slug' => 'the-seo-framework-extension-manager',
170
+ 'canEnhance' => the_seo_framework()->wp_version( '4.6' ),
171
+ );
172
+
173
+ wp_register_script( $scriptname, THE_SEO_FRAMEWORK_DIR_URL . "lib/js/installer/{$scriptname}{$suffix}.js", $deps, THE_SEO_FRAMEWORK_VERSION, true );
174
+ wp_localize_script( $scriptname, "{$scriptname}L10n", $strings );
175
+
176
+ add_action( 'admin_print_styles', 'the_seo_framework_print_installer_styles' );
177
+ add_action( 'admin_footer', 'wp_print_request_filesystem_credentials_modal' );
178
+ add_action( 'admin_footer', 'wp_print_admin_notice_templates' );
179
+
180
+ wp_enqueue_style( 'plugin-install' );
181
+ wp_enqueue_script( $scriptname );
182
+ add_thickbox();
183
+ }
184
+
185
+ /**
186
+ * Outputs "button-small" "Shiny Updates" compatibility style.
187
+ *
188
+ * @since 3.0.6
189
+ * @staticvar bool $printed Prevents duplicate writing.
190
+ * @access private
191
+ */
192
+ function the_seo_framework_print_installer_styles() {
193
+ static $printed = false;
194
+ if ( $printed ) return;
195
+ echo '<style type="text/css">#tsf-tsfem-install.updating-message:before{font-size:16px;vertical-align:top}</style>';
196
+ $printed = true;
197
+ }
inc/functions/upgrade.php CHANGED
@@ -16,7 +16,7 @@
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
- defined( 'ABSPATH' ) or die;
20
21
/**
22
* This file holds functions for upgrading the plugin.
@@ -85,6 +85,10 @@ function the_seo_framework_do_upgrade() {
85
the_seo_framework_do_upgrade_3001();
86
$version = '3001';
87
}
88
89
do_action( 'the_seo_framework_upgraded' );
90
}
@@ -141,6 +145,7 @@ function the_seo_framework_output_upgrade_notices() {
141
}
142
}
143
144
/**
145
* Upgrades term metadata for version 2701.
146
*
@@ -202,33 +207,44 @@ function the_seo_framework_do_upgrade_2900() {
202
* Invalidates object cache.
203
*
204
* @since 3.0.0
205
*/
206
function the_seo_framework_do_upgrade_3001() {
207
208
$tsf = the_seo_framework();
209
- $previous_version = the_seo_framework_previous_db_version();
210
211
$timestamp_format = $tsf->get_option( 'sitemap_timestamps', false );
212
//= Only change if option exists. Falls back to default upgrader instead.
213
if ( '' !== $timestamp_format ) {
214
$tsf->update_option( 'timestamps_format', (string) (int) $timestamp_format );
215
//= Only set notice if an actual upgrade took place. (redundancy check)
216
- if ( $previous_version > '0' ) {
217
the_seo_framework_add_upgrade_notice(
218
esc_html__( 'The previous sitemap timestamp settings have been converted into new global timestamp settings.', 'autodescription' )
219
);
220
}
221
}
222
223
- if ( $previous_version > '0' ) {
224
- $tsf->update_option( 'display_character_counter', 1 );
225
- $tsf->update_option( 'display_pixel_counter', 1 );
226
- } else {
227
- $tsf->update_option( 'display_character_counter', 0 );
228
- $tsf->update_option( 'display_pixel_counter', 1 );
229
- }
230
231
$tsf->delete_object_cache();
232
233
update_option( 'the_seo_framework_upgraded_db_version', '3001' );
234
}
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
+ defined( 'THE_SEO_FRAMEWORK_PLUGIN_BASENAME' ) or die;
20
21
/**
22
* This file holds functions for upgrading the plugin.
85
the_seo_framework_do_upgrade_3001();
86
$version = '3001';
87
}
88
+ if ( $version < '3060' ) {
89
+ the_seo_framework_do_upgrade_3060();
90
+ $version = '3060';
91
+ }
92
93
do_action( 'the_seo_framework_upgraded' );
94
}
145
}
146
}
147
148
+
149
/**
150
* Upgrades term metadata for version 2701.
151
*
207
* Invalidates object cache.
208
*
209
* @since 3.0.0
210
+ * @since 3.0.6 'display_character_counter' option now correctly defaults to 1.
211
*/
212
function the_seo_framework_do_upgrade_3001() {
213
214
$tsf = the_seo_framework();
215
216
$timestamp_format = $tsf->get_option( 'sitemap_timestamps', false );
217
//= Only change if option exists. Falls back to default upgrader instead.
218
if ( '' !== $timestamp_format ) {
219
$tsf->update_option( 'timestamps_format', (string) (int) $timestamp_format );
220
//= Only set notice if an actual upgrade took place. (redundancy check)
221
+ if ( the_seo_framework_previous_db_version() > '0' ) {
222
the_seo_framework_add_upgrade_notice(
223
esc_html__( 'The previous sitemap timestamp settings have been converted into new global timestamp settings.', 'autodescription' )
224
);
225
}
226
}
227
228
+ $tsf->update_option( 'display_character_counter', 1 );
229
+ $tsf->update_option( 'display_pixel_counter', 1 );
230
231
$tsf->delete_object_cache();
232
233
update_option( 'the_seo_framework_upgraded_db_version', '3001' );
234
}
235
+
236
+ /**
237
+ * Loads suggestion for TSFEM.
238
+ * Also deletes sitemap cache.
239
+ *
240
+ * @since 3.0.6
241
+ */
242
+ function the_seo_framework_do_upgrade_3060() {
243
+
244
+ the_seo_framework()->delete_cache( 'sitemap' );
245
+
246
+ require THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'tsfem-suggestion.php';
247
+ the_seo_framework_load_extension_manager_suggestion();
248
+
249
+ update_option( 'the_seo_framework_upgraded_db_version', '3060' );
250
+ }
inc/interfaces/debug.interface.php CHANGED
@@ -39,9 +39,9 @@ interface Debug_Interface {
39
* @access private
40
* @see @this->_deprecated_function().
41
*
42
- * @param string $filter The function that was called.
43
- * @param string $version The version of WordPress that deprecated the function.
44
- * @param string $replacement Optional. The function that should have been called. Default null.
45
*/
46
public function _deprecated_filter( $filter, $version, $replacement = null );
47
@@ -55,9 +55,9 @@ interface Debug_Interface {
55
* @since 2.6.0
56
* @access private
57
*
58
- * @param string $function The function that was called.
59
- * @param string $version The version of WordPress that deprecated the function.
60
- * @param string $replacement Optional. The function that should have been called. Default null.
61
*/
62
public function _deprecated_function( $function, $version, $replacement = null );
63
@@ -71,9 +71,9 @@ interface Debug_Interface {
71
* @since 2.6.0
72
* @access private
73
*
74
- * @param string $function The function that was called.
75
- * @param string $message A message explaining what has been done incorrectly.
76
- * @param string $version The version of WordPress where the message was added.
77
*/
78
public function _doing_it_wrong( $function, $message, $version );
79
@@ -85,8 +85,8 @@ interface Debug_Interface {
85
* @since 2.7.0
86
* @access private
87
*
88
- * @param string $p_or_m The Property or Method.
89
- * @param string $message A message explaining what has been done incorrectly.
90
*/
91
public function _inaccessible_p_or_m( $p_or_m, $message = '' );
92
39
* @access private
40
* @see @this->_deprecated_function().
41
*
42
+ * @param string $filter The function that was called.
43
+ * @param string $version The version of WordPress that deprecated the function.
44
+ * @param string $replacement Optional. The function that should have been called. Default null.
45
*/
46
public function _deprecated_filter( $filter, $version, $replacement = null );
47
55
* @since 2.6.0
56
* @access private
57
*
58
+ * @param string $function The function that was called.
59
+ * @param string $version The version of WordPress that deprecated the function.
60
+ * @param string $replacement Optional. The function that should have been called. Default null.
61
*/
62
public function _deprecated_function( $function, $version, $replacement = null );
63
71
* @since 2.6.0
72
* @access private
73
*
74
+ * @param string $function The function that was called.
75
+ * @param string $message A message explaining what has been done incorrectly.
76
+ * @param string $version he version of WordPress where the message was added.
77
*/
78
public function _doing_it_wrong( $function, $message, $version );
79
85
* @since 2.7.0
86
* @access private
87
*
88
+ * @param string $p_or_m The Property or Method.
89
+ * @param string $message A message explaining what has been done incorrectly.
90
*/
91
public function _inaccessible_p_or_m( $p_or_m, $message = '' );
92
inc/views/inpost/seo-settings-singular.php CHANGED
@@ -119,7 +119,7 @@ switch ( $instance ) :
119
</div>
120
<div class="tsf-flex-setting-input tsf-flex">
121
<div id="tsf-title-wrap">
122
- <input class="large-text" type="text" name="autodescription[_genesis_title]" id="autodescription_title" placeholder="<?php echo esc_attr( $doctitle_placeholder ); ?>" value="<?php echo esc_attr( $this->get_custom_field( '_genesis_title' ) ); ?>" autocomplete=off />
123
<?php echo $this->output_js_title_elements(); ?>
124
</div>
125
</div>
@@ -145,7 +145,7 @@ switch ( $instance ) :
145
</div>
146
</div>
147
<div class="tsf-flex-setting-input tsf-flex">
148
- <textarea class="large-text" name="autodescription[_genesis_description]" id="autodescription_description" placeholder="<?php echo esc_attr( $description_placeholder ); ?>" rows="4" cols="4"><?php echo esc_attr( $this->get_custom_field( '_genesis_description' ) ); ?></textarea>
149
<?php echo $this->output_js_description_elements(); ?>
150
</div>
151
</div>
119
</div>
120
<div class="tsf-flex-setting-input tsf-flex">
121
<div id="tsf-title-wrap">
122
+ <input class="large-text" type="text" name="autodescription[_genesis_title]" id="autodescription_title" placeholder="<?php echo esc_attr( $doctitle_placeholder ); ?>" value="<?php echo esc_attr( $this->get_custom_field( '_genesis_title', $post_id ) ); ?>" autocomplete=off />
123
<?php echo $this->output_js_title_elements(); ?>
124
</div>
125
</div>
145
</div>
146
</div>
147
<div class="tsf-flex-setting-input tsf-flex">
148
+ <textarea class="large-text" name="autodescription[_genesis_description]" id="autodescription_description" placeholder="<?php echo esc_attr( $description_placeholder ); ?>" rows="4" cols="4"><?php echo esc_attr( $this->get_custom_field( '_genesis_description', $post_id ) ); ?></textarea>
149
<?php echo $this->output_js_description_elements(); ?>
150
</div>
151
</div>
inc/views/inpost/seo-settings-tt.php CHANGED
@@ -26,15 +26,9 @@ $generated_doctitle_args = array(
26
'get_custom_field' => false,
27
);
28
29
- $generated_description_args = array(
30
- 'id' => $term_id,
31
- 'taxonomy' => $taxonomy,
32
- 'get_custom_field' => false,
33
- );
34
-
35
//* Generate title and description.
36
$generated_doctitle = $this->title( '', '', '', $generated_doctitle_args );
37
- $generated_description = $this->generate_description( '', $generated_description_args );
38
39
$blog_name = $this->get_blogname();
40
$add_additions = $this->add_title_additions();
26
'get_custom_field' => false,
27
);
28
29
//* Generate title and description.
30
$generated_doctitle = $this->title( '', '', '', $generated_doctitle_args );
31
+ $generated_description = $this->get_generated_description( $term_id );
32
33
$blog_name = $this->get_blogname();
34
$add_additions = $this->add_title_additions();
inc/views/metaboxes/homepage-metabox.php CHANGED
@@ -105,13 +105,7 @@ switch ( $instance ) :
105
if ( $frompost_description ) {
106
$description_placeholder = $frompost_description;
107
} else {
108
- $description_args = array(
109
- 'id' => $home_id,
110
- 'is_home' => true,
111
- 'get_custom_field' => false,
112
- );
113
-
114
- $description_placeholder = $this->generate_description( '', $description_args );
115
}
116
117
/**
105
if ( $frompost_description ) {
106
$description_placeholder = $frompost_description;
107
} else {
108
+ $description_placeholder = $this->get_generated_description( $home_id );
109
}
110
111
/**
language/autodescription.pot CHANGED
@@ -2,9 +2,9 @@
2
# This file is distributed under the same license as the The SEO Framework package.
3
msgid ""
4
msgstr ""
5
- "Project-Id-Version: The SEO Framework 3.0.4\n"
6
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/autodescription\n"
7
- "POT-Creation-Date: 2018-02-26 01:19:08+00:00\n"
8
"MIME-Version: 1.0\n"
9
"Content-Type: text/plain; charset=UTF-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
@@ -14,61 +14,61 @@ msgstr ""
14
15
#. translators: %s = term name
16
17
- #: inc/classes/admin-init.class.php:253
18
msgid "Make primary %s"
19
msgstr ""
20
21
#. translators: %s = term name
22
23
- #: inc/classes/admin-init.class.php:255
24
msgid "Primary %s"
25
msgstr ""
26
27
- #: inc/classes/admin-init.class.php:352
28
msgid "The changes you made will be lost if you navigate away from this page."
29
msgstr ""
30
31
- #: inc/classes/admin-init.class.php:353
32
msgid "Are you sure you want to reset all SEO settings to their defaults?"
33
msgstr ""
34
35
- #: inc/classes/admin-init.class.php:354
36
msgid "Good"
37
msgstr ""
38
39
- #: inc/classes/admin-init.class.php:355
40
msgid "Okay"
41
msgstr ""
42
43
- #: inc/classes/admin-init.class.php:356
44
msgid "Bad"
45
msgstr ""
46
47
- #: inc/classes/admin-init.class.php:357
48
msgid "Unknown"
49
msgstr ""
50
51
- #: inc/classes/admin-init.class.php:358
52
msgid "Private:"
53
msgstr ""
54
55
- #: inc/classes/admin-init.class.php:359
56
msgid "Protected:"
57
msgstr ""
58
59
#. translators: Pixel counter. 1: width, 2: guideline
60
61
- #: inc/classes/admin-init.class.php:361
62
msgid "%1$d out of %2$d pixels are used."
63
msgstr ""
64
65
#. translators: %s = Redirect URL markdown
66
67
- #: inc/classes/admin-init.class.php:703
68
msgid "There has been an error redirecting. Refresh the page or follow [this link](%s)."
69
msgstr ""
70
71
- #: inc/classes/admin-init.class.php:789 inc/classes/admin-init.class.php:850
72
msgid "Image could not be processed."
73
msgstr ""
74
@@ -130,7 +130,7 @@ msgstr ""
130
131
#: inc/classes/admin-pages.class.php:295
132
#: inc/views/inpost/seo-settings-singular.php:187
133
- #: inc/views/inpost/seo-settings-tt.php:164
134
msgid "Robots Meta Settings"
135
msgstr ""
136
@@ -203,29 +203,29 @@ msgstr ""
203
msgid "Characters Used: %s"
204
msgstr ""
205
206
- #: inc/classes/core.class.php:254
207
msgid "Settings"
208
msgstr ""
209
210
- #: inc/classes/core.class.php:256
211
msgctxt "As in: The Plugin Home Page"
212
msgid "Home"
213
msgstr ""
214
215
- #: inc/classes/core.class.php:265
216
msgid "https://wordpress.org/plugins/the-seo-framework-extension-manager/"
217
msgstr ""
218
219
- #: inc/classes/core.class.php:265
220
msgctxt "Plugin extensions"
221
msgid "Extensions"
222
msgstr ""
223
224
- #: inc/classes/core.class.php:317
225
msgid "Dismiss"
226
msgstr ""
227
228
- #: inc/classes/core.class.php:460
229
msgctxt "e.g. en for English, nl for Dutch, fi for Finish, de for German"
230
msgid "en"
231
msgstr ""
@@ -299,204 +299,204 @@ msgstr ""
299
300
#. translators: %s = But or And
301
302
- #: inc/classes/doing-it-right.class.php:956
303
msgid "%s the Title contains the Blogname multiple times."
304
msgstr ""
305
306
#. translators: 1: Word, 2: Occurrences
307
308
- #: inc/classes/doing-it-right.class.php:1129
309
msgid "%1$s is used %2$d times."
310
msgstr ""
311
312
#. Translators: %s = Post / Page / Category, etc.
313
314
- #: inc/classes/doing-it-right.class.php:1174
315
msgid "%s is being indexed."
316
msgstr ""
317
318
- #: inc/classes/doing-it-right.class.php:1183
319
msgid "But you've discouraged indexing for the whole site."
320
msgstr ""
321
322
#. translators: 1: But or And, 2: Current taxonomy term plural label
323
324
- #: inc/classes/doing-it-right.class.php:1207
325
msgid "%1$s indexing for %2$s have been discouraged."
326
msgstr ""
327
328
#. translators: 1 = But or And, 1 = Post/Page
329
330
- #: inc/classes/doing-it-right.class.php:1220
331
msgid "%1$s the %2$s is protected from public visibility. This means indexing is discouraged."
332
msgstr ""
333
334
#. translators: %s = But or And
335
336
- #: inc/classes/doing-it-right.class.php:1229
337
msgid "%s the blog isn't set to public. This means WordPress discourages indexing."
338
msgstr ""
339
340
#. translators: %s = But or And
341
342
- #: inc/classes/doing-it-right.class.php:1243
343
msgid "%s there are no posts in this term; therefore, indexing has been discouraged."
344
msgstr ""
345
346
- #: inc/classes/doing-it-right.class.php:1327
347
msgid "%s links aren't being followed."
348
msgstr ""
349
350
- #: inc/classes/doing-it-right.class.php:1333
351
msgid "%s links are being followed."
352
msgstr ""
353
354
#. translators: %s = But or And
355
356
- #: inc/classes/doing-it-right.class.php:1345
357
msgid "%s you've discouraged the following of links for the whole site."
358