diff --git a/includes/MslsAdminIcon.php b/includes/MslsAdminIcon.php index e2615daa..b73f0265 100644 --- a/includes/MslsAdminIcon.php +++ b/includes/MslsAdminIcon.php @@ -1,9 +1,4 @@ - * @since 0.9.8 - */ namespace lloc\Msls; @@ -12,6 +7,7 @@ /** * Handles the icon links in the backend + * * @package Msls */ class MslsAdminIcon { @@ -121,7 +117,7 @@ public function set_icon_type( $icon_type ): MslsAdminIcon { */ public function set_path(): MslsAdminIcon { if ( 'post' != $this->type ) { - $query_vars = [ 'post_type' => $this->type ]; + $query_vars = array( 'post_type' => $this->type ); $this->path = add_query_arg( $query_vars, $this->path ); } @@ -209,12 +205,16 @@ public function get_img(): string { */ public function get_a(): string { if ( empty( $this->href ) ) { - $title = sprintf( __( 'Create a new translation in the %s-blog', 'multisite-language-switcher' ), - $this->language ); + $title = sprintf( + __( 'Create a new translation in the %s-blog', 'multisite-language-switcher' ), + $this->language + ); $href = $this->get_edit_new(); } else { - $title = sprintf( __( 'Edit the translation in the %s-blog', 'multisite-language-switcher' ), - $this->language ); + $title = sprintf( + __( 'Edit the translation in the %s-blog', 'multisite-language-switcher' ), + $this->language + ); $href = $this->href; } @@ -232,21 +232,25 @@ public function get_icon(): string { } switch ( $this->icon_type ) { - case MslsAdminIcon::TYPE_FLAG: - $icon = sprintf( '%s', + case self::TYPE_FLAG: + $icon = sprintf( + '%s', ( new IconSvg() )->get( $this->language ), $this->language ); break; - case MslsAdminIcon::TYPE_LABEL: - $icon = sprintf( '%s', + case self::TYPE_LABEL: + $icon = sprintf( + '%s', $this->language, ( new IconLabel() )->get( $this->language ) ); break; default: - $icon = sprintf( '', - empty( $this->href ) ? 'dashicons-plus' : 'dashicons-edit' ); + $icon = sprintf( + '', + empty( $this->href ) ? 'dashicons-plus' : 'dashicons-edit' + ); } return $icon; @@ -261,7 +265,13 @@ public function get_edit_new(): string { $path = $this->path; if ( null !== $this->id && null !== $this->origin_language ) { - $path = add_query_arg( [ 'msls_id' => $this->id, 'msls_lang' => $this->origin_language ], $this->path ); + $path = add_query_arg( + array( + 'msls_id' => $this->id, + 'msls_lang' => $this->origin_language, + ), + $this->path + ); } /** @@ -275,5 +285,4 @@ public function get_edit_new(): string { return get_admin_url( get_current_blog_id(), $path ); } - } diff --git a/includes/MslsAdminIconTaxonomy.php b/includes/MslsAdminIconTaxonomy.php index 5db43b8e..46e7734d 100644 --- a/includes/MslsAdminIconTaxonomy.php +++ b/includes/MslsAdminIconTaxonomy.php @@ -1,20 +1,17 @@ - * @since 0.9.8 - */ namespace lloc\Msls; /** * Handles backend icons for taxonomies + * * @package Msls */ class MslsAdminIconTaxonomy extends MslsAdminIcon { /** * Path + * * @var string */ protected $path = 'edit-tags.php'; @@ -28,7 +25,7 @@ class MslsAdminIconTaxonomy extends MslsAdminIcon { * @uses get_edit_term_link() */ public function set_href( int $id ): MslsAdminIcon { - $object_type = MslsTaxonomy::instance()->get_post_type(); + $object_type = MslsTaxonomy::instance()->get_post_type(); $this->href = get_edit_term_link( $id, $this->type, $object_type ); @@ -39,17 +36,15 @@ public function set_href( int $id ): MslsAdminIcon { * Set the path by type * * @return MslsAdminIconTaxonomy - * */ public function set_path(): MslsAdminIcon { - $args = [ 'taxonomy' => $this->type ]; + $args = array( 'taxonomy' => $this->type ); $post_type = MslsTaxonomy::instance()->get_post_type(); - $post_type !== '' && $args['post_type'] = $post_type; + $post_type !== '' && $args['post_type'] = $post_type; $this->path = add_query_arg( $args, $this->path ); return $this; } - } diff --git a/includes/MslsOptions.php b/includes/MslsOptions.php index 9a9c7cc7..6fe8f077 100644 --- a/includes/MslsOptions.php +++ b/includes/MslsOptions.php @@ -108,7 +108,7 @@ public static function create( $id = 0 ) { $options = new MslsOptionsPost( get_queried_object_id() ); } - add_filter( 'check_url', array( $options, 'check_for_blog_slug' ), 10, 2 ); + add_filter( 'msls_get_postlink', array( $options, 'check_for_blog_slug' ), 10, 2 ); return $options; } diff --git a/includes/MslsOptionsPost.php b/includes/MslsOptionsPost.php index c60093c9..d9128b55 100644 --- a/includes/MslsOptionsPost.php +++ b/includes/MslsOptionsPost.php @@ -45,7 +45,11 @@ public function get_postlink( $language ) { $this->with_front = ! empty( $post_object->rewrite['with_front'] ); } - return apply_filters( 'check_url', get_permalink( $post ), $this ); + $post_link = get_permalink( $post ); + + $post_link = apply_filters_deprecated( 'check_url', array( $post_link, $this ), '2.7.1', 'msls_get_postlink' ); + + return apply_filters( 'msls_get_postlink', $post_link, $this ); } /** diff --git a/includes/MslsOptionsQuery.php b/includes/MslsOptionsQuery.php index 8e3c6771..f568c9e4 100644 --- a/includes/MslsOptionsQuery.php +++ b/includes/MslsOptionsQuery.php @@ -1,6 +1,7 @@ * @since 0.9.8 */ @@ -16,6 +17,7 @@ class MslsOptionsQuery extends MslsOptions { /** * Rewrite with front + * * @var bool */ public $with_front = true; @@ -61,13 +63,14 @@ public static function create( $id = 0 ) { */ public function get_postlink( $language ) { if ( $this->has_value( $language ) ) { - $link = $this->get_current_link(); - if ( ! empty( $link ) ) { - return apply_filters( 'check_url', $link, $this ); + $post_link = $this->get_current_link(); + if ( ! empty( $post_link ) ) { + $post_link = apply_filters_deprecated( 'check_url', array( $post_link, $this ), '2.7.1', 'msls_get_postlink' ); + + return apply_filters( 'msls_get_postlink', $post_link, $this ); } } return ''; } - } diff --git a/includes/MslsOptionsQueryAuthor.php b/includes/MslsOptionsQueryAuthor.php index dfa0320b..d985f544 100644 --- a/includes/MslsOptionsQueryAuthor.php +++ b/includes/MslsOptionsQueryAuthor.php @@ -1,6 +1,7 @@ * @since 0.9.8 */ @@ -15,7 +16,7 @@ class MslsOptionsQueryAuthor extends MslsOptionsQuery { /** - * Check if the array has an non empty item which has $language as a key + * Check if the array has a non-empty item which has $language as a key * * @param string $language * @@ -44,5 +45,4 @@ public function has_value( $language ) { public function get_current_link() { return get_author_posts_url( $this->get_arg( 0, 0 ) ); } - } diff --git a/includes/MslsOptionsTax.php b/includes/MslsOptionsTax.php index a2117a77..5921e3aa 100644 --- a/includes/MslsOptionsTax.php +++ b/includes/MslsOptionsTax.php @@ -1,6 +1,7 @@ * @since 0.9.8 */ @@ -9,18 +10,21 @@ /** * Taxonomy options + * * @package Msls */ class MslsOptionsTax extends MslsOptions { /** * Separator + * * @var string */ protected $sep = '_term_'; /** * Autoload + * * @var string */ protected $autoload = 'no'; @@ -58,7 +62,7 @@ public static function create( $id = 0 ) { } if ( $req ) { - add_filter( 'check_url', [ $options, 'check_base' ], 9, 2 ); + add_filter( 'msls_get_postlink', array( $options, 'check_base' ), 9, 2 ); } else { global $wp_rewrite; @@ -70,6 +74,7 @@ public static function create( $id = 0 ) { /** * Get the queried taxonomy + * * @return string */ public function get_tax_query() { @@ -92,17 +97,20 @@ public function get_tax_query() { * @return string */ public function get_postlink( $language ) { - $url = ''; + $post_link = ''; if ( $this->has_value( $language ) ) { - $url = $this->get_term_link( (int) $this->__get( $language ) ); + $post_link = $this->get_term_link( (int) $this->__get( $language ) ); } - return apply_filters( 'check_url', $url, $this ); + $post_link = apply_filters_deprecated( 'check_url', array( $post_link, $this ), '2.7.1', 'msls_get_postlink' ); + + return apply_filters( 'msls_get_postlink', $post_link, $this ); } /** * Get current link + * * @return string */ public function get_current_link() { @@ -129,5 +137,4 @@ public function get_term_link( $term_id ) { return ''; } - }