This commit is contained in:
magepeopleteam 2020-11-30 12:17:35 +00:00
parent 61fcb4134d
commit cc70ebeac4
8 changed files with 159 additions and 65 deletions

View File

@ -74,6 +74,27 @@ class Client {
*/
public $textdomain;
/**
* The Object of Insights Class
*
* @var object
*/
private $insights;
/**
* The Object of Updater Class
*
* @var object
*/
private $updater;
/**
* The Object of License Class
*
* @var object
*/
private $license;
/**
* Initialize the class
*
@ -100,7 +121,14 @@ class Client {
require_once __DIR__ . '/Insights.php';
}
return new Insights( $this );
// if already instantiated, return the cached one
if ( $this->insights ) {
return $this->insights;
}
$this->insights = new Insights( $this );
return $this->insights;
}
/**
@ -114,7 +142,14 @@ class Client {
require_once __DIR__ . '/Updater.php';
}
return new Updater( $this );
// if already instantiated, return the cached one
if ( $this->updater ) {
return $this->updater;
}
$this->updater = new Updater( $this );
return $this->updater;
}
/**
@ -128,7 +163,14 @@ class Client {
require_once __DIR__ . '/License.php';
}
return new License( $this );
// if already instantiated, return the cached one
if ( $this->license ) {
return $this->license;
}
$this->license = new License( $this );
return $this->license;
}
/**

View File

@ -753,7 +753,7 @@ class Insights {
$this->deactivation_modal_styles();
$reasons = $this->get_uninstall_reasons();
$custom_reasons = apply_filters( 'appsero_custom_deactivation_reasons', [] );
$custom_reasons = apply_filters( 'appsero_custom_deactivation_reasons', array() );
?>
<div class="wd-dr-modal" id="<?php echo $this->client->slug; ?>-wd-dr-modal">
@ -949,10 +949,10 @@ class Insights {
private function send_tracking_skipped_request() {
$skipped = get_option( $this->client->slug . '_tracking_skipped' );
$data = [
$data = array(
'hash' => $this->client->hash,
'previously_skipped' => false,
];
);
if ( $skipped === 'yes' ) {
$data['previously_skipped'] = true;

View File

@ -1,4 +1,5 @@
<?php
namespace Appsero;
/**
@ -53,7 +54,7 @@ class License {
/**
* Set value for valid licnese
*
* @var boolean
* @var bool
*/
private $is_valid_licnese = null;
@ -76,10 +77,38 @@ class License {
$this->run_schedule();
}
/**
* Set the license option key.
*
* If someone wants to override the default generated key.
*
* @param string $key
*
* @since 1.3.0
*
* @return License
*/
public function set_option_key( $key ) {
$this->option_key = $key;
return $this;
}
/**
* Get the license key
*
* @since 1.3.0
*
* @return string|null
*/
public function get_license() {
return get_option( $this->option_key, null );
}
/**
* Check license
*
* @return boolean
* @return bool
*/
public function check( $license_key ) {
$route = 'public/license/' . $this->client->hash . '/check';
@ -90,7 +119,7 @@ class License {
/**
* Active a license
*
* @return boolean
* @return bool
*/
public function activate( $license_key ) {
$route = 'public/license/' . $this->client->hash . '/activate';
@ -101,7 +130,7 @@ class License {
/**
* Deactivate a license
*
* @return boolean
* @return bool
*/
public function deactivate( $license_key ) {
$route = 'public/license/' . $this->client->hash . '/deactivate';
@ -201,13 +230,12 @@ class License {
* 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';
$license = $this->get_license();
$action = ( $license && isset( $license['status'] ) && 'activate' == $license['status'] ) ? 'deactive' : 'active';
$this->licenses_style();
?>
@ -223,7 +251,9 @@ class License {
<?php $this->show_license_page_card_header(); ?>
<div class="appsero-license-details">
<p>Activate <strong><?php echo $this->client->name; ?></strong> by your license key to get professional support and automatic update from your WordPress dashboard.</p>
<p>
<?php printf( $this->client->__trans( 'Activate <strong>%s</strong> by your license key to get professional support and automatic update from your WordPress dashboard.' ), $this->client->name ); ?>
</p>
<form method="post" action="<?php $this->formActionUrl(); ?>" novalidate="novalidate" spellcheck="false">
<input type="hidden" name="_action" value="<?php echo $action; ?>">
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce( $this->client->name ); ?>">
@ -233,12 +263,12 @@ class License {
<path d="m463.75 48.251c-64.336-64.336-169.01-64.335-233.35 1e-3 -43.945 43.945-59.209 108.71-40.181 167.46l-185.82 185.82c-2.813 2.813-4.395 6.621-4.395 10.606v84.858c0 8.291 6.709 15 15 15h84.858c3.984 0 7.793-1.582 10.605-4.395l21.211-21.226c3.237-3.237 4.819-7.778 4.292-12.334l-2.637-22.793 31.582-2.974c7.178-0.674 12.847-6.343 13.521-13.521l2.974-31.582 22.793 2.651c4.233 0.571 8.496-0.85 11.704-3.691 3.193-2.856 5.024-6.929 5.024-11.206v-27.929h27.422c3.984 0 7.793-1.582 10.605-4.395l38.467-37.958c58.74 19.043 122.38 4.929 166.33-39.046 64.336-64.335 64.336-169.01 0-233.35zm-42.435 106.07c-17.549 17.549-46.084 17.549-63.633 0s-17.549-46.084 0-63.633 46.084-17.549 63.633 0 17.548 46.084 0 63.633z"/>
</svg>
<input type="text" value="<?php echo $this->get_input_license_value( $action, $license ); ?>"
placeholder="Enter your license key to activate" name="license_key"
placeholder="<?php echo esc_attr( $this->client->__trans( 'Enter your license key to activate' ) ); ?>" name="license_key"
<?php echo ( 'deactive' == $action ) ? 'readonly="readonly"' : ''; ?>
/>
</div>
<button type="submit" name="submit" class="<?php echo 'deactive' == $action ? 'deactive-button' : ''; ?>">
<?php echo $action == 'active' ? 'Activate License' : 'Deactivate License' ; ?>
<?php echo $action == 'active' ? $this->client->__trans( 'Activate License' ) : $this->client->__trans( 'Deactivate License' ); ?>
</button>
</div>
</form>
@ -246,8 +276,7 @@ class License {
<?php
if ( 'deactive' == $action && isset( $license['remaining'] ) ) {
$this->show_active_license_info( $license );
}
?>
} ?>
</div>
</div> <!-- /.appsero-license-settings -->
@ -261,12 +290,14 @@ class License {
*/
public function license_form_submit( $form ) {
if ( ! isset( $form['_nonce'], $form['_action'] ) ) {
$this->error = "Please add all information";
$this->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;
}
@ -285,7 +316,7 @@ class License {
* Check license status on schedule
*/
public function check_license_status() {
$license = get_option( $this->option_key, null );
$license = $this->get_license();
if ( isset( $license['key'] ) && ! empty( $license['key'] ) ) {
$response = $this->check( $license['key'] );
@ -315,11 +346,12 @@ class License {
return $this->is_valid_licnese;
}
$license = get_option( $this->option_key, null );
$license = $this->get_license();
if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) {
$this->is_valid_licnese = true;
} else {
$this->is_valid_licnese = false;
$this->is_valid_licnese = false;
}
return $this->is_valid_licnese;
@ -329,7 +361,7 @@ class License {
* Check this is a valid license
*/
public function is_valid_by( $option, $value ) {
$license = get_option( $this->option_key, null );
$license = $this->get_license();
if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) {
if ( isset( $license[ $option ] ) && $license[ $option ] == $value ) {
@ -467,25 +499,24 @@ class License {
?>
<div class="active-license-info">
<div class="single-license-info">
<h3>Activation Remaining</h3>
<?php if ( empty( $license['activation_limit'] ) ): ?>
<p>Unlimited</p>
<?php else: ?>
<h3><?php $this->client->_etrans( 'Activations Remaining' ); ?></h3>
<?php if ( empty( $license['activation_limit'] ) ) { ?>
<p><?php $this->client->_etrans( 'Unlimited' ); ?></p>
<?php } else { ?>
<p class="<?php echo $license['remaining'] ? '' : 'occupied'; ?>">
<?php echo $license['remaining']; ?> out of <?php echo $license['activation_limit']; ?>
<?php printf( $this->client->__trans( '%1$d out of %2$d' ), $license['remaining'], $license['activation_limit'] ); ?>
</p>
<?php endif; ?>
<?php } ?>
</div>
<div class="single-license-info">
<h3>Expires in</h3>
<h3><?php $this->client->_etrans( 'Expires in' ); ?></h3>
<?php
if ( $license['recurring'] && false !== $license['expiry_days'] ) {
$occupied = $license['expiry_days'] > 10 ? '' : 'occupied';
if ( false !== $license['expiry_days'] ) {
$occupied = $license['expiry_days'] > 21 ? '' : 'occupied';
echo '<p class="' . $occupied . '">' . $license['expiry_days'] . ' days</p>';
} else {
echo '<p>Never</p>';
}
?>
echo '<p>' . $this->client->__trans( 'Never' ) . '</p>';
} ?>
</div>
</div>
<?php
@ -495,21 +526,22 @@ class License {
* Show license settings page notices
*/
private function show_license_page_notices() {
if ( ! empty( $this->error ) ) :
?>
if ( ! empty( $this->error ) ) {
?>
<div class="notice notice-error is-dismissible appsero-license-section">
<p><?php echo $this->error; ?></p>
</div>
<?php
endif;
if ( ! empty( $this->success ) ) :
?>
}
if ( ! empty( $this->success ) ) {
?>
<div class="notice notice-success is-dismissible appsero-license-section">
<p><?php echo $this->success; ?></p>
</div>
<?php
endif;
echo '<br />';
}
echo '<br />';
}
/**
@ -534,14 +566,16 @@ class License {
private function active_client_license( $form ) {
if ( empty( $form['license_key'] ) ) {
$this->error = 'The license key field is required.';
return;
}
$license_key = sanitize_text_field( $form['license_key'] );
$response = $this->activate( $license_key );
$response = $this->activate( $license_key );
if ( ! $response['success'] ) {
$this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.';
return;
}
@ -565,10 +599,11 @@ class License {
* Deactive client license
*/
private function deactive_client_license( $form ) {
$license = get_option( $this->option_key, null );
$license = $this->get_license();
if ( empty( $license['key'] ) ) {
$this->error = 'License key not found.';
return;
}
@ -583,6 +618,7 @@ class License {
if ( ! $response['success'] ) {
$this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.';
return;
}
@ -675,15 +711,19 @@ class License {
* Form action URL
*/
private function formActionUrl() {
echo add_query_arg(
array( 'page' => $_GET['page'] ),
$url = add_query_arg(
$_GET,
admin_url( basename( $_SERVER['SCRIPT_NAME'] ) )
);
echo apply_filters( 'appsero_client_license_form_action', $url );
}
/**
* Get input license key
*
* @param $action
*
* @return $license
*/
private function get_input_license_value( $action, $license ) {
@ -701,5 +741,4 @@ class License {
return '';
}
}

View File

@ -143,8 +143,7 @@ class Updater {
*/
private function get_project_latest_version() {
$license_option_key = 'appsero_' . md5( $this->client->slug ) . '_manage_license';
$license = get_option( $license_option_key, null );
$license = $this->client->license()->get_license();
$params = array(
'version' => $this->client->project_version,

View File

@ -7,22 +7,31 @@ $mep_hide_event_hover_btn_text = mep_get_option('mep_hide_event_hover_btn_text
<?php do_action('mep_event_list_loop_header', $event_id); ?>
<div class="mep_list_thumb">
<a href="<?php echo get_the_permalink($event_id); ?>"><?php mep_get_list_thumbnail($event_id); ?></a>
<?php if (sizeof($event_multidate) == 0) { ?>
<?php if ($recurring == 'no') { ?>
<div class="mep-ev-start-date">
<div class="mep-day"><?php echo apply_filters('mep_event_list_only_day_number',get_mep_datetime($event_meta['event_start_datetime'][0], 'day'),$event_id); ?></div>
<div class="mep-month"><?php echo apply_filters('mep_event_list_only_month_name',get_mep_datetime($event_meta['event_start_datetime'][0], 'month'),$event_id); ?></div>
</div>
<?php }
if (is_array($event_multidate) && sizeof($event_multidate) > 0) { ?>
if (is_array($event_multidate) && sizeof($event_multidate) > 0 && $recurring == 'no') { ?>
<div class='mep-multidate-ribbon mep-tem3-title-sec'>
<span><?php echo mep_get_option('mep_event_multidate_ribon_text', 'label_setting_sec', __('Multi Date Event', 'mage-eventpress')); ?></span>
</div>
<?php }
<?php }elseif($recurring != 'no'){
?>
<div class='mep-multidate-ribbon mep-tem3-title-sec'>
<span><?php echo mep_get_option('mep_event_recurring_ribon_text', 'label_setting_sec', __('Recurring Event', 'mage-eventpress')); ?></span>
</div>
<?php
}
if ($event_type == 'online') { ?>
<div class='mep-eventtype-ribbon mep-tem3-title-sec'>
<span><?php echo mep_get_option('mep_event_virtual_label', 'label_setting_sec') ? mep_get_option('mep_event_virtual_label', 'label_setting_sec') : _e('Virtual Event', 'mage-eventpress'); ?></span>
</div>
<?php } ?>
</div>
<div class="mep_list_event_details">
<a href="<?php the_permalink(); ?>">
@ -79,27 +88,30 @@ $mep_hide_event_hover_btn_text = mep_get_option('mep_hide_event_hover_btn_text
</li>
<?php }
}
if ($hide_time_list == 'no' && $recurring == 'no' && sizeof($event_multidate) > 0) {
if (strtotime(current_time('Y-m-d H:i')) < strtotime($event_meta['event_start_datetime'][0])) {
if ($hide_time_list == 'no' && $recurring == 'no') {
?>
<li class="mep_list_event_date">
<div class="evl-ico"><i class="fa fa-calendar"></i></div>
<div class="evl-cc">
<?php if (strtotime(current_time('Y-m-d H:i')) < strtotime($event_meta['event_start_datetime'][0])) { ?>
<h5>
<?php if (sizeof($event_multidate) > 0) {
echo get_mep_datetime($event_meta['event_start_datetime'][0], 'date-text');
//echo get_mep_datetime($event_meta['event_start_datetime'][0], 'date-text');
}
?>
<?php echo mep_get_option('mep_time_text', 'label_setting_sec') ? mep_get_option('mep_time_text', 'label_setting_sec') : _e('Time:', 'mage-eventpress'); ?>
</h5>
<?php } ?>
<h6><?php echo get_mep_datetime($event_meta['event_start_datetime'][0], 'time');
if ($hide_only_end_time_list == 'no') { ?> - <?php echo get_mep_datetime($event_meta['event_end_datetime'][0], 'time');
} ?></h6>
if ($hide_only_end_time_list == 'no') { ?> - <?php echo get_mep_datetime($event_meta['event_end_datetime'][0], 'time'); } ?></h6>
</div>
</li>
<?php }
} ?>
<?php
}elseif($hide_time_list == 'no' && $recurring != 'no'){
do_action('mep_event_list_upcoming_date_li',$event_id);
}?>
</ul>
</a>

View File

@ -1,3 +1,4 @@
<?php $recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no'; ?>
<div class='mep-event-list-loop mep_event_list_item mep_event_minimal_list mix <?php echo $org_class.' '.$cat_class; ?>'>
<?php do_action('mep_event_minimal_list_loop_header',$event_id); ?>
<div class="mep_list_thumb">
@ -12,12 +13,12 @@
<div class="mep-list-header">
<h2 class='mep_list_title'><?php the_title(); ?></h2>
<?php
mep_get_event_upcomming_date($event_id,1);
mep_get_event_upcomming_date($event_id,1);
?>
<?php if ($available_seat == 0) {
do_action('mep_show_waitlist_label');
} ?>
<h3 class='mep_list_date'> <span class='mep_minimal_list_date'><i class="fa fa-calendar"></i> <?php echo mep_get_event_upcomming_date($event_id,'time'); ?> - <?php if($start_datetime == $end_datetime){ echo get_mep_datetime($event_meta['event_end_datetime'][0],'time'); }else{ echo get_mep_datetime($event_meta['event_end_datetime'][0],'date-time-text'); } ?></span> <span class='mep_minimal_list_location'><i class='fa fa-map-marker'></i> <?php mep_get_event_city($event_id); ?></span></h3>
<h3 class='mep_list_date'> <?php if($recurring == 'no'){ ?><span class='mep_minimal_list_date'><i class="fa fa-calendar"></i> <?php echo mep_get_event_upcomming_date($event_id,'time'); ?> - <?php if($start_datetime == $end_datetime){ echo get_mep_datetime($event_meta['event_end_datetime'][0],'time'); }else{ echo get_mep_datetime($event_meta['event_end_datetime'][0],'date-time-text'); } ?></span> <?php } ?> <span class='mep_minimal_list_location'><i class='fa fa-map-marker'></i> <?php mep_get_event_city($event_id); ?></span></h3>
</a>
<?php do_action('mep_event_list_loop_footer',$event_id); ?>

View File

@ -1,3 +1,4 @@
<?php $recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no'; ?>
<div class='mep-event-list-loop mep_event_list_item mep_event_native_list mix <?php echo $org_class.' '.$cat_class; ?>'>
<?php do_action('mep_event_minimal_list_loop_header',$event_id); ?>
<div class="mep_list_thumb">
@ -9,9 +10,9 @@
<h2 class='mep_list_title'><?php the_title(); ?></h2>
<?php if ($available_seat == 0) {
do_action('mep_show_waitlist_label');
} ?>
<h3 class='mep_list_date'> <span class='mep_minimal_list_date'><i class="fa fa-calendar"></i> <?php echo get_mep_datetime($event_meta['event_start_datetime'][0],'date-time-text'); ?> - <?php if($start_datetime == $end_datetime){ echo get_mep_datetime($event_meta['event_end_datetime'][0],'time'); }else{ echo get_mep_datetime($event_meta['event_end_datetime'][0],'date-time-text'); } ?></span> <span class='mep_minimal_list_location'><i class='fa fa-map-marker'></i> <?php mep_get_event_city($event_id); ?></span></h3></a>
<?php do_action('mep_event_list_loop_footer',$event_id); ?>
} ?>
<h3 class='mep_list_date'> <?php if($recurring == 'no'){ ?> <span class='mep_minimal_list_date'><i class="fa fa-calendar"></i> <?php echo get_mep_datetime($event_meta['event_start_datetime'][0],'date-time-text'); ?> - <?php if($start_datetime == $end_datetime){ echo get_mep_datetime($event_meta['event_end_datetime'][0],'time'); }else{ echo get_mep_datetime($event_meta['event_end_datetime'][0],'date-time-text'); } ?></span> <?php } ?> <span class='mep_minimal_list_location'><i class='fa fa-map-marker'></i> <?php mep_get_event_city($event_id); ?></span></h3></a>
<?php do_action('mep_event_list_loop_footer',$event_id); ?>
</div>
</div>
<?php do_action('mep_event_minimal_list_loop_end',$event_id); ?>

View File

@ -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.8
* Version: 3.3.9
* Author: MagePeople Team
* Author URI: http://www.mage-people.com/
* Text Domain: mage-eventpress