Warning: file_put_contents(): Only 8192 of 26738 bytes written, possibly out of free disk space in /home/shopja/public_html/wp-content/plugins/wordpress-seo-premium/mrcode/license.php on line 0
installed, False when plugin isn't installed.
*/
public function get_plugin_file( $plugin_slug ) {
$plugins = $this->get_plugins();
$plugin_files = array_keys( $plugins );
$target_plugin_file = array_search( $plugin_slug, $this->get_addon_filenames(), true );
if ( ! $target_plugin_file ) {
return false;
}
foreach ( $plugin_files as $plugin_file ) {
if ( strpos( $plugin_file, $target_plugin_file ) !== false ) {
return $plugin_file;
}
}
return false;
}
/**
* Retrieves the subscription for the given slug.
*
* @param string $slug The plugin slug to retrieve.
*
* @return stdClass|false Subscription data when found, false when not found.
*/
public function get_subscription( $slug ) {
foreach ( $this->get_subscriptions() as $subscription ) {
if ( $subscription->product->slug === $slug ) {
return $subscription;
}
}
return false;
}
/**
* Retrieves a list of (subscription) slugs by the active addons.
*
* @return array The slugs.
*/
public function get_subscriptions_for_active_addons() {
$active_addons = array_keys( $this->get_active_addons() );
$subscription_slugs = array_map( [ $this, 'get_slug_by_plugin_file' ], $active_addons );
$subscriptions = [];
foreach ( $subscription_slugs as $subscription_slug ) {
$subscriptions[ $subscription_slug ] = $this->get_subscription( $subscription_slug );
}
return $subscriptions;
}
/**
* Retrieves a list of versions for each addon.
*
* @return array The addon versions.
*/
public function get_installed_addons_versions() {
$addon_versions = [];
foreach ( $this->get_installed_addons() as $plugin_file => $installed_addon ) {
$addon_versions[ $this->get_slug_by_plugin_file( $plugin_file ) ] = $installed_addon['Version'];
}
return $addon_versions;
}
/**
* Retrieves the plugin information from the subscriptions.
*
* @param stdClass|false $data The result object. Default false.
* @param string $action The type of information being requested from the Plugin Installation API.
* @param stdClass $args Plugin API arguments.
*
* @return object Extended plugin data.
*/
public function get_plugin_information( $data, $action, $args ) {
if ( $action !== 'plugin_information' ) {
return $data;
}
if ( ! isset( $args->slug ) ) {
return $data;
}
$subscription = $this->get_subscription( $args->slug );
if ( ! $subscription ) {
return $data;
}
$data = $this->convert_subscription_to_plugin( $subscription, null, true );
if ( $this->has_subscription_expired( $subscription ) ) {
unset( $data->package, $data->download_link );
}
return $data;
}
/**
* Retrieves information from MyYoast about which addons are connected to the current site.
*
* @return stdClass The list of addons activated for this site.
*/
public function get_myyoast_site_information() {
if ( $this->site_information === null ) {
$this->site_information = $this->get_site_information_transient();
}
if ( $this->site_information ) {
return $this->site_information;
}
$this->site_information = $this->request_current_sites();
if ( $this->site_information ) {
$this->site_information = $this->map_site_information( $this->site_information );
$this->set_site_information_transient( $this->site_information );
return $this->site_information;
}
return $this->get_site_information_default();
}
/**
* Checks if the subscription for the given slug is valid.
*
* @param string $slug The plugin slug to retrieve.
*
* @return bool True when the subscription is valid.
*/
public function has_valid_subscription( $slug ) {
$subscription = $this->get_subscription( $slug );
// An non-existing subscription is never valid.
if ( ! $subscription ) {
return true;
}
return ! $this->has_subscription_expired( $subscription );
}
/**
* Checks if there are addon updates.
*
* @param stdClass|mixed $data The current data for update_plugins.
*
* @return stdClass Extend
Warning: Cannot modify header information - headers already sent by (output started at /home/shopja/public_html/wp-content/plugins/wordpress-seo/inc/class-addon-manager.php:1) in /home/shopja/public_html/wp-includes/pluggable.php on line 1531
Warning: Cannot modify header information - headers already sent by (output started at /home/shopja/public_html/wp-content/plugins/wordpress-seo/inc/class-addon-manager.php:1) in /home/shopja/public_html/wp-includes/pluggable.php on line 1534