Version Description
- Several bug fixes, in addition to -
- Huge update! The plugin has been completely re-written from the ground up to be faster, simpler to use
- Choose from snazzy new Related Post themes
- Related Posts now come mobile optimized and responsive out of the box - Shareaholic automagically determines how many Related Posts to show given how much screen width it is given
- Customize your "You may also like" Related Posts text
- Option to exclude any URL from Related Posts
- Choose from new Share button themes! (including vertical share buttons!)
- Additional URL shortener options
- "Pages" now also have options to exclude Share Buttons, Recommendations
- Addition of new shareaholic:language tag to improve related content and recommendations computation
- Bugfix: Facebook Debugger will no longer show "Parser Mismatched Metadata" warnings
- Bugfix: Page titles are now properly encoded
- More robust curl function, more robust plugin
Download this release
Release Info
Developer | shareaholic |
Plugin | WordPress Social Tools, Related Posts, Monetization – Shareaholic |
Version | 7.0.0.7 |
Comparing to | |
See all releases |
Code changes from version 7.0.0.6 to 7.0.0.7
- admin.php +20 -7
- curl.php +16 -3
- deprecation.php +8 -1
- global_functions.php +15 -1
- notifier.php +40 -8
- public.php +5 -1
- query_string_builder.php +23 -1
- readme.txt +3 -2
- shareaholic.php +15 -4
- six_to_seven.php +25 -14
- utilities.php +49 -24
admin.php
CHANGED
@@ -1,11 +1,20 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package shareaholic
|
4 |
*/
|
|
|
5 |
/**
|
6 |
* This class takes care of all of the admin interface.
|
|
|
|
|
7 |
*/
|
8 |
class ShareaholicAdmin {
|
|
|
|
|
|
|
|
|
9 |
public static function show_terms_of_service() {
|
10 |
ShareaholicUtilities::load_template('terms_of_service_notice');
|
11 |
}
|
@@ -19,11 +28,11 @@ class ShareaholicAdmin {
|
|
19 |
|
20 |
/**
|
21 |
* Renders SnapEngage
|
22 |
-
*/
|
23 |
public static function include_snapengage() {
|
24 |
ShareaholicUtilities::load_template('script_snapengage');
|
25 |
}
|
26 |
-
|
27 |
/**
|
28 |
* Adds meta boxes for post and page options
|
29 |
*/
|
@@ -260,18 +269,18 @@ class ShareaholicAdmin {
|
|
260 |
if (isset($_POST['shareaholic']['api_key']) && $_POST['shareaholic']['api_key'] != $api_key) {
|
261 |
ShareaholicUtilities::get_new_location_name_ids($_POST['shareaholic']['api_key']);
|
262 |
}
|
263 |
-
|
264 |
if (isset($_POST['shareaholic']['api_key'])) {
|
265 |
ShareaholicUtilities::update_options(array('api_key' => $_POST['shareaholic']['api_key']));
|
266 |
}
|
267 |
-
|
268 |
if (isset($_POST['shareaholic']['disable_tracking'])) {
|
269 |
ShareaholicUtilities::update_options(array('disable_tracking' => $_POST['shareaholic']['disable_tracking']));
|
270 |
}
|
271 |
-
|
272 |
if (isset($_POST['shareaholic']['disable_og_tags'])) {
|
273 |
ShareaholicUtilities::update_options(array('disable_og_tags' => $_POST['shareaholic']['disable_og_tags']));
|
274 |
-
}
|
275 |
}
|
276 |
|
277 |
ShareaholicUtilities::load_template('advanced_settings', array(
|
@@ -280,6 +289,10 @@ class ShareaholicAdmin {
|
|
280 |
));
|
281 |
}
|
282 |
|
|
|
|
|
|
|
|
|
283 |
private static function draw_deprecation_warnings() {
|
284 |
$deprecations = ShareaholicDeprecation::all();
|
285 |
if (!empty($deprecations)) {
|
@@ -329,4 +342,4 @@ class ShareaholicAdmin {
|
|
329 |
}
|
330 |
}
|
331 |
}
|
332 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* This file holds the ShareaholicAdmin class.
|
4 |
+
*
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
+
|
8 |
/**
|
9 |
* This class takes care of all of the admin interface.
|
10 |
+
*
|
11 |
+
* @package shareaholic
|
12 |
*/
|
13 |
class ShareaholicAdmin {
|
14 |
+
/**
|
15 |
+
* Load the terms of service notice that shows up
|
16 |
+
* at the top of the admin pages.
|
17 |
+
*/
|
18 |
public static function show_terms_of_service() {
|
19 |
ShareaholicUtilities::load_template('terms_of_service_notice');
|
20 |
}
|
28 |
|
29 |
/**
|
30 |
* Renders SnapEngage
|
31 |
+
*/
|
32 |
public static function include_snapengage() {
|
33 |
ShareaholicUtilities::load_template('script_snapengage');
|
34 |
}
|
35 |
+
|
36 |
/**
|
37 |
* Adds meta boxes for post and page options
|
38 |
*/
|
269 |
if (isset($_POST['shareaholic']['api_key']) && $_POST['shareaholic']['api_key'] != $api_key) {
|
270 |
ShareaholicUtilities::get_new_location_name_ids($_POST['shareaholic']['api_key']);
|
271 |
}
|
272 |
+
|
273 |
if (isset($_POST['shareaholic']['api_key'])) {
|
274 |
ShareaholicUtilities::update_options(array('api_key' => $_POST['shareaholic']['api_key']));
|
275 |
}
|
276 |
+
|
277 |
if (isset($_POST['shareaholic']['disable_tracking'])) {
|
278 |
ShareaholicUtilities::update_options(array('disable_tracking' => $_POST['shareaholic']['disable_tracking']));
|
279 |
}
|
280 |
+
|
281 |
if (isset($_POST['shareaholic']['disable_og_tags'])) {
|
282 |
ShareaholicUtilities::update_options(array('disable_og_tags' => $_POST['shareaholic']['disable_og_tags']));
|
283 |
+
}
|
284 |
}
|
285 |
|
286 |
ShareaholicUtilities::load_template('advanced_settings', array(
|
289 |
));
|
290 |
}
|
291 |
|
292 |
+
/**
|
293 |
+
* Checks for any deprecations and then shows them
|
294 |
+
* to the end user.
|
295 |
+
*/
|
296 |
private static function draw_deprecation_warnings() {
|
297 |
$deprecations = ShareaholicDeprecation::all();
|
298 |
if (!empty($deprecations)) {
|
342 |
}
|
343 |
}
|
344 |
}
|
345 |
+
?>
|
curl.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package shareaholic
|
4 |
*/
|
5 |
|
@@ -8,6 +10,8 @@ require_once(SHAREAHOLIC_DIR . '/query_string_builder.php');
|
|
8 |
/**
|
9 |
* This class is a library to easily interface with PHP's native
|
10 |
* cURL library. It exposes two methods `get` and `post`.
|
|
|
|
|
11 |
*/
|
12 |
class ShareaholicCurl {
|
13 |
/**
|
@@ -30,6 +34,7 @@ class ShareaholicCurl {
|
|
30 |
*
|
31 |
* @param string $url the url you are GETing to
|
32 |
* @param array $data an associative array of the data you are posting
|
|
|
33 |
*
|
34 |
* @return array the returned data json decoded
|
35 |
*/
|
@@ -71,9 +76,17 @@ class ShareaholicCurl {
|
|
71 |
$response = wp_remote_post($url, $request);
|
72 |
}
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
+
* This file holds the ShareaholicCurl class.
|
4 |
+
*
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
|
10 |
/**
|
11 |
* This class is a library to easily interface with PHP's native
|
12 |
* cURL library. It exposes two methods `get` and `post`.
|
13 |
+
*
|
14 |
+
* @package shareaholic
|
15 |
*/
|
16 |
class ShareaholicCurl {
|
17 |
/**
|
34 |
*
|
35 |
* @param string $url the url you are GETing to
|
36 |
* @param array $data an associative array of the data you are posting
|
37 |
+
* @param string $data_type defaults to nothing, you can pass in 'json'
|
38 |
*
|
39 |
* @return array the returned data json decoded
|
40 |
*/
|
76 |
$response = wp_remote_post($url, $request);
|
77 |
}
|
78 |
|
79 |
+
if( is_wp_error( $response ) ) {
|
80 |
+
$error_message = $response->get_error_message();
|
81 |
+
ShareaholicUtilities::log($error_message);
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
else {
|
85 |
+
$body = $response['body'];
|
86 |
+
$response['body'] = ShareaholicUtilities::object_to_array(json_decode($body)) ?
|
87 |
+
ShareaholicUtilities::object_to_array(json_decode($body)) : $body;
|
88 |
+
return $response;
|
89 |
+
}
|
90 |
}
|
91 |
|
92 |
/**
|
deprecation.php
CHANGED
@@ -8,8 +8,15 @@
|
|
8 |
/**
|
9 |
* This class keeps track of various deprecations and what files
|
10 |
* and line numbers they occur on.
|
|
|
|
|
11 |
*/
|
12 |
class ShareaholicDeprecation {
|
|
|
|
|
|
|
|
|
|
|
13 |
public function __construct($function) {
|
14 |
$this->function = $function;
|
15 |
$deprecations = get_option('shareaholic_deprecations');
|
@@ -68,4 +75,4 @@ class ShareaholicDeprecation {
|
|
68 |
}
|
69 |
|
70 |
|
71 |
-
?>
|
8 |
/**
|
9 |
* This class keeps track of various deprecations and what files
|
10 |
* and line numbers they occur on.
|
11 |
+
*
|
12 |
+
* @package shareaholic
|
13 |
*/
|
14 |
class ShareaholicDeprecation {
|
15 |
+
/**
|
16 |
+
* Constructor for the `ShareaholicDeprecation` class.
|
17 |
+
*
|
18 |
+
* @param string $function the name of a function.
|
19 |
+
*/
|
20 |
public function __construct($function) {
|
21 |
$this->function = $function;
|
22 |
$deprecations = get_option('shareaholic_deprecations');
|
75 |
}
|
76 |
|
77 |
|
78 |
+
?>
|
global_functions.php
CHANGED
@@ -5,6 +5,13 @@
|
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
function selfserv_shareaholic() {
|
9 |
$trace = debug_backtrace();
|
10 |
$deprecation = new ShareaholicDeprecation('selfserv_shareaholic');
|
@@ -12,6 +19,13 @@ function selfserv_shareaholic() {
|
|
12 |
echo ShareaholicPublic::canvas(NULL, 'share_buttons');
|
13 |
}
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
function get_shr_like_buttonset($position) {
|
16 |
$trace = debug_backtrace();
|
17 |
$deprecation = new ShareaholicDeprecation('get_shr_like_buttonset');
|
@@ -34,4 +48,4 @@ function get_shr_like_buttonset($position) {
|
|
34 |
echo ShareaholicPublic::canvas($id, 'share_buttons');
|
35 |
}
|
36 |
|
37 |
-
?>
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
|
8 |
+
/**
|
9 |
+
* The old 'shortcode' function, which wasn't a real
|
10 |
+
* WordPress shortcode. This is currently deprecated so it
|
11 |
+
* logs that fact.
|
12 |
+
*
|
13 |
+
* @deprecated beginning with the release of 7.0.0.0
|
14 |
+
*/
|
15 |
function selfserv_shareaholic() {
|
16 |
$trace = debug_backtrace();
|
17 |
$deprecation = new ShareaholicDeprecation('selfserv_shareaholic');
|
19 |
echo ShareaholicPublic::canvas(NULL, 'share_buttons');
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* Another old 'shortcode' function. Because this accepts a position
|
24 |
+
* (either 'Top' or 'Bottom') it requres a little more finessing in
|
25 |
+
* its implementation.
|
26 |
+
*
|
27 |
+
* @param string $position either 'Top' or 'Bottom'
|
28 |
+
*/
|
29 |
function get_shr_like_buttonset($position) {
|
30 |
$trace = debug_backtrace();
|
31 |
$deprecation = new ShareaholicDeprecation('get_shr_like_buttonset');
|
48 |
echo ShareaholicPublic::canvas($id, 'share_buttons');
|
49 |
}
|
50 |
|
51 |
+
?>
|
notifier.php
CHANGED
@@ -1,10 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package shareaholic
|
4 |
*/
|
5 |
|
6 |
/**
|
7 |
* An interface to the publisher notification API
|
|
|
|
|
8 |
*/
|
9 |
class ShareaholicNotifier {
|
10 |
/**
|
@@ -20,6 +24,7 @@ class ShareaholicNotifier {
|
|
20 |
* @return bool whether the request worked
|
21 |
*/
|
22 |
public static function post_notify($post_id) {
|
|
|
23 |
$post = get_post($post_id);
|
24 |
$url = get_permalink($post_id);
|
25 |
$tags = wp_get_post_tags($post_id, array('fields' => 'name'));
|
@@ -35,27 +40,54 @@ class ShareaholicNotifier {
|
|
35 |
}
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
$notification = array(
|
39 |
'url' => $url,
|
|
|
40 |
'content' => array(
|
41 |
'title' => $post->post_title,
|
42 |
'excerpt' => $post->post_excerpt,
|
43 |
'body' => $post->post_content,
|
44 |
-
'featured-image-url' => $featured_image
|
45 |
),
|
46 |
'metadata' => array(
|
47 |
-
'author' => $post->post_author,
|
|
|
48 |
'post-type' => $post->post_type,
|
49 |
'post-id' => $post_id,
|
50 |
'post-tags' => $tags,
|
51 |
'post-categories' => $categories,
|
52 |
-
'
|
53 |
-
'
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
return self::send_notification($notification);
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
private static function post_notify_iterator($category) {
|
60 |
return $category->name;
|
61 |
}
|
@@ -70,7 +102,7 @@ class ShareaholicNotifier {
|
|
70 |
$url = self::URL . '/notify';
|
71 |
$response = ShareaholicCurl::post($url, $notification, 'json');
|
72 |
|
73 |
-
if ($response && $response['result'] == 'success') {
|
74 |
return true;
|
75 |
} else {
|
76 |
return false;
|
@@ -78,4 +110,4 @@ class ShareaholicNotifier {
|
|
78 |
}
|
79 |
}
|
80 |
|
81 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* File for the ShareaholicNotifier class.
|
4 |
+
*
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* An interface to the publisher notification API
|
10 |
+
*
|
11 |
+
* @package shareaholic
|
12 |
*/
|
13 |
class ShareaholicNotifier {
|
14 |
/**
|
24 |
* @return bool whether the request worked
|
25 |
*/
|
26 |
public static function post_notify($post_id) {
|
27 |
+
global $wpdb;
|
28 |
$post = get_post($post_id);
|
29 |
$url = get_permalink($post_id);
|
30 |
$tags = wp_get_post_tags($post_id, array('fields' => 'name'));
|
40 |
}
|
41 |
}
|
42 |
|
43 |
+
if ($post->post_author) {
|
44 |
+
$author_data = get_userdata($post->post_author);
|
45 |
+
$author_name = $author_data->display_name;
|
46 |
+
}
|
47 |
+
|
48 |
$notification = array(
|
49 |
'url' => $url,
|
50 |
+
'api_key' => ShareaholicUtilities::get_option('api_key'),
|
51 |
'content' => array(
|
52 |
'title' => $post->post_title,
|
53 |
'excerpt' => $post->post_excerpt,
|
54 |
'body' => $post->post_content,
|
55 |
+
'featured-image-url' => $featured_image,
|
56 |
),
|
57 |
'metadata' => array(
|
58 |
+
'author-id' => $post->post_author,
|
59 |
+
'author-name' => $author_name,
|
60 |
'post-type' => $post->post_type,
|
61 |
'post-id' => $post_id,
|
62 |
'post-tags' => $tags,
|
63 |
'post-categories' => $categories,
|
64 |
+
'post-language' => get_bloginfo('language'),
|
65 |
+
'published' => $post->post_date_gmt,
|
66 |
+
'updated' => get_lastpostmodified('GMT'),
|
67 |
+
'visibility' => $post->post_status,
|
68 |
+
),
|
69 |
+
'diagnostics' => array(
|
70 |
+
'platform' => 'wordpress',
|
71 |
+
'platform-version' => get_bloginfo('version'),
|
72 |
+
'shareaholic-version' => Shareaholic::VERSION,
|
73 |
+
'wp-multisite' => is_multisite(),
|
74 |
+
'wp-theme' => get_option('template'),
|
75 |
+
'wp-posts-total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'post' AND post_status = 'publish'" ),
|
76 |
+
'wp-pages-total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'page' AND post_status = 'publish'" ),
|
77 |
+
'wp-comments-total' => wp_count_comments()->approved,
|
78 |
+
'wp-users-total' => $wpdb->get_var("SELECT count(ID) FROM $wpdb->users"),
|
79 |
+
));
|
80 |
+
|
81 |
return self::send_notification($notification);
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* Because PHP < 5.3 doesn't allow anonymous functions, this
|
86 |
+
* is the mapping function used in the method above.
|
87 |
+
*
|
88 |
+
* @param Category $category
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
private static function post_notify_iterator($category) {
|
92 |
return $category->name;
|
93 |
}
|
102 |
$url = self::URL . '/notify';
|
103 |
$response = ShareaholicCurl::post($url, $notification, 'json');
|
104 |
|
105 |
+
if ($response && $response['body']['result'] == 'success') {
|
106 |
return true;
|
107 |
} else {
|
108 |
return false;
|
110 |
}
|
111 |
}
|
112 |
|
113 |
+
?>
|
public.php
CHANGED
@@ -1,11 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package shareaholic
|
4 |
*/
|
5 |
|
6 |
/**
|
7 |
* This class is all about drawing the stuff in publishers'
|
8 |
* templates that visitors can see.
|
|
|
|
|
9 |
*/
|
10 |
class ShareaholicPublic {
|
11 |
/**
|
@@ -211,4 +215,4 @@ class ShareaholicPublic {
|
|
211 |
}
|
212 |
}
|
213 |
|
214 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Holds the ShareaholicPublic class.
|
4 |
+
*
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* This class is all about drawing the stuff in publishers'
|
10 |
* templates that visitors can see.
|
11 |
+
*
|
12 |
+
* @package shareaholic
|
13 |
*/
|
14 |
class ShareaholicPublic {
|
15 |
/**
|
215 |
}
|
216 |
}
|
217 |
|
218 |
+
?>
|
query_string_builder.php
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package shareaholic
|
4 |
*/
|
|
|
5 |
/**
|
6 |
* This class builds query strings, because PHP's built in
|
7 |
* version doesn't deal with non-associative arrays correctly.
|
|
|
|
|
8 |
*/
|
9 |
class ShareaholicQueryStringBuilder {
|
10 |
|
@@ -76,6 +81,15 @@ class ShareaholicQueryStringBuilder {
|
|
76 |
));
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
private static function assoc_array_to_param_iterator($value, $key, $namespace) {
|
80 |
$new_key = ($namespace ? "{$namespace}[$key]" : $key);
|
81 |
return ShareaholicQueryStringBuilder::to_param($value, $new_key);
|
@@ -105,6 +119,14 @@ class ShareaholicQueryStringBuilder {
|
|
105 |
return implode("&", array_map(array('self', 'array_to_param_iterator'), $array, $prefix_array));
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
private static function array_to_param_iterator($value, $prefix) {
|
109 |
return ShareaholicQueryStringBuilder::to_param($value, $prefix);
|
110 |
}
|
@@ -121,4 +143,4 @@ class ShareaholicQueryStringBuilder {
|
|
121 |
}
|
122 |
}
|
123 |
|
124 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Holds the ShareaholicQueryStringBuilder class.
|
4 |
+
*
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
+
|
8 |
/**
|
9 |
* This class builds query strings, because PHP's built in
|
10 |
* version doesn't deal with non-associative arrays correctly.
|
11 |
+
*
|
12 |
+
* @package shareaholic
|
13 |
*/
|
14 |
class ShareaholicQueryStringBuilder {
|
15 |
|
81 |
));
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* Because PHP < 5.3 doesn't support anonymous functions, this serves
|
86 |
+
* as the mapping function for the above method.
|
87 |
+
*
|
88 |
+
* @param mixed $value
|
89 |
+
* @param string $key
|
90 |
+
* @param string $namespace
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
private static function assoc_array_to_param_iterator($value, $key, $namespace) {
|
94 |
$new_key = ($namespace ? "{$namespace}[$key]" : $key);
|
95 |
return ShareaholicQueryStringBuilder::to_param($value, $new_key);
|
119 |
return implode("&", array_map(array('self', 'array_to_param_iterator'), $array, $prefix_array));
|
120 |
}
|
121 |
|
122 |
+
/**
|
123 |
+
* Because PHP < 5.3 doesn't support anonymous functions, this serves
|
124 |
+
* as the mapping function for the above method.
|
125 |
+
*
|
126 |
+
* @param mixed $value
|
127 |
+
* @param string $prefix
|
128 |
+
* @return string
|
129 |
+
*/
|
130 |
private static function array_to_param_iterator($value, $prefix) {
|
131 |
return ShareaholicQueryStringBuilder::to_param($value, $prefix);
|
132 |
}
|
143 |
}
|
144 |
}
|
145 |
|
146 |
+
?>
|
readme.txt
CHANGED
@@ -141,7 +141,7 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
-
= 7.0.0.
|
145 |
* Several bug fixes, in addition to -
|
146 |
* Huge update! The plugin has been completely re-written from the ground up to be faster, simpler to use
|
147 |
* Choose from snazzy new Related Post themes
|
@@ -154,6 +154,7 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
|
|
154 |
* Addition of new shareaholic:language tag to improve related content and recommendations computation
|
155 |
* Bugfix: Facebook Debugger will no longer show "Parser Mismatched Metadata" warnings
|
156 |
* Bugfix: Page titles are now properly encoded
|
|
|
157 |
|
158 |
= 6.1.3.8 =
|
159 |
* Bugfix: fixed "Cannot use object of type WP_Error"
|
@@ -874,7 +875,7 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
|
|
874 |
|
875 |
== Upgrade Notice ==
|
876 |
|
877 |
-
= 7.0.0.
|
878 |
* Huge update! Completely re-written from the ground up to be faster and with a new simple interface! Includes brand new Share button themes (including vertical share buttons!) and Related posts themes. Related Posts now come mobile optimized and responsive out of the box - Shareaholic automagically determines how many Related Posts to show given how much screen width it is given. You can now even customize your "You may also like" text and exclude URLs.
|
879 |
|
880 |
= 6.1.3.5 =
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
+
= 7.0.0.7 =
|
145 |
* Several bug fixes, in addition to -
|
146 |
* Huge update! The plugin has been completely re-written from the ground up to be faster, simpler to use
|
147 |
* Choose from snazzy new Related Post themes
|
154 |
* Addition of new shareaholic:language tag to improve related content and recommendations computation
|
155 |
* Bugfix: Facebook Debugger will no longer show "Parser Mismatched Metadata" warnings
|
156 |
* Bugfix: Page titles are now properly encoded
|
157 |
+
* More robust curl function, more robust plugin
|
158 |
|
159 |
= 6.1.3.8 =
|
160 |
* Bugfix: fixed "Cannot use object of type WP_Error"
|
875 |
|
876 |
== Upgrade Notice ==
|
877 |
|
878 |
+
= 7.0.0.7 =
|
879 |
* Huge update! Completely re-written from the ground up to be faster and with a new simple interface! Includes brand new Share button themes (including vertical share buttons!) and Related posts themes. Related Posts now come mobile optimized and responsive out of the box - Shareaholic automagically determines how many Related Posts to show given how much screen width it is given. You can now even customize your "You may also like" text and exclude URLs.
|
880 |
|
881 |
= 6.1.3.5 =
|
shareaholic.php
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package shareaholic
|
4 |
-
* @version 7
|
5 |
*/
|
6 |
|
7 |
/*
|
8 |
Plugin Name: Shareaholic | share buttons, analytics, related content
|
9 |
Plugin URI: https://shareaholic.com/publishers/
|
10 |
Description: Whether you want to get people sharing, grow your fans, make money, or know who's reading your content, Shareaholic will help you get it done. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
|
11 |
-
Version: 7.0.0.
|
12 |
Author: Shareaholic
|
13 |
Author URI: https://shareaholic.com
|
14 |
Credits & Thanks: https://shareaholic.com/tools/wordpress/credits
|
@@ -36,10 +38,16 @@ require_once(SHAREAHOLIC_DIR . '/deprecation.php');
|
|
36 |
|
37 |
/**
|
38 |
* The main / base class.
|
|
|
|
|
39 |
*/
|
40 |
class Shareaholic {
|
41 |
const URL = 'https://shareaholic.com';
|
42 |
-
const VERSION = '7.0.0.
|
|
|
|
|
|
|
|
|
43 |
private static $instance = false;
|
44 |
|
45 |
/**
|
@@ -64,7 +72,7 @@ class Shareaholic {
|
|
64 |
register_activation_hook(__FILE__, array($this, 'after_activation' ));
|
65 |
register_deactivation_hook( __FILE__, array($this, 'deactivate' ));
|
66 |
register_uninstall_hook(__FILE__, array('Shareaholic', 'uninstall' ));
|
67 |
-
|
68 |
add_filter( 'plugin_action_links_'.plugin_basename(__FILE__), 'ShareaholicUtilities::admin_plugin_action_links', -10);
|
69 |
}
|
70 |
|
@@ -114,6 +122,9 @@ class Shareaholic {
|
|
114 |
}
|
115 |
}
|
116 |
|
|
|
|
|
|
|
117 |
public function terms_of_service() {
|
118 |
if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
|
119 |
add_action('admin_notices', array('ShareaholicAdmin', 'show_terms_of_service'));
|
1 |
<?php
|
2 |
/**
|
3 |
+
* The main and first file!
|
4 |
+
*
|
5 |
* @package shareaholic
|
6 |
+
* @version 7.0.0.7
|
7 |
*/
|
8 |
|
9 |
/*
|
10 |
Plugin Name: Shareaholic | share buttons, analytics, related content
|
11 |
Plugin URI: https://shareaholic.com/publishers/
|
12 |
Description: Whether you want to get people sharing, grow your fans, make money, or know who's reading your content, Shareaholic will help you get it done. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
|
13 |
+
Version: 7.0.0.7
|
14 |
Author: Shareaholic
|
15 |
Author URI: https://shareaholic.com
|
16 |
Credits & Thanks: https://shareaholic.com/tools/wordpress/credits
|
38 |
|
39 |
/**
|
40 |
* The main / base class.
|
41 |
+
*
|
42 |
+
* @package shareaholic
|
43 |
*/
|
44 |
class Shareaholic {
|
45 |
const URL = 'https://shareaholic.com';
|
46 |
+
const VERSION = '7.0.0.7';
|
47 |
+
/**
|
48 |
+
* Starts off as false so that ::get_instance() returns
|
49 |
+
* a new instance.
|
50 |
+
*/
|
51 |
private static $instance = false;
|
52 |
|
53 |
/**
|
72 |
register_activation_hook(__FILE__, array($this, 'after_activation' ));
|
73 |
register_deactivation_hook( __FILE__, array($this, 'deactivate' ));
|
74 |
register_uninstall_hook(__FILE__, array('Shareaholic', 'uninstall' ));
|
75 |
+
|
76 |
add_filter( 'plugin_action_links_'.plugin_basename(__FILE__), 'ShareaholicUtilities::admin_plugin_action_links', -10);
|
77 |
}
|
78 |
|
122 |
}
|
123 |
}
|
124 |
|
125 |
+
/**
|
126 |
+
* Checks whether to ask the user to accept the terms of service or not.
|
127 |
+
*/
|
128 |
public function terms_of_service() {
|
129 |
if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
|
130 |
add_action('admin_notices', array('ShareaholicAdmin', 'show_terms_of_service'));
|
six_to_seven.php
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package shareaholic
|
4 |
*/
|
|
|
5 |
/**
|
6 |
* This class is in charge or extracting the old style of configuration
|
7 |
* from the wordpress database and turning it into a format that we
|
8 |
* can POST back to shareaholic.com to create a new publisher configuration.
|
|
|
|
|
9 |
*/
|
10 |
class ShareaholicSixToSeven {
|
11 |
/**
|
@@ -68,15 +73,8 @@ class ShareaholicSixToSeven {
|
|
68 |
self::transform_shortener_configuration($sexybookmarks_configuration) : array());
|
69 |
$new_configuration = array_merge($new_configuration, $shortener_configuration);
|
70 |
|
71 |
-
$
|
72 |
-
if (
|
73 |
-
ShareaholicUtilities::log_event('6To7ConversionFailed', array(
|
74 |
-
'the_posted_json' => $new_configuration,
|
75 |
-
'SexyBookmarks' => $sexybookmarks_configuration,
|
76 |
-
'ShareaholicClassicBookmarks' => $classicbookmarks_configuration,
|
77 |
-
'ShareaholicRecommendations' => $recommendations_configuration
|
78 |
-
));
|
79 |
-
} else {
|
80 |
ShareaholicUtilities::log_event('6To7ConversionSuccess', array(
|
81 |
'the_posted_json' => $new_configuration,
|
82 |
'the_created_api_key' => $result['api_key'],
|
@@ -86,15 +84,22 @@ class ShareaholicSixToSeven {
|
|
86 |
));
|
87 |
|
88 |
ShareaholicUtilities::update_options(array(
|
89 |
-
'api_key' => $
|
90 |
'version' => Shareaholic::VERSION,
|
91 |
'verification_key' => $verification_key,
|
92 |
-
'location_name_ids' =>
|
93 |
));
|
94 |
|
95 |
-
ShareaholicUtilities::turn_on_locations(
|
96 |
|
97 |
self::transform_wordpress_specific_settings();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
}
|
100 |
|
@@ -268,7 +273,6 @@ class ShareaholicSixToSeven {
|
|
268 |
* Returns a configuration if the user was using classicbookmarks.
|
269 |
*
|
270 |
* @param array $classicbookmarks_configuration
|
271 |
-
* @param array $share_buttons_configuration
|
272 |
* @return array
|
273 |
*/
|
274 |
private static function transform_classicbookmarks_locations($classicbookmarks_configuration) {
|
@@ -323,6 +327,13 @@ class ShareaholicSixToSeven {
|
|
323 |
return array_map(array('self', 'services_iterator'), $services);
|
324 |
}
|
325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
private static function services_iterator($value) {
|
327 |
if (preg_match('/googleplus/', $value)) {
|
328 |
// it's stored as googleplus in wordpress, but
|
@@ -381,4 +392,4 @@ class ShareaholicSixToSeven {
|
|
381 |
}
|
382 |
}
|
383 |
|
384 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* This file holds the ShareaholicSixToSeven class.
|
4 |
+
*
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
+
|
8 |
/**
|
9 |
* This class is in charge or extracting the old style of configuration
|
10 |
* from the wordpress database and turning it into a format that we
|
11 |
* can POST back to shareaholic.com to create a new publisher configuration.
|
12 |
+
*
|
13 |
+
* @package shareaholic
|
14 |
*/
|
15 |
class ShareaholicSixToSeven {
|
16 |
/**
|
73 |
self::transform_shortener_configuration($sexybookmarks_configuration) : array());
|
74 |
$new_configuration = array_merge($new_configuration, $shortener_configuration);
|
75 |
|
76 |
+
$response = ShareaholicCurl::post(Shareaholic::URL . '/publisher_tools/anonymous', $new_configuration, 'json');
|
77 |
+
if ($response && preg_match('/20*/', $response['response']['code'])) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
ShareaholicUtilities::log_event('6To7ConversionSuccess', array(
|
79 |
'the_posted_json' => $new_configuration,
|
80 |
'the_created_api_key' => $result['api_key'],
|
84 |
));
|
85 |
|
86 |
ShareaholicUtilities::update_options(array(
|
87 |
+
'api_key' => $response['body']['api_key'],
|
88 |
'version' => Shareaholic::VERSION,
|
89 |
'verification_key' => $verification_key,
|
90 |
+
'location_name_ids' => $response['body']['location_name_ids']
|
91 |
));
|
92 |
|
93 |
+
ShareaholicUtilities::turn_on_locations($response['body']['location_name_ids']);
|
94 |
|
95 |
self::transform_wordpress_specific_settings();
|
96 |
+
} else {
|
97 |
+
ShareaholicUtilities::log_event('6To7ConversionFailed', array(
|
98 |
+
'the_posted_json' => $new_configuration,
|
99 |
+
'SexyBookmarks' => $sexybookmarks_configuration,
|
100 |
+
'ShareaholicClassicBookmarks' => $classicbookmarks_configuration,
|
101 |
+
'ShareaholicRecommendations' => $recommendations_configuration
|
102 |
+
));
|
103 |
}
|
104 |
}
|
105 |
|
273 |
* Returns a configuration if the user was using classicbookmarks.
|
274 |
*
|
275 |
* @param array $classicbookmarks_configuration
|
|
|
276 |
* @return array
|
277 |
*/
|
278 |
private static function transform_classicbookmarks_locations($classicbookmarks_configuration) {
|
327 |
return array_map(array('self', 'services_iterator'), $services);
|
328 |
}
|
329 |
|
330 |
+
/**
|
331 |
+
* Because PHP < 5.3 doesn't support anonymous functions, this serves
|
332 |
+
* as the mapping function for the above method.
|
333 |
+
*
|
334 |
+
* @param string $value
|
335 |
+
* @return string
|
336 |
+
*/
|
337 |
private static function services_iterator($value) {
|
338 |
if (preg_match('/googleplus/', $value)) {
|
339 |
// it's stored as googleplus in wordpress, but
|
392 |
}
|
393 |
}
|
394 |
|
395 |
+
?>
|
utilities.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package shareaholic
|
4 |
*/
|
5 |
|
@@ -9,6 +11,8 @@ require_once(SHAREAHOLIC_DIR . '/six_to_seven.php');
|
|
9 |
/**
|
10 |
* This class is just a holder for general functions that have
|
11 |
* no better place to be.
|
|
|
|
|
12 |
*/
|
13 |
class ShareaholicUtilities {
|
14 |
/**
|
@@ -66,12 +70,13 @@ class ShareaholicUtilities {
|
|
66 |
'verification_key' => '',
|
67 |
);
|
68 |
}
|
69 |
-
|
70 |
/**
|
71 |
* Returns links to add to the plugin options admin page
|
72 |
*
|
|
|
73 |
* @return array
|
74 |
-
*/
|
75 |
public static function admin_plugin_action_links($links) {
|
76 |
$links[] = '<a href="admin.php?page=shareaholic-settings">'.__('Settings', 'shareaholic').'</a>';
|
77 |
return $links;
|
@@ -316,7 +321,8 @@ class ShareaholicUtilities {
|
|
316 |
}
|
317 |
|
318 |
$api_key = self::get_or_create_api_key();
|
319 |
-
$
|
|
|
320 |
|
321 |
if ($result == 'true') {
|
322 |
ShareaholicUtilities::update_options(array(
|
@@ -351,26 +357,20 @@ class ShareaholicUtilities {
|
|
351 |
* @param string $api_key
|
352 |
*/
|
353 |
public static function get_new_location_name_ids($api_key) {
|
354 |
-
$
|
|
|
355 |
$result = array();
|
356 |
|
357 |
-
$
|
358 |
-
if ($publisher_configuration) {
|
359 |
foreach (array('share_buttons', 'recommendations') as $app) {
|
360 |
-
|
361 |
-
|
362 |
-
$result[$app][$location['name']] = $id;
|
363 |
-
}
|
364 |
-
} else {
|
365 |
-
$load_fail_template = true;
|
366 |
}
|
367 |
}
|
368 |
|
369 |
-
if ($load_fail_template) {
|
370 |
-
ShareaholicUtilities::load_template('failed_to_create_api_key_modal');
|
371 |
-
}
|
372 |
-
|
373 |
self::update_location_name_ids($result);
|
|
|
|
|
374 |
}
|
375 |
}
|
376 |
|
@@ -403,14 +403,28 @@ class ShareaholicUtilities {
|
|
403 |
* Returns the api key or creates a new one.
|
404 |
*/
|
405 |
public static function get_or_create_api_key() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
$settings = self::get_settings();
|
407 |
if (isset($settings['api_key']) && !empty($settings['api_key'])) {
|
408 |
return $settings['api_key'];
|
409 |
}
|
410 |
delete_option('shareaholic_settings');
|
411 |
|
|
|
|
|
412 |
$verification_key = md5(mt_rand());
|
413 |
-
$
|
414 |
'configuration_publisher' => array(
|
415 |
'verification_key' => $verification_key,
|
416 |
'site_name' => get_bloginfo('name'),
|
@@ -435,19 +449,24 @@ class ShareaholicUtilities {
|
|
435 |
)
|
436 |
));
|
437 |
|
438 |
-
if ($
|
439 |
self::update_options(array(
|
440 |
-
'api_key' => $
|
441 |
'verification_key' => $verification_key,
|
442 |
-
'location_name_ids' => $
|
443 |
));
|
444 |
|
445 |
-
ShareaholicUtilities::turn_on_locations($
|
446 |
} else {
|
447 |
add_action('admin_notices', array('ShareaholicAdmin', 'failed_to_create_api_key'));
|
448 |
}
|
449 |
}
|
450 |
|
|
|
|
|
|
|
|
|
|
|
451 |
public static function site_url() {
|
452 |
return preg_replace('/https?:\/\//', '', site_url());
|
453 |
}
|
@@ -458,6 +477,10 @@ class ShareaholicUtilities {
|
|
458 |
* of appending the values.
|
459 |
*
|
460 |
* http://www.php.net/manual/en/function.array-merge-recursive.php#92195
|
|
|
|
|
|
|
|
|
461 |
*/
|
462 |
public static function array_merge_recursive_distinct ( array &$array1, array &$array2 )
|
463 |
{
|
@@ -485,6 +508,8 @@ class ShareaholicUtilities {
|
|
485 |
/**
|
486 |
* Array casting an object is not recursive, this makes it recursive
|
487 |
*
|
|
|
|
|
488 |
* http://www.if-not-true-then-false.com/2009/php-tip-convert-stdclass-object-to-multidimensional-array-and-convert-multidimensional-array-to-stdclass-object/
|
489 |
*/
|
490 |
public static function object_to_array($d) {
|
@@ -520,7 +545,7 @@ class ShareaholicUtilities {
|
|
520 |
'plugin_version' => Shareaholic::VERSION,
|
521 |
'api_key' => self::get_option('api_key'),
|
522 |
'domain' => get_bloginfo('url'),
|
523 |
-
'
|
524 |
'stats' => array (
|
525 |
'posts_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'post' AND post_status = 'publish'" ),
|
526 |
'pages_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'page' AND post_status = 'publish'" ),
|
@@ -548,7 +573,7 @@ class ShareaholicUtilities {
|
|
548 |
|
549 |
// var_dump($event_params);
|
550 |
|
551 |
-
$
|
552 |
// $result = wp_remote_post($event_api_url, array('body' => $event_params) );
|
553 |
}
|
554 |
|
@@ -562,4 +587,4 @@ class ShareaholicUtilities {
|
|
562 |
}
|
563 |
|
564 |
}
|
565 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Holds the ShareaholicUtilities class.
|
4 |
+
*
|
5 |
* @package shareaholic
|
6 |
*/
|
7 |
|
11 |
/**
|
12 |
* This class is just a holder for general functions that have
|
13 |
* no better place to be.
|
14 |
+
*
|
15 |
+
* @package shareaholic
|
16 |
*/
|
17 |
class ShareaholicUtilities {
|
18 |
/**
|
70 |
'verification_key' => '',
|
71 |
);
|
72 |
}
|
73 |
+
|
74 |
/**
|
75 |
* Returns links to add to the plugin options admin page
|
76 |
*
|
77 |
+
* @param array $links
|
78 |
* @return array
|
79 |
+
*/
|
80 |
public static function admin_plugin_action_links($links) {
|
81 |
$links[] = '<a href="admin.php?page=shareaholic-settings">'.__('Settings', 'shareaholic').'</a>';
|
82 |
return $links;
|
321 |
}
|
322 |
|
323 |
$api_key = self::get_or_create_api_key();
|
324 |
+
$response = ShareaholicCurl::get(Shareaholic::URL . '/publisher_tools/' . $api_key . '/verified');
|
325 |
+
$result = $response['body'];
|
326 |
|
327 |
if ($result == 'true') {
|
328 |
ShareaholicUtilities::update_options(array(
|
357 |
* @param string $api_key
|
358 |
*/
|
359 |
public static function get_new_location_name_ids($api_key) {
|
360 |
+
$response = ShareaholicCurl::get(Shareaholic::URL . "/publisher_tools/{$api_key}.json");
|
361 |
+
$publisher_configuration = $response['body'];
|
362 |
$result = array();
|
363 |
|
364 |
+
if ($publisher_configuration && is_array($publisher_configuration)) {
|
|
|
365 |
foreach (array('share_buttons', 'recommendations') as $app) {
|
366 |
+
foreach ($publisher_configuration['apps'][$app]['locations'] as $id => $location) {
|
367 |
+
$result[$app][$location['name']] = $id;
|
|
|
|
|
|
|
|
|
368 |
}
|
369 |
}
|
370 |
|
|
|
|
|
|
|
|
|
371 |
self::update_location_name_ids($result);
|
372 |
+
} else {
|
373 |
+
ShareaholicUtilities::load_template('failed_to_create_api_key_modal');
|
374 |
}
|
375 |
}
|
376 |
|
403 |
* Returns the api key or creates a new one.
|
404 |
*/
|
405 |
public static function get_or_create_api_key() {
|
406 |
+
$trace = debug_backtrace();
|
407 |
+
$old_timezone = date_default_timezone_get();
|
408 |
+
date_default_timezone_set('UTC');
|
409 |
+
$things_to_log = array(
|
410 |
+
'request_uri' => $_SERVER['REQUEST_URI'],
|
411 |
+
'calling_location' => $trace[0]['file'] . ':' . $trace[0]['line'],
|
412 |
+
'time' => date('l jS \of F Y h:i:s A')
|
413 |
+
);
|
414 |
+
date_default_timezone_set($old_timezone);
|
415 |
+
|
416 |
+
ShareaholicUtilities::log($things_to_log);
|
417 |
+
|
418 |
$settings = self::get_settings();
|
419 |
if (isset($settings['api_key']) && !empty($settings['api_key'])) {
|
420 |
return $settings['api_key'];
|
421 |
}
|
422 |
delete_option('shareaholic_settings');
|
423 |
|
424 |
+
ShareaholicUtilities::log_event('CreatingNewApiKey', $things_to_log);
|
425 |
+
|
426 |
$verification_key = md5(mt_rand());
|
427 |
+
$response = ShareaholicCurl::post(Shareaholic::URL . '/publisher_tools/anonymous', array(
|
428 |
'configuration_publisher' => array(
|
429 |
'verification_key' => $verification_key,
|
430 |
'site_name' => get_bloginfo('name'),
|
449 |
)
|
450 |
));
|
451 |
|
452 |
+
if ($response && preg_match('/20*/', $response['response']['code'])) {
|
453 |
self::update_options(array(
|
454 |
+
'api_key' => $response['body']['api_key'],
|
455 |
'verification_key' => $verification_key,
|
456 |
+
'location_name_ids' => $response['body']['location_name_ids']
|
457 |
));
|
458 |
|
459 |
+
ShareaholicUtilities::turn_on_locations($response['body']['location_name_ids']);
|
460 |
} else {
|
461 |
add_action('admin_notices', array('ShareaholicAdmin', 'failed_to_create_api_key'));
|
462 |
}
|
463 |
}
|
464 |
|
465 |
+
/**
|
466 |
+
* Returns the site's url stripped of protocol.
|
467 |
+
*
|
468 |
+
* @return string
|
469 |
+
*/
|
470 |
public static function site_url() {
|
471 |
return preg_replace('/https?:\/\//', '', site_url());
|
472 |
}
|
477 |
* of appending the values.
|
478 |
*
|
479 |
* http://www.php.net/manual/en/function.array-merge-recursive.php#92195
|
480 |
+
*
|
481 |
+
* @param array $array1
|
482 |
+
* @param array $array2
|
483 |
+
* @return array
|
484 |
*/
|
485 |
public static function array_merge_recursive_distinct ( array &$array1, array &$array2 )
|
486 |
{
|
508 |
/**
|
509 |
* Array casting an object is not recursive, this makes it recursive
|
510 |
*
|
511 |
+
* @param object $d
|
512 |
+
*
|
513 |
* http://www.if-not-true-then-false.com/2009/php-tip-convert-stdclass-object-to-multidimensional-array-and-convert-multidimensional-array-to-stdclass-object/
|
514 |
*/
|
515 |
public static function object_to_array($d) {
|
545 |
'plugin_version' => Shareaholic::VERSION,
|
546 |
'api_key' => self::get_option('api_key'),
|
547 |
'domain' => get_bloginfo('url'),
|
548 |
+
'language' => get_bloginfo('language'),
|
549 |
'stats' => array (
|
550 |
'posts_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'post' AND post_status = 'publish'" ),
|
551 |
'pages_total' => $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts where post_type = 'page' AND post_status = 'publish'" ),
|
573 |
|
574 |
// var_dump($event_params);
|
575 |
|
576 |
+
$response = ShareaholicCurl::post($event_api_url, $event_params);
|
577 |
// $result = wp_remote_post($event_api_url, array('body' => $event_params) );
|
578 |
}
|
579 |
|
587 |
}
|
588 |
|
589 |
}
|
590 |
+
?>
|