Submit
Path:
~
/
home
/
getwphos
/
www
/
shellfish
/
wp-content
/
plugins
/
wordpress-seo
/
admin
/
File Content:
class-admin-recommended-replace-vars.php
<?php /** * WPSEO plugin file. * * @package WPSEO\Admin */ /** * Determines the recommended replacement variables based on the context. */ class WPSEO_Admin_Recommended_Replace_Vars { /** * The recommended replacement variables. * * @var array */ protected $recommended_replace_vars = [ // Posts types. 'page' => [ 'sitename', 'title', 'sep', 'primary_category' ], 'post' => [ 'sitename', 'title', 'sep', 'primary_category' ], // Homepage. 'homepage' => [ 'sitename', 'sitedesc', 'sep' ], // Custom post type. 'custom_post_type' => [ 'sitename', 'title', 'sep' ], // Taxonomies. 'category' => [ 'sitename', 'term_title', 'sep', 'term_hierarchy' ], 'post_tag' => [ 'sitename', 'term_title', 'sep' ], 'post_format' => [ 'sitename', 'term_title', 'sep', 'page' ], // Custom taxonomy. 'term-in-custom-taxonomy' => [ 'sitename', 'term_title', 'sep', 'term_hierarchy' ], // Settings - archive pages. 'author_archive' => [ 'sitename', 'title', 'sep', 'page' ], 'date_archive' => [ 'sitename', 'sep', 'date', 'page' ], 'custom-post-type_archive' => [ 'sitename', 'title', 'sep', 'page' ], // Settings - special pages. 'search' => [ 'sitename', 'searchphrase', 'sep', 'page' ], '404' => [ 'sitename', 'sep' ], ]; /** * Determines the page type of the current term. * * @param string $taxonomy The taxonomy name. * * @return string The page type. */ public function determine_for_term( $taxonomy ) { $recommended_replace_vars = $this->get_recommended_replacevars(); if ( array_key_exists( $taxonomy, $recommended_replace_vars ) ) { return $taxonomy; } return 'term-in-custom-taxonomy'; } /** * Determines the page type of the current post. * * @param WP_Post $post A WordPress post instance. * * @return string The page type. */ public function determine_for_post( $post ) { if ( $post instanceof WP_Post === false ) { return 'post'; } if ( $post->post_type === 'page' && $this->is_homepage( $post ) ) { return 'homepage'; } $recommended_replace_vars = $this->get_recommended_replacevars(); if ( array_key_exists( $post->post_type, $recommended_replace_vars ) ) { return $post->post_type; } return 'custom_post_type'; } /** * Determines the page type for a post type. * * @param string $post_type The name of the post_type. * @param string $fallback The page type to fall back to. * * @return string The page type. */ public function determine_for_post_type( $post_type, $fallback = 'custom_post_type' ) { $page_type = $post_type; $recommended_replace_vars = $this->get_recommended_replacevars(); $has_recommended_replacevars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type ); if ( ! $has_recommended_replacevars ) { return $fallback; } return $page_type; } /** * Determines the page type for an archive page. * * @param string $name The name of the archive. * @param string $fallback The page type to fall back to. * * @return string The page type. */ public function determine_for_archive( $name, $fallback = 'custom-post-type_archive' ) { $page_type = $name . '_archive'; $recommended_replace_vars = $this->get_recommended_replacevars(); $has_recommended_replacevars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type ); if ( ! $has_recommended_replacevars ) { return $fallback; } return $page_type; } /** * Retrieves the recommended replacement variables for the given page type. * * @param string $page_type The page type. * * @return array The recommended replacement variables. */ public function get_recommended_replacevars_for( $page_type ) { $recommended_replace_vars = $this->get_recommended_replacevars(); $has_recommended_replace_vars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type ); if ( ! $has_recommended_replace_vars ) { return []; } return $recommended_replace_vars[ $page_type ]; } /** * Retrieves the recommended replacement variables. * * @return array The recommended replacement variables. */ public function get_recommended_replacevars() { /** * Filter: Adds the possibility to add extra recommended replacement variables. * * @param array $additional_replace_vars Empty array to add the replacevars to. */ $recommended_replace_vars = apply_filters( 'wpseo_recommended_replace_vars', $this->recommended_replace_vars ); if ( ! is_array( $recommended_replace_vars ) ) { return $this->recommended_replace_vars; } return $recommended_replace_vars; } /** * Returns whether the given page type has recommended replace vars. * * @param array $recommended_replace_vars The recommended replace vars * to check in. * @param string $page_type The page type to check. * * @return bool True if there are associated recommended replace vars. */ private function has_recommended_replace_vars( $recommended_replace_vars, $page_type ) { if ( ! isset( $recommended_replace_vars[ $page_type ] ) ) { return false; } if ( ! is_array( $recommended_replace_vars[ $page_type ] ) ) { return false; } return true; } /** * Determines whether or not a post is the homepage. * * @param WP_Post $post The WordPress global post object. * * @return bool True if the given post is the homepage. */ private function is_homepage( $post ) { if ( $post instanceof WP_Post === false ) { return false; } /* * The page on front returns a string with normal WordPress interaction, while the post ID is an int. * This way we make sure we always compare strings. */ $post_id = (int) $post->ID; $page_on_front = (int) get_option( 'page_on_front' ); return get_option( 'show_on_front' ) === 'page' && $page_on_front === $post_id; } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
ajax
---
0755
capabilities
---
0755
endpoints
---
0755
exceptions
---
0755
filters
---
0755
formatter
---
0755
google_search_console
---
0755
import
---
0755
listeners
---
0755
menu
---
0755
metabox
---
0755
notifiers
---
0755
pages
---
0755
roles
---
0755
services
---
0755
statistics
---
0755
taxonomy
---
0755
tracking
---
0755
views
---
0755
watchers
---
0755
admin-settings-changed-listener.php
2445 bytes
0644
ajax.php
11509 bytes
0644
class-admin-asset-analysis-worker-location.php
1849 bytes
0644
class-admin-asset-dev-server-location.php
1672 bytes
0644
class-admin-asset-location.php
488 bytes
0644
class-admin-asset-manager.php
19717 bytes
0644
class-admin-asset-seo-location.php
2126 bytes
0644
class-admin-editor-specific-replace-vars.php
6495 bytes
0644
class-admin-gutenberg-compatibility-notification.php
2610 bytes
0644
class-admin-help-panel.php
2760 bytes
0644
class-admin-init.php
10970 bytes
0644
class-admin-recommended-replace-vars.php
6128 bytes
0644
class-admin-user-profile.php
3323 bytes
0644
class-admin-utils.php
2196 bytes
0644
class-admin.php
13447 bytes
0644
class-asset.php
4405 bytes
0644
class-bulk-description-editor-list-table.php
2100 bytes
0644
class-bulk-editor-list-table.php
30105 bytes
0644
class-bulk-title-editor-list-table.php
2286 bytes
0644
class-collector.php
1005 bytes
0644
class-config.php
5207 bytes
0644
class-database-proxy.php
7684 bytes
0644
class-export.php
3541 bytes
0644
class-expose-shortlinks.php
8791 bytes
0644
class-gutenberg-compatibility.php
2529 bytes
0644
class-meta-columns.php
25474 bytes
0644
class-my-yoast-proxy.php
6287 bytes
0644
class-option-tab.php
2268 bytes
0644
class-option-tabs-formatter.php
2905 bytes
0644
class-option-tabs.php
2311 bytes
0644
class-paper-presenter.php
3600 bytes
0644
class-plugin-availability.php
10296 bytes
0644
class-plugin-conflict.php
4141 bytes
0644
class-premium-popup.php
2874 bytes
0644
class-premium-upsell-admin-block.php
5236 bytes
0644
class-primary-term-admin.php
7524 bytes
0644
class-product-upsell-notice.php
5886 bytes
0644
class-remote-request.php
3203 bytes
0644
class-schema-person-upgrade-notification.php
2284 bytes
0644
class-suggested-plugins.php
4429 bytes
0644
class-wincher-dashboard-widget.php
3615 bytes
0644
class-yoast-columns.php
3602 bytes
0644
class-yoast-dashboard-widget.php
4055 bytes
0644
class-yoast-form.php
36591 bytes
0644
class-yoast-input-validation.php
7357 bytes
0644
class-yoast-network-admin.php
10208 bytes
0644
class-yoast-network-settings-api.php
4276 bytes
0644
class-yoast-notification-center.php
26710 bytes
0644
class-yoast-notification.php
10054 bytes
0644
class-yoast-notifications.php
7812 bytes
0644
class-yoast-plugin-conflict.php
10576 bytes
0644
index.php
38 bytes
0644
interface-collection.php
257 bytes
0644
interface-installable.php
254 bytes
0644
N4ST4R_ID | Naxtarrr