| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/force-rewrite-title.php.tar |
lebauwcentre/wp-content/plugins/wordpress-seo/src/integrations/front-end/force-rewrite-title.php 0000644 00000010630 15111766346 0032435 0 ustar 00 home/xbodynamge <?php
namespace Yoast\WP\SEO\Integrations\Front_End;
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Wrappers\WP_Query_Wrapper;
/**
* Class Force_Rewrite_Title.
*/
class Force_Rewrite_Title implements Integration_Interface {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* Toggle indicating whether output buffering has been started.
*
* @var bool
*/
private $ob_started = false;
/**
* The WP Query wrapper.
*
* @var WP_Query_Wrapper
*/
private $wp_query;
/**
* Sets the helpers.
*
* @codeCoverageIgnore It just handles dependencies.
*
* @param Options_Helper $options Options helper.
* @param WP_Query_Wrapper $wp_query WP query wrapper.
*/
public function __construct( Options_Helper $options, WP_Query_Wrapper $wp_query ) {
$this->options = $options;
$this->wp_query = $wp_query;
}
/**
* Returns the conditionals based in which this loadable should be active.
*
* @return array
*/
public static function get_conditionals() {
return [ Front_End_Conditional::class ];
}
/**
* Initializes the integration.
*
* This is the place to register hooks and filters.
*
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
// When the option is disabled.
if ( ! $this->options->get( 'forcerewritetitle', false ) ) {
return;
}
// For WordPress versions below 4.4.
if ( \current_theme_supports( 'title-tag' ) ) {
return;
}
\add_action( 'template_redirect', [ $this, 'force_rewrite_output_buffer' ], 99999 );
\add_action( 'wp_footer', [ $this, 'flush_cache' ], -1 );
}
/**
* Used in the force rewrite functionality this retrieves the output, replaces the title with the proper SEO
* title and then flushes the output.
*
* @return bool
*/
public function flush_cache() {
if ( $this->ob_started !== true ) {
return false;
}
$content = $this->get_buffered_output();
$old_wp_query = $this->wp_query->get_query();
\wp_reset_query();
// When the file has the debug mark.
if ( \preg_match( '/(?\'before\'.*)<!-- This site is optimized with the Yoast SEO.*<!-- \/ Yoast SEO( Premium)? plugin. -->(?\'after\'.*)/is', $content, $matches ) ) {
$content = $this->replace_titles_from_content( $content, $matches );
unset( $matches );
}
// phpcs:ignore WordPress.WP.GlobalVariablesOverride -- The query gets reset here with the original query.
$GLOBALS['wp_query'] = $old_wp_query;
// phpcs:ignore WordPress.Security.EscapeOutput -- The output should already have been escaped, we are only filtering it.
echo $content;
return true;
}
/**
* Starts the output buffer so it can later be fixed by flush_cache().
*/
public function force_rewrite_output_buffer() {
$this->ob_started = true;
$this->start_output_buffering();
}
/**
* Replaces the titles from the parts that contains a title.
*
* @param string $content The content to remove the titles from.
* @param array $parts_with_title The parts containing a title.
*
* @return string The modified content.
*/
protected function replace_titles_from_content( $content, $parts_with_title ) {
if ( isset( $parts_with_title['before'] ) && \is_string( $parts_with_title['before'] ) ) {
$content = $this->replace_title( $parts_with_title['before'], $content );
}
if ( isset( $parts_with_title['after'] ) ) {
$content = $this->replace_title( $parts_with_title['after'], $content );
}
return $content;
}
/**
* Removes the title from the part that contains the title and put this modified part back
* into the content.
*
* @param string $part_with_title The part with the title that needs to be replaced.
* @param string $content The entire content.
*
* @return string The altered content.
*/
protected function replace_title( $part_with_title, $content ) {
$part_without_title = \preg_replace( '/<title.*?\/title>/i', '', $part_with_title );
return \str_replace( $part_with_title, $part_without_title, $content );
}
/**
* Starts the output buffering.
*
* @codeCoverageIgnore
*/
protected function start_output_buffering() {
\ob_start();
}
/**
* Retrieves the buffered output.
*
* @codeCoverageIgnore
*
* @return false|string The buffered output.
*/
protected function get_buffered_output() {
return \ob_get_clean();
}
}
crosstraining/wp-content/plugins/wordpress-seo/src/integrations/front-end/force-rewrite-title.php 0000644 00000010630 15114414442 0032630 0 ustar 00 home/xbodynamge <?php
namespace Yoast\WP\SEO\Integrations\Front_End;
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Wrappers\WP_Query_Wrapper;
/**
* Class Force_Rewrite_Title.
*/
class Force_Rewrite_Title implements Integration_Interface {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* Toggle indicating whether output buffering has been started.
*
* @var bool
*/
private $ob_started = false;
/**
* The WP Query wrapper.
*
* @var WP_Query_Wrapper
*/
private $wp_query;
/**
* Sets the helpers.
*
* @codeCoverageIgnore It just handles dependencies.
*
* @param Options_Helper $options Options helper.
* @param WP_Query_Wrapper $wp_query WP query wrapper.
*/
public function __construct( Options_Helper $options, WP_Query_Wrapper $wp_query ) {
$this->options = $options;
$this->wp_query = $wp_query;
}
/**
* Returns the conditionals based in which this loadable should be active.
*
* @return array
*/
public static function get_conditionals() {
return [ Front_End_Conditional::class ];
}
/**
* Initializes the integration.
*
* This is the place to register hooks and filters.
*
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
// When the option is disabled.
if ( ! $this->options->get( 'forcerewritetitle', false ) ) {
return;
}
// For WordPress versions below 4.4.
if ( \current_theme_supports( 'title-tag' ) ) {
return;
}
\add_action( 'template_redirect', [ $this, 'force_rewrite_output_buffer' ], 99999 );
\add_action( 'wp_footer', [ $this, 'flush_cache' ], -1 );
}
/**
* Used in the force rewrite functionality this retrieves the output, replaces the title with the proper SEO
* title and then flushes the output.
*
* @return bool
*/
public function flush_cache() {
if ( $this->ob_started !== true ) {
return false;
}
$content = $this->get_buffered_output();
$old_wp_query = $this->wp_query->get_query();
\wp_reset_query();
// When the file has the debug mark.
if ( \preg_match( '/(?\'before\'.*)<!-- This site is optimized with the Yoast SEO.*<!-- \/ Yoast SEO( Premium)? plugin. -->(?\'after\'.*)/is', $content, $matches ) ) {
$content = $this->replace_titles_from_content( $content, $matches );
unset( $matches );
}
// phpcs:ignore WordPress.WP.GlobalVariablesOverride -- The query gets reset here with the original query.
$GLOBALS['wp_query'] = $old_wp_query;
// phpcs:ignore WordPress.Security.EscapeOutput -- The output should already have been escaped, we are only filtering it.
echo $content;
return true;
}
/**
* Starts the output buffer so it can later be fixed by flush_cache().
*/
public function force_rewrite_output_buffer() {
$this->ob_started = true;
$this->start_output_buffering();
}
/**
* Replaces the titles from the parts that contains a title.
*
* @param string $content The content to remove the titles from.
* @param array $parts_with_title The parts containing a title.
*
* @return string The modified content.
*/
protected function replace_titles_from_content( $content, $parts_with_title ) {
if ( isset( $parts_with_title['before'] ) && \is_string( $parts_with_title['before'] ) ) {
$content = $this->replace_title( $parts_with_title['before'], $content );
}
if ( isset( $parts_with_title['after'] ) ) {
$content = $this->replace_title( $parts_with_title['after'], $content );
}
return $content;
}
/**
* Removes the title from the part that contains the title and put this modified part back
* into the content.
*
* @param string $part_with_title The part with the title that needs to be replaced.
* @param string $content The entire content.
*
* @return string The altered content.
*/
protected function replace_title( $part_with_title, $content ) {
$part_without_title = \preg_replace( '/<title.*?\/title>/i', '', $part_with_title );
return \str_replace( $part_with_title, $part_without_title, $content );
}
/**
* Starts the output buffering.
*
* @codeCoverageIgnore
*/
protected function start_output_buffering() {
\ob_start();
}
/**
* Retrieves the buffered output.
*
* @codeCoverageIgnore
*
* @return false|string The buffered output.
*/
protected function get_buffered_output() {
return \ob_get_clean();
}
}
plugins/wordpress-seo/admin/views/tabs/metas/paper-content/general/force-rewrite-title.php 0000644 00000001032 15114572444 0036125 0 ustar 00 home/xbodynamge/crosstraining/wp-content <?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
$yform->light_switch( 'forcerewritetitle', __( 'Force rewrite titles', 'wordpress-seo' ) );
echo '<p class="description">';
printf(
/* translators: %1$s expands to Yoast SEO */
esc_html__( '%1$s has auto-detected whether it needs to force rewrite the titles for your pages, if you think it\'s wrong and you know what you\'re doing, you can change the setting here.', 'wordpress-seo' ),
'Yoast SEO'
);
echo '</p>';
plugins/wordpress-seo/admin/views/tabs/metas/paper-content/general/force-rewrite-title.php 0000644 00000001032 15114632525 0035715 0 ustar 00 home/xbodynamge/lebauwcentre/wp-content <?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
$yform->light_switch( 'forcerewritetitle', __( 'Force rewrite titles', 'wordpress-seo' ) );
echo '<p class="description">';
printf(
/* translators: %1$s expands to Yoast SEO */
esc_html__( '%1$s has auto-detected whether it needs to force rewrite the titles for your pages, if you think it\'s wrong and you know what you\'re doing, you can change the setting here.', 'wordpress-seo' ),
'Yoast SEO'
);
echo '</p>';
xbodynamge/www/wp-content/plugins/wordpress-seo/src/integrations/front-end/force-rewrite-title.php 0000644 00000010630 15115165632 0030574 0 ustar 00 home <?php
namespace Yoast\WP\SEO\Integrations\Front_End;
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Wrappers\WP_Query_Wrapper;
/**
* Class Force_Rewrite_Title.
*/
class Force_Rewrite_Title implements Integration_Interface {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options;
/**
* Toggle indicating whether output buffering has been started.
*
* @var bool
*/
private $ob_started = false;
/**
* The WP Query wrapper.
*
* @var WP_Query_Wrapper
*/
private $wp_query;
/**
* Sets the helpers.
*
* @codeCoverageIgnore It just handles dependencies.
*
* @param Options_Helper $options Options helper.
* @param WP_Query_Wrapper $wp_query WP query wrapper.
*/
public function __construct( Options_Helper $options, WP_Query_Wrapper $wp_query ) {
$this->options = $options;
$this->wp_query = $wp_query;
}
/**
* Returns the conditionals based in which this loadable should be active.
*
* @return array
*/
public static function get_conditionals() {
return [ Front_End_Conditional::class ];
}
/**
* Initializes the integration.
*
* This is the place to register hooks and filters.
*
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
// When the option is disabled.
if ( ! $this->options->get( 'forcerewritetitle', false ) ) {
return;
}
// For WordPress versions below 4.4.
if ( \current_theme_supports( 'title-tag' ) ) {
return;
}
\add_action( 'template_redirect', [ $this, 'force_rewrite_output_buffer' ], 99999 );
\add_action( 'wp_footer', [ $this, 'flush_cache' ], -1 );
}
/**
* Used in the force rewrite functionality this retrieves the output, replaces the title with the proper SEO
* title and then flushes the output.
*
* @return bool
*/
public function flush_cache() {
if ( $this->ob_started !== true ) {
return false;
}
$content = $this->get_buffered_output();
$old_wp_query = $this->wp_query->get_query();
\wp_reset_query();
// When the file has the debug mark.
if ( \preg_match( '/(?\'before\'.*)<!-- This site is optimized with the Yoast SEO.*<!-- \/ Yoast SEO( Premium)? plugin. -->(?\'after\'.*)/is', $content, $matches ) ) {
$content = $this->replace_titles_from_content( $content, $matches );
unset( $matches );
}
// phpcs:ignore WordPress.WP.GlobalVariablesOverride -- The query gets reset here with the original query.
$GLOBALS['wp_query'] = $old_wp_query;
// phpcs:ignore WordPress.Security.EscapeOutput -- The output should already have been escaped, we are only filtering it.
echo $content;
return true;
}
/**
* Starts the output buffer so it can later be fixed by flush_cache().
*/
public function force_rewrite_output_buffer() {
$this->ob_started = true;
$this->start_output_buffering();
}
/**
* Replaces the titles from the parts that contains a title.
*
* @param string $content The content to remove the titles from.
* @param array $parts_with_title The parts containing a title.
*
* @return string The modified content.
*/
protected function replace_titles_from_content( $content, $parts_with_title ) {
if ( isset( $parts_with_title['before'] ) && \is_string( $parts_with_title['before'] ) ) {
$content = $this->replace_title( $parts_with_title['before'], $content );
}
if ( isset( $parts_with_title['after'] ) ) {
$content = $this->replace_title( $parts_with_title['after'], $content );
}
return $content;
}
/**
* Removes the title from the part that contains the title and put this modified part back
* into the content.
*
* @param string $part_with_title The part with the title that needs to be replaced.
* @param string $content The entire content.
*
* @return string The altered content.
*/
protected function replace_title( $part_with_title, $content ) {
$part_without_title = \preg_replace( '/<title.*?\/title>/i', '', $part_with_title );
return \str_replace( $part_with_title, $part_without_title, $content );
}
/**
* Starts the output buffering.
*
* @codeCoverageIgnore
*/
protected function start_output_buffering() {
\ob_start();
}
/**
* Retrieves the buffered output.
*
* @codeCoverageIgnore
*
* @return false|string The buffered output.
*/
protected function get_buffered_output() {
return \ob_get_clean();
}
}