Version Description
- Code formatting for the save settings page.
- Done the broken link fixes for the about section.
Download this release
Release Info
Developer | Access Keys |
Plugin | Social Share WordPress Plugin – AccessPress Social Share |
Version | 3.0.4 |
Comparing to | |
See all releases |
Code changes from version 3.0.3 to 3.0.4
- accesspress-social-share.php +506 -510
- images/Thumbs.db +0 -0
- inc/backend/about-apss.php +1 -1
- inc/backend/activation.php +21 -20
- inc/backend/main-page.php +236 -190
- inc/backend/save-settings.php +34 -35
- inc/frontend/content-filter.php +159 -161
- inc/frontend/shortcode.php +182 -186
- readme.txt +5 -1
accesspress-social-share.php
CHANGED
@@ -1,566 +1,562 @@
|
|
1 |
<?php
|
2 |
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
3 |
/*
|
4 |
-
Plugin name: AccessPress Social Share
|
5 |
-
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-share/
|
6 |
-
Description: A plugin to add various social media shares to a site with dynamic configuration options.
|
7 |
-
Version: 3.0.
|
8 |
-
Author: AccessPress Themes
|
9 |
-
Author URI: http://accesspressthemes.com
|
10 |
-
Text Domain:apss-share
|
11 |
-
Domain Path: /languages/
|
12 |
-
License: GPLv2 or later
|
13 |
-
*/
|
14 |
|
15 |
//Decleration of the necessary constants for plugin
|
16 |
-
if( !defined( 'APSS_IMAGE_DIR' ) ) {
|
17 |
define( 'APSS_IMAGE_DIR', plugin_dir_url( __FILE__ ) . 'images' );
|
18 |
}
|
19 |
|
20 |
-
if( !defined( 'APSS_JS_DIR' ) ) {
|
21 |
define( 'APSS_JS_DIR', plugin_dir_url( __FILE__ ) . 'js' );
|
22 |
}
|
23 |
|
24 |
-
if( !defined( 'APSS_CSS_DIR' ) ) {
|
25 |
define( 'APSS_CSS_DIR', plugin_dir_url( __FILE__ ) . 'css' );
|
26 |
}
|
27 |
|
28 |
-
if( !defined( 'APSS_LANG_DIR' ) ) {
|
29 |
-
define( 'APSS_LANG_DIR', basename(dirname(__FILE__)) . '/languages/' );
|
30 |
}
|
31 |
|
32 |
-
if( !defined( 'APSS_VERSION' ) ) {
|
33 |
-
define( 'APSS_VERSION', '3.0.
|
34 |
}
|
35 |
|
36 |
-
if( !defined('APSS_TEXT_DOMAIN')){
|
37 |
define( 'APSS_TEXT_DOMAIN', 'apss-share' );
|
38 |
}
|
39 |
|
40 |
-
if( !defined('APSS_SETTING_NAME')){
|
41 |
-
|
42 |
}
|
43 |
|
44 |
-
if( !defined('APSS_COUNT_TRANSIENTS')){
|
45 |
-
|
46 |
}
|
47 |
|
48 |
//Decleration of the class for necessary configuration of a plugin
|
49 |
|
50 |
-
if( !class_exists( 'APSS_Class' ) ){
|
51 |
-
|
|
|
|
|
52 |
var $apss_settings;
|
53 |
var $apss_social_counts_transients;
|
|
|
54 |
function __construct() {
|
55 |
$this->apss_settings = get_option( APSS_SETTING_NAME ); //get the plugin variable contents from the options table.
|
56 |
register_activation_hook( __FILE__, array( $this, 'plugin_activation' ) ); //load the default setting for the plugin while activating
|
57 |
add_action( 'init', array( $this, 'plugin_text_domain' ) ); //load the plugin text domain
|
58 |
-
add_action('init',array( $this,'session_init')); //start the session if not started yet.
|
59 |
-
add_action('admin_enqueue_scripts', array($this, 'register_admin_assets')); //registers all the assets required for wp-admin
|
60 |
-
add_filter( 'the_content', array($this, 'apss_the_content_filter' )); // add the filter function for display of social share icons in frontend
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
add_action('admin_post_apss_save_options', array( $this, 'apss_save_options')); //save the options in the wordpress options table.
|
70 |
-
add_action('admin_post_apss_restore_default_settings',array($this,'apss_restore_default_settings'))
|
71 |
-
add_action('admin_post_apss_clear_cache',array($this,'apss_clear_cache'))
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
}
|
80 |
|
81 |
//called when plugin is activated
|
82 |
-
function plugin_activation(){
|
83 |
-
if( !get_option( APSS_SETTING_NAME ) ){
|
84 |
-
|
85 |
}
|
86 |
|
87 |
-
if( !get_option( APSS_COUNT_TRANSIENTS ) ){
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
}
|
92 |
|
93 |
//loads the text domain for translation
|
94 |
-
function plugin_text_domain(){
|
95 |
-
load_plugin_textdomain( APSS_TEXT_DOMAIN, false, APSS_LANG_DIR);
|
96 |
}
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
wp_enqueue_script( 'apss-frontend-mainjs', APSS_JS_DIR . '/frontend.js', array('jquery'), APSS_VERSION, true );
|
198 |
-
$ajax_nonce = wp_create_nonce( 'apss-ajax-nonce' );
|
199 |
-
wp_localize_script( 'apss-frontend-mainjs', 'frontend_ajax_object', array( 'ajax_url' => admin_url() . 'admin-ajax.php', 'ajax_nonce' => $ajax_nonce ) );
|
200 |
-
}
|
201 |
|
202 |
//add plugins menu in backend
|
203 |
-
function add_apss_menu(){
|
204 |
add_menu_page( 'AccessPress Social Share', 'AccessPress Social Share', 'manage_options', 'apss-share', array( $this, 'main_page' ), APSS_IMAGE_DIR . '/apss-icon.png' );
|
205 |
add_submenu_page( 'apss-share', __( 'Social Icons Settings', APSS_TEXT_DOMAIN ), __( 'Social Icons Settings', APSS_TEXT_DOMAIN ), 'manage_options', 'apss-share', array( $this, 'main_page' ) );
|
206 |
}
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
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 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
/* OK, it's safe for us to save the data now. */
|
351 |
-
// Make sure that it is set.
|
352 |
-
$content_flag = (isset($_POST['apss_content_flag']) && $_POST['apss_content_flag'] == 1) ? 1 : 0;
|
353 |
-
|
354 |
-
// Update the meta field in the database.
|
355 |
-
update_post_meta($post_id, 'apss_content_flag', $content_flag);
|
356 |
-
}
|
357 |
-
|
358 |
-
////////////////////////////////////////////////////////////
|
359 |
|
|
|
|
|
|
|
|
|
|
|
360 |
//plugins backend admin page
|
361 |
function main_page() {
|
362 |
include('inc/backend/main-page.php');
|
363 |
}
|
364 |
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
|
|
|
|
566 |
}
|
1 |
<?php
|
2 |
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
3 |
/*
|
4 |
+
Plugin name: AccessPress Social Share
|
5 |
+
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-share/
|
6 |
+
Description: A plugin to add various social media shares to a site with dynamic configuration options.
|
7 |
+
Version: 3.0.4
|
8 |
+
Author: AccessPress Themes
|
9 |
+
Author URI: http://accesspressthemes.com
|
10 |
+
Text Domain:apss-share
|
11 |
+
Domain Path: /languages/
|
12 |
+
License: GPLv2 or later
|
13 |
+
*/
|
14 |
|
15 |
//Decleration of the necessary constants for plugin
|
16 |
+
if ( !defined( 'APSS_IMAGE_DIR' ) ) {
|
17 |
define( 'APSS_IMAGE_DIR', plugin_dir_url( __FILE__ ) . 'images' );
|
18 |
}
|
19 |
|
20 |
+
if ( !defined( 'APSS_JS_DIR' ) ) {
|
21 |
define( 'APSS_JS_DIR', plugin_dir_url( __FILE__ ) . 'js' );
|
22 |
}
|
23 |
|
24 |
+
if ( !defined( 'APSS_CSS_DIR' ) ) {
|
25 |
define( 'APSS_CSS_DIR', plugin_dir_url( __FILE__ ) . 'css' );
|
26 |
}
|
27 |
|
28 |
+
if ( !defined( 'APSS_LANG_DIR' ) ) {
|
29 |
+
define( 'APSS_LANG_DIR', basename( dirname( __FILE__ ) ) . '/languages/' );
|
30 |
}
|
31 |
|
32 |
+
if ( !defined( 'APSS_VERSION' ) ) {
|
33 |
+
define( 'APSS_VERSION', '3.0.4' );
|
34 |
}
|
35 |
|
36 |
+
if ( !defined( 'APSS_TEXT_DOMAIN' ) ) {
|
37 |
define( 'APSS_TEXT_DOMAIN', 'apss-share' );
|
38 |
}
|
39 |
|
40 |
+
if ( !defined( 'APSS_SETTING_NAME' ) ) {
|
41 |
+
define( 'APSS_SETTING_NAME', 'apss_share_settings' );
|
42 |
}
|
43 |
|
44 |
+
if ( !defined( 'APSS_COUNT_TRANSIENTS' ) ) {
|
45 |
+
define( 'APSS_COUNT_TRANSIENTS', 'apss_social_counts_transients' );
|
46 |
}
|
47 |
|
48 |
//Decleration of the class for necessary configuration of a plugin
|
49 |
|
50 |
+
if ( !class_exists( 'APSS_Class' ) ) {
|
51 |
+
|
52 |
+
class APSS_Class {
|
53 |
+
|
54 |
var $apss_settings;
|
55 |
var $apss_social_counts_transients;
|
56 |
+
|
57 |
function __construct() {
|
58 |
$this->apss_settings = get_option( APSS_SETTING_NAME ); //get the plugin variable contents from the options table.
|
59 |
register_activation_hook( __FILE__, array( $this, 'plugin_activation' ) ); //load the default setting for the plugin while activating
|
60 |
add_action( 'init', array( $this, 'plugin_text_domain' ) ); //load the plugin text domain
|
61 |
+
add_action( 'init', array( $this, 'session_init' ) ); //start the session if not started yet.
|
62 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_assets' ) ); //registers all the assets required for wp-admin
|
63 |
+
add_filter( 'the_content', array( $this, 'apss_the_content_filter' ) ); // add the filter function for display of social share icons in frontend
|
64 |
+
|
65 |
+
if ( isset( $this->apss_settings['disable_frontend_assets'] ) && $this->apss_settings['disable_frontend_assets'] != '1' ) {
|
66 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_assets' ) ); //registers all the assets required for the frontend
|
67 |
+
} else if ( !isset( $this->apss_settings['disable_frontend_assets'] ) ) {
|
68 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_assets' ) ); //registers all the assets required for the frontend
|
69 |
+
}
|
70 |
+
|
71 |
+
add_action( 'admin_menu', array( $this, 'add_apss_menu' ) ); //register the plugin menu in backend
|
72 |
+
add_action( 'admin_post_apss_save_options', array( $this, 'apss_save_options' ) ); //save the options in the wordpress options table.
|
73 |
+
add_action( 'admin_post_apss_restore_default_settings', array( $this, 'apss_restore_default_settings' ) ); //restores default settings.
|
74 |
+
add_action( 'admin_post_apss_clear_cache', array( $this, 'apss_clear_cache' ) ); //clear the cache of the social share counter.
|
75 |
+
add_shortcode( 'apss-share', array( $this, 'apss_shortcode' ) ); //adds a shortcode
|
76 |
+
add_shortcode( 'apss-count', array( $this, 'apss_count_shortcode' ) ); //adds a share count shortcode
|
77 |
+
add_action( 'add_meta_boxes', array( $this, 'social_meta_box' ) ); //for providing the option to disable the social share option in each frontend page
|
78 |
+
add_action( 'save_post', array( $this, 'save_meta_values' ) ); //function to save the post meta values of a plugin.
|
79 |
+
|
80 |
+
add_action( 'wp_ajax_nopriv_frontend_counter', array( $this, 'frontend_counter' ) ); //fetching of the social share count.
|
81 |
+
add_action( 'wp_ajax_frontend_counter', array( $this, 'frontend_counter' ) ); // action for ajax counter.
|
82 |
}
|
83 |
|
84 |
//called when plugin is activated
|
85 |
+
function plugin_activation() {
|
86 |
+
if ( !get_option( APSS_SETTING_NAME ) ) {
|
87 |
+
include( 'inc/backend/activation.php' );
|
88 |
}
|
89 |
|
90 |
+
if ( !get_option( APSS_COUNT_TRANSIENTS ) ) {
|
91 |
+
$apss_social_counts_transients = array();
|
92 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
93 |
+
}
|
94 |
}
|
95 |
|
96 |
//loads the text domain for translation
|
97 |
+
function plugin_text_domain() {
|
98 |
+
load_plugin_textdomain( APSS_TEXT_DOMAIN, false, APSS_LANG_DIR );
|
99 |
}
|
100 |
|
101 |
+
//starts the session with the call of init hook
|
102 |
+
function session_init() {
|
103 |
+
if ( !session_id() ) {
|
104 |
+
session_start();
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
//functions to register frontend styles and scripts
|
109 |
+
function register_admin_assets() {
|
110 |
+
/**
|
111 |
+
* Backend CSS
|
112 |
+
* */
|
113 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == 'apss-share' ) {
|
114 |
+
wp_enqueue_style( 'aps-admin-css', APSS_CSS_DIR . '/backend.css', false, APSS_VERSION ); //registering plugin admin css
|
115 |
+
wp_enqueue_style( 'fontawesome-css', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css', false, APSS_VERSION );
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Backend JS
|
119 |
+
* */
|
120 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
121 |
+
wp_enqueue_script( 'apss-admin-js', APSS_JS_DIR . '/backend.js', array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker' ), APSS_VERSION ); //registering plugin's admin js
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
//function to return the content filter for the posts and pages
|
126 |
+
function apss_the_content_filter( $content ) {
|
127 |
+
global $post;
|
128 |
+
$post_content = $content;
|
129 |
+
$title = str_replace( '+', '%20', urlencode( $post->post_title ) );
|
130 |
+
$content = strip_shortcodes( strip_tags( get_the_content() ) );
|
131 |
+
|
132 |
+
if ( strlen( $content ) >= 100 ) {
|
133 |
+
$excerpt = substr( $content, 0, 100 ) . '...';
|
134 |
+
} else {
|
135 |
+
$excerpt = $content;
|
136 |
+
}
|
137 |
+
$options = $this->apss_settings;
|
138 |
+
ob_start();
|
139 |
+
include('inc/frontend/content-filter.php');
|
140 |
+
$html_content = ob_get_contents();
|
141 |
+
ob_get_clean();
|
142 |
+
|
143 |
+
$share_shows_in_options = $options['share_options'];
|
144 |
+
$content_flag = get_post_meta( $post->ID, 'apss_content_flag', true );
|
145 |
+
|
146 |
+
$all = in_array( 'all', $options['share_options'] );
|
147 |
+
$is_lists_authorized = (is_search() && $content_flag != '1' ) && $all ? true : false;
|
148 |
+
|
149 |
+
$is_attachement_check = in_array( 'attachment', $options['share_options'] );
|
150 |
+
$is_attachement = (is_attachment() && $is_attachement_check ) ? true : false;
|
151 |
+
|
152 |
+
$front_page = in_array( 'front_page', $options['share_options'] );
|
153 |
+
$is_front_page = (is_front_page() && $content_flag != '1' ) && $front_page ? true : false;
|
154 |
+
|
155 |
+
$share_shows_in_options = $options['share_options'];
|
156 |
+
$is_singular = is_singular( $share_shows_in_options ) && !is_front_page() && $content_flag != '1' ? true : false;
|
157 |
+
|
158 |
+
if ( !empty( $share_shows_in_options ) ) {
|
159 |
+
$is_tax = is_tax( $share_shows_in_options );
|
160 |
+
} else {
|
161 |
+
$is_tax = false;
|
162 |
+
}
|
163 |
+
|
164 |
+
$is_category = in_array( 'categories', $options['share_options'] );
|
165 |
+
$default_category = ( is_category() ) && $is_category ? true : false;
|
166 |
+
|
167 |
+
$is_default_archive = in_array( 'archives', $options['share_options'] );
|
168 |
+
$default_archives = ( ( is_archive() && !is_tax() ) && !is_category() ) && $is_default_archive ? true : false;
|
169 |
+
|
170 |
+
if ( empty( $options['share_options'] ) ) {
|
171 |
+
return $post_content;
|
172 |
+
} else if ( $is_lists_authorized || $is_attachement || $is_singular || $is_tax || $is_front_page || $default_category || $default_archives ) {
|
173 |
+
if ( $options['share_positions'] == 'below_content' ) {
|
174 |
+
return $post_content . "<div class='apss-social-share apss-theme-$icon_set_value clearfix' >" . $html_content . "</div>";
|
175 |
+
}
|
176 |
+
|
177 |
+
if ( $options['share_positions'] == 'above_content' ) {
|
178 |
+
return "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$html_content</div>" . $post_content;
|
179 |
+
}
|
180 |
+
|
181 |
+
if ( $options['share_positions'] == 'on_both' ) {
|
182 |
+
return "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$html_content</div>" . $post_content . "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$html_content</div>";
|
183 |
+
}
|
184 |
+
} else {
|
185 |
+
return $post_content;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Registers Frontend Assets
|
191 |
+
* */
|
192 |
+
function register_frontend_assets() {
|
193 |
+
wp_enqueue_style( 'apss-font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css', array(), APSS_VERSION );
|
194 |
+
wp_enqueue_style( 'apss-font-opensans', '//fonts.googleapis.com/css?family=Open+Sans', array(), false );
|
195 |
+
wp_enqueue_style( 'apss-frontend-css', APSS_CSS_DIR . '/frontend.css', array( 'apss-font-awesome' ), APSS_VERSION );
|
196 |
+
wp_enqueue_script( 'apss-frontend-mainjs', APSS_JS_DIR . '/frontend.js', array( 'jquery' ), APSS_VERSION, true );
|
197 |
+
$ajax_nonce = wp_create_nonce( 'apss-ajax-nonce' );
|
198 |
+
wp_localize_script( 'apss-frontend-mainjs', 'frontend_ajax_object', array( 'ajax_url' => admin_url() . 'admin-ajax.php', 'ajax_nonce' => $ajax_nonce ) );
|
199 |
+
}
|
|
|
|
|
|
|
|
|
200 |
|
201 |
//add plugins menu in backend
|
202 |
+
function add_apss_menu() {
|
203 |
add_menu_page( 'AccessPress Social Share', 'AccessPress Social Share', 'manage_options', 'apss-share', array( $this, 'main_page' ), APSS_IMAGE_DIR . '/apss-icon.png' );
|
204 |
add_submenu_page( 'apss-share', __( 'Social Icons Settings', APSS_TEXT_DOMAIN ), __( 'Social Icons Settings', APSS_TEXT_DOMAIN ), 'manage_options', 'apss-share', array( $this, 'main_page' ) );
|
205 |
}
|
206 |
|
207 |
+
//for saving the plugin settings
|
208 |
+
function apss_save_options() {
|
209 |
+
if ( isset( $_POST['apss_add_nonce_save_settings'] ) && isset( $_POST['apss_submit_settings'] ) && wp_verify_nonce( $_POST['apss_add_nonce_save_settings'], 'apss_nonce_save_settings' ) ) {
|
210 |
+
include( 'inc/backend/save-settings.php' );
|
211 |
+
} else {
|
212 |
+
die( 'No script kiddies please!' );
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
//function to restore the default setting of a plugin
|
217 |
+
function apss_restore_default_settings() {
|
218 |
+
$nonce = $_REQUEST['_wpnonce'];
|
219 |
+
if ( !empty( $_GET ) && wp_verify_nonce( $nonce, 'apss-restore-default-settings-nonce' ) ) {
|
220 |
+
//restore the default plugin activation settings from the activation page.
|
221 |
+
include( 'inc/backend/activation.php' );
|
222 |
+
$_SESSION['apss_message'] = __( 'Settings restored Successfully.', APSS_TEXT_DOMAIN );
|
223 |
+
wp_redirect( admin_url() . 'admin.php?page=apss-share' );
|
224 |
+
exit;
|
225 |
+
} else {
|
226 |
+
die( 'No script kiddies please!' );
|
227 |
+
}
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Clears the social share counter cache
|
232 |
+
*/
|
233 |
+
function apss_clear_cache() {
|
234 |
+
if ( !empty( $_GET ) && wp_verify_nonce( $_GET['_wpnonce'], 'apss-clear-cache-nonce' ) ) {
|
235 |
+
$apss_settings = $this->apss_settings;
|
236 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
237 |
+
foreach ( $apss_social_counts_transients as $transient ) {
|
238 |
+
delete_transient( $transient );
|
239 |
+
}
|
240 |
+
update_option( APSS_COUNT_TRANSIENTS, array() );
|
241 |
+
$transient_array = array( 'apss_tweets_count', 'apss_linkedin_count', 'apss_fb_count', 'apss_pin_count', 'apss_google_plus_count' );
|
242 |
+
foreach ( $transient_array as $transient ) {
|
243 |
+
delete_transient( $transient );
|
244 |
+
}
|
245 |
+
$_SESSION['apss_message'] = __( 'Cache cleared Successfully', APSS_TEXT_DOMAIN );
|
246 |
+
wp_redirect( admin_url() . 'admin.php?page=apss-share' );
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
//function for adding shortcode of a plugin
|
251 |
+
function apss_shortcode( $attr ) {
|
252 |
+
ob_start();
|
253 |
+
include( 'inc/frontend/shortcode.php' );
|
254 |
+
$html = ob_get_contents();
|
255 |
+
ob_get_clean();
|
256 |
+
return $html;
|
257 |
+
}
|
258 |
+
|
259 |
+
//frontend counter
|
260 |
+
function frontend_counter() {
|
261 |
+
if ( !empty( $_GET ) && wp_verify_nonce( $_GET['_wpnonce'], 'apss-ajax-nonce' ) ) {
|
262 |
+
$apss_settings = $this->apss_settings;
|
263 |
+
$new_detail_array = array();
|
264 |
+
if ( isset( $_POST['data'] ) ) {
|
265 |
+
$details = $_POST['data'];
|
266 |
+
foreach ( $details as $detail ) {
|
267 |
+
$new_detail_array[$detail['network']] = $this->get_count( $detail['network'], $detail['url'] );
|
268 |
+
}
|
269 |
+
} else if ( isset( $_POST['shortcode_data'] ) ) {
|
270 |
+
$shortcode_data = $_POST['shortcode_data'];
|
271 |
+
foreach ( $shortcode_data as $detail ) {
|
272 |
+
$detail_array = explode( '_', $detail );
|
273 |
+
$url = trim( $detail_array[0] );
|
274 |
+
$network = $detail_array[1];
|
275 |
+
$new_detail_array[] = $this->get_count( $network, $url );
|
276 |
+
}
|
277 |
+
}
|
278 |
+
die( json_encode( $new_detail_array ) );
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
//frontend counter only Shortcode
|
283 |
+
function apss_count_shortcode( $atts ) {
|
284 |
+
if ( isset( $atts['network'] ) ) {
|
285 |
+
$url = $this->curPageURL();
|
286 |
+
$count = $this->get_count( $atts['network'], $url );
|
287 |
+
return $count;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
///////////////////////////for post meta options//////////////////////////////////
|
292 |
+
/**
|
293 |
+
* Adds a section in all the post and page section to disable the share options in frontend pages
|
294 |
+
*/
|
295 |
+
function social_meta_box() {
|
296 |
+
add_meta_box( 'ap-share-box', 'AccessPress social share options', array( $this, 'metabox_callback' ), '', 'side', 'core' );
|
297 |
+
}
|
298 |
+
|
299 |
+
function metabox_callback( $post ) {
|
300 |
+
wp_nonce_field( 'save_meta_values', 'ap_share_meta_nonce' );
|
301 |
+
$content_flag = get_post_meta( $post->ID, 'apss_content_flag', true );
|
302 |
+
?>
|
303 |
+
<label><input type="checkbox" value="1" name="apss_content_flag" <?php checked( $content_flag, true ) ?>/><?php _e( 'Hide share icons in content', APSS_TEXT_DOMAIN ); ?></label><br>
|
304 |
+
<?php
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Save Share Flags on post save
|
309 |
+
*/
|
310 |
+
function save_meta_values( $post_id ) {
|
311 |
+
|
312 |
+
/*
|
313 |
+
* We need to verify this came from our screen and with proper authorization,
|
314 |
+
* because the save_post action can be triggered at other times.
|
315 |
+
*/
|
316 |
+
|
317 |
+
// Check if our nonce is set.
|
318 |
+
if ( !isset( $_POST['ap_share_meta_nonce'] ) ) {
|
319 |
+
return;
|
320 |
+
}
|
321 |
+
|
322 |
+
// Verify that the nonce is valid.
|
323 |
+
if ( !wp_verify_nonce( $_POST['ap_share_meta_nonce'], 'save_meta_values' ) ) {
|
324 |
+
return;
|
325 |
+
}
|
326 |
+
|
327 |
+
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
|
328 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
329 |
+
return;
|
330 |
+
}
|
331 |
+
|
332 |
+
// Check the user's permissions.
|
333 |
+
if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
|
334 |
+
|
335 |
+
if ( !current_user_can( 'edit_page', $post_id ) ) {
|
336 |
+
return;
|
337 |
+
}
|
338 |
+
} else {
|
339 |
+
|
340 |
+
if ( !current_user_can( 'edit_post', $post_id ) ) {
|
341 |
+
return;
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
/* OK, it's safe for us to save the data now. */
|
346 |
+
// Make sure that it is set.
|
347 |
+
$content_flag = (isset( $_POST['apss_content_flag'] ) && $_POST['apss_content_flag'] == 1) ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
|
349 |
+
// Update the meta field in the database.
|
350 |
+
update_post_meta( $post_id, 'apss_content_flag', $content_flag );
|
351 |
+
}
|
352 |
+
|
353 |
+
////////////////////////////////////////////////////////////
|
354 |
//plugins backend admin page
|
355 |
function main_page() {
|
356 |
include('inc/backend/main-page.php');
|
357 |
}
|
358 |
|
359 |
+
//returns the current page url
|
360 |
+
function curPageURL() {
|
361 |
+
$pageURL = 'http';
|
362 |
+
if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) {
|
363 |
+
$pageURL .= "s";
|
364 |
+
}
|
365 |
+
$pageURL .= "://";
|
366 |
+
if ( $_SERVER["SERVER_PORT"] != "80" ) {
|
367 |
+
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
368 |
+
} else {
|
369 |
+
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
370 |
+
}
|
371 |
+
return $pageURL;
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Funciton to print array in pre format
|
376 |
+
* */
|
377 |
+
function print_array( $array ) {
|
378 |
+
echo "<pre>";
|
379 |
+
print_r( $array );
|
380 |
+
echo "</pre>";
|
381 |
+
}
|
382 |
+
|
383 |
+
////////////////////////////////////for count //////////////////////////////////////////////////////
|
384 |
+
//for facebook url share count
|
385 |
+
function get_fb( $url ) {
|
386 |
+
$apss_settings = $this->apss_settings;
|
387 |
+
$cache_period = $apss_settings['cache_period'];
|
388 |
+
$fb_transient = 'fb_' . md5( $url );
|
389 |
+
$fb_transient_count = get_transient( $fb_transient );
|
390 |
+
|
391 |
+
//for setting the counter transient in separate options value
|
392 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
393 |
+
if ( false === $fb_transient_count ) {
|
394 |
+
// $json_string = $this->get_json_values( 'https://graph.facebook.com/?id=' . $url );
|
395 |
+
// $json = json_decode( $json_string, true );
|
396 |
+
// $facebook_count = isset($json['shares']) ? intval( $json['shares'] ) : 0;
|
397 |
+
$json_string = $this->get_json_values( 'https://api.facebook.com/method/links.getStats?urls=' . $url . '&format=json' );
|
398 |
+
$json = json_decode( $json_string, true );
|
399 |
+
$facebook_count = isset( $json[0]['total_count'] ) ? intval( $json[0]['total_count'] ) : 0;
|
400 |
+
set_transient( $fb_transient, $facebook_count, $cache_period * HOUR_IN_SECONDS );
|
401 |
+
if ( !in_array( $fb_transient, $apss_social_counts_transients ) ) {
|
402 |
+
$apss_social_counts_transients[] = $fb_transient;
|
403 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
404 |
+
}
|
405 |
+
} else {
|
406 |
+
$facebook_count = $fb_transient_count;
|
407 |
+
}
|
408 |
+
return $facebook_count;
|
409 |
+
}
|
410 |
+
|
411 |
+
//for twitter url share count
|
412 |
+
function get_tweets( $url ) {
|
413 |
+
$apss_settings = $this->apss_settings;
|
414 |
+
$cache_period = $apss_settings['cache_period'];
|
415 |
+
$twitter_transient = 'twitter_' . md5( $url );
|
416 |
+
$twitter_transient_count = get_transient( $twitter_transient );
|
417 |
+
|
418 |
+
//for setting the counter transient in separate options value
|
419 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
420 |
+
if ( false === $twitter_transient_count ) {
|
421 |
+
$json_string = $this->get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
|
422 |
+
$json = json_decode( $json_string, true );
|
423 |
+
$tweet_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
424 |
+
set_transient( $twitter_transient, $tweet_count, $cache_period * HOUR_IN_SECONDS );
|
425 |
+
if ( !in_array( $twitter_transient, $apss_social_counts_transients ) ) {
|
426 |
+
$apss_social_counts_transients[] = $twitter_transient;
|
427 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
428 |
+
}
|
429 |
+
} else {
|
430 |
+
$tweet_count = $twitter_transient_count;
|
431 |
+
}
|
432 |
+
return $tweet_count;
|
433 |
+
}
|
434 |
+
|
435 |
+
//for google plus url share count
|
436 |
+
function get_plusones( $url ) {
|
437 |
+
$apss_settings = $this->apss_settings;
|
438 |
+
$cache_period = $apss_settings['cache_period'];
|
439 |
+
$googlePlus_transient = 'gp_' . md5( $url );
|
440 |
+
$googlePlus_transient_count = get_transient( $googlePlus_transient );
|
441 |
+
|
442 |
+
//for setting the counter transient in separate options value
|
443 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
444 |
+
if ( false === $googlePlus_transient_count ) {
|
445 |
+
$curl = curl_init();
|
446 |
+
curl_setopt( $curl, CURLOPT_URL, "https://clients6.google.com/rpc" );
|
447 |
+
curl_setopt( $curl, CURLOPT_POST, true );
|
448 |
+
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
|
449 |
+
curl_setopt( $curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . rawurldecode( $url ) . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]' );
|
450 |
+
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
|
451 |
+
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-type: application/json' ) );
|
452 |
+
$curl_results = curl_exec( $curl );
|
453 |
+
curl_close( $curl );
|
454 |
+
unset( $curl );
|
455 |
+
$json = json_decode( $curl_results, true );
|
456 |
+
$plusones_count = isset( $json[0]['result']['metadata']['globalCounts']['count'] ) ? intval( $json[0]['result']['metadata']['globalCounts']['count'] ) : 0;
|
457 |
+
set_transient( $googlePlus_transient, $plusones_count, $cache_period * HOUR_IN_SECONDS );
|
458 |
+
if ( !in_array( $googlePlus_transient, $apss_social_counts_transients ) ) {
|
459 |
+
$apss_social_counts_transients[] = $googlePlus_transient;
|
460 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
461 |
+
}
|
462 |
+
} else {
|
463 |
+
$plusones_count = $googlePlus_transient_count;
|
464 |
+
}
|
465 |
+
return $plusones_count;
|
466 |
+
}
|
467 |
+
|
468 |
+
//for pinterest url share count
|
469 |
+
function get_pinterest( $url ) {
|
470 |
+
$apss_settings = $this->apss_settings;
|
471 |
+
$cache_period = $apss_settings['cache_period'];
|
472 |
+
$pinterest_transient = 'pinterest_' . md5( $url );
|
473 |
+
$pinterest_transient_count = get_transient( $pinterest_transient );
|
474 |
+
|
475 |
+
//for setting the counter transient in separate options value
|
476 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
477 |
+
if ( false === $pinterest_transient_count ) {
|
478 |
+
$json_string = $this->get_json_values( 'http://api.pinterest.com/v1/urls/count.json?url=' . $url );
|
479 |
+
$json_string = preg_replace( '/^receiveCount\((.*)\)$/', "\\1", $json_string );
|
480 |
+
$json = json_decode( $json_string, true );
|
481 |
+
$pinterest_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
482 |
+
set_transient( $pinterest_transient, $pinterest_count, $cache_period * HOUR_IN_SECONDS );
|
483 |
+
if ( !in_array( $pinterest_transient, $apss_social_counts_transients ) ) {
|
484 |
+
$apss_social_counts_transients[] = $pinterest_transient;
|
485 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
486 |
+
}
|
487 |
+
} else {
|
488 |
+
$pinterest_count = $pinterest_transient_count;
|
489 |
+
}
|
490 |
+
return $pinterest_count;
|
491 |
+
}
|
492 |
+
|
493 |
+
//for linkedin url share count
|
494 |
+
function get_linkedin( $url ) {
|
495 |
+
$apss_settings = $this->apss_settings;
|
496 |
+
$cache_period = $apss_settings['cache_period'];
|
497 |
+
$linkedin_transient = 'linkedin_' . md5( $url );
|
498 |
+
$linkedin_transient_count = get_transient( $linkedin_transient );
|
499 |
+
|
500 |
+
//for setting the counter transient in separate options value
|
501 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
502 |
+
if ( false === $linkedin_transient_count ) {
|
503 |
+
$json_string = $this->get_json_values( "https://www.linkedin.com/countserv/count/share?url=$url&format=json" );
|
504 |
+
$json = json_decode( $json_string, true );
|
505 |
+
$linkedin_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
506 |
+
|
507 |
+
set_transient( $linkedin_transient, $linkedin_count, $cache_period * HOUR_IN_SECONDS );
|
508 |
+
if ( !in_array( $linkedin_transient, $apss_social_counts_transients ) ) {
|
509 |
+
$apss_social_counts_transients[] = $linkedin_transient;
|
510 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
511 |
+
}
|
512 |
+
} else {
|
513 |
+
$linkedin_count = $linkedin_transient_count;
|
514 |
+
}
|
515 |
+
return $linkedin_count;
|
516 |
+
}
|
517 |
+
|
518 |
+
//function to return json values from social media urls
|
519 |
+
private function get_json_values( $url ) {
|
520 |
+
$args = array( 'timeout' => 10 );
|
521 |
+
$response = wp_remote_get( $url, $args );
|
522 |
+
$json_response = wp_remote_retrieve_body( $response );
|
523 |
+
return $json_response;
|
524 |
+
}
|
525 |
+
|
526 |
+
////////////////////////////////////for count ends here/////////////////////////////////////////////
|
527 |
+
|
528 |
+
function get_count( $profile_name, $url ) {
|
529 |
+
switch ( $profile_name ) {
|
530 |
+
case 'facebook':
|
531 |
+
$count = $this->get_fb( $url );
|
532 |
+
break;
|
533 |
+
|
534 |
+
case 'twitter':
|
535 |
+
$count = $this->get_tweets( $url );
|
536 |
+
break;
|
537 |
+
|
538 |
+
case 'google-plus':
|
539 |
+
$count = $this->get_plusones( $url );
|
540 |
+
break;
|
541 |
+
|
542 |
+
case 'linkedin':
|
543 |
+
$count = $this->get_linkedin( $url );
|
544 |
+
break;
|
545 |
+
|
546 |
+
case 'pinterest':
|
547 |
+
$count = $this->get_pinterest( $url );
|
548 |
+
break;
|
549 |
+
|
550 |
+
default:
|
551 |
+
$count = 0;
|
552 |
+
break;
|
553 |
+
}
|
554 |
+
return $count;
|
555 |
+
}
|
556 |
+
|
557 |
+
}
|
558 |
+
|
559 |
+
//APSS_Class termination
|
560 |
+
|
561 |
+
$apss_object = new APSS_Class();
|
562 |
}
|
images/Thumbs.db
CHANGED
Binary file
|
inc/backend/about-apss.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
</p>
|
16 |
<div class="halfseperator"></div>
|
17 |
<p><strong>If you like to buy premium version of this plugin please check here:</strong><br />
|
18 |
-
<a href="
|
19 |
</p>
|
20 |
<div class="halfseperator"></div>
|
21 |
<p><strong>Feature comparison between free and premium plugin is here:</strong><br />
|
15 |
</p>
|
16 |
<div class="halfseperator"></div>
|
17 |
<p><strong>If you like to buy premium version of this plugin please check here:</strong><br />
|
18 |
+
<a href="https://accesspressthemes.com/wordpress-plugins/accesspress-social-pro/" target="_blank">https://accesspressthemes.com/wordpress-plugins/accesspress-social-pro/</a>
|
19 |
</p>
|
20 |
<div class="halfseperator"></div>
|
21 |
<p><strong>Feature comparison between free and premium plugin is here:</strong><br />
|
inc/backend/activation.php
CHANGED
@@ -2,28 +2,29 @@
|
|
2 |
defined('ABSPATH') or die("No script kiddies please!");
|
3 |
$apss_share_settings=array();
|
4 |
$share_options = array('post', 'page');
|
5 |
-
$apss_share_settings['share_options']=$share_options;
|
6 |
-
$apss_share_settings['social_icon_set']='1';
|
7 |
-
$apss_share_settings['share_positions']='below_content';
|
8 |
-
$social_networks=array(
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
);
|
17 |
-
$apss_share_settings['social_networks']=$social_networks;
|
18 |
$apss_share_settings['disable_frontend_assets'] = '0';
|
19 |
-
$apss_share_settings['share_text']
|
20 |
-
$apss_share_settings['twitter_username']
|
21 |
-
$apss_share_settings['counter_enable_options']='0';
|
22 |
$apss_share_settings['total_counter_enable_options']='0';
|
23 |
-
$apss_share_settings['cache_period']='24';
|
24 |
$apss_share_settings['apss_social_counts_transients']=array();
|
25 |
-
$apss_share_settings['dialog_box_options']
|
26 |
-
$apss_share_settings['footer_javascript']
|
27 |
-
$apss_share_settings['apss_email_subject']
|
28 |
-
$apss_share_settings['apss_email_body']
|
29 |
update_option( APSS_SETTING_NAME, $apss_share_settings);
|
2 |
defined('ABSPATH') or die("No script kiddies please!");
|
3 |
$apss_share_settings=array();
|
4 |
$share_options = array('post', 'page');
|
5 |
+
$apss_share_settings['share_options'] =$share_options;
|
6 |
+
$apss_share_settings['social_icon_set'] ='1';
|
7 |
+
$apss_share_settings['share_positions'] ='below_content';
|
8 |
+
$social_networks=array(
|
9 |
+
'facebook' =>'1',
|
10 |
+
'twitter' =>'1',
|
11 |
+
'google-plus' =>'1',
|
12 |
+
'pinterest' =>'1',
|
13 |
+
'linkedin' =>'1',
|
14 |
+
'digg' =>'1',
|
15 |
+
'email' =>'0',
|
16 |
+
'print' =>'0',
|
17 |
);
|
18 |
+
$apss_share_settings['social_networks'] =$social_networks;
|
19 |
$apss_share_settings['disable_frontend_assets'] = '0';
|
20 |
+
$apss_share_settings['share_text'] = '';
|
21 |
+
$apss_share_settings['twitter_username'] = '';
|
22 |
+
$apss_share_settings['counter_enable_options'] ='0';
|
23 |
$apss_share_settings['total_counter_enable_options']='0';
|
24 |
+
$apss_share_settings['cache_period'] ='24';
|
25 |
$apss_share_settings['apss_social_counts_transients']=array();
|
26 |
+
$apss_share_settings['dialog_box_options'] ='1';
|
27 |
+
$apss_share_settings['footer_javascript'] = '1';
|
28 |
+
$apss_share_settings['apss_email_subject'] = 'Please visit this link %%url%%';
|
29 |
+
$apss_share_settings['apss_email_body'] = 'Hey Buddy!, I found this information for you: "%%title%%". Here is the website link: %%permalink%%. Thank you.';
|
30 |
update_option( APSS_SETTING_NAME, $apss_share_settings);
|
inc/backend/main-page.php
CHANGED
@@ -1,206 +1,252 @@
|
|
1 |
<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); ?>
|
2 |
<div class="apss-wrapper-block">
|
3 |
-
<div class="apss-setting-header clearfix">
|
4 |
-
|
5 |
-
|
6 |
-
</div>
|
7 |
-
<div class="apss-header-icons">
|
8 |
-
<p><?php _e('Follow us for new updates'); ?></p>
|
9 |
-
<div class="apss-social-bttns">
|
10 |
-
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FAccessPress-Themes%2F1396595907277967&width&layout=button&action=like&show_faces=false&share=false&height=35&appId=1411139805828592" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:20px; width:50px " allowtransparency="true"></iframe>
|
11 |
-
|
12 |
-
<iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/follow_button.5f46501ecfda1c3e1c05dd3e24875611.en.html#_=1421918256492&dnt=true&id=twitter-widget-0&lang=en&screen_name=apthemes&show_count=false&show_screen_name=true&size=m" class="twitter-follow-button twitter-follow-button" title="Twitter Follow Button" data-twttr-rendered="true" style="width: 126px; height: 20px;"></iframe>
|
13 |
-
<script>!function (d, s, id) {
|
14 |
-
var js, fjs = d.getElementsByTagName(s)[0];
|
15 |
-
if (!d.getElementById(id)) {
|
16 |
-
js = d.createElement(s);
|
17 |
-
js.id = id;
|
18 |
-
js.src = "//platform.twitter.com/widgets.js";
|
19 |
-
fjs.parentNode.insertBefore(js, fjs);
|
20 |
-
}
|
21 |
-
}(document, "script", "twitter-wjs");</script>
|
22 |
-
</div>
|
23 |
-
</div>
|
24 |
-
<div class="apss-header-title">
|
25 |
-
<?php _e( 'AccessPress Social Share', APSS_TEXT_DOMAIN ); ?>
|
26 |
-
</div>
|
27 |
-
</div>
|
28 |
-
<?php $options = get_option( APSS_SETTING_NAME );
|
29 |
-
if(isset($_SESSION['apss_message'])){ ?>
|
30 |
-
<div class="apss-message">
|
31 |
-
<p><?php
|
32 |
-
echo $_SESSION['apss_message'];
|
33 |
-
unset($_SESSION['apss_message']);
|
34 |
-
?></p>
|
35 |
-
</div>
|
36 |
-
<?php } ?>
|
37 |
-
|
38 |
-
<div class="apps-wrap">
|
39 |
-
<form method="post" action="<?php echo admin_url() . 'admin-post.php' ?>">
|
40 |
-
<input type="hidden" name="action" value="apss_save_options"/>
|
41 |
-
|
42 |
-
<ul class="apss-setting-tabs clearfix">
|
43 |
-
<li><a href="javascript:void(0)" id="apss-social-networks" class="apss-tabs-trigger apss-active-tab "><?php _e( 'Social Networks', APSS_TEXT_DOMAIN );?></a></li>
|
44 |
-
<li><a href="javascript:void(0)" id="apss-share-options" class="apss-tabs-trigger "><?php _e( 'Share Options', APSS_TEXT_DOMAIN )?></a></li>
|
45 |
-
<li><a href="javascript:void(0)" id="apss-display-settings" class="apss-tabs-trigger"><?php _e( 'Display Settings', APSS_TEXT_DOMAIN );?></a></li>
|
46 |
-
<li><a href="javascript:void(0)" id="apss-miscellaneous" class="apss-tabs-trigger"><?php _e( 'Miscellaneous', APSS_TEXT_DOMAIN );?></a></li>
|
47 |
-
<li><a href="javascript:void(0)" id="apss-how-to-use" class="apss-tabs-trigger"><?php _e( 'How To Use', APSS_TEXT_DOMAIN );?></a></li>
|
48 |
-
<li><a href="javascript:void(0)" id="apss-about" class="apss-tabs-trigger"><?php _e( 'About', APSS_TEXT_DOMAIN );?></a></li>
|
49 |
-
</ul>
|
50 |
-
<div class="apss-wrapper">
|
51 |
-
<div class="apss-tab-contents apss-social-networks" id="tab-apss-social-networks" style='display:block'>
|
52 |
-
<h2><?php _e('Social Media chooser:', APSS_TEXT_DOMAIN); ?> </h2>
|
53 |
-
<span class="social-text"><?php _e('Please choose the social media you want to display. Also you can order these social media\'s by drag and drop:', APSS_TEXT_DOMAIN ); ?></span>
|
54 |
-
<div class="apps-opt-wrap clearfix">
|
55 |
-
<?php
|
56 |
-
$label_array = array('facebook'=>' <span class="media-icon"><i class="fa fa-facebook"></i></span> Facebook',
|
57 |
-
'twitter'=>' <span class="media-icon"><i class="fa fa-twitter"></i></span> Twitter',
|
58 |
-
'google-plus'=>'<span class="media-icon"><i class="fa fa-google-plus"></i></span> Google Plus',
|
59 |
-
'pinterest'=>'<span class="media-icon"> <i class="fa fa-pinterest"></i> </span>Pinterest',
|
60 |
-
'linkedin'=>'<span class="media-icon"><i class="fa fa-linkedin"></i></span> Linkedin',
|
61 |
-
'digg'=>'<span class="media-icon"><i class="fa fa-digg"></i></span> Digg',
|
62 |
-
'email'=>'<span class="media-icon"><i class="fa fa-envelope"></i></span> Email',
|
63 |
-
'print'=>'<span class="media-icon"><i class="fa fa-print"></i> </span>Print',
|
64 |
-
);
|
65 |
-
?>
|
66 |
-
<?php foreach($options['social_networks'] as $key=>$val){
|
67 |
-
?>
|
68 |
-
<div class="apss-option-wrapper">
|
69 |
-
<div class="apss-option-field">
|
70 |
-
<label class="clearfix"><span class="left-icon"><i class="fa fa-arrows"></i></span><span class="social-name"><?php echo $label_array[$key];?></span><input type="checkbox" data-key='<?php echo $key;?>' name="social_networks[<?php echo $key;?>]" value="1" <?php if($val=='1'){ echo "checked='checked'"; } ?> /></label>
|
71 |
-
</div>
|
72 |
-
</div>
|
73 |
-
<?php } ?>
|
74 |
-
</div>
|
75 |
-
<input type="hidden" name="apss_social_newtwork_order" id='apss_social_newtwork_order' value="<?php echo implode(',',array_keys($options['social_networks']));?>"/>
|
76 |
-
</div>
|
77 |
-
|
78 |
-
<div class="apss-tab-contents apss-share-options" id="tab-apss-share-options" style='display:none'>
|
79 |
-
<h2><?php _e('Share options:', APSS_TEXT_DOMAIN); ?> </h2>
|
80 |
-
<span class="social-text"><?php _e( 'Please choose the options where you want to display social share icons:', APSS_TEXT_DOMAIN ); ?></span>
|
81 |
-
<p><input type="checkbox" id="apss_posts" value="post" name="apss_share_settings[share_options][]" <?php if (in_array("post", $options['share_options']) || in_array("posts", $options['share_options'])) { echo "checked='checked'"; } ?> ><label for="apss_posts"><?php _e( 'Posts', APSS_TEXT_DOMAIN ); ?> </label></p>
|
82 |
-
<p><input type="checkbox" id="apss_pages" value="page" name="apss_share_settings[share_options][]" <?php if (in_array("page", $options['share_options']) || in_array("pages", $options['share_options'])) { echo "checked='checked'"; } ?> ><label for="apss_pages"><?php _e( 'Pages', APSS_TEXT_DOMAIN ); ?> </label></p>
|
83 |
-
|
84 |
-
<p><input type="checkbox" id="apss_front_page" value="front_page" name="apss_share_settings[share_options][]" <?php if (in_array("front_page", $options['share_options'])) { echo "checked='checked'"; } ?> ><label for="apss_front_page"><?php _e('Front Page', APSS_TEXT_DOMAIN ); ?></label></p>
|
85 |
-
<p><input type="checkbox" id="apss_archives" value="archives" name="apss_share_settings[share_options][]" <?php if (in_array("archives", $options['share_options'])) { echo "checked='checked'"; } ?> ><label for="apss_archives"><?php _e('Archives', APSS_TEXT_DOMAIN ); ?></label></p>
|
86 |
-
|
87 |
-
<p><input type="checkbox" id="apss_attachement" value="attachment" name="apss_share_settings[share_options][]" <?php if (in_array("attachment", $options['share_options'])) { echo "checked='checked'"; } ?> ><label for="apss_attachment"><?php _e('Attachment pages', APSS_TEXT_DOMAIN ); ?></label></p>
|
88 |
-
|
89 |
-
<p><input type="checkbox" id="apss_categories" value="categories" name="apss_share_settings[share_options][]" <?php if (in_array("categories", $options['share_options'])) { echo "checked='checked'"; } ?> ><label for="apss_categories"><?php _e('Categories', APSS_TEXT_DOMAIN ); ?></label></p>
|
90 |
-
<p><input type="checkbox" id="apss_all" value="all" name="apss_share_settings[share_options][]" <?php if (in_array("all", $options['share_options'])) { echo "checked='checked'"; } ?> ><label for="apss_all"><?php _e('Other (search results, etc)', APSS_TEXT_DOMAIN ); ?></label></p>
|
91 |
-
|
92 |
-
</div>
|
93 |
-
|
94 |
-
<div class="apss-tab-contents apss-display-settings" id="tab-apss-display-settings" style='display:none'>
|
95 |
-
<div class=' apss-display-positions'>
|
96 |
-
<h2><?php _e('Display position:', APSS_TEXT_DOMAIN); ?></h2>
|
97 |
-
<span class='social-text'><?php _e( 'Please choose the option where you want to display the social share:', APSS_TEXT_DOMAIN ); ?></span>
|
98 |
-
<p><input type="radio" id="apss_below_content" name="apss_share_settings[social_share_position_options]" value="below_content" <?php if($options['share_positions']=='below_content'){ echo "checked='checked'"; } ?> /><label for='apss_below_content'><?php _e( 'Below content', APSS_TEXT_DOMAIN ); ?></label></p>
|
99 |
-
<p><input type="radio" id="apss_above_content" name="apss_share_settings[social_share_position_options]"/ value="above_content" <?php if($options['share_positions']=='above_content'){ echo "checked='checked'"; } ?> /><label for='apss_above_content'><?php _e( 'Above content', APSS_TEXT_DOMAIN ); ?></label></p>
|
100 |
-
<p><input type="radio" id="apss_below_above_content" id="below_above_content" name="apss_share_settings[social_share_position_options]" value="on_both" <?php if($options['share_positions']=='on_both'){ echo "checked='checked'"; } ?> /><label for='apss_below_above_content'><?php _e( 'Both(Below content and Above content)', APSS_TEXT_DOMAIN ); ?></label></p>
|
101 |
</div>
|
102 |
-
<div class="
|
103 |
-
<
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
<div class="misc-opt"><input type="radio" id='disable_frontend_assets_n' name="apss_share_settings[disable_frontend_assets]" value="0" <?php if(isset($options['disable_frontend_assets']) && $options['disable_frontend_assets'] =='0'){ echo "checked='checked'"; } ?> /><label for="disable_frontend_assets_n"><?php _e( 'No', APSS_TEXT_DOMAIN ); ?></label></div>
|
118 |
-
<div class="misc-opt"><input type="radio" id='disable_frontend_assets_y' name="apss_share_settings[disable_frontend_assets]" value="1" <?php if(isset($options['disable_frontend_assets']) && $options['disable_frontend_assets'] =='1'){ echo "checked='checked'"; } ?> /><label for="disable_frontend_assets_y"><?php _e( 'Yes', APSS_TEXT_DOMAIN ); ?></label></div>
|
119 |
-
<br />
|
120 |
-
<div class="apss_notes_cache_settings">
|
121 |
-
<?php _e( 'Please set this value if you don\'t want to use plguins frontend assets(js and css files).', APSS_TEXT_DOMAIN ); ?>
|
122 |
-
</div>
|
123 |
-
</div>
|
124 |
-
<br />
|
125 |
-
<div class="apss-share-text-settings clearfix">
|
126 |
-
<?php _e( 'Share text:', APSS_TEXT_DOMAIN ); ?> <input type="text" name="apss_share_settings[share_text]" value="<?php if(isset($options['share_text'])){echo $options['share_text']; } ?>" />
|
127 |
-
<div class="apss_notes_cache_settings">
|
128 |
-
<?php _e( 'Please enter the share text to make it appear above social share icons. Leave blank if you don\'t want to use share text.', APSS_TEXT_DOMAIN ); ?>
|
129 |
</div>
|
130 |
</div>
|
131 |
-
<
|
132 |
-
|
133 |
-
<?php _e( 'Twitter username:', APSS_TEXT_DOMAIN ); ?> <input type="text" name="apss_share_settings[twitter_username]" value="<?php echo $options['twitter_username']; ?>" />
|
134 |
</div>
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
140 |
</div>
|
|
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
<
|
145 |
-
<div class="misc-opt"><input type="radio" id='total_counter_enable_options_y' name="apss_share_settings[total_counter_enable_options]" value="1" <?php if(isset($options['total_counter_enable_options']) && $options['total_counter_enable_options'] == '1'){ echo "checked='checked'"; } ?> /><label for="total_counter_enable_options_y"><?php _e( 'Yes', APSS_TEXT_DOMAIN ); ?></label></div>
|
146 |
-
</div>
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
</div>
|
184 |
-
<?php wp_nonce_field('apss_nonce_save_settings', 'apss_add_nonce_save_settings'); ?>
|
185 |
-
<input type="submit" class="submit_settings button primary-button" value="<?php _e('Save settings', APSS_TEXT_DOMAIN); ?>" name="apss_submit_settings" id="apss_submit_settings"/>
|
186 |
-
<?php
|
187 |
-
/**
|
188 |
-
* Nonce field
|
189 |
-
* */
|
190 |
-
wp_nonce_field( 'apss_settings_action', 'apss_settings_action' );
|
191 |
-
?>
|
192 |
-
<?php $nonce = wp_create_nonce( 'apss-restore-default-settings-nonce' ); ?>
|
193 |
-
<?php $nonce_clear = wp_create_nonce( 'apss-clear-cache-nonce' ); ?>
|
194 |
-
<a href="<?php echo admin_url().'admin-post.php?action=apss_restore_default_settings&_wpnonce='.$nonce;?>" onclick="return confirm('<?php _e( 'Are you sure you want to restore default settings?',APSS_TEXT_DOMAIN ); ?>')"><input type="button" value="Restore Default Settings" class="apss-reset-button button primary-button"/></a>
|
195 |
-
<a href="<?php echo admin_url().'admin-post.php?action=apss_clear_cache&_wpnonce='.$nonce_clear;?>" onclick="return confirm('<?php _e( 'Are you sure you want to clear cache share counter?',APSS_TEXT_DOMAIN ); ?>')"><input type="button" value="Clear Cache" class="apss-reset-button button primary-button"/></a>
|
196 |
-
</div>
|
197 |
-
</form>
|
198 |
-
</div>
|
199 |
</div>
|
200 |
<div class="apss-promoFloat">
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
<div class="clear"></div>
|
1 |
<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); ?>
|
2 |
<div class="apss-wrapper-block">
|
3 |
+
<div class="apss-setting-header clearfix">
|
4 |
+
<div class="apss-headerlogo">
|
5 |
+
<img src="<?php echo APSS_IMAGE_DIR; ?>/logo-old.png" alt="<?php esc_attr_e( 'AccessPress Social Share', APSS_TEXT_DOMAIN ); ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
</div>
|
7 |
+
<div class="apss-header-icons">
|
8 |
+
<p><?php _e( 'Follow us for new updates' ); ?></p>
|
9 |
+
<div class="apss-social-bttns">
|
10 |
+
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FAccessPress-Themes%2F1396595907277967&width&layout=button&action=like&show_faces=false&share=false&height=35&appId=1411139805828592" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:20px; width:50px " allowtransparency="true"></iframe>
|
11 |
+
|
12 |
+
<iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/follow_button.5f46501ecfda1c3e1c05dd3e24875611.en.html#_=1421918256492&dnt=true&id=twitter-widget-0&lang=en&screen_name=apthemes&show_count=false&show_screen_name=true&size=m" class="twitter-follow-button twitter-follow-button" title="Twitter Follow Button" data-twttr-rendered="true" style="width: 126px; height: 20px;"></iframe>
|
13 |
+
<script>!function (d, s, id) {
|
14 |
+
var js, fjs = d.getElementsByTagName(s)[0];
|
15 |
+
if (!d.getElementById(id)) {
|
16 |
+
js = d.createElement(s);
|
17 |
+
js.id = id;
|
18 |
+
js.src = "//platform.twitter.com/widgets.js";
|
19 |
+
fjs.parentNode.insertBefore(js, fjs);
|
20 |
+
}
|
21 |
+
}(document, "script", "twitter-wjs");</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
</div>
|
23 |
</div>
|
24 |
+
<div class="apss-header-title">
|
25 |
+
<?php _e( 'AccessPress Social Share', APSS_TEXT_DOMAIN ); ?>
|
|
|
26 |
</div>
|
27 |
+
</div>
|
28 |
+
<?php $options = get_option( APSS_SETTING_NAME );
|
29 |
+
if ( isset( $_SESSION['apss_message'] ) ) {
|
30 |
+
?>
|
31 |
+
<div class="apss-message">
|
32 |
+
<p><?php
|
33 |
+
echo $_SESSION['apss_message'];
|
34 |
+
unset( $_SESSION['apss_message'] );
|
35 |
+
?></p>
|
36 |
</div>
|
37 |
+
<?php } ?>
|
38 |
|
39 |
+
<div class="apps-wrap">
|
40 |
+
<form method="post" action="<?php echo admin_url() . 'admin-post.php' ?>">
|
41 |
+
<input type="hidden" name="action" value="apss_save_options"/>
|
|
|
|
|
42 |
|
43 |
+
<ul class="apss-setting-tabs clearfix">
|
44 |
+
<li><a href="javascript:void(0)" id="apss-social-networks" class="apss-tabs-trigger apss-active-tab "><?php _e( 'Social Networks', APSS_TEXT_DOMAIN ); ?></a></li>
|
45 |
+
<li><a href="javascript:void(0)" id="apss-share-options" class="apss-tabs-trigger "><?php _e( 'Share Options', APSS_TEXT_DOMAIN ) ?></a></li>
|
46 |
+
<li><a href="javascript:void(0)" id="apss-display-settings" class="apss-tabs-trigger"><?php _e( 'Display Settings', APSS_TEXT_DOMAIN ); ?></a></li>
|
47 |
+
<li><a href="javascript:void(0)" id="apss-miscellaneous" class="apss-tabs-trigger"><?php _e( 'Miscellaneous', APSS_TEXT_DOMAIN ); ?></a></li>
|
48 |
+
<li><a href="javascript:void(0)" id="apss-how-to-use" class="apss-tabs-trigger"><?php _e( 'How To Use', APSS_TEXT_DOMAIN ); ?></a></li>
|
49 |
+
<li><a href="javascript:void(0)" id="apss-about" class="apss-tabs-trigger"><?php _e( 'About', APSS_TEXT_DOMAIN ); ?></a></li>
|
50 |
+
</ul>
|
51 |
+
<div class="apss-wrapper">
|
52 |
+
<div class="apss-tab-contents apss-social-networks" id="tab-apss-social-networks" style='display:block'>
|
53 |
+
<h2><?php _e( 'Social Media chooser:', APSS_TEXT_DOMAIN ); ?> </h2>
|
54 |
+
<span class="social-text"><?php _e( 'Please choose the social media you want to display. Also you can order these social media\'s by drag and drop:', APSS_TEXT_DOMAIN ); ?></span>
|
55 |
+
<div class="apps-opt-wrap clearfix">
|
56 |
+
<?php
|
57 |
+
$label_array = array(
|
58 |
+
'facebook' => ' <span class="media-icon"><i class="fa fa-facebook"></i></span> Facebook',
|
59 |
+
'twitter' => ' <span class="media-icon"><i class="fa fa-twitter"></i></span> Twitter',
|
60 |
+
'google-plus' => '<span class="media-icon"><i class="fa fa-google-plus"></i></span> Google Plus',
|
61 |
+
'pinterest' => '<span class="media-icon"> <i class="fa fa-pinterest"></i> </span>Pinterest',
|
62 |
+
'linkedin' => '<span class="media-icon"><i class="fa fa-linkedin"></i></span> Linkedin',
|
63 |
+
'digg' => '<span class="media-icon"><i class="fa fa-digg"></i></span> Digg',
|
64 |
+
'email' => '<span class="media-icon"><i class="fa fa-envelope"></i></span> Email',
|
65 |
+
'print' => '<span class="media-icon"><i class="fa fa-print"></i> </span>Print',
|
66 |
+
);
|
67 |
+
?>
|
68 |
+
<?php foreach ( $options['social_networks'] as $key => $val ) {
|
69 |
+
?>
|
70 |
+
<div class="apss-option-wrapper">
|
71 |
+
<div class="apss-option-field">
|
72 |
+
<label class="clearfix"><span class="left-icon"><i class="fa fa-arrows"></i></span><span class="social-name"><?php echo $label_array[$key]; ?></span><input type="checkbox" data-key='<?php echo $key; ?>' name="social_networks[<?php echo $key; ?>]" value="1" <?php if ( $val == '1' ) {
|
73 |
+
echo "checked='checked'";
|
74 |
+
} ?> /></label>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<?php } ?>
|
78 |
+
</div>
|
79 |
+
<input type="hidden" name="apss_social_newtwork_order" id='apss_social_newtwork_order' value="<?php echo implode( ',', array_keys( $options['social_networks'] ) ); ?>"/>
|
80 |
+
</div>
|
81 |
|
82 |
+
<div class="apss-tab-contents apss-share-options" id="tab-apss-share-options" style='display:none'>
|
83 |
+
<h2><?php _e( 'Share options:', APSS_TEXT_DOMAIN ); ?> </h2>
|
84 |
+
<span class="social-text"><?php _e( 'Please choose the options where you want to display social share icons:', APSS_TEXT_DOMAIN ); ?></span>
|
85 |
+
<p><input type="checkbox" id="apss_posts" value="post" name="apss_share_settings[share_options][]" <?php if ( in_array( "post", $options['share_options'] ) || in_array( "posts", $options['share_options'] ) ) {
|
86 |
+
echo "checked='checked'";
|
87 |
+
} ?> ><label for="apss_posts"><?php _e( 'Posts', APSS_TEXT_DOMAIN ); ?> </label></p>
|
88 |
+
<p><input type="checkbox" id="apss_pages" value="page" name="apss_share_settings[share_options][]" <?php if ( in_array( "page", $options['share_options'] ) || in_array( "pages", $options['share_options'] ) ) {
|
89 |
+
echo "checked='checked'";
|
90 |
+
} ?> ><label for="apss_pages"><?php _e( 'Pages', APSS_TEXT_DOMAIN ); ?> </label></p>
|
91 |
|
92 |
+
<p><input type="checkbox" id="apss_front_page" value="front_page" name="apss_share_settings[share_options][]" <?php if ( in_array( "front_page", $options['share_options'] ) ) {
|
93 |
+
echo "checked='checked'";
|
94 |
+
} ?> ><label for="apss_front_page"><?php _e( 'Front Page', APSS_TEXT_DOMAIN ); ?></label></p>
|
95 |
+
<p><input type="checkbox" id="apss_archives" value="archives" name="apss_share_settings[share_options][]" <?php if ( in_array( "archives", $options['share_options'] ) ) {
|
96 |
+
echo "checked='checked'";
|
97 |
+
} ?> ><label for="apss_archives"><?php _e( 'Archives', APSS_TEXT_DOMAIN ); ?></label></p>
|
98 |
+
|
99 |
+
<p><input type="checkbox" id="apss_attachement" value="attachment" name="apss_share_settings[share_options][]" <?php if ( in_array( "attachment", $options['share_options'] ) ) {
|
100 |
+
echo "checked='checked'";
|
101 |
+
} ?> ><label for="apss_attachment"><?php _e( 'Attachment pages', APSS_TEXT_DOMAIN ); ?></label></p>
|
102 |
+
|
103 |
+
<p><input type="checkbox" id="apss_categories" value="categories" name="apss_share_settings[share_options][]" <?php if ( in_array( "categories", $options['share_options'] ) ) {
|
104 |
+
echo "checked='checked'";
|
105 |
+
} ?> ><label for="apss_categories"><?php _e( 'Categories', APSS_TEXT_DOMAIN ); ?></label></p>
|
106 |
+
<p><input type="checkbox" id="apss_all" value="all" name="apss_share_settings[share_options][]" <?php if ( in_array( "all", $options['share_options'] ) ) {
|
107 |
+
echo "checked='checked'";
|
108 |
+
} ?> ><label for="apss_all"><?php _e( 'Other (search results, etc)', APSS_TEXT_DOMAIN ); ?></label></p>
|
109 |
+
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<div class="apss-tab-contents apss-display-settings" id="tab-apss-display-settings" style='display:none'>
|
113 |
+
<div class=' apss-display-positions'>
|
114 |
+
<h2><?php _e( 'Display position:', APSS_TEXT_DOMAIN ); ?></h2>
|
115 |
+
<span class='social-text'><?php _e( 'Please choose the option where you want to display the social share:', APSS_TEXT_DOMAIN ); ?></span>
|
116 |
+
<p><input type="radio" id="apss_below_content" name="apss_share_settings[social_share_position_options]" value="below_content" <?php if ( $options['share_positions'] == 'below_content' ) {
|
117 |
+
echo "checked='checked'";
|
118 |
+
} ?> /><label for='apss_below_content'><?php _e( 'Below content', APSS_TEXT_DOMAIN ); ?></label></p>
|
119 |
+
<p><input type="radio" id="apss_above_content" name="apss_share_settings[social_share_position_options]"/ value="above_content" <?php if ( $options['share_positions'] == 'above_content' ) {
|
120 |
+
echo "checked='checked'";
|
121 |
+
} ?> /><label for='apss_above_content'><?php _e( 'Above content', APSS_TEXT_DOMAIN ); ?></label></p>
|
122 |
+
<p><input type="radio" id="apss_below_above_content" id="below_above_content" name="apss_share_settings[social_share_position_options]" value="on_both" <?php if ( $options['share_positions'] == 'on_both' ) {
|
123 |
+
echo "checked='checked'";
|
124 |
+
} ?> /><label for='apss_below_above_content'><?php _e( 'Both(Below content and Above content)', APSS_TEXT_DOMAIN ); ?></label></p>
|
125 |
+
</div>
|
126 |
+
<div class=" apss-icon-sets">
|
127 |
+
<h2><?php _e( 'Social icons sets: ', APSS_TEXT_DOMAIN ); ?> </h2>
|
128 |
+
<?php _e( 'Please choose any one out of available icon themes:', APSS_TEXT_DOMAIN ); ?>
|
129 |
+
<?php for ( $i = 1; $i <= 6; $i++ ) { ?>
|
130 |
+
<p><input id="apss_icon_set_<?php echo $i; ?>" value="<?php echo $i; ?>" name="apss_share_settings[social_icon_set]" type="radio" <?php if ( $options['social_icon_set'] == $i ) {
|
131 |
+
echo "checked='checked'";
|
132 |
+
} ?> ><label for="apss_icon_set_<?php echo $i; ?>"><span class="apss_demo_icon apss_demo_icons_<?php echo $i; ?>"></span><?php _e( "Theme $i", APSS_TEXT_DOMAIN ); ?><div class="apss-theme-image"><img src='<?php echo APSS_IMAGE_DIR . "/theme/theme$i.jpg"; ?>'/></div></label></p>
|
133 |
+
<?php } ?>
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
|
137 |
+
<div class="apss-tab-contents apss-miscellaneous" id="tab-apss-miscellaneous" style='display:none'>
|
138 |
+
<h2><?php _e( 'Miscellaneous settings: ', APSS_TEXT_DOMAIN ); ?> </h2>
|
139 |
+
<h4><?php _e( 'Please setup these additional settings:', APSS_TEXT_DOMAIN ); ?></h4>
|
140 |
+
|
141 |
+
<div class="apss-share-text-settings clearfix">
|
142 |
+
<h4><?php _e( 'Disable the plugins frontend assets?', APSS_TEXT_DOMAIN ); ?> </h4>
|
143 |
+
<div class="misc-opt"><input type="radio" id='disable_frontend_assets_n' name="apss_share_settings[disable_frontend_assets]" value="0" <?php if ( isset( $options['disable_frontend_assets'] ) && $options['disable_frontend_assets'] == '0' ) {
|
144 |
+
echo "checked='checked'";
|
145 |
+
} ?> /><label for="disable_frontend_assets_n"><?php _e( 'No', APSS_TEXT_DOMAIN ); ?></label></div>
|
146 |
+
<div class="misc-opt"><input type="radio" id='disable_frontend_assets_y' name="apss_share_settings[disable_frontend_assets]" value="1" <?php if ( isset( $options['disable_frontend_assets'] ) && $options['disable_frontend_assets'] == '1' ) {
|
147 |
+
echo "checked='checked'";
|
148 |
+
} ?> /><label for="disable_frontend_assets_y"><?php _e( 'Yes', APSS_TEXT_DOMAIN ); ?></label></div>
|
149 |
+
<br />
|
150 |
+
<div class="apss_notes_cache_settings">
|
151 |
+
<?php _e( 'Please set this value if you don\'t want to use plguins frontend assets(js and css files).', APSS_TEXT_DOMAIN ); ?>
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
<br />
|
155 |
+
<div class="apss-share-text-settings clearfix">
|
156 |
+
<?php _e( 'Share text:', APSS_TEXT_DOMAIN ); ?> <input type="text" name="apss_share_settings[share_text]" value="<?php if ( isset( $options['share_text'] ) ) {
|
157 |
+
echo $options['share_text'];
|
158 |
+
} ?>" />
|
159 |
+
<div class="apss_notes_cache_settings">
|
160 |
+
<?php _e( 'Please enter the share text to make it appear above social share icons. Leave blank if you don\'t want to use share text.', APSS_TEXT_DOMAIN ); ?>
|
161 |
+
</div>
|
162 |
+
</div>
|
163 |
+
<br />
|
164 |
+
<div class="apss-twitter-settings clearfix">
|
165 |
+
<?php _e( 'Twitter username:', APSS_TEXT_DOMAIN ); ?> <input type="text" name="apss_share_settings[twitter_username]" value="<?php echo $options['twitter_username']; ?>" />
|
166 |
+
</div>
|
167 |
|
168 |
+
<div class="apss-counter-settings clearfix">
|
169 |
+
<h4><?php _e( 'Social share counter enable?', APSS_TEXT_DOMAIN ); ?> </h4>
|
170 |
+
<div class="misc-opt"><input type="radio" id='counter_enable_options_n' name="apss_share_settings[counter_enable_options]" value="0" <?php if ( $options['counter_enable_options'] == '0' ) {
|
171 |
+
echo "checked='checked'";
|
172 |
+
} ?> /><label for="counter_enable_options_n"><?php _e( 'No', APSS_TEXT_DOMAIN ); ?></label></div>
|
173 |
+
<div class="misc-opt"><input type="radio" id='counter_enable_options_y' name="apss_share_settings[counter_enable_options]" value="1" <?php if ( $options['counter_enable_options'] == '1' ) {
|
174 |
+
echo "checked='checked'";
|
175 |
+
} ?> /><label for="counter_enable_options_y"><?php _e( 'Yes', APSS_TEXT_DOMAIN ); ?></label></div>
|
176 |
+
</div>
|
177 |
+
|
178 |
+
<div class="apss-total-counter-settings clearfix">
|
179 |
+
<h4><?php _e( 'Social share total counter enable?', APSS_TEXT_DOMAIN ); ?> </h4>
|
180 |
+
<div class="misc-opt"><input type="radio" id='total_counter_enable_options_n' name="apss_share_settings[total_counter_enable_options]" value="0" <?php if ( isset( $options['total_counter_enable_options'] ) && $options['total_counter_enable_options'] == '0' ) {
|
181 |
+
echo "checked='checked'";
|
182 |
+
} ?> /><label for="total_counter_enable_options_n"><?php _e( 'No', APSS_TEXT_DOMAIN ); ?></label></div>
|
183 |
+
<div class="misc-opt"><input type="radio" id='total_counter_enable_options_y' name="apss_share_settings[total_counter_enable_options]" value="1" <?php if ( isset( $options['total_counter_enable_options'] ) && $options['total_counter_enable_options'] == '1' ) {
|
184 |
+
echo "checked='checked'";
|
185 |
+
} ?> /><label for="total_counter_enable_options_y"><?php _e( 'Yes', APSS_TEXT_DOMAIN ); ?></label></div>
|
186 |
+
</div>
|
187 |
+
|
188 |
+
<div class="apss-dialog-boxs clearfix">
|
189 |
+
<h4><?php _e( 'Social share link options:', APSS_TEXT_DOMAIN ); ?> </h4>
|
190 |
+
<div class="misc-opt"><input type="radio" id='dialog_box_options_1' name="apss_share_settings[dialog_box_options]" value="0" <?php if ( $options['dialog_box_options'] == '0' ) {
|
191 |
+
echo "checked='checked'";
|
192 |
+
} ?> /><label for="dialog_box_options_1"><?php _e( 'Open in same window', APSS_TEXT_DOMAIN ); ?></label></div>
|
193 |
+
<div class="misc-opt"><input type="radio" id='dialog_box_options_2' name="apss_share_settings[dialog_box_options]" value="1" <?php if ( $options['dialog_box_options'] == '1' ) {
|
194 |
+
echo "checked='checked'";
|
195 |
+
} ?> /><label for="dialog_box_options_2"><?php _e( 'Open in new window/Tab', APSS_TEXT_DOMAIN ); ?></label></div>
|
196 |
+
</div>
|
197 |
+
|
198 |
+
<div class='cache-settings'>
|
199 |
+
<h4><?php _e( 'Cache Settings: ', APSS_TEXT_DOMAIN ); ?> </h4>
|
200 |
+
<label for="apss_cache_settings"><?php _e( 'Cache Period:', APSS_TEXT_DOMAIN ); ?></label>
|
201 |
+
<input type='text' id="apss_cache_period" name='apss_share_settings[cache_settings]' value="<?php if ( isset( $options['cache_period'] ) ) {
|
202 |
+
echo $options['cache_period'];
|
203 |
+
} ?>" onkeyup="removeMe('invalid_cache_period');"/>
|
204 |
+
<span class="error invalid_cache_period"></span>
|
205 |
+
<div class="apss_notes_cache_settings">
|
206 |
+
<?php _e( 'Please enter the time in hours in which the social share counter should be updated from social networks. Default is 24 hours.', APSS_TEXT_DOMAIN ); ?>
|
207 |
+
</div>
|
208 |
+
</div>
|
209 |
+
|
210 |
+
<div class="apss-email-settings">
|
211 |
+
<h4><?php _e( 'Email Settings:', APSS_TEXT_DOMAIN ); ?></h4>
|
212 |
+
<div class="app-email-sub email-setg">
|
213 |
+
<label for='apss-email-subject'><?php _e( 'Email subject:', APSS_TEXT_DOMAIN ); ?></label>
|
214 |
+
<input type='text' name="apss_share_settings[apss_email_subject]" value="<?php echo $options['apss_email_subject'] ?>" />
|
215 |
+
</div>
|
216 |
+
<div class="app-email-body email-setg">
|
217 |
+
<label for='apss-email-body'><?php _e( 'Email body:', APSS_TEXT_DOMAIN ); ?></label>
|
218 |
+
<textarea rows='30' cols='30' name="apss_share_settings[apss_email_body]"><?php echo $options['apss_email_body'] ?></textarea>
|
219 |
+
</div>
|
220 |
+
</div>
|
221 |
+
</div>
|
222 |
+
<div class="apss-tab-contents apss-how-to-use" id="tab-apss-how-to-use" style='display:none' >
|
223 |
+
<?php include_once('how-to-use.php'); ?>
|
224 |
+
</div>
|
225 |
+
|
226 |
+
<div class="apss-tab-contents apss-about" id="tab-apss-about" style='display:none' >
|
227 |
+
<?php include('about-apss.php'); ?>
|
228 |
+
|
229 |
+
</div>
|
230 |
+
<?php wp_nonce_field( 'apss_nonce_save_settings', 'apss_add_nonce_save_settings' ); ?>
|
231 |
+
<input type="submit" class="submit_settings button primary-button" value="<?php _e( 'Save settings', APSS_TEXT_DOMAIN ); ?>" name="apss_submit_settings" id="apss_submit_settings"/>
|
232 |
+
<?php
|
233 |
+
/**
|
234 |
+
* Nonce field
|
235 |
+
* */
|
236 |
+
wp_nonce_field( 'apss_settings_action', 'apss_settings_action' );
|
237 |
+
?>
|
238 |
+
<?php $nonce = wp_create_nonce( 'apss-restore-default-settings-nonce' ); ?>
|
239 |
+
<?php $nonce_clear = wp_create_nonce( 'apss-clear-cache-nonce' ); ?>
|
240 |
+
<a href="<?php echo admin_url() . 'admin-post.php?action=apss_restore_default_settings&_wpnonce=' . $nonce; ?>" onclick="return confirm('<?php _e( 'Are you sure you want to restore default settings?', APSS_TEXT_DOMAIN ); ?>')"><input type="button" value="Restore Default Settings" class="apss-reset-button button primary-button"/></a>
|
241 |
+
<a href="<?php echo admin_url() . 'admin-post.php?action=apss_clear_cache&_wpnonce=' . $nonce_clear; ?>" onclick="return confirm('<?php _e( 'Are you sure you want to clear cache share counter?', APSS_TEXT_DOMAIN ); ?>')"><input type="button" value="Clear Cache" class="apss-reset-button button primary-button"/></a>
|
242 |
+
</div>
|
243 |
+
</form>
|
244 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
</div>
|
246 |
<div class="apss-promoFloat">
|
247 |
+
<a href='https://accesspressthemes.com/wordpress-plugins/accesspress-social-pro/' target='_blank'><img src="<?php echo APSS_IMAGE_DIR . '/promo-top.png' ?>" alt="promo-top" /></a>
|
248 |
+
<div class="apss-promo-buttons"><a target='_blank' href="http://accesspressthemes.com/demo/wordpress-plugins/accesspress-social-pro" /><img src="<?php echo APSS_IMAGE_DIR . '/demo-btn.png' ?>" alt="demo link" /></a><a target='_blank' href="http://codecanyon.net/item/accesspress-social-pro/10429645?ref=AccessKeys" ><img src="<?php echo APSS_IMAGE_DIR . '/upgrade-btn.png' ?>" alt="upgrade link" /></a></div>
|
249 |
+
<a href='https://accesspressthemes.com/wordpress-plugins/accesspress-social-pro/' target='_blank'><img src="<?php echo APSS_IMAGE_DIR . '/promo-bottom.png' ?>" alt="promo-bottom" /></a>
|
250 |
+
<div class="apss-promo-buttons"><a target='_blank' href="http://accesspressthemes.com/demo/wordpress-plugins/accesspress-social-pro" /><img src="<?php echo APSS_IMAGE_DIR . '/demo-btn.png' ?>" alt="demo link" /></a><a target='_blank' href="http://codecanyon.net/item/accesspress-social-pro/10429645?ref=AccessKeys" ><img src="<?php echo APSS_IMAGE_DIR . '/upgrade-btn.png' ?>" alt="upgrade link" /></a></div>
|
251 |
+
</div>
|
252 |
<div class="clear"></div>
|
inc/backend/save-settings.php
CHANGED
@@ -1,42 +1,41 @@
|
|
1 |
<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); ?>
|
2 |
<?php
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
}
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
1 |
<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); ?>
|
2 |
<?php
|
3 |
+
$apss_share_settings = array();
|
4 |
+
$share_options = array();
|
5 |
+
if ( isset( $_POST['apss_share_settings']['share_options'] ) ) {
|
6 |
+
foreach ( $_POST['apss_share_settings']['share_options'] as $key => $value ) {
|
7 |
+
$share_options[] = $value;
|
8 |
+
}
|
9 |
+
}
|
10 |
|
11 |
+
$apss_share_settings['share_options'] = $share_options;
|
12 |
+
$apss_share_settings['social_icon_set'] = $_POST['apss_share_settings']['social_icon_set'];
|
13 |
+
$apss_share_settings['share_positions'] = $_POST['apss_share_settings']['social_share_position_options'];
|
14 |
|
15 |
+
$apss_social_newtwork_order = explode( ',', $_POST['apss_social_newtwork_order'] );
|
16 |
+
$social_network_array = array();
|
17 |
+
foreach ( $apss_social_newtwork_order as $social_network ) {
|
18 |
+
$social_network_array[$social_network] = (isset( $_POST['social_networks'][$social_network] )) ? 1 : 0;
|
19 |
+
}
|
|
|
20 |
|
21 |
+
$apss_share_settings['social_networks'] = $social_network_array;
|
22 |
+
$apss_share_settings['disable_frontend_assets'] = isset( $_POST['apss_share_settings']['disable_frontend_assets'] ) ? $_POST['apss_share_settings']['disable_frontend_assets'] : '0';
|
23 |
+
$apss_share_settings['share_text'] = $_POST['apss_share_settings']['share_text'];
|
24 |
+
$apss_share_settings['twitter_username'] = stripslashes_deep( $_POST['apss_share_settings']['twitter_username'] );
|
25 |
+
$apss_share_settings['counter_enable_options'] = $_POST['apss_share_settings']['counter_enable_options'];
|
26 |
+
$apss_share_settings['total_counter_enable_options'] = $_POST['apss_share_settings']['total_counter_enable_options'];
|
27 |
+
$apss_share_settings['cache_period'] = is_numeric( $_POST['apss_share_settings']['cache_settings'] ) ? $_POST['apss_share_settings']['cache_settings'] : '24';
|
28 |
+
$apss_share_settings['dialog_box_options'] = $_POST['apss_share_settings']['dialog_box_options'];
|
29 |
+
$apss_share_settings['footer_javascript'] = $_POST['apss_share_settings']['footer_javascript'];
|
30 |
+
$apss_share_settings['apss_email_subject'] = stripslashes_deep( $_POST['apss_share_settings']['apss_email_subject'] );
|
31 |
+
$apss_share_settings['apss_email_body'] = stripslashes_deep( $_POST['apss_share_settings']['apss_email_body'] );
|
32 |
+
if ( !isset( $apss_share_settings['apss_social_counts_transients'] ) ) {
|
33 |
+
$apss_share_settings['apss_social_counts_transients'] = array();
|
34 |
+
}
|
35 |
|
36 |
+
// The option already exists, so we just update it.
|
37 |
+
update_option( APSS_SETTING_NAME, $apss_share_settings );
|
38 |
+
$_SESSION['apss_message'] = __( 'Settings Saved Successfully.', APSS_TEXT_DOMAIN );
|
39 |
+
wp_redirect( admin_url() . 'admin.php?page=apss-share' );
|
40 |
+
exit;
|
41 |
|
inc/frontend/content-filter.php
CHANGED
@@ -1,199 +1,197 @@
|
|
1 |
-
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
<?php
|
3 |
-
$apss_link_open_option=($options['dialog_box_options']=='1') ? "_blank": "";
|
4 |
-
$twitter_user
|
5 |
-
$counter_enable_options
|
6 |
-
$icon_set_value
|
7 |
-
$url =
|
8 |
-
$cache_period = ($options['cache_period'] != '') ? $options['cache_period']*60*60 : 24 * 60 * 60
|
9 |
-
|
10 |
-
if(isset($options['total_counter_enable_options'])){
|
11 |
-
if($options['total_counter_enable_options'] =='1'){
|
12 |
$enable_counter = 1;
|
13 |
}
|
14 |
-
}else{
|
15 |
$enable_counter = 0;
|
16 |
}
|
17 |
-
|
18 |
?>
|
19 |
|
20 |
|
21 |
-
<?php if( isset( $options['share_text'] ) && $options['share_text'] !='' ){ ?> <div class='apss-share-text'><?php echo $options['share_text']; ?></div> <?php } ?>
|
22 |
|
23 |
<?php
|
24 |
$total_count = 0;
|
25 |
|
26 |
-
foreach( $options['social_networks'] as $key
|
27 |
-
if( intval($value)=='1' ){
|
28 |
-
$count = $this->get_count($key, $url);
|
29 |
$total_count += $count;
|
30 |
-
switch( $key ){
|
31 |
//counter available for facebook
|
32 |
case 'facebook':
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
<a rel='nofollow' title="<?php _e('Share on Facebook', APSS_TEXT_DOMAIN ); ?>" target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
</a>
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
//counter available for twitter
|
52 |
case 'twitter':
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
|
75 |
//counter available for google plus
|
76 |
case 'google-plus':
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
//counter available for pinterest
|
96 |
case 'pinterest':
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
//couter available for linkedin
|
117 |
case 'linkedin':
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
127 |
</div>
|
128 |
-
<?php
|
129 |
-
|
130 |
-
<?php } ?>
|
131 |
-
</a>
|
132 |
-
</div>
|
133 |
-
<?php
|
134 |
-
break;
|
135 |
|
136 |
//there is no counter available for digg
|
137 |
case 'digg':
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
|
|
146 |
</div>
|
147 |
-
</a>
|
148 |
-
</div>
|
149 |
|
150 |
-
|
151 |
-
|
152 |
|
153 |
case 'email':
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
</
|
169 |
-
</
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
break;
|
174 |
|
175 |
case 'print':
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
}
|
190 |
-
|
191 |
}
|
192 |
-
if( isset($enable_counter) && $enable_counter == '1' ){
|
193 |
-
?>
|
194 |
-
<div class='apss-total-share-count'>
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
</div>
|
199 |
-
<?php
|
|
1 |
+
<?php defined( 'ABSPATH' ) or die( "No script kiddies please!" ); ?>
|
2 |
<?php
|
3 |
+
$apss_link_open_option = ($options['dialog_box_options'] == '1') ? "_blank" : "";
|
4 |
+
$twitter_user = $options['twitter_username'];
|
5 |
+
$counter_enable_options = $options['counter_enable_options'];
|
6 |
+
$icon_set_value = $options['social_icon_set'];
|
7 |
+
$url = get_permalink(); //$this->curPageURL();
|
8 |
+
$cache_period = ($options['cache_period'] != '') ? $options['cache_period'] * 60 * 60 : 24 * 60 * 60;
|
9 |
+
|
10 |
+
if ( isset( $options['total_counter_enable_options'] ) ) {
|
11 |
+
if ( $options['total_counter_enable_options'] == '1' ) {
|
12 |
$enable_counter = 1;
|
13 |
}
|
14 |
+
} else {
|
15 |
$enable_counter = 0;
|
16 |
}
|
|
|
17 |
?>
|
18 |
|
19 |
|
20 |
+
<?php if ( isset( $options['share_text'] ) && $options['share_text'] != '' ) { ?> <div class='apss-share-text'><?php echo $options['share_text']; ?></div> <?php } ?>
|
21 |
|
22 |
<?php
|
23 |
$total_count = 0;
|
24 |
|
25 |
+
foreach ( $options['social_networks'] as $key => $value ) {
|
26 |
+
if ( intval( $value ) == '1' ) {
|
27 |
+
$count = $this->get_count( $key, $url );
|
28 |
$total_count += $count;
|
29 |
+
switch ( $key ) {
|
30 |
//counter available for facebook
|
31 |
case 'facebook':
|
32 |
+
$link = 'https://www.facebook.com/sharer/sharer.php?u=' . $url;
|
33 |
+
$count = $this->get_count( $key, $url );
|
34 |
+
?>
|
35 |
+
<div class='apss-facebook apss-single-icon'>
|
36 |
+
<a rel='nofollow' title="<?php _e( 'Share on Facebook', APSS_TEXT_DOMAIN ); ?>" target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
37 |
+
<div class='apss-icon-block clearfix'>
|
38 |
+
<i class='fa fa-facebook'></i>
|
39 |
+
<span class='apss-social-text'><?php _e( 'Share on Facebook', APSS_TEXT_DOMAIN ); ?></span>
|
40 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
41 |
+
</div>
|
42 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
43 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
44 |
+
<?php } ?>
|
45 |
</a>
|
46 |
+
</div>
|
47 |
+
<?php
|
48 |
+
break;
|
49 |
|
50 |
//counter available for twitter
|
51 |
case 'twitter':
|
52 |
+
$url_twitter = $url;
|
53 |
+
$url_twitter = urlencode( $url_twitter );
|
54 |
+
if ( isset( $twitter_user ) && $twitter_user != '' ) {
|
55 |
+
$twitter_user = 'via=' . $twitter_user;
|
56 |
+
}
|
57 |
+
$link = "https://twitter.com/intent/tweet?text=$title&url=$url_twitter&$twitter_user";
|
58 |
+
$count = $this->get_count( $key, $url );
|
59 |
+
?>
|
60 |
+
<div class='apss-twitter apss-single-icon'>
|
61 |
+
<a rel='nofollow' title="<?php _e( 'Share on Twitter', APSS_TEXT_DOMAIN ); ?>" target='<?php echo $apss_link_open_option; ?>' href="<?php echo $link; ?>">
|
62 |
+
<div class='apss-icon-block clearfix'>
|
63 |
+
<i class='fa fa-twitter'></i>
|
64 |
+
<span class='apss-social-text'><?php _e( 'Share on Twitter', APSS_TEXT_DOMAIN ); ?></span><span class='apss-share'><?php _e( 'Tweet', APSS_TEXT_DOMAIN ); ?></span>
|
65 |
+
</div>
|
66 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
67 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
68 |
+
<?php } ?>
|
69 |
+
</a>
|
70 |
+
</div>
|
71 |
+
<?php
|
72 |
+
break;
|
73 |
|
74 |
//counter available for google plus
|
75 |
case 'google-plus':
|
76 |
+
$link = 'https://plus.google.com/share?url=' . $url;
|
77 |
+
$count = $this->get_count( $key, $url );
|
78 |
+
?>
|
79 |
+
<div class='apss-google-plus apss-single-icon'>
|
80 |
+
<a rel='nofollow' title="<?php _e( 'Share on Google Plus', APSS_TEXT_DOMAIN ); ?>" target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
81 |
+
<div class='apss-icon-block clearfix'>
|
82 |
+
<i class='fa fa-google-plus'></i>
|
83 |
+
<span class='apss-social-text'><?php _e( 'Share on Google Plus', APSS_TEXT_DOMAIN ); ?></span>
|
84 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
85 |
+
</div>
|
86 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
87 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
88 |
+
<?php } ?>
|
89 |
+
</a>
|
90 |
+
</div>
|
91 |
+
<?php
|
92 |
+
break;
|
93 |
+
|
94 |
//counter available for pinterest
|
95 |
case 'pinterest':
|
96 |
+
$count = $this->get_count( $key, $url );
|
97 |
+
?>
|
98 |
+
|
99 |
+
<div class='apss-pinterest apss-single-icon'>
|
100 |
+
<a rel='nofollow' title="<?php _e( 'Share on Pinterest', APSS_TEXT_DOMAIN ); ?>" href='javascript:pinIt();'>
|
101 |
+
<div class='apss-icon-block clearfix'>
|
102 |
+
<i class='fa fa-pinterest'></i>
|
103 |
+
<span class='apss-social-text'><?php _e( 'Share on Pinterest', APSS_TEXT_DOMAIN ); ?></span>
|
104 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
105 |
+
</div>
|
106 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
107 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
108 |
+
<?php } ?>
|
109 |
+
|
110 |
+
</a>
|
111 |
+
</div>
|
112 |
+
<?php
|
113 |
+
break;
|
114 |
+
|
115 |
//couter available for linkedin
|
116 |
case 'linkedin':
|
117 |
+
$link = "http://www.linkedin.com/shareArticle?mini=true&title=" . $title . "&url=" . $url . "&summary=" . $excerpt;
|
118 |
+
$count = $this->get_count( $key, $url );
|
119 |
+
?>
|
120 |
+
|
121 |
+
<div class='apss-linkedin apss-single-icon'>
|
122 |
+
<a rel='nofollow' title="<?php _e( 'Share on LinkedIn', APSS_TEXT_DOMAIN ); ?>" target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
123 |
+
<div class='apss-icon-block clearfix'><i class='fa fa-linkedin'></i>
|
124 |
+
<span class='apss-social-text'><?php _e( 'Share on LinkedIn', APSS_TEXT_DOMAIN ); ?></span>
|
125 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
126 |
+
</div>
|
127 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
128 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
129 |
+
<?php } ?>
|
130 |
+
</a>
|
131 |
</div>
|
132 |
+
<?php
|
133 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
//there is no counter available for digg
|
136 |
case 'digg':
|
137 |
+
$link = "http://digg.com/submit?phase=2%20&url=" . $url . "&title=" . $title;
|
138 |
+
?>
|
139 |
+
<div class='apss-digg apss-single-icon'>
|
140 |
+
<a rel='nofollow' title="<?php _e( 'Share on Digg', APSS_TEXT_DOMAIN ); ?>" target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
141 |
+
<div class='apss-icon-block clearfix'>
|
142 |
+
<i class='fa fa-digg'></i>
|
143 |
+
<span class='apss-social-text'><?php _e( 'Share on Digg', APSS_TEXT_DOMAIN ); ?></span>
|
144 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
145 |
+
</div>
|
146 |
+
</a>
|
147 |
</div>
|
|
|
|
|
148 |
|
149 |
+
<?php
|
150 |
+
break;
|
151 |
|
152 |
case 'email':
|
153 |
+
if ( strpos( $options['apss_email_body'], '%%' ) || strpos( $options['apss_email_subject'], '%%' ) ) {
|
154 |
+
$link = 'mailto:?subject=' . $options['apss_email_subject'] . '&body=' . $options['apss_email_body'];
|
155 |
+
$link = preg_replace( array( '#%%title%%#', '#%%siteurl%%#', '#%%permalink%%#', '#%%url%%#' ), array( $title, get_site_url(), get_permalink(), $url ), $link );
|
156 |
+
} else {
|
157 |
+
$link = 'mailto:?subject=' . $options['apss_email_subject'] . '&body=' . $options['apss_email_body'] . ": " . $url;
|
158 |
+
}
|
159 |
+
?>
|
160 |
+
<div class='apss-email apss-single-icon'>
|
161 |
+
<a rel='nofollow' class='share-email-popup' title="<?php _e( 'Share it on Email', APSS_TEXT_DOMAIN ); ?>" target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
162 |
+
<div class='apss-icon-block clearfix'>
|
163 |
+
<i class='fa fa-envelope'></i>
|
164 |
+
<span class='apss-social-text'><?php _e( 'Send email', APSS_TEXT_DOMAIN ); ?></span>
|
165 |
+
<span class='apss-share'><?php _e( 'Mail', APSS_TEXT_DOMAIN ); ?></span>
|
166 |
+
</div>
|
167 |
+
</a>
|
168 |
+
</div>
|
169 |
+
|
170 |
+
<?php
|
171 |
+
break;
|
|
|
172 |
|
173 |
case 'print':
|
174 |
+
?>
|
175 |
+
<div class='apss-print apss-single-icon'>
|
176 |
+
<a rel='nofollow' title="<?php _e( 'Print', APSS_TEXT_DOMAIN ); ?>" href='javascript:void(0);' onclick='window.print();
|
177 |
+
return false;'>
|
178 |
+
<div class='apss-icon-block clearfix'><i class='fa fa-print'></i>
|
179 |
+
<span class='apss-social-text'><?php _e( 'Print', APSS_TEXT_DOMAIN ); ?></span>
|
180 |
+
<span class='apss-share'><?php _e( 'Print', APSS_TEXT_DOMAIN ); ?></span>
|
181 |
+
</div>
|
182 |
+
</a>
|
183 |
+
</div>
|
184 |
+
<?php
|
185 |
+
break;
|
186 |
+
}
|
187 |
}
|
|
|
188 |
}
|
189 |
+
if ( isset( $enable_counter ) && $enable_counter == '1' ) {
|
190 |
+
?>
|
191 |
+
<div class='apss-total-share-count'>
|
192 |
+
<span class='apss-count-number'><?php echo $total_count; ?></span>
|
193 |
+
<div class="apss-total-shares"><span class='apss-total-text'><?php echo _e( ' Total', APSS_TEXT_DOMAIN ); ?></span>
|
194 |
+
<span class='apss-shares-text'><?php echo _e( ' Shares', APSS_TEXT_DOMAIN ); ?></span></div>
|
195 |
+
</div>
|
196 |
+
<?php
|
197 |
+
}
|
inc/frontend/shortcode.php
CHANGED
@@ -1,227 +1,223 @@
|
|
1 |
-
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
<?php
|
3 |
global $post;
|
4 |
$options = get_option( APSS_SETTING_NAME );
|
5 |
-
$apss_link_open_option=($options['dialog_box_options']=='1') ? "_blank": "";
|
6 |
-
$twitter_user
|
7 |
-
$icon_set_value
|
8 |
-
$url= get_permalink();
|
9 |
-
$cache_period = ($options['cache_period'] != '') ? $options['cache_period']*60*60 : 24 * 60 * 60
|
10 |
-
if( isset($attr['networks']) ){
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$options['social_networks'] = $new_array;
|
19 |
}
|
20 |
|
21 |
-
if(isset($attr['total_counter'])){
|
22 |
-
if($attr['total_counter'] =='1'){
|
23 |
$total_counter_enable_options = 1;
|
24 |
}
|
25 |
-
}else{
|
26 |
$total_counter_enable_options = 0;
|
27 |
}
|
28 |
|
29 |
|
30 |
-
if(isset($attr['counter'])){
|
31 |
-
if($attr['counter'] =='1'){
|
32 |
$counter_enable_options = 1;
|
33 |
}
|
34 |
-
}else{
|
35 |
$counter_enable_options = 0;
|
36 |
}
|
37 |
-
|
38 |
-
|
39 |
?>
|
40 |
|
41 |
<div class='apss-social-share apss-theme-<?php echo $icon_set_value; ?> clearfix'>
|
42 |
<?php
|
43 |
-
$title=str_replace('+', '%20', urlencode($post->post_title));
|
44 |
-
$content=strip_shortcodes(strip_tags(get_the_content()));
|
45 |
-
if(strlen($content) >= 100){
|
46 |
-
$excerpt= substr($content, 0, 100).'...';
|
47 |
-
}else{
|
48 |
$excerpt = $content;
|
49 |
}
|
50 |
-
|
51 |
?>
|
52 |
|
53 |
-
<?php if( isset( $attr['share_text'] ) && $attr['share_text'] !='' ){ ?> <div class='apss-share-text'><?php echo $attr['share_text']; ?></div> <?php } ?>
|
54 |
-
<?php
|
55 |
-
$total_count = 0;
|
56 |
-
foreach( $options['social_networks'] as $key
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
<div class='apss-icon-block clearfix'>
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
</div>
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
</div>
|
78 |
-
<?php
|
79 |
-
break;
|
80 |
-
|
81 |
-
//counter available for twitter
|
82 |
-
case 'twitter':
|
83 |
-
$url_twitter = $url;
|
84 |
-
$url_twitter=urlencode($url_twitter);
|
85 |
-
if(isset( $twitter_user) && $twitter_user !='' ){
|
86 |
-
$twitter_user = 'via='.$twitter_user;
|
87 |
-
}
|
88 |
-
$link ="https://twitter.com/intent/tweet?text=$title&url=$url_twitter&$twitter_user";
|
89 |
-
$count = $this->get_count($key, $url);
|
90 |
-
?>
|
91 |
-
<div class='apss-twitter apss-single-icon'>
|
92 |
-
<a rel='nofollow' title='<?php _e('Share on Twitter', APSS_TEXT_DOMAIN ); ?>' target='<?php echo $apss_link_open_option; ?>' href="<?php echo $link; ?>">
|
93 |
-
<div class='apss-icon-block clearfix'>
|
94 |
-
<i class='fa fa-twitter'></i>
|
95 |
-
<span class='apss-social-text'><?php _e('Share on Twitter', APSS_TEXT_DOMAIN ); ?></span><span class='apss-share'><?php _e( 'Tweet', APSS_TEXT_DOMAIN ); ?></span>
|
96 |
</div>
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
</a>
|
121 |
-
</div>
|
122 |
-
<?php
|
123 |
-
break;
|
124 |
-
|
125 |
-
//counter available for pinterest
|
126 |
-
case 'pinterest':
|
127 |
-
$count = $this->get_count($key, $url);
|
128 |
-
?>
|
129 |
-
<div class='apss-pinterest apss-single-icon'>
|
130 |
-
<a rel='nofollow' title='<?php _e('Share on Pinterest', APSS_TEXT_DOMAIN ); ?>' href='javascript:pinIt();'>
|
131 |
-
<div class='apss-icon-block clearfix'>
|
132 |
-
<i class='fa fa-pinterest'></i>
|
133 |
-
<span class='apss-social-text'><?php _e('Share on Pinterest', APSS_TEXT_DOMAIN ); ?></span>
|
134 |
-
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
135 |
</div>
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
154 |
-
</div>
|
155 |
-
|
156 |
-
<?php if(isset($counter_enable_options) && $counter_enable_options=='1'){ ?>
|
157 |
-
<div class='count apss-count' data-url='<?php echo $url;?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url.'_'.$key;?>"><?php echo $count; ?></div>
|
158 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
<
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
181 |
|
182 |
case 'email':
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
197 |
</div>
|
198 |
-
</a>
|
199 |
-
</div>
|
200 |
|
201 |
-
|
202 |
-
|
203 |
|
204 |
case 'print':
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
211 |
</div>
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
break;
|
216 |
-
}
|
217 |
}
|
218 |
}
|
219 |
|
220 |
-
if( isset($total_counter_enable_options) && $total_counter_enable_options == '1' ){
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
|
|
226 |
<?php } ?>
|
227 |
</div>
|
1 |
+
<?php defined( 'ABSPATH' ) or die( "No script kiddies please!" ); ?>
|
2 |
<?php
|
3 |
global $post;
|
4 |
$options = get_option( APSS_SETTING_NAME );
|
5 |
+
$apss_link_open_option = ($options['dialog_box_options'] == '1') ? "_blank" : "";
|
6 |
+
$twitter_user = $options['twitter_username'];
|
7 |
+
$icon_set_value = $options['social_icon_set'];
|
8 |
+
$url = get_permalink();
|
9 |
+
$cache_period = ($options['cache_period'] != '') ? $options['cache_period'] * 60 * 60 : 24 * 60 * 60;
|
10 |
+
if ( isset( $attr['networks'] ) ) {
|
11 |
+
$raw_array = explode( ',', $attr['networks'] );
|
12 |
+
$network_array = array_map( 'trim', $raw_array );
|
13 |
+
$new_array = array();
|
14 |
+
foreach ( $network_array as $network ) {
|
15 |
+
$new_array[$network] = '1';
|
16 |
+
}
|
17 |
+
$options['social_networks'] = $new_array;
|
|
|
18 |
}
|
19 |
|
20 |
+
if ( isset( $attr['total_counter'] ) ) {
|
21 |
+
if ( $attr['total_counter'] == '1' ) {
|
22 |
$total_counter_enable_options = 1;
|
23 |
}
|
24 |
+
} else {
|
25 |
$total_counter_enable_options = 0;
|
26 |
}
|
27 |
|
28 |
|
29 |
+
if ( isset( $attr['counter'] ) ) {
|
30 |
+
if ( $attr['counter'] == '1' ) {
|
31 |
$counter_enable_options = 1;
|
32 |
}
|
33 |
+
} else {
|
34 |
$counter_enable_options = 0;
|
35 |
}
|
|
|
|
|
36 |
?>
|
37 |
|
38 |
<div class='apss-social-share apss-theme-<?php echo $icon_set_value; ?> clearfix'>
|
39 |
<?php
|
40 |
+
$title = str_replace( '+', '%20', urlencode( $post->post_title ) );
|
41 |
+
$content = strip_shortcodes( strip_tags( get_the_content() ) );
|
42 |
+
if ( strlen( $content ) >= 100 ) {
|
43 |
+
$excerpt = substr( $content, 0, 100 ) . '...';
|
44 |
+
} else {
|
45 |
$excerpt = $content;
|
46 |
}
|
|
|
47 |
?>
|
48 |
|
49 |
+
<?php if ( isset( $attr['share_text'] ) && $attr['share_text'] != '' ) { ?> <div class='apss-share-text'><?php echo $attr['share_text']; ?></div> <?php } ?>
|
50 |
+
<?php
|
51 |
+
$total_count = 0;
|
52 |
+
foreach ( $options['social_networks'] as $key => $value ) {
|
53 |
+
if ( intval( $value ) == '1' ) {
|
54 |
+
$count = $this->get_count( $key, $url );
|
55 |
+
$total_count += $count;
|
56 |
+
switch ( $key ) {
|
57 |
+
//counter available for facebook
|
58 |
+
case 'facebook':
|
59 |
+
$link = 'https://www.facebook.com/sharer/sharer.php?u=' . $url;
|
60 |
+
$count = $this->get_count( $key, $url );
|
61 |
+
?>
|
62 |
+
<div class='apss-facebook apss-single-icon'>
|
63 |
+
<a rel='nofollow' title='<?php _e( 'Share on Facebook', APSS_TEXT_DOMAIN ); ?>' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
64 |
<div class='apss-icon-block clearfix'>
|
65 |
+
<i class='fa fa-facebook'></i>
|
66 |
+
<span class='apss-social-text'><?php _e( 'Share on Facebook', APSS_TEXT_DOMAIN ); ?></span>
|
67 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
68 |
</div>
|
69 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
70 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
71 |
+
<?php } ?>
|
72 |
+
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
</div>
|
74 |
+
<?php
|
75 |
+
break;
|
76 |
+
|
77 |
+
//counter available for twitter
|
78 |
+
case 'twitter':
|
79 |
+
$url_twitter = $url;
|
80 |
+
$url_twitter = urlencode( $url_twitter );
|
81 |
+
if ( isset( $twitter_user ) && $twitter_user != '' ) {
|
82 |
+
$twitter_user = 'via=' . $twitter_user;
|
83 |
+
}
|
84 |
+
$link = "https://twitter.com/intent/tweet?text=$title&url=$url_twitter&$twitter_user";
|
85 |
+
$count = $this->get_count( $key, $url );
|
86 |
+
?>
|
87 |
+
<div class='apss-twitter apss-single-icon'>
|
88 |
+
<a rel='nofollow' title='<?php _e( 'Share on Twitter', APSS_TEXT_DOMAIN ); ?>' target='<?php echo $apss_link_open_option; ?>' href="<?php echo $link; ?>">
|
89 |
+
<div class='apss-icon-block clearfix'>
|
90 |
+
<i class='fa fa-twitter'></i>
|
91 |
+
<span class='apss-social-text'><?php _e( 'Share on Twitter', APSS_TEXT_DOMAIN ); ?></span><span class='apss-share'><?php _e( 'Tweet', APSS_TEXT_DOMAIN ); ?></span>
|
92 |
+
</div>
|
93 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
94 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
95 |
+
<?php } ?>
|
96 |
+
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
</div>
|
98 |
+
<?php
|
99 |
+
break;
|
100 |
+
|
101 |
+
//counter available for google plus
|
102 |
+
case 'google-plus':
|
103 |
+
$link = 'https://plus.google.com/share?url=' . $url;
|
104 |
+
$count = $this->get_count( $key, $url );
|
105 |
+
?>
|
106 |
+
<div class='apss-google-plus apss-single-icon'>
|
107 |
+
<a rel='nofollow' title='<?php _e( 'Share on Google Plus', APSS_TEXT_DOMAIN ); ?>' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
108 |
+
<div class='apss-icon-block clearfix'>
|
109 |
+
<i class='fa fa-google-plus'></i>
|
110 |
+
<span class='apss-social-text'><?php _e( 'Share on Google Plus', APSS_TEXT_DOMAIN ); ?> </span>
|
111 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
112 |
+
</div>
|
113 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
114 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
|
|
|
|
|
|
|
|
|
|
115 |
<?php } ?>
|
116 |
+
</a>
|
117 |
+
</div>
|
118 |
+
<?php
|
119 |
+
break;
|
120 |
+
|
121 |
+
//counter available for pinterest
|
122 |
+
case 'pinterest':
|
123 |
+
$count = $this->get_count( $key, $url );
|
124 |
+
?>
|
125 |
+
<div class='apss-pinterest apss-single-icon'>
|
126 |
+
<a rel='nofollow' title='<?php _e( 'Share on Pinterest', APSS_TEXT_DOMAIN ); ?>' href='javascript:pinIt();'>
|
127 |
+
<div class='apss-icon-block clearfix'>
|
128 |
+
<i class='fa fa-pinterest'></i>
|
129 |
+
<span class='apss-social-text'><?php _e( 'Share on Pinterest', APSS_TEXT_DOMAIN ); ?></span>
|
130 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
131 |
+
</div>
|
132 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
133 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
134 |
+
<?php } ?>
|
135 |
+
</a>
|
136 |
+
</div>
|
137 |
+
<?php
|
138 |
+
break;
|
139 |
+
|
140 |
+
//couter available for linkedin
|
141 |
+
case 'linkedin':
|
142 |
+
$link = "http://www.linkedin.com/shareArticle?mini=true&title=" . $title . "&url=" . $url . "&summary=" . $excerpt;
|
143 |
+
$count = $this->get_count( $key, $url );
|
144 |
+
?>
|
145 |
+
<div class='apss-linkedin apss-single-icon'>
|
146 |
+
<a rel='nofollow' title='<?php _e( 'Share on LinkedIn', APSS_TEXT_DOMAIN ); ?>' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
147 |
+
<div class='apss-icon-block clearfix'><i class='fa fa-linkedin'></i>
|
148 |
+
<span class='apss-social-text'><?php _e( 'Share on LinkedIn', APSS_TEXT_DOMAIN ); ?></span>
|
149 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
150 |
+
</div>
|
151 |
|
152 |
+
<?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
|
153 |
+
<div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
|
154 |
+
<?php } ?>
|
155 |
+
|
156 |
+
</a>
|
157 |
+
</div>
|
158 |
+
<?php
|
159 |
+
break;
|
160 |
+
|
161 |
+
//there is no counter available for digg
|
162 |
+
case 'digg':
|
163 |
+
$link = "http://digg.com/submit?phase=2%20&url=" . $url . "&title=" . $title;
|
164 |
+
?>
|
165 |
+
<div class='apss-digg apss-single-icon'>
|
166 |
+
<a rel='nofollow' title='<?php _e( 'Share on Digg', APSS_TEXT_DOMAIN ); ?>' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
167 |
+
<div class='apss-icon-block clearfix'>
|
168 |
+
<i class='fa fa-digg'></i>
|
169 |
+
<span class='apss-social-text'><?php _e( 'Share on Digg', APSS_TEXT_DOMAIN ); ?></span>
|
170 |
+
<span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
|
171 |
+
</div>
|
172 |
+
</a>
|
173 |
+
</div>
|
174 |
+
|
175 |
+
<?php
|
176 |
+
break;
|
177 |
|
178 |
case 'email':
|
179 |
+
if ( strpos( $options['apss_email_body'], '%%' ) || strpos( $options['apss_email_subject'], '%%' ) ) {
|
180 |
+
$link = 'mailto:?subject=' . $options['apss_email_subject'] . '&body=' . $options['apss_email_body'];
|
181 |
+
$link = preg_replace( array( '#%%title%%#', '#%%siteurl%%#', '#%%permalink%%#', '#%%url%%#' ), array( $title, get_site_url(), get_permalink(), $url ), $link );
|
182 |
+
} else {
|
183 |
+
$link = 'mailto:?subject=' . $options['apss_email_subject'] . '&body=' . $options['apss_email_body'] . ": " . $url;
|
184 |
+
}
|
185 |
+
?>
|
186 |
+
<div class='apss-email apss-single-icon'>
|
187 |
+
<a rel='nofollow' class='share-email-popup' title='<?php _e( 'Share it on Email', APSS_TEXT_DOMAIN ); ?>' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
|
188 |
+
<div class='apss-icon-block clearfix'>
|
189 |
+
<i class='fa fa-envelope'></i>
|
190 |
+
<span class='apss-social-text'><?php _e( 'Send email', APSS_TEXT_DOMAIN ); ?></span>
|
191 |
+
<span class='apss-share'><?php _e( 'Mail', APSS_TEXT_DOMAIN ); ?></span>
|
192 |
+
</div>
|
193 |
+
</a>
|
194 |
</div>
|
|
|
|
|
195 |
|
196 |
+
<?php
|
197 |
+
break;
|
198 |
|
199 |
case 'print':
|
200 |
+
?>
|
201 |
+
<div class='apss-print apss-single-icon'>
|
202 |
+
<a rel='nofollow' title='<?php _e( 'Print', APSS_TEXT_DOMAIN ); ?>' href='javascript:void(0);' onclick='window.print(); return false;'>
|
203 |
+
<div class='apss-icon-block clearfix'><i class='fa fa-print'></i>
|
204 |
+
<span class='apss-social-text'><?php _e( 'Print', APSS_TEXT_DOMAIN ); ?></span>
|
205 |
+
<span class='apss-share'><?php _e( 'Print', APSS_TEXT_DOMAIN ); ?></span>
|
206 |
+
</div>
|
207 |
+
</a>
|
208 |
</div>
|
209 |
+
<?php
|
210 |
+
break;
|
211 |
+
}
|
|
|
|
|
212 |
}
|
213 |
}
|
214 |
|
215 |
+
if ( isset( $total_counter_enable_options ) && $total_counter_enable_options == '1' ) {
|
216 |
+
?>
|
217 |
+
<div class='apss-total-share-count'>
|
218 |
+
<span class='apss-count-number'><?php echo $total_count; ?></span>
|
219 |
+
<div class="apss-total-shares"><span class='apss-total-text'><?php echo _e( ' Total', APSS_TEXT_DOMAIN ); ?></span>
|
220 |
+
<span class='apss-shares-text'><?php echo _e( ' Shares', APSS_TEXT_DOMAIN ); ?></span></div>
|
221 |
+
</div>
|
222 |
<?php } ?>
|
223 |
</div>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: social share counter, social share, social media share, social network sha
|
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -131,6 +131,10 @@ Yes. You can use the AccessPress social share by using shortcode anywhere you wa
|
|
131 |
6. Backend Miscellaneous Settings Section
|
132 |
|
133 |
== Changelog ==
|
|
|
|
|
|
|
|
|
134 |
= 3.0.3 =
|
135 |
* Done the update of the upgrade banner image.
|
136 |
* Done the removal of unnecessary comments in the plugin.
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 3.0.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
131 |
6. Backend Miscellaneous Settings Section
|
132 |
|
133 |
== Changelog ==
|
134 |
+
= 3.0.4 =
|
135 |
+
* Code formatting for the save settings page.
|
136 |
+
* Done the broken link fixes for the about section.
|
137 |
+
|
138 |
= 3.0.3 =
|
139 |
* Done the update of the upgrade banner image.
|
140 |
* Done the removal of unnecessary comments in the plugin.
|