Version Description
Download this release
Release Info
Developer | codeinwp |
Plugin | Revive Old Posts – Auto Post to Social Media |
Version | 6.9.6.3 |
Comparing to | |
See all releases |
Code changes from version 6.8.4-back to 6.9.6.3
- css/custom_dashboard_icon.css +5 -5
- css/style.css +465 -19
- img/on-off-button.png +0 -0
- img/pro-version-badge.png +0 -0
- img/sib.png +0 -0
- inc/class-remote-notification-client.php +380 -380
- inc/config.php +572 -60
- inc/core.php +1631 -804
- inc/exclude-posts.php +220 -246
- inc/oAuth/OAuth.php +50 -13
- inc/oAuth/twitteroauth.php +27 -22
- inc/view-accounts.php +98 -0
- inc/view-exclude.php +2 -23
- inc/view-postformat.php +45 -0
- inc/view-postschedule.php +84 -0
- inc/view.php +262 -293
- js/countdown.js +256 -5
- js/master.js +563 -278
- readme.txt +54 -18
- tweet-old-post.php +39 -39
css/custom_dashboard_icon.css
CHANGED
@@ -1,5 +1,5 @@
|
|
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 { 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; }
|
css/style.css
CHANGED
@@ -11,13 +11,13 @@ strong {
|
|
11 |
* { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; }
|
12 |
|
13 |
/* Main Wrapper */
|
14 |
-
.cwp_top_wrapper {
|
15 |
|
16 |
/* Tweet Old Post Status */
|
17 |
.cwp_top_wrapper .cwp_top_status { }
|
18 |
.cwp_top_wrapper .cwp_top_status p { margin: 0; padding: 10px; text-align: center; font-family: "Roboto", sans-serif; color:#fff; }
|
19 |
.cwp_top_wrapper .cwp_top_status p.active { background: rgb(185, 243, 203);box-shadow: inset 0px 0px 6px rgba(8, 61, 8, 0.1);border-top: 1px solid rgba(97, 209, 101, 0.4);color: #218618;font-weight: bold;text-shadow: 0px 1px 0px rgba(255,255,255,1.3);border-bottom: 1px solid #fff; }
|
20 |
-
.cwp_top_wrapper .cwp_top_status p.inactive { background: rgb(240, 240, 240);
|
21 |
.cwp_top_wrapper a {
|
22 |
text-decoration: none!important;
|
23 |
}
|
@@ -45,7 +45,7 @@ strong {
|
|
45 |
/* Logged In User */
|
46 |
.cwp_top_container .user_details { height: 35px; border: 1px solid #fff; float: left; overflow: hidden; background:#fff; border: 1px solid #ddd; border-radius: 5px; margin-right: 10px;}
|
47 |
.cwp_top_container .user_details .user_avatar { float: left; width: 35px;}
|
48 |
-
.cwp_top_container .user_details .user_avatar img { width: 100%; }
|
49 |
.cwp_top_container .user_details .user_name { float: left; font-family: Roboto, "Helvetica Neue", HelveticaNeue, sans-serif; font-weight: 400; font-size:14px; line-height: 2.4; padding: 0px 10px; color:#5C5C5C; }
|
50 |
.cwp_top_container .user_details .remove_user { display:block; width: 35px; height: 35px; float: left; border-left: 1px solid #ddd; }
|
51 |
.cwp_top_container .user_details .remove_user .logout_user { display: block; width: 100%; height: 100%; background:url("../img/remove_account.png") no-repeat center center, #fff; }
|
@@ -67,14 +67,14 @@ strong {
|
|
67 |
|
68 |
/* Header Actions */
|
69 |
.cwp_top_wrapper #cwp_top_header .cwp_top_actions { float: right; margin-right: 6px; }
|
70 |
-
.cwp_top_wrapper #cwp_top_header .tweet-about-it { background:#52c4ef; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; text-shadow: 0px 1px 0px #33a4ce; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
71 |
.cwp_top_wrapper #cwp_top_header .tweet-about-it span { background:url("../img/twitter_icon.png") no-repeat center center, #3eaed8; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
72 |
-
.cwp_top_wrapper #cwp_top_header .leave-a-review { background:#f9866b; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; text-shadow: 0px 1px 0px #e46b3d; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
73 |
.cwp_top_wrapper #cwp_top_header .leave-a-review span { background:url("../img/review_icon.png") no-repeat center center, #f16848; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
74 |
|
75 |
/* Container and form styles */
|
76 |
.cwp_top_wrapper .cwp_top_container { background:#f9f9f9; border-bottom: 5px solid #52aae2; position: relative;}
|
77 |
-
.cwp_top_wrapper .cwp_top_container form { width:
|
78 |
.cwp_top_wrapper .option { width: 100%; margin: 15px 0px; }
|
79 |
.cwp_top_wrapper .option .left { float: left; width: 45%; }
|
80 |
.cwp_top_wrapper .option .left .select-all { float: right; background: none; border: none; background:#ddd; border-radius: 3px; padding: 5px 10px; }
|
@@ -98,39 +98,40 @@ strong {
|
|
98 |
.cwp_top_wrapper .cwp_top_container .sidebar ul li { display: block; }
|
99 |
.cwp_top_wrapper .cwp_top_container .sidebar ul li.upgrade a { display: block; background:url("../img/upgrade-top.png") no-repeat top left; width: 270px; height: 101px; text-indent: -9999px; }
|
100 |
.cwp_top_wrapper .cwp_top_container .sidebar ul li.readythemes a { display: block; background:url("../img/top_banner_themeisle.png") no-repeat left; width: 270px; height: 101px; text-indent: -9999px; }
|
|
|
101 |
.cwp_top_wrapper .cwp_top_container .sidebar ul li.affiliate-readythemes a { display: block; background:url("../img/affiliate.png") no-repeat left; width: 270px; height: 101px; text-indent: -9999px; }
|
102 |
|
103 |
/* Footer Styles */
|
104 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer { width: 100%; background:#fff; padding: 20px 10px; border-top: 1px solid #d4d4d4;}
|
105 |
-
.cwp_top_wrapper .
|
106 |
-
.cwp_top_wrapper .
|
107 |
|
108 |
/* Tweet Now Button Style */
|
109 |
-
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .tweet-now { background:#52c4ef; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
110 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .tweet-now span { background:url("../img/twitter_icon.png") no-repeat center center, #3eaed8; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
111 |
.top_close_popup {margin-left:37%;float:left;}
|
112 |
/* Stop Tweet Button Styles */
|
113 |
-
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .stop-tweet-old-post { background:#f9866b; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
114 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .stop-tweet-old-post span { background:url("../img/twitter_icon.png") no-repeat center center, #f16848; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
115 |
|
116 |
/* Tweet Now Button Style */
|
117 |
-
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .see-sample-tweet { background:#52c4ef; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
118 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .see-sample-tweet span { background:url("../img/twitter_icon.png") no-repeat center center, #3eaed8; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
119 |
|
120 |
/* Reset Settings Button Styles */
|
121 |
-
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .reset-settings { background:#f9866b; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
122 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .reset-settings span { background:url("../img/reset_icon.png") no-repeat center center, #f16848; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
123 |
-
.cwp_top_wrapper
|
124 |
|
125 |
/* Sample Tweet Preview Modal */
|
126 |
.cwp_top_wrapper .cwp_lkapp_preview,.cwp_top_wrapper .cwp_user_pages { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background:rgba(0,0,0,0.2); display: none; }
|
127 |
|
128 |
.cwp_top_wrapper .cwp_fbapp_preview,.cwp_top_wrapper .cwp_user_pages { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background:rgba(0,0,0,0.2); display: none; }
|
129 |
.cwp_top_wrapper .cwp_sample_tweet_preview_inner h2 { text-align: center; font-weight: bold;color:#7d7d7d; font-family: "HelveticaNeue", "Helvetica Neue", sans-serif; }
|
130 |
-
.cwp_top_wrapper .cwp_sample_tweet_preview_inner { background:#fff; width: 80%; margin: 0 auto; margin-top:
|
131 |
.cwp_top_wrapper .cwp_sample_tweet_preview_inner .sample_tweet { min-height:60px; display: block; width: 100%; border: 1px solid #e8e8e8; padding: 10px; border-radius: 5px; font-family: "Helvetica Neue", HelveticaNeue, sans-serif; font-size: 14px;}
|
132 |
.cwp_top_wrapper .cwp_sample_tweet_preview_inner .sample_tweet a { text-decoration: none; }
|
133 |
-
.cwp_top_wrapper .cwp_sample_tweet_preview_inner button { display: block; margin-top: 17px; background:#52c4ef; border: none; border-radius: 3px; padding: 5px 10px; color:#fff; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; }
|
134 |
.cwp_top_wrapper .cwp_sample_tweet_preview_inner button:hover { cursor: pointer; }
|
135 |
|
136 |
.cwp_top_wrapper .cwp_sample_tweet_preview { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background:rgba(0,0,0,0.2); display: none; }
|
@@ -160,7 +161,7 @@ strong {
|
|
160 |
float: left;
|
161 |
}
|
162 |
.cwp_user_pages .page_category {
|
163 |
-
|
164 |
color:grey;
|
165 |
}
|
166 |
.top_preview {
|
@@ -209,9 +210,6 @@ float: left;}
|
|
209 |
width:100%;
|
210 |
border-right: none;
|
211 |
}
|
212 |
-
.cwp_top_wrapper .cwp_top_container .sidebar {
|
213 |
-
display: none;
|
214 |
-
}
|
215 |
|
216 |
|
217 |
}
|
@@ -220,3 +218,451 @@ float: left;}
|
|
220 |
display: none;
|
221 |
}
|
222 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
* { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; }
|
12 |
|
13 |
/* Main Wrapper */
|
14 |
+
.cwp_top_wrapper { width: 1080px;}
|
15 |
|
16 |
/* Tweet Old Post Status */
|
17 |
.cwp_top_wrapper .cwp_top_status { }
|
18 |
.cwp_top_wrapper .cwp_top_status p { margin: 0; padding: 10px; text-align: center; font-family: "Roboto", sans-serif; color:#fff; }
|
19 |
.cwp_top_wrapper .cwp_top_status p.active { background: rgb(185, 243, 203);box-shadow: inset 0px 0px 6px rgba(8, 61, 8, 0.1);border-top: 1px solid rgba(97, 209, 101, 0.4);color: #218618;font-weight: bold;text-shadow: 0px 1px 0px rgba(255,255,255,1.3);border-bottom: 1px solid #fff; }
|
20 |
+
.cwp_top_wrapper .cwp_top_status p.inactive { background: rgb(240, 240, 240);border-top: 1px solid rgba(255,255,255,0.4);color: #494949;font-weight: bold;text-shadow: 0px 1px 0px rgba(255,255,255,1.3);border-bottom: 1px solid #E2E2E2; }
|
21 |
.cwp_top_wrapper a {
|
22 |
text-decoration: none!important;
|
23 |
}
|
45 |
/* Logged In User */
|
46 |
.cwp_top_container .user_details { height: 35px; border: 1px solid #fff; float: left; overflow: hidden; background:#fff; border: 1px solid #ddd; border-radius: 5px; margin-right: 10px;}
|
47 |
.cwp_top_container .user_details .user_avatar { float: left; width: 35px;}
|
48 |
+
.cwp_top_container .user_details .user_avatar img { width: 100%; }
|
49 |
.cwp_top_container .user_details .user_name { float: left; font-family: Roboto, "Helvetica Neue", HelveticaNeue, sans-serif; font-weight: 400; font-size:14px; line-height: 2.4; padding: 0px 10px; color:#5C5C5C; }
|
50 |
.cwp_top_container .user_details .remove_user { display:block; width: 35px; height: 35px; float: left; border-left: 1px solid #ddd; }
|
51 |
.cwp_top_container .user_details .remove_user .logout_user { display: block; width: 100%; height: 100%; background:url("../img/remove_account.png") no-repeat center center, #fff; }
|
67 |
|
68 |
/* Header Actions */
|
69 |
.cwp_top_wrapper #cwp_top_header .cwp_top_actions { float: right; margin-right: 6px; }
|
70 |
+
.cwp_top_wrapper #cwp_top_header .tweet-about-it { background:#52c4ef; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; text-shadow: 0px 1px 0px #33a4ce; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
71 |
.cwp_top_wrapper #cwp_top_header .tweet-about-it span { background:url("../img/twitter_icon.png") no-repeat center center, #3eaed8; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
72 |
+
.cwp_top_wrapper #cwp_top_header .leave-a-review { background:#f9866b; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; text-shadow: 0px 1px 0px #e46b3d; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
73 |
.cwp_top_wrapper #cwp_top_header .leave-a-review span { background:url("../img/review_icon.png") no-repeat center center, #f16848; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
74 |
|
75 |
/* Container and form styles */
|
76 |
.cwp_top_wrapper .cwp_top_container { background:#f9f9f9; border-bottom: 5px solid #52aae2; position: relative;}
|
77 |
+
.cwp_top_wrapper .cwp_top_container form { width: 100%; float: left; /* border-right: 1px solid #d4d4d4;*/ }
|
78 |
.cwp_top_wrapper .option { width: 100%; margin: 15px 0px; }
|
79 |
.cwp_top_wrapper .option .left { float: left; width: 45%; }
|
80 |
.cwp_top_wrapper .option .left .select-all { float: right; background: none; border: none; background:#ddd; border-radius: 3px; padding: 5px 10px; }
|
98 |
.cwp_top_wrapper .cwp_top_container .sidebar ul li { display: block; }
|
99 |
.cwp_top_wrapper .cwp_top_container .sidebar ul li.upgrade a { display: block; background:url("../img/upgrade-top.png") no-repeat top left; width: 270px; height: 101px; text-indent: -9999px; }
|
100 |
.cwp_top_wrapper .cwp_top_container .sidebar ul li.readythemes a { display: block; background:url("../img/top_banner_themeisle.png") no-repeat left; width: 270px; height: 101px; text-indent: -9999px; }
|
101 |
+
.cwp_top_wrapper .cwp_top_container .sidebar ul li.sib a { display: block; background:url("../img/sib.png") no-repeat left; width: 270px; height: 225px; text-indent: -9999px; }
|
102 |
.cwp_top_wrapper .cwp_top_container .sidebar ul li.affiliate-readythemes a { display: block; background:url("../img/affiliate.png") no-repeat left; width: 270px; height: 101px; text-indent: -9999px; }
|
103 |
|
104 |
/* Footer Styles */
|
105 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer { width: 100%; background:#fff; padding: 20px 10px; border-top: 1px solid #d4d4d4;}
|
106 |
+
.cwp_top_wrapper .update-options { background:#707070; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
107 |
+
.cwp_top_wrapper .update-options span { background:url("../img/update_icon.png") no-repeat center center, #464646; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
108 |
|
109 |
/* Tweet Now Button Style */
|
110 |
+
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .tweet-now { background:#52c4ef; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
111 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .tweet-now span { background:url("../img/twitter_icon.png") no-repeat center center, #3eaed8; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
112 |
.top_close_popup {margin-left:37%;float:left;}
|
113 |
/* Stop Tweet Button Styles */
|
114 |
+
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .stop-tweet-old-post { background:#f9866b; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
115 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .stop-tweet-old-post span { background:url("../img/twitter_icon.png") no-repeat center center, #f16848; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
116 |
|
117 |
/* Tweet Now Button Style */
|
118 |
+
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .see-sample-tweet { background:#52c4ef; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
119 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .see-sample-tweet span { background:url("../img/twitter_icon.png") no-repeat center center, #3eaed8; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
120 |
|
121 |
/* Reset Settings Button Styles */
|
122 |
+
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .reset-settings { background:#f9866b; text-decoration: none; border-radius: 3px; display: block; height: 30px; border-radius: 3px; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; line-height: 2.3; padding-right: 10px; display:inline-block; margin-top: 14px; margin-right: 5px; }
|
123 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer .reset-settings span { background:url("../img/reset_icon.png") no-repeat center center, #f16848; width: 30px; height: 30px; display: block; float: left; border-radius: 3px 0px 0px 3px; margin-right: 10px; }
|
124 |
+
.cwp_top_wrapper a { margin: 0 !important; padding: 0; margin-right: 10px !important; margin-bottom:10px!important;}
|
125 |
|
126 |
/* Sample Tweet Preview Modal */
|
127 |
.cwp_top_wrapper .cwp_lkapp_preview,.cwp_top_wrapper .cwp_user_pages { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background:rgba(0,0,0,0.2); display: none; }
|
128 |
|
129 |
.cwp_top_wrapper .cwp_fbapp_preview,.cwp_top_wrapper .cwp_user_pages { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background:rgba(0,0,0,0.2); display: none; }
|
130 |
.cwp_top_wrapper .cwp_sample_tweet_preview_inner h2 { text-align: center; font-weight: bold;color:#7d7d7d; font-family: "HelveticaNeue", "Helvetica Neue", sans-serif; }
|
131 |
+
.cwp_top_wrapper .cwp_sample_tweet_preview_inner { background:#fff; width: 80%; margin: 0 auto; margin-top: 109px; padding: 20px; border-radius: 5px;box-shadow: 0px 5px 5px rgba(0,0,0,0.1); }
|
132 |
.cwp_top_wrapper .cwp_sample_tweet_preview_inner .sample_tweet { min-height:60px; display: block; width: 100%; border: 1px solid #e8e8e8; padding: 10px; border-radius: 5px; font-family: "Helvetica Neue", HelveticaNeue, sans-serif; font-size: 14px;}
|
133 |
.cwp_top_wrapper .cwp_sample_tweet_preview_inner .sample_tweet a { text-decoration: none; }
|
134 |
+
.cwp_top_wrapper .cwp_sample_tweet_preview_inner button { display: block; margin-top: 17px; background:#52c4ef; border: none; border-radius: 3px; padding: 5px 10px; margin-left:10px;margin-right:10px;color:#fff; font-family: "Open Sans", sans-serif; color:#fff; text-transform: uppercase; font-weight: bold; }
|
135 |
.cwp_top_wrapper .cwp_sample_tweet_preview_inner button:hover { cursor: pointer; }
|
136 |
|
137 |
.cwp_top_wrapper .cwp_sample_tweet_preview { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background:rgba(0,0,0,0.2); display: none; }
|
161 |
float: left;
|
162 |
}
|
163 |
.cwp_user_pages .page_category {
|
164 |
+
|
165 |
color:grey;
|
166 |
}
|
167 |
.top_preview {
|
210 |
width:100%;
|
211 |
border-right: none;
|
212 |
}
|
|
|
|
|
|
|
213 |
|
214 |
|
215 |
}
|
218 |
display: none;
|
219 |
}
|
220 |
}
|
221 |
+
|
222 |
+
/* Tabbed Nav */
|
223 |
+
#cwp_top_tabs ul#tabs_menu {
|
224 |
+
margin: 0;
|
225 |
+
margin-bottom: -1px;
|
226 |
+
}
|
227 |
+
|
228 |
+
#cwp_top_tabs ul#tabs_menu li {
|
229 |
+
display: inline-block;
|
230 |
+
font-weight: bold;
|
231 |
+
font-family: "Roboto",sans-serif;
|
232 |
+
font-size: 13px;
|
233 |
+
padding: 15px;
|
234 |
+
line-height: 1;
|
235 |
+
border: 1px solid #EAEAEA;
|
236 |
+
border-bottom: none;
|
237 |
+
margin: 0;
|
238 |
+
}
|
239 |
+
|
240 |
+
#cwp_top_tabs ul#tabs_menu li.active,
|
241 |
+
#cwp_top_tabs ul#tabs_menu li:hover {
|
242 |
+
background: none repeat scroll 0% 0% #FFF;
|
243 |
+
cursor: pointer;
|
244 |
+
border: 1px solid #EAEAEA;
|
245 |
+
border-bottom: none;
|
246 |
+
}
|
247 |
+
|
248 |
+
#cwp_top_tabs div.tab {
|
249 |
+
display: none;
|
250 |
+
width: 100%;
|
251 |
+
float: left;
|
252 |
+
background: #FFF;
|
253 |
+
border: 1px solid #EAEAEA;
|
254 |
+
border-bottom: 0;
|
255 |
+
}
|
256 |
+
.tab .cwp_top_tabs_vertical .tab-vertical {
|
257 |
+
width:80%;
|
258 |
+
float:left;
|
259 |
+
|
260 |
+
}
|
261 |
+
#cwp_top_tabs div.tab.active {
|
262 |
+
display: block;
|
263 |
+
}
|
264 |
+
.cwp_top_tabs_vertical {
|
265 |
+
display:block;
|
266 |
+
width:100%;
|
267 |
+
|
268 |
+
}
|
269 |
+
.cwp_top_tabs_vertical .tab-vertical.active{
|
270 |
+
display:block;
|
271 |
+
|
272 |
+
}
|
273 |
+
.cwp_top_tabs_vertical .tab-vertical{
|
274 |
+
width:100%;
|
275 |
+
display:none;
|
276 |
+
|
277 |
+
}
|
278 |
+
.tab.active .cwp_top_tabs_vertical form {
|
279 |
+
width:80% ;
|
280 |
+
float:left;
|
281 |
+
|
282 |
+
|
283 |
+
}
|
284 |
+
.cwp_top_tabs_vertical .cwp_top_tabs_btns li:hover:not(.not-tab),
|
285 |
+
.cwp_top_tabs_vertical .cwp_top_tabs_btns li.active:not(.not-tab){
|
286 |
+
background:#fff;
|
287 |
+
|
288 |
+
}
|
289 |
+
.cwp_top_tabs_vertical .cwp_top_tabs_btns li.not-tab{
|
290 |
+
cursor: default;
|
291 |
+
|
292 |
+
}
|
293 |
+
.cwp_top_tabs_vertical .cwp_top_tabs_btns li{
|
294 |
+
cursor: pointer;
|
295 |
+
display: inline-block;
|
296 |
+
font-weight: bold;
|
297 |
+
font-family: "Roboto",sans-serif;
|
298 |
+
font-size: 13px;
|
299 |
+
padding: 15px;
|
300 |
+
line-height: 1;
|
301 |
+
width:100%;
|
302 |
+
margin: 0;
|
303 |
+
text-transform: capitalize;
|
304 |
+
|
305 |
+
}
|
306 |
+
.cwp_top_tabs_vertical .cwp_top_tabs_btns{
|
307 |
+
width:20%;
|
308 |
+
padding-top:30px;
|
309 |
+
float:left;
|
310 |
+
margin-top:0px;
|
311 |
+
padding-bottom:20px;
|
312 |
+
background: none repeat scroll 0% 0% #F0F0F0;
|
313 |
+
cursor: pointer;
|
314 |
+
border-right: 1px solid #ddd;
|
315 |
+
border-bottom: 1px solid #ddd;
|
316 |
+
border-left: 1px solid #ddd;
|
317 |
+
}
|
318 |
+
.cwp-top-premium-placeholder{
|
319 |
+
text-align:center;
|
320 |
+
padding-top:20px;
|
321 |
+
font-size:20px;
|
322 |
+
text-align: center;
|
323 |
+
}
|
324 |
+
.cwp-according-item {
|
325 |
+
margin:2%;
|
326 |
+
|
327 |
+
}
|
328 |
+
.cwp-according-item.active .cwp-according-body{
|
329 |
+
display:block;
|
330 |
+
|
331 |
+
}
|
332 |
+
.cwp-according-item .cwp-according-body{
|
333 |
+
display:none;
|
334 |
+
}
|
335 |
+
.cwp-according-item .cwp-according-body {
|
336 |
+
background:#f0f0f0;
|
337 |
+
width:96%;
|
338 |
+
padding:2%;
|
339 |
+
|
340 |
+
}
|
341 |
+
.cwp-according-item .cwp-according-header:hover,
|
342 |
+
.cwp-according-item.active .cwp-according-header{
|
343 |
+
|
344 |
+
background:#444;
|
345 |
+
color:#f0f0f0;
|
346 |
+
|
347 |
+
}
|
348 |
+
.cwp-according-item.active .cwp-according-header:before,
|
349 |
+
.cwp-according-item:hover .cwp-according-header:before{
|
350 |
+
border-color:#fff;
|
351 |
+
}
|
352 |
+
.cwp-according-item.active .cwp-according-header span:before,
|
353 |
+
.cwp-according-item:hover .cwp-according-header span:before {
|
354 |
+
|
355 |
+
content:"";
|
356 |
+
position:absolute;
|
357 |
+
background:#fff;
|
358 |
+
top: 18px;
|
359 |
+
left: 50px;
|
360 |
+
border-radius:50%;
|
361 |
+
width:10px;
|
362 |
+
height:10px;
|
363 |
+
}
|
364 |
+
.cwp-according-item .cwp-according-header:before{
|
365 |
+
content:"";
|
366 |
+
position:absolute;
|
367 |
+
border:4px solid #444;
|
368 |
+
top: 9px;
|
369 |
+
left: 41px;
|
370 |
+
border-radius:50%;
|
371 |
+
width:20px;
|
372 |
+
height:20px;
|
373 |
+
|
374 |
+
}
|
375 |
+
.cwp-according-item .cwp-according-header{
|
376 |
+
width:96%;
|
377 |
+
position:relative;
|
378 |
+
display:block;
|
379 |
+
background:#f0f0f0;
|
380 |
+
text-align: center;
|
381 |
+
color:#444;
|
382 |
+
font-size: 20px;
|
383 |
+
cursor:pointer;
|
384 |
+
padding: 14px;
|
385 |
+
|
386 |
+
}
|
387 |
+
.cwp-schedule-days li:first-child{
|
388 |
+
border-bottom-left-radius: 4px;
|
389 |
+
border-top-left-radius: 4px;
|
390 |
+
}
|
391 |
+
.cwp-schedule-days li:last-child{
|
392 |
+
border-bottom-right-radius: 8px;
|
393 |
+
border-top-right-radius: 8px;
|
394 |
+
|
395 |
+
}
|
396 |
+
.cwp-schedule-days li:hover {
|
397 |
+
color: #f0f0f0;
|
398 |
+
background: rgb(247,245,246); /* Old browsers */
|
399 |
+
background: -moz-linear-gradient(top, rgba(247,245,246,1) 0%, rgba(192,192,192,1) 100%); /* FF3.6+ */
|
400 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(247,245,246,1)), color-stop(100%,rgba(192,192,192,1))); /* Chrome,Safari4+ */
|
401 |
+
background: -webkit-linear-gradient(top, rgba(247,245,246,1) 0%,rgba(192,192,192,1) 100%); /* Chrome10+,Safari5.1+ */
|
402 |
+
background: -o-linear-gradient(top, rgba(247,245,246,1) 0%,rgba(192,192,192,1) 100%); /* Opera 11.10+ */
|
403 |
+
background: -ms-linear-gradient(top, rgba(247,245,246,1) 0%,rgba(192,192,192,1) 100%); /* IE10+ */
|
404 |
+
background: linear-gradient(to bottom, rgba(247,245,246,1) 0%,rgba(192,192,192,1) 100%); /* W3C */
|
405 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f5f6', endColorstr='#c0c0c0',GradientType=0 ); /* IE6-9 */
|
406 |
+
}
|
407 |
+
.cwp-schedule-days li.active {
|
408 |
+
text-decoration: none;
|
409 |
+
color: #f0f0f0;
|
410 |
+
box-shadow: none;
|
411 |
+
background: rgb(119,119,119); /* Old browsers */
|
412 |
+
background: -moz-linear-gradient(top, rgba(119,119,119,1) 0%, rgba(68,68,68,1) 100%); /* FF3.6+ */
|
413 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(119,119,119,1)), color-stop(100%,rgba(68,68,68,1))); /* Chrome,Safari4+ */
|
414 |
+
background: -webkit-linear-gradient(top, rgba(119,119,119,1) 0%,rgba(68,68,68,1) 100%); /* Chrome10+,Safari5.1+ */
|
415 |
+
background: -o-linear-gradient(top, rgba(119,119,119,1) 0%,rgba(68,68,68,1) 100%); /* Opera 11.10+ */
|
416 |
+
background: -ms-linear-gradient(top, rgba(119,119,119,1) 0%,rgba(68,68,68,1) 100%); /* IE10+ */
|
417 |
+
background: linear-gradient(to bottom, rgba(119,119,119,1) 0%,rgba(68,68,68,1) 100%); /* W3C */
|
418 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#777777', endColorstr='#444444',GradientType=0 ); /* IE6-9 */
|
419 |
+
border-top: 1px solid #666;
|
420 |
+
border-bottom: 1px solid #333;
|
421 |
+
border-right: 1px solid #444;
|
422 |
+
border-left: 1px solid #777;
|
423 |
+
}
|
424 |
+
.cwp-schedule-days li{
|
425 |
+
overflow: hidden;
|
426 |
+
display: inline-block;
|
427 |
+
float: left;
|
428 |
+
border-top: 1px solid #666;
|
429 |
+
border-bottom: 1px solid #333;
|
430 |
+
border-right: 1px solid #ABABAB;
|
431 |
+
border-left: 1px solid #D8D8D8;
|
432 |
+
color: #444;
|
433 |
+
cursor: pointer;
|
434 |
+
width: 14.2%;
|
435 |
+
text-align: center;
|
436 |
+
padding-top: 10px;
|
437 |
+
padding-bottom: 10px;
|
438 |
+
background: rgb(247,245,246);
|
439 |
+
background: -moz-linear-gradient(top, rgba(247,245,246,1) 0%, rgba(192,192,192,1) 100%);
|
440 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(247,245,246,1)), color-stop(100%,rgba(192,192,192,1)));
|
441 |
+
background: -webkit-linear-gradient(top, rgba(247,245,246,1) 0%,rgba(192,192,192,1) 100%);
|
442 |
+
background: -o-linear-gradient(top, rgba(247,245,246,1) 0%,rgba(192,192,192,1) 100%);
|
443 |
+
background: -ms-linear-gradient(top, rgba(247,245,246,1) 0%,rgba(192,192,192,1) 100%);
|
444 |
+
background: linear-gradient(to bottom, rgba(247,245,246,1) 0%,rgba(192,192,192,1) 100%);
|
445 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f5f6', endColorstr='#c0c0c0',GradientType=0 );
|
446 |
+
color: #E8E8E8;
|
447 |
+
text-shadow: 1px 1px 1px #7C7C7C;
|
448 |
+
box-shadow: inset 5px 0px 10px #D5D5D5;
|
449 |
+
border-top: 1px solid #CBCBCB;
|
450 |
+
border-bottom: 1px solid #ABABAB;
|
451 |
+
|
452 |
+
}
|
453 |
+
.cwp-pro-string{
|
454 |
+
|
455 |
+
margin: auto;
|
456 |
+
display: block;
|
457 |
+
text-align: center;
|
458 |
+
}
|
459 |
+
.cwp-posts-time-info{
|
460 |
+
text-align: center;
|
461 |
+
margin-top: -9px;
|
462 |
+
font-size: 14px;
|
463 |
+
}
|
464 |
+
a.cwp-primary:hover,
|
465 |
+
a.cwp-primary{
|
466 |
+
|
467 |
+
background: #52c4ef;
|
468 |
+
color: #fff;
|
469 |
+
}
|
470 |
+
a.cwp-btn{
|
471 |
+
text-decoration: none;
|
472 |
+
border-radius: 3px;
|
473 |
+
display: block;
|
474 |
+
height: 30px;
|
475 |
+
border-radius: 3px;
|
476 |
+
font-family: "Open Sans", sans-serif;
|
477 |
+
text-transform: uppercase;
|
478 |
+
font-weight: bold;
|
479 |
+
line-height: 2.3;
|
480 |
+
padding-right: 10px;
|
481 |
+
padding-left: 10px;
|
482 |
+
display: inline-block;
|
483 |
+
margin-top: 14px;
|
484 |
+
margin-right: 5px;
|
485 |
+
|
486 |
+
}
|
487 |
+
.cwp-top-times-choice .cwp-top-times-close:hover{
|
488 |
+
color:#000;
|
489 |
+
|
490 |
+
}
|
491 |
+
#cwp-top-container-form{
|
492 |
+
width:73%;
|
493 |
+
float:left;
|
494 |
+
|
495 |
+
}
|
496 |
+
.cwp-top-times-choice .cwp-top-times-close{
|
497 |
+
|
498 |
+
margin-left: 20px;
|
499 |
+
font-size: 15px;
|
500 |
+
font-weight: bold;
|
501 |
+
cursor: pointer;
|
502 |
+
}
|
503 |
+
.cwp-top-times-choice select{
|
504 |
+
width:100px;
|
505 |
+
|
506 |
+
}
|
507 |
+
|
508 |
+
.cwp-hidden{
|
509 |
+
display:none;
|
510 |
+
|
511 |
+
}
|
512 |
+
|
513 |
+
.inactive.cwp-error-label {
|
514 |
+
border-bottom: none !important;
|
515 |
+
}
|
516 |
+
|
517 |
+
.pro-version {
|
518 |
+
position: relative;
|
519 |
+
}
|
520 |
+
.pro-version:before {
|
521 |
+
content: "";
|
522 |
+
position: absolute;
|
523 |
+
width: 45px;
|
524 |
+
height: 45px;
|
525 |
+
top: 0;
|
526 |
+
background-repeat: no-repeat;
|
527 |
+
right: 0;
|
528 |
+
background: url(../img/pro-version-badge.png);
|
529 |
+
}
|
530 |
+
a.on-off-button {
|
531 |
+
float: left;
|
532 |
+
width: 76px;
|
533 |
+
height: 39px;
|
534 |
+
background-image: url(../img/on-off-button.png);
|
535 |
+
background-repeat: no-repeat;
|
536 |
+
margin-top: -4px !important;
|
537 |
+
cursor: pointer;
|
538 |
+
-webkit-transition: all 0;
|
539 |
+
-moz-transition: all 0;
|
540 |
+
-o-transition: all 0;
|
541 |
+
transition: all 0;
|
542 |
+
}
|
543 |
+
a.on-off-button.on {
|
544 |
+
background-position: 0 0;
|
545 |
+
}
|
546 |
+
a.on-off-button.off {
|
547 |
+
background-position: 0 -40px;
|
548 |
+
}
|
549 |
+
.cwp-remote-check-info{
|
550 |
+
float:left;
|
551 |
+
margin-right:5px;
|
552 |
+
margin-top:4px;
|
553 |
+
font-size: 15px;
|
554 |
+
color: #858585;
|
555 |
+
font-weight: 600;
|
556 |
+
font-style: italic;
|
557 |
+
}
|
558 |
+
.rop-error-log{
|
559 |
+
position:relative;
|
560 |
+
}
|
561 |
+
.rop-error-log span.no-error{
|
562 |
+
display:none;
|
563 |
+
|
564 |
+
}
|
565 |
+
.rop-error-log span{
|
566 |
+
background:#F16848;
|
567 |
+
padding:2px;
|
568 |
+
position:absolute;
|
569 |
+
top:0px;
|
570 |
+
right:0px;
|
571 |
+
color:#fff;
|
572 |
+
border-bottom-left-radius: 10px;
|
573 |
+
}
|
574 |
+
|
575 |
+
#rop-clear-log{
|
576 |
+
padding: 10px 15px 10px 15px;
|
577 |
+
font-weight: bold;
|
578 |
+
font-family: "HelveticaNeue", "Helvetica Neue", Arial, sans-serif;
|
579 |
+
font-size: 1em;
|
580 |
+
line-height: 1;
|
581 |
+
color: #696969;
|
582 |
+
border-radius: 10px;
|
583 |
+
border: 1px solid #F7F7F7;
|
584 |
+
-webkit-transition: all 0.3s ease-in-out;
|
585 |
+
-moz-transition: all 0.3s ease-in-out;
|
586 |
+
-o-transition: all 0.3s ease-in-out;
|
587 |
+
transition: all 0.3s ease-in-out;
|
588 |
+
box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.5);
|
589 |
+
float:right;
|
590 |
+
margin:10px !important;
|
591 |
+
margin-top:20px !important;
|
592 |
+
}
|
593 |
+
.rop-log-item .rop-log-date{
|
594 |
+
font-weight: bold;
|
595 |
+
}
|
596 |
+
.rop-log-item.rop-notice{
|
597 |
+
background:#52C4EF;
|
598 |
+
}
|
599 |
+
.rop-log-item.rop-error{
|
600 |
+
|
601 |
+
background:#F9866B;
|
602 |
+
}
|
603 |
+
.rop-log-item{
|
604 |
+
width:100%;
|
605 |
+
padding:5px;
|
606 |
+
color:#fff;
|
607 |
+
}
|
608 |
+
#rop-log-list{
|
609 |
+
text-align: center;
|
610 |
+
width:100%;
|
611 |
+
float:right;
|
612 |
+
background:none;
|
613 |
+
}
|
614 |
+
.clearfix:after{
|
615 |
+
|
616 |
+
clear:both;
|
617 |
+
}
|
618 |
+
.rop-log-text{
|
619 |
+
word-wrap: break-word;
|
620 |
+
|
621 |
+
}
|
622 |
+
.rop-log-container{
|
623 |
+
width:100%;
|
624 |
+
display: block;
|
625 |
+
|
626 |
+
}
|
627 |
+
.active-rop-error-label b{
|
628 |
+
color:#F9866B;
|
629 |
+
|
630 |
+
}
|
631 |
+
.active-rop-error-label{
|
632 |
+
display: none;
|
633 |
+
background: #F0F0F0;
|
634 |
+
border-top: 1px solid rgba(255, 255, 255, 0.4);
|
635 |
+
color: #494949 !important;
|
636 |
+
font-weight: bold;
|
637 |
+
text-shadow: 0px 1px 0px #FFF;
|
638 |
+
border-bottom: 1px solid #E2E2E2;
|
639 |
+
}
|
640 |
+
.rop-twitter-clock{
|
641 |
+
margin-top:-10px;
|
642 |
+
text-align: center;
|
643 |
+
padding:2px;
|
644 |
+
background: #F0F0F0;
|
645 |
+
color: #494949;
|
646 |
+
font-weight: bold;
|
647 |
+
text-shadow: 0px 1px 0px #FFF;
|
648 |
+
}
|
649 |
+
|
650 |
+
.rop-network-countdown{
|
651 |
+
background: #B9F3CB;
|
652 |
+
box-shadow: inset 0px 0px 6px rgba(8, 61, 8, 0.1);
|
653 |
+
border-top: 1px solid rgba(97, 209, 101, 0.4);
|
654 |
+
color: #218618;
|
655 |
+
text-shadow: 0px 1px 0px #FFF;
|
656 |
+
border-bottom: 1px solid #FFF;
|
657 |
+
padding:4px;
|
658 |
+
}
|
659 |
+
.rop-exclude-filter label{
|
660 |
+
padding-right:20px;
|
661 |
+
float: left;
|
662 |
+
}
|
663 |
+
.rop-exclude-filter{
|
664 |
+
float:left;
|
665 |
+
margin:0px;
|
666 |
+
margin-right:10px;
|
667 |
+
line-height: 26px;
|
668 |
+
}
|
img/on-off-button.png
ADDED
Binary file
|
img/pro-version-badge.png
ADDED
Binary file
|
img/sib.png
ADDED
Binary file
|
inc/class-remote-notification-client.php
CHANGED
@@ -1,381 +1,381 @@
|
|
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' ); ?>">×</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 |
}
|
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' ); ?>">×</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,8 +1,12 @@
|
|
1 |
-
<?php
|
2 |
define("CURRENTURL", top_current_page());
|
3 |
define("CWP_TEXTDOMAIN", "tweet-old-post");
|
4 |
-
define("SETTINGSURL", top_settings_url());
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
// Settings Array
|
7 |
$cwp_top_settings = array(
|
8 |
'name' => "Revive Old Post",
|
@@ -14,14 +18,17 @@ $cwp_top_settings = array(
|
|
14 |
'consumer_secret' => "vTzszlMujMZCY3mVtTE6WovUKQxqv3LVgiVku276M"
|
15 |
)
|
16 |
);
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
'id' => '1',
|
24 |
-
'name' => __('Post Content', CWP_TEXTDOMAIN),
|
25 |
'type' => 'select',
|
26 |
'slug' => 'tweet-content',
|
27 |
'option' => 'top_opt_tweet_type',
|
@@ -31,10 +38,20 @@ $cwp_top_fields = array(
|
|
31 |
'body' => __('Body Only', CWP_TEXTDOMAIN),
|
32 |
'titlenbody' => __('Title & Body', CWP_TEXTDOMAIN),
|
33 |
'custom-field' => __('Custom Field', CWP_TEXTDOMAIN)
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
'id' => '2',
|
39 |
'name' => __('Post Content Custom Field', CWP_TEXTDOMAIN),
|
40 |
'type' => 'text',
|
@@ -42,9 +59,9 @@ $cwp_top_fields = array(
|
|
42 |
'option' => 'top_opt_tweet_type_custom_field',
|
43 |
'description' => __('Which custom field do you want to fetch info from?', CWP_TEXTDOMAIN),
|
44 |
'options' => array()
|
45 |
-
|
46 |
|
47 |
-
|
48 |
'id' => '3',
|
49 |
'name' => __('Additional Text', CWP_TEXTDOMAIN),
|
50 |
'type' => 'text',
|
@@ -52,11 +69,11 @@ $cwp_top_fields = array(
|
|
52 |
'option' => 'top_opt_add_text',
|
53 |
'description' => __('Text added to your auto posts', CWP_TEXTDOMAIN),
|
54 |
'options' => array()
|
55 |
-
|
56 |
|
57 |
-
|
58 |
'id' => '4',
|
59 |
-
'name' => __('Additional Text At', CWP_TEXTDOMAIN),
|
60 |
'type' => 'select',
|
61 |
'slug' => 'additional-text-at',
|
62 |
'option' => 'top_opt_add_text_at',
|
@@ -64,12 +81,12 @@ $cwp_top_fields = array(
|
|
64 |
'options' => array(
|
65 |
'beginning' => __('Beginning of Post', CWP_TEXTDOMAIN),
|
66 |
'end' => __('End of Post', CWP_TEXTDOMAIN)
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
|
71 |
'id' => '5',
|
72 |
-
'name' => __('Include Link', CWP_TEXTDOMAIN),
|
73 |
'type' => 'select',
|
74 |
'slug' => 'include-link',
|
75 |
'option' => 'top_opt_include_link',
|
@@ -77,20 +94,29 @@ $cwp_top_fields = array(
|
|
77 |
'options' => array(
|
78 |
'true' => __('Yes', CWP_TEXTDOMAIN),
|
79 |
'false' => __('No', CWP_TEXTDOMAIN)
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
82 |
|
83 |
-
|
|
|
|
|
84 |
'id' => '6',
|
85 |
-
'name' => __('Fetch URL From Custom Field', CWP_TEXTDOMAIN),
|
86 |
'type' => 'checkbox',
|
87 |
'slug' => 'url-from-custom-field',
|
88 |
'option' => 'top_opt_custom_url_option',
|
89 |
'description' => __('URL will be fetched from a custom field.', CWP_TEXTDOMAIN),
|
90 |
-
'options' => ''
|
91 |
-
|
|
|
|
|
|
|
92 |
|
93 |
-
|
94 |
'id' => '7',
|
95 |
'name' => __('URL Custom Field', CWP_TEXTDOMAIN),
|
96 |
'type' => 'text',
|
@@ -98,9 +124,9 @@ $cwp_top_fields = array(
|
|
98 |
'option' => 'top_opt_custom_url_field',
|
99 |
'description' => __('URL will be fetched from the specified custom field.', CWP_TEXTDOMAIN),
|
100 |
'options' => array()
|
101 |
-
|
102 |
|
103 |
-
|
104 |
'id' => '8',
|
105 |
'name' => __('Use URL Shortner', CWP_TEXTDOMAIN),
|
106 |
'type' => 'checkbox',
|
@@ -108,13 +134,16 @@ $cwp_top_fields = array(
|
|
108 |
'option' => 'top_opt_use_url_shortner',
|
109 |
'description' => '',
|
110 |
'options' => '',
|
111 |
-
|
|
|
|
|
|
|
112 |
|
113 |
|
114 |
|
115 |
-
|
116 |
'id' => '9',
|
117 |
-
'name' => __('URL Shortner Service', CWP_TEXTDOMAIN),
|
118 |
'type' => 'select',
|
119 |
'slug' => 'url-shortner',
|
120 |
'option' => 'top_opt_url_shortner',
|
@@ -130,10 +159,14 @@ $cwp_top_fields = array(
|
|
130 |
//'1click.at' => __('1click.at', CWP_TEXTDOMAIN),
|
131 |
//'tinyurl' => __('TinyUrl', CWP_TEXTDOMAIN)
|
132 |
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
|
136 |
-
|
137 |
'id' => '22',
|
138 |
'name' => __('Bitly Key', CWP_TEXTDOMAIN),
|
139 |
'type' => 'text',
|
@@ -141,9 +174,9 @@ $cwp_top_fields = array(
|
|
141 |
'option' => 'top_opt_bitly_key',
|
142 |
'description' => '',
|
143 |
'options' => '',
|
144 |
-
|
145 |
|
146 |
-
|
147 |
'id' => '23',
|
148 |
'name' => __('Bitly User', CWP_TEXTDOMAIN),
|
149 |
'type' => 'text',
|
@@ -151,11 +184,11 @@ $cwp_top_fields = array(
|
|
151 |
'option' => 'top_opt_bitly_user',
|
152 |
'description' => '',
|
153 |
'options' => '',
|
154 |
-
|
155 |
|
156 |
-
|
157 |
'id' => '10',
|
158 |
-
'name' => __('Hashtags', CWP_TEXTDOMAIN),
|
159 |
'type' => 'select',
|
160 |
'slug' => 'custom-hashtag-option',
|
161 |
'option' => 'top_opt_custom_hashtag_option',
|
@@ -166,10 +199,241 @@ $cwp_top_fields = array(
|
|
166 |
'categories'=> __('Create hashtags from Categories', CWP_TEXTDOMAIN),
|
167 |
'tags' => __('Create hashtags from Tags', CWP_TEXTDOMAIN),
|
168 |
'custom' => __('Create hashtags from Custom Fields', CWP_TEXTDOMAIN)
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
'id' => '11',
|
174 |
'name' => __('Common Hashtags', CWP_TEXTDOMAIN),
|
175 |
'type' => 'text',
|
@@ -177,9 +441,9 @@ $cwp_top_fields = array(
|
|
177 |
'option' => 'top_opt_hashtags',
|
178 |
'description' => __('Specify which hashtags you want to be used. eg. #example, #example2', CWP_TEXTDOMAIN),
|
179 |
'options' => array()
|
180 |
-
|
181 |
|
182 |
-
|
183 |
'id' => '12',
|
184 |
'name' => __('Maximum Hashtags Length', CWP_TEXTDOMAIN),
|
185 |
'type' => 'text',
|
@@ -187,9 +451,9 @@ $cwp_top_fields = array(
|
|
187 |
'option' => 'top_opt_hashtag_length',
|
188 |
'description' => __('Set to 0 (characters) to include all.', CWP_TEXTDOMAIN),
|
189 |
'options' => array()
|
190 |
-
|
191 |
|
192 |
-
|
193 |
'id' => '13',
|
194 |
'name' => __('Hashtag Custom Field', CWP_TEXTDOMAIN),
|
195 |
'type' => 'text',
|
@@ -197,7 +461,262 @@ $cwp_top_fields = array(
|
|
197 |
'option' => 'top_opt_custom_hashtag_field',
|
198 |
'description' => __('Fetch hashtags from specified custom field', CWP_TEXTDOMAIN),
|
199 |
'options' => array()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
'interval' => array(
|
203 |
'id' => '14',
|
@@ -205,6 +724,7 @@ $cwp_top_fields = array(
|
|
205 |
'type' => 'text',
|
206 |
'slug' => 'interval',
|
207 |
'option' => 'top_opt_interval',
|
|
|
208 |
'description' => __('Minimum time between shares (Hour/Hours), 0.4 can be used also.', CWP_TEXTDOMAIN),
|
209 |
'options' => array()
|
210 |
),
|
@@ -241,19 +761,10 @@ $cwp_top_fields = array(
|
|
241 |
|
242 |
|
243 |
|
244 |
-
'use-image' => array(
|
245 |
-
'id' => '24',
|
246 |
-
'name' => __('Post with Image', CWP_TEXTDOMAIN),
|
247 |
-
'type' => 'checkbox',
|
248 |
-
'slug' => 'post-with-image',
|
249 |
-
'option' => 'top_opt_post_with_image',
|
250 |
-
'description' => __('Check if you want to add the post featured image to the share', CWP_TEXTDOMAIN),
|
251 |
-
'options' => array()
|
252 |
-
),
|
253 |
|
254 |
'tweet-multiple-times' => array(
|
255 |
'id' => '25',
|
256 |
-
'name' => __('Share old posts more than once', CWP_TEXTDOMAIN),
|
257 |
'type' => 'checkbox',
|
258 |
'slug' => 'tweet-multiple-times',
|
259 |
'option' => 'top_opt_tweet_multiple_times',
|
@@ -265,18 +776,19 @@ $cwp_top_fields = array(
|
|
265 |
|
266 |
'post-type' => array(
|
267 |
'id' => '18',
|
268 |
-
'name' => __('Post Type', CWP_TEXTDOMAIN),
|
269 |
'type' => 'custom-post-type',
|
270 |
'slug' => 'post-type',
|
271 |
'option' => 'top_opt_post_type',
|
272 |
'description' => __('What type of items do you want to share?', CWP_TEXTDOMAIN),
|
273 |
-
'options' => array()
|
274 |
-
|
|
|
275 |
),
|
276 |
|
277 |
'analytics-tracking' => array(
|
278 |
'id' => '26',
|
279 |
-
'name' => __('Google Analytics Campaign Tracking', CWP_TEXTDOMAIN),
|
280 |
'type' => 'checkbox',
|
281 |
'slug' => 'ga-tracking',
|
282 |
'option' => 'top_opt_ga_tracking',
|
@@ -286,7 +798,7 @@ $cwp_top_fields = array(
|
|
286 |
|
287 |
'exclude-specific-categories' => array(
|
288 |
'id' => '21',
|
289 |
-
'name' => __('Exclude Specific Categories', CWP_TEXTDOMAIN),
|
290 |
'type' => 'categories-list',
|
291 |
'slug' => 'exclude-specific-category',
|
292 |
'option' => 'top_opt_omit_cats',
|
1 |
+
<?php
|
2 |
define("CURRENTURL", top_current_page());
|
3 |
define("CWP_TEXTDOMAIN", "tweet-old-post");
|
|
|
4 |
|
5 |
+
if(class_exists("CWP_TOP_Core_PRO")){
|
6 |
+
define("CWP_TOP_PRO", TRUE);
|
7 |
+
}else{
|
8 |
+
define("CWP_TOP_PRO", FALSE);
|
9 |
+
}
|
10 |
// Settings Array
|
11 |
$cwp_top_settings = array(
|
12 |
'name' => "Revive Old Post",
|
18 |
'consumer_secret' => "vTzszlMujMZCY3mVtTE6WovUKQxqv3LVgiVku276M"
|
19 |
)
|
20 |
);
|
21 |
+
$cwp_rop_remote_trigger_url = "http://portal.themeisle.com/remote_trigger";
|
22 |
+
$cwp_top_global_schedule = array();
|
23 |
+
define("CWP_TOP_PRO_STRING",'<span class="cwp-pro-string">'.__("This is only available in the",CWP_TEXTDOMAIN)."<a href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=imagepro&utm_medium=link&utm_campaign=top&upgrade=true' target='_blank'> ".__("PRO version")."</a></span>");
|
24 |
|
25 |
|
26 |
+
$cwp_top_networks = array(
|
27 |
+
"twitter"=>array(
|
28 |
|
29 |
+
'tweet-content' => array(
|
30 |
'id' => '1',
|
31 |
+
'name' => __('Post Content', CWP_TEXTDOMAIN),
|
32 |
'type' => 'select',
|
33 |
'slug' => 'tweet-content',
|
34 |
'option' => 'top_opt_tweet_type',
|
38 |
'body' => __('Body Only', CWP_TEXTDOMAIN),
|
39 |
'titlenbody' => __('Title & Body', CWP_TEXTDOMAIN),
|
40 |
'custom-field' => __('Custom Field', CWP_TEXTDOMAIN)
|
41 |
+
)
|
42 |
+
),
|
43 |
+
'top_opt_tweet_length' => array(
|
44 |
+
'id' => '1',
|
45 |
+
'name' => __('Length', CWP_TEXTDOMAIN),
|
46 |
+
'type' => 'number',
|
47 |
+
'slug' => 'tweet-length',
|
48 |
+
'option' => 'top_opt_tweet_length',
|
49 |
+
'description' => __('The length of the tweet', CWP_TEXTDOMAIN),
|
50 |
+
'max-length' => 140,
|
51 |
+
'default_value' =>140
|
52 |
+
),
|
53 |
+
|
54 |
+
'tweet-content-field' => array(
|
55 |
'id' => '2',
|
56 |
'name' => __('Post Content Custom Field', CWP_TEXTDOMAIN),
|
57 |
'type' => 'text',
|
59 |
'option' => 'top_opt_tweet_type_custom_field',
|
60 |
'description' => __('Which custom field do you want to fetch info from?', CWP_TEXTDOMAIN),
|
61 |
'options' => array()
|
62 |
+
),
|
63 |
|
64 |
+
'additional-text' => array(
|
65 |
'id' => '3',
|
66 |
'name' => __('Additional Text', CWP_TEXTDOMAIN),
|
67 |
'type' => 'text',
|
69 |
'option' => 'top_opt_add_text',
|
70 |
'description' => __('Text added to your auto posts', CWP_TEXTDOMAIN),
|
71 |
'options' => array()
|
72 |
+
),
|
73 |
|
74 |
+
'additional-text-at' => array(
|
75 |
'id' => '4',
|
76 |
+
'name' => __('Additional Text At', CWP_TEXTDOMAIN),
|
77 |
'type' => 'select',
|
78 |
'slug' => 'additional-text-at',
|
79 |
'option' => 'top_opt_add_text_at',
|
81 |
'options' => array(
|
82 |
'beginning' => __('Beginning of Post', CWP_TEXTDOMAIN),
|
83 |
'end' => __('End of Post', CWP_TEXTDOMAIN)
|
84 |
+
)
|
85 |
+
),
|
86 |
|
87 |
+
'include-link' => array(
|
88 |
'id' => '5',
|
89 |
+
'name' => __('Include Link', CWP_TEXTDOMAIN),
|
90 |
'type' => 'select',
|
91 |
'slug' => 'include-link',
|
92 |
'option' => 'top_opt_include_link',
|
94 |
'options' => array(
|
95 |
'true' => __('Yes', CWP_TEXTDOMAIN),
|
96 |
'false' => __('No', CWP_TEXTDOMAIN)
|
97 |
+
),
|
98 |
+
'dependency'=> array(
|
99 |
+
"url-from-custom-field"=>"true",
|
100 |
+
"use-url-shortner"=>"true",
|
101 |
+
)
|
102 |
+
|
103 |
|
104 |
+
),
|
105 |
+
|
106 |
+
'url-from-custom-field' => array(
|
107 |
'id' => '6',
|
108 |
+
'name' => __('Fetch URL From Custom Field', CWP_TEXTDOMAIN),
|
109 |
'type' => 'checkbox',
|
110 |
'slug' => 'url-from-custom-field',
|
111 |
'option' => 'top_opt_custom_url_option',
|
112 |
'description' => __('URL will be fetched from a custom field.', CWP_TEXTDOMAIN),
|
113 |
+
'options' => '',
|
114 |
+
'dependency'=> array(
|
115 |
+
"custom-field-url"=>"true"
|
116 |
+
)
|
117 |
+
),
|
118 |
|
119 |
+
'custom-field-url' => array(
|
120 |
'id' => '7',
|
121 |
'name' => __('URL Custom Field', CWP_TEXTDOMAIN),
|
122 |
'type' => 'text',
|
124 |
'option' => 'top_opt_custom_url_field',
|
125 |
'description' => __('URL will be fetched from the specified custom field.', CWP_TEXTDOMAIN),
|
126 |
'options' => array()
|
127 |
+
),
|
128 |
|
129 |
+
'use-url-shortner' => array(
|
130 |
'id' => '8',
|
131 |
'name' => __('Use URL Shortner', CWP_TEXTDOMAIN),
|
132 |
'type' => 'checkbox',
|
134 |
'option' => 'top_opt_use_url_shortner',
|
135 |
'description' => '',
|
136 |
'options' => '',
|
137 |
+
'dependency'=> array(
|
138 |
+
"url-shortner"=>"true"
|
139 |
+
)
|
140 |
+
),
|
141 |
|
142 |
|
143 |
|
144 |
+
'url-shortner' => array(
|
145 |
'id' => '9',
|
146 |
+
'name' => __('URL Shortner Service', CWP_TEXTDOMAIN),
|
147 |
'type' => 'select',
|
148 |
'slug' => 'url-shortner',
|
149 |
'option' => 'top_opt_url_shortner',
|
159 |
//'1click.at' => __('1click.at', CWP_TEXTDOMAIN),
|
160 |
//'tinyurl' => __('TinyUrl', CWP_TEXTDOMAIN)
|
161 |
|
162 |
+
),
|
163 |
+
'dependency'=> array(
|
164 |
+
"bitly-key"=>"bit.ly",
|
165 |
+
"bitly-user"=>"bit.ly"
|
166 |
+
)
|
167 |
+
),
|
168 |
|
169 |
+
'bitly-key' => array(
|
170 |
'id' => '22',
|
171 |
'name' => __('Bitly Key', CWP_TEXTDOMAIN),
|
172 |
'type' => 'text',
|
174 |
'option' => 'top_opt_bitly_key',
|
175 |
'description' => '',
|
176 |
'options' => '',
|
177 |
+
),
|
178 |
|
179 |
+
'bitly-user' => array(
|
180 |
'id' => '23',
|
181 |
'name' => __('Bitly User', CWP_TEXTDOMAIN),
|
182 |
'type' => 'text',
|
184 |
'option' => 'top_opt_bitly_user',
|
185 |
'description' => '',
|
186 |
'options' => '',
|
187 |
+
),
|
188 |
|
189 |
+
'custom-hashtag-option' => array(
|
190 |
'id' => '10',
|
191 |
+
'name' => __('Hashtags', CWP_TEXTDOMAIN),
|
192 |
'type' => 'select',
|
193 |
'slug' => 'custom-hashtag-option',
|
194 |
'option' => 'top_opt_custom_hashtag_option',
|
199 |
'categories'=> __('Create hashtags from Categories', CWP_TEXTDOMAIN),
|
200 |
'tags' => __('Create hashtags from Tags', CWP_TEXTDOMAIN),
|
201 |
'custom' => __('Create hashtags from Custom Fields', CWP_TEXTDOMAIN)
|
202 |
+
),
|
203 |
+
'dependency'=> array(
|
204 |
+
"common-hashtags" =>"common",
|
205 |
+
"hashtags-length" =>"common,categories,tags,custom",
|
206 |
+
"common-hashtags" =>"common",
|
207 |
+
"custom-hashtag-field"=>"custom"
|
208 |
+
)
|
209 |
+
),
|
210 |
+
|
211 |
+
'common-hashtags' => array(
|
212 |
+
'id' => '11',
|
213 |
+
'name' => __('Common Hashtags', CWP_TEXTDOMAIN),
|
214 |
+
'type' => 'text',
|
215 |
+
'slug' => 'common-hashtags',
|
216 |
+
'option' => 'top_opt_hashtags',
|
217 |
+
'description' => __('Specify which hashtags you want to be used. eg. #example, #example2', CWP_TEXTDOMAIN),
|
218 |
+
'options' => array()
|
219 |
+
),
|
220 |
+
|
221 |
+
'hashtags-length' => array(
|
222 |
+
'id' => '12',
|
223 |
+
'name' => __('Maximum Hashtags Length', CWP_TEXTDOMAIN),
|
224 |
+
'type' => 'text',
|
225 |
+
'slug' => 'hashtags-length',
|
226 |
+
'option' => 'top_opt_hashtag_length',
|
227 |
+
'description' => __('Set to 0 (characters) to include all.', CWP_TEXTDOMAIN),
|
228 |
+
'options' => array()
|
229 |
+
),
|
230 |
+
|
231 |
+
'custom-hashtag-field' => array(
|
232 |
+
'id' => '13',
|
233 |
+
'name' => __('Hashtag Custom Field', CWP_TEXTDOMAIN),
|
234 |
+
'type' => 'text',
|
235 |
+
'slug' => 'custom-hashtag-field',
|
236 |
+
'option' => 'top_opt_custom_hashtag_field',
|
237 |
+
'description' => __('Fetch hashtags from specified custom field', CWP_TEXTDOMAIN),
|
238 |
+
'options' => array()
|
239 |
+
|
240 |
+
)
|
241 |
+
,
|
242 |
+
'use-image' => array(
|
243 |
+
'id' => '24',
|
244 |
+
'name' => __('Post with Image', CWP_TEXTDOMAIN),
|
245 |
+
'type' => 'checkbox',
|
246 |
+
'slug' => 'post-with-image',
|
247 |
+
'option' => 'top_opt_post_with_image',
|
248 |
+
'description' => __('Check if you want to add the post featured image to the share', CWP_TEXTDOMAIN),
|
249 |
+
'options' => array(),
|
250 |
+
"available_pro" => "yes"
|
251 |
+
)
|
252 |
),
|
253 |
+
"facebook"=>array(
|
254 |
+
'tweet-content' => array(
|
255 |
+
'id' => '1',
|
256 |
+
'name' => __('Post Content', CWP_TEXTDOMAIN),
|
257 |
+
'type' => 'select',
|
258 |
+
'slug' => 'tweet-content',
|
259 |
+
'option' => 'top_opt_tweet_type',
|
260 |
+
'description' => __('What do you want to share?', CWP_TEXTDOMAIN),
|
261 |
+
'options' => array(
|
262 |
+
'title' => __('Title Only', CWP_TEXTDOMAIN),
|
263 |
+
'body' => __('Body Only', CWP_TEXTDOMAIN),
|
264 |
+
'titlenbody' => __('Title & Body', CWP_TEXTDOMAIN),
|
265 |
+
'custom-field' => __('Custom Field', CWP_TEXTDOMAIN)
|
266 |
+
)
|
267 |
+
),
|
268 |
+
'top_opt_tweet_length' => array(
|
269 |
+
'id' => '1',
|
270 |
+
'name' => __('Length', CWP_TEXTDOMAIN),
|
271 |
+
'type' => 'number',
|
272 |
+
'slug' => 'tweet-length',
|
273 |
+
'option' => 'top_opt_tweet_length',
|
274 |
+
'description' => __('The length of the tweet', CWP_TEXTDOMAIN),
|
275 |
+
'max-length' => 1000,
|
276 |
+
'default_value' =>1000
|
277 |
+
),
|
278 |
+
|
279 |
+
'tweet-content-field' => array(
|
280 |
+
'id' => '2',
|
281 |
+
'name' => __('Post Content Custom Field', CWP_TEXTDOMAIN),
|
282 |
+
'type' => 'text',
|
283 |
+
'slug' => 'tweet-content-field',
|
284 |
+
'option' => 'top_opt_tweet_type_custom_field',
|
285 |
+
'description' => __('Which custom field do you want to fetch info from?', CWP_TEXTDOMAIN),
|
286 |
+
'options' => array()
|
287 |
+
),
|
288 |
+
|
289 |
+
'additional-text' => array(
|
290 |
+
'id' => '3',
|
291 |
+
'name' => __('Additional Text', CWP_TEXTDOMAIN),
|
292 |
+
'type' => 'text',
|
293 |
+
'slug' => 'additional-text',
|
294 |
+
'option' => 'top_opt_add_text',
|
295 |
+
'description' => __('Text added to your auto posts', CWP_TEXTDOMAIN),
|
296 |
+
'options' => array()
|
297 |
+
),
|
298 |
+
|
299 |
+
'additional-text-at' => array(
|
300 |
+
'id' => '4',
|
301 |
+
'name' => __('Additional Text At', CWP_TEXTDOMAIN),
|
302 |
+
'type' => 'select',
|
303 |
+
'slug' => 'additional-text-at',
|
304 |
+
'option' => 'top_opt_add_text_at',
|
305 |
+
'description' => __('Where do you want the text to be added?', CWP_TEXTDOMAIN),
|
306 |
+
'options' => array(
|
307 |
+
'beginning' => __('Beginning of Post', CWP_TEXTDOMAIN),
|
308 |
+
'end' => __('End of Post', CWP_TEXTDOMAIN)
|
309 |
+
)
|
310 |
+
),
|
311 |
|
312 |
+
'include-link' => array(
|
313 |
+
'id' => '5',
|
314 |
+
'name' => __('Include Link', CWP_TEXTDOMAIN),
|
315 |
+
'type' => 'select',
|
316 |
+
'slug' => 'include-link',
|
317 |
+
'option' => 'top_opt_include_link',
|
318 |
+
'description' => __('Include a link to your post?', CWP_TEXTDOMAIN),
|
319 |
+
'options' => array(
|
320 |
+
'true' => __('Yes', CWP_TEXTDOMAIN),
|
321 |
+
'false' => __('No', CWP_TEXTDOMAIN)
|
322 |
+
),
|
323 |
+
'dependency'=> array(
|
324 |
+
"url-from-custom-field"=>"true",
|
325 |
+
"use-url-shortner"=>"true",
|
326 |
+
)
|
327 |
+
|
328 |
+
|
329 |
+
),
|
330 |
+
|
331 |
+
'url-from-custom-field' => array(
|
332 |
+
'id' => '6',
|
333 |
+
'name' => __('Fetch URL From Custom Field', CWP_TEXTDOMAIN),
|
334 |
+
'type' => 'checkbox',
|
335 |
+
'slug' => 'url-from-custom-field',
|
336 |
+
'option' => 'top_opt_custom_url_option',
|
337 |
+
'description' => __('URL will be fetched from a custom field.', CWP_TEXTDOMAIN),
|
338 |
+
'options' => '',
|
339 |
+
'dependency'=> array(
|
340 |
+
"custom-field-url"=>"true"
|
341 |
+
)
|
342 |
+
),
|
343 |
+
|
344 |
+
'custom-field-url' => array(
|
345 |
+
'id' => '7',
|
346 |
+
'name' => __('URL Custom Field', CWP_TEXTDOMAIN),
|
347 |
+
'type' => 'text',
|
348 |
+
'slug' => 'custom-field-url',
|
349 |
+
'option' => 'top_opt_custom_url_field',
|
350 |
+
'description' => __('URL will be fetched from the specified custom field.', CWP_TEXTDOMAIN),
|
351 |
+
'options' => array()
|
352 |
+
),
|
353 |
+
|
354 |
+
'use-url-shortner' => array(
|
355 |
+
'id' => '8',
|
356 |
+
'name' => __('Use URL Shortner', CWP_TEXTDOMAIN),
|
357 |
+
'type' => 'checkbox',
|
358 |
+
'slug' => 'use-url-shortner',
|
359 |
+
'option' => 'top_opt_use_url_shortner',
|
360 |
+
'description' => '',
|
361 |
+
'options' => '',
|
362 |
+
'dependency'=> array(
|
363 |
+
"url-shortner"=>"true"
|
364 |
+
)
|
365 |
+
),
|
366 |
+
|
367 |
+
|
368 |
+
|
369 |
+
'url-shortner' => array(
|
370 |
+
'id' => '9',
|
371 |
+
'name' => __('URL Shortner Service', CWP_TEXTDOMAIN),
|
372 |
+
'type' => 'select',
|
373 |
+
'slug' => 'url-shortner',
|
374 |
+
'option' => 'top_opt_url_shortner',
|
375 |
+
'description' => __('Shorten the link to your post.', CWP_TEXTDOMAIN),
|
376 |
+
'options' => array(
|
377 |
+
'wp_short_url' => __('wp short url', CWP_TEXTDOMAIN),
|
378 |
+
//'t.co' => __('t.co', CWP_TEXTDOMAIN),
|
379 |
+
'is.gd' => __('is.gd', CWP_TEXTDOMAIN),
|
380 |
+
'bit.ly' => __('bit.ly', CWP_TEXTDOMAIN),
|
381 |
+
//'tr.im' => __('tr.im', CWP_TEXTDOMAIN),
|
382 |
+
//'3.ly' => __('3.ly', CWP_TEXTDOMAIN),
|
383 |
+
//'u.nu' => __('u.nu', CWP_TEXTDOMAIN),
|
384 |
+
//'1click.at' => __('1click.at', CWP_TEXTDOMAIN),
|
385 |
+
//'tinyurl' => __('TinyUrl', CWP_TEXTDOMAIN)
|
386 |
+
|
387 |
+
),
|
388 |
+
'dependency'=> array(
|
389 |
+
"bitly-key"=>"bit.ly",
|
390 |
+
"bitly-user"=>"bit.ly"
|
391 |
+
)
|
392 |
+
),
|
393 |
+
|
394 |
+
'bitly-key' => array(
|
395 |
+
'id' => '22',
|
396 |
+
'name' => __('Bitly Key', CWP_TEXTDOMAIN),
|
397 |
+
'type' => 'text',
|
398 |
+
'slug' => 'bitly-key',
|
399 |
+
'option' => 'top_opt_bitly_key',
|
400 |
+
'description' => '',
|
401 |
+
'options' => '',
|
402 |
+
),
|
403 |
+
|
404 |
+
'bitly-user' => array(
|
405 |
+
'id' => '23',
|
406 |
+
'name' => __('Bitly User', CWP_TEXTDOMAIN),
|
407 |
+
'type' => 'text',
|
408 |
+
'slug' => 'bitly-user',
|
409 |
+
'option' => 'top_opt_bitly_user',
|
410 |
+
'description' => '',
|
411 |
+
'options' => '',
|
412 |
+
),
|
413 |
+
|
414 |
+
'custom-hashtag-option' => array(
|
415 |
+
'id' => '10',
|
416 |
+
'name' => __('Hashtags', CWP_TEXTDOMAIN),
|
417 |
+
'type' => 'select',
|
418 |
+
'slug' => 'custom-hashtag-option',
|
419 |
+
'option' => 'top_opt_custom_hashtag_option',
|
420 |
+
'description' => __('Include #hashtags in your auto posts?', CWP_TEXTDOMAIN),
|
421 |
+
'options' => array(
|
422 |
+
'nohashtag' => __('Don\'t add any hashtags', CWP_TEXTDOMAIN),
|
423 |
+
'common' => __('Common hashtags for all shares', CWP_TEXTDOMAIN),
|
424 |
+
'categories'=> __('Create hashtags from Categories', CWP_TEXTDOMAIN),
|
425 |
+
'tags' => __('Create hashtags from Tags', CWP_TEXTDOMAIN),
|
426 |
+
'custom' => __('Create hashtags from Custom Fields', CWP_TEXTDOMAIN)
|
427 |
+
),
|
428 |
+
'dependency'=> array(
|
429 |
+
"common-hashtags" =>"common",
|
430 |
+
"hashtags-length" =>"common,categories,tags,custom",
|
431 |
+
"common-hashtags" =>"common",
|
432 |
+
"custom-hashtag-field"=>"custom"
|
433 |
+
)
|
434 |
+
),
|
435 |
+
|
436 |
+
'common-hashtags' => array(
|
437 |
'id' => '11',
|
438 |
'name' => __('Common Hashtags', CWP_TEXTDOMAIN),
|
439 |
'type' => 'text',
|
441 |
'option' => 'top_opt_hashtags',
|
442 |
'description' => __('Specify which hashtags you want to be used. eg. #example, #example2', CWP_TEXTDOMAIN),
|
443 |
'options' => array()
|
444 |
+
),
|
445 |
|
446 |
+
'hashtags-length' => array(
|
447 |
'id' => '12',
|
448 |
'name' => __('Maximum Hashtags Length', CWP_TEXTDOMAIN),
|
449 |
'type' => 'text',
|
451 |
'option' => 'top_opt_hashtag_length',
|
452 |
'description' => __('Set to 0 (characters) to include all.', CWP_TEXTDOMAIN),
|
453 |
'options' => array()
|
454 |
+
),
|
455 |
|
456 |
+
'custom-hashtag-field' => array(
|
457 |
'id' => '13',
|
458 |
'name' => __('Hashtag Custom Field', CWP_TEXTDOMAIN),
|
459 |
'type' => 'text',
|
461 |
'option' => 'top_opt_custom_hashtag_field',
|
462 |
'description' => __('Fetch hashtags from specified custom field', CWP_TEXTDOMAIN),
|
463 |
'options' => array()
|
464 |
+
),
|
465 |
+
'use-image' => array(
|
466 |
+
'id' => '24',
|
467 |
+
'name' => __('Post with Image', CWP_TEXTDOMAIN),
|
468 |
+
'type' => 'checkbox',
|
469 |
+
'slug' => 'post-with-image',
|
470 |
+
'option' => 'top_opt_post_with_image',
|
471 |
+
'description' => __('Check if you want to add the post featured image to the share', CWP_TEXTDOMAIN),
|
472 |
+
'options' => array(),
|
473 |
+
"available_pro" => "yes"
|
474 |
+
)
|
475 |
),
|
476 |
+
"linkedin"=>array(
|
477 |
+
'tweet-content' => array(
|
478 |
+
'id' => '1',
|
479 |
+
'name' => __('Post Content', CWP_TEXTDOMAIN),
|
480 |
+
'type' => 'select',
|
481 |
+
'slug' => 'tweet-content',
|
482 |
+
'option' => 'top_opt_tweet_type',
|
483 |
+
'description' => __('What do you want to share?', CWP_TEXTDOMAIN),
|
484 |
+
'options' => array(
|
485 |
+
'title' => __('Title Only', CWP_TEXTDOMAIN),
|
486 |
+
'body' => __('Body Only', CWP_TEXTDOMAIN),
|
487 |
+
'titlenbody' => __('Title & Body', CWP_TEXTDOMAIN),
|
488 |
+
'custom-field' => __('Custom Field', CWP_TEXTDOMAIN)
|
489 |
+
),
|
490 |
+
"available_pro" => "yes"
|
491 |
+
),
|
492 |
+
'top_opt_tweet_length' => array(
|
493 |
+
'id' => '1',
|
494 |
+
'name' => __('Length', CWP_TEXTDOMAIN),
|
495 |
+
'type' => 'number',
|
496 |
+
'slug' => 'tweet-length',
|
497 |
+
'option' => 'top_opt_tweet_length',
|
498 |
+
'description' => __('The length of the tweet', CWP_TEXTDOMAIN),
|
499 |
+
'max-length' => 256,
|
500 |
+
'default_value' =>256,
|
501 |
+
"available_pro" => "yes"
|
502 |
+
),
|
503 |
+
|
504 |
+
'tweet-content-field' => array(
|
505 |
+
'id' => '2',
|
506 |
+
'name' => __('Post Content Custom Field', CWP_TEXTDOMAIN),
|
507 |
+
'type' => 'text',
|
508 |
+
'slug' => 'tweet-content-field',
|
509 |
+
'option' => 'top_opt_tweet_type_custom_field',
|
510 |
+
'description' => __('Which custom field do you want to fetch info from?', CWP_TEXTDOMAIN),
|
511 |
+
'options' => array(),
|
512 |
+
"available_pro" => "yes"
|
513 |
+
),
|
514 |
+
|
515 |
+
'additional-text' => array(
|
516 |
+
'id' => '3',
|
517 |
+
'name' => __('Additional Text', CWP_TEXTDOMAIN),
|
518 |
+
'type' => 'text',
|
519 |
+
'slug' => 'additional-text',
|
520 |
+
'option' => 'top_opt_add_text',
|
521 |
+
'description' => __('Text added to your auto posts', CWP_TEXTDOMAIN),
|
522 |
+
'options' => array(),
|
523 |
+
"available_pro" => "yes"
|
524 |
+
),
|
525 |
+
|
526 |
+
'additional-text-at' => array(
|
527 |
+
'id' => '4',
|
528 |
+
'name' => __('Additional Text At', CWP_TEXTDOMAIN),
|
529 |
+
'type' => 'select',
|
530 |
+
'slug' => 'additional-text-at',
|
531 |
+
'option' => 'top_opt_add_text_at',
|
532 |
+
'description' => __('Where do you want the text to be added?', CWP_TEXTDOMAIN),
|
533 |
+
'options' => array(
|
534 |
+
'beginning' => __('Beginning of Post', CWP_TEXTDOMAIN),
|
535 |
+
'end' => __('End of Post', CWP_TEXTDOMAIN)
|
536 |
+
),
|
537 |
+
"available_pro" => "yes"
|
538 |
+
),
|
539 |
+
|
540 |
+
'include-link' => array(
|
541 |
+
'id' => '5',
|
542 |
+
'name' => __('Include Link', CWP_TEXTDOMAIN),
|
543 |
+
'type' => 'select',
|
544 |
+
'slug' => 'include-link',
|
545 |
+
'option' => 'top_opt_include_link',
|
546 |
+
'description' => __('Include a link to your post?', CWP_TEXTDOMAIN),
|
547 |
+
'options' => array(
|
548 |
+
'true' => __('Yes', CWP_TEXTDOMAIN),
|
549 |
+
'false' => __('No', CWP_TEXTDOMAIN)
|
550 |
+
),
|
551 |
+
'dependency'=> array(
|
552 |
+
"url-from-custom-field"=>"true",
|
553 |
+
"use-url-shortner"=>"true",
|
554 |
+
),
|
555 |
+
"available_pro" => "yes"
|
556 |
+
|
557 |
+
|
558 |
+
),
|
559 |
+
|
560 |
+
'url-from-custom-field' => array(
|
561 |
+
'id' => '6',
|
562 |
+
'name' => __('Fetch URL From Custom Field', CWP_TEXTDOMAIN),
|
563 |
+
'type' => 'checkbox',
|
564 |
+
'slug' => 'url-from-custom-field',
|
565 |
+
'option' => 'top_opt_custom_url_option',
|
566 |
+
'description' => __('URL will be fetched from a custom field.', CWP_TEXTDOMAIN),
|
567 |
+
'options' => '',
|
568 |
+
'dependency'=> array(
|
569 |
+
"custom-field-url"=>"true"
|
570 |
+
),
|
571 |
+
"available_pro" => "yes"
|
572 |
+
),
|
573 |
+
|
574 |
+
'custom-field-url' => array(
|
575 |
+
'id' => '7',
|
576 |
+
'name' => __('URL Custom Field', CWP_TEXTDOMAIN),
|
577 |
+
'type' => 'text',
|
578 |
+
'slug' => 'custom-field-url',
|
579 |
+
'option' => 'top_opt_custom_url_field',
|
580 |
+
'description' => __('URL will be fetched from the specified custom field.', CWP_TEXTDOMAIN),
|
581 |
+
'options' => array(),
|
582 |
+
"available_pro" => "yes"
|
583 |
+
),
|
584 |
+
|
585 |
+
'use-url-shortner' => array(
|
586 |
+
'id' => '8',
|
587 |
+
'name' => __('Use URL Shortner', CWP_TEXTDOMAIN),
|
588 |
+
'type' => 'checkbox',
|
589 |
+
'slug' => 'use-url-shortner',
|
590 |
+
'option' => 'top_opt_use_url_shortner',
|
591 |
+
'description' => '',
|
592 |
+
'options' => '',
|
593 |
+
'dependency'=> array(
|
594 |
+
"url-shortner"=>"true"
|
595 |
+
),
|
596 |
+
"available_pro" => "yes"
|
597 |
+
),
|
598 |
+
|
599 |
+
|
600 |
+
|
601 |
+
'url-shortner' => array(
|
602 |
+
'id' => '9',
|
603 |
+
'name' => __('URL Shortner Service', CWP_TEXTDOMAIN),
|
604 |
+
'type' => 'select',
|
605 |
+
'slug' => 'url-shortner',
|
606 |
+
'option' => 'top_opt_url_shortner',
|
607 |
+
'description' => __('Shorten the link to your post.', CWP_TEXTDOMAIN),
|
608 |
+
'options' => array(
|
609 |
+
'wp_short_url' => __('wp short url', CWP_TEXTDOMAIN),
|
610 |
+
//'t.co' => __('t.co', CWP_TEXTDOMAIN),
|
611 |
+
'is.gd' => __('is.gd', CWP_TEXTDOMAIN),
|
612 |
+
'bit.ly' => __('bit.ly', CWP_TEXTDOMAIN),
|
613 |
+
//'tr.im' => __('tr.im', CWP_TEXTDOMAIN),
|
614 |
+
//'3.ly' => __('3.ly', CWP_TEXTDOMAIN),
|
615 |
+
//'u.nu' => __('u.nu', CWP_TEXTDOMAIN),
|
616 |
+
//'1click.at' => __('1click.at', CWP_TEXTDOMAIN),
|
617 |
+
//'tinyurl' => __('TinyUrl', CWP_TEXTDOMAIN)
|
618 |
+
|
619 |
+
),
|
620 |
+
'dependency'=> array(
|
621 |
+
"bitly-key"=>"bit.ly",
|
622 |
+
"bitly-user"=>"bit.ly"
|
623 |
+
),
|
624 |
+
"available_pro" => "yes"
|
625 |
+
),
|
626 |
+
|
627 |
+
'bitly-key' => array(
|
628 |
+
'id' => '22',
|
629 |
+
'name' => __('Bitly Key', CWP_TEXTDOMAIN),
|
630 |
+
'type' => 'text',
|
631 |
+
'slug' => 'bitly-key',
|
632 |
+
'option' => 'top_opt_bitly_key',
|
633 |
+
'description' => '',
|
634 |
+
'options' => '',
|
635 |
+
"available_pro" => "yes"
|
636 |
+
),
|
637 |
+
|
638 |
+
'bitly-user' => array(
|
639 |
+
'id' => '23',
|
640 |
+
'name' => __('Bitly User', CWP_TEXTDOMAIN),
|
641 |
+
'type' => 'text',
|
642 |
+
'slug' => 'bitly-user',
|
643 |
+
'option' => 'top_opt_bitly_user',
|
644 |
+
'description' => '',
|
645 |
+
'options' => '',
|
646 |
+
"available_pro" => "yes"
|
647 |
+
),
|
648 |
+
|
649 |
+
'custom-hashtag-option' => array(
|
650 |
+
'id' => '10',
|
651 |
+
'name' => __('Hashtags', CWP_TEXTDOMAIN),
|
652 |
+
'type' => 'select',
|
653 |
+
'slug' => 'custom-hashtag-option',
|
654 |
+
'option' => 'top_opt_custom_hashtag_option',
|
655 |
+
'description' => __('Include #hashtags in your auto posts?', CWP_TEXTDOMAIN),
|
656 |
+
'options' => array(
|
657 |
+
'nohashtag' => __('Don\'t add any hashtags', CWP_TEXTDOMAIN),
|
658 |
+
'common' => __('Common hashtags for all shares', CWP_TEXTDOMAIN),
|
659 |
+
'categories'=> __('Create hashtags from Categories', CWP_TEXTDOMAIN),
|
660 |
+
'tags' => __('Create hashtags from Tags', CWP_TEXTDOMAIN),
|
661 |
+
'custom' => __('Create hashtags from Custom Fields', CWP_TEXTDOMAIN)
|
662 |
+
),
|
663 |
+
'dependency'=> array(
|
664 |
+
"common-hashtags" =>"common",
|
665 |
+
"hashtags-length" =>"common,categories,tags,custom",
|
666 |
+
"common-hashtags" =>"common",
|
667 |
+
"custom-hashtag-field"=>"custom"
|
668 |
+
),
|
669 |
+
"available_pro" => "yes"
|
670 |
+
),
|
671 |
+
|
672 |
+
'common-hashtags' => array(
|
673 |
+
'id' => '11',
|
674 |
+
'name' => __('Common Hashtags', CWP_TEXTDOMAIN),
|
675 |
+
'type' => 'text',
|
676 |
+
'slug' => 'common-hashtags',
|
677 |
+
'option' => 'top_opt_hashtags',
|
678 |
+
'description' => __('Specify which hashtags you want to be used. eg. #example, #example2', CWP_TEXTDOMAIN),
|
679 |
+
'options' => array(),
|
680 |
+
"available_pro" => "yes"
|
681 |
+
),
|
682 |
+
|
683 |
+
'hashtags-length' => array(
|
684 |
+
'id' => '12',
|
685 |
+
'name' => __('Maximum Hashtags Length', CWP_TEXTDOMAIN),
|
686 |
+
'type' => 'text',
|
687 |
+
'slug' => 'hashtags-length',
|
688 |
+
'option' => 'top_opt_hashtag_length',
|
689 |
+
'description' => __('Set to 0 (characters) to include all.', CWP_TEXTDOMAIN),
|
690 |
+
'options' => array(),
|
691 |
+
"available_pro" => "yes"
|
692 |
+
),
|
693 |
+
|
694 |
+
'custom-hashtag-field' => array(
|
695 |
+
'id' => '13',
|
696 |
+
'name' => __('Hashtag Custom Field', CWP_TEXTDOMAIN),
|
697 |
+
'type' => 'text',
|
698 |
+
'slug' => 'custom-hashtag-field',
|
699 |
+
'option' => 'top_opt_custom_hashtag_field',
|
700 |
+
'description' => __('Fetch hashtags from specified custom field', CWP_TEXTDOMAIN),
|
701 |
+
'options' => array(),
|
702 |
+
"available_pro" => "yes"
|
703 |
+
),
|
704 |
+
'use-image' => array(
|
705 |
+
'id' => '24',
|
706 |
+
'name' => __('Post with Image', CWP_TEXTDOMAIN),
|
707 |
+
'type' => 'checkbox',
|
708 |
+
'slug' => 'post-with-image',
|
709 |
+
'option' => 'top_opt_post_with_image',
|
710 |
+
'description' => __('Check if you want to add the post featured image to the share', CWP_TEXTDOMAIN),
|
711 |
+
'options' => array(),
|
712 |
+
"available_pro" => "yes",
|
713 |
+
"available_pro" => "yes"
|
714 |
+
)
|
715 |
+
)
|
716 |
+
);
|
717 |
+
|
718 |
+
$cwp_top_fields = array(
|
719 |
+
|
720 |
|
721 |
'interval' => array(
|
722 |
'id' => '14',
|
724 |
'type' => 'text',
|
725 |
'slug' => 'interval',
|
726 |
'option' => 'top_opt_interval',
|
727 |
+
"available_pro" =>"no",
|
728 |
'description' => __('Minimum time between shares (Hour/Hours), 0.4 can be used also.', CWP_TEXTDOMAIN),
|
729 |
'options' => array()
|
730 |
),
|
761 |
|
762 |
|
763 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
764 |
|
765 |
'tweet-multiple-times' => array(
|
766 |
'id' => '25',
|
767 |
+
'name' => __('Share old posts more than once', CWP_TEXTDOMAIN),
|
768 |
'type' => 'checkbox',
|
769 |
'slug' => 'tweet-multiple-times',
|
770 |
'option' => 'top_opt_tweet_multiple_times',
|
776 |
|
777 |
'post-type' => array(
|
778 |
'id' => '18',
|
779 |
+
'name' => __('Post Type', CWP_TEXTDOMAIN),
|
780 |
'type' => 'custom-post-type',
|
781 |
'slug' => 'post-type',
|
782 |
'option' => 'top_opt_post_type',
|
783 |
'description' => __('What type of items do you want to share?', CWP_TEXTDOMAIN),
|
784 |
+
'options' => array(),
|
785 |
+
"available_pro" => "yes"
|
786 |
+
|
787 |
),
|
788 |
|
789 |
'analytics-tracking' => array(
|
790 |
'id' => '26',
|
791 |
+
'name' => __('Google Analytics Campaign Tracking', CWP_TEXTDOMAIN),
|
792 |
'type' => 'checkbox',
|
793 |
'slug' => 'ga-tracking',
|
794 |
'option' => 'top_opt_ga_tracking',
|
798 |
|
799 |
'exclude-specific-categories' => array(
|
800 |
'id' => '21',
|
801 |
+
'name' => __('Exclude Specific Categories', CWP_TEXTDOMAIN),
|
802 |
'type' => 'categories-list',
|
803 |
'slug' => 'exclude-specific-category',
|
804 |
'option' => 'top_opt_omit_cats',
|
inc/core.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
-
// Basic configuration
|
3 |
require_once(ROPPLUGINPATH."/inc/config.php");
|
4 |
-
// RopTwitterOAuth class
|
5 |
require_once(ROPPLUGINPATH."/inc/oAuth/twitteroauth.php");
|
6 |
|
7 |
if (!class_exists('CWP_TOP_Core')) {
|
@@ -9,9 +9,10 @@ if (!class_exists('CWP_TOP_Core')) {
|
|
9 |
|
10 |
// All fields
|
11 |
public static $fields;
|
|
|
12 |
// Number of fields
|
13 |
public static $noFields;
|
14 |
-
|
15 |
// Consumer key, Consumer Secret key, oAuth Callback Key
|
16 |
public $consumer;
|
17 |
public $lastID;
|
@@ -25,7 +26,7 @@ if (!class_exists('CWP_TOP_Core')) {
|
|
25 |
private $cwp_top_oauth_token_secret;
|
26 |
|
27 |
|
28 |
-
|
29 |
private $user_info;
|
30 |
|
31 |
// Plugin Status
|
@@ -33,10 +34,11 @@ if (!class_exists('CWP_TOP_Core')) {
|
|
33 |
// Interval Set
|
34 |
public $intervalSet;
|
35 |
public $cwp_twitter;
|
36 |
-
|
37 |
public function __construct() {
|
38 |
// Get all fields
|
39 |
global $cwp_top_fields;
|
|
|
40 |
|
41 |
// Set all authentication settings
|
42 |
$this->setAlloAuthSettings();
|
@@ -49,56 +51,88 @@ if (!class_exists('CWP_TOP_Core')) {
|
|
49 |
|
50 |
// Save all fields in static var
|
51 |
self::$fields = $cwp_top_fields;
|
|
|
52 |
|
53 |
// Save all number of fields in static var
|
54 |
self::$noFields = count(self::$fields);
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
public function addLocalization() {
|
58 |
-
|
59 |
-
load_plugin_textdomain(CWP_TEXTDOMAIN, false, dirname(ROPPLUGINBASENAME).'/languages/');
|
60 |
-
}
|
61 |
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
{
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
82 |
}
|
83 |
|
84 |
-
die(); // Required for AJAX
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
public function stopTweetOldPost()
|
88 |
{
|
|
|
89 |
//echo $this->pluginStatus;
|
90 |
// If the plugin is active
|
91 |
if($this->pluginStatus !== 'false') {
|
92 |
-
|
93 |
-
update_option('cwp_topnew_active_status', 'false');
|
94 |
-
update_option('cwp_topnew_notice', '');
|
95 |
-
update_option('top_opt_already_tweeted_posts',array());
|
96 |
-
|
97 |
-
// Clear all scheduled tweets
|
98 |
-
$this->clearScheduledTweets();
|
99 |
-
} else {
|
100 |
-
// Report that is already inactive
|
101 |
-
_e("ROP is already inactive!", CWP_TEXTDOMAIN);
|
102 |
}
|
103 |
|
104 |
die(); // Required for AJAX
|
@@ -110,14 +144,7 @@ if (!class_exists('CWP_TOP_Core')) {
|
|
110 |
$postPosts = get_option('top_opt_excluded_post');
|
111 |
|
112 |
if(!empty($postPosts) && is_array($postPosts)) {
|
113 |
-
|
114 |
-
foreach ($postPosts as $key => $cat) {
|
115 |
-
if($cat == $lastPostPosts) {
|
116 |
-
$postQueryPosts .= $cat;
|
117 |
-
} else {
|
118 |
-
$postQueryPosts .= $cat . ", ";
|
119 |
-
}
|
120 |
-
}
|
121 |
}
|
122 |
else
|
123 |
$postQueryPosts = get_option('top_opt_excluded_post');
|
@@ -138,40 +165,35 @@ if (!class_exists('CWP_TOP_Core')) {
|
|
138 |
|
139 |
public function getTweetsFromDB()
|
140 |
{
|
141 |
-
// Global WordPress $wpdb object.
|
142 |
global $wpdb;
|
143 |
|
144 |
// Generate the Tweet Post Date Range
|
145 |
$dateQuery = $this->getTweetPostDateRange();
|
146 |
-
|
147 |
// Get the number of tweets to be tweeted each interval.
|
148 |
$tweetCount = intval(get_option('top_opt_no_of_tweet'));
|
149 |
-
|
|
|
|
|
|
|
150 |
// Get post categories set.
|
151 |
// $postQueryCategories = $this->getTweetCategories();
|
152 |
$excludedIds = "";
|
153 |
$tweetedPosts = get_option("top_opt_already_tweeted_posts");
|
154 |
-
if
|
|
|
|
|
|
|
|
|
|
|
155 |
$tweetedPosts = array();
|
156 |
}
|
157 |
$postQueryExcludedPosts = $this->getExcludedPosts();
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
$
|
162 |
-
$
|
163 |
-
for ($k=0;$k<$nrOfExcludedPosts-1;$k++)
|
164 |
-
$excludedIds .=$excludedPosts[$k].", ";
|
165 |
-
if ($nrOfExcludedPosts>0) {
|
166 |
-
$lastId = $nrOfExcludedPosts-1;
|
167 |
-
$excludedIds .=$excludedPosts[$lastId];
|
168 |
-
}
|
169 |
-
//print_r($excludedIds);
|
170 |
-
// Get excluded categories.
|
171 |
-
$postQueryExcludedCategories = $this->getExcludedCategories();
|
172 |
-
//echo $postQueryExcludedCategories;
|
173 |
-
//print_r($postQueryExcludedCategories);
|
174 |
-
// Get post type set.
|
175 |
$somePostType = $this->getTweetPostType();
|
176 |
|
177 |
// Generate dynamic query.
|
@@ -185,110 +207,152 @@ if (!class_exists('CWP_TOP_Core')) {
|
|
185 |
|
186 |
// If there are no categories set, select the post from all.
|
187 |
//if(!empty($postQueryCategories)) {
|
188 |
-
|
189 |
-
|
190 |
|
191 |
if(!empty($postQueryExcludedCategories)) {
|
192 |
$query .= "AND ( {$wpdb->prefix}posts.ID NOT IN (
|
193 |
SELECT object_id
|
194 |
FROM {$wpdb->prefix}term_relationships
|
195 |
-
INNER JOIN {$wpdb->prefix}term_taxonomy ON ( {$wpdb->prefix}term_relationships.term_taxonomy_id = {$wpdb->prefix}term_taxonomy.term_taxonomy_id )
|
196 |
-
WHERE
|
197 |
-
|
|
|
|
|
|
|
|
|
198 |
}
|
|
|
199 |
|
200 |
-
|
201 |
-
$
|
202 |
}
|
203 |
-
|
204 |
$query .= "AND {$wpdb->prefix}posts.post_type IN ({$somePostType})
|
205 |
AND ({$wpdb->prefix}posts.post_status = 'publish')
|
206 |
GROUP BY {$wpdb->prefix}posts.ID
|
207 |
-
|
208 |
";
|
209 |
|
210 |
-
// Save the result in a var for future use.
|
211 |
$returnedPost = $wpdb->get_results($query);
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
return $returnedPost;
|
214 |
}
|
215 |
|
216 |
-
public function isPostWithImageEnabled () {
|
217 |
-
|
218 |
-
|
|
|
|
|
219 |
return false;
|
220 |
else
|
221 |
return true;
|
222 |
}
|
223 |
|
224 |
-
public function tweetOldPost($byID = false)
|
225 |
-
|
226 |
{
|
227 |
-
$returnedPost = $this->getTweetsFromDB();
|
228 |
if ($byID!==false) {
|
229 |
|
230 |
$returnedPost = $this->getTweetsFromDBbyID($byID);
|
231 |
-
}
|
232 |
|
|
|
|
|
233 |
|
234 |
-
|
235 |
-
|
236 |
-
// Get the number of tweets to be tweeted each interval.
|
237 |
-
$tweetCount = intval(get_option('top_opt_no_of_tweet'));
|
238 |
|
239 |
-
if (count($returnedPost) == 0 )
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
//foreach ($returnedPost as $post) {
|
253 |
-
// Generate a tweet from it based on user settings.
|
254 |
-
$finalTweet = $this->generateTweetFromPost($post);
|
255 |
-
// Tweet the post
|
256 |
-
if ($this->isPostWithImageEnabled()=="on") {
|
257 |
-
$resp = $this->tweetPostwithImage($finalTweet, $post->ID);
|
258 |
-
update_option('cwp_topnew_notice', $resp);
|
259 |
-
}
|
260 |
-
else {
|
261 |
-
$resp = $this->tweetPost($finalTweet);
|
262 |
-
update_option('cwp_topnew_notice', $resp);
|
263 |
}
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
}
|
|
|
|
|
288 |
}
|
289 |
|
290 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
|
|
|
|
|
|
|
292 |
public function findInString($where,$what) {
|
293 |
if (!is_string($where)) {
|
294 |
return false;
|
@@ -298,61 +362,73 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
298 |
}
|
299 |
|
300 |
public function getNotice() {
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
else if ( $notice !== "OK" && !is_object($notice) && $this->findInString($notice,'UPDAT')===false && $notice!=="")
|
307 |
-
echo "Error for your last post was :'".$notice."'";
|
308 |
-
else
|
309 |
-
if (is_object($notice) && isset($notice->text) || $notice=="OK" || strpos($notice,'UPDAT')!==false) {
|
310 |
-
echo "Congrats! Your last post was revived successfully";
|
311 |
-
} else if ($notice!="") {
|
312 |
-
echo "Error for your last post was : ".$notice;
|
313 |
}
|
314 |
-
|
315 |
die();
|
316 |
}
|
317 |
|
318 |
public function tweetNow() {
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
}
|
321 |
|
322 |
public function viewSampleTweet()
|
323 |
{
|
324 |
|
|
|
325 |
$returnedTweets = $this->getTweetsFromDB();
|
326 |
-
$image="";
|
327 |
-
//var_dump($returnedTweets);
|
328 |
-
$finalTweetsPreview = $this->generateTweetFromPost($returnedTweets[0]);
|
329 |
-
if (is_array($finalTweetsPreview)){
|
330 |
-
$finalTweetsPreview = $finalTweetsPreview['message'];
|
331 |
-
}
|
332 |
-
$result = $finalTweetsPreview;
|
333 |
-
update_option( 'top_lastID', $returnedTweets[0]->ID);
|
334 |
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
|
347 |
-
|
348 |
-
endif;
|
349 |
|
350 |
-
$result = '<img class="top_preview" src="'.$image.'"/>'.$finalTweetsPreview;
|
351 |
-
}
|
352 |
-
|
353 |
-
echo $result;
|
354 |
|
355 |
-
|
356 |
die(); // required
|
357 |
}
|
358 |
|
@@ -361,7 +437,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
361 |
* @param [type] $postId Post ID
|
362 |
* @return boolean True if not already tweeted / False if already tweeted
|
363 |
*/
|
364 |
-
|
365 |
public function isNotAlreadyTweeted($postId) {
|
366 |
// Get all already tweeted posts
|
367 |
|
@@ -371,23 +447,23 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
371 |
add_option("top_opt_already_tweeted_posts");
|
372 |
return true;
|
373 |
}
|
374 |
-
|
375 |
-
|
376 |
if (!empty($tweetedPosts) && is_array($tweetedPosts) ) {
|
377 |
|
378 |
-
|
379 |
-
|
380 |
else
|
381 |
return true;
|
382 |
-
|
383 |
else
|
384 |
-
{
|
385 |
-
|
386 |
}
|
387 |
}
|
388 |
|
389 |
public function getStrLen($string) {
|
390 |
-
|
391 |
if (function_exists("mb_strlen"))
|
392 |
return mb_strlen($string);
|
393 |
else
|
@@ -407,359 +483,633 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
407 |
* @param [type] $postQuery Returned post from database
|
408 |
* @return [type] Generated Tweet
|
409 |
*/
|
410 |
-
|
411 |
-
public function generateTweetFromPost($postQuery)
|
412 |
{
|
413 |
|
414 |
// Save all user settings in variables.
|
|
|
415 |
$tweetedPosts = get_option("top_opt_already_tweeted_posts");
|
416 |
-
$
|
417 |
-
$
|
418 |
-
$
|
419 |
-
$
|
420 |
-
$
|
421 |
-
$
|
422 |
-
$
|
423 |
-
$
|
424 |
-
$
|
425 |
-
$
|
426 |
-
$
|
427 |
-
$
|
428 |
-
$
|
429 |
-
$
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
$
|
434 |
-
$
|
435 |
-
|
|
|
436 |
// If the user set to not use hashtags, set it to empty variable.
|
437 |
-
if($hashtags == 'nohashtag') {
|
438 |
$newHashtags = "";
|
439 |
}
|
440 |
-
|
441 |
// Generate the tweet content.
|
442 |
-
switch ($tweet_content) {
|
443 |
case 'title':
|
444 |
-
$tweetContent = $postQuery->post_title
|
445 |
break;
|
446 |
-
|
447 |
case 'body':
|
448 |
-
$tweetContent = get_post_field('post_content', $postQuery->ID)
|
449 |
break;
|
450 |
-
|
451 |
case 'titlenbody':
|
452 |
-
$tweetContent = $postQuery->post_title . " " . get_post_field('post_content', $postQuery->ID)
|
453 |
break;
|
454 |
-
|
455 |
case 'custom-field':
|
456 |
-
$tweetContent = get_post_meta($postQuery->ID, $tweet_content_custom_field,true);
|
457 |
break;
|
458 |
default:
|
459 |
-
$tweetContent =
|
460 |
break;
|
461 |
}
|
462 |
-
|
463 |
// Trim new empty lines.
|
464 |
-
|
465 |
-
$tweetContent = strip_tags(html_entity_decode($tweetContent));
|
|
|
466 |
//$tweetContent = esc_html($tweetContent);
|
467 |
-
//$tweetContent = esc_html($tweetContent);
|
468 |
//$tweetContent = trim(preg_replace('/\s+/', ' ', $tweetContent));
|
469 |
-
|
470 |
// Remove html entinies.
|
471 |
//$tweetContent = preg_replace("/&#?[a-z0-9]+;/i","", $tweetContent);
|
472 |
-
|
473 |
// Strip all shortcodes from content.
|
474 |
-
$tweetContent
|
475 |
-
$fTweet
|
476 |
-
$fTweet['link'] = get_permalink($postQuery->ID);
|
477 |
// Generate the post link.
|
478 |
-
if($include_link == 'true') {
|
479 |
-
if($fetch_url_from_custom_field == 'on') {
|
480 |
-
$post_url = "" . get_post_meta($postQuery->ID, $custom_field_url,true);
|
481 |
-
} else {
|
482 |
-
$post_url = "" . get_permalink($postQuery->ID);
|
483 |
}
|
484 |
-
|
485 |
-
|
486 |
-
$post_url = "" . get_permalink($postQuery->ID);
|
487 |
-
|
488 |
-
if ($ga_tracking=="on") {
|
489 |
-
$param = 'utm_source=ReviveOldPost&utm_medium=social&utm_campaign=ReviveOldPost';
|
490 |
-
$post_url = rtrim($post_url);
|
491 |
-
if (strpos($post_url,"?")===FALSE)
|
492 |
-
$post_url.='?'.$param;
|
493 |
-
else
|
494 |
-
$post_url.='&'.$param;
|
495 |
}
|
496 |
-
|
497 |
-
|
498 |
-
$post_url =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
}
|
500 |
-
|
501 |
-
if ($post_url=="")
|
502 |
-
$post_url = "" . get_permalink($postQuery->ID);
|
503 |
-
|
504 |
$post_url = $post_url . "";
|
505 |
-
|
506 |
-
|
507 |
-
}
|
508 |
-
|
509 |
// Generate the hashtags
|
510 |
$newHashtags = "";
|
511 |
-
if($hashtags != 'nohashtag') {
|
512 |
-
|
513 |
-
switch ($hashtags) {
|
514 |
case 'common':
|
515 |
$newHashtags = $common_hashtags;
|
516 |
break;
|
517 |
-
|
518 |
case 'categories':
|
519 |
-
|
520 |
-
|
521 |
-
$postCategories
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
$newHashtags = $newHashtags . " #" . preg_replace('/-/','',strtolower($category->slug));
|
526 |
-
}
|
527 |
}
|
528 |
-
}
|
529 |
-
|
530 |
-
|
531 |
-
$newHashtags = topProGetCustomCategories($postQuery
|
532 |
}
|
533 |
-
|
534 |
break;
|
535 |
-
|
536 |
case 'tags':
|
537 |
-
$postTags = wp_get_post_tags($postQuery->ID);
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
$newHashtags = $newHashtags . " #" . preg_replace('/-/','',strtolower($postTag->slug));
|
542 |
}
|
543 |
}
|
544 |
break;
|
545 |
-
|
546 |
case 'custom':
|
547 |
-
$newHashtags = get_post_meta($postQuery->ID, $hashtag_custom_field, true);
|
548 |
-
break;
|
549 |
default:
|
550 |
break;
|
551 |
}
|
552 |
}
|
553 |
-
|
554 |
-
|
555 |
// Generate the additional text
|
556 |
-
if($additional_text_at == 'beginning') {
|
557 |
$additionalTextBeginning = $additional_text . " ";
|
558 |
}
|
559 |
-
|
560 |
-
if($additional_text_at == 'end') {
|
561 |
$additionalTextEnd = " " . $additional_text;
|
562 |
}
|
563 |
-
|
564 |
// Calculate the final tweet length
|
565 |
$finalTweetLength = 0;
|
566 |
-
|
567 |
-
|
568 |
-
$
|
569 |
}
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
$postURLLength = $this->getStrLen($post_url);
|
574 |
//$post_url = urlencode($post_url);
|
575 |
-
if ($postURLLength > 21)
|
576 |
-
|
|
|
|
|
577 |
}
|
578 |
-
|
579 |
-
|
580 |
-
$
|
581 |
-
$finalTweetLength += intval($hashtagsLength);
|
582 |
}
|
583 |
-
|
584 |
-
if ($post_with_image == "on")
|
585 |
$finalTweetLength += 25;
|
586 |
-
|
587 |
-
$finalTweetLength =
|
588 |
-
|
589 |
-
$tweetContent = $this->ropSubstr($tweetContent,0, $finalTweetLength) . " ";
|
590 |
-
|
591 |
$finalTweet = $additionalTextBeginning . $tweetContent . " %short_urlshort_urlur% " . $newHashtags . $additionalTextEnd;
|
592 |
-
$finalTweet = $this->ropSubstr($finalTweet,0,
|
593 |
-
$finalTweet = str_replace("%short_urlshort_urlur%"
|
594 |
-
|
595 |
-
$
|
596 |
-
if ($post_url!="")
|
597 |
$fTweet['link'] = $post_url;
|
|
|
598 |
//var_dump($fTweet['link']);
|
599 |
// Strip any tags and return the final tweet
|
600 |
return $fTweet;
|
601 |
-
|
602 |
-
|
603 |
-
//var_dump(get_the_terms($postQuery->ID,'download_category'));
|
604 |
}
|
605 |
|
606 |
/**
|
607 |
* Tweets the returned post from generateTweetFromPost()
|
608 |
* @param [type] $finalTweet Generated tweet
|
609 |
*/
|
610 |
-
|
611 |
-
public function tweetPost($finalTweet)
|
612 |
-
{
|
613 |
-
|
614 |
-
$nrOfUsers = count($this->users);
|
615 |
|
616 |
foreach ($this->users as $user) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
|
618 |
-
|
619 |
-
|
620 |
-
// Create a new twitter connection using the stored user credentials.
|
621 |
-
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
622 |
-
// Post the new tweet
|
623 |
-
$status = $connection->post('statuses/update', array('status' => $finalTweet['message']));
|
624 |
-
//return $status;
|
625 |
-
if ($nrOfUsers == $k)
|
626 |
-
return $status;
|
627 |
-
else
|
628 |
-
$k++;
|
629 |
-
break;
|
630 |
-
|
631 |
-
case 'facebook':
|
632 |
-
$args = array(
|
633 |
-
|
634 |
-
'body' => array( 'message' => $finalTweet['message'],'link' => $finalTweet['link']),
|
635 |
-
|
636 |
-
);
|
637 |
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
else
|
643 |
-
$k++;
|
644 |
-
|
645 |
-
break;
|
646 |
|
647 |
-
|
648 |
-
|
649 |
-
$lk_message = str_replace("&", "&",$finalTweet['message']);
|
650 |
-
$sharedLink = str_replace("&", "&",$finalTweet['link']);
|
651 |
-
|
652 |
-
$visibility="anyone";
|
653 |
-
$content_xml.="<content><title>".$lk_message."</title><submitted-url>".$sharedLink."</submitted-url></content>";
|
654 |
-
$url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$user["oauth_token"];
|
655 |
|
|
|
|
|
|
|
|
|
656 |
|
657 |
-
$xml = '<?xml version="1.0" encoding="UTF-8"?><share>
|
658 |
-
' . $content_xml . '
|
659 |
-
<visibility>
|
660 |
-
<code>' . $visibility . '</code>
|
661 |
-
</visibility>
|
662 |
-
</share>';
|
663 |
-
$headers = array(
|
664 |
-
"Content-type: text/xml",
|
665 |
-
"Content-length: " . strlen($xml),
|
666 |
-
"Connection: close",
|
667 |
-
);
|
668 |
-
|
669 |
-
if (!function_exists('curl_version'))
|
670 |
-
update_option('cwp_topnew_notice',"You host does not support CURL");
|
671 |
-
$ch = curl_init();
|
672 |
-
curl_setopt($ch, CURLOPT_URL,$url);
|
673 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
674 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
675 |
-
curl_setopt($ch, CURLOPT_POST, true);
|
676 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
|
677 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
678 |
|
679 |
-
|
|
|
680 |
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
if(curl_errno($ch))
|
687 |
-
print curl_error($ch);
|
688 |
-
else
|
689 |
-
curl_close($ch);
|
690 |
-
|
691 |
-
break;
|
692 |
|
693 |
-
|
694 |
-
|
695 |
-
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
696 |
-
// Post the new tweet
|
697 |
-
$status = $connection->post('statuses/update', array('status' => $finalTweet['message']));
|
698 |
-
//return $status;
|
699 |
-
if ($nrOfUsers == $k)
|
700 |
-
return $status;
|
701 |
-
else
|
702 |
-
$k++;
|
703 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
704 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
|
706 |
}
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
}
|
711 |
}
|
712 |
|
713 |
|
714 |
-
public function
|
715 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
|
717 |
$k=1;
|
718 |
$tw=0;
|
719 |
$nrOfUsers = count($this->users);
|
|
|
720 |
|
721 |
foreach ($this->users as $user) {
|
722 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
723 |
switch ($user['service']) {
|
724 |
case 'twitter':
|
725 |
// Create a new twitter connection using the stored user credentials.
|
726 |
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
727 |
// Post the new tweet
|
728 |
-
if (
|
729 |
-
|
|
|
|
|
730 |
//var_dump($status);
|
731 |
-
|
732 |
//} else {
|
733 |
/// //$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
734 |
-
|
735 |
-
|
736 |
//}
|
737 |
|
738 |
if ($nrOfUsers == $k)
|
739 |
return $status;
|
740 |
else
|
741 |
-
$k++;
|
742 |
|
743 |
case 'facebook':
|
744 |
$args = array(
|
745 |
-
|
746 |
'body' => array( 'message' => $finalTweet['message'],'link' => $finalTweet['link']),
|
747 |
-
|
748 |
-
|
749 |
|
750 |
$pp=wp_remote_post("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/$user[id]/feed?access_token=$user[oauth_token]",$args);
|
751 |
if ($nrOfUsers == $k)
|
752 |
return $pp['response']['message'];
|
753 |
else
|
754 |
$k++;
|
755 |
-
|
756 |
break;
|
757 |
|
758 |
case 'linkedin':
|
759 |
|
760 |
$lk_message = str_replace("&", "&",$finalTweet['message']);
|
761 |
$sharedLink = str_replace("&", "&",$finalTweet['link']);
|
762 |
-
|
763 |
$visibility="anyone";
|
764 |
$content_xml.="<content><title>".$lk_message."</title><submitted-url>".$sharedLink."</submitted-url></content>";
|
765 |
$url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$user["oauth_token"];
|
@@ -771,14 +1121,14 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
771 |
<code>' . $visibility . '</code>
|
772 |
</visibility>
|
773 |
</share>';
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
);
|
779 |
-
|
780 |
-
|
781 |
-
$ch = curl_init();
|
782 |
curl_setopt($ch, CURLOPT_URL,$url);
|
783 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
784 |
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
@@ -794,87 +1144,84 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
794 |
$k++;
|
795 |
|
796 |
if(curl_errno($ch))
|
797 |
-
|
798 |
else
|
799 |
-
|
800 |
-
|
801 |
break;
|
802 |
default:
|
803 |
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
804 |
// Post the new tweet
|
805 |
-
if (
|
806 |
-
|
807 |
-
|
|
|
808 |
if ($nrOfUsers == $k)
|
809 |
return $status;
|
810 |
else
|
811 |
-
$k++;
|
|
|
812 |
|
813 |
-
|
814 |
-
}
|
815 |
//sleep(100);
|
816 |
}
|
817 |
-
}
|
818 |
-
|
819 |
// Generates the tweet date range based on the user input.
|
820 |
public function getTweetPostDateRange()
|
821 |
{
|
822 |
if (get_option('top_opt_max_age_limit')==0 )
|
823 |
$limit = 9999;
|
824 |
else
|
825 |
-
$limit = get_option('top_opt_max_age_limit');
|
826 |
-
|
827 |
-
$minAgeLimit = "-" . get_option('top_opt_age_limit') . " days";
|
828 |
-
|
829 |
-
$maxAgeLimit = "-" . $limit . " days";
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
$minLimit = current_time('timestamp') - get_option('top_opt_age_limit')*24*60*60;
|
834 |
-
$maxLimit = current_time('timestamp') - $limit*24*60*60;
|
835 |
-
|
836 |
-
$minAgeLimit = date("Y-m-d H:i:s", $minLimit);
|
837 |
-
$maxAgeLimit = date("Y-m-d H:i:s", $maxLimit);
|
838 |
-
|
839 |
-
if(isset($minAgeLimit) || isset($maxAgeLimit)) {
|
840 |
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
}
|
846 |
|
847 |
-
|
848 |
-
$dateQuery['after'] = $minAgeLimit;
|
849 |
-
}
|
850 |
|
851 |
-
|
|
|
|
|
852 |
|
853 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
854 |
|
855 |
-
if(!empty($dateQuery)) {
|
856 |
-
return $dateQuery;
|
857 |
}
|
858 |
|
859 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
860 |
}
|
861 |
|
862 |
// Gets the omited tweet categories
|
863 |
-
|
864 |
public function getExcludedCategories()
|
865 |
{
|
866 |
$postQueryCategories = "";
|
867 |
$postCategories = get_option('top_opt_omit_cats');
|
868 |
|
869 |
if(!empty($postCategories) && is_array($postCategories)) {
|
870 |
-
$
|
871 |
-
foreach ($postCategories as $key => $cat) {
|
872 |
-
if($cat == $lastPostCategory) {
|
873 |
-
$postQueryCategories .= $cat;
|
874 |
-
} else {
|
875 |
-
$postQueryCategories .= $cat . ", ";
|
876 |
-
}
|
877 |
-
}
|
878 |
}
|
879 |
else
|
880 |
$postQueryCategories = get_option('top_opt_omit_cats');
|
@@ -889,17 +1236,10 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
889 |
$top_opt_post_type = get_option('top_opt_post_type');
|
890 |
|
891 |
if(!empty($top_opt_post_type) && is_array($top_opt_post_type)) {
|
892 |
-
$
|
893 |
-
foreach ($top_opt_post_type as $key => $cat) {
|
894 |
-
if($cat == $lastPostCategory) {
|
895 |
-
$postQueryPostTypes .= "'".$cat."'";
|
896 |
-
} else {
|
897 |
-
$postQueryPostTypes .= "'".$cat."'" . ", ";
|
898 |
-
}
|
899 |
-
}
|
900 |
}
|
901 |
else
|
902 |
-
$postQueryPostTypes =
|
903 |
|
904 |
return $postQueryPostTypes;
|
905 |
|
@@ -910,9 +1250,9 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
910 |
public function createCustomSchedule($schedules)
|
911 |
{
|
912 |
$schedules['cwp_top_schedule'] = array(
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
|
917 |
return $schedules;
|
918 |
}
|
@@ -920,7 +1260,10 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
920 |
// Clears the custom Tweet Old Post cron job.
|
921 |
public function clearScheduledTweets()
|
922 |
{
|
923 |
-
|
|
|
|
|
|
|
924 |
}
|
925 |
|
926 |
// Deactivation hook
|
@@ -932,7 +1275,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
932 |
}
|
933 |
|
934 |
// Sets all authentication settings
|
935 |
-
public function setAlloAuthSettings()
|
936 |
{
|
937 |
global $cwp_top_settings;
|
938 |
|
@@ -940,16 +1283,41 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
940 |
$this->consumerSecret = $cwp_top_settings['oAuth_settings']['consumer_secret'];
|
941 |
$this->oAuthCallback = CURRENTURL;
|
942 |
|
943 |
-
$this->cwp_top_access_token = get_option('cwp_top_access_token');
|
944 |
$this->cwp_top_oauth_token = get_option('cwp_top_oauth_token');
|
945 |
$this->cwp_top_oauth_token_secret = get_option('cwp_top_oauth_token_secret');
|
946 |
|
947 |
-
$this->user_info = get_option('cwp_top_oauth_user_details');
|
948 |
$this->users = get_option('cwp_top_logged_in_users');
|
|
|
|
|
|
|
|
|
|
|
949 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
950 |
$this->pluginStatus = get_option('cwp_topnew_active_status');
|
951 |
$this->intervalSet = get_option('top_opt_interval');
|
952 |
|
|
|
953 |
//update_option('cwp_top_logged_in_users', '');
|
954 |
}
|
955 |
|
@@ -984,65 +1352,65 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
984 |
|
985 |
if(in_array($newUser, $loggedInUsers)) {
|
986 |
echo "You already added that user! no can do !";
|
987 |
-
} else {
|
988 |
array_push($loggedInUsers, $newUser);
|
989 |
update_option('cwp_top_logged_in_users', $loggedInUsers);
|
990 |
}
|
991 |
|
992 |
-
header("Location: " .
|
993 |
exit;
|
994 |
}
|
995 |
}
|
996 |
|
997 |
if(isset($_REQUEST['state']) && (get_option('top_fb_session_state') === $_REQUEST['state'])) {
|
998 |
-
|
999 |
$token_url = "https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/oauth/access_token?"
|
1000 |
-
|
1001 |
-
|
1002 |
|
1003 |
$params = null;$access_token="";
|
1004 |
$response = wp_remote_get($token_url);
|
1005 |
-
|
1006 |
if(is_array($response))
|
1007 |
{
|
1008 |
if(isset($response['body']))
|
1009 |
{
|
1010 |
parse_str($response['body'], $params);
|
1011 |
if(isset($params['access_token']))
|
1012 |
-
|
1013 |
}
|
1014 |
}
|
1015 |
|
1016 |
if($access_token!="")
|
1017 |
-
{
|
1018 |
update_option('top_fb_token',$access_token);
|
1019 |
-
|
1020 |
}
|
1021 |
-
header("Location: " .
|
1022 |
}
|
1023 |
-
|
1024 |
if (isset($_GET['code'])&&isset($_GET['state'])&&get_option('top_lk_session_state') == $_GET['state']) {
|
1025 |
|
1026 |
$lk_auth_token = get_option('cwp_top_lk_app_id');
|
1027 |
$lk_auth_secret = get_option('cwp_top_lk_app_secret');
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
$url = 'https://www.linkedin.com/uas/oauth2/accessToken?' . http_build_query($params);
|
1036 |
//echo $url;
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
}
|
1047 |
|
1048 |
$url = 'https://api.linkedin.com/v1/people/~:(id,picture-url,first_name,last_name)?oauth2_access_token='.$token->access_token;
|
@@ -1051,34 +1419,34 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1051 |
$response = wp_remote_retrieve_body($response);
|
1052 |
//print_r($response);
|
1053 |
$person = simplexml_load_string($response);
|
1054 |
-
|
1055 |
if (isset($person->id)) {
|
1056 |
$user_details = array('profile_image_url' => (string)$person->{'picture-url'},'name'=> (string)$person->{'first-name'} );
|
1057 |
-
|
1058 |
$newUser = array(
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
|
1066 |
$loggedInUsers = get_option('cwp_top_logged_in_users');
|
1067 |
if(empty($loggedInUsers)) { $loggedInUsers = array(); }
|
1068 |
|
1069 |
foreach ($loggedInUsers as $key=>$user) {
|
1070 |
-
if ($user['user_id'] == $person->id)
|
1071 |
unset($loggedInUsers[$key]);
|
1072 |
}
|
1073 |
|
1074 |
if(in_array($newUser, $loggedInUsers)) {
|
1075 |
echo "You already added that user! no can do !";
|
1076 |
-
} else {
|
1077 |
array_push($loggedInUsers, $newUser);
|
1078 |
update_option('cwp_top_logged_in_users', $loggedInUsers);
|
1079 |
}
|
1080 |
}
|
1081 |
-
|
1082 |
}
|
1083 |
|
1084 |
|
@@ -1107,36 +1475,38 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1107 |
foreach ($loggedInUsers as $key=>$user) {
|
1108 |
if ($user['service'] === "linkedin"&&$lk===0) {
|
1109 |
$lk++;
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
|
1115 |
}
|
1116 |
|
1117 |
if ($user['service'] === "facebook"&&$fb===0) {
|
1118 |
$top_session_state_fb = md5(uniqid(rand(), TRUE));
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
|
1125 |
header("Location: " . $dialog_url);
|
1126 |
}
|
1127 |
}
|
1128 |
-
|
1129 |
}
|
1130 |
|
1131 |
// Adds pages
|
1132 |
public function displayPages()
|
1133 |
{
|
|
|
|
|
1134 |
$social_network = $_POST['social_network'];
|
1135 |
$access_token = get_option('top_fb_token');
|
1136 |
|
1137 |
switch ($social_network) {
|
1138 |
-
|
1139 |
-
|
1140 |
$pp=wp_remote_get("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/me/accounts?access_token=$access_token&limit=100&offset=0");
|
1141 |
//print_r($pp);
|
1142 |
$me=wp_remote_get("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/me/?access_token=$access_token&limit=100&offset=0");
|
@@ -1153,7 +1523,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1153 |
$profile['access_token'] = $access_token;
|
1154 |
if(is_array($pagearray1->data))
|
1155 |
array_unshift($pagearray1->data, $profile);
|
1156 |
-
|
1157 |
$result1 = json_encode($pagearray1);
|
1158 |
//print_r($results1);
|
1159 |
echo $result1;
|
@@ -1163,20 +1533,33 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1163 |
}
|
1164 |
die(); // Required
|
1165 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1166 |
|
1167 |
-
|
1168 |
public function addPages()
|
1169 |
{
|
|
|
|
|
1170 |
$social_network = $_POST['social_network'];
|
1171 |
$access_token = $_POST['page_token'];
|
1172 |
$page_id= $_POST['page_id'];
|
1173 |
|
1174 |
switch ($social_network) {
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
'user_id' => $page_id,
|
1181 |
'oauth_token' => $access_token,
|
1182 |
'oauth_token_secret' => "",
|
@@ -1188,90 +1571,116 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1188 |
if(empty($loggedInUsers)) { $loggedInUsers = array(); }
|
1189 |
|
1190 |
foreach ($loggedInUsers as $key=>$user) {
|
1191 |
-
if ($user['user_id'] == $page_id)
|
1192 |
unset($loggedInUsers[$key]);
|
1193 |
}
|
1194 |
|
1195 |
if(in_array($newUser, $loggedInUsers)) {
|
1196 |
echo "You already added that user! no can do !";
|
1197 |
-
} else {
|
1198 |
array_push($loggedInUsers, $newUser);
|
1199 |
update_option('cwp_top_logged_in_users', $loggedInUsers);
|
1200 |
-
echo
|
1201 |
}
|
1202 |
|
1203 |
-
|
1204 |
break;
|
1205 |
}
|
1206 |
die(); // Required
|
1207 |
}
|
1208 |
|
1209 |
-
// Adds new account
|
1210 |
-
public function addNewAccount()
|
1211 |
-
{
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1250 |
|
1251 |
-
|
1252 |
|
1253 |
-
update_option('top_lk_session_state',$top_session_state);
|
1254 |
-
if (isset($_POST['app_id'])){
|
1255 |
-
update_option('cwp_top_lk_app_id', $_POST['app_id']);
|
1256 |
-
update_option('cwp_top_lk_app_secret', $_POST['app_secret']);
|
1257 |
-
}
|
1258 |
-
if (function_exists('topProAddNewAccount')) {
|
1259 |
-
echo $url;
|
1260 |
-
}
|
1261 |
-
else{
|
1262 |
-
update_option('cwp_topnew_notice',"You need to <a target='_blank' href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=topplusacc&utm_medium=announce&utm_campaign=top&upgrade=true'>upgrade to the PRO version</a> in order to add a Linkedin account, fellow pirate!");
|
1263 |
-
echo "You need to <a target='_blank' href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=topplusacc&utm_medium=announce&utm_campaign=top&upgrade=true'>upgrade to the PRO version</a> in order to add more accounts, fellow pirate!";
|
1264 |
|
1265 |
-
}
|
1266 |
-
|
1267 |
-
break;
|
1268 |
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
|
|
|
1273 |
|
|
|
1274 |
|
|
|
1275 |
|
1276 |
die(); // Required
|
1277 |
}
|
@@ -1279,8 +1688,11 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1279 |
// Adds more than one account
|
1280 |
public function addNewAccountPro()
|
1281 |
{
|
1282 |
-
|
1283 |
-
|
|
|
|
|
|
|
1284 |
}
|
1285 |
else{
|
1286 |
update_option('cwp_topnew_notice',"You need to <a target='_blank' href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=topplusacc&utm_medium=announce&utm_campaign=top&upgrade=true'>upgrade to the PRO version</a> in order to add more accounts, fellow pirate!");
|
@@ -1293,7 +1705,8 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1293 |
// Gets the next tweet interval.
|
1294 |
public function getNextTweetInterval()
|
1295 |
{
|
1296 |
-
$timestamp = wp_next_scheduled( '
|
|
|
1297 |
//echo $timestamp;
|
1298 |
//$timestamp = date("Y-m-d H:i:s", $timestamp);
|
1299 |
//$timeLeft = get_date_from_gmt($timestamp);
|
@@ -1306,7 +1719,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1306 |
{
|
1307 |
if(!empty($this->cwp_top_oauth_token) && !empty($this->cwp_top_oauth_token_secret)) {
|
1308 |
return true;
|
1309 |
-
} else {
|
1310 |
return false;
|
1311 |
}
|
1312 |
}
|
@@ -1314,6 +1727,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1314 |
// Clears all Twitter user credentials.
|
1315 |
public function logOutUser()
|
1316 |
{
|
|
|
1317 |
$userID = $_POST['user_id'];
|
1318 |
|
1319 |
$users = get_option('cwp_top_logged_in_users');
|
@@ -1333,16 +1747,127 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1333 |
die();
|
1334 |
}
|
1335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1336 |
// Updates all options.
|
1337 |
public function updateAllOptions()
|
1338 |
{
|
|
|
1339 |
$dataSent = $_POST['dataSent']['dataSent'];
|
1340 |
-
|
1341 |
$options = array();
|
1342 |
-
parse_str($dataSent, $options);
|
1343 |
-
|
1344 |
-
//print_r($options);
|
1345 |
|
|
|
1346 |
foreach ($options as $option => $newValue) {
|
1347 |
//$newValue = sanitize_text_field($newValue);
|
1348 |
update_option($option, $newValue);
|
@@ -1383,31 +1908,88 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1383 |
}
|
1384 |
|
1385 |
//update_option("top_opt_already_tweeted_posts", array());
|
|
|
|
|
1386 |
|
|
|
|
|
|
|
1387 |
die();
|
1388 |
}
|
1389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1390 |
public function top_admin_notice() {
|
1391 |
global $current_user ;
|
1392 |
-
|
1393 |
-
|
1394 |
if ( ! get_user_meta($user_id, 'top_ignore_notice3') ) {
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
}
|
1399 |
}
|
1400 |
public function top_nag_ignore() {
|
|
|
1401 |
global $current_user;
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
}
|
1407 |
}
|
1408 |
|
1409 |
public function resetAllOptions()
|
1410 |
{
|
|
|
|
|
1411 |
update_option('activation_hook_test_motherfucker', "Well, the plugin was activated!");
|
1412 |
|
1413 |
$defaultOptions = array(
|
@@ -1427,7 +2009,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1427 |
'top_opt_hashtags' => '',
|
1428 |
'top_opt_hashtag_length' => '0',
|
1429 |
'top_opt_custom_hashtag_field' => '',
|
1430 |
-
'top_opt_interval' => '
|
1431 |
'top_opt_age_limit' => '30',
|
1432 |
'top_opt_max_age_limit' => '0',
|
1433 |
'top_opt_no_of_tweet' => '1',
|
@@ -1440,12 +2022,18 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1440 |
'top_opt_excluded_post' => '',
|
1441 |
'top_opt_tweet-multiple-times' => 'off',
|
1442 |
'cwp_top_logged_in_users' => '',
|
1443 |
-
'top_fb_token' =>''
|
|
|
1444 |
);
|
1445 |
|
1446 |
foreach ($defaultOptions as $option => $defaultValue) {
|
1447 |
update_option($option, $defaultValue);
|
1448 |
}
|
|
|
|
|
|
|
|
|
|
|
1449 |
//die();
|
1450 |
}
|
1451 |
|
@@ -1459,115 +2047,206 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1459 |
|
1460 |
// Generate all fields based on settings
|
1461 |
public static function generateFieldType($field)
|
1462 |
-
{
|
1463 |
$disabled = "";
|
1464 |
$pro = "";
|
|
|
1465 |
switch ($field['type']) {
|
1466 |
|
1467 |
case 'text':
|
1468 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1469 |
break;
|
1470 |
-
|
1471 |
case 'select':
|
1472 |
$noFieldOptions = intval(count($field['options']));
|
1473 |
$fieldOptions = array_keys($field['options']);
|
1474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1475 |
//if ($field['option']=='top_opt_post_type') $disabled = "disabled";
|
1476 |
print "<select id='".$field['option']."' name='".$field['option']."'".$disabled.">";
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
print "</select>";
|
1483 |
break;
|
1484 |
|
1485 |
case 'checkbox':
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
|
|
|
|
|
|
|
|
1489 |
}
|
1490 |
print "<input id='".$field['option']."' type='checkbox' ".$disabled." name='".$field['option']."'";
|
1491 |
if($field['option_value'] == 'on') { echo "checked=checked"; }
|
1492 |
print " />".$pro;
|
1493 |
-
|
1494 |
-
|
1495 |
break;
|
1496 |
|
1497 |
case 'categories-list':
|
1498 |
-
print "<div class='categories-list'>";
|
1499 |
-
|
|
|
1500 |
|
1501 |
-
|
1502 |
|
1503 |
-
|
1504 |
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
|
1510 |
print "<div class='cwp-cat'>";
|
1511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1512 |
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
|
|
|
|
1517 |
}
|
1518 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1519 |
}
|
1520 |
|
|
|
1521 |
|
1522 |
-
print ">";
|
1523 |
-
print "<label for='".$field['option']."_cat_".$category->cat_ID."'>".$category->name."</label>";
|
1524 |
-
print "</div>";
|
1525 |
}
|
1526 |
-
|
|
|
|
|
|
|
1527 |
break;
|
1528 |
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
|
|
|
|
1539 |
$disabled = "disabled='disabled'";
|
1540 |
-
$pro = __("This is only available in the",CWP_TEXTDOMAIN)."<a href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=imagepro&utm_medium=link&utm_campaign=top&upgrade=true' target='_blank'> ".__("PRO version")."</a>";
|
1541 |
}
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
|
|
1545 |
|
1546 |
-
|
1547 |
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
|
1553 |
-
print "<div class='cwp-cat'>";
|
1554 |
-
|
1555 |
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
}
|
1561 |
-
}
|
1562 |
}
|
|
|
|
|
1563 |
|
1564 |
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
print "</div>".$pro;
|
1571 |
break;
|
1572 |
|
1573 |
}
|
@@ -1575,24 +2254,30 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1575 |
}
|
1576 |
|
1577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1578 |
public function getTime() {
|
1579 |
-
|
1580 |
-
echo current_time('timestamp',1);
|
1581 |
|
1582 |
-
|
|
|
|
|
1583 |
}
|
1584 |
|
1585 |
function top_plugin_action_links($links, $file) {
|
1586 |
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
|
1595 |
-
|
1596 |
}
|
1597 |
|
1598 |
public function fixCron() {
|
@@ -1620,92 +2305,202 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1620 |
update_option('cwp_topnew_notice', "Looks like there is an issue with your WP Cron and Tweet Old Post relies on wp-cron to schedule tweets, see the <a href='http://wordpress.org/plugins/tweet-old-post/faq/'>FAQ</a> for more details!");
|
1621 |
|
1622 |
}
|
1623 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1624 |
|
1625 |
$timestamp = wp_next_scheduled( 'cwp_top_tweet_cron' );
|
1626 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1627 |
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1631 |
}
|
1632 |
}
|
1633 |
-
}
|
1634 |
|
1635 |
-
|
|
|
|
|
1636 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
1637 |
// loading all actions and filters
|
1638 |
add_action('admin_menu', array($this, 'addAdminMenuPage'));
|
1639 |
|
1640 |
add_action('admin_enqueue_scripts', array($this, 'loadAllScriptsAndStyles'));
|
1641 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1642 |
// Update all options ajax action.
|
1643 |
-
add_action('wp_ajax_nopriv_update_response', array($this, 'updateAllOptions'));
|
1644 |
add_action('wp_ajax_update_response', array($this, 'updateAllOptions'));
|
1645 |
|
1646 |
// Reset all options ajax action.
|
1647 |
-
add_action('wp_ajax_nopriv_reset_options', array($this, 'resetAllOptions'));
|
1648 |
add_action('wp_ajax_reset_options', array($this, 'resetAllOptions'));
|
1649 |
|
1650 |
// Add new twitter account ajax action
|
1651 |
-
add_action('wp_ajax_nopriv_add_new_account', array($this, 'addNewAccount'));
|
1652 |
add_action('wp_ajax_add_new_account', array($this, 'addNewAccount'));
|
1653 |
|
1654 |
// Display managed pages ajax action
|
1655 |
-
add_action('wp_ajax_nopriv_display_pages', array($this, 'displayPages'));
|
1656 |
add_action('wp_ajax_display_pages', array($this, 'displayPages'));
|
1657 |
|
1658 |
// Add new account managed pages ajax action
|
1659 |
-
add_action('wp_ajax_nopriv_add_pages', array($this, 'addPages'));
|
1660 |
add_action('wp_ajax_add_pages', array($this, 'addPages'));
|
1661 |
|
1662 |
// Add more than one twitter account ajax action
|
1663 |
-
add_action('wp_ajax_nopriv_add_new_account_pro', array($this, 'addNewAccountPro'));
|
1664 |
add_action('wp_ajax_add_new_account_pro', array($this, 'addNewAccountPro'));
|
1665 |
|
1666 |
// Log Out Twitter user ajax action
|
1667 |
-
add_action('wp_ajax_nopriv_log_out_user', array($this, 'logOutUser'));
|
1668 |
add_action('wp_ajax_log_out_user', array($this, 'logOutUser'));
|
1669 |
|
1670 |
-
//
|
1671 |
-
add_action('wp_ajax_nopriv_tweet_old_post_action', array($this, 'startTweetOldPost'));
|
1672 |
add_action('wp_ajax_tweet_old_post_action', array($this, 'startTweetOldPost'));
|
1673 |
|
1674 |
-
//
|
1675 |
-
add_action('
|
|
|
|
|
|
|
|
|
|
|
1676 |
add_action('wp_ajax_view_sample_tweet_action', array($this, 'viewSampleTweet'));
|
1677 |
|
1678 |
// Tweet Old Post tweet now action.
|
1679 |
-
add_action('wp_ajax_nopriv_tweet_now_action', array($this, 'tweetNow'));
|
1680 |
add_action('wp_ajax_tweet_now_action', array($this, 'tweetNow'));
|
1681 |
|
1682 |
-
add_action('
|
1683 |
-
add_action('wp_ajax_gettime_action', array($this, 'getTime'));
|
1684 |
|
1685 |
-
|
1686 |
add_action('wp_ajax_getNotice_action', array($this, 'getNotice'));
|
1687 |
|
1688 |
-
//
|
1689 |
-
add_action('wp_ajax_nopriv_stop_tweet_old_post', array($this, 'stopTweetOldPost'));
|
1690 |
add_action('wp_ajax_stop_tweet_old_post', array($this, 'stopTweetOldPost'));
|
1691 |
|
1692 |
-
//
|
1693 |
|
1694 |
-
|
|
|
|
|
1695 |
|
1696 |
-
|
|
|
|
|
|
|
|
|
|
|
1697 |
|
1698 |
add_action('admin_init', array($this,'top_nag_ignore'));
|
|
|
1699 |
|
1700 |
-
// Filter to add new custom schedule based on user input
|
1701 |
-
add_filter('cron_schedules', array($this, 'createCustomSchedule'));
|
1702 |
|
1703 |
-
add_filter('plugin_action_links',array($this,'top_plugin_action_links'), 10, 2);
|
1704 |
|
1705 |
-
add_action('cwp_top_tweet_cron', array($this, 'tweetOldPost'));
|
1706 |
-
add_action( 'plugins_loaded', array($this, 'addLocalization') );
|
1707 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1708 |
|
|
|
1709 |
public function loadAllScriptsAndStyles()
|
1710 |
{
|
1711 |
global $cwp_top_settings; // Global Tweet Old Post Settings
|
@@ -1715,29 +2510,29 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1715 |
if ($_GET['page'] == $cwp_top_settings['slug'] || $_GET['page'] == "ExcludePosts") {
|
1716 |
|
1717 |
// Enqueue and Register Main CSS File
|
1718 |
-
wp_register_style( 'cwp_top_stylesheet', ROPCSSFILE, false,
|
1719 |
-
|
1720 |
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
}
|
1727 |
-
|
1728 |
}
|
1729 |
|
1730 |
function top_check_user_role( $role, $user_id = null ) {
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
}
|
1742 |
|
1743 |
public function addAdminMenuPage()
|
@@ -1748,14 +2543,41 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1748 |
else
|
1749 |
$cap='manage_options';
|
1750 |
add_menu_page($cwp_top_settings['name'], $cwp_top_settings['name'], $cap, $cwp_top_settings['slug'], array($this, 'loadMainView'), '','99.87514');
|
1751 |
-
add_submenu_page($cwp_top_settings['slug'], __('Exclude Posts',CWP_TEXTDOMAIN), __('Exclude Posts',CWP_TEXTDOMAIN), 'manage_options', 'ExcludePosts', '
|
1752 |
-
}
|
1753 |
|
|
|
|
|
|
|
1754 |
public function loadMainView()
|
1755 |
{
|
1756 |
global $cwp_top_fields;
|
1757 |
foreach ($cwp_top_fields as $field => $value) {
|
1758 |
-
$cwp_top_fields[$field]['option_value'] = get_option($cwp_top_fields[$field]['option']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1759 |
}
|
1760 |
require_once(plugin_dir_path( __FILE__ )."view.php");
|
1761 |
}
|
@@ -1763,81 +2585,86 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1763 |
// Sends a request to the passed URL
|
1764 |
public function sendRequest($url, $method='GET', $data='', $auth_user='', $auth_pass='') {
|
1765 |
|
1766 |
-
|
|
|
|
|
|
|
|
|
|
|
1767 |
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
}
|
1772 |
|
1773 |
-
|
1774 |
-
|
1775 |
-
}
|
1776 |
|
1777 |
-
|
1778 |
-
|
|
|
1779 |
|
1780 |
-
|
1781 |
-
curl_setopt($ch, CURLOPT_USERPWD, "{$auth_user}:{$auth_pass}");
|
1782 |
-
}
|
1783 |
|
1784 |
-
|
1785 |
-
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
1786 |
|
1787 |
-
|
1788 |
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
|
|
1792 |
|
1793 |
-
|
1794 |
}
|
1795 |
|
1796 |
// Shortens the url.
|
1797 |
public function shortenURL($url, $service, $id, $bitly_key, $bitly_user) {
|
1798 |
-
|
1799 |
if ($service == "bit.ly") {
|
|
|
1800 |
//$shortURL = $url;
|
1801 |
$url = trim($url);
|
1802 |
$bitly_key = trim($bitly_key);
|
1803 |
$bitly_user = trim($bitly_user);
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
|
|
|
|
1836 |
}
|
1837 |
|
1838 |
public function rop_load_dashboard_icon()
|
1839 |
{
|
1840 |
-
wp_register_style( 'rop_custom_dashboard_icon', ROPCUSTOMDASHBOARDICON, false,
|
1841 |
wp_enqueue_style( 'rop_custom_dashboard_icon' );
|
1842 |
}
|
1843 |
|
@@ -1846,4 +2673,4 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1846 |
|
1847 |
if(class_exists('CWP_TOP_Core')) {
|
1848 |
$CWP_TOP_Core = new CWP_TOP_Core;
|
1849 |
-
}
|
1 |
<?php
|
2 |
+
// Basic configuration
|
3 |
require_once(ROPPLUGINPATH."/inc/config.php");
|
4 |
+
// RopTwitterOAuth class
|
5 |
require_once(ROPPLUGINPATH."/inc/oAuth/twitteroauth.php");
|
6 |
|
7 |
if (!class_exists('CWP_TOP_Core')) {
|
9 |
|
10 |
// All fields
|
11 |
public static $fields;
|
12 |
+
public static $networks;
|
13 |
// Number of fields
|
14 |
public static $noFields;
|
15 |
+
public $notices;
|
16 |
// Consumer key, Consumer Secret key, oAuth Callback Key
|
17 |
public $consumer;
|
18 |
public $lastID;
|
26 |
private $cwp_top_oauth_token_secret;
|
27 |
|
28 |
|
29 |
+
public $users;
|
30 |
private $user_info;
|
31 |
|
32 |
// Plugin Status
|
34 |
// Interval Set
|
35 |
public $intervalSet;
|
36 |
public $cwp_twitter;
|
37 |
+
public static $date_format;
|
38 |
public function __construct() {
|
39 |
// Get all fields
|
40 |
global $cwp_top_fields;
|
41 |
+
global $cwp_top_networks;
|
42 |
|
43 |
// Set all authentication settings
|
44 |
$this->setAlloAuthSettings();
|
51 |
|
52 |
// Save all fields in static var
|
53 |
self::$fields = $cwp_top_fields;
|
54 |
+
self::$networks = $cwp_top_networks;
|
55 |
|
56 |
// Save all number of fields in static var
|
57 |
self::$noFields = count(self::$fields);
|
58 |
}
|
59 |
+
public static function addNotice($message,$type){
|
60 |
+
$errors = get_option('rop_notice_active');
|
61 |
+
if(count($errors) > 30) $errors = array();
|
62 |
+
$errors[] = array(
|
63 |
+
"time"=>date('j-m-Y h:i:s A'),
|
64 |
+
'message'=>$message,
|
65 |
+
"type" => $type
|
66 |
+
);
|
67 |
+
update_option("rop_notice_active",$errors);
|
68 |
+
|
69 |
+
}
|
70 |
+
public static function clearLog(){
|
71 |
+
if(!is_admin()) return false;
|
72 |
+
update_option("rop_notice_active",array());
|
73 |
|
74 |
+
}
|
75 |
+
public static function addLog($m){
|
76 |
+
$m .= date('l jS \of F Y h:i:s A')." - ".$m." \n\n ";
|
77 |
+
file_put_contents("rop.log",$m,FILE_APPEND);
|
78 |
+
|
79 |
+
}
|
80 |
public function addLocalization() {
|
|
|
|
|
|
|
81 |
|
82 |
+
load_plugin_textdomain(CWP_TEXTDOMAIN, false, dirname(ROPPLUGINBASENAME).'/languages/');
|
83 |
+
}
|
84 |
+
function checkUsers(){
|
85 |
+
if(!is_array($this->users)) $this->users = array();
|
86 |
+
if(count($this->users) == 0){
|
87 |
+
|
88 |
+
self::addNotice(__("You have no account set to post !", CWP_TEXTDOMAIN),"error");
|
89 |
+
die();
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
93 |
+
public function startTweetOldPost( )
|
94 |
{
|
95 |
+
if(!is_admin()) return false;
|
96 |
+
$this->checkUsers();
|
97 |
+
if($this->pluginStatus !== 'true' ) {
|
98 |
+
do_action("rop_start_posting");
|
99 |
+
}
|
100 |
+
die();
|
101 |
+
}
|
102 |
+
public function startPosting(){
|
103 |
+
|
104 |
+
update_option('cwp_topnew_active_status', 'true');
|
105 |
+
update_option('top_opt_already_tweeted_posts',array());
|
106 |
+
update_option('top_last_tweets',array());
|
107 |
+
$timeNow = $this->getTime();
|
108 |
+
$timeNow = $timeNow+15;
|
109 |
+
|
110 |
+
$this->clearScheduledTweets();
|
111 |
+
$networks = $this->getAvailableNetworks();
|
112 |
+
|
113 |
+
foreach($networks as $network){
|
114 |
+
wp_schedule_single_event($timeNow,$network.'roptweetcron',array($network));
|
115 |
}
|
116 |
|
|
|
117 |
}
|
118 |
|
119 |
+
public function stopPosting(){
|
120 |
+
|
121 |
+
// Set it to inactive status
|
122 |
+
update_option('cwp_topnew_active_status', 'false');
|
123 |
+
update_option('cwp_topnew_notice', '');
|
124 |
+
update_option('top_opt_already_tweeted_posts',array());
|
125 |
+
|
126 |
+
// Clear all scheduled tweets
|
127 |
+
$this->clearScheduledTweets();
|
128 |
+
}
|
129 |
public function stopTweetOldPost()
|
130 |
{
|
131 |
+
if(!is_admin()) return false;
|
132 |
//echo $this->pluginStatus;
|
133 |
// If the plugin is active
|
134 |
if($this->pluginStatus !== 'false') {
|
135 |
+
do_action("rop_stop_posting");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
|
138 |
die(); // Required for AJAX
|
144 |
$postPosts = get_option('top_opt_excluded_post');
|
145 |
|
146 |
if(!empty($postPosts) && is_array($postPosts)) {
|
147 |
+
$postQueryPosts = implode(',',$postPosts);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
else
|
150 |
$postQueryPosts = get_option('top_opt_excluded_post');
|
165 |
|
166 |
public function getTweetsFromDB()
|
167 |
{
|
|
|
168 |
global $wpdb;
|
169 |
|
170 |
// Generate the Tweet Post Date Range
|
171 |
$dateQuery = $this->getTweetPostDateRange();
|
172 |
+
if(!is_array($dateQuery)) return false;
|
173 |
// Get the number of tweets to be tweeted each interval.
|
174 |
$tweetCount = intval(get_option('top_opt_no_of_tweet'));
|
175 |
+
if($tweetCount == 0 ) {
|
176 |
+
self::addNotice("Invalid number for Number of Posts to share. It must be a value greater than 0 ",'error');
|
177 |
+
return false;
|
178 |
+
}
|
179 |
// Get post categories set.
|
180 |
// $postQueryCategories = $this->getTweetCategories();
|
181 |
$excludedIds = "";
|
182 |
$tweetedPosts = get_option("top_opt_already_tweeted_posts");
|
183 |
+
if(!is_array($tweetedPosts)) $tweetedPosts = array();
|
184 |
+
$orderQuery = "";
|
185 |
+
$orderQuery = " ORDER BY post_date ASC ";
|
186 |
+
|
187 |
+
if (get_option('top_opt_tweet_multiple_times')=="on") {
|
188 |
+
|
189 |
$tweetedPosts = array();
|
190 |
}
|
191 |
$postQueryExcludedPosts = $this->getExcludedPosts();
|
192 |
+
$postQueryExcludedPosts = explode (',',$postQueryExcludedPosts);
|
193 |
+
$excluded = array_merge($tweetedPosts,$postQueryExcludedPosts);
|
194 |
+
$excluded = array_unique($excluded);
|
195 |
+
$excluded = array_filter($excluded);
|
196 |
+
$postQueryExcludedCategories = $this->getExcludedCategories();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
$somePostType = $this->getTweetPostType();
|
198 |
|
199 |
// Generate dynamic query.
|
207 |
|
208 |
// If there are no categories set, select the post from all.
|
209 |
//if(!empty($postQueryCategories)) {
|
210 |
+
// $query .= "AND (wp_term_relationships.term_taxonomy_id IN ({$postQueryCategories})) ";
|
211 |
+
// }
|
212 |
|
213 |
if(!empty($postQueryExcludedCategories)) {
|
214 |
$query .= "AND ( {$wpdb->prefix}posts.ID NOT IN (
|
215 |
SELECT object_id
|
216 |
FROM {$wpdb->prefix}term_relationships
|
217 |
+
INNER JOIN {$wpdb->prefix}term_taxonomy ON ( {$wpdb->prefix}term_relationships.term_taxonomy_id = {$wpdb->prefix}term_taxonomy.term_taxonomy_id )
|
218 |
+
WHERE {$wpdb->prefix}term_taxonomy.term_id IN ({$postQueryExcludedCategories}))) ";
|
219 |
+
}
|
220 |
+
|
221 |
+
if(!empty($excluded)) {
|
222 |
+
$excluded = implode(',',$excluded);
|
223 |
+
$query .= "AND ( {$wpdb->prefix}posts.ID NOT IN ({$excluded})) ";
|
224 |
}
|
225 |
+
if(!empty($somePostType)){
|
226 |
|
227 |
+
$somePostType = explode(',',$somePostType);
|
228 |
+
$somePostType = "'".implode("','",$somePostType)."'";
|
229 |
}
|
|
|
230 |
$query .= "AND {$wpdb->prefix}posts.post_type IN ({$somePostType})
|
231 |
AND ({$wpdb->prefix}posts.post_status = 'publish')
|
232 |
GROUP BY {$wpdb->prefix}posts.ID
|
233 |
+
{$orderQuery }
|
234 |
";
|
235 |
|
|
|
236 |
$returnedPost = $wpdb->get_results($query);
|
237 |
+
|
238 |
+
if(count($returnedPost)< $tweetCount)
|
239 |
+
{
|
240 |
+
return $returnedPost;
|
241 |
+
}
|
242 |
+
$rand_keys = array_rand($returnedPost , $tweetCount);
|
243 |
+
|
244 |
+
if(is_int($rand_keys)) $rand_keys = array($rand_keys);
|
245 |
+
$return = array();
|
246 |
+
|
247 |
+
foreach($rand_keys as $rk){
|
248 |
+
$return[] = $returnedPost[$rk];
|
249 |
+
}
|
250 |
+
$returnedPost = $return;
|
251 |
+
if(count($returnedPost) > $tweetCount)
|
252 |
+
{
|
253 |
+
$returnedPost = array_slice($returnedPost,0,$tweetCount);
|
254 |
+
}
|
255 |
return $returnedPost;
|
256 |
}
|
257 |
|
258 |
+
public function isPostWithImageEnabled ($ntk = "twitter") {
|
259 |
+
$options = get_option("top_opt_post_formats");
|
260 |
+
global $cwp_top_networks;
|
261 |
+
$value = isset($options[$ntk."_".$cwp_top_networks[$ntk]["use-image"]['option']]) ? $options[$ntk."_".$cwp_top_networks[$ntk]["use-image"]['option']] : get_option("top_opt_post_with_image") ;
|
262 |
+
if ($value !='on')
|
263 |
return false;
|
264 |
else
|
265 |
return true;
|
266 |
}
|
267 |
|
268 |
+
public function tweetOldPost($ntk = "",$byID = false)
|
269 |
+
|
270 |
{
|
|
|
271 |
if ($byID!==false) {
|
272 |
|
273 |
$returnedPost = $this->getTweetsFromDBbyID($byID);
|
274 |
+
}else{
|
275 |
|
276 |
+
$returnedPost = $this->getTweetsFromDB();
|
277 |
+
if(!is_array($returnedPost)) return false;
|
278 |
|
279 |
+
}
|
|
|
|
|
|
|
280 |
|
281 |
+
if (count($returnedPost) == 0 ) {
|
282 |
+
self::addNotice('There is no suitable post to tweet make sure you excluded correct categories and selected the right dates.','error');
|
283 |
+
}
|
284 |
+
$done = get_option("top_opt_already_tweeted_posts");
|
285 |
+
if(!is_array($done) || get_option('top_opt_tweet_multiple_times')=="on" ) $done = array();
|
286 |
+
|
287 |
+
foreach($returnedPost as $post){
|
288 |
+
if(in_array($post->ID,$done)) continue;
|
289 |
+
$oknet = false;
|
290 |
+
foreach($this->users as $u){
|
291 |
+
if($u['service'] == $ntk){
|
292 |
+
$oknet = true;
|
293 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
+
}
|
296 |
+
if(!$oknet) return false;
|
297 |
+
$finalTweet = $this->generateTweetFromPost($post,$ntk);
|
298 |
+
|
299 |
+
$this->tweetPost( $finalTweet, $ntk, $post );
|
300 |
+
|
301 |
+
$tweetedPosts = get_option("top_opt_already_tweeted_posts");
|
302 |
+
|
303 |
+
if ($tweetedPosts=="") $tweetedPosts = array();
|
304 |
+
// Push the tweeted post at the end of the array.
|
305 |
+
array_push($tweetedPosts, $post->ID);
|
306 |
+
// Update the new already tweeted posts array.
|
307 |
+
if ( function_exists('w3tc_pgcache_flush') ) {
|
308 |
+
|
309 |
+
w3tc_dbcache_flush();
|
310 |
+
|
311 |
+
w3tc_objectcache_flush();
|
312 |
+
$cache = ' and W3TC Caches cleared';
|
313 |
+
}
|
314 |
+
update_option("top_opt_already_tweeted_posts", $tweetedPosts);
|
315 |
+
$done[] = $post->ID;
|
316 |
+
}
|
317 |
+
if ($byID===false) {
|
318 |
+
$this->scheduleTweet($ntk);
|
319 |
+
|
320 |
+
}
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
public function scheduleTweet($ntk){
|
325 |
+
$time = $this->getNextTweetTime( $ntk );
|
326 |
+
if($time != 0 && $time > $this->getTime()){
|
327 |
+
if(wp_next_scheduled( $ntk.'roptweetcron',array($ntk) ) === false) {
|
328 |
+
wp_schedule_single_event( $time, $ntk . 'roptweetcron', array( $ntk ) );
|
329 |
}
|
330 |
+
}else{
|
331 |
+
self::addNotice("Invalid next schedule: ".date ( 'M j, Y @ G:i',$time),'error');
|
332 |
}
|
333 |
|
334 |
}
|
335 |
+
public function getAvailableNetworks(){
|
336 |
+
$networks = array();
|
337 |
+
$users = is_array($this->users) ? $this->users : array();
|
338 |
+
foreach($users as $u){
|
339 |
+
if($u['service'] == 'twitter' && !in_array("twitter",$networks))
|
340 |
+
$networks[] = "twitter";
|
341 |
+
if($u['service'] == 'facebook' && !in_array("facebook",$networks))
|
342 |
+
$networks[] = "facebook";
|
343 |
+
if($u['service'] == 'linkedin' && !in_array("linkedin",$networks))
|
344 |
+
$networks[] = "linkedin";
|
345 |
+
}
|
346 |
+
|
347 |
+
return $networks;
|
348 |
+
}
|
349 |
+
|
350 |
+
public function getAllNetworks(){
|
351 |
+
$networks = array('twitter','facebook','linkedin');
|
352 |
|
353 |
+
|
354 |
+
return $networks;
|
355 |
+
}
|
356 |
public function findInString($where,$what) {
|
357 |
if (!is_string($where)) {
|
358 |
return false;
|
362 |
}
|
363 |
|
364 |
public function getNotice() {
|
365 |
+
if(!is_admin()) return false;
|
366 |
+
$notice = get_option('rop_notice_active');
|
367 |
+
if(!is_array($notice)) $notice = array();
|
368 |
+
foreach($notice as $k=>$n){
|
369 |
+
$notice[$k]['message'] = strip_tags($n['message']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
}
|
371 |
+
echo json_encode($notice);
|
372 |
die();
|
373 |
}
|
374 |
|
375 |
public function tweetNow() {
|
376 |
+
if(!is_admin()) return false;
|
377 |
+
$networks = $this->getAvailableNetworks();
|
378 |
+
foreach($networks as $net){
|
379 |
+
|
380 |
+
$this->tweetOldPost($net,get_option('top_lastID'));
|
381 |
+
}
|
382 |
+
die();
|
383 |
}
|
384 |
|
385 |
public function viewSampleTweet()
|
386 |
{
|
387 |
|
388 |
+
if(!is_admin()) return false;
|
389 |
$returnedTweets = $this->getTweetsFromDB();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
|
391 |
+
$messages = array();
|
392 |
+
$networks = $this->getAvailableNetworks();
|
393 |
+
if(count($returnedTweets) == 0) {
|
394 |
+
foreach($networks as $net){
|
395 |
+
$messages[$net] = __("No posts to share",CWP_TEXTDOMAIN);
|
396 |
+
}
|
397 |
+
$networks = array();
|
398 |
+
}
|
399 |
+
foreach($networks as $n) {
|
400 |
|
401 |
+
$finalTweetsPreview = $this->generateTweetFromPost($returnedTweets[0],$n);
|
402 |
+
if (is_array($finalTweetsPreview)){
|
403 |
+
$finalTweetsPreview = $finalTweetsPreview['message'];
|
404 |
+
}
|
405 |
+
$messages[$n] = $finalTweetsPreview;
|
406 |
+
}
|
407 |
+
if(isset($returnedTweets[0]))
|
408 |
+
update_option( 'top_lastID', $returnedTweets[0]->ID);
|
409 |
+
|
410 |
+
foreach($networks as $n) {
|
411 |
+
if (CWP_TOP_PRO && $this->isPostWithImageEnabled($n)) {
|
412 |
+
if (has_post_thumbnail($returnedTweets[0]->ID)) :
|
413 |
+
$image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $returnedTweets[0]->ID), array('medium') );
|
414 |
+
$image = $image_array[0];
|
415 |
+
else :
|
416 |
+
$post = get_post($returnedTweets[0]->ID);
|
417 |
+
$image = '';
|
418 |
+
ob_start();
|
419 |
+
ob_end_clean();
|
420 |
+
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
|
421 |
+
|
422 |
+
$image = $matches [1] [0];
|
423 |
+
|
424 |
+
endif;
|
425 |
+
$messages[$n] = '<img class="top_preview" src="'.$image.'"/>'.$messages[$n];
|
426 |
+
}
|
427 |
+
}
|
428 |
|
429 |
+
echo json_encode($messages);
|
|
|
430 |
|
|
|
|
|
|
|
|
|
431 |
|
|
|
432 |
die(); // required
|
433 |
}
|
434 |
|
437 |
* @param [type] $postId Post ID
|
438 |
* @return boolean True if not already tweeted / False if already tweeted
|
439 |
*/
|
440 |
+
|
441 |
public function isNotAlreadyTweeted($postId) {
|
442 |
// Get all already tweeted posts
|
443 |
|
447 |
add_option("top_opt_already_tweeted_posts");
|
448 |
return true;
|
449 |
}
|
450 |
+
|
451 |
+
// If the new post ID is in the array, which means that is already tweeted
|
452 |
if (!empty($tweetedPosts) && is_array($tweetedPosts) ) {
|
453 |
|
454 |
+
if (in_array($postId, $tweetedPosts))
|
455 |
+
return false;
|
456 |
else
|
457 |
return true;
|
458 |
+
}
|
459 |
else
|
460 |
+
{
|
461 |
+
return true;
|
462 |
}
|
463 |
}
|
464 |
|
465 |
public function getStrLen($string) {
|
466 |
+
|
467 |
if (function_exists("mb_strlen"))
|
468 |
return mb_strlen($string);
|
469 |
else
|
483 |
* @param [type] $postQuery Returned post from database
|
484 |
* @return [type] Generated Tweet
|
485 |
*/
|
486 |
+
|
487 |
+
public function generateTweetFromPost($postQuery,$network)
|
488 |
{
|
489 |
|
490 |
// Save all user settings in variables.
|
491 |
+
global $cwp_top_networks;
|
492 |
$tweetedPosts = get_option("top_opt_already_tweeted_posts");
|
493 |
+
$formats = get_option('top_opt_post_formats');
|
494 |
+
$tweet_content = isset($formats[$network."_"."top_opt_tweet_type"]) ? $formats[$network."_"."top_opt_tweet_type"] : get_option( 'top_opt_tweet_type' );
|
495 |
+
$tweet_content_custom_field = isset($formats[$network."_"."top_opt_tweet_type_custom_field"]) ? $formats[$network."_"."top_opt_tweet_type_custom_field"] : get_option( 'top_opt_tweet_type_custom_field' );
|
496 |
+
$additional_text = isset($formats[$network."_"."top_opt_add_text"]) ? $formats[$network."_"."top_opt_add_text"] : get_option( 'top_opt_tweet_type_custom_field' );
|
497 |
+
$additional_text_at = isset($formats[$network."_"."top_opt_add_text_at"]) ? $formats[$network."_"."top_opt_add_text_at"] : get_option( 'top_opt_add_text_at' );
|
498 |
+
$max_length = isset($formats[$network."_"."top_opt_tweet_length"]) ? $formats[$network."_"."top_opt_tweet_length"] : $cwp_top_networks[$network]['top_opt_tweet_length']['default_value'];
|
499 |
+
$include_link = isset($formats[$network."_"."top_opt_include_link"]) ? $formats[$network."_"."top_opt_include_link"] : get_option( 'top_opt_include_link' ); get_option( 'top_opt_include_link' );
|
500 |
+
$fetch_url_from_custom_field = isset($formats[$network."_"."top_opt_custom_url_option"]) ? $formats[$network."_"."top_opt_custom_url_option"] : get_option( 'top_opt_custom_url_option' );
|
501 |
+
$custom_field_url = isset($formats[$network."_"."top_opt_custom_url_field"]) ? $formats[$network."_"."top_opt_custom_url_field"] : get_option( 'top_opt_custom_url_field' ); get_option( 'top_opt_custom_url_field' );
|
502 |
+
$use_url_shortner = isset($formats[$network."_"."top_opt_use_url_shortner"]) ? $formats[$network."_"."top_opt_use_url_shortner"] : get_option( 'top_opt_use_url_shortner' );
|
503 |
+
$url_shortner_service = isset($formats[$network."_"."top_opt_url_shortner"]) ? $formats[$network."_"."top_opt_url_shortner"] : get_option( 'top_opt_url_shortner' );
|
504 |
+
$hashtags = isset($formats[$network."_"."top_opt_custom_hashtag_option"]) ? $formats[$network."_"."top_opt_custom_hashtag_option"] : get_option( 'top_opt_custom_hashtag_option' );
|
505 |
+
$common_hashtags = isset($formats[$network."_"."top_opt_hashtags"]) ? $formats[$network."_"."top_opt_hashtags"] : get_option( 'top_opt_hashtags' );
|
506 |
+
$maximum_hashtag_length = isset($formats[$network."_"."top_opt_hashtag_length"]) ? $formats[$network."_"."top_opt_hashtag_length"] : get_option( 'top_opt_hashtag_length' );
|
507 |
+
$hashtag_custom_field = isset($formats[$network."_"."top_opt_custom_hashtag_field"]) ? $formats[$network."_"."top_opt_custom_hashtag_field"] : get_option( 'top_opt_custom_hashtag_field' );
|
508 |
+
$bitly_key = isset($formats[$network."_"."top_opt_bitly_key"]) ? $formats[$network."_"."top_opt_bitly_key"] : get_option( 'top_opt_bitly_key' );
|
509 |
+
$bitly_user = isset($formats[$network."_"."top_opt_bitly_user"]) ? $formats[$network."_"."top_opt_bitly_user"] : get_option( 'top_opt_bitly_user' );
|
510 |
+
$post_with_image = isset($formats[$network."_". 'top_opt_post_with_image']) ? $formats[$network."_". 'top_opt_post_with_image'] : get_option( 'top_opt_bitly_user' );
|
511 |
+
$ga_tracking = get_option( 'top_opt_ga_tracking' );
|
512 |
+
$additionalTextBeginning = "";
|
513 |
+
$additionalTextEnd = "";
|
514 |
// If the user set to not use hashtags, set it to empty variable.
|
515 |
+
if ( $hashtags == 'nohashtag' ) {
|
516 |
$newHashtags = "";
|
517 |
}
|
|
|
518 |
// Generate the tweet content.
|
519 |
+
switch ( $tweet_content ) {
|
520 |
case 'title':
|
521 |
+
$tweetContent = $postQuery->post_title;
|
522 |
break;
|
|
|
523 |
case 'body':
|
524 |
+
$tweetContent = get_post_field( 'post_content', $postQuery->ID );
|
525 |
break;
|
|
|
526 |
case 'titlenbody':
|
527 |
+
$tweetContent = $postQuery->post_title . " " . get_post_field( 'post_content', $postQuery->ID );
|
528 |
break;
|
|
|
529 |
case 'custom-field':
|
530 |
+
$tweetContent = get_post_meta( $postQuery->ID, $tweet_content_custom_field, true );
|
531 |
break;
|
532 |
default:
|
533 |
+
$tweetContent = "";
|
534 |
break;
|
535 |
}
|
|
|
536 |
// Trim new empty lines.
|
537 |
+
if(!is_string($tweetContent)) $tweetContent = '';
|
538 |
+
$tweetContent = strip_tags( html_entity_decode( $tweetContent ) );
|
539 |
+
//$tweetContent = esc_html($tweetContent);
|
540 |
//$tweetContent = esc_html($tweetContent);
|
|
|
541 |
//$tweetContent = trim(preg_replace('/\s+/', ' ', $tweetContent));
|
|
|
542 |
// Remove html entinies.
|
543 |
//$tweetContent = preg_replace("/&#?[a-z0-9]+;/i","", $tweetContent);
|
|
|
544 |
// Strip all shortcodes from content.
|
545 |
+
$tweetContent = strip_shortcodes( $tweetContent );
|
546 |
+
$fTweet = array();
|
547 |
+
$fTweet['link'] = get_permalink( $postQuery->ID );
|
548 |
// Generate the post link.
|
549 |
+
if ( $include_link == 'true' ) {
|
550 |
+
if ( $fetch_url_from_custom_field == 'on' ) {
|
551 |
+
$post_url = "" . get_post_meta( $postQuery->ID, $custom_field_url, true );
|
552 |
+
} else {
|
553 |
+
$post_url = "" . get_permalink( $postQuery->ID );
|
554 |
}
|
555 |
+
if ( $post_url == "" ) {
|
556 |
+
$post_url = "" . get_permalink( $postQuery->ID );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
}
|
558 |
+
if ( $ga_tracking == "on" ) {
|
559 |
+
$param = 'utm_source=ReviveOldPost&utm_medium=social&utm_campaign=ReviveOldPost';
|
560 |
+
$post_url = rtrim( $post_url );
|
561 |
+
if ( strpos( $post_url, "?" ) === false ) {
|
562 |
+
$post_url .= '?' . $param;
|
563 |
+
} else {
|
564 |
+
$post_url .= '&' . $param;
|
565 |
+
}
|
566 |
+
}
|
567 |
+
if ( $use_url_shortner == 'on' ) {
|
568 |
+
$post_url = "" . $this->shortenURL( $post_url, $url_shortner_service, $postQuery->ID, $bitly_key, $bitly_user );
|
569 |
+
}
|
570 |
+
if ( $post_url == "" ) {
|
571 |
+
$post_url = "" . get_permalink( $postQuery->ID );
|
572 |
}
|
|
|
|
|
|
|
|
|
573 |
$post_url = $post_url . "";
|
574 |
+
} else {
|
575 |
+
$post_url = "";
|
576 |
+
}
|
|
|
577 |
// Generate the hashtags
|
578 |
$newHashtags = "";
|
579 |
+
if ( $hashtags != 'nohashtag' ) {
|
580 |
+
switch ( $hashtags ) {
|
|
|
581 |
case 'common':
|
582 |
$newHashtags = $common_hashtags;
|
583 |
break;
|
|
|
584 |
case 'categories':
|
585 |
+
if ( $postQuery->post_type == "post" ) {
|
586 |
+
$postCategories = get_the_category( $postQuery->ID );
|
587 |
+
foreach ( $postCategories as $category ) {
|
588 |
+
if ( strlen( $category->cat_name . $newHashtags ) <= $maximum_hashtag_length || $maximum_hashtag_length == 0 ) {
|
589 |
+
$newHashtags = $newHashtags . " #" . preg_replace( '/-/', '', strtolower( $category->slug ) );
|
590 |
+
}
|
|
|
|
|
591 |
}
|
592 |
+
} else {
|
593 |
+
if ( CWP_TOP_PRO ) {
|
594 |
+
global $CWP_TOP_Core_PRO;
|
595 |
+
$newHashtags = $CWP_TOP_Core_PRO->topProGetCustomCategories( $postQuery, $maximum_hashtag_length );
|
596 |
}
|
597 |
+
}
|
598 |
break;
|
|
|
599 |
case 'tags':
|
600 |
+
$postTags = wp_get_post_tags( $postQuery->ID );
|
601 |
+
foreach ( $postTags as $postTag ) {
|
602 |
+
if ( strlen( $postTag->slug . $newHashtags ) <= $maximum_hashtag_length || $maximum_hashtag_length == 0 ) {
|
603 |
+
$newHashtags = $newHashtags . " #" . preg_replace( '/-/', '', strtolower( $postTag->slug ) );
|
|
|
604 |
}
|
605 |
}
|
606 |
break;
|
|
|
607 |
case 'custom':
|
608 |
+
$newHashtags = get_post_meta( $postQuery->ID, $hashtag_custom_field, true );
|
609 |
+
break;
|
610 |
default:
|
611 |
break;
|
612 |
}
|
613 |
}
|
|
|
|
|
614 |
// Generate the additional text
|
615 |
+
if ( $additional_text_at == 'beginning' ) {
|
616 |
$additionalTextBeginning = $additional_text . " ";
|
617 |
}
|
618 |
+
if ( $additional_text_at == 'end' ) {
|
|
|
619 |
$additionalTextEnd = " " . $additional_text;
|
620 |
}
|
|
|
621 |
// Calculate the final tweet length
|
622 |
$finalTweetLength = 0;
|
623 |
+
if ( ! empty( $additional_text ) ) {
|
624 |
+
$additionalTextLength = $this->getStrLen( $additional_text );
|
625 |
+
$finalTweetLength += intval( $additionalTextLength );
|
626 |
}
|
627 |
+
if ( ! empty( $post_url ) ) {
|
628 |
+
$postURLLength = $this->getStrLen( $post_url );
|
|
|
|
|
629 |
//$post_url = urlencode($post_url);
|
630 |
+
if ( $postURLLength > 21 ) {
|
631 |
+
$postURLLength = 25;
|
632 |
+
}
|
633 |
+
$finalTweetLength += intval( $postURLLength );
|
634 |
}
|
635 |
+
if ( ! empty( $newHashtags ) ) {
|
636 |
+
$hashtagsLength = $this->getStrLen( $newHashtags );
|
637 |
+
$finalTweetLength += intval( $hashtagsLength );
|
|
|
638 |
}
|
639 |
+
if ( $post_with_image == "on" ) {
|
|
|
640 |
$finalTweetLength += 25;
|
641 |
+
}
|
642 |
+
$finalTweetLength = $max_length - 1 - $finalTweetLength - 5;
|
643 |
+
$tweetContent = $this->ropSubstr( $tweetContent, 0, $finalTweetLength );
|
|
|
|
|
644 |
$finalTweet = $additionalTextBeginning . $tweetContent . " %short_urlshort_urlur% " . $newHashtags . $additionalTextEnd;
|
645 |
+
$finalTweet = $this->ropSubstr( $finalTweet, 0, $max_length - 1 );
|
646 |
+
$finalTweet = str_replace( "%short_urlshort_urlur%", $post_url, $finalTweet );
|
647 |
+
$fTweet['message'] = strip_tags( $finalTweet );
|
648 |
+
if ( $post_url != "" ) {
|
|
|
649 |
$fTweet['link'] = $post_url;
|
650 |
+
}
|
651 |
//var_dump($fTweet['link']);
|
652 |
// Strip any tags and return the final tweet
|
653 |
return $fTweet;
|
654 |
+
//var_dump(get_object_taxonomies( $postQuery->post_type, 'objects' ));
|
655 |
+
//var_dump(get_the_terms($postQuery->ID,'download_category'));
|
|
|
656 |
}
|
657 |
|
658 |
/**
|
659 |
* Tweets the returned post from generateTweetFromPost()
|
660 |
* @param [type] $finalTweet Generated tweet
|
661 |
*/
|
662 |
+
|
663 |
+
public function tweetPost($finalTweet,$network = 'twitter',$post)
|
664 |
+
{
|
665 |
+
|
|
|
666 |
|
667 |
foreach ($this->users as $user) {
|
668 |
+
if($network == $user['service'] ){
|
669 |
+
|
670 |
+
switch ($user['service']) {
|
671 |
+
case 'twitter':
|
672 |
+
// Create a new twitter connection using the stored user credentials.
|
673 |
+
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
674 |
+
$args = array('status' => $finalTweet['message']);
|
675 |
+
|
676 |
+
if($this->isPostWithImageEnabled($network) && CWP_TOP_PRO) {
|
677 |
+
global $CWP_TOP_Core_PRO;
|
678 |
+
|
679 |
+
|
680 |
+
if(defined('ROP_IMAGE_CHECK')){
|
681 |
+
$args = $CWP_TOP_Core_PRO->topProImage( $connection, $finalTweet, $post->ID, $network );
|
682 |
+
if ( isset( $args['media[]'] ) ) {
|
683 |
+
$response = $connection->upload( 'statuses/update_with_media', $args );
|
684 |
+
} else {
|
685 |
+
$response = $connection->post( 'statuses/update', $args );
|
686 |
+
}
|
687 |
+
}else{
|
688 |
+
$CWP_TOP_Core_PRO->topProImage( $connection, $finalTweet['message'], $post->ID, $network );
|
689 |
+
}
|
690 |
+
}else{
|
691 |
|
692 |
+
$response = $connection->post('statuses/update',$args);
|
693 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
|
695 |
+
if($response !== false){
|
696 |
+
if(!is_object($response))
|
697 |
+
$status = json_decode($response);
|
698 |
+
if($status === false){
|
|
|
|
|
|
|
|
|
699 |
|
700 |
+
// self::addNotice("Error for post ".$post->post_title." when sending to Twitter: Invalid response - ".$response,'error');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
701 |
|
702 |
+
}
|
703 |
+
else{
|
704 |
+
if($status->errors[0]->code != 200) {
|
705 |
+
// self::addNotice("Error for post ".$post->post_title." when sending to Twitter: ".$status->errors[0]->message,'error');
|
706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
707 |
|
708 |
+
}
|
709 |
+
else{
|
710 |
|
711 |
+
}
|
712 |
+
}
|
713 |
+
if($connection->http_code == 200 ){
|
714 |
+
self::addNotice("Post ".$post->post_title." has been successfully sent to Twitter.",'notice');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
|
716 |
+
}
|
717 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
718 |
break;
|
719 |
+
case 'facebook':
|
720 |
+
|
721 |
+
$args = array(
|
722 |
+
|
723 |
+
'body' => array( 'message' => $finalTweet['message'],'link' => $finalTweet['link']),
|
724 |
+
'timeout'=>20
|
725 |
+
|
726 |
+
);
|
727 |
+
if($this->isPostWithImageEnabled($network) && CWP_TOP_PRO){
|
728 |
+
global $CWP_TOP_Core_PRO;
|
729 |
+
if(defined('ROP_IMAGE_CHECK'))
|
730 |
+
$args = $CWP_TOP_Core_PRO->topProImage($connection, $finalTweet, $post->ID,$network);
|
731 |
+
}
|
732 |
+
|
733 |
+
$pp=wp_remote_post("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/$user[id]/feed?access_token=$user[oauth_token]",$args);
|
734 |
+
if(is_wp_error( $pp )){
|
735 |
+
self::addNotice("Error for posting on facebook for - " .$post->post_title."".$pp->get_error_message(),'error' );
|
736 |
|
737 |
+
}else{
|
738 |
+
if($pp['response']['code'] == 200){
|
739 |
+
|
740 |
+
self::addNotice("Post ". $post->post_title." has been successfully sent to facebook ",'notice');
|
741 |
+
}else{
|
742 |
+
self::addNotice("Error for post ". $post->post_title." ".$pp['response']['message']." on facebook for ".$user['oauth_user_details']->name,'error');
|
743 |
+
|
744 |
+
}
|
745 |
+
|
746 |
+
}
|
747 |
+
|
748 |
+
break;
|
749 |
+
|
750 |
+
case 'linkedin':
|
751 |
+
|
752 |
+
$lk_message = str_replace("&", "&",$finalTweet['message']);
|
753 |
+
$sharedLink = str_replace("&", "&",$finalTweet['link']);
|
754 |
+
$content_xml = "";
|
755 |
+
$visibility="anyone";
|
756 |
+
$content_xml.="<content><title>".$lk_message."</title><submitted-url>".$sharedLink."</submitted-url></content>";
|
757 |
+
$url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$user["oauth_token"];
|
758 |
+
|
759 |
+
|
760 |
+
$xml = '<?xml version="1.0" encoding="UTF-8"?><share>
|
761 |
+
' . $content_xml . '
|
762 |
+
<visibility>
|
763 |
+
<code>' . $visibility . '</code>
|
764 |
+
</visibility>
|
765 |
+
</share>';
|
766 |
+
$headers = array(
|
767 |
+
"Content-type: text/xml",
|
768 |
+
"Content-length: " . strlen($xml),
|
769 |
+
"Connection: close",
|
770 |
+
);
|
771 |
+
|
772 |
+
if (!function_exists('curl_version'))
|
773 |
+
self::addNotice("Your host does not support CURL",'error');
|
774 |
+
$ch = curl_init();
|
775 |
+
curl_setopt($ch, CURLOPT_URL,$url);
|
776 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
777 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
778 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
779 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
|
780 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
781 |
+
|
782 |
+
$data = curl_exec($ch);
|
783 |
+
|
784 |
+
|
785 |
+
if(curl_errno($ch))
|
786 |
+
{
|
787 |
+
|
788 |
+
self::addNotice("Curl error: ". curl_error($ch),'error');
|
789 |
+
}
|
790 |
+
else{
|
791 |
+
self::addNotice("Post ". $post->post_title." has been successfully sent to LinkedIN.",'notice');
|
792 |
+
curl_close($ch);
|
793 |
+
}
|
794 |
+
break;
|
795 |
+
|
796 |
+
|
797 |
+
|
798 |
+
|
799 |
+
}
|
800 |
|
801 |
}
|
802 |
+
|
|
|
|
|
803 |
}
|
804 |
}
|
805 |
|
806 |
|
807 |
+
public function system_info(){
|
808 |
+
|
809 |
+
global $wpdb;
|
810 |
+
if(CWP_TOP_PRO){
|
811 |
+
|
812 |
+
$pro = get_plugin_data(ROPPROPLUGINPATH."/tweet-old-post-pro.php");
|
813 |
+
}
|
814 |
+
$lite = get_plugin_data(ROPPLUGINPATH."/tweet-old-post.php");
|
815 |
+
if ( get_bloginfo( 'version' ) < '3.4' ) {
|
816 |
+
$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
|
817 |
+
$theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
|
818 |
+
} else {
|
819 |
+
$theme_data = wp_get_theme();
|
820 |
+
$theme = $theme_data->Name . ' ' . $theme_data->Version;
|
821 |
+
}
|
822 |
+
|
823 |
+
// Try to identifty the hosting provider
|
824 |
+
$host = false;
|
825 |
+
if( defined( 'WPE_APIKEY' ) ) {
|
826 |
+
$host = 'WP Engine';
|
827 |
+
} elseif( defined( 'PAGELYBIN' ) ) {
|
828 |
+
$host = 'Pagely';
|
829 |
+
}
|
830 |
+
?>
|
831 |
+
<div class="wrap">
|
832 |
+
<h2><?php _e( 'System Information', CWP_TEXTDOMAIN); ?></h2><br/>
|
833 |
+
<form action="" method="post" dir="ltr">
|
834 |
+
<textarea readonly="readonly" onclick="this.focus();this.select()" cols="100" id="system-info-textarea" name="cwp-top-sysinfo" rows="20" title="<?php _e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd' ); ?>">
|
835 |
+
|
836 |
+
## Please include this information when posting support requests ##
|
837 |
+
|
838 |
+
## BEGIN ROP CONFIGS ##
|
839 |
+
|
840 |
+
<?php
|
841 |
+
$options = get_option("top_opt_post_formats");
|
842 |
+
$cwp_top_global_schedule = get_option("cwp_top_global_schedule");
|
843 |
+
global $cwp_top_networks;
|
844 |
+
echo "## ROP POST FORMAT";
|
845 |
+
foreach($cwp_top_networks as $n=>$d){
|
846 |
+
echo "\n \n \n ##".$n." \n \n \n";
|
847 |
+
|
848 |
+
|
849 |
+
|
850 |
+
|
851 |
+
foreach($d as $f){
|
852 |
+
|
853 |
+
echo $f['name']. " : ". $options[$n."_".$f['option']]." \n";
|
854 |
+
}
|
855 |
+
|
856 |
+
}
|
857 |
+
?>
|
858 |
+
|
859 |
+
## END ROP CONFIGS ##
|
860 |
+
|
861 |
+
## Begin CRON Info
|
862 |
+
|
863 |
+
CRON Active: <?php echo (WP_CRON) ? "yes" : "no"; ?><?php echo "\n"; ?>
|
864 |
+
Alternate WP Cron: <?php echo defined(ALTERNATE_WP_CRON) ? ((ALTERNATE_WP_CRON) ? "yes" : "no" ) : "no"; ?><?php echo "\n";
|
865 |
+
|
866 |
+
?>
|
867 |
+
Time now: <?php echo date ( 'M j, Y @ G:i',time()); ?> <?php echo "\n"; ?>
|
868 |
+
ROP Crons:
|
869 |
+
<?php
|
870 |
+
$all = $this->getAllNetworks();
|
871 |
+
foreach($all as $nn ){
|
872 |
+
if(wp_next_scheduled($nn.'roptweetcron',array($nn)) === false) continue;
|
873 |
+
echo date ( 'M j, Y @ G:i', wp_next_scheduled($nn.'roptweetcron',array($nn)) );
|
874 |
+
}
|
875 |
+
|
876 |
+
?>
|
877 |
+
|
878 |
+
## End Cron Info
|
879 |
+
|
880 |
+
##Begin General Settings:
|
881 |
+
|
882 |
+
<?php
|
883 |
+
global $cwp_top_fields;
|
884 |
+
foreach($cwp_top_fields as $general_field){
|
885 |
+
echo $general_field['name']. " : ";
|
886 |
+
if(is_array(get_option($general_field['option'])))
|
887 |
+
echo implode(",",get_option($general_field['option']))." \n" ;
|
888 |
+
else
|
889 |
+
echo get_option($general_field['option'])." \n";
|
890 |
+
}
|
891 |
+
?>
|
892 |
+
|
893 |
+
##End General Settings
|
894 |
+
|
895 |
+
|
896 |
+
<?php
|
897 |
+
if(CWP_TOP_PRO):?>
|
898 |
+
##Begin Custom schedule settings:
|
899 |
+
|
900 |
+
<?php foreach($all as $a) {
|
901 |
+
|
902 |
+
if( $cwp_top_global_schedule[$a.'_schedule_type_selected'] == 'each')
|
903 |
+
{
|
904 |
+
echo strtoupper($a)." post on every ".$cwp_top_global_schedule[$a.'_top_opt_interval']." hours"." \n" ;
|
905 |
+
}else{
|
906 |
+
echo strtoupper($a)." post each ".$cwp_top_global_schedule[$a.'_top_opt_interval']['days']." days of the week at: "." \n" ;
|
907 |
+
foreach($cwp_top_global_schedule[$a.'_top_opt_interval']['times'] as $time){
|
908 |
+
echo ''.$time['hour']." : ".$time['minute']." \n " ;
|
909 |
+
|
910 |
+
|
911 |
+
}
|
912 |
+
}
|
913 |
+
?>
|
914 |
+
<?php } ?>
|
915 |
+
|
916 |
+
##End Custom schedule settings
|
917 |
+
<?php endif;
|
918 |
+
?>
|
919 |
+
|
920 |
+
### Begin System Info ###
|
921 |
+
|
922 |
+
|
923 |
+
Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
|
924 |
+
|
925 |
+
SITE_URL: <?php echo site_url() . "\n"; ?>
|
926 |
+
HOME_URL: <?php echo home_url() . "\n"; ?>
|
927 |
+
<?php if(CWP_TOP_PRO): ?>
|
928 |
+
ROP PRO Version: <?php echo $pro['Version'] . "\n"; ?>
|
929 |
+
<?php endif; ?>
|
930 |
+
ROP Lite Version: <?php echo $lite['Version'] . "\n"; ?>
|
931 |
+
WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
|
932 |
+
Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?>
|
933 |
+
Active Theme: <?php echo $theme . "\n"; ?>
|
934 |
+
<?php if( $host ) : ?>
|
935 |
+
Host: <?php echo $host . "\n"; ?>
|
936 |
+
<?php endif; ?>
|
937 |
+
PHP Version: <?php echo PHP_VERSION . "\n"; ?>
|
938 |
+
MySQL Version: <?php echo mysql_get_server_info() . "\n"; ?>
|
939 |
+
Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
|
940 |
+
WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT ; ?><?php echo "\n"; ?>
|
941 |
+
PHP Safe Mode: <?php echo ini_get( 'safe_mode' ) ? "Yes" : "No\n"; ?>
|
942 |
+
PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
|
943 |
+
PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
|
944 |
+
PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
|
945 |
+
PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
|
946 |
+
PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
|
947 |
+
PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?>
|
948 |
+
PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?>
|
949 |
+
PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes" : "No\n"; ?>
|
950 |
+
WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
|
951 |
+
WP Table Prefix: <?php echo "Length: ". strlen( $wpdb->prefix ); echo " Status:"; if ( strlen( $wpdb->prefix )>16 ) {echo " ERROR: Too Long";} else {echo " Acceptable";} echo "\n"; ?>
|
952 |
+
Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?>
|
953 |
+
Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
|
954 |
+
Page For Posts: <?php $id = get_option( 'page_for_posts' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
|
955 |
+
Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
|
956 |
+
Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
|
957 |
+
Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
|
958 |
+
Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?>
|
959 |
+
Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
|
960 |
+
Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
|
961 |
+
DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
|
962 |
+
FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?>
|
963 |
+
cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?>
|
964 |
+
SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php echo "\n"; ?>
|
965 |
+
|
966 |
+
ACTIVE PLUGINS:
|
967 |
+
|
968 |
+
|
969 |
+
<?php
|
970 |
+
$plugins = get_plugins();
|
971 |
+
$active_plugins = get_option( 'active_plugins', array() );
|
972 |
+
|
973 |
+
foreach ( $plugins as $plugin_path => $plugin ) {
|
974 |
+
// If the plugin isn't active, don't show it.
|
975 |
+
if ( ! in_array( $plugin_path, $active_plugins ) )
|
976 |
+
continue;
|
977 |
+
|
978 |
+
echo $plugin['Name'] . ': ' . $plugin['Version'] ."\n";
|
979 |
+
}
|
980 |
+
|
981 |
+
if ( is_multisite() ) :
|
982 |
+
?>
|
983 |
+
|
984 |
+
NETWORK ACTIVE PLUGINS:
|
985 |
+
|
986 |
+
<?php
|
987 |
+
$plugins = wp_get_active_network_plugins();
|
988 |
+
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
|
989 |
+
|
990 |
+
foreach ( $plugins as $plugin_path ) {
|
991 |
+
$plugin_base = plugin_basename( $plugin_path );
|
992 |
+
|
993 |
+
// If the plugin isn't active, don't show it.
|
994 |
+
if ( ! array_key_exists( $plugin_base, $active_plugins ) )
|
995 |
+
continue;
|
996 |
+
|
997 |
+
$plugin = get_plugin_data( $plugin_path );
|
998 |
+
|
999 |
+
echo "\t"."\t"."\t"."\t".$plugin['Name'] . ' :' . $plugin['Version'] ."\n";
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
endif;
|
1003 |
+
?>
|
1004 |
+
|
1005 |
+
|
1006 |
+
|
1007 |
+
### End System Info ###
|
1008 |
+
|
1009 |
+
##Begin Log info
|
1010 |
+
|
1011 |
+
<?php $logs = get_option('rop_notice_active');
|
1012 |
+
foreach($logs as $log){
|
1013 |
+
echo strtoupper($log['type']). " @ ".$log['time']. ' - '. $log['message']." \n ";
|
1014 |
+
|
1015 |
+
|
1016 |
+
}
|
1017 |
+
?>
|
1018 |
+
<?php ?>
|
1019 |
+
|
1020 |
+
#End log info
|
1021 |
+
|
1022 |
+
##Begin user info
|
1023 |
+
|
1024 |
+
<?php
|
1025 |
+
foreach($all as $a ){
|
1026 |
+
if(!isset($$a)) $$a = 0;
|
1027 |
+
foreach($this->users as $us){
|
1028 |
+
if($us['service'] == $a) $$a ++;
|
1029 |
+
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
}
|
1033 |
+
foreach($all as $a){
|
1034 |
+
echo strtoupper($a)." accounts - ".$$a." \n";
|
1035 |
+
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
?>
|
1039 |
+
|
1040 |
+
##End user info
|
1041 |
+
|
1042 |
+
</textarea>
|
1043 |
+
<p class="submit">
|
1044 |
+
<input type="hidden" name="cwp-action" value="download_sysinfo" />
|
1045 |
+
<?php submit_button( 'Download System Info File', 'primary', 'cwp-download-sysinfo', false ); ?>
|
1046 |
+
</p>
|
1047 |
+
</form>
|
1048 |
+
</div>
|
1049 |
+
</div>
|
1050 |
+
<?php
|
1051 |
+
}
|
1052 |
+
/*public function tweetPostwithImage($finalTweet, $id,$ntk = 'twitter')
|
1053 |
+
{
|
1054 |
|
1055 |
$k=1;
|
1056 |
$tw=0;
|
1057 |
$nrOfUsers = count($this->users);
|
1058 |
+
$time = get_option("top_last_tweets");
|
1059 |
|
1060 |
foreach ($this->users as $user) {
|
1061 |
|
1062 |
+
if($ntk == $user['service'] ){
|
1063 |
+
if(isset($time[$ntk])){
|
1064 |
+
if(time() - $time[$ntk] < 60)
|
1065 |
+
return false;
|
1066 |
+
|
1067 |
+
}
|
1068 |
+
|
1069 |
+
$time[$ntk] = time();
|
1070 |
+
update_option("top_last_tweets",$time);
|
1071 |
switch ($user['service']) {
|
1072 |
case 'twitter':
|
1073 |
// Create a new twitter connection using the stored user credentials.
|
1074 |
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
1075 |
// Post the new tweet
|
1076 |
+
if (CWP_TOP_PRO){
|
1077 |
+
global $CWP_TOP_Core_PRO;
|
1078 |
+
$status = $CWP_TOP_Core_PRO->topProImage($connection, $finalTweet['message'], $id);
|
1079 |
+
}
|
1080 |
//var_dump($status);
|
1081 |
+
//$tw++;
|
1082 |
//} else {
|
1083 |
/// //$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
1084 |
+
//$status = $connection->post('statuses/update', array('status' => "acesta e un tweet"));
|
1085 |
+
//$tw++;
|
1086 |
//}
|
1087 |
|
1088 |
if ($nrOfUsers == $k)
|
1089 |
return $status;
|
1090 |
else
|
1091 |
+
$k++;
|
1092 |
|
1093 |
case 'facebook':
|
1094 |
$args = array(
|
1095 |
+
|
1096 |
'body' => array( 'message' => $finalTweet['message'],'link' => $finalTweet['link']),
|
1097 |
+
|
1098 |
+
);
|
1099 |
|
1100 |
$pp=wp_remote_post("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/$user[id]/feed?access_token=$user[oauth_token]",$args);
|
1101 |
if ($nrOfUsers == $k)
|
1102 |
return $pp['response']['message'];
|
1103 |
else
|
1104 |
$k++;
|
1105 |
+
|
1106 |
break;
|
1107 |
|
1108 |
case 'linkedin':
|
1109 |
|
1110 |
$lk_message = str_replace("&", "&",$finalTweet['message']);
|
1111 |
$sharedLink = str_replace("&", "&",$finalTweet['link']);
|
1112 |
+
$content_xml = "";
|
1113 |
$visibility="anyone";
|
1114 |
$content_xml.="<content><title>".$lk_message."</title><submitted-url>".$sharedLink."</submitted-url></content>";
|
1115 |
$url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$user["oauth_token"];
|
1121 |
<code>' . $visibility . '</code>
|
1122 |
</visibility>
|
1123 |
</share>';
|
1124 |
+
$headers = array(
|
1125 |
+
"Content-type: text/xml",
|
1126 |
+
"Content-length: " . strlen($xml),
|
1127 |
+
"Connection: close",
|
1128 |
);
|
1129 |
+
if (!function_exists('curl_version'))
|
1130 |
+
update_option('cwp_topnew_notice',"You host does not support CURL");
|
1131 |
+
$ch = curl_init();
|
1132 |
curl_setopt($ch, CURLOPT_URL,$url);
|
1133 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1134 |
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
1144 |
$k++;
|
1145 |
|
1146 |
if(curl_errno($ch))
|
1147 |
+
print curl_error($ch);
|
1148 |
else
|
1149 |
+
curl_close($ch);
|
1150 |
+
|
1151 |
break;
|
1152 |
default:
|
1153 |
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
1154 |
// Post the new tweet
|
1155 |
+
if (CWP_TOP_PRO) {
|
1156 |
+
global $$CWP_TOP_Core_PRO;
|
1157 |
+
$status = $CWP_TOP_Core_PRO->topProImage( $connection, $finalTweet['message'], $id );
|
1158 |
+
}
|
1159 |
if ($nrOfUsers == $k)
|
1160 |
return $status;
|
1161 |
else
|
1162 |
+
$k++;
|
1163 |
+
|
1164 |
|
1165 |
+
}
|
1166 |
+
}
|
1167 |
//sleep(100);
|
1168 |
}
|
1169 |
+
}*/
|
1170 |
+
|
1171 |
// Generates the tweet date range based on the user input.
|
1172 |
public function getTweetPostDateRange()
|
1173 |
{
|
1174 |
if (get_option('top_opt_max_age_limit')==0 )
|
1175 |
$limit = 9999;
|
1176 |
else
|
1177 |
+
$limit = intval(get_option('top_opt_max_age_limit'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1178 |
|
1179 |
+
if( !is_int($limit) ) {
|
1180 |
+
self::addNotice("Incorect value for Maximum age of post to be eligible for sharing. Please check the value to be a number greater or equal than 0 ",'error');
|
1181 |
+
return false;
|
1182 |
+
}
|
|
|
1183 |
|
1184 |
+
$min = intval(get_option('top_opt_age_limit'));
|
|
|
|
|
1185 |
|
1186 |
+
if(!is_int($min) ){
|
1187 |
+
self::addNotice("Incorect value for Minimum age of post to be eligible for sharing. Please check the value to be a number greater or equal than 0 ",'error');
|
1188 |
+
return false;
|
1189 |
|
1190 |
}
|
1191 |
+
if($limit == 0 ){
|
1192 |
+
$limit = 10*365;
|
1193 |
+
}
|
1194 |
+
if($limit < $min){
|
1195 |
+
self::addNotice("Maximum age of post to be eligible for sharing must be greater than Minimum age of post to be eligible for sharing. Please check the value to be a number greater or equal than 0 ",'error');
|
1196 |
+
return false;
|
1197 |
|
|
|
|
|
1198 |
}
|
1199 |
|
1200 |
|
1201 |
+
|
1202 |
+
$minLimit = time() - $min*24*60*60;
|
1203 |
+
$maxLimit = time() - $limit*24*60*60;
|
1204 |
+
|
1205 |
+
$minAgeLimit = date("Y-m-d H:i:s", $minLimit);
|
1206 |
+
$maxAgeLimit = date("Y-m-d H:i:s", $maxLimit);
|
1207 |
+
$dateQuery = array();
|
1208 |
+
$dateQuery['before'] = $maxAgeLimit;
|
1209 |
+
$dateQuery['after'] = $minAgeLimit;
|
1210 |
+
$dateQuery['inclusive'] = true;
|
1211 |
+
return $dateQuery;
|
1212 |
+
|
1213 |
+
|
1214 |
}
|
1215 |
|
1216 |
// Gets the omited tweet categories
|
1217 |
+
|
1218 |
public function getExcludedCategories()
|
1219 |
{
|
1220 |
$postQueryCategories = "";
|
1221 |
$postCategories = get_option('top_opt_omit_cats');
|
1222 |
|
1223 |
if(!empty($postCategories) && is_array($postCategories)) {
|
1224 |
+
$postQueryCategories = implode(',',$postCategories);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1225 |
}
|
1226 |
else
|
1227 |
$postQueryCategories = get_option('top_opt_omit_cats');
|
1236 |
$top_opt_post_type = get_option('top_opt_post_type');
|
1237 |
|
1238 |
if(!empty($top_opt_post_type) && is_array($top_opt_post_type)) {
|
1239 |
+
$postQueryPostTypes = implode(',',$top_opt_post_type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1240 |
}
|
1241 |
else
|
1242 |
+
$postQueryPostTypes = get_option('top_opt_post_type');
|
1243 |
|
1244 |
return $postQueryPostTypes;
|
1245 |
|
1250 |
public function createCustomSchedule($schedules)
|
1251 |
{
|
1252 |
$schedules['cwp_top_schedule'] = array(
|
1253 |
+
'interval' => floatval($this->intervalSet) * 60 * 60,
|
1254 |
+
'display' => __("Custom Tweet User Interval", CWP_TEXTDOMAIN)
|
1255 |
+
);
|
1256 |
|
1257 |
return $schedules;
|
1258 |
}
|
1260 |
// Clears the custom Tweet Old Post cron job.
|
1261 |
public function clearScheduledTweets()
|
1262 |
{
|
1263 |
+
$all = $this->getAllNetworks();
|
1264 |
+
foreach($all as $n){
|
1265 |
+
wp_clear_scheduled_hook($n.'roptweetcron',array($n));
|
1266 |
+
}
|
1267 |
}
|
1268 |
|
1269 |
// Deactivation hook
|
1275 |
}
|
1276 |
|
1277 |
// Sets all authentication settings
|
1278 |
+
public function setAlloAuthSettings()
|
1279 |
{
|
1280 |
global $cwp_top_settings;
|
1281 |
|
1283 |
$this->consumerSecret = $cwp_top_settings['oAuth_settings']['consumer_secret'];
|
1284 |
$this->oAuthCallback = CURRENTURL;
|
1285 |
|
1286 |
+
$this->cwp_top_access_token = get_option('cwp_top_access_token');
|
1287 |
$this->cwp_top_oauth_token = get_option('cwp_top_oauth_token');
|
1288 |
$this->cwp_top_oauth_token_secret = get_option('cwp_top_oauth_token_secret');
|
1289 |
|
1290 |
+
$this->user_info = get_option('cwp_top_oauth_user_details');
|
1291 |
$this->users = get_option('cwp_top_logged_in_users');
|
1292 |
+
if(!is_array($this->users)) $this->users = array();
|
1293 |
+
$ok_update = false;
|
1294 |
+
foreach($this->users as $k=>$user){
|
1295 |
+
if(!isset($user['service'])){
|
1296 |
+
if(strpos($user['oauth_user_details']->profile_image_url,'twimg')){
|
1297 |
|
1298 |
+
$this->users[$k]['service'] = 'twitter';
|
1299 |
+
}
|
1300 |
+
if(strpos($user['oauth_user_details']->profile_image_url,'facebook')){
|
1301 |
+
|
1302 |
+
$this->users[$k]['service'] = 'facebook';
|
1303 |
+
}
|
1304 |
+
if(strpos($user['oauth_user_details']->profile_image_url,'licdn')){
|
1305 |
+
|
1306 |
+
$this->users[$k]['service'] = 'linkedin';
|
1307 |
+
}
|
1308 |
+
$ok_update = true;
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
}
|
1312 |
+
if($ok_update){
|
1313 |
+
|
1314 |
+
update_option('cwp_top_logged_in_users',$this->users);
|
1315 |
+
|
1316 |
+
}
|
1317 |
$this->pluginStatus = get_option('cwp_topnew_active_status');
|
1318 |
$this->intervalSet = get_option('top_opt_interval');
|
1319 |
|
1320 |
+
self::$date_format = 'M j, Y @ G:i';
|
1321 |
//update_option('cwp_top_logged_in_users', '');
|
1322 |
}
|
1323 |
|
1352 |
|
1353 |
if(in_array($newUser, $loggedInUsers)) {
|
1354 |
echo "You already added that user! no can do !";
|
1355 |
+
} else {
|
1356 |
array_push($loggedInUsers, $newUser);
|
1357 |
update_option('cwp_top_logged_in_users', $loggedInUsers);
|
1358 |
}
|
1359 |
|
1360 |
+
header("Location: " . top_settings_url());
|
1361 |
exit;
|
1362 |
}
|
1363 |
}
|
1364 |
|
1365 |
if(isset($_REQUEST['state']) && (get_option('top_fb_session_state') === $_REQUEST['state'])) {
|
1366 |
+
|
1367 |
$token_url = "https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/oauth/access_token?"
|
1368 |
+
. "client_id=" . get_option('cwp_top_app_id') . "&redirect_uri=" . top_settings_url()
|
1369 |
+
. "&client_secret=" . get_option('cwp_top_app_secret') . "&code=" . $code;
|
1370 |
|
1371 |
$params = null;$access_token="";
|
1372 |
$response = wp_remote_get($token_url);
|
1373 |
+
|
1374 |
if(is_array($response))
|
1375 |
{
|
1376 |
if(isset($response['body']))
|
1377 |
{
|
1378 |
parse_str($response['body'], $params);
|
1379 |
if(isset($params['access_token']))
|
1380 |
+
$access_token = $params['access_token'];
|
1381 |
}
|
1382 |
}
|
1383 |
|
1384 |
if($access_token!="")
|
1385 |
+
{
|
1386 |
update_option('top_fb_token',$access_token);
|
1387 |
+
|
1388 |
}
|
1389 |
+
header("Location: " . top_settings_url().'#fbadd');
|
1390 |
}
|
1391 |
+
|
1392 |
if (isset($_GET['code'])&&isset($_GET['state'])&&get_option('top_lk_session_state') == $_GET['state']) {
|
1393 |
|
1394 |
$lk_auth_token = get_option('cwp_top_lk_app_id');
|
1395 |
$lk_auth_secret = get_option('cwp_top_lk_app_secret');
|
1396 |
+
$params = array('grant_type' => 'authorization_code',
|
1397 |
+
'client_id' => $lk_auth_token,
|
1398 |
+
'client_secret' => $lk_auth_secret,
|
1399 |
+
'code' => $_GET['code'],
|
1400 |
+
'redirect_uri' => top_settings_url(),
|
1401 |
+
);
|
1402 |
+
|
1403 |
$url = 'https://www.linkedin.com/uas/oauth2/accessToken?' . http_build_query($params);
|
1404 |
//echo $url;
|
1405 |
+
$response = wp_remote_post($url);
|
1406 |
+
$token = json_decode($response['body']);
|
1407 |
+
//print_r($response);
|
1408 |
+
//print_r($token);
|
1409 |
+
if($token->access_token) {
|
1410 |
+
// the request went through without an error, gather user's 'access' tokens
|
1411 |
+
//AQVBBQ6_ggJaUVFYmJ5oVF_kSH-wn6VNREGgC_sYPWp0YV0U4r2CFwptnLXUbJra5Glp0ZMax96CrD2azzf_HkJ2UdLp5q5zoiT_rbl5bmTMf50XnDfRcdm8Vl2k2XoYhGQ-LkYTnddFz1K-OBcW0CWsapzgZH2hepMVMhc1Lw7bhwTab04"
|
1412 |
+
update_option('top_linkedin_token',$token->access_token);
|
1413 |
+
update_option('top_linkedin_token_expires',$token->expires_in);
|
1414 |
}
|
1415 |
|
1416 |
$url = 'https://api.linkedin.com/v1/people/~:(id,picture-url,first_name,last_name)?oauth2_access_token='.$token->access_token;
|
1419 |
$response = wp_remote_retrieve_body($response);
|
1420 |
//print_r($response);
|
1421 |
$person = simplexml_load_string($response);
|
1422 |
+
|
1423 |
if (isset($person->id)) {
|
1424 |
$user_details = array('profile_image_url' => (string)$person->{'picture-url'},'name'=> (string)$person->{'first-name'} );
|
1425 |
+
|
1426 |
$newUser = array(
|
1427 |
+
'user_id' => (string)$person->id,
|
1428 |
+
'oauth_token' => $token->access_token,
|
1429 |
+
'oauth_token_secret' => '',
|
1430 |
+
'oauth_user_details' => (object)$user_details,
|
1431 |
+
'service' => 'linkedin'
|
1432 |
+
);
|
1433 |
|
1434 |
$loggedInUsers = get_option('cwp_top_logged_in_users');
|
1435 |
if(empty($loggedInUsers)) { $loggedInUsers = array(); }
|
1436 |
|
1437 |
foreach ($loggedInUsers as $key=>$user) {
|
1438 |
+
if ($user['user_id'] == $person->id)
|
1439 |
unset($loggedInUsers[$key]);
|
1440 |
}
|
1441 |
|
1442 |
if(in_array($newUser, $loggedInUsers)) {
|
1443 |
echo "You already added that user! no can do !";
|
1444 |
+
} else {
|
1445 |
array_push($loggedInUsers, $newUser);
|
1446 |
update_option('cwp_top_logged_in_users', $loggedInUsers);
|
1447 |
}
|
1448 |
}
|
1449 |
+
header("Location: " . top_settings_url());
|
1450 |
}
|
1451 |
|
1452 |
|
1475 |
foreach ($loggedInUsers as $key=>$user) {
|
1476 |
if ($user['service'] === "linkedin"&&$lk===0) {
|
1477 |
$lk++;
|
1478 |
+
$url = 'https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id='.get_option("cwp_top_lk_app_id").'&scope=rw_nus&state='.$top_session_state.'&redirect_uri='.top_settings_url();
|
1479 |
+
header("Location: " . $url);
|
1480 |
+
|
1481 |
+
update_option('top_lk_session_state',$top_session_state);
|
1482 |
|
1483 |
}
|
1484 |
|
1485 |
if ($user['service'] === "facebook"&&$fb===0) {
|
1486 |
$top_session_state_fb = md5(uniqid(rand(), TRUE));
|
1487 |
+
$fb++;
|
1488 |
+
update_option('top_fb_session_state',$top_session_state_fb);
|
1489 |
+
$dialog_url = "https://www.facebook.com/".ROP_TOP_FB_API_VERSION."/dialog/oauth?client_id="
|
1490 |
+
. get_option("cwp_top_app_id") . "&redirect_uri=" . top_settings_url() . "&state="
|
1491 |
+
. $top_session_state_fb . "&scope=publish_stream,publish_actions,manage_pages";
|
1492 |
|
1493 |
header("Location: " . $dialog_url);
|
1494 |
}
|
1495 |
}
|
1496 |
+
|
1497 |
}
|
1498 |
|
1499 |
// Adds pages
|
1500 |
public function displayPages()
|
1501 |
{
|
1502 |
+
|
1503 |
+
if(!is_admin()) return false;
|
1504 |
$social_network = $_POST['social_network'];
|
1505 |
$access_token = get_option('top_fb_token');
|
1506 |
|
1507 |
switch ($social_network) {
|
1508 |
+
case 'facebook':
|
1509 |
+
$result1="";$pagearray1="";
|
1510 |
$pp=wp_remote_get("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/me/accounts?access_token=$access_token&limit=100&offset=0");
|
1511 |
//print_r($pp);
|
1512 |
$me=wp_remote_get("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/me/?access_token=$access_token&limit=100&offset=0");
|
1523 |
$profile['access_token'] = $access_token;
|
1524 |
if(is_array($pagearray1->data))
|
1525 |
array_unshift($pagearray1->data, $profile);
|
1526 |
+
//$pagearray1->data[count($pagearray1->data)] = $profile;
|
1527 |
$result1 = json_encode($pagearray1);
|
1528 |
//print_r($results1);
|
1529 |
echo $result1;
|
1533 |
}
|
1534 |
die(); // Required
|
1535 |
}
|
1536 |
+
public function adminNotice(){
|
1537 |
+
if(is_array($this->notices)){
|
1538 |
+
|
1539 |
+
foreach($this->notices as $n){
|
1540 |
+
?>
|
1541 |
+
<div class="error">
|
1542 |
+
<p><?php _e( $n, CWP_TEXTDOMAIN ); ?></p>
|
1543 |
+
</div>
|
1544 |
+
<?php
|
1545 |
+
}
|
1546 |
+
}
|
1547 |
|
1548 |
+
}
|
1549 |
public function addPages()
|
1550 |
{
|
1551 |
+
|
1552 |
+
if(!is_admin()) return false;
|
1553 |
$social_network = $_POST['social_network'];
|
1554 |
$access_token = $_POST['page_token'];
|
1555 |
$page_id= $_POST['page_id'];
|
1556 |
|
1557 |
switch ($social_network) {
|
1558 |
+
case 'facebook':
|
1559 |
+
$user_details['profile_image_url'] = $_POST['picture_url'];
|
1560 |
+
$user_details['name'] = $_POST['page_name'];
|
1561 |
+
$user_details = (object) $user_details;
|
1562 |
+
$newUser = array(
|
1563 |
'user_id' => $page_id,
|
1564 |
'oauth_token' => $access_token,
|
1565 |
'oauth_token_secret' => "",
|
1571 |
if(empty($loggedInUsers)) { $loggedInUsers = array(); }
|
1572 |
|
1573 |
foreach ($loggedInUsers as $key=>$user) {
|
1574 |
+
if ($user['user_id'] == $page_id)
|
1575 |
unset($loggedInUsers[$key]);
|
1576 |
}
|
1577 |
|
1578 |
if(in_array($newUser, $loggedInUsers)) {
|
1579 |
echo "You already added that user! no can do !";
|
1580 |
+
} else {
|
1581 |
array_push($loggedInUsers, $newUser);
|
1582 |
update_option('cwp_top_logged_in_users', $loggedInUsers);
|
1583 |
+
echo top_settings_url();
|
1584 |
}
|
1585 |
|
1586 |
+
|
1587 |
break;
|
1588 |
}
|
1589 |
die(); // Required
|
1590 |
}
|
1591 |
|
1592 |
+
// Adds new account
|
1593 |
+
public function addNewAccount()
|
1594 |
+
{
|
1595 |
+
|
1596 |
+
if(!is_admin()) return false;
|
1597 |
+
global $cwp_top_settings;
|
1598 |
+
$social_network = $_POST['social_network'];
|
1599 |
+
$networks = $this->getAvailableNetworks();
|
1600 |
+
$response = array();
|
1601 |
+
if($social_network == 'linkedin' && !CWP_TOP_PRO){
|
1602 |
+
self::addNotice("You need to <a target='_blank' href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=topplusacc&utm_medium=announce&utm_campaign=top&upgrade=true'>upgrade to the PRO version</a> in order to add a Linkedin account, fellow pirate!",'error');
|
1603 |
+
|
1604 |
+
|
1605 |
+
}else if(in_array($social_network,$networks) && !CWP_TOP_PRO) {
|
1606 |
+
self::addNotice("You need to <a target='_blank' href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=topplusacc&utm_medium=announce&utm_campaign=top&upgrade=true'>upgrade to the PRO version</a> in order to add more accounts, fellow pirate!",'error');
|
1607 |
+
|
1608 |
+
|
1609 |
+
}else{
|
1610 |
+
switch ($social_network) {
|
1611 |
+
case 'twitter':
|
1612 |
+
$this->oAuthCallback = $_POST['currentURL'];
|
1613 |
+
$twitter = new RopTwitterOAuth($this->consumer, $this->consumerSecret);
|
1614 |
+
$requestToken = $twitter->getRequestToken($this->oAuthCallback);
|
1615 |
+
|
1616 |
+
update_option('cwp_top_oauth_token', $requestToken['oauth_token']);
|
1617 |
+
update_option('cwp_top_oauth_token_secret', $requestToken['oauth_token_secret']);
|
1618 |
+
|
1619 |
+
switch ($twitter->http_code) {
|
1620 |
+
case 200:
|
1621 |
+
$url = $twitter->getAuthorizeURL($requestToken['oauth_token']);
|
1622 |
+
$response['url'] = $url;
|
1623 |
+
break;
|
1624 |
+
|
1625 |
+
default:
|
1626 |
+
self::addNotice(__("Could not connect to Twitter!"),CWP_TEXTDOMAIN);
|
1627 |
+
|
1628 |
+
break;
|
1629 |
+
}
|
1630 |
+
break;
|
1631 |
+
case 'facebook':
|
1632 |
+
if (empty($_POST['extra']['app_id'])){
|
1633 |
+
self::addNotice(__("Could not connect to Facebook! You need to add the App ID",CWP_TEXTDOMAIN),'error');
|
1634 |
+
}else
|
1635 |
+
if (empty($_POST['extra']['app_secret'])){
|
1636 |
+
self::addNotice(__("Could not connect to Facebook! You need to add the App Secret",CWP_TEXTDOMAIN),'error');
|
1637 |
+
|
1638 |
+
}else{
|
1639 |
+
update_option('cwp_top_app_id', $_POST['extra']['app_id']);
|
1640 |
+
update_option('cwp_top_app_secret', $_POST['extra']['app_secret']);
|
1641 |
+
|
1642 |
+
$top_session_state = md5(uniqid(rand(), TRUE));
|
1643 |
+
|
1644 |
+
update_option('top_fb_session_state',$top_session_state);
|
1645 |
+
$dialog_url = "https://www.facebook.com/".ROP_TOP_FB_API_VERSION."/dialog/oauth?client_id="
|
1646 |
+
. $_POST['extra']['app_id'] . "&redirect_uri=" . top_settings_url() . "&state="
|
1647 |
+
. $top_session_state . "&scope=publish_stream,publish_actions,manage_pages";
|
1648 |
+
|
1649 |
+
$response['url'] = $dialog_url;
|
1650 |
+
|
1651 |
+
}
|
1652 |
+
|
1653 |
+
break;
|
1654 |
+
case 'linkedin':
|
1655 |
+
if (empty($_POST['extra']['app_id'])){
|
1656 |
+
self::addNotice(__("Could not connect to Linkedin! You need to add the App ID",CWP_TEXTDOMAIN),'error');
|
1657 |
+
}else
|
1658 |
+
if (empty($_POST['extra']['app_secret'])){
|
1659 |
+
self::addNotice(__("Could not connect to Linkedin! You need to add the App Secret",CWP_TEXTDOMAIN),'error');
|
1660 |
+
|
1661 |
+
}else{
|
1662 |
+
$top_session_state = uniqid('', true);
|
1663 |
+
$url = 'https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id='.$_POST['extra']["app_id"].'&scope=rw_nus&state='.$top_session_state.'&redirect_uri='.top_settings_url();
|
1664 |
+
|
1665 |
+
update_option('top_lk_session_state',$top_session_state);
|
1666 |
+
update_option('cwp_top_lk_app_id', $_POST['extra']['app_id']);
|
1667 |
+
update_option('cwp_top_lk_app_secret', $_POST['extra']['app_secret']);
|
1668 |
+
|
1669 |
+
$response['url'] = $url;
|
1670 |
+
|
1671 |
|
1672 |
+
}
|
1673 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1674 |
|
|
|
|
|
|
|
1675 |
|
1676 |
+
break;
|
1677 |
+
|
|
|
1678 |
|
1679 |
+
}
|
1680 |
|
1681 |
+
}
|
1682 |
|
1683 |
+
echo json_encode($response);
|
1684 |
|
1685 |
die(); // Required
|
1686 |
}
|
1688 |
// Adds more than one account
|
1689 |
public function addNewAccountPro()
|
1690 |
{
|
1691 |
+
|
1692 |
+
if(!is_admin()) return false;
|
1693 |
+
if (CWP_TOP_PRO) {
|
1694 |
+
global $CWP_TOP_Core_PRO;
|
1695 |
+
$CWP_TOP_Core_PRO->topProAddNewAccount($_POST['social_network']);
|
1696 |
}
|
1697 |
else{
|
1698 |
update_option('cwp_topnew_notice',"You need to <a target='_blank' href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=topplusacc&utm_medium=announce&utm_campaign=top&upgrade=true'>upgrade to the PRO version</a> in order to add more accounts, fellow pirate!");
|
1705 |
// Gets the next tweet interval.
|
1706 |
public function getNextTweetInterval()
|
1707 |
{
|
1708 |
+
$timestamp = wp_next_scheduled( 'cwptoptweetcronnew' );
|
1709 |
+
|
1710 |
//echo $timestamp;
|
1711 |
//$timestamp = date("Y-m-d H:i:s", $timestamp);
|
1712 |
//$timeLeft = get_date_from_gmt($timestamp);
|
1719 |
{
|
1720 |
if(!empty($this->cwp_top_oauth_token) && !empty($this->cwp_top_oauth_token_secret)) {
|
1721 |
return true;
|
1722 |
+
} else {
|
1723 |
return false;
|
1724 |
}
|
1725 |
}
|
1727 |
// Clears all Twitter user credentials.
|
1728 |
public function logOutUser()
|
1729 |
{
|
1730 |
+
if(!is_admin()) return false;
|
1731 |
$userID = $_POST['user_id'];
|
1732 |
|
1733 |
$users = get_option('cwp_top_logged_in_users');
|
1747 |
die();
|
1748 |
}
|
1749 |
|
1750 |
+
function getUpperDays($day,$days){
|
1751 |
+
$tmp = array();
|
1752 |
+
foreach($days as $d){
|
1753 |
+
if($day <= $d){
|
1754 |
+
$tmp[] = $d;
|
1755 |
+
}
|
1756 |
+
}
|
1757 |
+
return $tmp;
|
1758 |
+
}
|
1759 |
+
function getNextTweetTime($network){
|
1760 |
+
$time = 0;
|
1761 |
+
if(!CWP_TOP_PRO){
|
1762 |
+
$time = $this->getTime() + ( floatval(get_option('top_opt_interval')) * 3600 ) ;
|
1763 |
+
if($time > $this->getTime()) {
|
1764 |
+
return $time;
|
1765 |
+
}else{
|
1766 |
+
return 0;
|
1767 |
+
}
|
1768 |
+
}
|
1769 |
+
$cwp_top_global_schedule = get_option("cwp_top_global_schedule" );
|
1770 |
+
$type = $cwp_top_global_schedule[$network.'_schedule_type_selected'];
|
1771 |
+
if($type == 'each'){
|
1772 |
+
$time = $this->getTime() + floatval($cwp_top_global_schedule[$network.'_top_opt_interval']) * 3600;
|
1773 |
+
if($time > $this->getTime()) {
|
1774 |
+
return $time;
|
1775 |
+
}else{
|
1776 |
+
return 0;
|
1777 |
+
}
|
1778 |
+
}else{
|
1779 |
+
if (date('N', $this->getTime()) == 1){
|
1780 |
+
$start = strtotime("monday this week",$this->getTime()) ;
|
1781 |
+
}else{
|
1782 |
+
$start = strtotime("last Monday",$this->getTime()) ;
|
1783 |
+
}
|
1784 |
+
|
1785 |
+
$days = explode(",",$cwp_top_global_schedule[$network.'_top_opt_interval']['days']);
|
1786 |
+
$times = $cwp_top_global_schedule[$network.'_top_opt_interval']['times'];
|
1787 |
+
$schedules_days = array();
|
1788 |
+
if(count($times) == 0 ) return false;
|
1789 |
+
if(count($days) == 0 ) return false;
|
1790 |
+
foreach($days as $rday){
|
1791 |
+
$schedules_days[] = $start + ($rday-1) * 3600 * 24;
|
1792 |
+
|
1793 |
+
}
|
1794 |
+
$schedules = array();
|
1795 |
+
foreach($schedules_days as $schedule){
|
1796 |
+
|
1797 |
+
foreach($times as $time){
|
1798 |
+
|
1799 |
+
$schedules[] = $schedule + floatval($time['hour']) * 3600 + floatval($time['minute']) * 60;
|
1800 |
+
|
1801 |
+
}
|
1802 |
+
|
1803 |
+
}
|
1804 |
+
sort($schedules,SORT_REGULAR);
|
1805 |
+
|
1806 |
+
$ctime = $this->getTime();
|
1807 |
+
foreach($schedules as $s ){
|
1808 |
+
if($s > $ctime ) {
|
1809 |
+
return $s;
|
1810 |
+
}
|
1811 |
+
|
1812 |
+
}
|
1813 |
+
return 0;
|
1814 |
+
}
|
1815 |
+
return 0;
|
1816 |
+
}
|
1817 |
+
public function getAllOptions(){
|
1818 |
+
$options = array();
|
1819 |
+
|
1820 |
+
global $cwp_top_networks;
|
1821 |
+
$all = $this->getAllNetworks();
|
1822 |
+
foreach($cwp_top_networks as $n=>$d){
|
1823 |
+
foreach($d as $df){
|
1824 |
+
|
1825 |
+
$options[] = $n."_".$df['option'];
|
1826 |
+
|
1827 |
+
}
|
1828 |
+
}
|
1829 |
+
foreach($all as $a){
|
1830 |
+
|
1831 |
+
$options[] = $a."_schedule_type_selected";
|
1832 |
+
$options[] = $a."_top_schedule_days";
|
1833 |
+
$options[] = $a."_time_choice_hour";
|
1834 |
+
$options[] = $a."_top_opt_interval";
|
1835 |
+
$options[] = $a."_time_choice_min";
|
1836 |
+
}
|
1837 |
+
global $cwp_top_fields;
|
1838 |
+
foreach ($cwp_top_fields as $field)
|
1839 |
+
{
|
1840 |
+
$options[] = $field['option'];
|
1841 |
+
}
|
1842 |
+
return $options;
|
1843 |
+
}
|
1844 |
+
public function sanitizeRequest(){
|
1845 |
+
|
1846 |
+
$dataSent = $_POST['dataSent']['dataSent'];
|
1847 |
+
$valid = array();
|
1848 |
+
parse_str($dataSent, $options);
|
1849 |
+
$all_options = $this->getAllOptions();
|
1850 |
+
$invalid = array();
|
1851 |
+
foreach($options as $k => $option ){
|
1852 |
+
if(in_array($k,$all_options)){
|
1853 |
+
$valid[$k] = $option;
|
1854 |
+
|
1855 |
+
}else{
|
1856 |
+
$invalid[] = $k;
|
1857 |
+
}
|
1858 |
+
|
1859 |
+
}
|
1860 |
+
$_POST['dataSent']['dataSent'] = http_build_query($valid);
|
1861 |
+
}
|
1862 |
// Updates all options.
|
1863 |
public function updateAllOptions()
|
1864 |
{
|
1865 |
+
if(!is_admin()) return false;
|
1866 |
$dataSent = $_POST['dataSent']['dataSent'];
|
1867 |
+
$this->sanitizeRequest();
|
1868 |
$options = array();
|
|
|
|
|
|
|
1869 |
|
1870 |
+
parse_str($dataSent, $options);
|
1871 |
foreach ($options as $option => $newValue) {
|
1872 |
//$newValue = sanitize_text_field($newValue);
|
1873 |
update_option($option, $newValue);
|
1908 |
}
|
1909 |
|
1910 |
//update_option("top_opt_already_tweeted_posts", array());
|
1911 |
+
$this->updateAllPostFormat();
|
1912 |
+
if(CWP_TOP_PRO){
|
1913 |
|
1914 |
+
global $CWP_TOP_Core_PRO;
|
1915 |
+
$CWP_TOP_Core_PRO->updateTopProAjax();
|
1916 |
+
}
|
1917 |
die();
|
1918 |
}
|
1919 |
|
1920 |
+
public function updateAllPostFormat()
|
1921 |
+
{
|
1922 |
+
global $cwp_top_networks;
|
1923 |
+
$dataSent = $_POST['dataSent']['dataSent'];
|
1924 |
+
|
1925 |
+
$options = array();
|
1926 |
+
parse_str($dataSent, $options);
|
1927 |
+
|
1928 |
+
//print_r($options);
|
1929 |
+
foreach($cwp_top_networks as $n=>$d){
|
1930 |
+
|
1931 |
+
if(!array_key_exists($n.'_top_opt_custom_url_option', $options)) {
|
1932 |
+
$options[$n.'_top_opt_custom_url_option'] = 'off';
|
1933 |
+
}
|
1934 |
+
|
1935 |
+
if(!array_key_exists($n.'_top_opt_use_url_shortner', $options)) {
|
1936 |
+
$options[$n.'_top_opt_use_url_shortner'] = 'off';
|
1937 |
+
}
|
1938 |
+
|
1939 |
+
if(!array_key_exists($n.'_top_opt_post_with_image', $options)) {
|
1940 |
+
$options[$n.'_top_opt_post_with_image'] = 'off';
|
1941 |
+
}
|
1942 |
+
|
1943 |
+
if(!array_key_exists($n.'_top_opt_tweet_multiple_times', $options)) {
|
1944 |
+
$options[$n.'_top_opt_tweet_multiple_times'] = 'off';
|
1945 |
+
}
|
1946 |
+
|
1947 |
+
if(!array_key_exists($n.'_top_opt_ga_tracking', $options)) {
|
1948 |
+
$options[$n.'_top_opt_ga_tracking'] = 'off';
|
1949 |
+
}
|
1950 |
+
|
1951 |
+
//if(!array_key_exists('top_opt_tweet_specific_category', $options)) {
|
1952 |
+
// update_option('top_opt_tweet_specific_category', '');
|
1953 |
+
//}
|
1954 |
+
|
1955 |
+
if(!array_key_exists($n.'_top_opt_omit_cats', $options)) {
|
1956 |
+
$options[$n.'_top_opt_omit_cats'] = '';
|
1957 |
+
}
|
1958 |
+
|
1959 |
+
if(!array_key_exists($n.'_top_opt_post_type', $options)) {
|
1960 |
+
$options[$n.'_top_opt_post_type'] = 'post';
|
1961 |
+
}
|
1962 |
+
|
1963 |
+
}
|
1964 |
+
|
1965 |
+
update_option('top_opt_post_formats', $options);
|
1966 |
+
|
1967 |
+
}
|
1968 |
+
|
1969 |
public function top_admin_notice() {
|
1970 |
global $current_user ;
|
1971 |
+
$user_id = $current_user->ID;
|
1972 |
+
/* Check that the user hasn't already clicked to ignore the message */
|
1973 |
if ( ! get_user_meta($user_id, 'top_ignore_notice3') ) {
|
1974 |
+
// echo '<div class="error"><p>';
|
1975 |
+
// printf(__(' We just fixed the interrupted posting issue and scheduling issue, if you don\'t see any tweets you need to re-authentificate your twitter accounts. | <a href="'.SETTINGSURL.'&top_nag_ignore=0">Hide Notice</a>'));
|
1976 |
+
// echo "</p></div>";
|
1977 |
}
|
1978 |
}
|
1979 |
public function top_nag_ignore() {
|
1980 |
+
|
1981 |
global $current_user;
|
1982 |
+
$user_id = $current_user->ID;
|
1983 |
+
/* If user clicks to ignore the notice, add that to their user meta */
|
1984 |
+
if ( isset($_GET['top_nag_ignore']) && '0' == $_GET['top_nag_ignore'] ) {
|
1985 |
+
add_user_meta($user_id, 'top_ignore_notice3', 'true', true);
|
1986 |
}
|
1987 |
}
|
1988 |
|
1989 |
public function resetAllOptions()
|
1990 |
{
|
1991 |
+
|
1992 |
+
if(!is_admin()) return false;
|
1993 |
update_option('activation_hook_test_motherfucker', "Well, the plugin was activated!");
|
1994 |
|
1995 |
$defaultOptions = array(
|
2009 |
'top_opt_hashtags' => '',
|
2010 |
'top_opt_hashtag_length' => '0',
|
2011 |
'top_opt_custom_hashtag_field' => '',
|
2012 |
+
'top_opt_interval' => '8',
|
2013 |
'top_opt_age_limit' => '30',
|
2014 |
'top_opt_max_age_limit' => '0',
|
2015 |
'top_opt_no_of_tweet' => '1',
|
2022 |
'top_opt_excluded_post' => '',
|
2023 |
'top_opt_tweet-multiple-times' => 'off',
|
2024 |
'cwp_top_logged_in_users' => '',
|
2025 |
+
'top_fb_token' =>'',
|
2026 |
+
'top_opt_post_formats' =>''
|
2027 |
);
|
2028 |
|
2029 |
foreach ($defaultOptions as $option => $defaultValue) {
|
2030 |
update_option($option, $defaultValue);
|
2031 |
}
|
2032 |
+
|
2033 |
+
|
2034 |
+
update_option("top_opt_post_formats",array());
|
2035 |
+
update_option("cwp_top_global_schedule",array());
|
2036 |
+
$this->clearScheduledTweets();
|
2037 |
//die();
|
2038 |
}
|
2039 |
|
2047 |
|
2048 |
// Generate all fields based on settings
|
2049 |
public static function generateFieldType($field)
|
2050 |
+
{
|
2051 |
$disabled = "";
|
2052 |
$pro = "";
|
2053 |
+
|
2054 |
switch ($field['type']) {
|
2055 |
|
2056 |
case 'text':
|
2057 |
+
if (isset($field['available_pro'])) {
|
2058 |
+
|
2059 |
+
|
2060 |
+
if(!CWP_TOP_PRO && $field['available_pro'] == 'yes'){
|
2061 |
+
$pro = CWP_TOP_PRO_STRING;
|
2062 |
+
$disabled = "disabled='disabled'";
|
2063 |
+
}
|
2064 |
+
}
|
2065 |
+
echo "<input type='text' placeholder='".__($field['description'],CWP_TEXTDOMAIN)."' ".$disabled." value='".$field['option_value']."' name='".$field['option']."' id='".$field['option']."'><br/>".$pro;
|
2066 |
+
break;
|
2067 |
+
|
2068 |
+
case 'number':
|
2069 |
+
if (isset($field['available_pro'])) {
|
2070 |
+
|
2071 |
+
|
2072 |
+
if(!CWP_TOP_PRO){
|
2073 |
+
$pro = CWP_TOP_PRO_STRING;
|
2074 |
+
$disabled = "disabled='disabled'";
|
2075 |
+
}
|
2076 |
+
}
|
2077 |
+
echo "<input type='number' placeholder='".__($field['description'],CWP_TEXTDOMAIN)."' ".$disabled." value='".$field['option_value']."' max='".$field['max-length']."' name='".$field['option']."' id='".$field['option']."'><br/>".$pro;
|
2078 |
break;
|
2079 |
+
|
2080 |
case 'select':
|
2081 |
$noFieldOptions = intval(count($field['options']));
|
2082 |
$fieldOptions = array_keys($field['options']);
|
2083 |
+
if (isset($field['available_pro'])) {
|
2084 |
+
|
2085 |
+
|
2086 |
+
if(!CWP_TOP_PRO && $field['available_pro'] == 'yes'){
|
2087 |
+
$pro = CWP_TOP_PRO_STRING;
|
2088 |
+
$disabled = "disabled='disabled'";
|
2089 |
+
}
|
2090 |
+
}
|
2091 |
//if ($field['option']=='top_opt_post_type') $disabled = "disabled";
|
2092 |
print "<select id='".$field['option']."' name='".$field['option']."'".$disabled.">";
|
2093 |
+
for ($i=0; $i < $noFieldOptions; $i++) {
|
2094 |
+
print "<option value=".$fieldOptions[$i];
|
2095 |
+
if($field['option_value'] == $fieldOptions[$i]) { echo " selected='selected'"; }
|
2096 |
+
print ">".__($field['options'][$fieldOptions[$i]],CWP_TEXTDOMAIN)."</option>";
|
2097 |
+
}
|
2098 |
+
print "</select>".$pro;
|
2099 |
break;
|
2100 |
|
2101 |
case 'checkbox':
|
2102 |
+
|
2103 |
+
if (isset($field['available_pro'])) {
|
2104 |
+
|
2105 |
+
if(!CWP_TOP_PRO){
|
2106 |
+
$pro = CWP_TOP_PRO_STRING;
|
2107 |
+
$disabled = "disabled='disabled'";
|
2108 |
+
}
|
2109 |
}
|
2110 |
print "<input id='".$field['option']."' type='checkbox' ".$disabled." name='".$field['option']."'";
|
2111 |
if($field['option_value'] == 'on') { echo "checked=checked"; }
|
2112 |
print " />".$pro;
|
2113 |
+
|
2114 |
+
|
2115 |
break;
|
2116 |
|
2117 |
case 'categories-list':
|
2118 |
+
print "<div class='categories-list cwp-tax-post'><p class='rop-category-header'> Posts </p>";
|
2119 |
+
$categories = get_categories(array(
|
2120 |
+
'hide_empty' => false));
|
2121 |
|
2122 |
+
foreach ($categories as $category) {
|
2123 |
|
2124 |
+
$top_opt_tweet_specific_category = get_option('top_opt_tweet_specific_category');
|
2125 |
|
2126 |
+
if (!is_array(get_option('top_opt_omit_cats')))
|
2127 |
+
$top_opt_omit_specific_cats = explode(',',get_option('top_opt_omit_cats'));
|
2128 |
+
else
|
2129 |
+
$top_opt_omit_specific_cats = get_option('top_opt_omit_cats');
|
2130 |
|
2131 |
print "<div class='cwp-cat'>";
|
2132 |
+
print "<input type='checkbox' name='".$field['option']."[]' value='".$category->cat_ID."' id='".$field['option']."_cat_".$category->cat_ID."'";
|
2133 |
+
|
2134 |
+
if($field['option'] == 'top_opt_omit_cats') {
|
2135 |
+
if(is_array($top_opt_omit_specific_cats)) {
|
2136 |
+
if(in_array($category->cat_ID, $top_opt_omit_specific_cats)) {
|
2137 |
+
print "checked=checked";
|
2138 |
+
}
|
2139 |
+
}
|
2140 |
+
}
|
2141 |
+
|
2142 |
+
|
2143 |
+
print ">";
|
2144 |
+
print "<label for='".$field['option']."_cat_".$category->cat_ID."'>".$category->name."</label>";
|
2145 |
+
print "</div>";
|
2146 |
+
}
|
2147 |
+
print "<div class='clearfix'></div></div>";
|
2148 |
+
$taxs = get_taxonomies(array(
|
2149 |
+
'public' => true,
|
2150 |
+
'_builtin' => false
|
2151 |
+
),"object","and");
|
2152 |
+
$args = array(
|
2153 |
+
'public' => true,
|
2154 |
+
'_builtin' => false
|
2155 |
+
);
|
2156 |
+
$output = 'object';
|
2157 |
+
$operator = 'and';
|
2158 |
+
$post_types = get_post_types( $args, $output, $operator );
|
2159 |
+
|
2160 |
+
foreach($post_types as $pt=>$pd){
|
2161 |
+
foreach($taxs as $tx){
|
2162 |
+
|
2163 |
+
if(in_array($pt,$tx->object_type)){
|
2164 |
+
|
2165 |
+
$terms = get_terms($tx->name, array(
|
2166 |
+
'hide_empty' => false
|
2167 |
+
|
2168 |
+
) );
|
2169 |
+
if(!empty($terms)){
|
2170 |
+
print "<div class='categories-list cwp-hidden cwp-tax-".$pt."'><p class='rop-category-header'>".$pd->labels->name." </p>";
|
2171 |
+
foreach ($terms as $t) {
|
2172 |
+
|
2173 |
+
if (!is_array(get_option('top_opt_omit_cats')))
|
2174 |
+
$top_opt_omit_specific_cats = explode(',',get_option('top_opt_omit_cats'));
|
2175 |
+
else
|
2176 |
+
$top_opt_omit_specific_cats = get_option('top_opt_omit_cats');
|
2177 |
+
|
2178 |
+
print "<div class='cwp-cat'>";
|
2179 |
+
print "<input type='checkbox' data-posttype='".$pt."' name='".$field['option']."[]' value='".$t->term_id."' id='".$field['option']."_cat_".$t->term_id."'";
|
2180 |
|
2181 |
+
if($field['option'] == 'top_opt_omit_cats') {
|
2182 |
+
if(is_array($top_opt_omit_specific_cats)) {
|
2183 |
+
if(in_array($t->term_id, $top_opt_omit_specific_cats)) {
|
2184 |
+
print "checked=checked";
|
2185 |
+
}
|
2186 |
+
}
|
2187 |
}
|
2188 |
+
|
2189 |
+
|
2190 |
+
print ">";
|
2191 |
+
print "<label for='".$field['option']."_cat_".$t->term_id."'>".$t->name."</label>";
|
2192 |
+
print "</div>";
|
2193 |
+
}
|
2194 |
+
print "</div>";
|
2195 |
}
|
2196 |
|
2197 |
+
}
|
2198 |
|
|
|
|
|
|
|
2199 |
}
|
2200 |
+
|
2201 |
+
}
|
2202 |
+
|
2203 |
+
|
2204 |
break;
|
2205 |
|
2206 |
+
case 'custom-post-type':
|
2207 |
+
print "<div class='post-type-list clearfix'>";
|
2208 |
+
$args = array(
|
2209 |
+
'public' => true,
|
2210 |
+
'_builtin' => false
|
2211 |
+
);
|
2212 |
|
2213 |
+
$output = 'names'; // names or objects, note names is the default
|
2214 |
+
$operator = 'and'; // 'and' or 'or'
|
2215 |
+
if (isset($field['available_pro'])) {
|
2216 |
+
if(!CWP_TOP_PRO){
|
2217 |
+
$pro = CWP_TOP_PRO_STRING;
|
2218 |
$disabled = "disabled='disabled'";
|
|
|
2219 |
}
|
2220 |
+
}
|
2221 |
+
$post_types = get_post_types( $args, $output, $operator );
|
2222 |
+
array_push($post_types,"post","page");
|
2223 |
+
foreach ($post_types as $post_type) {
|
2224 |
|
2225 |
+
//$top_opt_tweet_specific_category = get_option('top_opt_tweet_specific_category');
|
2226 |
|
2227 |
+
if (!is_array(get_option('top_opt_post_type')))
|
2228 |
+
$top_opt_post_types = explode(',',get_option('top_opt_post_type'));
|
2229 |
+
else
|
2230 |
+
$top_opt_post_types = get_option('top_opt_post_type');
|
2231 |
|
2232 |
+
print "<div class='cwp-cat '>";
|
2233 |
+
print "<input ".$disabled." type='checkbox' class='cwp-cpt-checkbox' name='".$field['option']."[]' value='".$post_type."' id='".$field['option']."_cat_".$post_type."'";
|
2234 |
|
2235 |
+
if($field['option'] == 'top_opt_post_type') {
|
2236 |
+
if(is_array($top_opt_post_types)) {
|
2237 |
+
if(in_array($post_type, $top_opt_post_types)) {
|
2238 |
+
print "checked=checked";
|
|
|
|
|
2239 |
}
|
2240 |
+
}
|
2241 |
+
}
|
2242 |
|
2243 |
|
2244 |
+
print ">";
|
2245 |
+
print "<label for='".$field['option']."_cat_".$post_type."'>".$post_type."</label>";
|
2246 |
+
print "</div>";
|
2247 |
+
|
2248 |
+
}
|
2249 |
+
print "</div> ".$pro;
|
2250 |
break;
|
2251 |
|
2252 |
}
|
2254 |
}
|
2255 |
|
2256 |
|
2257 |
+
public function echoTime() {
|
2258 |
+
|
2259 |
+
echo $this->getTime();
|
2260 |
+
|
2261 |
+
die();
|
2262 |
+
}
|
2263 |
public function getTime() {
|
|
|
|
|
2264 |
|
2265 |
+
return time() ;
|
2266 |
+
|
2267 |
+
//return time() - 253214 + 2 * 3600 + 24 * 3600;
|
2268 |
}
|
2269 |
|
2270 |
function top_plugin_action_links($links, $file) {
|
2271 |
|
2272 |
+
if ($file == ROPPLUGINBASENAME) {
|
2273 |
+
// The "page" query string value must be equal to the slug
|
2274 |
+
// of the Settings admin page we defined earlier, which in
|
2275 |
+
// this case equals "myplugin-settings".
|
2276 |
+
$settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=TweetOldPost">Settings</a>';
|
2277 |
+
array_unshift($links, $settings_link);
|
2278 |
+
}
|
2279 |
|
2280 |
+
return $links;
|
2281 |
}
|
2282 |
|
2283 |
public function fixCron() {
|
2305 |
update_option('cwp_topnew_notice', "Looks like there is an issue with your WP Cron and Tweet Old Post relies on wp-cron to schedule tweets, see the <a href='http://wordpress.org/plugins/tweet-old-post/faq/'>FAQ</a> for more details!");
|
2306 |
|
2307 |
}
|
2308 |
+
|
2309 |
+
|
2310 |
+
|
2311 |
+
}
|
2312 |
+
}
|
2313 |
+
public function clearOldCron(){
|
2314 |
+
if(isset($_POST['cwp-action'])){
|
2315 |
+
if($_POST['cwp-action'] == 'download_sysinfo'){
|
2316 |
+
header('Content-Disposition: attachment; filename="report.txt"');
|
2317 |
+
header('Content-type: text/plain');
|
2318 |
+
echo $_POST['cwp-top-sysinfo'];
|
2319 |
+
die();
|
2320 |
+
|
2321 |
+
}
|
2322 |
+
|
2323 |
+
}
|
2324 |
+
if(!defined("VERSION_CHECK") && function_exists('topProImage')){
|
2325 |
+
$this->notices[] = "You need to have the latest version of the Revive Old Post Pro addon in order to use it. Please download it from the themeisle.com account";
|
2326 |
+
|
2327 |
+
}
|
2328 |
+
$all = $this->getAllNetworks();
|
2329 |
+
if($this->pluginStatus !== 'true'){
|
2330 |
+
|
2331 |
+
foreach($all as $a){
|
2332 |
+
|
2333 |
+
wp_clear_scheduled_hook($a.'roptweetcron',array($a));
|
2334 |
+
|
2335 |
+
|
2336 |
+
}
|
2337 |
+
return false;
|
2338 |
+
}
|
2339 |
+
|
2340 |
+
$networks = $this->getAvailableNetworks();
|
2341 |
+
if(wp_next_scheduled( 'cwp_top_tweet_cron' ) !== false) {
|
2342 |
|
2343 |
$timestamp = wp_next_scheduled( 'cwp_top_tweet_cron' );
|
2344 |
+
wp_clear_scheduled_hook('cwp_top_tweet_cron');
|
2345 |
+
foreach($networks as $network){
|
2346 |
+
wp_schedule_single_event($timestamp,$network.'roptweetcron',array($network));
|
2347 |
+
}
|
2348 |
+
|
2349 |
+
}else{
|
2350 |
+
|
2351 |
+
if(wp_next_scheduled( 'cwptoptweetcronnew' ) !== false) {
|
2352 |
+
$timestamp = wp_next_scheduled( 'cwptoptweetcronnew' );
|
2353 |
+
wp_clear_scheduled_hook('cwptoptweetcronnew');
|
2354 |
+
foreach($networks as $network){
|
2355 |
+
wp_schedule_single_event($timestamp,$network.'roptweetcron',array($network));
|
2356 |
+
}
|
2357 |
+
}
|
2358 |
+
else{
|
2359 |
|
2360 |
+
foreach($all as $a){
|
2361 |
+
if(wp_next_scheduled( $a.'cwptoptweetcron',array($a) ) !== false) {
|
2362 |
+
|
2363 |
+
$timestamp = wp_next_scheduled($a.'cwptoptweetcron',array($a) );
|
2364 |
+
wp_clear_scheduled_hook($a.'cwptoptweetcron',array($a));
|
2365 |
+
wp_schedule_single_event($timestamp,$a.'roptweetcron',array($a));
|
2366 |
+
}
|
2367 |
+
}
|
2368 |
+
foreach($all as $a){
|
2369 |
+
if(!in_array($a,$networks)){
|
2370 |
+
wp_clear_scheduled_hook($a.'roptweetcron',array($a));
|
2371 |
+
}
|
2372 |
+
|
2373 |
+
}
|
2374 |
+
|
2375 |
+
}
|
2376 |
+
|
2377 |
+
}
|
2378 |
+
|
2379 |
+
if($this->pluginStatus === 'true'){
|
2380 |
+
foreach($networks as $avn){
|
2381 |
+
if(wp_next_scheduled( $avn.'roptweetcron',array($avn) ) === false) {
|
2382 |
+
$this->scheduleTweet($avn);
|
2383 |
+
}
|
2384 |
}
|
2385 |
}
|
|
|
2386 |
|
2387 |
+
|
2388 |
+
}
|
2389 |
+
public function loadAllHooks()
|
2390 |
{
|
2391 |
+
if(isset($_GET['debug']) == 'on') {
|
2392 |
+
//$this->getNextTweetTime('twitter');
|
2393 |
+
// $this->tweetOldPost("twitter");
|
2394 |
+
// $this->tweetOldPost("facebook");
|
2395 |
+
die();
|
2396 |
+
}
|
2397 |
// loading all actions and filters
|
2398 |
add_action('admin_menu', array($this, 'addAdminMenuPage'));
|
2399 |
|
2400 |
add_action('admin_enqueue_scripts', array($this, 'loadAllScriptsAndStyles'));
|
2401 |
|
2402 |
+
add_action( 'admin_notices', array($this, 'adminNotice') );
|
2403 |
+
|
2404 |
+
add_filter('plugin_action_links',array($this,'top_plugin_action_links'), 10, 2);
|
2405 |
+
|
2406 |
+
add_action( 'plugins_loaded', array($this, 'addLocalization') );
|
2407 |
+
|
2408 |
+
//ajax actions
|
2409 |
+
|
2410 |
// Update all options ajax action.
|
|
|
2411 |
add_action('wp_ajax_update_response', array($this, 'updateAllOptions'));
|
2412 |
|
2413 |
// Reset all options ajax action.
|
|
|
2414 |
add_action('wp_ajax_reset_options', array($this, 'resetAllOptions'));
|
2415 |
|
2416 |
// Add new twitter account ajax action
|
|
|
2417 |
add_action('wp_ajax_add_new_account', array($this, 'addNewAccount'));
|
2418 |
|
2419 |
// Display managed pages ajax action
|
|
|
2420 |
add_action('wp_ajax_display_pages', array($this, 'displayPages'));
|
2421 |
|
2422 |
// Add new account managed pages ajax action
|
|
|
2423 |
add_action('wp_ajax_add_pages', array($this, 'addPages'));
|
2424 |
|
2425 |
// Add more than one twitter account ajax action
|
|
|
2426 |
add_action('wp_ajax_add_new_account_pro', array($this, 'addNewAccountPro'));
|
2427 |
|
2428 |
// Log Out Twitter user ajax action
|
|
|
2429 |
add_action('wp_ajax_log_out_user', array($this, 'logOutUser'));
|
2430 |
|
2431 |
+
//start ROP
|
|
|
2432 |
add_action('wp_ajax_tweet_old_post_action', array($this, 'startTweetOldPost'));
|
2433 |
|
2434 |
+
//clear Log messages
|
2435 |
+
add_action('wp_ajax_rop_clear_log', array($this, 'clearLog'));
|
2436 |
+
|
2437 |
+
//remote trigger cron
|
2438 |
+
add_action('wp_ajax_remote_trigger', array($this, 'remoteTrigger'));
|
2439 |
+
|
2440 |
+
//sample tweet messages
|
2441 |
add_action('wp_ajax_view_sample_tweet_action', array($this, 'viewSampleTweet'));
|
2442 |
|
2443 |
// Tweet Old Post tweet now action.
|
|
|
2444 |
add_action('wp_ajax_tweet_now_action', array($this, 'tweetNow'));
|
2445 |
|
2446 |
+
add_action('wp_ajax_gettime_action', array($this, 'echoTime'));
|
|
|
2447 |
|
2448 |
+
//get notice
|
2449 |
add_action('wp_ajax_getNotice_action', array($this, 'getNotice'));
|
2450 |
|
2451 |
+
//stop ROP
|
|
|
2452 |
add_action('wp_ajax_stop_tweet_old_post', array($this, 'stopTweetOldPost'));
|
2453 |
|
2454 |
+
//custom actions
|
2455 |
|
2456 |
+
add_action("rop_start_posting",array($this,"startPosting"));
|
2457 |
+
add_action("rop_stop_posting",array($this,"stopPosting"));
|
2458 |
+
$networks = $this->getAllNetworks();
|
2459 |
|
2460 |
+
foreach($networks as $network){
|
2461 |
+
add_action($network.'roptweetcron',array($this,"tweetOldPost"));
|
2462 |
+
|
2463 |
+
}
|
2464 |
+
|
2465 |
+
//admin_init actions
|
2466 |
|
2467 |
add_action('admin_init', array($this,'top_nag_ignore'));
|
2468 |
+
add_action('admin_init', array($this,'clearOldCron'));
|
2469 |
|
|
|
|
|
2470 |
|
|
|
2471 |
|
|
|
|
|
2472 |
}
|
2473 |
+
public function remoteTrigger(){
|
2474 |
+
if(!is_admin()) return false;
|
2475 |
+
$state = $_POST["state"];
|
2476 |
+
if(!empty($state) &&( $state == "on" || $state == "off")){
|
2477 |
+
|
2478 |
+
update_option("cwp_rop_remote_trigger",$state);
|
2479 |
+
$this->sendRemoteTrigger($state);
|
2480 |
+
|
2481 |
+
}
|
2482 |
+
|
2483 |
+
die();
|
2484 |
+
}
|
2485 |
+
|
2486 |
+
public function sendRemoteTrigger($state){
|
2487 |
+
|
2488 |
+
global $cwp_rop_remote_trigger_url;
|
2489 |
+
$state = ($state == "on") ? "yes" : "no";
|
2490 |
+
|
2491 |
+
wp_remote_post( $cwp_rop_remote_trigger_url, array(
|
2492 |
+
'method' => 'POST',
|
2493 |
+
'timeout' => 1,
|
2494 |
+
'redirection' => 5,
|
2495 |
+
'httpversion' => '1.0',
|
2496 |
+
'blocking' => true,
|
2497 |
+
'headers' => array(),
|
2498 |
+
'body' => array( 'url' => get_site_url(), 'status' => $state ),
|
2499 |
+
'cookies' => array()
|
2500 |
+
)
|
2501 |
+
);
|
2502 |
|
2503 |
+
}
|
2504 |
public function loadAllScriptsAndStyles()
|
2505 |
{
|
2506 |
global $cwp_top_settings; // Global Tweet Old Post Settings
|
2510 |
if ($_GET['page'] == $cwp_top_settings['slug'] || $_GET['page'] == "ExcludePosts") {
|
2511 |
|
2512 |
// Enqueue and Register Main CSS File
|
2513 |
+
wp_register_style( 'cwp_top_stylesheet', ROPCSSFILE, false, time() );
|
2514 |
+
wp_enqueue_style( 'cwp_top_stylesheet' );
|
2515 |
|
2516 |
+
// Register Main JS File
|
2517 |
+
wp_enqueue_script( 'cwp_top_js_countdown', ROPJSCOUNTDOWN, array(), time(), true );
|
2518 |
+
wp_enqueue_script( 'cwp_top_javascript', ROPJSFILE, array(), time(), true );
|
2519 |
+
wp_localize_script( 'cwp_top_javascript', 'cwp_top_ajaxload', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
|
2520 |
+
}
|
2521 |
}
|
2522 |
+
|
2523 |
}
|
2524 |
|
2525 |
function top_check_user_role( $role, $user_id = null ) {
|
2526 |
+
|
2527 |
+
if ( is_numeric( $user_id ) )
|
2528 |
+
$user = get_userdata( $user_id );
|
2529 |
+
else
|
2530 |
+
$user = wp_get_current_user();
|
2531 |
+
|
2532 |
+
if ( empty( $user ) )
|
2533 |
+
return false;
|
2534 |
+
|
2535 |
+
return in_array( $role, (array) $user->roles );
|
2536 |
}
|
2537 |
|
2538 |
public function addAdminMenuPage()
|
2543 |
else
|
2544 |
$cap='manage_options';
|
2545 |
add_menu_page($cwp_top_settings['name'], $cwp_top_settings['name'], $cap, $cwp_top_settings['slug'], array($this, 'loadMainView'), '','99.87514');
|
2546 |
+
add_submenu_page($cwp_top_settings['slug'], __('Exclude Posts',CWP_TEXTDOMAIN), __('Exclude Posts',CWP_TEXTDOMAIN), 'manage_options', 'ExcludePosts', 'rop_exclude_posts');
|
|
|
2547 |
|
2548 |
+
add_submenu_page($cwp_top_settings['slug'], __('System Info',CWP_TEXTDOMAIN), __('System Info',CWP_TEXTDOMAIN), 'manage_options', 'SystemInfo', array($this,'system_info'));
|
2549 |
+
|
2550 |
+
}
|
2551 |
public function loadMainView()
|
2552 |
{
|
2553 |
global $cwp_top_fields;
|
2554 |
foreach ($cwp_top_fields as $field => $value) {
|
2555 |
+
$cwp_top_fields[$field]['option_value'] = get_option($cwp_top_fields[$field]['option']);
|
2556 |
+
}
|
2557 |
+
global $cwp_top_networks;
|
2558 |
+
global $cwp_top_global_schedule;
|
2559 |
+
$options = get_option("top_opt_post_formats");
|
2560 |
+
$cwp_top_global_schedule = get_option("cwp_top_global_schedule");
|
2561 |
+
if($options === false ) $options = array();
|
2562 |
+
if($cwp_top_global_schedule === false ) $cwp_top_global_schedule = array();
|
2563 |
+
|
2564 |
+
$schedule = $cwp_top_fields["interval"]['option_value'];
|
2565 |
+
foreach ($cwp_top_networks as $network_name => $network_details) {
|
2566 |
+
foreach ($network_details as $field => $vvalue) {
|
2567 |
+
$value = isset($options[$network_name."_".$cwp_top_networks[$network_name][$field]['option']]) ? $options[$network_name."_".$cwp_top_networks[$network_name][$field]['option']] : false ;
|
2568 |
+
if($value === false) {
|
2569 |
+
$value = get_option($cwp_top_networks[$network_name][$field]['option']);
|
2570 |
+
if($value === false) {
|
2571 |
+
if(isset($vvalue['default_value']))
|
2572 |
+
$value = $vvalue['default_value'];
|
2573 |
+
}
|
2574 |
+
}
|
2575 |
+
$cwp_top_networks[$network_name][$field]['option_value'] = $value;
|
2576 |
+
}
|
2577 |
+
if(!isset($cwp_top_global_schedule[$network_name."_schedule_type_selected"])){
|
2578 |
+
$cwp_top_global_schedule[$network_name."_schedule_type_selected"] = "each";
|
2579 |
+
$cwp_top_global_schedule[$network_name."_top_opt_interval"] = $schedule;
|
2580 |
+
}
|
2581 |
}
|
2582 |
require_once(plugin_dir_path( __FILE__ )."view.php");
|
2583 |
}
|
2585 |
// Sends a request to the passed URL
|
2586 |
public function sendRequest($url, $method='GET', $data='', $auth_user='', $auth_pass='') {
|
2587 |
|
2588 |
+
$ch = curl_init($url);
|
2589 |
+
|
2590 |
+
if (strtoupper($method) == "POST") {
|
2591 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
2592 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
2593 |
+
}
|
2594 |
|
2595 |
+
if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') {
|
2596 |
+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
2597 |
+
}
|
|
|
2598 |
|
2599 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
2600 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
2601 |
|
2602 |
+
if ($auth_user != '' && $auth_pass != '') {
|
2603 |
+
curl_setopt($ch, CURLOPT_USERPWD, "{$auth_user}:{$auth_pass}");
|
2604 |
+
}
|
2605 |
|
2606 |
+
$response = curl_exec($ch);
|
|
|
|
|
2607 |
|
2608 |
+
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
2609 |
|
2610 |
+
curl_close($ch);
|
2611 |
|
2612 |
+
if ($httpcode != 200) {
|
2613 |
+
self::addNotice("Error for request: " . $url . " : ". $response,'error');
|
2614 |
+
return $httpcode;
|
2615 |
+
}
|
2616 |
|
2617 |
+
return $response;
|
2618 |
}
|
2619 |
|
2620 |
// Shortens the url.
|
2621 |
public function shortenURL($url, $service, $id, $bitly_key, $bitly_user) {
|
2622 |
+
$url = urlencode($url);
|
2623 |
if ($service == "bit.ly") {
|
2624 |
+
|
2625 |
//$shortURL = $url;
|
2626 |
$url = trim($url);
|
2627 |
$bitly_key = trim($bitly_key);
|
2628 |
$bitly_user = trim($bitly_user);
|
2629 |
+
$shortURL = "http://api.bit.ly/v3/shorten?format=txt&login=".$bitly_user."&apiKey=".$bitly_key."&longUrl={$url}";
|
2630 |
+
$shortURL = $this->sendRequest($shortURL, 'GET');
|
2631 |
+
|
2632 |
+
} elseif ($service == "tr.im") {
|
2633 |
+
$shortURL = "http://api.tr.im/api/trim_simple?url={$url}";
|
2634 |
+
$shortURL = $this->sendRequest($shortURL, 'GET');
|
2635 |
+
} elseif ($service == "3.ly") {
|
2636 |
+
$shortURL = "http://3.ly/?api=em5893833&u={$url}";
|
2637 |
+
$shortURL = $this->sendRequest($shortURL, 'GET');
|
2638 |
+
} elseif ($service == "tinyurl") {
|
2639 |
+
$shortURL = "http://tinyurl.com/api-create.php?url=" . $url;
|
2640 |
+
$shortURL = $this->sendRequest($shortURL, 'GET');
|
2641 |
+
} elseif ($service == "u.nu") {
|
2642 |
+
$shortURL = "http://u.nu/unu-api-simple?url={$url}";
|
2643 |
+
$shortURL = $this->sendRequest($shortURL, 'GET');
|
2644 |
+
} elseif ($service == "1click.at") {
|
2645 |
+
$shortURL = "http://1click.at/api.php?action=shorturl&url={$url}&format=simple";
|
2646 |
+
$shortURL = $this->sendRequest($shortURL, 'GET');
|
2647 |
+
} elseif ($service == "is.gd") {
|
2648 |
+
|
2649 |
+
$shortURL = "http://is.gd/api.php?longurl={$url}";
|
2650 |
+
|
2651 |
+
$shortURL = $this->sendRequest($shortURL, 'GET');
|
2652 |
+
} elseif ($service == "t.co") {
|
2653 |
+
$shortURL = "http://twitter.com/share?url={$url}";
|
2654 |
+
$shortURL = $this->sendRequest($shortURL, 'GET');
|
2655 |
+
} else {
|
2656 |
+
$shortURL = wp_get_shortlink($id);
|
2657 |
+
}
|
2658 |
+
if($shortURL != ' 400 '&& $shortURL!="500" && $shortURL!="0") {
|
2659 |
+
return $shortURL;
|
2660 |
+
}
|
2661 |
+
else
|
2662 |
+
update_option('cwp_topnew_notice','Looks like is an error with your url shortner');
|
2663 |
}
|
2664 |
|
2665 |
public function rop_load_dashboard_icon()
|
2666 |
{
|
2667 |
+
wp_register_style( 'rop_custom_dashboard_icon', ROPCUSTOMDASHBOARDICON, false, time() );
|
2668 |
wp_enqueue_style( 'rop_custom_dashboard_icon' );
|
2669 |
}
|
2670 |
|
2673 |
|
2674 |
if(class_exists('CWP_TOP_Core')) {
|
2675 |
$CWP_TOP_Core = new CWP_TOP_Core;
|
2676 |
+
}
|
inc/exclude-posts.php
CHANGED
@@ -3,180 +3,239 @@
|
|
3 |
require_once(ROPPLUGINPATH.'/tweet-old-post.php');
|
4 |
require_once(ROPPLUGINPATH.'/inc/xml.php');
|
5 |
|
6 |
-
|
7 |
-
{
|
8 |
-
function mysql_real_escape_string ($str)
|
9 |
-
{
|
10 |
-
return mysql_escape_string ($str);
|
11 |
-
}
|
12 |
-
}
|
13 |
-
function top_opt_optionselected($opValue, $value) {
|
14 |
-
if ($opValue == $value) {
|
15 |
-
return 'selected="selected"';
|
16 |
-
}
|
17 |
-
return '';
|
18 |
-
}
|
19 |
|
20 |
-
|
21 |
-
if (current_user_can('manage_options'))
|
22 |
{
|
23 |
-
$message = null;
|
24 |
-
$message_updated = __("Tweet Old Post Options Updated.", 'TweetOldPost');
|
25 |
-
$response = null;
|
26 |
-
$records_per_page = 20;
|
27 |
-
$twp_obj = new CWP_TOP_Core;
|
28 |
-
$omit_cat = "";
|
29 |
-
|
30 |
-
//$omit_cat=get_option('top_opt_omit_cats');
|
31 |
-
$update_text = "Exclude Selected";
|
32 |
-
$search_term="";
|
33 |
-
$ex_filter="all";
|
34 |
-
$cat_filter=0;
|
35 |
-
|
36 |
-
global $wpdb;
|
37 |
-
|
38 |
-
if ((!isset($_GET["paged"])) && (!isset($_POST["delids"]))) {
|
39 |
-
$exposts = get_option('top_opt_excluded_post');
|
40 |
-
} else {
|
41 |
-
$exposts = $_POST["delids"];
|
42 |
-
}
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
-
|
68 |
-
|
69 |
<div id="message" style="margin-top:30px" class="updated fade">
|
70 |
-
<p>' . __('Posts excluded successfully.', 'TweetOldPost') . '</p>
|
71 |
-
</div>');
|
72 |
-
|
73 |
-
}
|
74 |
-
global $cwp_top_fields;
|
75 |
-
foreach ($cwp_top_fields as $field => $value) {
|
76 |
-
$cwp_top_fields[$field]['option_value'] = get_option($cwp_top_fields[$field]['option']);
|
77 |
-
}
|
78 |
|
79 |
-
|
80 |
require_once(plugin_dir_path( __FILE__ )."view-exclude.php");
|
81 |
|
82 |
-
|
83 |
-
$sql = "SELECT p.ID,p.post_title,p.post_date,u.user_nicename,p.guid,p.post_type FROM $wpdb->posts p join $wpdb->users u on p.post_author=u.ID WHERE (post_type = '
|
84 |
AND post_status = 'publish'";
|
|
|
|
|
|
|
|
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
{
|
89 |
-
if($_POST["cat"] != 0)
|
90 |
-
{
|
91 |
-
|
92 |
-
$cat_filter = $_POST["cat"];
|
93 |
-
$cat_filter = mysql_real_escape_string($cat_filter);
|
94 |
-
$sql = $sql . " and p.ID IN ( SELECT tr.object_id FROM ".$wpdb->prefix."term_relationships AS tr INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id=" . $cat_filter . ")";
|
95 |
-
|
96 |
-
}
|
97 |
-
else
|
98 |
-
{
|
99 |
-
$sql = $sql . " and p.ID NOT IN ( SELECT tr.object_id FROM ".$wpdb->prefix."term_relationships AS tr INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN (" . $omit_cat . "))";
|
100 |
-
$cat_filter = 0;
|
101 |
-
}
|
102 |
|
103 |
-
if($_POST["selFilter"] == "excluded")
|
104 |
-
{
|
105 |
-
$sql = $sql . " and p.ID IN (".$exposts.")";
|
106 |
-
$update_text = "Update";
|
107 |
-
$ex_filter = "excluded";
|
108 |
}
|
109 |
-
|
110 |
}
|
111 |
else
|
112 |
-
{
|
113 |
-
if($omit_cat !='')
|
114 |
-
{
|
115 |
-
$sql = $sql . " and p.ID NOT IN ( SELECT tr.object_id FROM ".$wpdb->prefix."term_relationships AS tr INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN (" . $omit_cat . "))";
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
if(isset($_POST["s"]))
|
120 |
-
{
|
121 |
-
if(trim( $_POST["s"]) != "")
|
122 |
{
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
}
|
|
|
|
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
$sql = $sql . " order by post_date desc";
|
131 |
$posts = $wpdb->get_results($sql);
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
$from = $
|
136 |
-
$to = min($
|
137 |
$post_count =count($posts);
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
}
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
print('<div class="tablenav"><div class="alignleft actions">');
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
print('<p class="search-box" style="margin:0px">
|
159 |
-
<input type="text" id="post-search-input" name="s" value="'.$
|
160 |
<input type="submit" value="Search Posts" name="search" class="button" />
|
|
|
161 |
</p>');
|
162 |
print('</div>');
|
163 |
-
|
164 |
-
|
165 |
-
$page_links = paginate_links(array(
|
166 |
'base' => add_query_arg('paged', '%#%'),
|
167 |
'format' => '',
|
168 |
'prev_text' => __('«'),
|
169 |
'next_text' => __('»'),
|
170 |
'total' => ceil(count($posts) / $records_per_page),
|
171 |
-
'current' => $
|
172 |
));
|
173 |
-
|
174 |
if ($page_links) {
|
175 |
|
176 |
print('<div class="tablenav-pages">');
|
177 |
$page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s') . '</span>%s',
|
178 |
-
number_format_i18n(( $
|
179 |
-
number_format_i18n(min($
|
180 |
number_format_i18n(count($posts)),
|
181 |
$page_links
|
182 |
);
|
@@ -184,19 +243,17 @@ if(count($excludeList) >0)
|
|
184 |
print('</div>');
|
185 |
}
|
186 |
print('</div>');//tablenav div
|
187 |
-
|
188 |
print(' <div class="wrap">
|
189 |
<table class="widefat fixed">
|
190 |
<thead>
|
191 |
<tr>
|
192 |
-
<th class="manage-column column-cb check-column"><input name="headchkbx" onchange="javascript:checkedAll();" type="checkbox" value="checkall"/></th>
|
193 |
<th>No.</th>
|
194 |
<th>Id</th>
|
195 |
<th>Post Title</th>
|
196 |
<th>Author</th>
|
197 |
<th>Post Date</th>
|
198 |
-
<th>Categories</th>
|
199 |
-
<th>Post Type</th>
|
200 |
</tr>
|
201 |
</thead>
|
202 |
<tbody>
|
@@ -204,34 +261,22 @@ if(count($excludeList) >0)
|
|
204 |
|
205 |
|
206 |
|
207 |
-
|
208 |
for ($i = $from; $i < $to; $i++) {
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
if (!empty($categories)) {
|
213 |
-
$out = array();
|
214 |
-
foreach ($categories as $c)
|
215 |
-
$out[] = "<a href='edit.php?post_type={$posts[$i]->post_type}&category_name={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
|
216 |
-
$cats = join(', ', $out);
|
217 |
-
}
|
218 |
-
else {
|
219 |
-
$cats = 'Uncategorized';
|
220 |
-
}
|
221 |
-
|
222 |
-
if (in_array($posts[$i]->ID, $excluded_posts)) {
|
223 |
$checked = "Checked";
|
224 |
$bgcolor="#FFCC99";
|
225 |
} else {
|
226 |
$checked = "";
|
227 |
$bgcolor="#FFF";
|
228 |
}
|
229 |
-
|
230 |
print('
|
231 |
-
|
232 |
<tr style="background-color:'.$bgcolor.';">
|
233 |
<th class="check-column">
|
234 |
-
<input type="checkbox" name="
|
235 |
</th>
|
236 |
<td>
|
237 |
' . ($i + 1) . '
|
@@ -240,7 +285,7 @@ if(count($excludeList) >0)
|
|
240 |
' . $posts[$i]->ID . '
|
241 |
</td>
|
242 |
<td>
|
243 |
-
<a href=' . $posts[$i]->
|
244 |
</td>
|
245 |
<td>
|
246 |
' . $posts[$i]->user_nicename . '
|
@@ -248,14 +293,8 @@ if(count($excludeList) >0)
|
|
248 |
<td>
|
249 |
' . $posts[$i]->post_date . '
|
250 |
</td>
|
251 |
-
<td>
|
252 |
-
' . $cats . '
|
253 |
-
</td>
|
254 |
-
<td>
|
255 |
-
' . $posts[$i]->post_type . '
|
256 |
-
</td>
|
257 |
</tr>
|
258 |
-
|
259 |
');
|
260 |
}
|
261 |
print('
|
@@ -263,105 +302,40 @@ if(count($excludeList) >0)
|
|
263 |
</table>
|
264 |
</div>
|
265 |
');
|
266 |
-
|
267 |
-
|
|
|
268 |
|
269 |
if ($page_links) {
|
270 |
|
271 |
-
print('<div class="tablenav-pages">');
|
272 |
$page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s') . '</span>%s',
|
273 |
-
number_format_i18n(( $
|
274 |
-
number_format_i18n(min($
|
275 |
number_format_i18n(count($posts)),
|
276 |
$page_links
|
277 |
);
|
278 |
echo $page_links_text;
|
279 |
-
print('</div>');
|
280 |
}
|
281 |
-
print('</div></div>');
|
282 |
-
|
283 |
|
284 |
|
285 |
-
print('
|
286 |
-
<script language="javascript">
|
287 |
-
|
288 |
|
289 |
-
jQuery(function() {
|
290 |
-
jQuery(".page-numbers").click(function(e){
|
291 |
-
jQuery("#top_TweetOldPost").attr("action",jQuery(this).attr("href"));
|
292 |
-
e.preventDefault();
|
293 |
-
jQuery("#pageit").click();
|
294 |
-
});// page number click end
|
295 |
-
});//jquery document.ready end
|
296 |
-
|
297 |
-
function setExcludeList(exlist)
|
298 |
-
{
|
299 |
-
jQuery("#excludeList").html("\"" + exlist + "\"");
|
300 |
-
}
|
301 |
-
|
302 |
-
|
303 |
-
function managedelid(ctrl,id)
|
304 |
-
{
|
305 |
-
|
306 |
-
var delids = document.getElementById("delids").value;
|
307 |
-
if(ctrl.checked)
|
308 |
-
{
|
309 |
-
delids=addId(delids,id);
|
310 |
-
}
|
311 |
-
else
|
312 |
-
{
|
313 |
-
delids=removeId(delids,id);
|
314 |
-
}
|
315 |
-
document.getElementById("delids").value=delids;
|
316 |
-
setExcludeList(delids);
|
317 |
-
}
|
318 |
-
|
319 |
-
function removeId(list, value) {
|
320 |
-
list = list.split(",");
|
321 |
-
if(list.indexOf(value) != -1)
|
322 |
-
list.splice(list.indexOf(value), 1);
|
323 |
-
return list.join(",");
|
324 |
-
}
|
325 |
|
326 |
-
|
327 |
-
function addId(list,value)
|
328 |
-
{
|
329 |
-
list = list.split(",");
|
330 |
-
if(list.indexOf(value) == -1)
|
331 |
-
list.push(value);
|
332 |
-
return list.join(",");
|
333 |
-
}
|
334 |
-
|
335 |
-
function checkedAll() {
|
336 |
-
var ischecked=document.top_TweetOldPost.headchkbx.checked;
|
337 |
-
var delids="";
|
338 |
-
for (var i = 0; i < document.top_TweetOldPost.chkbx.length; i++) {
|
339 |
-
document.top_TweetOldPost.chkbx[i].checked = ischecked;
|
340 |
-
if(ischecked)
|
341 |
-
delids=delids+document.top_TweetOldPost.chkbx[i].value+",";
|
342 |
-
}
|
343 |
-
document.getElementById("delids").value=delids;
|
344 |
-
}
|
345 |
-
|
346 |
-
setExcludeList("' . $exposts . '");
|
347 |
-
|
348 |
-
</script>
|
349 |
-
');
|
350 |
}
|
351 |
else
|
352 |
{
|
353 |
-
print('
|
354 |
-
print('
|
355 |
<div id="message" style="margin-top:30px" class="updated fade">
|
356 |
<p>' . __('No Posts found. Review your search or filter criteria/term.', 'TweetOldPost') . '</p>
|
357 |
-
</div>');
|
358 |
}
|
359 |
-
print('</form>');
|
360 |
-
} else {
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
}
|
367 |
?>
|
3 |
require_once(ROPPLUGINPATH.'/tweet-old-post.php');
|
4 |
require_once(ROPPLUGINPATH.'/inc/xml.php');
|
5 |
|
6 |
+
function rop_exclude_posts() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
if (current_user_can('manage_options'))
|
|
|
9 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
global $wpdb;
|
12 |
+
$message_updated = __("Tweet Old Post Options Updated.", 'TweetOldPost');
|
13 |
+
$records_per_page = 20;
|
14 |
+
$twp_obj = new CWP_TOP_Core;
|
15 |
+
$paged = isset($_GET['paged']) ? $_GET['paged'] : 1;
|
16 |
+
$postTypes = $twp_obj->getTweetPostType();
|
17 |
+
$postTypes = explode(',',$postTypes);
|
18 |
+
$selected_post_type = isset($_POST['rop_select_post_type']) ? $_POST['rop_select_post_type'] : $postTypes[0];
|
19 |
+
$selected_tax = isset($_POST['rop_select_category']) ? $_POST['rop_select_category'] : "none";
|
20 |
+
$displayed_posts = array();
|
21 |
+
$exclude_search = isset($_POST['s']) ? $_POST['s'] : "";
|
22 |
+
$excluded_cats=get_option('top_opt_omit_cats');
|
23 |
+
if(is_array($excluded_cats)) $excluded_cats = implode(",",$excluded_cats);
|
24 |
+
if(empty($excluded_cats)) $excluded_cats = '';
|
25 |
+
if(!is_string($excluded_cats)) $excluded_cats = '';
|
26 |
+
$excluded_cats = trim($excluded_cats);
|
27 |
+
$excluded_display_option = array("all"=>"All","excluded"=>"Excluded","unexcluded"=>"Unexcluded");
|
28 |
+
$excluded_display_selected = isset($_POST['rop_display_selection']) ? $_POST['rop_display_selection'] : key($excluded_display_option);
|
29 |
+
$taxs = get_taxonomies(array(
|
30 |
+
'public' => true,
|
31 |
+
'hierarchical' => true
|
32 |
+
),"object","and");
|
33 |
+
$available_taxonomy = array();
|
34 |
+
foreach($postTypes as $pt){
|
35 |
+
foreach($taxs as $kt=>$tx){
|
36 |
+
|
37 |
+
if(in_array($pt,$tx->object_type)){
|
38 |
+
if(!isset($available_taxonomy[$kt])){
|
39 |
+
$available_taxonomy[$kt] = array("label"=>$tx->label);
|
40 |
+
}
|
41 |
+
if(!isset($available_taxonomy[$kt]['post_types'])){
|
42 |
+
$available_taxonomy[$kt]['post_types'] = array();
|
43 |
+
|
44 |
+
}
|
45 |
+
$available_taxonomy[$kt]['post_types'] = array_merge( $available_taxonomy[$kt]['post_types'],$tx->object_type);
|
46 |
+
if(!isset($available_taxonomy[$kt]['taxs'])){
|
47 |
+
$available_taxonomy[$kt]['taxs'] = array();
|
48 |
+
|
49 |
+
}
|
50 |
+
$terms = get_terms($tx->name, array(
|
51 |
+
'hide_empty' => false,
|
52 |
+
'exclude' =>$excluded_cats
|
53 |
+
));
|
54 |
+
foreach ($terms as $t) {
|
55 |
+
$available_taxonomy[$kt]['taxs'][$t->term_id] = $t->name;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
|
60 |
+
}
|
61 |
+
$excluded_ids = get_option('top_opt_excluded_post');
|
62 |
+
$excluded_ids = array_filter(explode(',',$excluded_ids));
|
63 |
+
if(isset($_POST['exclude']) ){
|
64 |
+
if(!isset($_POST['rop_post_id'])) $_POST['rop_post_id'] =array();
|
65 |
+
$show_items = explode(',',$_POST['rop_show_posts']);
|
66 |
+
$dif = array_diff($show_items,$_POST['rop_post_id']);
|
67 |
+
$com = array_intersect($dif,$excluded_ids);
|
68 |
+
$excluded_ids = array_diff($excluded_ids,$com);
|
69 |
+
$excluded_ids = array_merge ($excluded_ids,$_POST['rop_post_id']);
|
70 |
+
$excluded_ids = array_unique($excluded_ids);
|
71 |
+
update_option('top_opt_excluded_post',implode(',',$excluded_ids));
|
72 |
+
}
|
73 |
|
74 |
+
if(isset($_POST['exclude']) ) {
|
75 |
+
print( '
|
76 |
<div id="message" style="margin-top:30px" class="updated fade">
|
77 |
+
<p>' . __( 'Posts excluded successfully.', 'TweetOldPost' ) . '</p>
|
78 |
+
</div>' );
|
79 |
+
}
|
|
|
|
|
|
|
|
|
|
|
80 |
|
|
|
81 |
require_once(plugin_dir_path( __FILE__ )."view-exclude.php");
|
82 |
|
83 |
+
|
84 |
+
$sql = "SELECT p.ID,p.post_title,p.post_date,u.user_nicename,p.guid,p.post_type FROM $wpdb->posts p join $wpdb->users u on p.post_author=u.ID WHERE (post_type = '{$selected_post_type}')
|
85 |
AND post_status = 'publish'";
|
86 |
+
if($selected_tax != 'none'){
|
87 |
+
$sql = $sql . " and p.ID IN ( SELECT tr.object_id FROM ".$wpdb->prefix."term_relationships AS tr INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.term_id=" . $selected_tax . " ";
|
88 |
+
if(!empty($excluded_cats)){
|
89 |
+
$sql .= " and tr.object_id NOT IN ( SELECT tr.object_id FROM ".$wpdb->prefix."term_relationships AS tr INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id AND tt.term_id IN (" . $excluded_cats . ")) ) ";
|
90 |
|
91 |
+
}else{
|
92 |
+
$sql .= ")";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
|
|
95 |
}
|
96 |
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
{
|
98 |
+
|
99 |
+
if(!empty($excluded_cats)){
|
100 |
+
$sql = $sql . " and p.ID NOT IN ( SELECT tr.object_id FROM ".$wpdb->prefix."term_relationships AS tr INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id AND tt.term_id IN (" . $excluded_cats . "))";
|
101 |
+
|
102 |
+
}
|
103 |
}
|
104 |
+
if($excluded_display_selected == "excluded" )
|
105 |
+
{
|
106 |
|
107 |
+
$sql = $sql . " and p.ID IN (".implode(",",$excluded_ids).")";
|
108 |
+
}
|
109 |
+
if($excluded_display_selected == "unexcluded" && !empty($excluded_ids))
|
110 |
+
{
|
111 |
+
|
112 |
+
$sql = $sql . " and p.ID NOT in (".implode(",",$excluded_ids).")";
|
113 |
+
}
|
114 |
+
if(!empty($exclude_search))
|
115 |
+
$sql = $sql . " and post_title like '%" . trim($exclude_search ) . "%'";
|
116 |
$sql = $sql . " order by post_date desc";
|
117 |
$posts = $wpdb->get_results($sql);
|
118 |
|
119 |
+
|
120 |
+
|
121 |
+
$from = $paged * $records_per_page - $records_per_page;
|
122 |
+
$to = min($paged * $records_per_page, count($posts));
|
123 |
$post_count =count($posts);
|
124 |
+
|
125 |
+
print('<form id="top_TweetOldPost" name="top_TweetOldPost" action="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=ExcludePosts" method="post">');
|
126 |
+
print('
|
127 |
+
<script language="javascript">
|
128 |
+
|
129 |
+
function ROPshowCorectTax(){
|
130 |
+
var post_type = jQuery("#rop_select_post_type").val();
|
131 |
+
jQuery("#rop_select_category optgroup").each(function(){
|
132 |
+
var pt = jQuery(this).attr("data-post-type").split(",");
|
133 |
+
var th = jQuery(this);
|
134 |
+
if(jQuery.inArray(post_type,pt) > -1){
|
135 |
+
th.show();
|
136 |
+
}else{
|
137 |
+
th.hide();
|
138 |
}
|
139 |
+
|
140 |
+
|
141 |
+
});
|
142 |
+
|
143 |
}
|
144 |
+
jQuery(function() {
|
145 |
+
jQuery("#rop_select_post_type").on("change",function(){
|
146 |
+
ROPshowCorectTax();
|
147 |
+
|
148 |
+
});
|
149 |
+
ROPshowCorectTax();
|
150 |
+
|
151 |
+
|
152 |
+
|
153 |
+
|
154 |
+
|
155 |
+
|
156 |
+
|
157 |
+
});
|
158 |
+
function checkedAll() {
|
159 |
+
if(jQuery("rop-header-check").is("checked")){
|
160 |
+
jQuery(".rop_post_id").attr("checked","checked");
|
161 |
+
|
162 |
+
}else{
|
163 |
+
|
164 |
+
jQuery(".rop_post_id").removeAttr("checked" );
|
165 |
+
|
166 |
+
}
|
167 |
+
}
|
168 |
+
</script>
|
169 |
+
');
|
170 |
print('<div class="tablenav"><div class="alignleft actions">');
|
171 |
+
?> <p class="rop-exclude-filter">
|
172 |
+
<label>View: </label>
|
173 |
+
<select name="rop_display_selection" id="selFilter" style="width:100px">
|
174 |
+
<?php foreach($excluded_display_option as $value=>$name): ?>
|
175 |
+
<option value="<?php echo $value; ?>" <?php selected($value,$excluded_display_selected); ?> > <?php echo $name; ?></option>
|
176 |
+
<?php endforeach; ?>
|
177 |
+
</select>
|
178 |
+
</p>
|
179 |
+
<p class="rop-exclude-filter">
|
180 |
+
<label>Post type</label>
|
181 |
+
<select name="rop_select_post_type" id="rop_select_post_type">
|
182 |
+
<?php
|
183 |
+
foreach($postTypes as $pt):
|
184 |
+
?>
|
185 |
+
<option value="<?php echo $pt ?>" <?php selected($pt,$selected_post_type); ?>><?php echo $pt?></option>
|
186 |
+
<?php
|
187 |
+
endforeach;
|
188 |
+
?>
|
189 |
+
|
190 |
+
</select>
|
191 |
+
</p>
|
192 |
+
|
193 |
+
<p class="rop-exclude-filter">
|
194 |
+
<label>Category</label>
|
195 |
+
<select name="rop_select_category" id="rop_select_category">
|
196 |
+
<option value="none"> All </option>
|
197 |
+
<?php
|
198 |
+
foreach($available_taxonomy as $at):
|
199 |
+
?>
|
200 |
+
<optgroup label="<?php echo $at['label']; ?>" data-post-type="<?php echo implode(',',$at['post_types']);?>">
|
201 |
+
<?php
|
202 |
+
foreach($at['taxs'] as $id=>$tax): ?>
|
203 |
+
<option value="<?php echo $id ?>" <?php selected($id,$selected_tax); ?>><?php echo $tax; ?></option>
|
204 |
+
<?php
|
205 |
+
endforeach;
|
206 |
+
?>
|
207 |
+
</optgroup>
|
208 |
+
|
209 |
+
<?php
|
210 |
+
endforeach;
|
211 |
+
?>
|
212 |
+
|
213 |
+
</select>
|
214 |
+
</p>
|
215 |
+
<?php
|
216 |
+
|
217 |
print('<p class="search-box" style="margin:0px">
|
218 |
+
<input type="text" id="post-search-input" name="s" value="'.$exclude_search.'" />
|
219 |
<input type="submit" value="Search Posts" name="search" class="button" />
|
220 |
+
<input type="submit" value="Exclude selected" name="exclude" class="button" />
|
221 |
</p>');
|
222 |
print('</div>');
|
223 |
+
|
224 |
+
$page_links = paginate_links(array(
|
|
|
225 |
'base' => add_query_arg('paged', '%#%'),
|
226 |
'format' => '',
|
227 |
'prev_text' => __('«'),
|
228 |
'next_text' => __('»'),
|
229 |
'total' => ceil(count($posts) / $records_per_page),
|
230 |
+
'current' => $paged
|
231 |
));
|
232 |
+
|
233 |
if ($page_links) {
|
234 |
|
235 |
print('<div class="tablenav-pages">');
|
236 |
$page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s') . '</span>%s',
|
237 |
+
number_format_i18n(( $paged - 1 ) * $records_per_page + 1),
|
238 |
+
number_format_i18n(min($paged * $records_per_page, count($posts))),
|
239 |
number_format_i18n(count($posts)),
|
240 |
$page_links
|
241 |
);
|
243 |
print('</div>');
|
244 |
}
|
245 |
print('</div>');//tablenav div
|
246 |
+
if (count($posts) > 0) {
|
247 |
print(' <div class="wrap">
|
248 |
<table class="widefat fixed">
|
249 |
<thead>
|
250 |
<tr>
|
251 |
+
<th class="manage-column column-cb check-column"><input name="headchkbx" id="rop-header-check" onchange="javascript:checkedAll();" type="checkbox" value="checkall"/></th>
|
252 |
<th>No.</th>
|
253 |
<th>Id</th>
|
254 |
<th>Post Title</th>
|
255 |
<th>Author</th>
|
256 |
<th>Post Date</th>
|
|
|
|
|
257 |
</tr>
|
258 |
</thead>
|
259 |
<tbody>
|
261 |
|
262 |
|
263 |
|
|
|
264 |
for ($i = $from; $i < $to; $i++) {
|
265 |
+
|
266 |
+
$displayed_posts[] = $posts[$i]->ID;
|
267 |
+
if (in_array($posts[$i]->ID, $excluded_ids)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
$checked = "Checked";
|
269 |
$bgcolor="#FFCC99";
|
270 |
} else {
|
271 |
$checked = "";
|
272 |
$bgcolor="#FFF";
|
273 |
}
|
274 |
+
$displayed_posts[] = $posts[$i]->ID;
|
275 |
print('
|
276 |
+
|
277 |
<tr style="background-color:'.$bgcolor.';">
|
278 |
<th class="check-column">
|
279 |
+
<input type="checkbox" name="rop_post_id[]" class="rop_post_id" id="del' . $posts[$i]->ID . '" value="' . $posts[$i]->ID . '" ' . $checked . '/>
|
280 |
</th>
|
281 |
<td>
|
282 |
' . ($i + 1) . '
|
285 |
' . $posts[$i]->ID . '
|
286 |
</td>
|
287 |
<td>
|
288 |
+
<a href=' . get_permalink($posts[$i]->ID) . ' target="_blank">' . $posts[$i]->post_title . '</a>
|
289 |
</td>
|
290 |
<td>
|
291 |
' . $posts[$i]->user_nicename . '
|
293 |
<td>
|
294 |
' . $posts[$i]->post_date . '
|
295 |
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
</tr>
|
297 |
+
|
298 |
');
|
299 |
}
|
300 |
print('
|
302 |
</table>
|
303 |
</div>
|
304 |
');
|
305 |
+
?>
|
306 |
+
<input type="hidden" name="rop_show_posts" value="<?php echo implode(',',$displayed_posts); ?>"/>
|
307 |
+
<?php
|
308 |
|
309 |
if ($page_links) {
|
310 |
|
311 |
+
print('<div class="tablenav"> <div class="tablenav-pages">');
|
312 |
$page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s') . '</span>%s',
|
313 |
+
number_format_i18n(( $paged - 1 ) * $records_per_page + 1),
|
314 |
+
number_format_i18n(min($paged * $records_per_page, count($posts))),
|
315 |
number_format_i18n(count($posts)),
|
316 |
$page_links
|
317 |
);
|
318 |
echo $page_links_text;
|
319 |
+
print('</div></div> ');
|
320 |
}
|
|
|
|
|
321 |
|
322 |
|
|
|
|
|
|
|
323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
}
|
326 |
else
|
327 |
{
|
328 |
+
print('<div class="wrap">
|
|
|
329 |
<div id="message" style="margin-top:30px" class="updated fade">
|
330 |
<p>' . __('No Posts found. Review your search or filter criteria/term.', 'TweetOldPost') . '</p>
|
331 |
+
</div></div>');
|
332 |
}
|
333 |
+
print('</form></section>');
|
334 |
+
} else {
|
335 |
+
print('
|
336 |
+
<div id="message" class="updated fade">
|
337 |
+
<p>' . __('You do not have enough permission to set the option. Please contact your admin.', 'TweetOldPost') . '</p>
|
338 |
+
</div>');
|
339 |
+
}
|
340 |
}
|
341 |
?>
|
inc/oAuth/OAuth.php
CHANGED
@@ -94,9 +94,9 @@ abstract class RopOAuthSignatureMethod {
|
|
94 |
}
|
95 |
}
|
96 |
/**
|
97 |
-
* The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
|
98 |
-
* where the Signature Base String is the text and the key is the concatenated values (each first
|
99 |
-
* encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
|
100 |
* character (ASCII code 38) even if empty.
|
101 |
* - Chapter 9.2 ("HMAC-SHA1")
|
102 |
*/
|
@@ -124,7 +124,7 @@ class RopOAuthSignatureMethod_HMAC_SHA1 extends RopOAuthSignatureMethod {
|
|
124 |
}
|
125 |
}
|
126 |
/**
|
127 |
-
* The PLAINTEXT method does not provide any security protection and SHOULD only be used
|
128 |
* over a secure channel such as HTTPS. It does not use the Signature Base String.
|
129 |
* - Chapter 9.4 ("PLAINTEXT")
|
130 |
*/
|
@@ -135,8 +135,8 @@ class RopOAuthSignatureMethod_PLAINTEXT extends RopOAuthSignatureMethod {
|
|
135 |
}
|
136 |
|
137 |
/**
|
138 |
-
* oauth_signature is set to the concatenated encoded values of the Consumer Secret and
|
139 |
-
* Token Secret, separated by a '&' character (ASCII code 38), even if either secret is
|
140 |
* empty. The result MUST be encoded again.
|
141 |
* - Chapter 9.4.1 ("Generating Signatures")
|
142 |
*
|
@@ -159,10 +159,10 @@ class RopOAuthSignatureMethod_PLAINTEXT extends RopOAuthSignatureMethod {
|
|
159 |
}
|
160 |
|
161 |
/**
|
162 |
-
* The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in
|
163 |
-
* [RFC3447] section 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function for
|
164 |
-
* EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its RSA public key in a
|
165 |
-
* verified way to the Service Provider, in a manner which is beyond the scope of this
|
166 |
* specification.
|
167 |
* - Chapter 9.3 ("RSA-SHA1")
|
168 |
*/
|
@@ -481,9 +481,46 @@ class RopOAuthRequest {
|
|
481 |
* util function: current timestamp
|
482 |
*/
|
483 |
private static function generate_timestamp() {
|
484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
/**
|
488 |
* util function: current nonce
|
489 |
*/
|
@@ -574,7 +611,7 @@ class RopOAuthServer {
|
|
574 |
private function get_version(&$request) {
|
575 |
$version = $request->get_parameter("oauth_version");
|
576 |
if (!$version) {
|
577 |
-
// Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present.
|
578 |
// Chapter 7.0 ("Accessing Protected Ressources")
|
579 |
$version = '1.0';
|
580 |
}
|
@@ -674,7 +711,7 @@ class RopOAuthServer {
|
|
674 |
throw new RopOAuthException(
|
675 |
'Missing timestamp parameter. The parameter is required'
|
676 |
);
|
677 |
-
|
678 |
// verify that timestamp is recentish
|
679 |
$now = time();
|
680 |
if (abs($now - $timestamp) > $this->timestamp_threshold) {
|
94 |
}
|
95 |
}
|
96 |
/**
|
97 |
+
* The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
|
98 |
+
* where the Signature Base String is the text and the key is the concatenated values (each first
|
99 |
+
* encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
|
100 |
* character (ASCII code 38) even if empty.
|
101 |
* - Chapter 9.2 ("HMAC-SHA1")
|
102 |
*/
|
124 |
}
|
125 |
}
|
126 |
/**
|
127 |
+
* The PLAINTEXT method does not provide any security protection and SHOULD only be used
|
128 |
* over a secure channel such as HTTPS. It does not use the Signature Base String.
|
129 |
* - Chapter 9.4 ("PLAINTEXT")
|
130 |
*/
|
135 |
}
|
136 |
|
137 |
/**
|
138 |
+
* oauth_signature is set to the concatenated encoded values of the Consumer Secret and
|
139 |
+
* Token Secret, separated by a '&' character (ASCII code 38), even if either secret is
|
140 |
* empty. The result MUST be encoded again.
|
141 |
* - Chapter 9.4.1 ("Generating Signatures")
|
142 |
*
|
159 |
}
|
160 |
|
161 |
/**
|
162 |
+
* The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in
|
163 |
+
* [RFC3447] section 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function for
|
164 |
+
* EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its RSA public key in a
|
165 |
+
* verified way to the Service Provider, in a manner which is beyond the scope of this
|
166 |
* specification.
|
167 |
* - Chapter 9.3 ("RSA-SHA1")
|
168 |
*/
|
481 |
* util function: current timestamp
|
482 |
*/
|
483 |
private static function generate_timestamp() {
|
484 |
+
|
485 |
+
$ci = curl_init();
|
486 |
+
|
487 |
+
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
|
488 |
+
curl_setopt($ci, CURLOPT_HEADER, TRUE);
|
489 |
+
|
490 |
+
curl_setopt($ci, CURLOPT_URL, "http://api.twitter.com/1.1/");
|
491 |
+
|
492 |
+
$response = curl_exec($ci);
|
493 |
+
$header_size = curl_getinfo($ci, CURLINFO_HEADER_SIZE);
|
494 |
+
$header = substr($response, 0, $header_size);
|
495 |
+
$headers = self::get_headers_from_curl_response($header);
|
496 |
+
return strtotime($headers[0]['date']);
|
497 |
}
|
498 |
+
static function get_headers_from_curl_response($headerContent)
|
499 |
+
{
|
500 |
+
|
501 |
+
$headers = array();
|
502 |
+
|
503 |
+
// Split the string on every "double" new line.
|
504 |
+
$arrRequests = explode("\r\n\r\n", $headerContent);
|
505 |
|
506 |
+
// Loop of response headers. The "count() -1" is to
|
507 |
+
//avoid an empty row for the extra line break before the body of the response.
|
508 |
+
for ($index = 0; $index < count($arrRequests) -1; $index++) {
|
509 |
+
|
510 |
+
foreach (explode("\r\n", $arrRequests[$index]) as $i => $line)
|
511 |
+
{
|
512 |
+
if ($i === 0)
|
513 |
+
$headers[$index]['http_code'] = $line;
|
514 |
+
else
|
515 |
+
{
|
516 |
+
list ($key, $value) = explode(': ', $line);
|
517 |
+
$headers[$index][$key] = $value;
|
518 |
+
}
|
519 |
+
}
|
520 |
+
}
|
521 |
+
|
522 |
+
return $headers;
|
523 |
+
}
|
524 |
/**
|
525 |
* util function: current nonce
|
526 |
*/
|
611 |
private function get_version(&$request) {
|
612 |
$version = $request->get_parameter("oauth_version");
|
613 |
if (!$version) {
|
614 |
+
// Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present.
|
615 |
// Chapter 7.0 ("Accessing Protected Ressources")
|
616 |
$version = '1.0';
|
617 |
}
|
711 |
throw new RopOAuthException(
|
712 |
'Missing timestamp parameter. The parameter is required'
|
713 |
);
|
714 |
+
|
715 |
// verify that timestamp is recentish
|
716 |
$now = time();
|
717 |
if (abs($now - $timestamp) > $this->timestamp_threshold) {
|
inc/oAuth/twitteroauth.php
CHANGED
@@ -23,7 +23,7 @@ class RopTwitterOAuth {
|
|
23 |
/* Set timeout default. */
|
24 |
public $timeout = 30;
|
25 |
/* Set connect timeout. */
|
26 |
-
public $connecttimeout = 30;
|
27 |
/* Verify SSL Cert. */
|
28 |
public $ssl_verifypeer = FALSE;
|
29 |
/* Respons format. */
|
@@ -41,8 +41,8 @@ class RopTwitterOAuth {
|
|
41 |
/* caching responses for an hour only with GET requests */
|
42 |
public $cache = 0;
|
43 |
/* where cache files will be stored if above is set to true */
|
44 |
-
public $cacheLocation = '/tmp';
|
45 |
-
|
46 |
/**
|
47 |
* Set API URLS
|
48 |
*/
|
@@ -78,7 +78,7 @@ class RopTwitterOAuth {
|
|
78 |
*/
|
79 |
function getRequestToken($oauth_callback) {
|
80 |
$parameters = array();
|
81 |
-
$parameters['oauth_callback'] = $oauth_callback;
|
82 |
$request = $this->RopOAuthRequest($this->requestTokenURL(), 'GET', $parameters);
|
83 |
return $this->getToken($request);
|
84 |
}
|
@@ -123,7 +123,7 @@ class RopTwitterOAuth {
|
|
123 |
* "user_id" => "9436992",
|
124 |
* "screen_name" => "abraham",
|
125 |
* "x_auth_expires" => "0")
|
126 |
-
*/
|
127 |
function getXAuthToken($username, $password) {
|
128 |
$parameters = array();
|
129 |
$parameters['x_auth_username'] = $username;
|
@@ -143,7 +143,7 @@ class RopTwitterOAuth {
|
|
143 |
}
|
144 |
return $response;
|
145 |
}
|
146 |
-
|
147 |
/**
|
148 |
* POST wrapper for RopOAuthRequest.
|
149 |
*/
|
@@ -216,7 +216,7 @@ class RopTwitterOAuth {
|
|
216 |
*/
|
217 |
function http($url, $method, $postfields = NULL, $authorization_header= false) {
|
218 |
$this->http_info = array();
|
219 |
-
|
220 |
$ci = curl_init();
|
221 |
|
222 |
$headers = Array('Expect:');
|
@@ -250,14 +250,19 @@ class RopTwitterOAuth {
|
|
250 |
$response = curl_exec($ci);
|
251 |
|
252 |
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
|
|
|
|
|
|
|
|
|
|
261 |
return $response;
|
262 |
}
|
263 |
|
@@ -273,10 +278,10 @@ class RopTwitterOAuth {
|
|
273 |
}
|
274 |
return strlen($header);
|
275 |
}
|
276 |
-
|
277 |
function checkCache($fileName, $time) {
|
278 |
$fileName = $this->cacheLocation.'/'.$fileName;
|
279 |
-
|
280 |
if (!file_exists($fileName)) {
|
281 |
$this->cache_debug = $fileName . 'does not exist';
|
282 |
return 0;
|
@@ -292,11 +297,11 @@ class RopTwitterOAuth {
|
|
292 |
$this->cache_debug = 'cache file expired';
|
293 |
return 1;
|
294 |
}
|
295 |
-
|
296 |
$this->cache_debug = 'cache file still valid';
|
297 |
return 0;
|
298 |
}
|
299 |
-
|
300 |
function cacheFile($data, $filename) {
|
301 |
$new_file = $this->cacheLocation.'/'.$fileName;
|
302 |
$fh = fopen($new_file, 'w+');
|
@@ -313,7 +318,7 @@ class RopTwitterOAuth {
|
|
313 |
chmod($new_file, 0766);
|
314 |
return 1;
|
315 |
}
|
316 |
-
|
317 |
function cacheRetrieve($fileName) {
|
318 |
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
|
319 |
if (!$fh = fopen($this->cacheLocation.'/'.$fileName, 'r')) {
|
@@ -323,8 +328,8 @@ class RopTwitterOAuth {
|
|
323 |
error_reporting(E_ALL ^ E_NOTICE);
|
324 |
|
325 |
$xml = "";
|
326 |
-
while (!feof($fh)) {
|
327 |
-
$xml .= fread($fh, 1024);
|
328 |
}
|
329 |
fclose($fh);
|
330 |
|
23 |
/* Set timeout default. */
|
24 |
public $timeout = 30;
|
25 |
/* Set connect timeout. */
|
26 |
+
public $connecttimeout = 30;
|
27 |
/* Verify SSL Cert. */
|
28 |
public $ssl_verifypeer = FALSE;
|
29 |
/* Respons format. */
|
41 |
/* caching responses for an hour only with GET requests */
|
42 |
public $cache = 0;
|
43 |
/* where cache files will be stored if above is set to true */
|
44 |
+
public $cacheLocation = '/tmp';
|
45 |
+
|
46 |
/**
|
47 |
* Set API URLS
|
48 |
*/
|
78 |
*/
|
79 |
function getRequestToken($oauth_callback) {
|
80 |
$parameters = array();
|
81 |
+
$parameters['oauth_callback'] = $oauth_callback;
|
82 |
$request = $this->RopOAuthRequest($this->requestTokenURL(), 'GET', $parameters);
|
83 |
return $this->getToken($request);
|
84 |
}
|
123 |
* "user_id" => "9436992",
|
124 |
* "screen_name" => "abraham",
|
125 |
* "x_auth_expires" => "0")
|
126 |
+
*/
|
127 |
function getXAuthToken($username, $password) {
|
128 |
$parameters = array();
|
129 |
$parameters['x_auth_username'] = $username;
|
143 |
}
|
144 |
return $response;
|
145 |
}
|
146 |
+
|
147 |
/**
|
148 |
* POST wrapper for RopOAuthRequest.
|
149 |
*/
|
216 |
*/
|
217 |
function http($url, $method, $postfields = NULL, $authorization_header= false) {
|
218 |
$this->http_info = array();
|
219 |
+
|
220 |
$ci = curl_init();
|
221 |
|
222 |
$headers = Array('Expect:');
|
250 |
$response = curl_exec($ci);
|
251 |
|
252 |
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
|
253 |
+
|
254 |
+
if ( $this->http_code != 200 ) {
|
255 |
+
CWP_TOP_Core::addNotice( "Twitter error: " . htmlentities($response), 'error' );
|
256 |
+
return false;
|
257 |
+
}
|
258 |
+
$this->http_info = array_merge( $this->http_info, curl_getinfo( $ci ) );
|
259 |
+
$this->url = $url;
|
260 |
+
curl_close( $ci );
|
261 |
+
|
262 |
+
if ( $this->cache ) {
|
263 |
+
$this->cacheFile( $response, $this->cache_file_name );
|
264 |
+
}
|
265 |
+
|
266 |
return $response;
|
267 |
}
|
268 |
|
278 |
}
|
279 |
return strlen($header);
|
280 |
}
|
281 |
+
|
282 |
function checkCache($fileName, $time) {
|
283 |
$fileName = $this->cacheLocation.'/'.$fileName;
|
284 |
+
|
285 |
if (!file_exists($fileName)) {
|
286 |
$this->cache_debug = $fileName . 'does not exist';
|
287 |
return 0;
|
297 |
$this->cache_debug = 'cache file expired';
|
298 |
return 1;
|
299 |
}
|
300 |
+
|
301 |
$this->cache_debug = 'cache file still valid';
|
302 |
return 0;
|
303 |
}
|
304 |
+
|
305 |
function cacheFile($data, $filename) {
|
306 |
$new_file = $this->cacheLocation.'/'.$fileName;
|
307 |
$fh = fopen($new_file, 'w+');
|
318 |
chmod($new_file, 0766);
|
319 |
return 1;
|
320 |
}
|
321 |
+
|
322 |
function cacheRetrieve($fileName) {
|
323 |
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
|
324 |
if (!$fh = fopen($this->cacheLocation.'/'.$fileName, 'r')) {
|
328 |
error_reporting(E_ALL ^ E_NOTICE);
|
329 |
|
330 |
$xml = "";
|
331 |
+
while (!feof($fh)) {
|
332 |
+
$xml .= fread($fh, 1024);
|
333 |
}
|
334 |
fclose($fh);
|
335 |
|
inc/view-accounts.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input id="cwp_top_currenturl" type="hidden" value="<?php echo CURRENTURL; ?>">
|
2 |
+
|
3 |
+
<fieldset class="option">
|
4 |
+
<div class="left">
|
5 |
+
<label for="twitter-login"> <?php _e("Twitter Login", CWP_TEXTDOMAIN); ?> </label>
|
6 |
+
<span class='description'> <?php _e("Login using your Twitter account.", CWP_TEXTDOMAIN); ?> </span>
|
7 |
+
</div><!-- end .left -->
|
8 |
+
|
9 |
+
<div class='right'>
|
10 |
+
<?php
|
11 |
+
|
12 |
+
|
13 |
+
$tw_users = 0;
|
14 |
+
//$this->tweetPost(array("message"=>"Testinsd sg tpo","link"=>"http://wicked-stallion-64-120688.euw1.nitrousbox.com/"));
|
15 |
+
//echo count($this->users);
|
16 |
+
if(!empty($this->users))
|
17 |
+
foreach ($this->users as $user) {
|
18 |
+
if ($user['service']=='twitter'|| !isset($user['service'])) {
|
19 |
+
$tw_users++;
|
20 |
+
?>
|
21 |
+
<div class="user_details">
|
22 |
+
<div class='user_avatar'><img src="<?php echo $user['oauth_user_details']->profile_image_url; ?>"></div>
|
23 |
+
<div class="user_name"><?php echo $user['oauth_user_details']->name; ?></div>
|
24 |
+
<div class="remove_user"><a href='#' id='<?php echo $user['user_id']; ?>' class='logout_user'></a></div>
|
25 |
+
</div><!-- end .user_details -->
|
26 |
+
<?php } }
|
27 |
+
if ($tw_users!==0) { ?>
|
28 |
+
<button id='twitter-login' class='another-account login' service='twitter'>+</button>
|
29 |
+
<?php } else { ?>
|
30 |
+
<button id='twitter-login' class='login' service='twitter'> <?php _e("Add Account", CWP_TEXTDOMAIN) ?> </button>
|
31 |
+
<?php } ?>
|
32 |
+
</div><!-- end .right -->
|
33 |
+
</fieldset><!-- end .option -->
|
34 |
+
|
35 |
+
<fieldset class="option">
|
36 |
+
<div class="left">
|
37 |
+
<label for="facebook-login"> <?php _e("Facebook Login", CWP_TEXTDOMAIN); ?> </label>
|
38 |
+
<span class='description'> <?php _e("Login using your Facebook account.", CWP_TEXTDOMAIN); ?> </span>
|
39 |
+
</div><!-- end .left -->
|
40 |
+
|
41 |
+
<div class='right'>
|
42 |
+
<?php
|
43 |
+
|
44 |
+
$fb_users = 0;
|
45 |
+
|
46 |
+
if(!empty($this->users))
|
47 |
+
foreach ($this->users as $user) {
|
48 |
+
if ($user['service']=='facebook') {
|
49 |
+
$fb_users++;
|
50 |
+
?>
|
51 |
+
<div class="user_details">
|
52 |
+
<div class='user_avatar'><img src="<?php echo $user['oauth_user_details']->profile_image_url; ?>"></div>
|
53 |
+
<div class="user_name"><?php echo $user['oauth_user_details']->name; ?></div>
|
54 |
+
<div class="remove_user"><a href='#' id='<?php echo $user['user_id']; ?>' service='facebook' class='logout_user'></a></div>
|
55 |
+
</div><!-- end .user_details -->
|
56 |
+
<?php } }
|
57 |
+
if ($fb_users!==0){ ?>
|
58 |
+
<button id='facebook-login' class='another-account login' service='facebook'>+</button>
|
59 |
+
<?php } else {
|
60 |
+
if (get_option('top_fb_token')===""||!get_option('top_fb_token')) {
|
61 |
+
?>
|
62 |
+
<button id='facebook-login' class='login' service='facebook'> <?php _e("Authorize", CWP_TEXTDOMAIN) ?> </button>
|
63 |
+
<?php } else {?>
|
64 |
+
<button id='facebook-login' class='login' service='facebook'> <?php _e("Add Account", CWP_TEXTDOMAIN) ?> </button>
|
65 |
+
<?php }} ?>
|
66 |
+
</div><!-- end .right -->
|
67 |
+
</fieldset><!-- end .option -->
|
68 |
+
|
69 |
+
<fieldset class="option">
|
70 |
+
<div class="left">
|
71 |
+
<label for="linkedin-login"> <?php _e("Linkedin Login", CWP_TEXTDOMAIN); ?> </label>
|
72 |
+
<span class='description'> <?php _e("Login using your Linkedin account.", CWP_TEXTDOMAIN); ?> </span>
|
73 |
+
</div><!-- end .left -->
|
74 |
+
|
75 |
+
<div class='right'>
|
76 |
+
<?php
|
77 |
+
|
78 |
+
$lk_users = 0;
|
79 |
+
|
80 |
+
if(!empty($this->users))
|
81 |
+
foreach ($this->users as $user) {
|
82 |
+
if ($user['service']=='linkedin') {
|
83 |
+
$lk_users++;
|
84 |
+
?>
|
85 |
+
<div class="user_details">
|
86 |
+
<div class='user_avatar'><img src="<?php echo $user['oauth_user_details']->profile_image_url; ?>"></div>
|
87 |
+
<div class="user_name"><?php echo $user['oauth_user_details']->name; ?></div>
|
88 |
+
<div class="remove_user"><a href='#' id='<?php echo $user['user_id']; ?>' service='linkedin' class='logout_user'></a></div>
|
89 |
+
</div><!-- end .user_details -->
|
90 |
+
<?php } }
|
91 |
+
if ($lk_users!==0){ ?>
|
92 |
+
<button id='linkedin-login' class='another-account login' service='linkedin'>+</button>
|
93 |
+
<?php } else { ?>
|
94 |
+
<button id='linkedin-login' class='login' service='linkedin'> <?php _e("Add account", CWP_TEXTDOMAIN); ?> </button>
|
95 |
+
<?php } ?>
|
96 |
+
</div><!-- end .right -->
|
97 |
+
</fieldset><!-- end .option -->
|
98 |
+
|
inc/view-exclude.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
|
8 |
<header id="cwp_top_header" class='clearfix'>
|
9 |
<h1 class="top-logo" style="float:left">
|
10 |
-
<?php if (
|
11 |
echo "Revive Old Post PRO";
|
12 |
} else echo "Revive Old Post"; ?>
|
13 |
|
@@ -16,31 +16,10 @@
|
|
16 |
|
17 |
<div class="cwp_top_actions">
|
18 |
<a href="https://twitter.com/intent/tweet?text=Check-out%20this%20awesome%20plugin%20-%20&url=http%3A%2F%2Fthemeisle.com%2Fplugins%2Ftweet-old-post-lite%2F&via=themeisle" class="tweet-about-it"><span></span> <?php _e("Show your love", CWP_TEXTDOMAIN); ?></a>
|
19 |
-
<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/tweet-old-post#postform" class="leave-a-review"><span></span> <?php _e("Leave A Review", CWP_TEXTDOMAIN); ?></a>
|
20 |
</div><!-- end .cwp_top_actions -->
|
21 |
</header><!-- end .cwp_top_header -->
|
22 |
|
23 |
<section class="cwp_top_container clearfix">
|
24 |
|
25 |
|
26 |
-
<div class="cwp_top_status">
|
27 |
-
|
28 |
-
<?php if($twp_obj->pluginStatus == 'true') { ?>
|
29 |
-
<p class='active'>
|
30 |
-
<?php _e("Revive Old Post is set to share on a", CWP_TEXTDOMAIN); ?>
|
31 |
-
<span class='tweetInterval'> <?php echo $twp_obj->intervalSet; ?></span>
|
32 |
-
<?php _e("hours interval, ", CWP_TEXTDOMAIN); ?>
|
33 |
-
<?php _e("and the next share will take place in: ", CWP_TEXTDOMAIN); ?>
|
34 |
-
<span class='nextTweet'><?php $twp_obj->getNextTweetInterval(); update_option('cwp_topnew_notice', ""); ?></span>
|
35 |
-
</p>
|
36 |
-
<?php } else { ?>
|
37 |
-
<p class='inactive'>
|
38 |
-
<?php _e("Revive Old Post is not set to share!", CWP_TEXTDOMAIN); ?>
|
39 |
-
</p>
|
40 |
-
<?php } ?>
|
41 |
-
<p class='inactive'>
|
42 |
-
<?php _e("You have selected following POST IDs to be excluded from tweeting: <span id='excludeList' style='font-weight:bold;font-style:italic;'></span>.
|
43 |
-
Note: If you have made any change and dint hit 'Exclude Selected' button changes will not be saved. ", CWP_TEXTDOMAIN); ?>
|
44 |
-
</p>
|
45 |
-
|
46 |
-
</div><!-- end .cwp_top_status -->
|
7 |
|
8 |
<header id="cwp_top_header" class='clearfix'>
|
9 |
<h1 class="top-logo" style="float:left">
|
10 |
+
<?php if (CWP_TOP_PRO) {
|
11 |
echo "Revive Old Post PRO";
|
12 |
} else echo "Revive Old Post"; ?>
|
13 |
|
16 |
|
17 |
<div class="cwp_top_actions">
|
18 |
<a href="https://twitter.com/intent/tweet?text=Check-out%20this%20awesome%20plugin%20-%20&url=http%3A%2F%2Fthemeisle.com%2Fplugins%2Ftweet-old-post-lite%2F&via=themeisle" class="tweet-about-it"><span></span> <?php _e("Show your love", CWP_TEXTDOMAIN); ?></a>
|
19 |
+
<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/tweet-old-post#postform" class="leave-a-review"><span></span> <?php _e("Leave A Review", CWP_TEXTDOMAIN); ?></a>
|
20 |
</div><!-- end .cwp_top_actions -->
|
21 |
</header><!-- end .cwp_top_header -->
|
22 |
|
23 |
<section class="cwp_top_container clearfix">
|
24 |
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/view-postformat.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
global $cwp_top_networks;
|
3 |
+
global $cwp_global_schedule;
|
4 |
+
?><div class="cwp_top_tabs_vertical">
|
5 |
+
<ul class="cwp_top_tabs_btns">
|
6 |
+
<?php $first = true; foreach($cwp_top_networks as $network_name=>$network_details) { ?>
|
7 |
+
<li <?php if($first){ ?>class="active" <?php }else{
|
8 |
+
|
9 |
+
if($network_name == 'linkedin' && !CWP_TOP_PRO) echo 'class="pro-version"';
|
10 |
+
|
11 |
+
} ?> <?php ?>><?php echo $network_name; ?></li>
|
12 |
+
|
13 |
+
<?php $first = false; } ?>
|
14 |
+
|
15 |
+
</ul>
|
16 |
+
|
17 |
+
<?php $first = true; foreach($cwp_top_networks as $network_name=>$network_details) { ?>
|
18 |
+
|
19 |
+
<div class="tab-vertical <?php if($first){ ?> active <?php } ?>">
|
20 |
+
|
21 |
+
<?php foreach ($network_details as $key=>$field) {
|
22 |
+
$field['option'] = $network_name."_".$field['option'];
|
23 |
+
?>
|
24 |
+
<fieldset class="option twp<?php echo $key; ?>" <?php if(isset($field['dependency'])) { ?> data-dependent='<?php echo json_encode($field['dependency']); ?>' <?php } ?>>
|
25 |
+
<div class="left">
|
26 |
+
<label for="<?php echo $field['option']; ?>"> <?php _e( $field['name'], CWP_TEXTDOMAIN ); ?> </label>
|
27 |
+
<span class="description"> <?php _e( $field['description'], CWP_TEXTDOMAIN ); ?> <?php if($field['type'] == 'number'):
|
28 |
+
?>(<?php _e("Max",CWP_TEXTDOMAIN); ?>: <?php echo $field['max-length']; ?>)<?php
|
29 |
+
endif;?> </span>
|
30 |
+
|
31 |
+
<?php if($field['type'] == 'categories-list') { ?>
|
32 |
+
<button class='select-all'><?php _e( "Select All", CWP_TEXTDOMAIN );?></button>
|
33 |
+
<?php } ?>
|
34 |
+
|
35 |
+
</div><!-- end .left -->
|
36 |
+
<div class="right">
|
37 |
+
<?php CWP_TOP_Core::generateFieldType( $field ); ?>
|
38 |
+
</div><!-- end .right -->
|
39 |
+
</fieldset><!-- end .option -->
|
40 |
+
<?php } ?>
|
41 |
+
</div>
|
42 |
+
<?php $first = false; } ?>
|
43 |
+
|
44 |
+
|
45 |
+
</div>
|
inc/view-postschedule.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
global $cwp_top_networks;
|
3 |
+
global $cwp_top_global_schedule;
|
4 |
+
?><div class="cwp_top_tabs_vertical">
|
5 |
+
<ul class="cwp_top_tabs_btns">
|
6 |
+
<?php $first = true; foreach($cwp_top_networks as $network_name=>$network_details) { ?>
|
7 |
+
<li <?php if($first){ ?>class="active" <?php } ?> <?php ?>><?php echo $network_name; ?></li>
|
8 |
+
<?php $first = false; } ?>
|
9 |
+
|
10 |
+
</ul>
|
11 |
+
|
12 |
+
<?php $first = true; foreach($cwp_top_networks as $network_name=>$network_details) { ?>
|
13 |
+
|
14 |
+
<div class="tab-vertical <?php if($first){ ?> active <?php } ?>" data-network="<?php echo $network_name; ?>">
|
15 |
+
<input type="hidden" value="<?php echo @$cwp_top_global_schedule[$network_name.'_schedule_type_selected'];?>" id="<?php echo $network_name.'_schedule_type_selected' ?>" name="<?php echo $network_name.'_schedule_type_selected' ?>" />
|
16 |
+
<input type="hidden" value="<?php echo isset($cwp_top_global_schedule[$network_name.'_top_opt_interval']['days']) ? $cwp_top_global_schedule[$network_name.'_top_opt_interval']['days'] : '1,2,3,4,5,6,7'; ?>" id="<?php echo $network_name.'_top_schedule_days' ?>" name="<?php echo $network_name.'_top_schedule_days'; ?>" />
|
17 |
+
<div class="cwp-according-item cwp-populate-hidden-radio <?php if( $cwp_top_global_schedule[$network_name.'_schedule_type_selected'] == 'each'): ?> active <?php endif; ?>" data-hidden="<?php echo $network_name.'_schedule_type_selected' ?>" data-value="each" >
|
18 |
+
<div class="cwp-according-header cwp-populate-hidden-radio" data-hidden="<?php echo $network_name.'_schedule_type_selected' ?>" data-value="each">
|
19 |
+
<span> <?php _e("Each x hours", CWP_TEXTDOMAIN); ?></span>
|
20 |
+
</div>
|
21 |
+
<div class="cwp-according-body">
|
22 |
+
<fieldset class="option twpinterval" >
|
23 |
+
<div class="left">
|
24 |
+
<label for="<?php echo $network_name;?>_top_opt_interval"> <?php _e( "Interval", CWP_TEXTDOMAIN ); ?> </label>
|
25 |
+
<span class="description"> <?php _e('Minimum time between shares (Hour/Hours), 0.4 can be used also.', CWP_TEXTDOMAIN)?> </span>
|
26 |
+
|
27 |
+
</div><!-- end .left -->
|
28 |
+
<div class="right">
|
29 |
+
|
30 |
+
<?php CWP_TOP_Core::generateFieldType(array(
|
31 |
+
'id' => '14',
|
32 |
+
'name' => __('Minimum interval between shares', CWP_TEXTDOMAIN),
|
33 |
+
'type' => 'text',
|
34 |
+
'slug' => 'interval',
|
35 |
+
'option_value' =>($cwp_top_global_schedule[$network_name.'_schedule_type_selected'] == 'each') ? $cwp_top_global_schedule[$network_name.'_top_opt_interval'] : '8',
|
36 |
+
"available_pro" => "yes",
|
37 |
+
'option' => $network_name.'_top_opt_interval',
|
38 |
+
'description' => __('Minimum time between shares (Hour/Hours), 0.4 can be used also.', CWP_TEXTDOMAIN),
|
39 |
+
'options' => array()
|
40 |
+
)); ?>
|
41 |
+
</div><!-- end .right -->
|
42 |
+
</fieldset><!-- end .option -->
|
43 |
+
|
44 |
+
</div>
|
45 |
+
|
46 |
+
</div>
|
47 |
+
<div class="cwp-according-item <?php if( $cwp_top_global_schedule[$network_name.'_schedule_type_selected'] == 'custom'): ?> active <?php endif; ?>" >
|
48 |
+
<div class="cwp-according-header cwp-populate-hidden-radio" data-hidden="<?php echo $network_name.'_schedule_type_selected' ?>" data-value="custom">
|
49 |
+
|
50 |
+
<span><?php _e("Custom Schedule", CWP_TEXTDOMAIN); ?></span>
|
51 |
+
</div>
|
52 |
+
<div class="cwp-according-body">
|
53 |
+
<div class="cwp-custom-schedule-days">
|
54 |
+
|
55 |
+
<ul class="cwp-schedule-days clearfix cwp-populate-hidden-checkbox-group" data-hidden="<?php echo $network_name.'_top_schedule_days' ?>" >
|
56 |
+
<li class=" cwp-populate-hidden-checkbox" data-value="1"><?php _e("Monday", CWP_TEXTDOMAIN); ?></li>
|
57 |
+
<li class=" cwp-populate-hidden-checkbox" data-value="2"><?php _e("Tuesday", CWP_TEXTDOMAIN); ?></li>
|
58 |
+
<li class=" cwp-populate-hidden-checkbox" data-value="3"><?php _e("Wednesday", CWP_TEXTDOMAIN); ?></li>
|
59 |
+
<li class=" cwp-populate-hidden-checkbox" data-value="4"><?php _e("Thursday", CWP_TEXTDOMAIN); ?></li>
|
60 |
+
<li class=" cwp-populate-hidden-checkbox" data-value="5"><?php _e("Friday", CWP_TEXTDOMAIN); ?></li>
|
61 |
+
<li class=" cwp-populate-hidden-checkbox" data-value="6"><?php _e("Saturday", CWP_TEXTDOMAIN); ?></li>
|
62 |
+
<li class=" cwp-populate-hidden-checkbox" data-value="7"><?php _e("Sunday", CWP_TEXTDOMAIN); ?></li>
|
63 |
+
</ul>
|
64 |
+
<p class="cwp-posts-time-info"><?php _e("Posts this "); ?><b class="cwp-posts-time-info-times"></b> <?php _e(" times every"); ?> <b class="cwp-posts-time-info-days"></b></p>
|
65 |
+
<ul class="cwp-posting-times" data-times='<?php echo isset($cwp_top_global_schedule[$network_name.'_top_opt_interval']['times']) ? json_encode($cwp_top_global_schedule[$network_name.'_top_opt_interval']['times']) : "[]";?>'>
|
66 |
+
|
67 |
+
|
68 |
+
</ul>
|
69 |
+
<P><A href="#" class="cwp-btn cwp-primary cwp-add-posting-time"><?php _e("Add posting time",CWP_TEXTDOMAIN); ?></a></P>
|
70 |
+
</div>
|
71 |
+
<?php
|
72 |
+
if(!CWP_TOP_PRO){
|
73 |
+
echo CWP_TOP_PRO_STRING;
|
74 |
+
}
|
75 |
+
?>
|
76 |
+
</div>
|
77 |
+
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
<?php $first = false; } ?>
|
81 |
+
|
82 |
+
|
83 |
+
</div>
|
84 |
+
|
inc/view.php
CHANGED
@@ -1,293 +1,262 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
<
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
<
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
<
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
</
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
<div class="
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
<
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
<
|
186 |
-
<
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
<div class="
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
<
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
<
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
<
|
252 |
-
<
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
<fieldset class="option twptop_opt_app_id">
|
264 |
-
<div class="left">
|
265 |
-
<label for="top_opt_app_id"><?php _e('Linkedin API Key',CWP_TEXTDOMAIN);?> </label>
|
266 |
-
<span class="description"><?php _e('API Key that you get once you create an app',CWP_TEXTDOMAIN);?> </span>
|
267 |
-
|
268 |
-
|
269 |
-
</div><!-- end .left -->
|
270 |
-
<div class="right">
|
271 |
-
<input type="text" placeholder="1487991504767913" value="<?php get_option('cwp_top_lk_app_id');?>" name="top_opt_app_id" id="top_opt_app_id_lk">
|
272 |
-
</div><!-- end .right -->
|
273 |
-
</fieldset>
|
274 |
-
|
275 |
-
<fieldset class="option twptop_opt_app_secret">
|
276 |
-
<div class="left">
|
277 |
-
<label for="top_opt_app_secret"><?php _e('Linkedin Secret Key',CWP_TEXTDOMAIN);?> </label>
|
278 |
-
<span class="description"><?php _e('Secret Key that you get once you create an app',CWP_TEXTDOMAIN);?> </span>
|
279 |
-
|
280 |
-
|
281 |
-
</div><!-- end .left -->
|
282 |
-
<div class="right">
|
283 |
-
<input type="text" placeholder="5124ea6d46e64da3c306f12812d0e4fx" value="<?php get_option('cwp_top_lk_app_id');?>" name="top_opt_app_secret" id="top_opt_app_secret_lk">
|
284 |
-
</div><!-- end .right -->
|
285 |
-
</fieldset>
|
286 |
-
|
287 |
-
<button class="top_authorize" service="linkedin"><?php _e('Authorize App',CWP_TEXTDOMAIN);?></button>
|
288 |
-
</form>
|
289 |
-
</span><button class="top_close_popup"><?php _e('Close preview',CWP_TEXTDOMAIN);?></button>
|
290 |
-
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
291 |
-
</div><!-- end .cwp_sample_tweet_preview -->
|
292 |
-
|
293 |
-
</div><!-- end .cwp_top_wrapper -->
|
1 |
+
<?php
|
2 |
+
global $cwp_top_networks;
|
3 |
+
$remote_check = get_option("cwp_rop_remote_trigger");
|
4 |
+
if($remote_check === false) $remote_check = "off";
|
5 |
+
?>
|
6 |
+
<div class="cwp_top_wrapper">
|
7 |
+
<!--<div class="announcement clearfix">
|
8 |
+
<h2><?php _e("After 6 months of hard work, we have just released", CWP_TEXTDOMAIN); ?> <b>ThemeIsle</b>, <?php _e("the island of WordPress themes.", CWP_TEXTDOMAIN); ?></h2>
|
9 |
+
<a class="show-me" href="https://themeisle.com/?utm_source=topadmin&utm_medium=announce&utm_campaign=top"><?php _e("Show Me", CWP_TEXTDOMAIN); ?></a>
|
10 |
+
</div> end .announcement -->
|
11 |
+
|
12 |
+
<header id="cwp_top_header" class='clearfix'>
|
13 |
+
<h1 class="top_logo">
|
14 |
+
<?php if (CWP_TOP_PRO) {
|
15 |
+
echo "Revive Old Post PRO";
|
16 |
+
} else echo "Revive Old Post"; ?>
|
17 |
+
|
18 |
+
</h1>
|
19 |
+
<span class="slogan"><?php _e("by", CWP_TEXTDOMAIN); ?> <a href="https://themeisle.com/?utm_source=topadmin&utm_medium=announce&utm_campaign=top">ThemeIsle</a></span>
|
20 |
+
|
21 |
+
<div class="cwp_top_actions">
|
22 |
+
<span class="cwp-remote-check-info">Remote check</span> <a class="on-off-button <?php echo $remote_check; ?>" id="cwp_remote_check"></a>
|
23 |
+
<a href="https://twitter.com/intent/tweet?text=Check-out%20this%20awesome%20plugin%20-%20&url=http%3A%2F%2Fthemeisle.com%2Fplugins%2Ftweet-old-post-lite%2F&via=themeisle" class="tweet-about-it"><span></span> <?php _e("Show your love", CWP_TEXTDOMAIN); ?></a>
|
24 |
+
<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/tweet-old-post#postform" class="leave-a-review"><span></span> <?php _e("Leave A Review", CWP_TEXTDOMAIN); ?></a>
|
25 |
+
</div><!-- end .cwp_top_actions -->
|
26 |
+
</header><!-- end .cwp_top_header -->
|
27 |
+
|
28 |
+
<section class="cwp_top_container clearfix">
|
29 |
+
|
30 |
+
|
31 |
+
<div class="cwp_top_status">
|
32 |
+
|
33 |
+
<?php if($this->pluginStatus != 'true') { ?>
|
34 |
+
<p class='inactive'>
|
35 |
+
<?php _e("Revive Old Post is not set to post!", CWP_TEXTDOMAIN); ?>
|
36 |
+
</p>
|
37 |
+
<?php } ?>
|
38 |
+
<p class='inactive cwp-error-label inactive-rop-error-label'>
|
39 |
+
|
40 |
+
<?php
|
41 |
+
_e("Here you can see errors and notifications if they exist.", CWP_TEXTDOMAIN);
|
42 |
+
|
43 |
+
?>
|
44 |
+
</p>
|
45 |
+
<p class='active-rop-error-label cwp-error-label'>
|
46 |
+
|
47 |
+
</p>
|
48 |
+
|
49 |
+
</div><!-- end .cwp_top_status -->
|
50 |
+
<div id="cwp-top-container-form" class="clearfix">
|
51 |
+
<div id="cwp_top_tabs" class="clearfix">
|
52 |
+
<ul id="tabs_menu">
|
53 |
+
<li class="active" > <?php _e('Accounts',CWP_TEXTDOMAIN); ?> </li>
|
54 |
+
<li > <?php _e('General settings',CWP_TEXTDOMAIN); ?> </li>
|
55 |
+
<li ><?php _e('Post Format',CWP_TEXTDOMAIN); ?></li>
|
56 |
+
<li <?php if(!CWP_TOP_PRO): ?> class="pro-version" <?php endif; ?>><?php _e('Custom Schedule',CWP_TEXTDOMAIN); ?></li>
|
57 |
+
<li class="rop-error-log"><span class="no-error"> </span></span><?php _e('Log',CWP_TEXTDOMAIN); ?></li>
|
58 |
+
|
59 |
+
</ul>
|
60 |
+
|
61 |
+
<form action="" method="post" id="cwp_top_form" class="clearfix">
|
62 |
+
|
63 |
+
|
64 |
+
<div class="tab active"><?php require_once(ROPPLUGINPATH."/inc/view-accounts.php"); ?></div>
|
65 |
+
<div class="tab">
|
66 |
+
|
67 |
+
|
68 |
+
<?php foreach ($cwp_top_fields as $field) {
|
69 |
+
|
70 |
+
if(CWP_TOP_PRO){
|
71 |
+
if(isset($field['available_pro'])){
|
72 |
+
if($field['available_pro'] == 'no')
|
73 |
+
continue ;
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
?>
|
80 |
+
|
81 |
+
<fieldset class="option twp<?php echo $field['option']; ?>" >
|
82 |
+
<div class="left">
|
83 |
+
<label for="<?php echo $field['option']; ?>"> <?php _e($field['name'],CWP_TEXTDOMAIN); ?> </label>
|
84 |
+
<span class="description"> <?php _e($field['description'],CWP_TEXTDOMAIN); ?> </span>
|
85 |
+
|
86 |
+
<?php if($field['type'] == 'categories-list') { ?>
|
87 |
+
<button class='select-all'><?php _e("Select All",CWP_TEXTDOMAIN);?></button>
|
88 |
+
<?php } ?>
|
89 |
+
|
90 |
+
</div><!-- end .left -->
|
91 |
+
<div class="right">
|
92 |
+
<?php CWP_TOP_Core::generateFieldType( $field ); ?>
|
93 |
+
</div><!-- end .right -->
|
94 |
+
</fieldset><!-- end .option -->
|
95 |
+
<?php } ?>
|
96 |
+
|
97 |
+
|
98 |
+
</div>
|
99 |
+
|
100 |
+
<div class="tab"><?php require_once(ROPPLUGINPATH."/inc/view-postformat.php"); ?></div>
|
101 |
+
<div class="tab"><?php require_once(ROPPLUGINPATH."/inc/view-postschedule.php"); ?></div>
|
102 |
+
<div class="tab clearfix">
|
103 |
+
<div class="rop-log-container clearfix">
|
104 |
+
|
105 |
+
<a href="#" id="rop-clear-log"><?php _e('Clear Log',CWP_TEXTDOMAIN); ?></a>
|
106 |
+
<ul id="rop-log-list">
|
107 |
+
|
108 |
+
|
109 |
+
</ul>
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<!-- end #cwp_top_form -->
|
113 |
+
</div><div class="cwp_top_footer">
|
114 |
+
<a class="reset-settings" id="reset-settings" href="#"><span></span> <?php _e("Reset", CWP_TEXTDOMAIN); ?></a>
|
115 |
+
<a class="update-options" id="update-options"href="#"><span></span><?php _e("Save", CWP_TEXTDOMAIN); ?></a>
|
116 |
+
<?php if($this->pluginStatus != 'true' ): ?>
|
117 |
+
|
118 |
+
<a class="tweet-now" id="tweet-now" href="#"><span></span> <?php _e("Start Sharing", CWP_TEXTDOMAIN); ?></a>
|
119 |
+
<?php else: ?>
|
120 |
+
|
121 |
+
<a class="stop-tweet-old-post" id="stop-tweet-old-post" href="#"><span></span> <?php _e("Stop Sharing", CWP_TEXTDOMAIN); ?></a>
|
122 |
+
|
123 |
+
<?php endif; ?>
|
124 |
+
<a class="see-sample-tweet" id="see-sample-tweet" href="#"><span></span> <?php _e("See Sample Post", CWP_TEXTDOMAIN); ?></a>
|
125 |
+
</div><!-- end .cwp_top_footer -->
|
126 |
+
<p><?php _e("We are not affiliated or partner with Twitter/Facebook/Linkedin in any way.", CWP_TEXTDOMAIN); ?></p>
|
127 |
+
</form></div>
|
128 |
+
<aside class="sidebar">
|
129 |
+
<ul>
|
130 |
+
<li class="rop-twitter-clock" data-current="<?php echo $this->getTime(); ?>"><?php echo __("Now is: ",CWP_TEXTDOMAIN)." <b> </b> " ?></li>
|
131 |
+
<?php
|
132 |
+
if($this->pluginStatus == 'true' ): ?>
|
133 |
+
<?php
|
134 |
+
foreach($cwp_top_networks as $nn=>$nd) {
|
135 |
+
if(wp_next_scheduled($nn.'roptweetcron',array($nn)) === false) continue;
|
136 |
+
?>
|
137 |
+
<li class="rop-twitter-countdown rop-network-countdown"><?php echo __("Revive Old Post will post on",CWP_TEXTDOMAIN)." <span class='rop-network-name'>".$nn."</span> ".__("in the next",CWP_TEXTDOMAIN); ?>: <span data-timestamp="<?php echo wp_next_scheduled($nn.'roptweetcron',array($nn)) ; ?>" class='rop-network-timestamp'></span></li>
|
138 |
+
<?php } ?>
|
139 |
+
|
140 |
+
<?php endif; ?>
|
141 |
+
<li class="upgrade"><a target="_blank" href="https://themeisle.com/plugins/tweet-old-post-pro/?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!", CWP_TEXTDOMAIN); ?></a></li>
|
142 |
+
<li class="sib"><a target="_blank" href="https://www.sendinblue.com/?utm_source=rop&utm_medium=display&utm_campaign=iplugins&utm_content=free"> <?php _e("ThemeIsle - Deadly Simple WordPress Themes", CWP_TEXTDOMAIN); ?></a></li>
|
143 |
+
<li class="affiliate-readythemes"><a target="_blank" href="https://themeisle.com/contact/?utm_source=bannerright&utm_medium=announce&utm_campaign=top"> <?php _e("ThemeIsle - Promote Our Themes and Plugins and get 55% Comission", CWP_TEXTDOMAIN); ?></a></li>
|
144 |
+
</ul>
|
145 |
+
</aside><!-- end .sidebar -->
|
146 |
+
</section><!-- end .cwp_top_container -->
|
147 |
+
|
148 |
+
<div class="cwp_sample_tweet_preview">
|
149 |
+
<div class="cwp_sample_tweet_preview_inner">
|
150 |
+
<h2><?php _e('Sample Post Preview',CWP_TEXTDOMAIN);?> Twitter</h2>
|
151 |
+
<span class="sample_tweet sample_tweet_twitter"></span>
|
152 |
+
<h2><?php _e('Sample Post Preview',CWP_TEXTDOMAIN);?> Facebook</h2>
|
153 |
+
<span class="sample_tweet sample_tweet_facebook"></span>
|
154 |
+
<h2><?php _e('Sample Post Preview',CWP_TEXTDOMAIN);?> LinkedIn</h2>
|
155 |
+
<span class="sample_tweet sample_tweet_linkedin"></span>
|
156 |
+
<button class="top_close_popup"><?php _e('Close preview',CWP_TEXTDOMAIN);?></button>
|
157 |
+
<button class="tweetitnow"><?php _e('Share now',CWP_TEXTDOMAIN);?></button>
|
158 |
+
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
159 |
+
</div><!-- end .cwp_sample_tweet_preview -->
|
160 |
+
|
161 |
+
<div class="cwp_user_pages">
|
162 |
+
<div class="cwp_sample_tweet_preview_inner">
|
163 |
+
<h2><?php _e('Choose a Profile or Page',CWP_TEXTDOMAIN);?></h2>
|
164 |
+
<div class="cwp_user_pages_inner"></div>
|
165 |
+
<button class="top_close_popup"><?php _e('Close preview',CWP_TEXTDOMAIN);?></button>
|
166 |
+
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
167 |
+
</div><!-- end .cwp_sample_tweet_preview -->
|
168 |
+
|
169 |
+
<div class="cwp_fbapp_preview">
|
170 |
+
<div class="cwp_sample_tweet_preview_inner top_auth_inner">
|
171 |
+
<h2><?php _e('Add Your Facebook Account Following The Instructions On The Left',CWP_TEXTDOMAIN);?></h2>
|
172 |
+
<span class="sample_tweet top_sample_auth">
|
173 |
+
<div class="top_left_instructions">
|
174 |
+
<ol>
|
175 |
+
<li><?php _e('Go on',CWP_TEXTDOMAIN);?> <a href="https://developers.facebook.com/apps/" target="_blank">developers.facebook.com/apps</a></li>
|
176 |
+
<li><?php _e('Click on <strong>Create New App</strong> from the top right corner',CWP_TEXTDOMAIN);?> </li>
|
177 |
+
<li><?php _e('Enter a <strong>Display Name</strong> and <strong>Namespace</strong> and click on Create App',CWP_TEXTDOMAIN);?> </li>
|
178 |
+
<li><?php _e('Once you arrive on the app dashboard, copy your <strong>App ID</strong> and <strong>App Secret</strong> in the fields on the right',CWP_TEXTDOMAIN);?> </li>
|
179 |
+
<li><?php _e('Go on Settings tab from the left sidebar menu add the contact email and click on <strong>Add Platform</strong> and select <strong>Website</strong>',CWP_TEXTDOMAIN);?> </li>
|
180 |
+
<li><?php printf(__('Copy/Paste this url : <strong>%s</strong> into App Domains and Site URL fields and <strong>Save</strong>',CWP_TEXTDOMAIN),top_settings_url());?> </li>
|
181 |
+
<li><?php _e('Go on Status & Review tab and set your app live from the top-right switch.',CWP_TEXTDOMAIN);?> </li>
|
182 |
+
<li><?php _e('Now everything is done, click on <strong>Authorize App</strong> button.',CWP_TEXTDOMAIN);?> </li>
|
183 |
+
</ol>
|
184 |
+
</div>
|
185 |
+
<form action="" method="post" id="cwp_top_form" class=" top_auth_form">
|
186 |
+
<fieldset class="option twptop_opt_app_id">
|
187 |
+
<div class="left">
|
188 |
+
<label for="top_opt_app_id"><?php _e('Facebook App ID',CWP_TEXTDOMAIN);?> </label>
|
189 |
+
<span class="description"><?php _e('ID from your app created on facebook website.',CWP_TEXTDOMAIN);?> </span>
|
190 |
+
|
191 |
+
|
192 |
+
</div><!-- end .left -->
|
193 |
+
<div class="right">
|
194 |
+
<input type="text" placeholder="1487991504767913" value="<?php get_option('cwp_top_app_id');?>" name="top_opt_app_id" id="top_opt_app_id">
|
195 |
+
</div><!-- end .right -->
|
196 |
+
</fieldset>
|
197 |
+
|
198 |
+
<fieldset class="option twptop_opt_app_secret">
|
199 |
+
<div class="left">
|
200 |
+
<label for="top_opt_app_secret"><?php _e('Facebook App Secret',CWP_TEXTDOMAIN);?> </label>
|
201 |
+
<span class="description"><?php _e('Secret from your app created on facebook website. ',CWP_TEXTDOMAIN);?> </span>
|
202 |
+
|
203 |
+
</div><!-- end .left -->
|
204 |
+
<div class="right">
|
205 |
+
<input type="text" placeholder="5124ea6d46e64da3c306f12812d0e4fx" value="<?php get_option('cwp_top_app_secret');?>" name="top_opt_app_secret" id="top_opt_app_secret">
|
206 |
+
</div><!-- end .right -->
|
207 |
+
</fieldset>
|
208 |
+
|
209 |
+
<button class="top_authorize" service="facebook"><?php _e('Authorize App',CWP_TEXTDOMAIN);?></button>
|
210 |
+
</form>
|
211 |
+
</span><button class="top_close_popup"><?php _e('Close preview',CWP_TEXTDOMAIN);?></button>
|
212 |
+
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
213 |
+
</div><!-- end .cwp_sample_tweet_preview -->
|
214 |
+
|
215 |
+
<div class="cwp_lkapp_preview">
|
216 |
+
<div class="cwp_sample_tweet_preview_inner top_auth_inner">
|
217 |
+
<h2><?php _e('Add Your Linkedin Account Following The Instructions On The Left',CWP_TEXTDOMAIN);?></h2>
|
218 |
+
<span class="sample_tweet top_sample_auth">
|
219 |
+
<div class="top_left_instructions">
|
220 |
+
<ol>
|
221 |
+
<li><?php _e('Go on',CWP_TEXTDOMAIN);?> <a href="https://www.linkedin.com/secure/developer?newapp=" target="_blank">linkedin.com/secure/developer?newapp=</a></li>
|
222 |
+
<li><?php _e('Enter the required details and pay special attention to the further fields :',CWP_TEXTDOMAIN);?></li>
|
223 |
+
<li><?php _e('Make sure you set Live Status to LIVE',CWP_TEXTDOMAIN);?> </li>
|
224 |
+
<li><?php _e('Default Scope should have r_basicprofile and rw_nus checked',CWP_TEXTDOMAIN);?></li>
|
225 |
+
<li><?php printf(__('Copy/Paste this url : <strong>%s</strong> into OAuth 2.0 Redirect URLs field and <strong>Save</strong>',CWP_TEXTDOMAIN),top_settings_url());?> </li>
|
226 |
+
<li><?php _e('Once all required fields are filled click on Add Application button, get the API Key and Secret Key and paste them in the fields on the right',CWP_TEXTDOMAIN);?></li>
|
227 |
+
|
228 |
+
<li><?php _e('Now everything is done, click on <strong>Authorize App</strong> button.',CWP_TEXTDOMAIN);?></li>
|
229 |
+
</ol>
|
230 |
+
</div>
|
231 |
+
<form action="" method="post" id="cwp_top_form" class=" top_auth_form">
|
232 |
+
<fieldset class="option twptop_opt_app_id">
|
233 |
+
<div class="left">
|
234 |
+
<label for="top_opt_app_id"><?php _e('Linkedin API Key',CWP_TEXTDOMAIN);?> </label>
|
235 |
+
<span class="description"><?php _e('API Key that you get once you create an app',CWP_TEXTDOMAIN);?> </span>
|
236 |
+
|
237 |
+
|
238 |
+
</div><!-- end .left -->
|
239 |
+
<div class="right">
|
240 |
+
<input type="text" placeholder="1487991504767913" value="<?php get_option('cwp_top_lk_app_id');?>" name="top_opt_app_id" id="top_opt_app_id_lk">
|
241 |
+
</div><!-- end .right -->
|
242 |
+
</fieldset>
|
243 |
+
|
244 |
+
<fieldset class="option twptop_opt_app_secret">
|
245 |
+
<div class="left">
|
246 |
+
<label for="top_opt_app_secret"><?php _e('Linkedin Secret Key',CWP_TEXTDOMAIN);?> </label>
|
247 |
+
<span class="description"><?php _e('Secret Key that you get once you create an app',CWP_TEXTDOMAIN);?> </span>
|
248 |
+
|
249 |
+
|
250 |
+
</div><!-- end .left -->
|
251 |
+
<div class="right">
|
252 |
+
<input type="text" placeholder="5124ea6d46e64da3c306f12812d0e4fx" value="<?php get_option('cwp_top_lk_app_id');?>" name="top_opt_app_secret" id="top_opt_app_secret_lk">
|
253 |
+
</div><!-- end .right -->
|
254 |
+
</fieldset>
|
255 |
+
|
256 |
+
<button class="top_authorize" service="linkedin"><?php _e('Authorize App',CWP_TEXTDOMAIN);?></button>
|
257 |
+
</form>
|
258 |
+
</span><button class="top_close_popup"><?php _e('Close preview',CWP_TEXTDOMAIN);?></button>
|
259 |
+
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
260 |
+
</div><!-- end .cwp_sample_tweet_preview -->
|
261 |
+
|
262 |
+
</div><!-- end .cwp_top_wrapper -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/countdown.js
CHANGED
@@ -18,11 +18,11 @@ var timenow="";
|
|
18 |
_this.render();
|
19 |
return _this;
|
20 |
};
|
21 |
-
|
22 |
getDateData = function(endDate) {
|
23 |
var dateData, diff;
|
24 |
jQuery.ajax({
|
25 |
-
type: "POST",
|
26 |
url: cwp_top_ajaxload.ajaxurl,
|
27 |
data: {
|
28 |
action: "gettime_action"
|
@@ -39,10 +39,10 @@ var timenow="";
|
|
39 |
//var timenow = new Date( d1.getUTCFullYear(), d1.getUTCMonth(), d1.getUTCDate(), d1.getUTCHours(), d1.getUTCMinutes(), d1.getUTCSeconds() );
|
40 |
//endDate = Date.parse($.isPlainObject(_this.options.date) ? _this.options.date : new Date(_this.options.date));
|
41 |
endDate = _this.options.date;
|
42 |
-
|
43 |
-
if (timenow == '')
|
44 |
timenow = _this.options.date-20;
|
45 |
-
|
46 |
diff = endDate - timenow;
|
47 |
//diff = Math.floor(diff);
|
48 |
if (diff <= 0) {
|
@@ -145,3 +145,254 @@ var timenow="";
|
|
145 |
})(jQuery);
|
146 |
|
147 |
}).call(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
_this.render();
|
19 |
return _this;
|
20 |
};
|
21 |
+
|
22 |
getDateData = function(endDate) {
|
23 |
var dateData, diff;
|
24 |
jQuery.ajax({
|
25 |
+
type: "POST",
|
26 |
url: cwp_top_ajaxload.ajaxurl,
|
27 |
data: {
|
28 |
action: "gettime_action"
|
39 |
//var timenow = new Date( d1.getUTCFullYear(), d1.getUTCMonth(), d1.getUTCDate(), d1.getUTCHours(), d1.getUTCMinutes(), d1.getUTCSeconds() );
|
40 |
//endDate = Date.parse($.isPlainObject(_this.options.date) ? _this.options.date : new Date(_this.options.date));
|
41 |
endDate = _this.options.date;
|
42 |
+
|
43 |
+
if (timenow == '')
|
44 |
timenow = _this.options.date-20;
|
45 |
+
|
46 |
diff = endDate - timenow;
|
47 |
//diff = Math.floor(diff);
|
48 |
if (diff <= 0) {
|
145 |
})(jQuery);
|
146 |
|
147 |
}).call(this);
|
148 |
+
|
149 |
+
|
150 |
+
;(function(factory) {
|
151 |
+
'use strict';
|
152 |
+
|
153 |
+
if (typeof define === 'function' && define.amd) {
|
154 |
+
define(['jquery'], factory);
|
155 |
+
} else {
|
156 |
+
factory(jQuery);
|
157 |
+
}
|
158 |
+
})(function($){
|
159 |
+
'use strict';
|
160 |
+
|
161 |
+
var PRECISION = 100; // 0.1 seconds, used to update the DOM
|
162 |
+
var instances = [],
|
163 |
+
matchers = [];
|
164 |
+
// Miliseconds
|
165 |
+
matchers.push(/^[0-9]*$/.source);
|
166 |
+
// Month/Day/Year [hours:minutes:seconds]
|
167 |
+
matchers.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/
|
168 |
+
.source);
|
169 |
+
// Year/Day/Month [hours:minutes:seconds] and
|
170 |
+
// Year-Day-Month [hours:minutes:seconds]
|
171 |
+
matchers.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/
|
172 |
+
.source);
|
173 |
+
// Cast the matchers to a regular expression object
|
174 |
+
matchers = new RegExp(matchers.join('|'));
|
175 |
+
// Parse a Date formatted has String to a native object
|
176 |
+
function parseDateString(dateString) {
|
177 |
+
// Pass through when a native object is sent
|
178 |
+
if(dateString instanceof Date) {
|
179 |
+
return dateString;
|
180 |
+
}
|
181 |
+
// Caste string to date object
|
182 |
+
if(String(dateString).match(matchers)) {
|
183 |
+
// If looks like a milisecond value cast to number before
|
184 |
+
// final casting (Thanks to @msigley)
|
185 |
+
if(String(dateString).match(/^[0-9]*$/)) {
|
186 |
+
dateString = Number(dateString);
|
187 |
+
}
|
188 |
+
// Replace dashes to slashes
|
189 |
+
if(String(dateString).match(/\-/)) {
|
190 |
+
dateString = String(dateString).replace(/\-/g, '/');
|
191 |
+
}
|
192 |
+
return new Date(dateString);
|
193 |
+
} else {
|
194 |
+
throw new Error('Couldn\'t cast `' + dateString +
|
195 |
+
'` to a date object.');
|
196 |
+
}
|
197 |
+
}
|
198 |
+
// Map to convert from a directive to offset object property
|
199 |
+
var DIRECTIVE_KEY_MAP = {
|
200 |
+
'Y': 'years',
|
201 |
+
'm': 'months',
|
202 |
+
'w': 'weeks',
|
203 |
+
'd': 'days',
|
204 |
+
'D': 'totalDays',
|
205 |
+
'H': 'hours',
|
206 |
+
'M': 'minutes',
|
207 |
+
'S': 'seconds'
|
208 |
+
};
|
209 |
+
// Returns an escaped regexp from the string
|
210 |
+
function escapedRegExp(str) {
|
211 |
+
var sanitize = str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
|
212 |
+
return new RegExp(sanitize);
|
213 |
+
}
|
214 |
+
// Time string formatter
|
215 |
+
function strftime(offsetObject) {
|
216 |
+
return function(format) {
|
217 |
+
var directives = format.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);
|
218 |
+
if(directives) {
|
219 |
+
for(var i = 0, len = directives.length; i < len; ++i) {
|
220 |
+
var directive = directives[i]
|
221 |
+
.match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),
|
222 |
+
regexp = escapedRegExp(directive[0]),
|
223 |
+
modifier = directive[1] || '',
|
224 |
+
plural = directive[3] || '',
|
225 |
+
value = null;
|
226 |
+
// Get the key
|
227 |
+
directive = directive[2];
|
228 |
+
// Swap shot-versions directives
|
229 |
+
if(DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) {
|
230 |
+
value = DIRECTIVE_KEY_MAP[directive];
|
231 |
+
value = Number(offsetObject[value]);
|
232 |
+
}
|
233 |
+
if(value !== null) {
|
234 |
+
// Pluralize
|
235 |
+
if(modifier === '!') {
|
236 |
+
value = pluralize(plural, value);
|
237 |
+
}
|
238 |
+
// Add zero-padding
|
239 |
+
if(modifier === '') {
|
240 |
+
if(value < 10) {
|
241 |
+
value = '0' + value.toString();
|
242 |
+
}
|
243 |
+
}
|
244 |
+
// Replace the directive
|
245 |
+
format = format.replace(regexp, value.toString());
|
246 |
+
}
|
247 |
+
}
|
248 |
+
}
|
249 |
+
format = format.replace(/%%/, '%');
|
250 |
+
return format;
|
251 |
+
};
|
252 |
+
}
|
253 |
+
// Pluralize
|
254 |
+
function pluralize(format, count) {
|
255 |
+
var plural = 's', singular = '';
|
256 |
+
if(format) {
|
257 |
+
format = format.replace(/(:|;|\s)/gi, '').split(/\,/);
|
258 |
+
if(format.length === 1) {
|
259 |
+
plural = format[0];
|
260 |
+
} else {
|
261 |
+
singular = format[0];
|
262 |
+
plural = format[1];
|
263 |
+
}
|
264 |
+
}
|
265 |
+
if(Math.abs(count) === 1) {
|
266 |
+
return singular;
|
267 |
+
} else {
|
268 |
+
return plural;
|
269 |
+
}
|
270 |
+
}
|
271 |
+
// The Final Countdown
|
272 |
+
var Countdown = function(el, finalDate, callback) {
|
273 |
+
this.el = el;
|
274 |
+
this.$el = $(el);
|
275 |
+
this.interval = null;
|
276 |
+
this.offset = {};
|
277 |
+
// Register this instance
|
278 |
+
this.instanceNumber = instances.length;
|
279 |
+
instances.push(this);
|
280 |
+
// Save the reference
|
281 |
+
this.$el.data('countdown-instance', this.instanceNumber);
|
282 |
+
// Register the callbacks when supplied
|
283 |
+
if(callback) {
|
284 |
+
this.$el.on('update.countdown', callback);
|
285 |
+
this.$el.on('stoped.countdown', callback);
|
286 |
+
this.$el.on('finish.countdown', callback);
|
287 |
+
}
|
288 |
+
// Set the final date and start
|
289 |
+
this.setFinalDate(finalDate);
|
290 |
+
this.start();
|
291 |
+
};
|
292 |
+
$.extend(Countdown.prototype, {
|
293 |
+
start: function() {
|
294 |
+
if(this.interval !== null) {
|
295 |
+
clearInterval(this.interval);
|
296 |
+
}
|
297 |
+
var self = this;
|
298 |
+
this.update();
|
299 |
+
this.interval = setInterval(function() {
|
300 |
+
self.update.call(self);
|
301 |
+
}, PRECISION);
|
302 |
+
},
|
303 |
+
stop: function() {
|
304 |
+
clearInterval(this.interval);
|
305 |
+
this.interval = null;
|
306 |
+
this.dispatchEvent('stoped');
|
307 |
+
},
|
308 |
+
toggle: function() {
|
309 |
+
if (this.interval) {
|
310 |
+
this.stop();
|
311 |
+
} else {
|
312 |
+
this.start();
|
313 |
+
}
|
314 |
+
},
|
315 |
+
pause: function() {
|
316 |
+
this.stop();
|
317 |
+
},
|
318 |
+
resume: function() {
|
319 |
+
this.start();
|
320 |
+
},
|
321 |
+
remove: function() {
|
322 |
+
this.stop.call(this);
|
323 |
+
instances[this.instanceNumber] = null;
|
324 |
+
// Reset the countdown instance under data attr (Thanks to @assiotis)
|
325 |
+
delete this.$el.data().countdownInstance;
|
326 |
+
},
|
327 |
+
setFinalDate: function(value) {
|
328 |
+
this.finalDate = parseDateString(value); // Cast the given date
|
329 |
+
},
|
330 |
+
update: function() {
|
331 |
+
// Stop if dom is not in the html (Thanks to @dleavitt)
|
332 |
+
if(this.$el.closest('html').length === 0) {
|
333 |
+
this.remove();
|
334 |
+
return;
|
335 |
+
}
|
336 |
+
// Calculate the remaining time
|
337 |
+
this.totalSecsLeft = this.finalDate.getTime() -
|
338 |
+
new Date().getTime(); // In miliseconds
|
339 |
+
this.totalSecsLeft = Math.ceil(this.totalSecsLeft / 1000);
|
340 |
+
this.totalSecsLeft = this.totalSecsLeft < 0 ? 0 : this.totalSecsLeft;
|
341 |
+
// Calculate the offsets
|
342 |
+
this.offset = {
|
343 |
+
seconds : this.totalSecsLeft % 60,
|
344 |
+
minutes : Math.floor(this.totalSecsLeft / 60) % 60,
|
345 |
+
hours : Math.floor(this.totalSecsLeft / 60 / 60) % 24,
|
346 |
+
days : Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
|
347 |
+
totalDays : Math.floor(this.totalSecsLeft / 60 / 60 / 24),
|
348 |
+
weeks : Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7),
|
349 |
+
months : Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 30),
|
350 |
+
years : Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 365)
|
351 |
+
};
|
352 |
+
// Dispatch an event
|
353 |
+
if(this.totalSecsLeft === 0) {
|
354 |
+
this.stop();
|
355 |
+
this.dispatchEvent('finish');
|
356 |
+
} else {
|
357 |
+
this.dispatchEvent('update');
|
358 |
+
}
|
359 |
+
},
|
360 |
+
dispatchEvent: function(eventName) {
|
361 |
+
var event = $.Event(eventName + '.countdown');
|
362 |
+
event.finalDate = this.finalDate;
|
363 |
+
event.offset = $.extend({}, this.offset);
|
364 |
+
event.strftime = strftime(this.offset);
|
365 |
+
this.$el.trigger(event);
|
366 |
+
}
|
367 |
+
});
|
368 |
+
// Register the jQuery selector actions
|
369 |
+
$.fn.countdownPlugin = function() {
|
370 |
+
var argumentsArray = Array.prototype.slice.call(arguments, 0);
|
371 |
+
return this.each(function() {
|
372 |
+
// If no data was set, jQuery.data returns undefined
|
373 |
+
var instanceNumber = $(this).data('countdown-instance');
|
374 |
+
// Verify if we already have a countdown for this node ...
|
375 |
+
// Fix issue #22 (Thanks to @romanbsd)
|
376 |
+
if (instanceNumber !== undefined) {
|
377 |
+
var instance = instances[instanceNumber],
|
378 |
+
method = argumentsArray[0];
|
379 |
+
// If method exists in the prototype execute
|
380 |
+
if(Countdown.prototype.hasOwnProperty(method)) {
|
381 |
+
instance[method].apply(instance, argumentsArray.slice(1));
|
382 |
+
// If method look like a date try to set a new final date
|
383 |
+
} else if(String(method).match(/^[$A-Z_][0-9A-Z_$]*$/i) === null) {
|
384 |
+
instance.setFinalDate.call(instance, method);
|
385 |
+
// Allow plugin to restart after finished
|
386 |
+
// Fix issue #38 (thanks to @yaoazhen)
|
387 |
+
instance.start();
|
388 |
+
} else {
|
389 |
+
$.error('Method %s does not exist on jQuery.countdown'
|
390 |
+
.replace(/\%s/gi, method));
|
391 |
+
}
|
392 |
+
} else {
|
393 |
+
// ... if not we create an instance
|
394 |
+
new Countdown(this, argumentsArray[0], argumentsArray[1]);
|
395 |
+
}
|
396 |
+
});
|
397 |
+
};
|
398 |
+
});
|
js/master.js
CHANGED
@@ -1,23 +1,22 @@
|
|
1 |
jQuery(document).ready(function(){
|
2 |
|
3 |
-
hideSpecifiedFieldsets();
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
e.preventDefault();
|
12 |
cwpTopUpdateForm();
|
13 |
return false;
|
14 |
});
|
15 |
-
|
16 |
-
// Reset Options Event
|
17 |
-
jQuery(".cwp_top_wrapper a.reset-settings").click(function(e) {
|
18 |
e.preventDefault();
|
19 |
startAjaxIntro();
|
20 |
-
//cwpTopUpdateForm();
|
21 |
|
22 |
jQuery.ajax({
|
23 |
type: "POST",
|
@@ -39,8 +38,45 @@ jQuery(document).ready(function(){
|
|
39 |
endAjaxIntro();
|
40 |
return false;
|
41 |
});
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
function cwpTopUpdateForm() {
|
46 |
startAjaxIntro();
|
@@ -53,8 +89,9 @@ jQuery(document).ready(function(){
|
|
53 |
}
|
54 |
|
55 |
jQuery.ajax({
|
56 |
-
type: "POST",
|
57 |
url: cwp_top_ajaxload.ajaxurl,
|
|
|
58 |
data: {
|
59 |
action: "update_response",
|
60 |
dataSent: formData
|
@@ -68,7 +105,7 @@ jQuery(document).ready(function(){
|
|
68 |
});
|
69 |
|
70 |
endAjaxIntro();
|
71 |
-
return false;
|
72 |
}
|
73 |
|
74 |
function cwpTopUpdateFormWithoIntro() {
|
@@ -82,7 +119,7 @@ jQuery(document).ready(function(){
|
|
82 |
}
|
83 |
|
84 |
jQuery.ajax({
|
85 |
-
type: "POST",
|
86 |
url: cwp_top_ajaxload.ajaxurl,
|
87 |
data: {
|
88 |
action: "update_response",
|
@@ -97,48 +134,20 @@ jQuery(document).ready(function(){
|
|
97 |
});
|
98 |
|
99 |
//endAjaxIntro();
|
100 |
-
return false;
|
101 |
}
|
102 |
|
103 |
|
104 |
|
105 |
-
jQuery("#cwp_top_form button.top_authorize").click(function(e){
|
106 |
-
e.preventDefault();
|
107 |
-
startAjaxIntro();
|
108 |
-
if (jQuery(this).attr("service")=='facebook') {
|
109 |
-
app_id = jQuery("#top_opt_app_id").val();
|
110 |
-
app_secret = jQuery("#top_opt_app_secret").val();
|
111 |
-
}
|
112 |
-
else {
|
113 |
-
app_id = jQuery("#top_opt_app_id_lk").val();
|
114 |
-
app_secret = jQuery("#top_opt_app_secret_lk").val();
|
115 |
-
}
|
116 |
-
jQuery.ajax({
|
117 |
-
type: "POST",
|
118 |
-
url: cwp_top_ajaxload.ajaxurl,
|
119 |
-
data: {
|
120 |
-
action: "add_new_account",
|
121 |
-
currentURL: jQuery("#cwp_top_currenturl").val(),
|
122 |
-
social_network: jQuery(this).attr("service"),
|
123 |
-
app_id: app_id,
|
124 |
-
app_secret: app_secret
|
125 |
-
},
|
126 |
-
success: function(response) {
|
127 |
|
128 |
-
window.location.href = response;
|
129 |
-
}
|
130 |
-
})
|
131 |
-
return false;
|
132 |
-
});
|
133 |
|
134 |
|
135 |
-
|
136 |
function addFacebook(){
|
137 |
var service = "facebook";
|
138 |
-
|
139 |
startAjaxIntro();
|
140 |
jQuery.ajax({
|
141 |
-
type: "POST",
|
142 |
url: cwp_top_ajaxload.ajaxurl,
|
143 |
data: {
|
144 |
action: "display_pages",
|
@@ -147,11 +156,11 @@ jQuery(document).ready(function(){
|
|
147 |
},
|
148 |
success: function(response) {
|
149 |
switch (service) {
|
150 |
-
|
151 |
case 'facebook':
|
152 |
var elem = jQuery(".cwp_top_wrapper .cwp_user_pages");
|
153 |
elem.fadeIn().addClass("active");
|
154 |
-
|
155 |
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
156 |
jQuery('html, body').scrollTop(scrollhere);
|
157 |
response = JSON.parse(response);
|
@@ -170,18 +179,19 @@ jQuery(document).ready(function(){
|
|
170 |
//html+='<button class="top_close_popup">Close preview</button>';
|
171 |
//data.length = 3;
|
172 |
fheight = (Math.ceil(data.length / 4) )*95;
|
173 |
-
//if (fheight<=0) fheight = 175;
|
174 |
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").html(html);
|
175 |
-
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").height(fheight);
|
176 |
-
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_sample_tweet_preview_inner ").height(fheight+120);
|
177 |
|
178 |
endAjaxIntro();
|
179 |
break;
|
180 |
|
|
|
181 |
case 'linkedin':
|
182 |
var elem = jQuery(".cwp_top_wrapper .cwp_user_pages");
|
183 |
elem.fadeIn().addClass("active");
|
184 |
-
|
185 |
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
186 |
jQuery('html, body').scrollTop(scrollhere);
|
187 |
response = JSON.parse(response);
|
@@ -193,19 +203,19 @@ jQuery(document).ready(function(){
|
|
193 |
name = data[i].name;
|
194 |
category = data[i].category.substr(0,9);
|
195 |
html+="<div class='page_avatar'><img src='"+profile_image+"'/></div><div class='page_name'>"+name+"</div><div class='page_category'>"+category+"</div></a>";
|
196 |
-
|
197 |
}
|
198 |
-
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").html(html);
|
199 |
endAjaxIntro();
|
200 |
break;
|
201 |
}
|
202 |
-
|
203 |
},
|
204 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
205 |
console.log("There was an error: " + errorThrown);
|
206 |
}
|
207 |
});
|
208 |
-
|
209 |
|
210 |
|
211 |
return false;
|
@@ -214,37 +224,53 @@ jQuery(document).ready(function(){
|
|
214 |
// Add New Account
|
215 |
if (location.hash=="#_=_"|| location.hash=="#fbadd") {
|
216 |
addFacebook();
|
217 |
-
|
218 |
};
|
219 |
|
220 |
// Add New Twitter Account
|
221 |
-
jQuery("#
|
222 |
-
|
223 |
var service = jQuery(this).attr('service');
|
224 |
var action = "add_new_account";
|
225 |
-
var
|
226 |
-
if
|
227 |
-
|
228 |
-
another = 1;
|
229 |
-
}
|
230 |
-
if (jQuery(this).text()==" Add Account ") {
|
231 |
-
another = 1;
|
232 |
-
}
|
233 |
startAjaxIntro();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
jQuery.ajax({
|
235 |
-
type: "POST",
|
236 |
url: cwp_top_ajaxload.ajaxurl,
|
237 |
data: {
|
238 |
action: action,
|
239 |
currentURL: jQuery("#cwp_top_currenturl").val(),
|
240 |
social_network: service,
|
241 |
-
|
242 |
},
|
|
|
243 |
success: function(response) {
|
244 |
|
245 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
switch (service) {
|
247 |
-
case 'twitter':
|
248 |
window.location.href = response;
|
249 |
break;
|
250 |
case 'facebook':
|
@@ -252,7 +278,7 @@ jQuery(document).ready(function(){
|
|
252 |
|
253 |
var elem = jQuery(".cwp_top_wrapper .cwp_fbapp_preview")
|
254 |
elem.fadeIn().addClass("active");
|
255 |
-
|
256 |
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
257 |
jQuery('html, body').scrollTop(scrollhere);
|
258 |
} else {
|
@@ -264,7 +290,7 @@ jQuery(document).ready(function(){
|
|
264 |
case 'linkedin':
|
265 |
var elem = jQuery(".cwp_top_wrapper .cwp_lkapp_preview")
|
266 |
elem.fadeIn().addClass("active");
|
267 |
-
|
268 |
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
269 |
jQuery('html, body').scrollTop(scrollhere);
|
270 |
// html = "<input type='text' placeholder='App key'/>";
|
@@ -275,9 +301,9 @@ jQuery(document).ready(function(){
|
|
275 |
}else {
|
276 |
jQuery(".cwp_top_status .inactive").html(response);
|
277 |
endAjaxIntro();
|
278 |
-
}
|
|
|
279 |
|
280 |
-
|
281 |
},
|
282 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
283 |
console.log("There was an error: " + errorThrown);
|
@@ -295,14 +321,13 @@ jQuery(document).ready(function(){
|
|
295 |
var userID = jQuery(this).attr('id');
|
296 |
|
297 |
jQuery.ajax({
|
298 |
-
type: "POST",
|
299 |
url: cwp_top_ajaxload.ajaxurl,
|
300 |
data: {
|
301 |
action: "log_out_user",
|
302 |
user_id: userID
|
303 |
},
|
304 |
success: function(response) {
|
305 |
-
console.log(response);
|
306 |
window.location.href = jQuery("#cwp_top_currenturl").val();
|
307 |
},
|
308 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
@@ -312,26 +337,32 @@ jQuery(document).ready(function(){
|
|
312 |
|
313 |
endAjaxIntro();
|
314 |
});
|
315 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
// Start Tweet
|
317 |
-
jQuery("#
|
318 |
-
|
319 |
startAjaxIntro();
|
320 |
cwpTopUpdateForm();
|
321 |
|
322 |
jQuery.ajax({
|
323 |
-
type: "POST",
|
324 |
url: cwp_top_ajaxload.ajaxurl,
|
325 |
data: {
|
326 |
action: "tweet_old_post_action"
|
327 |
},
|
328 |
success: function(response) {
|
329 |
-
if(response !== '') {
|
330 |
-
|
331 |
-
jQuery('.cwp_top_wrapper').append(response);
|
332 |
|
333 |
-
|
334 |
-
location.reload();
|
335 |
},
|
336 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
337 |
console.log("There was an error: "+errorThrown);
|
@@ -342,39 +373,48 @@ jQuery(document).ready(function(){
|
|
342 |
});
|
343 |
|
344 |
setInterval(function(){ jQuery.ajax({
|
345 |
-
type: "POST",
|
346 |
url: cwp_top_ajaxload.ajaxurl,
|
347 |
data: {
|
348 |
action: "getNotice_action"
|
349 |
},
|
|
|
350 |
success: function(response) {
|
351 |
-
if(response !== '') {
|
352 |
-
if (response.substring(0,5)=="Error") {
|
353 |
-
jQuery(".cwp_top_status p:nth-child(2)").css( "color", "red" );
|
354 |
-
jQuery(".cwp_top_status p:nth-child(2)").html(response);
|
355 |
-
} else {
|
356 |
|
357 |
-
|
358 |
-
jQuery(".
|
359 |
-
jQuery(".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
|
361 |
}
|
362 |
-
|
363 |
-
//jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet").html(response);
|
364 |
}
|
365 |
-
}
|
366 |
-
|
367 |
-
console.log("There was an error: "+errorThrown);
|
368 |
-
}
|
369 |
-
})},3000);
|
370 |
|
371 |
-
jQuery("#
|
|
|
|
|
|
|
|
|
|
|
372 |
e.preventDefault();
|
373 |
startAjaxIntro();
|
374 |
cwpTopUpdateFormWithoIntro();
|
375 |
-
|
376 |
jQuery.ajax({
|
377 |
-
type: "POST",
|
378 |
url: cwp_top_ajaxload.ajaxurl,
|
379 |
data: {
|
380 |
action: "view_sample_tweet_action"
|
@@ -387,10 +427,24 @@ jQuery(document).ready(function(){
|
|
387 |
//jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").css("top", ( jQuery(window).height() - this.height() ) / 2+jQuery(window).scrollTop() + "px");
|
388 |
//jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").css("left", ( jQuery(window).width() - this.width() ) / 2+jQuery(window).scrollLeft() + "px");
|
389 |
var elem = jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview");
|
390 |
-
|
391 |
-
jQuery(
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
}
|
395 |
endAjaxIntro();
|
396 |
},
|
@@ -400,17 +454,17 @@ jQuery(document).ready(function(){
|
|
400 |
}
|
401 |
});
|
402 |
|
403 |
-
|
404 |
-
});
|
405 |
|
406 |
// Stop Tweet Old Post
|
407 |
-
jQuery("#
|
408 |
e.preventDefault();
|
409 |
startAjaxIntro();
|
410 |
cwpTopUpdateForm();
|
411 |
|
412 |
jQuery.ajax({
|
413 |
-
type: "POST",
|
414 |
url: cwp_top_ajaxload.ajaxurl,
|
415 |
data: {
|
416 |
action: "stop_tweet_old_post"
|
@@ -418,8 +472,8 @@ jQuery(document).ready(function(){
|
|
418 |
success: function(response) {
|
419 |
if(response !== '') {
|
420 |
jQuery('.cwp_top_wrapper').append(response);
|
421 |
-
}
|
422 |
-
location.reload();
|
423 |
},
|
424 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
425 |
console.log("There was an error: "+errorThrown);
|
@@ -431,20 +485,20 @@ jQuery(document).ready(function(){
|
|
431 |
|
432 |
jQuery(".cwp_sample_tweet_preview_inner button.top_close_popup").on("click",function(e){
|
433 |
jQuery(this).parent().parent().fadeOut().removeClass("active");
|
434 |
-
});
|
435 |
|
436 |
jQuery(".cwp_user_pages_inner button.top_close_popup").on("click",function(e){
|
437 |
e.preventDefault();
|
438 |
jQuery(this).parent().parent().parent().fadeOut().removeClass("active");
|
439 |
return false;
|
440 |
-
});
|
441 |
|
442 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner button.tweetitnow").click(function(e){
|
443 |
e.preventDefault();
|
444 |
startAjaxIntro();
|
445 |
-
|
446 |
jQuery.ajax({
|
447 |
-
type: "POST",
|
448 |
url: cwp_top_ajaxload.ajaxurl,
|
449 |
data: {
|
450 |
action: "tweet_now_action"
|
@@ -461,15 +515,68 @@ jQuery(document).ready(function(){
|
|
461 |
endAjaxIntro();
|
462 |
}
|
463 |
});
|
464 |
-
});
|
465 |
|
466 |
// Transform the date into a countdown.
|
467 |
-
var nextTweetDate =
|
468 |
jQuery(".cwp_top_container .nextTweet").html('');
|
469 |
-
|
470 |
-
|
471 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
|
|
|
473 |
// Starting the AJAX intro animation
|
474 |
function startAjaxIntro() {
|
475 |
jQuery(".cwp_top_wrapper .ajaxAnimation").fadeIn();
|
@@ -487,19 +594,18 @@ jQuery(document).ready(function(){
|
|
487 |
}
|
488 |
|
489 |
jQuery("body").on('click',function(e){
|
490 |
-
|
491 |
-
|
492 |
if (jQuery(e.target).parent().hasClass("cwp_preview_page")) {
|
493 |
e.preventDefault();
|
494 |
-
|
495 |
-
|
496 |
startAjaxIntro();
|
497 |
var service = jQuery(e.target).parent().attr('service');
|
498 |
var access_token = jQuery(e.target).parent().attr('pagetoken');
|
499 |
var page_id = jQuery(e.target).parent().attr('pageid');
|
500 |
-
|
501 |
jQuery.ajax({
|
502 |
-
type: "POST",
|
503 |
url: cwp_top_ajaxload.ajaxurl,
|
504 |
data: {
|
505 |
action: "add_pages",
|
@@ -512,20 +618,20 @@ jQuery(document).ready(function(){
|
|
512 |
},
|
513 |
success: function(response) {
|
514 |
switch (service) {
|
515 |
-
|
516 |
-
case 'facebook':
|
517 |
endAjaxIntro();
|
518 |
jQuery(".cwp_top_wrapper .cwp_user_pages").fadeOut().removeClass("active");
|
519 |
window.location.href = response;
|
520 |
break;
|
521 |
|
522 |
-
case 'linkedin':
|
523 |
endAjaxIntro();
|
524 |
jQuery(".cwp_top_wrapper .cwp_user_pages").fadeOut().removeClass("active");
|
525 |
window.location.href = response;
|
526 |
break;
|
527 |
}
|
528 |
-
|
529 |
},
|
530 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
531 |
console.log("There was an error: " + errorThrown);
|
@@ -533,7 +639,7 @@ jQuery(document).ready(function(){
|
|
533 |
});
|
534 |
return false;
|
535 |
}
|
536 |
-
|
537 |
});
|
538 |
|
539 |
// Select all function
|
@@ -542,153 +648,332 @@ jQuery(document).ready(function(){
|
|
542 |
if(jQuery(this).hasClass('active')) {
|
543 |
jQuery(this).removeClass('active').text('Select All');
|
544 |
jQuery(this).parent().parent().find('.right input[type=checkbox]').attr('checked', false);
|
545 |
-
} else {
|
546 |
jQuery(this).addClass('active').text('Deselect All');
|
547 |
jQuery(this).parent().parent().find('.right input[type=checkbox]').attr('checked', true);
|
548 |
-
}
|
549 |
-
});
|
550 |
-
|
551 |
-
|
552 |
-
function hideSpecifiedFieldsets()
|
553 |
-
{
|
554 |
-
jQuery("#top_opt_post_type_custom_field").parent().parent().hide();
|
555 |
-
jQuery("#top_opt_custom_url_option").parent().parent().hide();
|
556 |
-
jQuery("#top_opt_custom_url_field").parent().parent().hide();
|
557 |
-
jQuery("#top_opt_url_shortner").parent().parent().hide();
|
558 |
-
jQuery("#top_opt_use_url_shortner").parent().parent().hide();
|
559 |
-
jQuery("#top_opt_hashtags").parent().parent().hide();
|
560 |
-
jQuery("#top_opt_hashtag_length").parent().parent().hide();
|
561 |
-
jQuery("#top_opt_custom_hashtag_field").parent().parent().hide();
|
562 |
-
jQuery("#top_opt_post_type_value").parent().parent().hide();
|
563 |
-
jQuery("#top_opt_bitly_user").parent().parent().hide();
|
564 |
-
jQuery("#top_opt_bitly_key").parent().parent().hide();
|
565 |
-
|
566 |
-
}
|
567 |
-
|
568 |
-
function cwpManipulateHashtags()
|
569 |
-
{
|
570 |
-
if(jQuery("#top_opt_custom_hashtag_option").val() == "nohashtag") {
|
571 |
-
jQuery("#top_opt_hashtags").parent().parent().slideUp("fast");
|
572 |
-
jQuery("#top_opt_hashtag_length").parent().parent().slideUp("fast");
|
573 |
-
jQuery("#top_opt_custom_hashtag_field").parent().parent().slideUp("fast");
|
574 |
-
} else if(jQuery("#top_opt_custom_hashtag_option").val() == "common") {
|
575 |
-
jQuery("#top_opt_hashtags").parent().parent().slideDown("fast");
|
576 |
-
jQuery("#top_opt_hashtag_length").parent().parent().slideDown("fast");
|
577 |
-
} else if(jQuery("#top_opt_custom_hashtag_option").val() == "categories" || jQuery("#top_opt_custom_hashtag_option").val() == "tags") {
|
578 |
-
jQuery("#top_opt_hashtags").parent().parent().slideUp("fast");
|
579 |
-
jQuery("#top_opt_hashtag_length").parent().parent().slideDown("fast");
|
580 |
-
jQuery("#top_opt_custom_hashtag_field").parent().parent().slideUp("fast");
|
581 |
-
} else if(jQuery("#top_opt_custom_hashtag_option").val() == "custom") {
|
582 |
-
jQuery("#top_opt_hashtags").parent().parent().slideUp("fast");
|
583 |
-
jQuery("#top_opt_hashtag_length").parent().parent().slideDown("fast");
|
584 |
-
jQuery("#top_opt_custom_hashtag_field").parent().parent().slideDown("fast");
|
585 |
-
}
|
586 |
-
}
|
587 |
-
|
588 |
-
|
589 |
-
// Functions to show / hide specific inputs based on user selection.
|
590 |
-
cwpManipulateHashtags();
|
591 |
-
|
592 |
-
if(jQuery("#top_opt_use_url_shortner").is(":checked")) {
|
593 |
-
jQuery("#top_opt_url_shortner").parent().parent().show();
|
594 |
-
if(jQuery("#top_opt_url_shortner").val() == "bit.ly") {
|
595 |
-
jQuery("#top_opt_bitly_user").parent().parent().show();
|
596 |
-
jQuery("#top_opt_bitly_key").parent().parent().show();
|
597 |
-
|
598 |
-
}
|
599 |
-
} else {
|
600 |
-
jQuery("#top_opt_url_shortner").parent().parent().hide();
|
601 |
-
jQuery("#top_opt_bitly_user").parent().parent().hide();
|
602 |
-
jQuery("#top_opt_bitly_key").parent().parent().hide();
|
603 |
-
}
|
604 |
-
|
605 |
-
jQuery( "#top_opt_url_shortner" ).change(function(){
|
606 |
-
if(jQuery("#top_opt_url_shortner").val() == "bit.ly" && jQuery("#top_opt_use_url_shortner").is(":checked")) {
|
607 |
-
jQuery("#top_opt_bitly_user").parent().parent().show();
|
608 |
-
jQuery("#top_opt_bitly_key").parent().parent().show();
|
609 |
-
|
610 |
-
}
|
611 |
-
else {
|
612 |
-
jQuery("#top_opt_bitly_user").parent().parent().hide();
|
613 |
-
jQuery("#top_opt_bitly_key").parent().parent().hide();
|
614 |
-
}
|
615 |
-
})
|
616 |
-
|
617 |
-
if(jQuery("select#top_opt_include_link").val() == "true") {
|
618 |
-
jQuery("#top_opt_custom_url_option").parent().parent().show();
|
619 |
-
jQuery("#top_opt_use_url_shortner").parent().parent().show();
|
620 |
-
//jQuery("#top_opt_url_shortner").parent().parent().show();
|
621 |
-
if (jQuery("#top_opt_custom_url_option").is(":checked"))
|
622 |
-
jQuery("#top_opt_custom_url_field").parent().parent().show();
|
623 |
-
} else {
|
624 |
-
jQuery("#top_opt_use_url_shortner").parent().parent().hide();
|
625 |
-
jQuery("#top_opt_custom_url_option").parent().parent().hide();
|
626 |
-
jQuery("#top_opt_url_shortner").parent().parent().hide();
|
627 |
-
jQuery("#top_opt_bitly_user").parent().parent().hide();
|
628 |
-
jQuery("#top_opt_bitly_key").parent().parent().hide();
|
629 |
-
}
|
630 |
-
|
631 |
-
if(jQuery("#top_opt_post_type").val() == "custom-post-type") {
|
632 |
-
jQuery("#top_opt_post_type_value").parent().parent().slideDown("fast");
|
633 |
-
} else {
|
634 |
-
jQuery("#top_opt_post_type_value").parent().parent().slideUp("fast");
|
635 |
-
}
|
636 |
-
|
637 |
-
jQuery("select#top_opt_tweet_type").change(function(){
|
638 |
-
if(jQuery(this).val() == "custom-field") {
|
639 |
-
jQuery("#top_opt_post_type_custom_field").parent().parent().slideDown("fast");
|
640 |
-
} else {
|
641 |
-
jQuery("#top_opt_post_type_custom_field").parent().parent().slideUp("fast");
|
642 |
-
}
|
643 |
-
});
|
644 |
-
|
645 |
-
|
646 |
-
jQuery("select#top_opt_include_link").change(function(){
|
647 |
-
if(jQuery(this).val() == "true") {
|
648 |
-
jQuery("#top_opt_custom_url_option").parent().parent().slideDown("fast");
|
649 |
-
jQuery("#top_opt_use_url_shortner").parent().parent().slideDown("fast");
|
650 |
-
jQuery("#top_opt_url_shortner").parent().parent().slideDown("fast");
|
651 |
-
} else {
|
652 |
-
jQuery("#top_opt_use_url_shortner").parent().parent().slideUp("fast");
|
653 |
-
jQuery("#top_opt_custom_url_option").parent().parent().slideUp("fast");
|
654 |
-
jQuery("#top_opt_url_shortner").parent().parent().slideUp("fast");
|
655 |
-
}
|
656 |
-
});
|
657 |
-
|
658 |
-
jQuery("#top_opt_custom_url_option").change(function(){
|
659 |
-
if(jQuery(this).is(":checked")) {
|
660 |
-
jQuery("#top_opt_custom_url_field").parent().parent().slideDown("fast");
|
661 |
-
} else {
|
662 |
-
jQuery("#top_opt_custom_url_field").parent().parent().slideUp("fast");
|
663 |
}
|
664 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
|
666 |
-
jQuery("#top_opt_use_url_shortner").change(function(){
|
667 |
-
if(jQuery(this).is(":checked")) {
|
668 |
-
jQuery("#top_opt_url_shortner").parent().parent().slideDown("fast");
|
669 |
-
if(jQuery("#top_opt_url_shortner").val() == "bit.ly") {
|
670 |
-
jQuery("#top_opt_bitly_user").parent().parent().slideDown("fast");
|
671 |
-
jQuery("#top_opt_bitly_key").parent().parent().slideDown("fast");
|
672 |
-
|
673 |
}
|
674 |
-
} else {
|
675 |
-
jQuery("#top_opt_url_shortner").parent().parent().slideUp("fast");
|
676 |
-
jQuery("#top_opt_bitly_user").parent().parent().slideUp("fast");
|
677 |
-
jQuery("#top_opt_bitly_key").parent().parent().slideUp("fast");
|
678 |
|
679 |
-
}
|
680 |
-
});
|
681 |
-
|
682 |
-
jQuery("#top_opt_custom_hashtag_option").change(function(){
|
683 |
-
cwpManipulateHashtags();
|
684 |
-
});
|
685 |
-
|
686 |
-
jQuery("#top_opt_post_type").change(function(){
|
687 |
-
if(jQuery(this).val() == "custom-post-type") {
|
688 |
-
jQuery("#top_opt_post_type_value").parent().parent().slideDown("fast");
|
689 |
-
} else {
|
690 |
-
jQuery("#top_opt_post_type_value").parent().parent().slideUp("fast");
|
691 |
-
}
|
692 |
});
|
693 |
-
|
694 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(function(){
|
2 |
|
|
|
3 |
|
4 |
+
setInterval(function(){
|
5 |
+
var clock = jQuery(".rop-twitter-clock");
|
6 |
+
var time = parseInt(clock.attr('data-current'));
|
7 |
+
// console.log(time);
|
8 |
+
clock.attr('data-current',time+1);
|
9 |
+
clock.find("b").html(new Date(time * 1000).toUTCString());
|
10 |
+
},1000);
|
11 |
+
jQuery(".cwp_top_wrapper").append("<div class='ajaxAnimation'></div>");
|
12 |
+
jQuery("#update-options").click(function(e){
|
13 |
e.preventDefault();
|
14 |
cwpTopUpdateForm();
|
15 |
return false;
|
16 |
});
|
17 |
+
jQuery("#reset-settings").click(function(e) {
|
|
|
|
|
18 |
e.preventDefault();
|
19 |
startAjaxIntro();
|
|
|
20 |
|
21 |
jQuery.ajax({
|
22 |
type: "POST",
|
38 |
endAjaxIntro();
|
39 |
return false;
|
40 |
});
|
41 |
+
jQuery("#linkedin-login").on("click",function(){
|
42 |
+
jQuery(".cwp_lkapp_preview").show();
|
43 |
+
return false;
|
44 |
+
});
|
45 |
+
jQuery("#facebook-login").on("click",function(){
|
46 |
+
if(jQuery(this).hasClass("another-account")){
|
47 |
+
addFacebook()
|
48 |
+
}else{
|
49 |
+
jQuery(".cwp_fbapp_preview").show();
|
50 |
+
}
|
51 |
+
return false;
|
52 |
+
});
|
53 |
+
jQuery("#cwp_remote_check").on("click",function(){
|
54 |
+
|
55 |
+
var state = "";
|
56 |
+
var th = jQuery(this);
|
57 |
+
if(th.hasClass("on")){
|
58 |
+
state = "off";
|
59 |
+
th.addClass("off").removeClass("on");
|
60 |
+
}else{
|
61 |
+
state = "on";
|
62 |
+
th.addClass("on").removeClass("off");
|
63 |
+
}
|
64 |
+
jQuery.ajax({
|
65 |
+
type: "POST",
|
66 |
+
url: cwp_top_ajaxload.ajaxurl,
|
67 |
+
data: {
|
68 |
+
action: 'remote_trigger',
|
69 |
+
state:state
|
70 |
+
},
|
71 |
+
success: function(response) {
|
72 |
+
console.log(response);
|
73 |
+
},
|
74 |
+
error: function(response) {
|
75 |
+
console.log("Error: "+ response);
|
76 |
+
}
|
77 |
+
});
|
78 |
+
return false;
|
79 |
+
})
|
80 |
|
81 |
function cwpTopUpdateForm() {
|
82 |
startAjaxIntro();
|
89 |
}
|
90 |
|
91 |
jQuery.ajax({
|
92 |
+
type: "POST",
|
93 |
url: cwp_top_ajaxload.ajaxurl,
|
94 |
+
async:false,
|
95 |
data: {
|
96 |
action: "update_response",
|
97 |
dataSent: formData
|
105 |
});
|
106 |
|
107 |
endAjaxIntro();
|
108 |
+
return false;
|
109 |
}
|
110 |
|
111 |
function cwpTopUpdateFormWithoIntro() {
|
119 |
}
|
120 |
|
121 |
jQuery.ajax({
|
122 |
+
type: "POST",
|
123 |
url: cwp_top_ajaxload.ajaxurl,
|
124 |
data: {
|
125 |
action: "update_response",
|
134 |
});
|
135 |
|
136 |
//endAjaxIntro();
|
137 |
+
return false;
|
138 |
}
|
139 |
|
140 |
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
|
|
|
145 |
function addFacebook(){
|
146 |
var service = "facebook";
|
147 |
+
|
148 |
startAjaxIntro();
|
149 |
jQuery.ajax({
|
150 |
+
type: "POST",
|
151 |
url: cwp_top_ajaxload.ajaxurl,
|
152 |
data: {
|
153 |
action: "display_pages",
|
156 |
},
|
157 |
success: function(response) {
|
158 |
switch (service) {
|
159 |
+
|
160 |
case 'facebook':
|
161 |
var elem = jQuery(".cwp_top_wrapper .cwp_user_pages");
|
162 |
elem.fadeIn().addClass("active");
|
163 |
+
|
164 |
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
165 |
jQuery('html, body').scrollTop(scrollhere);
|
166 |
response = JSON.parse(response);
|
179 |
//html+='<button class="top_close_popup">Close preview</button>';
|
180 |
//data.length = 3;
|
181 |
fheight = (Math.ceil(data.length / 4) )*95;
|
182 |
+
//if (fheight<=0) fheight = 175;
|
183 |
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").html(html);
|
184 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").height(fheight);
|
185 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_sample_tweet_preview_inner ").height(fheight+120);
|
186 |
|
187 |
endAjaxIntro();
|
188 |
break;
|
189 |
|
190 |
+
|
191 |
case 'linkedin':
|
192 |
var elem = jQuery(".cwp_top_wrapper .cwp_user_pages");
|
193 |
elem.fadeIn().addClass("active");
|
194 |
+
|
195 |
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
196 |
jQuery('html, body').scrollTop(scrollhere);
|
197 |
response = JSON.parse(response);
|
203 |
name = data[i].name;
|
204 |
category = data[i].category.substr(0,9);
|
205 |
html+="<div class='page_avatar'><img src='"+profile_image+"'/></div><div class='page_name'>"+name+"</div><div class='page_category'>"+category+"</div></a>";
|
206 |
+
|
207 |
}
|
208 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").html(html);
|
209 |
endAjaxIntro();
|
210 |
break;
|
211 |
}
|
212 |
+
|
213 |
},
|
214 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
215 |
console.log("There was an error: " + errorThrown);
|
216 |
}
|
217 |
});
|
218 |
+
|
219 |
|
220 |
|
221 |
return false;
|
224 |
// Add New Account
|
225 |
if (location.hash=="#_=_"|| location.hash=="#fbadd") {
|
226 |
addFacebook();
|
227 |
+
|
228 |
};
|
229 |
|
230 |
// Add New Twitter Account
|
231 |
+
jQuery("#twitter-login,.top_authorize").click(function(e){
|
232 |
+
|
233 |
var service = jQuery(this).attr('service');
|
234 |
var action = "add_new_account";
|
235 |
+
var extra = {};
|
236 |
+
if(service != 'twitter'){
|
237 |
+
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
238 |
startAjaxIntro();
|
239 |
+
if (service=='facebook') {
|
240 |
+
extra.app_id = jQuery("#top_opt_app_id").val();
|
241 |
+
extra.app_secret = jQuery("#top_opt_app_secret").val();
|
242 |
+
}
|
243 |
+
else {
|
244 |
+
extra.app_id = jQuery("#top_opt_app_id_lk").val();
|
245 |
+
extra.app_secret = jQuery("#top_opt_app_secret_lk").val();
|
246 |
+
}
|
247 |
+
|
248 |
+
|
249 |
+
}
|
250 |
+
startAjaxIntro();
|
251 |
jQuery.ajax({
|
252 |
+
type: "POST",
|
253 |
url: cwp_top_ajaxload.ajaxurl,
|
254 |
data: {
|
255 |
action: action,
|
256 |
currentURL: jQuery("#cwp_top_currenturl").val(),
|
257 |
social_network: service,
|
258 |
+
extra:extra
|
259 |
},
|
260 |
+
dataType:"json",
|
261 |
success: function(response) {
|
262 |
|
263 |
+
if(response.url){
|
264 |
+
window.location.href = response.url;
|
265 |
+
}else{
|
266 |
+
jQuery(".cwp_fbapp_preview").hide();
|
267 |
+
jQuery(".cwp_lkapp_preview").hide();
|
268 |
+
endAjaxIntro();
|
269 |
+
|
270 |
+
}
|
271 |
+
/*if (response.indexOf("upgrade to the PRO")===-1) {
|
272 |
switch (service) {
|
273 |
+
case 'twitter':
|
274 |
window.location.href = response;
|
275 |
break;
|
276 |
case 'facebook':
|
278 |
|
279 |
var elem = jQuery(".cwp_top_wrapper .cwp_fbapp_preview")
|
280 |
elem.fadeIn().addClass("active");
|
281 |
+
|
282 |
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
283 |
jQuery('html, body').scrollTop(scrollhere);
|
284 |
} else {
|
290 |
case 'linkedin':
|
291 |
var elem = jQuery(".cwp_top_wrapper .cwp_lkapp_preview")
|
292 |
elem.fadeIn().addClass("active");
|
293 |
+
|
294 |
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
295 |
jQuery('html, body').scrollTop(scrollhere);
|
296 |
// html = "<input type='text' placeholder='App key'/>";
|
301 |
}else {
|
302 |
jQuery(".cwp_top_status .inactive").html(response);
|
303 |
endAjaxIntro();
|
304 |
+
}*/
|
305 |
+
|
306 |
|
|
|
307 |
},
|
308 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
309 |
console.log("There was an error: " + errorThrown);
|
321 |
var userID = jQuery(this).attr('id');
|
322 |
|
323 |
jQuery.ajax({
|
324 |
+
type: "POST",
|
325 |
url: cwp_top_ajaxload.ajaxurl,
|
326 |
data: {
|
327 |
action: "log_out_user",
|
328 |
user_id: userID
|
329 |
},
|
330 |
success: function(response) {
|
|
|
331 |
window.location.href = jQuery("#cwp_top_currenturl").val();
|
332 |
},
|
333 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
337 |
|
338 |
endAjaxIntro();
|
339 |
});
|
340 |
+
jQuery("#rop-clear-log").on("click",function(){
|
341 |
+
clearNotices();
|
342 |
+
jQuery.ajax({
|
343 |
+
type: "POST",
|
344 |
+
url: cwp_top_ajaxload.ajaxurl,
|
345 |
+
data: {
|
346 |
+
action: "rop_clear_log"
|
347 |
+
}
|
348 |
+
});
|
349 |
+
return false;
|
350 |
+
})
|
351 |
// Start Tweet
|
352 |
+
jQuery("#tweet-now").click(function(e){
|
353 |
+
|
354 |
startAjaxIntro();
|
355 |
cwpTopUpdateForm();
|
356 |
|
357 |
jQuery.ajax({
|
358 |
+
type: "POST",
|
359 |
url: cwp_top_ajaxload.ajaxurl,
|
360 |
data: {
|
361 |
action: "tweet_old_post_action"
|
362 |
},
|
363 |
success: function(response) {
|
|
|
|
|
|
|
364 |
|
365 |
+
location.reload();
|
|
|
366 |
},
|
367 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
368 |
console.log("There was an error: "+errorThrown);
|
373 |
});
|
374 |
|
375 |
setInterval(function(){ jQuery.ajax({
|
376 |
+
type: "POST",
|
377 |
url: cwp_top_ajaxload.ajaxurl,
|
378 |
data: {
|
379 |
action: "getNotice_action"
|
380 |
},
|
381 |
+
dataType:"json",
|
382 |
success: function(response) {
|
|
|
|
|
|
|
|
|
|
|
383 |
|
384 |
+
if(response.length > 0 ){
|
385 |
+
jQuery(".inactive-rop-error-label").hide();
|
386 |
+
jQuery(".active-rop-error-label").show();
|
387 |
+
jQuery(".rop-error-log span").html(response.length).removeClass('no-error');
|
388 |
+
jQuery(".active-rop-error-label").html( " You have <b>" + response.length + " </b>new messages ! Go to Log tab to see them");
|
389 |
+
jQuery("#rop-log-list").html('');
|
390 |
+
jQuery.each(response,function(k,v){
|
391 |
+
|
392 |
+
jQuery("#rop-log-list").append('<li class="rop-log-item rop-'+ v.type +'"> <span class="rop-log-date">' + v.time + '</span> <span class="rop-log-text">'+ v.message+ '</span> </li>');
|
393 |
+
|
394 |
+
|
395 |
+
})
|
396 |
+
|
397 |
+
}else{
|
398 |
+
clearNotices();
|
399 |
+
jQuery("#rop-log-list").html('<li class="rop-log-item rop-notice"> <span class="rop-log-text">You have no messages ! </span> </li>');
|
400 |
|
401 |
}
|
402 |
+
|
|
|
403 |
}
|
404 |
+
} )
|
405 |
+
},3000);
|
|
|
|
|
|
|
406 |
|
407 |
+
jQuery("#see-sample-tweet").click(function(e){
|
408 |
+
if(!cwpTopCheckAccounts()){
|
409 |
+
jQuery("#tabs_menu li:first").trigger("click");
|
410 |
+
showCWPROPError("You need to add an account in order to start posting.");
|
411 |
+
return false;
|
412 |
+
}
|
413 |
e.preventDefault();
|
414 |
startAjaxIntro();
|
415 |
cwpTopUpdateFormWithoIntro();
|
|
|
416 |
jQuery.ajax({
|
417 |
+
type: "POST",
|
418 |
url: cwp_top_ajaxload.ajaxurl,
|
419 |
data: {
|
420 |
action: "view_sample_tweet_action"
|
427 |
//jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").css("top", ( jQuery(window).height() - this.height() ) / 2+jQuery(window).scrollTop() + "px");
|
428 |
//jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").css("left", ( jQuery(window).width() - this.width() ) / 2+jQuery(window).scrollLeft() + "px");
|
429 |
var elem = jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview");
|
430 |
+
|
431 |
+
jQuery(window).scrollTop(0);
|
432 |
+
|
433 |
+
$json = JSON.parse(response);
|
434 |
+
|
435 |
+
if($json .twitter)
|
436 |
+
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet.sample_tweet_twitter").html($json .twitter);
|
437 |
+
else
|
438 |
+
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet.sample_tweet_twitter").hide().prev().hide();
|
439 |
+
if($json .facebook)
|
440 |
+
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet.sample_tweet_facebook").html( $json .facebook) ;
|
441 |
+
else
|
442 |
+
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet.sample_tweet_facebook").hide().prev().hide();
|
443 |
+
if($json .linkedin)
|
444 |
+
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet.sample_tweet_linkedin").html( $json .linkedin);
|
445 |
+
else
|
446 |
+
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet.sample_tweet_linkedin").hide().prev().hide();
|
447 |
+
|
448 |
}
|
449 |
endAjaxIntro();
|
450 |
},
|
454 |
}
|
455 |
});
|
456 |
|
457 |
+
|
458 |
+
});
|
459 |
|
460 |
// Stop Tweet Old Post
|
461 |
+
jQuery("#stop-tweet-old-post").click(function(e){
|
462 |
e.preventDefault();
|
463 |
startAjaxIntro();
|
464 |
cwpTopUpdateForm();
|
465 |
|
466 |
jQuery.ajax({
|
467 |
+
type: "POST",
|
468 |
url: cwp_top_ajaxload.ajaxurl,
|
469 |
data: {
|
470 |
action: "stop_tweet_old_post"
|
472 |
success: function(response) {
|
473 |
if(response !== '') {
|
474 |
jQuery('.cwp_top_wrapper').append(response);
|
475 |
+
}
|
476 |
+
location.reload();
|
477 |
},
|
478 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
479 |
console.log("There was an error: "+errorThrown);
|
485 |
|
486 |
jQuery(".cwp_sample_tweet_preview_inner button.top_close_popup").on("click",function(e){
|
487 |
jQuery(this).parent().parent().fadeOut().removeClass("active");
|
488 |
+
});
|
489 |
|
490 |
jQuery(".cwp_user_pages_inner button.top_close_popup").on("click",function(e){
|
491 |
e.preventDefault();
|
492 |
jQuery(this).parent().parent().parent().fadeOut().removeClass("active");
|
493 |
return false;
|
494 |
+
});
|
495 |
|
496 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner button.tweetitnow").click(function(e){
|
497 |
e.preventDefault();
|
498 |
startAjaxIntro();
|
499 |
+
|
500 |
jQuery.ajax({
|
501 |
+
type: "POST",
|
502 |
url: cwp_top_ajaxload.ajaxurl,
|
503 |
data: {
|
504 |
action: "tweet_now_action"
|
515 |
endAjaxIntro();
|
516 |
}
|
517 |
});
|
518 |
+
});
|
519 |
|
520 |
// Transform the date into a countdown.
|
521 |
+
var nextTweetDate = jQuery(".cwp_top_container .nextTweet").html();
|
522 |
jQuery(".cwp_top_container .nextTweet").html('');
|
523 |
+
if(nextTweetDate){
|
524 |
+
jQuery(".cwp_top_container .nextTweet").countdown({
|
525 |
+
date: nextTweetDate
|
526 |
+
});
|
527 |
+
}
|
528 |
+
jQuery(".rop-network-countdown").each(function() {
|
529 |
+
var span = jQuery(this).find('.rop-network-timestamp');
|
530 |
+
var timestamp = parseInt(span.attr('data-timestamp'));
|
531 |
+
|
532 |
+
if (!isNaN(timestamp)) {
|
533 |
+
span.countdownPlugin(timestamp * 1000).on('update.countdown', function(event) {
|
534 |
+
var format = '%H hr %M m %S s';
|
535 |
+
if(event.offset.days > 0) {
|
536 |
+
format = '%-d day%!d ' + format;
|
537 |
+
}
|
538 |
+
if(event.offset.weeks > 0) {
|
539 |
+
format = '%-w week%!w ' + format;
|
540 |
+
}
|
541 |
+
jQuery(this).html(event.strftime(format));
|
542 |
+
}).on('finish.countdown', function(event) {
|
543 |
+
var th = jQuery(this).parent();
|
544 |
+
th.html("Please wait ....");
|
545 |
+
setTimeout(function(){
|
546 |
+
th.html("You can refresh the page to see the next schedule !");
|
547 |
+
|
548 |
+
},1000)
|
549 |
+
|
550 |
+
});
|
551 |
+
span.parent().show();
|
552 |
+
}else{
|
553 |
+
span.parent().hide();
|
554 |
+
}
|
555 |
+
})
|
556 |
+
|
557 |
+
jQuery(".cwp-cpt-checkbox").click(function(){
|
558 |
+
var ck = false;
|
559 |
+
var th = jQuery(this);
|
560 |
+
var val = th.val();
|
561 |
+
if(th.is(":checked")){
|
562 |
+
|
563 |
+
ck = true;
|
564 |
+
}else{
|
565 |
+
|
566 |
+
ck = false;
|
567 |
+
}
|
568 |
+
if(ck){
|
569 |
+
|
570 |
+
jQuery(".cwp-tax-"+val).show();
|
571 |
+
|
572 |
+
}else{
|
573 |
+
|
574 |
+
jQuery(".cwp-tax-"+val + " input").removeAttr("checked");
|
575 |
+
jQuery(".cwp-tax-"+val).hide();
|
576 |
+
|
577 |
+
}
|
578 |
|
579 |
+
});
|
580 |
// Starting the AJAX intro animation
|
581 |
function startAjaxIntro() {
|
582 |
jQuery(".cwp_top_wrapper .ajaxAnimation").fadeIn();
|
594 |
}
|
595 |
|
596 |
jQuery("body").on('click',function(e){
|
597 |
+
|
598 |
+
|
599 |
if (jQuery(e.target).parent().hasClass("cwp_preview_page")) {
|
600 |
e.preventDefault();
|
601 |
+
|
|
|
602 |
startAjaxIntro();
|
603 |
var service = jQuery(e.target).parent().attr('service');
|
604 |
var access_token = jQuery(e.target).parent().attr('pagetoken');
|
605 |
var page_id = jQuery(e.target).parent().attr('pageid');
|
606 |
+
|
607 |
jQuery.ajax({
|
608 |
+
type: "POST",
|
609 |
url: cwp_top_ajaxload.ajaxurl,
|
610 |
data: {
|
611 |
action: "add_pages",
|
618 |
},
|
619 |
success: function(response) {
|
620 |
switch (service) {
|
621 |
+
|
622 |
+
case 'facebook':
|
623 |
endAjaxIntro();
|
624 |
jQuery(".cwp_top_wrapper .cwp_user_pages").fadeOut().removeClass("active");
|
625 |
window.location.href = response;
|
626 |
break;
|
627 |
|
628 |
+
case 'linkedin':
|
629 |
endAjaxIntro();
|
630 |
jQuery(".cwp_top_wrapper .cwp_user_pages").fadeOut().removeClass("active");
|
631 |
window.location.href = response;
|
632 |
break;
|
633 |
}
|
634 |
+
|
635 |
},
|
636 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
637 |
console.log("There was an error: " + errorThrown);
|
639 |
});
|
640 |
return false;
|
641 |
}
|
642 |
+
|
643 |
});
|
644 |
|
645 |
// Select all function
|
648 |
if(jQuery(this).hasClass('active')) {
|
649 |
jQuery(this).removeClass('active').text('Select All');
|
650 |
jQuery(this).parent().parent().find('.right input[type=checkbox]').attr('checked', false);
|
651 |
+
} else {
|
652 |
jQuery(this).addClass('active').text('Deselect All');
|
653 |
jQuery(this).parent().parent().find('.right input[type=checkbox]').attr('checked', true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
}
|
655 |
});
|
656 |
+
jQuery(".option[data-dependent] select, .option[data-dependent] input[type='checkbox']").change(function(){
|
657 |
+
cwpDependeField(jQuery(this).closest('.option'));
|
658 |
+
});
|
659 |
+
|
660 |
+
jQuery("#cwp_top_tabs ul#tabs_menu li ").not(".not-tab").click(function() {
|
661 |
+
jQuery("#cwp_top_tabs ul#tabs_menu li").removeClass("active");
|
662 |
+
jQuery("#cwp_top_tabs div.tab").removeClass("active");
|
663 |
+
var th = jQuery(this);
|
664 |
+
var index = th.index();
|
665 |
+
th.addClass("active");
|
666 |
+
|
667 |
+
|
668 |
+
jQuery("#cwp_top_tabs div.tab").eq(index).addClass("active");
|
669 |
+
|
670 |
+
return false
|
671 |
+
});
|
672 |
+
jQuery(".cwp-schedule-days li").click(function(){
|
673 |
+
var th = jQuery(this);
|
674 |
+
if(th.hasClass("active")){
|
675 |
+
th.removeClass('active');
|
676 |
+
}else{
|
677 |
+
|
678 |
+
th.addClass('active');
|
679 |
+
}
|
680 |
+
|
681 |
+
})
|
682 |
+
jQuery(".cwp-schedule-days li").click(function(){
|
683 |
+
var container = jQuery(this).parent().parent();
|
684 |
+
cwpTopRefreshPostingDays(container);
|
685 |
+
|
686 |
+
})
|
687 |
+
jQuery(".cwp-populate-hidden-radio").click(function(){
|
688 |
+
var th = jQuery(this);
|
689 |
+
var id = th.attr('data-hidden');
|
690 |
+
var value = th.attr('data-value');
|
691 |
+
jQuery("#"+id).val(value);
|
692 |
+
|
693 |
+
})
|
694 |
+
jQuery(".cwp-populate-hidden-checkbox").click(function(){
|
695 |
+
var th = jQuery(this);
|
696 |
+
var id = th.parent().attr('data-hidden');
|
697 |
+
var values = [];
|
698 |
+
th.parent().find('.active').each(function(){
|
699 |
+
var ith = jQuery(this);
|
700 |
+
values.push(ith.attr('data-value'));
|
701 |
+
});
|
702 |
+
jQuery("#"+id).val(values.join(','));
|
703 |
+
|
704 |
+
})
|
705 |
+
jQuery(".cwp-according-item .cwp-according-header").click(function(){
|
706 |
+
|
707 |
+
var th = jQuery(this).parent();
|
708 |
+
if(th.hasClass('active')) return false;
|
709 |
+
var active = th.parent().children(".active");
|
710 |
+
|
711 |
+
|
712 |
+
active.find(".cwp-according-body").slideUp(100,function(){
|
713 |
+
active.removeClass('active');
|
714 |
+
});
|
715 |
+
th.find(".cwp-according-body").slideDown(100,function(){
|
716 |
+
th.addClass('active');
|
717 |
+
});
|
718 |
+
return false;
|
719 |
+
});
|
720 |
+
jQuery(".cwp_top_tabs_vertical .cwp_top_tabs_btns li ").not('.not-tab').click(function() {
|
721 |
+
|
722 |
+
var th = jQuery(this);
|
723 |
+
if(th.parent().parent().find(".tab-vertical").is(":animated")) return false;
|
724 |
+
var index = th.index();
|
725 |
+
th.parent().parent().find(".tab-vertical.active").fadeOut(200,function(){
|
726 |
+
jQuery(this).removeClass("active");
|
727 |
+
th.parent().find("li").removeClass("active");
|
728 |
+
th.parent().parent().find(".tab-vertical").eq(index).fadeIn(200,function(){
|
729 |
+
jQuery(this).addClass("active");
|
730 |
+
th.parent().find("li").eq(index).addClass("active");
|
731 |
+
} );
|
732 |
+
} );
|
733 |
+
|
734 |
+
|
735 |
+
return false
|
736 |
+
});
|
737 |
+
|
738 |
+
jQuery("#cwp_top_tabs").on("click",".cwp-top-times-close",function(){
|
739 |
+
var li = jQuery(this).parent();
|
740 |
+
li.remove();
|
741 |
+
cwpTopRefreshPostingDays( );
|
742 |
+
})
|
743 |
+
jQuery(".cwp-add-posting-time").click(function(){
|
744 |
+
|
745 |
+
var container = jQuery(this).parent().parent();
|
746 |
+
var network = jQuery(this).closest('.tab-vertical').attr('data-network');
|
747 |
+
container.find(".cwp-posting-times").append(getCwpTopTimeHTML(network));
|
748 |
+
|
749 |
+
cwpTopRefreshPostingDays(container);
|
750 |
+
return false;
|
751 |
+
})
|
752 |
+
cwpBindCheckedHidden();
|
753 |
+
cwpLoadPostFormaFields();
|
754 |
+
|
755 |
+
cwpTopBindTimes();
|
756 |
+
jQuery(".cwp-custom-schedule-days").each(function(){
|
757 |
+
var container = jQuery(this);
|
758 |
+
cwpTopRefreshPostingDays(container);
|
759 |
+
});
|
760 |
+
|
761 |
+
jQuery(".cwp-cpt-checkbox").each(function(){
|
762 |
+
var th = jQuery(this);
|
763 |
+
if(th.is(":checked")){
|
764 |
+
|
765 |
+
jQuery(".cwp-tax-"+th.val()).show();
|
766 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
767 |
}
|
|
|
|
|
|
|
|
|
768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
});
|
770 |
+
});
|
771 |
+
|
772 |
+
function cwpDependeField(field,second){
|
773 |
+
|
774 |
+
var dvalues = field.attr("data-dependent");
|
775 |
+
if(dvalues === undefined) return false;
|
776 |
+
var value;
|
777 |
+
|
778 |
+
if(field.find("select").length != 0 ){
|
779 |
+
|
780 |
+
value = field.find("select").val();
|
781 |
+
|
782 |
+
}
|
783 |
+
if(field.find("input[type='checkbox']").length != 0 ){
|
784 |
+
if(field.find("input[type='checkbox']").is(":checked")){
|
785 |
+
|
786 |
+
value = 'true';
|
787 |
+
|
788 |
+
}else{
|
789 |
+
|
790 |
+
value = 'false';
|
791 |
+
}
|
792 |
+
|
793 |
+
}
|
794 |
+
var json = JSON.parse(dvalues);
|
795 |
+
var item;
|
796 |
+
|
797 |
+
var tmpvalues;
|
798 |
+
jQuery.each(json,function(k,v){
|
799 |
+
item = field.parent().find(".twp"+k);
|
800 |
+
v = v.split(',');
|
801 |
+
if(jQuery.inArray(value,v) > -1 && !second){
|
802 |
+
item.slideDown('fast');
|
803 |
+
cwpDependeField(item);
|
804 |
+
}else{
|
805 |
+
|
806 |
+
item.slideUp('fast');
|
807 |
+
cwpDependeField(item,true);
|
808 |
+
}
|
809 |
+
|
810 |
+
});
|
811 |
+
|
812 |
+
}
|
813 |
+
function getCwpTopTimeHTML(network){
|
814 |
+
var cwp_top_time = '<li class="clearfix cwp-top-times-choice">\
|
815 |
+
<select class="cwp-top-times-hours" name="'+network+'_time_choice_hour[]">\
|
816 |
+
<option value="00">00</option>\
|
817 |
+
<option value="01">01</option>\
|
818 |
+
<option value="02">02</option>\
|
819 |
+
<option value="03">03</option>\
|
820 |
+
<option value="04">04</option>\
|
821 |
+
<option value="05">05</option>\
|
822 |
+
<option value="06">06</option>\
|
823 |
+
<option value="07">07</option>\
|
824 |
+
<option value="08">08</option>\
|
825 |
+
<option value="09">09</option>\
|
826 |
+
<option value="10">10</option>\
|
827 |
+
<option value="11">11</option>\
|
828 |
+
<option value="12">12</option>\
|
829 |
+
<option value="13">13</option>\
|
830 |
+
<option value="14">14</option>\
|
831 |
+
<option value="15">15</option>\
|
832 |
+
<option value="16">16</option>\
|
833 |
+
<option value="17">17</option>\
|
834 |
+
<option value="18">18</option>\
|
835 |
+
<option value="19">19</option>\
|
836 |
+
<option value="20">20</option>\
|
837 |
+
<option value="21">21</option>\
|
838 |
+
<option value="22">22</option>\
|
839 |
+
<option value="23">23</option>\
|
840 |
+
</select> : \
|
841 |
+
<select class="cwp-top-times-hours" name="'+network+'_time_choice_min[]">\
|
842 |
+
<option value="00">00</option>\
|
843 |
+
<option value="01">01</option>\
|
844 |
+
<option value="02">02</option>\
|
845 |
+
<option value="03">03</option>\
|
846 |
+
<option value="04">04</option>\
|
847 |
+
<option value="05">05</option>\
|
848 |
+
<option value="06">06</option>\
|
849 |
+
<option value="07">07</option>\
|
850 |
+
<option value="08">08</option>\
|
851 |
+
<option value="09">09</option>\
|
852 |
+
<option value="10">10</option>\
|
853 |
+
<option value="11">11</option>\
|
854 |
+
<option value="12">12</option>\
|
855 |
+
<option value="13">13</option>\
|
856 |
+
<option value="14">14</option>\
|
857 |
+
<option value="15">15</option>\
|
858 |
+
<option value="16">16</option>\
|
859 |
+
<option value="17">17</option>\
|
860 |
+
<option value="18">18</option>\
|
861 |
+
<option value="19">19</option>\
|
862 |
+
<option value="20">20</option>\
|
863 |
+
<option value="21">21</option>\
|
864 |
+
<option value="22">22</option>\
|
865 |
+
<option value="23">23</option>\
|
866 |
+
<option value="24">24</option>\
|
867 |
+
<option value="25">25</option>\
|
868 |
+
<option value="26">26</option>\
|
869 |
+
<option value="27">27</option>\
|
870 |
+
<option value="28">28</option>\
|
871 |
+
<option value="29">29</option>\
|
872 |
+
<option value="30">30</option>\
|
873 |
+
<option value="31">31</option>\
|
874 |
+
<option value="32">32</option>\
|
875 |
+
<option value="33">33</option>\
|
876 |
+
<option value="34">34</option>\
|
877 |
+
<option value="35">35</option>\
|
878 |
+
<option value="36">36</option>\
|
879 |
+
<option value="37">37</option>\
|
880 |
+
<option value="38">38</option>\
|
881 |
+
<option value="39">39</option>\
|
882 |
+
<option value="40">40</option>\
|
883 |
+
<option value="41">41</option>\
|
884 |
+
<option value="42">42</option>\
|
885 |
+
<option value="43">43</option>\
|
886 |
+
<option value="44">44</option>\
|
887 |
+
<option value="45">45</option>\
|
888 |
+
<option value="46">46</option>\
|
889 |
+
<option value="47">47</option>\
|
890 |
+
<option value="48">48</option>\
|
891 |
+
<option value="49">49</option>\
|
892 |
+
<option value="50">50</option>\
|
893 |
+
<option value="51">51</option>\
|
894 |
+
<option value="52">52</option>\
|
895 |
+
<option value="53">53</option>\
|
896 |
+
<option value="54">54</option>\
|
897 |
+
<option value="55">55</option>\
|
898 |
+
<option value="56">56</option>\
|
899 |
+
<option value="57">57</option>\
|
900 |
+
<option value="58">58</option>\
|
901 |
+
<option value="59">59</option>\
|
902 |
+
</select><span class="cwp-top-times-close">x</span>\
|
903 |
+
</li>';
|
904 |
+
return cwp_top_time;
|
905 |
+
}
|
906 |
+
function cwpBindCheckedHidden(){
|
907 |
+
jQuery(".cwp-populate-hidden-checkbox-group").each(function(){
|
908 |
+
var th = jQuery(this);
|
909 |
+
var field = th.attr('data-hidden');
|
910 |
+
var values = jQuery("#"+field).val();
|
911 |
+
values = values.split(',');
|
912 |
+
jQuery.each(values,function(k,v){
|
913 |
+
th.find(".cwp-populate-hidden-checkbox[data-value='"+v+"']").addClass('active');
|
914 |
+
});
|
915 |
+
|
916 |
+
})
|
917 |
+
|
918 |
+
}
|
919 |
+
|
920 |
+
function cwpTopBindTimes(){
|
921 |
+
|
922 |
+
jQuery(".cwp-posting-times").each(function(){
|
923 |
+
var network = jQuery(this).closest('.tab-vertical').attr('data-network');
|
924 |
+
var values = jQuery(this).attr('data-times');
|
925 |
+
var th = jQuery(this);
|
926 |
+
values = jQuery.parseJSON(values);
|
927 |
+
jQuery.each(values,function(k,v){
|
928 |
+
th.append(getCwpTopTimeHTML(network) );
|
929 |
+
th.find("li:last select:first").val(v.hour);
|
930 |
+
th.find("li:last select:last").val(v.minute);
|
931 |
+
});
|
932 |
+
|
933 |
+
|
934 |
+
})
|
935 |
+
|
936 |
+
}
|
937 |
+
function cwpTopRefreshPostingDays(container){
|
938 |
+
if(container === undefined){
|
939 |
+
jQuery(".cwp-custom-schedule-days").each(function(){
|
940 |
+
var container = jQuery(this);
|
941 |
+
cwpTopRefreshPostingDays(container);
|
942 |
+
})
|
943 |
+
return false;
|
944 |
+
}
|
945 |
+
var times = container.find(".cwp-top-times-choice").length;
|
946 |
+
var days = [];
|
947 |
+
var day = "";
|
948 |
+
container.find('.cwp-populate-hidden-checkbox.active').each(function(){
|
949 |
+
day = jQuery(this).text().substr(0,3);
|
950 |
+
days.push(day);
|
951 |
+
});
|
952 |
+
container.find(".cwp-posts-time-info-days").text(days.join(","));
|
953 |
+
container.find(".cwp-posts-time-info-times").text(times);
|
954 |
+
}
|
955 |
+
function cwpLoadPostFormaFields(){
|
956 |
+
jQuery(".option[data-dependent], .option[data-dependent] ").each(function(){
|
957 |
+
cwpDependeField(jQuery(this));
|
958 |
+
|
959 |
+
})
|
960 |
+
|
961 |
+
}
|
962 |
+
function showCWPROPError(string){
|
963 |
+
jQuery(".cwp_top_status p.cwp-error-label").css( "color", "red" );
|
964 |
+
jQuery(".cwp_top_status p.cwp-error-label").html(string);
|
965 |
+
|
966 |
+
}
|
967 |
+
function cwpTopCheckAccounts(){
|
968 |
+
var users = jQuery(".user_details").length;
|
969 |
+
return (users > 0);
|
970 |
+
|
971 |
+
}
|
972 |
+
function clearNotices(){
|
973 |
+
jQuery("#rop-log-list").html('');
|
974 |
+
jQuery(".rop-error-log span").html('').addClass("no-error");
|
975 |
+
jQuery(".active-rop-error-label").hide();
|
976 |
+
jQuery(".inactive-rop-error-label").show();
|
977 |
+
|
978 |
+
|
979 |
+
}
|
readme.txt
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
=== Revive Old Post (Former Tweet Old Post) ===
|
2 |
-
Contributors: codeinwp
|
3 |
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
|
4 |
Requires at least: 2.7
|
5 |
-
|
6 |
-
Tested up to: 4.0
|
7 |
Stable tag: trunk
|
8 |
|
9 |
|
@@ -17,7 +16,7 @@ Plugin to share about your old posts on twitter, facebook, linkedin to get more
|
|
17 |
|
18 |
Using the <a href="https://themeisle.com/plugins/tweet-old-post-pro/?ref=1">PRO version</a> of the plugin you will unleash the most important functionality : images in tweets . Using those your RT/CTR will go crazy.
|
19 |
|
20 |
-
Other notable features :
|
21 |
|
22 |
* Multiple Social Accounts
|
23 |
* Custom Post Types support
|
@@ -33,11 +32,9 @@ For updates follow https://twitter.com/themeisle If you have anything you can le
|
|
33 |
ThemeIsle is a <a href="https://www.codeinwp.com">Codeinwp</a> product.
|
34 |
|
35 |
|
36 |
-
|
37 |
**Fortcoming**
|
38 |
|
39 |
-
-
|
40 |
-
- Posts queue
|
41 |
- Different post content for each account
|
42 |
|
43 |
|
@@ -51,6 +48,7 @@ ThemeIsle is a <a href="https://www.codeinwp.com">Codeinwp</a> product.
|
|
51 |
- Exclude categories
|
52 |
- Exclude specific posts.
|
53 |
|
|
|
54 |
= Translations =
|
55 |
|
56 |
* sk_SK translation by Patrik Žec (PATWIST) of http://patwist.com
|
@@ -60,7 +58,7 @@ ThemeIsle is a <a href="https://www.codeinwp.com">Codeinwp</a> product.
|
|
60 |
Following are the steps to install the Revive Old Post plugin
|
61 |
|
62 |
1. Download the latest version of the Revive Old Posts Plugin to your computer from here.
|
63 |
-
2. With an FTP program, access your
|
64 |
3. Upload (copy) the Plugin file(s) or folder to the /wp-content/plugins folder.
|
65 |
4. In your WordPress Administration Panels, click on Plugins from the menu.
|
66 |
5. You should see Revive Old Posts Plugin listed. If not, with your FTP program, check the folder to see if it is installed. If it isn�t, upload the file(s) again. If it is, delete the files and upload them again.
|
@@ -120,7 +118,7 @@ Please note: Despite the fact that error is saying "might be automated", it does
|
|
120 |
|
121 |
**Any more questions or doubts?**
|
122 |
|
123 |
-
- Contact us at https://themeisle.com/contact/
|
124 |
|
125 |
|
126 |
|
@@ -129,13 +127,51 @@ Please note: Despite the fact that error is saying "might be automated", it does
|
|
129 |
1. Screenshot 1 Basic configurable options for Tweet Old Post to function, with ability to tweet at random interval.
|
130 |
|
131 |
|
132 |
-
for more you can check out
|
133 |
|
134 |
https://themeisle.com/plugins/tweet-old-post-lite/
|
135 |
|
136 |
|
137 |
== Changelog ==
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
**New in v6.8.2**
|
140 |
|
141 |
Fixed no available posts issue
|
@@ -218,14 +254,14 @@ Fixed exclude categories error, added wp short url, fixed oauth error, removed b
|
|
218 |
|
219 |
**New in v4.0.9**
|
220 |
|
221 |
-
- Resolved twitter connectivity issue, for users who were not able to connect in 4.0.8. Twitter has changed their policy
|
222 |
as per https://dev.twitter.com/discussions/24239
|
223 |
|
224 |
|
225 |
|
226 |
**New in v4.0.8**
|
227 |
|
228 |
-
- Resolved twitter connectivity issue. Twitter has changed their policy
|
229 |
as per https://dev.twitter.com/discussions/24239
|
230 |
|
231 |
|
@@ -281,7 +317,7 @@ as per https://dev.twitter.com/discussions/24239
|
|
281 |
|
282 |
**New in v4.0.0**
|
283 |
|
284 |
-
- You can now change the application name. Change via Tweet Old Post to your specified name. Follow the Steps here,
|
285 |
http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
286 |
- Pages can now be included in tweets. Added an option to select what is to be tweeted (pages, posts, or both).
|
287 |
- Removed "." and used "-" when adding additional text, "." was causing grammatical mistakes if sentence was trimmed.
|
@@ -301,7 +337,7 @@ http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
|
301 |
- Resolved too many redirects issue
|
302 |
If its still not working try these steps
|
303 |
- Make sure "Tweet Old Post Admin URL (Current URL)" is showing your current URL.
|
304 |
-
- Click on "Update Tweet Old Post Options".
|
305 |
- Try to authorize again.
|
306 |
- Removed "_" from hashtags. Previously space in hashtag was replaced with "_". Now there will be no spaces or "_" in hashtags.
|
307 |
|
@@ -493,13 +529,13 @@ http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
|
493 |
|
494 |
**New in v4.0.9**
|
495 |
|
496 |
-
- Resolved twitter connectivity issue, for users who were not able to connect in 4.0.8. Twitter has changed their policy
|
497 |
as per https://dev.twitter.com/discussions/24239
|
498 |
|
499 |
|
500 |
**New in v4.0.8**
|
501 |
|
502 |
-
- Resolved twitter connectivity issue. Twitter has changed their policy
|
503 |
as per https://dev.twitter.com/discussions/24239
|
504 |
|
505 |
|
@@ -554,7 +590,7 @@ as per https://dev.twitter.com/discussions/24239
|
|
554 |
|
555 |
**New in v4.0.0**
|
556 |
|
557 |
-
- You can now change the application name. Change via Tweet Old Post to your specified name. Follow the Steps here,
|
558 |
http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
559 |
- Pages can now be included in tweets. Added an option to select what is to be tweeted (pages, posts, or both).
|
560 |
- Removed "." and used "-" when adding additional text, "." was causing grammatical mistakes if sentence was trimmed.
|
@@ -572,7 +608,7 @@ http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
|
572 |
- Resolved too many redirects issue
|
573 |
If its still not working try these steps
|
574 |
- Make sure "Tweet Old Post Admin URL (Current URL)" is showing your current URL.
|
575 |
-
- Click on "Update Tweet Old Post Options".
|
576 |
- Try to authorize again.
|
577 |
- Removed "_" from hashtags. Previously space in hashtag was replaced with "_". Now there will be no spaces or "_" in hashtags.
|
578 |
|
1 |
=== Revive Old Post (Former Tweet Old Post) ===
|
2 |
+
Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani
|
3 |
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
|
4 |
Requires at least: 2.7
|
5 |
+
Tested up to: 4.1
|
|
|
6 |
Stable tag: trunk
|
7 |
|
8 |
|
16 |
|
17 |
Using the <a href="https://themeisle.com/plugins/tweet-old-post-pro/?ref=1">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
|
32 |
ThemeIsle is a <a href="https://www.codeinwp.com">Codeinwp</a> product.
|
33 |
|
34 |
|
|
|
35 |
**Fortcoming**
|
36 |
|
37 |
+
- Posts queue
|
|
|
38 |
- Different post content for each account
|
39 |
|
40 |
|
48 |
- Exclude categories
|
49 |
- Exclude specific posts.
|
50 |
|
51 |
+
|
52 |
= Translations =
|
53 |
|
54 |
* sk_SK translation by Patrik Žec (PATWIST) of http://patwist.com
|
58 |
Following are the steps to install the Revive Old Post plugin
|
59 |
|
60 |
1. Download the latest version of the Revive Old Posts Plugin to your computer from here.
|
61 |
+
2. With an FTP program, access your sites server.
|
62 |
3. Upload (copy) the Plugin file(s) or folder to the /wp-content/plugins folder.
|
63 |
4. In your WordPress Administration Panels, click on Plugins from the menu.
|
64 |
5. You should see Revive Old Posts Plugin listed. If not, with your FTP program, check the folder to see if it is installed. If it isn�t, upload the file(s) again. If it is, delete the files and upload them again.
|
118 |
|
119 |
**Any more questions or doubts?**
|
120 |
|
121 |
+
- Contact us at https://themeisle.com/contact/
|
122 |
|
123 |
|
124 |
|
127 |
1. Screenshot 1 Basic configurable options for Tweet Old Post to function, with ability to tweet at random interval.
|
128 |
|
129 |
|
130 |
+
for more you can check out
|
131 |
|
132 |
https://themeisle.com/plugins/tweet-old-post-lite/
|
133 |
|
134 |
|
135 |
== Changelog ==
|
136 |
|
137 |
+
**New in v6.9.6.2**
|
138 |
+
|
139 |
+
* Fixed issue with the is.gd shortner refresh
|
140 |
+
|
141 |
+
**New in v6.9.6**
|
142 |
+
|
143 |
+
* Fixed issue cron stop
|
144 |
+
* Fixed issue for excluded post
|
145 |
+
* Added exclude posts from custom post types.
|
146 |
+
|
147 |
+
|
148 |
+
**New in v6.9.4**
|
149 |
+
|
150 |
+
* Fixed issue with share more than once option
|
151 |
+
|
152 |
+
|
153 |
+
**New in v6.9.3**
|
154 |
+
|
155 |
+
* Improved logging system
|
156 |
+
* Fixed vulnerability issue with update options
|
157 |
+
* Fixed issues with custom schedule timing
|
158 |
+
* Improved excluded category design
|
159 |
+
* Fixed excluded post selection issue
|
160 |
+
|
161 |
+
|
162 |
+
**New in v6.8.8**
|
163 |
+
|
164 |
+
Added a more complex logging system
|
165 |
+
Fixed multiple accounts/posts issue
|
166 |
+
Fixed 404 twitter login error
|
167 |
+
|
168 |
+
**New in v6.8.5**
|
169 |
+
|
170 |
+
Completely reworked how cron is working
|
171 |
+
Separated post format by network
|
172 |
+
Added support for custom schedule
|
173 |
+
Added remote cron trigger feature
|
174 |
+
|
175 |
**New in v6.8.2**
|
176 |
|
177 |
Fixed no available posts issue
|
254 |
|
255 |
**New in v4.0.9**
|
256 |
|
257 |
+
- Resolved twitter connectivity issue, for users who were not able to connect in 4.0.8. Twitter has changed their policy
|
258 |
as per https://dev.twitter.com/discussions/24239
|
259 |
|
260 |
|
261 |
|
262 |
**New in v4.0.8**
|
263 |
|
264 |
+
- Resolved twitter connectivity issue. Twitter has changed their policy
|
265 |
as per https://dev.twitter.com/discussions/24239
|
266 |
|
267 |
|
317 |
|
318 |
**New in v4.0.0**
|
319 |
|
320 |
+
- You can now change the application name. Change via Tweet Old Post to your specified name. Follow the Steps here,
|
321 |
http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
322 |
- Pages can now be included in tweets. Added an option to select what is to be tweeted (pages, posts, or both).
|
323 |
- Removed "." and used "-" when adding additional text, "." was causing grammatical mistakes if sentence was trimmed.
|
337 |
- Resolved too many redirects issue
|
338 |
If its still not working try these steps
|
339 |
- Make sure "Tweet Old Post Admin URL (Current URL)" is showing your current URL.
|
340 |
+
- Click on "Update Tweet Old Post Options".
|
341 |
- Try to authorize again.
|
342 |
- Removed "_" from hashtags. Previously space in hashtag was replaced with "_". Now there will be no spaces or "_" in hashtags.
|
343 |
|
529 |
|
530 |
**New in v4.0.9**
|
531 |
|
532 |
+
- Resolved twitter connectivity issue, for users who were not able to connect in 4.0.8. Twitter has changed their policy
|
533 |
as per https://dev.twitter.com/discussions/24239
|
534 |
|
535 |
|
536 |
**New in v4.0.8**
|
537 |
|
538 |
+
- Resolved twitter connectivity issue. Twitter has changed their policy
|
539 |
as per https://dev.twitter.com/discussions/24239
|
540 |
|
541 |
|
590 |
|
591 |
**New in v4.0.0**
|
592 |
|
593 |
+
- You can now change the application name. Change via Tweet Old Post to your specified name. Follow the Steps here,
|
594 |
http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
595 |
- Pages can now be included in tweets. Added an option to select what is to be tweeted (pages, posts, or both).
|
596 |
- Removed "." and used "-" when adding additional text, "." was causing grammatical mistakes if sentence was trimmed.
|
608 |
- Resolved too many redirects issue
|
609 |
If its still not working try these steps
|
610 |
- Make sure "Tweet Old Post Admin URL (Current URL)" is showing your current URL.
|
611 |
+
- Click on "Update Tweet Old Post Options".
|
612 |
- Try to authorize again.
|
613 |
- Removed "_" from hashtags. Previously space in hashtag was replaced with "_". Now there will be no spaces or "_" in hashtags.
|
614 |
|
tweet-old-post.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
# /*
|
3 |
-
# Plugin Name: Revive Old Post (Former Tweet Old Post)
|
4 |
-
# Plugin URI: https://themeisle.com/plugins/tweet-old-post-lite/
|
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="https://themeisle.com/contact/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
|
6 |
-
# Author: ThemeIsle
|
7 |
-
# Version: 6.
|
8 |
-
# Author URI: https://themeisle.com/
|
9 |
-
# Text Domain: tweet-old-post
|
10 |
-
# Domain Path: /languages
|
11 |
-
# */
|
12 |
-
|
13 |
-
// Config Constants
|
14 |
-
define("ROPPLUGINPATH", realpath(dirname(__FILE__) ));
|
15 |
-
define("ROPCSSFILE", plugins_url('css/style.css',__FILE__ ));
|
16 |
-
define("ROPCUSTOMDASHBOARDICON", plugins_url("css/custom_dashboard_icon.css", __FILE__));
|
17 |
-
define("ROPJSFILE", plugins_url('js/master.js',__FILE__ ));
|
18 |
-
define("ROPJSCOUNTDOWN", plugins_url('js/countdown.js',__FILE__ ));
|
19 |
-
define("ROPPLUGINBASENAME", plugin_basename(__FILE__));
|
20 |
-
define('ROP_TOP_FB_API_VERSION','v2.0');
|
21 |
-
// Require core.
|
22 |
-
require_once(ROPPLUGINPATH."/inc/core.php");
|
23 |
-
// Require core.
|
24 |
-
require_once(ROPPLUGINPATH."/inc/exclude-posts.php");
|
25 |
-
if (!class_exists('TAV_Remote_Notification_Client')) {
|
26 |
-
require( ROPPLUGINPATH.'/inc/class-remote-notification-client.php' );
|
27 |
-
}
|
28 |
-
if (
|
29 |
-
$notification = new TAV_Remote_Notification_Client( 37, 'a8be784b898fa2fb', 'https://themeisle.com?post_type=notification' );
|
30 |
-
else
|
31 |
-
$notification = new TAV_Remote_Notification_Client( 38, 'b7fbcc8d0c58614a', 'https://themeisle.com?post_type=notification' );
|
32 |
-
|
33 |
-
// Clear scheduled tweets on plugin deactivation
|
34 |
-
register_deactivation_hook(__FILE__, array($CWP_TOP_Core, 'deactivationHook'));
|
35 |
-
|
36 |
-
// Reset all settings on plugin activation.
|
37 |
-
register_activation_hook(__FILE__, array($CWP_TOP_Core, 'resetAllOptions'));
|
38 |
-
|
39 |
-
add_action("admin_head", array($CWP_TOP_Core, 'rop_load_dashboard_icon'));
|
1 |
+
<?php
|
2 |
+
# /*
|
3 |
+
# Plugin Name: Revive Old Post (Former Tweet Old Post)
|
4 |
+
# Plugin URI: https://themeisle.com/plugins/tweet-old-post-lite/
|
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="https://themeisle.com/contact/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
|
6 |
+
# Author: ThemeIsle
|
7 |
+
# Version: 6.9.6.3
|
8 |
+
# Author URI: https://themeisle.com/
|
9 |
+
# Text Domain: tweet-old-post
|
10 |
+
# Domain Path: /languages
|
11 |
+
# */
|
12 |
+
|
13 |
+
// Config Constants
|
14 |
+
define("ROPPLUGINPATH", realpath(dirname(__FILE__) ));
|
15 |
+
define("ROPCSSFILE", plugins_url('css/style.css',__FILE__ ));
|
16 |
+
define("ROPCUSTOMDASHBOARDICON", plugins_url("css/custom_dashboard_icon.css", __FILE__));
|
17 |
+
define("ROPJSFILE", plugins_url('js/master.js',__FILE__ ));
|
18 |
+
define("ROPJSCOUNTDOWN", plugins_url('js/countdown.js',__FILE__ ));
|
19 |
+
define("ROPPLUGINBASENAME", plugin_basename(__FILE__));
|
20 |
+
define('ROP_TOP_FB_API_VERSION','v2.0');
|
21 |
+
// Require core.
|
22 |
+
require_once(ROPPLUGINPATH."/inc/core.php");
|
23 |
+
// Require core.
|
24 |
+
require_once(ROPPLUGINPATH."/inc/exclude-posts.php");
|
25 |
+
if (!class_exists('TAV_Remote_Notification_Client')) {
|
26 |
+
require( ROPPLUGINPATH.'/inc/class-remote-notification-client.php' );
|
27 |
+
}
|
28 |
+
if (CWP_TOP_PRO)
|
29 |
+
$notification = new TAV_Remote_Notification_Client( 37, 'a8be784b898fa2fb', 'https://themeisle.com?post_type=notification' );
|
30 |
+
else
|
31 |
+
$notification = new TAV_Remote_Notification_Client( 38, 'b7fbcc8d0c58614a', 'https://themeisle.com?post_type=notification' );
|
32 |
+
|
33 |
+
// Clear scheduled tweets on plugin deactivation
|
34 |
+
register_deactivation_hook(__FILE__, array($CWP_TOP_Core, 'deactivationHook'));
|
35 |
+
|
36 |
+
// Reset all settings on plugin activation.
|
37 |
+
register_activation_hook(__FILE__, array($CWP_TOP_Core, 'resetAllOptions'));
|
38 |
+
|
39 |
+
add_action("admin_head", array($CWP_TOP_Core, 'rop_load_dashboard_icon'));
|