HEX
Server: Apache
System:
User: ()
PHP: 7.4.33
Disabled: system,passthru,shell_exec,exec,proc_close,proc_open,proc_get_status,proc_nice,proc_terminate,highlight_file,escapeshellcmd,pclose,debugger_off,debugger_on,leak,listen,define_syslog_variables,ftp_exec,posix_uname,posix_getpwuid,get_current_user,getmyuid,getmygid,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,escapeshellarg,myshellexec,escapeshellarg,disk_free_space,disk_total_space,show_source,dl,symlink,listen,syslog,php_ini_scanned_files,inurl,apache_setenv,closelog,rar_open,bzopen,bzread,bzwrite,shellcode,show_source,apache_get_modules,apache_get_version,apache_note,openlog,crack_check,crack_closedict,pcntl_exec,ini_alter,backtick,cmd,virtual,getservbyport,myshellexec,hypot,pg_host,phpini,link,readlink,syslog,id,ftok,posix_access,error_log,sym,php_u,psockopen,apache_child_k_closedict,crack_getlastmessage,crack_opendict,php_ini,ini_restore,popen,curl_multi_exec,php_uname
Upload Files
File: /home/homework/public_html/kurs3/wp-content/plugins/jetpack/modules/seo-tools/jetpack-seo-utils.php
<?php

/**
 * Class containing utility static methods that other SEO tools are relying on.
 */
class Jetpack_SEO_Utils {
	/**
	 * Site option name used to store front page meta description.
	 */
	const FRONT_PAGE_META_OPTION = 'advanced_seo_front_page_description';

	/**
	 * Old version of option name that was previously used under Free plan.
	 */
	const LEGACY_META_OPTION = 'seo_meta_description';

	/**
	 * Used to check whether SEO tools are enabled for given site.
	 *
	 * @param int $site_id Optional. Defaults to current blog id if not given.
	 *
	 * @return bool True if SEO tools are enabled, false otherwise.
	 */
	public static function is_enabled_jetpack_seo( $site_id = 0 ) {
		/**
		 * Can be used by SEO plugin authors to disable the conflicting output of SEO Tools.
		 *
		 * @module seo-tools
		 *
		 * @since 5.0.0
		 *
		 * @param bool True if SEO Tools should be disabled, false otherwise.
		 */
		if ( apply_filters( 'jetpack_disable_seo_tools', false ) ) {
			return false;
		}

		if ( function_exists( 'has_any_blog_stickers' ) ) {
			// For WPCOM sites
			if ( empty( $site_id ) ) {
				$site_id = get_current_blog_id();
			}

			return has_any_blog_stickers( array( 'business-plan', 'ecommerce-plan' ), $site_id );
		}

		// For all Jetpack sites
		return true;
	}

	/**
	 * Checks if this option was set while it was still available under free plan.
	 *
	 * @return bool True if we should enable legacy usage, false otherwise.
	 */
	public static function has_legacy_front_page_meta() {
		return ! self::is_enabled_jetpack_seo() && get_option( self::LEGACY_META_OPTION );
	}

	/**
	 * Returns front page meta description for current site.
	 *
	 * Since we allowed non-business users to set Front page meta description for some time,
	 * before bundling it with other SEO tools features that require a business plan,
	 * we are supporting legacy usage here.
	 *
	 * @return string Front page meta description string or empty string.
	 */
	public static function get_front_page_meta_description() {
		if ( self::is_enabled_jetpack_seo() ) {
			$front_page_meta = get_option( self::FRONT_PAGE_META_OPTION );
			return $front_page_meta ? $front_page_meta : get_option( self::LEGACY_META_OPTION, '' );
		}

		// Support legacy usage for non-business users.
		return get_option( self::LEGACY_META_OPTION, '' );
	}

	/**
	 * Updates the site option value for front page meta description.
	 *
	 * We are taking care to update the correct option, in case the value is legacy-ed for current site.
	 *
	 * @param $value string New value for front page meta description.
	 *
	 * @return string Saved value, or empty string if no update was performed.
	 */
	public static function update_front_page_meta_description( $value ) {
		$front_page_description = sanitize_text_field( $value );

		/**
		 * Can be used to limit the lenght of front page meta description.
		 *
		 * @module seo-tools
		 *
		 * @since 4.4.0
		 *
		 * @param int Maximum length of front page meta description. Defaults to 300.
		 */
		$description_max_length = apply_filters( 'jetpack_seo_front_page_description_max_length', 300 );

		if ( function_exists( 'mb_substr' ) ) {
			$front_page_description = mb_substr( $front_page_description, 0, $description_max_length );
		} else {
			$front_page_description = substr( $front_page_description, 0, $description_max_length );
		}

		$can_set_meta       = self::is_enabled_jetpack_seo();
		$legacy_meta_option = get_option( self::LEGACY_META_OPTION );
		$has_old_meta       = ! empty( $legacy_meta_option );
		$option_name        = self::has_legacy_front_page_meta() ? self::LEGACY_META_OPTION : self::FRONT_PAGE_META_OPTION;

		$did_update = update_option( $option_name, $front_page_description );

		if ( $did_update && $has_old_meta && $can_set_meta ) {
			// Delete legacy option if user has switched to Business plan and updated meta description.
			delete_option( 'seo_meta_description' );
		}

		if ( $did_update ) {
			return $front_page_description;
		}

		return '';
	}
}