Skip to content

Commit

Permalink
4.1.4 Release client 1. Improved performance. Added filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
sybrew committed Jul 19, 2021
1 parent 70f932b commit 1f36c92
Show file tree
Hide file tree
Showing 15 changed files with 191 additions and 145 deletions.
2 changes: 1 addition & 1 deletion autodescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: The SEO Framework
* Plugin URI: https://theseoframework.com/
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for your WordPress website.
* Version: 4.1.4-beta-2
* Version: 4.1.4-RC-1
* Author: The SEO Framework Team
* Author URI: https://theseoframework.com/
* License: GPLv3
Expand Down
1 change: 1 addition & 0 deletions inc/classes/admin-pages.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public function _init_term_edit_view() {
* Prepares profile/user edit view, like outputting the SEO fields.
*
* @since 4.1.4
* @access private
*/
public function _init_user_edit_view() {

Expand Down
6 changes: 3 additions & 3 deletions inc/classes/bridges/usersettings.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ final class UserSettings {
* Prepares the user setting fields.
*
* @since 4.1.4
* @access private
*
* @param \WP_User $user WP_User object.
*/
public static function _prepare_setting_fields( \WP_User $user ) {

if ( ! $user->has_cap( THE_SEO_FRAMEWORK_AUTHOR_INFO_CAP ) ) return;

static::_add_user_author_fields( $user );
static::add_user_author_fields( $user );
}

/**
* Outputs user profile fields.
*
* @since 4.1.4
* @access private
*
* @param \WP_User $user WP_User object.
*/
public static function _add_user_author_fields( \WP_User $user ) {
private static function add_user_author_fields( \WP_User $user ) {
/**
* @since 4.1.4
*/
Expand Down
2 changes: 1 addition & 1 deletion inc/classes/builders/sitemap.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected function create_xml_entry( $data, $level = 1 ) {
* 3. First parameter can now be a post object.
* 4. If the first parameter is 0, it's now indicative of a home-as-blog page.
* 5. Moved to \The_SEO_Framework\Builders\Sitemap
* @since 4.1.4 TRUE: Now tests for redirect settings.
* @since 4.1.4 TRUE: Now tests for redirect settings.
*
* @param int $post_id The Post ID to check.
* @return bool True if included, false otherwise.
Expand Down
13 changes: 7 additions & 6 deletions inc/classes/cache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ public function delete_excluded_post_ids_transient() {
*
* @since 2.8.0
* @since 2.9.3 $type = 'front' now also returns true.
* @since 3.1.0 Added action.
* @since 3.1.0 1. Added action.
* 2. Removed support for $type 'detection'.
* @since 4.0.5 Removed all JSON-LD transient clear calls.
* @since 4.1.4 The following $types are no longer supported: 'front', 'post', 'term', 'author', 'robots', 'object'.
* @since 4.1.4 The following $type's are no longer supported: 'front', 'post', 'term', 'author', 'robots', 'object'.
*
* @param string $type The type
* @param int $id The post, page or TT ID. Defaults to $this->get_the_real_ID().
Expand All @@ -183,9 +184,6 @@ public function delete_cache( $type, $id = 0, array $args = [] ) {
$success = $this->delete_excluded_post_ids_transient();
break;

case 'detection':
break;

default:
break;
endswitch;
Expand Down Expand Up @@ -455,7 +453,10 @@ public function delete_sitemap_transient() {
*/
public function get_excluded_ids_from_cache() {

if ( $this->is_headless['meta'] ) return [];
if ( $this->is_headless['meta'] ) return [
'archive' => '',
'search' => '',
];

static $cache = null;

Expand Down
2 changes: 1 addition & 1 deletion inc/classes/core.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public function uses_time_in_timestamp_format() {
*
* @since 4.1.4
*
* @param array ...$arrays The arrays to merge. The rightmost array .
* @param array ...$arrays The arrays to merge. The rightmost array's values are dominant.
* @return array The merged arrays.
*/
public function array_merge_recursive_distinct( array ...$arrays ) {
Expand Down
4 changes: 2 additions & 2 deletions inc/classes/generate-ldjson.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ public function get_ld_json_website() {
$alternate_name = $kname && $kname !== $blogname ? $kname : '';

$data += [
'name' => $this->escape_title( $blogname ),
'alternateName' => $this->escape_title( $alternate_name ),
'name' => \strlen( $blogname ) ? $this->escape_title( $blogname ) : '',
'alternateName' => \strlen( $alternate_name ) ? $this->escape_title( $alternate_name ) : '',
];

//= The searchbox part.
Expand Down
5 changes: 2 additions & 3 deletions inc/classes/init.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ public function init_cron_actions() {
* Initializes AJAX actions.
*
* @since 4.1.4
* TODO make protected?
*/
public function init_ajax_actions() {
protected function init_ajax_actions() {

// Admin AJAX for notice dismissal.
\add_action( 'wp_ajax_tsf_dismiss_notice', '\The_SEO_Framework\Bridges\AJAX::_wp_ajax_dismiss_notice' );
Expand Down Expand Up @@ -1041,7 +1040,7 @@ protected function is_query_adjustment_blocked( $wp_query ) {
* WordPress should've authenthicated the user at
* WP_REST_Server::check_authentication() -> rest_cookie_check_errors() -> wp_nonce et al.
* before executing the query. For REST_REQUEST can not be true otherwise. Ergo,
* \current_user_can() should work. If it returns true, can trust it's a safe request.
* \current_user_can() should work. If it returns true, we can trust it's a safe request.
* If it returns false, the user may still be logged in, but the request isn't sent via
* WordPress's API with the proper nonces supplied. This is as perfect as it can be.
*/
Expand Down
24 changes: 20 additions & 4 deletions inc/classes/post-data.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,36 @@ public function get_post_meta( $post_id, $use_cache = true ) {
* @return array The default post meta.
*/
public function get_post_meta_defaults( $post_id = 0 ) {

/**
* @since 3.1.0
* @since 4.1.4
* @param array $defaults
* @param integer $post_id Post ID.
* @param \WP_Post $post Post object.
*/
return (array) \apply_filters_ref_array(
'the_seo_framework_inpost_seo_save_defaults', // TODO rename to the_seo_framework_post_meta_defaults. 4.1.0?
$defaults = (array) \apply_filters_ref_array(
'the_seo_framework_post_meta_defaults',
[
$this->get_unfiltered_post_meta_defaults(),
$post_id,
\get_post( $post_id ),
$post = \get_post( $post_id ),
]
);

/**
* @since 3.1.0
* @since 4.1.4 Deprecated. Use filter `the_seo_framework_post_meta_defaults` instead.
* @deprecated
* @param array $defaults
* @param integer $post_id Post ID.
* @param \WP_Post $post Post object.
*/
return (array) \apply_filters_deprecated(
'the_seo_framework_inpost_seo_save_defaults',
[ $defaults, $post_id, $post ],
'4.1.4 of The SEO Framework',
'the_seo_framework_post_meta_defaults'
);
}

/**
Expand Down
14 changes: 10 additions & 4 deletions inc/classes/query.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ public function is_blog_page( $id = 0 ) {
* Checks blog page by sole ID.
*
* @since 4.0.0
* @since 4.1.4 Improved performance by switching the conditional.
* @since 4.1.4 1. Improved performance by switching the conditional.
* 2. Improved performance by adding memoization.
* @todo deprecate
* @see is_wc_shop() -- that's the correct implementation.
*
Expand All @@ -610,7 +611,12 @@ public function is_blog_page_by_id( $id ) {
// ID 0 cannot be a blog page.
if ( ! $id ) return false;

return (int) \get_option( 'page_for_posts' ) === $id;
static $pfp = null;

if ( \is_null( $pfp ) )
$pfp = (int) \get_option( 'page_for_posts' );

return $pfp === $id;
}

/**
Expand Down Expand Up @@ -1045,9 +1051,9 @@ public function is_static_frontpage( $id = 0 ) {
static $front_id;

if ( ! isset( $front_id ) )
$front_id = 'page' === \get_option( 'show_on_front' ) ? (int) \get_option( 'page_on_front' ) : -1;
$front_id = 'page' === \get_option( 'show_on_front' ) ? (int) \get_option( 'page_on_front' ) : false;

return ( $id ?: $this->get_the_real_ID() ) === $front_id;
return false !== $front_id && ( $id ?: $this->get_the_real_ID() ) === $front_id;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions inc/compat/plugin-edd.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ function _set_edd_is_product( $is_product, $post ) {

if ( ! $is_product ) {
if ( \function_exists( 'edd_get_download' ) ) {
$post_id = $post ? \get_post( $post ) : \the_seo_framework()->get_the_real_ID();
$download = \edd_get_download( $post_id );
$download = \edd_get_download(
$post ? \get_post( $post ) : \the_seo_framework()->get_the_real_ID()
);

$is_product = ! empty( $download->ID );
}
Expand Down
4 changes: 0 additions & 4 deletions inc/compat/plugin-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ function _set_wc_is_shop( $is_shop, $post ) {
if ( isset( $post ) ) {
$post = \get_post( $post );
$id = $post ? $post->ID : 0;
} else {
$id = null;
}

if ( isset( $id ) ) {
$is_shop = (int) \get_option( 'woocommerce_shop_page_id' ) === $id;
} else {
$is_shop = ! \is_admin() && \function_exists( 'is_shop' ) && \is_shop();
Expand Down
2 changes: 1 addition & 1 deletion inc/functions/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
* @since 2.3.5 Emptied. (~2.5 months later)
* @since 2.6.2 Emptied. (~6 months later)
* @since 2.9.2 Emptied. (~8 months later)
* @since 4.1.4 Emptied. (~22 months after 3.1.0 deprecations)
* @since 4.1.4 Emptied. (~22 months after the 3.1.0 deprecations)
*/
14 changes: 7 additions & 7 deletions inc/views/profile/author.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
defined( 'THE_SEO_FRAMEWORK_PRESENT' ) and the_seo_framework()->_verify_include_secret( $_secret ) or die;

$fields = [
'tsf-user-meta[facebook_page]' => (object) [
'tsf-user-meta[facebook_page]' => [
'name' => __( 'Facebook profile page', 'autodescription' ),
'type' => 'url',
'placeholder' => _x( 'https://www.facebook.com/YourPersonalProfile', 'Example Facebook Personal URL', 'autodescription' ),
'value' => $this->get_user_meta_item( 'facebook_page', $user->ID ),
'class' => '',
],
'tsf-user-meta[twitter_page]' => (object) [
'tsf-user-meta[twitter_page]' => [
'name' => __( 'Twitter profile name', 'autodescription' ),
'type' => 'text',
'placeholder' => _x( '@your-personal-username', 'Twitter @username', 'autodescription' ),
Expand All @@ -34,16 +34,16 @@
?>
<tr class="user-<?php echo esc_attr( $field ); ?>-wrap">
<th><label for="<?php echo esc_attr( $field ); ?>">
<?php echo esc_html( $labels->name ); ?>
<?php echo esc_html( $labels['name'] ); ?>
</label></th>
<td>
<input
type="<?php echo esc_attr( $labels->type ); ?>"
type="<?php echo esc_attr( $labels['type'] ); ?>"
name="<?php echo esc_attr( $field ); ?>"
id="<?php echo esc_attr( $field ); ?>"
value="<?php echo esc_attr( $labels->value ); ?>"
placeholder="<?php echo esc_attr( $labels->placeholder ); ?>"
class="regular-text <?php echo esc_attr( $labels->class ); ?>" />
value="<?php echo esc_attr( $labels['value'] ); ?>"
placeholder="<?php echo esc_attr( $labels['placeholder'] ); ?>"
class="regular-text <?php echo esc_attr( $labels['class'] ); ?>" />
<p class="description"><?php esc_html_e( 'This may be shown publicly.', 'autodescription' ); ?></p>
</td>
</tr>
Expand Down
Loading

0 comments on commit 1f36c92

Please sign in to comment.