a Yoast addon.
*/
protected function is_yoast_addon( $plugin_file ) {
return $this->get_slug_by_plugin_file( $plugin_file ) !== '';
}
/**
* Retrieves the addon slug by given plugin file path.
*
* @param string $plugin_file The file path to the plugin.
*
* @return string The slug when found or empty string when not.
*/
protected function get_slug_by_plugin_file( $plugin_file ) {
$addons = self::$addons;
// Yoast SEO Free isn't an addon, but we needed it in Premium to fetch translations.
if ( YoastSEO()->helpers->product->is_premium() ) {
$addons['wp-seo.php'] = self::FREE_SLUG;
}
foreach ( $addons as $addon => $addon_slug ) {
if ( strpos( $plugin_file, $addon ) !== false ) {
return $addon_slug;
}
}
return '';
}
/**
* Retrieves the installed Yoast addons.
*
* @return array The installed plugins.
*/
protected function get_installed_addons() {
return array_filter( $this->get_plugins(), [ $this, 'is_yoast_addon' ], ARRAY_FILTER_USE_KEY );
}
/**
* Retrieves a list of active addons.
*
* @return array The active addons.
*/
protected function get_active_addons() {
return array_filter( $this->get_installed_addons(), [ $this, 'is_plugin_active' ], ARRAY_FILTER_USE_KEY );
}
/**
* Retrieves the current sites from the API.
*
* @codeCoverageIgnore
*
* @return bool|stdClass Object when request is successful. False if not.
*/
protected function request_current_sites() {
$api_request = new WPSEO_MyYoast_Api_Request( 'sites/current' );
if ( $api_request->fire() ) {
return $api_request->get_response();
}
return $this->get_site_information_default();
}
/**
* Retrieves the transient value with the site information.
*
* @codeCoverageIgnore
*
* @return stdClass|false The transient value.
*/
protected function get_site_information_transient() {
global $pagenow;
// Force re-check on license & dashboard pages.
$current_page = null;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['page'] ) && is_string( $_GET['page'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are only strictly comparing and thus no need to sanitize.
$current_page = wp_unslash( $_GET['page'] );
}
// Check whether the licenses are valid or whether we need to show notifications.
$quick = ( $current_page === Plans_Page_Integration::PAGE || $current_page === General_Page_Integration::PAGE );
// Also do a fresh request on Plugins & Core Update pages.
$quick = $quick || $pagenow === 'plugins.php';
$quick = $quick || $pagenow === 'update-core.php';
if ( $quick ) {
return get_transient( self::SITE_INFORMATION_TRANSIENT_QUICK );
}
return get_transient( self::SITE_INFORMATION_TRANSIENT );
}
/**
* Sets the site information transient.
*
* @codeCoverageIgnore
*
* @param stdClass $site_information The site information to save.
*
* @return void
*/
protected function set_site_information_transient( $site_information ) {
set_transient( self::SITE_INFORMATION_TRANSIENT, $site_information, DAY_IN_SECONDS );
set_transient( self::SITE_INFORMATION_TRANSIENT_QUICK, $site_information, 60 );
}
/**
* Retrieves all installed WordPress plugins.
*
* @codeCoverageIgnore
*
* @return array The plugins.
*/
protected function get_plugins() {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
return get_plugins();
}
/**
* Checks if the given plugin file belongs to an active plugin.
*
* @codeCoverageIgnore
*
* @param string $plugin_file The file path to the plugin.
*
* @return bool True when plugin is active.
*/
protected function is_plugin_active( $plugin_file ) {
return is_plugin_active( $plugin_file );
}
/**
* Returns an object with no subscriptions.
*
* @codeCoverageIgnore
*
* @return stdClass Site information.
*/
protected function get_site_information_default() {
return (object) [
'url' => WPSEO_Utils::get_home_url(),
'subscriptions' => [],
];
}
/**
* Maps the plugin API response.
*
* @param object $site_information Site information as received from the API.
*
* @return stdClass Mapped site information.
*/
protected function map_site_information( $site_information ) {
return (object) [
'url' => $site_information->url,
'subscriptions' => array_map( [ $this, 'map_subscription' ], $site_information->subscriptions ),
];
}
/**
* Maps a plugin subscription.
*
* @param object $subscription Subscription information as received from the API.
*
* @return stdClass Mapped subscription.
*/
protected function map_subscription( $subscription ) {
// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Not our properties.
return (object) [
'renewal_url' => $subscription->renewalUrl,
'expiry_date' => $subscription->expiryDate,
'product' => (object) [
'version' => $subscription->product->version,
'name' => $subscription->product->name,
'slug' => $subscription->product->slug,
'last_updated' => $subscription->product->lastUpdated,
'store_url' => $subscription->product->storeUrl,
// Ternary operator is necessary because download can be undefined.
'download' => ( $subscription->product->download ?? null ),
'changelog' => $subscription->product->changelog,
],
];
// phpcs:enable
}
/**
* Retrieves the site information.
*
* @return stdClass The site information.
*/
private function get_site_information() {
if ( ! $this->has_installed_addons() ) {
return $this->get_site_information_default();
}
return $this->get_myyoast_site_information();
}
/**
* Retrieves the contents for the support section.
*
* @return string The support section content.
*/
protected function get_support_section() {
return '
' . __( 'Need support?', 'wordpress-seo' ) . '
'
. '
'
/* translators: 1: expands to that refers to the help page, 2: closing tag. */
. sprintf( __( 'You can probably find an answer to your question in our %1$shelp center%2$s.', 'wordpress-seo' ), '', '' )
. ' '
/* translators: %s expands to a mailto support link. */
. sprintf( __( 'If you still need support and have an active subscription for this product, please email %s.', 'wordpress-seo' ), 'support@yoast.com' )
. '
کسب درامد از تولید محتوی ویدئویی و صداگذاری
کسب درآمد از تولید محتوای ویدئویی و صداگذاری: راهنمای جامع سئو
در دنیای امروز که محتوای ویدئویی حرف اول را میزند، صداگذاری حرفهای نقشی حیاتی در جذب مخاطب و موفقیت ویدئوهای شما ایفا میکند. این مقاله به شما کمک میکند تا با استراتژیهای سئو، پتانسیل کسب درآمد از تولید محتوای ویدئویی و صداگذاری را به حداکثر برسانید. از تولید ویدئوهای آموزشی گرفته تا برگزاری دورهها و انتشار کتاب، هر گام را با تمرکز بر کلمات کلیدی پرجستجو و نکات سئو پیش خواهیم برد.