Revive Old Posts – Auto Post to Social Media - Version 7.4.5

Version Description

Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Revive Old Posts – Auto Post to Social Media
Version 7.4.5
Comparing to
See all releases

Code changes from version 7.4.0 to 7.4.5

CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
 
 
 
 
2
- Improved schedule trigger mechanism
3
- Fixed post format saving issues
4
- Fixed status saving issue
5
- Updated readme and assets
6
 
7
 
8
 
9
- Added support for custom messages
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
 
10
 
11
 
 
css/style.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- # Version: 7.3.8
3
  */
4
 
5
  /* Clearfix */
1
  /*
2
+ # Version: 7.4.5
3
  */
4
 
5
  /* Clearfix */
inc/class-remote-notification-client.php DELETED
@@ -1,381 +0,0 @@
1
- <?php
2
- /**
3
- * Remote Dashobard Notifications.
4
- *
5
- * This class is part of the Remote Dashboard Notifications plugin.
6
- * This plugin allows you to send notifications to your client's
7
- * WordPress dashboard easily.
8
- *
9
- * Notification you send will be displayed as admin notifications
10
- * using the standard WordPress hooks. A "dismiss" option is added
11
- * in order to let the user hide the notification.
12
- *
13
- * @package Remote Dashboard Notifications
14
- * @author ThemeAvenue <web@themeavenue.net>
15
- * @license GPL-2.0+
16
- * @link http://themeavenue.net
17
- * @link http://wordpress.org/plugins/remote-dashboard-notifications/
18
- * @link https://github.com/ThemeAvenue/Remote-Dashboard-Notifications
19
- * @copyright 2014 ThemeAvenue
20
- */
21
-
22
- // If this file is called directly, abort.
23
- if ( ! defined( 'WPINC' ) ) {
24
- die;
25
- }
26
-
27
- class TAV_Remote_Notification_Client {
28
-
29
- /**
30
- * Class version.
31
- *
32
- * @since 0.1.0
33
- *
34
- * @var string
35
- */
36
- protected static $version = '0.1.2';
37
-
38
- public function __construct( $channel_id = false, $channel_key = false, $server = false, $debug = false ) {
39
-
40
- /* Don't continue during Ajax process */
41
- if( !is_admin() || defined( 'DOING_AJAX' ) && DOING_AJAX )
42
- return;
43
-
44
- $this->id = intval( $channel_id );
45
- $this->key = sanitize_key( $channel_key );
46
- $this->server = esc_url( $server );
47
- $this->notice = false;
48
- $this->cache = apply_filters( 'rn_notice_caching_time', 6 );
49
- $this->debug = $debug;
50
- $this->error = null;
51
-
52
- /* The plugin can't work without those 2 parameters */
53
- if( false === ( $this->id || $this->key || $this->server ) )
54
- return;
55
-
56
- /* Call the dismiss method before testing for Ajax */
57
- if( isset( $_GET['rn'] ) && isset( $_GET['notification'] ) )
58
- add_action( 'init', array( $this, 'dismiss' ) );
59
-
60
- add_action( 'init', array( $this, 'request_server' ) );
61
-
62
- }
63
-
64
- /**
65
- * Send a request to notification server
66
- *
67
- * The distant WordPress notification server is
68
- * queried using the WordPress HTTP API.
69
- *
70
- * @since 0.1.0
71
- */
72
- public function request_server() {
73
-
74
- /* Current channel ID */
75
- $channel_id = $this->id;
76
-
77
- /* Current channel key */
78
- $channel_key = $this->key;
79
-
80
- /* Generate a unique identifyer used for the transient */
81
- $uniqid = $channel_id . substr( $channel_key, 0, 5 );
82
-
83
- /* Prepare the payload to send to server */
84
- $payload = base64_encode( json_encode( array( 'channel' => $channel_id, 'key' => $channel_key ) ) );
85
-
86
- /* Get the endpoint URL ready */
87
- $url = add_query_arg( array( 'payload' => $payload ), $this->server );
88
-
89
- /* Content is false at first */
90
- $content = get_transient( "rn_last_notification_$uniqid" );
91
-
92
- /* Set the request response to null */
93
- $request = null;
94
-
95
- /* If no notice is present in DB we query the server */
96
- if( false === $content || defined( 'RDN_DEV' ) && RDN_DEV ) {
97
-
98
- /* Query the server */
99
- $request = wp_remote_get( $url, array( 'timeout' => apply_filters( 'rn_http_request_timeout', 5 ) ) );
100
-
101
- /* If we have a WP_Error object we abort */
102
- if( is_wp_error( $request ) )
103
- return;
104
-
105
- /* Check if we have a valid response */
106
- if( is_array( $request ) && isset( $request['response']['code'] ) && 200 === intval( $request['response']['code'] ) ) {
107
-
108
- /* Get the response body */
109
- if( isset( $request['body'] ) ) {
110
-
111
- /**
112
- * Decode the response JSON string
113
- */
114
- $content = json_decode( $request['body'] );
115
-
116
- /**
117
- * Check if the payload is in a usable JSON format
118
- */
119
- if( version_compare( phpversion(), '5.3.0', '>=' ) ) {
120
-
121
- if( ! ( json_last_error() == JSON_ERROR_NONE ) )
122
- return false;
123
-
124
- } else {
125
-
126
- if( $content == NULL )
127
- return false;
128
-
129
- }
130
-
131
- set_transient( "rn_last_notification_$uniqid", $content, $this->cache*60*60*5 );
132
-
133
- }
134
-
135
- }
136
-
137
- }
138
-
139
- /**
140
- * If the JSON string has been decoded we can go ahead
141
- */
142
- if( is_object( $content ) ) {
143
-
144
- if( isset( $content->error ) ) {
145
-
146
- /* Display debug info in the admin footer */
147
- if( true === $this->debug ) {
148
-
149
- /* Save the error message */
150
- $this->error = $content->error;
151
-
152
- /* Display it commented in the footer */
153
- add_action( 'admin_footer', array( $this, 'debug_info' ) );
154
-
155
- }
156
-
157
- /* Stop */
158
- return;
159
-
160
- }
161
-
162
- $this->notice = $content;
163
-
164
- /**
165
- * Check if notice has already been dismissed
166
- */
167
- $dismissed = get_option( '_rn_dismissed' );
168
-
169
- if( is_array( $dismissed ) && in_array( $content->slug, $dismissed ) )
170
- return;
171
-
172
- /**
173
- * Add the notice style
174
- */
175
- add_action( 'admin_print_styles', array( $this, 'style' ), 100 );
176
-
177
- /**
178
- * Add the notice to WP dashboard
179
- */
180
- add_action( 'admin_notices', array( $this, 'show_notice' ) );
181
-
182
- } else {
183
-
184
- return false;
185
-
186
- }
187
-
188
- }
189
-
190
- /**
191
- * Display the admin notice
192
- *
193
- * The function will do some checks to verify if
194
- * the notice can be displayed on the current page.
195
- * If all the checks are passed, the notice
196
- * is added to the page.
197
- *
198
- * @since 0.1.0
199
- */
200
- public function show_notice() {
201
-
202
- $content = $this->notice;
203
-
204
- /* If there is no content we abort */
205
- if( false === $content )
206
- return;
207
-
208
- /* If the type array isn't empty we have a limitation */
209
- if( isset( $content->type ) && is_array( $content->type ) && !empty( $content->type ) ) {
210
-
211
- /* Get current post type */
212
- $pt = get_post_type();
213
-
214
- /**
215
- * If the current post type can't be retrieved
216
- * or if it's not in the allowed post types,
217
- * then we don't display the admin notice.
218
- */
219
- if( false === $pt || !in_array( $pt, $content->type ) )
220
- return;
221
-
222
- }
223
-
224
- /* Prepare alert class */
225
- $style = isset( $content->style ) ? $content->style : 'updated';
226
-
227
- if( 'updated' == $style )
228
- $class = $style;
229
-
230
- elseif( 'error' == $style )
231
- $class = 'updated error';
232
-
233
- else
234
- $class = "updated rn-alert rn-alert-$style";
235
-
236
- /**
237
- * Prepare the dismiss URL
238
- *
239
- * @var (string) URL
240
- * @todo get a more accurate URL of the current page
241
- */
242
- $args = array();
243
- $nonce = wp_create_nonce( 'rn-dismiss' );
244
- $slug = $content->slug;
245
-
246
- array_push( $args, "rn=$nonce" );
247
- array_push( $args, "notification=$slug" );
248
-
249
- foreach( $_GET as $key => $value ) {
250
-
251
- array_push( $args, "$key=$value" );
252
-
253
- }
254
-
255
- $args = implode( '&', $args );
256
- $url = "?$args";
257
- ?>
258
-
259
- <div class="<?php echo $class; ?>">
260
- <?php if( !in_array( $style, array( 'updated', 'error' ) ) ): ?><a href="<?php echo $url; ?>" id="rn-dismiss" class="rn-dismiss-btn" title="<?php _e( 'Dismiss notification', 'remote-notifications' ); ?>">&times;</a><?php endif; ?>
261
- <p><?php echo html_entity_decode( $content->message ); ?></p>
262
- <?php if( in_array( $style, array( 'updated', 'error' ) ) ): ?><p><a href="<?php echo $url; ?>" id="rn-dismiss" class="rn-dismiss-button button-secondary"><?php _e( 'Dismiss', 'remote-notifications' ); ?></a></p><?php endif; ?>
263
- </div>
264
- <?php
265
-
266
- }
267
-
268
- /**
269
- * Dismiss notice
270
- *
271
- * When the user dismisses a notice, its slug
272
- * is added to the _rn_dismissed entry in the DB options table.
273
- * This entry is then used to check if a notie has been dismissed
274
- * before displaying it on the dashboard.
275
- *
276
- * @since 0.1.0
277
- */
278
- public function dismiss() {
279
-
280
- /* Check if we have all the vars */
281
- if( !isset( $_GET['rn'] ) || !isset( $_GET['notification'] ) )
282
- return;
283
-
284
- /* Validate nonce */
285
- if( !wp_verify_nonce( sanitize_key( $_GET['rn'] ), 'rn-dismiss' ) )
286
- return;
287
-
288
- /* Get dismissed list */
289
- $dismissed = get_option( '_rn_dismissed', array() );
290
-
291
- /* Add the current notice to the list if needed */
292
- if( is_array( $dismissed ) && !in_array( $_GET['notification'], $dismissed ) )
293
- array_push( $dismissed, $_GET['notification'] );
294
-
295
- /* Update option */
296
- update_option( '_rn_dismissed', $dismissed );
297
-
298
- /* Get redirect URL */
299
- $args = array();
300
-
301
- /* Get URL args */
302
- foreach( $_GET as $key => $value ) {
303
-
304
- if( in_array( $key, array( 'rn', 'notification' ) ) )
305
- continue;
306
-
307
- array_push( $args, "$key=$value" );
308
-
309
- }
310
-
311
- $args = implode( '&', $args );
312
- $url = "?$args";
313
-
314
- /* Redirect */
315
- wp_redirect( $url );
316
-
317
- }
318
-
319
- /**
320
- * Adds inline style for non standard notices
321
- *
322
- * This function will only be called if the notice style is not standard.
323
- *
324
- * @since 0.1.0
325
- */
326
- public function style() { ?>
327
-
328
- <style type="text/css">div.rn-alert{padding:15px;padding-right:35px;margin-bottom:20px;border:1px solid transparent;-webkit-box-shadow:none;box-shadow:none}div.rn-alert p:empty{display:none}div.rn-alert ul,div.rn-alert ul li,div.rn-alert ol,div.rn-alert ol li{list-style:inherit !important}div.rn-alert ul,div.rn-alert ol{padding-left:30px}div.rn-alert hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}div.rn-alert h1,h2,h3,h4,h5,h6{margin-top:0;color:inherit}div.rn-alert a{font-weight:700}div.rn-alert a:hover{text-decoration:underline}div.rn-alert>p{margin:0;padding:0;line-height:1}div.rn-alert>p,div.rn-alert>ul{margin-bottom:0}div.rn-alert>p+p{margin-top:5px}div.rn-alert .rn-dismiss-btn{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;position:relative;top:-2px;right:-21px;padding:0;cursor:pointer;background:0;border:0;-webkit-appearance:none;float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20);text-decoration:none}div.rn-alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}div.rn-alert-success hr{border-top-color:#c9e2b3}div.rn-alert-success a{color:#2b542c}div.rn-alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#31708f}div.rn-alert-info hr{border-top-color:#a6e1ec}div.rn-alert-info a{color:#245269}div.rn-alert-warning{background-color:#fcf8e3;border-color:#faebcc;color:#8a6d3b}div.rn-alert-warning hr{border-top-color:#f7e1b5}div.rn-alert-warning a{color:#66512c}div.rn-alert-danger{background-color:#f2dede;border-color:#ebccd1;color:#a94442}div.rn-alert-danger hr{border-top-color:#e4b9c0}div.rn-alert-danger a{color:#843534}</style>
329
-
330
- <?php }
331
-
332
- /**
333
- * Dismiss notice using Ajax
334
- *
335
- * This function is NOT used. Testing only.
336
- */
337
- public function script() {
338
-
339
- $url = admin_url();
340
- ?>
341
-
342
- <script type="text/javascript">
343
- jQuery(document).ready(function($) {
344
-
345
- var prout = 'prout';
346
-
347
- $('#rn-dismiss').on('click', function(event) {
348
- event.preventDefault();
349
- $.ajax({
350
- type: "GET",
351
- url: <?php echo $url; ?>,
352
- data: prout
353
- });
354
- console.log('clicked');
355
- });
356
-
357
- return false;
358
-
359
- });
360
- </script>
361
-
362
- <?php
363
-
364
- }
365
-
366
- /**
367
- * Debug info.
368
- *
369
- * Display an error message commented in the admin footer.
370
- *
371
- * @since 0.1.2
372
- */
373
- public function debug_info() {
374
-
375
- $error = $this->error;
376
-
377
- echo "<!-- RDN Debug Info: $error -->";
378
-
379
- }
380
-
381
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/config.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
  define("CURRENTURL", top_current_page());
 
 
 
3
 
4
  if(class_exists("CWP_TOP_Core_PRO")){
5
  define("CWP_TOP_PRO", TRUE);
@@ -19,9 +22,6 @@ $cwp_top_settings = array(
19
  );
20
  $cwp_rop_remote_trigger_url = "http://portal.themeisle.com/remote_trigger";
21
  $cwp_rop_beta_trigger_url = "http://portal.themeisle.com/beta_user";
22
- // Added by Ash/Upwork
23
- $cwp_rop_self_endpoint = "rop_checking_schedule";
24
- // Added by Ash/Upwork
25
  $cwp_top_global_schedule = array();
26
  if(!defined('ROP_PRO_VERSION'))
27
  $cwp_top_networks = array();
1
  <?php
2
  define("CURRENTURL", top_current_page());
3
+ define("ROP_ENDPOINT_SLUG__", "rop");
4
+ define("ROP_REST_VERSION", "1");
5
+ define("ROP_REMOTE_CHECK_URL", 'http://mirror.themeisle.com');
6
 
7
  if(class_exists("CWP_TOP_Core_PRO")){
8
  define("CWP_TOP_PRO", TRUE);
22
  );
23
  $cwp_rop_remote_trigger_url = "http://portal.themeisle.com/remote_trigger";
24
  $cwp_rop_beta_trigger_url = "http://portal.themeisle.com/beta_user";
 
 
 
25
  $cwp_top_global_schedule = array();
26
  if(!defined('ROP_PRO_VERSION'))
27
  $cwp_top_networks = array();
inc/core.php CHANGED
@@ -108,7 +108,7 @@ if (!class_exists('CWP_TOP_Core')) {
108
  }
109
  public function startPosting(){
110
 
111
- update_option('cwp_topnew_active_status', 'true');
112
  update_option('top_opt_already_tweeted_posts',array());
113
  update_option('top_last_tweets',array());
114
  $timeNow = $this->getTime();
@@ -130,7 +130,7 @@ if (!class_exists('CWP_TOP_Core')) {
130
  public function stopPosting(){
131
 
132
  // Set it to inactive status
133
- update_option('cwp_topnew_active_status', 'false');
134
  update_option('cwp_topnew_notice', '');
135
  update_option('top_opt_already_tweeted_posts',array());
136
 
@@ -1600,8 +1600,12 @@ endif;
1600
 
1601
  $this->user_info = get_option('cwp_top_oauth_user_details');
1602
  $this->users = apply_filters("rop_users_filter",get_option('cwp_top_logged_in_users'));
1603
-
1604
- $this->pluginStatus = get_option('cwp_topnew_active_status');
 
 
 
 
1605
  $this->intervalSet = get_option('top_opt_interval');
1606
 
1607
  self::$date_format = 'M j, Y @ G:i';
@@ -2221,7 +2225,7 @@ endif;
2221
  }
2222
 
2223
  //update_option("top_opt_already_tweeted_posts", array());
2224
- $this->updateAllPostFormat();
2225
  if(CWP_TOP_PRO){
2226
 
2227
  global $CWP_TOP_Core_PRO;
@@ -2230,15 +2234,10 @@ endif;
2230
  die();
2231
  }
2232
 
2233
- public function updateAllPostFormat()
2234
  {
2235
  $all = $this->getAllNetworks();
2236
- $dataSent = $_POST['dataSent']['dataSent'];
2237
 
2238
- $options = array();
2239
- parse_str($dataSent, $options);
2240
-
2241
- //print_r($options);
2242
  foreach($all as $n){
2243
 
2244
  if(!array_key_exists($n.'_top_opt_custom_url_option', $options)) {
@@ -2329,7 +2328,7 @@ endif;
2329
  'top_opt_post_type_value' => 'post',
2330
  'top_opt_custom_url_field' => '',
2331
  'top_opt_omit_cats' => '',
2332
- 'cwp_topnew_active_status' => 'false',
2333
  'cwp_topnew_notice' => '',
2334
  'top_opt_excluded_post' => '',
2335
  'top_opt_tweet-multiple-times' => 'off',
@@ -2710,7 +2709,7 @@ endif;
2710
  $this->sendBetaUserTrigger($remote_call);
2711
  }
2712
 
2713
- $this->sendRemoteTrigger($this->getRemoteCheck());
2714
  set_transient( 'rop_remote_calls', "done", 24 * HOUR_IN_SECONDS );
2715
  }
2716
  if(!defined("VERSION_CHECK") && function_exists('topProImage')){
@@ -2866,10 +2865,8 @@ endif;
2866
 
2867
  add_action('admin_init', array($this,'top_nag_ignore'));
2868
  add_action('admin_init', array($this,'clearOldCron'));
2869
- // Added by Ash/Upwork
2870
- add_filter('template_include', array($this, 'captureRewrites'), 1, 1);
2871
- add_filter('query_vars', array($this, 'addRewriteVars'));
2872
- // Added by Ash/Upwork
2873
 
2874
  //filters
2875
 
@@ -2890,6 +2887,46 @@ endif;
2890
 
2891
  }
2892
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2893
  function checkAjaxCapability() {
2894
  $cap = false;
2895
  if (!current_user_can('manage_options') && $this->top_check_user_role( 'Administrator' )) {
@@ -2933,7 +2970,7 @@ endif;
2933
  $this->clearLog();
2934
  break;
2935
  case 'remote_trigger':
2936
- $this->remoteTrigger();
2937
  break;
2938
  case 'beta_user_trigger':
2939
  $this->betaUserTrigger();
@@ -2958,26 +2995,11 @@ endif;
2958
  }
2959
 
2960
  // Added by Ash/Upwork
2961
- function addRewriteVars($vars){
2962
- global $cwp_rop_self_endpoint;
2963
- $vars[] = $cwp_rop_self_endpoint;
2964
- return $vars;
2965
- }
2966
-
2967
- function captureRewrites($template){
2968
- global $wp_query, $cwp_rop_self_endpoint;
2969
- if (get_query_var($cwp_rop_self_endpoint, false)){
2970
- $this->processServerRequest();
2971
- return null;
2972
- }
2973
- return $template;
2974
- }
2975
-
2976
  private function processServerRequest(){
2977
  if(
2978
  !get_option("cwp_rop_remote_trigger", false)
2979
  ||
2980
- !get_option("cwp_topnew_active_status", false)
2981
  ) return;
2982
 
2983
  $crons = _get_cron_array();
@@ -3023,53 +3045,59 @@ endif;
3023
  return $users;
3024
  }
3025
 
3026
- public function remoteTrigger($status = ""){
3027
- if(!is_admin()) return false;
3028
- $state = isset($_POST["state"]) ? $_POST["state"] : "";
3029
-
3030
- if(!empty($status)) $state = $status;
3031
-
3032
- if(!empty($state) &&( $state == "on" || $state == "off")){
3033
-
3034
- update_option("cwp_rop_remote_trigger",$state);
3035
- // Added by Ash/Upwork
3036
- $response = $this->sendRemoteTrigger($state);
3037
- if($response){
3038
- $error = __('Error: ','tweet-old-post') . $response;
3039
- self::addNotice($error, 'error');
3040
- update_option("cwp_rop_remote_trigger", "off");
3041
- // if you want to show the user an alert, make showAlert true
3042
- wp_send_json_error(array("error" => $error, "showAlert" => false));
3043
- }
3044
- // Added by Ash/Upwork
3045
  }
 
 
 
3046
 
3047
- if(empty($status)) die();
3048
- }
3049
-
3050
- public function sendRemoteTrigger($state){
3051
-
3052
- global $cwp_rop_remote_trigger_url;
3053
- $state = ($state == "on") ? "yes" : "no";
3054
-
3055
- $response = wp_remote_post( $cwp_rop_remote_trigger_url, array(
3056
- 'method' => 'POST',
3057
- 'timeout' => 1,
 
 
 
 
3058
  'redirection' => 5,
3059
- 'httpversion' => '1.0',
3060
- 'blocking' => true,
3061
- 'headers' => array(),
3062
- 'body' => array( 'url' => get_site_url(), 'status' => $state ),
3063
- 'cookies' => array()
3064
- )
3065
- );
3066
-
3067
- // Added by Ash/Upwork
3068
- if(is_wp_error($response)){
3069
- return $response->get_error_message();
3070
- }
3071
- return null;
3072
- // Added by Ash/Upwork
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3073
  }
3074
 
3075
  public function betaUserTrigger($status = ""){
108
  }
109
  public function startPosting(){
110
 
111
+ update_option('cwp_topnew_active_status', 'yes');
112
  update_option('top_opt_already_tweeted_posts',array());
113
  update_option('top_last_tweets',array());
114
  $timeNow = $this->getTime();
130
  public function stopPosting(){
131
 
132
  // Set it to inactive status
133
+ update_option('cwp_topnew_active_status', 'no');
134
  update_option('cwp_topnew_notice', '');
135
  update_option('top_opt_already_tweeted_posts',array());
136
 
1600
 
1601
  $this->user_info = get_option('cwp_top_oauth_user_details');
1602
  $this->users = apply_filters("rop_users_filter",get_option('cwp_top_logged_in_users'));
1603
+ $status = get_option('cwp_topnew_active_status', 'no');
1604
+ if($status == 'yes' || $status == 'no'){
1605
+ $this->pluginStatus = ($status=='yes') ? 'true' : 'false';
1606
+ }else{
1607
+ $this->pluginStatus = $status;
1608
+ }
1609
  $this->intervalSet = get_option('top_opt_interval');
1610
 
1611
  self::$date_format = 'M j, Y @ G:i';
2225
  }
2226
 
2227
  //update_option("top_opt_already_tweeted_posts", array());
2228
+ $this->updateAllPostFormat($options);
2229
  if(CWP_TOP_PRO){
2230
 
2231
  global $CWP_TOP_Core_PRO;
2234
  die();
2235
  }
2236
 
2237
+ private function updateAllPostFormat($options)
2238
  {
2239
  $all = $this->getAllNetworks();
 
2240
 
 
 
 
 
2241
  foreach($all as $n){
2242
 
2243
  if(!array_key_exists($n.'_top_opt_custom_url_option', $options)) {
2328
  'top_opt_post_type_value' => 'post',
2329
  'top_opt_custom_url_field' => '',
2330
  'top_opt_omit_cats' => '',
2331
+ 'cwp_topnew_active_status' => 'no',
2332
  'cwp_topnew_notice' => '',
2333
  'top_opt_excluded_post' => '',
2334
  'top_opt_tweet-multiple-times' => 'off',
2709
  $this->sendBetaUserTrigger($remote_call);
2710
  }
2711
 
2712
+ $this->remoteTrigger();
2713
  set_transient( 'rop_remote_calls', "done", 24 * HOUR_IN_SECONDS );
2714
  }
2715
  if(!defined("VERSION_CHECK") && function_exists('topProImage')){
2865
 
2866
  add_action('admin_init', array($this,'top_nag_ignore'));
2867
  add_action('admin_init', array($this,'clearOldCron'));
2868
+
2869
+ add_action("rest_api_init", array($this, "rop_endpoint_register"));
 
 
2870
 
2871
  //filters
2872
 
2887
 
2888
  }
2889
 
2890
+ function rop_endpoint_trigger_schedule() {
2891
+ $this->processServerRequest();
2892
+ $networks = $this->getAvailableNetworks();
2893
+ $users = $this->getUsers();
2894
+ return new WP_REST_Response(
2895
+ array(
2896
+ "networks" => count($networks),
2897
+ "accounts" => count($users),
2898
+ "free_version" => defined("ROP_VERSION") ? ROP_VERSION : false,
2899
+ "pro_version" => defined("ROP_PRO_VERSION") ? ROP_PRO_VERSION : false ,
2900
+ "started" => true
2901
+ )
2902
+ );
2903
+ }
2904
+
2905
+ function rop_endpoint_register() {
2906
+ register_rest_route(
2907
+ ROP_ENDPOINT_SLUG__ . "/v" . ROP_REST_VERSION,
2908
+ "/trigger_schedule/",
2909
+ array(
2910
+ "methods" => "GET",
2911
+ "callback" => array($this, "rop_endpoint_trigger_schedule"),
2912
+ )
2913
+ );
2914
+ }
2915
+
2916
+ function rop_update_option($name, $value=false) {
2917
+ $main = get_option("rop-settings", array());
2918
+ $main[$name] = $value;
2919
+ update_option("rop-settings", $main);
2920
+ }
2921
+
2922
+ function rop_get_option($name, $default=false) {
2923
+ $main = get_option("rop-settings", array());
2924
+ if ($main && array_key_exists($name, $main)) {
2925
+ return $main[$name];
2926
+ }
2927
+ return $default;
2928
+ }
2929
+
2930
  function checkAjaxCapability() {
2931
  $cap = false;
2932
  if (!current_user_can('manage_options') && $this->top_check_user_role( 'Administrator' )) {
2970
  $this->clearLog();
2971
  break;
2972
  case 'remote_trigger':
2973
+ $this->remoteTrigger(isset($_POST["state"]) ? $_POST["state"] : null);
2974
  break;
2975
  case 'beta_user_trigger':
2976
  $this->betaUserTrigger();
2995
  }
2996
 
2997
  // Added by Ash/Upwork
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2998
  private function processServerRequest(){
2999
  if(
3000
  !get_option("cwp_rop_remote_trigger", false)
3001
  ||
3002
+ get_option("cwp_topnew_active_status", 'no') === 'no'
3003
  ) return;
3004
 
3005
  $crons = _get_cron_array();
3045
  return $users;
3046
  }
3047
 
3048
+ // status will be on/off when its being toggled and null when the scheduled JS is calling
3049
+ public function remoteTrigger( $status = null ) {
3050
+ if ( is_null( $status ) && ! defined( 'ROP_PRO_VERSION' ) && get_option( "cwp_rop_remote_trigger", 'off' ) == "off" ) {
3051
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3052
  }
3053
+ if ( ! is_null( $status ) ) {
3054
+ update_option( "cwp_rop_remote_trigger", $status );
3055
+ wp_send_json_success( array() );
3056
 
3057
+ return;
3058
+ }
3059
+ // when status is "on" we will call the api no matter the time
3060
+ if ( ! is_null( $status ) ) {
3061
+ $time_to_shake = $this->rop_get_option( "api-handshake-time", 0 );
3062
+ $time_to_shake = time() > $time_to_shake;
3063
+ } else {
3064
+ $time_to_shake = true;
3065
+ }
3066
+ if ( $time_to_shake ) {
3067
+ // call the api
3068
+ $rest_url = rest_url( ROP_ENDPOINT_SLUG__ . "/v" . ROP_REST_VERSION . "/trigger_schedule/" );
3069
+ $hresponse = wp_remote_post( ROP_REMOTE_CHECK_URL, array(
3070
+ 'method' => 'POST',
3071
+ 'timeout' => 3,
3072
  'redirection' => 5,
3073
+ 'headers' => array( "X-ThemeIsle-Event" => "add_ping" ),
3074
+ 'body' => array(
3075
+ 'site' => urlencode( $rest_url )
3076
+ ),
3077
+ ) );
3078
+ $handshake = "no";
3079
+ if ( is_array( $hresponse ) ) {
3080
+ $body = $hresponse['body']; // use the content
3081
+ $body = json_decode( $body );
3082
+ if ( isset( $body->data ) ) {
3083
+ if ( $body->data->handshake ) {
3084
+ $handshake = $body->data->handshake;
3085
+ }
3086
+ }
3087
+ }
3088
+ $failed = $handshake === "no";
3089
+ $this->rop_update_option( "api-handshake-response", $handshake );
3090
+ if ( $failed ) {
3091
+ $this->rop_update_option( "api-handshake-time", time() + 24 * HOUR_IN_SECONDS );
3092
+ if ( $status === "on" ) {
3093
+ update_option( "cwp_rop_remote_trigger", "off" );
3094
+ }
3095
+ self::addNotice( __( "The remote check can not access your website. You need to whitelist this ip 107.170.26.57 in order for the schedule to work properly", "tweet-old-post" ), "error" );
3096
+ }
3097
+ }
3098
+ if ( ! is_null( $status ) ) {
3099
+ die();
3100
+ }
3101
  }
3102
 
3103
  public function betaUserTrigger($status = ""){
inc/view-advancedscheduling.php CHANGED
@@ -64,7 +64,7 @@
64
 
65
  foreach($networks as $network){
66
  $all = null;
67
- if(get_option("cwp_topnew_active_status", 'false') === 'true'){
68
  $all = array();
69
  if($network){
70
  $posts = CWP_TOP_Core::getTweetsFromDB($network, false, $count);
64
 
65
  foreach($networks as $network){
66
  $all = null;
67
+ if(get_option("cwp_topnew_active_status", 'no') === 'yes'){
68
  $all = array();
69
  if($network){
70
  $posts = CWP_TOP_Core::getTweetsFromDB($network, false, $count);
inc/view.php CHANGED
@@ -142,7 +142,13 @@
142
  <?php } ?>
143
  <?php endif; ?>
144
  <li class="rop-beta-user"><div class="rop-left"><?php _e("Beta user",'tweet-old-post');?> </div><a href="#" id="rop-beta-button" class="rop-right <?php echo $beta_user; ?>"></a><div class="rop-clear" ></div><span class="rop-beta-desc"><?php _e("As a beta user you will have access to the latest stable releases before going to production",'tweet-old-post');?></span></li>
 
 
 
145
  <li class="rop-beta-user"><div class="rop-left"><?php _e("Remote check",'tweet-old-post');?></div><a href="#" id="cwp_remote_check" class="<?php echo $remote_check; ?> rop-right "></a><div class="rop-clear" ></div><span class="rop-beta-desc"><?php _e("We will send you a ping each 15 minutes in order to assure that posts will be sent to social networks on time. ",'tweet-old-post');?> </span> </li>
 
 
 
146
  <?php echo apply_filters("rop_add_to_sidebar", "");?>
147
  <li class="upgrade"><a target="_blank" href="https://revive.social/plugins/revive-old-post/?utm_source=bannerright&utm_medium=announce&utm_campaign=top&upgrade=true"> <?php _e("Upgrade Tweet Old Post for only $9.99 - Upgrade To Pro Now!", 'tweet-old-post'); ?></a></li>
148
 
142
  <?php } ?>
143
  <?php endif; ?>
144
  <li class="rop-beta-user"><div class="rop-left"><?php _e("Beta user",'tweet-old-post');?> </div><a href="#" id="rop-beta-button" class="rop-right <?php echo $beta_user; ?>"></a><div class="rop-clear" ></div><span class="rop-beta-desc"><?php _e("As a beta user you will have access to the latest stable releases before going to production",'tweet-old-post');?></span></li>
145
+ <?php
146
+ if (!defined('ROP_PRO_VERSION')) {
147
+ ?>
148
  <li class="rop-beta-user"><div class="rop-left"><?php _e("Remote check",'tweet-old-post');?></div><a href="#" id="cwp_remote_check" class="<?php echo $remote_check; ?> rop-right "></a><div class="rop-clear" ></div><span class="rop-beta-desc"><?php _e("We will send you a ping each 15 minutes in order to assure that posts will be sent to social networks on time. ",'tweet-old-post');?> </span> </li>
149
+ <?php
150
+ }
151
+ ?>
152
  <?php echo apply_filters("rop_add_to_sidebar", "");?>
153
  <li class="upgrade"><a target="_blank" href="https://revive.social/plugins/revive-old-post/?utm_source=bannerright&utm_medium=announce&utm_campaign=top&upgrade=true"> <?php _e("Upgrade Tweet Old Post for only $9.99 - Upgrade To Pro Now!", 'tweet-old-post'); ?></a></li>
154
 
js/master.js CHANGED
@@ -1,6 +1,15 @@
1
  jQuery(document).ready(function(){
2
 
3
 
 
 
 
 
 
 
 
 
 
4
  jQuery(".rop-not-version ").on("click" ,function(){
5
  console.log('not version')
6
  jQuery(".cwp_not_version_preview").show();
1
  jQuery(document).ready(function(){
2
 
3
 
4
+ jQuery.ajax({
5
+ type: "POST",
6
+ url: cwp_top_ajaxload.ajaxurl,
7
+ data: {
8
+ action: 'remote_trigger',
9
+ security: cwp_top_ajaxload.ajaxnonce
10
+ },
11
+ });
12
+
13
  jQuery(".rop-not-version ").on("click" ,function(){
14
  console.log('not version')
15
  jQuery(".cwp_not_version_preview").show();
readme.txt CHANGED
@@ -1,22 +1,22 @@
1
  === Revive Old Post (Former Tweet Old Post) ===
2
- Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,Madalin_Themeisle, rsocial
3
  Tags:twitter, facebook, linkedin, automatic, tweet, share, wordpress, marketing, sharing, Tweet old post, Tweets,evergreen
4
  Requires at least: 2.7
5
  Tested up to: 4.6.1
6
  Stable tag: trunk
7
 
8
 
9
- Plugin to share about your old posts on twitter, facebook, linkedin to get more hits for them and keep them alive.
10
 
11
  == Description ==
12
 
13
  ### What the plugin can do ?
14
 
15
- This plugin helps you to keeps your old posts alive by sharing them and driving more traffic to them from social networks. It also helps you to promote your content. You can set time and no of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=readmetop&utm_medium=announce&utm_campaign=top">contact us</a>!
16
 
17
 
18
 
19
- **Revive Old Post provides following features**
20
 
21
  - Share new and old posts.
22
  - Choose the time between posts.
@@ -25,6 +25,8 @@ This plugin helps you to keeps your old posts alive by sharing them and driving
25
  - Include links back to your site.
26
  - Exclude categories
27
  - Exclude specific posts.
 
 
28
 
29
 
30
  > ### Why to upgrade to PRO ?
@@ -35,9 +37,10 @@ This plugin helps you to keeps your old posts alive by sharing them and driving
35
 
36
  > * Multiple Social Accounts
37
  > * Custom Post Types support
38
- > * Linkedin support
39
  > * Post with image
40
  > * Custom Schedule
 
41
  > * Post to Xing / Tumblr
42
 
43
  Some of you reported some scheduling issues, after investigation work looks like this is coming from some web hosts, make sure you check-out this post about <a rel="nofollow" href="http://www.codeinwp.com/blog/best-wordpress-shared-hosting-providers/">shared WordPress hosting</a>, which should help you pick a good one that works.
@@ -125,6 +128,12 @@ http://revive.social/plugins/revive-old-post
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
 
128
  **New in v7.4.0**
129
 
130
  * Added support for custom messages
1
  === Revive Old Post (Former Tweet Old Post) ===
2
+ Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,Madalin_Themeisle, rsocial, uriahs-victor
3
  Tags:twitter, facebook, linkedin, automatic, tweet, share, wordpress, marketing, sharing, Tweet old post, Tweets,evergreen
4
  Requires at least: 2.7
5
  Tested up to: 4.6.1
6
  Stable tag: trunk
7
 
8
 
9
+ Automatically share your old posts on Twitter, Facebook, LinkedIn. Get more visitors to your website and keep your content alive.
10
 
11
  == Description ==
12
 
13
  ### What the plugin can do ?
14
 
15
+ This plugin helps you keep your old posts alive by automatically sharing them and driving more traffic to them from Social Networks. It also helps you to promote your content. You can set sharing interval and number of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=readmetop&utm_medium=announce&utm_campaign=top">contact us</a>!
16
 
17
 
18
 
19
+ **Revive Old Post provides the following features**
20
 
21
  - Share new and old posts.
22
  - Choose the time between posts.
25
  - Include links back to your site.
26
  - Exclude categories
27
  - Exclude specific posts.
28
+ - Integrated with Google Analytics.
29
+ - Compatible with URL Shortners.
30
 
31
 
32
  > ### Why to upgrade to PRO ?
37
 
38
  > * Multiple Social Accounts
39
  > * Custom Post Types support
40
+ > * LinkedIn support
41
  > * Post with image
42
  > * Custom Schedule
43
+ > * Custom Share Messages
44
  > * Post to Xing / Tumblr
45
 
46
  Some of you reported some scheduling issues, after investigation work looks like this is coming from some web hosts, make sure you check-out this post about <a rel="nofollow" href="http://www.codeinwp.com/blog/best-wordpress-shared-hosting-providers/">shared WordPress hosting</a>, which should help you pick a good one that works.
128
 
129
  == Changelog ==
130
 
131
+ **New in v7.4.5**
132
+
133
+ * Improved schedule trigger for posts
134
+ * Fixed issue with plugin starting
135
+ * Fixed issue with post format
136
+
137
  **New in v7.4.0**
138
 
139
  * Added support for custom messages
screenshot-1.png CHANGED
Binary file
tweet-old-post.php CHANGED
@@ -3,8 +3,8 @@
3
  # Plugin Name: Revive Old Post (Former Tweet Old Post)
4
  # Plugin URI: https://revive.social/
5
  # Description: Wordpress plugin that helps you to keeps your old posts alive by sharing them and driving more traffic to them from twitter/facebook or linkedin. It also helps you to promote your content. You can set time and no of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
6
- # Author: reviev.social
7
- # Version: 7.4.0
8
  # Author URI: https://revive.social/
9
  # Text Domain: tweet-old-post
10
  # Domain Path: /languages
@@ -19,7 +19,7 @@ define("ROPJSFILE", plugins_url('js/master.js',__FILE__ ));
19
  define("ROPJSCOUNTDOWN", plugins_url('js/countdown.js',__FILE__ ));
20
  define("ROPPLUGINBASENAME", plugin_basename(__FILE__));
21
  define('ROP_TOP_FB_API_VERSION','v2.0');
22
- define('ROP_VERSION','7.4.0');
23
  // Added by Ash/Upwork
24
  define("ROP_ROOT", trailingslashit(plugins_url("", __FILE__)));
25
  // Added by Ash/Upwork
@@ -28,13 +28,6 @@ define("ROP_ROOT", trailingslashit(plugins_url("", __FILE__)));
28
  require_once(ROPPLUGINPATH."/inc/core.php");
29
  // Require core.
30
  require_once(ROPPLUGINPATH."/inc/exclude-posts.php");
31
- if (!class_exists('TAV_Remote_Notification_Client')) {
32
- require( ROPPLUGINPATH.'/inc/class-remote-notification-client.php' );
33
- }
34
- if (CWP_TOP_PRO)
35
- $notification = new TAV_Remote_Notification_Client( 37, 'a8be784b898fa2fb', 'https://themeisle.com?post_type=notification' );
36
- else
37
- $notification = new TAV_Remote_Notification_Client( 38, 'b7fbcc8d0c58614a', 'https://themeisle.com?post_type=notification' );
38
 
39
  // Clear scheduled tweets on plugin deactivation
40
  register_deactivation_hook(__FILE__, array($CWP_TOP_Core, 'deactivationHook'));
3
  # Plugin Name: Revive Old Post (Former Tweet Old Post)
4
  # Plugin URI: https://revive.social/
5
  # Description: Wordpress plugin that helps you to keeps your old posts alive by sharing them and driving more traffic to them from twitter/facebook or linkedin. It also helps you to promote your content. You can set time and no of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
6
+ # Author: revive.social
7
+ # Version: 7.4.5
8
  # Author URI: https://revive.social/
9
  # Text Domain: tweet-old-post
10
  # Domain Path: /languages
19
  define("ROPJSCOUNTDOWN", plugins_url('js/countdown.js',__FILE__ ));
20
  define("ROPPLUGINBASENAME", plugin_basename(__FILE__));
21
  define('ROP_TOP_FB_API_VERSION','v2.0');
22
+ define('ROP_VERSION','7.4.5');
23
  // Added by Ash/Upwork
24
  define("ROP_ROOT", trailingslashit(plugins_url("", __FILE__)));
25
  // Added by Ash/Upwork
28
  require_once(ROPPLUGINPATH."/inc/core.php");
29
  // Require core.
30
  require_once(ROPPLUGINPATH."/inc/exclude-posts.php");
 
 
 
 
 
 
 
31
 
32
  // Clear scheduled tweets on plugin deactivation
33
  register_deactivation_hook(__FILE__, array($CWP_TOP_Core, 'deactivationHook'));