Plugin Directory

Changeset 3137890


Ignore:
Timestamp:
08/20/2024 02:28:25 AM (17 months ago)
Author:
ryviu
Message:

Ryviu Wook

Location:
ryviu
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • ryviu/tags/3.1.25/includes/class-ryviu.php

    r3134663 r3137890  
    3737        include_once RYVIU_DIR_PATH . 'includes/functions.php';
    3838        include_once RYVIU_DIR_PATH . 'includes/woo-hooks.php';
     39        include_once RYVIU_DIR_PATH . 'includes/class-ryviu-hook.php';
    3940    }
    4041
  • ryviu/tags/3.1.25/includes/functions.php

    r3133949 r3137890  
    225225            echo "<div class=\"lt-block-reviews\"><questions-answers handle=\"$product_handle\"></questions-answers></div>";
    226226        }
     227    }
     228}
     229
     230function ryviu_badge_section(){
     231    $featured_ryviu_data = get_option( 'featured_ryviu_data' );
     232    if($featured_ryviu_data){
     233        echo '<ryviu-feature-extend reviews_badge="1" reviews_data="'.$featured_ryviu_data.'"></ryviu-feature-extend>';
     234    }else{
     235        echo '<ryviu-feature-extend reviews_badge="1"></ryviu-feature-extend>';
    227236    }
    228237}
     
    762771
    763772add_shortcode( 'ryviu_question_and_answer', 'question_and_answer_func' );
     773
     774// Reviews Badge shortcode
     775
     776function ryviu_badge_func( $atts ) {
     777   
     778    ob_start();
     779
     780    ryviu_badge_section();
     781
     782    return ob_get_clean();
     783}
     784
     785add_shortcode( 'ryviu_badge', 'ryviu_badge_func' );
  • ryviu/tags/3.1.25/includes/ryviu-api-controller.php

    r3131432 r3137890  
    3232    public function __construct(){
    3333        RyviuApiController::_header();
     34        include_once RYVIU_DIR_PATH . 'includes/common-functions.php';
    3435    }
    3536
     
    145146                if($product_id && $meta_key){
    146147                    self::updateProductMetafield($product_id, $meta_key, $meta_value);
    147                     self::clearWpCache();
     148                    CommonFunctions::clearStoreCache();
    148149                }else{
    149150                    wp_die( 'Empty product ID or meta key', 'Request Error' );
     
    157158
    158159                if($settings){
    159                     self::updateSettings( 'ryviu_client_settings', json_decode($settings) );
    160                     self::clearWpCache();
     160                    CommonFunctions::updateSettings('ryviu_client_settings', json_decode($settings));
     161                    CommonFunctions::clearStoreCache();
    161162                }
    162163
    163164                if($key_id){
    164                     self::updateSettings( 'ryviu_user_api_key_id', $key_id );
    165                     self::clearWpCache();
     165                    CommonFunctions::updateSettings('ryviu_user_api_key_id', $key_id);
     166                    CommonFunctions::clearStoreCache();
    166167                }
    167168
     
    172173    }
    173174
    174     // Clear Plugin Cache
    175 
    176     public static function clearWpCache() {
    177 
    178         global $wp_fastest_cache;
    179 
    180         if ( function_exists( 'rocket_clean_domain' ) ) { // WP Rocket
    181             rocket_clean_domain();
    182         }
    183 
    184         if ( function_exists( 'wp_cache_flush' ) ) {
    185             wp_cache_flush();
    186         }
    187 
    188         // Purge entire WP Rocket cache.
    189         if (class_exists('\LiteSpeed\Purge')) {
    190             \LiteSpeed\Purge::purge_all();
    191         }
    192 
    193         if ( function_exists( 'wp_cache_clear_cache' ) ) { // WP Super Cache
    194             wp_cache_clear_cache();
    195         }
    196 
    197         if ( function_exists( 'w3tc_flush_posts' ) ) { // W3 Total Cache
    198             w3tc_flush_posts();
    199         }
    200         if ( has_action( 'ce_clear_cache' ) ) { // Cache Enabler
    201             do_action( 'ce_clear_cache' );
    202         }
    203         if ( class_exists( 'Breeze_PurgeCache' ) ) { // Breeze
    204             if ( method_exists( 'Breeze_PurgeCache', 'breeze_cache_flush' ) ) {
    205                 Breeze_PurgeCache::breeze_cache_flush();
    206             }
    207         }
    208 
    209         if ( class_exists( 'Swift_Performance_Cache' ) ) {
    210             if ( method_exists( 'Swift_Performance_Cache', 'clear_all_cache' ) ) {
    211                 Swift_Performance_Cache::clear_all_cache();
    212             }
    213         }
    214 
    215         if ( method_exists( 'WpFastestCache', 'deleteCache' ) && ! empty( $wp_fastest_cache ) ) { // WP Fastest Cache
    216             $wp_fastest_cache->deleteCache();
    217         }
    218 
    219         if ( class_exists( 'WpeCommon' ) ) { // Autoptimize
    220             if ( method_exists( 'WpeCommon', 'purge_memcached' ) ) {
    221                 WpeCommon::purge_memcached();
    222             }
    223             if ( method_exists( 'WpeCommon', 'clear_maxcdn_cache' ) ) {
    224                 WpeCommon::clear_maxcdn_cache();
    225             }
    226             if ( method_exists( 'WpeCommon', 'purge_varnish_cache' ) ) {
    227                 WpeCommon::purge_varnish_cache();
    228             }
    229         }
    230 
    231         if ( function_exists('sg_cachepress_purge_cache') ) { // SGOptimzer
    232             sg_cachepress_purge_cache();
    233         }
    234     }
    235175    /**
    236176     * Update product metafield
     
    244184        }
    245185    }
    246 
    247 
    248     /**
    249      * Update settings
    250      *
    251      * @param Request object $request Data.
    252      * @return JSON data
    253      */
    254     public static function updateSettings($option_key, $option_value){
    255         update_option($option_key, $option_value);
    256     }
    257 
    258186
    259187    /**
  • ryviu/tags/3.1.25/ryviu.php

    r3133949 r3137890  
    4242define('RYVIU_URL_ASSETS', plugins_url( 'assets/', __FILE__ ) );
    4343define('RYVIU_APP_HOOK_URL', 'https://app.ryviu.io/webhook/woocommerce/');
     44define('RYVIU_NAMESPACE', 'ryviu/v1');
    4445
    4546add_action( 'before_woocommerce_init', function() {
  • ryviu/trunk/includes/class-ryviu.php

    r3134663 r3137890  
    3737        include_once RYVIU_DIR_PATH . 'includes/functions.php';
    3838        include_once RYVIU_DIR_PATH . 'includes/woo-hooks.php';
     39        include_once RYVIU_DIR_PATH . 'includes/class-ryviu-hook.php';
    3940    }
    4041
  • ryviu/trunk/includes/functions.php

    r3133949 r3137890  
    225225            echo "<div class=\"lt-block-reviews\"><questions-answers handle=\"$product_handle\"></questions-answers></div>";
    226226        }
     227    }
     228}
     229
     230function ryviu_badge_section(){
     231    $featured_ryviu_data = get_option( 'featured_ryviu_data' );
     232    if($featured_ryviu_data){
     233        echo '<ryviu-feature-extend reviews_badge="1" reviews_data="'.$featured_ryviu_data.'"></ryviu-feature-extend>';
     234    }else{
     235        echo '<ryviu-feature-extend reviews_badge="1"></ryviu-feature-extend>';
    227236    }
    228237}
     
    762771
    763772add_shortcode( 'ryviu_question_and_answer', 'question_and_answer_func' );
     773
     774// Reviews Badge shortcode
     775
     776function ryviu_badge_func( $atts ) {
     777   
     778    ob_start();
     779
     780    ryviu_badge_section();
     781
     782    return ob_get_clean();
     783}
     784
     785add_shortcode( 'ryviu_badge', 'ryviu_badge_func' );
  • ryviu/trunk/includes/ryviu-api-controller.php

    r3131432 r3137890  
    3232    public function __construct(){
    3333        RyviuApiController::_header();
     34        include_once RYVIU_DIR_PATH . 'includes/common-functions.php';
    3435    }
    3536
     
    145146                if($product_id && $meta_key){
    146147                    self::updateProductMetafield($product_id, $meta_key, $meta_value);
    147                     self::clearWpCache();
     148                    CommonFunctions::clearStoreCache();
    148149                }else{
    149150                    wp_die( 'Empty product ID or meta key', 'Request Error' );
     
    157158
    158159                if($settings){
    159                     self::updateSettings( 'ryviu_client_settings', json_decode($settings) );
    160                     self::clearWpCache();
     160                    CommonFunctions::updateSettings('ryviu_client_settings', json_decode($settings));
     161                    CommonFunctions::clearStoreCache();
    161162                }
    162163
    163164                if($key_id){
    164                     self::updateSettings( 'ryviu_user_api_key_id', $key_id );
    165                     self::clearWpCache();
     165                    CommonFunctions::updateSettings('ryviu_user_api_key_id', $key_id);
     166                    CommonFunctions::clearStoreCache();
    166167                }
    167168
     
    172173    }
    173174
    174     // Clear Plugin Cache
    175 
    176     public static function clearWpCache() {
    177 
    178         global $wp_fastest_cache;
    179 
    180         if ( function_exists( 'rocket_clean_domain' ) ) { // WP Rocket
    181             rocket_clean_domain();
    182         }
    183 
    184         if ( function_exists( 'wp_cache_flush' ) ) {
    185             wp_cache_flush();
    186         }
    187 
    188         // Purge entire WP Rocket cache.
    189         if (class_exists('\LiteSpeed\Purge')) {
    190             \LiteSpeed\Purge::purge_all();
    191         }
    192 
    193         if ( function_exists( 'wp_cache_clear_cache' ) ) { // WP Super Cache
    194             wp_cache_clear_cache();
    195         }
    196 
    197         if ( function_exists( 'w3tc_flush_posts' ) ) { // W3 Total Cache
    198             w3tc_flush_posts();
    199         }
    200         if ( has_action( 'ce_clear_cache' ) ) { // Cache Enabler
    201             do_action( 'ce_clear_cache' );
    202         }
    203         if ( class_exists( 'Breeze_PurgeCache' ) ) { // Breeze
    204             if ( method_exists( 'Breeze_PurgeCache', 'breeze_cache_flush' ) ) {
    205                 Breeze_PurgeCache::breeze_cache_flush();
    206             }
    207         }
    208 
    209         if ( class_exists( 'Swift_Performance_Cache' ) ) {
    210             if ( method_exists( 'Swift_Performance_Cache', 'clear_all_cache' ) ) {
    211                 Swift_Performance_Cache::clear_all_cache();
    212             }
    213         }
    214 
    215         if ( method_exists( 'WpFastestCache', 'deleteCache' ) && ! empty( $wp_fastest_cache ) ) { // WP Fastest Cache
    216             $wp_fastest_cache->deleteCache();
    217         }
    218 
    219         if ( class_exists( 'WpeCommon' ) ) { // Autoptimize
    220             if ( method_exists( 'WpeCommon', 'purge_memcached' ) ) {
    221                 WpeCommon::purge_memcached();
    222             }
    223             if ( method_exists( 'WpeCommon', 'clear_maxcdn_cache' ) ) {
    224                 WpeCommon::clear_maxcdn_cache();
    225             }
    226             if ( method_exists( 'WpeCommon', 'purge_varnish_cache' ) ) {
    227                 WpeCommon::purge_varnish_cache();
    228             }
    229         }
    230 
    231         if ( function_exists('sg_cachepress_purge_cache') ) { // SGOptimzer
    232             sg_cachepress_purge_cache();
    233         }
    234     }
    235175    /**
    236176     * Update product metafield
     
    244184        }
    245185    }
    246 
    247 
    248     /**
    249      * Update settings
    250      *
    251      * @param Request object $request Data.
    252      * @return JSON data
    253      */
    254     public static function updateSettings($option_key, $option_value){
    255         update_option($option_key, $option_value);
    256     }
    257 
    258186
    259187    /**
  • ryviu/trunk/ryviu.php

    r3133949 r3137890  
    4242define('RYVIU_URL_ASSETS', plugins_url( 'assets/', __FILE__ ) );
    4343define('RYVIU_APP_HOOK_URL', 'https://app.ryviu.io/webhook/woocommerce/');
     44define('RYVIU_NAMESPACE', 'ryviu/v1');
    4445
    4546add_action( 'before_woocommerce_init', function() {
Note: See TracChangeset for help on using the changeset viewer.