PluginProbe
Ryviu – Review Importer & Product Reviews / 3.1.27
Ryviu – Review Importer & Product Reviews v3.1.27
3.1.28 3.1.27 trunk 2.0 3.0.2 3.0.7 3.1.14 3.1.25 3.1.26
ryviu / ryviu.php

ryviu.php in Ryviu – Review Importer & Product Reviews 3.1.27, at ryviu.php

134 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The plugin bootstrap file
4 *
5 * This file is read by WordPress to generate the plugin information in the plugin
6 * admin area. This file also includes all of the dependencies used by the plugin,
7 * registers the activation and deactivation functions, and defines a function
8 * that starts the plugin.
9 *
10 * @link https://www.ryviu.com
11 * @since 2.0.0
12 * @package Ryviu
13 *
14 * @wordpress-plugin
15 * Plugin Name: Ryviu – Review Importer & Product Reviews
16 * Plugin URI: https://www.ryviu.com
17 * Description: Import product reviews from AliExpress, Amazon, and Etsy to WooCommerce in seconds. Boost social proof for your dropshipping store with photo reviews and Q&A. With Ryviu, you can easily customize and display these reviews on your store.
18 * Version: 3.1.27
19 * Requires at least: 4.0
20 * Tested up to: 7.0
21 * WC requires at least: 3.0
22 * WC tested up to: 10.9
23 * Author: Ryviu
24 * Author URI: https://www.ryviu.com
25 * License: GPL-2.0+
26 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
27 * Text Domain: ryviu
28 * Domain Path: /languages
29 */
30
31 // If this file is called directly, abort.
32 if ( ! defined( 'WPINC' ) ) {
33 die;
34 }
35 $urlparts = wp_parse_url( site_url() );
36 $domain = $urlparts['host'];
37
38 // Allow overriding the shop domain with a static value set on the Ryviu settings page
39 // (useful when the WordPress site URL doesn't match the domain registered with Ryviu,
40 // e.g. staging/dev environments, reverse proxies, multi-domain setups).
41 $ryviu_settings_reviews = get_option( 'ryviu_settings_reviews' );
42 if ( is_array( $ryviu_settings_reviews ) && ! empty( $ryviu_settings_reviews['ryviu_static_domain'] ) ) {
43 $domain = trim( $ryviu_settings_reviews['ryviu_static_domain'] );
44 }
45
46 define('RYVIU_SHOP_DOMAIN', $domain);
47 define('RYVIU_WOO_VERSION', '3.1.27');
48 defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
49 define('RYVIU_DIR_PATH', plugin_dir_path(__FILE__) );
50 define('RYVIU_URL_ASSETS', plugins_url( 'assets/', __FILE__ ) );
51 define('RYVIU_APP_HOOK_URL', 'https://app.ryviu.io/webhook/woocommerce/');
52 define('RYVIU_NAMESPACE', 'ryviu/v1');
53
54 add_action( 'before_woocommerce_init', function() {
55 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
56 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
57 }
58 } );
59
60 require_once RYVIU_DIR_PATH . 'includes/main-class.php';
61
62 /**
63 * The code that runs during plugin activation.
64 */
65 function activate_ryviu() {
66 RyviuMain::activate();
67 }
68
69 /**
70 * The code that runs during plugin uninstall.
71 */
72 function uninstall_ryviu(){
73 RyviuMain::uninstall();
74 }
75
76 add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'code_add_plugin_page_settings_link');
77 // Add Menu Ryviu to Dashboard WordPress
78 function code_add_plugin_page_settings_link( $links ) {
79 $links[] = '<a href="' .
80 admin_url( 'options-general.php?page=ryviu-setting-admin' ) .
81 '">' . __('Settings') . '</a>';
82 return $links;
83 }
84
85 // Show notice when do not connect store with Ryviu
86 function r_admin_notices() {
87
88 $settings = get_option( 'ryviu_client_settings' );
89
90 $image_url = RYVIU_URL_ASSETS.'images/logo-ryviu-v9.png';
91
92 if(!$settings || $settings == new \stdClass()){
93 echo '<div class="notice notice-error is-dismissible r-cl-connect"><div class="r--notices"><img src="'.$image_url.'" alt="" /><p><b>Ryviu:</b> It looks like there is a problem connecting your store to Ryviu. Please <a class="ryviu-check-connect" href="javascript:void(0)">click here</a> to check the issue, or please <a target="_blank" href="https://www.ryviu.com/contact-us">contact us</a> for help.</p></div></div>';
94 echo '<div class="notice notice-success is-dismissible r-cl-connect"><p class="r--notices"><img src="'.$image_url.'" alt="" /><b>Ryviu:</b> Successful connection.</p></div>';
95 }else{
96 $ryviu_settings = get_option( 'ryviu_settings_reviews' );
97 $ryviu_version = get_option( 'ryviu_version' );
98 if (is_array($ryviu_settings) && array_key_exists('ryviu_frontend_version', $ryviu_settings)) {
99 $ryviu_frontend_version = $ryviu_settings['ryviu_frontend_version'];
100
101 if(!$ryviu_version){
102 $ryviu_version = $ryviu_frontend_version;
103 RyviuMain::ryviu_update_frontend($ryviu_frontend_version, false);
104 }else{
105 if($ryviu_frontend_version != $ryviu_version){
106 $ryviu_version = $ryviu_frontend_version;
107 RyviuMain::ryviu_update_frontend($ryviu_frontend_version, false);
108 }
109 }
110 }
111
112 if(!$ryviu_version || ($ryviu_version && $ryviu_version == 1)){
113 echo '<div class="notice notice-info is-dismissible r-cl-update"><div class="r--notices"><img src="'.$image_url.'" alt="" /><p><b>Ryviu:</b>&nbsp; Enhancing your store\'s frontend with the new design for the reviews widget, featuring a user-friendly layout and more customizable options. <a class="ryviu-view-demo" target="_blank" href="https://version2.omazing.us/">Click here</a> to see the demo or <a class="ryviu-update-frontend" href="javascript:void(0)">update now</a>.</p></div></div>';
114 echo '<div class="notice notice-success is-dismissible rpl--hide r-cl-update"><p class="r--notices"><img src="'.$image_url.'" alt="" /><b>Ryviu:</b>&nbsp; Successful update.</p></div>';
115 }
116 }
117 }
118
119
120 register_activation_hook( __FILE__, 'activate_ryviu' );
121 register_uninstall_hook( __FILE__, 'uninstall_ryviu' );
122 add_action( 'admin_notices','r_admin_notices');
123 RyviuMain::re_order_plugin();
124
125 // Include main ryviu class
126 require_once RYVIU_DIR_PATH . 'includes/class-ryviu.php';
127
128 // Main Class Called
129 function RYVIU() {
130 return RyviuWoo::instance();
131 }
132
133 $GLOBALS['RYVIU'] = RYVIU();
134