file updated

This commit is contained in:
magepeopleteam 2020-08-18 12:08:58 +00:00
parent 89836832c0
commit dc39ebe883
16 changed files with 206 additions and 345 deletions

View File

@ -283,3 +283,17 @@ ul.mep_rt_settings_list li {
margin-bottom: 30px;
margin-top: 10px;
}
.mep_event_metabox_address .sec {
width: 48%;
display: inline-block;
padding: 0px 10px;
}
#poststuff .stuffbox>h3, #poststuff h2, #poststuff h3.hndle {
display: block;
}
span.event_meta_help_txt {
display: block;
font-size: 13px;
margin: 2px 0 20px;
color: #ba2720;
}

View File

@ -18,29 +18,29 @@ function mep_cpt()
'singular_name' => __($event_label, 'mage-eventpress'),
'menu_name' => __($event_label, 'mage-eventpress'),
'name_admin_bar' => __($event_label, 'mage-eventpress'),
'archives' => __($event_label.' List', 'mage-eventpress'),
'attributes' => __($event_label.' List', 'mage-eventpress'),
'parent_item_colon' => __($event_label.' Item:', 'mage-eventpress'),
'all_items' => __('All '.$event_label, 'mage-eventpress'),
'add_new_item' => __('Add New '.$event_label, 'mage-eventpress'),
'add_new' => __('Add New '.$event_label, 'mage-eventpress'),
'new_item' => __('New '.$event_label, 'mage-eventpress'),
'edit_item' => __('Edit '.$event_label, 'mage-eventpress'),
'update_item' => __('Update '.$event_label, 'mage-eventpress'),
'view_item' => __('View '.$event_label, 'mage-eventpress'),
'view_items' => __('View '.$event_label, 'mage-eventpress'),
'search_items' => __('Search '.$event_label, 'mage-eventpress'),
'not_found' => __($event_label.' Not found', 'mage-eventpress'),
'not_found_in_trash' => __($event_label.' Not found in Trash', 'mage-eventpress'),
'featured_image' => __($event_label.' Feature Image', 'mage-eventpress'),
'set_featured_image' => __('Set '.$event_label.' featured image', 'mage-eventpress'),
'remove_featured_image' => __('Remove '.$event_label.' featured image', 'mage-eventpress'),
'use_featured_image' => __('Use as '.$event_label.' featured image', 'mage-eventpress'),
'insert_into_item' => __('Insert into '.$event_label, 'mage-eventpress'),
'uploaded_to_this_item' => __('Uploaded to this '.$event_label, 'mage-eventpress'),
'items_list' => __($event_label.' list', 'mage-eventpress'),
'items_list_navigation' => __($event_label.' list navigation', 'mage-eventpress'),
'filter_items_list' => __('Filter '.$event_label.' list', 'mage-eventpress'),
'archives' => __($event_label . ' List', 'mage-eventpress'),
'attributes' => __($event_label . ' List', 'mage-eventpress'),
'parent_item_colon' => __($event_label . ' Item:', 'mage-eventpress'),
'all_items' => __('All ' . $event_label, 'mage-eventpress'),
'add_new_item' => __('Add New ' . $event_label, 'mage-eventpress'),
'add_new' => __('Add New ' . $event_label, 'mage-eventpress'),
'new_item' => __('New ' . $event_label, 'mage-eventpress'),
'edit_item' => __('Edit ' . $event_label, 'mage-eventpress'),
'update_item' => __('Update ' . $event_label, 'mage-eventpress'),
'view_item' => __('View ' . $event_label, 'mage-eventpress'),
'view_items' => __('View ' . $event_label, 'mage-eventpress'),
'search_items' => __('Search ' . $event_label, 'mage-eventpress'),
'not_found' => __($event_label . ' Not found', 'mage-eventpress'),
'not_found_in_trash' => __($event_label . ' Not found in Trash', 'mage-eventpress'),
'featured_image' => __($event_label . ' Feature Image', 'mage-eventpress'),
'set_featured_image' => __('Set ' . $event_label . ' featured image', 'mage-eventpress'),
'remove_featured_image' => __('Remove ' . $event_label . ' featured image', 'mage-eventpress'),
'use_featured_image' => __('Use as ' . $event_label . ' featured image', 'mage-eventpress'),
'insert_into_item' => __('Insert into ' . $event_label, 'mage-eventpress'),
'uploaded_to_this_item' => __('Uploaded to this ' . $event_label, 'mage-eventpress'),
'items_list' => __($event_label . ' list', 'mage-eventpress'),
'items_list_navigation' => __($event_label . ' list navigation', 'mage-eventpress'),
'filter_items_list' => __('Filter ' . $event_label . ' list', 'mage-eventpress'),
);
$args = array(
@ -48,7 +48,8 @@ function mep_cpt()
'labels' => $labels,
'menu_icon' => $event_icon,
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
'rewrite' => array('slug' => $event_slug)
'rewrite' => array('slug' => $event_slug),
'show_in_rest' => true
);
register_post_type('mep_events', $args);
@ -89,11 +90,12 @@ function mep_cpt()
'menu_icon' => 'dashicons-calendar-alt',
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
'rewrite' => array('slug' => 'event-speaker'),
'show_in_menu' => 'edit.php?post_type=mep_events',
'show_in_menu' => 'edit.php?post_type=mep_events',
'show_in_rest' => true
);
if($speaker_status == 'yes'){
if ($speaker_status == 'yes') {
register_post_type('mep_event_speaker', $args);
}
}

View File

@ -17,10 +17,6 @@ function mep_add_admin_scripts($hook)
*/
if ($hook == 'post-new.php' || $hook == 'post.php') {
if ('mep_events' === $post->post_type) {
// wp_enqueue_script('jquery-ui-timepicker-addon', plugin_dir_url(__DIR__) . 'js/jquery-ui-timepicker-addon.js', array('jquery', 'jquery-ui-core'), 1, true);
// wp_enqueue_script('jquery-ui-timepicker-addon', plugin_dir_url(__DIR__) . 'js/jquery-ui-sliderAccess.js', array('jquery', 'jquery-ui-core', 'jquery-ui-timepicker-addon'), 1, true);
// wp_enqueue_script('mep_datepicker', plugin_dir_url(__DIR__) . 'js/mep_datepicker.js', array('jquery', 'jquery-ui-core', 'jquery-ui-timepicker-addon'), 1, true);
// wp_enqueue_style('jquery-ui-timepicker-addon', plugin_dir_url(__DIR__) . 'css/jquery-ui-timepicker-addon.css', array());
wp_enqueue_style('mep-jquery-ui-style', plugin_dir_url(__DIR__) . 'css/jquery-ui.css', array());
wp_enqueue_script('gmap-scripts', plugin_dir_url(__DIR__) . 'js/mkb-admin.js', array('jquery', 'jquery-ui-core'), 1, true);
}
@ -56,7 +52,7 @@ function mep_add_admin_scripts($hook)
wp_enqueue_script('wp-color-picker');
wp_enqueue_script('magepeople-options-framework', plugins_url('js/mage-options-framework.js', __DIR__), array('jquery'));
wp_localize_script('PickpluginsOptionsFramework', 'PickpluginsOptionsFramework_ajax', array('PickpluginsOptionsFramework_ajaxurl' => admin_url('admin-ajax.php')));
wp_enqueue_script('select2.min', plugins_url('js/select2.min.js', __DIR__), array('jquery'));
// wp_enqueue_script('select2.min', plugins_url('js/select2.min.js', __DIR__), array('jquery'));
wp_enqueue_script('codemirror', plugin_dir_url(__DIR__) . 'js/codemirror.min.js', array('jquery'), null, false);
wp_enqueue_script('form-field-dependency', plugins_url('js/form-field-dependency.js', __DIR__), array('jquery'), null, false);
wp_localize_script('jquery', 'mep_ajax', array( 'mep_ajaxurl' => admin_url( 'admin-ajax.php')));
@ -99,3 +95,14 @@ if($owlThemeLoad == 'no'){
}
// Ajax Issue
add_action('wp_head','mep_ajax_url',5);
add_action('admin_head','mep_ajax_url',5);
function mep_ajax_url(){
?>
<script type="text/javascript">
// WooCommerce Event Manager Ajax URL
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
</script>
<?php
}

View File

@ -272,18 +272,24 @@ function mep_event_venue_meta_box_cb($post){
$values = get_post_custom( $post->ID );
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
$map_type = mep_get_option( 'mep_google_map_type', 'general_setting_sec', 'iframe');
$mep_org_address = array_key_exists('mep_org_address', $values) ? $values['mep_org_address'][0] : 0 ;
?>
<div class='sec'>
<label for="mep_ev_9890"> <?php _e('Show Address from Organizer?:','mage-eventpress'); ?> </label>
<span><input style='text-align: left;width: auto;' id='mep_ev_9890' type="checkbox" name='mep_org_address' value='1' <?php if(array_key_exists('mep_org_address', $values)){ $mep_org_address = $values['mep_org_address'][0]; if($mep_org_address==1){ echo 'checked'; } } ?> > Yes (If Yes, Organizer Address will show from organizer area.)</span>
<label for="mep_ev_9890"> <?php _e('Event Location Source:','mage-eventpress'); ?>
<select name="mep_org_address" id="mep_ev_9890">
<option value='0' <?php if($mep_org_address == 0){ echo 'selected'; } ?>><?php _e('Event Details','mage-eventpress'); ?></option>
<option value='1' <?php if($mep_org_address == 1){ echo 'selected'; } ?>><?php _e('Organizer','mage-eventpress'); ?></option>
</select>
<span class='event_meta_help_txt'>Select Organizer if you already save the organizer details. Please remember if you select orginizer and not checked the the organizer from the Event Organizer list from the right sidebar, Event Location section if the frontend will be blank. </span>
</label>
</div>
<div class='mep_event_metabox_address' style='display:<?php if($mep_org_address == 0){ echo 'block'; }else{ 'none'; } ?>;'>
<div class='sec'>
<label for="mep_ev_2"> <?php _e('Location/Venue:','mage-eventpress'); ?> </label>
@ -325,20 +331,32 @@ $map_type = mep_get_option( 'mep_google_map_type', 'general_setting_sec', 'ifram
<label for="mep_ev_7"> <?php _e('Country:','mage-eventpress'); ?> </label>
<span><input id='mep_ev_7' type="text" name='mep_country' placeholder="Ex: USA" value='<?php echo mep_get_event_locaion_item($post->ID,'mep_country'); ?>'> </span>
</div>
</div>
<div class='sec'>
<label for="mep_ev_989"> <?php _e('Show Google Map:','mage-eventpress'); ?> </label>
<span><input style='text-align: left;width: auto;' id='mep_ev_989' type="checkbox" name='mep_sgm' value='1' <?php if(array_key_exists('mep_sgm', $values)){ $mep_sgm = $values['mep_sgm'][0]; if($mep_sgm==1){ echo 'checked'; } } ?> > Yes</span>
</div>
<!-- <a id="check_gmap" type="submit" style="display: block;background: #3496f3;text-align: center;color: #fff;font-size: 19px;padding: 15px 20px;margin: 20px auto;width: 200px;cursor: pointer;">Show Google Map</a> -->
<script type="text/javascript">
jQuery("#mep_ev_9890").click(function(){
// jQuery("#mep_ev_9890").click(function(){
if(jQuery(this).is(':checked')){
// }
jQuery("#mep_ev_9890").change(function(){
var source = jQuery(this).val();
// if(jQuery(this).is(':checked')){
if(source == '1'){
jQuery('.mep_event_metabox_address').hide();
jQuery('#mep_ev_2').val('<?php echo mep_event_org_location_item($post->ID,'org_location'); ?>');
jQuery('#mep_ev_3').val('<?php echo mep_event_org_location_item($post->ID,'org_street'); ?>');
jQuery('#mep_ev_4').val('<?php echo mep_event_org_location_item($post->ID,'org_city'); ?>');
@ -348,7 +366,7 @@ jQuery("#mep_ev_9890").click(function(){
var location = jQuery('#mep_ev_2').val();
jQuery('#show_gmap').html('<iframe id="gmap_canvas" src="https://maps.google.com/maps?q='+location+'&t=&z=19&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>')
}else{
jQuery('.mep_event_metabox_address').show();
jQuery('#mep_ev_2').val('<?php echo mep_event_location_item($post->ID,'mep_location_venue'); ?>');
jQuery('#mep_ev_3').val('<?php echo mep_event_location_item($post->ID,'mep_street'); ?>');
jQuery('#mep_ev_4').val('<?php echo mep_event_location_item($post->ID,'mep_city'); ?>');
@ -1427,7 +1445,7 @@ if (get_post_type($post_id) == 'mep_events') {
$more_start_time = isset($_POST['event_more_start_time']) ? $_POST['event_more_start_time'] : '';
$more_end_date = isset($_POST['event_more_end_date']) ? $_POST['event_more_end_date'] : '';
$more_end_time = isset($_POST['event_more_end_time']) ? $_POST['event_more_end_time'] : '';
$mdate = [];
$mcount = count( $more_start_date );

View File

@ -2785,14 +2785,20 @@ add_action('mep_event_admin_booking_js','mep_single_page_js_script');
if (!function_exists('mep_single_page_js_script')) {
function mep_single_page_js_script($event_id){
$currency_pos = get_option('woocommerce_currency_pos');
$mep_event_faq = get_post_meta($event_id, 'mep_event_faq', true) ? get_post_meta($event_id, 'mep_event_faq', true) : [];
ob_start();
?>
<script>
jQuery(document).ready(function() {
// jQuery("#mep-event-accordion").accordion({
// collapsible: true,
// active: false
// });
<?php if(sizeof($mep_event_faq) > 0){ ?>
jQuery("#mep-event-accordion").accordion({
collapsible: true,
active: false
});
<?php } ?>
jQuery(document).on("change", ".etp", function() {
var sum = 0;
jQuery(".etp").each(function() {
@ -2978,6 +2984,33 @@ if (!function_exists('mep_get_event_dates_arr')) {
}
}
$event_dates = array_merge($date_arr,$m_date_arr);
// print_r($event_dates);
return apply_filters('mep_event_dates_in_calender_free',$event_dates,$event_id);
}
}
add_action('rest_api_init', 'mep_event_cunstom_fields_to_rest_init');
if (!function_exists('mep_event_cunstom_fields_to_rest_init')) {
function mep_event_cunstom_fields_to_rest_init()
{
register_rest_field('mep_events', 'event_informations', array(
'get_callback' => 'mep_get_events_custom_meta_for_api',
'schema' => null,
));
}
}
if (!function_exists('mep_get_events_custom_meta_for_api')) {
function mep_get_events_custom_meta_for_api($object)
{
$post_id = $object['id'];
$post_meta = get_post_meta( $post_id );
$post_image = get_post_thumbnail_id( $post_id );
$post_meta["event_feature_image"] = wp_get_attachment_image_src($post_image,'full')[0];
return $post_meta;
}
}

View File

@ -40,6 +40,8 @@ function mep_cpt_tax(){
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => $event_cat_slug ),
'show_in_rest' => true,
'rest_base' => 'mep_cat'
);
register_taxonomy('mep_cat', 'mep_events', $args);
@ -76,6 +78,8 @@ register_taxonomy('mep_cat', 'mep_events', $args);
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => $event_org_slug ),
'show_in_rest' => true,
'rest_base' => 'mep_org',
);
register_taxonomy('mep_org', 'mep_events', $argso);

View File

@ -19,7 +19,7 @@ function mep_user_custom_styles()
?>
<style>
.mep-default-sidrbar-events-schedule ul li i, .mep-ev-start-date, h3.mep_list_date i, .mep-list-footer ul li i, .df-ico i, .mep-default-sidrbar-meta i, .mep-default-sidrbar-address ul li i, .mep-default-sidrbar-social ul li a, .mep-tem3-title-sec {
.mep-default-sidrbar-events-schedule ul li i, .mep-ev-start-date, h3.mep_list_date i, .mep-list-footer ul li i, .df-ico i, .mep-default-sidrbar-meta i, .mep-default-sidrbar-address ul li i, .mep-default-sidrbar-social ul li a, .mep-tem3-title-sec, button.mep-cat-control, .pagination-sec a {
background: <?php echo $base_color; ?>;
}

View File

@ -92,6 +92,7 @@ if (!function_exists('mep_get_event_reg_btn')) {
*/
do_action('mep_event_no_seat_text');
do_action('mep_after_no_seat_notice');
} else {
/**
* If everything is fine then its go on ....

View File

@ -32,10 +32,10 @@ if (!function_exists('mep_event_ticket_type_loop_list_html')) {
$event_start_date = get_post_meta($post_id, 'event_start_date', true) . ' ' . get_post_meta($post_id, 'event_start_time', true);
$total_sold = (int) mep_ticket_type_sold($post_id, $ticket_type_name, $event_date);
$total_tickets = (int) $total_quantity - ((int) $total_sold + (int) $total_resv_quantity);
$total_seats = apply_filters('mep_total_ticket_of_type', $total_tickets, $post_id, $field);
$total_seats = apply_filters('mep_total_ticket_of_type', $total_tickets, $post_id, $field, $event_date);
$total_min_seat = apply_filters('mep_ticket_min_qty', 0, $post_id, $field);
$default_quantity = apply_filters('mep_ticket_default_qty', $default_qty, $post_id, $field);
$total_left = apply_filters('mep_total_ticket_of_type', $total_tickets, $post_id, $field);
$total_left = apply_filters('mep_total_ticket_of_type', $total_tickets, $post_id, $field, $event_date);
$ticket_price = apply_filters('mep_ticket_type_price', $ticket_type_price, $ticket_type_name, $post_id, $field);
$passed = apply_filters('mep_ticket_type_validation', true);
$start_date = get_post_meta($post_id, 'event_start_datetime', true);

View File

@ -10,7 +10,7 @@
<div class="col_5 sd_6 alignCenter">
<div class="textContent">
<h3>Thanks a lot</h3>
<h2 class="extraBold">For choosing Woocommerce Event Manager</h2>
<h2 class="extraBold">For choosing MageAddons</h2>
</div>
</div>
<div class="col_4">
@ -65,7 +65,7 @@
<li>Event Horizontal Timeline<pre> [event-list style='timeline' timeline-mode='horizontal'] </pre> <a href="https://vaincode.com/reevent/event-list-horizontal-timeline-view/">View Example</a></li>
<li>Event Carousal Style<pre> [event-list style='grid' pagination='carousal' carousal-dots='yes' carousal-nav='yes' column=3]</pre><a href="https://vaincode.com/reevent/event-carousal/">View Example</a></li>
<li>EventWise Speaker list: <pre>[event-speaker-list event=EventID]</pre> <a href="https://vaincode.com/reevent/speaker-list/">View Example</a></li>
<li>Event Cart Section only:<pre>[event-add-cart-section event=EventID]</pre> <a href="https://vaincode.com/reevent/event-add-to-cart-section/">View Example</a></li>
<li>Event Cart Section only:<pre>[[event-add-cart-section event=EventID]</pre> <a href="https://vaincode.com/reevent/event-add-to-cart-section/">View Example</a></li>
</ul>

View File

@ -109,7 +109,7 @@
</div>
</div>
</div>
<a href="https://mage-people.com/product/mage-woo-event-booking-manager-pro/" target="_blank" class="buttonOutline allCenter_radius_transition customButton">Buy Event Manager Pro Today</a>
<a href="https://mage-people.com/product/mage-woo-event-booking-manager-pro/" target="_blank" class="buttonOutline allCenter_radius_transition customButton">Bu Event Manager Pro Today</a>
</div>
</div>
<div class="col_6 sd_12">

View File

@ -123,11 +123,11 @@ jQuery(document).ready(function($) {
})
$('.field-select2-wrapper select').select2({
width: '320px',
allowClear: true
// $('.field-select2-wrapper select').select2({
// width: '320px',
// allowClear: true
});
// });

View File

@ -1,16 +0,0 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
/nbproject
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
.phpunit.result.cache
.DS_Store

View File

@ -1,21 +0,0 @@
{
"name": "appsero/client",
"description": "Appsero Client",
"keywords": ["analytics", "wordpress", "plugin", "theme"],
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Tareq Hasan",
"email": "tareq@appsero.com"
}
],
"autoload": {
"psr-4": {
"Appsero\\": "src/"
}
},
"require": {
"php": ">=5.3"
}
}

View File

@ -1,216 +0,0 @@
# 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).

View File

@ -181,7 +181,9 @@ class Insights {
return;
}
$response = $this->client->send_request( $this->get_tracking_data(), 'track' );
$tracking_data = $this->get_tracking_data();
$response = $this->client->send_request( $tracking_data, 'track' );
update_option( $this->client->slug . '_tracking_last_send', time() );
}
@ -211,7 +213,6 @@ class Insights {
}
$data = array(
'client_version' => $this->client->version,
'url' => esc_url( home_url() ),
'site' => $this->get_site_name(),
'admin_email' => get_option( 'admin_email' ),
@ -225,6 +226,7 @@ class Insights {
'inactive_plugins' => count( $all_plugins['inactive_plugins'] ),
'ip_address' => $this->get_user_ip_address(),
'project_version' => $this->client->project_version,
'tracking_skipped' => false,
);
// Add metadata
@ -232,6 +234,15 @@ class Insights {
$data['extra'] = $extra;
}
// Check this has previously skipped tracking
$skipped = get_option( $this->client->slug . '_tracking_skipped' );
if ( $skipped === 'yes' ) {
delete_option( $this->client->slug . '_tracking_skipped' );
$data['tracking_skipped'] = true;
}
return apply_filters( $this->client->slug . '_tracker_data', $data );
}
@ -360,36 +371,38 @@ class Insights {
}
// 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 <strong>%1$s</strong> 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 .= ' (<a class="' . $this->client->slug . '-insights-data-we-collect" href="#">' . $this->client->__trans( 'what we collect' ) . '</a>)';
$notice .= '<p class="description" style="display:none;">' . implode( ', ', $this->data_we_collect() ) . '. No sensitive data is tracked. ';
$notice .= 'We are using Appsero to collect your data. <a href="' . $policy_url . '">Learn more</a> about how Appsero collects and handle your data.</p>';
echo '<div class="updated"><p>';
echo $notice;
echo '</p><p class="submit">';
echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . $this->client->__trans( 'Allow' ) . '</a>';
echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . $this->client->__trans( 'No thanks' ) . '</a>';
echo '</p></div>';
echo "<script type='text/javascript'>jQuery('." . $this->client->slug . "-insights-data-we-collect').on('click', function(e) {
e.preventDefault();
jQuery(this).parents('.updated').find('p.description').slideToggle('fast');
});
</script>
";
if ( $this->is_local_server() ) {
return;
}
$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 <strong>%1$s</strong> 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 .= ' (<a class="' . $this->client->slug . '-insights-data-we-collect" href="#">' . $this->client->__trans( 'what we collect' ) . '</a>)';
$notice .= '<p class="description" style="display:none;">' . implode( ', ', $this->data_we_collect() ) . '. No sensitive data is tracked. ';
$notice .= 'We are using Appsero to collect your data. <a href="' . $policy_url . '">Learn more</a> about how Appsero collects and handle your data.</p>';
echo '<div class="updated"><p>';
echo $notice;
echo '</p><p class="submit">';
echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . $this->client->__trans( 'Allow' ) . '</a>';
echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . $this->client->__trans( 'No thanks' ) . '</a>';
echo '</p></div>';
echo "<script type='text/javascript'>jQuery('." . $this->client->slug . "-insights-data-we-collect').on('click', function(e) {
e.preventDefault();
jQuery(this).parents('.updated').find('p.description').slideToggle('fast');
});
</script>
";
}
/**
@ -437,6 +450,8 @@ class Insights {
update_option( $this->client->slug . '_allow_tracking', 'no' );
update_option( $this->client->slug . '_tracking_notice', 'hide' );
$this->send_tracking_skipped_request();
$this->clear_schedule_event();
}
@ -946,4 +961,24 @@ class Insights {
return $site_name;
}
/**
* Send request to appsero if user skip to send tracking data
*/
private function send_tracking_skipped_request() {
$skipped = get_option( $this->client->slug . '_tracking_skipped' );
$data = [
'hash' => $this->client->hash,
'previously_skipped' => false,
];
if ( $skipped === 'yes' ) {
$data['previously_skipped'] = true;
} else {
update_option( $this->client->slug . '_tracking_skipped', 'yes' );
}
$this->client->send_request( $data, 'tracking-skipped' );
}
}