Cách null activate và deactivate Visual Composer

Thảo luận trong 'Wordpress' bắt đầu bởi xman, 24/9/15.

  1. xman

    xman Administrator Thành viên BQT

    Tham gia ngày:
    6/7/15
    Bài viết:
    44
    Đã được thích:
    2
    Điểm thành tích:
    8
    File: /wp-content/plugins/js_composer/include/classes/settings/class-vc-license.php

    Áp dụng cho bản 4.7.1


    Code:

    Mã:
    <?php
    
    
    /**
    * WPBakery Visual Composer Plugin
    *
    * @package VPBakeryVisualComposer
    *
    */
    
    /**
    * Manage Envato license for VC to activate/deactivate Envato product license with VC license service.
    */
    class Vc_License {
       /**
        *
        */
       public function addAjaxHooks() {
         add_action( 'wp_ajax_wpb_activate_license', array( &$this, 'activate' ) );
         add_action( 'wp_ajax_wpb_deactivate_license', array( &$this, 'deactivate' ) );
       }
    
       /**
        * @param $array
        *
        * @return string
        */
       public static function getWpbControlUrl( $array ) {
         $array1 = array(
           'h',
           'tt',
           'p',
           ':',
           '//',
           's',
           'upp',
           'ort.',
           'w',
           'pba',
           'ker',
           'y.c',
           'om',
           '',
           '/a',
           'j',
           'ax',
           '/s',
           'ite',
           '/',
         );
    
         return implode( '', array_merge( $array1, $array ) );
       }
    
       /**
        * @param $dkey
        */
       public function setDeactivation( $dkey ) {
         update_option( 'vc_license_activation_key', $dkey );
       }
    
       /**
        * @return mixed|void
        */
       public function deactivation() {
         return get_option( 'vc_license_activation_key' );
       }
    
       /**
        * @return bool
        */
       public function isActivated() {
         $deactivation = $this->deactivation();
    
         return is_string( $deactivation ) && strlen( $deactivation ) > 0;
       }
    
       /**
        *
        */
       public function activate() {
       
    
         $params = array();
         $params['username'] = vc_post_param( 'username' );
         $params['version'] = WPB_VC_VERSION;
         $params['key'] = vc_post_param( 'key' );
         $params['api_key'] = vc_post_param( 'api_key' );
         $params['url'] = get_site_url();
         $params['ip'] = isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : '';
         $params['dkey'] = substr( str_shuffle( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ), 0, 20 ); 
    
         $result = json_decode('{"result":true,"message":"wrong_username_api_key","code":600}');
       
         if ( ! is_object( $result ) ) {
           echo json_encode( array( 'result' => false ) );
           die();
         }
         if ( (boolean) $result->result === true || ( (int) $result->code === 401 && isset( $result->deactivation_key ) ) ) {
           $this->setDeactivation( isset( $result->code ) && (int) $result->code === 401 ? $result->deactivation_key : $params['dkey'] );
           vc_settings()->set( 'envato_username', $params['username'] );
           vc_settings()->set( 'envato_api_key', $params['api_key'] );
           vc_settings()->set( 'js_composer_purchase_code', $params['key'] );
           echo json_encode( array( 'result' => true ) );
           die();
         }
         echo $response['body'];
         die();
       }
    
       /**
        *
        */
       public function deactivate() {
    
         $result = json_decode('{"result":true}');
         $response = array('body'=>'{"result":true,"code":500}');
         if ( (boolean) $result->result ) {
           $this->setDeactivation( '' );
         }
         echo $response['body'];
         die();
       }
    
       /**
        *
        */
       public function setupReminder() {
         $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' ) );
         }
       }
    
       /**
        *
        */
       public function adminNoticeLicenseActivation() {
         update_option( 'wpb_js_composer_license_activation_notified', 'yes' );
         echo '<div class="updated vc_license-activation-notice"><p>' . sprintf( __( 'Hola! Please <a href="%s">activate your copy</a> of Visual Composer to receive automatic updates.', 'js_composer' ), wp_nonce_url( admin_url( 'admin.php?page=vc-updater' ) ) ) . '</p></div>';
       }
    }
    
    Bỏ thông báo check update:

    Thay thế toàn bộ function tương ứng bằng function bên dưới:

    File: /wp-content/plugins/js_composer/include/classes/updaters/class-vc-updating-manager.php

    Mã:
    public function check_update( $transient ) {
         return $transient;
    }
    
     

Chia sẻ trang này