The SEO Framework - Version 2.9.1

Version Description

  • Sovereign Comprehension =

Release date:

  • 27th March 2017

Summarized:

  • This release patches a few bugs that were brought with the 2.9.0 release related to debugging and cache clearing.
  • And if you like to use quick edit a lot, the SEO Bar will now also re-render on save.

Detailed log:

All we have to decide is what to do with the time that is given us.

Download this release

Release Info

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

Code changes from version 2.9.0 to 2.9.1

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: 2.9.0
7
  * Author: Sybre Waaijer
8
  * Author URI: https://cyberwire.nl/
9
  * License: GPLv3
@@ -46,7 +46,7 @@ defined( 'ABSPATH' ) or die;
46
  * Not many caching plugins use CDN in dashboard. What a shame. Firefox does cache.
47
  * @since 1.0.0
48
  */
49
- define( 'THE_SEO_FRAMEWORK_VERSION', '2.9.0' );
50
 
51
  /**
52
  * Plugin Database version for lightweight version upgrade comparing.
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: 2.9.1
7
  * Author: Sybre Waaijer
8
  * Author URI: https://cyberwire.nl/
9
  * License: GPLv3
46
  * Not many caching plugins use CDN in dashboard. What a shame. Firefox does cache.
47
  * @since 1.0.0
48
  */
49
+ define( 'THE_SEO_FRAMEWORK_VERSION', '2.9.1' );
50
 
51
  /**
52
  * Plugin Database version for lightweight version upgrade comparing.
inc/classes/cache.class.php CHANGED
@@ -232,31 +232,45 @@ class Cache extends Sitemaps {
232
  case 'front' :
233
  $front_id = $this->get_the_front_page_ID();
234
 
235
- $this->setup_auto_description_transient( $front_id, '', 'frontpage' );
236
-
237
- $this->object_cache_delete( $this->get_meta_output_cache_key( $this->get_the_front_page_ID() ) );
238
- $this->is_option_checked( 'cache_meta_schema' ) and $this->delete_ld_json_transient( $front_id, '', 'frontpage' );
239
- $this->is_option_checked( 'cache_meta_description' ) and delete_transient( $this->auto_description_transient );
240
  break;
241
 
242
  case 'post' :
243
- $this->object_cache_delete( $this->get_meta_output_cache_key( $id ) );
244
- $this->delete_auto_description_transient( $id );
245
- $this->delete_ld_json_transient( $id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  return true;
247
  break;
248
 
249
  //* Careful, this can only run on archive pages. For now.
250
  case 'term' :
251
- $this->object_cache_delete( $this->get_meta_output_cache_key( $id ) );
252
- $this->delete_auto_description_transient( $id, $args['term'] );
253
- $this->delete_ld_json_transient( $id, $args['term'] );
254
  return true;
255
  break;
256
 
257
  case 'author' :
258
- $this->object_cache_delete( $this->get_meta_output_cache_key( $id ) );
259
  $this->delete_auto_description_transient( $id, 'author', 'author' );
 
260
  return true;
261
  break;
262
 
@@ -470,10 +484,11 @@ class Cache extends Sitemaps {
470
  }
471
 
472
  /**
473
- * Setup vars for transients which require $page_id.
474
  *
475
  * @since 2.3.3
476
  * @since 2.8.0: Now listens to option 'cache_meta_description'.
 
477
  *
478
  * @param int|string|bool $page_id the Taxonomy or Post ID. If false it will generate for the blog page.
479
  * @param string $taxonomy The taxonomy name.
@@ -485,28 +500,36 @@ class Cache extends Sitemaps {
485
  if ( false === $this->is_option_checked( 'cache_meta_description' ) )
486
  return;
487
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  $cache_key = $this->generate_cache_key( $page_id, $taxonomy, $type );
489
 
490
- /**
491
- * When the caching mechanism changes. Change this value.
492
- * Use hex. e.g. 0, 1, 2, 9, a, b
493
- *
494
- * @since 2.3.4
495
- */
496
  $revision = '2';
497
-
498
  $additions = $this->add_description_additions( $page_id, $taxonomy );
499
 
500
  if ( $additions ) {
501
  $option = $this->get_option( 'description_blogname' ) ? '1' : '0';
502
- $this->auto_description_transient = 'tsf_desc_' . $option . '_' . $revision . '_' . $cache_key;
503
  } else {
504
- $this->auto_description_transient = 'tsf_desc_noa_' . $revision . '_' . $cache_key;
505
  }
506
  }
507
 
508
  /**
509
- * Setup vars for transients which require $page_id.
510
  *
511
  * @since 2.3.3
512
  * @since 2.8.0: Now listens to option 'cache_meta_schema'.
@@ -521,13 +544,23 @@ class Cache extends Sitemaps {
521
  if ( false === $this->is_option_checked( 'cache_meta_schema' ) )
522
  return;
523
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  $cache_key = $this->generate_cache_key( $page_id, $taxonomy, $type );
525
 
526
- /**
527
- * When the caching mechanism changes. Change this value.
528
- *
529
- * Use hex. e.g. 0, 1, 2, 9, a, b
530
- */
531
  $revision = '3';
532
 
533
  /**
@@ -537,40 +570,52 @@ class Cache extends Sitemaps {
537
  $options .= $this->enable_ld_json_sitename() ? '1' : '0';
538
  $options .= $this->enable_ld_json_searchbox() ? '1' : '0';
539
 
540
- $this->ld_json_transient = 'tsf_' . $revision . '_' . $options . '_ldjs_' . $cache_key;
541
  }
542
 
543
  /**
544
- * Generate transient key based on query vars.
545
  *
546
- * @global int $blog_id;
547
  *
548
  * @since 2.3.3
549
  * @since 2.6.0 Refactored.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
550
  * @staticvar array $cached_id : contains cache strings.
 
551
  *
552
  * @param int|string|bool $page_id the Taxonomy or Post ID.
553
  * @param string $taxonomy The Taxonomy name.
554
  * @param string $type The Post Type
555
- * @return string The generated page id key.
556
  */
557
- public function generate_cache_key( $page_id, $taxonomy = '', $type = null ) {
558
 
559
  $page_id = $page_id ?: $this->get_the_real_ID();
560
 
561
- if ( isset( $type ) ) {
562
- if ( 'author' === $type ) {
563
- //* Author page.
564
- return $this->add_cache_key_suffix( 'author_' . $page_id );
565
- } elseif ( 'frontpage' === $type ) {
566
- //* Front/HomePage.
567
- return $this->add_cache_key_suffix( $this->generate_front_page_cache_key() );
568
- } else {
569
- $this->_doing_it_wrong( __METHOD__, 'Third parameter must be a known type.', '2.6.5' );
570
- return $this->add_cache_key_suffix( \esc_sql( $type . '_' . $page_id . '_' . $taxonomy ) );
571
- }
572
- }
573
-
574
  static $cached_id = array();
575
 
576
  if ( isset( $cached_id[ $page_id ][ $taxonomy ] ) )
@@ -588,16 +633,26 @@ class Cache extends Sitemaps {
588
  } elseif ( $this->is_blog_page( $page_id ) ) {
589
  $the_id = 'blog_' . $page_id;
590
  } elseif ( $this->is_singular() ) {
591
- if ( $this->is_page( $page_id ) ) {
592
- $the_id = 'page_' . $page_id;
593
- } elseif ( $this->is_single( $page_id ) ) {
594
- $the_id = 'post_' . $page_id;
595
- } elseif ( $this->is_attachment( $page_id ) ) {
596
- $the_id = 'attach_' . $page_id;
597
- } else {
598
- //* Other.
599
- $the_id = 'singular_' . $page_id;
600
- }
 
 
 
 
 
 
 
 
 
 
601
  } elseif ( $this->is_search() ) {
602
  $query = '';
603
 
@@ -708,6 +763,52 @@ class Cache extends Sitemaps {
708
  return $cached_id[ $page_id ][ $taxonomy ] = $this->add_cache_key_suffix( $the_id );
709
  }
710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711
  /**
712
  * Adds cache key suffix based on blog id and locale.
713
  *
@@ -732,7 +833,9 @@ class Cache extends Sitemaps {
732
  /**
733
  * Returns the front page partial transient key.
734
  *
735
- * @param string $type
 
 
736
  * @return string the front page transient key.
737
  */
738
  public function generate_front_page_cache_key( $type = '' ) {
@@ -810,6 +913,8 @@ class Cache extends Sitemaps {
810
  *
811
  * @since 2.8.0
812
  * @uses THE_SEO_FRAMEWORK_DB_VERSION as cache key buster.
 
 
813
  *
814
  * @param int $id The ID. Defaults to $this->get_the_real_ID();
815
  * @return string The TSF meta output cache key.
@@ -831,6 +936,53 @@ class Cache extends Sitemaps {
831
  return $cache_key = 'seo_framework_output_' . $key . '_' . $paged . '_' . $page;
832
  }
833
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
834
  /**
835
  * Delete transient on term save/deletion.
836
  *
@@ -896,25 +1048,25 @@ class Cache extends Sitemaps {
896
  * Returns old option, since that's passed for sanitation within WP Core.
897
  *
898
  * @since 2.3.3
899
- * @since 2.8.0 : Now listens to option 'cache_meta_description' before deleting transient.
 
900
  *
901
  * @param string $old_option The previous blog description option.
902
  * @return string Previous option.
903
  */
904
  public function delete_auto_description_frontpage_transient( $old_option ) {
905
 
906
- $this->setup_auto_description_transient( $this->get_the_front_page_ID(), '', 'frontpage' );
907
-
908
- $this->is_option_checked( 'cache_meta_description' ) and \delete_transient( $this->auto_description_transient );
909
 
910
  return $old_option;
911
  }
912
 
913
  /**
914
- * Delete transient for the automatic description on requests.
915
  *
916
  * @since 2.3.3
917
  * @since 2.8.0 : Now listens to option 'cache_meta_description' before deleting transient.
 
918
  *
919
  * @param mixed $page_id The page ID or identifier.
920
  * @param string $taxonomy The tt name.
@@ -923,18 +1075,20 @@ class Cache extends Sitemaps {
923
  */
924
  public function delete_auto_description_transient( $page_id, $taxonomy = '', $type = null ) {
925
 
926
- $this->setup_auto_description_transient( $page_id, $taxonomy, $type );
927
-
928
- $this->is_option_checked( 'cache_meta_description' ) and \delete_transient( $this->auto_description_transient );
 
929
 
930
  return true;
931
  }
932
 
933
  /**
934
- * Delete transient for the LD+Json scripts on requests.
935
  *
936
  * @since 2.4.2
937
- * @since 2.8.0 : Now listens to option 'cache_meta_schema' before deleting transient.
 
938
  *
939
  * @param mixed $page_id The page ID or identifier.
940
  * @param string $taxonomy The tt name.
@@ -946,9 +1100,10 @@ class Cache extends Sitemaps {
946
  static $flushed = null;
947
 
948
  if ( ! isset( $flushed ) ) {
949
- $this->setup_ld_json_transient( $page_id, $taxonomy, $type );
950
-
951
- $this->is_option_checked( 'cache_meta_schema' ) and \delete_transient( $this->ld_json_transient );
 
952
 
953
  $flushed = 'Oh behave!';
954
 
232
  case 'front' :
233
  $front_id = $this->get_the_front_page_ID();
234
 
235
+ $this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $front_id, '', 'frontpage' ) );
236
+ $this->delete_auto_description_transient( $front_id, '', 'frontpage' );
237
+ $this->delete_ld_json_transient( $front_id, '', 'frontpage' );
 
 
238
  break;
239
 
240
  case 'post' :
241
+ if ( ! $post_type = \get_post_type( $id ) )
242
+ return false;
243
+
244
+ switch ( $post_type ) {
245
+ case 'page' :
246
+ case 'post' :
247
+ case 'attachment' :
248
+ break;
249
+
250
+ default :
251
+ //* Generic key for CPT.
252
+ $post_type = 'singular';
253
+ break;
254
+ }
255
+
256
+ $this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, '', $post_type ) );
257
+ $this->delete_auto_description_transient( $id, '', $post_type );
258
+ $this->delete_ld_json_transient( $id, '', $post_type );
259
  return true;
260
  break;
261
 
262
  //* Careful, this can only run on archive pages. For now.
263
  case 'term' :
264
+ $this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, $args['term'], 'term' ) );
265
+ $this->delete_auto_description_transient( $id, $args['term'], 'term' );
266
+ $this->delete_ld_json_transient( $id, $args['term'], 'term' );
267
  return true;
268
  break;
269
 
270
  case 'author' :
271
+ $this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, 'author', 'author' ) );
272
  $this->delete_auto_description_transient( $id, 'author', 'author' );
273
+ $this->delete_ld_json_transient( $id, 'author', 'author' );
274
  return true;
275
  break;
276
 
484
  }
485
 
486
  /**
487
+ * Sets up property for autodescription transient.
488
  *
489
  * @since 2.3.3
490
  * @since 2.8.0: Now listens to option 'cache_meta_description'.
491
+ * @see $this->get_auto_description_transient().
492
  *
493
  * @param int|string|bool $page_id the Taxonomy or Post ID. If false it will generate for the blog page.
494
  * @param string $taxonomy The taxonomy name.
500
  if ( false === $this->is_option_checked( 'cache_meta_description' ) )
501
  return;
502
 
503
+ $this->auto_description_transient = $this->get_auto_description_transient( $page_id, $taxonomy, $type );
504
+ }
505
+
506
+ /**
507
+ * Returns autodescription transients key by page ID.
508
+ *
509
+ * @since 2.9.1
510
+ *
511
+ * @param int|string|bool $page_id the Taxonomy or Post ID.
512
+ * @param string $taxonomy The taxonomy name.
513
+ * @param string $type The Post Type.
514
+ * @return string The auto description transient key.
515
+ */
516
+ public function get_auto_description_transient( $page_id = 0, $taxonomy = '', $type = null ) {
517
+
518
  $cache_key = $this->generate_cache_key( $page_id, $taxonomy, $type );
519
 
 
 
 
 
 
 
520
  $revision = '2';
 
521
  $additions = $this->add_description_additions( $page_id, $taxonomy );
522
 
523
  if ( $additions ) {
524
  $option = $this->get_option( 'description_blogname' ) ? '1' : '0';
525
+ return 'tsf_desc_' . $option . '_' . $revision . '_' . $cache_key;
526
  } else {
527
+ return 'tsf_desc_noa_' . $revision . '_' . $cache_key;
528
  }
529
  }
530
 
531
  /**
532
+ * Sets up property for ld_json transient.
533
  *
534
  * @since 2.3.3
535
  * @since 2.8.0: Now listens to option 'cache_meta_schema'.
544
  if ( false === $this->is_option_checked( 'cache_meta_schema' ) )
545
  return;
546
 
547
+ $this->ld_json_transient = $this->get_ld_json_transient( $page_id, $taxonomy, $type );
548
+ }
549
+
550
+ /**
551
+ * Returns ld_json transients for page ID.
552
+ *
553
+ * @since 2.9.1
554
+ *
555
+ * @param int|string|bool $page_id the Taxonomy or Post ID. If false it will generate for the blog page.
556
+ * @param string $taxonomy The taxonomy name.
557
+ * @param string|null $type The post type.
558
+ * @return string The ld_json cache key.
559
+ */
560
+ public function get_ld_json_transient( $page_id, $taxonomy = '', $type = null ) {
561
+
562
  $cache_key = $this->generate_cache_key( $page_id, $taxonomy, $type );
563
 
 
 
 
 
 
564
  $revision = '3';
565
 
566
  /**
570
  $options .= $this->enable_ld_json_sitename() ? '1' : '0';
571
  $options .= $this->enable_ld_json_searchbox() ? '1' : '0';
572
 
573
+ return 'tsf_' . $revision . '_' . $options . '_ldjs_' . $cache_key;
574
  }
575
 
576
  /**
577
+ * Generate transient key based on query vars or input variables.
578
  *
579
+ * Warning: This can generate errors when used too early if no type has been set.
580
  *
581
  * @since 2.3.3
582
  * @since 2.6.0 Refactored.
583
+ * @since 2.9.1 : 1. Added early singular type detection.
584
+ * 2. Moved generation into $this->generate_cache_key_by_query().
585
+ * @see $this->generate_cache_key_by_query() to get cache key from the query.
586
+ * @see $this->generate_cache_key_by_type() to get cache key outside of the query.
587
+ *
588
+ * @param int|string|bool $page_id the Taxonomy or Post ID.
589
+ * @param string $taxonomy The taxonomy name.
590
+ * @param string $type The Post Type.
591
+ * @return string The generated cache key by query or type.
592
+ */
593
+ public function generate_cache_key( $page_id, $taxonomy = '', $type = null ) {
594
+
595
+ if ( isset( $type ) )
596
+ return $this->generate_cache_key_by_type( $page_id, $taxonomy, $type );
597
+
598
+ return $this->generate_cache_key_by_query( $page_id, $taxonomy, $type );
599
+ }
600
+
601
+ /**
602
+ * Generate transient key based on query vars.
603
+ *
604
+ * Warning: This can generate errors when used too early if no type has been set.
605
+ *
606
+ * @since 2.9.1
607
  * @staticvar array $cached_id : contains cache strings.
608
+ * @see $this->generate_cache_key_by_type() to get cache key outside of the query.
609
  *
610
  * @param int|string|bool $page_id the Taxonomy or Post ID.
611
  * @param string $taxonomy The Taxonomy name.
612
  * @param string $type The Post Type
613
+ * @return string The generated cache key by query.
614
  */
615
+ public function generate_cache_key_by_query( $page_id, $taxonomy = '', $type = null ) {
616
 
617
  $page_id = $page_id ?: $this->get_the_real_ID();
618
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
  static $cached_id = array();
620
 
621
  if ( isset( $cached_id[ $page_id ][ $taxonomy ] ) )
633
  } elseif ( $this->is_blog_page( $page_id ) ) {
634
  $the_id = 'blog_' . $page_id;
635
  } elseif ( $this->is_singular() ) {
636
+
637
+ $post_type = \get_post_type( $page_id );
638
+
639
+ switch ( $post_type ) :
640
+ case 'page' :
641
+ $the_id = 'page_' . $page_id;
642
+ break;
643
+
644
+ case 'post' :
645
+ $the_id = 'post_' . $page_id;
646
+ break;
647
+
648
+ case 'attachment' :
649
+ $the_id = 'attach_' . $page_id;
650
+ break;
651
+
652
+ default :
653
+ $the_id = 'singular_' . $page_id;
654
+ break;
655
+ endswitch;
656
  } elseif ( $this->is_search() ) {
657
  $query = '';
658
 
763
  return $cached_id[ $page_id ][ $taxonomy ] = $this->add_cache_key_suffix( $the_id );
764
  }
765
 
766
+ /**
767
+ * Generate transient key based on input.
768
+ *
769
+ * Use this method if you wish to evade the query usage.
770
+ *
771
+ * @since 2.9.1
772
+ * @staticvar array $cached_id : contains cache strings.
773
+ * @see $this->generate_cache_key().
774
+ * @see $this->generate_cache_key_by_query() to get cache key from the query.
775
+ *
776
+ * @param int|string|bool $page_id the Taxonomy or Post ID.
777
+ * @param string $taxonomy The term taxonomy.
778
+ * @param string $type The Post Type.
779
+ * @return string The generated cache key by type.
780
+ */
781
+ public function generate_cache_key_by_type( $page_id, $taxonomy = '', $type = '' ) {
782
+
783
+ switch ( $type ) :
784
+ case 'author' :
785
+ return $this->add_cache_key_suffix( 'author_' . $page_id );
786
+ break;
787
+ case 'frontpage' :
788
+ return $this->add_cache_key_suffix( $this->generate_front_page_cache_key() );
789
+ break;
790
+ case 'page' :
791
+ return $this->add_cache_key_suffix( 'page_' . $page_id );
792
+ break;
793
+ case 'post' :
794
+ return $this->add_cache_key_suffix( 'post_' . $page_id );
795
+ break;
796
+ case 'attachment' :
797
+ return $this->add_cache_key_suffix( 'attach_' . $page_id );
798
+ break;
799
+ case 'singular' :
800
+ return $this->add_cache_key_suffix( 'singular_' . $page_id );
801
+ break;
802
+ case 'term' :
803
+ return $this->add_cache_key_suffix( $this->generate_taxonomial_cache_key( $page_id, $taxonomy ) );
804
+ break;
805
+ default :
806
+ $this->_doing_it_wrong( __METHOD__, 'Third parameter must be a known type.', '2.6.5' );
807
+ return $this->add_cache_key_suffix( \esc_sql( $type . '_' . $page_id . '_' . $taxonomy ) );
808
+ break;
809
+ endswitch;
810
+ }
811
+
812
  /**
813
  * Adds cache key suffix based on blog id and locale.
814
  *
833
  /**
834
  * Returns the front page partial transient key.
835
  *
836
+ * @since ??? (2.8+)
837
+ *
838
+ * @param string $type Either blog or page.
839
  * @return string the front page transient key.
840
  */
841
  public function generate_front_page_cache_key( $type = '' ) {
913
  *
914
  * @since 2.8.0
915
  * @uses THE_SEO_FRAMEWORK_DB_VERSION as cache key buster.
916
+ * @see $this->get_meta_output_cache_key_by_type();
917
+ * @todo deprecate.
918
  *
919
  * @param int $id The ID. Defaults to $this->get_the_real_ID();
920
  * @return string The TSF meta output cache key.
936
  return $cache_key = 'seo_framework_output_' . $key . '_' . $paged . '_' . $page;
937
  }
938
 
939
+ /**
940
+ * Returns the TSF meta output Object cache key.
941
+ *
942
+ * @since 2.9.1
943
+ * @uses THE_SEO_FRAMEWORK_DB_VERSION as cache key buster.
944
+ *
945
+ * @param int $id The ID. Defaults to $this->get_the_real_ID();
946
+ * @param string $type The post type.
947
+ * @return string The TSF meta output cache key.
948
+ */
949
+ public function get_meta_output_cache_key_by_query() {
950
+ /**
951
+ * Cache key buster.
952
+ * Busts cache on each new db version.
953
+ */
954
+ $key = $this->generate_cache_key_by_query() . '_' . THE_SEO_FRAMEWORK_DB_VERSION;
955
+
956
+ $page = (string) $this->page();
957
+ $paged = (string) $this->paged();
958
+
959
+ return $cache_key = 'seo_framework_output_' . $key . '_' . $paged . '_' . $page;
960
+ }
961
+
962
+ /**
963
+ * Returns the TSF meta output Object cache key.
964
+ *
965
+ * @since 2.9.1
966
+ * @uses THE_SEO_FRAMEWORK_DB_VERSION as cache key buster.
967
+ *
968
+ * @param int $id The ID. Defaults to $this->get_the_real_ID();
969
+ * @param string $taxonomy The term taxonomy
970
+ * @param string $type The post type.
971
+ * @return string The TSF meta output cache key.
972
+ */
973
+ public function get_meta_output_cache_key_by_type( $id = 0, $taxonomy = '', $type = '' ) {
974
+ /**
975
+ * Cache key buster.
976
+ * Busts cache on each new db version.
977
+ */
978
+ $key = $this->generate_cache_key_by_type( $id, $taxonomy, $type ) . '_' . THE_SEO_FRAMEWORK_DB_VERSION;
979
+
980
+ $page = '1';
981
+ $paged = '1';
982
+
983
+ return $cache_key = 'seo_framework_output_' . $key . '_' . $paged . '_' . $page;
984
+ }
985
+
986
  /**
987
  * Delete transient on term save/deletion.
988
  *
1048
  * Returns old option, since that's passed for sanitation within WP Core.
1049
  *
1050
  * @since 2.3.3
1051
+ * @since 2.8.0 Now listens to option 'cache_meta_description' before deleting transient.
1052
+ * @since 2.9.1 Now no longer sets object property $this->auto_description_transient.
1053
  *
1054
  * @param string $old_option The previous blog description option.
1055
  * @return string Previous option.
1056
  */
1057
  public function delete_auto_description_frontpage_transient( $old_option ) {
1058
 
1059
+ $this->delete_auto_description_transient( $this->get_the_front_page_ID(), '', 'frontpage' );
 
 
1060
 
1061
  return $old_option;
1062
  }
1063
 
1064
  /**
1065
+ * Deletes transient for the automatic description on requests.
1066
  *
1067
  * @since 2.3.3
1068
  * @since 2.8.0 : Now listens to option 'cache_meta_description' before deleting transient.
1069
+ * @since 2.9.1 Now no longer sets object property $this->auto_description_transient.
1070
  *
1071
  * @param mixed $page_id The page ID or identifier.
1072
  * @param string $taxonomy The tt name.
1075
  */
1076
  public function delete_auto_description_transient( $page_id, $taxonomy = '', $type = null ) {
1077
 
1078
+ if ( $this->is_option_checked( 'cache_meta_description' ) ) {
1079
+ $transient = $this->get_auto_description_transient( $page_id, $taxonomy, $type );
1080
+ \delete_transient( $transient );
1081
+ }
1082
 
1083
  return true;
1084
  }
1085
 
1086
  /**
1087
+ * Deletes transient for the LD+Json scripts on requests.
1088
  *
1089
  * @since 2.4.2
1090
+ * @since 2.8.0 Now listens to option 'cache_meta_schema' before deleting transient.
1091
+ * @since 2.9.1 Now no longer sets object property $this->ld_json_transient.
1092
  *
1093
  * @param mixed $page_id The page ID or identifier.
1094
  * @param string $taxonomy The tt name.
1100
  static $flushed = null;
1101
 
1102
  if ( ! isset( $flushed ) ) {
1103
+ if ( $this->is_option_checked( 'cache_meta_schema' ) ) {
1104
+ $transient = $this->get_ld_json_transient( $page_id, $taxonomy, $type );
1105
+ \delete_transient( $transient );
1106
+ }
1107
 
1108
  $flushed = 'Oh behave!';
1109
 
inc/classes/doing-it-right.class.php CHANGED
@@ -86,18 +86,19 @@ class Doing_It_Right extends Generate_Ldjson {
86
  }
87
 
88
  /**
89
- * AJAX wrapper for $this->init_columns
90
  *
91
- * @since 2.6.0
 
92
  */
93
- public function init_columns_ajax() {
94
 
95
  /**
96
  * Securely check the referrer, instead of leaving holes everywhere.
97
  */
98
  if ( $this->doing_ajax() && \check_ajax_referer( 'add-tag', '_wpnonce_add-tag', false ) ) {
99
 
100
- $taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag';
101
  $tax = \get_taxonomy( $taxonomy );
102
 
103
  if ( \current_user_can( $tax->cap->edit_terms ) )
@@ -105,10 +106,63 @@ class Doing_It_Right extends Generate_Ldjson {
105
  }
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  /**
109
  * Initializes SEO bar columns.
110
  *
111
  * @since 2.1.9
 
112
  *
113
  * @param object|empty $screen WP_Screen
114
  * @param bool $doing_ajax Whether we're doing an AJAX response.
@@ -129,22 +183,36 @@ class Doing_It_Right extends Generate_Ldjson {
129
  return;
130
 
131
  if ( $doing_ajax ) {
132
- $post_type = isset( $_POST['post_type'] ) ? $_POST['post_type'] : '';
 
133
  } else {
134
  $post_type = isset( $screen->post_type ) ? $screen->post_type : '';
135
  }
136
 
137
- if ( $this->post_type_supports_custom_seo( $post_type ) ) {
138
  if ( $doing_ajax ) {
139
-
140
  //* Nonce is done in $this->init_columns_ajax()
141
- $id = isset( $_POST['screen'] ) ? $_POST['screen'] : false;
142
- $taxonomy = isset( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : false;
143
 
144
- if ( $taxonomy && $id ) {
 
145
  \add_filter( 'manage_' . $id . '_columns', array( $this, 'add_column' ), 1 );
146
- \add_action( 'manage_' . $taxonomy . '_custom_column', array( $this, 'seo_bar_ajax' ), 1, 3 );
 
 
 
 
 
 
 
 
 
147
  }
 
 
 
 
148
  } else {
149
  $id = isset( $screen->id ) ? $screen->id : '';
150
 
@@ -164,7 +232,7 @@ class Doing_It_Right extends Generate_Ldjson {
164
  \add_action( 'manage_pages_custom_column', array( $this, 'seo_bar' ), 1, 3 );
165
  }
166
  }
167
- }
168
  }
169
 
170
  /**
86
  }
87
 
88
  /**
89
+ * Initializes SEO columns for adding a tag or category.
90
  *
91
+ * @since 2.9.1
92
+ * @access private
93
  */
94
+ public function _init_columns_wp_ajax_add_tag() {
95
 
96
  /**
97
  * Securely check the referrer, instead of leaving holes everywhere.
98
  */
99
  if ( $this->doing_ajax() && \check_ajax_referer( 'add-tag', '_wpnonce_add-tag', false ) ) {
100
 
101
+ $taxonomy = ! empty( $_POST['taxonomy'] ) ? \sanitize_key( $_POST['taxonomy'] ) : 'post_tag';
102
  $tax = \get_taxonomy( $taxonomy );
103
 
104
  if ( \current_user_can( $tax->cap->edit_terms ) )
106
  }
107
  }
108
 
109
+ /**
110
+ * Initializes SEO columns for adding a tag or category.
111
+ *
112
+ * @since 2.9.1
113
+ * @access private
114
+ */
115
+ public function _init_columns_wp_ajax_inline_save() {
116
+
117
+ /**
118
+ * Securely check the referrer, instead of leaving holes everywhere.
119
+ */
120
+ if ( $this->doing_ajax() && \check_ajax_referer( 'inlineeditnonce', '_inline_edit', false ) ) {
121
+ $post_type = isset( $_POST['post_type'] ) ? \sanitize_key( $_POST['post_type'] ) : false;
122
+
123
+ if ( $post_type && isset( $_POST['post_ID'] ) ) {
124
+ $post_id = (int) $_POST['post_ID'];
125
+ $access = false;
126
+
127
+ $pto = \get_post_type_object( $post_type );
128
+ if ( isset( $pto->capability_type ) )
129
+ $access = \current_user_can( 'edit_' . $pto->capability_type, $post_id );
130
+
131
+ if ( $access )
132
+ $this->init_columns( '', true );
133
+ }
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Initializes SEO columns for adding a tag or category.
139
+ *
140
+ * @since 2.9.1
141
+ * @access private
142
+ */
143
+ public function _init_columns_wp_ajax_inline_save_tax() {
144
+
145
+ /**
146
+ * Securely check the referrer, instead of leaving holes everywhere.
147
+ */
148
+ if ( $this->doing_ajax() && \check_ajax_referer( 'taxinlineeditnonce', '_inline_edit', false ) ) {
149
+ $taxonomy = \sanitize_key( $_POST['taxonomy'] );
150
+ $tax = \get_taxonomy( $taxonomy );
151
+
152
+ if ( $tax && isset( $_POST['tax_ID'] ) ) {
153
+ $tax_id = (int) $_POST['tax_ID'];
154
+
155
+ if ( \current_user_can( 'edit_term', $tax_id ) )
156
+ $this->init_columns( '', true );
157
+ }
158
+ }
159
+ }
160
+
161
  /**
162
  * Initializes SEO bar columns.
163
  *
164
  * @since 2.1.9
165
+ * @since 2.9.1 Now supports inline edit AJAX.
166
  *
167
  * @param object|empty $screen WP_Screen
168
  * @param bool $doing_ajax Whether we're doing an AJAX response.
183
  return;
184
 
185
  if ( $doing_ajax ) {
186
+ $post_type = isset( $_POST['post_type'] ) ? \sanitize_key( $_POST['post_type'] ) : '';
187
+ $post_type = $post_type ?: ( isset( $_POST['tax_type'] ) ? \sanitize_key( $_POST['tax_type'] ) : '' );
188
  } else {
189
  $post_type = isset( $screen->post_type ) ? $screen->post_type : '';
190
  }
191
 
192
+ if ( $this->post_type_supports_custom_seo( $post_type ) ) :
193
  if ( $doing_ajax ) {
 
194
  //* Nonce is done in $this->init_columns_ajax()
195
+ $id = isset( $_POST['screen'] ) ? \sanitize_key( $_POST['screen'] ) : false;
196
+ $taxonomy = isset( $_POST['taxonomy'] ) ? \sanitize_key( $_POST['taxonomy'] ) : false;
197
 
198
+ if ( $id ) {
199
+ //* Everything but inline-save-tax action.
200
  \add_filter( 'manage_' . $id . '_columns', array( $this, 'add_column' ), 1 );
201
+
202
+ /**
203
+ * Always load pages and posts.
204
+ * Many CPT plugins rely on these.
205
+ */
206
+ \add_action( 'manage_posts_custom_column', array( $this, 'seo_bar_ajax' ), 1, 3 );
207
+ \add_action( 'manage_pages_custom_column', array( $this, 'seo_bar_ajax' ), 1, 3 );
208
+ } elseif ( $taxonomy ) {
209
+ //* Action: inline-save-tax does not POST screen.
210
+ \add_filter( 'manage_edit-' . $taxonomy . '_columns', array( $this, 'add_column' ), 1 );
211
  }
212
+
213
+ if ( $taxonomy )
214
+ \add_action( 'manage_' . $taxonomy . '_custom_column', array( $this, 'seo_bar_ajax' ), 1, 3 );
215
+
216
  } else {
217
  $id = isset( $screen->id ) ? $screen->id : '';
218
 
232
  \add_action( 'manage_pages_custom_column', array( $this, 'seo_bar' ), 1, 3 );
233
  }
234
  }
235
+ endif;
236
  }
237
 
238
  /**
inc/classes/init.class.php CHANGED
@@ -173,7 +173,9 @@ class Init extends Query {
173
  \add_action( 'current_screen', array( $this, 'init_columns' ) );
174
 
175
  //* Ajax handlers for columns.
176
- \add_action( 'wp_ajax_add-tag', array( $this, 'init_columns_ajax' ), -1 );
 
 
177
  }
178
 
179
  if ( $this->load_options ) :
@@ -260,6 +262,7 @@ class Init extends Query {
260
  //* Initialize feed alteration.
261
  \add_action( 'template_redirect', array( $this, '_init_feed_output' ) );
262
 
 
263
  \add_action( 'wp_head', array( $this, 'html_output' ), 1 );
264
  }
265
 
173
  \add_action( 'current_screen', array( $this, 'init_columns' ) );
174
 
175
  //* Ajax handlers for columns.
176
+ \add_action( 'wp_ajax_add-tag', array( $this, '_init_columns_wp_ajax_add_tag' ), -1 );
177
+ \add_action( 'wp_ajax_inline-save', array( $this, '_init_columns_wp_ajax_inline_save' ), -1 );
178
+ \add_action( 'wp_ajax_inline-save-tax', array( $this, '_init_columns_wp_ajax_inline_save_tax' ), -1 );
179
  }
180
 
181
  if ( $this->load_options ) :
262
  //* Initialize feed alteration.
263
  \add_action( 'template_redirect', array( $this, '_init_feed_output' ) );
264
 
265
+ //* Output meta tags.
266
  \add_action( 'wp_head', array( $this, 'html_output' ), 1 );
267
  }
268
 
inc/classes/query.class.php CHANGED
@@ -63,6 +63,17 @@ class Query extends Compat {
63
 
64
  $this->_doing_it_wrong( __METHOD__, "You've initiated a method that uses queries too early.", '2.9.0' );
65
 
 
 
 
 
 
 
 
 
 
 
 
66
  return false;
67
  }
68
 
63
 
64
  $this->_doing_it_wrong( __METHOD__, "You've initiated a method that uses queries too early.", '2.9.0' );
65
 
66
+ //* Backtrace debugging.
67
+ if ( $this->the_seo_framework_debug ) {
68
+ static $_more = true;
69
+ $catch_all = false;
70
+ $depth = 10;
71
+ if ( $catch_all || $_more ) {
72
+ error_log( var_export( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, $depth ), true ) );
73
+ $_more = false;
74
+ }
75
+ }
76
+
77
  return false;
78
  }
79
 
inc/compat/plugin-donncha-dm.php CHANGED
@@ -61,5 +61,9 @@ function _donncha_domainmap_get_url( $path, $get_scheme = false ) {
61
  }
62
  }
63
 
64
- return '';
 
 
 
 
65
  }
61
  }
62
  }
63
 
64
+ if ( $get_scheme ) {
65
+ return array( '', '' );
66
+ } else {
67
+ return '';
68
+ }
69
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://theseoframework.com/donate/
4
  Tags: google, bing, open graph, seo, xml sitemap, breadcrumbs, meta, search engine, pagerank, serp, facebook, twitter
5
  Requires at least: 4.4.0
6
  Tested up to: 4.8.0
7
- Stable tag: 2.9.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -206,6 +206,21 @@ Transporting Terms and Taxonomies SEO data isn't supported.
206
 
207
  == Changelog ==
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  = 2.9.0 - Equitable Erudition =
210
 
211
  *Courage is found in unlikely places - J.R.R. Tolkien*
4
  Tags: google, bing, open graph, seo, xml sitemap, breadcrumbs, meta, search engine, pagerank, serp, facebook, twitter
5
  Requires at least: 4.4.0
6
  Tested up to: 4.8.0
7
+ Stable tag: 2.9.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
206
 
207
  == Changelog ==
208
 
209
+ = 2.9.1 - Sovereign Comprehension =
210
+
211
+ **Release date:**
212
+
213
+ * 27th March 2017
214
+
215
+ **Summarized:**
216
+
217
+ * This release patches a few bugs that were brought with the 2.9.0 release related to debugging and cache clearing.
218
+ * And if you like to use quick edit a lot, the SEO Bar will now also re-render on save.
219
+
220
+ **Detailed log:**
221
+
222
+ ***All we have to decide is what to do with [the time that is given us](https://theseoframework.com/?p=1912#detailed).***
223
+
224
  = 2.9.0 - Equitable Erudition =
225
 
226
  *Courage is found in unlikely places - J.R.R. Tolkien*