Submit
Path:
~
/
home
/
getwphos
/
www
/
radkingpanels
/
wp-content
/
plugins
/
wordpress-seo
/
src
/
integrations
/
watchers
/
File Content:
indexable-static-home-page-watcher.php
<?php namespace Yoast\WP\SEO\Integrations\Watchers; use Yoast\WP\SEO\Conditionals\Admin_Conditional; use Yoast\WP\SEO\Integrations\Integration_Interface; use Yoast\WP\SEO\Repositories\Indexable_Repository; /** * Watcher that checks for changes in the page used as homepage. * * Watches the static homepage option and updates the permalinks accordingly. */ class Indexable_Static_Home_Page_Watcher implements Integration_Interface { /** * The indexable repository. * * @var Indexable_Repository */ protected $repository; /** * Returns the conditionals based on which this loadable should be active. * * @return array */ public static function get_conditionals() { return [ Admin_Conditional::class ]; } /** * Indexable_Static_Home_Page_Watcher constructor. * * @codeCoverageIgnore * * @param Indexable_Repository $repository The repository to use. */ public function __construct( Indexable_Repository $repository ) { $this->repository = $repository; } /** * Initializes the integration. * * This is the place to register hooks and filters. * * @return void */ public function register_hooks() { \add_action( 'update_option_page_on_front', [ $this, 'update_static_homepage_permalink' ], 10, 2 ); } /** * Updates the new and previous homepage's permalink when the static home page is updated. * * @param string $old_value The previous homepage's ID. * @param int $value The new homepage's ID. * * @return void */ public function update_static_homepage_permalink( $old_value, $value ) { if ( \is_string( $old_value ) ) { $old_value = (int) $old_value; } if ( $old_value === $value ) { return; } $this->update_permalink_for_page( $old_value ); $this->update_permalink_for_page( $value ); } /** * Updates the permalink based on the selected homepage settings. * * @param int $page_id The page's id. * * @return void */ private function update_permalink_for_page( $page_id ) { if ( $page_id === 0 ) { return; } $indexable = $this->repository->find_by_id_and_type( $page_id, 'post', false ); if ( $indexable === false ) { return; } $indexable->permalink = \get_permalink( $page_id ); $indexable->save(); } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
addon-update-watcher.php
7309 bytes
0644
auto-update-watcher.php
1530 bytes
0644
indexable-ancestor-watcher.php
8415 bytes
0644
indexable-attachment-watcher.php
4881 bytes
0644
indexable-author-archive-watcher.php
2382 bytes
0644
indexable-author-watcher.php
3592 bytes
0644
indexable-category-permalink-watcher.php
1780 bytes
0644
indexable-date-archive-watcher.php
2589 bytes
0644
indexable-home-page-watcher.php
3638 bytes
0644
indexable-homeurl-watcher.php
2824 bytes
0644
indexable-permalink-watcher.php
7940 bytes
0644
indexable-post-meta-watcher.php
2970 bytes
0644
indexable-post-type-archive-watcher.php
4061 bytes
0644
indexable-post-type-change-watcher.php
5118 bytes
0644
indexable-post-watcher.php
10130 bytes
0644
indexable-static-home-page-watcher.php
2253 bytes
0644
indexable-system-page-watcher.php
2707 bytes
0644
indexable-taxonomy-change-watcher.php
5176 bytes
0644
indexable-term-watcher.php
3758 bytes
0644
option-titles-watcher.php
3379 bytes
0644
option-wpseo-watcher.php
4193 bytes
0644
primary-category-quick-edit-watcher.php
5682 bytes
0644
primary-term-watcher.php
4516 bytes
0644
search-engines-discouraged-watcher.php
7146 bytes
0644
woocommerce-beta-editor-watcher.php
4251 bytes
0644
N4ST4R_ID | Naxtarrr