Version Description
- updated in translation ready.
Download this release
Release Info
Developer | Access Keys |
Plugin | Social Share WordPress Plugin – AccessPress Social Share |
Version | 4.3.9 |
Comparing to | |
See all releases |
Code changes from version 4.3.8 to 4.3.9
- accesspress-social-share.php +682 -694
- inc/backend/about-apss.php +66 -67
- inc/backend/how-to-use.php +57 -57
- inc/backend/main-page.php +417 -324
- inc/backend/save-settings.php +38 -37
- readme.txt +18 -15
accesspress-social-share.php
CHANGED
@@ -4,7 +4,7 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
|
4 |
Plugin name: Social Share WordPress Plugin - 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: 4.3.
|
8 |
Author: AccessPress Themes
|
9 |
Author URI: http://accesspressthemes.com
|
10 |
Text Domain: accesspress-social-share
|
@@ -13,725 +13,713 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
|
13 |
*/
|
14 |
|
15 |
//Decleration of the necessary constants for plugin
|
16 |
-
if ( !defined( 'APSS_IMAGE_DIR' ) ) {
|
17 |
-
|
18 |
}
|
19 |
|
20 |
-
if ( !defined( 'APSS_JS_DIR' ) ) {
|
21 |
-
|
22 |
}
|
23 |
|
24 |
-
if ( !defined( 'APSS_CSS_DIR' ) ) {
|
25 |
-
|
26 |
}
|
27 |
|
28 |
-
if ( !defined( 'APSS_LANG_DIR' ) ) {
|
29 |
-
|
30 |
}
|
31 |
|
32 |
-
if ( !defined( 'APSS_VERSION' ) ) {
|
33 |
-
|
34 |
}
|
35 |
|
36 |
-
if ( !defined( 'APSS_TEXT_DOMAIN' ) ) {
|
37 |
-
|
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 |
-
if ( !class_exists( 'APSS_Class' ) ) {
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
if ( is_multisite() ) {
|
89 |
-
$current_blog = $wpdb->blogid;
|
90 |
// Get all blogs in the network and activate plugin on each one
|
91 |
-
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
92 |
foreach ( $blog_ids as $blog_id ) {
|
93 |
switch_to_blog( $blog_id );
|
94 |
-
if ( !get_option( APSS_SETTING_NAME ) ) {
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
-
|
104 |
-
if (
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
//loads the text domain for translation
|
118 |
-
function plugin_text_domain() {
|
119 |
-
load_plugin_textdomain( 'accesspress-social-share', false, APSS_LANG_DIR );
|
120 |
-
}
|
121 |
-
|
122 |
-
//functions to register frontend styles and scripts
|
123 |
-
function register_admin_assets() {
|
124 |
-
/**
|
125 |
-
* Backend CSS
|
126 |
-
* */
|
127 |
-
if ( isset( $_GET['page'] ) && $_GET['page'] == 'accesspress-social-share' ) {
|
128 |
-
wp_enqueue_style( 'aps-admin-css', APSS_CSS_DIR . '/backend.css', false, APSS_VERSION ); //registering plugin admin css
|
129 |
-
wp_enqueue_style( 'fontawesome-css', APSS_CSS_DIR.'/font-awesome/font-awesome.min.css', false, APSS_VERSION );
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Backend JS
|
133 |
-
* */
|
134 |
-
wp_enqueue_script( 'jquery-ui-sortable' );
|
135 |
-
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
|
136 |
-
}
|
137 |
-
}
|
138 |
-
|
139 |
-
//function to return the content filter for the posts and pages
|
140 |
-
function apss_the_content_filter( $content ) {
|
141 |
-
if(in_array('get_the_excerpt', $GLOBALS['wp_current_filter'])) return $content;
|
142 |
-
global $post;
|
143 |
-
$post_content = $content;
|
144 |
-
$title = str_replace( '+', '%20', urlencode( $post->post_title ) );
|
145 |
-
$content = trim( strip_shortcodes( strip_tags( $post->post_content ) ) );
|
146 |
-
if ( strlen( $content ) >= 100 ) {
|
147 |
-
$excerpt = urlencode(substr( $content, 0, 100 ) . '...');
|
148 |
-
} else {
|
149 |
-
$excerpt = urlencode($content);
|
150 |
-
}
|
151 |
-
$options = $this->apss_settings;
|
152 |
-
ob_start();
|
153 |
-
include('inc/frontend/content-filter.php');
|
154 |
-
$html_content = ob_get_contents();
|
155 |
-
ob_get_clean();
|
156 |
-
|
157 |
-
$share_shows_in_options = $options['share_options'];
|
158 |
-
$content_flag = get_post_meta( $post->ID, 'apss_content_flag', true );
|
159 |
-
|
160 |
-
$all = in_array( 'all', $options['share_options'] );
|
161 |
-
$is_lists_authorized = (is_search() && $content_flag != '1' ) && $all ? true : false;
|
162 |
-
|
163 |
-
$is_attachement_check = in_array( 'attachment', $options['share_options'] );
|
164 |
-
$is_attachement = (is_attachment() && $is_attachement_check ) ? true : false;
|
165 |
-
|
166 |
-
$front_page = in_array( 'front_page', $options['share_options'] );
|
167 |
-
$is_front_page = (is_front_page() && $content_flag != '1' ) && $front_page ? true : false;
|
168 |
-
|
169 |
-
$share_shows_in_options = $options['share_options'];
|
170 |
-
$is_singular = is_singular( $share_shows_in_options ) && !is_front_page() && $content_flag != '1' ? true : false;
|
171 |
-
|
172 |
-
if ( !empty( $share_shows_in_options ) ) {
|
173 |
-
$is_tax = is_tax( $share_shows_in_options );
|
174 |
-
} else {
|
175 |
-
$is_tax = false;
|
176 |
-
}
|
177 |
-
|
178 |
-
$is_category = in_array( 'categories', $options['share_options'] );
|
179 |
-
$default_category = ( is_category() ) && $is_category ? true : false;
|
180 |
-
|
181 |
-
$is_default_archive = in_array( 'archives', $options['share_options'] );
|
182 |
-
$default_archives = ( ( is_archive() && !is_tax() ) && !is_category() ) && $is_default_archive ? true : false;
|
183 |
-
if(function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()){
|
184 |
-
$show_icons = false;
|
185 |
-
}else {
|
186 |
-
$show_icons = true;
|
187 |
-
}
|
188 |
-
|
189 |
-
if ( empty( $options['share_options'] ) ) {
|
190 |
-
return $post_content;
|
191 |
-
} else if ( ($is_lists_authorized || $is_attachement || $is_singular || $is_tax || $is_front_page || $default_category || $default_archives) && $show_icons) {
|
192 |
-
if ( $options['share_positions'] == 'below_content' ) {
|
193 |
-
return $post_content . "<div class='apss-social-share apss-theme-$icon_set_value clearfix' >" . $html_content . "</div>";
|
194 |
-
}
|
195 |
-
|
196 |
-
if ( $options['share_positions'] == 'above_content' ) {
|
197 |
-
return "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$html_content</div>" . $post_content;
|
198 |
-
}
|
199 |
-
|
200 |
-
if ( $options['share_positions'] == 'on_both' ) {
|
201 |
-
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>";
|
202 |
-
}
|
203 |
-
} else {
|
204 |
-
return $post_content;
|
205 |
-
}
|
206 |
-
}
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Registers Frontend Assets
|
210 |
-
* */
|
211 |
-
function register_frontend_assets() {
|
212 |
-
wp_enqueue_style( 'apss-font-awesome', APSS_CSS_DIR . '/font-awesome/font-awesome.min.css', array(), APSS_VERSION );
|
213 |
-
wp_enqueue_style( 'apss-font-opensans', '//fonts.googleapis.com/css?family=Open+Sans', array(), false );
|
214 |
-
wp_enqueue_style( 'apss-frontend-css', APSS_CSS_DIR . '/frontend.css', array( 'apss-font-awesome' ), APSS_VERSION );
|
215 |
-
wp_enqueue_script( 'apss-frontend-mainjs', APSS_JS_DIR . '/frontend.js', array( 'jquery' ), APSS_VERSION, true );
|
216 |
-
$ajax_nonce = wp_create_nonce( 'apss-ajax-nonce' );
|
217 |
-
wp_localize_script( 'apss-frontend-mainjs', 'frontend_ajax_object', array( 'ajax_url' => admin_url() . 'admin-ajax.php', 'ajax_nonce' => $ajax_nonce ) );
|
218 |
-
}
|
219 |
-
|
220 |
-
//add plugins menu in backend
|
221 |
-
function add_apss_menu() {
|
222 |
-
add_menu_page( 'AccessPress Social Share', 'AccessPress Social Share', 'manage_options', 'accesspress-social-share', array( $this, 'main_page' ), APSS_IMAGE_DIR . '/apss-icon.png' );
|
223 |
-
}
|
224 |
-
|
225 |
-
//for saving the plugin settings
|
226 |
-
function apss_save_options() {
|
227 |
-
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' ) ) {
|
228 |
-
include( 'inc/backend/save-settings.php' );
|
229 |
-
} else {
|
230 |
-
die( 'No script kiddies please!' );
|
231 |
-
}
|
232 |
-
}
|
233 |
-
|
234 |
-
//function to restore the default setting of a plugin
|
235 |
-
function apss_restore_default_settings() {
|
236 |
-
$nonce = $_REQUEST['_wpnonce'];
|
237 |
-
if ( !empty( $_GET ) && wp_verify_nonce( $nonce, 'apss-restore-default-settings-nonce' ) ) {
|
238 |
-
//restore the default plugin activation settings from the activation page.
|
239 |
-
include( 'inc/backend/activation.php' );
|
240 |
-
wp_redirect( admin_url() . 'admin.php?page=accesspress-social-share&message=3' );
|
241 |
-
exit;
|
242 |
-
} else {
|
243 |
-
die( 'No script kiddies please!' );
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Clears the social share counter cache
|
249 |
-
*/
|
250 |
-
function apss_clear_cache() {
|
251 |
-
if ( !empty( $_GET ) && wp_verify_nonce( $_GET['_wpnonce'], 'apss-clear-cache-nonce' ) ) {
|
252 |
-
$apss_settings = $this->apss_settings;
|
253 |
-
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
254 |
-
foreach ( $apss_social_counts_transients as $transient ) {
|
255 |
-
delete_transient( $transient );
|
256 |
-
}
|
257 |
-
update_option( APSS_COUNT_TRANSIENTS, array() );
|
258 |
-
$transient_array = array( 'apss_tweets_count', 'apss_linkedin_count', 'apss_fb_count', 'apss_pin_count', 'apss_google_plus_count' );
|
259 |
-
foreach ( $transient_array as $transient ) {
|
260 |
-
delete_transient( $transient );
|
261 |
-
}
|
262 |
-
wp_redirect( admin_url() . 'admin.php?page=accesspress-social-share&message=4' );
|
263 |
-
}
|
264 |
-
}
|
265 |
-
|
266 |
-
//function for adding shortcode of a plugin
|
267 |
-
function apss_shortcode( $attr ) {
|
268 |
-
ob_start();
|
269 |
-
include( 'inc/frontend/shortcode.php' );
|
270 |
-
$html = ob_get_contents();
|
271 |
-
ob_get_clean();
|
272 |
-
return $html;
|
273 |
-
}
|
274 |
-
|
275 |
-
//frontend counter
|
276 |
-
function frontend_counter() {
|
277 |
-
if ( !empty( $_GET ) && wp_verify_nonce( $_GET['_wpnonce'], 'apss-ajax-nonce' ) ) {
|
278 |
-
$apss_settings = $this->apss_settings;
|
279 |
-
$new_detail_array = array();
|
280 |
-
if ( isset( $_POST['data'] ) ) {
|
281 |
-
$details = $_POST['data'];
|
282 |
-
foreach ( $details as $detail ) {
|
283 |
-
$new_detail_array[$detail['network']] = $this->get_count( $detail['network'], $detail['url'] );
|
284 |
-
}
|
285 |
-
} else if ( isset( $_POST['shortcode_data'] ) ) {
|
286 |
-
$shortcode_data = $_POST['shortcode_data'];
|
287 |
-
foreach ( $shortcode_data as $detail ) {
|
288 |
-
$detail_array = explode( '_', $detail );
|
289 |
-
$url = trim( $detail_array[0] );
|
290 |
-
$network = $detail_array[1];
|
291 |
-
$new_detail_array[] = $this->get_count( $network, $url );
|
292 |
-
}
|
293 |
-
}
|
294 |
-
die( json_encode( $new_detail_array ) );
|
295 |
-
}
|
296 |
-
}
|
297 |
-
|
298 |
-
//frontend counter only Shortcode
|
299 |
-
function apss_count_shortcode( $attr ) {
|
300 |
-
ob_start();
|
301 |
-
include( 'inc/frontend/count_shortcode.php' );
|
302 |
-
$html = ob_get_contents();
|
303 |
-
ob_get_clean();
|
304 |
-
return $html;
|
305 |
-
}
|
306 |
-
|
307 |
-
///////////////////////////for post meta options//////////////////////////////////
|
308 |
-
/**
|
309 |
-
* Adds a section in all the post and page section to disable the share options in frontend pages
|
310 |
-
*/
|
311 |
-
function social_meta_box() {
|
312 |
-
add_meta_box( 'ap-share-box', 'AccessPress social share options', array( $this, 'metabox_callback' ), '', 'side', 'core' );
|
313 |
-
}
|
314 |
-
function metabox_callback( $post ) {
|
315 |
-
wp_nonce_field( 'save_meta_values', 'ap_share_meta_nonce' );
|
316 |
-
$content_flag = get_post_meta( $post->ID, 'apss_content_flag', true );
|
317 |
-
?>
|
318 |
-
<label><input type="checkbox" value="1" name="apss_content_flag" <?php checked( $content_flag, true ) ?>/><?php _e( 'Hide share icons in content', 'accesspress-social-share' ); ?></label><br>
|
319 |
-
<?php
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* Save Share Flags on post save
|
324 |
-
*/
|
325 |
-
function save_meta_values( $post_id ) {
|
326 |
-
|
327 |
-
/*
|
328 |
-
* We need to verify this came from our screen and with proper authorization,
|
329 |
-
* because the save_post action can be triggered at other times.
|
330 |
-
*/
|
331 |
-
|
332 |
-
// Check if our nonce is set.
|
333 |
-
if ( !isset( $_POST['ap_share_meta_nonce'] ) ) {
|
334 |
-
return;
|
335 |
-
}
|
336 |
-
|
337 |
-
// Verify that the nonce is valid.
|
338 |
-
if ( !wp_verify_nonce( $_POST['ap_share_meta_nonce'], 'save_meta_values' ) ) {
|
339 |
-
return;
|
340 |
-
}
|
341 |
-
|
342 |
-
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
|
343 |
-
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
344 |
-
return;
|
345 |
-
}
|
346 |
-
|
347 |
-
// Check the user's permissions.
|
348 |
-
if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
|
349 |
-
|
350 |
-
if ( !current_user_can( 'edit_page', $post_id ) ) {
|
351 |
-
return;
|
352 |
-
}
|
353 |
-
} else {
|
354 |
-
|
355 |
-
if ( !current_user_can( 'edit_post', $post_id ) ) {
|
356 |
-
return;
|
357 |
-
}
|
358 |
-
}
|
359 |
-
|
360 |
-
/* OK, it's safe for us to save the data now. */
|
361 |
-
// Make sure that it is set.
|
362 |
-
$content_flag = (isset( $_POST['apss_content_flag'] ) && $_POST['apss_content_flag'] == 1) ? 1 : 0;
|
363 |
-
|
364 |
-
// Update the meta field in the database.
|
365 |
-
update_post_meta( $post_id, 'apss_content_flag', $content_flag );
|
366 |
-
}
|
367 |
-
|
368 |
-
////////////////////////////////////////////////////////////
|
369 |
-
//plugins backend admin page
|
370 |
-
function main_page() {
|
371 |
-
include('inc/backend/main-page.php');
|
372 |
-
}
|
373 |
-
|
374 |
-
//returns the current page url
|
375 |
-
function curPageURL() {
|
376 |
-
$pageURL = 'http';
|
377 |
-
if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) {
|
378 |
-
$pageURL .= "s";
|
379 |
-
}
|
380 |
-
$pageURL .= "://";
|
381 |
-
if ( $_SERVER["SERVER_PORT"] != "80" ) {
|
382 |
-
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
383 |
-
} else {
|
384 |
-
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
385 |
-
}
|
386 |
-
return $pageURL;
|
387 |
-
}
|
388 |
-
|
389 |
-
/**
|
390 |
-
* Funciton to print array in pre format
|
391 |
-
* */
|
392 |
-
function print_array( $array ) {
|
393 |
-
echo "<pre>";
|
394 |
-
print_r( $array );
|
395 |
-
echo "</pre>";
|
396 |
-
}
|
397 |
-
|
398 |
-
////////////////////////////////////for count //////////////////////////////////////////////////////
|
399 |
-
//for facebook url share count
|
400 |
-
function get_fb( $url ) {
|
401 |
-
$apss_settings = $this->apss_settings;
|
402 |
-
if(!isset($apss_settings['enable_cache']) || $apss_settings['enable_cache'] == '1'){
|
403 |
-
////////////////////////for transient//////////////////////////////
|
404 |
-
$cache_period = $apss_settings['cache_period'];
|
405 |
-
$fb_transient = 'fb_' . md5( $url );
|
406 |
-
$fb_transient_count = get_transient( $fb_transient );
|
407 |
-
|
408 |
-
//for setting the counter transient in separate options value
|
409 |
-
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
410 |
-
if ( false === $fb_transient_count ) {
|
411 |
-
$json_string = $this->get_json_values( 'https://graph.facebook.com/?id=' . $url );
|
412 |
-
$json = json_decode( $json_string, true );
|
413 |
-
$facebook_count = isset( $json['share']['share_count'] ) ? intval( $json['share']['share_count'] ) : 0;
|
414 |
-
set_transient( $fb_transient, $facebook_count, $cache_period * HOUR_IN_SECONDS );
|
415 |
-
if ( !in_array( $fb_transient, $apss_social_counts_transients ) ) {
|
416 |
-
$apss_social_counts_transients[] = $fb_transient;
|
417 |
-
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
418 |
-
}
|
419 |
-
} else {
|
420 |
-
$facebook_count = $fb_transient_count;
|
421 |
-
}
|
422 |
-
////////////////////////for transient ends ///////////////////////////
|
423 |
-
}else{
|
424 |
-
$json_string = $this->get_json_values( 'https://graph.facebook.com/?id=' . $url );
|
425 |
-
$json = json_decode( $json_string, true );
|
426 |
-
$facebook_count = isset( $json['share']['share_count'] ) ? intval( $json['share']['share_count'] ) : 0;
|
427 |
-
}
|
428 |
-
return $facebook_count;
|
429 |
-
}
|
430 |
-
|
431 |
-
/**
|
432 |
-
* Get Facebook Access Token
|
433 |
-
* */
|
434 |
-
function get_fb_access_token(){
|
435 |
-
$apss_settings = $this->apss_settings;
|
436 |
-
$app_id = $apss_settings['api_configuration']['facebook']['app_id'];
|
437 |
-
$app_secret = $apss_settings['api_configuration']['facebook']['app_secret'];
|
438 |
-
$api_url = 'https://graph.facebook.com/';
|
439 |
-
$app_id= $apss_settings['api_configuration']['facebook']['app_id'];
|
440 |
-
$app_secret = $apss_settings['api_configuration']['facebook']['app_secret'];
|
441 |
-
$url = sprintf(
|
442 |
-
'%soauth/access_token?client_id=%s&client_secret=%s&grant_type=client_credentials',
|
443 |
-
$api_url,
|
444 |
-
$app_id ,
|
445 |
-
$app_secret
|
446 |
-
);
|
447 |
-
|
448 |
-
$access_token = wp_remote_get( $url, array( 'timeout' => 60 ) );
|
449 |
-
if ( is_wp_error( $access_token ) || ( isset( $access_token['response']['code'] ) && 200 != $access_token['response']['code'] ) ) {
|
450 |
-
return '';
|
451 |
-
} else {
|
452 |
-
$json_decode = json_decode($access_token['body']);
|
453 |
-
return sanitize_text_field( $json_decode->access_token );
|
454 |
-
}
|
455 |
-
}
|
456 |
-
|
457 |
-
function new_get_fb($url){
|
458 |
-
$apss_settings = $this->apss_settings;
|
459 |
-
|
460 |
-
if(isset($apss_settings['api_configuration']['facebook']['app_id']) && $apss_settings['api_configuration']['facebook']['app_id'] !='' ){
|
461 |
-
$fb_app_id = $apss_settings['api_configuration']['facebook']['app_id'];
|
462 |
-
}
|
463 |
-
|
464 |
-
if(isset($apss_settings['api_configuration']['facebook']['app_secret']) && $apss_settings['api_configuration']['facebook']['app_secret'] !='' ){
|
465 |
-
$fb_app_secret = $apss_settings['api_configuration']['facebook']['app_id'];
|
466 |
-
}
|
467 |
-
|
468 |
-
if(!isset($fb_app_id) || !isset($fb_app_secret)){
|
469 |
-
$facebook_count = self:: get_fb($url);
|
470 |
-
return $facebook_count;
|
471 |
-
}else{
|
472 |
-
$access_token = self:: get_fb_access_token();
|
473 |
-
$api_url = 'https://graph.facebook.com/';
|
474 |
-
$facebook_count = sprintf(
|
475 |
-
'%s?access_token=%s&id=%s',
|
476 |
-
$api_url,
|
477 |
-
$access_token,
|
478 |
-
$url
|
479 |
-
);
|
480 |
-
$apss_settings = $this->apss_settings;
|
481 |
-
if(isset($apss_settings['enable_cache']) && $apss_settings['enable_cache'] == '1'){
|
482 |
-
////////////////////////for transient//////////////////////////////
|
483 |
-
$cache_period = $apss_settings['cache_period'];
|
484 |
-
$fb_transient = 'fb_' . md5( $url );
|
485 |
-
$fb_transient_count = get_transient( $fb_transient );
|
486 |
-
|
487 |
-
//for setting the counter transient in separate options value
|
488 |
-
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
489 |
-
if ( false === $fb_transient_count ) {
|
490 |
-
$json_string = $this->get_json_values($facebook_count);
|
491 |
-
$json = json_decode( $json_string, true );
|
492 |
-
$facebook_count = isset( $json['share']['share_count'] ) ? intval( $json['share']['share_count'] ) : 0;
|
493 |
-
set_transient( $fb_transient, $facebook_count, $cache_period * HOUR_IN_SECONDS );
|
494 |
-
if ( !in_array( $fb_transient, $apss_social_counts_transients ) ) {
|
495 |
-
$apss_social_counts_transients[] = $fb_transient;
|
496 |
-
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
497 |
-
}
|
498 |
-
} else {
|
499 |
-
$facebook_count = $fb_transient_count;
|
500 |
-
}
|
501 |
-
////////////////////////for transient ends ///////////////////////////
|
502 |
-
}else{
|
503 |
-
$json_string = $this->get_json_values($facebook_count);
|
504 |
-
$json = json_decode( $json_string, true );
|
505 |
-
$facebook_count = isset( $json['share']['share_count'] ) ? intval( $json['share']['share_count'] ) : 0;
|
506 |
-
}
|
507 |
-
return $facebook_count;
|
508 |
-
die();
|
509 |
-
}
|
510 |
-
|
511 |
-
|
512 |
-
}
|
513 |
-
|
514 |
-
//for twitter url share count
|
515 |
-
function get_tweets( $url ) {
|
516 |
-
$apss_settings = $this->apss_settings;
|
517 |
-
if(!isset($apss_settings['enable_cache']) || $apss_settings['enable_cache'] == '1'){
|
518 |
-
$cache_period = $apss_settings['cache_period'];
|
519 |
-
$twitter_transient = 'twitter_' . md5( $url );
|
520 |
-
$twitter_transient_count = get_transient( $twitter_transient );
|
521 |
-
//for setting the counter transient in separate options value
|
522 |
-
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
523 |
-
if ( false === $twitter_transient_count ) {
|
524 |
-
if(isset($apss_settings['twitter_counter_api'])){
|
525 |
-
$api_selection = $apss_settings['twitter_counter_api'];
|
526 |
-
}else{
|
527 |
-
$api_selection = '1';
|
528 |
-
}
|
529 |
-
|
530 |
-
if($api_selection == '2'){
|
531 |
-
$json_string = $this->get_json_values( 'http://public.newsharecounts.com/count.json?url=' . $url );
|
532 |
-
|
533 |
-
}else if($api_selection == '3'){
|
534 |
-
$json_string = $this->get_json_values( 'http://opensharecount.com/count.json?url=' . $url );
|
535 |
-
|
536 |
-
}else{
|
537 |
-
// depriciated url share count. returns null
|
538 |
-
$json_string = $this->get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
|
539 |
-
}
|
540 |
-
|
541 |
-
$json = json_decode( $json_string, true );
|
542 |
-
$tweet_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
543 |
-
set_transient( $twitter_transient, $tweet_count, $cache_period * HOUR_IN_SECONDS );
|
544 |
-
if ( !in_array( $twitter_transient, $apss_social_counts_transients ) ) {
|
545 |
-
$apss_social_counts_transients[] = $twitter_transient;
|
546 |
-
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
547 |
-
}
|
548 |
-
} else {
|
549 |
-
$tweet_count = $twitter_transient_count;
|
550 |
-
}
|
551 |
-
}else{
|
552 |
-
if(isset($apss_settings['twitter_counter_api'])){
|
553 |
-
$api_selection = $apss_settings['twitter_counter_api'];
|
554 |
-
}else{
|
555 |
-
$api_selection = '1';
|
556 |
-
}
|
557 |
-
|
558 |
-
if($api_selection == '2'){
|
559 |
-
$json_string = $this->get_json_values( 'http://public.newsharecounts.com/count.json?url=' . $url );
|
560 |
-
|
561 |
-
}else if($api_selection == '3'){
|
562 |
-
$json_string = $this->get_json_values( 'http://opensharecount.com/count.json?url=' . $url );
|
563 |
-
|
564 |
-
}else{
|
565 |
-
// depriciated url share count. returns null
|
566 |
-
$json_string = $this->get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
|
567 |
-
}
|
568 |
-
|
569 |
-
$json = json_decode( $json_string, true );
|
570 |
-
$tweet_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
571 |
-
}
|
572 |
-
return $tweet_count;
|
573 |
-
}
|
574 |
-
|
575 |
-
//for google plus url share count
|
576 |
-
function get_plusones( $url ) {
|
577 |
-
$apss_settings = $this->apss_settings;
|
578 |
-
if(!isset($apss_settings['enable_cache']) || $apss_settings['enable_cache'] == '1'){
|
579 |
-
$cache_period = $apss_settings['cache_period'];
|
580 |
-
$googlePlus_transient = 'gp_' . md5( $url );
|
581 |
-
$googlePlus_transient_count = get_transient( $googlePlus_transient );
|
582 |
-
|
583 |
-
//for setting the counter transient in separate options value
|
584 |
-
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
585 |
-
if ( false === $googlePlus_transient_count ) {
|
586 |
-
$curl = curl_init();
|
587 |
-
curl_setopt( $curl, CURLOPT_URL, "https://clients6.google.com/rpc" );
|
588 |
-
curl_setopt( $curl, CURLOPT_POST, true );
|
589 |
-
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
|
590 |
-
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"}]' );
|
591 |
-
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
|
592 |
-
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-type: application/json' ) );
|
593 |
-
$curl_results = curl_exec( $curl );
|
594 |
-
curl_close( $curl );
|
595 |
-
unset( $curl );
|
596 |
-
$json = json_decode( $curl_results, true );
|
597 |
-
$plusones_count = isset( $json[0]['result']['metadata']['globalCounts']['count'] ) ? intval( $json[0]['result']['metadata']['globalCounts']['count'] ) : 0;
|
598 |
-
set_transient( $googlePlus_transient, $plusones_count, $cache_period * HOUR_IN_SECONDS );
|
599 |
-
if ( !in_array( $googlePlus_transient, $apss_social_counts_transients ) ) {
|
600 |
-
$apss_social_counts_transients[] = $googlePlus_transient;
|
601 |
-
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
602 |
-
}
|
603 |
-
} else {
|
604 |
-
$plusones_count = $googlePlus_transient_count;
|
605 |
-
}
|
606 |
-
}else{
|
607 |
-
$curl = curl_init();
|
608 |
-
curl_setopt( $curl, CURLOPT_URL, "https://clients6.google.com/rpc" );
|
609 |
-
curl_setopt( $curl, CURLOPT_POST, true );
|
610 |
-
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
|
611 |
-
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"}]' );
|
612 |
-
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
|
613 |
-
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-type: application/json' ) );
|
614 |
-
$curl_results = curl_exec( $curl );
|
615 |
-
curl_close( $curl );
|
616 |
-
unset( $curl );
|
617 |
-
$json = json_decode( $curl_results, true );
|
618 |
-
$plusones_count = isset( $json[0]['result']['metadata']['globalCounts']['count'] ) ? intval( $json[0]['result']['metadata']['globalCounts']['count'] ) : 0;
|
619 |
-
}
|
620 |
-
return $plusones_count;
|
621 |
-
}
|
622 |
-
|
623 |
-
//for pinterest url share count
|
624 |
-
function get_pinterest( $url ) {
|
625 |
-
$apss_settings = $this->apss_settings;
|
626 |
-
if(!isset($apss_settings['enable_cache']) || $apss_settings['enable_cache'] == '1'){
|
627 |
-
$cache_period = $apss_settings['cache_period'];
|
628 |
-
$pinterest_transient = 'pinterest_' . md5( $url );
|
629 |
-
$pinterest_transient_count = get_transient( $pinterest_transient );
|
630 |
-
|
631 |
-
//for setting the counter transient in separate options value
|
632 |
-
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
633 |
-
if ( false === $pinterest_transient_count ) {
|
634 |
-
$json_string = $this->get_json_values( 'http://api.pinterest.com/v1/urls/count.json?url=' . $url );
|
635 |
-
$json_string = preg_replace( '/^receiveCount\((.*)\)$/', "\\1", $json_string );
|
636 |
-
$json = json_decode( $json_string, true );
|
637 |
-
$pinterest_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
638 |
-
set_transient( $pinterest_transient, $pinterest_count, $cache_period * HOUR_IN_SECONDS );
|
639 |
-
if ( !in_array( $pinterest_transient, $apss_social_counts_transients ) ) {
|
640 |
-
$apss_social_counts_transients[] = $pinterest_transient;
|
641 |
-
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
642 |
-
}
|
643 |
-
} else {
|
644 |
-
$pinterest_count = $pinterest_transient_count;
|
645 |
-
}
|
646 |
-
}else{
|
647 |
-
$json_string = $this->get_json_values( 'http://api.pinterest.com/v1/urls/count.json?url=' . $url );
|
648 |
-
$json_string = preg_replace( '/^receiveCount\((.*)\)$/', "\\1", $json_string );
|
649 |
-
$json = json_decode( $json_string, true );
|
650 |
-
$pinterest_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
651 |
-
}
|
652 |
-
return $pinterest_count;
|
653 |
-
}
|
654 |
-
|
655 |
-
//for linkedin url share count
|
656 |
-
function get_linkedin( $url ) {
|
657 |
-
$apss_settings = $this->apss_settings;
|
658 |
-
if(!isset($apss_settings['enable_cache']) || $apss_settings['enable_cache'] == '1'){
|
659 |
-
$cache_period = $apss_settings['cache_period'];
|
660 |
-
$linkedin_transient = 'linkedin_' . md5( $url );
|
661 |
-
$linkedin_transient_count = get_transient( $linkedin_transient );
|
662 |
-
|
663 |
-
//for setting the counter transient in separate options value
|
664 |
-
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
665 |
-
if ( false === $linkedin_transient_count ) {
|
666 |
-
$json_string = $this->get_json_values( "https://www.linkedin.com/countserv/count/share?url=$url&format=json" );
|
667 |
-
$json = json_decode( $json_string, true );
|
668 |
-
$linkedin_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
669 |
-
|
670 |
-
set_transient( $linkedin_transient, $linkedin_count, $cache_period * HOUR_IN_SECONDS );
|
671 |
-
if ( !in_array( $linkedin_transient, $apss_social_counts_transients ) ) {
|
672 |
-
$apss_social_counts_transients[] = $linkedin_transient;
|
673 |
-
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
674 |
-
}
|
675 |
-
} else {
|
676 |
-
$linkedin_count = $linkedin_transient_count;
|
677 |
-
}
|
678 |
-
}else{
|
679 |
-
$json_string = $this->get_json_values( "https://www.linkedin.com/countserv/count/share?url=$url&format=json" );
|
680 |
-
$json = json_decode( $json_string, true );
|
681 |
-
$linkedin_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
|
682 |
-
}
|
683 |
-
return $linkedin_count;
|
684 |
-
}
|
685 |
-
|
686 |
-
//function to return json values from social media urls
|
687 |
-
private function get_json_values( $url ) {
|
688 |
-
$args = array( 'timeout' => 10 );
|
689 |
-
$response = wp_remote_get( $url, $args );
|
690 |
-
$json_response = wp_remote_retrieve_body( $response );
|
691 |
-
return $json_response;
|
692 |
-
}
|
693 |
-
|
694 |
-
////////////////////////////////////for count ends here/////////////////////////////////////////////
|
695 |
-
|
696 |
-
function get_count( $profile_name, $url ) {
|
697 |
-
|
698 |
-
$url = apply_filters('apss_share_url', $url);
|
699 |
-
|
700 |
-
switch ( $profile_name ) {
|
701 |
-
case 'facebook':
|
702 |
-
$count = $this->new_get_fb( $url );
|
703 |
-
break;
|
704 |
-
|
705 |
-
case 'twitter':
|
706 |
-
$count = $this->get_tweets( $url );
|
707 |
-
break;
|
708 |
-
|
709 |
-
case 'google-plus':
|
710 |
-
$count = $this->get_plusones( $url );
|
711 |
-
break;
|
712 |
-
|
713 |
-
case 'linkedin':
|
714 |
-
$count = $this->get_linkedin( $url );
|
715 |
-
break;
|
716 |
-
|
717 |
-
case 'pinterest':
|
718 |
-
$count = $this->get_pinterest( $url );
|
719 |
-
break;
|
720 |
-
|
721 |
-
default:
|
722 |
-
$count = 0;
|
723 |
-
break;
|
724 |
-
}
|
725 |
-
return $count;
|
726 |
-
}
|
727 |
-
|
728 |
-
public static function get_http_url( $url ) {
|
729 |
-
return preg_replace( '/https:/i', 'http:', $url );
|
730 |
}
|
731 |
-
}
|
732 |
|
733 |
-
|
734 |
|
735 |
-
|
736 |
|
|
|
737 |
}
|
4 |
Plugin name: Social Share WordPress Plugin - 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: 4.3.9
|
8 |
Author: AccessPress Themes
|
9 |
Author URI: http://accesspressthemes.com
|
10 |
Text Domain: accesspress-social-share
|
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', '4.3.9' );
|
34 |
}
|
35 |
|
36 |
+
if ( ! defined( 'APSS_TEXT_DOMAIN' ) ) {
|
37 |
+
define( 'APSS_TEXT_DOMAIN', 'accesspress-social-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 |
+
if ( ! class_exists( 'APSS_Class' ) ) {
|
50 |
+
|
51 |
+
class APSS_Class{
|
52 |
+
|
53 |
+
var $apss_settings;
|
54 |
+
var $apss_social_counts_transients;
|
55 |
+
|
56 |
+
function __construct(){
|
57 |
+
$this -> apss_settings = get_option( APSS_SETTING_NAME ); //get the plugin variable contents from the options table.
|
58 |
+
register_activation_hook( __FILE__, array( $this, 'plugin_activation' ) ); //load the default setting for the plugin while activating
|
59 |
+
add_action( 'init', array( $this, 'plugin_text_domain' ) ); //load the plugin text domain
|
60 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_assets' ) ); //registers all the assets required for wp-admin
|
61 |
+
add_filter( 'the_content', array( $this, 'apss_the_content_filter' ), 110 ); // add the filter function for display of social share icons in frontend //added 12 priority level at the end to make the plugin compactible with Visual Composer.
|
62 |
+
|
63 |
+
if ( isset( $this -> apss_settings[ 'disable_frontend_assets' ] ) && $this -> apss_settings[ 'disable_frontend_assets' ] != '1' ) {
|
64 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_assets' ) ); //registers all the assets required for the frontend
|
65 |
+
} else if ( ! isset( $this -> apss_settings[ 'disable_frontend_assets' ] ) ) {
|
66 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_assets' ) ); //registers all the assets required for the frontend
|
67 |
+
}
|
68 |
+
|
69 |
+
add_action( 'admin_menu', array( $this, 'add_apss_menu' ) ); //register the plugin menu in backend
|
70 |
+
add_action( 'admin_post_apss_save_options', array( $this, 'apss_save_options' ) ); //save the options in the wordpress options table.
|
71 |
+
add_action( 'admin_post_apss_restore_default_settings', array( $this, 'apss_restore_default_settings' ) ); //restores default settings.
|
72 |
+
add_action( 'admin_post_apss_clear_cache', array( $this, 'apss_clear_cache' ) ); //clear the cache of the social share counter.
|
73 |
+
add_shortcode( 'apss-share', array( $this, 'apss_shortcode' ) ); //adds a shortcode
|
74 |
+
add_shortcode( 'apss_share', array( $this, 'apss_shortcode' ) ); //added a new shortcode to remove the shortcode with hyphen in future
|
75 |
+
add_shortcode( 'apss-count', array( $this, 'apss_count_shortcode' ) ); //adds a share count shortcode
|
76 |
+
add_shortcode( 'apss_count', array( $this, 'apss_count_shortcode' ) ); //added a new shortcode to remove the shortcode with hyphen in future
|
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 |
+
|
87 |
+
global $wpdb;
|
88 |
if ( is_multisite() ) {
|
89 |
+
$current_blog = $wpdb -> blogid;
|
90 |
// Get all blogs in the network and activate plugin on each one
|
91 |
+
$blog_ids = $wpdb -> get_col( "SELECT blog_id FROM $wpdb -> blogs" );
|
92 |
foreach ( $blog_ids as $blog_id ) {
|
93 |
switch_to_blog( $blog_id );
|
94 |
+
if ( ! get_option( APSS_SETTING_NAME ) ) {
|
95 |
+
include( 'inc/backend/activation.php' );
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( ! get_option( APSS_COUNT_TRANSIENTS ) ) {
|
99 |
+
$apss_social_counts_transients = array();
|
100 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
101 |
+
}
|
102 |
+
}
|
103 |
+
} else {
|
104 |
+
if ( ! get_option( APSS_SETTING_NAME ) ) {
|
105 |
+
include( 'inc/backend/activation.php' );
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( ! get_option( APSS_COUNT_TRANSIENTS ) ) {
|
109 |
+
$apss_social_counts_transients = array();
|
110 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
//loads the text domain for translation
|
116 |
+
function plugin_text_domain(){
|
117 |
+
load_plugin_textdomain( 'accesspress-social-share', false, APSS_LANG_DIR );
|
118 |
+
}
|
119 |
+
|
120 |
+
//functions to register frontend styles and scripts
|
121 |
+
function register_admin_assets(){
|
122 |
+
/**
|
123 |
+
* Backend CSS
|
124 |
+
* */
|
125 |
+
if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'accesspress-social-share' ) {
|
126 |
+
wp_enqueue_style( 'aps-admin-css', APSS_CSS_DIR . '/backend.css', false, APSS_VERSION ); //registering plugin admin css
|
127 |
+
wp_enqueue_style( 'fontawesome-css', APSS_CSS_DIR . '/font-awesome/font-awesome.min.css', false, APSS_VERSION );
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Backend JS
|
131 |
+
* */
|
132 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
133 |
+
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
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
//function to return the content filter for the posts and pages
|
138 |
+
function apss_the_content_filter( $content ){
|
139 |
+
if ( in_array( 'get_the_excerpt', $GLOBALS[ 'wp_current_filter' ] ) )
|
140 |
+
return $content;
|
141 |
+
global $post;
|
142 |
+
$post_content = $content;
|
143 |
+
$title = str_replace( '+', '%20', urlencode( $post -> post_title ) );
|
144 |
+
$content = trim( strip_shortcodes( strip_tags( $post -> post_content ) ) );
|
145 |
+
if ( strlen( $content ) >= 100 ) {
|
146 |
+
$excerpt = urlencode( substr( $content, 0, 100 ) . '...' );
|
147 |
+
} else {
|
148 |
+
$excerpt = urlencode( $content );
|
149 |
+
}
|
150 |
+
$options = $this -> apss_settings;
|
151 |
+
ob_start();
|
152 |
+
include('inc/frontend/content-filter.php');
|
153 |
+
$html_content = ob_get_contents();
|
154 |
+
ob_get_clean();
|
155 |
+
|
156 |
+
$share_shows_in_options = $options[ 'share_options' ];
|
157 |
+
$content_flag = get_post_meta( $post -> ID, 'apss_content_flag', true );
|
158 |
+
|
159 |
+
$all = in_array( 'all', $options[ 'share_options' ] );
|
160 |
+
$is_lists_authorized = (is_search() && $content_flag != '1' ) && $all ? true : false;
|
161 |
+
|
162 |
+
$is_attachement_check = in_array( 'attachment', $options[ 'share_options' ] );
|
163 |
+
$is_attachement = (is_attachment() && $is_attachement_check ) ? true : false;
|
164 |
+
|
165 |
+
$front_page = in_array( 'front_page', $options[ 'share_options' ] );
|
166 |
+
$is_front_page = (is_front_page() && $content_flag != '1' ) && $front_page ? true : false;
|
167 |
+
|
168 |
+
$share_shows_in_options = $options[ 'share_options' ];
|
169 |
+
$is_singular = is_singular( $share_shows_in_options ) && ! is_front_page() && $content_flag != '1' ? true : false;
|
170 |
+
|
171 |
+
if ( ! empty( $share_shows_in_options ) ) {
|
172 |
+
$is_tax = is_tax( $share_shows_in_options );
|
173 |
+
} else {
|
174 |
+
$is_tax = false;
|
175 |
+
}
|
176 |
+
|
177 |
+
$is_category = in_array( 'categories', $options[ 'share_options' ] );
|
178 |
+
$default_category = ( is_category() ) && $is_category ? true : false;
|
179 |
+
|
180 |
+
$is_default_archive = in_array( 'archives', $options[ 'share_options' ] );
|
181 |
+
$default_archives = ( ( is_archive() && ! is_tax() ) && ! is_category() ) && $is_default_archive ? true : false;
|
182 |
+
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
|
183 |
+
$show_icons = false;
|
184 |
+
} else {
|
185 |
+
$show_icons = true;
|
186 |
+
}
|
187 |
+
|
188 |
+
if ( empty( $options[ 'share_options' ] ) ) {
|
189 |
+
return $post_content;
|
190 |
+
} else if ( ($is_lists_authorized || $is_attachement || $is_singular || $is_tax || $is_front_page || $default_category || $default_archives) && $show_icons ) {
|
191 |
+
if ( $options[ 'share_positions' ] == 'below_content' ) {
|
192 |
+
return $post_content . "<div class='apss-social-share apss-theme-$icon_set_value clearfix' >" . $html_content . "</div>";
|
193 |
+
}
|
194 |
+
|
195 |
+
if ( $options[ 'share_positions' ] == 'above_content' ) {
|
196 |
+
return "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$html_content</div>" . $post_content;
|
197 |
}
|
198 |
+
|
199 |
+
if ( $options[ 'share_positions' ] == 'on_both' ) {
|
200 |
+
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>";
|
201 |
+
}
|
202 |
+
} else {
|
203 |
+
return $post_content;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Registers Frontend Assets
|
209 |
+
* */
|
210 |
+
function register_frontend_assets(){
|
211 |
+
wp_enqueue_style( 'apss-font-awesome', APSS_CSS_DIR . '/font-awesome/font-awesome.min.css', array(), APSS_VERSION );
|
212 |
+
wp_enqueue_style( 'apss-font-opensans', '//fonts.googleapis.com/css?family=Open+Sans', array(), false );
|
213 |
+
wp_enqueue_style( 'apss-frontend-css', APSS_CSS_DIR . '/frontend.css', array( 'apss-font-awesome' ), APSS_VERSION );
|
214 |
+
wp_enqueue_script( 'apss-frontend-mainjs', APSS_JS_DIR . '/frontend.js', array( 'jquery' ), APSS_VERSION, true );
|
215 |
+
$ajax_nonce = wp_create_nonce( 'apss-ajax-nonce' );
|
216 |
+
wp_localize_script( 'apss-frontend-mainjs', 'frontend_ajax_object', array( 'ajax_url' => admin_url() . 'admin-ajax.php', 'ajax_nonce' => $ajax_nonce ) );
|
217 |
+
}
|
218 |
+
|
219 |
+
//add plugins menu in backend
|
220 |
+
function add_apss_menu(){
|
221 |
+
add_menu_page( 'AccessPress Social Share', 'AccessPress Social Share', 'manage_options', 'accesspress-social-share', array( $this, 'main_page' ), APSS_IMAGE_DIR . '/apss-icon.png' );
|
222 |
+
}
|
223 |
+
|
224 |
+
//for saving the plugin settings
|
225 |
+
function apss_save_options(){
|
226 |
+
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' ) ) {
|
227 |
+
include( 'inc/backend/save-settings.php' );
|
228 |
+
} else {
|
229 |
+
die( 'No script kiddies please!' );
|
230 |
}
|
231 |
+
}
|
232 |
+
|
233 |
+
//function to restore the default setting of a plugin
|
234 |
+
function apss_restore_default_settings(){
|
235 |
+
$nonce = $_REQUEST[ '_wpnonce' ];
|
236 |
+
if ( ! empty( $_GET ) && wp_verify_nonce( $nonce, 'apss-restore-default-settings-nonce' ) ) {
|
237 |
+
//restore the default plugin activation settings from the activation page.
|
238 |
+
include( 'inc/backend/activation.php' );
|
239 |
+
wp_redirect( admin_url() . 'admin.php?page=accesspress-social-share&message=3' );
|
240 |
+
exit;
|
241 |
+
} else {
|
242 |
+
die( 'No script kiddies please!' );
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Clears the social share counter cache
|
248 |
+
*/
|
249 |
+
function apss_clear_cache(){
|
250 |
+
if ( ! empty( $_GET ) && wp_verify_nonce( $_GET[ '_wpnonce' ], 'apss-clear-cache-nonce' ) ) {
|
251 |
+
$apss_settings = $this -> apss_settings;
|
252 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
253 |
+
foreach ( $apss_social_counts_transients as $transient ) {
|
254 |
+
delete_transient( $transient );
|
255 |
+
}
|
256 |
+
update_option( APSS_COUNT_TRANSIENTS, array() );
|
257 |
+
$transient_array = array( 'apss_tweets_count', 'apss_linkedin_count', 'apss_fb_count', 'apss_pin_count', 'apss_google_plus_count' );
|
258 |
+
foreach ( $transient_array as $transient ) {
|
259 |
+
delete_transient( $transient );
|
260 |
+
}
|
261 |
+
wp_redirect( admin_url() . 'admin.php?page=accesspress-social-share&message=4' );
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
//function for adding shortcode of a plugin
|
266 |
+
function apss_shortcode( $attr ){
|
267 |
+
ob_start();
|
268 |
+
include( 'inc/frontend/shortcode.php' );
|
269 |
+
$html = ob_get_contents();
|
270 |
+
ob_get_clean();
|
271 |
+
return $html;
|
272 |
+
}
|
273 |
+
|
274 |
+
//frontend counter
|
275 |
+
function frontend_counter(){
|
276 |
+
if ( ! empty( $_GET ) && wp_verify_nonce( $_GET[ '_wpnonce' ], 'apss-ajax-nonce' ) ) {
|
277 |
+
$apss_settings = $this -> apss_settings;
|
278 |
+
$new_detail_array = array();
|
279 |
+
if ( isset( $_POST[ 'data' ] ) ) {
|
280 |
+
$details = $_POST[ 'data' ];
|
281 |
+
foreach ( $details as $detail ) {
|
282 |
+
$new_detail_array[ $detail[ 'network' ] ] = $this -> get_count( $detail[ 'network' ], $detail[ 'url' ] );
|
283 |
+
}
|
284 |
+
} else if ( isset( $_POST[ 'shortcode_data' ] ) ) {
|
285 |
+
$shortcode_data = $_POST[ 'shortcode_data' ];
|
286 |
+
foreach ( $shortcode_data as $detail ) {
|
287 |
+
$detail_array = explode( '_', $detail );
|
288 |
+
$url = trim( $detail_array[ 0 ] );
|
289 |
+
$network = $detail_array[ 1 ];
|
290 |
+
$new_detail_array[] = $this -> get_count( $network, $url );
|
291 |
+
}
|
292 |
+
}
|
293 |
+
die( json_encode( $new_detail_array ) );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
//frontend counter only Shortcode
|
298 |
+
function apss_count_shortcode( $attr ){
|
299 |
+
ob_start();
|
300 |
+
include( 'inc/frontend/count_shortcode.php' );
|
301 |
+
$html = ob_get_contents();
|
302 |
+
ob_get_clean();
|
303 |
+
return $html;
|
304 |
+
}
|
305 |
+
|
306 |
+
///////////////////////////for post meta options//////////////////////////////////
|
307 |
+
/**
|
308 |
+
* Adds a section in all the post and page section to disable the share options in frontend pages
|
309 |
+
*/
|
310 |
+
function social_meta_box(){
|
311 |
+
add_meta_box( 'ap-share-box', 'AccessPress social share options', array( $this, 'metabox_callback' ), '', 'side', 'core' );
|
312 |
+
}
|
313 |
+
|
314 |
+
function metabox_callback( $post ){
|
315 |
+
wp_nonce_field( 'save_meta_values', 'ap_share_meta_nonce' );
|
316 |
+
$content_flag = get_post_meta( $post -> ID, 'apss_content_flag', true );
|
317 |
+
?>
|
318 |
+
<label><input type="checkbox" value="1" name="apss_content_flag" <?php checked( $content_flag, true ) ?>/><?php _e( 'Hide share icons in content', 'accesspress-social-share' ); ?></label><br>
|
319 |
+
<?php
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Save Share Flags on post save
|
324 |
+
*/
|
325 |
+
function save_meta_values( $post_id ){
|
326 |
+
|
327 |
+
/*
|
328 |
+
* We need to verify this came from our screen and with proper authorization,
|
329 |
+
* because the save_post action can be triggered at other times.
|
330 |
+
*/
|
331 |
+
|
332 |
+
// Check if our nonce is set.
|
333 |
+
if ( ! isset( $_POST[ 'ap_share_meta_nonce' ] ) ) {
|
334 |
+
return;
|
335 |
+
}
|
336 |
+
|
337 |
+
// Verify that the nonce is valid.
|
338 |
+
if ( ! wp_verify_nonce( $_POST[ 'ap_share_meta_nonce' ], 'save_meta_values' ) ) {
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
|
342 |
+
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
|
343 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
344 |
+
return;
|
345 |
+
}
|
346 |
+
|
347 |
+
// Check the user's permissions.
|
348 |
+
if ( isset( $_POST[ 'post_type' ] ) && 'page' == $_POST[ 'post_type' ] ) {
|
349 |
+
|
350 |
+
if ( ! current_user_can( 'edit_page', $post_id ) ) {
|
351 |
+
return;
|
352 |
+
}
|
353 |
+
} else {
|
354 |
+
|
355 |
+
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
356 |
+
return;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
/* OK, it's safe for us to save the data now. */
|
361 |
+
// Make sure that it is set.
|
362 |
+
$content_flag = (isset( $_POST[ 'apss_content_flag' ] ) && $_POST[ 'apss_content_flag' ] == 1) ? 1 : 0;
|
363 |
+
|
364 |
+
// Update the meta field in the database.
|
365 |
+
update_post_meta( $post_id, 'apss_content_flag', $content_flag );
|
366 |
+
}
|
367 |
+
|
368 |
+
////////////////////////////////////////////////////////////
|
369 |
+
//plugins backend admin page
|
370 |
+
function main_page(){
|
371 |
+
include('inc/backend/main-page.php');
|
372 |
+
}
|
373 |
+
|
374 |
+
//returns the current page url
|
375 |
+
function curPageURL(){
|
376 |
+
$pageURL = 'http';
|
377 |
+
if ( isset( $_SERVER[ 'HTTPS' ] ) && $_SERVER[ 'HTTPS' ] == 'on' ) {
|
378 |
+
$pageURL .= "s";
|
379 |
+
}
|
380 |
+
$pageURL .= "://";
|
381 |
+
if ( $_SERVER[ "SERVER_PORT" ] != "80" ) {
|
382 |
+
$pageURL .= $_SERVER[ "SERVER_NAME" ] . ":" . $_SERVER[ "SERVER_PORT" ] . $_SERVER[ "REQUEST_URI" ];
|
383 |
+
} else {
|
384 |
+
$pageURL .= $_SERVER[ "SERVER_NAME" ] . $_SERVER[ "REQUEST_URI" ];
|
385 |
+
}
|
386 |
+
return $pageURL;
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Funciton to print array in pre format
|
391 |
+
* */
|
392 |
+
function print_array( $array ){
|
393 |
+
echo "<pre>";
|
394 |
+
print_r( $array );
|
395 |
+
echo "</pre>";
|
396 |
+
}
|
397 |
+
|
398 |
+
////////////////////////////////////for count //////////////////////////////////////////////////////
|
399 |
+
//for facebook url share count
|
400 |
+
function get_fb( $url ){
|
401 |
+
$apss_settings = $this -> apss_settings;
|
402 |
+
if ( ! isset( $apss_settings[ 'enable_cache' ] ) || $apss_settings[ 'enable_cache' ] == '1' ) {
|
403 |
+
////////////////////////for transient//////////////////////////////
|
404 |
+
$cache_period = $apss_settings[ 'cache_period' ];
|
405 |
+
$fb_transient = 'fb_' . md5( $url );
|
406 |
+
$fb_transient_count = get_transient( $fb_transient );
|
407 |
+
|
408 |
+
//for setting the counter transient in separate options value
|
409 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
410 |
+
if ( false === $fb_transient_count ) {
|
411 |
+
$json_string = $this -> get_json_values( 'https://graph.facebook.com/?id=' . $url );
|
412 |
+
$json = json_decode( $json_string, true );
|
413 |
+
$facebook_count = isset( $json[ 'share' ][ 'share_count' ] ) ? intval( $json[ 'share' ][ 'share_count' ] ) : 0;
|
414 |
+
set_transient( $fb_transient, $facebook_count, $cache_period * HOUR_IN_SECONDS );
|
415 |
+
if ( ! in_array( $fb_transient, $apss_social_counts_transients ) ) {
|
416 |
+
$apss_social_counts_transients[] = $fb_transient;
|
417 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
418 |
+
}
|
419 |
+
} else {
|
420 |
+
$facebook_count = $fb_transient_count;
|
421 |
+
}
|
422 |
+
////////////////////////for transient ends ///////////////////////////
|
423 |
+
} else {
|
424 |
+
$json_string = $this -> get_json_values( 'https://graph.facebook.com/?id=' . $url );
|
425 |
+
$json = json_decode( $json_string, true );
|
426 |
+
$facebook_count = isset( $json[ 'share' ][ 'share_count' ] ) ? intval( $json[ 'share' ][ 'share_count' ] ) : 0;
|
427 |
+
}
|
428 |
+
return $facebook_count;
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Get Facebook Access Token
|
433 |
+
* */
|
434 |
+
function get_fb_access_token(){
|
435 |
+
$apss_settings = $this -> apss_settings;
|
436 |
+
$app_id = $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_id' ];
|
437 |
+
$app_secret = $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_secret' ];
|
438 |
+
$api_url = 'https://graph.facebook.com/';
|
439 |
+
$app_id = $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_id' ];
|
440 |
+
$app_secret = $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_secret' ];
|
441 |
+
$url = sprintf(
|
442 |
+
'%soauth/access_token?client_id=%s&client_secret=%s&grant_type=client_credentials', $api_url, $app_id, $app_secret
|
443 |
+
);
|
444 |
+
|
445 |
+
$access_token = wp_remote_get( $url, array( 'timeout' => 60 ) );
|
446 |
+
if ( is_wp_error( $access_token ) || ( isset( $access_token[ 'response' ][ 'code' ] ) && 200 != $access_token[ 'response' ][ 'code' ] ) ) {
|
447 |
+
return '';
|
448 |
+
} else {
|
449 |
+
$json_decode = json_decode( $access_token[ 'body' ] );
|
450 |
+
return sanitize_text_field( $json_decode -> access_token );
|
451 |
+
}
|
452 |
+
}
|
453 |
+
|
454 |
+
function new_get_fb( $url ){
|
455 |
+
$apss_settings = $this -> apss_settings;
|
456 |
+
|
457 |
+
if ( isset( $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_id' ] ) && $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_id' ] != '' ) {
|
458 |
+
$fb_app_id = $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_id' ];
|
459 |
+
}
|
460 |
+
|
461 |
+
if ( isset( $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_secret' ] ) && $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_secret' ] != '' ) {
|
462 |
+
$fb_app_secret = $apss_settings[ 'api_configuration' ][ 'facebook' ][ 'app_id' ];
|
463 |
+
}
|
464 |
+
|
465 |
+
if ( ! isset( $fb_app_id ) || ! isset( $fb_app_secret ) ) {
|
466 |
+
$facebook_count = self:: get_fb( $url );
|
467 |
+
return $facebook_count;
|
468 |
+
} else {
|
469 |
+
$access_token = self:: get_fb_access_token();
|
470 |
+
$api_url = 'https://graph.facebook.com/';
|
471 |
+
$facebook_count = sprintf(
|
472 |
+
'%s?access_token=%s&id=%s', $api_url, $access_token, $url
|
473 |
+
);
|
474 |
+
$apss_settings = $this -> apss_settings;
|
475 |
+
if ( isset( $apss_settings[ 'enable_cache' ] ) && $apss_settings[ 'enable_cache' ] == '1' ) {
|
476 |
+
////////////////////////for transient//////////////////////////////
|
477 |
+
$cache_period = $apss_settings[ 'cache_period' ];
|
478 |
+
$fb_transient = 'fb_' . md5( $url );
|
479 |
+
$fb_transient_count = get_transient( $fb_transient );
|
480 |
+
|
481 |
+
//for setting the counter transient in separate options value
|
482 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
483 |
+
if ( false === $fb_transient_count ) {
|
484 |
+
$json_string = $this -> get_json_values( $facebook_count );
|
485 |
+
$json = json_decode( $json_string, true );
|
486 |
+
$facebook_count = isset( $json[ 'share' ][ 'share_count' ] ) ? intval( $json[ 'share' ][ 'share_count' ] ) : 0;
|
487 |
+
set_transient( $fb_transient, $facebook_count, $cache_period * HOUR_IN_SECONDS );
|
488 |
+
if ( ! in_array( $fb_transient, $apss_social_counts_transients ) ) {
|
489 |
+
$apss_social_counts_transients[] = $fb_transient;
|
490 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
491 |
+
}
|
492 |
+
} else {
|
493 |
+
$facebook_count = $fb_transient_count;
|
494 |
+
}
|
495 |
+
////////////////////////for transient ends ///////////////////////////
|
496 |
+
} else {
|
497 |
+
$json_string = $this -> get_json_values( $facebook_count );
|
498 |
+
$json = json_decode( $json_string, true );
|
499 |
+
$facebook_count = isset( $json[ 'share' ][ 'share_count' ] ) ? intval( $json[ 'share' ][ 'share_count' ] ) : 0;
|
500 |
+
}
|
501 |
+
return $facebook_count;
|
502 |
+
die();
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
//for twitter url share count
|
507 |
+
function get_tweets( $url ){
|
508 |
+
$apss_settings = $this -> apss_settings;
|
509 |
+
if ( ! isset( $apss_settings[ 'enable_cache' ] ) || $apss_settings[ 'enable_cache' ] == '1' ) {
|
510 |
+
$cache_period = $apss_settings[ 'cache_period' ];
|
511 |
+
$twitter_transient = 'twitter_' . md5( $url );
|
512 |
+
$twitter_transient_count = get_transient( $twitter_transient );
|
513 |
+
//for setting the counter transient in separate options value
|
514 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
515 |
+
if ( false === $twitter_transient_count ) {
|
516 |
+
if ( isset( $apss_settings[ 'twitter_counter_api' ] ) ) {
|
517 |
+
$api_selection = $apss_settings[ 'twitter_counter_api' ];
|
518 |
+
} else {
|
519 |
+
$api_selection = '1';
|
520 |
+
}
|
521 |
+
|
522 |
+
if ( $api_selection == '2' ) {
|
523 |
+
$json_string = $this -> get_json_values( 'http://public.newsharecounts.com/count.json?url=' . $url );
|
524 |
+
} else if ( $api_selection == '3' ) {
|
525 |
+
$json_string = $this -> get_json_values( 'http://opensharecount.com/count.json?url=' . $url );
|
526 |
+
} else {
|
527 |
+
// depriciated url share count. returns null
|
528 |
+
$json_string = $this -> get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
|
529 |
+
}
|
530 |
+
|
531 |
+
$json = json_decode( $json_string, true );
|
532 |
+
$tweet_count = isset( $json[ 'count' ] ) ? intval( $json[ 'count' ] ) : 0;
|
533 |
+
set_transient( $twitter_transient, $tweet_count, $cache_period * HOUR_IN_SECONDS );
|
534 |
+
if ( ! in_array( $twitter_transient, $apss_social_counts_transients ) ) {
|
535 |
+
$apss_social_counts_transients[] = $twitter_transient;
|
536 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
537 |
+
}
|
538 |
+
} else {
|
539 |
+
$tweet_count = $twitter_transient_count;
|
540 |
+
}
|
541 |
+
} else {
|
542 |
+
if ( isset( $apss_settings[ 'twitter_counter_api' ] ) ) {
|
543 |
+
$api_selection = $apss_settings[ 'twitter_counter_api' ];
|
544 |
+
} else {
|
545 |
+
$api_selection = '1';
|
546 |
+
}
|
547 |
+
|
548 |
+
if ( $api_selection == '2' ) {
|
549 |
+
$json_string = $this -> get_json_values( 'http://public.newsharecounts.com/count.json?url=' . $url );
|
550 |
+
} else if ( $api_selection == '3' ) {
|
551 |
+
$json_string = $this -> get_json_values( 'http://opensharecount.com/count.json?url=' . $url );
|
552 |
+
} else {
|
553 |
+
// depriciated url share count. returns null
|
554 |
+
$json_string = $this -> get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
|
555 |
+
}
|
556 |
+
|
557 |
+
$json = json_decode( $json_string, true );
|
558 |
+
$tweet_count = isset( $json[ 'count' ] ) ? intval( $json[ 'count' ] ) : 0;
|
559 |
+
}
|
560 |
+
return $tweet_count;
|
561 |
+
}
|
562 |
+
|
563 |
+
//for google plus url share count
|
564 |
+
function get_plusones( $url ){
|
565 |
+
$apss_settings = $this -> apss_settings;
|
566 |
+
if ( ! isset( $apss_settings[ 'enable_cache' ] ) || $apss_settings[ 'enable_cache' ] == '1' ) {
|
567 |
+
$cache_period = $apss_settings[ 'cache_period' ];
|
568 |
+
$googlePlus_transient = 'gp_' . md5( $url );
|
569 |
+
$googlePlus_transient_count = get_transient( $googlePlus_transient );
|
570 |
+
|
571 |
+
//for setting the counter transient in separate options value
|
572 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
573 |
+
if ( false === $googlePlus_transient_count ) {
|
574 |
+
$curl = curl_init();
|
575 |
+
curl_setopt( $curl, CURLOPT_URL, "https://clients6.google.com/rpc" );
|
576 |
+
curl_setopt( $curl, CURLOPT_POST, true );
|
577 |
+
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
|
578 |
+
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"}]' );
|
579 |
+
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
|
580 |
+
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-type: application/json' ) );
|
581 |
+
$curl_results = curl_exec( $curl );
|
582 |
+
curl_close( $curl );
|
583 |
+
unset( $curl );
|
584 |
+
$json = json_decode( $curl_results, true );
|
585 |
+
$plusones_count = isset( $json[ 0 ][ 'result' ][ 'metadata' ][ 'globalCounts' ][ 'count' ] ) ? intval( $json[ 0 ][ 'result' ][ 'metadata' ][ 'globalCounts' ][ 'count' ] ) : 0;
|
586 |
+
set_transient( $googlePlus_transient, $plusones_count, $cache_period * HOUR_IN_SECONDS );
|
587 |
+
if ( ! in_array( $googlePlus_transient, $apss_social_counts_transients ) ) {
|
588 |
+
$apss_social_counts_transients[] = $googlePlus_transient;
|
589 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
590 |
+
}
|
591 |
+
} else {
|
592 |
+
$plusones_count = $googlePlus_transient_count;
|
593 |
+
}
|
594 |
+
} else {
|
595 |
+
$curl = curl_init();
|
596 |
+
curl_setopt( $curl, CURLOPT_URL, "https://clients6.google.com/rpc" );
|
597 |
+
curl_setopt( $curl, CURLOPT_POST, true );
|
598 |
+
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
|
599 |
+
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"}]' );
|
600 |
+
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
|
601 |
+
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-type: application/json' ) );
|
602 |
+
$curl_results = curl_exec( $curl );
|
603 |
+
curl_close( $curl );
|
604 |
+
unset( $curl );
|
605 |
+
$json = json_decode( $curl_results, true );
|
606 |
+
$plusones_count = isset( $json[ 0 ][ 'result' ][ 'metadata' ][ 'globalCounts' ][ 'count' ] ) ? intval( $json[ 0 ][ 'result' ][ 'metadata' ][ 'globalCounts' ][ 'count' ] ) : 0;
|
607 |
+
}
|
608 |
+
return $plusones_count;
|
609 |
+
}
|
610 |
+
|
611 |
+
//for pinterest url share count
|
612 |
+
function get_pinterest( $url ){
|
613 |
+
$apss_settings = $this -> apss_settings;
|
614 |
+
if ( ! isset( $apss_settings[ 'enable_cache' ] ) || $apss_settings[ 'enable_cache' ] == '1' ) {
|
615 |
+
$cache_period = $apss_settings[ 'cache_period' ];
|
616 |
+
$pinterest_transient = 'pinterest_' . md5( $url );
|
617 |
+
$pinterest_transient_count = get_transient( $pinterest_transient );
|
618 |
+
|
619 |
+
//for setting the counter transient in separate options value
|
620 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
621 |
+
if ( false === $pinterest_transient_count ) {
|
622 |
+
$json_string = $this -> get_json_values( 'http://api.pinterest.com/v1/urls/count.json?url=' . $url );
|
623 |
+
$json_string = preg_replace( '/^receiveCount\((.*)\)$/', "\\1", $json_string );
|
624 |
+
$json = json_decode( $json_string, true );
|
625 |
+
$pinterest_count = isset( $json[ 'count' ] ) ? intval( $json[ 'count' ] ) : 0;
|
626 |
+
set_transient( $pinterest_transient, $pinterest_count, $cache_period * HOUR_IN_SECONDS );
|
627 |
+
if ( ! in_array( $pinterest_transient, $apss_social_counts_transients ) ) {
|
628 |
+
$apss_social_counts_transients[] = $pinterest_transient;
|
629 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
630 |
+
}
|
631 |
+
} else {
|
632 |
+
$pinterest_count = $pinterest_transient_count;
|
633 |
+
}
|
634 |
+
} else {
|
635 |
+
$json_string = $this -> get_json_values( 'http://api.pinterest.com/v1/urls/count.json?url=' . $url );
|
636 |
+
$json_string = preg_replace( '/^receiveCount\((.*)\)$/', "\\1", $json_string );
|
637 |
+
$json = json_decode( $json_string, true );
|
638 |
+
$pinterest_count = isset( $json[ 'count' ] ) ? intval( $json[ 'count' ] ) : 0;
|
639 |
+
}
|
640 |
+
return $pinterest_count;
|
641 |
+
}
|
642 |
+
|
643 |
+
//for linkedin url share count
|
644 |
+
function get_linkedin( $url ){
|
645 |
+
$apss_settings = $this -> apss_settings;
|
646 |
+
if ( ! isset( $apss_settings[ 'enable_cache' ] ) || $apss_settings[ 'enable_cache' ] == '1' ) {
|
647 |
+
$cache_period = $apss_settings[ 'cache_period' ];
|
648 |
+
$linkedin_transient = 'linkedin_' . md5( $url );
|
649 |
+
$linkedin_transient_count = get_transient( $linkedin_transient );
|
650 |
+
|
651 |
+
//for setting the counter transient in separate options value
|
652 |
+
$apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
|
653 |
+
if ( false === $linkedin_transient_count ) {
|
654 |
+
$json_string = $this -> get_json_values( "https://www.linkedin.com/countserv/count/share?url=$url&format=json" );
|
655 |
+
$json = json_decode( $json_string, true );
|
656 |
+
$linkedin_count = isset( $json[ 'count' ] ) ? intval( $json[ 'count' ] ) : 0;
|
657 |
+
|
658 |
+
set_transient( $linkedin_transient, $linkedin_count, $cache_period * HOUR_IN_SECONDS );
|
659 |
+
if ( ! in_array( $linkedin_transient, $apss_social_counts_transients ) ) {
|
660 |
+
$apss_social_counts_transients[] = $linkedin_transient;
|
661 |
+
update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
|
662 |
+
}
|
663 |
+
} else {
|
664 |
+
$linkedin_count = $linkedin_transient_count;
|
665 |
+
}
|
666 |
+
} else {
|
667 |
+
$json_string = $this -> get_json_values( "https://www.linkedin.com/countserv/count/share?url=$url&format=json" );
|
668 |
+
$json = json_decode( $json_string, true );
|
669 |
+
$linkedin_count = isset( $json[ 'count' ] ) ? intval( $json[ 'count' ] ) : 0;
|
670 |
+
}
|
671 |
+
return $linkedin_count;
|
672 |
+
}
|
673 |
+
|
674 |
+
//function to return json values from social media urls
|
675 |
+
private function get_json_values( $url ){
|
676 |
+
$args = array( 'timeout' => 10 );
|
677 |
+
$response = wp_remote_get( $url, $args );
|
678 |
+
$json_response = wp_remote_retrieve_body( $response );
|
679 |
+
return $json_response;
|
680 |
+
}
|
681 |
+
|
682 |
+
////////////////////////////////////for count ends here/////////////////////////////////////////////
|
683 |
+
|
684 |
+
function get_count( $profile_name, $url ){
|
685 |
+
|
686 |
+
$url = apply_filters( 'apss_share_url', $url );
|
687 |
+
|
688 |
+
switch ( $profile_name ) {
|
689 |
+
case 'facebook':
|
690 |
+
$count = $this -> new_get_fb( $url );
|
691 |
+
break;
|
692 |
+
|
693 |
+
case 'twitter':
|
694 |
+
$count = $this -> get_tweets( $url );
|
695 |
+
break;
|
696 |
+
|
697 |
+
case 'google-plus':
|
698 |
+
$count = $this -> get_plusones( $url );
|
699 |
+
break;
|
700 |
+
|
701 |
+
case 'linkedin':
|
702 |
+
$count = $this -> get_linkedin( $url );
|
703 |
+
break;
|
704 |
+
|
705 |
+
case 'pinterest':
|
706 |
+
$count = $this -> get_pinterest( $url );
|
707 |
+
break;
|
708 |
+
|
709 |
+
default:
|
710 |
+
$count = 0;
|
711 |
+
break;
|
712 |
+
}
|
713 |
+
return $count;
|
714 |
+
}
|
715 |
|
716 |
+
public static function get_http_url( $url ){
|
717 |
+
return preg_replace( '/https:/i', 'http:', $url );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
718 |
}
|
|
|
719 |
|
720 |
+
}
|
721 |
|
722 |
+
//APSS_Class termination
|
723 |
|
724 |
+
$GLOBALS[ 'apss_object' ] = new APSS_Class();
|
725 |
}
|
inc/backend/about-apss.php
CHANGED
@@ -1,73 +1,72 @@
|
|
1 |
-
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
-
<h2><?php _e( 'About Us', 'accesspress-social-share' )
|
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 |
-
|
43 |
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
<div class="other-products">
|
47 |
-
<h3 class="get-header">Get in touch</h3>
|
48 |
-
<div class="other-products-inner">
|
49 |
-
<p>If you've any question/feedback, please get in touch: <br />
|
50 |
-
<p><strong>General enquiries:</strong> <a href="mailto:info@accesspressthemes.com">info@accesspressthemes.com</a></p>
|
51 |
-
<p><strong>Support:</strong> <a href="mailto:support@accesspressthemes.com">support@accesspressthemes.com</a></p>
|
52 |
-
<p><strong>Sales:</strong> <a href="mailto:sales@accesspressthemes.com">sales@accesspressthemes.com</a></p>
|
53 |
-
</p>
|
54 |
-
</div>
|
55 |
-
</div>
|
56 |
-
<div class="seperator"></div><div class="dottedline"></div><div class="seperator"></div>
|
57 |
-
<div class="other-products">
|
58 |
-
<h3 class="get-header">Get social</h3>
|
59 |
-
<div class="other-products-inner">
|
60 |
-
<p>Get connected with us on social media. Facebook is the best place to find updates on our themes/plugins: </p>
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
</div>
|
1 |
+
<?php defined( 'ABSPATH' ) or die( "No script kiddies please!" ); ?>
|
2 |
+
<h2><?php _e( 'About Us', 'accesspress-social-share' ); ?></h2>
|
3 |
+
<div class="ap-tab-wrapper">
|
4 |
+
<p><strong><?php _e( 'AccessPress Social Share', 'accesspress-social-share' ); ?></strong> - <?php _e( 'is a FREE WordPress Plugin by AccessPress Themes.', 'accesspress-social-share' ); ?></p>
|
5 |
|
6 |
+
<p><?php _e( 'AccessPress Themes is a venture of Access Keys - who has developed hundreds of Custom WordPress themes and plugins for its clients over the years.', 'accesspress-social-share' ); ?> </p>
|
7 |
|
8 |
+
<p><strong>AccessPress Social Share</strong> - <?php _e( 'is plugin to allow anyone easily share website content (pages, posts) on major social media (Facebook, Twitter, Google+, Pinterest, LinkedIn and Digg). A perfect plugin to make any content on your website social-share-friendly, and increase your social reach dramatically!', 'accesspress-social-share' ); ?> </p>
|
9 |
+
<div class="halfseperator"></div>
|
10 |
+
<p><strong><?php _e( 'Please visit our product page for more details here:', 'accesspress-social-share' ); ?></strong><br />
|
11 |
+
<a href="http://accesspressthemes.com/wordpress-plugins/accesspress-social-share/" target="_blank">http://accesspressthemes.com/wordpress-plugins/accesspress-social-share/</a></p>
|
12 |
+
<div class="halfseperator"></div>
|
13 |
+
<p><strong><?php _e( 'Plugin documentation can be found here:', 'accesspress-social-share' ); ?></strong><br />
|
14 |
+
<a href="https://accesspressthemes.com/documentation/documentation-plugin-instruction-accesspress-social-share/" target="_blank">https://accesspressthemes.com/documentation/documentation-plugin-instruction-accesspress-social-share/</a>
|
15 |
+
</p>
|
16 |
+
<div class="halfseperator"></div>
|
17 |
+
<p><strong><?php _e( 'If you like to buy premium version of this plugin please check here:', 'accesspress-social-share' ); ?></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><?php _e( 'Feature comparison between free and premium plugin is here:', 'accesspress-social-share' ); ?></strong><br />
|
22 |
+
<a href="http://accesspressthemes.com/wordpress-plugins/accesspress-social-share/#comparision" target="_blank">http://accesspressthemes.com/wordpress-plugins/accesspress-social-share/#comparison</a>
|
23 |
+
</p>
|
24 |
+
<div class="seperator"></div><div class="dottedline"></div><div class="seperator"></div>
|
25 |
+
<div class="other-products">
|
26 |
+
<h3><?php _e( 'Other products by AccessPress themes', 'accesspress-social-share' ); ?> </h3>
|
27 |
+
<div class="other-products-inner">
|
28 |
+
<div class="product">
|
29 |
+
<div class="logo-product"><img src="<?php echo APSS_IMAGE_DIR; ?>/aplite.png" alt="<?php esc_attr_e( 'AccessPress Social Share', 'accesspress-social-share' ); ?>" /></div>
|
30 |
+
<div class="productext"><p><strong>AccessPress Lite</strong> -<?php _e( 'A very popular Free WordPress theme, available in WordPress.org', 'accesspress-social-share' ); ?><br />
|
31 |
+
<a href="http://accesspressthemes.com/wordpress-themes/accesspress-lite/" target="_blank">http://accesspressthemes.com/wordpress-themes/accesspress-lite/</a></p>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
|
35 |
+
<div class="product">
|
36 |
+
<div class="logo-product"><img src="<?php echo APSS_IMAGE_DIR; ?>/appro.png" alt="<?php esc_attr_e( 'AccessPress Social Share', 'accesspress-social-share' ); ?>" /></div>
|
37 |
+
<div class="productext"><p><strong>AccessPress Pro</strong> - Premium version of AccessPress lite<br />
|
38 |
+
<a href="http://accesspressthemes.com/wordpress-themes/accesspress-lite/" target="_blank">http://accesspressthemes.com/wordpress-themes/accesspress-pro/</a></p>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
</div>
|
43 |
|
44 |
+
<div class="seperator"></div><div class="dottedline"></div><div class="seperator"></div>
|
45 |
+
<div class="other-products">
|
46 |
+
<h3 class="get-header"><?php _e( 'Get in touch', 'accesspress-social-share' ); ?></h3>
|
47 |
+
<div class="other-products-inner">
|
48 |
+
<p><?php _e( "If you've any question/feedback, please get in touch:", "accesspress-social-share" ); ?> <br />
|
49 |
+
<p><strong>General enquiries:</strong> <a href="mailto:info@accesspressthemes.com">info@accesspressthemes.com</a></p>
|
50 |
+
<p><strong>Support:</strong> <a href="mailto:support@accesspressthemes.com">support@accesspressthemes.com</a></p>
|
51 |
+
<p><strong>Sales:</strong> <a href="mailto:sales@accesspressthemes.com">sales@accesspressthemes.com</a></p>
|
52 |
+
</p>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
<div class="seperator"></div><div class="dottedline"></div><div class="seperator"></div>
|
56 |
+
<div class="other-products">
|
57 |
+
<h3 class="get-header"><?php _e( 'Get social', 'accesspress-social-share' ); ?></h3>
|
58 |
+
<div class="other-products-inner">
|
59 |
+
<p><?php _e( 'Get connected with us on social media. Facebook is the best place to find updates on our themes/plugins:', 'accesspress-social-share' ); ?> </p>
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
<p><strong><?php _e( 'Like us on facebook:', 'accesspress-social-share' ); ?></strong><br />
|
63 |
+
<iframe style="border: none; overflow: hidden; width: 764px; height: 206px;" src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FAccessPress-Themes%2F1396595907277967&width=842&height=258&colorscheme=light&show_faces=true&header=false&stream=false&show_border=true&appId=1411139805828592" width="240" height="150" frameborder="0" scrolling="no"></iframe></p>
|
64 |
+
<ul class="social-icon clearfix">
|
65 |
+
<li><a href="https://plus.google.com/u/0/+Accesspressthemesprofile/about" target="_blank"><img src="<?php echo APSS_IMAGE_DIR; ?>/google-plus-blue.png" alt="google+"></a></li>
|
66 |
+
<li><a href="http://www.pinterest.com/accesspresswp/" target="_blank"><img src="<?php echo APSS_IMAGE_DIR; ?>/pinterest-blue.png" alt="pinterest"></a></li>
|
67 |
+
<li><a href="https://www.flickr.com/photos/accesspressthemes/" target="_blank"><img src="<?php echo APSS_IMAGE_DIR; ?>/flickr.png" alt="flicker"></a></li>
|
68 |
+
<li><a href="https://twitter.com/apthemes" target="_blank"><img src="<?php echo APSS_IMAGE_DIR; ?>/twitter.png" alt="twitter"/></a></li>
|
69 |
+
</ul>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
</div>
|
|
inc/backend/how-to-use.php
CHANGED
@@ -1,73 +1,73 @@
|
|
1 |
-
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
-
<p
|
3 |
-
|
4 |
<br />
|
5 |
-
You can get the details instruction for creating facebook app <a href='http://demo.accesspressthemes.com/wordpress-plugins/accesspress-social-share/?p=89' target="_blank">here</a>.
|
6 |
<br />
|
7 |
-
<p
|
8 |
<dl>
|
9 |
-
<dt><strong
|
10 |
-
<dd><p
|
11 |
|
12 |
-
<dt><strong
|
13 |
-
<dd><p
|
14 |
|
15 |
-
<dt><strong
|
16 |
-
<dd><p
|
17 |
|
18 |
-
<dt><strong
|
19 |
-
<dd><p
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
</ul>
|
27 |
-
</p></dd>
|
28 |
-
<dt><strong>Shortcode</strong></dt>
|
29 |
-
<dd><p>You can use shortcode for the display of the social share in the contents. Optionally You can enter the name of the networks you want to display. The networks will be displayed in the order of entered networks.
|
30 |
-
<ul class="how-list">
|
31 |
-
<li><i class="fa fa-check"></i>Example 1: <code>[apss_share]</code></li>
|
32 |
-
<li>Available shortcode parameters</li>
|
33 |
-
<ul>
|
34 |
-
<li><i class="fa fa-check"></i>networks : You can define which social medias to show in the shortcode. You need to enter the networks name in string in comma separated values. If you don't want to choose which social medias to appear in shortcode, you can discard this option. </li>
|
35 |
-
<li>Available network parameters are: facebook, twitter, google-plus, pinterest, linkedin, digg, email, print</li>
|
36 |
-
<li><i class="fa fa-check"></i>share_text: You can add the share text. To use share text use share_text='text to be shared'. If you don't use this parameter the share text will not appear in shortcode.</li>
|
37 |
-
<li><i class="fa fa-check"></i>counter : You can enable or disable the share counter. To enable the share count use counter='1' and to disable it simply don't use counter parameter or use parameter counter='0'.</li>
|
38 |
-
<li><i class="fa fa-check"></i>total_counter : You can enable or disable the total share counter. To enable the total share count use total_counter='1' and to disable it simply don't use total_counter parameter or use parameter total_counter='0'.</li>
|
39 |
-
<li><i class="fa fa-check"></i>custom_share_link : You can enter the custom share link in case if the link provided by shortcode is not as per your need. To enable the custom share link use custom_share_link='custom link as per your need.'</li>
|
40 |
-
<li><i class='fa fa-check'></i>http_count: You can set this option if you have moved your site from HTTP to HTTPS to show the share counts from your old http site as well. Please note that the share count will fetch if your site has been moved from HTTP to HTTPS eg if your old site was http://example.com and you have moved your site to https://example.com. But please not that if you have changed other url parameters then the count will not work for example if your old page slug was http://example.com/sample-page and you have changed it to https://example.com/sample-page-1 then the share counts will not work for old url.</li>
|
41 |
</ul>
|
42 |
-
|
43 |
-
</
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
<li><li><i class="fa fa-check"></i>Example 2: <code>[apss_count]</code></li></li>
|
49 |
-
<li>Available Parameters
|
50 |
-
<ul>
|
51 |
-
<li><i class="fa fa-check"></i>network : You can define which social medias to show total share counts. You need to enter the networks name in string in comma separated values. You need to enter at least one network attribute.</li>
|
52 |
-
<li>Available network parameters are: facebook, twitter, google-plus, pinterest, linkedin</li>
|
53 |
-
<li>Example 2.1: <code>[apss_count network='facebook, pinterest']</code></li>
|
54 |
-
<li>This will show the sum of share counts from facebook and pinterest.</li>
|
55 |
-
</ul>
|
56 |
<ul>
|
57 |
-
<li><i class="fa fa-check"></i
|
58 |
-
<li
|
59 |
-
<li
|
60 |
-
<li
|
|
|
|
|
|
|
61 |
</ul>
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
</dd>
|
66 |
<dd>
|
67 |
-
|
68 |
</dd>
|
69 |
<dd>
|
70 |
-
<p
|
71 |
</dd>
|
72 |
|
73 |
</dl>
|
1 |
+
<?php defined( 'ABSPATH' ) or die( "No script kiddies please!" ); ?>
|
2 |
+
<p><?php _e( 'Plugin configuration video', 'accesspress-social-share' ); ?> </p>
|
3 |
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/tAfiyOnoEZs" frameborder="0" allowfullscreen></iframe>
|
4 |
<br />
|
5 |
+
<?php _e( 'You can get the details instruction for creating facebook app', 'accesspress-social-share' ); ?> <a href='http://demo.accesspressthemes.com/wordpress-plugins/accesspress-social-share/?p=89' target="_blank">here</a>.
|
6 |
<br />
|
7 |
+
<p><?php _e( 'Basically there are four main settings tabs that will help you to setup the plugin to work properly.', 'accesspress-social-share' ); ?></p>
|
8 |
<dl>
|
9 |
+
<dt><strong><?php _e( 'Social Networks', 'accesspress-social-share' ); ?></strong></dt>
|
10 |
+
<dd><p><?php _e( 'In this tab you can choose which social media icons you want to display in the frontend. Here you can order the apperance of the social icons simply by drag and drop of each social icons.', 'accesspress-social-share' ); ?></p></dd>
|
11 |
|
12 |
+
<dt><strong><?php _e( 'Share options', 'accesspress-social-share' ); ?></strong></dt>
|
13 |
+
<dd><p><?php _e( 'In this tab you can select the options where you want to display social media share icons.', 'accesspress-social-share' ); ?></p></dd>
|
14 |
|
15 |
+
<dt><strong><?php _e( 'Display settings', 'accesspress-social-share' ); ?></strong></dt>
|
16 |
+
<dd><p><?php _e( 'In this tab you can customize the apperance of the social media share icons. You can choose the options to display the share icons below the contennt, above the content or you can choose an options to display in both below and above content. Also you can choose the theme from the pre available 5 themes.', 'accesspress-social-share' ); ?></p></dd>
|
17 |
|
18 |
+
<dt><strong><?php _e( 'Miscellaneous settings', 'accesspress-social-share' ); ?></strong></dt>
|
19 |
+
<dd><p><?php _e( 'In this tab you can do the additional settings for the plugin.', 'accesspress-social-share' ); ?>
|
20 |
+
<ul class="how-list">
|
21 |
+
<li><i class="fa fa-check"></i><?php _e( 'You can setup the twitter username.', 'accesspress-social-share' ); ?></li>
|
22 |
+
<li><i class="fa fa-check"></i><?php _e( 'You can enable/disable the social counter.', 'accesspress-social-share' ); ?></li>
|
23 |
+
<li><i class="fa fa-check"></i><?php _e( 'Share link - You can enable the share options either in new tab/window or in same widow.', 'accesspress-social-share' ); ?></li>
|
24 |
+
<li><i class="fa fa-check"></i>Cache settings - Here you can set the cache settings of the social share counter in hour format.','accesspress-social-share'); ?></li>
|
25 |
+
<li><i class="fa fa-check"></i>Email settings - If you have enabled the email settings you can setup the email header and body part.','accesspress-social-share'); ?></li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</ul>
|
27 |
+
</p></dd>
|
28 |
+
<dt><strong>Shortcode</strong></dt>
|
29 |
+
<dd><p><?php _e( 'You can use shortcode for the display of the social share in the contents. Optionally You can enter the name of the networks you want to display. The networks will be displayed in the order of entered networks.', 'accesspress-social-share' ); ?>
|
30 |
+
<ul class="how-list">
|
31 |
+
<li><i class="fa fa-check"></i>Example 1: <code>[apss_share]</code></li>
|
32 |
+
<li><?php _e( 'Available shortcode parameters', 'accesspress-social-share' ); ?></li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
<ul>
|
34 |
+
<li><i class="fa fa-check"></i><?php _e( "networks : You can define which social medias to show in the shortcode. You need to enter the networks name in string in comma separated values. If you don't want to choose which social medias to appear in shortcode, you can discard this option.", "accesspress-social-share" ); ?> </li>
|
35 |
+
<li><?php _e( 'Available network parameters are: facebook, twitter, google-plus, pinterest, linkedin, digg, email, print', 'accesspress-social-share' ); ?></li>
|
36 |
+
<li><i class="fa fa-check"></i><?php _e( "share_text: You can add the share text. To use share text use share_text='text to be shared'. If you don't use this parameter the share text will not appear in shortcode.", "accesspress-social-share" ); ?></li>
|
37 |
+
<li><i class="fa fa-check"></i><?php _e( "counter : You can enable or disable the share counter. To enable the share count use counter='1' and to disable it simply don't use counter parameter or use parameter counter = '0'.", "accesspress-social-share" ); ?></li>
|
38 |
+
<li><i class="fa fa-check"></i><?php _e( "total_counter : You can enable or disable the total share counter. To enable the total share count use total_counter='1' and to disable it simply don't use total_counter parameter or use parameter total_counter = '0'.", "accesspress-social-share" ); ?></li>
|
39 |
+
<li><i class = "fa fa-check"></i><?php _e( "custom_share_link : You can enter the custom share link in case if the link provided by shortcode is not as per your need. To enable the custom share link use custom_share_link = 'custom link as per your need.'", "accesspress-social-share" ); ?></li>
|
40 |
+
<li><i class = 'fa fa-check'></i><?php _e( "http_count: You can set this option if you have moved your site from HTTP to HTTPS to show the share counts from your old http site as well. Please note that the share count will fetch if your site has been moved from HTTP to HTTPS eg if your old site was http://example.com and you have moved your site to https://example.com. But please not that if you have changed other url parameters then the count will not work for example if your old page slug was http://example.com/sample-page and you have changed it to https://example.com/sample-page-1 then the share counts will not work for old url.", "accesspress-social-share" ); ?></li>
|
41 |
</ul>
|
42 |
+
<li><i class = "fa fa-check"></i>Example 1.1: <code>[ apss_share networks = 'facebook, twitter, pinterest' share_text = 'Share it' counter = '1' total_counter = '1' http_count = '1' ]</code></li>
|
43 |
+
</ul>
|
44 |
+
</p></dd>
|
45 |
+
<dd>
|
46 |
+
<p><?php _e( "You can use the below shortcode to display the share counts number only in the content using shortcode. You can wrap that number in your reqired html tags and use it as per your need. The share count displayed will be the sum of entered network attributes.", "accesspress-social-share" ); ?>
|
47 |
+
<ul class = "how-list">
|
48 |
+
<li><li><i class = "fa fa-check"></i>Example 2: <code>[ apss_count ]</code></li></li>
|
49 |
+
<li><?php _e( 'Available Parameters', 'accesspress-social-share' ); ?>
|
50 |
+
<ul>
|
51 |
+
<li><i class = "fa fa-check"></i><?php _e( "network : You can define which social medias to show total share counts. You need to enter the networks name in string in comma separated values. You need to enter at least one network attribute.", "accesspress-social-share" ); ?></li>
|
52 |
+
<li><?php _e( "Available network parameters are: facebook, twitter, google-plus, pinterest, linkedin", "accesspress-social-share" ); ?></li>
|
53 |
+
<li><?php _e( "Example 2.1:", "accesspress-social-share" ); ?> <code>[ apss_count network = 'facebook, pinterest' ]</code></li>
|
54 |
+
<li><?php _e( "This will show the sum of share counts from facebook and pinterest.", "accesspress-social-shares" ); ?></li>
|
55 |
+
</ul>
|
56 |
+
<ul>
|
57 |
+
<li><i class = "fa fa-check"></i><?php _e( 'custom_url_link', 'accesspress-social-share' ); ?></li>
|
58 |
+
<li><?php _e( 'Now you can use attribute "custom_url_link" to fetch the share counts for custom url as well.', 'accesspress-social-share' ); ?></li>
|
59 |
+
<li><?php _e( "Example 2.2:", "accesspress-social-share" ); ?> <code>[ apss_count network = 'facebook, pinterest' custom_url_link = '<?php echo site_url( 'sample-page' ); ?>' ]</code></li>
|
60 |
+
<li><?php _e( "This attribute is useful in case if the shortcode is not fetching the share counts for shortcode placed url and force the shortcode to use the url from the attribute defined in custom_url_link.", "accesspress-social-share" ); ?></li>
|
61 |
+
</ul>
|
62 |
+
</li>
|
63 |
+
</ul>
|
64 |
+
</p>
|
65 |
</dd>
|
66 |
<dd>
|
67 |
+
<p><b><?php _e( "For now you can use shortcode", "accesspress-social-share" ); ?> [ apss-share ] and [ apss-count ]<?php _e( "for the display of the social shares and counts only as well but in upcoming plugin updates this shortcode will be removed and use the new one. So we suggest to use only the new shortcodes.", "accesspress-social-share" ); ?></b></p>
|
68 |
</dd>
|
69 |
<dd>
|
70 |
+
<p><?php _e( 'For the complete documentation please visit:', 'accesspress-social-share' ); ?><br /> <a href = 'https://accesspressthemes.com/documentation/documentation-plugin-instruction-accesspress-social-share/' target = "_blank">https://accesspressthemes.com/documentation/documentation-plugin-instruction-accesspress-social-share/</a> </p>
|
71 |
</dd>
|
72 |
|
73 |
</dl>
|
inc/backend/main-page.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); ?>
|
2 |
<div class="apss-wrapper-block">
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
var js, fjs = d.getElementsByTagName(s)[0];
|
15 |
if (!d.getElementById(id)) {
|
16 |
js = d.createElement(s);
|
@@ -19,339 +19,432 @@
|
|
19 |
fjs.parentNode.insertBefore(js, fjs);
|
20 |
}
|
21 |
}(document, "script", "twitter-wjs");</script>
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
<div class='apss-tab-contents-wrapper'>
|
77 |
-
<div class="apss-wrapper">
|
78 |
-
|
79 |
-
<div class="apss-tab-contents apss-social-networks" id="tab-apss-social-networks" style='display:block'>
|
80 |
-
<h2><?php _e( 'Social Media chooser:', 'accesspress-social-share' ); ?> </h2>
|
81 |
-
<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:', 'accesspress-social-share' ); ?></span>
|
82 |
-
<div class="apps-opt-wrap clearfix">
|
83 |
-
<?php
|
84 |
-
$label_array = array(
|
85 |
-
'facebook' => ' <span class="media-icon"><i class="fa fa-facebook"></i></span> Facebook',
|
86 |
-
'twitter' => ' <span class="media-icon"><i class="fa fa-twitter"></i></span> Twitter',
|
87 |
-
'google-plus' => '<span class="media-icon"><i class="fa fa-google-plus"></i></span> Google Plus',
|
88 |
-
'pinterest' => '<span class="media-icon"> <i class="fa fa-pinterest"></i> </span>Pinterest',
|
89 |
-
'linkedin' => '<span class="media-icon"><i class="fa fa-linkedin"></i></span> Linkedin',
|
90 |
-
'digg' => '<span class="media-icon"><i class="fa fa-digg"></i></span> Digg',
|
91 |
-
'email' => '<span class="media-icon"><i class="fa fa-envelope"></i></span> Email',
|
92 |
-
'print' => '<span class="media-icon"><i class="fa fa-print"></i> </span>Print',
|
93 |
-
);
|
94 |
-
?>
|
95 |
-
<?php foreach ( $options['social_networks'] as $key => $val ) {
|
96 |
-
?>
|
97 |
-
<div class="apss-option-wrapper">
|
98 |
-
<div class="apss-option-field">
|
99 |
-
<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' ) {
|
100 |
-
echo "checked='checked'";
|
101 |
-
} ?> /></label>
|
102 |
-
</div>
|
103 |
-
</div>
|
104 |
-
<?php } ?>
|
105 |
-
</div>
|
106 |
-
<input type="hidden" name="apss_social_newtwork_order" id='apss_social_newtwork_order' value="<?php echo implode( ',', array_keys( $options['social_networks'] ) ); ?>"/>
|
107 |
-
</div>
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
<span class="social-text"><?php _e( 'Please choose the options where you want to display social share icons:', 'accesspress-social-share' ); ?></span>
|
112 |
-
<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'] ) ) {
|
113 |
-
echo "checked='checked'";
|
114 |
-
} ?> ><label for="apss_posts"><?php _e( 'Posts', 'accesspress-social-share' ); ?> </label></p>
|
115 |
-
<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'] ) ) {
|
116 |
-
echo "checked='checked'";
|
117 |
-
} ?> ><label for="apss_pages"><?php _e( 'Pages', 'accesspress-social-share' ); ?> </label></p>
|
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 |
-
<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' ) {
|
150 |
-
echo "checked='checked'";
|
151 |
-
} ?> /><label for='apss_below_above_content'><?php _e( 'Both(Below content and Above content)', 'accesspress-social-share' ); ?></label></p>
|
152 |
-
</div>
|
153 |
-
<div class=" apss-icon-sets">
|
154 |
-
<h2><?php _e( 'Social icons sets: ', 'accesspress-social-share' ); ?> </h2>
|
155 |
-
<?php _e( 'Please choose any one out of available icon themes:', 'accesspress-social-share' ); ?>
|
156 |
-
<?php for ( $i = 1; $i <= 6; $i++ ) { ?>
|
157 |
-
<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 ) {
|
158 |
-
echo "checked='checked'";
|
159 |
-
} ?> ><label for="apss_icon_set_<?php echo $i; ?>"><span class="apss_demo_icon apss_demo_icons_<?php echo $i; ?>"></span><?php _e( "Theme $i", 'accesspress-social-share' ); ?><div class="apss-theme-image"><img src='<?php echo APSS_IMAGE_DIR . "/theme/theme$i.jpg"; ?>'/></div></label></p>
|
160 |
-
<?php } ?>
|
161 |
-
</div>
|
162 |
-
</div>
|
163 |
|
164 |
-
|
165 |
-
<h2><?php _e( 'Miscellaneous settings: ', 'accesspress-social-share' ); ?> </h2>
|
166 |
-
<h4><?php _e( 'Please setup these additional settings:', 'accesspress-social-share' ); ?></h4>
|
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 |
-
echo "checked='checked'";
|
198 |
-
} ?> /><label for="counter_enable_options_n"><?php _e( 'No', 'accesspress-social-share' ); ?></label></div>
|
199 |
-
<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' ) {
|
200 |
-
echo "checked='checked'";
|
201 |
-
} ?> /><label for="counter_enable_options_y"><?php _e( 'Yes', 'accesspress-social-share' ); ?></label></div>
|
202 |
-
</div>
|
203 |
|
204 |
-
|
205 |
-
|
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 |
-
You can get the details instruction for creating facebook app <a href='http://demo.accesspressthemes.com/wordpress-plugins/accesspress-social-share/?p=89' target="_blank">here</a>.
|
242 |
-
</div>
|
243 |
-
</div>
|
244 |
-
</div>
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
echo "checked='checked'";
|
253 |
-
} ?> /><label for="total_counter_enable_options_y"><?php _e( 'Yes', 'accesspress-social-share' ); ?></label></div>
|
254 |
-
</div>
|
255 |
|
256 |
-
<div class='apss_cache_enable_opt'>
|
257 |
-
<h4><?php _e( 'Fetch the share counts from HTTP url as well? ', 'accesspress-social-share' ); ?> </h4>
|
258 |
-
<div class='misc-opt'>
|
259 |
-
<input type="radio" id='enable_http_count_yes' name="apss_share_settings[enable_http_count]" value="1" <?php if ( isset($options['enable_http_count']) && $options['enable_http_count'] == '1' ) { echo "checked='checked'"; } ?> />
|
260 |
-
<label for='enable_http_count_yes'><?php _e('Yes', 'accesspress-social-share'); ?></label>
|
261 |
-
</div>
|
262 |
-
<div class='misc-opt'>
|
263 |
-
<input type="radio" id='enable_http_count_no' name="apss_share_settings[enable_http_count]" value="0" <?php if ( isset($options['enable_http_count']) && $options['enable_http_count'] == '0' ) { echo "checked='checked'"; } ?> />
|
264 |
-
<label for='enable_http_count_no'><?php _e('No', 'accesspress-social-share'); ?></label>
|
265 |
-
</div>
|
266 |
-
<br />
|
267 |
-
<div class="apss_notes_cache_settings">
|
268 |
-
<?php _e( "<b>Note:</b> Please select this option if you have moved your site from HTTP to HTTPS. For Facebook and Google+, The crawler still needs to be able to access the old page, so exempt the crawler's user agent from the redirect and only send an HTTP redirect to non-Facebook crawler clients. If you have done 301 redirect then the old url share counts will be lost.", 'accesspress-social-share' ); ?>
|
269 |
-
</div>
|
270 |
-
</div>
|
271 |
-
<br />
|
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 |
-
</div>
|
309 |
-
</div>
|
310 |
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
%%permalink%% = current page/post url <br />
|
326 |
-
%%siteurl%% = Site url <br />
|
327 |
-
</div>
|
328 |
-
</div>
|
329 |
-
</div>
|
330 |
-
<div class="apss-tab-contents apss-how-to-use" id="tab-apss-how-to-use" style='display:none' ><?php include_once('how-to-use.php'); ?></div>
|
331 |
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
<?php $nonce_clear = wp_create_nonce( 'apss-clear-cache-nonce' ); ?>
|
343 |
-
<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?', 'accesspress-social-share' ); ?>')"><input type="button" value="Restore Default Settings" class="apss-reset-button button primary-button"/></a>
|
344 |
-
<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?', 'accesspress-social-share' ); ?>')"><input type="button" value="Clear Cache" class="apss-reset-button button primary-button"/></a>
|
345 |
-
</div>
|
346 |
-
|
347 |
-
<div class="apss-promoFloat">
|
348 |
-
<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>
|
349 |
-
<div class="apss-promo-buttons"><a target='_blank' href="http://demo.accesspressthemes.com/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>
|
350 |
-
<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>
|
351 |
-
<div class="apss-promo-buttons"><a target='_blank' href="http://demo.accesspressthemes.com/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>
|
352 |
-
</div>
|
353 |
-
</div>
|
354 |
-
<div class="clear"></div>
|
355 |
-
</form>
|
356 |
-
</div>
|
357 |
</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', 'accesspress-social-share' ); ?>" />
|
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="//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);
|
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', 'accesspress-social-share' ); ?>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
<?php
|
29 |
+
$options = get_option( APSS_SETTING_NAME );
|
30 |
+
if ( isset( $_GET[ 'message' ] ) && $_GET[ 'message' ] == '1' ) {
|
31 |
+
?>
|
32 |
+
<div class="apss-message notice notice-success is-dismissible">
|
33 |
+
<p><strong><?php _e( 'Settings Saved Successfully.', 'accesspress-social-share' ); ?></strong></p>
|
34 |
+
<button type="button" class="notice-dismiss">
|
35 |
+
<span class="screen-reader-text"><?php _e( 'Dismiss this notice.', 'accesspress-social-share' ); ?></span>
|
36 |
+
</button>
|
37 |
+
</div>
|
38 |
+
<?php } else if ( isset( $_GET[ 'message' ] ) && $_GET[ 'message' ] == '3' ) {
|
39 |
+
?>
|
40 |
+
<div class="apss-message notice notice-success is-dismissible">
|
41 |
+
<p><strong><?php _e( 'Settings restored successfully.', 'accesspress-social-share' ); ?></strong></p>
|
42 |
+
<button type="button" class="notice-dismiss">
|
43 |
+
<span class="screen-reader-text"><?php _e( 'Dismiss this notice.', 'accesspress-social-share' ); ?></span>
|
44 |
+
</button>
|
45 |
+
</div>
|
46 |
+
<?php } else if ( isset( $_GET[ 'message' ] ) && $_GET[ 'message' ] == '4' ) {
|
47 |
+
?>
|
48 |
+
<div class="apss-message notice notice-success is-dismissible">
|
49 |
+
<p><strong><?php _e( 'Cache cleared Successfully', 'accesspress-social-share' ); ?></strong></p>
|
50 |
+
<button type="button" class="notice-dismiss">
|
51 |
+
<span class="screen-reader-text"><?php _e( 'Dismiss this notice.', 'accesspress-social-share' ); ?></span>
|
52 |
+
</button>
|
53 |
+
</div>
|
54 |
+
<?php
|
55 |
+
} else if ( isset( $_GET[ 'message' ] ) && $_GET[ 'message' ] != '3' && $_GET[ 'message' ] != '1' ) {
|
56 |
+
?>
|
57 |
+
<div class="apss-message notice notice-error is-dismissible">
|
58 |
+
<p><?php _e( 'There has been an error.', 'accesspress-social-share' ); ?></p>
|
59 |
+
</div>
|
60 |
+
<?php }
|
61 |
+
?>
|
62 |
|
63 |
+
<div class="apps-wrap">
|
64 |
+
<form method="post" action="<?php echo admin_url() . 'admin-post.php' ?>">
|
65 |
+
<input type="hidden" name="action" value="apss_save_options"/>
|
66 |
|
67 |
+
<ul class="apss-setting-tabs clearfix">
|
68 |
+
<li><a href="javascript:void(0)" id="apss-social-networks" class="apss-tabs-trigger apss-active-tab "><?php _e( 'Social Networks', 'accesspress-social-share' ); ?></a></li>
|
69 |
+
<li><a href="javascript:void(0)" id="apss-share-options" class="apss-tabs-trigger "><?php _e( 'Share Options', 'accesspress-social-share' ) ?></a></li>
|
70 |
+
<li><a href="javascript:void(0)" id="apss-display-settings" class="apss-tabs-trigger"><?php _e( 'Display Settings', 'accesspress-social-share' ); ?></a></li>
|
71 |
+
<li><a href="javascript:void(0)" id="apss-miscellaneous" class="apss-tabs-trigger"><?php _e( 'Miscellaneous', 'accesspress-social-share' ); ?></a></li>
|
72 |
+
<li><a href="javascript:void(0)" id="apss-how-to-use" class="apss-tabs-trigger"><?php _e( 'How To Use', 'accesspress-social-share' ); ?></a></li>
|
73 |
+
<li><a href="javascript:void(0)" id="apss-about" class="apss-tabs-trigger"><?php _e( 'About', 'accesspress-social-share' ); ?></a></li>
|
74 |
+
<li><a href="http://wpall.club/" id="apss-resources" class="apss-tabs-trigger" target="_blank"><?php _e( 'More WordPress Resources', 'accesspress-social-share' ); ?></a></li>
|
75 |
+
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
<div class='apss-tab-contents-wrapper'>
|
78 |
+
<div class="apss-wrapper">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
+
<div class="apss-tab-contents apss-social-networks" id="tab-apss-social-networks" style='display:block'>
|
81 |
+
<h2><?php _e( 'Social Media chooser:', 'accesspress-social-share' ); ?> </h2>
|
82 |
+
<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:', 'accesspress-social-share' ); ?></span>
|
83 |
+
<div class="apps-opt-wrap clearfix">
|
84 |
+
<?php
|
85 |
+
$label_array = array(
|
86 |
+
'facebook' => ' <span class="media-icon"><i class="fa fa-facebook"></i></span> Facebook',
|
87 |
+
'twitter' => ' <span class="media-icon"><i class="fa fa-twitter"></i></span> Twitter',
|
88 |
+
'google-plus' => '<span class="media-icon"><i class="fa fa-google-plus"></i></span> Google Plus',
|
89 |
+
'pinterest' => '<span class="media-icon"> <i class="fa fa-pinterest"></i> </span>Pinterest',
|
90 |
+
'linkedin' => '<span class="media-icon"><i class="fa fa-linkedin"></i></span> Linkedin',
|
91 |
+
'digg' => '<span class="media-icon"><i class="fa fa-digg"></i></span> Digg',
|
92 |
+
'email' => '<span class="media-icon"><i class="fa fa-envelope"></i></span> Email',
|
93 |
+
'print' => '<span class="media-icon"><i class="fa fa-print"></i> </span>Print',
|
94 |
+
);
|
95 |
+
?>
|
96 |
+
<?php foreach ( $options[ 'social_networks' ] as $key => $val ) {
|
97 |
+
?>
|
98 |
+
<div class="apss-option-wrapper">
|
99 |
+
<div class="apss-option-field">
|
100 |
+
<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
|
101 |
+
if ( $val == '1' ) {
|
102 |
+
echo "checked='checked'";
|
103 |
+
}
|
104 |
+
?> /></label>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
<?php } ?>
|
108 |
+
</div>
|
109 |
+
<input type="hidden" name="apss_social_newtwork_order" id='apss_social_newtwork_order' value="<?php echo implode( ',', array_keys( $options[ 'social_networks' ] ) ); ?>"/>
|
110 |
+
</div>
|
111 |
|
112 |
+
<div class="apss-tab-contents apss-share-options" id="tab-apss-share-options" style='display:none'>
|
113 |
+
<h2><?php _e( 'Share options:', 'accesspress-social-share' ); ?> </h2>
|
114 |
+
<span class="social-text"><?php _e( 'Please choose the options where you want to display social share icons:', 'accesspress-social-share' ); ?></span>
|
115 |
+
<p><input type="checkbox" id="apss_posts" value="post" name="apss_share_settings[share_options][]" <?php
|
116 |
+
if ( in_array( "post", $options[ 'share_options' ] ) || in_array( "posts", $options[ 'share_options' ] ) ) {
|
117 |
+
echo "checked='checked'";
|
118 |
+
}
|
119 |
+
?> ><label for="apss_posts"><?php _e( 'Posts', 'accesspress-social-share' ); ?> </label></p>
|
120 |
+
<p><input type="checkbox" id="apss_pages" value="page" name="apss_share_settings[share_options][]" <?php
|
121 |
+
if ( in_array( "page", $options[ 'share_options' ] ) || in_array( "pages", $options[ 'share_options' ] ) ) {
|
122 |
+
echo "checked='checked'";
|
123 |
+
}
|
124 |
+
?> ><label for="apss_pages"><?php _e( 'Pages', 'accesspress-social-share' ); ?> </label></p>
|
125 |
|
126 |
+
<p><input type="checkbox" id="apss_front_page" value="front_page" name="apss_share_settings[share_options][]" <?php
|
127 |
+
if ( in_array( "front_page", $options[ 'share_options' ] ) ) {
|
128 |
+
echo "checked='checked'";
|
129 |
+
}
|
130 |
+
?> ><label for="apss_front_page"><?php _e( 'Front Page', 'accesspress-social-share' ); ?></label></p>
|
131 |
+
<p><input type="checkbox" id="apss_archives" value="archives" name="apss_share_settings[share_options][]" <?php
|
132 |
+
if ( in_array( "archives", $options[ 'share_options' ] ) ) {
|
133 |
+
echo "checked='checked'";
|
134 |
+
}
|
135 |
+
?> ><label for="apss_archives"><?php _e( 'Archives', 'accesspress-social-share' ); ?></label></p>
|
136 |
|
137 |
+
<p><input type="checkbox" id="apss_attachement" value="attachment" name="apss_share_settings[share_options][]" <?php
|
138 |
+
if ( in_array( "attachment", $options[ 'share_options' ] ) ) {
|
139 |
+
echo "checked='checked'";
|
140 |
+
}
|
141 |
+
?> ><label for="apss_attachment"><?php _e( 'Attachment pages', 'accesspress-social-share' ); ?></label></p>
|
142 |
|
143 |
+
<p><input type="checkbox" id="apss_categories" value="categories" name="apss_share_settings[share_options][]" <?php
|
144 |
+
if ( in_array( "categories", $options[ 'share_options' ] ) ) {
|
145 |
+
echo "checked='checked'";
|
146 |
+
}
|
147 |
+
?> ><label for="apss_categories"><?php _e( 'Categories', 'accesspress-social-share' ); ?></label></p>
|
148 |
+
<p><input type="checkbox" id="apss_all" value="all" name="apss_share_settings[share_options][]" <?php
|
149 |
+
if ( in_array( "all", $options[ 'share_options' ] ) ) {
|
150 |
+
echo "checked='checked'";
|
151 |
+
}
|
152 |
+
?> ><label for="apss_all"><?php _e( 'Other (search results, etc)', 'accesspress-social-share' ); ?></label></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
+
</div>
|
|
|
|
|
155 |
|
156 |
+
<div class="apss-tab-contents apss-display-settings" id="tab-apss-display-settings" style='display:none'>
|
157 |
+
<div class=' apss-display-positions'>
|
158 |
+
<h2><?php _e( 'Display position:', 'accesspress-social-share' ); ?></h2>
|
159 |
+
<span class='social-text'><?php _e( 'Please choose the option where you want to display the social share:', 'accesspress-social-share' ); ?></span>
|
160 |
+
<p><input type="radio" id="apss_below_content" name="apss_share_settings[social_share_position_options]" value="below_content" <?php
|
161 |
+
if ( $options[ 'share_positions' ] == 'below_content' ) {
|
162 |
+
echo "checked='checked'";
|
163 |
+
}
|
164 |
+
?> /><label for='apss_below_content'><?php _e( 'Below content', 'accesspress-social-share' ); ?></label></p>
|
165 |
+
<p><input type="radio" id="apss_above_content" name="apss_share_settings[social_share_position_options]"/ value="above_content" <?php
|
166 |
+
if ( $options[ 'share_positions' ] == 'above_content' ) {
|
167 |
+
echo "checked='checked'";
|
168 |
+
}
|
169 |
+
?> /><label for='apss_above_content'><?php _e( 'Above content', 'accesspress-social-share' ); ?></label></p>
|
170 |
+
<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
|
171 |
+
if ( $options[ 'share_positions' ] == 'on_both' ) {
|
172 |
+
echo "checked='checked'";
|
173 |
+
}
|
174 |
+
?> /><label for='apss_below_above_content'><?php _e( 'Both(Below content and Above content)', 'accesspress-social-share' ); ?></label></p>
|
175 |
+
</div>
|
176 |
+
<div class=" apss-icon-sets">
|
177 |
+
<h2><?php _e( 'Social icons sets: ', 'accesspress-social-share' ); ?> </h2>
|
178 |
+
<?php _e( 'Please choose any one out of available icon themes:', 'accesspress-social-share' ); ?>
|
179 |
+
<?php for ( $i = 1; $i <= 6; $i ++ ) { ?>
|
180 |
+
<p><input id="apss_icon_set_<?php echo $i; ?>" value="<?php echo $i; ?>" name="apss_share_settings[social_icon_set]" type="radio" <?php
|
181 |
+
if ( $options[ 'social_icon_set' ] == $i ) {
|
182 |
+
echo "checked='checked'";
|
183 |
+
}
|
184 |
+
?> ><label for="apss_icon_set_<?php echo $i; ?>"><span class="apss_demo_icon apss_demo_icons_<?php echo $i; ?>"></span><?php _e( "Theme $i", 'accesspress-social-share' ); ?><div class="apss-theme-image"><img src='<?php echo APSS_IMAGE_DIR . "/theme/theme$i.jpg"; ?>'/></div></label></p>
|
185 |
+
<?php } ?>
|
186 |
+
</div>
|
187 |
+
</div>
|
188 |
|
189 |
+
<div class="apss-tab-contents apss-miscellaneous" id="tab-apss-miscellaneous" style='display:none'>
|
190 |
+
<h2><?php _e( 'Miscellaneous settings: ', 'accesspress-social-share' ); ?> </h2>
|
191 |
+
<h4><?php _e( 'Please setup these additional settings:', 'accesspress-social-share' ); ?></h4>
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
+
<div class="apss-share-text-settings clearfix">
|
194 |
+
<h4><?php _e( 'Disable the plugins frontend assets?', 'accesspress-social-share' ); ?> </h4>
|
195 |
+
<div class="misc-opt"><input type="radio" id='disable_frontend_assets_n' name="apss_share_settings[disable_frontend_assets]" value="0" <?php
|
196 |
+
if ( isset( $options[ 'disable_frontend_assets' ] ) && $options[ 'disable_frontend_assets' ] == '0' ) {
|
197 |
+
echo "checked='checked'";
|
198 |
+
}
|
199 |
+
?> /><label for="disable_frontend_assets_n"><?php _e( 'No', 'accesspress-social-share' ); ?></label></div>
|
200 |
+
<div class="misc-opt"><input type="radio" id='disable_frontend_assets_y' name="apss_share_settings[disable_frontend_assets]" value="1" <?php
|
201 |
+
if ( isset( $options[ 'disable_frontend_assets' ] ) && $options[ 'disable_frontend_assets' ] == '1' ) {
|
202 |
+
echo "checked='checked'";
|
203 |
+
}
|
204 |
+
?> /><label for="disable_frontend_assets_y"><?php _e( 'Yes', 'accesspress-social-share' ); ?></label></div>
|
205 |
+
<br />
|
206 |
+
<div class="apss_notes_cache_settings">
|
207 |
+
<?php _e( 'Please set this value if you don\'t want to use plguins frontend assets(js and css files).', 'accesspress-social-share' ); ?>
|
208 |
+
</div>
|
209 |
+
</div>
|
210 |
+
<br />
|
211 |
+
<div class="apss_input_wrapper clearfix">
|
212 |
+
<label><?php _e( 'Share text:', 'accesspress-social-share' ); ?></label>
|
213 |
+
<input type="text" name="apss_share_settings[share_text]" value="<?php
|
214 |
+
if ( isset( $options[ 'share_text' ] ) ) {
|
215 |
+
echo $options[ 'share_text' ];
|
216 |
+
}
|
217 |
+
?>" />
|
218 |
+
<div class="apss_notes_cache_settings">
|
219 |
+
<?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.', 'accesspress-social-share' ); ?>
|
220 |
+
</div>
|
221 |
+
</div>
|
222 |
+
<div class="apss_input_wrapper apss-twitter-settings clearfix">
|
223 |
+
<label><?php _e( 'Twitter username:', 'accesspress-social-share' ); ?></label>
|
224 |
+
<input type="text" name="apss_share_settings[twitter_username]" value="<?php echo $options[ 'twitter_username' ]; ?>" />
|
225 |
+
</div>
|
226 |
|
227 |
+
<div class="apss-counter-settings clearfix">
|
228 |
+
<h4><?php _e( 'Social share counter enable?', 'accesspress-social-share' ); ?> </h4>
|
229 |
+
<div class="misc-opt"><input type="radio" id='counter_enable_options_n' name="apss_share_settings[counter_enable_options]" value="0" <?php
|
230 |
+
if ( $options[ 'counter_enable_options' ] == '0' ) {
|
231 |
+
echo "checked='checked'";
|
232 |
+
}
|
233 |
+
?> /><label for="counter_enable_options_n"><?php _e( 'No', 'accesspress-social-share' ); ?></label></div>
|
234 |
+
<div class="misc-opt"><input type="radio" id='counter_enable_options_y' name="apss_share_settings[counter_enable_options]" value="1" <?php
|
235 |
+
if ( $options[ 'counter_enable_options' ] == '1' ) {
|
236 |
+
echo "checked='checked'";
|
237 |
+
}
|
238 |
+
?> /><label for="counter_enable_options_y"><?php _e( 'Yes', 'accesspress-social-share' ); ?></label></div>
|
239 |
+
</div>
|
240 |
|
241 |
+
<div class="apss-counter-api-options apss-counter-settings clearfix" style="<?php
|
242 |
+
if ( isset( $options[ 'counter_enable_options' ] ) && $options[ 'counter_enable_options' ] == '1' ) {
|
243 |
+
echo 'display:block';
|
244 |
+
} else {
|
245 |
+
echo 'display:none';
|
246 |
+
}
|
247 |
+
?>">
|
248 |
+
<div class='apss-counter-api'>
|
249 |
+
<input type="radio" id='apss_twitter_counter_option' name="apss_share_settings[twitter_counter_api]" value="1" <?php
|
250 |
+
if ( isset( $options[ 'twitter_counter_api' ] ) ) {
|
251 |
+
if ( $options[ 'twitter_counter_api' ] == '1' ) {
|
252 |
+
echo "checked='checked'";
|
253 |
+
}
|
254 |
+
}
|
255 |
+
?> />
|
256 |
+
<label for="apss_twitter_counter_option"><?php _e( "Don't show Twitter share counts", 'accesspress-social-share' ); ?></label>
|
257 |
+
<div class="apss_notes_cache_settings"> Please select this option if you don't want to show twitter share counts.</div>
|
258 |
+
</div>
|
259 |
+
|
260 |
+
<div class='apss-counter-api'>
|
261 |
+
<input type="radio" id='apss_twitter_counter_option_1' name="apss_share_settings[twitter_counter_api]" value="2" <?php
|
262 |
+
if ( isset( $options[ 'twitter_counter_api' ] ) ) {
|
263 |
+
if ( $options[ 'twitter_counter_api' ] == '2' ) {
|
264 |
+
echo "checked='checked'";
|
265 |
+
}
|
266 |
+
}
|
267 |
+
?> />
|
268 |
+
<label for="apss_twitter_counter_option_1"><?php _e( 'Use', 'accesspress-social-share' ); ?> <a href='http://newsharecounts.com' target='_blank'>NewShareCounts</a><?php _e( ' to show Twitter share counts', 'accesspress-social-share' ); ?></label>
|
269 |
+
<div class="apss_notes_cache_settings"> To use newsharecount public API, you have to enter your website url <?php echo site_url(); ?> and sign in using Twitter at their <a href='http://newsharecounts.com/' target='_blank'>website</a>.</div>
|
270 |
+
</div>
|
271 |
+
|
272 |
+
<div class='apss-counter-api'>
|
273 |
+
<input type="radio" id='apss_twitter_counter_option_2' name="apss_share_settings[twitter_counter_api]" value="3" <?php
|
274 |
+
if ( isset( $options[ 'twitter_counter_api' ] ) ) {
|
275 |
+
if ( $options[ 'twitter_counter_api' ] == '3' ) {
|
276 |
+
echo "checked='checked'";
|
277 |
+
}
|
278 |
+
}
|
279 |
+
?> /><label for="apss_twitter_counter_option_2"><?php _e( 'Use', 'accesspress-social-share' ); ?> <a href=' http://opensharecount.com/' target='_blank'>OpenShareCount</a><?php _e( ' to show Twitter share counts', 'accesspress-social-share' ); ?></label>
|
280 |
+
<div class="apss_notes_cache_settings"> To use opensharecount public API, you have to sign up and register your website url <?php echo site_url(); ?> at their <a href='http://opensharecount.com/' target='_blank'>website</a>. </div>
|
281 |
+
</div>
|
282 |
+
<div class="apss_notes_cache_settings"> Note: If you switch the API please don't forget to clear cache for fetching new share counts.</div>
|
283 |
+
|
284 |
+
<div class="apss_counter-api">
|
285 |
+
<h4>If facebook counter is not working. Please setup the facebook APP and enter required details below.</h4>
|
286 |
+
<div class='apss_input_wrapper'>
|
287 |
+
<label for=apss_facebook_app_id"">APP ID: </label><input type='text' id="apss_facebook_app_id" name='apss_share_settings[api_configuration][facebook][app_id]' value="<?php
|
288 |
+
if ( isset( $options[ 'api_configuration' ][ 'facebook' ][ 'app_id' ] ) ) {
|
289 |
+
echo $options[ 'api_configuration' ][ 'facebook' ][ 'app_id' ];
|
290 |
+
}
|
291 |
+
?>" />
|
292 |
+
<div class="apss_notes_cache_settings">Please go to <a href="https://developers.facebook.com/" target="_blank">https://developers.facebook.com/</a> and create an app and get the App ID.</div>
|
293 |
+
</div>
|
294 |
+
<div class='apss_input_wrapper'>
|
295 |
+
<label for=apss_facebook_app_secret"">APP Secret: </label><input type='text' id="apss_facebook_app_secret" name='apss_share_settings[api_configuration][facebook][app_secret]' value="<?php
|
296 |
+
if ( isset( $options[ 'api_configuration' ][ 'facebook' ][ 'app_secret' ] ) ) {
|
297 |
+
echo $options[ 'api_configuration' ][ 'facebook' ][ 'app_secret' ];
|
298 |
+
}
|
299 |
+
?>" style="width:285px;" />
|
300 |
+
<div class="apss_notes_cache_settings">Please go to <a href="https://developers.facebook.com/" target="_blank">https://developers.facebook.com/</a> and create an app and get the App Secret.</div>
|
301 |
+
</div>
|
302 |
+
<div class="apss_notes_cache_settings">
|
303 |
+
<b>Please note that you should make your APP live.</b>
|
304 |
+
You can get the details instruction for creating facebook app <a href='http://demo.accesspressthemes.com/wordpress-plugins/accesspress-social-share/?p=89' target="_blank">here</a>.
|
305 |
+
</div>
|
306 |
+
</div>
|
307 |
+
</div>
|
308 |
+
|
309 |
+
<div class="apss-total-counter-settings clearfix">
|
310 |
+
<h4><?php _e( 'Social share total counter enable?', 'accesspress-social-share' ); ?> </h4>
|
311 |
+
<div class="misc-opt"><input type="radio" id='total_counter_enable_options_n' name="apss_share_settings[total_counter_enable_options]" value="0" <?php
|
312 |
+
if ( isset( $options[ 'total_counter_enable_options' ] ) && $options[ 'total_counter_enable_options' ] == '0' ) {
|
313 |
+
echo "checked='checked'";
|
314 |
+
}
|
315 |
+
?> /><label for="total_counter_enable_options_n"><?php _e( 'No', 'accesspress-social-share' ); ?></label></div>
|
316 |
+
<div class="misc-opt"><input type="radio" id='total_counter_enable_options_y' name="apss_share_settings[total_counter_enable_options]" value="1" <?php
|
317 |
+
if ( isset( $options[ 'total_counter_enable_options' ] ) && $options[ 'total_counter_enable_options' ] == '1' ) {
|
318 |
+
echo "checked='checked'";
|
319 |
+
}
|
320 |
+
?> /><label for="total_counter_enable_options_y"><?php _e( 'Yes', 'accesspress-social-share' ); ?></label></div>
|
321 |
+
</div>
|
322 |
+
|
323 |
+
<div class='apss_cache_enable_opt'>
|
324 |
+
<h4><?php _e( 'Fetch the share counts from HTTP url as well? ', 'accesspress-social-share' ); ?> </h4>
|
325 |
+
<div class='misc-opt'>
|
326 |
+
<input type="radio" id='enable_http_count_yes' name="apss_share_settings[enable_http_count]" value="1" <?php
|
327 |
+
if ( isset( $options[ 'enable_http_count' ] ) && $options[ 'enable_http_count' ] == '1' ) {
|
328 |
+
echo "checked='checked'";
|
329 |
+
}
|
330 |
+
?> />
|
331 |
+
<label for='enable_http_count_yes'><?php _e( 'Yes', 'accesspress-social-share' ); ?></label>
|
332 |
+
</div>
|
333 |
+
<div class='misc-opt'>
|
334 |
+
<input type="radio" id='enable_http_count_no' name="apss_share_settings[enable_http_count]" value="0" <?php
|
335 |
+
if ( isset( $options[ 'enable_http_count' ] ) && $options[ 'enable_http_count' ] == '0' ) {
|
336 |
+
echo "checked='checked'";
|
337 |
+
}
|
338 |
+
?> />
|
339 |
+
<label for='enable_http_count_no'><?php _e( 'No', 'accesspress-social-share' ); ?></label>
|
340 |
+
</div>
|
341 |
+
<br />
|
342 |
+
<div class="apss_notes_cache_settings">
|
343 |
+
<?php _e( "<b>Note:</b> Please select this option if you have moved your site from HTTP to HTTPS. For Facebook and Google+, The crawler still needs to be able to access the old page, so exempt the crawler's user agent from the redirect and only send an HTTP redirect to non-Facebook crawler clients. If you have done 301 redirect then the old url share counts will be lost.", 'accesspress-social-share' ); ?>
|
344 |
+
</div>
|
345 |
+
</div>
|
346 |
+
<br />
|
347 |
|
348 |
+
<div class="apss-dialog-boxs clearfix">
|
349 |
+
<h4><?php _e( 'Social share link options:', 'accesspress-social-share' ); ?> </h4>
|
350 |
+
<div class="misc-opt"><input type="radio" id='dialog_box_options_1' name="apss_share_settings[dialog_box_options]" value="0" <?php
|
351 |
+
if ( $options[ 'dialog_box_options' ] == '0' ) {
|
352 |
+
echo "checked='checked'";
|
353 |
+
}
|
354 |
+
?> /><label for="dialog_box_options_1"><?php _e( 'Open in same window', 'accesspress-social-share' ); ?></label></div>
|
355 |
+
<div class="misc-opt"><input type="radio" id='dialog_box_options_2' name="apss_share_settings[dialog_box_options]" value="1" <?php
|
356 |
+
if ( $options[ 'dialog_box_options' ] == '1' ) {
|
357 |
+
echo "checked='checked'";
|
358 |
+
}
|
359 |
+
?> /><label for="dialog_box_options_2"><?php _e( 'Open in new window/Tab', 'accesspress-social-share' ); ?></label></div>
|
|
|
|
|
|
|
|
|
360 |
|
361 |
+
<div class="misc-opt"><input type="radio" id='dialog_box_options_3' name="apss_share_settings[dialog_box_options]" value="2" <?php
|
362 |
+
if ( $options[ 'dialog_box_options' ] == '2' ) {
|
363 |
+
echo "checked='checked'";
|
364 |
+
}
|
365 |
+
?> /><label for="dialog_box_options_3"><?php _e( 'Open in popup window', 'accesspress-social-share' ); ?></label></div>
|
366 |
+
</div>
|
|
|
|
|
|
|
367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
+
<div class='apss_cache_enable_opt'>
|
370 |
+
<h4><?php _e( 'Enable cache? ', 'accesspress-social-share' ); ?> </h4>
|
371 |
+
<div class='misc-opt'>
|
372 |
+
<input type="radio" id='enable_cache_yes' name="apss_share_settings[enable_cache]" value="1" <?php
|
373 |
+
if ( isset( $options[ 'enable_cache' ] ) && $options[ 'enable_cache' ] == '1' ) {
|
374 |
+
echo "checked='checked'";
|
375 |
+
}
|
376 |
+
?> />
|
377 |
+
<label for='enable_cache_yes'><?php _e( 'Yes', 'accesspress-social-share' ); ?></label>
|
378 |
+
</div>
|
379 |
+
<div class='misc-opt'>
|
380 |
+
<input type="radio" id='enable_cache_no' name="apss_share_settings[enable_cache]" value="0" <?php
|
381 |
+
if ( isset( $options[ 'enable_cache' ] ) && $options[ 'enable_cache' ] == '0' ) {
|
382 |
+
echo "checked='checked'";
|
383 |
+
}
|
384 |
+
?> />
|
385 |
+
<label for='enable_cache_no'><?php _e( 'No', 'accesspress-social-share' ); ?></label>
|
386 |
+
</div>
|
387 |
+
</div>
|
388 |
+
<br />
|
389 |
+
<div class='cache-settings'>
|
390 |
+
<h4><?php _e( 'Cache Settings: ', 'accesspress-social-share' ); ?> </h4>
|
391 |
+
<div class="apss_input_wrapper">
|
392 |
+
<label for="apss_cache_settings"><?php _e( 'Cache Period:', 'accesspress-social-share' ); ?></label>
|
393 |
+
<input type='text' id="apss_cache_period" name='apss_share_settings[cache_settings]' value="<?php
|
394 |
+
if ( isset( $options[ 'cache_period' ] ) ) {
|
395 |
+
echo $options[ 'cache_period' ];
|
396 |
+
}
|
397 |
+
?>" onkeyup="removeMe('invalid_cache_period');" style='width:50px;'/>
|
398 |
+
<span class="error invalid_cache_period"></span>
|
399 |
+
<div class="apss_notes_cache_settings"><?php _e( 'Please enter the time in hours in which the social share counter should be updated from social networks. Default is 24 hours.', 'accesspress-social-share' ); ?></div>
|
400 |
|
401 |
+
</div>
|
402 |
+
</div>
|
403 |
|
404 |
+
<div class="apss-email-settings">
|
405 |
+
<h4><?php _e( 'Email Settings:', 'accesspress-social-share' ); ?></h4>
|
406 |
+
<div class="app-email-sub email-setg">
|
407 |
+
<label for='apss-email-subject'><?php _e( 'Email subject:', 'accesspress-social-share' ); ?></label>
|
408 |
+
<input type='text' name="apss_share_settings[apss_email_subject]" value="<?php echo $options[ 'apss_email_subject' ] ?>" style='width:325px;'/>
|
409 |
+
</div>
|
410 |
+
<div class="app-email-body email-setg">
|
411 |
+
<label for='apss-email-body'><?php _e( 'Email body:', 'accesspress-social-share' ); ?></label>
|
412 |
+
<textarea rows='30' cols='30' name="apss_share_settings[apss_email_body]"><?php echo $options[ 'apss_email_body' ] ?></textarea>
|
413 |
+
</div>
|
414 |
+
<div class="apss_notes_cache_settings">
|
415 |
+
Available parameters: <br />
|
416 |
+
%%url%% = current page/post url(custom url if you have used "custom_share_link" attribute in the shortcode ) <br />
|
417 |
+
%%title%% = current page/post's title <br />
|
418 |
+
%%permalink%% = current page/post url <br />
|
419 |
+
%%siteurl%% = Site url <br />
|
420 |
+
</div>
|
421 |
+
</div>
|
422 |
+
</div>
|
423 |
+
<div class="apss-tab-contents apss-how-to-use" id="tab-apss-how-to-use" style='display:none' ><?php include_once('how-to-use.php'); ?></div>
|
|
|
|
|
424 |
|
425 |
+
<div class="apss-tab-contents apss-about" id="tab-apss-about" style='display:none' ><?php include('about-apss.php'); ?></div>
|
426 |
+
<?php wp_nonce_field( 'apss_nonce_save_settings', 'apss_add_nonce_save_settings' ); ?>
|
427 |
+
<input type="submit" class="submit_settings button primary-button" value="<?php _e( 'Save settings', 'accesspress-social-share' ); ?>" name="apss_submit_settings" id="apss_submit_settings"/>
|
428 |
+
<?php
|
429 |
+
/**
|
430 |
+
* Nonce field
|
431 |
+
* */
|
432 |
+
wp_nonce_field( 'apss_settings_action', 'apss_settings_action' );
|
433 |
+
?>
|
434 |
+
<?php $nonce = wp_create_nonce( 'apss-restore-default-settings-nonce' ); ?>
|
435 |
+
<?php $nonce_clear = wp_create_nonce( 'apss-clear-cache-nonce' ); ?>
|
436 |
+
<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?', 'accesspress-social-share' ); ?>')"><input type="button" value="Restore Default Settings" class="apss-reset-button button primary-button"/></a>
|
437 |
+
<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?', 'accesspress-social-share' ); ?>')"><input type="button" value="Clear Cache" class="apss-reset-button button primary-button"/></a>
|
438 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
|
440 |
+
<div class="apss-promoFloat">
|
441 |
+
<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>
|
442 |
+
<div class="apss-promo-buttons"><a target='_blank' href="http://demo.accesspressthemes.com/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>
|
443 |
+
<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>
|
444 |
+
<div class="apss-promo-buttons"><a target='_blank' href="http://demo.accesspressthemes.com/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>
|
445 |
+
</div>
|
446 |
+
</div>
|
447 |
+
<div class="clear"></div>
|
448 |
+
</form>
|
449 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
</div>
|
inc/backend/save-settings.php
CHANGED
@@ -1,55 +1,56 @@
|
|
1 |
-
<?php
|
|
|
2 |
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
3 |
$apss_share_settings = array();
|
4 |
$share_options = array();
|
5 |
-
if ( isset( $_POST['apss_share_settings']['share_options'] ) ) {
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
}
|
10 |
|
11 |
-
$apss_share_settings['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 |
-
|
19 |
}
|
20 |
|
21 |
-
$apss_share_settings['social_networks']
|
22 |
-
$apss_share_settings['disable_frontend_assets']
|
23 |
-
$apss_share_settings['share_text']
|
24 |
-
$apss_share_settings['twitter_username']
|
25 |
-
$apss_share_settings['counter_enable_options']
|
26 |
-
$apss_share_settings['twitter_counter_api']
|
27 |
-
|
28 |
-
$fb_app_id = isset( $_POST['apss_share_settings']['api_configuration']['facebook']['app_id'] ) ? $_POST['apss_share_settings']['api_configuration']['facebook']['app_id'] : '';
|
29 |
-
$fb_app_secret = isset( $_POST['apss_share_settings']['api_configuration']['facebook']['app_secret'] ) ? $_POST['apss_share_settings']['api_configuration']['facebook']['app_secret'] : '';
|
30 |
-
$apss_share_settings['api_configuration']['facebook'] =
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
$apss_share_settings['total_counter_enable_options']
|
36 |
-
$apss_share_settings['enable_http_count']
|
37 |
-
$apss_share_settings['enable_cache']
|
38 |
-
$apss_share_settings['cache_period']
|
39 |
-
$apss_share_settings['dialog_box_options']
|
40 |
// $apss_share_settings['footer_javascript'] = $_POST['apss_share_settings']['footer_javascript'];
|
41 |
-
$apss_share_settings['apss_email_subject']
|
42 |
-
$apss_share_settings['apss_email_body']
|
43 |
-
if ( !isset( $apss_share_settings['apss_social_counts_transients'] ) ) {
|
44 |
-
|
45 |
}
|
46 |
|
47 |
// The option already exists, so we just update it.
|
48 |
$status = update_option( APSS_SETTING_NAME, $apss_share_settings );
|
49 |
-
if($status == TRUE){
|
50 |
-
|
51 |
-
}else{
|
52 |
-
|
53 |
}
|
54 |
exit;
|
55 |
|
1 |
+
<?php
|
2 |
+
|
3 |
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
4 |
$apss_share_settings = array();
|
5 |
$share_options = array();
|
6 |
+
if ( isset( $_POST[ 'apss_share_settings' ][ 'share_options' ] ) ) {
|
7 |
+
foreach ( $_POST[ 'apss_share_settings' ][ 'share_options' ] as $key => $value ) {
|
8 |
+
$share_options[] = $value;
|
9 |
+
}
|
10 |
}
|
11 |
|
12 |
+
$apss_share_settings[ 'share_options' ] = $share_options;
|
13 |
+
$apss_share_settings[ 'social_icon_set' ] = $_POST[ 'apss_share_settings' ][ 'social_icon_set' ];
|
14 |
+
$apss_share_settings[ 'share_positions' ] = $_POST[ 'apss_share_settings' ][ 'social_share_position_options' ];
|
15 |
|
16 |
+
$apss_social_newtwork_order = explode( ',', $_POST[ 'apss_social_newtwork_order' ] );
|
17 |
$social_network_array = array();
|
18 |
foreach ( $apss_social_newtwork_order as $social_network ) {
|
19 |
+
$social_network_array[ $social_network ] = (isset( $_POST[ 'social_networks' ][ $social_network ] )) ? 1 : 0;
|
20 |
}
|
21 |
|
22 |
+
$apss_share_settings[ 'social_networks' ] = $social_network_array;
|
23 |
+
$apss_share_settings[ 'disable_frontend_assets' ] = isset( $_POST[ 'apss_share_settings' ][ 'disable_frontend_assets' ] ) ? $_POST[ 'apss_share_settings' ][ 'disable_frontend_assets' ] : '0';
|
24 |
+
$apss_share_settings[ 'share_text' ] = stripslashes_deep( $_POST[ 'apss_share_settings' ][ 'share_text' ] );
|
25 |
+
$apss_share_settings[ 'twitter_username' ] = stripslashes_deep( $_POST[ 'apss_share_settings' ][ 'twitter_username' ] );
|
26 |
+
$apss_share_settings[ 'counter_enable_options' ] = $_POST[ 'apss_share_settings' ][ 'counter_enable_options' ];
|
27 |
+
$apss_share_settings[ 'twitter_counter_api' ] = $_POST[ 'apss_share_settings' ][ 'twitter_counter_api' ];
|
28 |
+
|
29 |
+
$fb_app_id = isset( $_POST[ 'apss_share_settings' ][ 'api_configuration' ][ 'facebook' ][ 'app_id' ] ) ? $_POST[ 'apss_share_settings' ][ 'api_configuration' ][ 'facebook' ][ 'app_id' ] : '';
|
30 |
+
$fb_app_secret = isset( $_POST[ 'apss_share_settings' ][ 'api_configuration' ][ 'facebook' ][ 'app_secret' ] ) ? $_POST[ 'apss_share_settings' ][ 'api_configuration' ][ 'facebook' ][ 'app_secret' ] : '';
|
31 |
+
$apss_share_settings[ 'api_configuration' ][ 'facebook' ] = array(
|
32 |
+
'app_id' => stripslashes_deep( $fb_app_id ),
|
33 |
+
'app_secret' => stripslashes_deep( $fb_app_secret )
|
34 |
+
);
|
35 |
+
|
36 |
+
$apss_share_settings[ 'total_counter_enable_options' ] = $_POST[ 'apss_share_settings' ][ 'total_counter_enable_options' ];
|
37 |
+
$apss_share_settings[ 'enable_http_count' ] = $_POST[ 'apss_share_settings' ][ 'enable_http_count' ];
|
38 |
+
$apss_share_settings[ 'enable_cache' ] = $_POST[ 'apss_share_settings' ][ 'enable_cache' ];
|
39 |
+
$apss_share_settings[ 'cache_period' ] = is_numeric( $_POST[ 'apss_share_settings' ][ 'cache_settings' ] ) ? $_POST[ 'apss_share_settings' ][ 'cache_settings' ] : '24';
|
40 |
+
$apss_share_settings[ 'dialog_box_options' ] = $_POST[ 'apss_share_settings' ][ 'dialog_box_options' ];
|
41 |
// $apss_share_settings['footer_javascript'] = $_POST['apss_share_settings']['footer_javascript'];
|
42 |
+
$apss_share_settings[ 'apss_email_subject' ] = stripslashes_deep( $_POST[ 'apss_share_settings' ][ 'apss_email_subject' ] );
|
43 |
+
$apss_share_settings[ 'apss_email_body' ] = stripslashes_deep( $_POST[ 'apss_share_settings' ][ 'apss_email_body' ] );
|
44 |
+
if ( ! isset( $apss_share_settings[ 'apss_social_counts_transients' ] ) ) {
|
45 |
+
$apss_share_settings[ 'apss_social_counts_transients' ] = array();
|
46 |
}
|
47 |
|
48 |
// The option already exists, so we just update it.
|
49 |
$status = update_option( APSS_SETTING_NAME, $apss_share_settings );
|
50 |
+
if ( $status == TRUE ) {
|
51 |
+
wp_redirect( admin_url() . 'admin.php?page=accesspress-social-share&message=1' );
|
52 |
+
} else {
|
53 |
+
wp_redirect( admin_url() . 'admin.php?page=accesspress-social-share&message=2' );
|
54 |
}
|
55 |
exit;
|
56 |
|
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.9
|
7 |
-
Stable tag: 4.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -23,15 +23,15 @@ The available social media are: Facebook, Twitter, Google+, Pinterest, LinkedIn
|
|
23 |
|
24 |
Just get it done in a few minutes!
|
25 |
|
26 |
-
`For more options - more social media integration, more themes,
|
27 |
-
floating sidebar options, widget options, more shortcode
|
28 |
options. Pinterest pin it button for each images. Please upgrade
|
29 |
to Premium version.`
|
30 |
|
31 |
`Have you moved your site from HTTP to HTTPS and lost your share
|
32 |
-
counts? No worries! Now you can get your http site's share
|
33 |
counts back using our plugin.
|
34 |
-
<strong>Note: If you have set 301 redirects in your site the
|
35 |
facebook share counts may reset</strong>
|
36 |
`
|
37 |
|
@@ -62,8 +62,8 @@ facebook share counts may reset</strong>
|
|
62 |
|
63 |
★ Beautifully designed 10 themes to select from.
|
64 |
|
65 |
-
★ Major 14 social media included(Facebook, Twitter, Google+, Pinterest,
|
66 |
-
LinkedIn, Digg, Delicious, Stumbleupon, Tumblr, Vkontakte, Reddit, Xing,
|
67 |
Weibo and Buffer).
|
68 |
|
69 |
★ Popup sharing.
|
@@ -76,7 +76,7 @@ facebook share counts may reset</strong>
|
|
76 |
|
77 |
★ Widgets - Add the AccessPress Social Share in widgets.
|
78 |
|
79 |
-
★ Floating Sidebar - Beautifully designed 4 themes to display in the
|
80 |
floating sidebar with various display position options.
|
81 |
|
82 |
★ Social media fans/followers count display options.
|
@@ -95,7 +95,7 @@ For premium upgrade please go [here](https://accesspressthemes.com/wordpress-plu
|
|
95 |
* <strong>Support Forum Link</strong>: http://accesspressthemes.com/support/
|
96 |
* <strong>Website Link</strong>: http://accesspressthemes.com/
|
97 |
* <strong>Youtube channel link</strong>: https://www.youtube.com/watch?v=TjZNcVG3fDE
|
98 |
-
* <strong>Facebook link</strong>: https://www.facebook.com/AccessPressThemes
|
99 |
|
100 |
|
101 |
|
@@ -147,6 +147,9 @@ Yes. You can use the AccessPress social share by using shortcode anywhere you wa
|
|
147 |
|
148 |
== Changelog ==
|
149 |
|
|
|
|
|
|
|
150 |
= 4.3.8 =
|
151 |
* Checked GDPR Compability.
|
152 |
|
@@ -223,7 +226,7 @@ Yes. You can use the AccessPress social share by using shortcode anywhere you wa
|
|
223 |
|
224 |
= 4.1.6 =
|
225 |
* Fixed the twitter multiple popup issue.
|
226 |
-
* Removed the dublicate css for the share text css from the frontend css.
|
227 |
|
228 |
= 4.1.5 =
|
229 |
* Multisite compactibility issue fixed.
|
@@ -408,22 +411,22 @@ Yes. You can use the AccessPress social share by using shortcode anywhere you wa
|
|
408 |
* Share count using ajax to store it in cache.
|
409 |
* Changes in the upgrade banner images.
|
410 |
* Fixed the bug for share options if not selected to any.
|
411 |
-
* Fixed the bug in the twitter share and added twitter share via in the twitter share link.
|
412 |
|
413 |
-
= 1.0.3 =
|
414 |
* Fixed the bug for pinterest images share.
|
415 |
* Fixed the bug for the post and page share url.
|
416 |
|
417 |
-
= 1.0.2 =
|
418 |
* Fixed the bug for pre-selected page share options.
|
419 |
* Done the bug fixing for label attributes for display settings tab and miscellaneous tab.
|
420 |
-
* Some changes done for how to use section and about sections.
|
421 |
|
422 |
|
423 |
= 1.0.1 =
|
424 |
* Added the options for the display of the social share in home page.
|
425 |
* Fixed wp error occuring for the http request made by site.
|
426 |
-
|
427 |
= 1.0.0 =
|
428 |
* Plugin submitted to http://wordpress.org for review and approval
|
429 |
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 4.3.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
23 |
|
24 |
Just get it done in a few minutes!
|
25 |
|
26 |
+
`For more options - more social media integration, more themes,
|
27 |
+
floating sidebar options, widget options, more shortcode
|
28 |
options. Pinterest pin it button for each images. Please upgrade
|
29 |
to Premium version.`
|
30 |
|
31 |
`Have you moved your site from HTTP to HTTPS and lost your share
|
32 |
+
counts? No worries! Now you can get your http site's share
|
33 |
counts back using our plugin.
|
34 |
+
<strong>Note: If you have set 301 redirects in your site the
|
35 |
facebook share counts may reset</strong>
|
36 |
`
|
37 |
|
62 |
|
63 |
★ Beautifully designed 10 themes to select from.
|
64 |
|
65 |
+
★ Major 14 social media included(Facebook, Twitter, Google+, Pinterest,
|
66 |
+
LinkedIn, Digg, Delicious, Stumbleupon, Tumblr, Vkontakte, Reddit, Xing,
|
67 |
Weibo and Buffer).
|
68 |
|
69 |
★ Popup sharing.
|
76 |
|
77 |
★ Widgets - Add the AccessPress Social Share in widgets.
|
78 |
|
79 |
+
★ Floating Sidebar - Beautifully designed 4 themes to display in the
|
80 |
floating sidebar with various display position options.
|
81 |
|
82 |
★ Social media fans/followers count display options.
|
95 |
* <strong>Support Forum Link</strong>: http://accesspressthemes.com/support/
|
96 |
* <strong>Website Link</strong>: http://accesspressthemes.com/
|
97 |
* <strong>Youtube channel link</strong>: https://www.youtube.com/watch?v=TjZNcVG3fDE
|
98 |
+
* <strong>Facebook link</strong>: https://www.facebook.com/AccessPressThemes
|
99 |
|
100 |
|
101 |
|
147 |
|
148 |
== Changelog ==
|
149 |
|
150 |
+
= 4.3.9 =
|
151 |
+
* updated in translation ready.
|
152 |
+
|
153 |
= 4.3.8 =
|
154 |
* Checked GDPR Compability.
|
155 |
|
226 |
|
227 |
= 4.1.6 =
|
228 |
* Fixed the twitter multiple popup issue.
|
229 |
+
* Removed the dublicate css for the share text css from the frontend css.
|
230 |
|
231 |
= 4.1.5 =
|
232 |
* Multisite compactibility issue fixed.
|
411 |
* Share count using ajax to store it in cache.
|
412 |
* Changes in the upgrade banner images.
|
413 |
* Fixed the bug for share options if not selected to any.
|
414 |
+
* Fixed the bug in the twitter share and added twitter share via in the twitter share link.
|
415 |
|
416 |
+
= 1.0.3 =
|
417 |
* Fixed the bug for pinterest images share.
|
418 |
* Fixed the bug for the post and page share url.
|
419 |
|
420 |
+
= 1.0.2 =
|
421 |
* Fixed the bug for pre-selected page share options.
|
422 |
* Done the bug fixing for label attributes for display settings tab and miscellaneous tab.
|
423 |
+
* Some changes done for how to use section and about sections.
|
424 |
|
425 |
|
426 |
= 1.0.1 =
|
427 |
* Added the options for the display of the social share in home page.
|
428 |
* Fixed wp error occuring for the http request made by site.
|
429 |
+
|
430 |
= 1.0.0 =
|
431 |
* Plugin submitted to http://wordpress.org for review and approval
|
432 |
|