Skip to content

Instantly share code, notes, and snippets.

View appscreo's full-sized avatar

AppsCreo appscreo

View GitHub Profile
@appscreo
appscreo / gist:4a5cec20fb81881fdc16659b5bdda13d
Created June 5, 2019 19:21
Update Facebook Counter for ESSB version 4.x
/**
* Patch the old version of Easy Social Share Buttons for WordPress https://socialsharingplugin.com to
* read updated Facebook API for getting share counters
*
* The code snippet is made for version 4.x only
* @author AppsCreo
*/
public static function get_facebook_count($url) {
$api3 = true;
@appscreo
appscreo / essb-metadetails.php
Created July 27, 2017 18:36
Location: easy-social-share-buttons3/lib/modules/social-share-optimization/
<?php
/**
* @package EasySocialShareButtons\SocialShareOptimization
* @author appscreo
* @since 4.2
* @version 4.0
*
* Generate and store require from social share optimization tags post details: title,
* description and image
*/
@font-face {
font-family: "essb";
src: url("../fonts/essb.eot");
src: url("../fonts/essb.eot?#iefix") format("embedded-opentype"),
url("../fonts/essb.woff") format("woff"), url("../fonts/essb.ttf")
format("truetype"), url("../fonts/essb.svg#essb") format("svg");
font-weight: normal;
font-style: normal;
}
@appscreo
appscreo / essb-custom-subscription-module.php
Created July 26, 2017 05:13
How to register a custom subscription module in Easy Social Share Buttons for WordPress - example
<?php
/*
* Plugin Name: Easy Social Share Buttons for WordPress Subscribe Connector - JetPack Subscriptions
* Description: Activate usage of JetPack Subscriptions in Opt-in Module
* Plugin URI: http://codecanyon.net/item/easy-social-share-buttons-for-wordpress/6394476?ref=appscreo
* Version: 1.0
* Author: CreoApps
* Author URI: http://codecanyon.net/user/appscreo/portfolio?ref=appscreo
*/
@appscreo
appscreo / easy-social-image-share.min.js
Last active July 25, 2017 18:33
Modified version of On Media Sharing to take custom share details. Files should be placed in the following folders to replace originals: easy-social-share-buttons.min.js inside folder easy-social-share-buttons3/lib/modules/social-image-share/assets/js/ and file easy-social-image-share.php inside folder easy-social-share-buttons3/lib/modules/soci…
!function(t){function e(){this.$element=null}String.format||(String.format=function(t){var e=Array.prototype.slice.call(arguments,1);return t.replace(/{(\d+)}/g,function(t,n){return"undefined"!=typeof e[n]?e[n]:t})});var n={transferDataAttributes:function(t,e){var n=t.data();for(var i in n)n.hasOwnProperty(i)&&e.attr("data-"+i,n[i])}};e.prototype.addAttr=function(t,e){this.$element.attr(t,e)},e.prototype.addClass=function(t){this.$element.addClass(t)},window.essbis=function(){function i(n,i,o){e.call(this),this.width=n,this.height=i,this.$element=t("<a/>"),this.addAttr(a.attr.type,o),this.addAttr("href","#"),this.$iconElement=t("<div/>").addClass(a.cssClass.iconPrefix+o),this.$iconElement.html(t("<div/>").addClass(a.cssClass.prefix+"inner"))}function o(e){switch(this.icons=[],this.width=0,this.height=0,this.$element=t("<div/>"),e){case"vertical":this.updateContainerSize=this.updateSizeVertical;break;case"horizontal":this.updateContainerSize=this.updateSizeHorizontal}this.addClass(a.cssClass.container)}functio
@appscreo
appscreo / essb-facebook-past-counter.php
Created April 25, 2017 14:41
How to add custom past share counter to Facebook using cached counters API
if (!function_exists('essb_cache_counters_parse')) {
function essb_cache_counters_parse($cached_counters = array()) {
global $post;
if (!isset($post)) return $cached_counters;
$post_id = $post->ID;
$cumulative_total = 0;
foreach ($cached_counters as $network => $shares) {
@appscreo
appscreo / essb-replace-comments-count.php
Created March 16, 2017 19:29
How to replace the default comments counter with Facebook comments counter in Easy Social Share Buttons for WordPress (requires version 4.1 or newer). Code can be added anywhere
function essb_counter_request_external( $encUrl ) {
$counter_curl_fix = essb_option_value('counter_curl_fix');
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
//CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'essb', // who am i
@appscreo
appscreo / custom-share-button.php
Last active May 6, 2017 15:55
How to add own buttons inside Easy Social Share Buttons
// Register of the custom buttom
add_filter('essb4_social_networks', 'register_my_network');
function register_my_network($networks) {
$networks['mynetwork'] = array( 'name' => 'My Custom Network', 'type' => 'buildin', 'supports' => 'desktop,mobile,retina templates only');
// Here you can include multiple unique social network buttons (or custom buttons).
return $networks;
}
// Each button support 2 filters for URL and custom command. The custom command filter you need to use only if you wish to overwrite
@appscreo
appscreo / essb-custom-share-counters.php
Created February 22, 2017 13:44
How to setup custom share counters with Easy Social Share Buttons using functions.php of theme
if (!function_exists('essb_cache_counters_parse')) {
function essb_cache_counters_parse($cached_counters = array()) {
global $post;
if (!isset($post)) return $cached_counters;
$post_id = $post->ID;
$cumulative_total = 0;
foreach ($cached_counters as $network => $shares) {