Version Description
= Version 1.1.8.3 =
Download this release
Release Info
Developer | ashokrane |
Plugin | WP Content Copy Protection |
Version | 1.1.8.5 |
Comparing to | |
See all releases |
Version 1.1.8.5
- includes/component/README.md +1 -0
- includes/component/deactivate-survey-popup/Instructions +73 -0
- includes/component/deactivate-survey-popup/class-ts-deactivation.php +231 -0
- includes/component/deactivate-survey-popup/template/ts-deactivate-modal.php +387 -0
- includes/component/faq-support/Instructions +47 -0
- includes/component/faq-support/templates/faq-page/faq-page.php +138 -0
- includes/component/faq-support/ts-faq-support.php +260 -0
- includes/component/pro-notices-in-lite/Instructions +41 -0
- includes/component/pro-notices-in-lite/ts-pro-notices.php +667 -0
- includes/component/tracking-data/Instructions +54 -0
- includes/component/tracking-data/assets/images/site-logo-new.jpg +0 -0
- includes/component/tracking-data/assets/js/dismiss-notice.js +41 -0
- includes/component/tracking-data/class-ts-tracker.php +267 -0
- includes/component/tracking-data/ts-tracking.php +350 -0
- includes/component/welcome-page/Instructions +37 -0
- includes/component/welcome-page/assets/images/icon-256x256.png +0 -0
- includes/component/welcome-page/templates/social-media-elements.php +24 -0
- includes/component/welcome-page/templates/welcome/welcome-page.php +96 -0
- includes/component/welcome-page/ts-welcome.php +282 -0
- includes/wpccpl-all-component.php +239 -0
- index.php +9 -0
- readme.txt +374 -0
- settings.php +4 -0
- wpccpl.php +263 -0
includes/component/README.md
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
# ts-plugin-features-boilerplate
|
includes/component/deactivate-survey-popup/Instructions
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Add a popup with some questions when the plugin is deactivated.
|
2 |
+
|
3 |
+
To add this feature to the plugin, you can follow the below steps:
|
4 |
+
|
5 |
+
1. Copy the class-ts-deactivation.php file.
|
6 |
+
|
7 |
+
2. Include the file class-ts-deactivation.php once when on the admin page. This can be done with is_admin() function.
|
8 |
+
|
9 |
+
3. You need to pass the 2 parameters to the init function of the TS_deactivate class. You need to change the value of the variable as per the respective plugin.
|
10 |
+
|
11 |
+
$wcap_file_name = 'woocommerce-abandon-cart-pro/woocommerce-ac.php';
|
12 |
+
$wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
|
13 |
+
|
14 |
+
$wcap_deativate = new TS_deactivate;
|
15 |
+
$wcap_deativate->init( $wcap_file_name, $wcap_plugin_name );
|
16 |
+
|
17 |
+
4. In respective plugin you have to add the filter as below:
|
18 |
+
The filter name: ts_deativate_plugin_questions
|
19 |
+
|
20 |
+
Please follow the below Standard method to add your plugin specific deactivate questions.
|
21 |
+
|
22 |
+
Note: Dont chnage the below things in the function:
|
23 |
+
|
24 |
+
1. Main index: 0,1,2,3
|
25 |
+
2. The "id" paramter value in sub array.
|
26 |
+
|
27 |
+
add_filter ( 'ts_deativate_plugin_questions', array( 'Wcap_Common', 'wcap_deactivate_add_questions' ), 10, 1 );
|
28 |
+
|
29 |
+
/**
|
30 |
+
* It will add the Questions while admin deactivate the plugin.
|
31 |
+
* @hook ts_deativate_plugin_questions
|
32 |
+
* @param array $wcap_add_questions Blank array
|
33 |
+
* @return array $wcap_add_questions List of all questions.
|
34 |
+
*/
|
35 |
+
public static function wcap_deactivate_add_questions ( $wcap_add_questions ) {
|
36 |
+
|
37 |
+
$wcap_add_questions = array(
|
38 |
+
0 => array(
|
39 |
+
'id' => 4,
|
40 |
+
'text' => __( "Custom Delivery Settings are not working", "woocommerce-ac" ),
|
41 |
+
'input_type' => '',
|
42 |
+
'input_placeholder' => ''
|
43 |
+
),
|
44 |
+
1 => array(
|
45 |
+
'id' => 5,
|
46 |
+
'text' => __( "Minimum Delivery Time (in hours) is not working as expected", "woocommerce-ac" ),
|
47 |
+
'input_type' => '',
|
48 |
+
'input_placeholder' => ''
|
49 |
+
),
|
50 |
+
2 => array(
|
51 |
+
'id' => 6,
|
52 |
+
'text' => __( "Shipping Days feature is not working", "woocommerce-ac" ),
|
53 |
+
'input_type' => '',
|
54 |
+
'input_placeholder' => ''
|
55 |
+
),
|
56 |
+
3 => array(
|
57 |
+
'id' => 7,
|
58 |
+
'text' => __( "The plugin is not compatible with another plugin", "woocommerce-ac" ),
|
59 |
+
'input_type' => 'textfield',
|
60 |
+
'input_placeholder' => __( "Which Plugin?", "ts-deactivation-survey" )
|
61 |
+
)
|
62 |
+
|
63 |
+
);
|
64 |
+
return $wcap_add_questions;
|
65 |
+
}
|
66 |
+
|
67 |
+
Once the above changes are done. Data will be stored in the tychesod_tracking database in the staging cpanel.
|
68 |
+
|
69 |
+
- The ts_tracking_data table will store the unique tracking id, site URL and admin email address.
|
70 |
+
|
71 |
+
- The ts_deactivation_survery table will store the meta for the reason for deactivating the plugin. Here tracking_id will be same as tracking id in ts_tracking_data.
|
72 |
+
|
73 |
+
- The ts_tracking_plugins table will store the plugin name from which the action is performed. Here tracking_id will be same as tracking id in ts_tracking_data.
|
includes/component/deactivate-survey-popup/class-ts-deactivation.php
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Contains the logic for deactivation popups
|
5 |
+
* @since 1.0.0
|
6 |
+
*/
|
7 |
+
class WPCCPL_TS_deactivate {
|
8 |
+
public static $ts_deactivation_str;
|
9 |
+
|
10 |
+
public static $ts_generic_questions;
|
11 |
+
|
12 |
+
public static $ts_plugin_specific_questions;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* URL to the Tracker API endpoint.
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
|
19 |
+
private static $api_url = 'http://tracking.tychesoftwares.com/v1/';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var string Plugin name
|
23 |
+
* @access public
|
24 |
+
*/
|
25 |
+
|
26 |
+
public static $plugin_name = '';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var string Plugin file name
|
30 |
+
* @access public
|
31 |
+
*/
|
32 |
+
public static $ts_plugin_file_name = '';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var string Plugin URL
|
36 |
+
* @access public
|
37 |
+
*/
|
38 |
+
public static $ts_plugin_url = '';
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Initialization of hooks where we prepare the functionality to ask use for survey
|
42 |
+
*/
|
43 |
+
public static function init( $ts_plugin_file_name = '', $ts_plugin_name = '' ) {
|
44 |
+
self::$ts_plugin_file_name = $ts_plugin_file_name;
|
45 |
+
self::$plugin_name = $ts_plugin_name;
|
46 |
+
self::$ts_plugin_url = untrailingslashit( plugin_dir_path ( __FILE__ ) );
|
47 |
+
|
48 |
+
self::ts_load_all_str();
|
49 |
+
add_action( 'admin_footer', array( __CLASS__, 'maybe_load_deactivate_options' ) );
|
50 |
+
add_action( 'wp_ajax_ts_submit_uninstall_reason', array( __CLASS__, '_submit_uninstall_reason_action' ) );
|
51 |
+
|
52 |
+
add_filter( 'plugin_action_links_' . self::$ts_plugin_file_name, array( __CLASS__, 'ts_plugin_settings_link' ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Settings link on Plugins page
|
57 |
+
*
|
58 |
+
* @access public
|
59 |
+
* @param array $links
|
60 |
+
* @return array
|
61 |
+
*/
|
62 |
+
public static function ts_plugin_settings_link( $links ) {
|
63 |
+
|
64 |
+
if ( isset ( $links['deactivate'] ) ) {
|
65 |
+
$links['deactivate'] .= '<i class="shortcodes-ts-slug" data-slug="' . self::$ts_plugin_file_name . '"></i>';
|
66 |
+
}
|
67 |
+
return $links;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Localizes all the string used
|
72 |
+
*/
|
73 |
+
public static function ts_load_all_str() {
|
74 |
+
self::$ts_deactivation_str = array(
|
75 |
+
"deactivation-share-reason" => __( "If you have a moment, please let us know why you are deactivating", "ts-deactivation-survey" ),
|
76 |
+
"deactivation-modal-button-submit" => __( "Submit & Deactivate", "ts-deactivation-survey" ),
|
77 |
+
"deactivation-modal-button-deactivate" => __( "Deactivate", "ts-deactivation-survey" ),
|
78 |
+
"deactivation-modal-button-cancel" => __( "Cancel", "ts-deactivation-survey" ),
|
79 |
+
"deactivation-modal-button-confirm" => __( 'Yes - Deactivate', 'ts-deactivation-survey' ),
|
80 |
+
);
|
81 |
+
|
82 |
+
self::$ts_generic_questions = array(
|
83 |
+
"reason-found-a-better-plugin" => __( "I found a better plugin", "ts-deactivation-survey" ),
|
84 |
+
"placeholder-plugin-name" => __( "What's the plugin's name?", "ts-deactivation-survey" ),
|
85 |
+
"reason-needed-for-a-short-period" => __( "I only needed the plugin for a short period", "ts-deactivation-survey" ),
|
86 |
+
"reason-not-working" => __( "The plugin is not working", "ts-deactivation-survey" ),
|
87 |
+
"placeholder-share-what-didnt-work" => __( "Kindly share what didn't work so we can fix it for future users...", "ts-deactivation-survey" ),
|
88 |
+
"reason-great-but-need-specific-feature" => __( "The plugin is great, but I need specific feature that you don't support", "ts-deactivation-survey" ),
|
89 |
+
"placeholder-feature" => __( "What feature?", "ts-deactivation-survey" ),
|
90 |
+
"reason-dont-like-to-share-my-information" => __( "I don't like to share my information with you", "ts-deactivation-survey" ),
|
91 |
+
"reason-other" => _x( "Other", "the text of the 'other' reason for deactivating the plugin that is shown in the modal box.", "ts-deactivation-survey" ),
|
92 |
+
);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Checking current page and pushing html, js and css for this task
|
97 |
+
* @global string $pagenow current admin page
|
98 |
+
* @global array $VARS global vars to pass to view file
|
99 |
+
*/
|
100 |
+
public static function maybe_load_deactivate_options() {
|
101 |
+
global $pagenow;
|
102 |
+
if ( $pagenow == "plugins.php" ) {
|
103 |
+
global $VARS;
|
104 |
+
$VARS = array( 'slug' => "asvbsd", 'reasons' => self::deactivate_options() );
|
105 |
+
include_once self::$ts_plugin_url . "/template/ts-deactivate-modal.php";
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* deactivation reasons in array format
|
111 |
+
* @return array reasons array
|
112 |
+
* @since 1.0.0
|
113 |
+
*/
|
114 |
+
public static function deactivate_options() {
|
115 |
+
|
116 |
+
self::$ts_plugin_specific_questions = apply_filters( 'ts_deativate_plugin_questions', array () );
|
117 |
+
|
118 |
+
|
119 |
+
$reason_found_better_plugin = array(
|
120 |
+
'id' => 2,
|
121 |
+
'text' => self::$ts_generic_questions[ 'reason-found-a-better-plugin' ],
|
122 |
+
'input_type' => 'textfield',
|
123 |
+
'input_placeholder' => self::$ts_generic_questions[ 'placeholder-plugin-name' ]
|
124 |
+
);
|
125 |
+
|
126 |
+
$reason_not_working = array(
|
127 |
+
'id' => 3,
|
128 |
+
'text' => self::$ts_generic_questions[ 'reason-not-working' ],
|
129 |
+
'input_type' => 'textfield',
|
130 |
+
'input_placeholder' => self::$ts_generic_questions[ 'placeholder-share-what-didnt-work' ]
|
131 |
+
);
|
132 |
+
|
133 |
+
$reason_great_but_need_specific_feature = array(
|
134 |
+
'id' => 8,
|
135 |
+
'text' => self::$ts_generic_questions[ 'reason-great-but-need-specific-feature' ],
|
136 |
+
'input_type' => 'textfield',
|
137 |
+
'input_placeholder' => self::$ts_generic_questions[ 'placeholder-feature' ]
|
138 |
+
);
|
139 |
+
|
140 |
+
$reason_plugin_not_compatible = isset ( self::$ts_plugin_specific_questions[ 3 ] ) ? self::$ts_plugin_specific_questions[ 3 ] : '' ;
|
141 |
+
|
142 |
+
$reason_other = array(
|
143 |
+
'id' => 10,
|
144 |
+
'text' => self::$ts_generic_questions[ 'reason-other' ],
|
145 |
+
'input_type' => 'textfield',
|
146 |
+
'input_placeholder' => ''
|
147 |
+
);
|
148 |
+
|
149 |
+
$long_term_user_reasons = array(
|
150 |
+
array(
|
151 |
+
'id' => 1,
|
152 |
+
'text' => self::$ts_generic_questions[ 'reason-needed-for-a-short-period' ],
|
153 |
+
'input_type' => '',
|
154 |
+
'input_placeholder' => ''
|
155 |
+
),
|
156 |
+
$reason_found_better_plugin,
|
157 |
+
$reason_not_working,
|
158 |
+
isset ( self::$ts_plugin_specific_questions[ 0 ] ) ? self::$ts_plugin_specific_questions[ 0 ] : '',
|
159 |
+
isset ( self::$ts_plugin_specific_questions[ 1 ] ) ? self::$ts_plugin_specific_questions[ 1 ] : '',
|
160 |
+
isset ( self::$ts_plugin_specific_questions[ 2 ] ) ? self::$ts_plugin_specific_questions[ 2 ] : '',
|
161 |
+
$reason_plugin_not_compatible,
|
162 |
+
$reason_great_but_need_specific_feature,
|
163 |
+
array(
|
164 |
+
'id' => 9,
|
165 |
+
'text' => self::$ts_generic_questions[ 'reason-dont-like-to-share-my-information' ],
|
166 |
+
'input_type' => '',
|
167 |
+
'input_placeholder' => ''
|
168 |
+
)
|
169 |
+
);
|
170 |
+
|
171 |
+
|
172 |
+
$uninstall_reasons[ 'default' ] = $long_term_user_reasons;
|
173 |
+
|
174 |
+
$uninstall_reasons = apply_filters( 'ts_uninstall_reasons', $uninstall_reasons );
|
175 |
+
array_push( $uninstall_reasons['default'], $reason_other );
|
176 |
+
|
177 |
+
return $uninstall_reasons;
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* get exact str against the slug
|
182 |
+
*
|
183 |
+
* @param type $slug
|
184 |
+
*
|
185 |
+
* @return type
|
186 |
+
*/
|
187 |
+
public static function load_str( $slug ) {
|
188 |
+
return self::$ts_deactivation_str[ $slug ];
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Called after the user has submitted his reason for deactivating the plugin.
|
193 |
+
*
|
194 |
+
* @since 1.1.2
|
195 |
+
*/
|
196 |
+
public static function _submit_uninstall_reason_action() {
|
197 |
+
if ( ! isset( $_POST[ 'reason_id' ] ) ) {
|
198 |
+
exit;
|
199 |
+
}
|
200 |
+
|
201 |
+
$plugin_data = array();
|
202 |
+
|
203 |
+
$plugin_data[ 'url' ] = home_url();
|
204 |
+
$plugin_data[ 'email' ] = apply_filters( 'ts_tracker_admin_email', get_option( 'admin_email' ) );
|
205 |
+
|
206 |
+
$reason_info = isset( $_REQUEST[ 'reason_info' ] ) ? trim( stripslashes( $_REQUEST[ 'reason_info' ] ) ) : '';
|
207 |
+
|
208 |
+
$plugin_data[ 'reason_id' ] = $_POST[ 'reason_id' ];
|
209 |
+
$plugin_data[ 'reason_info' ] = substr( $reason_info, 0, 128 );
|
210 |
+
$plugin_data[ 'reason_text' ] = $_POST[ 'reason_text' ];
|
211 |
+
|
212 |
+
$plugin_data[ 'ts_meta_data_table_name' ] = 'ts_deactivation_survey';
|
213 |
+
$plugin_data[ 'ts_plugin_name' ] = self::$plugin_name;
|
214 |
+
|
215 |
+
wp_safe_remote_post( self::$api_url, array(
|
216 |
+
'method' => 'POST',
|
217 |
+
'timeout' => 45,
|
218 |
+
'redirection' => 5,
|
219 |
+
'httpversion' => '1.0',
|
220 |
+
'blocking' => false,
|
221 |
+
'headers' => array( 'user-agent' => 'TSTracker/' . md5( esc_url( home_url( '/' ) ) ) . ';' ),
|
222 |
+
'body' => json_encode( $plugin_data ),
|
223 |
+
'cookies' => array(),
|
224 |
+
)
|
225 |
+
);
|
226 |
+
// Print '1' for successful operation.
|
227 |
+
echo 1;
|
228 |
+
exit;
|
229 |
+
}
|
230 |
+
|
231 |
+
}
|
includes/component/deactivate-survey-popup/template/ts-deactivate-modal.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
$slug = $VARS[ 'slug' ];
|
7 |
+
$confirmation_message = '';
|
8 |
+
$reasons = $VARS['reasons']['default'];
|
9 |
+
$reasons_list_items_html = '';
|
10 |
+
$plugin_customized_reasons = array();
|
11 |
+
$incr = 0;
|
12 |
+
|
13 |
+
foreach ( $reasons as $reason ) {
|
14 |
+
$list_item_classes = 'reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' ) . ( ( isset( $reason[ 'html' ] ) && ( ! empty( $reason[ 'html' ] ) ) ) ? ' has_html' : '' );
|
15 |
+
|
16 |
+
$reason_html = ( isset( $reason['html'] ) && ( ! empty( $reason['html'] ) ) ) ? '<div class="reason_html">' . $reason['html'] . '</div>' : '';
|
17 |
+
|
18 |
+
$ts_reason_input_type = ( isset( $reason['input_type'] ) && ( ! empty( $reason['input_type'] ) ) ) ? $reason['input_type'] : '';
|
19 |
+
|
20 |
+
$ts_reason_input_placeholder = ( isset( $reason['input_placeholder'] ) && ( ! empty( $reason['input_placeholder'] ) ) ) ? $reason['input_placeholder'] : '';
|
21 |
+
|
22 |
+
$ts_reason_id = ( isset( $reason['id'] ) && ( ! empty( $reason['id'] ) ) ) ? $reason['id'] : '';
|
23 |
+
|
24 |
+
$ts_reason_text = ( isset( $reason['text'] ) && ( ! empty( $reason['text'] ) ) ) ? $reason['text'] : '';
|
25 |
+
|
26 |
+
$selected = "";
|
27 |
+
if ( $incr == 0 ) {
|
28 |
+
$selected = "checked";
|
29 |
+
}
|
30 |
+
|
31 |
+
$reasons_list_items_html .= '<li class="' . $list_item_classes . '" data-input-type="' . $ts_reason_input_type . '" data-input-placeholder="' . $ts_reason_input_placeholder . '"><label><span><input type="radio" name="selected-reason" value="' . $ts_reason_id . '" ' . $selected . '/></span><span>' . $ts_reason_text . '</span></label>' . $reason_html . '</li>';
|
32 |
+
$incr ++;
|
33 |
+
}
|
34 |
+
|
35 |
+
?>
|
36 |
+
<style>
|
37 |
+
.ts-modal {
|
38 |
+
position: fixed;
|
39 |
+
overflow: auto;
|
40 |
+
height: 100%;
|
41 |
+
width: 100%;
|
42 |
+
top: 0;
|
43 |
+
z-index: 100000;
|
44 |
+
display: none;
|
45 |
+
background: rgba(0, 0, 0, 0.6)
|
46 |
+
}
|
47 |
+
|
48 |
+
.ts-modal .ts-modal-dialog {
|
49 |
+
background: transparent;
|
50 |
+
position: absolute;
|
51 |
+
left: 50%;
|
52 |
+
margin-left: -298px;
|
53 |
+
padding-bottom: 30px;
|
54 |
+
top: -100%;
|
55 |
+
z-index: 100001;
|
56 |
+
width: 596px
|
57 |
+
}
|
58 |
+
|
59 |
+
.ts-modal li.reason.has_html .reason_html {
|
60 |
+
display: none;
|
61 |
+
border: 1px solid #ddd;
|
62 |
+
padding: 4px 6px;
|
63 |
+
margin: 6px 0 0 20px;
|
64 |
+
}
|
65 |
+
|
66 |
+
.ts-modal li.reason.has_html.li-active .reason_html {
|
67 |
+
display: block;
|
68 |
+
}
|
69 |
+
|
70 |
+
@media (max-width: 650px) {
|
71 |
+
.ts-modal .ts-modal-dialog {
|
72 |
+
margin-left: -50%;
|
73 |
+
box-sizing: border-box;
|
74 |
+
padding-left: 10px;
|
75 |
+
padding-right: 10px;
|
76 |
+
width: 100%
|
77 |
+
}
|
78 |
+
|
79 |
+
.ts-modal .ts-modal-dialog .ts-modal-panel > h3 > strong {
|
80 |
+
font-size: 1.3em
|
81 |
+
}
|
82 |
+
|
83 |
+
.ts-modal .ts-modal-dialog li.reason {
|
84 |
+
margin-bottom: 10px
|
85 |
+
}
|
86 |
+
|
87 |
+
.ts-modal .ts-modal-dialog li.reason .reason-input {
|
88 |
+
margin-left: 29px
|
89 |
+
}
|
90 |
+
|
91 |
+
.ts-modal .ts-modal-dialog li.reason label {
|
92 |
+
display: table
|
93 |
+
}
|
94 |
+
|
95 |
+
.ts-modal .ts-modal-dialog li.reason label > span {
|
96 |
+
display: table-cell;
|
97 |
+
font-size: 1.3em
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
.ts-modal.active {
|
102 |
+
display: block
|
103 |
+
}
|
104 |
+
|
105 |
+
.ts-modal.active:before {
|
106 |
+
display: block
|
107 |
+
}
|
108 |
+
|
109 |
+
.ts-modal.active .ts-modal-dialog {
|
110 |
+
top: 10%
|
111 |
+
}
|
112 |
+
|
113 |
+
.ts-modal .ts-modal-body, .ts-modal .ts-modal-footer {
|
114 |
+
border: 0;
|
115 |
+
background: #fefefe;
|
116 |
+
padding: 20px
|
117 |
+
}
|
118 |
+
|
119 |
+
.ts-modal .ts-modal-body {
|
120 |
+
border-bottom: 0
|
121 |
+
}
|
122 |
+
|
123 |
+
.ts-modal .ts-modal-body h2 {
|
124 |
+
font-size: 20px
|
125 |
+
}
|
126 |
+
|
127 |
+
.ts-modal .ts-modal-body > div {
|
128 |
+
margin-top: 10px
|
129 |
+
}
|
130 |
+
|
131 |
+
.ts-modal .ts-modal-body > div h2 {
|
132 |
+
font-weight: bold;
|
133 |
+
font-size: 20px;
|
134 |
+
margin-top: 0
|
135 |
+
}
|
136 |
+
|
137 |
+
.ts-modal .ts-modal-footer {
|
138 |
+
border-top: #eeeeee solid 1px;
|
139 |
+
text-align: right
|
140 |
+
}
|
141 |
+
|
142 |
+
.ts-modal .ts-modal-footer > .button {
|
143 |
+
margin: 0 7px
|
144 |
+
}
|
145 |
+
|
146 |
+
.ts-modal .ts-modal-footer > .button:first-child {
|
147 |
+
margin: 0
|
148 |
+
}
|
149 |
+
|
150 |
+
.ts-modal .ts-modal-panel:not(.active) {
|
151 |
+
display: none
|
152 |
+
}
|
153 |
+
|
154 |
+
.ts-modal .reason-input {
|
155 |
+
margin: 3px 0 3px 22px
|
156 |
+
}
|
157 |
+
|
158 |
+
.ts-modal .reason-input input, .ts-modal .reason-input textarea {
|
159 |
+
width: 100%
|
160 |
+
}
|
161 |
+
|
162 |
+
body.has-ts-modal {
|
163 |
+
overflow: hidden
|
164 |
+
}
|
165 |
+
|
166 |
+
#the-list .deactivate > .shortcodes-ts-slug {
|
167 |
+
display: none
|
168 |
+
}
|
169 |
+
|
170 |
+
.ts-modal li.reason-hide {
|
171 |
+
display: none;
|
172 |
+
}
|
173 |
+
|
174 |
+
</style>
|
175 |
+
<script type="text/javascript">
|
176 |
+
var currentPluginName = "";
|
177 |
+
var TSCustomReasons = {};
|
178 |
+
var TSDefaultReason = {};
|
179 |
+
( function ($) {
|
180 |
+
var $deactivateLinks = {};
|
181 |
+
var reasonsHtml = <?php echo json_encode( $reasons_list_items_html ); ?>,
|
182 |
+
modalHtml =
|
183 |
+
'<div class="ts-modal<?php echo ( $confirmation_message == "" ) ? ' no-confirmation-message' : ''; ?>">'
|
184 |
+
+ ' <div class="ts-modal-dialog">'
|
185 |
+
+ ' <div class="ts-modal-body">'
|
186 |
+
+ ' <div class="ts-modal-panel" data-panel-id="confirm"><p><?php echo $confirmation_message; ?></p></div>'
|
187 |
+
+ ' <div class="ts-modal-panel active" data-panel-id="reasons"><h3><strong><?php printf( WPCCPL_TS_deactivate::load_str( 'deactivation-share-reason' ) ); ?>:</strong></h3><ul id="reasons-list">' + reasonsHtml + '</ul></div>'
|
188 |
+
+ ' </div>'
|
189 |
+
+ ' <div class="ts-modal-footer">'
|
190 |
+
+ ' <a href="#" class="button button-secondary button-deactivate"></a>'
|
191 |
+
+ ' <a href="#" class="button button-primary button-close"><?php printf( WPCCPL_TS_deactivate::load_str( 'deactivation-modal-button-cancel' ) ); ?></a>'
|
192 |
+
+ ' </div>'
|
193 |
+
+ ' </div>'
|
194 |
+
+ '</div>',
|
195 |
+
$modal = $(modalHtml),
|
196 |
+
|
197 |
+
$deactivateLink = $('#the-list .deactivate > .shortcodes-ts-slug').prev();
|
198 |
+
|
199 |
+
for( var i = 0; i < $deactivateLink.length; i++ ) {
|
200 |
+
$deactivateLinks[ $( $deactivateLink[i] ).siblings( ".shortcodes-ts-slug" ).attr( 'data-slug' ) ] = $deactivateLink[i].href;
|
201 |
+
}
|
202 |
+
|
203 |
+
$modal.appendTo( $( 'body' ) );
|
204 |
+
|
205 |
+
registerEventHandlers();
|
206 |
+
|
207 |
+
function registerEventHandlers() {
|
208 |
+
$deactivateLink.on( "click", function (evt) {
|
209 |
+
evt.preventDefault();
|
210 |
+
currentPluginName = $(this).siblings( ".shortcodes-ts-slug" ).attr( 'data-slug' );
|
211 |
+
showModal();
|
212 |
+
});
|
213 |
+
|
214 |
+
$modal.on( 'click', '.button', function (evt) {
|
215 |
+
evt.preventDefault();
|
216 |
+
if ($(this).hasClass( 'disabled' ) ) {
|
217 |
+
return;
|
218 |
+
}
|
219 |
+
|
220 |
+
var _parent = $(this).parents( '.ts-modal:first' );
|
221 |
+
var _this = $(this);
|
222 |
+
|
223 |
+
if( _this.hasClass( 'allow-deactivate' ) ) {
|
224 |
+
var $radio = $('input[type="radio"]:checked');
|
225 |
+
var $selected_reason = $radio.parents('li:first'),
|
226 |
+
$input = $selected_reason.find('textarea, input[type="text"]');
|
227 |
+
if( $radio.length == 0 ) {
|
228 |
+
var data = {
|
229 |
+
'action': 'ts_submit_uninstall_reason',
|
230 |
+
'reason_id': 0,
|
231 |
+
'reason_text': "Deactivated without any option",
|
232 |
+
'plugin_basename': currentPluginName,
|
233 |
+
};
|
234 |
+
} else {
|
235 |
+
var data = {
|
236 |
+
'action': 'ts_submit_uninstall_reason',
|
237 |
+
'reason_id': (0 !== $radio.length) ? $radio.val() : '',
|
238 |
+
'reason_text': $selected_reason.text(),
|
239 |
+
'reason_info': (0 !== $input.length) ? $input.val().trim() : '',
|
240 |
+
'plugin_basename': currentPluginName,
|
241 |
+
};
|
242 |
+
}
|
243 |
+
|
244 |
+
$.ajax({
|
245 |
+
url: ajaxurl,
|
246 |
+
method: 'POST',
|
247 |
+
data: data,
|
248 |
+
beforeSend: function () {
|
249 |
+
_parent.find('.button').addClass('disabled');
|
250 |
+
_parent.find('.button-secondary').text('Processing...');
|
251 |
+
},
|
252 |
+
complete: function () {
|
253 |
+
// Do not show the dialog box, deactivate the plugin.
|
254 |
+
window.location.href = $deactivateLinks[currentPluginName];
|
255 |
+
}
|
256 |
+
});
|
257 |
+
}
|
258 |
+
});
|
259 |
+
|
260 |
+
$modal.on('click', 'input[type="radio"]', function () {
|
261 |
+
console.log( this );
|
262 |
+
var _parent = $(this).parents('li:first');
|
263 |
+
var _parent_ul = $(this).parents('ul#reasons-list');
|
264 |
+
|
265 |
+
_parent_ul.children("li.li-active").removeClass("li-active");
|
266 |
+
|
267 |
+
$modal.find('.reason-input').remove();
|
268 |
+
$modal.find('.button-deactivate').text('<?php printf( WPCCPL_TS_deactivate::load_str( 'deactivation-modal-button-submit' ) ); ?>');
|
269 |
+
|
270 |
+
if (_parent.hasClass('has_html')) {
|
271 |
+
_parent.addClass('li-active');
|
272 |
+
}
|
273 |
+
if (_parent.hasClass('has-input')) {
|
274 |
+
var inputType = _parent.data('input-type'),
|
275 |
+
inputPlaceholder = _parent.data('input-placeholder'),
|
276 |
+
reasonInputHtml = '<div class="reason-input">' + (('textfield' === inputType) ? '<input type="text" />' : '<textarea rows="5"></textarea>') + '</div>';
|
277 |
+
|
278 |
+
_parent.append($(reasonInputHtml));
|
279 |
+
_parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
|
280 |
+
}
|
281 |
+
});
|
282 |
+
|
283 |
+
// If the user has clicked outside the window, cancel it.
|
284 |
+
$modal.on('click', function (evt) {
|
285 |
+
var $target = $(evt.target);
|
286 |
+
|
287 |
+
// If the user has clicked anywhere in the modal dialog, just return.
|
288 |
+
if ($target.hasClass('ts-modal-body') || $target.hasClass('ts-modal-footer')) {
|
289 |
+
return;
|
290 |
+
}
|
291 |
+
|
292 |
+
// If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
|
293 |
+
if (!$target.hasClass('button-close') && ($target.parents('.ts-modal-body').length > 0 || $target.parents('.ts-modal-footer').length > 0)) {
|
294 |
+
return;
|
295 |
+
}
|
296 |
+
|
297 |
+
closeModal();
|
298 |
+
});
|
299 |
+
}
|
300 |
+
|
301 |
+
function showModal() {
|
302 |
+
resetModal();
|
303 |
+
|
304 |
+
// Display the dialog box.
|
305 |
+
$modal.addClass('active');
|
306 |
+
|
307 |
+
$('body').addClass('has-ts-modal');
|
308 |
+
}
|
309 |
+
|
310 |
+
function closeModal() {
|
311 |
+
$modal.removeClass('active');
|
312 |
+
|
313 |
+
$('body').removeClass('has-ts-modal');
|
314 |
+
}
|
315 |
+
|
316 |
+
function resetModal() {
|
317 |
+
if (TSCustomReasons.hasOwnProperty(currentPluginName) === true) {
|
318 |
+
$modal.find("ul#reasons-list").html(TSCustomReasons[currentPluginName]);
|
319 |
+
} else {
|
320 |
+
$modal.find("ul#reasons-list").html(reasonsHtml);
|
321 |
+
|
322 |
+
}
|
323 |
+
var defaultSelect = TSDefaultReason[currentPluginName];
|
324 |
+
$modal.find('.button').removeClass('disabled');
|
325 |
+
|
326 |
+
// Remove all input fields ( textfield, textarea ).
|
327 |
+
$modal.find('.reason-input').remove();
|
328 |
+
|
329 |
+
var $deactivateButton = $modal.find('.button-deactivate');
|
330 |
+
$modal.find(".reason-hide").hide();
|
331 |
+
/*
|
332 |
+
* If the modal dialog has no confirmation message, that is, it has only one panel, then ensure
|
333 |
+
* that clicking the deactivate button will actually deactivate the plugin.
|
334 |
+
*/
|
335 |
+
if ($modal.hasClass('no-confirmation-message')) {
|
336 |
+
$deactivateButton.addClass('allow-deactivate');
|
337 |
+
showPanel('reasons');
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
function showPanel(panelType) {
|
342 |
+
$modal.find('.ts-modal-panel').removeClass('active ');
|
343 |
+
$modal.find('[data-panel-id="' + panelType + '"]').addClass('active');
|
344 |
+
|
345 |
+
updateButtonLabels();
|
346 |
+
}
|
347 |
+
|
348 |
+
function updateButtonLabels() {
|
349 |
+
var $deactivateButton = $modal.find('.button-deactivate');
|
350 |
+
|
351 |
+
// Reset the deactivate button's text.
|
352 |
+
if ('confirm' === getCurrentPanel()) {
|
353 |
+
$deactivateButton.text('<?php printf( WPCCPL_TS_deactivate::load_str( 'deactivation-modal-button-confirm' ) ); ?>');
|
354 |
+
} else {
|
355 |
+
var $radio = $('input[type="radio"]:checked');
|
356 |
+
if( $radio.length == 0 ) {
|
357 |
+
$deactivateButton.text('<?php printf( WPCCPL_TS_deactivate::load_str( 'deactivation-modal-button-deactivate' ) ); ?>');
|
358 |
+
} else {
|
359 |
+
var _parent = $( $radio ).parents('li:first');
|
360 |
+
var _parent_ul = $( $radio ).parents('ul#reasons-list');
|
361 |
+
|
362 |
+
_parent_ul.children("li.li-active").removeClass("li-active");
|
363 |
+
|
364 |
+
$modal.find('.reason-input').remove();
|
365 |
+
$modal.find('.button-deactivate').text('<?php printf( WPCCPL_TS_deactivate::load_str( 'deactivation-modal-button-submit' ) ); ?>');
|
366 |
+
|
367 |
+
if (_parent.hasClass('has_html')) {
|
368 |
+
_parent.addClass('li-active');
|
369 |
+
}
|
370 |
+
|
371 |
+
if (_parent.hasClass('has-input')) {
|
372 |
+
var inputType = _parent.data('input-type'),
|
373 |
+
inputPlaceholder = _parent.data('input-placeholder'),
|
374 |
+
reasonInputHtml = '<div class="reason-input">' + (('textfield' === inputType) ? '<input type="text" />' : '<textarea rows="5"></textarea>') + '</div>';
|
375 |
+
|
376 |
+
_parent.append($(reasonInputHtml));
|
377 |
+
_parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
|
378 |
+
}
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
function getCurrentPanel() {
|
384 |
+
return $modal.find('.ts-modal-panel.active').attr('data-panel-id');
|
385 |
+
}
|
386 |
+
})(jQuery);
|
387 |
+
</script>
|
includes/component/faq-support/Instructions
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Add FAQ's submenu or tab in the plugin.
|
2 |
+
|
3 |
+
To add this feature to the plugin, you can follow the below steps:
|
4 |
+
|
5 |
+
1. Copy the ts-faq-support.php file into your plugin folder. And faq-page folder into templates folder.
|
6 |
+
|
7 |
+
2. Include the ts-faq-support.php file once when on the admin page. This can be done with is_admin() function.
|
8 |
+
|
9 |
+
3. You need to pass the 7 parameters to the default constructor of the TS_Welcome class. You need to change the value of the variable value as per the respective plugin.
|
10 |
+
|
11 |
+
$wcap_plugin_prefix = 'wcap';
|
12 |
+
$wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
|
13 |
+
$wcap_blog_post_link = 'https://www.tychesoftwares.com/order-delivery-date-usage-tracking/';
|
14 |
+
$wcap_locale = 'woocommerce-ac';
|
15 |
+
$wcap_plugin_folder_name = 'woocommerce-abandon-cart-pro/';
|
16 |
+
$wcap_plugins_page = 'admin.php?page=woocommerce_ac_page';
|
17 |
+
$wcap_plugin_slug = 'woocommerce_ac_page';
|
18 |
+
|
19 |
+
$ts_pro_faq = self::wcap_get_faq ();
|
20 |
+
new TS_Faq_Support( $wcap_plugin_name, $wcap_plugin_prefix, $wcap_plugins_page, $wcap_locale, $wcap_plugin_folder_name, $wcap_plugin_slug, $ts_pro_faq );
|
21 |
+
|
22 |
+
Here , $ts_pro_faq is an array.
|
23 |
+
|
24 |
+
The structure of the array is like below:
|
25 |
+
|
26 |
+
$ts_faq = array(
|
27 |
+
1 => array (
|
28 |
+
'question' => '',
|
29 |
+
'answer' => ''
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
Here Index start from 1. Do not change it. We need to display 10 Questions and answers, so you can add 10 questions and answers in the above format.
|
34 |
+
|
35 |
+
4. You need to create 3 do_action in your respective plugin. And it should follow below standard.
|
36 |
+
|
37 |
+
1. {{plugin-prefix}}_add_settings_tab
|
38 |
+
2. {{plugin-prefix}}_add_tab_content
|
39 |
+
3. {{plugin-prefix}}_add_submenu
|
40 |
+
|
41 |
+
5. {{plugin-prefix}}_add_settings_tab : This do_action will be placed after your plguins tab. It will allow to add new tab.
|
42 |
+
|
43 |
+
6. {{plugin-prefix}}_add_tab_content : This do_action will be placed where you display the content of the tab.
|
44 |
+
|
45 |
+
7. {{plugin-prefix}}_add_submenu : This do_action will be placed where you have screated sub menu of your plguin.
|
46 |
+
|
47 |
+
8. You need to update all faq of the plugins.
|
includes/component/faq-support/templates/faq-page/faq-page.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* FAQ & Support page
|
4 |
+
*/
|
5 |
+
|
6 |
+
$faq_array = get_query_var( 'faq_support' );
|
7 |
+
|
8 |
+
$ts_plugin_name = $faq_array['ts_plugin_name'];
|
9 |
+
|
10 |
+
$ts_faq = $faq_array['ts_faq'];
|
11 |
+
|
12 |
+
?>
|
13 |
+
<style>
|
14 |
+
.faq-ts-accordion {
|
15 |
+
background-color: #ccc;
|
16 |
+
color: #444;
|
17 |
+
cursor: pointer;
|
18 |
+
padding: 18px;
|
19 |
+
width: 100%;
|
20 |
+
border: none;
|
21 |
+
text-align: left;
|
22 |
+
outline: none;
|
23 |
+
font-size: 15px;
|
24 |
+
transition: 0.4s;
|
25 |
+
margin-bottom: 5px;
|
26 |
+
}
|
27 |
+
.active, .faq-ts-accordion:hover {
|
28 |
+
background-color: #ccc;
|
29 |
+
}
|
30 |
+
.faq-ts-accordion:after {
|
31 |
+
content: '\002B';
|
32 |
+
color: #777;
|
33 |
+
font-weight: bold;
|
34 |
+
float: right;
|
35 |
+
margin-left: 5px;
|
36 |
+
}
|
37 |
+
.active:after {
|
38 |
+
content: "\2212";
|
39 |
+
}
|
40 |
+
.panel {
|
41 |
+
padding: 0 18px;
|
42 |
+
display: none;
|
43 |
+
background-color: light-grey;
|
44 |
+
overflow: hidden;
|
45 |
+
}
|
46 |
+
.main-panel {
|
47 |
+
width: 650px !important;
|
48 |
+
}
|
49 |
+
.support-panel {
|
50 |
+
padding: 5px;
|
51 |
+
}
|
52 |
+
.dashicons-external {
|
53 |
+
content: "\f504";
|
54 |
+
}
|
55 |
+
.dashicons-editor-help {
|
56 |
+
content: "\f223";
|
57 |
+
}
|
58 |
+
div.panel.show {
|
59 |
+
display: block !important;
|
60 |
+
}
|
61 |
+
|
62 |
+
</style>
|
63 |
+
|
64 |
+
<div class="main-panel">
|
65 |
+
<h3>Frequently Asked Questions for <?php echo $ts_plugin_name; ?> Plugin</h3>
|
66 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[1]['question'] ?></strong></button>
|
67 |
+
<div class="panel">
|
68 |
+
<p><?php echo $ts_faq[1]['answer'] ?></p>
|
69 |
+
</div>
|
70 |
+
|
71 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[2]['question'] ?></strong></button>
|
72 |
+
<div class="panel">
|
73 |
+
<p><?php echo $ts_faq[2]['answer'] ?></p>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[3]['question'] ?></strong></button>
|
77 |
+
<div class="panel">
|
78 |
+
<p><?php echo $ts_faq[3]['answer'] ?></p>
|
79 |
+
</div>
|
80 |
+
|
81 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[4]['question'] ?></strong></button>
|
82 |
+
<div class="panel">
|
83 |
+
<p><?php echo $ts_faq[4]['answer'] ?></p>
|
84 |
+
</div>
|
85 |
+
|
86 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[5]['question'] ?></strong></button>
|
87 |
+
<div class="panel">
|
88 |
+
<p><?php echo $ts_faq[5]['answer'] ?></p>
|
89 |
+
</div>
|
90 |
+
|
91 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[6]['question'] ?></strong></button>
|
92 |
+
<div class="panel">
|
93 |
+
<p><?php echo $ts_faq[6]['answer'] ?></p>
|
94 |
+
</div>
|
95 |
+
|
96 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[7]['question'] ?></strong></button>
|
97 |
+
<div class="panel">
|
98 |
+
<p><?php echo $ts_faq[7]['answer'] ?></p>
|
99 |
+
</div>
|
100 |
+
|
101 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[8]['question'] ?></strong></button>
|
102 |
+
<div class="panel">
|
103 |
+
<p><?php echo $ts_faq[8]['answer'] ?></p>
|
104 |
+
</div>
|
105 |
+
|
106 |
+
<button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[9]['question'] ?></strong></button>
|
107 |
+
<div class="panel">
|
108 |
+
<p><?php echo $ts_faq[9]['answer'] ?></p>
|
109 |
+
</div>
|
110 |
+
|
111 |
+
</div>
|
112 |
+
|
113 |
+
<div class="support-panel">
|
114 |
+
<p style="font-size: 19px">
|
115 |
+
If your queries are not answered here, you can send an email directly to <strong>support@tychesoftwares.freshdesk.com</strong> for some additional requirements.
|
116 |
+
</p>
|
117 |
+
</div>
|
118 |
+
<script>
|
119 |
+
var acc = document.getElementsByClassName("faq-ts-accordion");
|
120 |
+
var i;
|
121 |
+
|
122 |
+
for (i = 0; i < acc.length; i++) {
|
123 |
+
acc[i].onclick = function() {
|
124 |
+
hideAll();
|
125 |
+
|
126 |
+
this.classList.toggle("active");
|
127 |
+
this.nextElementSibling.classList.toggle("show");
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
function hideAll() {
|
132 |
+
for (i = 0; i < acc.length; i++) {
|
133 |
+
acc[i].classList.toggle( "active", false);
|
134 |
+
acc[i].nextElementSibling.classList.toggle( "show", false );
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
</script>
|
includes/component/faq-support/ts-faq-support.php
ADDED
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*/
|
7 |
+
class WPCCPL_TS_Faq_Support {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @var string The capability users should have to view the page
|
11 |
+
*/
|
12 |
+
public static $minimum_capability = 'manage_options';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var string Plugin name
|
16 |
+
* @access public
|
17 |
+
*/
|
18 |
+
|
19 |
+
public static $plugin_name = '';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var string Plugin prefix
|
23 |
+
* @access public
|
24 |
+
*/
|
25 |
+
public static $plugin_prefix = '';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var string Plugins page path
|
29 |
+
* @access public
|
30 |
+
*/
|
31 |
+
public static $plugin_page = '';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var string Plugins plugin local
|
35 |
+
* @access public
|
36 |
+
*/
|
37 |
+
public static $plugin_locale = '';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @var string Plugin folder name
|
41 |
+
* @access public
|
42 |
+
*/
|
43 |
+
public static $plugin_folder = '';
|
44 |
+
/**
|
45 |
+
* @var string Plugin url
|
46 |
+
* @access public
|
47 |
+
*/
|
48 |
+
public static $plugin_url = '';
|
49 |
+
/**
|
50 |
+
* @var string Template path
|
51 |
+
* @access public
|
52 |
+
*/
|
53 |
+
public static $template_base = '';
|
54 |
+
/**
|
55 |
+
* @var string Slug on Main menu
|
56 |
+
* @access public
|
57 |
+
*/
|
58 |
+
public static $plugin_slug = '';
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @var array List of all questions and answers.
|
62 |
+
* @access public
|
63 |
+
*/
|
64 |
+
public static $ts_faq = array ();
|
65 |
+
/**
|
66 |
+
* @var string Slug for FAQ submenu
|
67 |
+
* @access public
|
68 |
+
*/
|
69 |
+
public static $ts_faq_submenu_slug = '';
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @var string Plugin file name
|
73 |
+
* @access public
|
74 |
+
*/
|
75 |
+
public static $ts_faq_file_base_name = '';
|
76 |
+
/**
|
77 |
+
* Initialization of hooks where we prepare the functionality to ask use for survey
|
78 |
+
*/
|
79 |
+
public function __construct( $ts_plugin_mame = '', $ts_plugin_prefix = '', $ts_plugin_page = '', $ts_plugin_locale = '', $ts_plugin_folder_name = '', $ts_plugin_slug = '', $ts_faq_array = array(), $faq_submenu_slug = '', $ts_plugin_file = '' ) {
|
80 |
+
|
81 |
+
self::$plugin_name = $ts_plugin_mame;
|
82 |
+
self::$plugin_prefix = $ts_plugin_prefix;
|
83 |
+
self::$plugin_page = $ts_plugin_page;
|
84 |
+
self::$plugin_locale = $ts_plugin_locale;
|
85 |
+
self::$plugin_slug = $ts_plugin_slug;
|
86 |
+
self::$ts_faq = $ts_faq_array;
|
87 |
+
self::$ts_faq_submenu_slug = ( '' == $faq_submenu_slug ) ? self::$plugin_slug : $faq_submenu_slug ;
|
88 |
+
self::$ts_faq_file_base_name = $ts_plugin_file ;
|
89 |
+
|
90 |
+
//Add a sub menu in the main menu of the plugin if added.
|
91 |
+
add_action( self::$plugin_prefix . '_add_submenu', array( &$this, 'ts_add_submenu' ) );
|
92 |
+
|
93 |
+
//Add a tab for FAQ & Support along with other plugin settings tab.
|
94 |
+
add_action( self::$plugin_prefix . '_add_settings_tab', array( &$this, 'ts_add_new_settings_tab' ) );
|
95 |
+
add_action( self::$plugin_prefix . '_add_tab_content', array( &$this, 'ts_add_tab_content' ) );
|
96 |
+
|
97 |
+
add_action ( self::$plugin_prefix . '_add_meta_footer', array( &$this, 'ts_add_meta_footer_text' ), 10, 1 );
|
98 |
+
|
99 |
+
add_action( 'admin_menu', array( &$this, 'ts_admin_menus' ) );
|
100 |
+
add_action( 'admin_head', array( &$this, 'admin_head' ) );
|
101 |
+
|
102 |
+
self::$plugin_folder = $ts_plugin_folder_name;
|
103 |
+
self::$plugin_url = $this->ts_get_plugin_url();
|
104 |
+
self::$template_base = $this->ts_get_template_path();
|
105 |
+
|
106 |
+
|
107 |
+
add_filter( 'plugin_action_links_' . self::$ts_faq_file_base_name, array( __CLASS__, 'ts_plugin_action_links'
|
108 |
+
), 10 );
|
109 |
+
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Add the FAQ & SUpport link on the plugins page.
|
115 |
+
* @hook 'plugin_action_links_' . self::$ts_plugin_dir
|
116 |
+
*/
|
117 |
+
public static function ts_plugin_action_links ( $links ) {
|
118 |
+
|
119 |
+
$ts_action_links = array();
|
120 |
+
|
121 |
+
$ts_faq_url = admin_url( 'index.php?page='.self::$plugin_prefix.'_faq_page' ) ;
|
122 |
+
$ts_action_links = array(
|
123 |
+
'faq_support' => '<a href="'.$ts_faq_url.'" class="faq" title= "You can check Frequently asked questions off the plugin.">FAQ & Support</a>',
|
124 |
+
);
|
125 |
+
|
126 |
+
return array_merge( $ts_action_links, $links );
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
public static function ts_add_meta_footer_text () {
|
131 |
+
?>
|
132 |
+
<tr> <td> <br></td> </tr>
|
133 |
+
|
134 |
+
<tr>
|
135 |
+
<td colspan="2">
|
136 |
+
You have any queries? Please check our <a href=<?php echo admin_url( 'index.php?page='.self::$plugin_prefix .'_faq_page' ) ; ?> >FAQ</a> page.
|
137 |
+
</td>
|
138 |
+
<tr>
|
139 |
+
<?php
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Register the Dashboard Page which is later hidden but this pages
|
144 |
+
* is used to render the Welcome page.
|
145 |
+
*
|
146 |
+
* @access public
|
147 |
+
* @since 7.7
|
148 |
+
* @return void
|
149 |
+
*/
|
150 |
+
public function ts_admin_menus() {
|
151 |
+
|
152 |
+
// About Page
|
153 |
+
$page = add_dashboard_page(
|
154 |
+
sprintf( esc_html__( 'Frequently Asked Questions for %s', self::$plugin_locale ), self::$plugin_name ),
|
155 |
+
esc_html__( 'Frequently Asked Questions for ' . self::$plugin_name, self::$plugin_locale ),
|
156 |
+
self::$minimum_capability,
|
157 |
+
self::$plugin_prefix . '_faq_page',
|
158 |
+
array( $this, 'ts_faq_support_page' )
|
159 |
+
);
|
160 |
+
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Hide Individual Dashboard Pages
|
165 |
+
*
|
166 |
+
* @access public
|
167 |
+
* @since 7.7
|
168 |
+
* @return void
|
169 |
+
*/
|
170 |
+
public function admin_head() {
|
171 |
+
remove_submenu_page( 'index.php', self::$plugin_prefix . '_faq_page' );
|
172 |
+
}
|
173 |
+
/**
|
174 |
+
* Adds a subment to the main menu of the plugin
|
175 |
+
*
|
176 |
+
* @since 7.7
|
177 |
+
*/
|
178 |
+
|
179 |
+
public function ts_add_submenu() {
|
180 |
+
$page = add_submenu_page( self::$plugin_slug,
|
181 |
+
'FAQ & Support',
|
182 |
+
'FAQ & Support',
|
183 |
+
'manage_options',
|
184 |
+
self::$ts_faq_submenu_slug,
|
185 |
+
array( &$this, 'ts_add_tab_content' )
|
186 |
+
);
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Add a new tab on the settings page.
|
191 |
+
*
|
192 |
+
* @since 7.7
|
193 |
+
*/
|
194 |
+
public function ts_add_new_settings_tab() {
|
195 |
+
$faq_support_page = '';
|
196 |
+
if( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'faq_support_page' ) {
|
197 |
+
$faq_support_page = "nav-tab-active";
|
198 |
+
}
|
199 |
+
$ts_plugins_page_url = self::$plugin_page . "&action=faq_support_page" ;
|
200 |
+
?>
|
201 |
+
<a href="<?php echo $ts_plugins_page_url; ?>" class="nav-tab <?php echo $faq_support_page; ?>"> <?php _e( 'FAQ & Support', self::$plugin_locale ); ?> </a>
|
202 |
+
<?php
|
203 |
+
|
204 |
+
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Add content to the new tab added.
|
209 |
+
*
|
210 |
+
* @since 7.7
|
211 |
+
*/
|
212 |
+
|
213 |
+
public function ts_add_tab_content() {
|
214 |
+
if( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'faq_support_page' ) {
|
215 |
+
$this->ts_faq_support_page();
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Adds a page to display the FAQ's and support information
|
221 |
+
*
|
222 |
+
* @since 7.7
|
223 |
+
*/
|
224 |
+
public function ts_faq_support_page() {
|
225 |
+
|
226 |
+
$ts_file_path = dirname( __FILE__ ) ;
|
227 |
+
$faq_support = array(
|
228 |
+
'ts_plugin_name' => self::$plugin_name,
|
229 |
+
'ts_faq' => self::$ts_faq
|
230 |
+
);
|
231 |
+
set_query_var( 'faq_support', $faq_support );
|
232 |
+
|
233 |
+
ob_start();
|
234 |
+
load_template( $ts_file_path . '/templates/faq-page/faq-page.php'
|
235 |
+
);
|
236 |
+
echo ob_get_clean();
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* This function returns the plugin url
|
241 |
+
*
|
242 |
+
* @access public
|
243 |
+
* @since 7.7
|
244 |
+
* @return string
|
245 |
+
*/
|
246 |
+
public function ts_get_plugin_url() {
|
247 |
+
return plugins_url() . '/' . self::$plugin_folder;
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* This function returns the template directory path
|
252 |
+
*
|
253 |
+
* @access public
|
254 |
+
* @since 7.7
|
255 |
+
* @return string
|
256 |
+
*/
|
257 |
+
public function ts_get_template_path() {
|
258 |
+
return untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/';
|
259 |
+
}
|
260 |
+
}
|
includes/component/pro-notices-in-lite/Instructions
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Add some notices of Pro plugins in the lite plugins.
|
2 |
+
|
3 |
+
To add this feature to the plugin, you can follow the below steps:
|
4 |
+
|
5 |
+
1. Copy the ts-pro-notices.php file into your plugin folder.
|
6 |
+
|
7 |
+
2. Include the file once when on the admin page. This can be done with is_admin() function.
|
8 |
+
|
9 |
+
3. You need to pass the 3 parameters to the default constructor of the ts_pro_notices class. You need to change the value of the variable as per the respective plugin.
|
10 |
+
|
11 |
+
$wcap_plugin_prefix = 'wcap';
|
12 |
+
$wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
|
13 |
+
$wcap_lite_plugin_prefix = 'wcal';
|
14 |
+
|
15 |
+
new ts_pro_notices( $wcap_plugin_name, $wcap_lite_plugin_prefix, $wcap_plugin_prefix );
|
16 |
+
|
17 |
+
4. You need to add one do_action in your lite plguin. This do_action will be placed under the "register_activation_hook" hook of the plguin.
|
18 |
+
|
19 |
+
The do_action will be like {{plugin-prefix}}_activate
|
20 |
+
|
21 |
+
For an ex:
|
22 |
+
|
23 |
+
do_action( 'wcal_activate' );
|
24 |
+
|
25 |
+
Here, 'wcal' is tge prefix of the AC Lite.
|
26 |
+
|
27 |
+
5. Then you need create an array of the notices.
|
28 |
+
|
29 |
+
$ts_pro_notices = array (
|
30 |
+
1 => $message_first,
|
31 |
+
2 => $message_two,
|
32 |
+
3 => $message_three,
|
33 |
+
4 => $message_four,
|
34 |
+
5 => $message_five,
|
35 |
+
6 => $message_six,
|
36 |
+
7 => $message_seven,
|
37 |
+
8 => $message_eight,
|
38 |
+
9 => $message_nine,
|
39 |
+
) ;
|
40 |
+
|
41 |
+
Here, you dont need to change the index, you just need to change the message variable.
|
includes/component/pro-notices-in-lite/ts-pro-notices.php
ADDED
@@ -0,0 +1,667 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPCCPL_ts_pro_notices {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Plugin's Name
|
7 |
+
*
|
8 |
+
* @access public
|
9 |
+
* @since 3.5
|
10 |
+
*/
|
11 |
+
public static $plugin_name = "";
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Plugin's unique prefix
|
15 |
+
*
|
16 |
+
* @access public
|
17 |
+
* @since 3.5
|
18 |
+
*/
|
19 |
+
|
20 |
+
public static $plugin_prefix = '';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Pro plugin's unique prefix
|
24 |
+
*
|
25 |
+
* @access public
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
|
29 |
+
public static $pro_plugin_prefix = '';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var array Collection of all messages.
|
33 |
+
* @access public
|
34 |
+
*/
|
35 |
+
public static $ts_pro_notices = array ();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var string file name
|
39 |
+
* @access public
|
40 |
+
*/
|
41 |
+
public static $ts_file_name = '';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var string Pro version file name
|
45 |
+
* @access public
|
46 |
+
*/
|
47 |
+
public static $ts_pro_file_name = '';
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Default Constructor
|
52 |
+
*
|
53 |
+
* @since 3.5
|
54 |
+
*/
|
55 |
+
|
56 |
+
public function __construct( $ts_plugin_name = '', $ts_plugin_prefix = '', $ts_pro_plugin_prefix = '', $ts_notices = array(), $ts_file = '', $ts_pro_file = '' ) {
|
57 |
+
self::$plugin_name = $ts_plugin_name;
|
58 |
+
self::$plugin_prefix = $ts_plugin_prefix;
|
59 |
+
self::$pro_plugin_prefix = $ts_pro_plugin_prefix;
|
60 |
+
self::$ts_pro_notices = $ts_notices;
|
61 |
+
self::$ts_file_name = $ts_file;
|
62 |
+
self::$ts_pro_file_name = $ts_pro_file;
|
63 |
+
|
64 |
+
//Initialize settings
|
65 |
+
register_activation_hook( __FILE__, array( &$this, 'ts_notices_activate' ) );
|
66 |
+
|
67 |
+
//Add pro notices
|
68 |
+
add_action( 'admin_notices', array( __CLASS__, 'ts_notices_of_pro' ) );
|
69 |
+
add_action( 'admin_init', array( __CLASS__, 'ts_ignore_pro_notices' ) );
|
70 |
+
|
71 |
+
if( !get_option( self::$plugin_prefix . '_activate_time' ) ) {
|
72 |
+
add_action( self::$plugin_prefix . '_activate', array( __CLASS__, 'ts_notices_activate' ) );
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Add an option which stores the timestamp when the plugin is first activated
|
78 |
+
*
|
79 |
+
* @since 3.5
|
80 |
+
*/
|
81 |
+
public static function ts_notices_activate() {
|
82 |
+
//Pro admin Notices
|
83 |
+
if( !get_option( self::$plugin_prefix . '_activate_time' ) ) {
|
84 |
+
add_option( self::$plugin_prefix . '_activate_time', current_time( 'timestamp' ) );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
public static function ts_notices_of_pro() {
|
89 |
+
$activate_time = get_option ( self::$plugin_prefix . '_activate_time' );
|
90 |
+
$sixty_days = strtotime ( '+60 Days', $activate_time );
|
91 |
+
$current_time = current_time ( 'timestamp' );
|
92 |
+
$add_query_arguments = '';
|
93 |
+
$message = '';
|
94 |
+
|
95 |
+
if( '' != self::$ts_pro_file_name && !is_plugin_active( self::$ts_pro_file_name ) &&
|
96 |
+
( false === $activate_time || ( $activate_time > 0 && $current_time >= $sixty_days ) ) ) {
|
97 |
+
global $current_user ;
|
98 |
+
$user_id = $current_user->ID;
|
99 |
+
|
100 |
+
if( ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) ) {
|
101 |
+
|
102 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_first_notice_ignore', '0' );
|
103 |
+
|
104 |
+
$class = 'updated notice-info point-notice one';
|
105 |
+
$style = 'position:relative';
|
106 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
107 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[1], $cancel_button );
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
|
111 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' )
|
112 |
+
) {
|
113 |
+
|
114 |
+
$first_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore_time' );
|
115 |
+
$fifteen_days = strtotime( '+15 Days', $first_ignore_time[0] );
|
116 |
+
|
117 |
+
if ( $current_time > $fifteen_days ) {
|
118 |
+
|
119 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_second_notice_ignore', '0' );
|
120 |
+
|
121 |
+
$class = 'updated notice-info point-notice two';
|
122 |
+
$style = 'position:relative';
|
123 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
124 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[2], $cancel_button );
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
|
129 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' ) &&
|
130 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore' )
|
131 |
+
) {
|
132 |
+
|
133 |
+
$second_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore_time' );
|
134 |
+
$ts_fifteen_days = strtotime( '+15 Days', $second_ignore_time[0] );
|
135 |
+
|
136 |
+
if ( $current_time > $ts_fifteen_days ) {
|
137 |
+
|
138 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_third_notice_ignore', '0' );
|
139 |
+
|
140 |
+
$class = 'updated notice-info point-notice';
|
141 |
+
$style = 'position:relative';
|
142 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
143 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[3], $cancel_button );
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
|
148 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' ) &&
|
149 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore' ) &&
|
150 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore' )
|
151 |
+
) {
|
152 |
+
|
153 |
+
$third_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore_time' );
|
154 |
+
$ts_fifteen_days = strtotime( '+15 Days', $third_ignore_time[0] );
|
155 |
+
|
156 |
+
if ( $current_time > $ts_fifteen_days ) {
|
157 |
+
|
158 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_fourth_notice_ignore', '0' );
|
159 |
+
|
160 |
+
$class = 'updated notice-info point-notice';
|
161 |
+
$style = 'position:relative';
|
162 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
163 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[4], $cancel_button );
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
|
168 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' ) &&
|
169 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore' ) &&
|
170 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore' ) &&
|
171 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore' )
|
172 |
+
) {
|
173 |
+
|
174 |
+
$fourth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore_time' );
|
175 |
+
$ts_fifteen_days = strtotime( '+15 Days', $fourth_ignore_time[0] );
|
176 |
+
|
177 |
+
if ( $current_time > $ts_fifteen_days ) {
|
178 |
+
|
179 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_fifth_notice_ignore', '0' );
|
180 |
+
|
181 |
+
$class = 'updated notice-info point-notice';
|
182 |
+
$style = 'position:relative';
|
183 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
184 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[5], $cancel_button );
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Display Other plugin notices.
|
190 |
+
*/
|
191 |
+
|
192 |
+
if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
|
193 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' ) &&
|
194 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore' ) &&
|
195 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore' ) &&
|
196 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore' )
|
197 |
+
) {
|
198 |
+
$fifth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore_time' );
|
199 |
+
|
200 |
+
self::ts_display_other_pro_plugin_notices( $current_time, $activate_time, $fifth_ignore_time [ 0 ] );
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* What happen if the respective plugin is activated.
|
206 |
+
* AC - With latest version, Lite will be deactivated. With old version, it will be deactivated.
|
207 |
+
* Ordd, Prdd - Both version can be activated.
|
208 |
+
*
|
209 |
+
*/
|
210 |
+
$seven_days = strtotime ( '+7 Days', $activate_time );
|
211 |
+
if( ( is_plugin_active( self::$ts_pro_file_name ) || '' == self::$ts_pro_file_name ) &&
|
212 |
+
( false === $activate_time || ( $activate_time > 0 && $current_time >= $seven_days ) ) ) {
|
213 |
+
|
214 |
+
self::ts_display_other_pro_plugin_notices( $current_time, $activate_time );
|
215 |
+
}
|
216 |
+
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* It will display the all othe pro plugin notices
|
221 |
+
*
|
222 |
+
*/
|
223 |
+
public static function ts_display_other_pro_plugin_notices ( $current_time, $activate_time, $ts_consider_time = '' ) {
|
224 |
+
|
225 |
+
$sixth_plugin_link = self::$ts_pro_notices[6] ['plugin_link'];
|
226 |
+
|
227 |
+
if ( !is_plugin_active( $sixth_plugin_link ) &&
|
228 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore' )
|
229 |
+
) {
|
230 |
+
|
231 |
+
if ( '' != $ts_consider_time ) {
|
232 |
+
/**
|
233 |
+
* This is fifth ignore notice time plus 7 days
|
234 |
+
*/
|
235 |
+
$ts_consider_time = strtotime( '+7 Days', $ts_consider_time );
|
236 |
+
|
237 |
+
}
|
238 |
+
|
239 |
+
$sixth_message = self::$ts_pro_notices[6] ['message'];
|
240 |
+
|
241 |
+
if ( $current_time > $ts_consider_time ) {
|
242 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_sixth_notice_ignore', '0' );
|
243 |
+
|
244 |
+
$class = 'updated notice-info point-notice';
|
245 |
+
$style = 'position:relative';
|
246 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
247 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $sixth_message, $cancel_button );
|
248 |
+
}
|
249 |
+
|
250 |
+
}
|
251 |
+
|
252 |
+
if ( !is_plugin_active( $sixth_plugin_link ) &&
|
253 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore' ) &&
|
254 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore' )
|
255 |
+
) {
|
256 |
+
|
257 |
+
$sixth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore_time' );
|
258 |
+
$ts_seven_days = strtotime( '+7 Days', $sixth_ignore_time[0] );
|
259 |
+
|
260 |
+
if ( $current_time > $ts_seven_days ) {
|
261 |
+
|
262 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_seventh_notice_ignore', '0' );
|
263 |
+
|
264 |
+
$seventh_message = self::$ts_pro_notices[7] ['message'];
|
265 |
+
|
266 |
+
$class = 'updated notice-info point-notice';
|
267 |
+
$style = 'position:relative';
|
268 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
269 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $seventh_message, $cancel_button );
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
|
274 |
+
if ( !is_plugin_active( $sixth_plugin_link ) &&
|
275 |
+
|
276 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore' ) &&
|
277 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore' )
|
278 |
+
) {
|
279 |
+
|
280 |
+
$seventh_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore_time' );
|
281 |
+
$ts_seven_days = strtotime( '+7 Days', $seventh_ignore_time[0] );
|
282 |
+
|
283 |
+
if ( $current_time > $ts_seven_days ) {
|
284 |
+
|
285 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_eigth_notice_ignore', '0' );
|
286 |
+
|
287 |
+
$eight_message = self::$ts_pro_notices[8] ['message'];
|
288 |
+
|
289 |
+
$class = 'updated notice-info point-notice';
|
290 |
+
$style = 'position:relative';
|
291 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
292 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $eight_message, $cancel_button );
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
if ( !is_plugin_active( $sixth_plugin_link ) &&
|
297 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore' ) &&
|
298 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_ninth_notice_ignore' )
|
299 |
+
) {
|
300 |
+
|
301 |
+
$eigth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore_time' );
|
302 |
+
$ts_seven_days = strtotime( '+7 Days', $eigth_ignore_time[0] );
|
303 |
+
|
304 |
+
if ( $current_time > $ts_seven_days ) {
|
305 |
+
|
306 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_ninth_notice_ignore', '0' );
|
307 |
+
|
308 |
+
$ninth_message = self::$ts_pro_notices[9] ['message'];
|
309 |
+
|
310 |
+
$class = 'updated notice-info point-notice';
|
311 |
+
$style = 'position:relative';
|
312 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
313 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $ninth_message, $cancel_button );
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
|
318 |
+
$tenth_plugin_link = self::$ts_pro_notices[10] ['plugin_link'];
|
319 |
+
if ( !is_plugin_active( $tenth_plugin_link ) &&
|
320 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_ninth_notice_ignore' ) &&
|
321 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore' )
|
322 |
+
) {
|
323 |
+
|
324 |
+
$ninth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_ninth_notice_ignore_time' );
|
325 |
+
$ts_seven_days = strtotime( '+7 Days', $ninth_ignore_time[0] );
|
326 |
+
|
327 |
+
if ( $current_time > $ts_seven_days ) {
|
328 |
+
|
329 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_tenth_notice_ignore', '0' );
|
330 |
+
|
331 |
+
$tenth_message = self::$ts_pro_notices[10] ['message'];
|
332 |
+
|
333 |
+
$class = 'updated notice-info point-notice';
|
334 |
+
$style = 'position:relative';
|
335 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
336 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $tenth_message, $cancel_button );
|
337 |
+
}
|
338 |
+
|
339 |
+
} else if ( !is_plugin_active( $tenth_plugin_link ) &&
|
340 |
+
is_plugin_active ( $sixth_plugin_link ) &&
|
341 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore' )
|
342 |
+
) {
|
343 |
+
/**
|
344 |
+
* If Ac Pro active then Directly show notice after 30 days, skip 4 notice period of ac pro.
|
345 |
+
*/
|
346 |
+
$ts_seven_days = strtotime( '+30 Days', $activate_time );
|
347 |
+
|
348 |
+
if ( $current_time > $ts_seven_days ) {
|
349 |
+
|
350 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_tenth_notice_ignore', '0' );
|
351 |
+
|
352 |
+
$tenth_message = self::$ts_pro_notices[10] ['message'];
|
353 |
+
|
354 |
+
$class = 'updated notice-info point-notice';
|
355 |
+
$style = 'position:relative';
|
356 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
357 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $tenth_message, $cancel_button );
|
358 |
+
}
|
359 |
+
|
360 |
+
}
|
361 |
+
|
362 |
+
$eleven_plugin_link = self::$ts_pro_notices[11] ['plugin_link'];
|
363 |
+
if ( !is_plugin_active( $eleven_plugin_link ) &&
|
364 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore' ) &&
|
365 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleven_notice_ignore' )
|
366 |
+
) {
|
367 |
+
|
368 |
+
$tenth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore_time' );
|
369 |
+
$ts_seven_days = strtotime( '+7 Days', $tenth_ignore_time[0] );
|
370 |
+
|
371 |
+
if ( $current_time > $ts_seven_days ) {
|
372 |
+
|
373 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_eleven_notice_ignore', '0' );
|
374 |
+
|
375 |
+
$eleven_message = self::$ts_pro_notices[11] ['message'];
|
376 |
+
|
377 |
+
$class = 'updated notice-info point-notice';
|
378 |
+
$style = 'position:relative';
|
379 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
380 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $eleven_message, $cancel_button );
|
381 |
+
}
|
382 |
+
|
383 |
+
} else if ( !is_plugin_active( $eleven_plugin_link ) &&
|
384 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore' ) &&
|
385 |
+
! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleven_notice_ignore' )
|
386 |
+
) {
|
387 |
+
|
388 |
+
/**
|
389 |
+
* If Tenth notice has been ignored, the consider the time.
|
390 |
+
*/
|
391 |
+
$tenth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore_time' );
|
392 |
+
$ts_seven_days = strtotime( '+7 Days', $tenth_ignore_time[0] );
|
393 |
+
|
394 |
+
if ( $current_time > $ts_seven_days ) {
|
395 |
+
|
396 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_eleven_notice_ignore', '0' );
|
397 |
+
|
398 |
+
$eleven_message = self::$ts_pro_notices[11] ['message'];
|
399 |
+
|
400 |
+
$class = 'updated notice-info point-notice';
|
401 |
+
$style = 'position:relative';
|
402 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
403 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $eleven_message, $cancel_button );
|
404 |
+
}
|
405 |
+
|
406 |
+
} else if ( !is_plugin_active( $eleven_plugin_link ) &&
|
407 |
+
is_plugin_active ( $sixth_plugin_link ) &&
|
408 |
+
is_plugin_active ( $tenth_plugin_link ) &&
|
409 |
+
!get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleven_notice_ignore' )
|
410 |
+
) {
|
411 |
+
|
412 |
+
/**
|
413 |
+
* If Ac pro and orrdd pro is activate then skip the time priod of both plugins
|
414 |
+
*/
|
415 |
+
$ts_seven_days = strtotime( '+37 Days', $activate_time );
|
416 |
+
|
417 |
+
if ( $current_time > $ts_seven_days ) {
|
418 |
+
|
419 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_eleven_notice_ignore', '0' );
|
420 |
+
|
421 |
+
$eleven_message = self::$ts_pro_notices[11] ['message'];
|
422 |
+
|
423 |
+
$class = 'updated notice-info point-notice';
|
424 |
+
$style = 'position:relative';
|
425 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
426 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $eleven_message, $cancel_button );
|
427 |
+
}
|
428 |
+
|
429 |
+
}
|
430 |
+
|
431 |
+
$twelve_plugin_link = self::$ts_pro_notices[12] ['plugin_link'];
|
432 |
+
if ( !is_plugin_active( $twelve_plugin_link ) &&
|
433 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleven_notice_ignore' ) &&
|
434 |
+
!get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore' )
|
435 |
+
) {
|
436 |
+
|
437 |
+
$eleventh_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleventh_notice_ignore_time' );
|
438 |
+
$ts_seven_days = strtotime( '+7 Days', $eleventh_ignore_time[0] );
|
439 |
+
|
440 |
+
if ( $current_time > $ts_seven_days ) {
|
441 |
+
|
442 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_twelve_notice_ignore', '0' );
|
443 |
+
|
444 |
+
$twelve_message = self::$ts_pro_notices[12] ['message'];
|
445 |
+
|
446 |
+
$class = 'updated notice-info point-notice';
|
447 |
+
$style = 'position:relative';
|
448 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
449 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $twelve_message, $cancel_button );
|
450 |
+
}
|
451 |
+
|
452 |
+
} else if ( !is_plugin_active( $twelve_plugin_link ) &&
|
453 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore' ) &&
|
454 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleven_notice_ignore' ) &&
|
455 |
+
!get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore' )
|
456 |
+
) {
|
457 |
+
|
458 |
+
/**
|
459 |
+
* If ordd, booking notice ignored then consider booking plugin ignore time ( 11 )
|
460 |
+
*/
|
461 |
+
$eleventh_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleventh_notice_ignore_time' );
|
462 |
+
$ts_seven_days = strtotime( '+7 Days', $eleventh_ignore_time[0] );
|
463 |
+
|
464 |
+
if ( $current_time > $ts_seven_days ) {
|
465 |
+
|
466 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_twelve_notice_ignore', '0' );
|
467 |
+
|
468 |
+
$twelve_message = self::$ts_pro_notices[12] ['message'];
|
469 |
+
|
470 |
+
$class = 'updated notice-info point-notice';
|
471 |
+
$style = 'position:relative';
|
472 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
473 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $twelve_message, $cancel_button );
|
474 |
+
}
|
475 |
+
|
476 |
+
}else if ( !is_plugin_active( $twelve_plugin_link ) &&
|
477 |
+
is_plugin_active ( $sixth_plugin_link ) &&
|
478 |
+
is_plugin_active ( $tenth_plugin_link ) &&
|
479 |
+
is_plugin_active ( $eleven_plugin_link ) &&
|
480 |
+
!get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore' )
|
481 |
+
) {
|
482 |
+
/**
|
483 |
+
* If ac pro, ordd pro, booking is active then skip the time period for these plugins and consider the plugin activate time
|
484 |
+
*/
|
485 |
+
$ts_seven_days = strtotime( '+43 Days', $activate_time );
|
486 |
+
|
487 |
+
if ( $current_time > $ts_seven_days ) {
|
488 |
+
|
489 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_twelve_notice_ignore', '0' );
|
490 |
+
|
491 |
+
$twelve_message = self::$ts_pro_notices[12] ['message'];
|
492 |
+
|
493 |
+
$class = 'updated notice-info point-notice';
|
494 |
+
$style = 'position:relative';
|
495 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
496 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $twelve_message, $cancel_button );
|
497 |
+
}
|
498 |
+
|
499 |
+
}
|
500 |
+
|
501 |
+
$thirteen_plugin_link = self::$ts_pro_notices[13] ['plugin_link'];
|
502 |
+
if ( !is_plugin_active( $thirteen_plugin_link ) &&
|
503 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore' ) &&
|
504 |
+
!get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_thirteen_notice_ignore' )
|
505 |
+
) {
|
506 |
+
|
507 |
+
$twelve_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore_time' );
|
508 |
+
$ts_seven_days = strtotime( '+7 Days', $twelve_ignore_time[0] );
|
509 |
+
|
510 |
+
if ( $current_time > $ts_seven_days ) {
|
511 |
+
|
512 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_thirteen_notice_ignore', '0' );
|
513 |
+
|
514 |
+
$thirteen_message = self::$ts_pro_notices[13] ['message'];
|
515 |
+
|
516 |
+
$class = 'updated notice-info point-notice';
|
517 |
+
$style = 'position:relative';
|
518 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
519 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $thirteen_message, $cancel_button );
|
520 |
+
}
|
521 |
+
|
522 |
+
} else if ( !is_plugin_active( $thirteen_plugin_link ) &&
|
523 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore' ) &&
|
524 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleven_notice_ignore' ) &&
|
525 |
+
get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore' ) &&
|
526 |
+
!get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_thirteen_notice_ignore' )
|
527 |
+
) {
|
528 |
+
|
529 |
+
/**
|
530 |
+
* If ordd, booking, and wc deposits notice is ignored, then consider the wc deposits ignore time.
|
531 |
+
*/
|
532 |
+
$twelve_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore_time' );
|
533 |
+
$ts_seven_days = strtotime( '+7 Days', $twelve_ignore_time[0] );
|
534 |
+
|
535 |
+
if ( $current_time > $ts_seven_days ) {
|
536 |
+
|
537 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_thirteen_notice_ignore', '0' );
|
538 |
+
|
539 |
+
$thirteen_message = self::$ts_pro_notices[13] ['message'];
|
540 |
+
|
541 |
+
$class = 'updated notice-info point-notice';
|
542 |
+
$style = 'position:relative';
|
543 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
544 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $thirteen_message, $cancel_button );
|
545 |
+
}
|
546 |
+
|
547 |
+
}
|
548 |
+
else if ( !is_plugin_active( $thirteen_plugin_link ) &&
|
549 |
+
is_plugin_active ( $sixth_plugin_link ) &&
|
550 |
+
is_plugin_active ( $tenth_plugin_link ) &&
|
551 |
+
is_plugin_active ( $eleven_plugin_link ) &&
|
552 |
+
is_plugin_active ( $twelve_plugin_link ) &&
|
553 |
+
!get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_thirteen_notice_ignore' )
|
554 |
+
) {
|
555 |
+
|
556 |
+
/**
|
557 |
+
* If ordd, booking, and wc deposits activate, then consider the plugin activate time.
|
558 |
+
*/
|
559 |
+
$ts_seven_days = strtotime( '+50 Days', $activate_time );
|
560 |
+
|
561 |
+
if ( $current_time > $ts_seven_days ) {
|
562 |
+
|
563 |
+
$add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_thirteen_notice_ignore', '0' );
|
564 |
+
|
565 |
+
$thirteen_message = self::$ts_pro_notices[13] ['message'];
|
566 |
+
|
567 |
+
$class = 'updated notice-info point-notice';
|
568 |
+
$style = 'position:relative';
|
569 |
+
$cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
|
570 |
+
printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $thirteen_message, $cancel_button );
|
571 |
+
}
|
572 |
+
|
573 |
+
}
|
574 |
+
}
|
575 |
+
|
576 |
+
/**
|
577 |
+
* Ignore pro notice
|
578 |
+
*/
|
579 |
+
public static function ts_ignore_pro_notices() {
|
580 |
+
|
581 |
+
if( !get_option( self::$plugin_prefix . 'activate_time' ) ) {
|
582 |
+
add_option( self::$plugin_prefix . '_activate_time', current_time( 'timestamp' ) );
|
583 |
+
}
|
584 |
+
|
585 |
+
// If user clicks to ignore the notice, add that to their user meta
|
586 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_first_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_first_notice_ignore' ] ) {
|
587 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore', 'true', true );
|
588 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore_time', current_time( 'timestamp' ), true );
|
589 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_first_notice_ignore' ) );
|
590 |
+
|
591 |
+
}
|
592 |
+
|
593 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_second_notice_ignore'] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_second_notice_ignore'] ) {
|
594 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore', 'true', true );
|
595 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore_time', current_time( 'timestamp' ), true );
|
596 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_second_notice_ignore' ) );
|
597 |
+
}
|
598 |
+
|
599 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_third_notice_ignore'] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_third_notice_ignore'] ) {
|
600 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore', 'true', true );
|
601 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore_time', current_time( 'timestamp' ), true );
|
602 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_third_notice_ignore' ) );
|
603 |
+
}
|
604 |
+
|
605 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_fourth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_fourth_notice_ignore' ] ) {
|
606 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore', 'true', true );
|
607 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore_time', current_time( 'timestamp' ), true );
|
608 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_fourth_notice_ignore' ) );
|
609 |
+
}
|
610 |
+
|
611 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_fifth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_fifth_notice_ignore' ] ) {
|
612 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore', 'true', true );
|
613 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore_time', current_time( 'timestamp' ), true );
|
614 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_fifth_notice_ignore' ) );
|
615 |
+
}
|
616 |
+
|
617 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_sixth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_sixth_notice_ignore' ] ) {
|
618 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore', 'true', true );
|
619 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore_time', current_time( 'timestamp' ), true );
|
620 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_sixth_notice_ignore' ) );
|
621 |
+
}
|
622 |
+
|
623 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_seventh_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_seventh_notice_ignore' ] ) {
|
624 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore', 'true', true );
|
625 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore_time', current_time( 'timestamp' ), true );
|
626 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_seventh_notice_ignore' ) );
|
627 |
+
}
|
628 |
+
|
629 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_eigth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_eigth_notice_ignore' ] ) {
|
630 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore', 'true', true );
|
631 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore_time', current_time( 'timestamp' ), true );
|
632 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_eigth_notice_ignore' ) );
|
633 |
+
}
|
634 |
+
|
635 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_ninth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_ninth_notice_ignore' ] ) {
|
636 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_ninth_notice_ignore', 'true', true );
|
637 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_ninth_notice_ignore_time', current_time( 'timestamp' ), true );
|
638 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_ninth_notice_ignore' ) );
|
639 |
+
}
|
640 |
+
|
641 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_tenth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_tenth_notice_ignore' ] ) {
|
642 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore', 'true', true );
|
643 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_tenth_notice_ignore_time', current_time( 'timestamp' ), true );
|
644 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_tenth_notice_ignore' ) );
|
645 |
+
}
|
646 |
+
|
647 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_eleven_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_eleven_notice_ignore' ] ) {
|
648 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleven_notice_ignore', 'true', true );
|
649 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eleventh_notice_ignore_time', current_time( 'timestamp' ), true );
|
650 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_eleven_notice_ignore' ) );
|
651 |
+
}
|
652 |
+
|
653 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_twelve_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_twelve_notice_ignore' ] ) {
|
654 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore', 'true', true );
|
655 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_twelve_notice_ignore_time', current_time( 'timestamp' ), true );
|
656 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_twelve_notice_ignore' ) );
|
657 |
+
}
|
658 |
+
|
659 |
+
if ( isset( $_GET[ self::$pro_plugin_prefix . '_thirteen_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_thirteen_notice_ignore' ] ) {
|
660 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_thirteen_notice_ignore', 'true', true );
|
661 |
+
add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_thirteen_notice_ignore_time', current_time( 'timestamp' ), true );
|
662 |
+
wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_thirteen_notice_ignore' ) );
|
663 |
+
}
|
664 |
+
|
665 |
+
}
|
666 |
+
}
|
667 |
+
|
includes/component/tracking-data/Instructions
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Add a notice to ask customers to collect non-sensitive data for the plugin and provide them with 20% coupon code if they allow us to collect data.
|
2 |
+
|
3 |
+
To add this feature to the plugin, you can follow the below steps:
|
4 |
+
|
5 |
+
1. Copy the ts-tracking.php file and class-ts-tracker.php file into your plugin folder.
|
6 |
+
|
7 |
+
2. Include the file ts-tracking.php once when on the admin page. This can be done with is_admin() function.
|
8 |
+
|
9 |
+
3. You need to pass the 5 parameters to the default constructor of the TS_tracking class. You need to change the value of the variable as per the respective plugin.
|
10 |
+
|
11 |
+
$wcap_plugin_prefix = 'wcap';
|
12 |
+
$wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
|
13 |
+
$wcap_blog_post_link = 'https://www.tychesoftwares.com/order-delivery-date-usage-tracking/';
|
14 |
+
$wcap_locale = 'woocommerce-ac';
|
15 |
+
WCAP_PLUGIN_URL = untrailingslashit(plugins_url('/', __FILE__)) ;
|
16 |
+
|
17 |
+
new TS_tracking( $wcap_plugin_prefix, $wcap_plugin_name, $wcap_blog_post_link, $wcap_locale, WCAP_PLUGIN_URL );
|
18 |
+
|
19 |
+
4. Then you need to pass 2 parameters to the TS_Tracker class. You need to change the value of the variable as per the respective plugin.
|
20 |
+
|
21 |
+
$wcap_plugin_prefix = 'wcap';
|
22 |
+
$wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
|
23 |
+
new TS_Tracker( $wcap_plugin_prefix, $wcap_plugin_name );
|
24 |
+
|
25 |
+
5. We are using these class for tracking the data from the websites, so to track the data from the site we need to add the plugin data.
|
26 |
+
|
27 |
+
To get the data from the website you need to use 2 filters.
|
28 |
+
|
29 |
+
1. ts_tracker_data : It will be called when admin allows tracking the data.
|
30 |
+
|
31 |
+
2. ts_tracker_opt_out_data : It will be called when an admin does not allow to track the data
|
32 |
+
|
33 |
+
Both filters have 1 argument, you need to add all the data as per the plugin.
|
34 |
+
|
35 |
+
6. We need to give the table name in the tracking data. You need to pass that in above both filter.
|
36 |
+
|
37 |
+
IMP: ts_meta_data_table_name - this should contain the table name which will store the plugin specific data. This should not be skipped.
|
38 |
+
|
39 |
+
Like: $plugin_data[ 'ts_meta_data_table_name' ] = 'ts_tracking_wcap_meta_data';
|
40 |
+
|
41 |
+
Here, key 'ts_meta_data_table_name' should remain same, you just need to change the table name.
|
42 |
+
|
43 |
+
Here, in the AC pro case, I have given table name as 'ts_tracking_{{prefix-of-plugin}}_meta_data
|
44 |
+
|
45 |
+
7. Here we need 1 js file and 1 image for the tracking of the data. So I have added in the same folder, so the code structure is kept as per the current location.
|
46 |
+
|
47 |
+
If you move the js file and the image to another place then you need to change that in the 'ts-tracking.php' file.
|
48 |
+
|
49 |
+
You need to change the line number #75 for js file.
|
50 |
+
You need to change the line number #127 for the image.
|
51 |
+
|
52 |
+
8. It is also have the ajax function which will be named as
|
53 |
+
|
54 |
+
'wp_ajax_{{plugin-prefix}}_admin_notices'
|
includes/component/tracking-data/assets/images/site-logo-new.jpg
ADDED
Binary file
|
includes/component/tracking-data/assets/js/dismiss-notice.js
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* This function allows to dismiss the notices which are shown from the plugin.
|
3 |
+
*
|
4 |
+
* @namespace orddd_notice_dismissible
|
5 |
+
* @since 6.8
|
6 |
+
*/
|
7 |
+
// Make notices dismissible
|
8 |
+
jQuery(document).ready( function() {
|
9 |
+
jQuery( '.notice.is-dismissible' ).each( function() {
|
10 |
+
var $this = jQuery( this ),
|
11 |
+
$button = jQuery( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
|
12 |
+
btnText = commonL10n.dismiss || '';
|
13 |
+
|
14 |
+
// Ensure plain text
|
15 |
+
$button.find( '.screen-reader-text' ).text( btnText );
|
16 |
+
|
17 |
+
$this.append( $button );
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Event when close icon is clicked.
|
21 |
+
* @fires event:notice-dismiss
|
22 |
+
* @since 6.8
|
23 |
+
*/
|
24 |
+
$button.on( 'click.notice-dismiss', function( event ) {
|
25 |
+
event.preventDefault();
|
26 |
+
$this.fadeTo( 100 , 0, function() {
|
27 |
+
//alert();
|
28 |
+
jQuery(this).slideUp( 100, function() {
|
29 |
+
jQuery(this).remove();
|
30 |
+
var data = {
|
31 |
+
action: ts_dismiss_notice.ts_prefix_of_plugin + "_admin_notices"
|
32 |
+
};
|
33 |
+
var admin_url = ts_dismiss_notice.ts_admin_url;
|
34 |
+
|
35 |
+
jQuery.post( admin_url , data, function( response ) {
|
36 |
+
});
|
37 |
+
});
|
38 |
+
});
|
39 |
+
});
|
40 |
+
});
|
41 |
+
});
|
includes/component/tracking-data/class-ts-tracker.php
ADDED
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The tracker class adds functionality to track usage of the plugin based on if the customer opted in.
|
4 |
+
* No personal information is tracked, only general settings, order and user counts and admin email for
|
5 |
+
* discount code.
|
6 |
+
*
|
7 |
+
* @class WPCCPL_TS_Tracker
|
8 |
+
* @version 6.8
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
class WPCCPL_TS_Tracker {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* URL to the Tracker API endpoint.
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
|
22 |
+
private static $api_url = 'http://tracking.tychesoftwares.com/v1/';
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var string Plugin prefix
|
26 |
+
* @access public
|
27 |
+
*/
|
28 |
+
|
29 |
+
public static $plugin_prefix = '';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var string Plugin name
|
33 |
+
* @access public
|
34 |
+
*/
|
35 |
+
|
36 |
+
public static $plugin_name = '';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Hook into cron event.
|
40 |
+
*/
|
41 |
+
public function __construct( $ts_plugin_prefix = '', $ts_plugin_name = '' ) {
|
42 |
+
|
43 |
+
self::$plugin_prefix = $ts_plugin_prefix;
|
44 |
+
self::$plugin_name = $ts_plugin_name;
|
45 |
+
|
46 |
+
add_action( self::$plugin_prefix . '_ts_tracker_send_event', array( __CLASS__, 'ts_send_tracking_data' ) );
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Decide whether to send tracking data or not.
|
51 |
+
*
|
52 |
+
* @param boolean $override
|
53 |
+
*/
|
54 |
+
public static function ts_send_tracking_data( $override = false ) {
|
55 |
+
if ( ! apply_filters( 'ts_tracker_send_override', $override ) ) {
|
56 |
+
// Send a maximum of once per week by default.
|
57 |
+
$last_send = self::ts_get_last_send_time();
|
58 |
+
if ( $last_send && $last_send > apply_filters( 'ts_tracker_last_send_interval', strtotime( '-1 week' ) ) ) {
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
} else {
|
62 |
+
// Make sure there is at least a 1 hour delay between override sends, we don't want duplicate calls due to double clicking links.
|
63 |
+
$last_send = self::ts_get_last_send_time();
|
64 |
+
if ( $last_send && $last_send > strtotime( '-1 hours' ) ) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
$allow_tracking = get_option( self::$plugin_prefix . '_allow_tracking' );
|
70 |
+
if ( 'yes' == $allow_tracking ) {
|
71 |
+
$override = true;
|
72 |
+
}
|
73 |
+
|
74 |
+
// Update time first before sending to ensure it is set
|
75 |
+
update_option( self::$plugin_prefix . '_ts_tracker_last_send', time() );
|
76 |
+
|
77 |
+
if( $override == false ) {
|
78 |
+
$params = array();
|
79 |
+
$params[ 'tracking_usage' ] = 'no';
|
80 |
+
$params[ 'url' ] = home_url();
|
81 |
+
$params[ 'email' ] = '';
|
82 |
+
|
83 |
+
$params = apply_filters( 'ts_tracker_opt_out_data', $params );
|
84 |
+
} else {
|
85 |
+
$params = self::ts_get_tracking_data();
|
86 |
+
}
|
87 |
+
|
88 |
+
wp_safe_remote_post( self::$api_url, array(
|
89 |
+
'method' => 'POST',
|
90 |
+
'timeout' => 45,
|
91 |
+
'redirection' => 5,
|
92 |
+
'httpversion' => '1.0',
|
93 |
+
'blocking' => false,
|
94 |
+
'headers' => array( 'user-agent' => 'TSTracker/' . md5( esc_url( home_url( '/' ) ) ) . ';' ),
|
95 |
+
'body' => json_encode( $params ),
|
96 |
+
'cookies' => array(),
|
97 |
+
)
|
98 |
+
);
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Get the last time tracking data was sent.
|
103 |
+
* @return int|bool
|
104 |
+
*/
|
105 |
+
private static function ts_get_last_send_time() {
|
106 |
+
return apply_filters( 'ts_tracker_last_send_time', get_option( self::$plugin_prefix . '_ts_tracker_last_send', false ) );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Get all the tracking data.
|
111 |
+
* @return array
|
112 |
+
*/
|
113 |
+
private static function ts_get_tracking_data() {
|
114 |
+
$data = array();
|
115 |
+
|
116 |
+
// General site info
|
117 |
+
$data[ 'url' ] = home_url();
|
118 |
+
$data[ 'email' ] = apply_filters( 'ts_tracker_admin_email', get_option( 'admin_email' ) );
|
119 |
+
|
120 |
+
// WordPress Info
|
121 |
+
$data[ 'wp' ] = self::ts_get_wordpress_info();
|
122 |
+
|
123 |
+
$data[ 'theme_info' ] = self::ts_get_theme_info();
|
124 |
+
|
125 |
+
// Server Info
|
126 |
+
$data[ 'server' ] = self::ts_get_server_info();
|
127 |
+
|
128 |
+
// Plugin info
|
129 |
+
$all_plugins = self::ts_get_all_plugins();
|
130 |
+
$data[ 'active_plugins' ] = $all_plugins[ 'active_plugins' ];
|
131 |
+
$data[ 'inactive_plugins' ] = $all_plugins[ 'inactive_plugins' ];
|
132 |
+
|
133 |
+
return apply_filters( 'ts_tracker_data', $data );
|
134 |
+
}
|
135 |
+
|
136 |
+
private static function tyche_let_to_num( $size ) {
|
137 |
+
$l = substr( $size, -1 );
|
138 |
+
$ret = substr( $size, 0, -1 );
|
139 |
+
switch ( strtoupper( $l ) ) {
|
140 |
+
case 'P':
|
141 |
+
$ret *= 1024;
|
142 |
+
case 'T':
|
143 |
+
$ret *= 1024;
|
144 |
+
case 'G':
|
145 |
+
$ret *= 1024;
|
146 |
+
case 'M':
|
147 |
+
$ret *= 1024;
|
148 |
+
case 'K':
|
149 |
+
$ret *= 1024;
|
150 |
+
}
|
151 |
+
return $ret;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Get WordPress related data.
|
156 |
+
* @return array
|
157 |
+
*/
|
158 |
+
private static function ts_get_wordpress_info() {
|
159 |
+
$wp_data = array();
|
160 |
+
|
161 |
+
$memory = self::tyche_let_to_num( WP_MEMORY_LIMIT );
|
162 |
+
|
163 |
+
if ( function_exists( 'memory_get_usage' ) ) {
|
164 |
+
$system_memory = self::tyche_let_to_num( @ini_get( 'memory_limit' ) );
|
165 |
+
$memory = max( $memory, $system_memory );
|
166 |
+
}
|
167 |
+
|
168 |
+
$wp_data[ 'memory_limit' ] = size_format( $memory );
|
169 |
+
$wp_data[ 'debug_mode' ] = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No';
|
170 |
+
$wp_data[ 'locale' ] = get_locale();
|
171 |
+
$wp_data[ 'wp_version' ] = get_bloginfo( 'version' );
|
172 |
+
$wp_data[ 'multisite' ] = is_multisite() ? 'Yes' : 'No';
|
173 |
+
$wp_data[ 'blogdescription' ] = get_option ( 'blogdescription' );
|
174 |
+
$wp_data[ 'blogname' ] = get_option ( 'blogname' );
|
175 |
+
|
176 |
+
return $wp_data;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Get the current theme info, theme name and version.
|
181 |
+
* @return array
|
182 |
+
*/
|
183 |
+
public static function ts_get_theme_info() {
|
184 |
+
$theme_data = wp_get_theme();
|
185 |
+
$theme_child_theme = is_child_theme() ? 'Yes' : 'No';
|
186 |
+
|
187 |
+
return array( 'theme_name' => $theme_data->Name,
|
188 |
+
'theme_version' => $theme_data->Version,
|
189 |
+
'child_theme' => $theme_child_theme );
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Get server related info.
|
194 |
+
* @return array
|
195 |
+
*/
|
196 |
+
private static function ts_get_server_info() {
|
197 |
+
global $wpdb;
|
198 |
+
$server_data = array();
|
199 |
+
|
200 |
+
if ( isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) && ! empty( $_SERVER[ 'SERVER_SOFTWARE' ] ) ) {
|
201 |
+
$server_data[ 'software' ] = $_SERVER[ 'SERVER_SOFTWARE' ];
|
202 |
+
}
|
203 |
+
|
204 |
+
if ( function_exists( 'phpversion' ) ) {
|
205 |
+
$server_data[ 'php_version' ] = phpversion();
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( function_exists( 'ini_get' ) ) {
|
209 |
+
$server_data[ 'php_post_max_size' ] = size_format( self::tyche_let_to_num( ini_get( 'post_max_size' ) ) );
|
210 |
+
$server_data[ 'php_time_limt' ] = ini_get( 'max_execution_time' );
|
211 |
+
$server_data[ 'php_max_input_vars' ] = ini_get( 'max_input_vars' );
|
212 |
+
$server_data[ 'php_suhosin' ] = extension_loaded( 'suhosin' ) ? 'Yes' : 'No';
|
213 |
+
}
|
214 |
+
|
215 |
+
$server_data[ 'mysql_version' ] = $wpdb->db_version();
|
216 |
+
|
217 |
+
$server_data[ 'php_max_upload_size' ] = size_format( wp_max_upload_size() );
|
218 |
+
$server_data[ 'php_default_timezone' ] = date_default_timezone_get();
|
219 |
+
$server_data[ 'php_soap' ] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
|
220 |
+
$server_data[ 'php_fsockopen' ] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
|
221 |
+
$server_data[ 'php_curl' ] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
|
222 |
+
|
223 |
+
return $server_data;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Get all plugins grouped into activated or not.
|
228 |
+
* @return array
|
229 |
+
*/
|
230 |
+
private static function ts_get_all_plugins() {
|
231 |
+
// Ensure get_plugins function is loaded
|
232 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
233 |
+
include ABSPATH . '/wp-admin/includes/plugin.php';
|
234 |
+
}
|
235 |
+
|
236 |
+
$plugins = get_plugins();
|
237 |
+
$active_plugins_keys = get_option( 'active_plugins', array() );
|
238 |
+
$active_plugins = array();
|
239 |
+
|
240 |
+
foreach ( $plugins as $k => $v ) {
|
241 |
+
// Take care of formatting the data how we want it.
|
242 |
+
$formatted = array();
|
243 |
+
$formatted[ 'name' ] = strip_tags( $v[ 'Name' ] );
|
244 |
+
if ( isset( $v[ 'Version' ] ) ) {
|
245 |
+
$formatted[ 'version' ] = strip_tags( $v[ 'Version' ] );
|
246 |
+
}
|
247 |
+
if ( isset( $v[ 'Author' ] ) ) {
|
248 |
+
$formatted[ 'author' ] = strip_tags( $v[ 'Author' ] );
|
249 |
+
}
|
250 |
+
if ( isset( $v[ 'Network' ] ) ) {
|
251 |
+
$formatted[ 'network' ] = strip_tags( $v[ 'Network' ] );
|
252 |
+
}
|
253 |
+
if ( isset( $v[ 'PluginURI' ] ) ) {
|
254 |
+
$formatted[ 'plugin_uri' ] = strip_tags( $v[ 'PluginURI' ] );
|
255 |
+
}
|
256 |
+
if ( in_array( $k, $active_plugins_keys ) ) {
|
257 |
+
// Remove active plugins from list so we can show active and inactive separately
|
258 |
+
unset( $plugins[ $k ] );
|
259 |
+
$active_plugins[ $k ] = $formatted;
|
260 |
+
} else {
|
261 |
+
$plugins[ $k ] = $formatted;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
|
266 |
+
}
|
267 |
+
}
|
includes/component/tracking-data/ts-tracking.php
ADDED
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
include_once( 'class-ts-tracker.php' );
|
7 |
+
|
8 |
+
/** Adds the Tracking non-senstive data notice
|
9 |
+
*
|
10 |
+
* @since 6.8
|
11 |
+
*/
|
12 |
+
class WPCCPL_TS_tracking {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var string Plugin prefix
|
16 |
+
* @access public
|
17 |
+
*/
|
18 |
+
|
19 |
+
public static $plugin_prefix = '';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var string Plugin Name
|
23 |
+
* @access public
|
24 |
+
*/
|
25 |
+
|
26 |
+
public static $plugin_name = '';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var string Tracking data blog post link
|
30 |
+
* @access public
|
31 |
+
*/
|
32 |
+
|
33 |
+
public static $blog_post_link = '';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var string Plugin context
|
37 |
+
* @access public
|
38 |
+
*/
|
39 |
+
|
40 |
+
public static $plugin_context = '';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var string Plugin url
|
44 |
+
* @access public
|
45 |
+
*/
|
46 |
+
public static $plugin_url = '';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var string File path
|
50 |
+
* @access public
|
51 |
+
*/
|
52 |
+
public static $ts_file_path = '' ;
|
53 |
+
/**
|
54 |
+
* @var string plugin locale
|
55 |
+
* @access public
|
56 |
+
*/
|
57 |
+
public static $ts_plugin_locale = '';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @var string Settings page
|
61 |
+
* @access public
|
62 |
+
*/
|
63 |
+
public static $ts_settings_page = '';
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @var string On which setting page need to add setting
|
67 |
+
* @access public
|
68 |
+
*/
|
69 |
+
public static $ts_add_setting_on_page = '';
|
70 |
+
/**
|
71 |
+
* @var string On which section setting need to add
|
72 |
+
* @access public
|
73 |
+
*/
|
74 |
+
public static $ts_add_setting_on_section = '';
|
75 |
+
/**
|
76 |
+
* @var string Register setting
|
77 |
+
* @access public
|
78 |
+
*/
|
79 |
+
public static $ts_register_setting = '';
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @var string Plugin dir
|
83 |
+
* @access public
|
84 |
+
*/
|
85 |
+
public static $ts_plugin_dir ='';
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Default Constructor
|
89 |
+
*
|
90 |
+
*/
|
91 |
+
public function __construct( $ts_plugin_prefix = '', $ts_plugin_name = '', $ts_blog_post_link = '', $ts_plugin_context = '', $ts_plugin_url = '', $setting_page = '', $add_setting = '', $setting_section = '', $setting_register = '', $plugin_dir = '' ) {
|
92 |
+
|
93 |
+
self::$plugin_prefix = $ts_plugin_prefix;
|
94 |
+
self::$plugin_name = $ts_plugin_name;
|
95 |
+
self::$blog_post_link = $ts_blog_post_link;
|
96 |
+
self::$plugin_url = $ts_plugin_url;
|
97 |
+
self::$ts_plugin_locale = $ts_plugin_context;
|
98 |
+
self::$ts_settings_page = $setting_page;
|
99 |
+
self::$ts_add_setting_on_page = $add_setting;
|
100 |
+
self::$ts_add_setting_on_section = $setting_section;
|
101 |
+
self::$ts_register_setting = $setting_register;
|
102 |
+
|
103 |
+
self::$ts_plugin_dir = $plugin_dir;
|
104 |
+
|
105 |
+
self::$ts_file_path = untrailingslashit( plugins_url( '/', __FILE__) ) ;
|
106 |
+
//Tracking Data
|
107 |
+
add_action( 'admin_notices', array( __CLASS__, 'ts_track_usage_data' ) );
|
108 |
+
add_action( 'admin_footer', array( __CLASS__, 'ts_admin_notices_scripts' ) );
|
109 |
+
add_action( 'wp_ajax_'.self::$plugin_prefix.'_admin_notices', array( __CLASS__, 'ts_admin_notices' ) );
|
110 |
+
|
111 |
+
add_filter( 'cron_schedules', array( __CLASS__, 'ts_add_cron_schedule' ) );
|
112 |
+
|
113 |
+
add_action( self::$plugin_prefix . '_add_new_settings', array( __CLASS__, 'ts_add_reset_tracking_setting' ) );
|
114 |
+
|
115 |
+
add_action ( 'admin_init', array( __CLASS__, 'ts_reset_tracking_setting' ) ) ;
|
116 |
+
|
117 |
+
self::ts_schedule_cron_job();
|
118 |
+
|
119 |
+
add_filter( self::$plugin_prefix . '_add_settings_field', array( __CLASS__, 'ts_add_new_settings_field') );
|
120 |
+
|
121 |
+
if ( '' != self::$ts_plugin_dir ) {
|
122 |
+
add_filter( 'plugin_action_links_' . self::$ts_plugin_dir, array( __CLASS__, 'ts_plugin_action_links'
|
123 |
+
) );
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Add the Reset tracking link on the plugins page.
|
129 |
+
* @hook 'plugin_action_links_' . self::$ts_plugin_dir
|
130 |
+
*/
|
131 |
+
public static function ts_plugin_action_links ( $links ) {
|
132 |
+
|
133 |
+
$ts_action_links = array();
|
134 |
+
|
135 |
+
if ( 'unknown' != get_option( self::$plugin_prefix . '_allow_tracking', 'unknown' ) ) {
|
136 |
+
|
137 |
+
$ts_action = self::$ts_settings_page . "?ts_action=reset_tracking";
|
138 |
+
|
139 |
+
$ts_action_links = array(
|
140 |
+
'reset_tracking' => '<a href="'.$ts_action.'" class="reset_tracking" title= "This will reset your usage tracking settings, causing it to show the opt-in banner again and not sending any data.">Reset Usage Tracking</a>',
|
141 |
+
);
|
142 |
+
}
|
143 |
+
return array_merge( $ts_action_links, $links );
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* It will add the New setting for the WooCommerce settings.
|
148 |
+
* @hook self::$plugin_prefix . '_add_settings_field'
|
149 |
+
*/
|
150 |
+
public static function ts_add_new_settings_field ( $ts_settings ) {
|
151 |
+
|
152 |
+
$ts_settings = array (
|
153 |
+
'name' => __( 'Reset usage tracking', 'deposits-for-woocommerce'),
|
154 |
+
'type' => 'link',
|
155 |
+
'desc' => __( 'This will reset your usage tracking settings, causing it to show the opt-in banner again and not sending any data','ts-tracking'),
|
156 |
+
'button_text' => 'Reset',
|
157 |
+
'desc_tip' => true,
|
158 |
+
'class' => 'button-secondary reset_tracking',
|
159 |
+
'id' => 'ts_reset_tracking',
|
160 |
+
);
|
161 |
+
|
162 |
+
return $ts_settings;
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
/**
|
168 |
+
* It will delete the tracking option from the database.
|
169 |
+
*/
|
170 |
+
public static function ts_reset_tracking_setting () {
|
171 |
+
|
172 |
+
if ( isset ( $_GET [ 'ts_action' ] ) && 'reset_tracking' == $_GET [ 'ts_action' ] ) {
|
173 |
+
delete_option( self::$plugin_prefix . '_allow_tracking' );
|
174 |
+
delete_option( self::$plugin_prefix . '_ts_tracker_last_send' );
|
175 |
+
$ts_url = remove_query_arg( 'ts_action' );
|
176 |
+
wp_safe_redirect( $ts_url );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* It will add the settinig, which will allow store owner to reset the tracking data. Which will result into stop trakcing the data.
|
182 |
+
* @hook self::$plugin_prefix . '_add_new_settings'
|
183 |
+
*
|
184 |
+
*/
|
185 |
+
public static function ts_add_reset_tracking_setting ( $value ) {
|
186 |
+
|
187 |
+
if ( '' == self::$ts_add_setting_on_page && '' == self::$ts_add_setting_on_section && '' == self::$ts_register_setting ) {
|
188 |
+
if ( $value['id'] == 'ts_reset_tracking' ) {
|
189 |
+
$description = WC_Admin_Settings::get_field_description( $value );
|
190 |
+
$ts_action = self::$ts_settings_page . "&ts_action=reset_tracking";
|
191 |
+
?>
|
192 |
+
|
193 |
+
<tr valign="top">
|
194 |
+
<th scope="row" class="titledesc">
|
195 |
+
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
196 |
+
<?php echo $description['tooltip_html'];?>
|
197 |
+
</th>
|
198 |
+
|
199 |
+
<td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
|
200 |
+
|
201 |
+
<a href = "<?php echo $ts_action; ?>"
|
202 |
+
name ="ts_reset_tracking"
|
203 |
+
id ="ts_reset_tracking"
|
204 |
+
style="<?php echo esc_attr( $value['css'] ); ?>"
|
205 |
+
class="<?php echo esc_attr( $value['class'] ); ?>"
|
206 |
+
> <?php echo $value['button_text']; ?> </a> <?php echo $description['description']; ?>
|
207 |
+
</td>
|
208 |
+
</tr><?php
|
209 |
+
}
|
210 |
+
} else {
|
211 |
+
add_settings_field(
|
212 |
+
'ts_reset_tracking',
|
213 |
+
__( 'Reset usage tracking', self::$ts_plugin_locale ),
|
214 |
+
array( __CLASS__, 'ts_rereset_tracking_callback' ),
|
215 |
+
self::$ts_add_setting_on_page,
|
216 |
+
self::$ts_add_setting_on_section,
|
217 |
+
array( 'This will reset your usage tracking settings, causing it to show the opt-in banner again and not sending any data.', self::$ts_plugin_locale )
|
218 |
+
);
|
219 |
+
|
220 |
+
register_setting(
|
221 |
+
self::$ts_register_setting,
|
222 |
+
'ts_reset_tracking'
|
223 |
+
);
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
public static function ts_reset_tracking_setting_section_callback ( ) {
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* It will add the Reset button on the settings page.
|
233 |
+
* @param array $args
|
234 |
+
*/
|
235 |
+
public static function ts_rereset_tracking_callback ( $args ) {
|
236 |
+
$wcap_restrict_domain_address = get_option( 'wcap_restrict_domain_address' );
|
237 |
+
$domain_value = isset( $wcap_restrict_domain_address ) ? esc_attr( $wcap_restrict_domain_address ) : '';
|
238 |
+
// Next, we update the name attribute to access this element's ID in the context of the display options array
|
239 |
+
// We also access the show_header element of the options collection in the call to the checked() helper function
|
240 |
+
$ts_action = self::$ts_settings_page . "&ts_action=reset_tracking";
|
241 |
+
printf( '<a href="'.$ts_action.'" class="button button-large reset_tracking">Reset</a>' );
|
242 |
+
|
243 |
+
// Here, we'll take the first argument of the array and add it to a label next to the checkbox
|
244 |
+
$html = '<label for="wcap_restrict_domain_address_label"> ' . $args[0] . '</label>';
|
245 |
+
echo $html;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* It will add a cron job for sending the tarcking data.
|
250 |
+
* By default it will set once in a week interval.
|
251 |
+
* @hook cron_schedules
|
252 |
+
* @param array $schedules
|
253 |
+
* @return array $schedules
|
254 |
+
*/
|
255 |
+
public static function ts_add_cron_schedule( $schedules ) {
|
256 |
+
$schedules[ 'once_in_week' ] = array(
|
257 |
+
'interval' => 604800, // one week in seconds
|
258 |
+
'display' => __( 'Once in a Week', self::$ts_plugin_locale )
|
259 |
+
);
|
260 |
+
|
261 |
+
return $schedules;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* To capture the data from the client site.
|
266 |
+
*/
|
267 |
+
public static function ts_schedule_cron_job () {
|
268 |
+
if ( ! wp_next_scheduled( self::$plugin_prefix . '_ts_tracker_send_event' ) ) {
|
269 |
+
wp_schedule_event( time(), 'once_in_week', self::$plugin_prefix . '_ts_tracker_send_event' );
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Load the js file in the admin
|
275 |
+
*
|
276 |
+
* @since 6.8
|
277 |
+
* @access public
|
278 |
+
*/
|
279 |
+
public static function ts_admin_notices_scripts() {
|
280 |
+
|
281 |
+
wp_enqueue_script(
|
282 |
+
'ts_dismiss_notice',
|
283 |
+
self::$ts_file_path . '/assets/js/dismiss-notice.js',
|
284 |
+
'',
|
285 |
+
'',
|
286 |
+
false
|
287 |
+
);
|
288 |
+
|
289 |
+
wp_localize_script( 'ts_dismiss_notice', 'ts_dismiss_notice', array (
|
290 |
+
'ts_prefix_of_plugin' => self::$plugin_prefix,
|
291 |
+
'ts_admin_url' => admin_url( 'admin-ajax.php' )
|
292 |
+
) );
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Called when the dismiss icon is clicked on the notice.
|
297 |
+
*
|
298 |
+
* @since 6.8
|
299 |
+
* @access public
|
300 |
+
*/
|
301 |
+
|
302 |
+
public static function ts_admin_notices() {
|
303 |
+
update_option( self::$plugin_prefix . '_allow_tracking', 'dismissed' );
|
304 |
+
WPCCPL_TS_Tracker::ts_send_tracking_data( false );
|
305 |
+
die();
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Send the data tracking data to the server.
|
310 |
+
*
|
311 |
+
* @access public
|
312 |
+
*
|
313 |
+
*/
|
314 |
+
|
315 |
+
private static function ts_tracking_actions() {
|
316 |
+
if ( isset( $_GET[ self::$plugin_prefix . '_tracker_optin' ] ) && isset( $_GET[ self::$plugin_prefix . '_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ self::$plugin_prefix . '_tracker_nonce' ], self::$plugin_prefix . '_tracker_optin' ) ) {
|
317 |
+
update_option( self::$plugin_prefix . '_allow_tracking', 'yes' );
|
318 |
+
WPCCPL_TS_Tracker::ts_send_tracking_data( true );
|
319 |
+
@header( 'Location: ' . $_SERVER[ 'HTTP_REFERER' ] );
|
320 |
+
} elseif ( isset( $_GET[ self::$plugin_prefix . '_tracker_optout' ] ) && isset( $_GET[ self::$plugin_prefix . '_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ self::$plugin_prefix . '_tracker_nonce' ], self::$plugin_prefix . '_tracker_optout' ) ) {
|
321 |
+
update_option( self::$plugin_prefix . '_allow_tracking', 'no' );
|
322 |
+
WPCCPL_TS_Tracker::ts_send_tracking_data( false );
|
323 |
+
@header( 'Location: ' . $_SERVER[ 'HTTP_REFERER' ] );
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Adds a data usage tracking notice in the admin
|
329 |
+
*
|
330 |
+
* @access public
|
331 |
+
* @since 6.8
|
332 |
+
*/
|
333 |
+
|
334 |
+
public static function ts_track_usage_data() {
|
335 |
+
$admin_url = get_admin_url();
|
336 |
+
echo '<input type="hidden" id="admin_url" value="' . $admin_url . '"/>';
|
337 |
+
self::ts_tracking_actions();
|
338 |
+
if ( 'unknown' === get_option( self::$plugin_prefix . '_allow_tracking', 'unknown' ) ) : ?>
|
339 |
+
<div class="<?php echo self::$plugin_prefix; ?>-message <?php echo self::$plugin_prefix; ?>-tracker notice notice-info is-dismissible" style="position: relative;">
|
340 |
+
<div style="position: absolute;"><img class="site-logo" src= " <?php echo self::$ts_file_path . '/assets/images/site-logo-new.jpg '; ?> "></div>
|
341 |
+
<p style="margin: 10px 0 42px 130px; font-size: medium;">
|
342 |
+
<?php print( __( 'Want to help make ' . self::$plugin_name . ' even more awesome? Allow ' . self::$plugin_name . ' to collect non-sensitive diagnostic data and usage information and get 20% off on your next purchase. <a href="' . self::$blog_post_link . '" target="_blank" >Find out more</a>.', self::$plugin_context ) ); ?></p>
|
343 |
+
<p class="submit">
|
344 |
+
<a class="button-primary button button-large" href="<?php echo esc_url( wp_nonce_url( add_query_arg( self::$plugin_prefix . '_tracker_optin', 'true' ), self::$plugin_prefix . '_tracker_optin', self::$plugin_prefix . '_tracker_nonce' ) ); ?>"><?php esc_html_e( 'Allow', self::$plugin_context ); ?></a>
|
345 |
+
<a class="button-secondary button button-large skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( self::$plugin_prefix . '_tracker_optout', 'true' ), self::$plugin_prefix . '_tracker_optout', self::$plugin_prefix . '_tracker_nonce' ) ); ?>"><?php esc_html_e( 'No thanks', self::$plugin_context ); ?></a>
|
346 |
+
</p>
|
347 |
+
</div>
|
348 |
+
<?php endif;
|
349 |
+
}
|
350 |
+
}
|
includes/component/welcome-page/Instructions
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Welcome page feature allows you to add an introduction page when a plugin is installed and active for the first time or when it is updated.
|
2 |
+
|
3 |
+
To add this feature to the plugin, you can follow the below steps:
|
4 |
+
|
5 |
+
1. Copy the ts-welcome.php file into your plugin folder.
|
6 |
+
|
7 |
+
2. Copy the files in the template folder to template in the plugin.
|
8 |
+
|
9 |
+
3. Include the file once when on the admin page. This can be done with is_admin() function.
|
10 |
+
|
11 |
+
4. You need to pass the 6 parameters to the default constructor of the TS_Welcome class. You need to change the value of the variable value as per the respective plugin.
|
12 |
+
|
13 |
+
$wcap_plugin_prefix = 'wcap';
|
14 |
+
$wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
|
15 |
+
$wcap_blog_post_link = 'https://www.tychesoftwares.com/order-delivery-date-usage-tracking/';
|
16 |
+
$wcap_locale = 'woocommerce-ac';
|
17 |
+
define('WCAP_PLUGIN_PATH' , untrailingslashit(plugin_dir_path(__FILE__)) );
|
18 |
+
$wcap_plugin_folder_name = 'woocommerce-abandon-cart-pro/';
|
19 |
+
$wcap_plugin_dir_name = WCAP_PLUGIN_PATH . '/woocommerce-ac.php' ;
|
20 |
+
$wcap_get_previous_version = get_option( 'woocommerce_ac_db_version' );
|
21 |
+
|
22 |
+
new TS_Welcome ( $wcap_plugin_name, $wcap_plugin_prefix, $wcap_locale, $wcap_plugin_folder_name, $wcap_plugin_dir_name, $wcap_get_previous_version );
|
23 |
+
|
24 |
+
5. Add the below code in the uninstall.php file of the plugin.
|
25 |
+
|
26 |
+
delete_option( '{{plugin-prefix}}_pro_welcome_page_shown' );
|
27 |
+
delete_option( '{{plugin-prefix}}_pro_welcome_page_shown_time' );
|
28 |
+
|
29 |
+
6. You need to update the Template as per your update of the plguin. You just need to update the template content.
|
30 |
+
|
31 |
+
Note:
|
32 |
+
|
33 |
+
1. Please put your all images in the images folder of this folder.
|
34 |
+
2. You can use the $ts_dir_image_path for img src. Like <img src="<?php echo $ts_dir_image_path . 'custom-delivery-settings.png'?>"
|
35 |
+
3. Please change the Utm parameters
|
36 |
+
|
37 |
+
You just need to append the image name.
|
includes/component/welcome-page/assets/images/icon-256x256.png
ADDED
Binary file
|
includes/component/welcome-page/templates/social-media-elements.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Welcome page on activate or updation of the plugin
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<div class="social-items-wrap">
|
7 |
+
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Ftychesoftwares&send=false&layout=button_count&width=100&show_faces=false&font&colorscheme=light&action=like&height=21&appId=220596284639969" scrolling="no" frameborder="0" style="border:none;overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
|
8 |
+
<a href="https://twitter.com/tychesoftwares" class="twitter-follow-button" data-show-count="false"><?php
|
9 |
+
printf(
|
10 |
+
esc_html_e( 'Follow %s', 'tychesoftwares' ),
|
11 |
+
'@tychesoftwares'
|
12 |
+
);
|
13 |
+
?></a>
|
14 |
+
<script>!function (d, s, id) {
|
15 |
+
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
|
16 |
+
if (!d.getElementById(id)) {
|
17 |
+
js = d.createElement(s);
|
18 |
+
js.id = id;
|
19 |
+
js.src = p + '://platform.twitter.com/widgets.js';
|
20 |
+
fjs.parentNode.insertBefore(js, fjs);
|
21 |
+
}
|
22 |
+
}(document, 'script', 'twitter-wjs');
|
23 |
+
</script>
|
24 |
+
</div>
|
includes/component/welcome-page/templates/welcome/welcome-page.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Welcome page on activate or updation of the plugin
|
4 |
+
*/
|
5 |
+
|
6 |
+
$shortcodes_array = get_query_var( 'shortcodes_array' );
|
7 |
+
|
8 |
+
$badge_url = $shortcodes_array['badge_url'];
|
9 |
+
|
10 |
+
$ts_dir_image_path = $shortcodes_array['ts_dir_image_path'];
|
11 |
+
|
12 |
+
$ts_plugin_name = $shortcodes_array['plugin_name'];
|
13 |
+
|
14 |
+
?>
|
15 |
+
<style>
|
16 |
+
.feature-section .feature-section-item {
|
17 |
+
float:left;
|
18 |
+
width:48%;
|
19 |
+
}
|
20 |
+
</style>
|
21 |
+
<div class="wrap about-wrap">
|
22 |
+
|
23 |
+
<?php echo $shortcodes_array[ 'get_welcome_header'] ?>
|
24 |
+
|
25 |
+
<div style="float:left;width: 80%;">
|
26 |
+
<p class="about-text" style="margin-right:20px;"><?php
|
27 |
+
printf(
|
28 |
+
__( "Thank you for activating or updating to the latest version of $ts_plugin_name! If you're a first time user, welcome! You're well on your way to explore the $ts_plugin_name functionality for your WordPress site." )
|
29 |
+
);
|
30 |
+
?></p>
|
31 |
+
</div>
|
32 |
+
<div class="faq-badge"><img src="<?php echo $badge_url; ?>" style="width:150px;"/></div>
|
33 |
+
|
34 |
+
<p> </p>
|
35 |
+
|
36 |
+
<p>
|
37 |
+
WP Content Copy Protection is a simple, yet effective plugin that uses an array of aggressive techniques in protecting your online content from being stolen.
|
38 |
+
</p>
|
39 |
+
<p>
|
40 |
+
Some of the most common content copy methods (via mouse, keyboard and browser), such as right-click, image drag/drop/save, text selection/drag/drop, source code viewing, and keyboard copy shortcut keys such as CTRL A, C, X, U, S, and P are disabled with this plugin (just to name a few).
|
41 |
+
</p>
|
42 |
+
<h4>Basic Features (included)</h4>
|
43 |
+
<pre><code>√ Disables right click context menu on all content (except href links)
|
44 |
+
|
45 |
+
√ Disables text selection (globally) on PC and mobile devices
|
46 |
+
|
47 |
+
√ Disables text and image drag/drop/save on PC and mobile devices
|
48 |
+
|
49 |
+
√ Basic image protection (image link URL's are automatically removed)
|
50 |
+
|
51 |
+
√ Copy methods disabled from onscreen keyboard and shortcut context key
|
52 |
+
|
53 |
+
√ Secures your uploads directory and sub-directories from public access
|
54 |
+
|
55 |
+
√ Disables right click and save function on default video and audio embeds
|
56 |
+
|
57 |
+
√ Javascript validation (displays error message when disabled in user browser)
|
58 |
+
|
59 |
+
√ Disables keyboard copy controls (CTRL A, C, X) - Windows only
|
60 |
+
|
61 |
+
√ Disables 'Source view', 'Save Page', and 'Print' key functions
|
62 |
+
|
63 |
+
√ Disables f shortcut key for accessing developer tools to view source code
|
64 |
+
|
65 |
+
√ No obtrusive popups or alert messages as they are known to defame your site
|
66 |
+
|
67 |
+
√ No negative side-effects on your SEO (search engines can read your content)
|
68 |
+
|
69 |
+
√ This is a non resource-intensive plugin that works silently in the background
|
70 |
+
|
71 |
+
√ No configuration, customization or coding needed. Simply plug in and leave
|
72 |
+
</code></pre>
|
73 |
+
|
74 |
+
<div class="feature-section clearfix">
|
75 |
+
|
76 |
+
<div class="content feature-section-item">
|
77 |
+
|
78 |
+
<h3><?php esc_html_e( 'Getting to Know Tyche Softwares', 'acs' ); ?></h3>
|
79 |
+
|
80 |
+
<ul class="ul-disc">
|
81 |
+
<li><a href="https://tychesoftwares.com/?utm_source=wpaboutp age&utm_medium=link&utm_campaign=WpContentCopyPlugin" target="_blank"><?php esc_html_e( 'Visit the Tyche Softwares Website', 'acs' ); ?></a></li>
|
82 |
+
<li><a href="https://tychesoftwares.com/premium-woocommerce-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WpContentCopyPlugin" target="_blank"><?php esc_html_e( 'View all Premium Plugins', 'acs' ); ?></a>
|
83 |
+
<ul class="ul-disc">
|
84 |
+
<li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WpContentCopyPlugin" target="_blank">Abandoned Cart Pro Plugin for WooCommerce</a></li>
|
85 |
+
<li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WpContentCopyPlugin" target="_blank">Booking & Appointment Plugin for WooCommerce</a></li>
|
86 |
+
<li><a href="https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WpContentCopyPlugin" target="_blank">Order Delivery Date for WooCommerce</a></li>
|
87 |
+
<li><a href="https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WpContentCopyPlugin" target="_blank">Product Delivery Date for WooCommerce</a></li>
|
88 |
+
<li><a href="https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WpContentCopyPlugin" target="_blank">Deposits for WooCommerce</a></li>
|
89 |
+
</ul>
|
90 |
+
</li>
|
91 |
+
<li><a href="https://tychesoftwares.com/about/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WpContentCopyPlugin" target="_blank"><?php esc_html_e( 'Meet the team', 'acs' ); ?></a></li>
|
92 |
+
</ul>
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
<!-- /.feature-section -->
|
96 |
+
</div>
|
includes/component/welcome-page/ts-welcome.php
ADDED
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Welcome Page Class
|
5 |
+
*
|
6 |
+
* Displays on plugin activation or updation
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly.
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* WPCCPL_TS_Welcome Class
|
16 |
+
*
|
17 |
+
* A general class for About page.
|
18 |
+
*
|
19 |
+
* @since 7.7
|
20 |
+
*/
|
21 |
+
|
22 |
+
class WPCCPL_TS_Welcome {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var string The capability users should have to view the page
|
26 |
+
*/
|
27 |
+
public $minimum_capability = 'manage_options';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var string The name of the plugin
|
31 |
+
* @access public
|
32 |
+
*/
|
33 |
+
public static $plugin_name = "";
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var string Unique prefix of the plugin
|
37 |
+
* @access public
|
38 |
+
*/
|
39 |
+
|
40 |
+
public static $plugin_prefix = '';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var Plugin Context
|
44 |
+
* @access public
|
45 |
+
*/
|
46 |
+
|
47 |
+
public static $plugin_context = '';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @var string Folder of the plugin
|
51 |
+
* @access public
|
52 |
+
*/
|
53 |
+
public static $plugin_folder = '';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @var string Plugin live version
|
57 |
+
* @access public
|
58 |
+
*/
|
59 |
+
|
60 |
+
public static $plugin_version = '';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @var string Plugin previous version
|
64 |
+
* @access public
|
65 |
+
*/
|
66 |
+
public static $previous_plugin_version = '';
|
67 |
+
/**
|
68 |
+
* @var string Plugin Url
|
69 |
+
* @access public
|
70 |
+
*/
|
71 |
+
public static $plugin_url = '';
|
72 |
+
/**
|
73 |
+
* @var string Template base path
|
74 |
+
* @access public
|
75 |
+
*/
|
76 |
+
public static $template_base = '';
|
77 |
+
/**
|
78 |
+
* @var string Plugin dir name with plugin file name
|
79 |
+
* @access public
|
80 |
+
*/
|
81 |
+
public static $plugin_file_path = '';
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Get things started
|
85 |
+
*
|
86 |
+
* @since 7.7
|
87 |
+
*/
|
88 |
+
public function __construct( $ts_plugin_name = '', $ts_plugin_prefix = '', $ts_plugin_context = '', $ts_plugin_folder_name = '', $ts_plugin_dir_name = '' , $ts_previous_version = '' ) {
|
89 |
+
self::$plugin_name = $ts_plugin_name;
|
90 |
+
self::$plugin_prefix = $ts_plugin_prefix;
|
91 |
+
self::$plugin_context = $ts_plugin_context;
|
92 |
+
self::$plugin_folder = $ts_plugin_folder_name;
|
93 |
+
self::$plugin_file_path = $ts_plugin_dir_name;
|
94 |
+
|
95 |
+
|
96 |
+
//Update plugin
|
97 |
+
add_action( 'admin_init', array( &$this, 'ts_update_db_check' ) );
|
98 |
+
|
99 |
+
add_action( 'admin_menu', array( $this, 'admin_menus' ) );
|
100 |
+
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
101 |
+
|
102 |
+
if ( !isset( $_GET[ 'page' ] ) ||
|
103 |
+
( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] != self::$plugin_prefix . '-pro-about' ) ) {
|
104 |
+
add_action( 'admin_init', array( $this, 'ts_pro_welcome' ) );
|
105 |
+
}
|
106 |
+
|
107 |
+
self::$plugin_version = $this->ts_get_version();
|
108 |
+
|
109 |
+
self::$previous_plugin_version = $ts_previous_version;
|
110 |
+
self::$plugin_url = $this->ts_get_plugin_url();
|
111 |
+
self::$template_base = $this->ts_get_template_path();
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* This function returns the plugin version number.
|
116 |
+
*
|
117 |
+
* @access public
|
118 |
+
* @since 7.7
|
119 |
+
* @return $plugin_version
|
120 |
+
*/
|
121 |
+
public function ts_get_version() {
|
122 |
+
$plugin_version = '';
|
123 |
+
|
124 |
+
$plugin_data = get_file_data( self::$plugin_file_path, array( 'Version' => 'Version' ) );
|
125 |
+
if ( ! empty( $plugin_data['Version'] ) ) {
|
126 |
+
$plugin_version = $plugin_data[ 'Version' ];
|
127 |
+
}
|
128 |
+
return $plugin_version;;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* This function returns the plugin url
|
133 |
+
*
|
134 |
+
* @access public
|
135 |
+
* @since 7.7
|
136 |
+
* @return string
|
137 |
+
*/
|
138 |
+
public function ts_get_plugin_url() {
|
139 |
+
return plugins_url() . '/' . self::$plugin_folder ;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* This function returns the template directory path
|
144 |
+
*
|
145 |
+
* @access public
|
146 |
+
* @since 7.7
|
147 |
+
* @return string
|
148 |
+
*/
|
149 |
+
public function ts_get_template_path() {
|
150 |
+
|
151 |
+
return untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/';
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Register the Dashboard Page which is later hidden but this pages
|
156 |
+
* is used to render the Welcome page.
|
157 |
+
*
|
158 |
+
* @access public
|
159 |
+
* @since 7.7
|
160 |
+
* @return void
|
161 |
+
*/
|
162 |
+
public function admin_menus() {
|
163 |
+
$display_version = self::$plugin_version;
|
164 |
+
|
165 |
+
// About Page
|
166 |
+
add_dashboard_page(
|
167 |
+
sprintf( esc_html__( 'Welcome to %s %s', self::$plugin_context ), self::$plugin_name, $display_version ),
|
168 |
+
esc_html__( 'Welcome to ' . self::$plugin_name, self::$plugin_context ),
|
169 |
+
$this->minimum_capability,
|
170 |
+
self::$plugin_prefix . '-pro-about',
|
171 |
+
array( $this, 'about_screen' )
|
172 |
+
);
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Hide Individual Dashboard Pages
|
178 |
+
*
|
179 |
+
* @access public
|
180 |
+
* @since 7.7
|
181 |
+
* @return void
|
182 |
+
*/
|
183 |
+
public function admin_head() {
|
184 |
+
remove_submenu_page( 'index.php', self::$plugin_prefix . '-pro-about' );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Render About Screen
|
189 |
+
*
|
190 |
+
* @access public
|
191 |
+
* @since 7.7
|
192 |
+
* @return void
|
193 |
+
*/
|
194 |
+
public function about_screen() {
|
195 |
+
$display_version = self::$plugin_version;
|
196 |
+
$ts_file_path = dirname( __FILE__ ) ;
|
197 |
+
$ts_plugin_dir_path = plugin_dir_url( __FILE__ );
|
198 |
+
// Badge for welcome page
|
199 |
+
$badge_url = $ts_plugin_dir_path . '/assets/images/icon-256x256.png';
|
200 |
+
|
201 |
+
$shortcodes_array = array(
|
202 |
+
'plugin_name' => self::$plugin_name,
|
203 |
+
'plugin_url' => self::$plugin_url,
|
204 |
+
'display_version' => $display_version,
|
205 |
+
'badge_url' => $badge_url,
|
206 |
+
'ts_dir_image_path' => $ts_plugin_dir_path . '/assets/images/',
|
207 |
+
'plugin_context' => self::$plugin_context,
|
208 |
+
'get_welcome_header' => self::get_welcome_header()
|
209 |
+
);
|
210 |
+
set_query_var( 'shortcodes_array', $shortcodes_array );
|
211 |
+
|
212 |
+
ob_start();
|
213 |
+
load_template( $ts_file_path . '/templates/welcome/welcome-page.php' );
|
214 |
+
echo ob_get_clean();
|
215 |
+
|
216 |
+
add_option( self::$plugin_prefix . '_pro_welcome_page_shown', 'yes' );
|
217 |
+
add_option( self::$plugin_prefix . '_pro_welcome_page_shown_time', current_time( 'timestamp' ) );
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* The header section for the welcome screen.
|
222 |
+
*
|
223 |
+
* @since 7.7
|
224 |
+
*/
|
225 |
+
public function get_welcome_header() {
|
226 |
+
// Badge for welcome page
|
227 |
+
$ts_file_path = plugin_dir_url( __FILE__ ) ;
|
228 |
+
|
229 |
+
// Badge for welcome page
|
230 |
+
$badge_url = $ts_file_path . '/assets/images/icon-256x256.png';
|
231 |
+
|
232 |
+
?>
|
233 |
+
<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
|
234 |
+
<?php self::social_media_elements();
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Social Media Like Buttons
|
239 |
+
*
|
240 |
+
* Various social media elements to Tyche Softwares
|
241 |
+
*/
|
242 |
+
public function social_media_elements() {
|
243 |
+
$display_version = self::$plugin_version;
|
244 |
+
$ts_file_path = dirname ( dirname( __FILE__ ) ) ;
|
245 |
+
ob_start();
|
246 |
+
|
247 |
+
load_template( $ts_file_path. '/welcome-page/templates/social-media-elements.php' );
|
248 |
+
echo ob_get_clean();
|
249 |
+
}
|
250 |
+
/**
|
251 |
+
* Sends user to the Welcome page on first activation of the plugin as well as each
|
252 |
+
* time the plugin is updated is upgraded to a new version
|
253 |
+
*
|
254 |
+
* @access public
|
255 |
+
* @since 7.7
|
256 |
+
*
|
257 |
+
* @return void
|
258 |
+
*/
|
259 |
+
public function ts_pro_welcome() {
|
260 |
+
|
261 |
+
// Bail if activating from network, or bulk
|
262 |
+
if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) {
|
263 |
+
return;
|
264 |
+
}
|
265 |
+
|
266 |
+
if( !get_option( self::$plugin_prefix . '_pro_welcome_page_shown' ) ) {
|
267 |
+
wp_safe_redirect( admin_url( 'index.php?page=' . self::$plugin_prefix . '-pro-about' ) );
|
268 |
+
exit;
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Executed when the plugin is updated using the Automatic Updater.
|
274 |
+
*/
|
275 |
+
public function ts_update_db_check() {
|
276 |
+
|
277 |
+
if ( self::$plugin_version != self::$previous_plugin_version ) {
|
278 |
+
delete_option( self::$plugin_prefix . '_pro_welcome_page_shown' );
|
279 |
+
delete_option( self::$plugin_prefix . '_pro_welcome_page_shown_time' );
|
280 |
+
}
|
281 |
+
}
|
282 |
+
}
|
includes/wpccpl-all-component.php
ADDED
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* It will Add all the Boilerplate component when we activate the plugin.
|
4 |
+
* @author Tyche Softwares
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
+
exit; // Exit if accessed directly.
|
9 |
+
}
|
10 |
+
if ( ! class_exists( 'WPCCPL_Component' ) ) {
|
11 |
+
/**
|
12 |
+
* It will Add all the Boilerplate component when we activate the plugin.
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
class WPCCPL_Component {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* It will Add all the Boilerplate component when we activate the plugin.
|
19 |
+
*/
|
20 |
+
public function __construct() {
|
21 |
+
|
22 |
+
$is_admin = is_admin();
|
23 |
+
|
24 |
+
if ( true === $is_admin ) {
|
25 |
+
|
26 |
+
require_once( "component/tracking-data/ts-tracking.php" );
|
27 |
+
require_once( "component/deactivate-survey-popup/class-ts-deactivation.php" );
|
28 |
+
|
29 |
+
require_once( "component/welcome-page/ts-welcome.php" );
|
30 |
+
require_once( "component/faq-support/ts-faq-support.php" );
|
31 |
+
require_once( "component/pro-notices-in-lite/ts-pro-notices.php" );
|
32 |
+
|
33 |
+
$wpccpl_plugin_name = self::ts_get_plugin_name();;
|
34 |
+
$wpccpl_locale = self::ts_get_plugin_locale();
|
35 |
+
|
36 |
+
$wpccpl_file_name = 'wp-content-copy-protection/wpccpl.php';
|
37 |
+
$wpccpl_plugin_prefix = 'wpccpl';
|
38 |
+
$wpccpl_lite_plugin_prefix = 'wpccpl';
|
39 |
+
$wpccpl_plugin_folder_name = 'wp-content-copy-protection/';
|
40 |
+
$wpccpl_plugin_dir_name = dirname ( untrailingslashit( plugin_dir_path ( __FILE__ ) ) ) . '/wpccpl.php' ;
|
41 |
+
$wpccpl_plugin_url = dirname ( untrailingslashit( plugins_url( '/', __FILE__ ) ) );
|
42 |
+
|
43 |
+
$wpccpl_get_previous_version = get_option( 'wpccpl_version', '1' );
|
44 |
+
|
45 |
+
$wpccpl_blog_post_link = 'https://www.tychesoftwares.com/docs/docs/wp-content-copy-protection/usage-tracking/';
|
46 |
+
|
47 |
+
$wpccpl_plugins_page = '';
|
48 |
+
$wpccpl_plugin_slug = '';
|
49 |
+
$wpccpl_pro_file_name = '';
|
50 |
+
|
51 |
+
$wpccpl_settings_page = '';
|
52 |
+
|
53 |
+
new WPCCPL_TS_tracking ( $wpccpl_plugin_prefix, $wpccpl_plugin_name, $wpccpl_blog_post_link, $wpccpl_locale, $wpccpl_plugin_url, $wpccpl_settings_page, '', '', '', $wpccpl_file_name );
|
54 |
+
|
55 |
+
new WPCCPL_TS_Tracker ( $wpccpl_plugin_prefix, $wpccpl_plugin_name );
|
56 |
+
|
57 |
+
$wpccpl_deativate = new WPCCPL_TS_deactivate;
|
58 |
+
$wpccpl_deativate->init ( $wpccpl_file_name, $wpccpl_plugin_name );
|
59 |
+
|
60 |
+
new WPCCPL_TS_Welcome ( $wpccpl_plugin_name, $wpccpl_plugin_prefix, $wpccpl_locale, $wpccpl_plugin_folder_name, $wpccpl_plugin_dir_name, $wpccpl_get_previous_version );
|
61 |
+
|
62 |
+
$ts_pro_wpccpl = self::wpccpl_get_faq ();
|
63 |
+
new WPCCPL_TS_Faq_Support( $wpccpl_plugin_name, $wpccpl_plugin_prefix, $wpccpl_plugins_page, $wpccpl_locale, $wpccpl_plugin_folder_name, $wpccpl_plugin_slug, $ts_pro_wpccpl, '', $wpccpl_file_name );
|
64 |
+
|
65 |
+
$ts_pro_notices = self::wpccpl_get_notice_text ();
|
66 |
+
new WPCCPL_ts_pro_notices( $wpccpl_plugin_name, $wpccpl_lite_plugin_prefix, $wpccpl_plugin_prefix, $ts_pro_notices, $wpccpl_file_name, $wpccpl_pro_file_name );
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* It will retrun the plguin name.
|
73 |
+
* @return string $ts_plugin_name Name of the plugin
|
74 |
+
*/
|
75 |
+
public static function ts_get_plugin_name () {
|
76 |
+
$ordd_plugin_dir = dirname ( dirname ( __FILE__ ) ) ;
|
77 |
+
$ordd_plugin_dir .= '/wpccpl.php';
|
78 |
+
|
79 |
+
$ts_plugin_name = '';
|
80 |
+
$plugin_data = get_file_data( $ordd_plugin_dir, array( 'name' => 'Plugin Name' ) );
|
81 |
+
if ( ! empty( $plugin_data['name'] ) ) {
|
82 |
+
$ts_plugin_name = $plugin_data[ 'name' ];
|
83 |
+
}
|
84 |
+
return $ts_plugin_name;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* It will retrun the Plugin text Domain
|
89 |
+
* @return string $ts_plugin_domain Name of the Plugin domain
|
90 |
+
*/
|
91 |
+
public static function ts_get_plugin_locale () {
|
92 |
+
$ordd_plugin_dir = dirname( dirname ( __FILE__ ) ) ;
|
93 |
+
$ordd_plugin_dir .= '/wpccpl.php';
|
94 |
+
|
95 |
+
$ts_plugin_domain = '';
|
96 |
+
$plugin_data = get_file_data( $ordd_plugin_dir, array( 'domain' => 'Text Domain' ) );
|
97 |
+
if ( ! empty( $plugin_data['domain'] ) ) {
|
98 |
+
$ts_plugin_domain = $plugin_data[ 'domain' ];
|
99 |
+
}
|
100 |
+
return $ts_plugin_domain;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* It will Display the notices in the admin dashboard for the pro vesion of the plugin.
|
105 |
+
* @return array $ts_pro_notices All text of the notices
|
106 |
+
*/
|
107 |
+
public static function wpccpl_get_notice_text () {
|
108 |
+
$ts_pro_notices = array();
|
109 |
+
|
110 |
+
$wpccpl_locale = self::ts_get_plugin_locale();
|
111 |
+
|
112 |
+
$message_first = wp_kses_post ( __( 'Thank you for using WooCommerce Print Invoice & Delivery Note plugin! Now make your deliveries more accurate by allowing customers to select their preferred delivery date & time from Product Delivery Date Pro for WooCommerce. <strong><a target="_blank" href= "https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpnotice&utm_medium=first&utm_campaign=WpContentCopyPlugin">Get it now!</a></strong>', $wpccpl_locale ) );
|
113 |
+
|
114 |
+
$message_two = wp_kses_post ( __( 'Never login to your admin to check your deliveries by syncing the delivery dates to the Google Calendar from Product Delivery Date Pro for WooCommerce. <strong><a target="_blank" href= "https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/checkout?edd_action=add_to_cart&download_id=16&utm_source=wpnotice&utm_medium=first&utm_campaign=WpContentCopyPlugin">Get it now!</a></strong>', $wpccpl_locale ) );
|
115 |
+
|
116 |
+
$message_three = wp_kses_post ( __( 'You can now view all your deliveries in list view or in calendar view from Product Delivery Date Pro for WooCommerce. <strong><a target="_blank" href= "https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/checkout?edd_action=add_to_cart&download_id=16&utm_source=wpnotice&utm_medium=first&utm_campaign=WpContentCopyPlugin">Get it now!</a></strong>.', $wpccpl_locale ) );
|
117 |
+
|
118 |
+
$message_four = wp_kses_post ( __( 'Allow your customers to pay extra for delivery for certain Weekdays/Dates from Product Delivery Date Pro for WooCommerce. <strong><a target="_blank" href= "https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/checkout?edd_action=add_to_cart&download_id=16&utm_source=wpnotice&utm_medium=first&utm_campaign=WpContentCopyPlugin">Have it now!</a></strong>.', $wpccpl_locale ) );
|
119 |
+
|
120 |
+
$message_five = wp_kses_post ( __( 'Customers can now edit the Delivery date & time on cart and checkout page or they can reschedule the deliveries for the already placed orders from Product Delivery Date Pro for WooCommerce. <strong><a target="_blank" href= "https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/checkout?edd_action=add_to_cart&download_id=16&utm_source=wpnotice&utm_medium=first&utm_campaign=WpContentCopyPlugin">Have it now!</a></strong>.', $wpccpl_locale ) );
|
121 |
+
|
122 |
+
// message six
|
123 |
+
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=sixth&utm_campaign=WpContentCopyPlugin';
|
124 |
+
$message_six = wp_kses_post ( __( 'Boost your sales by recovering up to 60% of the abandoned carts with our Abandoned Cart Pro for WooCommerce plugin. You can capture customer email addresses right when they click the Add To Cart button. <strong><a target="_blank" href= "'.$_link.'">Grab your copy of Abandon Cart Pro plugin now</a></strong>.', $wpccpl_locale ) );
|
125 |
+
|
126 |
+
$wpccpl_message_six = array ( 'message' => $message_six, 'plugin_link' => 'woocommerce-abandon-cart-pro/woocommerce-ac.php' );
|
127 |
+
// message seven
|
128 |
+
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=seventh&utm_campaign=WpContentCopyPlugin';
|
129 |
+
$message_seven = wp_kses_post ( __( 'Don\'t loose your sales to abandoned carts. Use our Abandon Cart Pro plugin & start recovering your lost sales in less then 60 seconds.<br>
|
130 |
+
<strong><a target="_blank" href= "'.$_link.'">Get it now!</a></strong>', $wpccpl_locale ) );
|
131 |
+
$wpccpl_message_seven = array ( 'message' => $message_seven, 'plugin_link' => 'woocommerce-abandon-cart-pro/woocommerce-ac.php' );
|
132 |
+
|
133 |
+
// message eight
|
134 |
+
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=eight&utm_campaign=WpContentCopyPlugin';
|
135 |
+
$message_eight = wp_kses_post ( __( 'Send Abandoned Cart reminders that actually convert. Take advantage of our fully responsive email templates designed specially with an intent to trigger conversion. <br><strong><a target="_blank" href= "'.$_link.'">Grab your copy now!</a></strong>', $wpccpl_locale ) );
|
136 |
+
$wpccpl_message_eight = array ( 'message' => $message_eight, 'plugin_link' => 'woocommerce-abandon-cart-pro/woocommerce-ac.php' );
|
137 |
+
|
138 |
+
// message nine
|
139 |
+
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=ninth&utm_campaign=WpContentCopyPlugin';
|
140 |
+
$message_nine = wp_kses_post ( __( 'Increase your store sales by recovering your abandoned carts for just $119. No profit sharing, no monthly fees. Our Abandoned Cart Pro plugin comes with a 30 day money back guarantee as well. :). Use coupon code ACPRO20 & save $24!<br>
|
141 |
+
<strong><a target="_blank" href= "'.$_link.'">Purchase now</a></strong>', $wpccpl_locale ) );
|
142 |
+
$wpccpl_message_nine = array ( 'message' => $message_nine, 'plugin_link' => 'woocommerce-abandon-cart-pro/woocommerce-ac.php' );
|
143 |
+
|
144 |
+
// message ten
|
145 |
+
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/?utm_source=wpnotice&utm_medium=tenth&utm_campaign=WpContentCopyPlugin';
|
146 |
+
$message_ten = wp_kses_post ( __( 'Allow your customers to select the Delivery Date & Time on the Checkout Page using our Order Delivery Date Pro for WooCommerce Plugin. <br>
|
147 |
+
<strong><a target="_blank" href= "'.$_link.'">Shop now</a></strong> & be one of the 20 customers to get 20% discount on the plugin price. Use the code "ORDPRO20". Hurry!!', $wpccpl_locale ) );
|
148 |
+
$wpccpl_message_ten = array ( 'message' => $message_ten, 'plugin_link' => 'order-delivery-date/order_delivery_date.php' );
|
149 |
+
|
150 |
+
// message eleven
|
151 |
+
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/?utm_source=wpnotice&utm_medium=eleven&utm_campaign=WpContentCopyPlugin';
|
152 |
+
$message_eleven = wp_kses_post ( __( ' Allow your customers to book an appointment or rent an apartment with our Booking and Appointment for WooCommerce plugin. You can also sell your product as a resource or integrate with a few Vendor plugins. <br>Shop now & Save 20% on the plugin with the code "BKAP20". Only for first 20 customers. <strong><a target="_blank" href= "'.$_link.'">Have it now!</a></strong>', $wpccpl_locale ) );
|
153 |
+
$wpccpl_message_eleven = array ( 'message' => $message_eleven, 'plugin_link' => 'woocommerce-booking/woocommerce-booking.php' );
|
154 |
+
|
155 |
+
// message 12
|
156 |
+
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/?utm_source=wpnotice&utm_medium=twelve&utm_campaign=WpContentCopyPlugin';
|
157 |
+
$message_twelve = wp_kses_post ( __( ' Allow your customers to pay deposits on products using our Deposits for WooCommerce plugin.<br>
|
158 |
+
<strong><a target="_blank" href= "'.$_link.'">Purchase now</a></strong> & Grab 20% discount with the code "DFWP20". The discount code is valid only for the first 20 customers.', $wpccpl_locale ) );
|
159 |
+
$wpccpl_message_twelve = array ( 'message' => $message_twelve, 'plugin_link' => 'woocommerce-deposits/deposits-for-woocommerce.php' );
|
160 |
+
|
161 |
+
// message 13
|
162 |
+
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpnotice&utm_medium=thirteen&utm_campaign=WpContentCopyPlugin';
|
163 |
+
$message_thirteen = wp_kses_post ( __( 'Allow your customers to select the Delivery Date & Time for your WooCommerce products using our Product Delivery Date Pro for WooCommerce Plugin. <br>
|
164 |
+
<strong><a target="_blank" href= "'.$_link.'">Shop now</a></strong>', $wpccpl_locale ) );
|
165 |
+
$wpccpl_message_thirteen = array ( 'message' => $message_thirteen, 'plugin_link' => 'product-delivery-date/product-delivery-date.php' );
|
166 |
+
|
167 |
+
$ts_pro_notices = array (
|
168 |
+
1 => $message_first,
|
169 |
+
2 => $message_two,
|
170 |
+
3 => $message_three,
|
171 |
+
4 => $message_four,
|
172 |
+
5 => $message_five,
|
173 |
+
6 => $wpccpl_message_six,
|
174 |
+
7 => $wpccpl_message_seven,
|
175 |
+
8 => $wpccpl_message_eight,
|
176 |
+
9 => $wpccpl_message_nine,
|
177 |
+
10 => $wpccpl_message_ten,
|
178 |
+
11 => $wpccpl_message_eleven,
|
179 |
+
12 => $wpccpl_message_twelve,
|
180 |
+
13 => $wpccpl_message_thirteen
|
181 |
+
);
|
182 |
+
|
183 |
+
return $ts_pro_notices;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* It will contain all the shortcodes which need to be display on the shortcodes page.
|
188 |
+
* @return array $ts_shortcodes All questions and answers.
|
189 |
+
*
|
190 |
+
*/
|
191 |
+
public static function wpccpl_get_faq() {
|
192 |
+
|
193 |
+
$ts_wpccpl = array ();
|
194 |
+
|
195 |
+
$ts_wpccpl = array(
|
196 |
+
1 => array (
|
197 |
+
'question' => 'Will WP Content Copy Protection Plugin have a negative impact on my SEO?',
|
198 |
+
'answer' => 'Absolutely not! This plugin will only affect the client browser and will have absolutely no negative impact on your SEO. In fact, it would assist in increasing your SEO score as your content will remain unique.'
|
199 |
+
),
|
200 |
+
2 => array (
|
201 |
+
'question' => 'Will this plugin disable the features from the site administrator also?',
|
202 |
+
'answer' => 'Yes! However, our Pro version allows the blog administrator to enable/disable copy protect functions for registered and logged in users (globally)
|
203 |
+
'
|
204 |
+
),
|
205 |
+
3 => array (
|
206 |
+
'question' => 'Will your WP Content Copy Protection Plugin affect my Advertising Units (Adsense)?',
|
207 |
+
'answer' => 'Absolutely not! Although this plugin locks your content and prevents it from being copied by anyone else, your advertising units will remain unaffected as the code doesn’t alter any embeddable code or the functioning thereof.'
|
208 |
+
),
|
209 |
+
4 => array (
|
210 |
+
'question' => 'Why Did you Exclude The alert-message (Popup), Function?',
|
211 |
+
'answer' => 'This function was removed simply because it could scare away your website visitors – cause a higher bounce rate – and essentially defame your website. We like to be silent! However, this is optional in our Pro edition.'
|
212 |
+
),
|
213 |
+
5 => array (
|
214 |
+
'question' => 'Does your Plugin work on all major Browsers?',
|
215 |
+
'answer' => 'This plugin works on all major browsers and theme frameworks. The full functionality of WPCCP was tested on the latest versions of IE (Internet Explorer), Mozilla Firefox, Safari and Chrome without any problems.'
|
216 |
+
),
|
217 |
+
6 => array (
|
218 |
+
'question' => 'What is the difference between the free version and the pro version?',
|
219 |
+
'answer' => 'The pro version includes super aggressive image protection (making it near impossible for a user to copy/steal your images using advanced masking), Prt Sc (print screen) deterrent agent, optional alert message for right click, Javascript validation with idle redirect, removed all RSS feeds instances to counter content scraping software/autoblogs and much, much more! See our features above.'
|
220 |
+
),
|
221 |
+
7 => array (
|
222 |
+
'question' => 'Why did you remove the iframe breaker?',
|
223 |
+
'answer' => 'We decided to remove the Iframe breaker due to conflict with theme appearance/customization.'
|
224 |
+
),
|
225 |
+
8 => array (
|
226 |
+
'question' => 'How would I break out of Iframes now?',
|
227 |
+
'answer' => '<p>We have developed a small plugin that will act as an extension to WP Content Copy Protection. This plugin, WP noFrame/noClickjacking can be found <a href="https://wordpress.org/plugins/wp-noframenoclickjacking/">HERE</a>. This plugin is a simple (yet) effective frame breaking plugin (iframe buster) that protects your site content from being embedded into other sites – effectively defending you against clickjacking attacks. This is achieved by adding a Header always append X-Frame-Options DENY instruction to your .htaccess file – where the DENY rule will prevent ALL domains from framing your content.</p>'
|
228 |
+
),
|
229 |
+
9 => array (
|
230 |
+
'question' => 'How is my Video and Audio Protected?',
|
231 |
+
'answer' => 'This plugin inheritently disables right click/copy/save functions on your default HTML5 video and audio embeds.'
|
232 |
+
)
|
233 |
+
);
|
234 |
+
|
235 |
+
return $ts_wpccpl;
|
236 |
+
}
|
237 |
+
}
|
238 |
+
$WPCCPL_Component = new WPCCPL_Component();
|
239 |
+
}
|
index.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WordPress Content Copy Protection Premium is brought to you by TycheSoftwares.com
|
5 |
+
*/
|
6 |
+
|
7 |
+
?>
|
8 |
+
<br /><br />
|
9 |
+
<center>Sorry, you are not authorized to access this area ! Goodbye !</center><br />
|
readme.txt
ADDED
@@ -0,0 +1,374 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WP Content Copy Protection ===
|
2 |
+
|
3 |
+
Contributors: tychesoftwares
|
4 |
+
Donate link: https://www.paypal.me/TycheSoftwares
|
5 |
+
Tags: protection, copyright, theft, no right click, content protection, image protection, image protect, copyprotect, security, copy protection, protect blog, plagiarism, duplicate, seo, context menu
|
6 |
+
Requires at least: 3.0
|
7 |
+
Tested up to: 4.9.7
|
8 |
+
Stable tag: 1.1.8.5
|
9 |
+
License: GPLv2 or Later
|
10 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
|
12 |
+
WP Content Copy Protection uses aggressive techniques in protecting your online content (text/source/images/video/audio) from being stolen.
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
WP Content Copy Protection is a simple, yet effective plugin that uses an array of aggressive techniques in protecting your online content from being stolen.
|
17 |
+
|
18 |
+
Some of the most common content copy methods (via mouse, keyboard and browser), such as right-click, image drag/drop/save, text selection/drag/drop, source code viewing, and keyboard copy shortcut keys such as CTRL A, C, X, U, S, and P are disabled with this plugin (just to name a few).
|
19 |
+
|
20 |
+
This is a plugin with teeth - and an absolute must for any business owner, blogger and WordPress site owner who is serious about protecting his online content! Simple, effective, lightweight and non resource-intensive! By far the most effective 360 degree content copy protection plugin you will come across.
|
21 |
+
|
22 |
+
= Basic Features (included) =
|
23 |
+
|
24 |
+
√ Disables right click context menu on all content (except href links)
|
25 |
+
√ Disables text selection (globally) on PC and mobile devices
|
26 |
+
√ Disables text and image drag/drop/save on PC and mobile devices
|
27 |
+
√ Basic image protection (image link URL's are automatically removed)
|
28 |
+
√ Copy methods disabled from onscreen keyboard and shortcut context key
|
29 |
+
√ Secures your uploads directory and sub-directories from public access
|
30 |
+
√ Disables right click and save function on default video and audio embeds
|
31 |
+
√ Javascript validation (displays error message when disabled in user browser)
|
32 |
+
√ Disables keyboard copy controls (CTRL A, C, X) - Windows only
|
33 |
+
√ Disables 'Source view', 'Save Page', and 'Print' key functions
|
34 |
+
√ Disables f shortcut key for accessing developer tools to view source code
|
35 |
+
√ No obtrusive popups or alert messages as they are known to defame your site
|
36 |
+
√ No negative side-effects on your SEO (search engines can read your content)
|
37 |
+
√ This is a non resource-intensive plugin that works silently in the background
|
38 |
+
√ No configuration, customization or coding needed. Simply plug in and leave
|
39 |
+
|
40 |
+
= Premium Features (Compatible with Windows, Linux and Mac OS X | Woocommerce | Gallery plugins such as NextGEN and NextCellent) =
|
41 |
+
|
42 |
+
√ EVERYTHING in the basic version plus
|
43 |
+
√ Admin can exclude specific pages/posts/categories from being protected
|
44 |
+
√ Admin can enable/disable protection for site admins only OR registered users only OR admin and registered/logged in users
|
45 |
+
√ Advanced/aggressive image protection (makes it near impossible for users to steal your images | pc and mobile friendly)
|
46 |
+
√ Compatible with all gallery plugins (such as NextGEN and NextCellent) for uncompromised image protection
|
47 |
+
√ Removes feeds (rdf, rss, rss2, atom, rss2_comments and more) from content scrapers and autoblogs
|
48 |
+
√ Added extended keyboard copy protection commands (Windows, Linux and Mac OS X compatible)
|
49 |
+
√ Added Prt Sc (Print Screen) deterrent agent (preventative measure in image theft)
|
50 |
+
√ Prtsc agent equipped with instant redirect trigger (instantly bounce offender)
|
51 |
+
√ Added extended CSS for text and image protection (mobile devices and smartphones)
|
52 |
+
√ Source code view is disabled from F12, Ctrl+Shift+I, Ctrl+U and other combo keys
|
53 |
+
√ Source code padding added (tricks the user into thinking your source is hidden)
|
54 |
+
√ NO negative side-effects on your SEO (search engines can read your content)
|
55 |
+
√ Works (tested) in IE9, IE10, Firefox, Google Chrome, Opera and Safari
|
56 |
+
√ Compatible with all major theme frameworks and browsers
|
57 |
+
√ Compatible with WooCommerce and other eCommerce plugins
|
58 |
+
√ Lightweight, non resource-intensive plugin
|
59 |
+
√ Quality Support | Dedicated Devs
|
60 |
+
|
61 |
+
√ coming soon : source view page/post encryption and MUCH, MUCH more
|
62 |
+
|
63 |
+
The WP Content Copy Protection plugin is maintained by [OPTIPress](http://optipress.org/)
|
64 |
+
|
65 |
+
== This Plugin will NOT ==
|
66 |
+
|
67 |
+
1. Have any negative impact on your SEO.
|
68 |
+
2. Have any negative effect on your Advertising (such as Adsense) : Embeddable codes, other than the Video and Audio embeds from v3.6 upwards, are not affected by this plugin in any way!
|
69 |
+
|
70 |
+
== Installation ==
|
71 |
+
|
72 |
+
1. Download the .zip file
|
73 |
+
2. Upload and extract the contents of the zip file to your wp-content/plugins/folder
|
74 |
+
3. Activate the plugin
|
75 |
+
4. Enjoy!
|
76 |
+
|
77 |
+
== Feedback, Questions, Help, Bug Reporting, and Suggestions ==
|
78 |
+
|
79 |
+
Just email us at: support@tychesoftwares.com / Email Subject : WP Content Copy Protection
|
80 |
+
|
81 |
+
== Upgrade Notice ==
|
82 |
+
|
83 |
+
= Version 1.1.8.3 =
|
84 |
+
|
85 |
+
== Screenshots ==
|
86 |
+
|
87 |
+
none
|
88 |
+
|
89 |
+
== Frequently Asked Questions ==
|
90 |
+
|
91 |
+
= Will WP Content Copy Protection Plugin have a negative impact on my SEO? =
|
92 |
+
|
93 |
+
Absolutely not! This plugin will only affect the client browser and will have absolutely no negative impact on your SEO. In fact, it would assist in increasing your SEO score as your content will remain unique.
|
94 |
+
|
95 |
+
= Will this plugin disable the features from the site administrator also? =
|
96 |
+
|
97 |
+
Yes! However, our Pro version allows the blog administrator to enable/disable copy protect functions for registered and logged in users (globally)
|
98 |
+
|
99 |
+
= Will your WP Content Copy Protection Plugin affect my Advertising Units (Adsense)? =
|
100 |
+
|
101 |
+
Absolutely not! Although this plugin locks your content and prevents it from being copied by anyone else, your advertising units will remain unaffected as the code doesn't alter any embeddable code or the functioning thereof.
|
102 |
+
|
103 |
+
= Why Did you Exclude The alert-message (Popup), Function? =
|
104 |
+
|
105 |
+
This function was removed simply because it could scare away your website visitors - cause a higher bounce rate - and essentially defame your website. We like to be silent! However, this is optional in our Pro edition.
|
106 |
+
|
107 |
+
= Does your Plugin work on all major Browsers? =
|
108 |
+
|
109 |
+
This plugin works on all major browsers and theme frameworks. The full functionality of WPCCP was tested on the latest versions of IE (Internet Explorer), Mozilla Firefox, Safari and Chrome without any problems.
|
110 |
+
|
111 |
+
= What is the difference between the free version and the pro version? =
|
112 |
+
|
113 |
+
The pro version includes super aggressive image protection (making it near impossible for a user to copy/steal your images using advanced masking), Prt Sc (print screen) deterrent agent, optional alert message for right click, Javascript validation with idle redirect, removed all RSS feeds instances to counter content scraping software/autoblogs and much, much more! See our features above.
|
114 |
+
|
115 |
+
= Why did you remove the iframe breaker? =
|
116 |
+
|
117 |
+
We decided to remove the Iframe breaker due to conflict with theme appearance/customization.
|
118 |
+
|
119 |
+
= How would I break out of Iframes now? =
|
120 |
+
|
121 |
+
We have developed a small plugin that will act as an extension to WP Content Copy Protection. This plugin, WP noFrame/noClickjacking can be found [HERE](http://wordpress.org/plugins/wp-noframenoclickjacking/). This plugin is a simple (yet) effective frame breaking plugin (iframe buster) that protects your site content from being embedded into other sites - effectively defending you against clickjacking attacks. This is achieved by adding a Header always append X-Frame-Options DENY instruction to your .htaccess file - where the DENY rule will prevent ALL domains from framing your content.
|
122 |
+
|
123 |
+
= How is my Video and Audio Protected? =
|
124 |
+
|
125 |
+
This plugin inheritently disables right click/copy/save functions on your default HTML5 video and audio embeds.
|
126 |
+
|
127 |
+
== Changelog ==
|
128 |
+
|
129 |
+
= 1.0.1 =
|
130 |
+
* First release version
|
131 |
+
* Fixed bug that disabled user input via contact form
|
132 |
+
* Added function to disable Print via keyboard (CTRL+P)
|
133 |
+
|
134 |
+
= 1.0.2 =
|
135 |
+
* Re-enabled text selection (giving users more "freedom"). However, users are still unable to copy any selected text
|
136 |
+
* Fixed User input error (this error prevented users from text input via contact, search, and comment forms)
|
137 |
+
* Fixed a bug in mobile text protection code (conflicted with Chrome specific user input)
|
138 |
+
* Fixed Javascript drop down menu functionality
|
139 |
+
* Revamped iFrame breaking code
|
140 |
+
|
141 |
+
= 1.0.3 =
|
142 |
+
* Added function to automatically remove the image link URL and defaults the image upload settings to 'none' (deters image theft)
|
143 |
+
* Fixed a bug that prevented text input (via forms) in Chrome browsers
|
144 |
+
* Did some housekeeping
|
145 |
+
|
146 |
+
= 1.0.4 =
|
147 |
+
* added settings page
|
148 |
+
* Cleared ctrl + f5 (hard refresh) issue - no longer conflicts with other ctrl key functions
|
149 |
+
* Cleared bug that caused dropdown and user input issues
|
150 |
+
* Changed readme.txt and corrected typo errors
|
151 |
+
* Removed included screenshots
|
152 |
+
* General housekeeping
|
153 |
+
|
154 |
+
= 1.0.4.1 =
|
155 |
+
* fixed callback error
|
156 |
+
* fixed bug in mobile hold/copy function
|
157 |
+
* changed settings page
|
158 |
+
* edited readme.txt
|
159 |
+
* added tester area links in pro.php
|
160 |
+
* fixed user input bug for Chrome browsers
|
161 |
+
* added notice to plugin settings page
|
162 |
+
|
163 |
+
= 1.0.4.2 =
|
164 |
+
* fixed user input bug (for Chrome browsers)
|
165 |
+
* changed settings page and added notice
|
166 |
+
* fixed bug in mobile text select function
|
167 |
+
* edited readme.txt
|
168 |
+
* general housekeeping
|
169 |
+
|
170 |
+
= 1.0.5 =
|
171 |
+
|
172 |
+
* fixed bug in mobile text selection function (hold to copy)
|
173 |
+
* made changes to included pro page and fixed typo errors
|
174 |
+
* made changes to readme file
|
175 |
+
|
176 |
+
= 1.0.5.1 =
|
177 |
+
|
178 |
+
* changed settings page (added new text, removed some text, fixed typo error)
|
179 |
+
* renamed pro.php page to settings.php (modified the fwpconsec.php accordingly)
|
180 |
+
* added license URI to fwpconsec.php file header
|
181 |
+
* decreased tag count in readme.txt file (best practice)
|
182 |
+
* changed plugin description in fwpconsec.php file header
|
183 |
+
* general housekeeping and cleaning
|
184 |
+
|
185 |
+
= 1.0.5.2 =
|
186 |
+
|
187 |
+
* removed imagetoolbar meta from code due to conflict with head content
|
188 |
+
* removed deprecated code and replaced with correct syntax
|
189 |
+
* added padding to JS error message
|
190 |
+
* modified readme file
|
191 |
+
* general housekeeping
|
192 |
+
|
193 |
+
= 1.0.6 =
|
194 |
+
|
195 |
+
* re-enabled text selection as users could bypass mouse/keyboard copy on selected text by using the browser copy function (text select disabled = nothing to copy even from browser copy option)
|
196 |
+
* reconstructed and upgraded settings page
|
197 |
+
* added donation link (settings file)
|
198 |
+
* general housekeeping and code cleanup
|
199 |
+
* upgraded from v1.0.5.2 - v1.0.6
|
200 |
+
* updated and tested compatibility with WP v3.7.1
|
201 |
+
* updated readme.txt file
|
202 |
+
|
203 |
+
= 1.0.6.1 =
|
204 |
+
|
205 |
+
* removed duplicate javascript function from code
|
206 |
+
* corrected author name (display issue)
|
207 |
+
* upgraded from v1.0.6 - v1.0.6.1
|
208 |
+
* updated settings.php page
|
209 |
+
* updated readme.txt file
|
210 |
+
* general housekeeping
|
211 |
+
|
212 |
+
= 1.0.6.2 =
|
213 |
+
|
214 |
+
* tested compatibility with v3.8
|
215 |
+
* changed version number
|
216 |
+
* changed support email
|
217 |
+
* corrected typo error
|
218 |
+
|
219 |
+
= 1.0.6.03 =
|
220 |
+
|
221 |
+
* general housekeeping
|
222 |
+
* fixed typos in readme.txt
|
223 |
+
* updated settings.php page
|
224 |
+
|
225 |
+
= 1.0.7 =
|
226 |
+
|
227 |
+
* updated compatibility (tested up to 3.9)
|
228 |
+
* changes in readme.txt
|
229 |
+
* changes in settings.php
|
230 |
+
* changes in fwpconsec.php
|
231 |
+
|
232 |
+
= 1.0.8 =
|
233 |
+
|
234 |
+
* addressed conflict with theme appearance/customization (fwpconsec and readme)
|
235 |
+
* added missing feature in readme description
|
236 |
+
* removed some unnecessary spacing in code
|
237 |
+
* changed external URLs in settings
|
238 |
+
* changed default (blank) index.php
|
239 |
+
* added new question to readme faq
|
240 |
+
* upgraded from v1.0.7-v1.0.8
|
241 |
+
* fixed iFrame code comment
|
242 |
+
|
243 |
+
= 1.0.8.1 =
|
244 |
+
|
245 |
+
* added new function (ctrl+s = document saving) to keyboard copy protection. Now prevents keyboard shortcut to saving documents/webpages.
|
246 |
+
* fixed typo error in fwpconsec.php (caused code comments to display in UI)
|
247 |
+
* renamed plugin name due to conflict with another plugin
|
248 |
+
* renamed php files (fwpconsec.php to wpccpl.php)
|
249 |
+
* made changes to settings/readme files
|
250 |
+
* made changes to blank index.php
|
251 |
+
* pushed from v1.0.8-v1.0.8.1
|
252 |
+
* general housekeeping
|
253 |
+
|
254 |
+
= 1.0.8.2 =
|
255 |
+
|
256 |
+
* disabled iframe breaking code due to conflict with theme customizer
|
257 |
+
* added new function = disabled key command responsible for opening developer tools (another way of viewing source code)
|
258 |
+
* renamed plugin name (previous plugin conflict resolved)
|
259 |
+
* changed plugin version from v1.0.8.1-v1.0.8.2
|
260 |
+
* tested all current functions with v3.9
|
261 |
+
* made changes to readme
|
262 |
+
|
263 |
+
= 1.0.8.4 =
|
264 |
+
|
265 |
+
* disabled bookmark feature (used as a bypass measure in viewing source code)
|
266 |
+
* closed style tags in mobile copy disable function
|
267 |
+
* tested plugin compatibility with v3.9.1
|
268 |
+
* general housekeeping
|
269 |
+
|
270 |
+
= 1.0.8.5 =
|
271 |
+
|
272 |
+
* removed js for iframe breaking function
|
273 |
+
* added X-Frame-Options HTTP response header as iframe breaker alternative
|
274 |
+
* made readme.txt changes to include workaround
|
275 |
+
* general housekeeping
|
276 |
+
|
277 |
+
= 1.0.8.6 =
|
278 |
+
* compressed javascript (increase execution times and reduce bandwidth/http requests)
|
279 |
+
* cleaned up settings page
|
280 |
+
* disabled ctrlv key
|
281 |
+
* changed readme.txt
|
282 |
+
|
283 |
+
= 1.0.9.1 =
|
284 |
+
* corrected typo errors
|
285 |
+
* general housekeeping
|
286 |
+
|
287 |
+
= 1.1.2 =
|
288 |
+
* minor code changes
|
289 |
+
* enabled context menu on href tags
|
290 |
+
* general housekeeping
|
291 |
+
* upgraded v1.1.2
|
292 |
+
|
293 |
+
= 1.1.3 =
|
294 |
+
* fixed img drag/drop bug
|
295 |
+
|
296 |
+
= 1.1.3.2 =
|
297 |
+
* minified css
|
298 |
+
* added settings link to plugin menu in dashboard
|
299 |
+
* updated plugin from v1.1.3 - v1.1.3.2
|
300 |
+
* tested compatibility on WordPress v4.0
|
301 |
+
* general housekeeping
|
302 |
+
|
303 |
+
= 1.1.3.3 =
|
304 |
+
* disabled quickfind option (can be used to bypass all other keyboard commands)
|
305 |
+
* changed plugin and author URI along with support email
|
306 |
+
* modified JavaScript validation error message
|
307 |
+
* made changes to settings.php and readme.txt
|
308 |
+
* general housekeeping
|
309 |
+
* upgraded v1.1.3.3
|
310 |
+
|
311 |
+
= 1.1.4 =
|
312 |
+
* tested compatibility with core v4.1.1
|
313 |
+
* added rating link setting in plugin menu
|
314 |
+
* changed version number
|
315 |
+
* general housekeeping
|
316 |
+
|
317 |
+
= 1.1.4.1 =
|
318 |
+
* tested context functions on default video and audio embeds
|
319 |
+
* upgraded readme.txt
|
320 |
+
|
321 |
+
= 1.1.4.2 =
|
322 |
+
* otimized JS validation (includes an idle redirect when disabled in user browser)
|
323 |
+
* corrected upgrade notice version number
|
324 |
+
* readme.txt and settings changes
|
325 |
+
* general housekeeping
|
326 |
+
|
327 |
+
= 1.1.4.3 =
|
328 |
+
* tested compatibility with core 4.1.2
|
329 |
+
* changed support email
|
330 |
+
* changed stable tag
|
331 |
+
|
332 |
+
= 1.1.5 =
|
333 |
+
* added function to secure uploads dir from direct user access (without this function, all images and uploads can be accessed by default)
|
334 |
+
* modified index.php file (this file will be copied to user's uploads dir)
|
335 |
+
* changed stable tag (v1.1.5)
|
336 |
+
|
337 |
+
= 1.1.6 =
|
338 |
+
* tested compatibility with core 4.2.2
|
339 |
+
* extended uploads dir protection function to include subdirectories
|
340 |
+
* general housekeeping
|
341 |
+
|
342 |
+
= 1.1.7 =
|
343 |
+
* removed conflicting redeclare issue with another plugin
|
344 |
+
* updated the readme file and settings page
|
345 |
+
* general housekeeping
|
346 |
+
|
347 |
+
= 1.1.7.1 =
|
348 |
+
|
349 |
+
* removed idle redirect in js disable function due to conflict with open graph protocol
|
350 |
+
* tested functionality alongside social sharing (no issues present)
|
351 |
+
* removed duplicated code
|
352 |
+
* altered keywords
|
353 |
+
|
354 |
+
= 1.1.8.1 =
|
355 |
+
|
356 |
+
* added pro link on plugin screen
|
357 |
+
* tested compatibility on core 4.2.4
|
358 |
+
* modified plugin description in plugin screen
|
359 |
+
* modified keywords in readme file
|
360 |
+
* minor housekeeping on wpccpl.php, settings.php and readme files
|
361 |
+
|
362 |
+
= 1.1.8.3 =
|
363 |
+
|
364 |
+
* tested compatibility with core 4.3
|
365 |
+
* minor link change in settings file
|
366 |
+
* changed version number
|
367 |
+
|
368 |
+
= 1.1.8.4 =
|
369 |
+
|
370 |
+
* removed links of yooplugins
|
371 |
+
|
372 |
+
= 1.1.8.5 =
|
373 |
+
|
374 |
+
* Usage Tracking has been added in the plugin. It provides an option to allow tracking of the non-sensitive data of our plugin from the website. You can read more about it [here](https://www.tychesoftwares.com/docs/docs/wp-content-copy-protection/usage-tracking/).
|
settings.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h2><?php _e('WP Content Copy Protection Settings', 'wpcp'); ?></h2><br />
|
3 |
+
We have just taken over the development of this plugin & will be updating this page in the next release.<br/>
|
4 |
+
</div>
|
wpccpl.php
ADDED
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: WP Content Copy Protection
|
5 |
+
Plugin URI: https://www.tychesoftwares.com/premium-plugins/
|
6 |
+
Description: WP Content Copy Protection prevents plagiarism and protects your valuable online content (such as source code, text and images) from being copied illegally. Copy methods are disabled via mouse and keyboard. See <a href="options-general.php?page=wpcp_options">Settings > WP Content Copy Protection</a> to learn more about WP Content Copy Protection - The complete content protection plugin for WordPress.
|
7 |
+
Version: 1.1.8.5
|
8 |
+
Text Domain: wpccpl
|
9 |
+
Author: Tyche Softwares
|
10 |
+
Author URI: https://www.tychesoftwares.com/
|
11 |
+
License: GPLv2 or later
|
12 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html/
|
13 |
+
*/
|
14 |
+
|
15 |
+
define ( 'wpccpl_version', '1.1.8.5' );
|
16 |
+
|
17 |
+
/*
|
18 |
+
Original work: Copyright 2013-2015 Rynaldo Stoltz (email: rcstoltz@gmail.com )
|
19 |
+
Modified work: Copyright 2017 Vishal Kothari (email: vishal@tychesoftwares.com )
|
20 |
+
|
21 |
+
This program is free software; you can redistribute it and/or modify
|
22 |
+
it under the terms of the GNU General Public License as published by
|
23 |
+
the Free Software Foundation; either version 2 of the License, or
|
24 |
+
(at your option) any later version.
|
25 |
+
|
26 |
+
This program is distributed in the hope that it will be useful,
|
27 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
+
GNU General Public License for more details.
|
30 |
+
|
31 |
+
You should have received a copy of the GNU General Public License
|
32 |
+
along with this program; if not, write to the Free Software
|
33 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
34 |
+
*/
|
35 |
+
|
36 |
+
if(is_admin()) {
|
37 |
+
add_action('admin_menu', 'constr_menu');
|
38 |
+
add_action ('init', 'wpccl_add_all_component');
|
39 |
+
|
40 |
+
add_filter( 'ts_deativate_plugin_questions', 'wpccpl_deactivate_add_questions' );
|
41 |
+
add_filter( 'ts_tracker_data', 'wpccpl_ts_add_plugin_tracking_data' );
|
42 |
+
add_filter( 'ts_tracker_opt_out_data', 'wpccpl_get_data_for_opt_out' );
|
43 |
+
|
44 |
+
add_action( 'admin_init', 'wpccl_admin_actions' );
|
45 |
+
}
|
46 |
+
|
47 |
+
function wpccl_add_all_component () {
|
48 |
+
|
49 |
+
include_once ('includes/wpccpl-all-component.php');
|
50 |
+
do_action ('wpccpl_activate');
|
51 |
+
}
|
52 |
+
|
53 |
+
function wpccpl_deactivate_add_questions ( $wpccpl_deactivate_questions ) {
|
54 |
+
|
55 |
+
$wpccpl_deactivate_questions = array(
|
56 |
+
0 => array(
|
57 |
+
'id' => 4,
|
58 |
+
'text' => __( "Some keys does not blocked.", "wpccpl" ),
|
59 |
+
'input_type' => 'textfield',
|
60 |
+
'input_placeholder' => 'Which keys?'
|
61 |
+
),
|
62 |
+
1 => array(
|
63 |
+
'id' => 5,
|
64 |
+
'text' => __( "I need more keys need to be blocked.", "wpccpl" ),
|
65 |
+
'input_type' => 'textfield',
|
66 |
+
'input_placeholder' => 'Which keys?'
|
67 |
+
),
|
68 |
+
2 => array(
|
69 |
+
'id' => 6,
|
70 |
+
'text' => __( "The plugin does not protect Audio and video files on my site.", "wpccpl" ),
|
71 |
+
'input_type' => '',
|
72 |
+
'input_placeholder' => ''
|
73 |
+
),
|
74 |
+
3 => array(
|
75 |
+
'id' => 7,
|
76 |
+
'text' => __( "The plugin is not compatible with my browser.", "wpccpl" ),
|
77 |
+
'input_type' => 'textfield',
|
78 |
+
'input_placeholder' => 'Which browser?'
|
79 |
+
)
|
80 |
+
|
81 |
+
);
|
82 |
+
return $wpccpl_deactivate_questions;
|
83 |
+
}
|
84 |
+
/**
|
85 |
+
* Plugin's data to be tracked when Allow option is choosed.
|
86 |
+
*
|
87 |
+
* @hook ts_tracker_data
|
88 |
+
*
|
89 |
+
* @param array $data Contains the data to be tracked.
|
90 |
+
*
|
91 |
+
* @return array Plugin's data to track.
|
92 |
+
*
|
93 |
+
*/
|
94 |
+
|
95 |
+
function wpccpl_ts_add_plugin_tracking_data ( $data ) {
|
96 |
+
if ( isset( $_GET[ 'wpccpl_tracker_optin' ] ) && isset( $_GET[ 'wpccpl_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ 'wpccpl_tracker_nonce' ], 'wpccpl_tracker_optin' ) ) {
|
97 |
+
|
98 |
+
$plugin_data[ 'ts_meta_data_table_name' ] = 'ts_tracking_wpccpl_meta_data';
|
99 |
+
$plugin_data[ 'ts_plugin_name' ] = 'WP Content Copy Protection';
|
100 |
+
/**
|
101 |
+
* Add Plugin data
|
102 |
+
*/
|
103 |
+
$plugin_data[ 'wpccpl_plugin_version' ] = wpccpl_version;
|
104 |
+
|
105 |
+
$plugin_data[ 'wpccpl_allow_tracking' ] = get_option ( 'wpccpl_allow_tracking' );
|
106 |
+
$data[ 'plugin_data' ] = $plugin_data;
|
107 |
+
}
|
108 |
+
return $data;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Tracking data to send when No, thanks. button is clicked.
|
113 |
+
*
|
114 |
+
* @hook ts_tracker_opt_out_data
|
115 |
+
*
|
116 |
+
* @param array $params Parameters to pass for tracking data.
|
117 |
+
*
|
118 |
+
* @return array Data to track when opted out.
|
119 |
+
*
|
120 |
+
*/
|
121 |
+
function wpccpl_get_data_for_opt_out ( $params ) {
|
122 |
+
$plugin_data[ 'ts_meta_data_table_name'] = 'ts_tracking_wpccpl_meta_data';
|
123 |
+
$plugin_data[ 'ts_plugin_name' ] = 'WP Content Copy Protection';
|
124 |
+
|
125 |
+
// Store count info
|
126 |
+
$params[ 'plugin_data' ] = $plugin_data;
|
127 |
+
|
128 |
+
return $params;
|
129 |
+
}
|
130 |
+
|
131 |
+
function wpccl_admin_actions () {
|
132 |
+
/**
|
133 |
+
* We need to store the plugin version in DB, so we can show the welcome page and other contents.
|
134 |
+
*/
|
135 |
+
$wpccpl_version_in_db = get_option( 'wpccpl_version' );
|
136 |
+
if ( $wpccpl_version_in_db != wpccpl_version ){
|
137 |
+
update_option( 'wpccpl_version', wpccpl_version );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
function constr_menu() {
|
142 |
+
add_options_page('WP Content Copy Protection', 'WP Content Copy Protection', 'manage_options', 'wpcp_options', 'return_settings');
|
143 |
+
}
|
144 |
+
|
145 |
+
function return_settings() {
|
146 |
+
require_once('settings.php');
|
147 |
+
}
|
148 |
+
|
149 |
+
function ccp_config_link($links) {
|
150 |
+
$settings_link = '<a href="options-general.php?page=wpcp_options">Settings</a>';
|
151 |
+
array_unshift($links, $settings_link);
|
152 |
+
return $links;
|
153 |
+
}
|
154 |
+
|
155 |
+
$plugin = plugin_basename(__FILE__);
|
156 |
+
add_filter("plugin_action_links_$plugin", 'ccp_config_link' );
|
157 |
+
|
158 |
+
function rate_wpccp_yoo ($links, $file) {
|
159 |
+
if ($file == plugin_basename(__FILE__)) {
|
160 |
+
$rate_url = 'http://wordpress.org/support/view/plugin-reviews/' . basename(dirname(__FILE__)) . '?rate=5#postform';
|
161 |
+
$links[] = '<a href="' . $rate_url . '" target="_blank" title="Click here to rate and review this plugin on WordPress.org">Rate this plugin</a>';
|
162 |
+
}
|
163 |
+
return $links;
|
164 |
+
}
|
165 |
+
|
166 |
+
add_filter('plugin_row_meta', 'rate_wpccp_yoo', 10, 2);
|
167 |
+
|
168 |
+
function secure_uploads_dir() {
|
169 |
+
$start_dir = wp_upload_dir();
|
170 |
+
secure_copy_file($start_dir['basedir']);
|
171 |
+
}
|
172 |
+
|
173 |
+
function secure_copy_file($dir){
|
174 |
+
$empty_file = realpath( dirname( __FILE__ ) ) . '/index.php';
|
175 |
+
copy($empty_file, $dir . '/index.php');
|
176 |
+
if ($dh = opendir($dir)) {
|
177 |
+
while (($file = readdir($dh)) !== false) {
|
178 |
+
if ( is_dir($dir . '/' . $file) && $file!='.' && $file!='..' ) {
|
179 |
+
secure_copy_file( $dir . '/' . $file );
|
180 |
+
}
|
181 |
+
}
|
182 |
+
closedir($dh);
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
register_activation_hook( __FILE__, 'secure_uploads_dir' );
|
187 |
+
|
188 |
+
add_action('wp_head', 'fwpcon_pro');
|
189 |
+
update_option('image_default_link_type','none');
|
190 |
+
|
191 |
+
function fwpcon_pro() {
|
192 |
+
|
193 |
+
?>
|
194 |
+
|
195 |
+
<!-- WP Content Copy Protection script by Rynaldo Stoltz Starts -->
|
196 |
+
|
197 |
+
<div align="center"><noscript>
|
198 |
+
<div style="position:fixed; top:0px; left:0px; z-index:3000; height:100%; width:100%; background-color:#FFFFFF">
|
199 |
+
<div style="font-family: Trebuchet MS; font-size: 14px; background-color:#FFF000; padding: 10pt;">Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!</div></div>
|
200 |
+
</noscript></div>
|
201 |
+
|
202 |
+
<script type="text/javascript">
|
203 |
+
function disableSelection(e){if(typeof e.onselectstart!="undefined")e.onselectstart=function(){return false};else if(typeof e.style.MozUserSelect!="undefined")e.style.MozUserSelect="none";else e.onmousedown=function(){return false};e.style.cursor="default"}window.onload=function(){disableSelection(document.body)}
|
204 |
+
</script>
|
205 |
+
|
206 |
+
<script type="text/javascript">
|
207 |
+
document.oncontextmenu=function(e){var t=e||window.event;var n=t.target||t.srcElement;if(n.nodeName!="A")return false};
|
208 |
+
document.ondragstart=function(){return false};
|
209 |
+
</script>
|
210 |
+
|
211 |
+
<style type="text/css">
|
212 |
+
* : (input, textarea) {
|
213 |
+
-webkit-touch-callout:none;
|
214 |
+
-webkit-user-select:none;
|
215 |
+
}
|
216 |
+
</style>
|
217 |
+
|
218 |
+
<style type="text/css">
|
219 |
+
img {
|
220 |
+
-webkit-touch-callout:none;
|
221 |
+
-webkit-user-select:none;
|
222 |
+
}
|
223 |
+
</style>
|
224 |
+
|
225 |
+
<script type="text/javascript">
|
226 |
+
window.addEventListener("keydown",function(e){if(e.ctrlKey&&(e.which==65||e.which==66||e.which==67||e.which==70||e.which==73||e.which==80||e.which==83||e.which==85||e.which==86)){e.preventDefault()}});document.keypress=function(e){if(e.ctrlKey&&(e.which==65||e.which==66||e.which==70||e.which==67||e.which==73||e.which==80||e.which==83||e.which==85||e.which==86)){}return false}
|
227 |
+
</script>
|
228 |
+
|
229 |
+
<script type="text/javascript">
|
230 |
+
document.onkeydown=function(e){e=e||window.event;if(e.keyCode==123||e.keyCode==18){return false}}
|
231 |
+
</script>
|
232 |
+
|
233 |
+
<!-- WP Content Copy Protection script by Rynaldo Stoltz Ends -->
|
234 |
+
|
235 |
+
|
236 |
+
|
237 |
+
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
|
242 |
+
|
243 |
+
|
244 |
+
|
245 |
+
|
246 |
+
|
247 |
+
|
248 |
+
|
249 |
+
|
250 |
+
|
251 |
+
|
252 |
+
|
253 |
+
|
254 |
+
|
255 |
+
|
256 |
+
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
|
261 |
+
|
262 |
+
|
263 |
+
<?php } ?>
|