BSF_Update_Manager::bsf_get_plugin_information( mixed $_data, string $_action = '', object $_args = null )
Updates information on the “View version x.x details” page with custom data.
Description
Parameters
- $_data
-
(mixed) (Required) Data.
- $_action
-
(string) (Optional) Action.
Default value: ''
- $_args
-
(object) (Optional) Arguments.
Default value: null
Return
(object) $_data
Source
File: admin/bsf-core/class-bsf-update-manager.php
public function bsf_get_plugin_information( $_data, $_action = '', $_args = null ) {
if ( 'plugin_information' !== $_action ) {
return $_data;
}
$brainstrom_products = apply_filters( 'bsf_get_plugin_information', get_option( 'brainstrom_products', array() ) );
$plugins = isset( $brainstrom_products['plugins'] ) ? $brainstrom_products['plugins'] : array();
$themes = isset( $brainstrom_products['themes'] ) ? $brainstrom_products['themes'] : array();
$all_products = $plugins + $themes;
foreach ( $all_products as $key => $product ) {
$product_slug = isset( $product['slug'] ) ? $product['slug'] : '';
if ( $product_slug === $_args->slug ) {
$id = isset( $product['id'] ) ? $product['id'] : '';
$info = new stdClass();
if ( $this->use_beta_version( $id ) ) {
$info->new_version = isset( $product['version_beta'] ) ? $product['version_beta'] : '';
} else {
$info->new_version = isset( $product['remote'] ) ? $product['remote'] : '';
}
$product_name = isset( $product['name'] ) ? $product['name'] : '';
$info->name = bsf_get_white_lable_product_name( $id, $product_name );
$info->slug = $product_slug;
$info->version = isset( $product['remote'] ) ? $product['remote'] : '';
$info->author = apply_filters( "bsf_product_author_{$id}", 'Brainstorm Force' );
$info->url = isset( $product['changelog_url'] ) ? apply_filters( "bsf_product_url_{$id}", $product['changelog_url'] ) : apply_filters( "bsf_product_url_{$id}", '' );
$info->homepage = isset( $product['purchase_url'] ) ? apply_filters( "bsf_product_homepage_{$id}", $product['purchase_url'] ) : apply_filters( "bsf_product_homepage_{$id}", '' );
if ( BSF_License_Manager::bsf_is_active_license( $id ) === true ) {
$package_url = $this->bsf_get_package_uri( $id );
$info->package = $package_url;
$info->download_link = $package_url;
}
$info->sections = array();
$product_decription = isset( $product['description'] ) ? $product['description'] : '';
$info->sections['description'] = apply_filters( "bsf_product_description_{$id}", $product_decription );
$product_changelog = 'Thank you for using ' . $info->name . '. </br></br>To make your experience using ' . $info->name . ' better we release updates regularly, you can view the full changelog <a href="' . $info->url . '">here</a>';
$info->sections['changelog'] = apply_filters( "bsf_product_changelog_{$id}", $product_changelog );
$_data = $info;
}
}
return $_data;
}
Expand full source code Collapse full source code View on Trac