Skip to content

Commit 07cc301

Browse files
committed
Merge pull request #42 from Codeinwp/development
Development
2 parents 592c83f + 51bb9b3 commit 07cc301

File tree

7 files changed

+168
-53
lines changed

7 files changed

+168
-53
lines changed

css/custom_dashboard_icon.css

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
@font-face { font-family: "rop-custom-icon-font";src:url("../assets/rop-custom-icon-font.eot");src:url("../assets/rop-custom-icon-font.eot?#iefix") format("embedded-opentype"), url("../assets/rop-custom-icon-font.woff") format("woff"), url("../assets/rop-custom-icon-font.ttf") format("truetype"), url("../assets/rop-custom-icon-font.svg#rop-custom-icon-font") format("svg");font-weight: normal;font-style: normal;}
2-
[data-icon]:before { font-family: "rop-custom-icon-font" !important;content: attr(data-icon);font-style: normal !important;font-weight: normal !important;font-variant: normal !important;text-transform: none !important;speak: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
3-
[class^="rop-icon-"]:before, [class*=" rop-icon-"]:before { font-family: "rop-custom-icon-font" !important;font-style: normal !important;font-weight: normal !important;font-variant: normal !important;text-transform: none !important;speak: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
4-
.rop-icon-dashboard:before { content: "a"; }
5-
#adminmenu #toplevel_page_TweetOldPost .wp-menu-image:before { font-family: "rop-custom-icon-font" !important; content: "a" !important; }
1+
@font-face {
2+
font-family: "rop-custom-icon-font";
3+
src: url("../assets/rop-custom-icon-font.eot");
4+
src: url("../assets/rop-custom-icon-font.eot?#iefix") format("embedded-opentype"), url("../assets/rop-custom-icon-font.woff") format("woff"), url("../assets/rop-custom-icon-font.ttf") format("truetype"), url("../assets/rop-custom-icon-font.svg#rop-custom-icon-font") format("svg");
5+
font-weight: normal;
6+
font-style: normal;
7+
}
8+
9+
10+
#adminmenu #toplevel_page_TweetOldPost .wp-menu-image:before {
11+
font-family: "rop-custom-icon-font" !important;
12+
content: "a" !important;
13+
}

css/style.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,3 +830,32 @@ button.login{
830830
font-weight: 500;
831831

832832
}
833+
834+
[data-icon]:before {
835+
font-family: "rop-custom-icon-font" !important;
836+
content: attr(data-icon);
837+
font-style: normal !important;
838+
font-weight: normal !important;
839+
font-variant: normal !important;
840+
text-transform: none !important;
841+
speak: none;
842+
line-height: 1;
843+
-webkit-font-smoothing: antialiased;
844+
-moz-osx-font-smoothing: grayscale;
845+
}
846+
847+
[class^="rop-icon-"]:before, [class*=" rop-icon-"]:before {
848+
font-family: "rop-custom-icon-font" !important;
849+
font-style: normal !important;
850+
font-weight: normal !important;
851+
font-variant: normal !important;
852+
text-transform: none !important;
853+
speak: none;
854+
line-height: 1;
855+
-webkit-font-smoothing: antialiased;
856+
-moz-osx-font-smoothing: grayscale;
857+
}
858+
859+
.rop-icon-dashboard:before {
860+
content: "a";
861+
}

inc/config.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
);
2020
$cwp_rop_remote_trigger_url = "http://portal.themeisle.com/remote_trigger";
2121
$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
2225
$cwp_top_global_schedule = array();
2326
if(!defined('ROP_PRO_VERSION'))
2427
$cwp_top_networks = array();

inc/core.php

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class CWP_TOP_Core {
2525
private $cwp_top_oauth_token;
2626
private $cwp_top_oauth_token_secret;
2727

28-
2928
public $users;
3029
private $user_info;
3130

@@ -735,7 +734,8 @@ public function tweetPost($finalTweet,$network = 'twitter',$post)
735734

736735
if(defined('ROP_IMAGE_CHECK')){
737736
$args = $CWP_TOP_Core_PRO->topProImage( $connection, $finalTweet, $post->ID, $network );
738-
if ( isset( $args['media[]'] ) ) {
737+
// Added by Ash/Upwork: !empty($args['media[]'])
738+
if ( isset( $args['media[]'] ) && !empty($args['media[]'])) {
739739
$image = array("media"=>$args['media[]']);
740740
$response = $connection->upload( 'https://upload.twitter.com/1.1/media/upload.json', $image );
741741
unset($args['media[]']);
@@ -2590,11 +2590,17 @@ public function loadAllHooks()
25902590

25912591
add_action('admin_init', array($this,'top_nag_ignore'));
25922592
add_action('admin_init', array($this,'clearOldCron'));
2593+
// Added by Ash/Upwork
2594+
add_filter('template_include', array($this, 'captureRewrites'), 1, 1);
2595+
add_filter('query_vars', array($this, 'addRewriteVars'));
2596+
// Added by Ash/Upwork
25932597

25942598
//filters
25952599

25962600
add_filter("rop_users_filter",array($this,"rop_users_filter_free"),1,1);
25972601

2602+
2603+
25982604
if(isset($_GET['debug']) ) {
25992605
//$this->getNextTweetTime('twitter');
26002606
//$this->tweetOldPost("twitter"); global $CWP_TOP_Core_PRO;
@@ -2605,6 +2611,53 @@ public function loadAllHooks()
26052611

26062612
}
26072613

2614+
// Added by Ash/Upwork
2615+
function addRewriteVars($vars){
2616+
global $cwp_rop_self_endpoint;
2617+
$vars[] = $cwp_rop_self_endpoint;
2618+
return $vars;
2619+
}
2620+
2621+
function captureRewrites($template){
2622+
global $wp_query, $cwp_rop_self_endpoint;
2623+
if (get_query_var($cwp_rop_self_endpoint, false)){
2624+
$this->processServerRequest();
2625+
return null;
2626+
}
2627+
return $template;
2628+
}
2629+
2630+
private function processServerRequest(){
2631+
if(
2632+
!get_option("cwp_rop_remote_trigger", false)
2633+
||
2634+
!get_option("cwp_topnew_active_status", false)
2635+
) return;
2636+
2637+
$crons = _get_cron_array();
2638+
$this->clearScheduledTweets();
2639+
2640+
foreach($crons as $time => $cron){
2641+
foreach($cron as $hook => $dings){
2642+
if(strpos($hook, "roptweetcron") === FALSE) continue;
2643+
2644+
$network = trim(str_replace("roptweetcron", "", $hook));
2645+
if($time > $this->getTime()){
2646+
// echo "FUTURE $hook for $time (current time is " . $this->getTime() . ") <br>";
2647+
wp_schedule_single_event($time, $network.'roptweetcron', array($network));
2648+
continue;
2649+
}
2650+
2651+
//echo "NOW $hook for $network for $time (current time is " . $this->getTime() . ") <br>";
2652+
2653+
foreach($dings as $hash => $data){
2654+
do_action($hook, $network);
2655+
}
2656+
}
2657+
}
2658+
}
2659+
// Added by Ash/Upwork
2660+
26082661
public function rop_users_filter_free($users){
26092662

26102663
if(!is_array($users)) $users = array();
@@ -2633,8 +2686,16 @@ public function remoteTrigger($status = ""){
26332686
if(!empty($state) &&( $state == "on" || $state == "off")){
26342687

26352688
update_option("cwp_rop_remote_trigger",$state);
2636-
$this->sendRemoteTrigger($state);
2637-
2689+
// Added by Ash/Upwork
2690+
$response = $this->sendRemoteTrigger($state);
2691+
if($response){
2692+
$error = __('Error: ','tweet-old-post') . $response;
2693+
self::addNotice($error, 'error');
2694+
update_option("cwp_rop_remote_trigger", "off");
2695+
// if you want to show the user an alert, make showAlert true
2696+
wp_send_json_error(array("error" => $error, "showAlert" => false));
2697+
}
2698+
// Added by Ash/Upwork
26382699
}
26392700

26402701
if(empty($status)) die();
@@ -2645,7 +2706,7 @@ public function sendRemoteTrigger($state){
26452706
global $cwp_rop_remote_trigger_url;
26462707
$state = ($state == "on") ? "yes" : "no";
26472708

2648-
wp_remote_post( $cwp_rop_remote_trigger_url, array(
2709+
$response = wp_remote_post( $cwp_rop_remote_trigger_url, array(
26492710
'method' => 'POST',
26502711
'timeout' => 1,
26512712
'redirection' => 5,
@@ -2657,6 +2718,12 @@ public function sendRemoteTrigger($state){
26572718
)
26582719
);
26592720

2721+
// Added by Ash/Upwork
2722+
if(is_wp_error($response)){
2723+
return $response->get_error_message();
2724+
}
2725+
return null;
2726+
// Added by Ash/Upwork
26602727
}
26612728

26622729
public function betaUserTrigger($status = ""){
@@ -2883,11 +2950,9 @@ public function shortenURL($url, $service, $id, $bitly_key, $bitly_user) {
28832950

28842951
public function rop_load_dashboard_icon()
28852952
{
2886-
wp_register_style( 'rop_custom_dashboard_icon', ROPCUSTOMDASHBOARDICON, false, time() );
2887-
$screen = get_current_screen();
2888-
if($screen->base == "toplevel_page_TweetOldPost"){
2889-
wp_enqueue_style( 'rop_custom_dashboard_icon' );
2890-
}
2953+
wp_register_style( 'rop_custom_dashboard_icon', ROPCUSTOMDASHBOARDICON, false, ROP_VERSION );
2954+
wp_enqueue_style( 'rop_custom_dashboard_icon' );
2955+
28912956
}
28922957

28932958
}

js/master.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,30 @@ jQuery(document).ready(function(){
2020
return false;
2121
});
2222
jQuery("#reset-settings").click(function(e) {
23-
e.preventDefault();
24-
startAjaxIntro();
23+
if(confirm('Are you sure you want to reset all settings? You can\'t undo this action.')) {
24+
e.preventDefault();
25+
startAjaxIntro();
2526

26-
jQuery.ajax({
27-
type: "POST",
28-
url: cwp_top_ajaxload.ajaxurl,
29-
data: {
30-
action: 'reset_options'
31-
},
32-
success: function(response) {
33-
console.log("Success: " + response);
34-
//jQuery("#cwp_top_form").cwpTopUpdateForm();
35-
location.reload();
36-
endAjaxIntro();
37-
},
38-
error: function(response) {
39-
console.log("Error: "+ response);
40-
}
41-
});
27+
jQuery.ajax({
28+
type: "POST",
29+
url: cwp_top_ajaxload.ajaxurl,
30+
data: {
31+
action: 'reset_options'
32+
},
33+
success: function(response) {
34+
console.log("Success: " + response);
35+
//jQuery("#cwp_top_form").cwpTopUpdateForm();
36+
location.reload();
37+
endAjaxIntro();
38+
},
39+
error: function(response) {
40+
console.log("Error: "+ response);
41+
}
42+
});
4243

43-
endAjaxIntro();
44-
return false;
44+
endAjaxIntro();
45+
return false;
46+
}
4547
});
4648
jQuery("#linkedin-login").on("click",function(){
4749
if(jQuery(this).hasClass("pro-only")) return false;
@@ -101,6 +103,11 @@ jQuery(document).ready(function(){
101103
},
102104
success: function(response) {
103105
console.log(response);
106+
if(!response.success){
107+
if(response.data && response.data.showAlert) alert(response.data.error);
108+
state = "off";
109+
th.addClass("off").removeClass("on");
110+
}
104111
},
105112
error: function(response) {
106113
console.log("Error: "+ response);

readme.txt

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,14 @@
22
Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,Madalin_Themeisle
33
Tags: admin, ajax, plugin, twitter, facebook, linkedin, automatic, tweet, share, wordpress, marketing, sharing, Tweet old post, Tweets,evergreen, Promote old post by tweeting about them, Twitter, Auto Tweet, Hashtags, Twitter Hashtags, Tweet Posts, Tweet, Post Tweets, Wordpress Twitter Plugin, Twitter Plugin, Tweet Selected Posts, Twitter, Promote Posts, Tweet Random Post, Share Post, Promote Post, Post Tweets, Wordpress Twitter, Drive Traffic, Tweet Selected Posts
44
Requires at least: 2.7
5-
Tested up to: 4.2.2
5+
Tested up to: 4.4.1
66
Stable tag: trunk
77

88

99
Plugin to share about your old posts on twitter, facebook, linkedin to get more hits for them and keep them alive.
1010

1111
== Description ==
1212

13-
> If you want to see a live demo of the plugin you can check <a href="http://www.youtube.com/watch?v=YOnlWmyO3VU">http://www.youtube.com/watch?v=YOnlWmyO3VU</a>.
14-
15-
### Why to upgrade to PRO ?
16-
17-
Using the <a rel="friend" href="https://themeisle.com/plugins/tweet-old-post-pro/">PRO version</a> of the plugin you will unleash the most important functionality : images in tweets . Using those your RT/CTR will go crazy.
18-
19-
Other notable features :
20-
21-
* Multiple Social Accounts
22-
* Custom Post Types support
23-
* Linkedin support
24-
* Post with image
25-
* Custom Schedule
26-
* Post to Xing / Tumblr
27-
2813
### What the plugin can do ?
2914

3015
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="https://themeisle.com/contact/?utm_source=readmetop&utm_medium=announce&utm_campaign=top">contact us</a>!
@@ -44,7 +29,20 @@ ThemeIsle is a Codeinwp product where we also offer a <a href="http://www.codein
4429
- Exclude categories
4530
- Exclude specific posts.
4631

32+
If you want to see a live demo of the plugin you can check <a href="http://www.youtube.com/watch?v=YOnlWmyO3VU">http://www.youtube.com/watch?v=YOnlWmyO3VU</a>.
4733

34+
### Why to upgrade to PRO ?
35+
36+
> Using the <a rel="friend" href="https://themeisle.com/plugins/tweet-old-post-pro/">PRO version</a> of the plugin you will unleash the most important functionality : images in tweets . Using those your RT/CTR will go crazy.
37+
38+
Other notable features :
39+
40+
* Multiple Social Accounts
41+
* Custom Post Types support
42+
* Linkedin support
43+
* Post with image
44+
* Custom Schedule
45+
* Post to Xing / Tumblr
4846
= Translations =
4947

5048
* sk_SK translation by Patrik Žec (PATWIST) of http://patwist.com
@@ -119,6 +117,11 @@ https://themeisle.com/plugins/tweet-old-post-lite/
119117

120118
== Changelog ==
121119

120+
**New in v7.1**
121+
122+
* Fixed inconsistency in the schedule. Now posting is more accurate.
123+
* Fixed image sharing issue which was not working for some server configuration
124+
122125

123126
**New in v7.0.8**
124127
* Added facebook tutorial for facebook share.

tweet-old-post.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Plugin URI: https://themeisle.com/plugins/tweet-old-post-lite/
55
# 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="https://themeisle.com/contact/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
66
# Author: ThemeIsle
7-
# Version: 7.0.8
7+
# Version: 7.1
88
# Author URI: https://themeisle.com/
99
# Text Domain: tweet-old-post
1010
# Domain Path: /languages
@@ -18,7 +18,7 @@
1818
define("ROPJSCOUNTDOWN", plugins_url('js/countdown.js',__FILE__ ));
1919
define("ROPPLUGINBASENAME", plugin_basename(__FILE__));
2020
define('ROP_TOP_FB_API_VERSION','v2.0');
21-
define('ROP_VERSION','7.0.8');
21+
define('ROP_VERSION','7.1');
2222
// Require core.
2323
require_once(ROPPLUGINPATH."/inc/core.php");
2424
// Require core.

0 commit comments

Comments
 (0)