From afeb24ee00430058f82d46feeaa32f0cfafea6f8 Mon Sep 17 00:00:00 2001 From: magepeopleteam Date: Mon, 20 Jul 2020 10:01:44 +0000 Subject: [PATCH] version 3.3.1 --- inc/admin_setting_panel.php | 13 + inc/mep_functions.php | 40 +- inc/mep_shortcode.php | 2 + inc/template-prts/event_location.php | 7 +- inc/template-prts/event_speakers_list.php | 20 +- inc/template-prts/shortcode_speaker_list.php | 11 + lib/appsero/.gitignore | 16 + lib/appsero/composer.json | 21 + lib/appsero/readme.md | 216 +++++ lib/appsero/src/Client.php | 238 +++++ lib/appsero/src/Insights.php | 949 +++++++++++++++++++ lib/appsero/src/License.php | 705 ++++++++++++++ lib/appsero/src/Updater.php | 247 +++++ readme.txt | 18 +- templates/all-speaker-list.php | 10 + templates/list/default.php | 1 + templates/single-speaker.php | 35 + templates/themes/theme-3.php | 2 +- woocommerce-event-press.php | 11 +- 19 files changed, 2541 insertions(+), 21 deletions(-) create mode 100755 lib/appsero/.gitignore create mode 100755 lib/appsero/composer.json create mode 100755 lib/appsero/readme.md create mode 100755 lib/appsero/src/Client.php create mode 100755 lib/appsero/src/Insights.php create mode 100755 lib/appsero/src/License.php create mode 100755 lib/appsero/src/Updater.php create mode 100755 templates/all-speaker-list.php diff --git a/inc/admin_setting_panel.php b/inc/admin_setting_panel.php index 4fa66e8..30fa0cb 100644 --- a/inc/admin_setting_panel.php +++ b/inc/admin_setting_panel.php @@ -382,10 +382,23 @@ if (!class_exists('MAGE_Events_Setting_Controls')) : ), 'email_setting_sec' => apply_filters('mep_settings_email_arr',array( + array( + 'name' => 'mep_email_sending_order_status', + 'label' => __( 'Email Sent on order status', 'mage-eventpress' ), + 'desc' => __( 'Please Select when and which order status event confirmation email will send to customer', 'mage-eventpress' ), + 'type' => 'multicheck', + 'default' => array( 'completed' => 'completed' ), + 'options' => array( + 'processing' => 'Processing', + 'completed' => 'Completed' + ) + ), + array( 'name' => 'mep_email_form_name', 'label' => __('Email Form Name', 'mage-eventpress'), 'desc' => __('Email Form Name', 'mage-eventpress'), + 'default' => '', 'type' => 'text' ), array( diff --git a/inc/mep_functions.php b/inc/mep_functions.php index 75da8a9..7704303 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -1,6 +1,8 @@ 'completed')); + // mep_email_sending_order_status + + foreach ( $order->get_items() as $item_id => $item_values ) { $item_id = $item_id; @@ -702,11 +706,19 @@ if (!function_exists('change_wc_event_product_status')) { if($order->has_status( 'processing' ) ) { + + if(in_array('processing',$email_send_status)){ + mep_event_confirmation_email_sent($event_id,$email); + } + change_attandee_order_status($order_id,'publish','trash','processing'); change_attandee_order_status($order_id,'publish','publish','processing'); change_extra_service_status($order_id,'publish','trash','processing'); change_extra_service_status($order_id,'publish','publish','processing'); + + + } if($order->has_status( 'pending' )) { change_attandee_order_status($order_id,'publish','trash','pending'); @@ -720,7 +732,11 @@ if (!function_exists('change_wc_event_product_status')) { change_attandee_order_status($order_id,'publish','publish','on-hold'); } if($order->has_status( 'completed' ) ) { - mep_event_confirmation_email_sent($event_id,$email); + + if(in_array('completed',$email_send_status)){ + mep_event_confirmation_email_sent($event_id,$email); + } + change_attandee_order_status($order_id,'publish','trash','completed'); change_attandee_order_status($order_id,'publish','publish','completed'); @@ -867,20 +883,20 @@ if (!function_exists('change_wc_event_product_status')) { ?>
- + - +
'mep_events_attendees', 'posts_per_page' => -1, diff --git a/inc/mep_shortcode.php b/inc/mep_shortcode.php index 7233d17..2098f93 100644 --- a/inc/mep_shortcode.php +++ b/inc/mep_shortcode.php @@ -380,6 +380,8 @@ function mep_event_speaker_list_shortcode_section($atts, $content = null) ob_start(); if($event > 0){ echo mep_shortcode_speaker_list_html($event); + }else{ + echo mep_shortcode_all_speaker_list_html(); } return ob_get_clean(); } diff --git a/inc/template-prts/event_location.php b/inc/template-prts/event_location.php index d3a7f96..6fa7a09 100755 --- a/inc/template-prts/event_location.php +++ b/inc/template-prts/event_location.php @@ -119,11 +119,10 @@ $location_sts = get_post_meta($event,'mep_org_address',true); if($location_sts){ $org_arr = get_the_terms( $event, 'mep_org' ); $org_id = $org_arr[0]->term_id; - echo "".get_term_meta( $org_id, 'org_location', true ).""; + echo get_term_meta( $org_id, 'org_location', true ); }else{ -?> - - array('mep_event_speaker'), + 'posts_per_page' => -1 + + ); + $loop = new WP_Query($args); + echo ''; + } +} diff --git a/inc/template-prts/shortcode_speaker_list.php b/inc/template-prts/shortcode_speaker_list.php index 41784c0..10c5bb0 100644 --- a/inc/template-prts/shortcode_speaker_list.php +++ b/inc/template-prts/shortcode_speaker_list.php @@ -14,3 +14,14 @@ if (!function_exists('mep_shortcode_speaker_list_html')) { +
+ +
+=5.3" + } +} diff --git a/lib/appsero/readme.md b/lib/appsero/readme.md new file mode 100755 index 0000000..fd6e02f --- /dev/null +++ b/lib/appsero/readme.md @@ -0,0 +1,216 @@ +# Appsero - Client + +- [Installation](#installation) +- [Insights](#insights) +- [Dynamic Usage](#dynamic-usage) + + +## Installation + +You can install AppSero Client in two ways, via composer and manually. + +### 1. Composer Installation + +Add dependency in your project (theme/plugin): + +``` +composer require appsero/client +``` + +Now add `autoload.php` in your file if you haven't done already. + +```php +require __DIR__ . '/vendor/autoload.php'; +``` + +### 2. Manual Installation + +Clone the repository in your project. + +``` +cd /path/to/your/project/folder +git clone https://github.com/AppSero/client.git appsero +``` + +Now include the dependencies in your plugin/theme. + +```php +require __DIR__ . '/appsero/src/Client.php'; +``` + +## Insights + +AppSero can be used in both themes and plugins. + +The `Appsero\Client` class has *three* parameters: + +```php +$client = new Appsero\Client( $hash, $name, $file ); +``` + +- **hash** (*string*, *required*) - The unique identifier for a plugin or theme. +- **name** (*string*, *required*) - The name of the plugin or theme. +- **file** (*string*, *required*) - The **main file** path of the plugin. For theme, path to `functions.php` + +### Usage Example + +Please refer to the **installation** step before start using the class. + +You can obtain the **hash** for your plugin for the [Appsero Dashboard](https://dashboard.appsero.com). The 3rd parameter **must** have to be the main file of the plugin. + +```php +/** + * Initialize the tracker + * + * @return void + */ +function appsero_init_tracker_appsero_test() { + + if ( ! class_exists( 'Appsero\Client' ) ) { + require_once __DIR__ . '/appsero/src/Client.php'; + } + + $client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044891', 'Akismet', __FILE__ ); + + // Active insights + $client->insights()->init(); + + // Active automatic updater + $client->updater(); + + // Active license page and checker + $args = array( + 'type' => 'options', + 'menu_title' => 'Akismet', + 'page_title' => 'Akismet License Settings', + 'menu_slug' => 'akismet_settings', + ); + $client->license()->add_settings_page( $args ); +} + +appsero_init_tracker_appsero_test(); +``` + +Make sure you call this function directly, never use any action hook to call this function. + +> For plugins example code that needs to be used on your main plugin file. +> For themes example code that needs to be used on your themes `functions.php` file. + +## More Usage + +```php +$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044892', 'Twenty Twelve', __FILE__ ); +``` + +#### 1. Hiding the notice + +Sometimes you wouldn't want to show the notice, or want to customize the notice message. You can do that as well. + +```php +$client->insights() + ->hide_notice() + ->init(); +``` + +#### 2. Customizing the notice message + +```php +$client->insights() + ->notice( 'My Custom Notice Message' ) + ->init(); +``` + +#### 3. Adding extra data + +You can add extra metadata from your theme or plugin. In that case, the **keys** has to be whitelisted from the Appsero dashboard. +`add_extra` method also support callback as parameter, If you need database call then callback is best for you. + +```php +$metadata = array( + 'key' => 'value', + 'another' => 'another_value' +); +$client->insights() + ->add_extra( $metadata ) + ->init(); +``` + +Or if you want to run a query then pass callback, we will call the function when it is necessary. + +```php +$metadata = function () { + $total_posts = wp_count_posts(); + + return array( + 'total_posts' => $total_posts, + 'another' => 'another_value' + ); +}; +$client->insights() + ->add_extra( $metadata ) + ->init(); +``` + +#### 4. Set textdomain + +You may set your own textdomain to translate text. + +```php +$client->set_textdomain( 'your-project-textdomain' ); +``` + +--- + +### Check License Validity + +Check your plugin/theme is using with valid license or not, First create a global variable of `License` object then use it anywhere in your code. +If you are using it outside of same function make sure you global the variable before using the condition. + +```php +$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044892', 'Twenty Twelve', __FILE__ ); + +$args = array( + 'type' => 'submenu', + 'menu_title' => 'Twenty Twelve License', + 'page_title' => 'Twenty Twelve License Settings', + 'menu_slug' => 'twenty_twelve_settings', + 'parent_slug' => 'themes.php', +); + +global $twenty_twelve_license; +$twenty_twelve_license = $client->license(); +$twenty_twelve_license->add_settings_page( $args ); + +if ( $twenty_twelve_license->is_valid() ) { + // Your special code here +} + +Or check by pricing plan title + +if ( $twenty_twelve_license->is_valid_by( 'title', 'Business' ) ) { + // Your special code here +} +``` + +### Use your own license form + +You can easily manage license by creating a form using HTTP request. Call `license_form_submit` method from License object. + +```php +global $twenty_twelve_license; // License object +$twenty_twelve_license->license_form_submit([ + '_nonce' => wp_create_nonce( 'Twenty Twelve' ), // create a nonce with name + '_action' => 'active', // active, deactive + 'license_key' => 'random-license-key', // no need to provide if you want to deactive +]); +if ( ! $twenty_twelve_license->error ) { + // license activated + $twenty_twelve_license->success; // Success message is here +} else { + $twenty_twelve_license->error; // has error message here +} +``` + +## Credits + +Created and maintained by [Appsero](https://appsero.com). diff --git a/lib/appsero/src/Client.php b/lib/appsero/src/Client.php new file mode 100755 index 0000000..8061e8f --- /dev/null +++ b/lib/appsero/src/Client.php @@ -0,0 +1,238 @@ +hash = $hash; + $this->name = $name; + $this->file = $file; + + $this->set_basename_and_slug(); + } + + /** + * Initialize insights class + * + * @return Appsero\Insights + */ + public function insights() { + + if ( ! class_exists( __NAMESPACE__ . '\Insights') ) { + require_once __DIR__ . '/Insights.php'; + } + + return new Insights( $this ); + } + + /** + * Initialize plugin/theme updater + * + * @return Appsero\Updater + */ + public function updater() { + + if ( ! class_exists( __NAMESPACE__ . '\Updater') ) { + require_once __DIR__ . '/Updater.php'; + } + + return new Updater( $this ); + } + + /** + * Initialize license checker + * + * @return Appsero\License + */ + public function license() { + + if ( ! class_exists( __NAMESPACE__ . '\License') ) { + require_once __DIR__ . '/License.php'; + } + + return new License( $this ); + } + + /** + * API Endpoint + * + * @return string + */ + public function endpoint() { + $endpoint = apply_filters( 'appsero_endpoint', 'https://api.appsero.com' ); + + return trailingslashit( $endpoint ); + } + + /** + * Set project basename, slug and version + * + * @return void + */ + protected function set_basename_and_slug() { + + if ( strpos( $this->file, WP_CONTENT_DIR . '/themes/' ) === false ) { + $this->basename = plugin_basename( $this->file ); + + list( $this->slug, $mainfile) = explode( '/', $this->basename ); + + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + + $plugin_data = get_plugin_data( $this->file ); + + $this->project_version = $plugin_data['Version']; + $this->type = 'plugin'; + } else { + $this->basename = str_replace( WP_CONTENT_DIR . '/themes/', '', $this->file ); + + list( $this->slug, $mainfile) = explode( '/', $this->basename ); + + $theme = wp_get_theme( $this->slug ); + + $this->project_version = $theme->version; + $this->type = 'theme'; + } + + $this->textdomain = $this->slug; + } + + /** + * Send request to remote endpoint + * + * @param array $params + * @param string $route + * + * @return array|WP_Error Array of results including HTTP headers or WP_Error if the request failed. + */ + public function send_request( $params, $route, $blocking = false ) { + $url = $this->endpoint() . $route; + + $headers = array( + 'user-agent' => 'Appsero/' . md5( esc_url( home_url() ) ) . ';', + 'Accept' => 'application/json', + ); + + $response = wp_remote_post( $url, array( + 'method' => 'POST', + 'timeout' => 30, + 'redirection' => 5, + 'httpversion' => '1.0', + 'blocking' => $blocking, + 'headers' => $headers, + 'body' => array_merge( $params, array( 'client' => $this->version ) ), + 'cookies' => array() + ) ); + + return $response; + } + + /** + * Check if the current server is localhost + * + * @return boolean + */ + public function is_local_server() { + $is_local = in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) ); + + return apply_filters( 'appsero_is_local', $is_local ); + } + + /** + * Translate function _e() + */ + public function _etrans( $text ) { + call_user_func( '_e', $text, $this->textdomain ); + } + + /** + * Translate function __() + */ + public function __trans( $text ) { + return call_user_func( '__', $text, $this->textdomain ); + } + + /** + * Set project textdomain + */ + public function set_textdomain( $textdomain ) { + $this->textdomain = $textdomain; + } +} diff --git a/lib/appsero/src/Insights.php b/lib/appsero/src/Insights.php new file mode 100755 index 0000000..32e1369 --- /dev/null +++ b/lib/appsero/src/Insights.php @@ -0,0 +1,949 @@ +client = $client; + } + } + + /** + * Don't show the notice + * + * @return \self + */ + public function hide_notice() { + $this->show_notice = false; + + return $this; + } + + /** + * Add extra data if needed + * + * @param array $data + * + * @return \self + */ + public function add_extra( $data = array() ) { + $this->extra_data = $data; + + return $this; + } + + /** + * Set custom notice text + * + * @param string $text + * + * @return \self + */ + public function notice( $text ) { + $this->notice = $text; + + return $this; + } + + /** + * Initialize insights + * + * @return void + */ + public function init() { + if ( $this->client->type == 'plugin' ) { + $this->init_plugin(); + } else if ( $this->client->type == 'theme' ) { + $this->init_theme(); + } + } + + /** + * Initialize theme hooks + * + * @return void + */ + public function init_theme() { + $this->init_common(); + + add_action( 'switch_theme', array( $this, 'deactivation_cleanup' ) ); + add_action( 'switch_theme', array( $this, 'theme_deactivated' ), 12, 3 ); + } + + /** + * Initialize plugin hooks + * + * @return void + */ + public function init_plugin() { + // plugin deactivate popup + if ( ! $this->is_local_server() ) { + add_filter( 'plugin_action_links_' . $this->client->basename, array( $this, 'plugin_action_links' ) ); + add_action( 'admin_footer', array( $this, 'deactivate_scripts' ) ); + } + + $this->init_common(); + + register_activation_hook( $this->client->file, array( $this, 'activate_plugin' ) ); + register_deactivation_hook( $this->client->file, array( $this, 'deactivation_cleanup' ) ); + } + + /** + * Initialize common hooks + * + * @return void + */ + protected function init_common() { + + if ( $this->show_notice ) { + // tracking notice + add_action( 'admin_notices', array( $this, 'admin_notice' ) ); + } + + add_action( 'admin_init', array( $this, 'handle_optin_optout' ) ); + + // uninstall reason + add_action( 'wp_ajax_' . $this->client->slug . '_submit-uninstall-reason', array( $this, 'uninstall_reason_submission' ) ); + + // cron events + add_filter( 'cron_schedules', array( $this, 'add_weekly_schedule' ) ); + add_action( $this->client->slug . '_tracker_send_event', array( $this, 'send_tracking_data' ) ); + // add_action( 'admin_init', array( $this, 'send_tracking_data' ) ); // test + } + + /** + * Send tracking data to AppSero server + * + * @param boolean $override + * + * @return void + */ + public function send_tracking_data( $override = false ) { + // skip on AJAX Requests + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { + return; + } + + if ( ! $this->tracking_allowed() && ! $override ) { + return; + } + + // Send a maximum of once per week + $last_send = $this->get_last_send(); + + if ( $last_send && $last_send > strtotime( '-1 week' ) ) { + return; + } + + $response = $this->client->send_request( $this->get_tracking_data(), 'track' ); + + update_option( $this->client->slug . '_tracking_last_send', time() ); + } + + /** + * Get the tracking data points + * + * @return array + */ + protected function get_tracking_data() { + $all_plugins = $this->get_all_plugins(); + + $users = get_users( array( + 'role' => 'administrator', + 'orderby' => 'ID', + 'order' => 'ASC', + 'number' => 1, + 'paged' => 1, + ) ); + + $admin_user = ( is_array( $users ) && ! empty( $users ) ) ? $users[0] : false; + $first_name = $last_name = ''; + + if ( $admin_user ) { + $first_name = $admin_user->first_name ? $admin_user->first_name : $admin_user->display_name; + $last_name = $admin_user->last_name; + } + + $data = array( + 'client_version' => $this->client->version, + 'url' => esc_url( home_url() ), + 'site' => $this->get_site_name(), + 'admin_email' => get_option( 'admin_email' ), + 'first_name' => $first_name, + 'last_name' => $last_name, + 'hash' => $this->client->hash, + 'server' => $this->get_server_info(), + 'wp' => $this->get_wp_info(), + 'users' => $this->get_user_counts(), + 'active_plugins' => count( $all_plugins['active_plugins'] ), + 'inactive_plugins' => count( $all_plugins['inactive_plugins'] ), + 'ip_address' => $this->get_user_ip_address(), + 'project_version' => $this->client->project_version, + ); + + // Add metadata + if ( $extra = $this->get_extra_data() ) { + $data['extra'] = $extra; + } + + return apply_filters( $this->client->slug . '_tracker_data', $data ); + } + + /** + * If a child class wants to send extra data + * + * @return mixed + */ + protected function get_extra_data() { + if ( is_callable( $this->extra_data ) ) { + return call_user_func( $this->extra_data ); + } + + if ( is_array( $this->extra_data ) ) { + return $this->extra_data; + } + + return array(); + } + + /** + * Explain the user which data we collect + * + * @return array + */ + protected function data_we_collect() { + $data = array( + 'Server environment details (php, mysql, server, WordPress versions)', + 'Number of users in your site', + 'Site language', + 'Number of active and inactive plugins', + 'Site name and url', + 'Your name and email address', + ); + + return $data; + } + + /** + * Check if the user has opted into tracking + * + * @return bool + */ + public function tracking_allowed() { + $allow_tracking = get_option( $this->client->slug . '_allow_tracking', 'no' ); + + return $allow_tracking == 'yes'; + } + + /** + * Get the last time a tracking was sent + * + * @return false|string + */ + private function get_last_send() { + return get_option( $this->client->slug . '_tracking_last_send', false ); + } + + /** + * Check if the notice has been dismissed or enabled + * + * @return boolean + */ + public function notice_dismissed() { + $hide_notice = get_option( $this->client->slug . '_tracking_notice', null ); + + if ( 'hide' == $hide_notice ) { + return true; + } + + return false; + } + + /** + * Check if the current server is localhost + * + * @return boolean + */ + private function is_local_server() { + return false; + + $is_local = in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) ); + + return apply_filters( 'appsero_is_local', $is_local ); + } + + /** + * Schedule the event weekly + * + * @return void + */ + private function schedule_event() { + $hook_name = $this->client->slug . '_tracker_send_event'; + + if ( ! wp_next_scheduled( $hook_name ) ) { + wp_schedule_event( time(), 'weekly', $hook_name ); + } + } + + /** + * Clear any scheduled hook + * + * @return void + */ + private function clear_schedule_event() { + wp_clear_scheduled_hook( $this->client->slug . '_tracker_send_event' ); + } + + /** + * Display the admin notice to users that have not opted-in or out + * + * @return void + */ + public function admin_notice() { + + if ( $this->notice_dismissed() ) { + return; + } + + if ( $this->tracking_allowed() ) { + return; + } + + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + + // don't show tracking if a local server + if ( ! $this->is_local_server() ) { + $optin_url = add_query_arg( $this->client->slug . '_tracker_optin', 'true' ); + $optout_url = add_query_arg( $this->client->slug . '_tracker_optout', 'true' ); + + if ( empty( $this->notice ) ) { + $notice = sprintf( $this->client->__trans( 'Want to help make %1$s even more awesome? Allow %1$s to collect non-sensitive diagnostic data and usage information.' ), $this->client->name ); + } else { + $notice = $this->notice; + } + + $policy_url = 'https://' . 'appsero.com/privacy-policy/'; + + $notice .= ' (' . $this->client->__trans( 'what we collect' ) . ')'; + $notice .= ''; + + echo '

'; + echo $notice; + echo '

'; + echo ' ' . $this->client->__trans( 'Allow' ) . ''; + echo ' ' . $this->client->__trans( 'No thanks' ) . ''; + echo '

'; + + echo " + "; + } + } + + /** + * handle the optin/optout + * + * @return void + */ + public function handle_optin_optout() { + + if ( isset( $_GET[ $this->client->slug . '_tracker_optin' ] ) && $_GET[ $this->client->slug . '_tracker_optin' ] == 'true' ) { + $this->optin(); + + wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optin' ) ); + exit; + } + + if ( isset( $_GET[ $this->client->slug . '_tracker_optout' ] ) && $_GET[ $this->client->slug . '_tracker_optout' ] == 'true' ) { + $this->optout(); + + wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optout' ) ); + exit; + } + } + + /** + * Tracking optin + * + * @return void + */ + public function optin() { + update_option( $this->client->slug . '_allow_tracking', 'yes' ); + update_option( $this->client->slug . '_tracking_notice', 'hide' ); + + $this->clear_schedule_event(); + $this->schedule_event(); + $this->send_tracking_data(); + } + + /** + * Optout from tracking + * + * @return void + */ + public function optout() { + update_option( $this->client->slug . '_allow_tracking', 'no' ); + update_option( $this->client->slug . '_tracking_notice', 'hide' ); + + $this->clear_schedule_event(); + } + + /** + * Get the number of post counts + * + * @param string $post_type + * + * @return integer + */ + public function get_post_count( $post_type ) { + global $wpdb; + + return (int) $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts WHERE post_type = '$post_type' and post_status = 'publish'"); + } + + /** + * Get server related info. + * + * @return array + */ + private static function get_server_info() { + global $wpdb; + + $server_data = array(); + + if ( isset( $_SERVER['SERVER_SOFTWARE'] ) && ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) { + $server_data['software'] = $_SERVER['SERVER_SOFTWARE']; + } + + if ( function_exists( 'phpversion' ) ) { + $server_data['php_version'] = phpversion(); + } + + $server_data['mysql_version'] = $wpdb->db_version(); + + $server_data['php_max_upload_size'] = size_format( wp_max_upload_size() ); + $server_data['php_default_timezone'] = date_default_timezone_get(); + $server_data['php_soap'] = class_exists( 'SoapClient' ) ? 'Yes' : 'No'; + $server_data['php_fsockopen'] = function_exists( 'fsockopen' ) ? 'Yes' : 'No'; + $server_data['php_curl'] = function_exists( 'curl_init' ) ? 'Yes' : 'No'; + + return $server_data; + } + + /** + * Get WordPress related data. + * + * @return array + */ + private function get_wp_info() { + $wp_data = array(); + + $wp_data['memory_limit'] = WP_MEMORY_LIMIT; + $wp_data['debug_mode'] = ( defined('WP_DEBUG') && WP_DEBUG ) ? 'Yes' : 'No'; + $wp_data['locale'] = get_locale(); + $wp_data['version'] = get_bloginfo( 'version' ); + $wp_data['multisite'] = is_multisite() ? 'Yes' : 'No'; + $wp_data['theme_slug'] = get_stylesheet(); + + $theme = wp_get_theme( $wp_data['theme_slug'] ); + + $wp_data['theme_name'] = $theme->get( 'Name' ); + $wp_data['theme_version'] = $theme->get( 'Version' ); + $wp_data['theme_uri'] = $theme->get( 'ThemeURI' ); + $wp_data['theme_author'] = $theme->get( 'Author' ); + + return $wp_data; + } + + /** + * Get the list of active and inactive plugins + * + * @return array + */ + private function get_all_plugins() { + // Ensure get_plugins function is loaded + if ( ! function_exists( 'get_plugins' ) ) { + include ABSPATH . '/wp-admin/includes/plugin.php'; + } + + $plugins = get_plugins(); + $active_plugins_keys = get_option( 'active_plugins', array() ); + $active_plugins = array(); + + foreach ( $plugins as $k => $v ) { + // Take care of formatting the data how we want it. + $formatted = array(); + $formatted['name'] = strip_tags( $v['Name'] ); + + if ( isset( $v['Version'] ) ) { + $formatted['version'] = strip_tags( $v['Version'] ); + } + + if ( isset( $v['Author'] ) ) { + $formatted['author'] = strip_tags( $v['Author'] ); + } + + if ( isset( $v['Network'] ) ) { + $formatted['network'] = strip_tags( $v['Network'] ); + } + + if ( isset( $v['PluginURI'] ) ) { + $formatted['plugin_uri'] = strip_tags( $v['PluginURI'] ); + } + + if ( in_array( $k, $active_plugins_keys ) ) { + // Remove active plugins from list so we can show active and inactive separately + unset( $plugins[$k] ); + $active_plugins[$k] = $formatted; + } else { + $plugins[$k] = $formatted; + } + } + + return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins ); + } + + /** + * Get user totals based on user role. + * + * @return array + */ + public function get_user_counts() { + $user_count = array(); + $user_count_data = count_users(); + $user_count['total'] = $user_count_data['total_users']; + + // Get user count based on user role + foreach ( $user_count_data['avail_roles'] as $role => $count ) { + if ( ! $count ) { + continue; + } + + $user_count[ $role ] = $count; + } + + return $user_count; + } + + /** + * Add weekly cron schedule + * + * @param array $schedules + * + * @return array + */ + public function add_weekly_schedule( $schedules ) { + + $schedules['weekly'] = array( + 'interval' => DAY_IN_SECONDS * 7, + 'display' => 'Once Weekly', + ); + + return $schedules; + } + + /** + * Plugin activation hook + * + * @return void + */ + public function activate_plugin() { + $allowed = get_option( $this->client->slug . '_allow_tracking', 'no' ); + + // if it wasn't allowed before, do nothing + if ( 'yes' !== $allowed ) { + return; + } + + // re-schedule and delete the last sent time so we could force send again + $hook_name = $this->client->slug . '_tracker_send_event'; + if ( ! wp_next_scheduled( $hook_name ) ) { + wp_schedule_event( time(), 'weekly', $hook_name ); + } + + delete_option( $this->client->slug . '_tracking_last_send' ); + + $this->send_tracking_data( true ); + } + + /** + * Clear our options upon deactivation + * + * @return void + */ + public function deactivation_cleanup() { + $this->clear_schedule_event(); + + if ( 'theme' == $this->client->type ) { + delete_option( $this->client->slug . '_tracking_last_send' ); + delete_option( $this->client->slug . '_allow_tracking' ); + } + + delete_option( $this->client->slug . '_tracking_notice' ); + } + + /** + * Hook into action links and modify the deactivate link + * + * @param array $links + * + * @return array + */ + public function plugin_action_links( $links ) { + + if ( array_key_exists( 'deactivate', $links ) ) { + $links['deactivate'] = str_replace( ' 'could-not-understand', + 'text' => $this->client->__trans( "I couldn't understand how to make it work" ), + 'type' => 'textarea', + 'placeholder' => $this->client->__trans( 'Would you like us to assist you?' ) + ), + array( + 'id' => 'found-better-plugin', + 'text' => $this->client->__trans( 'I found a better plugin' ), + 'type' => 'text', + 'placeholder' => $this->client->__trans( 'Which plugin?' ) + ), + array( + 'id' => 'not-have-that-feature', + 'text' => $this->client->__trans( "The plugin is great, but I need specific feature that you don't support" ), + 'type' => 'textarea', + 'placeholder' => $this->client->__trans( 'Could you tell us more about that feature?' ) + ), + array( + 'id' => 'is-not-working', + 'text' => $this->client->__trans( 'The plugin is not working' ), + 'type' => 'textarea', + 'placeholder' => $this->client->__trans( 'Could you tell us a bit more whats not working?' ) + ), + array( + 'id' => 'looking-for-other', + 'text' => $this->client->__trans( "It's not what I was looking for" ), + 'type' => '', + 'placeholder' => '' + ), + array( + 'id' => 'did-not-work-as-expected', + 'text' => $this->client->__trans( "The plugin didn't work as expected" ), + 'type' => 'textarea', + 'placeholder' => $this->client->__trans( 'What did you expect?' ) + ), + array( + 'id' => 'other', + 'text' => $this->client->__trans( 'Other' ), + 'type' => 'textarea', + 'placeholder' => $this->client->__trans( 'Could you tell us a bit more?' ) + ), + ); + + return $reasons; + } + + /** + * Plugin deactivation uninstall reason submission + * + * @return void + */ + public function uninstall_reason_submission() { + + if ( ! isset( $_POST['reason_id'] ) ) { + wp_send_json_error(); + } + + $data = $this->get_tracking_data(); + $data['reason_id'] = sanitize_text_field( $_POST['reason_id'] ); + $data['reason_info'] = isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : ''; + + $this->client->send_request( $data, 'deactivate' ); + + wp_send_json_success(); + } + + /** + * Handle the plugin deactivation feedback + * + * @return void + */ + public function deactivate_scripts() { + global $pagenow; + + if ( 'plugins.php' != $pagenow ) { + return; + } + + $reasons = $this->get_uninstall_reasons(); + ?> + +
+
+
+

client->_etrans( 'If you have a moment, please let us know why you are deactivating:' ); ?>

+
+ +
+
    + +
  • + +
  • + +
+

+ client->__trans( 'We share your data with Appsero to troubleshoot problems & make product improvements. Learn more about how Appsero handles your data.'), + esc_url( 'https://appsero.com/' ), + esc_url( 'https://appsero.com/privacy-policy' ) + ); + ?> +

+
+ + +
+
+ + + + + + get_template() == $this->client->slug ) { + $this->client->send_request( $this->get_tracking_data(), 'deactivate' ); + } + } + + /** + * Get user IP Address + */ + private function get_user_ip_address() { + $response = wp_remote_get( 'https://icanhazip.com/' ); + + if ( is_wp_error( $response ) ) { + return ''; + } + + $ip = trim( wp_remote_retrieve_body( $response ) ); + + if ( ! filter_var( $ip, FILTER_VALIDATE_IP ) ) { + return ''; + } + + return $ip; + } + + /** + * Get site name + */ + private function get_site_name() { + $site_name = get_bloginfo( 'name' ); + + if ( empty( $site_name ) ) { + $site_name = get_bloginfo( 'description' ); + $site_name = wp_trim_words( $site_name, 3, '' ); + } + + if ( empty( $site_name ) ) { + $site_name = esc_url( home_url() ); + } + + return $site_name; + } +} diff --git a/lib/appsero/src/License.php b/lib/appsero/src/License.php new file mode 100755 index 0000000..1e3ac35 --- /dev/null +++ b/lib/appsero/src/License.php @@ -0,0 +1,705 @@ +client = $client; + + $this->option_key = 'appsero_' . md5( $this->client->slug ) . '_manage_license'; + + $this->schedule_hook = $this->client->slug . '_license_check_event'; + + // Run hook to check license status daily + add_action( $this->schedule_hook, array( $this, 'check_license_status' ) ); + + // Active/Deactive corn schedule + $this->run_schedule(); + } + + /** + * Check license + * + * @return boolean + */ + public function check( $license_key ) { + $route = 'public/license/' . $this->client->hash . '/check'; + + return $this->send_request( $license_key, $route ); + } + + /** + * Active a license + * + * @return boolean + */ + public function activate( $license_key ) { + $route = 'public/license/' . $this->client->hash . '/activate'; + + return $this->send_request( $license_key, $route ); + } + + /** + * Deactivate a license + * + * @return boolean + */ + public function deactivate( $license_key ) { + $route = 'public/license/' . $this->client->hash . '/deactivate'; + + return $this->send_request( $license_key, $route ); + } + + /** + * Send common request + * + * @param $license_key + * @param $route + * + * @return array + */ + protected function send_request( $license_key, $route ) { + $params = array( + 'license_key' => $license_key, + 'url' => esc_url( home_url() ), + 'is_local' => $this->client->is_local_server(), + ); + + $response = $this->client->send_request( $params, $route, true ); + + if ( is_wp_error( $response ) ) { + return array( + 'success' => false, + 'error' => $response->get_error_message() + ); + } + + $response = json_decode( wp_remote_retrieve_body( $response ), true ); + + if ( empty( $response ) || isset( $response['exception'] )) { + return array( + 'success' => false, + 'error' => 'Unknown error occurred, Please try again.' + ); + } + + if ( isset( $response['errors'] ) && isset( $response['errors']['license_key'] ) ) { + $response = array( + 'success' => false, + 'error' => $response['errors']['license_key'][0] + ); + } + + return $response; + } + + /** + * Add settings page for license + * + * @param array $args + * + * @return void + */ + public function add_settings_page( $args = array() ) { + $defaults = array( + 'type' => 'menu', // Can be: menu, options, submenu + 'page_title' => 'Manage License', + 'menu_title' => 'Manage License', + 'capability' => 'manage_options', + 'menu_slug' => $this->client->slug . '-manage-license', + 'icon_url' => '', + 'position' => null, + 'parent_slug' => '', + ); + + $this->menu_args = wp_parse_args( $args, $defaults ); + + add_action( 'admin_menu', array( $this, 'admin_menu' ), 99 ); + } + + /** + * Admin Menu hook + * + * @return void + */ + public function admin_menu() { + switch ( $this->menu_args['type'] ) { + case 'menu': + $this->create_menu_page(); + break; + + case 'submenu': + $this->create_submenu_page(); + break; + + case 'options': + $this->create_options_page(); + break; + } + } + + /** + * License menu output + */ + public function menu_output() { + + if ( isset( $_POST['submit'] ) ) { + $this->license_form_submit( $_POST ); + } + + $license = get_option( $this->option_key, null ); + $action = ( $license && isset( $license['status'] ) && 'activate' == $license['status'] ) ? 'deactive' : 'active'; + $this->licenses_style(); + ?> + +
+

License Settings

+ + show_license_page_notices(); + do_action( 'before_appsero_license_section' ); + ?> + +
+ show_license_page_card_header(); ?> + +
+

Activate client->name; ?> by your license key to get professional support and automatic update from your WordPress dashboard.

+
+ + +
+
+ + + + + /> +
+ +
+
+ + show_active_license_info( $license ); + } + ?> +
+
+ + +
+ error = "Please add all information"; + return; + } + + if ( ! wp_verify_nonce( $form['_nonce'], $this->client->name ) ) { + $this->error = "You don't have permission to manage license."; + return; + } + + switch ( $form['_action'] ) { + case 'active': + $this->active_client_license( $form ); + break; + + case 'deactive': + $this->deactive_client_license( $form ); + break; + } + } + + /** + * Check license status on schedule + */ + public function check_license_status() { + $license = get_option( $this->option_key, null ); + + if ( isset( $license['key'] ) && ! empty( $license['key'] ) ) { + $response = $this->check( $license['key'] ); + + if ( isset( $response['success'] ) && $response['success'] ) { + $license['status'] = 'activate'; + $license['remaining'] = $response['remaining']; + $license['activation_limit'] = $response['activation_limit']; + $license['expiry_days'] = $response['expiry_days']; + $license['title'] = $response['title']; + $license['source_id'] = $response['source_identifier']; + $license['recurring'] = $response['recurring']; + } else { + $license['status'] = 'deactivate'; + $license['expiry_days'] = 0; + } + + update_option( $this->option_key, $license, false ); + } + } + + /** + * Check this is a valid license + */ + public function is_valid() { + if ( null !== $this->is_valid_licnese ) { + return $this->is_valid_licnese; + } + + $license = get_option( $this->option_key, null ); + if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) { + $this->is_valid_licnese = true; + } else { + $this->is_valid_licnese = false; + } + + return $this->is_valid_licnese; + } + + /** + * Check this is a valid license + */ + public function is_valid_by( $option, $value ) { + $license = get_option( $this->option_key, null ); + + if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) { + if ( isset( $license[ $option ] ) && $license[ $option ] == $value ) { + return true; + } + } + + return false; + } + + /** + * Styles for licenses page + */ + private function licenses_style() { + ?> + + +
+
+

Activation Remaining

+ +

Unlimited

+ +

+ out of +

+ +
+
+

Expires in

+ 10 ? '' : 'occupied'; + echo '

' . $license['expiry_days'] . ' days

'; + } else { + echo '

Never

'; + } + ?> +
+
+ error ) ) : + ?> +
+

error; ?>

+
+ success ) ) : + ?> +
+

success; ?>

+
+ '; + } + + /** + * Card header + */ + private function show_license_page_card_header() { + ?> +
+ + + + + + Activate License +
+ error = 'The license key field is required.'; + return; + } + + $license_key = sanitize_text_field( $form['license_key'] ); + $response = $this->activate( $license_key ); + + if ( ! $response['success'] ) { + $this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.'; + return; + } + + $data = array( + 'key' => $license_key, + 'status' => 'activate', + 'remaining' => $response['remaining'], + 'activation_limit' => $response['activation_limit'], + 'expiry_days' => $response['expiry_days'], + 'title' => $response['title'], + 'source_id' => $response['source_identifier'], + 'recurring' => $response['recurring'], + ); + + update_option( $this->option_key, $data, false ); + + $this->success = 'License activated successfully.'; + } + + /** + * Deactive client license + */ + private function deactive_client_license( $form ) { + $license = get_option( $this->option_key, null ); + + if ( empty( $license['key'] ) ) { + $this->error = 'License key not found.'; + return; + } + + $response = $this->deactivate( $license['key'] ); + + $data = array( + 'key' => '', + 'status' => 'deactivate', + ); + + update_option( $this->option_key, $data, false ); + + if ( ! $response['success'] ) { + $this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.'; + return; + } + + $this->success = 'License deactivated successfully.'; + } + + /** + * Add license menu page + */ + private function create_menu_page() { + call_user_func( + 'add_' . 'menu' . '_page', + $this->menu_args['page_title'], + $this->menu_args['menu_title'], + $this->menu_args['capability'], + $this->menu_args['menu_slug'], + array( $this, 'menu_output' ), + $this->menu_args['icon_url'], + $this->menu_args['position'] + ); + } + + /** + * Add submenu page + */ + private function create_submenu_page() { + call_user_func( + 'add_' . 'submenu' . '_page', + $this->menu_args['parent_slug'], + $this->menu_args['page_title'], + $this->menu_args['menu_title'], + $this->menu_args['capability'], + $this->menu_args['menu_slug'], + array( $this, 'menu_output' ), + $this->menu_args['position'] + ); + } + + /** + * Add submenu page + */ + private function create_options_page() { + call_user_func( + 'add_' . 'options' . '_page', + $this->menu_args['page_title'], + $this->menu_args['menu_title'], + $this->menu_args['capability'], + $this->menu_args['menu_slug'], + array( $this, 'menu_output' ), + $this->menu_args['position'] + ); + } + + /** + * Schedule daily sicense checker event + */ + public function schedule_cron_event() { + if ( ! wp_next_scheduled( $this->schedule_hook ) ) { + wp_schedule_event( time(), 'daily', $this->schedule_hook ); + + wp_schedule_single_event( time() + 20, $this->schedule_hook ); + } + } + + /** + * Clear any scheduled hook + */ + public function clear_scheduler() { + wp_clear_scheduled_hook( $this->schedule_hook ); + } + + /** + * Enable/Disable schedule + */ + private function run_schedule() { + switch ( $this->client->type ) { + case 'plugin': + register_activation_hook( $this->client->file, array( $this, 'schedule_cron_event' ) ); + register_deactivation_hook( $this->client->file, array( $this, 'clear_scheduler' ) ); + break; + + case 'theme': + add_action( 'after_switch_theme', array( $this, 'schedule_cron_event' ) ); + add_action( 'switch_theme', array( $this, 'clear_scheduler' ) ); + break; + } + } + + /** + * Form action URL + */ + private function formActionUrl() { + echo add_query_arg( + array( 'page' => $_GET['page'] ), + admin_url( basename( $_SERVER['SCRIPT_NAME'] ) ) + ); + } + + /** + * Get input license key + * @param $action + * @return $license + */ + private function get_input_license_value( $action, $license ) { + if ( 'active' == $action ) { + return isset( $license['key'] ) ? $license['key'] : ''; + } + + if ( 'deactive' == $action ) { + $key_length = strlen( $license['key'] ); + + return str_pad( + substr( $license['key'], 0, $key_length / 2 ), $key_length, '*' + ); + } + + return ''; + } + +} diff --git a/lib/appsero/src/Updater.php b/lib/appsero/src/Updater.php new file mode 100755 index 0000000..0cc121c --- /dev/null +++ b/lib/appsero/src/Updater.php @@ -0,0 +1,247 @@ +client = $client; + $this->cache_key = 'appsero_' . md5( $this->client->slug ) . '_version_info'; + + // Run hooks. + if ( $this->client->type == 'plugin' ) { + $this->run_plugin_hooks(); + } elseif ( $this->client->type == 'theme' ) { + $this->run_theme_hooks(); + } + } + + /** + * Set up WordPress filter to hooks to get update. + * + * @return void + */ + public function run_plugin_hooks() { + add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_plugin_update' ) ); + add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); + } + + /** + * Set up WordPress filter to hooks to get update. + * + * @return void + */ + public function run_theme_hooks() { + add_filter( 'pre_set_site_transient_update_themes', array( $this, 'check_theme_update' ) ); + } + + /** + * Check for Update for this specific project + */ + public function check_plugin_update( $transient_data ) { + global $pagenow; + + if ( ! is_object( $transient_data ) ) { + $transient_data = new \stdClass; + } + + if ( 'plugins.php' == $pagenow && is_multisite() ) { + return $transient_data; + } + + if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->basename ] ) ) { + return $transient_data; + } + + $version_info = $this->get_cached_version_info(); + + if ( false === $version_info ) { + $version_info = $this->get_project_latest_version(); + $this->set_cached_version_info( $version_info ); + } + + if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { + + if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) { + unset( $version_info->sections ); + $transient_data->response[ $this->client->basename ] = $version_info; + } + + $transient_data->last_checked = time(); + $transient_data->checked[ $this->client->basename ] = $this->client->project_version; + } + + return $transient_data; + } + + /** + * Get version info from database + * + * @return Object or Boolean + */ + private function get_cached_version_info() { + + $value = get_transient( $this->cache_key ); + + if( ! $value && ! isset( $value->name ) ) { + return false; // Cache is expired + } + + // We need to turn the icons into an array + if ( isset( $value->icons ) ) { + $value->icons = (array) $value->icons; + } + + // We need to turn the banners into an array + if ( isset( $value->banners ) ) { + $value->banners = (array) $value->banners; + } + + if ( isset( $value->sections ) ) { + $value->sections = (array) $value->sections; + } + + return $value; + } + + /** + * Set version info to database + */ + private function set_cached_version_info( $value ) { + if ( ! $value ) { + return; + } + + set_transient( $this->cache_key, $value, 3 * HOUR_IN_SECONDS ); + } + + /** + * Get plugin info from Appsero + */ + private function get_project_latest_version() { + + $license_option_key = 'appsero_' . md5( $this->client->slug ) . '_manage_license'; + $license = get_option( $license_option_key, null ); + + $params = array( + 'version' => $this->client->project_version, + 'name' => $this->client->name, + 'slug' => $this->client->slug, + 'basename' => $this->client->basename, + 'license_key' => ! empty( $license ) && isset( $license['key'] ) ? $license['key'] : '', + ); + + $route = 'update/' . $this->client->hash . '/check'; + + $response = $this->client->send_request( $params, $route, true ); + + if ( is_wp_error( $response ) ) { + return false; + } + + $response = json_decode( wp_remote_retrieve_body( $response ) ); + + if ( ! isset( $response->slug ) ) { + return false; + } + + if ( isset( $response->icons ) ) { + $response->icons = (array) $response->icons; + } + + if ( isset( $response->banners ) ) { + $response->banners = (array) $response->banners; + } + + if ( isset( $response->sections ) ) { + $response->sections = (array) $response->sections; + } + + return $response; + } + + /** + * Updates information on the "View version x.x details" page with custom data. + * + * @param mixed $data + * @param string $action + * @param object $args + * + * @return object $data + */ + public function plugins_api_filter( $data, $action = '', $args = null ) { + + if ( $action != 'plugin_information' ) { + return $data; + } + + if ( ! isset( $args->slug ) || ( $args->slug != $this->client->slug ) ) { + return $data; + } + + $version_info = $this->get_cached_version_info(); + + if ( false === $version_info ) { + $version_info = $this->get_project_latest_version(); + $this->set_cached_version_info( $version_info ); + } + + return $version_info; + } + + /** + * Check theme upate + */ + public function check_theme_update( $transient_data ) { + global $pagenow; + + if ( ! is_object( $transient_data ) ) { + $transient_data = new \stdClass; + } + + if ( 'themes.php' == $pagenow && is_multisite() ) { + return $transient_data; + } + + if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->slug ] ) ) { + return $transient_data; + } + + $version_info = $this->get_cached_version_info(); + + if ( false === $version_info ) { + $version_info = $this->get_project_latest_version(); + $this->set_cached_version_info( $version_info ); + } + + if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { + + if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) { + $transient_data->response[ $this->client->slug ] = (array) $version_info; + } + + $transient_data->last_checked = time(); + $transient_data->checked[ $this->client->slug ] = $this->client->project_version; + } + + return $transient_data; + } + +} diff --git a/readme.txt b/readme.txt index 73a8028..2ba0428 100644 --- a/readme.txt +++ b/readme.txt @@ -272,6 +272,14 @@ https://www.youtube.com/watch?v=F9wnlUjXa6I [Woocommerce Events Manager](https://wordpress.org/plugins/mage-eventpress/) +## Privacy Policy +WooCommerce Event Manager uses [Appsero](https://appsero.com) SDK to collect some telemetry data upon user's confirmation. This helps us to troubleshoot problems faster & make product improvements. + +Appsero SDK **does not gather any data by default.** The SDK only starts gathering basic telemetry data **when a user allows it via the admin notice**. We collect the data to ensure a great user experience for all our users. + +Integrating Appsero SDK **DOES NOT IMMEDIATELY** start gathering data, **without confirmation from users in any case.** + +Learn more about how [Appsero collects and uses this data](https://appsero.com/privacy-policy/). == Installation == @@ -568,4 +576,12 @@ New Hooks added Event Label & Slug change settings added PHP Warning in cart page issue fixed More... -12 July 2020* \ No newline at end of file +12 July 2020* + + += 3.3.1 = +* Update Release: +Code Optimized & Improved +Location Typo fixed in event list +Event Confirmation email sending based on order status settings added +20 July 2020* \ No newline at end of file diff --git a/templates/all-speaker-list.php b/templates/all-speaker-list.php new file mode 100755 index 0000000..02dabdc --- /dev/null +++ b/templates/all-speaker-list.php @@ -0,0 +1,10 @@ + +
  • + '; + } ?> +
    +
    +
  • \ No newline at end of file diff --git a/templates/list/default.php b/templates/list/default.php index bafbe21..9e3f81c 100644 --- a/templates/list/default.php +++ b/templates/list/default.php @@ -95,6 +95,7 @@ + diff --git a/templates/single-speaker.php b/templates/single-speaker.php index e7a1fee..f02b2ff 100644 --- a/templates/single-speaker.php +++ b/templates/single-speaker.php @@ -12,6 +12,41 @@ the_post();
    + + +
    +
    +

    +
    +
    + array('mep_events'), + 'paged' => $paged, + // 'posts_per_page' => -1, + 'orderby' => 'meta_value', + 'meta_key' => 'event_start_datetime', + 'meta_query' => array( + array( + 'key' => 'mep_event_speakers_list', + 'value' => get_the_id(), + 'compare' => 'LIKE' + ) + ) + ); + + $loop = new WP_Query($args); + // $loop = mep_event_query(20, 'ASC', $term_id, '', '', '', 'upcoming'); + while ($loop->have_posts()) { + $loop->the_post(); + do_action('mep_event_list_shortcode', get_the_id(), 'three_column', 'grid'); + } + wp_reset_postdata(); + mep_event_pagination($loop->max_num_pages); + ?> +
    +

    - ,

    +,

    diff --git a/woocommerce-event-press.php b/woocommerce-event-press.php index 0952d58..a1a71ab 100644 --- a/woocommerce-event-press.php +++ b/woocommerce-event-press.php @@ -3,7 +3,7 @@ * Plugin Name: Woocommerce Events Manager * Plugin URI: http://mage-people.com * Description: A Complete Event Solution for WordPress by MagePeople.. - * Version: 3.3.0 + * Version: 3.3.1 * Author: MagePeople Team * Author URI: http://www.mage-people.com/ * Text Domain: mage-eventpress @@ -18,6 +18,13 @@ if (!defined('ABSPATH')) { include_once(ABSPATH . 'wp-admin/includes/plugin.php'); if (is_plugin_active('woocommerce/woocommerce.php')) { + function appsero_init_tracker_mage_eventpress() { + if ( ! class_exists( 'Appsero\Client' ) ) { + require_once __DIR__ . '/lib/appsero/src/Client.php'; + } + $client = new Appsero\Client( '08cd627c-4ed9-49cf-a9b5-1536ec384a5a', 'WooCommerce Event Manager', __FILE__ ); + $client->insights()->init(); +} require_once(dirname(__FILE__) . "/inc/mep_file_include.php"); } else { function mep_admin_notice_wc_not_active() @@ -29,4 +36,4 @@ if (is_plugin_active('woocommerce/woocommerce.php')) { ); } add_action('admin_notices', 'mep_admin_notice_wc_not_active'); -} +} \ No newline at end of file