plugin updates
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Addon_Installation;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Addon_Activation_Error_Exception
|
||||
*/
|
||||
class Addon_Activation_Error_Exception extends Exception {}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Addon_Installation;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Addon_Already_Installed_Exception
|
||||
*/
|
||||
class Addon_Already_Installed_Exception extends Exception {}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Addon_Installation;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Addon_Installation_Error
|
||||
*/
|
||||
class Addon_Installation_Error_Exception extends Exception {}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Addon_Installation;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class User_Cannot_Activate_Plugins
|
||||
*/
|
||||
class User_Cannot_Activate_Plugins_Exception extends Exception {}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Addon_Installation;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class User_Cannot_Install_Plugins_Exception
|
||||
*/
|
||||
class User_Cannot_Install_Plugins_Exception extends Exception {}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Exception for attempting a mutation on properties that are made readonly through magic getters and setters.
|
||||
*/
|
||||
class Forbidden_Property_Mutation_Exception extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Creates a Forbidden_Property_Mutation_Exception exception when an attempt is made
|
||||
* to assign a value to an immutable property.
|
||||
*
|
||||
* @param string $property_name The name of the immutable property.
|
||||
*
|
||||
* @return Forbidden_Property_Mutation_Exception The exception.
|
||||
*/
|
||||
public static function cannot_set_because_property_is_immutable( $property_name ) {
|
||||
return new self( \sprintf( 'Setting property $%s is not supported.', $property_name ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Forbidden_Property_Mutation_Exception exception when an attempt is made to unset an immutable property.
|
||||
*
|
||||
* @param string $property_name The name of the immutable property.
|
||||
*
|
||||
* @return Forbidden_Property_Mutation_Exception The exception.
|
||||
*/
|
||||
public static function cannot_unset_because_property_is_immutable( $property_name ) {
|
||||
return new self( \sprintf( 'Unsetting property $%s is not supported.', $property_name ) );
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Importing;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Aioseo_Validation_Exception
|
||||
*/
|
||||
class Aioseo_Validation_Exception extends Exception {
|
||||
|
||||
/**
|
||||
* Exception that is thrown whenever validation of the
|
||||
* AIOSEO data structure has failed.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct( \esc_html__( 'The validation of the AIOSEO data structure has failed.', 'wordpress-seo' ) );
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* For when an author indexable is not being built.
|
||||
*/
|
||||
class Author_Not_Built_Exception extends Not_Built_Exception {
|
||||
|
||||
/**
|
||||
* Named constructor for creating an Author_Not_Built_Exception
|
||||
* when author archives are disabled for users without posts.
|
||||
*
|
||||
* @param string $user_id The user id.
|
||||
*
|
||||
* @return Author_Not_Built_Exception The exception.
|
||||
*/
|
||||
public static function author_archives_are_not_indexed_for_users_without_posts( $user_id ) {
|
||||
return new self(
|
||||
'Indexable for author with id ' . $user_id . ' is not being built, since author archives are not indexed for users without posts.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Named constructor for creating an Author_Not_Built_Exception
|
||||
* when author archives are disabled.
|
||||
*
|
||||
* @param string $user_id The user id.
|
||||
*
|
||||
* @return Author_Not_Built_Exception The exception.
|
||||
*/
|
||||
public static function author_archives_are_disabled( $user_id ) {
|
||||
return new self(
|
||||
'Indexable for author with id ' . $user_id . ' is not being built, since author archives are disabled.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Named constructor for creating an Author_Not_Build_Exception
|
||||
* when an author is excluded because of the `'wpseo_should_build_and_save_user_indexable'` filter.
|
||||
*
|
||||
* @param string $user_id The user id.
|
||||
*
|
||||
* @return Author_Not_Built_Exception The exception.
|
||||
*/
|
||||
public static function author_not_built_because_of_filter( $user_id ) {
|
||||
return new self(
|
||||
'Indexable for author with id ' . $user_id . ' is not being built, since it is excluded because of the \'wpseo_should_build_and_save_user_indexable\' filter.'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Indexable_Exception
|
||||
*/
|
||||
abstract class Indexable_Exception extends Exception {
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* Exception that can be thrown whenever a term is considered invalid by WordPress
|
||||
* within the context of the indexables.
|
||||
*/
|
||||
class Invalid_Term_Exception extends Source_Exception {
|
||||
|
||||
/**
|
||||
* Exception that can be thrown whenever a term is considered invalid by WordPress
|
||||
* within the context of the indexables.
|
||||
*
|
||||
* @param string $reason The reason given by WordPress why the term is invalid.
|
||||
*/
|
||||
public function __construct( $reason ) {
|
||||
parent::__construct(
|
||||
\sprintf(
|
||||
/* translators: %s is the reason given by WordPress. */
|
||||
\esc_html__( 'The term is considered invalid. The following reason was given by WordPress: %s', 'wordpress-seo' ),
|
||||
$reason
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* Class Not_Built_Exception
|
||||
*/
|
||||
class Not_Built_Exception extends Indexable_Exception {
|
||||
|
||||
/**
|
||||
* Creates an exception that should be thrown when an indexable
|
||||
* was not built because of an invalid object id.
|
||||
*
|
||||
* @param int $object_id The invalid object id.
|
||||
*
|
||||
* @return Not_Built_Exception The exception.
|
||||
*/
|
||||
public static function invalid_object_id( $object_id ) {
|
||||
return new self(
|
||||
"Indexable was not built because it had an invalid object id of $object_id."
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* Exception that is thrown whenever a post could not be built
|
||||
* in the context of the indexables.
|
||||
*/
|
||||
class Post_Not_Built_Exception extends Not_Built_Exception {
|
||||
|
||||
/**
|
||||
* Throws an exception if the post is not indexable.
|
||||
*
|
||||
* @param int $post_id ID of the post.
|
||||
*
|
||||
* @return Post_Not_Built_Exception
|
||||
*/
|
||||
public static function because_not_indexable( $post_id ) {
|
||||
/* translators: %s: expands to the post id */
|
||||
return new self( \sprintf( \__( 'The post %s could not be indexed because it does not meet indexing requirements.', 'wordpress-seo' ), $post_id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an exception if the post type is excluded from indexing.
|
||||
*
|
||||
* @param int $post_id ID of the post.
|
||||
*
|
||||
* @return Post_Not_Built_Exception
|
||||
*/
|
||||
public static function because_post_type_excluded( $post_id ) {
|
||||
/* translators: %s: expands to the post id */
|
||||
return new self( \sprintf( \__( 'The post %s could not be indexed because it\'s post type is excluded from indexing.', 'wordpress-seo' ), $post_id ) );
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* Exception that is thrown whenever a post could not be found
|
||||
* in the context of the indexables.
|
||||
*/
|
||||
class Post_Not_Found_Exception extends Source_Exception {
|
||||
|
||||
/**
|
||||
* Exception that is thrown whenever a post could not be found
|
||||
* in the context of the indexables.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct( \__( 'The post could not be found.', 'wordpress-seo' ) );
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* Exception that is thrown whenever a post type could not be built
|
||||
* in the context of the indexables.
|
||||
*/
|
||||
class Post_Type_Not_Built_Exception extends Not_Built_Exception {
|
||||
|
||||
/**
|
||||
* Throws an exception if the post is not indexable.
|
||||
*
|
||||
* @param string $post_type The post type.
|
||||
*
|
||||
* @return Post_Type_Not_Built_Exception
|
||||
*/
|
||||
public static function because_not_indexable( $post_type ) {
|
||||
/* translators: %s: expands to the post type */
|
||||
return new self( \sprintf( \__( 'The post type %s could not be indexed because it does not meet indexing requirements.', 'wordpress-seo' ), $post_type ) );
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* Class Indexable_Source_Exception
|
||||
*/
|
||||
class Source_Exception extends Indexable_Exception {
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* Exception that is thrown whenever a term could not be built
|
||||
* in the context of the indexables.
|
||||
*/
|
||||
class Term_Not_Built_Exception extends Not_Built_Exception {
|
||||
|
||||
/**
|
||||
* Throws an exception if the term is not indexable.
|
||||
*
|
||||
* @param int $term_id ID of the term.
|
||||
*
|
||||
* @return Term_Not_Built_Exception
|
||||
*/
|
||||
public static function because_not_indexable( $term_id ) {
|
||||
/* translators: %s: expands to the term id */
|
||||
return new self( \sprintf( \__( 'The term %s could not be built because it\'s not indexable.', 'wordpress-seo' ), $term_id ) );
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\Indexable;
|
||||
|
||||
/**
|
||||
* Exception that is thrown whenever a term could not be found
|
||||
* in the context of the indexables.
|
||||
*/
|
||||
class Term_Not_Found_Exception extends Source_Exception {
|
||||
|
||||
/**
|
||||
* Exception that is thrown whenever a term could not be found
|
||||
* in the context of the indexables.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct( \__( 'The term could not be found.', 'wordpress-seo' ) );
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Exception to use when a method does not exist.
|
||||
*/
|
||||
class Missing_Method extends Exception {
|
||||
|
||||
/**
|
||||
* Creates exception for a method that does not exist in a class.
|
||||
*
|
||||
* @param string $method The method that does not exist.
|
||||
* @param string $class_name The class name.
|
||||
*
|
||||
* @return static Instance of the exception.
|
||||
*/
|
||||
public static function for_class( $method, $class_name ) {
|
||||
return new static(
|
||||
\sprintf(
|
||||
/* translators: %1$s expands to the method name. %2$s expands to the class name */
|
||||
\__( 'Method %1$s() does not exist in class %2$s', 'wordpress-seo' ),
|
||||
$method,
|
||||
$class_name
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\OAuth;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Authentication_Failed_Exception
|
||||
*/
|
||||
class Authentication_Failed_Exception extends Exception {
|
||||
|
||||
/**
|
||||
* Authentication_Failed_Exception constructor.
|
||||
*
|
||||
* @param Exception $original_exception The original exception.
|
||||
*/
|
||||
public function __construct( Exception $original_exception ) {
|
||||
parent::__construct( 'Authentication failed', 401, $original_exception );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted response object.
|
||||
*
|
||||
* @return object The response object.
|
||||
*/
|
||||
public function get_response() {
|
||||
return (object) [
|
||||
'tokens' => [],
|
||||
'error' => $this->getMessage() . ': ' . $this->getPrevious()->getMessage(),
|
||||
'status' => $this->getCode(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\OAuth\Tokens;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Empty_Property_Exception
|
||||
*/
|
||||
class Empty_Property_Exception extends Exception {
|
||||
|
||||
/**
|
||||
* Empty_Property_Exception constructor.
|
||||
*
|
||||
* @param string $property The property that is empty.
|
||||
*/
|
||||
public function __construct( $property ) {
|
||||
parent::__construct( \sprintf( 'Token creation failed. Property `%s` cannot be empty.', $property ), 400 );
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\OAuth\Tokens;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Empty_Token_Exception
|
||||
*/
|
||||
class Empty_Token_Exception extends Exception {
|
||||
|
||||
/**
|
||||
* Empty_Token_Exception constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct( 'Token usage failed. Token is empty.', 400 );
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Exceptions\OAuth\Tokens;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Failed_Storage_Exception
|
||||
*/
|
||||
class Failed_Storage_Exception extends Exception {
|
||||
|
||||
public const DEFAULT_MESSAGE = 'Token storing failed. Please try again.';
|
||||
|
||||
/**
|
||||
* Failed_Storage_Exception constructor.
|
||||
*
|
||||
* @param string $reason The reason why token storage failed. Optional.
|
||||
*/
|
||||
public function __construct( $reason = '' ) {
|
||||
$message = ( $reason ) ? \sprintf( 'Token storing failed. Reason: %s. Please try again', $reason ) : self::DEFAULT_MESSAGE;
|
||||
|
||||
parent::__construct( $message, 500 );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user