Version Description
- Addition of the share text options in backend.
- Done the css modification for frontend share text display.
Download this release
Release Info
Developer | Access Keys |
Plugin | Social Share WordPress Plugin – AccessPress Social Share |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- accesspress-social-share.php +165 -171
- css/frontend.css +10 -0
- inc/backend/activation.php +1 -0
- inc/backend/main-page.php +8 -0
- inc/backend/save-settings.php +1 -0
- inc/frontend/content-filter.php +5 -0
- readme.txt +5 -1
accesspress-social-share.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
3 |
/*
|
4 |
Plugin name: AccessPress Social Share
|
5 |
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-share/
|
6 |
Description: A plugin to add various social media shares to a site with dynamic configuration options.
|
7 |
-
Version: 1.1.
|
8 |
Author: AccessPress Themes
|
9 |
Author URI: http://accesspressthemes.com
|
10 |
Text Domain:apss-share
|
@@ -31,7 +31,7 @@ if( !defined( 'APSS_LANG_DIR' ) ) {
|
|
31 |
}
|
32 |
|
33 |
if( !defined( 'APSS_VERSION' ) ) {
|
34 |
-
define( 'APSS_VERSION', '1.1.
|
35 |
}
|
36 |
|
37 |
if(!defined('APSS_TEXT_DOMAIN')){
|
@@ -87,29 +87,7 @@ if( !class_exists( 'APSS_Class' ) ){
|
|
87 |
load_plugin_textdomain( APSS_TEXT_DOMAIN, false, APSS_LANG_DIR);
|
88 |
}
|
89 |
|
90 |
-
|
91 |
-
function add_apss_menu(){
|
92 |
-
add_menu_page( 'AccessPress Social Share', 'AccessPress Social Share', 'manage_options', 'apss-share', array( $this, 'main_page' ), APSS_IMAGE_DIR . '/apss-icon.png' );
|
93 |
-
add_submenu_page( 'apss-share', __( 'Social Icons Settings', APSS_TEXT_DOMAIN ), __( 'Social Icons Settings', APSS_TEXT_DOMAIN ), 'manage_options', 'apss-share', array( $this, 'main_page' ) );
|
94 |
-
}
|
95 |
-
|
96 |
-
//plugins backend admin page
|
97 |
-
function main_page() {
|
98 |
-
include('inc/backend/main-page.php');
|
99 |
-
}
|
100 |
-
|
101 |
-
//for saving the plugin settings
|
102 |
-
function apss_save_options(){
|
103 |
-
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') ){
|
104 |
-
include( 'inc/backend/save-settings.php' );
|
105 |
-
}
|
106 |
-
else
|
107 |
-
{
|
108 |
-
die('No script kiddies please!');
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
//starts the session with the call of init hook
|
113 |
function session_init(){
|
114 |
if( !session_id() )
|
115 |
{
|
@@ -117,70 +95,72 @@ if( !class_exists( 'APSS_Class' ) ){
|
|
117 |
}
|
118 |
}
|
119 |
|
120 |
-
//
|
121 |
-
function
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
131 |
}
|
132 |
-
return $pageURL;
|
133 |
}
|
134 |
|
135 |
//function to return the content filter for the posts and pages
|
136 |
-
|
137 |
-
|
138 |
$post_content=$content;
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
$excerpt= substr($content, 0, 100).'...';
|
143 |
}else{
|
144 |
$excerpt = $content;
|
145 |
}
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
|
165 |
-
|
166 |
-
|
167 |
|
168 |
-
|
169 |
-
|
170 |
|
171 |
-
|
172 |
|
173 |
-
|
174 |
-
|
175 |
|
176 |
-
|
177 |
-
|
178 |
|
179 |
if( empty($options['share_options']) ){
|
180 |
return $post_content;
|
181 |
|
182 |
}else if( $is_lists_authorized || $is_singular || $is_tax || $is_front_page || $default_category || $default_archives ){
|
183 |
-
|
184 |
return $post_content . "<div class='apss-social-share apss-theme-$icon_set_value clearfix' >" . $html_content . "</div>";
|
185 |
}
|
186 |
|
@@ -195,38 +175,124 @@ if( !class_exists( 'APSS_Class' ) ){
|
|
195 |
} else {
|
196 |
return $post_content;
|
197 |
}
|
|
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
//functions to register frontend styles and scripts
|
202 |
-
function register_admin_assets(){
|
203 |
-
/**
|
204 |
-
* Backend CSS
|
205 |
-
* */
|
206 |
-
if( isset($_GET['page']) && $_GET['page']=='apss-share' ){
|
207 |
-
wp_enqueue_style( 'aps-admin-css', APSS_CSS_DIR . '/backend.css', false, APSS_VERSION ); //registering plugin admin css
|
208 |
-
wp_enqueue_style( 'fontawesome-css', APSS_CSS_DIR . '/font-awesome.min.css', false, APSS_VERSION );
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Backend JS
|
212 |
-
* */
|
213 |
-
wp_enqueue_script( 'jquery-ui-sortable' );
|
214 |
-
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
|
215 |
-
}
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
* Registers Frontend Assets
|
220 |
* */
|
221 |
function register_frontend_assets() {
|
222 |
-
|
223 |
-
|
224 |
wp_enqueue_style( 'apss-frontend-css', APSS_CSS_DIR . '/frontend.css', array( 'apss-font-awesome' ), APSS_VERSION );
|
225 |
wp_enqueue_script('apss-frontend-mainjs', APSS_JS_DIR . '/frontend.js', array('jquery'), APSS_VERSION, true);
|
226 |
$ajax_nonce = wp_create_nonce( 'apss-ajax-nonce' );
|
227 |
wp_localize_script( 'apss-frontend-mainjs', 'frontend_ajax_object', array( 'ajax_url' => admin_url() . 'admin-ajax.php', 'ajax_nonce' => $ajax_nonce ) );
|
228 |
}
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
/**
|
231 |
* Funciton to print array in pre format
|
232 |
* */
|
@@ -237,23 +303,7 @@ if( !class_exists( 'APSS_Class' ) ){
|
|
237 |
echo "</pre>";
|
238 |
}
|
239 |
|
240 |
-
|
241 |
-
function apss_restore_default_settings(){
|
242 |
-
$nonce = $_REQUEST['_wpnonce'];
|
243 |
-
if(!empty($_GET) && wp_verify_nonce( $nonce, 'apss-restore-default-settings-nonce' ) )
|
244 |
-
{
|
245 |
-
//restore the default plugin activation settings from the activation page.
|
246 |
-
include( 'inc/backend/activation.php' );
|
247 |
-
$_SESSION['apss_message'] = __( 'Settings restored Successfully.', APSS_TEXT_DOMAIN );
|
248 |
-
wp_redirect( admin_url().'admin.php?page=apss-share' );
|
249 |
-
exit;
|
250 |
-
}else{
|
251 |
-
die( 'No script kiddies please!' );
|
252 |
-
}
|
253 |
-
|
254 |
-
}
|
255 |
-
|
256 |
-
////////////////////////////////////for count //////////////////////////////////////////////////////
|
257 |
//for facebook url share count
|
258 |
function get_fb($url) {
|
259 |
$apss_settings = $this->apss_settings;
|
@@ -385,9 +435,8 @@ if( !class_exists( 'APSS_Class' ) ){
|
|
385 |
return $linkedin_count;
|
386 |
}
|
387 |
|
388 |
-
|
389 |
-
|
390 |
-
private function get_json_values( $url ){
|
391 |
$apss_settings = $this->apss_settings;
|
392 |
$cache_period = $apss_settings['cache_period']*60*60;
|
393 |
$args = array( 'timeout' => 10 );
|
@@ -395,9 +444,9 @@ if( !class_exists( 'APSS_Class' ) ){
|
|
395 |
$json_response = wp_remote_retrieve_body( $response );
|
396 |
return $json_response;
|
397 |
}
|
|
|
398 |
|
399 |
-
|
400 |
-
function get_count($profile_name, $url) {
|
401 |
switch ($profile_name) {
|
402 |
case 'facebook':
|
403 |
$count = $this->get_fb($url);
|
@@ -426,62 +475,7 @@ if( !class_exists( 'APSS_Class' ) ){
|
|
426 |
return $count;
|
427 |
}
|
428 |
|
429 |
-
|
430 |
-
function frontend_counter() {
|
431 |
-
if (!empty($_GET) && wp_verify_nonce( $_GET['_wpnonce'], 'apss-ajax-nonce' ) ) {
|
432 |
-
$apss_settings = $this->apss_settings;
|
433 |
-
$new_detail_array = array();
|
434 |
-
if (isset($_POST['data'])) {
|
435 |
-
$details = $_POST['data'];
|
436 |
-
foreach ($details as $detail) {
|
437 |
-
$new_detail_array[$detail['network']] = $this->get_count($detail['network'], $detail['url']);
|
438 |
-
}
|
439 |
-
} else {
|
440 |
-
$shortcode_data = $_POST['shortcode_data'];
|
441 |
-
foreach ($shortcode_data as $detail) {
|
442 |
-
$detail_array = explode('_', $detail);
|
443 |
-
$url = trim($detail_array[0]);
|
444 |
-
$network = $detail_array[1];
|
445 |
-
$new_detail_array[] = $this->get_count($network, $url);
|
446 |
-
}
|
447 |
-
}
|
448 |
-
die( json_encode( $new_detail_array ) );
|
449 |
-
}
|
450 |
-
}
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
/**
|
455 |
-
* Clears the social share counter cache
|
456 |
-
*/
|
457 |
-
function apss_clear_cache() {
|
458 |
-
if (!empty($_GET) && wp_verify_nonce($_GET['_wpnonce'], 'apss-clear-cache-nonce')) {
|
459 |
-
$apss_settings = $this->apss_settings;
|
460 |
-
$apss_social_counts_transients = get_option(APSS_COUNT_TRANSIENTS);
|
461 |
-
foreach ($apss_social_counts_transients as $transient) {
|
462 |
-
delete_transient($transient);
|
463 |
-
}
|
464 |
-
update_option( APSS_COUNT_TRANSIENTS, array() );
|
465 |
-
$transient_array = array('apss_tweets_count', 'apss_linkedin_count', 'apss_fb_count', 'apss_pin_count', 'apss_google_plus_count', 'apss_stumble_count', 'apss_delicious_count', 'apss_reddit_count');
|
466 |
-
foreach ($transient_array as $transient) {
|
467 |
-
delete_transient($transient);
|
468 |
-
}
|
469 |
-
$_SESSION['apss_message'] = __( 'Cache cleared Successfully', APSS_TEXT_DOMAIN );
|
470 |
-
wp_redirect( admin_url() . 'admin.php?page=apss-share' );
|
471 |
-
}
|
472 |
-
}
|
473 |
-
|
474 |
-
//function for adding shortcode of a plugin
|
475 |
-
function apss_shortcode($attr) {
|
476 |
-
ob_start();
|
477 |
-
include('inc/frontend/shortcode.php');
|
478 |
-
$html = ob_get_contents();
|
479 |
-
ob_get_clean();
|
480 |
-
return $html;
|
481 |
-
}
|
482 |
-
|
483 |
}//APSS_Class termination
|
484 |
|
485 |
$apss_object = new APSS_Class();
|
486 |
-
|
487 |
}
|
1 |
+
<?php
|
2 |
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
3 |
/*
|
4 |
Plugin name: AccessPress Social Share
|
5 |
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-share/
|
6 |
Description: A plugin to add various social media shares to a site with dynamic configuration options.
|
7 |
+
Version: 1.1.2
|
8 |
Author: AccessPress Themes
|
9 |
Author URI: http://accesspressthemes.com
|
10 |
Text Domain:apss-share
|
31 |
}
|
32 |
|
33 |
if( !defined( 'APSS_VERSION' ) ) {
|
34 |
+
define( 'APSS_VERSION', '1.1.2' );
|
35 |
}
|
36 |
|
37 |
if(!defined('APSS_TEXT_DOMAIN')){
|
87 |
load_plugin_textdomain( APSS_TEXT_DOMAIN, false, APSS_LANG_DIR);
|
88 |
}
|
89 |
|
90 |
+
//starts the session with the call of init hook
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
function session_init(){
|
92 |
if( !session_id() )
|
93 |
{
|
95 |
}
|
96 |
}
|
97 |
|
98 |
+
//functions to register frontend styles and scripts
|
99 |
+
function register_admin_assets(){
|
100 |
+
/**
|
101 |
+
* Backend CSS
|
102 |
+
* */
|
103 |
+
if( isset($_GET['page']) && $_GET['page']=='apss-share' ){
|
104 |
+
wp_enqueue_style( 'aps-admin-css', APSS_CSS_DIR . '/backend.css', false, APSS_VERSION ); //registering plugin admin css
|
105 |
+
wp_enqueue_style( 'fontawesome-css', APSS_CSS_DIR . '/font-awesome.min.css', false, APSS_VERSION );
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Backend JS
|
109 |
+
* */
|
110 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
111 |
+
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
|
112 |
}
|
|
|
113 |
}
|
114 |
|
115 |
//function to return the content filter for the posts and pages
|
116 |
+
function apss_the_content_filter( $content ) {
|
117 |
+
global $post;
|
118 |
$post_content=$content;
|
119 |
+
$title = get_the_title();
|
120 |
+
$content=strip_shortcodes( strip_tags( get_the_content() ) );
|
121 |
+
if(strlen($content) >= 100){
|
122 |
$excerpt= substr($content, 0, 100).'...';
|
123 |
}else{
|
124 |
$excerpt = $content;
|
125 |
}
|
126 |
+
$options = $this->apss_settings;
|
127 |
+
ob_start();
|
128 |
+
include('inc/frontend/content-filter.php');
|
129 |
+
$html_content = ob_get_contents();
|
130 |
+
ob_get_clean();
|
131 |
+
|
132 |
+
$share_shows_in_options=$options['share_options'];
|
133 |
+
$all = in_array('all', $options['share_options']);
|
134 |
+
$is_lists_authorized = (is_search()) && $all ? true : false;
|
135 |
+
|
136 |
+
$all = in_array('all', $options['share_options']);
|
137 |
+
$is_lists_authorized = (is_search()) && $all ? true : false;
|
138 |
+
|
139 |
+
$front_page = in_array('front_page', $options['share_options']);
|
140 |
+
$is_front_page=(is_front_page()) && $front_page ? true : false;
|
141 |
+
|
142 |
+
$share_shows_in_options=$options['share_options'];
|
143 |
+
$is_singular = is_singular($share_shows_in_options) && !is_front_page() ? true : false;
|
144 |
|
145 |
+
if(!empty($share_shows_in_options)){
|
146 |
+
$is_tax =is_tax($share_shows_in_options);
|
147 |
|
148 |
+
}else{
|
149 |
+
$is_tax=false;
|
150 |
|
151 |
+
}
|
152 |
|
153 |
+
$is_category = in_array( 'categories', $options['share_options'] );
|
154 |
+
$default_category=( is_category() ) && $is_category ? true : false;
|
155 |
|
156 |
+
$is_default_archive=in_array( 'archives', $options['share_options'] );
|
157 |
+
$default_archives=( ( is_archive() && !is_tax() )&& !is_category() ) && $is_default_archive ? true : false;
|
158 |
|
159 |
if( empty($options['share_options']) ){
|
160 |
return $post_content;
|
161 |
|
162 |
}else if( $is_lists_authorized || $is_singular || $is_tax || $is_front_page || $default_category || $default_archives ){
|
163 |
+
if ( $options['share_positions'] == 'below_content' ) {
|
164 |
return $post_content . "<div class='apss-social-share apss-theme-$icon_set_value clearfix' >" . $html_content . "</div>";
|
165 |
}
|
166 |
|
175 |
} else {
|
176 |
return $post_content;
|
177 |
}
|
178 |
+
}
|
179 |
|
180 |
+
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
* Registers Frontend Assets
|
182 |
* */
|
183 |
function register_frontend_assets() {
|
184 |
+
wp_enqueue_style( 'apss-font-awesome', APSS_CSS_DIR.'/font-awesome.min.css',array(),APSS_VERSION );
|
185 |
+
wp_enqueue_style( 'apss-font-opensans', 'http://fonts.googleapis.com/css?family=Open+Sans',array(),false);
|
186 |
wp_enqueue_style( 'apss-frontend-css', APSS_CSS_DIR . '/frontend.css', array( 'apss-font-awesome' ), APSS_VERSION );
|
187 |
wp_enqueue_script('apss-frontend-mainjs', APSS_JS_DIR . '/frontend.js', array('jquery'), APSS_VERSION, true);
|
188 |
$ajax_nonce = wp_create_nonce( 'apss-ajax-nonce' );
|
189 |
wp_localize_script( 'apss-frontend-mainjs', 'frontend_ajax_object', array( 'ajax_url' => admin_url() . 'admin-ajax.php', 'ajax_nonce' => $ajax_nonce ) );
|
190 |
}
|
191 |
+
|
192 |
+
//add plugins menu in backend
|
193 |
+
function add_apss_menu(){
|
194 |
+
add_menu_page( 'AccessPress Social Share', 'AccessPress Social Share', 'manage_options', 'apss-share', array( $this, 'main_page' ), APSS_IMAGE_DIR . '/apss-icon.png' );
|
195 |
+
add_submenu_page( 'apss-share', __( 'Social Icons Settings', APSS_TEXT_DOMAIN ), __( 'Social Icons Settings', APSS_TEXT_DOMAIN ), 'manage_options', 'apss-share', array( $this, 'main_page' ) );
|
196 |
+
}
|
197 |
+
|
198 |
+
//for saving the plugin settings
|
199 |
+
function apss_save_options(){
|
200 |
+
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') ){
|
201 |
+
include( 'inc/backend/save-settings.php' );
|
202 |
+
}
|
203 |
+
else
|
204 |
+
{
|
205 |
+
die('No script kiddies please!');
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
//function to restore the default setting of a plugin
|
210 |
+
function apss_restore_default_settings(){
|
211 |
+
$nonce = $_REQUEST['_wpnonce'];
|
212 |
+
if(!empty($_GET) && wp_verify_nonce( $nonce, 'apss-restore-default-settings-nonce' ) )
|
213 |
+
{
|
214 |
+
//restore the default plugin activation settings from the activation page.
|
215 |
+
include( 'inc/backend/activation.php' );
|
216 |
+
$_SESSION['apss_message'] = __( 'Settings restored Successfully.', APSS_TEXT_DOMAIN );
|
217 |
+
wp_redirect( admin_url().'admin.php?page=apss-share' );
|
218 |
+
exit;
|
219 |
+
}else{
|
220 |
+
die( 'No script kiddies please!' );
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Clears the social share counter cache
|
226 |
+
*/
|
227 |
+
function apss_clear_cache() {
|
228 |
+
if (!empty($_GET) && wp_verify_nonce($_GET['_wpnonce'], 'apss-clear-cache-nonce')) {
|
229 |
+
$apss_settings = $this->apss_settings;
|
230 |
+
$apss_social_counts_transients = get_option(APSS_COUNT_TRANSIENTS);
|
231 |
+
foreach ($apss_social_counts_transients as $transient) {
|
232 |
+
delete_transient($transient);
|
233 |
+
}
|
234 |
+
update_option( APSS_COUNT_TRANSIENTS, array() );
|
235 |
+
$transient_array = array('apss_tweets_count', 'apss_linkedin_count', 'apss_fb_count', 'apss_pin_count', 'apss_google_plus_count', 'apss_stumble_count', 'apss_delicious_count', 'apss_reddit_count');
|
236 |
+
foreach ($transient_array as $transient) {
|
237 |
+
delete_transient($transient);
|
238 |
+
}
|
239 |
+
$_SESSION['apss_message'] = __( 'Cache cleared Successfully', APSS_TEXT_DOMAIN );
|
240 |
+
wp_redirect( admin_url() . 'admin.php?page=apss-share' );
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
//function for adding shortcode of a plugin
|
245 |
+
function apss_shortcode($attr) {
|
246 |
+
ob_start();
|
247 |
+
include('inc/frontend/shortcode.php');
|
248 |
+
$html = ob_get_contents();
|
249 |
+
ob_get_clean();
|
250 |
+
return $html;
|
251 |
+
}
|
252 |
+
|
253 |
+
//frontend counter
|
254 |
+
function frontend_counter() {
|
255 |
+
if (!empty($_GET) && wp_verify_nonce( $_GET['_wpnonce'], 'apss-ajax-nonce' ) ) {
|
256 |
+
$apss_settings = $this->apss_settings;
|
257 |
+
$new_detail_array = array();
|
258 |
+
if (isset($_POST['data'])) {
|
259 |
+
$details = $_POST['data'];
|
260 |
+
foreach ($details as $detail) {
|
261 |
+
$new_detail_array[$detail['network']] = $this->get_count($detail['network'], $detail['url']);
|
262 |
+
}
|
263 |
+
} else {
|
264 |
+
$shortcode_data = $_POST['shortcode_data'];
|
265 |
+
foreach ($shortcode_data as $detail) {
|
266 |
+
$detail_array = explode('_', $detail);
|
267 |
+
$url = trim($detail_array[0]);
|
268 |
+
$network = $detail_array[1];
|
269 |
+
$new_detail_array[] = $this->get_count($network, $url);
|
270 |
+
}
|
271 |
+
}
|
272 |
+
die( json_encode( $new_detail_array ) );
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
//plugins backend admin page
|
277 |
+
function main_page() {
|
278 |
+
include('inc/backend/main-page.php');
|
279 |
+
}
|
280 |
+
|
281 |
+
//returns the current page url
|
282 |
+
function curPageURL() {
|
283 |
+
$pageURL = 'http';
|
284 |
+
if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) {
|
285 |
+
$pageURL .= "s";
|
286 |
+
}
|
287 |
+
$pageURL .= "://";
|
288 |
+
if ( $_SERVER["SERVER_PORT"] != "80" ) {
|
289 |
+
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
290 |
+
} else {
|
291 |
+
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
292 |
+
}
|
293 |
+
return $pageURL;
|
294 |
+
}
|
295 |
+
|
296 |
/**
|
297 |
* Funciton to print array in pre format
|
298 |
* */
|
303 |
echo "</pre>";
|
304 |
}
|
305 |
|
306 |
+
////////////////////////////////////for count //////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
//for facebook url share count
|
308 |
function get_fb($url) {
|
309 |
$apss_settings = $this->apss_settings;
|
435 |
return $linkedin_count;
|
436 |
}
|
437 |
|
438 |
+
//function to return json values from social media urls
|
439 |
+
private function get_json_values( $url ){
|
|
|
440 |
$apss_settings = $this->apss_settings;
|
441 |
$cache_period = $apss_settings['cache_period']*60*60;
|
442 |
$args = array( 'timeout' => 10 );
|
444 |
$json_response = wp_remote_retrieve_body( $response );
|
445 |
return $json_response;
|
446 |
}
|
447 |
+
////////////////////////////////////for count ends here/////////////////////////////////////////////
|
448 |
|
449 |
+
function get_count($profile_name, $url) {
|
|
|
450 |
switch ($profile_name) {
|
451 |
case 'facebook':
|
452 |
$count = $this->get_fb($url);
|
475 |
return $count;
|
476 |
}
|
477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
}//APSS_Class termination
|
479 |
|
480 |
$apss_object = new APSS_Class();
|
|
|
481 |
}
|
css/frontend.css
CHANGED
@@ -983,6 +983,14 @@ a:hover, a:focus {
|
|
983 |
display:none;
|
984 |
}
|
985 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
986 |
|
987 |
/************************************************responsive*************************************************************/
|
988 |
|
@@ -1005,3 +1013,5 @@ a:hover, a:focus {
|
|
1005 |
|
1006 |
}
|
1007 |
|
|
|
|
983 |
display:none;
|
984 |
}
|
985 |
|
986 |
+
.apss-share-text{
|
987 |
+
opacity: 0.4;
|
988 |
+
line-height: 16px;
|
989 |
+
color: #333;
|
990 |
+
font-size: 14px;
|
991 |
+
font-family: 'Open Sans', sans-serif;
|
992 |
+
}
|
993 |
+
|
994 |
|
995 |
/************************************************responsive*************************************************************/
|
996 |
|
1013 |
|
1014 |
}
|
1015 |
|
1016 |
+
|
1017 |
+
|
inc/backend/activation.php
CHANGED
@@ -15,6 +15,7 @@ $social_networks=array('facebook'=>'1',
|
|
15 |
'print'=>'0',
|
16 |
);
|
17 |
$apss_share_settings['social_networks']=$social_networks;
|
|
|
18 |
$apss_share_settings['twitter_username'] = '';
|
19 |
$apss_share_settings['counter_enable_options']='0';
|
20 |
$apss_share_settings['cache_period']='24';
|
15 |
'print'=>'0',
|
16 |
);
|
17 |
$apss_share_settings['social_networks']=$social_networks;
|
18 |
+
$apss_share_settings['share_text'] = '';
|
19 |
$apss_share_settings['twitter_username'] = '';
|
20 |
$apss_share_settings['counter_enable_options']='0';
|
21 |
$apss_share_settings['cache_period']='24';
|
inc/backend/main-page.php
CHANGED
@@ -118,6 +118,14 @@ if(isset($_SESSION['apss_message'])){ ?>
|
|
118 |
<div class="apss-tab-contents apss-miscellaneous" id="tab-apss-miscellaneous" style='display:none'>
|
119 |
<h2><?php _e( 'Miscellaneous settings: ', APSS_TEXT_DOMAIN ); ?> </h2>
|
120 |
<h4><?php _e('Please setup these additional settings:', APSS_TEXT_DOMAIN ); ?></h4>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
<div class="apss-twitter-settings">
|
122 |
<?php _e( 'Twitter username:', APSS_TEXT_DOMAIN ); ?> <input type="text" name="apss_share_settings[twitter_username]" value="<?php echo $options['twitter_username']; ?>" />
|
123 |
</div>
|
118 |
<div class="apss-tab-contents apss-miscellaneous" id="tab-apss-miscellaneous" style='display:none'>
|
119 |
<h2><?php _e( 'Miscellaneous settings: ', APSS_TEXT_DOMAIN ); ?> </h2>
|
120 |
<h4><?php _e('Please setup these additional settings:', APSS_TEXT_DOMAIN ); ?></h4>
|
121 |
+
|
122 |
+
<div class="apss-share-text-settings">
|
123 |
+
<?php _e( 'Share text:', APSS_TEXT_DOMAIN ); ?> <input type="text" name="apss_share_settings[share_text]" value="<?php if(isset($options['share_text'])){echo $options['share_text']; } ?>" />
|
124 |
+
<div class="apss_notes_cache_settings">
|
125 |
+
<?php _e( 'Please enter the share text to make it appear above social share icons. Leave blank if you dont want to use share text.', APSS_TEXT_DOMAIN ); ?>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
<br />
|
129 |
<div class="apss-twitter-settings">
|
130 |
<?php _e( 'Twitter username:', APSS_TEXT_DOMAIN ); ?> <input type="text" name="apss_share_settings[twitter_username]" value="<?php echo $options['twitter_username']; ?>" />
|
131 |
</div>
|
inc/backend/save-settings.php
CHANGED
@@ -19,6 +19,7 @@
|
|
19 |
}
|
20 |
|
21 |
$apss_share_settings['social_networks']=$social_network_array;
|
|
|
22 |
$apss_share_settings['twitter_username'] = stripslashes_deep($_POST['apss_share_settings']['twitter_username']);
|
23 |
$apss_share_settings['counter_enable_options'] = $_POST['apss_share_settings']['counter_enable_options'];
|
24 |
$apss_share_settings['cache_period']= is_numeric($_POST['apss_share_settings']['cache_settings']) ? $_POST['apss_share_settings']['cache_settings'] : '24' ;
|
19 |
}
|
20 |
|
21 |
$apss_share_settings['social_networks']=$social_network_array;
|
22 |
+
$apss_share_settings['share_text'] = $_POST['apss_share_settings']['share_text'];
|
23 |
$apss_share_settings['twitter_username'] = stripslashes_deep($_POST['apss_share_settings']['twitter_username']);
|
24 |
$apss_share_settings['counter_enable_options'] = $_POST['apss_share_settings']['counter_enable_options'];
|
25 |
$apss_share_settings['cache_period']= is_numeric($_POST['apss_share_settings']['cache_settings']) ? $_POST['apss_share_settings']['cache_settings'] : '24' ;
|
inc/frontend/content-filter.php
CHANGED
@@ -5,6 +5,11 @@ $counter_enable_options=$options['counter_enable_options'];
|
|
5 |
$icon_set_value=$options['social_icon_set'];
|
6 |
$url = get_permalink(); //$this->curPageURL();
|
7 |
$cache_period = ($options['cache_period'] != '') ? $options['cache_period']*60*60 : 24 * 60 * 60 ;
|
|
|
|
|
|
|
|
|
|
|
8 |
foreach( $options['social_networks'] as $key=>$value ){
|
9 |
if( intval($value)=='1' ){
|
10 |
switch( $key ){
|
5 |
$icon_set_value=$options['social_icon_set'];
|
6 |
$url = get_permalink(); //$this->curPageURL();
|
7 |
$cache_period = ($options['cache_period'] != '') ? $options['cache_period']*60*60 : 24 * 60 * 60 ;
|
8 |
+
?>
|
9 |
+
<?php if( isset( $options['share_text'] ) && $options['share_text'] !='' ){ ?>
|
10 |
+
<div class='apss-share-text'><?php echo $options['share_text']; ?></div>
|
11 |
+
<?php
|
12 |
+
}
|
13 |
foreach( $options['social_networks'] as $key=>$value ){
|
14 |
if( intval($value)=='1' ){
|
15 |
switch( $key ){
|
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.1
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -131,6 +131,10 @@ Yes. You can use the AccessPress social share by using shortcode anywhere you wa
|
|
131 |
6. Backend Miscellaneous Settings Section
|
132 |
|
133 |
== Changelog ==
|
|
|
|
|
|
|
|
|
134 |
= 1.1.1 =
|
135 |
* excerpt filter removal.
|
136 |
* Code sanitization for backend options.
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.1.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
131 |
6. Backend Miscellaneous Settings Section
|
132 |
|
133 |
== Changelog ==
|
134 |
+
= 1.1.2 =
|
135 |
+
* Addition of the share text options in backend.
|
136 |
+
* Done the css modification for frontend share text display.
|
137 |
+
|
138 |
= 1.1.1 =
|
139 |
* excerpt filter removal.
|
140 |
* Code sanitization for backend options.
|