예제 #1
0
 public function setupReminder()
 {
     $deactivation_key = $this->deactivation();
     if (empty($deactivation_key) && empty($_COOKIE['vchideactivationmsg']) && !vc_is_network_plugin() && !vc_is_updater_disabled()) {
         add_action('admin_notices', array(&$this, 'adminNoticeLicenseActivation'));
     }
 }
예제 #2
0
 /**
  * @return bool
  */
 public function showConfigurationTabs()
 {
     return !vc_is_network_plugin() || !is_network_admin();
 }
 /**
  * Shows message on Wp plugins page with a link for updating from envato.
  */
 public function addUpgradeMessageLink()
 {
     $is_activated = vc_license()->isActivated();
     if (!$is_activated) {
         $url = esc_url(vc_is_network_plugin() ? network_admin_url('admin.php?page=vc-updater') : admin_url('admin.php?page=vc-updater'));
         $redirect = sprintf('<a href="%s" target="_blank">%s</a>', $url, __('settings', 'js_composer'));
         echo sprintf(' ' . __('To receive automatic updates license activation is required. Please visit %s to activate your Visual Composer.', 'js_composer'), $redirect) . sprintf(' <a href="http://go.wpbakery.com/faq-update-in-theme" target="_blank">%s</a>', __('Got Visual Composer in theme?', 'js_composer'));
     }
 }
예제 #4
0
 public function addMenuPage()
 {
     if (vc_is_network_plugin() && is_network_admin()) {
         $page = add_menu_page(__("Visual Composer Settings", LANGUAGE_ZONE), __("Visual Composer", LANGUAGE_ZONE), 'manage_options', $this->page, array(&$this, 'render'));
     } else {
         $page = add_options_page(__("Visual Composer Settings", LANGUAGE_ZONE), __("Visual Composer", LANGUAGE_ZONE), 'manage_options', $this->page, array(&$this, 'render'));
     }
     add_action("load-{$page}", array(&$this, 'adminLoad'));
 }
예제 #5
0
 /**
  * Get link to newest VC
  *
  * @param $reply
  * @param $package
  * @param $updater
  *
  * @return mixed|string|WP_Error
  */
 public function preUpgradeFilter($reply, $package, $updater)
 {
     $condition1 = isset($updater->skin->plugin) && $updater->skin->plugin === vc_plugin_name();
     $condition2 = isset($updater->skin->plugin_info) && $updater->skin->plugin_info['Name'] === $this->title;
     if (!$condition1 && !$condition2) {
         return $reply;
     }
     $res = $updater->fs_connect(array(WP_CONTENT_DIR));
     if (!$res) {
         return new WP_Error('no_credentials', __("Error! Can't connect to filesystem", 'js_composer'));
     }
     $license_key = vc_license()->getLicenseKey();
     if (!$license_key || !vc_license()->isActivated()) {
         if (vc_is_as_theme() && vc_get_param('action') !== 'update-selected') {
             return false;
         }
         $url = esc_url(vc_is_network_plugin() ? network_admin_url('admin.php?page=vc-updater') : admin_url('admin.php?page=vc-updater'));
         return new WP_Error('no_credentials', __('To receive automatic updates license activation is required. Please visit <a href="' . $url . '' . '" target="_blank">Settings</a> to activate your Visual Composer.', 'js_composer') . ' ' . sprintf(' <a href="http://go.wpbakery.com/faq-update-in-theme" target="_blank">%s</a>', __('Got Visual Composer in theme?', 'js_composer')));
     }
     $updater->strings['downloading_package_url'] = __('Getting download link...', 'js_composer');
     $updater->skin->feedback('downloading_package_url');
     $response = $this->getDownloadUrl($license_key);
     if (!$response) {
         return new WP_Error('no_credentials', __('Download link could not be retrieved', 'js_composer'));
     }
     if (!$response['status']) {
         return new WP_Error('no_credentials', $response['error']);
     }
     $updater->strings['downloading_package'] = __('Downloading package...', 'js_composer');
     $updater->skin->feedback('downloading_package');
     $downloaded_archive = download_url($response['url']);
     if (is_wp_error($downloaded_archive)) {
         return $downloaded_archive;
     }
     $plugin_directory_name = 'js_composer';
     // WP will use same name for plugin directory as archive name, so we have to rename it
     if (basename($downloaded_archive, '.zip') !== $plugin_directory_name) {
         $new_archive_name = dirname($downloaded_archive) . '/' . $plugin_directory_name . '.zip';
         rename($downloaded_archive, $new_archive_name);
         $downloaded_archive = $new_archive_name;
     }
     return $downloaded_archive;
 }
예제 #6
0
 /**
  * Set up license activation notice if needed
  *
  * Don't show notice on dev environment
  */
 public function setupReminder()
 {
     if (self::isDevEnvironment()) {
         return;
     }
     $deactivation_key = $this->deactivation();
     if (empty($deactivation_key) && empty($_COOKIE['vchideactivationmsg']) && !vc_is_network_plugin() && !vc_is_as_theme()) {
         add_action('admin_notices', array(&$this, 'adminNoticeLicenseActivation'));
     }
 }
예제 #7
0
 /**
  * Set up license activation notice if needed
  *
  * Don't show notice on dev environment
  */
 public function setupReminder()
 {
     if (self::isDevEnvironment()) {
         return;
     }
     if (!$this->isActivated() && (empty($_COOKIE['vchideactivationmsg_vc11']) || version_compare($_COOKIE['vchideactivationmsg_vc11'], WPB_VC_VERSION, '<')) && !(vc_is_network_plugin() && is_network_admin())) {
         add_action('admin_notices', array($this, 'adminNoticeLicenseActivation'));
     }
 }
예제 #8
0
    public function adminNoticeLicenseActivation()
    {
        update_option('wpb_js_composer_license_activation_notified', 'yes');
        $redirect = esc_url(vc_is_network_plugin() ? network_admin_url('admin.php?page=vc-updater') : admin_url('admin.php?page=vc-updater'));
        ?>
		<style>
			.vc_license-activation-notice {
				position: relative;
			}
		</style>
		<script type="text/javascript">
			(function ( $ ) {
				var setCookie = function ( c_name, value, exdays ) {
					var exdate = new Date();
					exdate.setDate( exdate.getDate() + exdays );
					var c_value = encodeURIComponent( value ) + ((null === exdays) ? "" : "; expires=" + exdate.toUTCString());
					document.cookie = c_name + "=" + c_value;
				};
				$( document ).on( 'click.vc-notice-dismiss',
					'.vc-notice-dismiss',
					function ( e ) {
						e.preventDefault();
						var $el = $( this ).closest(
							'#vc_license-activation-notice' );
						$el.fadeTo( 100, 0, function () {
							$el.slideUp( 100, function () {
								$el.remove();
							} );
						} );
						setCookie( 'vchideactivationmsg_vc11',
							'<?php 
        echo WPB_VC_VERSION;
        ?>
',
							30 );
					} );
			})( window.jQuery );
		</script>
		<?php 
        echo '<div class="updated vc_license-activation-notice" id="vc_license-activation-notice"><p>' . sprintf(__('Hola! Would you like to receive automatic updates and unlock premium support? Please <a href="%s">activate your copy</a> of Visual Composer.', 'js_composer'), wp_nonce_url($redirect)) . '</p>' . '<button type="button" class="notice-dismiss vc-notice-dismiss"><span class="screen-reader-text">' . __('Dismiss this notice.') . '</span></button></div>';
    }