本文整理汇总了PHP中vc_plugin_name函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_plugin_name函数的具体用法?PHP vc_plugin_name怎么用?PHP vc_plugin_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_plugin_name函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initialize a new instance of the WordPress Auto-Update class
*
* @param string $current_version
* @param string $update_path
* @param string $plugin_slug
*/
function __construct($current_version, $update_path, $plugin_slug)
{
// Set the class public variables
$this->current_version = $current_version;
$this->update_path = $update_path;
$this->plugin_slug = $plugin_slug;
$t = explode('/', $plugin_slug);
$this->slug = str_replace('.php', '', $t[1]);
// define the alternative API for updating checking
add_filter('pre_set_site_transient_update_plugins', array(&$this, 'check_update'));
// Define the alternative response for information checking
add_filter('plugins_api', array(&$this, 'check_info'), 10, 3);
add_action('in_plugin_update_message-' . vc_plugin_name(), array(&$this, 'addUpgradeMessageLink'));
}
示例2: upgradeFilterFromEnvato
/**
* Downloads new VC from Envato marketplace and unzips into temporary directory.
*
* @param $reply
* @param $package
* @param $updater
*
* @return mixed|string|WP_Error
*/
public function upgradeFilterFromEnvato($reply, $package, $updater)
{
global $wp_filesystem;
if (isset($updater->skin->plugin) && $updater->skin->plugin === vc_plugin_name() || isset($updater->skin->plugin_info) && $updater->skin->plugin_info['Name'] === $this->title) {
$updater->strings['download_envato'] = __('Downloading package from envato market...', 'js_composer');
$updater->skin->feedback('download_envato');
$package_filename = 'js_composer.zip';
$res = $updater->fs_connect(array(WP_CONTENT_DIR));
if (!$res) {
return new WP_Error('no_credentials', __("Error! Can't connect to filesystem", 'js_composer'));
}
$username = vc_settings()->get('envato_username');
$api_key = vc_settings()->get('envato_api_key');
$purchase_code = vc_settings()->get('js_composer_purchase_code');
if (!vc_license()->isActivated() || empty($username) || empty($api_key) || empty($purchase_code)) {
return new WP_Error('no_credentials', __('To receive automatic updates license activation is required. Please visit <a href="' . admin_url('admin.php?page=vc-updater') . '' . '" target="_blank">Settings</a> to activate your Visual Composer.', 'js_composer'));
}
$json = wp_remote_get($this->envatoDownloadPurchaseUrl($username, $api_key, $purchase_code));
$result = json_decode($json['body'], true);
if (!isset($result['download-purchase']['download_url'])) {
return new WP_Error('no_credentials', __('Error! Envato API error', 'js_composer') . (isset($result['error']) ? ': ' . $result['error'] : '.'));
}
$result['download-purchase']['download_url'];
$download_file = download_url($result['download-purchase']['download_url']);
if (is_wp_error($download_file)) {
return $download_file;
}
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'uploads/js_composer_envato_package';
if (is_dir($upgrade_folder)) {
$wp_filesystem->delete($upgrade_folder);
}
$result = unzip_file($download_file, $upgrade_folder);
if ($result && is_file($upgrade_folder . '/' . $package_filename)) {
return $upgrade_folder . '/' . $package_filename;
}
return new WP_Error('no_credentials', __('Error on unzipping package', 'js_composer'));
}
return $reply;
}
示例3: addUpgradeMessageLink
/**
* Shows message on Wp plugins page with a link for updating from envato.
*/
public function addUpgradeMessageLink()
{
$username = vc_settings()->get('envato_username');
$api_key = vc_settings()->get('envato_api_key');
$purchase_code = vc_settings()->get('js_composer_purchase_code');
echo '<style type="text/css" media="all">tr#wpbakery-visual-composer + tr.plugin-update-tr a.thickbox + em { display: none; }</style>';
if (empty($username) || empty($api_key) || empty($purchase_code)) {
echo ' <a href="' . $this->url . '">' . __('Download new version from CodeCanyon.', 'js_composer') . '</a>';
} else {
// update.php?action=upgrade-plugin&plugin=testimonials-widget%2Ftestimonials-widget.php&_wpnonce=6178d48b6e
// echo '<a href="' . wp_nonce_url( admin_url( 'plugins.php?vc_action=vc_upgrade' ) ) . '">' . __( 'Update Visual Composer now.', 'js_composer' ) . '</a>';
echo '<a href="' . wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . vc_plugin_name()), 'upgrade-plugin_' . vc_plugin_name()) . '">' . __('Update Visual Composer now.', 'js_composer') . '</a>';
}
}
示例4: updater
/**
* Gets updater instance.
*
* @return Vc_Updater
*/
public function updater()
{
if (!isset($this->factory['updater'])) {
do_action('vc_before_init_updater');
require_once $this->path('UPDATERS_DIR', 'class-vc-updater.php');
$updater = new Vc_Updater();
require_once vc_path_dir('UPDATERS_DIR', 'class-vc-updating-manager.php');
$updater->setUpdateManager(new Vc_Updating_Manager(WPB_VC_VERSION, $updater->versionUrl(), vc_plugin_name()));
$this->factory['updater'] = $updater;
do_action('vc_after_init_updater');
}
return $this->factory['updater'];
}
示例5: disable_updater
/**
* Disables the VC updater function
*
* @since 3.0.0
*/
public function disable_updater()
{
// Make sure theme mode is enabled
if (!$this->vc_theme_mode) {
return;
}
/**
* Remove update pre_download filter
*
* @see Vc_Updater
*
*/
if (empty($GLOBALS['wp_filter']['upgrader_pre_download'])) {
return;
} else {
$filters = $GLOBALS['wp_filter']['upgrader_pre_download'];
}
// Loop through filter
foreach ($filters as $priority => $filter) {
foreach ($filter as $identifier => $function) {
if (is_array($function) and is_a($function['function'][0], 'Vc_Updater') and 'upgradeFilterFromEnvato' === $function['function'][1]) {
remove_filter('upgrader_pre_download', array($function['function'][0], 'upgradeFilterFromEnvato'), $priority);
}
}
}
/**
* Remove Updater message in plugins list
*
* @see Vc_Updating_Manager
*
*/
if (!function_exists('vc_plugin_name')) {
return;
}
$tag = 'in_plugin_update_message-' . vc_plugin_name();
if (empty($GLOBALS['wp_filter'][$tag])) {
return;
} else {
$filters = $GLOBALS['wp_filter'][$tag];
}
// Return if filters are empty
if (empty($filters)) {
return;
}
// Loop through filter
foreach ($filters as $priority => $filter) {
foreach ($filter as $identifier => $function) {
if (is_array($function) and is_a($function['function'][0], 'Vc_Updating_Manager') and 'check_update' === $function['function'][1]) {
remove_filter($tag, array($function['function'][0], 'check_update'), $priority);
}
}
}
}
示例6: disable_updater
/**
* Disables the VC updater function
*
* @since 3.0.0
*/
public function disable_updater()
{
// Get Globals
global $GLOBALS;
/**
* Remove update pre_download filter
*
* @see Vc_Updater
*
*/
if (!empty($GLOBALS['wp_filter']['upgrader_pre_download'])) {
$filters = $GLOBALS['wp_filter']['upgrader_pre_download'];
if (!empty($filters) && is_array($filters)) {
foreach ($filters as $priority => $filter) {
foreach ($filter as $identifier => $function) {
if (is_array($function) and is_a($function['function'][0], 'Vc_Updater') and 'upgradeFilterFromEnvato' === $function['function'][1]) {
remove_filter('upgrader_pre_download', array($function['function'][0], 'upgradeFilterFromEnvato'), $priority);
}
}
}
}
}
/**
* Remove Updater message in plugins list
*
* @see Vc_Updating_Manager
*
*/
if (function_exists('vc_plugin_name')) {
$tag = 'in_plugin_update_message-' . vc_plugin_name();
if (!empty($GLOBALS['wp_filter'][$tag])) {
$filters = $GLOBALS['wp_filter'][$tag];
if (!empty($filters) && is_array($filters)) {
foreach ($filters as $priority => $filter) {
foreach ($filter as $identifier => $function) {
if (is_array($function) and is_a($function['function'][0], 'Vc_Updating_Manager') and 'check_update' === $function['function'][1]) {
remove_filter($tag, array($function['function'][0], 'check_update'), $priority);
}
}
}
}
}
}
}