Version Description
Download this release
Release Info
Developer | codeinwp |
Plugin | Revive Old Posts – Auto Post to Social Media |
Version | 6.8 |
Comparing to | |
See all releases |
Code changes from version 6.7.4 to 6.8
- assets/rop-custom-icon-font.eot +0 -0
- assets/rop-custom-icon-font.svg +11 -0
- assets/rop-custom-icon-font.ttf +0 -0
- assets/rop-custom-icon-font.woff +0 -0
- css/custom_dashboard_icon.css +5 -0
- css/style.css +89 -24
- img/icon_facebook.gif +0 -0
- img/linkedIn.png +0 -0
- img/logo.png +0 -0
- img/rop-icons.png +0 -0
- img/upgrade-top.png +0 -0
- inc/class-remote-notification-client.php +54 -13
- inc/config.php +34 -18
- inc/core.php +543 -79
- inc/exclude-posts.php +366 -366
- inc/oAuth/OAuth.php +69 -69
- inc/oAuth/twitteroauth.php +21 -21
- inc/view-exclude.php +45 -45
- inc/view.php +193 -19
- inc/xml.php +129 -129
- js/countdown.js +1 -1
- js/master.js +234 -38
- readme.txt +693 -762
- tweet-old-post.php +15 -13
assets/rop-custom-icon-font.eot
ADDED
Binary file
|
assets/rop-custom-icon-font.svg
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Generated by Fontastic.me</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="untitled-font-2" horiz-adv-x="512">
|
7 |
+
<font-face font-family="untitled-font-2" units-per-em="512" ascent="480" descent="-32"/>
|
8 |
+
<missing-glyph horiz-adv-x="512" />
|
9 |
+
|
10 |
+
<glyph unicode="a" d="M264 478c-132 0-239-107-239-239 0-132 107-239 239-239 131 0 239 107 239 239 0 132-108 239-239 239z m0-72c94 0 171-68 171-170l-61 0-43-37-109 114-68-77-62 0c0 102 77 170 172 170z m0-343c-87 0-158 70-170 147l72 0 57 66 107-114 55 48 49 0c-13-77-84-147-170-147z"/>
|
11 |
+
</font></defs></svg>
|
assets/rop-custom-icon-font.ttf
ADDED
Binary file
|
assets/rop-custom-icon-font.woff
ADDED
Binary file
|
css/custom_dashboard_icon.css
ADDED
@@ -0,0 +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; }
|
css/style.css
CHANGED
@@ -4,7 +4,9 @@
|
|
4 |
html[xmlns] .clearfix { display: block;}
|
5 |
* html .clearfix{ height: 1%;}
|
6 |
.clearfix { display: block; }
|
7 |
-
|
|
|
|
|
8 |
/* Padding Fix */
|
9 |
* { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; }
|
10 |
|
@@ -16,7 +18,9 @@ html[xmlns] .clearfix { display: block;}
|
|
16 |
.cwp_top_wrapper .cwp_top_status p { margin: 0; padding: 10px; text-align: center; font-family: "Roboto", sans-serif; color:#fff; }
|
17 |
.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; }
|
18 |
.cwp_top_wrapper .cwp_top_status p.inactive { background: rgb(240, 240, 240);box-shadow: inset 0px 0px 6px rgba(0,0,0,0.1);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 #fff; }
|
19 |
-
|
|
|
|
|
20 |
/* Ajax Animation */
|
21 |
.cwp_top_wrapper .ajaxAnimation { background: url("../img/loader.gif") no-repeat center center, rgba(255,255,255,0.8); position: absolute;top: 0; left: 0; right: 0; bottom: 0; display: none;}
|
22 |
|
@@ -26,6 +30,18 @@ html[xmlns] .clearfix { display: block;}
|
|
26 |
.cwp_top_container button#twitter-login.another-account { border:1px solid #ddd; box-shadow: none; border-radius: 3px; background-image: none; display: block; padding: 0; height: 35px; width: 35px; font-weight: 100; }
|
27 |
.cwp_top_container button#twitter-login.another-account:hover { opacity: 0.8; }
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/* Logged In User */
|
30 |
.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;}
|
31 |
.cwp_top_container .user_details .user_avatar { float: left; width: 35px;}
|
@@ -44,7 +60,7 @@ html[xmlns] .clearfix { display: block;}
|
|
44 |
|
45 |
/* Header Styles */
|
46 |
.cwp_top_wrapper #cwp_top_header { background:#fff; border-top: 5px solid #52aae2; border-bottom: 1px solid #d4d4d4; margin-top: 10px; padding: 20px 10px;}
|
47 |
-
.cwp_top_wrapper #cwp_top_header .
|
48 |
.cwp_top_wrapper #cwp_top_header .slogan { float: left; margin: 0; padding: 0; font-size: 17px; color:#858585; font-family: "Open Sans", sans-serif; line-height: 3.5; margin-left: 10px; }
|
49 |
.cwp_top_wrapper #cwp_top_header .slogan a { color:#858585; font-weight: 600; text-decoration: none; font-style: italic; -webkit-transition: all 0.250s ease-in-out; -moz-transition: all 0.250s ease-in-out; -o-transition: all 0.250s ease-in-out; transition: all 0.250s ease-in-out; }
|
50 |
.cwp_top_wrapper #cwp_top_header .slogan a:hover { color:#52aae2; }
|
@@ -59,18 +75,18 @@ html[xmlns] .clearfix { display: block;}
|
|
59 |
/* Container and form styles */
|
60 |
.cwp_top_wrapper .cwp_top_container { background:#f9f9f9; border-bottom: 5px solid #52aae2; position: relative;}
|
61 |
.cwp_top_wrapper .cwp_top_container form { width: 73%; float: left; border-right: 1px solid #d4d4d4;}
|
62 |
-
.cwp_top_wrapper
|
63 |
-
.cwp_top_wrapper
|
64 |
-
.cwp_top_wrapper
|
65 |
-
.cwp_top_wrapper
|
66 |
-
.cwp_top_wrapper
|
67 |
-
.cwp_top_wrapper
|
68 |
-
.cwp_top_wrapper
|
69 |
-
.cwp_top_wrapper
|
70 |
-
.cwp_top_wrapper
|
71 |
-
.cwp_top_wrapper
|
72 |
-
.cwp_top_wrapper
|
73 |
-
.cwp_top_wrapper
|
74 |
|
75 |
/* Sidebar Styles */
|
76 |
.cwp_top_wrapper .cwp_top_container .sidebar { float: left; width: 27%; padding: 10px}
|
@@ -88,7 +104,7 @@ html[xmlns] .clearfix { display: block;}
|
|
88 |
/* Tweet Now Button Style */
|
89 |
.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; }
|
90 |
.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; }
|
91 |
-
.top_close_popup {margin-left:
|
92 |
/* Stop Tweet Button Styles */
|
93 |
.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; }
|
94 |
.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; }
|
@@ -103,13 +119,46 @@ html[xmlns] .clearfix { display: block;}
|
|
103 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer a { margin: 0 !important; padding: 0; margin-right: 10px !important; }
|
104 |
|
105 |
/* Sample Tweet Preview Modal */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
.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; }
|
107 |
-
|
108 |
-
|
109 |
-
.
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
.top_preview {
|
114 |
width: 40px;
|
115 |
height: 40px;
|
@@ -133,7 +182,23 @@ float: left;}
|
|
133 |
.twptop_opt_post_type {
|
134 |
display: none;
|
135 |
}
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
@media all and (max-width:1280px) {
|
138 |
.cwp_top_wrapper {
|
139 |
width:100%;
|
@@ -152,4 +217,4 @@ float: left;}
|
|
152 |
.slogan {
|
153 |
display: none;
|
154 |
}
|
155 |
-
}
|
4 |
html[xmlns] .clearfix { display: block;}
|
5 |
* html .clearfix{ height: 1%;}
|
6 |
.clearfix { display: block; }
|
7 |
+
strong {
|
8 |
+
font-weight: 900;
|
9 |
+
}
|
10 |
/* Padding Fix */
|
11 |
* { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; }
|
12 |
|
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);box-shadow: inset 0px 0px 6px rgba(0,0,0,0.1);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 #fff; }
|
21 |
+
.cwp_top_wrapper a {
|
22 |
+
text-decoration: none!important;
|
23 |
+
}
|
24 |
/* Ajax Animation */
|
25 |
.cwp_top_wrapper .ajaxAnimation { background: url("../img/loader.gif") no-repeat center center, rgba(255,255,255,0.8); position: absolute;top: 0; left: 0; right: 0; bottom: 0; display: none;}
|
26 |
|
30 |
.cwp_top_container button#twitter-login.another-account { border:1px solid #ddd; box-shadow: none; border-radius: 3px; background-image: none; display: block; padding: 0; height: 35px; width: 35px; font-weight: 100; }
|
31 |
.cwp_top_container button#twitter-login.another-account:hover { opacity: 0.8; }
|
32 |
|
33 |
+
/* Facebook Login Button */
|
34 |
+
.cwp_top_container button#facebook-login { background:none; border: none; background:url("../img/icon_facebook.gif") no-repeat left 10px center, #fff; padding: 10px 15px 10px 35px; font-weight: bold; font-family: "HelveticaNeue", "Helvetica Neue", Arial, sans-serif; font-size: 1em; line-height: 1; color:#696969; border-radius: 10px; border: 1px solid #f7f7f7; -webkit-transition: all 0.3s ease-in-out;-moz-transition: all 0.3s ease-in-out;-o-transition: all 0.3s ease-in-out;transition: all 0.3s ease-in-out; box-shadow: inset 0px 0px 3px rgba(0,0,0,0.5); }
|
35 |
+
.cwp_top_container button#facebook-login:hover { cursor: pointer; background:url("../img/icon_facebook.gif") no-repeat left 10px center, #f7f7f7; box-shadow: inset 0px 0px 3px rgba(0,0,0,0.5); border: 1px solid #f7f7f7; text-shadow: 0px 1px 0px rgba(255,255,255,1);}
|
36 |
+
.cwp_top_container button#facebook-login.another-account { border:1px solid #ddd; box-shadow: none; border-radius: 3px; background-image: none; display: block; padding: 0; height: 35px; width: 35px; font-weight: 100; }
|
37 |
+
.cwp_top_container button#facebook-login.another-account:hover { opacity: 0.8; }
|
38 |
+
|
39 |
+
/* Linkedin Login Button */
|
40 |
+
.cwp_top_container button#linkedin-login { background:none; border: none; background:url("../img/linkedIn.png") no-repeat left 10px center, #fff; padding: 10px 15px 10px 35px; font-weight: bold; font-family: "HelveticaNeue", "Helvetica Neue", Arial, sans-serif; font-size: 1em; line-height: 1; color:#696969; border-radius: 10px; border: 1px solid #f7f7f7; -webkit-transition: all 0.3s ease-in-out;-moz-transition: all 0.3s ease-in-out;-o-transition: all 0.3s ease-in-out;transition: all 0.3s ease-in-out; box-shadow: inset 0px 0px 3px rgba(0,0,0,0.5); }
|
41 |
+
.cwp_top_container button#linkedin-login:hover { cursor: pointer; background:url("../img/linkedIn.png") no-repeat left 10px center, #f7f7f7; box-shadow: inset 0px 0px 3px rgba(0,0,0,0.5); border: 1px solid #f7f7f7; text-shadow: 0px 1px 0px rgba(255,255,255,1);}
|
42 |
+
.cwp_top_container button#linkedin-login.another-account { border:1px solid #ddd; box-shadow: none; border-radius: 3px; background-image: none; display: block; padding: 0; height: 35px; width: 35px; font-weight: 100; }
|
43 |
+
.cwp_top_container button#linkedin-login.another-account:hover { opacity: 0.8; }
|
44 |
+
|
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;}
|
60 |
|
61 |
/* Header Styles */
|
62 |
.cwp_top_wrapper #cwp_top_header { background:#fff; border-top: 5px solid #52aae2; border-bottom: 1px solid #d4d4d4; margin-top: 10px; padding: 20px 10px;}
|
63 |
+
.cwp_top_wrapper #cwp_top_header .top_logo { margin: 0; padding: 0; float: left; font-family: "Open Sans", sans-serif; font-weight: bold; color:#3c3c3c; padding-left: 55px; background:url("../img/logo.png") no-repeat left center; padding: 20px; padding-left: 60px; padding-right: 0; letter-spacing: -1px; margin-left: 14px; }
|
64 |
.cwp_top_wrapper #cwp_top_header .slogan { float: left; margin: 0; padding: 0; font-size: 17px; color:#858585; font-family: "Open Sans", sans-serif; line-height: 3.5; margin-left: 10px; }
|
65 |
.cwp_top_wrapper #cwp_top_header .slogan a { color:#858585; font-weight: 600; text-decoration: none; font-style: italic; -webkit-transition: all 0.250s ease-in-out; -moz-transition: all 0.250s ease-in-out; -o-transition: all 0.250s ease-in-out; transition: all 0.250s ease-in-out; }
|
66 |
.cwp_top_wrapper #cwp_top_header .slogan a:hover { color:#52aae2; }
|
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: 73%; 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; }
|
81 |
+
.cwp_top_wrapper .option .left .select-all:hover { cursor: pointer; }
|
82 |
+
.cwp_top_wrapper .option label { font-family: "Helvetica Neue", HelveticaNeue, sans-serif; font-size: 15px; color:#525252; }
|
83 |
+
.cwp_top_wrapper .option input[type=text], .cwp_top_wrapper .cwp_top_container form .option select { height: 35px; border-radius: 3px; border: 1px solid #d7d7d7; box-shadow: none; font-family: "Roboto", sans-serif; }
|
84 |
+
.cwp_top_wrapper .option input[type=text] { width: 90%; }
|
85 |
+
.cwp_top_wrapper .option .left * { display: block; text-align: right; }
|
86 |
+
.cwp_top_wrapper .option .right { float: left; width: 55%; padding-left: 20px; }
|
87 |
+
.cwp_top_wrapper .option .categories-list { padding-top: 4px; }
|
88 |
+
.cwp_top_wrapper .option .categories-list .cwp-cat { float: left; width: 50%; margin-bottom: 5px; }
|
89 |
+
.cwp_top_wrapper .option .categories-list .cwp-cat label { font-size: 13px; }
|
90 |
|
91 |
/* Sidebar Styles */
|
92 |
.cwp_top_wrapper .cwp_top_container .sidebar { float: left; width: 27%; padding: 10px}
|
104 |
/* Tweet Now Button Style */
|
105 |
.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; }
|
106 |
.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; }
|
107 |
+
.top_close_popup {margin-left:37%;float:left;}
|
108 |
/* Stop Tweet Button Styles */
|
109 |
.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; }
|
110 |
.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; }
|
119 |
.cwp_top_wrapper .cwp_top_container .cwp_top_footer a { margin: 0 !important; padding: 0; margin-right: 10px !important; }
|
120 |
|
121 |
/* Sample Tweet Preview Modal */
|
122 |
+
.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; }
|
123 |
+
|
124 |
+
.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; }
|
125 |
+
.cwp_top_wrapper .cwp_sample_tweet_preview_inner h2 { text-align: center; font-weight: bold;color:#7d7d7d; font-family: "HelveticaNeue", "Helvetica Neue", sans-serif; }
|
126 |
+
.cwp_top_wrapper .cwp_sample_tweet_preview_inner { background:#fff; width: 80%; margin: 0 auto; margin-top: 759px; padding: 20px; border-radius: 5px;box-shadow: 0px 5px 5px rgba(0,0,0,0.1); }
|
127 |
+
.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;}
|
128 |
+
.cwp_top_wrapper .cwp_sample_tweet_preview_inner .sample_tweet a { text-decoration: none; }
|
129 |
+
.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; }
|
130 |
+
.cwp_top_wrapper .cwp_sample_tweet_preview_inner button:hover { cursor: pointer; }
|
131 |
+
|
132 |
.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; }
|
133 |
+
|
134 |
+
|
135 |
+
.cwp_user_pages .cwp_preview_page {
|
136 |
+
width: 175px;
|
137 |
+
margin-right: 25px;
|
138 |
+
float: left;
|
139 |
+
height: 75px;
|
140 |
+
margin-bottom: 25px;
|
141 |
+
border-bottom: 1px solid #F1F1F1;
|
142 |
+
}
|
143 |
+
|
144 |
+
.cwp_user_pages_inner {
|
145 |
+
height: 340px;
|
146 |
+
}
|
147 |
+
.cwp_user_pages .page_name {
|
148 |
+
font-weight: bold;
|
149 |
+
font-size: 15px;
|
150 |
+
padding-bottom: 10px;
|
151 |
+
}
|
152 |
+
.cwp_user_pages .page_avatar {
|
153 |
+
width: 50px;
|
154 |
+
height: 50px;
|
155 |
+
margin-right: 5px;
|
156 |
+
float: left;
|
157 |
+
}
|
158 |
+
.cwp_user_pages .page_category {
|
159 |
+
|
160 |
+
color:grey;
|
161 |
+
}
|
162 |
.top_preview {
|
163 |
width: 40px;
|
164 |
height: 40px;
|
182 |
.twptop_opt_post_type {
|
183 |
display: none;
|
184 |
}
|
185 |
+
.top_left_instructions {
|
186 |
+
float: left;
|
187 |
+
width: 50%;
|
188 |
+
}
|
189 |
+
.top_auth_form {
|
190 |
+
width:50%;
|
191 |
+
float: left;
|
192 |
+
}
|
193 |
+
.top_sample_auth{
|
194 |
+
height: 370px;
|
195 |
+
}
|
196 |
+
.top_auth_inner {
|
197 |
+
height: 500px;
|
198 |
+
}
|
199 |
+
.top_authorize{
|
200 |
+
margin-left:50px;
|
201 |
+
}
|
202 |
@media all and (max-width:1280px) {
|
203 |
.cwp_top_wrapper {
|
204 |
width:100%;
|
217 |
.slogan {
|
218 |
display: none;
|
219 |
}
|
220 |
+
}
|
img/icon_facebook.gif
ADDED
Binary file
|
img/linkedIn.png
ADDED
Binary file
|
img/logo.png
CHANGED
Binary file
|
img/rop-icons.png
ADDED
Binary file
|
img/upgrade-top.png
CHANGED
Binary file
|
inc/class-remote-notification-client.php
CHANGED
@@ -33,19 +33,21 @@ class TAV_Remote_Notification_Client {
|
|
33 |
*
|
34 |
* @var string
|
35 |
*/
|
36 |
-
protected static $version = '0.1.
|
37 |
|
38 |
-
public function __construct( $channel_id = false, $channel_key = false, $server = false ) {
|
39 |
|
40 |
/* Don't continue during Ajax process */
|
41 |
if( !is_admin() || defined( 'DOING_AJAX' ) && DOING_AJAX )
|
42 |
return;
|
43 |
|
44 |
-
$this->id
|
45 |
-
$this->key
|
46 |
$this->server = esc_url( $server );
|
47 |
$this->notice = false;
|
48 |
$this->cache = apply_filters( 'rn_notice_caching_time', 6 );
|
|
|
|
|
49 |
|
50 |
/* The plugin can't work without those 2 parameters */
|
51 |
if( false === ( $this->id || $this->key || $this->server ) )
|
@@ -69,8 +71,23 @@ class TAV_Remote_Notification_Client {
|
|
69 |
*/
|
70 |
public function request_server() {
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
/* Content is false at first */
|
73 |
-
$content = get_transient(
|
74 |
|
75 |
/* Set the request response to null */
|
76 |
$request = null;
|
@@ -78,12 +95,6 @@ class TAV_Remote_Notification_Client {
|
|
78 |
/* If no notice is present in DB we query the server */
|
79 |
if( false === $content || defined( 'RDN_DEV' ) && RDN_DEV ) {
|
80 |
|
81 |
-
/* Prepare the payload to send to server */
|
82 |
-
$payload = base64_encode( json_encode( array( 'channel' => $this->id, 'key' => $this->key ) ) );
|
83 |
-
|
84 |
-
/* Get the endpoint URL ready */
|
85 |
-
$url = add_query_arg( array( 'payload' => $payload ), $this->server );
|
86 |
-
|
87 |
/* Query the server */
|
88 |
$request = wp_remote_get( $url, array( 'timeout' => apply_filters( 'rn_http_request_timeout', 5 ) ) );
|
89 |
|
@@ -117,7 +128,7 @@ class TAV_Remote_Notification_Client {
|
|
117 |
|
118 |
}
|
119 |
|
120 |
-
set_transient(
|
121 |
|
122 |
}
|
123 |
|
@@ -130,9 +141,24 @@ class TAV_Remote_Notification_Client {
|
|
130 |
*/
|
131 |
if( is_object( $content ) ) {
|
132 |
|
133 |
-
if( isset( $content->error ) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
return;
|
135 |
|
|
|
|
|
136 |
$this->notice = $content;
|
137 |
|
138 |
/**
|
@@ -337,4 +363,19 @@ class TAV_Remote_Notification_Client {
|
|
337 |
|
338 |
}
|
339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
}
|
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 ) )
|
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;
|
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 |
|
128 |
|
129 |
}
|
130 |
|
131 |
+
set_transient( "rn_last_notification_$uniqid", $content, $this->cache*60*60 );
|
132 |
|
133 |
}
|
134 |
|
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 |
/**
|
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,11 +1,11 @@
|
|
1 |
<?php
|
2 |
define("CURRENTURL", top_current_page());
|
3 |
define("CWP_TEXTDOMAIN", "TweetOldPost");
|
4 |
-
define("SETTINGSURL",
|
5 |
|
6 |
// Settings Array
|
7 |
$cwp_top_settings = array(
|
8 |
-
'name' => __("
|
9 |
'slug' => "TweetOldPost",
|
10 |
'oAuth_settings' => array( // Based on TOP Dev Application settings.
|
11 |
'oauth_access_token' => "2256465193-KDpAFIYfxpWugX2OU025b1CPs3WB0RJpgA4Gd4h",
|
@@ -21,7 +21,7 @@ $cwp_top_fields = array(
|
|
21 |
|
22 |
'tweet-content' => array(
|
23 |
'id' => '1',
|
24 |
-
'name' => __('
|
25 |
'type' => 'select',
|
26 |
'slug' => 'tweet-content',
|
27 |
'option' => 'top_opt_tweet_type',
|
@@ -36,7 +36,7 @@ $cwp_top_fields = array(
|
|
36 |
|
37 |
'tweet-content-field' => array(
|
38 |
'id' => '2',
|
39 |
-
'name' => __('
|
40 |
'type' => 'text',
|
41 |
'slug' => 'tweet-content-field',
|
42 |
'option' => 'top_opt_tweet_type_custom_field',
|
@@ -62,8 +62,8 @@ $cwp_top_fields = array(
|
|
62 |
'option' => 'top_opt_add_text_at',
|
63 |
'description' => __('Where do you want the text to be added?', CWP_TEXTDOMAIN),
|
64 |
'options' => array(
|
65 |
-
'beginning' => __('Beginning of
|
66 |
-
'end' => __('End of
|
67 |
)
|
68 |
),
|
69 |
|
@@ -162,7 +162,7 @@ $cwp_top_fields = array(
|
|
162 |
'description' => __('Include #hashtags in your auto posts?', CWP_TEXTDOMAIN),
|
163 |
'options' => array(
|
164 |
'nohashtag' => __('Don\'t add any hashtags', CWP_TEXTDOMAIN),
|
165 |
-
'common' => __('Common hashtags for all
|
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)
|
@@ -201,17 +201,17 @@ $cwp_top_fields = array(
|
|
201 |
|
202 |
'interval' => array(
|
203 |
'id' => '14',
|
204 |
-
'name' => __('Minimum interval between
|
205 |
'type' => 'text',
|
206 |
'slug' => 'interval',
|
207 |
'option' => 'top_opt_interval',
|
208 |
-
'description' => __('Minimum time between
|
209 |
'options' => array()
|
210 |
),
|
211 |
|
212 |
'age-limit' => array(
|
213 |
'id' => '15',
|
214 |
-
'name' => __('Minimum age of post to be eligible for
|
215 |
'type' => 'text',
|
216 |
'slug' => 'age-limit',
|
217 |
'option' => 'top_opt_age_limit',
|
@@ -221,7 +221,7 @@ $cwp_top_fields = array(
|
|
221 |
|
222 |
'max-age-limit' => array(
|
223 |
'id' => '16',
|
224 |
-
'name' => __('Maximum age of post to be eligible for
|
225 |
'type' => 'text',
|
226 |
'slug' => 'max-age-limit',
|
227 |
'option' => 'top_opt_max_age_limit',
|
@@ -231,7 +231,7 @@ $cwp_top_fields = array(
|
|
231 |
|
232 |
'no-of-tweet' => array(
|
233 |
'id' => '17',
|
234 |
-
'name' => __('Number of Posts to
|
235 |
'type' => 'text',
|
236 |
'slug' => 'no-of-tweet',
|
237 |
'option' => 'top_opt_no_of_tweet',
|
@@ -270,17 +270,27 @@ $cwp_top_fields = array(
|
|
270 |
'type' => 'checkbox',
|
271 |
'slug' => 'post-with-image',
|
272 |
'option' => 'top_opt_post_with_image',
|
273 |
-
'description' => __('Check if you want to add the post featured image to the
|
274 |
'options' => array()
|
275 |
),
|
276 |
|
277 |
'tweet-multiple-times' => array(
|
278 |
-
'id' => '
|
279 |
-
'name' => __('
|
280 |
'type' => 'checkbox',
|
281 |
'slug' => 'tweet-multiple-times',
|
282 |
'option' => 'top_opt_tweet_multiple_times',
|
283 |
-
'description' => __('By default once a post is
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
'options' => array()
|
285 |
),
|
286 |
|
@@ -300,7 +310,7 @@ $cwp_top_fields = array(
|
|
300 |
'type' => 'categories-list',
|
301 |
'slug' => 'exclude-specific-category',
|
302 |
'option' => 'top_opt_omit_cats',
|
303 |
-
'description' => __('Select which categories do you want to exclude to
|
304 |
'options' => array()
|
305 |
),
|
306 |
|
@@ -312,9 +322,10 @@ $defaultOptions = array(
|
|
312 |
'top_opt_tweet_type_custom_field' => '',
|
313 |
'top_opt_add_text' => '',
|
314 |
'top_opt_add_text_at' => 'beginning',
|
315 |
-
'top_opt_include_link' => '
|
316 |
'top_opt_custom_url_option' => 'off',
|
317 |
'top_opt_use_url_shortner' => 'off',
|
|
|
318 |
'top_opt_url_shortner' => 'is.gd',
|
319 |
'top_opt_custom_hashtag_option' => 'nohashtag',
|
320 |
'top_opt_hashtags' => '',
|
@@ -356,5 +367,10 @@ function top_current_page(){
|
|
356 |
return $pageURL;
|
357 |
}
|
358 |
|
|
|
|
|
|
|
|
|
|
|
359 |
// Store all options in array.
|
360 |
$cwp_top_options_list = array_column($cwp_top_fields, 'option');
|
1 |
<?php
|
2 |
define("CURRENTURL", top_current_page());
|
3 |
define("CWP_TEXTDOMAIN", "TweetOldPost");
|
4 |
+
define("SETTINGSURL", top_settings_url());
|
5 |
|
6 |
// Settings Array
|
7 |
$cwp_top_settings = array(
|
8 |
+
'name' => __("Revive Old Post", CWP_TEXTDOMAIN),
|
9 |
'slug' => "TweetOldPost",
|
10 |
'oAuth_settings' => array( // Based on TOP Dev Application settings.
|
11 |
'oauth_access_token' => "2256465193-KDpAFIYfxpWugX2OU025b1CPs3WB0RJpgA4Gd4h",
|
21 |
|
22 |
'tweet-content' => array(
|
23 |
'id' => '1',
|
24 |
+
'name' => __('Post Content', CWP_TEXTDOMAIN),
|
25 |
'type' => 'select',
|
26 |
'slug' => 'tweet-content',
|
27 |
'option' => 'top_opt_tweet_type',
|
36 |
|
37 |
'tweet-content-field' => array(
|
38 |
'id' => '2',
|
39 |
+
'name' => __('Post Content Custom Field', CWP_TEXTDOMAIN),
|
40 |
'type' => 'text',
|
41 |
'slug' => 'tweet-content-field',
|
42 |
'option' => 'top_opt_tweet_type_custom_field',
|
62 |
'option' => 'top_opt_add_text_at',
|
63 |
'description' => __('Where do you want the text to be added?', CWP_TEXTDOMAIN),
|
64 |
'options' => array(
|
65 |
+
'beginning' => __('Beginning of Post', CWP_TEXTDOMAIN),
|
66 |
+
'end' => __('End of Post', CWP_TEXTDOMAIN)
|
67 |
)
|
68 |
),
|
69 |
|
162 |
'description' => __('Include #hashtags in your auto posts?', CWP_TEXTDOMAIN),
|
163 |
'options' => array(
|
164 |
'nohashtag' => __('Don\'t add any hashtags', CWP_TEXTDOMAIN),
|
165 |
+
'common' => __('Common hashtags for all shares', CWP_TEXTDOMAIN),
|
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)
|
201 |
|
202 |
'interval' => array(
|
203 |
'id' => '14',
|
204 |
+
'name' => __('Minimum interval between shares', CWP_TEXTDOMAIN),
|
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 |
),
|
211 |
|
212 |
'age-limit' => array(
|
213 |
'id' => '15',
|
214 |
+
'name' => __('Minimum age of post to be eligible for sharing', CWP_TEXTDOMAIN),
|
215 |
'type' => 'text',
|
216 |
'slug' => 'age-limit',
|
217 |
'option' => 'top_opt_age_limit',
|
221 |
|
222 |
'max-age-limit' => array(
|
223 |
'id' => '16',
|
224 |
+
'name' => __('Maximum age of post to be eligible for sharing', CWP_TEXTDOMAIN),
|
225 |
'type' => 'text',
|
226 |
'slug' => 'max-age-limit',
|
227 |
'option' => 'top_opt_max_age_limit',
|
231 |
|
232 |
'no-of-tweet' => array(
|
233 |
'id' => '17',
|
234 |
+
'name' => __('Number of Posts to share', CWP_TEXTDOMAIN),
|
235 |
'type' => 'text',
|
236 |
'slug' => 'no-of-tweet',
|
237 |
'option' => 'top_opt_no_of_tweet',
|
270 |
'type' => 'checkbox',
|
271 |
'slug' => 'post-with-image',
|
272 |
'option' => 'top_opt_post_with_image',
|
273 |
+
'description' => __('Check if you want to add the post featured image to the share', CWP_TEXTDOMAIN),
|
274 |
'options' => array()
|
275 |
),
|
276 |
|
277 |
'tweet-multiple-times' => array(
|
278 |
+
'id' => '25',
|
279 |
+
'name' => __('Share old posts more than once', CWP_TEXTDOMAIN),
|
280 |
'type' => 'checkbox',
|
281 |
'slug' => 'tweet-multiple-times',
|
282 |
'option' => 'top_opt_tweet_multiple_times',
|
283 |
+
'description' => __('By default once a post is shared it will not be shared again until you stop/start the plugin', CWP_TEXTDOMAIN),
|
284 |
+
'options' => array()
|
285 |
+
),
|
286 |
+
|
287 |
+
'analytics-tracking' => array(
|
288 |
+
'id' => '26',
|
289 |
+
'name' => __('Google Analytics Campaign Tracking', CWP_TEXTDOMAIN),
|
290 |
+
'type' => 'checkbox',
|
291 |
+
'slug' => 'ga-tracking',
|
292 |
+
'option' => 'top_opt_ga_tracking',
|
293 |
+
'description' => __('Enabling Campaign Tracking you would be able to see how much traffic Revive Old Post generated.', CWP_TEXTDOMAIN),
|
294 |
'options' => array()
|
295 |
),
|
296 |
|
310 |
'type' => 'categories-list',
|
311 |
'slug' => 'exclude-specific-category',
|
312 |
'option' => 'top_opt_omit_cats',
|
313 |
+
'description' => __('Select which categories do you want to exclude to share from? Blank - None', CWP_TEXTDOMAIN),
|
314 |
'options' => array()
|
315 |
),
|
316 |
|
322 |
'top_opt_tweet_type_custom_field' => '',
|
323 |
'top_opt_add_text' => '',
|
324 |
'top_opt_add_text_at' => 'beginning',
|
325 |
+
'top_opt_include_link' => 'true',
|
326 |
'top_opt_custom_url_option' => 'off',
|
327 |
'top_opt_use_url_shortner' => 'off',
|
328 |
+
'top_opt_ga_tracking' =>'on',
|
329 |
'top_opt_url_shortner' => 'is.gd',
|
330 |
'top_opt_custom_hashtag_option' => 'nohashtag',
|
331 |
'top_opt_hashtags' => '',
|
367 |
return $pageURL;
|
368 |
}
|
369 |
|
370 |
+
function top_settings_url(){
|
371 |
+
$pageURL = admin_url('admin.php?page=TweetOldPost');
|
372 |
+
return str_replace(":80","",$pageURL);
|
373 |
+
}
|
374 |
+
|
375 |
// Store all options in array.
|
376 |
$cwp_top_options_list = array_column($cwp_top_fields, 'option');
|
inc/core.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
// Basic configuration
|
3 |
-
require_once(
|
4 |
-
//
|
5 |
-
require_once(
|
6 |
|
7 |
if (!class_exists('CWP_TOP_Core')) {
|
8 |
class CWP_TOP_Core {
|
@@ -281,17 +281,30 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
281 |
|
282 |
}
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
public function getNotice() {
|
285 |
$notice = get_option('cwp_topnew_notice');
|
286 |
-
|
287 |
-
|
288 |
if (is_object($notice) && $notice->errors[0]->message)
|
289 |
echo "Error for your last tweet was :'".$notice->errors[0]->message."'";
|
290 |
-
else if (is_object($notice) && $notice
|
291 |
-
echo "
|
|
|
|
|
|
|
292 |
} else if ($notice!="") {
|
293 |
-
echo "Error for your last
|
294 |
}
|
|
|
|
|
295 |
die();
|
296 |
}
|
297 |
|
@@ -306,16 +319,25 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
306 |
$image="";
|
307 |
//var_dump($returnedTweets);
|
308 |
$finalTweetsPreview = $this->generateTweetFromPost($returnedTweets[0]);
|
|
|
|
|
|
|
309 |
$result = $finalTweetsPreview;
|
310 |
update_option( 'top_lastID', $returnedTweets[0]->ID);
|
311 |
|
312 |
if (function_exists('topProImage') && get_option('top_opt_post_with_image')=="on") {
|
313 |
|
314 |
-
if (
|
315 |
$image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $returnedTweets[0]->ID ), 'optional-size' );
|
316 |
$image = $image_array[0];
|
317 |
else :
|
318 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
endif;
|
320 |
|
321 |
$result = '<img class="top_preview" src="'.$image.'"/>'.$finalTweetsPreview;
|
@@ -385,6 +407,8 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
385 |
$hashtag_custom_field = get_option('top_opt_custom_hashtag_field');
|
386 |
$bitly_key = get_option('top_opt_bitly_key');
|
387 |
$bitly_user = get_option('top_opt_bitly_user');
|
|
|
|
|
388 |
$additionalTextBeginning = "";
|
389 |
$additionalTextEnd = "";
|
390 |
|
@@ -427,15 +451,33 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
427 |
// Generate the post link.
|
428 |
if($include_link == 'true') {
|
429 |
if($fetch_url_from_custom_field == 'on') {
|
430 |
-
$post_url = " " . get_post_meta($postQuery->ID, $custom_field_url,true)
|
431 |
} else {
|
432 |
$post_url = " " . get_permalink($postQuery->ID);
|
433 |
}
|
434 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
if($use_url_shortner == 'on') {
|
436 |
$post_url = " " . $this->shortenURL($post_url, $url_shortner_service, $postQuery->ID, $bitly_key, $bitly_user);
|
437 |
}
|
|
|
|
|
|
|
|
|
438 |
$post_url = $post_url . " ";
|
|
|
|
|
439 |
} else { $post_url = ""; }
|
440 |
|
441 |
// Generate the hashtags
|
@@ -496,7 +538,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
496 |
if(!empty($post_url)) {
|
497 |
|
498 |
$postURLLength = strlen($post_url);
|
499 |
-
if ($postURLLength >
|
500 |
$finalTweetLength += intval($postURLLength);
|
501 |
}
|
502 |
|
@@ -505,15 +547,21 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
505 |
$finalTweetLength += intval($hashtagsLength);
|
506 |
}
|
507 |
|
|
|
|
|
|
|
508 |
$finalTweetLength = 139 - $finalTweetLength - 5;
|
509 |
|
510 |
$tweetContent = mb_substr($tweetContent,0, $finalTweetLength) . " ";
|
511 |
|
512 |
-
$finalTweet = $additionalTextBeginning . $tweetContent .
|
513 |
$finalTweet = substr($finalTweet,0, 139);
|
514 |
-
|
|
|
|
|
|
|
515 |
// Strip any tags and return the final tweet
|
516 |
-
return
|
517 |
}
|
518 |
|
519 |
/**
|
@@ -527,16 +575,89 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
527 |
$nrOfUsers = count($this->users);
|
528 |
|
529 |
foreach ($this->users as $user) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
|
531 |
-
|
532 |
-
$connection = new TwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
533 |
-
// Post the new tweet
|
534 |
-
$status = $connection->post('statuses/update', array('status' => $finalTweet));
|
535 |
-
//return $status;
|
536 |
-
if ($nrOfUsers == $k)
|
537 |
-
return $status;
|
538 |
-
else
|
539 |
-
$k++;
|
540 |
|
541 |
}
|
542 |
}
|
@@ -548,16 +669,85 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
548 |
$nrOfUsers = count($this->users);
|
549 |
|
550 |
foreach ($this->users as $user) {
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
}
|
562 |
}
|
563 |
|
@@ -640,9 +830,9 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
640 |
// Gets the tweet post type.
|
641 |
public function getTweetPostType()
|
642 |
{
|
643 |
-
$
|
644 |
|
645 |
-
/* switch ($
|
646 |
case 'post':
|
647 |
return "'post'";
|
648 |
break;
|
@@ -718,10 +908,17 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
718 |
// Checks if twitter returned any temporary credentials to log in the user.
|
719 |
public function afterAddAccountCheck()
|
720 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
721 |
if(isset($_REQUEST['oauth_token'])) {
|
722 |
if($_REQUEST['oauth_token'] == $this->cwp_top_oauth_token) {
|
723 |
|
724 |
-
$twitter = new
|
725 |
$access_token = $twitter->getAccessToken($_REQUEST['oauth_verifier']);
|
726 |
$user_details = $twitter->get('account/verify_credentials');
|
727 |
|
@@ -729,7 +926,8 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
729 |
'user_id' => $user_details->id,
|
730 |
'oauth_token' => $access_token['oauth_token'],
|
731 |
'oauth_token_secret' => $access_token['oauth_token_secret'],
|
732 |
-
'oauth_user_details' => $user_details
|
|
|
733 |
);
|
734 |
|
735 |
$loggedInUsers = get_option('cwp_top_logged_in_users');
|
@@ -747,53 +945,298 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
747 |
exit;
|
748 |
}
|
749 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
750 |
}
|
751 |
|
752 |
-
// Used to display the
|
753 |
-
public function
|
754 |
{
|
755 |
// display the twitter login button
|
756 |
-
if($this->userIsLoggedIn()) {
|
757 |
-
$this->setAlloAuthSettings();
|
758 |
return true;
|
759 |
} else {
|
760 |
return false;
|
761 |
}
|
762 |
}
|
763 |
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
$
|
768 |
-
$
|
769 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
|
771 |
-
|
772 |
-
|
|
|
|
|
|
|
|
|
|
|
773 |
|
|
|
|
|
|
|
|
|
|
|
774 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
775 |
|
776 |
-
|
777 |
-
case 200:
|
778 |
-
$url = $twitter->getAuthorizeURL($requestToken['oauth_token']);
|
779 |
-
echo $url;
|
780 |
break;
|
781 |
-
|
782 |
-
|
783 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
784 |
break;
|
785 |
}
|
786 |
die(); // Required
|
787 |
}
|
788 |
|
789 |
-
|
790 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
791 |
{
|
792 |
if (function_exists('topProAddNewAccount')) {
|
793 |
-
topProAddNewAccount();
|
794 |
}
|
795 |
else{
|
796 |
-
|
|
|
797 |
|
798 |
}
|
799 |
die(); // Required
|
@@ -821,7 +1264,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
821 |
}
|
822 |
|
823 |
// Clears all Twitter user credentials.
|
824 |
-
public function
|
825 |
{
|
826 |
$userID = $_POST['user_id'];
|
827 |
|
@@ -875,6 +1318,10 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
875 |
update_option('top_opt_tweet_multiple_times', 'off');
|
876 |
}
|
877 |
|
|
|
|
|
|
|
|
|
878 |
//if(!array_key_exists('top_opt_tweet_specific_category', $options)) {
|
879 |
// update_option('top_opt_tweet_specific_category', '');
|
880 |
//}
|
@@ -916,12 +1363,13 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
916 |
'top_opt_post_with_image' => 'off',
|
917 |
'top_opt_bitly_user' =>'',
|
918 |
'top_opt_bitly_key' =>'',
|
919 |
-
'
|
920 |
'top_opt_add_text' => '',
|
921 |
'top_opt_add_text_at' => 'beginning',
|
922 |
-
'top_opt_include_link' => '
|
923 |
'top_opt_custom_url_option' => 'off',
|
924 |
'top_opt_use_url_shortner' => 'off',
|
|
|
925 |
'top_opt_url_shortner' => 'is.gd',
|
926 |
'top_opt_custom_hashtag_option' => 'nohashtag',
|
927 |
'top_opt_hashtags' => '',
|
@@ -939,7 +1387,8 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
939 |
'cwp_topnew_notice' => '',
|
940 |
'top_opt_excluded_post' => '',
|
941 |
'top_opt_tweet-multiple-times' => 'off',
|
942 |
-
'cwp_top_logged_in_users' => ''
|
|
|
943 |
);
|
944 |
|
945 |
foreach ($defaultOptions as $option => $defaultValue) {
|
@@ -1056,7 +1505,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1056 |
|
1057 |
function top_plugin_action_links($links, $file) {
|
1058 |
|
1059 |
-
if ($file ==
|
1060 |
// The "page" query string value must be equal to the slug
|
1061 |
// of the Settings admin page we defined earlier, which in
|
1062 |
// this case equals "myplugin-settings".
|
@@ -1120,16 +1569,24 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1120 |
add_action('wp_ajax_reset_options', array($this, 'resetAllOptions'));
|
1121 |
|
1122 |
// Add new twitter account ajax action
|
1123 |
-
add_action('
|
1124 |
-
add_action('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1125 |
|
1126 |
// Add more than one twitter account ajax action
|
1127 |
-
add_action('
|
1128 |
-
add_action('
|
1129 |
|
1130 |
// Log Out Twitter user ajax action
|
1131 |
-
add_action('
|
1132 |
-
add_action('
|
1133 |
|
1134 |
// Tweet Old Post ajax action.
|
1135 |
add_action('wp_ajax_nopriv_tweet_old_post_action', array($this, 'startTweetOldPost'));
|
@@ -1157,7 +1614,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1157 |
|
1158 |
//add_filter('plugin_action_links', array($this,'top_plugin_action_links'), 10, 2);
|
1159 |
|
1160 |
-
add_action('admin_notices', array($this,'top_admin_notice'));
|
1161 |
|
1162 |
add_action('admin_init', array($this,'top_nag_ignore'));
|
1163 |
|
@@ -1167,7 +1624,6 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1167 |
add_filter('plugin_action_links',array($this,'top_plugin_action_links'), 10, 2);
|
1168 |
|
1169 |
add_action('cwp_top_tweet_cron', array($this, 'tweetOldPost'));
|
1170 |
-
|
1171 |
}
|
1172 |
|
1173 |
public function loadAllScriptsAndStyles()
|
@@ -1179,12 +1635,12 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1179 |
if ($_GET['page'] == $cwp_top_settings['slug'] || $_GET['page'] == "ExcludePosts") {
|
1180 |
|
1181 |
// Enqueue and Register Main CSS File
|
1182 |
-
wp_register_style( 'cwp_top_stylesheet',
|
1183 |
wp_enqueue_style( 'cwp_top_stylesheet' );
|
1184 |
|
1185 |
// Register Main JS File
|
1186 |
-
wp_enqueue_script( 'cwp_top_js_countdown',
|
1187 |
-
wp_enqueue_script( 'cwp_top_javascript',
|
1188 |
wp_localize_script( 'cwp_top_javascript', 'cwp_top_ajaxload', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
|
1189 |
}
|
1190 |
}
|
@@ -1211,7 +1667,7 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1211 |
$cap = 1;
|
1212 |
else
|
1213 |
$cap='manage_options';
|
1214 |
-
add_menu_page($cwp_top_settings['name'], $cwp_top_settings['name'], $cap, $cwp_top_settings['slug'], array($this, 'loadMainView'),'
|
1215 |
add_submenu_page($cwp_top_settings['slug'], __('Exclude Posts',CWP_TEXTDOMAIN), __('Exclude Posts',CWP_TEXTDOMAIN), 'manage_options', __('ExcludePosts',CWP_TEXTDOMAIN), 'top_exclude');
|
1216 |
}
|
1217 |
|
@@ -1292,9 +1748,17 @@ WHERE {$wpdb->prefix}term_taxonomy.taxonomy = 'category'
|
|
1292 |
$shortURL = wp_get_shortlink($id);
|
1293 |
}
|
1294 |
|
1295 |
-
if($shortURL != ' 400 ') {
|
1296 |
return $shortURL;
|
1297 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1298 |
}
|
1299 |
|
1300 |
}
|
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')) {
|
8 |
class CWP_TOP_Core {
|
281 |
|
282 |
}
|
283 |
|
284 |
+
public function findInString($where,$what) {
|
285 |
+
if (is_string($notice)) {
|
286 |
+
return false;
|
287 |
+
}
|
288 |
+
else
|
289 |
+
return strpos($where,$what);
|
290 |
+
}
|
291 |
+
|
292 |
public function getNotice() {
|
293 |
$notice = get_option('cwp_topnew_notice');
|
294 |
+
|
295 |
+
//$notice = strpos($notice,'UPDAT');
|
296 |
if (is_object($notice) && $notice->errors[0]->message)
|
297 |
echo "Error for your last tweet was :'".$notice->errors[0]->message."'";
|
298 |
+
else if ( $notice !== "OK" && !is_object($notice) && $this->findInString($notice,'UPDAT')===false && $notice!=="")
|
299 |
+
echo "Error for your last post was :'".$notice."'";
|
300 |
+
else
|
301 |
+
if (is_object($notice) && $notice->text || $notice=="OK" || strpos($notice,'UPDAT')!==false) {
|
302 |
+
echo "Congrats! Your last post was revived successfully";
|
303 |
} else if ($notice!="") {
|
304 |
+
echo "Error for your last post was : ".$notice;
|
305 |
}
|
306 |
+
|
307 |
+
|
308 |
die();
|
309 |
}
|
310 |
|
319 |
$image="";
|
320 |
//var_dump($returnedTweets);
|
321 |
$finalTweetsPreview = $this->generateTweetFromPost($returnedTweets[0]);
|
322 |
+
if (is_array($finalTweetsPreview)){
|
323 |
+
$finalTweetsPreview = $finalTweetsPreview['message'];
|
324 |
+
}
|
325 |
$result = $finalTweetsPreview;
|
326 |
update_option( 'top_lastID', $returnedTweets[0]->ID);
|
327 |
|
328 |
if (function_exists('topProImage') && get_option('top_opt_post_with_image')=="on") {
|
329 |
|
330 |
+
if ( strlen( $img = get_the_post_thumbnail( $returnedTweets[0]->ID, array( 150, 150 ) ) ) ) :
|
331 |
$image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $returnedTweets[0]->ID ), 'optional-size' );
|
332 |
$image = $image_array[0];
|
333 |
else :
|
334 |
+
$post = get_post($returnedTweets[0]->ID);
|
335 |
+
$image = '';
|
336 |
+
ob_start();
|
337 |
+
ob_end_clean();
|
338 |
+
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
|
339 |
+
|
340 |
+
$image = $matches [1] [0];
|
341 |
endif;
|
342 |
|
343 |
$result = '<img class="top_preview" src="'.$image.'"/>'.$finalTweetsPreview;
|
407 |
$hashtag_custom_field = get_option('top_opt_custom_hashtag_field');
|
408 |
$bitly_key = get_option('top_opt_bitly_key');
|
409 |
$bitly_user = get_option('top_opt_bitly_user');
|
410 |
+
$ga_tracking = get_option('top_opt_ga_tracking');
|
411 |
+
$post_with_image = get_option('top_opt_post_with_image');
|
412 |
$additionalTextBeginning = "";
|
413 |
$additionalTextEnd = "";
|
414 |
|
451 |
// Generate the post link.
|
452 |
if($include_link == 'true') {
|
453 |
if($fetch_url_from_custom_field == 'on') {
|
454 |
+
$post_url = " " . get_post_meta($postQuery->ID, $custom_field_url,true);
|
455 |
} else {
|
456 |
$post_url = " " . get_permalink($postQuery->ID);
|
457 |
}
|
458 |
|
459 |
+
if ($post_url==" ")
|
460 |
+
$post_url = " " . get_permalink($postQuery->ID);
|
461 |
+
|
462 |
+
if ($ga_tracking=="on") {
|
463 |
+
$param = 'utm_source=ReviveOldPost&utm_medium=social&utm_campaign=ReviveOldPost';
|
464 |
+
$post_url = rtrim($post_url);
|
465 |
+
if (strpos($post_url,"?")===FALSE)
|
466 |
+
$post_url.='?'.$param;
|
467 |
+
else
|
468 |
+
$post_url.='&'.$param;
|
469 |
+
}
|
470 |
+
|
471 |
if($use_url_shortner == 'on') {
|
472 |
$post_url = " " . $this->shortenURL($post_url, $url_shortner_service, $postQuery->ID, $bitly_key, $bitly_user);
|
473 |
}
|
474 |
+
|
475 |
+
if ($post_url==" ")
|
476 |
+
$post_url = " " . get_permalink($postQuery->ID);
|
477 |
+
|
478 |
$post_url = $post_url . " ";
|
479 |
+
|
480 |
+
|
481 |
} else { $post_url = ""; }
|
482 |
|
483 |
// Generate the hashtags
|
538 |
if(!empty($post_url)) {
|
539 |
|
540 |
$postURLLength = strlen($post_url);
|
541 |
+
if ($postURLLength > 21) $postURLLength = 22;
|
542 |
$finalTweetLength += intval($postURLLength);
|
543 |
}
|
544 |
|
547 |
$finalTweetLength += intval($hashtagsLength);
|
548 |
}
|
549 |
|
550 |
+
if ($post_with_image == "on")
|
551 |
+
$finalTweetLength += 25;
|
552 |
+
|
553 |
$finalTweetLength = 139 - $finalTweetLength - 5;
|
554 |
|
555 |
$tweetContent = mb_substr($tweetContent,0, $finalTweetLength) . " ";
|
556 |
|
557 |
+
$finalTweet = $additionalTextBeginning . $tweetContent . "%short_urlshort_urlurl%" . $newHashtags . $additionalTextEnd;
|
558 |
$finalTweet = substr($finalTweet,0, 139);
|
559 |
+
$finalTweet = str_replace("%short_urlshort_urlurl%",$post_url,$finalTweet);
|
560 |
+
$fTweet = array();
|
561 |
+
$fTweet['message'] = strip_tags($finalTweet);
|
562 |
+
$fTweet['link'] = $post_url;
|
563 |
// Strip any tags and return the final tweet
|
564 |
+
return $fTweet;
|
565 |
}
|
566 |
|
567 |
/**
|
575 |
$nrOfUsers = count($this->users);
|
576 |
|
577 |
foreach ($this->users as $user) {
|
578 |
+
|
579 |
+
switch ($user['service']) {
|
580 |
+
case 'twitter':
|
581 |
+
// Create a new twitter connection using the stored user credentials.
|
582 |
+
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
583 |
+
// Post the new tweet
|
584 |
+
$status = $connection->post('statuses/update', array('status' => $finalTweet['message']));
|
585 |
+
//return $status;
|
586 |
+
if ($nrOfUsers == $k)
|
587 |
+
return $status;
|
588 |
+
else
|
589 |
+
$k++;
|
590 |
+
break;
|
591 |
+
|
592 |
+
case 'facebook':
|
593 |
+
$args = array(
|
594 |
+
|
595 |
+
'body' => array( 'message' => $finalTweet['message'],'link' => $finalTweet['link']),
|
596 |
+
|
597 |
+
);
|
598 |
+
|
599 |
+
$pp=wp_remote_post("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/$user[id]/feed?access_token=$user[oauth_token]",$args);
|
600 |
+
if ($nrOfUsers == $k)
|
601 |
+
return $pp['response']['message'];
|
602 |
+
else
|
603 |
+
$k++;
|
604 |
+
|
605 |
+
break;
|
606 |
+
|
607 |
+
case 'linkedin':
|
608 |
+
|
609 |
+
$visibility="anyone";
|
610 |
+
$content_xml.="<content><title>".$finalTweet['message']."</title><submitted-url>".$finalTweet['link']."</submitted-url></content>";
|
611 |
+
$url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$user["oauth_token"];
|
612 |
+
|
613 |
+
|
614 |
+
$xml = '<?xml version="1.0" encoding="UTF-8"?><share>
|
615 |
+
' . $content_xml . '
|
616 |
+
<visibility>
|
617 |
+
<code>' . $visibility . '</code>
|
618 |
+
</visibility>
|
619 |
+
</share>';
|
620 |
+
$headers = array(
|
621 |
+
"Content-type: text/xml",
|
622 |
+
"Content-length: " . strlen($xml),
|
623 |
+
"Connection: close",
|
624 |
+
);
|
625 |
+
|
626 |
+
$ch = curl_init();
|
627 |
+
curl_setopt($ch, CURLOPT_URL,$url);
|
628 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
629 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
630 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
631 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
|
632 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
633 |
+
|
634 |
+
$data = curl_exec($ch);
|
635 |
+
if ($nrOfUsers == $k)
|
636 |
+
return $data;
|
637 |
+
else
|
638 |
+
$k++;
|
639 |
+
|
640 |
+
if(curl_errno($ch))
|
641 |
+
print curl_error($ch);
|
642 |
+
else
|
643 |
+
curl_close($ch);
|
644 |
+
|
645 |
+
break;
|
646 |
+
|
647 |
+
default:
|
648 |
+
// Create a new twitter connection using the stored user credentials.
|
649 |
+
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
650 |
+
// Post the new tweet
|
651 |
+
$status = $connection->post('statuses/update', array('status' => $finalTweet['message']));
|
652 |
+
//return $status;
|
653 |
+
if ($nrOfUsers == $k)
|
654 |
+
return $status;
|
655 |
+
else
|
656 |
+
$k++;
|
657 |
+
break;
|
658 |
+
}
|
659 |
|
660 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
|
662 |
}
|
663 |
}
|
669 |
$nrOfUsers = count($this->users);
|
670 |
|
671 |
foreach ($this->users as $user) {
|
672 |
+
|
673 |
+
switch ($user['service']) {
|
674 |
+
case 'twitter':
|
675 |
+
// Create a new twitter connection using the stored user credentials.
|
676 |
+
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
677 |
+
// Post the new tweet
|
678 |
+
if (function_exists('topProImage'))
|
679 |
+
$status = topProImage($connection, $finalTweet['message'], $id);
|
680 |
+
|
681 |
+
if ($nrOfUsers == $k)
|
682 |
+
return $status;
|
683 |
+
else
|
684 |
+
$k++;
|
685 |
+
|
686 |
+
case 'facebook':
|
687 |
+
$args = array(
|
688 |
+
|
689 |
+
'body' => array( 'message' => $finalTweet['message'],'link' => $finalTweet['link']),
|
690 |
+
|
691 |
+
);
|
692 |
+
|
693 |
+
$pp=wp_remote_post("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/$user[id]/feed?access_token=$user[oauth_token]",$args);
|
694 |
+
if ($nrOfUsers == $k)
|
695 |
+
return $pp['response']['message'];
|
696 |
+
else
|
697 |
+
$k++;
|
698 |
+
|
699 |
+
break;
|
700 |
+
|
701 |
+
case 'linkedin':
|
702 |
+
|
703 |
+
$visibility="anyone";
|
704 |
+
$content_xml.="<content><title>".$finalTweet['message']."</title><submitted-url>".$finalTweet['link']."</submitted-url></content>";
|
705 |
+
$url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$user["oauth_token"];
|
706 |
+
|
707 |
+
|
708 |
+
$xml = '<?xml version="1.0" encoding="UTF-8"?><share>
|
709 |
+
' . $content_xml . '
|
710 |
+
<visibility>
|
711 |
+
<code>' . $visibility . '</code>
|
712 |
+
</visibility>
|
713 |
+
</share>';
|
714 |
+
$headers = array(
|
715 |
+
"Content-type: text/xml",
|
716 |
+
"Content-length: " . strlen($xml),
|
717 |
+
"Connection: close",
|
718 |
+
);
|
719 |
+
|
720 |
+
$ch = curl_init();
|
721 |
+
curl_setopt($ch, CURLOPT_URL,$url);
|
722 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
723 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
724 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
725 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
|
726 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
727 |
+
|
728 |
+
$data = curl_exec($ch);
|
729 |
+
if ($nrOfUsers == $k)
|
730 |
+
return $data;
|
731 |
+
else
|
732 |
+
$k++;
|
733 |
+
|
734 |
+
if(curl_errno($ch))
|
735 |
+
print curl_error($ch);
|
736 |
+
else
|
737 |
+
curl_close($ch);
|
738 |
+
|
739 |
+
break;
|
740 |
+
default:
|
741 |
+
$connection = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $user['oauth_token'], $user['oauth_token_secret']);
|
742 |
+
// Post the new tweet
|
743 |
+
if (function_exists('topProImage'))
|
744 |
+
$status = topProImage($connection, $finalTweet['message'], $id);
|
745 |
+
|
746 |
+
if ($nrOfUsers == $k)
|
747 |
+
return $status;
|
748 |
+
else
|
749 |
+
$k++;
|
750 |
+
}
|
751 |
}
|
752 |
}
|
753 |
|
830 |
// Gets the tweet post type.
|
831 |
public function getTweetPostType()
|
832 |
{
|
833 |
+
$top_opt_post_type = get_option('top_opt_post_type');
|
834 |
|
835 |
+
/* switch ($top_opt_post_type) {
|
836 |
case 'post':
|
837 |
return "'post'";
|
838 |
break;
|
908 |
// Checks if twitter returned any temporary credentials to log in the user.
|
909 |
public function afterAddAccountCheck()
|
910 |
{
|
911 |
+
if( time() - get_option("top_reauthorize") > 2592000 )
|
912 |
+
$this->reAuthorize();
|
913 |
+
global $cwp_top_settings;
|
914 |
+
$code="";
|
915 |
+
if(isset($_REQUEST['code']))
|
916 |
+
$code = $_REQUEST["code"];
|
917 |
+
|
918 |
if(isset($_REQUEST['oauth_token'])) {
|
919 |
if($_REQUEST['oauth_token'] == $this->cwp_top_oauth_token) {
|
920 |
|
921 |
+
$twitter = new RopTwitterOAuth($this->consumer, $this->consumerSecret, $this->cwp_top_oauth_token, $this->cwp_top_oauth_token_secret );
|
922 |
$access_token = $twitter->getAccessToken($_REQUEST['oauth_verifier']);
|
923 |
$user_details = $twitter->get('account/verify_credentials');
|
924 |
|
926 |
'user_id' => $user_details->id,
|
927 |
'oauth_token' => $access_token['oauth_token'],
|
928 |
'oauth_token_secret' => $access_token['oauth_token_secret'],
|
929 |
+
'oauth_user_details' => $user_details,
|
930 |
+
'service' => 'twitter'
|
931 |
);
|
932 |
|
933 |
$loggedInUsers = get_option('cwp_top_logged_in_users');
|
945 |
exit;
|
946 |
}
|
947 |
}
|
948 |
+
|
949 |
+
if(isset($_REQUEST['state']) && (get_option('top_fb_session_state') === $_REQUEST['state'])) {
|
950 |
+
|
951 |
+
$token_url = "https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/oauth/access_token?"
|
952 |
+
. "client_id=" . get_option('cwp_top_app_id') . "&redirect_uri=" . SETTINGSURL
|
953 |
+
. "&client_secret=" . get_option('cwp_top_app_secret') . "&code=" . $code;
|
954 |
+
|
955 |
+
$params = null;$access_token="";
|
956 |
+
$response = wp_remote_get($token_url);
|
957 |
+
|
958 |
+
if(is_array($response))
|
959 |
+
{
|
960 |
+
if(isset($response['body']))
|
961 |
+
{
|
962 |
+
parse_str($response['body'], $params);
|
963 |
+
if(isset($params['access_token']))
|
964 |
+
$access_token = $params['access_token'];
|
965 |
+
}
|
966 |
+
}
|
967 |
+
|
968 |
+
if($access_token!="")
|
969 |
+
{
|
970 |
+
update_option('top_fb_token',$access_token);
|
971 |
+
|
972 |
+
}
|
973 |
+
header("Location: " . SETTINGSURL.'#fbadd');
|
974 |
+
}
|
975 |
+
|
976 |
+
if (isset($_GET['code'])&&isset($_GET['state'])&&get_option('top_lk_session_state') == $_GET['state']) {
|
977 |
+
|
978 |
+
$lk_auth_token = get_option('cwp_top_lk_app_id');
|
979 |
+
$lk_auth_secret = get_option('cwp_top_lk_app_secret');
|
980 |
+
$params = array('grant_type' => 'authorization_code',
|
981 |
+
'client_id' => $lk_auth_token,
|
982 |
+
'client_secret' => $lk_auth_secret,
|
983 |
+
'code' => $_GET['code'],
|
984 |
+
'redirect_uri' => SETTINGSURL,
|
985 |
+
);
|
986 |
+
|
987 |
+
$url = 'https://www.linkedin.com/uas/oauth2/accessToken?' . http_build_query($params);
|
988 |
+
//echo $url;
|
989 |
+
$response = wp_remote_post($url);
|
990 |
+
$token = json_decode($response['body']);
|
991 |
+
//print_r($response);
|
992 |
+
//print_r($token);
|
993 |
+
if($token->access_token) {
|
994 |
+
// the request went through without an error, gather user's 'access' tokens
|
995 |
+
//AQVBBQ6_ggJaUVFYmJ5oVF_kSH-wn6VNREGgC_sYPWp0YV0U4r2CFwptnLXUbJra5Glp0ZMax96CrD2azzf_HkJ2UdLp5q5zoiT_rbl5bmTMf50XnDfRcdm8Vl2k2XoYhGQ-LkYTnddFz1K-OBcW0CWsapzgZH2hepMVMhc1Lw7bhwTab04"
|
996 |
+
update_option('top_linkedin_token',$token->access_token);
|
997 |
+
update_option('top_linkedin_token_expires',$token->expires_in);
|
998 |
+
}
|
999 |
+
|
1000 |
+
$url = 'https://api.linkedin.com/v1/people/~:(id,picture-url,first_name,last_name)?oauth2_access_token='.$token->access_token;
|
1001 |
+
//echo $url;
|
1002 |
+
$response = wp_remote_get($url);
|
1003 |
+
$response = wp_remote_retrieve_body($response);
|
1004 |
+
//print_r($response);
|
1005 |
+
$person = simplexml_load_string($response);
|
1006 |
+
|
1007 |
+
if (isset($person->id)) {
|
1008 |
+
$user_details = array('profile_image_url' => (string)$person->{'picture-url'},'name'=> (string)$person->{'first-name'} );
|
1009 |
+
|
1010 |
+
$newUser = array(
|
1011 |
+
'user_id' => (string)$person->id,
|
1012 |
+
'oauth_token' => $token->access_token,
|
1013 |
+
'oauth_token_secret' => '',
|
1014 |
+
'oauth_user_details' => (object)$user_details,
|
1015 |
+
'service' => 'linkedin'
|
1016 |
+
);
|
1017 |
+
|
1018 |
+
$loggedInUsers = get_option('cwp_top_logged_in_users');
|
1019 |
+
if(empty($loggedInUsers)) { $loggedInUsers = array(); }
|
1020 |
+
|
1021 |
+
foreach ($loggedInUsers as $key=>$user) {
|
1022 |
+
if ($user['user_id'] == $person->id)
|
1023 |
+
unset($loggedInUsers[$key]);
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
if(in_array($newUser, $loggedInUsers)) {
|
1027 |
+
echo "You already added that user! no can do !";
|
1028 |
+
} else {
|
1029 |
+
array_push($loggedInUsers, $newUser);
|
1030 |
+
update_option('cwp_top_logged_in_users', $loggedInUsers);
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
header("Location: " . SETTINGSURL);
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
|
1037 |
}
|
1038 |
|
1039 |
+
// Used to display the login buttons
|
1040 |
+
public function displayLoginButton($social_network)
|
1041 |
{
|
1042 |
// display the twitter login button
|
1043 |
+
if($this->userIsLoggedIn($social_network)) {
|
1044 |
+
$this->setAlloAuthSettings($social_network);
|
1045 |
return true;
|
1046 |
} else {
|
1047 |
return false;
|
1048 |
}
|
1049 |
}
|
1050 |
|
1051 |
+
public function reAuthorize() {
|
1052 |
+
$top_session_state = uniqid('', true);
|
1053 |
+
update_option('top_reauthorize',time());
|
1054 |
+
$loggedInUsers = get_option('cwp_top_logged_in_users');
|
1055 |
+
if(empty($loggedInUsers)) { $loggedInUsers = array(); }
|
1056 |
+
$lk = 0;
|
1057 |
+
$fb = 0;
|
1058 |
+
|
1059 |
+
foreach ($loggedInUsers as $key=>$user) {
|
1060 |
+
if ($user['service'] === "linkedin"&&$lk===0) {
|
1061 |
+
$lk++;
|
1062 |
+
$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='.SETTINGSURL;
|
1063 |
+
header("Location: " . $url);
|
1064 |
+
|
1065 |
+
update_option('top_lk_session_state',$top_session_state);
|
1066 |
+
|
1067 |
+
}
|
1068 |
|
1069 |
+
if ($user['service'] === "facebook"&&$fb===0) {
|
1070 |
+
$top_session_state_fb = md5(uniqid(rand(), TRUE));
|
1071 |
+
$fb++;
|
1072 |
+
update_option('top_fb_session_state',$top_session_state_fb);
|
1073 |
+
$dialog_url = "https://www.facebook.com/".ROP_TOP_FB_API_VERSION."/dialog/oauth?client_id="
|
1074 |
+
. get_option("cwp_top_app_id") . "&redirect_uri=" . SETTINGSURL . "&state="
|
1075 |
+
. $top_session_state_fb . "&scope=publish_stream,publish_actions,manage_pages";
|
1076 |
|
1077 |
+
header("Location: " . $dialog_url);
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
}
|
1082 |
|
1083 |
+
// Adds pages
|
1084 |
+
public function displayPages()
|
1085 |
+
{
|
1086 |
+
$social_network = $_POST['social_network'];
|
1087 |
+
$access_token = get_option('top_fb_token');
|
1088 |
+
|
1089 |
+
switch ($social_network) {
|
1090 |
+
case 'facebook':
|
1091 |
+
$result1="";$pagearray1="";
|
1092 |
+
$pp=wp_remote_get("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/me/accounts?access_token=$access_token&limit=100&offset=0");
|
1093 |
+
//print_r($pp);
|
1094 |
+
$me=wp_remote_get("https://graph.facebook.com/".ROP_TOP_FB_API_VERSION."/me/?access_token=$access_token&limit=100&offset=0");
|
1095 |
+
if(is_array($pp))
|
1096 |
+
{
|
1097 |
+
$result1=$pp['body'];
|
1098 |
+
$result2 = $me['body'];
|
1099 |
+
$pagearray2 = json_decode($result2);
|
1100 |
+
//print_r($pagearray2);
|
1101 |
+
$pagearray1 = json_decode($result1);
|
1102 |
+
$profile['name'] = $pagearray2->first_name.' '.$pagearray2->last_name;
|
1103 |
+
$profile['id'] = $pagearray2->id;
|
1104 |
+
$profile['category'] ='profile';
|
1105 |
+
$profile['access_token'] = $access_token;
|
1106 |
+
if(is_array($pagearray1->data))
|
1107 |
+
array_unshift($pagearray1->data, $profile);
|
1108 |
+
//$pagearray1->data[count($pagearray1->data)] = $profile;
|
1109 |
+
$result1 = json_encode($pagearray1);
|
1110 |
+
//print_r($results1);
|
1111 |
+
echo $result1;
|
1112 |
|
1113 |
+
}
|
|
|
|
|
|
|
1114 |
break;
|
1115 |
+
}
|
1116 |
+
die(); // Required
|
1117 |
+
}
|
1118 |
+
|
1119 |
+
// Adds pages
|
1120 |
+
public function addPages()
|
1121 |
+
{
|
1122 |
+
$social_network = $_POST['social_network'];
|
1123 |
+
$access_token = $_POST['page_token'];
|
1124 |
+
$page_id= $_POST['page_id'];
|
1125 |
+
|
1126 |
+
switch ($social_network) {
|
1127 |
+
case 'facebook':
|
1128 |
+
$user_details['profile_image_url'] = $_POST['picture_url'];
|
1129 |
+
$user_details['name'] = $_POST['page_name'];
|
1130 |
+
$user_details = (object) $user_details;
|
1131 |
+
$newUser = array(
|
1132 |
+
'user_id' => $page_id,
|
1133 |
+
'oauth_token' => $access_token,
|
1134 |
+
'oauth_token_secret' => "",
|
1135 |
+
'oauth_user_details' => $user_details,
|
1136 |
+
'service' => 'facebook'
|
1137 |
+
);
|
1138 |
+
|
1139 |
+
$loggedInUsers = get_option('cwp_top_logged_in_users');
|
1140 |
+
if(empty($loggedInUsers)) { $loggedInUsers = array(); }
|
1141 |
+
|
1142 |
+
foreach ($loggedInUsers as $key=>$user) {
|
1143 |
+
if ($user['user_id'] == $page_id)
|
1144 |
+
unset($loggedInUsers[$key]);
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
if(in_array($newUser, $loggedInUsers)) {
|
1148 |
+
echo "You already added that user! no can do !";
|
1149 |
+
} else {
|
1150 |
+
array_push($loggedInUsers, $newUser);
|
1151 |
+
update_option('cwp_top_logged_in_users', $loggedInUsers);
|
1152 |
+
echo SETTINGSURL;
|
1153 |
+
}
|
1154 |
+
|
1155 |
+
|
1156 |
break;
|
1157 |
}
|
1158 |
die(); // Required
|
1159 |
}
|
1160 |
|
1161 |
+
// Adds new account
|
1162 |
+
public function addNewAccount()
|
1163 |
+
{
|
1164 |
+
global $cwp_top_settings;
|
1165 |
+
$social_network = $_POST['social_network'];
|
1166 |
+
switch ($social_network) {
|
1167 |
+
case 'twitter':
|
1168 |
+
$this->oAuthCallback = $_POST['currentURL'];
|
1169 |
+
$twitter = new RopTwitterOAuth($this->consumer, $this->consumerSecret);
|
1170 |
+
$requestToken = $twitter->getRequestToken($this->oAuthCallback);
|
1171 |
+
|
1172 |
+
update_option('cwp_top_oauth_token', $requestToken['oauth_token']);
|
1173 |
+
update_option('cwp_top_oauth_token_secret', $requestToken['oauth_token_secret']);
|
1174 |
+
|
1175 |
+
switch ($twitter->http_code) {
|
1176 |
+
case 200:
|
1177 |
+
$url = $twitter->getAuthorizeURL($requestToken['oauth_token']);
|
1178 |
+
echo $url;
|
1179 |
+
break;
|
1180 |
+
|
1181 |
+
default:
|
1182 |
+
return __("Could not connect to Twitter!", CWP_TEXTDOMAIN);
|
1183 |
+
break;
|
1184 |
+
}
|
1185 |
+
break;
|
1186 |
+
case 'facebook':
|
1187 |
+
if (isset($_POST['app_id'])){
|
1188 |
+
update_option('cwp_top_app_id', $_POST['app_id']);
|
1189 |
+
update_option('cwp_top_app_secret', $_POST['app_secret']);
|
1190 |
+
|
1191 |
+
$top_session_state = md5(uniqid(rand(), TRUE));
|
1192 |
+
|
1193 |
+
update_option('top_fb_session_state',$top_session_state);
|
1194 |
+
$dialog_url = "https://www.facebook.com/".ROP_TOP_FB_API_VERSION."/dialog/oauth?client_id="
|
1195 |
+
. $_POST['app_id'] . "&redirect_uri=" . SETTINGSURL . "&state="
|
1196 |
+
. $top_session_state . "&scope=publish_stream,publish_actions,manage_pages";
|
1197 |
+
echo $dialog_url;
|
1198 |
+
}
|
1199 |
+
break;
|
1200 |
+
case 'linkedin':
|
1201 |
+
$top_session_state = uniqid('', true);
|
1202 |
+
|
1203 |
+
$url = 'https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id='.$_POST["app_id"].'&scope=rw_nus&state='.$top_session_state.'&redirect_uri='.SETTINGSURL;
|
1204 |
+
|
1205 |
+
update_option('top_lk_session_state',$top_session_state);
|
1206 |
+
if (isset($_POST['app_id'])){
|
1207 |
+
update_option('cwp_top_lk_app_id', $_POST['app_id']);
|
1208 |
+
update_option('cwp_top_lk_app_secret', $_POST['app_secret']);
|
1209 |
+
}
|
1210 |
+
if (function_exists('topProAddNewAccount')) {
|
1211 |
+
echo $url;
|
1212 |
+
}
|
1213 |
+
else{
|
1214 |
+
update_option('cwp_topnew_notice',"You need to <a target='_blank' href='http://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!");
|
1215 |
+
echo "You need to <a target='_blank' href='http://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!";
|
1216 |
+
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
break;
|
1220 |
+
|
1221 |
+
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
|
1225 |
+
|
1226 |
+
|
1227 |
+
|
1228 |
+
die(); // Required
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
// Adds more than one account
|
1232 |
+
public function addNewAccountPro()
|
1233 |
{
|
1234 |
if (function_exists('topProAddNewAccount')) {
|
1235 |
+
topProAddNewAccount($_POST['social_network']);
|
1236 |
}
|
1237 |
else{
|
1238 |
+
update_option('cwp_topnew_notice',"You need to <a target='_blank' href='http://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!");
|
1239 |
+
echo "You need to <a target='_blank' href='http://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!";
|
1240 |
|
1241 |
}
|
1242 |
die(); // Required
|
1264 |
}
|
1265 |
|
1266 |
// Clears all Twitter user credentials.
|
1267 |
+
public function logOutUser()
|
1268 |
{
|
1269 |
$userID = $_POST['user_id'];
|
1270 |
|
1318 |
update_option('top_opt_tweet_multiple_times', 'off');
|
1319 |
}
|
1320 |
|
1321 |
+
if(!array_key_exists('top_opt_ga_tracking', $options)) {
|
1322 |
+
update_option('top_opt_ga_tracking', 'off');
|
1323 |
+
}
|
1324 |
+
|
1325 |
//if(!array_key_exists('top_opt_tweet_specific_category', $options)) {
|
1326 |
// update_option('top_opt_tweet_specific_category', '');
|
1327 |
//}
|
1363 |
'top_opt_post_with_image' => 'off',
|
1364 |
'top_opt_bitly_user' =>'',
|
1365 |
'top_opt_bitly_key' =>'',
|
1366 |
+
'top_opt_post_type_custom_field' => '',
|
1367 |
'top_opt_add_text' => '',
|
1368 |
'top_opt_add_text_at' => 'beginning',
|
1369 |
+
'top_opt_include_link' => 'true',
|
1370 |
'top_opt_custom_url_option' => 'off',
|
1371 |
'top_opt_use_url_shortner' => 'off',
|
1372 |
+
'top_opt_ga_tracking' => 'on',
|
1373 |
'top_opt_url_shortner' => 'is.gd',
|
1374 |
'top_opt_custom_hashtag_option' => 'nohashtag',
|
1375 |
'top_opt_hashtags' => '',
|
1387 |
'cwp_topnew_notice' => '',
|
1388 |
'top_opt_excluded_post' => '',
|
1389 |
'top_opt_tweet-multiple-times' => 'off',
|
1390 |
+
'cwp_top_logged_in_users' => '',
|
1391 |
+
'top_fb_token' =>''
|
1392 |
);
|
1393 |
|
1394 |
foreach ($defaultOptions as $option => $defaultValue) {
|
1505 |
|
1506 |
function top_plugin_action_links($links, $file) {
|
1507 |
|
1508 |
+
if ($file == ROPPLUGINBASENAME) {
|
1509 |
// The "page" query string value must be equal to the slug
|
1510 |
// of the Settings admin page we defined earlier, which in
|
1511 |
// this case equals "myplugin-settings".
|
1569 |
add_action('wp_ajax_reset_options', array($this, 'resetAllOptions'));
|
1570 |
|
1571 |
// Add new twitter account ajax action
|
1572 |
+
add_action('wp_ajax_nopriv_add_new_account', array($this, 'addNewAccount'));
|
1573 |
+
add_action('wp_ajax_add_new_account', array($this, 'addNewAccount'));
|
1574 |
+
|
1575 |
+
// Display managed pages ajax action
|
1576 |
+
add_action('wp_ajax_nopriv_display_pages', array($this, 'displayPages'));
|
1577 |
+
add_action('wp_ajax_display_pages', array($this, 'displayPages'));
|
1578 |
+
|
1579 |
+
// Add new account managed pages ajax action
|
1580 |
+
add_action('wp_ajax_nopriv_add_pages', array($this, 'addPages'));
|
1581 |
+
add_action('wp_ajax_add_pages', array($this, 'addPages'));
|
1582 |
|
1583 |
// Add more than one twitter account ajax action
|
1584 |
+
add_action('wp_ajax_nopriv_add_new_account_pro', array($this, 'addNewAccountPro'));
|
1585 |
+
add_action('wp_ajax_add_new_account_pro', array($this, 'addNewAccountPro'));
|
1586 |
|
1587 |
// Log Out Twitter user ajax action
|
1588 |
+
add_action('wp_ajax_nopriv_log_out_user', array($this, 'logOutUser'));
|
1589 |
+
add_action('wp_ajax_log_out_user', array($this, 'logOutUser'));
|
1590 |
|
1591 |
// Tweet Old Post ajax action.
|
1592 |
add_action('wp_ajax_nopriv_tweet_old_post_action', array($this, 'startTweetOldPost'));
|
1614 |
|
1615 |
//add_filter('plugin_action_links', array($this,'top_plugin_action_links'), 10, 2);
|
1616 |
|
1617 |
+
//add_action('admin_notices', array($this,'top_admin_notice'));
|
1618 |
|
1619 |
add_action('admin_init', array($this,'top_nag_ignore'));
|
1620 |
|
1624 |
add_filter('plugin_action_links',array($this,'top_plugin_action_links'), 10, 2);
|
1625 |
|
1626 |
add_action('cwp_top_tweet_cron', array($this, 'tweetOldPost'));
|
|
|
1627 |
}
|
1628 |
|
1629 |
public function loadAllScriptsAndStyles()
|
1635 |
if ($_GET['page'] == $cwp_top_settings['slug'] || $_GET['page'] == "ExcludePosts") {
|
1636 |
|
1637 |
// Enqueue and Register Main CSS File
|
1638 |
+
wp_register_style( 'cwp_top_stylesheet', ROPCSSFILE, false, '1.0.0' );
|
1639 |
wp_enqueue_style( 'cwp_top_stylesheet' );
|
1640 |
|
1641 |
// Register Main JS File
|
1642 |
+
wp_enqueue_script( 'cwp_top_js_countdown', ROPJSCOUNTDOWN, array(), '1.0.0', true );
|
1643 |
+
wp_enqueue_script( 'cwp_top_javascript', ROPJSFILE, array(), '1.0.0', true );
|
1644 |
wp_localize_script( 'cwp_top_javascript', 'cwp_top_ajaxload', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
|
1645 |
}
|
1646 |
}
|
1667 |
$cap = 1;
|
1668 |
else
|
1669 |
$cap='manage_options';
|
1670 |
+
add_menu_page($cwp_top_settings['name'], $cwp_top_settings['name'], $cap, $cwp_top_settings['slug'], array($this, 'loadMainView'), '','99.87514');
|
1671 |
add_submenu_page($cwp_top_settings['slug'], __('Exclude Posts',CWP_TEXTDOMAIN), __('Exclude Posts',CWP_TEXTDOMAIN), 'manage_options', __('ExcludePosts',CWP_TEXTDOMAIN), 'top_exclude');
|
1672 |
}
|
1673 |
|
1748 |
$shortURL = wp_get_shortlink($id);
|
1749 |
}
|
1750 |
|
1751 |
+
if($shortURL != ' 400 '&& $shortURL!="500" && $shortURL!="0") {
|
1752 |
return $shortURL;
|
1753 |
}
|
1754 |
+
else
|
1755 |
+
update_option('cwp_topnew_notice','Looks like is an error with your url shortner');
|
1756 |
+
}
|
1757 |
+
|
1758 |
+
public function rop_load_dashboard_icon()
|
1759 |
+
{
|
1760 |
+
wp_register_style( 'rop_custom_dashboard_icon', ROPCUSTOMDASHBOARDICON, false, '1.0.0' );
|
1761 |
+
wp_enqueue_style( 'rop_custom_dashboard_icon' );
|
1762 |
}
|
1763 |
|
1764 |
}
|
inc/exclude-posts.php
CHANGED
@@ -1,367 +1,367 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once(
|
4 |
-
require_once(
|
5 |
-
|
6 |
-
if (!function_exists ("mysql_real_escape_string"))
|
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 |
-
function top_exclude() {
|
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 |
-
$exposts = preg_replace('/,,+/', ',', $exposts);
|
47 |
-
if (substr($exposts, 0, 1) == ",") {
|
48 |
-
$exposts = substr($exposts, 1, strlen($exposts));
|
49 |
-
}
|
50 |
-
if (substr($exposts, -1, 1) == ",") {
|
51 |
-
$exposts = substr($exposts, 0, strlen($exposts) - 1);
|
52 |
-
}
|
53 |
-
$excluded_posts = explode(",", $exposts);
|
54 |
-
|
55 |
-
|
56 |
-
if (!isset($_GET['paged']))
|
57 |
-
$_GET['paged'] = 1;
|
58 |
-
|
59 |
-
if (isset($_POST["excludeall"])) {
|
60 |
-
if (substr($_POST["delids"], 0, -1) == "") {
|
61 |
-
print('
|
62 |
-
<div id="message" style="margin-top:30px" class="updated fade">
|
63 |
-
<p>' . __('No post selected please select a post to be excluded.', 'TweetOldPost') . '</p>
|
64 |
-
</div>');
|
65 |
-
} else {
|
66 |
-
|
67 |
-
update_option('top_opt_excluded_post',$exposts);
|
68 |
-
print('
|
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 = 'post')
|
84 |
-
AND post_status = 'publish'";
|
85 |
-
|
86 |
-
|
87 |
-
if(isset($_POST["setFilter"]))
|
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 |
-
$_s = $_POST["s"];
|
124 |
-
$_s = mysql_real_escape_string($_s);
|
125 |
-
$sql = $sql . " and post_title like '%" . trim( $_s) . "%'";
|
126 |
-
$search_term = trim( $_s);
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
$sql = $sql . " order by post_date desc";
|
131 |
-
$posts = $wpdb->get_results($sql);
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
$from = $_GET["paged"] * $records_per_page - $records_per_page;
|
136 |
-
$to = min($_GET['paged'] * $records_per_page, count($posts));
|
137 |
-
$post_count =count($posts);
|
138 |
-
|
139 |
-
$ex = 0;
|
140 |
-
$excludeList = array();
|
141 |
-
for ($j = 0; $j < $post_count; $j++) {
|
142 |
-
if (in_array($posts[$j]->ID, $excluded_posts)) {
|
143 |
-
$excludeList[$ex] = $posts[$j]->ID;
|
144 |
-
$ex = $ex + 1;
|
145 |
-
}
|
146 |
-
}
|
147 |
-
if(count($excludeList) >0)
|
148 |
-
{
|
149 |
-
$exposts = implode(",",$excludeList);
|
150 |
-
}
|
151 |
-
print('<form id="top_TweetOldPost" name="top_TweetOldPost" action="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=ExcludePosts" method="post"><input type="hidden" name="delids" id="delids" value="' . $exposts . '" /><input type="submit" id="pageit" name="pageit" style="display:none" value="" /> ');
|
152 |
-
print('<div class="tablenav"><div class="alignleft actions">');
|
153 |
-
print('<input type="submit" class="button-secondary" name="excludeall" value="' . __($update_text, 'TweetOldPost') . '" />');
|
154 |
-
print('<select name="selFilter" id="selFilter" style="width:100px"><option value="all" '.top_opt_optionselected("all",$ex_filter).'> All </option><option value="excluded" '.top_opt_optionselected("excluded",$ex_filter).'> Excluded </option></select>');
|
155 |
-
$dropdown_options = array('show_option_all' => __('Selected Categories'),'exclude' =>$omit_cat,'selected' =>$cat_filter);
|
156 |
-
wp_dropdown_categories($dropdown_options);
|
157 |
-
print('<input type="submit" class="button-secondary" name="setFilter" value="' . __('Filter', 'TweetOldPost') . '" />');
|
158 |
-
print('<p class="search-box" style="margin:0px">
|
159 |
-
<input type="text" id="post-search-input" name="s" value="'.$search_term.'" />
|
160 |
-
<input type="submit" value="Search Posts" name="search" class="button" />
|
161 |
-
</p>');
|
162 |
-
print('</div>');
|
163 |
-
if (count($posts) > 0) {
|
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' => $_GET['paged']
|
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(( $_GET['paged'] - 1 ) * $records_per_page + 1),
|
179 |
-
number_format_i18n(min($_GET['paged'] * $records_per_page, count($posts))),
|
180 |
-
number_format_i18n(count($posts)),
|
181 |
-
$page_links
|
182 |
-
);
|
183 |
-
echo $page_links_text;
|
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>
|
203 |
-
');
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
for ($i = $from; $i < $to; $i++) {
|
209 |
-
|
210 |
-
|
211 |
-
$categories = get_the_category($posts[$i]->ID);
|
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="chkbx" id="del' . $posts[$i]->ID . '" onchange="javascript:managedelid(this,\'' . $posts[$i]->ID . '\');" value="' . $posts[$i]->ID . '" ' . $checked . '/>
|
235 |
-
</th>
|
236 |
-
<td>
|
237 |
-
' . ($i + 1) . '
|
238 |
-
</td>
|
239 |
-
<td>
|
240 |
-
' . $posts[$i]->ID . '
|
241 |
-
</td>
|
242 |
-
<td>
|
243 |
-
<a href=' . $posts[$i]->guid . ' target="_blank">' . $posts[$i]->post_title . '</a>
|
244 |
-
</td>
|
245 |
-
<td>
|
246 |
-
' . $posts[$i]->user_nicename . '
|
247 |
-
</td>
|
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('
|
262 |
-
</tbody>
|
263 |
-
</table>
|
264 |
-
</div>
|
265 |
-
');
|
266 |
-
|
267 |
-
print('<div class="tablenav"><div class="alignleft actions"><input type="submit" class="button-secondary" name="excludeall" value="' . __($update_text, 'TweetOldPost') . '" /></div>');
|
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(( $_GET['paged'] - 1 ) * $records_per_page + 1),
|
274 |
-
number_format_i18n(min($_GET['paged'] * $records_per_page, count($posts))),
|
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('</div>');//tablenav div
|
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 |
-
print('
|
362 |
-
<div id="message" class="updated fade">
|
363 |
-
<p>' . __('You do not have enough permission to set the option. Please contact your admin.', 'TweetOldPost') . '</p>
|
364 |
-
</div>');
|
365 |
-
}
|
366 |
-
}
|
367 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once(ROPPLUGINPATH.'/tweet-old-post.php');
|
4 |
+
require_once(ROPPLUGINPATH.'/inc/xml.php');
|
5 |
+
|
6 |
+
if (!function_exists ("mysql_real_escape_string"))
|
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 |
+
function top_exclude() {
|
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 |
+
$exposts = preg_replace('/,,+/', ',', $exposts);
|
47 |
+
if (substr($exposts, 0, 1) == ",") {
|
48 |
+
$exposts = substr($exposts, 1, strlen($exposts));
|
49 |
+
}
|
50 |
+
if (substr($exposts, -1, 1) == ",") {
|
51 |
+
$exposts = substr($exposts, 0, strlen($exposts) - 1);
|
52 |
+
}
|
53 |
+
$excluded_posts = explode(",", $exposts);
|
54 |
+
|
55 |
+
|
56 |
+
if (!isset($_GET['paged']))
|
57 |
+
$_GET['paged'] = 1;
|
58 |
+
|
59 |
+
if (isset($_POST["excludeall"])) {
|
60 |
+
if (substr($_POST["delids"], 0, -1) == "") {
|
61 |
+
print('
|
62 |
+
<div id="message" style="margin-top:30px" class="updated fade">
|
63 |
+
<p>' . __('No post selected please select a post to be excluded.', 'TweetOldPost') . '</p>
|
64 |
+
</div>');
|
65 |
+
} else {
|
66 |
+
|
67 |
+
update_option('top_opt_excluded_post',$exposts);
|
68 |
+
print('
|
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 = 'post')
|
84 |
+
AND post_status = 'publish'";
|
85 |
+
|
86 |
+
|
87 |
+
if(isset($_POST["setFilter"]))
|
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 |
+
$_s = $_POST["s"];
|
124 |
+
$_s = mysql_real_escape_string($_s);
|
125 |
+
$sql = $sql . " and post_title like '%" . trim( $_s) . "%'";
|
126 |
+
$search_term = trim( $_s);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
$sql = $sql . " order by post_date desc";
|
131 |
+
$posts = $wpdb->get_results($sql);
|
132 |
+
|
133 |
+
|
134 |
+
|
135 |
+
$from = $_GET["paged"] * $records_per_page - $records_per_page;
|
136 |
+
$to = min($_GET['paged'] * $records_per_page, count($posts));
|
137 |
+
$post_count =count($posts);
|
138 |
+
|
139 |
+
$ex = 0;
|
140 |
+
$excludeList = array();
|
141 |
+
for ($j = 0; $j < $post_count; $j++) {
|
142 |
+
if (in_array($posts[$j]->ID, $excluded_posts)) {
|
143 |
+
$excludeList[$ex] = $posts[$j]->ID;
|
144 |
+
$ex = $ex + 1;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
if(count($excludeList) >0)
|
148 |
+
{
|
149 |
+
$exposts = implode(",",$excludeList);
|
150 |
+
}
|
151 |
+
print('<form id="top_TweetOldPost" name="top_TweetOldPost" action="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=ExcludePosts" method="post"><input type="hidden" name="delids" id="delids" value="' . $exposts . '" /><input type="submit" id="pageit" name="pageit" style="display:none" value="" /> ');
|
152 |
+
print('<div class="tablenav"><div class="alignleft actions">');
|
153 |
+
print('<input type="submit" class="button-secondary" name="excludeall" value="' . __($update_text, 'TweetOldPost') . '" />');
|
154 |
+
print('<select name="selFilter" id="selFilter" style="width:100px"><option value="all" '.top_opt_optionselected("all",$ex_filter).'> All </option><option value="excluded" '.top_opt_optionselected("excluded",$ex_filter).'> Excluded </option></select>');
|
155 |
+
$dropdown_options = array('show_option_all' => __('Selected Categories'),'exclude' =>$omit_cat,'selected' =>$cat_filter);
|
156 |
+
wp_dropdown_categories($dropdown_options);
|
157 |
+
print('<input type="submit" class="button-secondary" name="setFilter" value="' . __('Filter', 'TweetOldPost') . '" />');
|
158 |
+
print('<p class="search-box" style="margin:0px">
|
159 |
+
<input type="text" id="post-search-input" name="s" value="'.$search_term.'" />
|
160 |
+
<input type="submit" value="Search Posts" name="search" class="button" />
|
161 |
+
</p>');
|
162 |
+
print('</div>');
|
163 |
+
if (count($posts) > 0) {
|
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' => $_GET['paged']
|
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(( $_GET['paged'] - 1 ) * $records_per_page + 1),
|
179 |
+
number_format_i18n(min($_GET['paged'] * $records_per_page, count($posts))),
|
180 |
+
number_format_i18n(count($posts)),
|
181 |
+
$page_links
|
182 |
+
);
|
183 |
+
echo $page_links_text;
|
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>
|
203 |
+
');
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
|
208 |
+
for ($i = $from; $i < $to; $i++) {
|
209 |
+
|
210 |
+
|
211 |
+
$categories = get_the_category($posts[$i]->ID);
|
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="chkbx" id="del' . $posts[$i]->ID . '" onchange="javascript:managedelid(this,\'' . $posts[$i]->ID . '\');" value="' . $posts[$i]->ID . '" ' . $checked . '/>
|
235 |
+
</th>
|
236 |
+
<td>
|
237 |
+
' . ($i + 1) . '
|
238 |
+
</td>
|
239 |
+
<td>
|
240 |
+
' . $posts[$i]->ID . '
|
241 |
+
</td>
|
242 |
+
<td>
|
243 |
+
<a href=' . $posts[$i]->guid . ' target="_blank">' . $posts[$i]->post_title . '</a>
|
244 |
+
</td>
|
245 |
+
<td>
|
246 |
+
' . $posts[$i]->user_nicename . '
|
247 |
+
</td>
|
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('
|
262 |
+
</tbody>
|
263 |
+
</table>
|
264 |
+
</div>
|
265 |
+
');
|
266 |
+
|
267 |
+
print('<div class="tablenav"><div class="alignleft actions"><input type="submit" class="button-secondary" name="excludeall" value="' . __($update_text, 'TweetOldPost') . '" /></div>');
|
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(( $_GET['paged'] - 1 ) * $records_per_page + 1),
|
274 |
+
number_format_i18n(min($_GET['paged'] * $records_per_page, count($posts))),
|
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('</div>');//tablenav div
|
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 |
+
print('
|
362 |
+
<div id="message" class="updated fade">
|
363 |
+
<p>' . __('You do not have enough permission to set the option. Please contact your admin.', 'TweetOldPost') . '</p>
|
364 |
+
</div>');
|
365 |
+
}
|
366 |
+
}
|
367 |
?>
|
inc/oAuth/OAuth.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
|
4 |
/* Generic exception class
|
5 |
*/
|
6 |
-
if (!class_exists('
|
7 |
-
class
|
8 |
// pass
|
9 |
}
|
10 |
}
|
11 |
-
if (!class_exists('
|
12 |
-
class
|
13 |
public $key;
|
14 |
public $secret;
|
15 |
|
@@ -20,12 +20,12 @@ class OAuthConsumer {
|
|
20 |
}
|
21 |
|
22 |
function __toString() {
|
23 |
-
return "
|
24 |
}
|
25 |
}
|
26 |
}
|
27 |
-
if (!class_exists('
|
28 |
-
class
|
29 |
// access tokens and request tokens
|
30 |
public $key;
|
31 |
public $secret;
|
@@ -45,9 +45,9 @@ class OAuthToken {
|
|
45 |
*/
|
46 |
function to_string() {
|
47 |
return "oauth_token=" .
|
48 |
-
|
49 |
"&oauth_token_secret=" .
|
50 |
-
|
51 |
}
|
52 |
|
53 |
function __toString() {
|
@@ -59,8 +59,8 @@ class OAuthToken {
|
|
59 |
* A class for implementing a Signature Method
|
60 |
* See section 9 ("Signing Requests") in the spec
|
61 |
*/
|
62 |
-
if (!class_exists('
|
63 |
-
abstract class
|
64 |
/**
|
65 |
* Needs to return the name of the Signature Method (ie HMAC-SHA1)
|
66 |
* @return string
|
@@ -70,20 +70,20 @@ abstract class OAuthSignatureMethod {
|
|
70 |
/**
|
71 |
* Build up the signature
|
72 |
* NOTE: The output of this function MUST NOT be urlencoded.
|
73 |
-
* the encoding is handled in
|
74 |
* request is serialized
|
75 |
-
* @param
|
76 |
-
* @param
|
77 |
-
* @param
|
78 |
* @return string
|
79 |
*/
|
80 |
abstract public function build_signature($request, $consumer, $token);
|
81 |
|
82 |
/**
|
83 |
* Verifies that a given signature is correct
|
84 |
-
* @param
|
85 |
-
* @param
|
86 |
-
* @param
|
87 |
* @param string $signature
|
88 |
* @return bool
|
89 |
*/
|
@@ -100,8 +100,8 @@ abstract class OAuthSignatureMethod {
|
|
100 |
* character (ASCII code 38) even if empty.
|
101 |
* - Chapter 9.2 ("HMAC-SHA1")
|
102 |
*/
|
103 |
-
if (!class_exists('
|
104 |
-
class
|
105 |
function get_name() {
|
106 |
return "HMAC-SHA1";
|
107 |
}
|
@@ -116,7 +116,7 @@ class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod {
|
|
116 |
($token) ? $token->secret : ""
|
117 |
);
|
118 |
|
119 |
-
$key_parts =
|
120 |
$key = implode('&', $key_parts);
|
121 |
|
122 |
return base64_encode(hash_hmac('sha1', $base_string, $key, true));
|
@@ -128,8 +128,8 @@ class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod {
|
|
128 |
* over a secure channel such as HTTPS. It does not use the Signature Base String.
|
129 |
* - Chapter 9.4 ("PLAINTEXT")
|
130 |
*/
|
131 |
-
if (!class_exists('
|
132 |
-
class
|
133 |
public function get_name() {
|
134 |
return "PLAINTEXT";
|
135 |
}
|
@@ -141,7 +141,7 @@ class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod {
|
|
141 |
* - Chapter 9.4.1 ("Generating Signatures")
|
142 |
*
|
143 |
* Please note that the second encoding MUST NOT happen in the SignatureMethod, as
|
144 |
-
*
|
145 |
*/
|
146 |
public function build_signature($request, $consumer, $token) {
|
147 |
$key_parts = array(
|
@@ -149,7 +149,7 @@ class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod {
|
|
149 |
($token) ? $token->secret : ""
|
150 |
);
|
151 |
|
152 |
-
$key_parts =
|
153 |
$key = implode('&', $key_parts);
|
154 |
$request->base_string = $key;
|
155 |
|
@@ -166,8 +166,8 @@ class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod {
|
|
166 |
* specification.
|
167 |
* - Chapter 9.3 ("RSA-SHA1")
|
168 |
*/
|
169 |
-
if (!class_exists('
|
170 |
-
abstract class
|
171 |
public function get_name() {
|
172 |
return "RSA-SHA1";
|
173 |
}
|
@@ -226,8 +226,8 @@ abstract class OAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod {
|
|
226 |
}
|
227 |
}
|
228 |
}
|
229 |
-
if (!class_exists('
|
230 |
-
class
|
231 |
private $parameters;
|
232 |
private $http_method;
|
233 |
private $http_url;
|
@@ -238,7 +238,7 @@ class OAuthRequest {
|
|
238 |
|
239 |
function __construct($http_method, $http_url, $parameters=NULL) {
|
240 |
@$parameters or $parameters = array();
|
241 |
-
$parameters = array_merge(
|
242 |
$this->parameters = $parameters;
|
243 |
$this->http_method = $http_method;
|
244 |
$this->http_url = $http_url;
|
@@ -265,10 +265,10 @@ class OAuthRequest {
|
|
265 |
// parsed parameter-list
|
266 |
if (!$parameters) {
|
267 |
// Find request headers
|
268 |
-
$request_headers =
|
269 |
|
270 |
// Parse the query-string to find GET parameters
|
271 |
-
$parameters =
|
272 |
|
273 |
// It's a POST request of the proper content-type, so parse POST
|
274 |
// parameters and add those overriding any duplicates from GET
|
@@ -276,7 +276,7 @@ class OAuthRequest {
|
|
276 |
&& @strstr($request_headers["Content-Type"],
|
277 |
"application/x-www-form-urlencoded")
|
278 |
) {
|
279 |
-
$post_data =
|
280 |
file_get_contents(self::$POST_INPUT)
|
281 |
);
|
282 |
$parameters = array_merge($parameters, $post_data);
|
@@ -285,7 +285,7 @@ class OAuthRequest {
|
|
285 |
// We have a Authorization-header with OAuth data. Parse the header
|
286 |
// and add those overriding any duplicates from GET or POST
|
287 |
if (@substr($request_headers['Authorization'], 0, 6) == "OAuth ") {
|
288 |
-
$header_parameters =
|
289 |
$request_headers['Authorization']
|
290 |
);
|
291 |
$parameters = array_merge($parameters, $header_parameters);
|
@@ -293,7 +293,7 @@ class OAuthRequest {
|
|
293 |
|
294 |
}
|
295 |
|
296 |
-
return new
|
297 |
}
|
298 |
|
299 |
/**
|
@@ -301,16 +301,16 @@ class OAuthRequest {
|
|
301 |
*/
|
302 |
public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) {
|
303 |
@$parameters or $parameters = array();
|
304 |
-
$defaults = array("oauth_version" =>
|
305 |
-
"oauth_nonce" =>
|
306 |
-
"oauth_timestamp" =>
|
307 |
"oauth_consumer_key" => $consumer->key);
|
308 |
if ($token)
|
309 |
$defaults['oauth_token'] = $token->key;
|
310 |
|
311 |
$parameters = array_merge($defaults, $parameters);
|
312 |
|
313 |
-
return new
|
314 |
}
|
315 |
|
316 |
public function set_parameter($name, $value, $allow_duplicates = true) {
|
@@ -361,7 +361,7 @@ class OAuthRequest {
|
|
361 |
unset($params['oauth_signature']);
|
362 |
}
|
363 |
|
364 |
-
return
|
365 |
}
|
366 |
|
367 |
/**
|
@@ -378,7 +378,7 @@ class OAuthRequest {
|
|
378 |
$this->get_signable_parameters()
|
379 |
);
|
380 |
|
381 |
-
$parts =
|
382 |
|
383 |
return implode('&', $parts);
|
384 |
}
|
@@ -427,7 +427,7 @@ class OAuthRequest {
|
|
427 |
* builds the data one would send in a POST request
|
428 |
*/
|
429 |
public function to_postdata() {
|
430 |
-
return
|
431 |
}
|
432 |
|
433 |
/**
|
@@ -436,7 +436,7 @@ class OAuthRequest {
|
|
436 |
public function to_header($realm=null) {
|
437 |
$first = true;
|
438 |
if($realm) {
|
439 |
-
$out = 'Authorization: OAuth realm="' .
|
440 |
$first = false;
|
441 |
} else
|
442 |
$out = 'Authorization: OAuth';
|
@@ -445,12 +445,12 @@ class OAuthRequest {
|
|
445 |
foreach ($this->parameters as $k => $v) {
|
446 |
if (substr($k, 0, 5) != "oauth") continue;
|
447 |
if (is_array($v)) {
|
448 |
-
throw new
|
449 |
}
|
450 |
$out .= ($first) ? ' ' : ',';
|
451 |
-
$out .=
|
452 |
'="' .
|
453 |
-
|
454 |
'"';
|
455 |
$first = false;
|
456 |
}
|
@@ -495,8 +495,8 @@ class OAuthRequest {
|
|
495 |
}
|
496 |
}
|
497 |
}
|
498 |
-
if (!class_exists('
|
499 |
-
class
|
500 |
protected $timestamp_threshold = 300; // in seconds, five minutes
|
501 |
protected $version = '1.0'; // hi blaine
|
502 |
protected $signature_methods = array();
|
@@ -579,7 +579,7 @@ class OAuthServer {
|
|
579 |
$version = '1.0';
|
580 |
}
|
581 |
if ($version !== $this->version) {
|
582 |
-
throw new
|
583 |
}
|
584 |
return $version;
|
585 |
}
|
@@ -594,12 +594,12 @@ class OAuthServer {
|
|
594 |
if (!$signature_method) {
|
595 |
// According to chapter 7 ("Accessing Protected Ressources") the signature-method
|
596 |
// parameter is required, and we can't just fallback to PLAINTEXT
|
597 |
-
throw new
|
598 |
}
|
599 |
|
600 |
if (!in_array($signature_method,
|
601 |
array_keys($this->signature_methods))) {
|
602 |
-
throw new
|
603 |
"Signature method '$signature_method' not supported " .
|
604 |
"try one of the following: " .
|
605 |
implode(", ", array_keys($this->signature_methods))
|
@@ -614,12 +614,12 @@ class OAuthServer {
|
|
614 |
private function get_consumer(&$request) {
|
615 |
$consumer_key = @$request->get_parameter("oauth_consumer_key");
|
616 |
if (!$consumer_key) {
|
617 |
-
throw new
|
618 |
}
|
619 |
|
620 |
$consumer = $this->data_store->lookup_consumer($consumer_key);
|
621 |
if (!$consumer) {
|
622 |
-
throw new
|
623 |
}
|
624 |
|
625 |
return $consumer;
|
@@ -634,7 +634,7 @@ class OAuthServer {
|
|
634 |
$consumer, $token_type, $token_field
|
635 |
);
|
636 |
if (!$token) {
|
637 |
-
throw new
|
638 |
}
|
639 |
return $token;
|
640 |
}
|
@@ -662,7 +662,7 @@ class OAuthServer {
|
|
662 |
);
|
663 |
|
664 |
if (!$valid_sig) {
|
665 |
-
throw new
|
666 |
}
|
667 |
}
|
668 |
|
@@ -671,14 +671,14 @@ class OAuthServer {
|
|
671 |
*/
|
672 |
private function check_timestamp($timestamp) {
|
673 |
if( ! $timestamp )
|
674 |
-
throw new
|
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) {
|
681 |
-
throw new
|
682 |
"Expired timestamp, yours $timestamp, ours $now"
|
683 |
);
|
684 |
}
|
@@ -689,7 +689,7 @@ class OAuthServer {
|
|
689 |
*/
|
690 |
private function check_nonce($consumer, $token, $nonce, $timestamp) {
|
691 |
if( ! $nonce )
|
692 |
-
throw new
|
693 |
'Missing nonce parameter. The parameter is required'
|
694 |
);
|
695 |
|
@@ -701,14 +701,14 @@ class OAuthServer {
|
|
701 |
$timestamp
|
702 |
);
|
703 |
if ($found) {
|
704 |
-
throw new
|
705 |
}
|
706 |
}
|
707 |
|
708 |
}
|
709 |
}
|
710 |
-
if (!class_exists('
|
711 |
-
class
|
712 |
function lookup_consumer($consumer_key) {
|
713 |
// implement me
|
714 |
}
|
@@ -734,11 +734,11 @@ class OAuthDataStore {
|
|
734 |
|
735 |
}
|
736 |
}
|
737 |
-
if (!class_exists('
|
738 |
-
class
|
739 |
public static function urlencode_rfc3986($input) {
|
740 |
if (is_array($input)) {
|
741 |
-
return array_map(array('
|
742 |
} else if (is_scalar($input)) {
|
743 |
return str_replace(
|
744 |
'+',
|
@@ -770,7 +770,7 @@ class OAuthUtil {
|
|
770 |
$header_name = $matches[2][0];
|
771 |
$header_content = (isset($matches[5])) ? $matches[5][0] : $matches[4][0];
|
772 |
if (preg_match('/^oauth_/', $header_name) || !$only_allow_oauth_parameters) {
|
773 |
-
$params[$header_name] =
|
774 |
}
|
775 |
$offset = $match[1] + strlen($match[0]);
|
776 |
}
|
@@ -839,8 +839,8 @@ class OAuthUtil {
|
|
839 |
$parsed_parameters = array();
|
840 |
foreach ($pairs as $pair) {
|
841 |
$split = explode('=', $pair, 2);
|
842 |
-
$parameter =
|
843 |
-
$value = isset($split[1]) ?
|
844 |
|
845 |
if (isset($parsed_parameters[$parameter])) {
|
846 |
// We have already recieved parameter(s) with this name, so add to the list
|
@@ -864,8 +864,8 @@ class OAuthUtil {
|
|
864 |
if (!$params) return '';
|
865 |
|
866 |
// Urlencode both keys and values
|
867 |
-
$keys =
|
868 |
-
$values =
|
869 |
$params = array_combine($keys, $values);
|
870 |
|
871 |
// Parameters are sorted by name, using lexicographical byte value ordering.
|
3 |
|
4 |
/* Generic exception class
|
5 |
*/
|
6 |
+
if (!class_exists('RopOAuthException')) {
|
7 |
+
class RopOAuthException extends Exception {
|
8 |
// pass
|
9 |
}
|
10 |
}
|
11 |
+
if (!class_exists('RopOAuthConsumer')) {
|
12 |
+
class RopOAuthConsumer {
|
13 |
public $key;
|
14 |
public $secret;
|
15 |
|
20 |
}
|
21 |
|
22 |
function __toString() {
|
23 |
+
return "RopOAuthConsumer[key=$this->key,secret=$this->secret]";
|
24 |
}
|
25 |
}
|
26 |
}
|
27 |
+
if (!class_exists('RopOAuthToken')) {
|
28 |
+
class RopOAuthToken {
|
29 |
// access tokens and request tokens
|
30 |
public $key;
|
31 |
public $secret;
|
45 |
*/
|
46 |
function to_string() {
|
47 |
return "oauth_token=" .
|
48 |
+
RopOAuthUtil::urlencode_rfc3986($this->key) .
|
49 |
"&oauth_token_secret=" .
|
50 |
+
RopOAuthUtil::urlencode_rfc3986($this->secret);
|
51 |
}
|
52 |
|
53 |
function __toString() {
|
59 |
* A class for implementing a Signature Method
|
60 |
* See section 9 ("Signing Requests") in the spec
|
61 |
*/
|
62 |
+
if (!class_exists('RopOAuthSignatureMethod')) {
|
63 |
+
abstract class RopOAuthSignatureMethod {
|
64 |
/**
|
65 |
* Needs to return the name of the Signature Method (ie HMAC-SHA1)
|
66 |
* @return string
|
70 |
/**
|
71 |
* Build up the signature
|
72 |
* NOTE: The output of this function MUST NOT be urlencoded.
|
73 |
+
* the encoding is handled in RopOAuthRequest when the final
|
74 |
* request is serialized
|
75 |
+
* @param RopOAuthRequest $request
|
76 |
+
* @param RopOAuthConsumer $consumer
|
77 |
+
* @param RopOAuthToken $token
|
78 |
* @return string
|
79 |
*/
|
80 |
abstract public function build_signature($request, $consumer, $token);
|
81 |
|
82 |
/**
|
83 |
* Verifies that a given signature is correct
|
84 |
+
* @param RopOAuthRequest $request
|
85 |
+
* @param RopOAuthConsumer $consumer
|
86 |
+
* @param RopOAuthToken $token
|
87 |
* @param string $signature
|
88 |
* @return bool
|
89 |
*/
|
100 |
* character (ASCII code 38) even if empty.
|
101 |
* - Chapter 9.2 ("HMAC-SHA1")
|
102 |
*/
|
103 |
+
if (!class_exists('RopOAuthSignatureMethod_HMAC_SHA1')) {
|
104 |
+
class RopOAuthSignatureMethod_HMAC_SHA1 extends RopOAuthSignatureMethod {
|
105 |
function get_name() {
|
106 |
return "HMAC-SHA1";
|
107 |
}
|
116 |
($token) ? $token->secret : ""
|
117 |
);
|
118 |
|
119 |
+
$key_parts = RopOAuthUtil::urlencode_rfc3986($key_parts);
|
120 |
$key = implode('&', $key_parts);
|
121 |
|
122 |
return base64_encode(hash_hmac('sha1', $base_string, $key, true));
|
128 |
* over a secure channel such as HTTPS. It does not use the Signature Base String.
|
129 |
* - Chapter 9.4 ("PLAINTEXT")
|
130 |
*/
|
131 |
+
if (!class_exists('RopOAuthSignatureMethod_PLAINTEXT')) {
|
132 |
+
class RopOAuthSignatureMethod_PLAINTEXT extends RopOAuthSignatureMethod {
|
133 |
public function get_name() {
|
134 |
return "PLAINTEXT";
|
135 |
}
|
141 |
* - Chapter 9.4.1 ("Generating Signatures")
|
142 |
*
|
143 |
* Please note that the second encoding MUST NOT happen in the SignatureMethod, as
|
144 |
+
* RopOAuthRequest handles this!
|
145 |
*/
|
146 |
public function build_signature($request, $consumer, $token) {
|
147 |
$key_parts = array(
|
149 |
($token) ? $token->secret : ""
|
150 |
);
|
151 |
|
152 |
+
$key_parts = RopOAuthUtil::urlencode_rfc3986($key_parts);
|
153 |
$key = implode('&', $key_parts);
|
154 |
$request->base_string = $key;
|
155 |
|
166 |
* specification.
|
167 |
* - Chapter 9.3 ("RSA-SHA1")
|
168 |
*/
|
169 |
+
if (!class_exists('RopOAuthSignatureMethod_RSA_SHA1')) {
|
170 |
+
abstract class RopOAuthSignatureMethod_RSA_SHA1 extends RopOAuthSignatureMethod {
|
171 |
public function get_name() {
|
172 |
return "RSA-SHA1";
|
173 |
}
|
226 |
}
|
227 |
}
|
228 |
}
|
229 |
+
if (!class_exists('RopOAuthRequest')) {
|
230 |
+
class RopOAuthRequest {
|
231 |
private $parameters;
|
232 |
private $http_method;
|
233 |
private $http_url;
|
238 |
|
239 |
function __construct($http_method, $http_url, $parameters=NULL) {
|
240 |
@$parameters or $parameters = array();
|
241 |
+
$parameters = array_merge( RopOAuthUtil::parse_parameters(parse_url($http_url, PHP_URL_QUERY)), $parameters);
|
242 |
$this->parameters = $parameters;
|
243 |
$this->http_method = $http_method;
|
244 |
$this->http_url = $http_url;
|
265 |
// parsed parameter-list
|
266 |
if (!$parameters) {
|
267 |
// Find request headers
|
268 |
+
$request_headers = RopOAuthUtil::get_headers();
|
269 |
|
270 |
// Parse the query-string to find GET parameters
|
271 |
+
$parameters = RopOAuthUtil::parse_parameters($_SERVER['QUERY_STRING']);
|
272 |
|
273 |
// It's a POST request of the proper content-type, so parse POST
|
274 |
// parameters and add those overriding any duplicates from GET
|
276 |
&& @strstr($request_headers["Content-Type"],
|
277 |
"application/x-www-form-urlencoded")
|
278 |
) {
|
279 |
+
$post_data = RopOAuthUtil::parse_parameters(
|
280 |
file_get_contents(self::$POST_INPUT)
|
281 |
);
|
282 |
$parameters = array_merge($parameters, $post_data);
|
285 |
// We have a Authorization-header with OAuth data. Parse the header
|
286 |
// and add those overriding any duplicates from GET or POST
|
287 |
if (@substr($request_headers['Authorization'], 0, 6) == "OAuth ") {
|
288 |
+
$header_parameters = RopOAuthUtil::split_header(
|
289 |
$request_headers['Authorization']
|
290 |
);
|
291 |
$parameters = array_merge($parameters, $header_parameters);
|
293 |
|
294 |
}
|
295 |
|
296 |
+
return new RopOAuthRequest($http_method, $http_url, $parameters);
|
297 |
}
|
298 |
|
299 |
/**
|
301 |
*/
|
302 |
public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) {
|
303 |
@$parameters or $parameters = array();
|
304 |
+
$defaults = array("oauth_version" => RopOAuthRequest::$version,
|
305 |
+
"oauth_nonce" => RopOAuthRequest::generate_nonce(),
|
306 |
+
"oauth_timestamp" => RopOAuthRequest::generate_timestamp(),
|
307 |
"oauth_consumer_key" => $consumer->key);
|
308 |
if ($token)
|
309 |
$defaults['oauth_token'] = $token->key;
|
310 |
|
311 |
$parameters = array_merge($defaults, $parameters);
|
312 |
|
313 |
+
return new RopOAuthRequest($http_method, $http_url, $parameters);
|
314 |
}
|
315 |
|
316 |
public function set_parameter($name, $value, $allow_duplicates = true) {
|
361 |
unset($params['oauth_signature']);
|
362 |
}
|
363 |
|
364 |
+
return RopOAuthUtil::build_http_query($params);
|
365 |
}
|
366 |
|
367 |
/**
|
378 |
$this->get_signable_parameters()
|
379 |
);
|
380 |
|
381 |
+
$parts = RopOAuthUtil::urlencode_rfc3986($parts);
|
382 |
|
383 |
return implode('&', $parts);
|
384 |
}
|
427 |
* builds the data one would send in a POST request
|
428 |
*/
|
429 |
public function to_postdata() {
|
430 |
+
return RopOAuthUtil::build_http_query($this->parameters);
|
431 |
}
|
432 |
|
433 |
/**
|
436 |
public function to_header($realm=null) {
|
437 |
$first = true;
|
438 |
if($realm) {
|
439 |
+
$out = 'Authorization: OAuth realm="' . RopOAuthUtil::urlencode_rfc3986($realm) . '"';
|
440 |
$first = false;
|
441 |
} else
|
442 |
$out = 'Authorization: OAuth';
|
445 |
foreach ($this->parameters as $k => $v) {
|
446 |
if (substr($k, 0, 5) != "oauth") continue;
|
447 |
if (is_array($v)) {
|
448 |
+
throw new RopOAuthException('Arrays not supported in headers');
|
449 |
}
|
450 |
$out .= ($first) ? ' ' : ',';
|
451 |
+
$out .= RopOAuthUtil::urlencode_rfc3986($k) .
|
452 |
'="' .
|
453 |
+
RopOAuthUtil::urlencode_rfc3986($v) .
|
454 |
'"';
|
455 |
$first = false;
|
456 |
}
|
495 |
}
|
496 |
}
|
497 |
}
|
498 |
+
if (!class_exists('RopOAuthServer')) {
|
499 |
+
class RopOAuthServer {
|
500 |
protected $timestamp_threshold = 300; // in seconds, five minutes
|
501 |
protected $version = '1.0'; // hi blaine
|
502 |
protected $signature_methods = array();
|
579 |
$version = '1.0';
|
580 |
}
|
581 |
if ($version !== $this->version) {
|
582 |
+
throw new RopOAuthException("OAuth version '$version' not supported");
|
583 |
}
|
584 |
return $version;
|
585 |
}
|
594 |
if (!$signature_method) {
|
595 |
// According to chapter 7 ("Accessing Protected Ressources") the signature-method
|
596 |
// parameter is required, and we can't just fallback to PLAINTEXT
|
597 |
+
throw new RopOAuthException('No signature method parameter. This parameter is required');
|
598 |
}
|
599 |
|
600 |
if (!in_array($signature_method,
|
601 |
array_keys($this->signature_methods))) {
|
602 |
+
throw new RopOAuthException(
|
603 |
"Signature method '$signature_method' not supported " .
|
604 |
"try one of the following: " .
|
605 |
implode(", ", array_keys($this->signature_methods))
|
614 |
private function get_consumer(&$request) {
|
615 |
$consumer_key = @$request->get_parameter("oauth_consumer_key");
|
616 |
if (!$consumer_key) {
|
617 |
+
throw new RopOAuthException("Invalid consumer key");
|
618 |
}
|
619 |
|
620 |
$consumer = $this->data_store->lookup_consumer($consumer_key);
|
621 |
if (!$consumer) {
|
622 |
+
throw new RopOAuthException("Invalid consumer");
|
623 |
}
|
624 |
|
625 |
return $consumer;
|
634 |
$consumer, $token_type, $token_field
|
635 |
);
|
636 |
if (!$token) {
|
637 |
+
throw new RopOAuthException("Invalid $token_type token: $token_field");
|
638 |
}
|
639 |
return $token;
|
640 |
}
|
662 |
);
|
663 |
|
664 |
if (!$valid_sig) {
|
665 |
+
throw new RopOAuthException("Invalid signature");
|
666 |
}
|
667 |
}
|
668 |
|
671 |
*/
|
672 |
private function check_timestamp($timestamp) {
|
673 |
if( ! $timestamp )
|
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) {
|
681 |
+
throw new RopOAuthException(
|
682 |
"Expired timestamp, yours $timestamp, ours $now"
|
683 |
);
|
684 |
}
|
689 |
*/
|
690 |
private function check_nonce($consumer, $token, $nonce, $timestamp) {
|
691 |
if( ! $nonce )
|
692 |
+
throw new RopOAuthException(
|
693 |
'Missing nonce parameter. The parameter is required'
|
694 |
);
|
695 |
|
701 |
$timestamp
|
702 |
);
|
703 |
if ($found) {
|
704 |
+
throw new RopOAuthException("Nonce already used: $nonce");
|
705 |
}
|
706 |
}
|
707 |
|
708 |
}
|
709 |
}
|
710 |
+
if (!class_exists('RopOAuthDataStore')) {
|
711 |
+
class RopOAuthDataStore {
|
712 |
function lookup_consumer($consumer_key) {
|
713 |
// implement me
|
714 |
}
|
734 |
|
735 |
}
|
736 |
}
|
737 |
+
if (!class_exists('RopOAuthUtil')) {
|
738 |
+
class RopOAuthUtil {
|
739 |
public static function urlencode_rfc3986($input) {
|
740 |
if (is_array($input)) {
|
741 |
+
return array_map(array('RopOAuthUtil', 'urlencode_rfc3986'), $input);
|
742 |
} else if (is_scalar($input)) {
|
743 |
return str_replace(
|
744 |
'+',
|
770 |
$header_name = $matches[2][0];
|
771 |
$header_content = (isset($matches[5])) ? $matches[5][0] : $matches[4][0];
|
772 |
if (preg_match('/^oauth_/', $header_name) || !$only_allow_oauth_parameters) {
|
773 |
+
$params[$header_name] = RopOAuthUtil::urldecode_rfc3986($header_content);
|
774 |
}
|
775 |
$offset = $match[1] + strlen($match[0]);
|
776 |
}
|
839 |
$parsed_parameters = array();
|
840 |
foreach ($pairs as $pair) {
|
841 |
$split = explode('=', $pair, 2);
|
842 |
+
$parameter = RopOAuthUtil::urldecode_rfc3986($split[0]);
|
843 |
+
$value = isset($split[1]) ? RopOAuthUtil::urldecode_rfc3986($split[1]) : '';
|
844 |
|
845 |
if (isset($parsed_parameters[$parameter])) {
|
846 |
// We have already recieved parameter(s) with this name, so add to the list
|
864 |
if (!$params) return '';
|
865 |
|
866 |
// Urlencode both keys and values
|
867 |
+
$keys = RopOAuthUtil::urlencode_rfc3986(array_keys($params));
|
868 |
+
$values = RopOAuthUtil::urlencode_rfc3986(array_values($params));
|
869 |
$params = array_combine($keys, $values);
|
870 |
|
871 |
// Parameters are sorted by name, using lexicographical byte value ordering.
|
inc/oAuth/twitteroauth.php
CHANGED
@@ -12,8 +12,8 @@ require_once('OAuth.php');
|
|
12 |
/**
|
13 |
* Twitter OAuth class
|
14 |
*/
|
15 |
-
if (!class_exists('
|
16 |
-
class
|
17 |
/* Contains the last HTTP status code returned. */
|
18 |
public $http_code;
|
19 |
/* Contains the last API call. */
|
@@ -33,7 +33,7 @@ class TwitterOAuth {
|
|
33 |
/* Contains the last HTTP headers returned. */
|
34 |
public $http_info;
|
35 |
/* Set the useragnet. */
|
36 |
-
public $useragent = '
|
37 |
/* Immediately retry the API call if the response was not successful. */
|
38 |
//public $retry = TRUE;
|
39 |
|
@@ -58,13 +58,13 @@ class TwitterOAuth {
|
|
58 |
function lastAPICall() { return $this->last_api_call; }
|
59 |
|
60 |
/**
|
61 |
-
* construct
|
62 |
*/
|
63 |
function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) {
|
64 |
-
$this->sha1_method = new
|
65 |
-
$this->consumer = new
|
66 |
if (!empty($oauth_token) && !empty($oauth_token_secret)) {
|
67 |
-
$this->token = new
|
68 |
} else {
|
69 |
$this->token = NULL;
|
70 |
}
|
@@ -79,7 +79,7 @@ class TwitterOAuth {
|
|
79 |
function getRequestToken($oauth_callback) {
|
80 |
$parameters = array();
|
81 |
$parameters['oauth_callback'] = $oauth_callback;
|
82 |
-
$request = $this->
|
83 |
return $this->getToken($request);
|
84 |
}
|
85 |
|
@@ -111,7 +111,7 @@ class TwitterOAuth {
|
|
111 |
function getAccessToken($oauth_verifier) {
|
112 |
$parameters = array();
|
113 |
$parameters['oauth_verifier'] = $oauth_verifier;
|
114 |
-
$request = $this->
|
115 |
return $this->getToken($request);
|
116 |
}
|
117 |
|
@@ -129,15 +129,15 @@ class TwitterOAuth {
|
|
129 |
$parameters['x_auth_username'] = $username;
|
130 |
$parameters['x_auth_password'] = $password;
|
131 |
$parameters['x_auth_mode'] = 'client_auth';
|
132 |
-
$request = $this->
|
133 |
return $this->getToken($request);
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
-
* GET wrapper for
|
138 |
*/
|
139 |
function get($url, $parameters = array()) {
|
140 |
-
$response = $this->
|
141 |
if ($this->format === 'json' && $this->decode_json) {
|
142 |
return json_decode($response);
|
143 |
}
|
@@ -145,10 +145,10 @@ class TwitterOAuth {
|
|
145 |
}
|
146 |
|
147 |
/**
|
148 |
-
* POST wrapper for
|
149 |
*/
|
150 |
function post($url, $parameters = array()) {
|
151 |
-
$response = $this->
|
152 |
if ($this->format === 'json' && $this->decode_json) {
|
153 |
return json_decode($response);
|
154 |
}
|
@@ -159,7 +159,7 @@ class TwitterOAuth {
|
|
159 |
* Uploads are handled slightly differently
|
160 |
*/
|
161 |
function upload($url, $parameters = array()) {
|
162 |
-
$response = $this->
|
163 |
if ($this->format === 'json' && $this->decode_json) {
|
164 |
return json_decode($response);
|
165 |
}
|
@@ -170,7 +170,7 @@ class TwitterOAuth {
|
|
170 |
* DELETE wrapper for oAuthReqeust.
|
171 |
*/
|
172 |
function delete($url, $parameters = array()) {
|
173 |
-
$response = $this->
|
174 |
if ($this->format === 'json' && $this->decode_json) {
|
175 |
return json_decode($response);
|
176 |
}
|
@@ -180,7 +180,7 @@ class TwitterOAuth {
|
|
180 |
/**
|
181 |
* Format and sign an OAuth / API request
|
182 |
*/
|
183 |
-
function
|
184 |
|
185 |
if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
|
186 |
$url = "{$this->host}{$url}.{$this->format}";
|
@@ -193,11 +193,11 @@ class TwitterOAuth {
|
|
193 |
foreach ($parameters as $k=>&$v)
|
194 |
if (substr($k, 0, 6) == "oauth_")
|
195 |
$signable_parameters[$k] = $v;
|
196 |
-
$request =
|
197 |
$request->sign_request($this->sha1_method, $this->consumer, $this->token);
|
198 |
$request->set_parameters($parameters);
|
199 |
} else {
|
200 |
-
$request =
|
201 |
$request->sign_request($this->sha1_method, $this->consumer, $this->token);
|
202 |
}
|
203 |
|
@@ -339,9 +339,9 @@ class TwitterOAuth {
|
|
339 |
**/
|
340 |
private function getToken($request)
|
341 |
{
|
342 |
-
$token =
|
343 |
if(isset($token['oauth_token'], $token['oauth_token_secret']))
|
344 |
-
$this->token = new
|
345 |
return $token;
|
346 |
}
|
347 |
}
|
12 |
/**
|
13 |
* Twitter OAuth class
|
14 |
*/
|
15 |
+
if (!class_exists('RopTwitterOAuth')) {
|
16 |
+
class RopTwitterOAuth {
|
17 |
/* Contains the last HTTP status code returned. */
|
18 |
public $http_code;
|
19 |
/* Contains the last API call. */
|
33 |
/* Contains the last HTTP headers returned. */
|
34 |
public $http_info;
|
35 |
/* Set the useragnet. */
|
36 |
+
public $useragent = 'RopTwitterOAuth v0.2.0-beta2';
|
37 |
/* Immediately retry the API call if the response was not successful. */
|
38 |
//public $retry = TRUE;
|
39 |
|
58 |
function lastAPICall() { return $this->last_api_call; }
|
59 |
|
60 |
/**
|
61 |
+
* construct RopTwitterOAuth object
|
62 |
*/
|
63 |
function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) {
|
64 |
+
$this->sha1_method = new RopOAuthSignatureMethod_HMAC_SHA1();
|
65 |
+
$this->consumer = new RopOAuthConsumer($consumer_key, $consumer_secret);
|
66 |
if (!empty($oauth_token) && !empty($oauth_token_secret)) {
|
67 |
+
$this->token = new RopOAuthConsumer($oauth_token, $oauth_token_secret);
|
68 |
} else {
|
69 |
$this->token = NULL;
|
70 |
}
|
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 |
}
|
85 |
|
111 |
function getAccessToken($oauth_verifier) {
|
112 |
$parameters = array();
|
113 |
$parameters['oauth_verifier'] = $oauth_verifier;
|
114 |
+
$request = $this->RopOAuthRequest($this->accessTokenURL(), 'GET', $parameters);
|
115 |
return $this->getToken($request);
|
116 |
}
|
117 |
|
129 |
$parameters['x_auth_username'] = $username;
|
130 |
$parameters['x_auth_password'] = $password;
|
131 |
$parameters['x_auth_mode'] = 'client_auth';
|
132 |
+
$request = $this->RopOAuthRequest($this->accessTokenURL(), 'POST', $parameters);
|
133 |
return $this->getToken($request);
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
+
* GET wrapper for RopOAuthRequest.
|
138 |
*/
|
139 |
function get($url, $parameters = array()) {
|
140 |
+
$response = $this->RopOAuthRequest($url, 'GET', $parameters);
|
141 |
if ($this->format === 'json' && $this->decode_json) {
|
142 |
return json_decode($response);
|
143 |
}
|
145 |
}
|
146 |
|
147 |
/**
|
148 |
+
* POST wrapper for RopOAuthRequest.
|
149 |
*/
|
150 |
function post($url, $parameters = array()) {
|
151 |
+
$response = $this->RopOAuthRequest($url, 'POST', $parameters);
|
152 |
if ($this->format === 'json' && $this->decode_json) {
|
153 |
return json_decode($response);
|
154 |
}
|
159 |
* Uploads are handled slightly differently
|
160 |
*/
|
161 |
function upload($url, $parameters = array()) {
|
162 |
+
$response = $this->RopOAuthRequest($url, 'POST', $parameters, true);
|
163 |
if ($this->format === 'json' && $this->decode_json) {
|
164 |
return json_decode($response);
|
165 |
}
|
170 |
* DELETE wrapper for oAuthReqeust.
|
171 |
*/
|
172 |
function delete($url, $parameters = array()) {
|
173 |
+
$response = $this->RopOAuthRequest($url, 'DELETE', $parameters);
|
174 |
if ($this->format === 'json' && $this->decode_json) {
|
175 |
return json_decode($response);
|
176 |
}
|
180 |
/**
|
181 |
* Format and sign an OAuth / API request
|
182 |
*/
|
183 |
+
function RopOAuthRequest($url, $method, $parameters, $upload = false) {
|
184 |
|
185 |
if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
|
186 |
$url = "{$this->host}{$url}.{$this->format}";
|
193 |
foreach ($parameters as $k=>&$v)
|
194 |
if (substr($k, 0, 6) == "oauth_")
|
195 |
$signable_parameters[$k] = $v;
|
196 |
+
$request = RopOAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $signable_parameters);
|
197 |
$request->sign_request($this->sha1_method, $this->consumer, $this->token);
|
198 |
$request->set_parameters($parameters);
|
199 |
} else {
|
200 |
+
$request = RopOAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
|
201 |
$request->sign_request($this->sha1_method, $this->consumer, $this->token);
|
202 |
}
|
203 |
|
339 |
**/
|
340 |
private function getToken($request)
|
341 |
{
|
342 |
+
$token = RopOAuthUtil::parse_parameters($request);
|
343 |
if(isset($token['oauth_token'], $token['oauth_token_secret']))
|
344 |
+
$this->token = new RopOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
|
345 |
return $token;
|
346 |
}
|
347 |
}
|
inc/view-exclude.php
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
<?php $twp_obj = new CWP_TOP_Core; ?>
|
2 |
-
<div class="cwp_top_wrapper_full cwp_top_wrapper">
|
3 |
-
<div class="announcement clearfix">
|
4 |
-
<h2><?php _e("After 6 months of hard work, we have just released", CWP_TEXTDOMAIN); ?> <b>ThemeIsle</b>, <?php _e("th’ island ‘o WordPress themes.", CWP_TEXTDOMAIN); ?></h2>
|
5 |
-
<a class="show-me" href="http://themeisle.com/?utm_source=topadmin&utm_medium=announce&utm_campaign=top"><?php _e("Show Me", CWP_TEXTDOMAIN); ?></a>
|
6 |
-
</div><!-- end .announcement -->
|
7 |
-
|
8 |
-
<header id="cwp_top_header" class='clearfix'>
|
9 |
-
<h1 class="logo">
|
10 |
-
<?php if (function_exists('topProAddNewAccount')) {
|
11 |
-
_e("
|
12 |
-
} else _e("
|
13 |
-
|
14 |
-
</h1>
|
15 |
-
<span class="slogan"><?php _e("by", CWP_TEXTDOMAIN); ?> <a href="http://themeisle.com/?utm_source=topadmin&utm_medium=announce&utm_campaign=top">ThemeIsle</a></span>
|
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("
|
31 |
-
<span class='tweetInterval'> <?php echo $twp_obj->intervalSet; ?></span>
|
32 |
-
<?php _e("hours interval, ", CWP_TEXTDOMAIN); ?>
|
33 |
-
<?php _e("and the next
|
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("
|
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 -->
|
1 |
+
<?php $twp_obj = new CWP_TOP_Core; ?>
|
2 |
+
<div class="cwp_top_wrapper_full cwp_top_wrapper">
|
3 |
+
<div class="announcement clearfix">
|
4 |
+
<h2><?php _e("After 6 months of hard work, we have just released", CWP_TEXTDOMAIN); ?> <b>ThemeIsle</b>, <?php _e("th’ island ‘o WordPress themes.", CWP_TEXTDOMAIN); ?></h2>
|
5 |
+
<a class="show-me" href="http://themeisle.com/?utm_source=topadmin&utm_medium=announce&utm_campaign=top"><?php _e("Show Me", CWP_TEXTDOMAIN); ?></a>
|
6 |
+
</div><!-- end .announcement -->
|
7 |
+
|
8 |
+
<header id="cwp_top_header" class='clearfix'>
|
9 |
+
<h1 class="logo">
|
10 |
+
<?php if (function_exists('topProAddNewAccount')) {
|
11 |
+
_e("Revive Old Post PRO", CWP_TEXTDOMAIN);
|
12 |
+
} else _e("Revive Old Post", CWP_TEXTDOMAIN); ?>
|
13 |
+
|
14 |
+
</h1>
|
15 |
+
<span class="slogan"><?php _e("by", CWP_TEXTDOMAIN); ?> <a href="http://themeisle.com/?utm_source=topadmin&utm_medium=announce&utm_campaign=top">ThemeIsle</a></span>
|
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 -->
|
inc/view.php
CHANGED
@@ -5,10 +5,10 @@
|
|
5 |
</div><!-- end .announcement -->
|
6 |
|
7 |
<header id="cwp_top_header" class='clearfix'>
|
8 |
-
<h1 class="
|
9 |
<?php if (function_exists('topProAddNewAccount')) {
|
10 |
-
_e("
|
11 |
-
} else _e("
|
12 |
|
13 |
</h1>
|
14 |
<span class="slogan"><?php _e("by", CWP_TEXTDOMAIN); ?> <a href="http://themeisle.com/?utm_source=topadmin&utm_medium=announce&utm_campaign=top">ThemeIsle</a></span>
|
@@ -26,20 +26,20 @@
|
|
26 |
|
27 |
<?php if($this->pluginStatus == 'true') { ?>
|
28 |
<p class='active'>
|
29 |
-
<?php _e("
|
30 |
<span class='tweetInterval'> <?php echo $this->intervalSet; ?></span>
|
31 |
<?php _e("hours interval, ", CWP_TEXTDOMAIN); ?>
|
32 |
-
<?php _e("and the next
|
33 |
<span class='nextTweet'><?php $this->getNextTweetInterval(); update_option('cwp_topnew_notice', ""); ?></span>
|
34 |
</p>
|
35 |
<?php } else { ?>
|
36 |
<p class='inactive'>
|
37 |
-
<?php _e("
|
38 |
</p>
|
39 |
<?php } ?>
|
40 |
<p class='inactive'>
|
41 |
|
42 |
-
<?php _e("Once you click start
|
43 |
</p>
|
44 |
|
45 |
</div><!-- end .cwp_top_status -->
|
@@ -54,19 +54,91 @@
|
|
54 |
</div><!-- end .left -->
|
55 |
|
56 |
<div class='right'>
|
57 |
-
<?php
|
|
|
58 |
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
<div class="user_details">
|
62 |
<div class='user_avatar'><img src="<?php echo $user['oauth_user_details']->profile_image_url; ?>"></div>
|
63 |
<div class="user_name"><?php echo $user['oauth_user_details']->name; ?></div>
|
64 |
<div class="remove_user"><a href='#' id='<?php echo $user['user_id']; ?>' class='logout_user'></a></div>
|
65 |
</div><!-- end .user_details -->
|
66 |
-
<?php }
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
<?php } else { ?>
|
69 |
-
<button id='
|
70 |
<?php } ?>
|
71 |
</div><!-- end .right -->
|
72 |
</fieldset><!-- end .option -->
|
@@ -92,11 +164,11 @@
|
|
92 |
<div class="cwp_top_footer">
|
93 |
<a class="reset-settings" href="#"><span></span> <?php _e("Reset", CWP_TEXTDOMAIN); ?></a>
|
94 |
<a class="update-options" href="#"><span></span><?php _e("Save", CWP_TEXTDOMAIN); ?></a>
|
95 |
-
<a class="tweet-now" href="#"><span></span> <?php _e("Start
|
96 |
-
<a class="stop-tweet-old-post" href="#"><span></span> <?php _e("Stop
|
97 |
-
<a class="see-sample-tweet" href="#"><span></span> <?php _e("See Sample
|
98 |
</div><!-- end .cwp_top_footer -->
|
99 |
-
<p><?php _e("We are not affiliated or partner with Twitter in any way.", CWP_TEXTDOMAIN); ?>
|
100 |
</form><!-- end #cwp_top_form -->
|
101 |
|
102 |
<aside class="sidebar">
|
@@ -110,10 +182,112 @@
|
|
110 |
|
111 |
<div class="cwp_sample_tweet_preview">
|
112 |
<div class="cwp_sample_tweet_preview_inner">
|
113 |
-
<h2>Sample
|
114 |
<span class="sample_tweet">Lorem ipsum dolor sit amet consectetutem! <a href="#">Lorem ipsum</a></span>
|
115 |
<button class="top_close_popup">Close preview</button>
|
116 |
-
<button class="tweetitnow">
|
117 |
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
118 |
</div><!-- end .cwp_sample_tweet_preview -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
</div><!-- end .cwp_top_wrapper -->
|
5 |
</div><!-- end .announcement -->
|
6 |
|
7 |
<header id="cwp_top_header" class='clearfix'>
|
8 |
+
<h1 class="top_logo">
|
9 |
<?php if (function_exists('topProAddNewAccount')) {
|
10 |
+
_e("Revive Old Post PRO", CWP_TEXTDOMAIN);
|
11 |
+
} else _e("Revive Old Post", CWP_TEXTDOMAIN); ?>
|
12 |
|
13 |
</h1>
|
14 |
<span class="slogan"><?php _e("by", CWP_TEXTDOMAIN); ?> <a href="http://themeisle.com/?utm_source=topadmin&utm_medium=announce&utm_campaign=top">ThemeIsle</a></span>
|
26 |
|
27 |
<?php if($this->pluginStatus == 'true') { ?>
|
28 |
<p class='active'>
|
29 |
+
<?php _e("Revive Old Post is set to post on a", CWP_TEXTDOMAIN); ?>
|
30 |
<span class='tweetInterval'> <?php echo $this->intervalSet; ?></span>
|
31 |
<?php _e("hours interval, ", CWP_TEXTDOMAIN); ?>
|
32 |
+
<?php _e("and the next share will take place in: ", CWP_TEXTDOMAIN); ?>
|
33 |
<span class='nextTweet'><?php $this->getNextTweetInterval(); update_option('cwp_topnew_notice', ""); ?></span>
|
34 |
</p>
|
35 |
<?php } else { ?>
|
36 |
<p class='inactive'>
|
37 |
+
<?php _e("Revive Old Post is not set to post!", CWP_TEXTDOMAIN); ?>
|
38 |
</p>
|
39 |
<?php } ?>
|
40 |
<p class='inactive'>
|
41 |
|
42 |
+
<?php _e("Once you click start sharing a post will be sent in 15 sec, also here you can see the error message if is any.", CWP_TEXTDOMAIN); $this->fixCron(); ?>
|
43 |
</p>
|
44 |
|
45 |
</div><!-- end .cwp_top_status -->
|
54 |
</div><!-- end .left -->
|
55 |
|
56 |
<div class='right'>
|
57 |
+
<?php
|
58 |
+
|
59 |
|
60 |
+
$tw_users = 0;
|
61 |
+
//$this->tweetPost(array("message"=>"Testinsd sg tpo","link"=>"http://wicked-stallion-64-120688.euw1.nitrousbox.com/"));
|
62 |
+
//echo count($this->users);
|
63 |
+
if(!empty($this->users))
|
64 |
+
foreach ($this->users as $user) {
|
65 |
+
if ($user['service']=='twitter'|| !isset($user['service'])) {
|
66 |
+
$tw_users++;
|
67 |
+
?>
|
68 |
<div class="user_details">
|
69 |
<div class='user_avatar'><img src="<?php echo $user['oauth_user_details']->profile_image_url; ?>"></div>
|
70 |
<div class="user_name"><?php echo $user['oauth_user_details']->name; ?></div>
|
71 |
<div class="remove_user"><a href='#' id='<?php echo $user['user_id']; ?>' class='logout_user'></a></div>
|
72 |
</div><!-- end .user_details -->
|
73 |
+
<?php } }
|
74 |
+
if ($tw_users!==0) { ?>
|
75 |
+
<button id='twitter-login' class='another-account login' service='twitter'>+</button>
|
76 |
+
<?php } else { ?>
|
77 |
+
<button id='twitter-login' class='login' service='twitter'> <?php _e("Add Account", CWP_TEXTDOMAIN) ?> </button>
|
78 |
+
<?php } ?>
|
79 |
+
</div><!-- end .right -->
|
80 |
+
</fieldset><!-- end .option -->
|
81 |
+
|
82 |
+
<fieldset class="option">
|
83 |
+
<div class="left">
|
84 |
+
<label for="facebook-login"> <?php _e("Facebook Login", CWP_TEXTDOMAIN); ?> </label>
|
85 |
+
<span class='description'> <?php _e("Login using your Facebook account.", CWP_TEXTDOMAIN); ?> </span>
|
86 |
+
</div><!-- end .left -->
|
87 |
+
|
88 |
+
<div class='right'>
|
89 |
+
<?php
|
90 |
+
|
91 |
+
$fb_users = 0;
|
92 |
+
|
93 |
+
if(!empty($this->users))
|
94 |
+
foreach ($this->users as $user) {
|
95 |
+
if ($user['service']=='facebook') {
|
96 |
+
$fb_users++;
|
97 |
+
?>
|
98 |
+
<div class="user_details">
|
99 |
+
<div class='user_avatar'><img src="<?php echo $user['oauth_user_details']->profile_image_url; ?>"></div>
|
100 |
+
<div class="user_name"><?php echo $user['oauth_user_details']->name; ?></div>
|
101 |
+
<div class="remove_user"><a href='#' id='<?php echo $user['user_id']; ?>' service='facebook' class='logout_user'></a></div>
|
102 |
+
</div><!-- end .user_details -->
|
103 |
+
<?php } }
|
104 |
+
if ($fb_users!==0){ ?>
|
105 |
+
<button id='facebook-login' class='another-account login' service='facebook'>+</button>
|
106 |
+
<?php } else {
|
107 |
+
if (get_option('top_fb_token')===""||!get_option('top_fb_token')) {
|
108 |
+
?>
|
109 |
+
<button id='facebook-login' class='login' service='facebook'> <?php _e("Authorize", CWP_TEXTDOMAIN) ?> </button>
|
110 |
+
<?php } else {?>
|
111 |
+
<button id='facebook-login' class='login' service='facebook'> <?php _e("Add Account", CWP_TEXTDOMAIN) ?> </button>
|
112 |
+
<?php }} ?>
|
113 |
+
</div><!-- end .right -->
|
114 |
+
</fieldset><!-- end .option -->
|
115 |
+
|
116 |
+
<fieldset class="option">
|
117 |
+
<div class="left">
|
118 |
+
<label for="linkedin-login"> <?php _e("Linkedin Login", CWP_TEXTDOMAIN); ?> </label>
|
119 |
+
<span class='description'> <?php _e("Login using your Linkedin account.", CWP_TEXTDOMAIN); ?> </span>
|
120 |
+
</div><!-- end .left -->
|
121 |
+
|
122 |
+
<div class='right'>
|
123 |
+
<?php
|
124 |
+
|
125 |
+
$lk_users = 0;
|
126 |
+
|
127 |
+
if(!empty($this->users))
|
128 |
+
foreach ($this->users as $user) {
|
129 |
+
if ($user['service']=='linkedin') {
|
130 |
+
$lk_users++;
|
131 |
+
?>
|
132 |
+
<div class="user_details">
|
133 |
+
<div class='user_avatar'><img src="<?php echo $user['oauth_user_details']->profile_image_url; ?>"></div>
|
134 |
+
<div class="user_name"><?php echo $user['oauth_user_details']->name; ?></div>
|
135 |
+
<div class="remove_user"><a href='#' id='<?php echo $user['user_id']; ?>' service='linkedin' class='logout_user'></a></div>
|
136 |
+
</div><!-- end .user_details -->
|
137 |
+
<?php } }
|
138 |
+
if ($lk_users!==0){ ?>
|
139 |
+
<button id='linkedin-login' class='another-account login' service='linkedin'>+</button>
|
140 |
<?php } else { ?>
|
141 |
+
<button id='linkedin-login' class='login' service='linkedin'> <?php _e("Add account", CWP_TEXTDOMAIN) ?> </button>
|
142 |
<?php } ?>
|
143 |
</div><!-- end .right -->
|
144 |
</fieldset><!-- end .option -->
|
164 |
<div class="cwp_top_footer">
|
165 |
<a class="reset-settings" href="#"><span></span> <?php _e("Reset", CWP_TEXTDOMAIN); ?></a>
|
166 |
<a class="update-options" href="#"><span></span><?php _e("Save", CWP_TEXTDOMAIN); ?></a>
|
167 |
+
<a class="tweet-now" href="#"><span></span> <?php _e("Start Sharing", CWP_TEXTDOMAIN); ?></a>
|
168 |
+
<a class="stop-tweet-old-post" href="#"><span></span> <?php _e("Stop Sharing", CWP_TEXTDOMAIN); ?></a>
|
169 |
+
<a class="see-sample-tweet" href="#"><span></span> <?php _e("See Sample Post", CWP_TEXTDOMAIN); ?></a>
|
170 |
</div><!-- end .cwp_top_footer -->
|
171 |
+
<p><?php _e("We are not affiliated or partner with Twitter/Facebook/Linkedin in any way.", CWP_TEXTDOMAIN); ?>
|
172 |
</form><!-- end #cwp_top_form -->
|
173 |
|
174 |
<aside class="sidebar">
|
182 |
|
183 |
<div class="cwp_sample_tweet_preview">
|
184 |
<div class="cwp_sample_tweet_preview_inner">
|
185 |
+
<h2>Sample Post Preview</h2>
|
186 |
<span class="sample_tweet">Lorem ipsum dolor sit amet consectetutem! <a href="#">Lorem ipsum</a></span>
|
187 |
<button class="top_close_popup">Close preview</button>
|
188 |
+
<button class="tweetitnow">Share Now</button>
|
189 |
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
190 |
</div><!-- end .cwp_sample_tweet_preview -->
|
191 |
+
|
192 |
+
<div class="cwp_user_pages">
|
193 |
+
<div class="cwp_sample_tweet_preview_inner">
|
194 |
+
<h2>Choose a Profile or Page</h2>
|
195 |
+
<div class="cwp_user_pages_inner"></div>
|
196 |
+
<button class="top_close_popup">Close preview</button>
|
197 |
+
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
198 |
+
</div><!-- end .cwp_sample_tweet_preview -->
|
199 |
+
|
200 |
+
<div class="cwp_fbapp_preview">
|
201 |
+
<div class="cwp_sample_tweet_preview_inner top_auth_inner">
|
202 |
+
<h2>Add Your Facebook Account Following The Instructions On The Left</h2>
|
203 |
+
<span class="sample_tweet top_sample_auth">
|
204 |
+
<div class="top_left_instructions">
|
205 |
+
<ol>
|
206 |
+
<li>Go on <a href="https://developers.facebook.com/apps/" target="_blank">developers.facebook.com/apps</a></li>
|
207 |
+
<li>Click on <strong>Create New App</strong> from the top right corner</li>
|
208 |
+
<li>Enter a <strong>Display Name</strong> and <strong>Namespace</strong> and click on Create App</li>
|
209 |
+
<li>Once you arrive on the app dashboard, copy your <strong>App ID</strong> and <strong>App Secret</strong> in the fields on the right</li>
|
210 |
+
<li>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></li>
|
211 |
+
<li>Copy/Paste this url : <strong><?php echo SETTINGSURL; ?></strong> into App Domains and Site URL fields and <strong>Save</strong></li>
|
212 |
+
<li>Go on Status & Review tab and set your app live from the top-right switch.</li>
|
213 |
+
<li>Now everything is done, click on <strong>Authorize App</strong> button.</li>
|
214 |
+
</ol>
|
215 |
+
</div>
|
216 |
+
<form action="" method="post" id="cwp_top_form" class="clearfix top_auth_form">
|
217 |
+
<fieldset class="option twptop_opt_app_id">
|
218 |
+
<div class="left">
|
219 |
+
<label for="top_opt_app_id"> Facebook App ID </label>
|
220 |
+
<span class="description"> ID from your app created on facebook website. </span>
|
221 |
+
|
222 |
+
|
223 |
+
</div><!-- end .left -->
|
224 |
+
<div class="right">
|
225 |
+
<input type="text" placeholder="1487991504767913" value="<?php get_option('cwp_top_app_id');?>" name="top_opt_app_id" id="top_opt_app_id">
|
226 |
+
</div><!-- end .right -->
|
227 |
+
</fieldset>
|
228 |
+
|
229 |
+
<fieldset class="option twptop_opt_app_secret">
|
230 |
+
<div class="left">
|
231 |
+
<label for="top_opt_app_secret"> Facebook App Secret </label>
|
232 |
+
<span class="description"> Secret from your app created on facebook website. </span>
|
233 |
+
|
234 |
+
</div><!-- end .left -->
|
235 |
+
<div class="right">
|
236 |
+
<input type="text" placeholder="5124ea6d46e64da3c306f12812d0e4fx" value="<?php get_option('cwp_top_app_secret');?>" name="top_opt_app_secret" id="top_opt_app_secret">
|
237 |
+
</div><!-- end .right -->
|
238 |
+
</fieldset>
|
239 |
+
|
240 |
+
<button class="top_authorize" service="facebook">Authorize App</button>
|
241 |
+
</form>
|
242 |
+
</span><button class="top_close_popup">Close preview</button>
|
243 |
+
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
244 |
+
</div><!-- end .cwp_sample_tweet_preview -->
|
245 |
+
|
246 |
+
<div class="cwp_lkapp_preview">
|
247 |
+
<div class="cwp_sample_tweet_preview_inner top_auth_inner">
|
248 |
+
<h2>Add Your Linkedin Account Following The Instructions On The Left</h2>
|
249 |
+
<span class="sample_tweet top_sample_auth">
|
250 |
+
<div class="top_left_instructions">
|
251 |
+
<ol>
|
252 |
+
<li>Go on <a href="https://www.linkedin.com/secure/developer?newapp=" target="_blank">linkedin.com/secure/developer?newapp=</a></li>
|
253 |
+
<li>Enter the required details and pay special attention to the further fields :</li>
|
254 |
+
<li>Make sure you set Live Status to LIVE </li>
|
255 |
+
<li>Default Scope should have r_basicprofile and rw_nus checked</li>
|
256 |
+
<li>Copy/Paste this url : <strong><?php echo SETTINGSURL; ?></strong> into OAuth 2.0 Redirect URLs</li>
|
257 |
+
<li>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</li>
|
258 |
+
|
259 |
+
<li>Now everything is done, click on <strong>Authorize App</strong> button.</li>
|
260 |
+
</ol>
|
261 |
+
</div>
|
262 |
+
<form action="" method="post" id="cwp_top_form" class="clearfix top_auth_form">
|
263 |
+
<fieldset class="option twptop_opt_app_id">
|
264 |
+
<div class="left">
|
265 |
+
<label for="top_opt_app_id"> Linkedin API Key </label>
|
266 |
+
<span class="description"> API Key that you get once you create an app </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"> Linkedin Secret Key </label>
|
278 |
+
<span class="description">Secret Key that you get once you create an app </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">Authorize App</button>
|
288 |
+
</form>
|
289 |
+
</span><button class="top_close_popup">Close preview</button>
|
290 |
+
</div><!-- end .cwp_sample_tweet_preview_inner -->
|
291 |
+
</div><!-- end .cwp_sample_tweet_preview -->
|
292 |
+
|
293 |
</div><!-- end .cwp_top_wrapper -->
|
inc/xml.php
CHANGED
@@ -1,130 +1,130 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function TOP_parsexml( $xml, $get_attributes = 1, $priority = 'tag' )
|
4 |
-
{
|
5 |
-
$parser = xml_parser_create('');
|
6 |
-
xml_parser_set_option( $parser, XML_OPTION_TARGET_ENCODING, "UTF-8" );
|
7 |
-
xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
|
8 |
-
xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 1 );
|
9 |
-
xml_parse_into_struct( $parser, trim($xml), $xml_values );
|
10 |
-
xml_parser_free($parser);
|
11 |
-
|
12 |
-
if (!$xml_values)
|
13 |
-
return;
|
14 |
-
|
15 |
-
$xml_array = array ();
|
16 |
-
$parents = array ();
|
17 |
-
$opened_tags = array ();
|
18 |
-
$arr = array ();
|
19 |
-
$current = & $xml_array;
|
20 |
-
$repeated_tag_index = array ();
|
21 |
-
|
22 |
-
foreach ($xml_values as $data) {
|
23 |
-
unset ($attributes, $value);
|
24 |
-
extract($data);
|
25 |
-
$result = array ();
|
26 |
-
$attributes_data = array ();
|
27 |
-
if (isset ($value))
|
28 |
-
{
|
29 |
-
if ($priority == 'tag')
|
30 |
-
$result = $value;
|
31 |
-
else
|
32 |
-
$result['value'] = $value;
|
33 |
-
}
|
34 |
-
if (isset ($attributes) and $get_attributes)
|
35 |
-
{
|
36 |
-
foreach ($attributes as $attr => $val)
|
37 |
-
{
|
38 |
-
if ($priority == 'tag')
|
39 |
-
$attributes_data[$attr] = $val;
|
40 |
-
else
|
41 |
-
$result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
|
42 |
-
}
|
43 |
-
}
|
44 |
-
if ($type == "open")
|
45 |
-
{
|
46 |
-
$parent[$level -1] = & $current;
|
47 |
-
if (!is_array($current) or (!in_array($tag, array_keys($current))))
|
48 |
-
{
|
49 |
-
$current[$tag] = $result;
|
50 |
-
if ($attributes_data)
|
51 |
-
$current[$tag . '_attr'] = $attributes_data;
|
52 |
-
$repeated_tag_index[$tag . '_' . $level] = 1;
|
53 |
-
$current = & $current[$tag];
|
54 |
-
}
|
55 |
-
else
|
56 |
-
{
|
57 |
-
if (isset ($current[$tag][0]))
|
58 |
-
{
|
59 |
-
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
|
60 |
-
$repeated_tag_index[$tag . '_' . $level]++;
|
61 |
-
}
|
62 |
-
else
|
63 |
-
{
|
64 |
-
$current[$tag] = array (
|
65 |
-
$current[$tag],
|
66 |
-
$result
|
67 |
-
);
|
68 |
-
$repeated_tag_index[$tag . '_' . $level] = 2;
|
69 |
-
if (isset ($current[$tag . '_attr']))
|
70 |
-
{
|
71 |
-
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
|
72 |
-
unset ($current[$tag . '_attr']);
|
73 |
-
}
|
74 |
-
}
|
75 |
-
$last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1;
|
76 |
-
$current = & $current[$tag][$last_item_index];
|
77 |
-
}
|
78 |
-
}
|
79 |
-
elseif ($type == "complete")
|
80 |
-
{
|
81 |
-
if (!isset ($current[$tag]))
|
82 |
-
{
|
83 |
-
$current[$tag] = $result;
|
84 |
-
$repeated_tag_index[$tag . '_' . $level] = 1;
|
85 |
-
if ($priority == 'tag' and $attributes_data)
|
86 |
-
$current[$tag . '_attr'] = $attributes_data;
|
87 |
-
}
|
88 |
-
else
|
89 |
-
{
|
90 |
-
if (isset ($current[$tag][0]) and is_array($current[$tag]))
|
91 |
-
{
|
92 |
-
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
|
93 |
-
if ($priority == 'tag' and $get_attributes and $attributes_data)
|
94 |
-
{
|
95 |
-
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
|
96 |
-
}
|
97 |
-
$repeated_tag_index[$tag . '_' . $level]++;
|
98 |
-
}
|
99 |
-
else
|
100 |
-
{
|
101 |
-
$current[$tag] = array (
|
102 |
-
$current[$tag],
|
103 |
-
$result
|
104 |
-
);
|
105 |
-
$repeated_tag_index[$tag . '_' . $level] = 1;
|
106 |
-
if ($priority == 'tag' and $get_attributes)
|
107 |
-
{
|
108 |
-
if (isset ($current[$tag . '_attr']))
|
109 |
-
{
|
110 |
-
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
|
111 |
-
unset ($current[$tag . '_attr']);
|
112 |
-
}
|
113 |
-
if ($attributes_data)
|
114 |
-
{
|
115 |
-
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
$repeated_tag_index[$tag . '_' . $level]++; //0 and 1 index is already taken
|
119 |
-
}
|
120 |
-
}
|
121 |
-
}
|
122 |
-
elseif ($type == 'close')
|
123 |
-
{
|
124 |
-
$current = & $parent[$level -1];
|
125 |
-
}
|
126 |
-
}
|
127 |
-
return $xml_array;
|
128 |
-
}
|
129 |
-
|
130 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function TOP_parsexml( $xml, $get_attributes = 1, $priority = 'tag' )
|
4 |
+
{
|
5 |
+
$parser = xml_parser_create('');
|
6 |
+
xml_parser_set_option( $parser, XML_OPTION_TARGET_ENCODING, "UTF-8" );
|
7 |
+
xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
|
8 |
+
xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 1 );
|
9 |
+
xml_parse_into_struct( $parser, trim($xml), $xml_values );
|
10 |
+
xml_parser_free($parser);
|
11 |
+
|
12 |
+
if (!$xml_values)
|
13 |
+
return;
|
14 |
+
|
15 |
+
$xml_array = array ();
|
16 |
+
$parents = array ();
|
17 |
+
$opened_tags = array ();
|
18 |
+
$arr = array ();
|
19 |
+
$current = & $xml_array;
|
20 |
+
$repeated_tag_index = array ();
|
21 |
+
|
22 |
+
foreach ($xml_values as $data) {
|
23 |
+
unset ($attributes, $value);
|
24 |
+
extract($data);
|
25 |
+
$result = array ();
|
26 |
+
$attributes_data = array ();
|
27 |
+
if (isset ($value))
|
28 |
+
{
|
29 |
+
if ($priority == 'tag')
|
30 |
+
$result = $value;
|
31 |
+
else
|
32 |
+
$result['value'] = $value;
|
33 |
+
}
|
34 |
+
if (isset ($attributes) and $get_attributes)
|
35 |
+
{
|
36 |
+
foreach ($attributes as $attr => $val)
|
37 |
+
{
|
38 |
+
if ($priority == 'tag')
|
39 |
+
$attributes_data[$attr] = $val;
|
40 |
+
else
|
41 |
+
$result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
|
42 |
+
}
|
43 |
+
}
|
44 |
+
if ($type == "open")
|
45 |
+
{
|
46 |
+
$parent[$level -1] = & $current;
|
47 |
+
if (!is_array($current) or (!in_array($tag, array_keys($current))))
|
48 |
+
{
|
49 |
+
$current[$tag] = $result;
|
50 |
+
if ($attributes_data)
|
51 |
+
$current[$tag . '_attr'] = $attributes_data;
|
52 |
+
$repeated_tag_index[$tag . '_' . $level] = 1;
|
53 |
+
$current = & $current[$tag];
|
54 |
+
}
|
55 |
+
else
|
56 |
+
{
|
57 |
+
if (isset ($current[$tag][0]))
|
58 |
+
{
|
59 |
+
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
|
60 |
+
$repeated_tag_index[$tag . '_' . $level]++;
|
61 |
+
}
|
62 |
+
else
|
63 |
+
{
|
64 |
+
$current[$tag] = array (
|
65 |
+
$current[$tag],
|
66 |
+
$result
|
67 |
+
);
|
68 |
+
$repeated_tag_index[$tag . '_' . $level] = 2;
|
69 |
+
if (isset ($current[$tag . '_attr']))
|
70 |
+
{
|
71 |
+
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
|
72 |
+
unset ($current[$tag . '_attr']);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
$last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1;
|
76 |
+
$current = & $current[$tag][$last_item_index];
|
77 |
+
}
|
78 |
+
}
|
79 |
+
elseif ($type == "complete")
|
80 |
+
{
|
81 |
+
if (!isset ($current[$tag]))
|
82 |
+
{
|
83 |
+
$current[$tag] = $result;
|
84 |
+
$repeated_tag_index[$tag . '_' . $level] = 1;
|
85 |
+
if ($priority == 'tag' and $attributes_data)
|
86 |
+
$current[$tag . '_attr'] = $attributes_data;
|
87 |
+
}
|
88 |
+
else
|
89 |
+
{
|
90 |
+
if (isset ($current[$tag][0]) and is_array($current[$tag]))
|
91 |
+
{
|
92 |
+
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
|
93 |
+
if ($priority == 'tag' and $get_attributes and $attributes_data)
|
94 |
+
{
|
95 |
+
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
|
96 |
+
}
|
97 |
+
$repeated_tag_index[$tag . '_' . $level]++;
|
98 |
+
}
|
99 |
+
else
|
100 |
+
{
|
101 |
+
$current[$tag] = array (
|
102 |
+
$current[$tag],
|
103 |
+
$result
|
104 |
+
);
|
105 |
+
$repeated_tag_index[$tag . '_' . $level] = 1;
|
106 |
+
if ($priority == 'tag' and $get_attributes)
|
107 |
+
{
|
108 |
+
if (isset ($current[$tag . '_attr']))
|
109 |
+
{
|
110 |
+
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
|
111 |
+
unset ($current[$tag . '_attr']);
|
112 |
+
}
|
113 |
+
if ($attributes_data)
|
114 |
+
{
|
115 |
+
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
$repeated_tag_index[$tag . '_' . $level]++; //0 and 1 index is already taken
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
elseif ($type == 'close')
|
123 |
+
{
|
124 |
+
$current = & $parent[$level -1];
|
125 |
+
}
|
126 |
+
}
|
127 |
+
return $xml_array;
|
128 |
+
}
|
129 |
+
|
130 |
?>
|
js/countdown.js
CHANGED
@@ -102,7 +102,7 @@ var timenow="";
|
|
102 |
clearInterval(_this.interval);
|
103 |
}
|
104 |
_this.interval = null;
|
105 |
-
jQuery(".cwp_top_container .nextTweet").html('Your
|
106 |
|
107 |
return _this;
|
108 |
//return _this;
|
102 |
clearInterval(_this.interval);
|
103 |
}
|
104 |
_this.interval = null;
|
105 |
+
jQuery(".cwp_top_container .nextTweet").html('Your post was just sent to social networks servers, wait 15s for a confirmation below. Refresh the page to see when the next one will be posted.');
|
106 |
|
107 |
return _this;
|
108 |
//return _this;
|
js/master.js
CHANGED
@@ -40,6 +40,8 @@ jQuery(document).ready(function(){
|
|
40 |
return false;
|
41 |
});
|
42 |
|
|
|
|
|
43 |
function cwpTopUpdateForm() {
|
44 |
startAjaxIntro();
|
45 |
var data = jQuery("#cwp_top_form").serialize();
|
@@ -100,41 +102,179 @@ jQuery(document).ready(function(){
|
|
100 |
|
101 |
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
// Add New Twitter Account
|
105 |
-
jQuery("#cwp_top_form button
|
106 |
e.preventDefault();
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
startAjaxIntro();
|
110 |
jQuery.ajax({
|
111 |
type: "POST",
|
112 |
url: cwp_top_ajaxload.ajaxurl,
|
113 |
data: {
|
114 |
-
action:
|
115 |
-
currentURL: jQuery("#cwp_top_currenturl").val()
|
|
|
|
|
116 |
},
|
117 |
success: function(response) {
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
-
|
124 |
-
}
|
125 |
-
else
|
126 |
-
jQuery.ajax({
|
127 |
-
type: "POST",
|
128 |
-
url: cwp_top_ajaxload.ajaxurl,
|
129 |
-
data: {
|
130 |
-
action: "add_new_twitter_account_pro",
|
131 |
-
currentURL: jQuery("#cwp_top_currenturl").val()
|
132 |
-
},
|
133 |
-
success: function(response) {
|
134 |
-
if (response.search("api.twitter.com")==-1)
|
135 |
-
jQuery(".cwp_top_status .inactive").html(response);
|
136 |
-
else
|
137 |
-
window.location.href = response;
|
138 |
|
139 |
},
|
140 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
@@ -142,7 +282,6 @@ jQuery(document).ready(function(){
|
|
142 |
}
|
143 |
});
|
144 |
|
145 |
-
|
146 |
return false;
|
147 |
});
|
148 |
|
@@ -157,7 +296,7 @@ jQuery(document).ready(function(){
|
|
157 |
type: "POST",
|
158 |
url: cwp_top_ajaxload.ajaxurl,
|
159 |
data: {
|
160 |
-
action: "
|
161 |
user_id: userID
|
162 |
},
|
163 |
success: function(response) {
|
@@ -242,9 +381,13 @@ jQuery(document).ready(function(){
|
|
242 |
if(response !== '') {
|
243 |
|
244 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").fadeIn().addClass("active");
|
245 |
-
|
246 |
-
|
247 |
-
|
|
|
|
|
|
|
|
|
248 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet").html(response);
|
249 |
}
|
250 |
endAjaxIntro();
|
@@ -284,10 +427,16 @@ jQuery(document).ready(function(){
|
|
284 |
//location.reload();
|
285 |
});
|
286 |
|
287 |
-
jQuery(".
|
288 |
jQuery(this).parent().parent().fadeOut().removeClass("active");
|
289 |
});
|
290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner button.tweetitnow").click(function(e){
|
292 |
e.preventDefault();
|
293 |
startAjaxIntro();
|
@@ -302,8 +451,8 @@ jQuery(document).ready(function(){
|
|
302 |
endAjaxIntro();
|
303 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").fadeOut().removeClass("active");
|
304 |
jQuery('html, body').animate({
|
305 |
-
scrollTop: jQuery(".cwp_top_wrapper .cwp_top_status").offset().top
|
306 |
-
},
|
307 |
},
|
308 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
309 |
console.log("There was an error: "+errorThrown);
|
@@ -335,6 +484,56 @@ jQuery(document).ready(function(){
|
|
335 |
//jQuery(this).find("input[type=radio], input[type=checkbox]").checked = false;
|
336 |
}
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
// Select all function
|
339 |
jQuery("button.select-all").click(function(e){
|
340 |
e.preventDefault();
|
@@ -350,7 +549,7 @@ jQuery(document).ready(function(){
|
|
350 |
|
351 |
function hideSpecifiedFieldsets()
|
352 |
{
|
353 |
-
jQuery("#
|
354 |
jQuery("#top_opt_custom_url_option").parent().parent().hide();
|
355 |
jQuery("#top_opt_custom_url_field").parent().parent().hide();
|
356 |
jQuery("#top_opt_url_shortner").parent().parent().hide();
|
@@ -435,9 +634,9 @@ jQuery(document).ready(function(){
|
|
435 |
|
436 |
jQuery("select#top_opt_tweet_type").change(function(){
|
437 |
if(jQuery(this).val() == "custom-field") {
|
438 |
-
jQuery("#
|
439 |
} else {
|
440 |
-
jQuery("#
|
441 |
}
|
442 |
});
|
443 |
|
@@ -489,8 +688,5 @@ jQuery(document).ready(function(){
|
|
489 |
jQuery("#top_opt_post_type_value").parent().parent().slideUp("fast");
|
490 |
}
|
491 |
});
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
|
496 |
});
|
40 |
return false;
|
41 |
});
|
42 |
|
43 |
+
|
44 |
+
|
45 |
function cwpTopUpdateForm() {
|
46 |
startAjaxIntro();
|
47 |
var data = jQuery("#cwp_top_form").serialize();
|
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",
|
145 |
+
currentURL: jQuery("#cwp_top_currenturl").val(),
|
146 |
+
social_network: service
|
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);
|
158 |
+
html='';
|
159 |
+
data = response.data;
|
160 |
+
|
161 |
+
for (i = 0; i < data.length; i++) {
|
162 |
+
// if (jQuery(".remove_user a[service=facebook").attr("id")!==data[i].id) {
|
163 |
+
html+="<a href='#' class='cwp_preview_page' service='"+service+"' pagetoken='"+data[i].access_token+"' pageid='"+data[i].id+"'>";
|
164 |
+
profile_image = 'https://graph.facebook.com/'+data[i].id+'/picture';
|
165 |
+
name = data[i].name;
|
166 |
+
category = data[i].category.substr(0,9);
|
167 |
+
html+="<div class='page_avatar'><img src='"+profile_image+"'/></div><div class='page_name'>"+name+"</div><div class='page_category'>"+category+"</div></a>";
|
168 |
+
//}
|
169 |
+
}
|
170 |
+
//html+='<button class="top_close_popup">Close preview</button>';
|
171 |
+
fheight = (Math.floor(data.length / 4) -1 )*175;
|
172 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").html(html);
|
173 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").height(fheight);
|
174 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_sample_tweet_preview_inner ").height(fheight+120);
|
175 |
+
|
176 |
+
endAjaxIntro();
|
177 |
+
break;
|
178 |
+
|
179 |
+
case 'linkedin':
|
180 |
+
var elem = jQuery(".cwp_top_wrapper .cwp_user_pages");
|
181 |
+
elem.fadeIn().addClass("active");
|
182 |
+
|
183 |
+
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
184 |
+
jQuery('html, body').scrollTop(scrollhere);
|
185 |
+
response = JSON.parse(response);
|
186 |
+
html='';
|
187 |
+
data = response.data;
|
188 |
+
for (i = 0; i < data.length; i++) {
|
189 |
+
html+="<a href='#' class='cwp_preview_page' service='"+service+"' pagetoken='"+data[i].access_token+"' pageid='"+data[i].id+"'>";
|
190 |
+
profile_image = 'https://graph.facebook.com/'+data[i].id+'/picture';
|
191 |
+
name = data[i].name;
|
192 |
+
category = data[i].category.substr(0,9);
|
193 |
+
html+="<div class='page_avatar'><img src='"+profile_image+"'/></div><div class='page_name'>"+name+"</div><div class='page_category'>"+category+"</div></a>";
|
194 |
+
|
195 |
+
}
|
196 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages .cwp_user_pages_inner ").html(html);
|
197 |
+
endAjaxIntro();
|
198 |
+
break;
|
199 |
+
}
|
200 |
+
|
201 |
+
},
|
202 |
+
error: function(MLHttpRequest, textStatus, errorThrown) {
|
203 |
+
console.log("There was an error: " + errorThrown);
|
204 |
+
}
|
205 |
+
});
|
206 |
+
|
207 |
+
|
208 |
+
|
209 |
+
return false;
|
210 |
+
}
|
211 |
+
|
212 |
+
// Add New Account
|
213 |
+
if (location.hash=="#_=_"|| location.hash=="#fbadd") {
|
214 |
+
addFacebook();
|
215 |
+
|
216 |
+
};
|
217 |
|
218 |
// Add New Twitter Account
|
219 |
+
jQuery("#cwp_top_form button.login").click(function(e){
|
220 |
e.preventDefault();
|
221 |
+
var service = jQuery(this).attr('service');
|
222 |
+
var action = "add_new_account";
|
223 |
+
var another = 0;
|
224 |
+
if (jQuery(this).text()=="+") {
|
225 |
+
action = "add_new_account_pro";
|
226 |
+
another = 1;
|
227 |
+
}
|
228 |
+
if (jQuery(this).text()==" Add Account ") {
|
229 |
+
another = 1;
|
230 |
+
}
|
231 |
startAjaxIntro();
|
232 |
jQuery.ajax({
|
233 |
type: "POST",
|
234 |
url: cwp_top_ajaxload.ajaxurl,
|
235 |
data: {
|
236 |
+
action: action,
|
237 |
+
currentURL: jQuery("#cwp_top_currenturl").val(),
|
238 |
+
social_network: service,
|
239 |
+
another:another
|
240 |
},
|
241 |
success: function(response) {
|
242 |
+
|
243 |
+
if (response.indexOf("upgrade to the PRO")===-1) {
|
244 |
+
switch (service) {
|
245 |
+
case 'twitter':
|
246 |
+
window.location.href = response;
|
247 |
+
break;
|
248 |
+
case 'facebook':
|
249 |
+
if (another===0) {
|
250 |
+
|
251 |
+
var elem = jQuery(".cwp_top_wrapper .cwp_fbapp_preview")
|
252 |
+
elem.fadeIn().addClass("active");
|
253 |
+
|
254 |
+
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
255 |
+
jQuery('html, body').scrollTop(scrollhere);
|
256 |
+
} else {
|
257 |
+
addFacebook();
|
258 |
+
}
|
259 |
+
endAjaxIntro();
|
260 |
+
|
261 |
+
break;
|
262 |
+
case 'linkedin':
|
263 |
+
var elem = jQuery(".cwp_top_wrapper .cwp_lkapp_preview")
|
264 |
+
elem.fadeIn().addClass("active");
|
265 |
+
|
266 |
+
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
267 |
+
jQuery('html, body').scrollTop(scrollhere);
|
268 |
+
// html = "<input type='text' placeholder='App key'/>";
|
269 |
+
//jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet").html(html);
|
270 |
+
endAjaxIntro();
|
271 |
+
break;
|
272 |
+
}
|
273 |
+
}else {
|
274 |
+
jQuery(".cwp_top_status .inactive").html(response);
|
275 |
+
endAjaxIntro();
|
276 |
}
|
277 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
|
279 |
},
|
280 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
282 |
}
|
283 |
});
|
284 |
|
|
|
285 |
return false;
|
286 |
});
|
287 |
|
296 |
type: "POST",
|
297 |
url: cwp_top_ajaxload.ajaxurl,
|
298 |
data: {
|
299 |
+
action: "log_out_user",
|
300 |
user_id: userID
|
301 |
},
|
302 |
success: function(response) {
|
381 |
if(response !== '') {
|
382 |
|
383 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").fadeIn().addClass("active");
|
384 |
+
|
385 |
+
//jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").css("top", ( jQuery(window).height() - this.height() ) / 2+jQuery(window).scrollTop() + "px");
|
386 |
+
//jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").css("left", ( jQuery(window).width() - this.width() ) / 2+jQuery(window).scrollLeft() + "px");
|
387 |
+
var elem = jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview");
|
388 |
+
var scrollhere = elem.offset().top+(jQuery(window).height()+elem.height())/2;
|
389 |
+
jQuery('html, body').scrollTop(scrollhere);
|
390 |
+
|
391 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner .sample_tweet").html(response);
|
392 |
}
|
393 |
endAjaxIntro();
|
427 |
//location.reload();
|
428 |
});
|
429 |
|
430 |
+
jQuery(".cwp_sample_tweet_preview_inner button.top_close_popup").on("click",function(e){
|
431 |
jQuery(this).parent().parent().fadeOut().removeClass("active");
|
432 |
});
|
433 |
|
434 |
+
jQuery(".cwp_user_pages_inner button.top_close_popup").on("click",function(e){
|
435 |
+
e.preventDefault();
|
436 |
+
jQuery(this).parent().parent().parent().fadeOut().removeClass("active");
|
437 |
+
return false;
|
438 |
+
});
|
439 |
+
|
440 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview .cwp_sample_tweet_preview_inner button.tweetitnow").click(function(e){
|
441 |
e.preventDefault();
|
442 |
startAjaxIntro();
|
451 |
endAjaxIntro();
|
452 |
jQuery(".cwp_top_wrapper .cwp_sample_tweet_preview").fadeOut().removeClass("active");
|
453 |
jQuery('html, body').animate({
|
454 |
+
scrollTop: jQuery(".cwp_top_wrapper .cwp_top_status").offset().top
|
455 |
+
}, 1000);
|
456 |
},
|
457 |
error: function(MLHttpRequest, textStatus, errorThrown) {
|
458 |
console.log("There was an error: "+errorThrown);
|
484 |
//jQuery(this).find("input[type=radio], input[type=checkbox]").checked = false;
|
485 |
}
|
486 |
|
487 |
+
jQuery("body").on('click',function(e){
|
488 |
+
|
489 |
+
|
490 |
+
if (jQuery(e.target).parent().hasClass("cwp_preview_page")) {
|
491 |
+
e.preventDefault();
|
492 |
+
//console.log(e);
|
493 |
+
|
494 |
+
startAjaxIntro();
|
495 |
+
var service = jQuery(e.target).parent().attr('service');
|
496 |
+
var access_token = jQuery(e.target).parent().attr('pagetoken');
|
497 |
+
var page_id = jQuery(e.target).parent().attr('pageid');
|
498 |
+
|
499 |
+
jQuery.ajax({
|
500 |
+
type: "POST",
|
501 |
+
url: cwp_top_ajaxload.ajaxurl,
|
502 |
+
data: {
|
503 |
+
action: "add_pages",
|
504 |
+
currentURL: jQuery("#cwp_top_currenturl").val(),
|
505 |
+
social_network: service,
|
506 |
+
page_token:access_token,
|
507 |
+
page_id:page_id,
|
508 |
+
picture_url: jQuery(e.target).parent().children().children('img').attr('src'),
|
509 |
+
page_name: jQuery(e.target).parent().children('.page_name').text()
|
510 |
+
},
|
511 |
+
success: function(response) {
|
512 |
+
switch (service) {
|
513 |
+
|
514 |
+
case 'facebook':
|
515 |
+
endAjaxIntro();
|
516 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages").fadeOut().removeClass("active");
|
517 |
+
window.location.href = response;
|
518 |
+
break;
|
519 |
+
|
520 |
+
case 'linkedin':
|
521 |
+
endAjaxIntro();
|
522 |
+
jQuery(".cwp_top_wrapper .cwp_user_pages").fadeOut().removeClass("active");
|
523 |
+
window.location.href = response;
|
524 |
+
break;
|
525 |
+
}
|
526 |
+
|
527 |
+
},
|
528 |
+
error: function(MLHttpRequest, textStatus, errorThrown) {
|
529 |
+
console.log("There was an error: " + errorThrown);
|
530 |
+
}
|
531 |
+
});
|
532 |
+
return false;
|
533 |
+
}
|
534 |
+
|
535 |
+
});
|
536 |
+
|
537 |
// Select all function
|
538 |
jQuery("button.select-all").click(function(e){
|
539 |
e.preventDefault();
|
549 |
|
550 |
function hideSpecifiedFieldsets()
|
551 |
{
|
552 |
+
jQuery("#top_opt_post_type_custom_field").parent().parent().hide();
|
553 |
jQuery("#top_opt_custom_url_option").parent().parent().hide();
|
554 |
jQuery("#top_opt_custom_url_field").parent().parent().hide();
|
555 |
jQuery("#top_opt_url_shortner").parent().parent().hide();
|
634 |
|
635 |
jQuery("select#top_opt_tweet_type").change(function(){
|
636 |
if(jQuery(this).val() == "custom-field") {
|
637 |
+
jQuery("#top_opt_post_type_custom_field").parent().parent().slideDown("fast");
|
638 |
} else {
|
639 |
+
jQuery("#top_opt_post_type_custom_field").parent().parent().slideUp("fast");
|
640 |
}
|
641 |
});
|
642 |
|
688 |
jQuery("#top_opt_post_type_value").parent().parent().slideUp("fast");
|
689 |
}
|
690 |
});
|
|
|
|
|
|
|
691 |
|
692 |
});
|
readme.txt
CHANGED
@@ -1,762 +1,693 @@
|
|
1 |
-
=== Tweet Old Post ===
|
2 |
-
Contributors: codeinwp
|
3 |
-
Tags: Tweet old post, Tweets, 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: 3.9
|
6 |
-
Stable tag: trunk
|
7 |
-
|
8 |
-
|
9 |
-
Plugin to
|
10 |
-
|
11 |
-
== Description ==
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
This plugin helps you to keeps your old posts alive by
|
16 |
-
|
17 |
-
For updates follow https://twitter.com/themeisle If you have anything you can let us know at <a href="http://themeisle.com/contact/?utm_source=readmetop&utm_medium=announce&utm_campaign=top">here</a>
|
18 |
-
|
19 |
-
|
20 |
-
**Fortcoming**
|
21 |
-
|
22 |
-
-
|
23 |
-
-
|
24 |
-
|
25 |
-
|
26 |
-
**
|
27 |
-
|
28 |
-
- Share new and old posts.
|
29 |
-
- Choose the time between
|
30 |
-
- Choose the number of
|
31 |
-
- Use hashtags to focus on topics.
|
32 |
-
- Include links back to your site.
|
33 |
-
- Exclude categories
|
34 |
-
- Exclude specific posts.
|
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 |
-
|
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 |
-
|
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 |
-
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
-
|
286 |
-
- Minor
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
-
|
317 |
-
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
**New in v3.
|
322 |
-
|
323 |
-
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
**New in v3.3
|
328 |
-
|
329 |
-
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
**New in
|
427 |
-
|
428 |
-
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
-
|
436 |
-
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
**
|
441 |
-
|
442 |
-
-
|
443 |
-
-
|
444 |
-
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
-
|
537 |
-
|
538 |
-
|
539 |
-
**New in
|
540 |
-
|
541 |
-
- Changed
|
542 |
-
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
-
|
553 |
-
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
-
|
611 |
-
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
-
|
630 |
-
-
|
631 |
-
-
|
632 |
-
|
633 |
-
|
634 |
-
**New in
|
635 |
-
|
636 |
-
-
|
637 |
-
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
-
|
661 |
-
|
662 |
-
|
663 |
-
**New in
|
664 |
-
|
665 |
-
-
|
666 |
-
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
**New in v3.0**
|
697 |
-
|
698 |
-
- added OAuth authentication
|
699 |
-
- user defined intervals
|
700 |
-
- may not work under php 4 requires php 5
|
701 |
-
|
702 |
-
|
703 |
-
**New in v2.0**
|
704 |
-
|
705 |
-
- added provision to select if you want to shorten the URL or not.
|
706 |
-
- Cleaned other options.
|
707 |
-
|
708 |
-
|
709 |
-
**New in v1.9**
|
710 |
-
|
711 |
-
- Removed PHP 4 support as it was creating problem for lot of people
|
712 |
-
|
713 |
-
|
714 |
-
**New in v1.8**
|
715 |
-
|
716 |
-
- Bug Fixes
|
717 |
-
- Provision to fetch tweet url from custom field
|
718 |
-
|
719 |
-
|
720 |
-
**New in v1.7**
|
721 |
-
|
722 |
-
- Removed api option from 1click.at not needed api key
|
723 |
-
|
724 |
-
|
725 |
-
**New in v1.6**
|
726 |
-
|
727 |
-
- Made the plugin PHP 4 compatible. Guys try it out and please let me know if that worked.
|
728 |
-
- Better error prompting. If your tweets are not appearing on twitter. Try "Tweet Now" button you'll see if there is any problem in tweeting.
|
729 |
-
- Added 1click.at shortning service you need to get the api key from http://theeasyapi.com/ you need to add your machine IP address in the server of http://theeasyapi.com/ for this api key to work.
|
730 |
-
|
731 |
-
|
732 |
-
**New in v1.5**
|
733 |
-
|
734 |
-
- Maximum age of post to be eligible for tweet - allows you to set Maximum age of the post to be eligible for tweet
|
735 |
-
- Added one more shortner service was looking for j.mp but they dont have the api yet.
|
736 |
-
|
737 |
-
|
738 |
-
**New in v1.4**
|
739 |
-
|
740 |
-
- Hashtags - allows you to set default hashtags for your tweets
|
741 |
-
|
742 |
-
|
743 |
-
**New in v1.3**
|
744 |
-
|
745 |
-
- URL Shortener Service - allows you to select which URL shortener service you want to use.
|
746 |
-
|
747 |
-
|
748 |
-
**New in v1.2**
|
749 |
-
|
750 |
-
- Tweet Prefix - Allows you to set prefix to the tweets.
|
751 |
-
- Add Data - Allows you to add post data to the tweets
|
752 |
-
- Tweet now - Button that will tweet at that moment without wanting you to wait for scheduled tweet
|
753 |
-
|
754 |
-
|
755 |
-
**v1.1**
|
756 |
-
|
757 |
-
- Twitter Username & Password - Using this twitter account credentials plugin will tweet.
|
758 |
-
- Minimum interval between tweets - allows you to determine how often the plugin will automatically choose and tweet a blog post for you.
|
759 |
-
- Randomness interval - This is a contributing factor in minimum interval so that posts are randomly chosen and tweeted from your blog.
|
760 |
-
- Minimum age of post to be eligible for tweet - This allows you to set how old your post should be in order to be eligible for the tweet.
|
761 |
-
- Categories to omit from tweets - This will protect posts from the selected categories from being tweeted.
|
762 |
-
|
1 |
+
=== Revive Old Post (Former Tweet Old Post) ===
|
2 |
+
Contributors: codeinwp
|
3 |
+
Tags: Tweet old post, Tweets, 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: 3.9
|
6 |
+
Stable tag: trunk
|
7 |
+
|
8 |
+
|
9 |
+
Plugin to share about your old posts to get more hits for them and keep them alive.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Revive Old Posts is a plugin designed to tweet your older posts to get more traffic.
|
14 |
+
|
15 |
+
This plugin helps you to keeps your old posts alive by sharing them and driving more traffic to them from social networks. It also helps you to promote your content. You can set time and no of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://themeisle.com/contact/?utm_source=readmetop&utm_medium=announce&utm_campaign=top">contact us</a>!
|
16 |
+
|
17 |
+
For updates follow https://twitter.com/themeisle If you have anything you can let us know at <a href="http://themeisle.com/contact/?utm_source=readmetop&utm_medium=announce&utm_campaign=top">here</a>
|
18 |
+
|
19 |
+
|
20 |
+
**Fortcoming**
|
21 |
+
|
22 |
+
- Custom Schedule
|
23 |
+
- Posts queue
|
24 |
+
|
25 |
+
|
26 |
+
**Revive Old Post provides following features**
|
27 |
+
|
28 |
+
- Share new and old posts.
|
29 |
+
- Choose the time between posts.
|
30 |
+
- Choose the number of posts to share.
|
31 |
+
- Use hashtags to focus on topics.
|
32 |
+
- Include links back to your site.
|
33 |
+
- Exclude categories
|
34 |
+
- Exclude specific posts.
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
== Installation ==
|
39 |
+
|
40 |
+
Following are the steps to install the Revive Old Post plugin
|
41 |
+
|
42 |
+
1. Download the latest version of the Revive Old Posts Plugin to your computer from here.
|
43 |
+
2. With an FTP program, access your site�s server.
|
44 |
+
3. Upload (copy) the Plugin file(s) or folder to the /wp-content/plugins folder.
|
45 |
+
4. In your WordPress Administration Panels, click on Plugins from the menu.
|
46 |
+
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.
|
47 |
+
6. To turn the Revive Old Posts Plugin on, click Activate.
|
48 |
+
7. Check your Administration Panels or WordPress blog to see if the Plugin is working.
|
49 |
+
8. You can change the plugin options from Revive Old Posts under settings menu.
|
50 |
+
|
51 |
+
Alternatively you can also follow the following steps to install the Revive Old Post plugin
|
52 |
+
|
53 |
+
1. In your WordPress Administration Panels, click on Add New option under Plugins from the menu.
|
54 |
+
2. Click on upload at the top.
|
55 |
+
3. Browse the location and select the Revive Old Post Plugin and click install now.
|
56 |
+
4. To turn the Revive Old Posts Plugin on, click Activate.
|
57 |
+
5. Check your Administration Panels or WordPress blog to see if the Plugin is working.
|
58 |
+
6. You can change the plugin options from Revive Old Posts under settings menu.
|
59 |
+
|
60 |
+
== Frequently Asked Questions ==
|
61 |
+
|
62 |
+
If you have any questions please get in touch with us at,
|
63 |
+
http://themeisle.com/contact/
|
64 |
+
|
65 |
+
|
66 |
+
**Plugin doesn't post at the regular interval**
|
67 |
+
|
68 |
+
- Unfortunately wp_cron function isn't perfect, it trigger just when somebody visit your site, so you nobody visit your site in 3 hours, TOP won't trigger
|
69 |
+
|
70 |
+
**What do I do is a get the WP CRON error ?
|
71 |
+
|
72 |
+
The issue is that your wp-cron.php is not returning a 200 response when hit with a http request originating from your own server, it could be several things, most of the time it's an issue with the server / site and not with TOP.
|
73 |
+
|
74 |
+
Some things you can test are.
|
75 |
+
|
76 |
+
- Are scheduled posts working? (They use wp-cron too).
|
77 |
+
- Are you hosted on Heart Internet? (wp-cron is known not to work with them).
|
78 |
+
- If you click Share now from sample post popup does it work?
|
79 |
+
- Try adding define( 'ALTERNATE_WP_CRON', true ); to your wp-config.php`, does the plugin work?
|
80 |
+
- Is your site private (I.E. is it behind some kind of authentication, maintenance plugin, .htaccess) if so wp-cron won't work until you remove it, if you are and you temporarily remove the authentication, do tweets start working?
|
81 |
+
|
82 |
+
If you have tried all these then feel free to contact support.
|
83 |
+
|
84 |
+
**If new version doesn't works**
|
85 |
+
|
86 |
+
- Try other versions from http://wordpress.org/extend/plugins/tweet-old-post/download/
|
87 |
+
- Manually upload it in your plugins folder, activate and use.
|
88 |
+
- Note: Do not upgrade your plugin if you want to use the older version.
|
89 |
+
|
90 |
+
|
91 |
+
**Revive Old post does not posts any tweets?**
|
92 |
+
|
93 |
+
- If its not sharing any posts try playing around with the options. Try setting maxtweetage to none and try again.
|
94 |
+
- Try removing categories from excluded option. Some of them have posted issues of tweet not getting post when categories are selected in exclued category section.
|
95 |
+
|
96 |
+
**When I publish a new post to Twitter sometimes it’s ok, but sometimes I am getting this error: "code":226,"message":"This request looks like it might be automated. To protect our users from spam and other malicious activity, we can’t complete this action right now. Please try again later"?**
|
97 |
+
|
98 |
+
This message is coming from the new Twitter’s spam protection mechanism. It’s analyzed your message and marked it as spam. As you can expect they don’t share any information about how this thing works. Try to change the format of your messages and use/don’t use/change URL shortener. There are also some reports that Twitter rejects posts coming from hosting providers that were used to abuse it.
|
99 |
+
Please note: Despite the fact that error is saying "might be automated", it doesn’t mean that Twitter rejects the post because it was made though the API. "Automated" there doesn’t mean "posted/submitted automatically", it means "written/generated automatically".
|
100 |
+
|
101 |
+
**Any more questions or doubts?**
|
102 |
+
|
103 |
+
- Contact us at http://themeisle.com/contact/
|
104 |
+
|
105 |
+
|
106 |
+
== Screenshots ==
|
107 |
+
|
108 |
+
1. Screenshot 1 Basic configurable options for Tweet Old Post to function, with ability to tweet at random interval.
|
109 |
+
|
110 |
+
|
111 |
+
for more you can check out
|
112 |
+
|
113 |
+
http://themeisle.com/plugins/tweet-old-post-lite/
|
114 |
+
|
115 |
+
|
116 |
+
== Changelog ==
|
117 |
+
|
118 |
+
**New in v6.7.7**
|
119 |
+
|
120 |
+
Added Facebook and Linkedin, Facebook is also enabled for the free users
|
121 |
+
Improved Post with image feature, we can also pull the image from post
|
122 |
+
Fixed Tweet over 140 chars error
|
123 |
+
Added Google Analytics Campaign Tracking
|
124 |
+
Rebranded into Revive Old Post
|
125 |
+
|
126 |
+
**New in v6.7.5**
|
127 |
+
|
128 |
+
Fixed some debug messages
|
129 |
+
|
130 |
+
**New in v6.7.3**
|
131 |
+
|
132 |
+
Added settings link, fixed tweet cutting and added cron debug messages
|
133 |
+
|
134 |
+
**New in v6.6**
|
135 |
+
|
136 |
+
Fixed excluded category issue and some small others.
|
137 |
+
|
138 |
+
**New in v6.0**
|
139 |
+
|
140 |
+
Tweets now are posted immediately, fixed scheduling and added debug messages
|
141 |
+
|
142 |
+
**New in v5.9**
|
143 |
+
|
144 |
+
Tags are converted to lowercase automatically now
|
145 |
+
|
146 |
+
**New in v5.8**
|
147 |
+
|
148 |
+
Added post by image options in the pro version and some fixes.
|
149 |
+
|
150 |
+
**New in v5.7**
|
151 |
+
|
152 |
+
Fixed permissions
|
153 |
+
|
154 |
+
**New in v5.6**
|
155 |
+
|
156 |
+
Added bit.ly back
|
157 |
+
|
158 |
+
**New in v5.5**
|
159 |
+
|
160 |
+
Fixed the table prefix issue
|
161 |
+
|
162 |
+
**New in v5.4**
|
163 |
+
|
164 |
+
Fixed the hashtags length issue
|
165 |
+
|
166 |
+
**New in v5.3**
|
167 |
+
|
168 |
+
Fixed the custom field issue
|
169 |
+
|
170 |
+
**New in v5.2**
|
171 |
+
|
172 |
+
Fixed exclude categories error, added wp short url, fixed oauth error, removed broken shorten services.
|
173 |
+
|
174 |
+
**New in v5.0**
|
175 |
+
|
176 |
+
- Whole plugin was rewrote from scratch and a pro version was added, so after 50 hours of work, here we are. This change will allow us to easier fix issues/ release new features and maintain the plugin.
|
177 |
+
|
178 |
+
**New in v4.0.9**
|
179 |
+
|
180 |
+
- Resolved twitter connectivity issue, for users who were not able to connect in 4.0.8. Twitter has changed their policy
|
181 |
+
as per https://dev.twitter.com/discussions/24239
|
182 |
+
|
183 |
+
|
184 |
+
|
185 |
+
**New in v4.0.8**
|
186 |
+
|
187 |
+
- Resolved twitter connectivity issue. Twitter has changed their policy
|
188 |
+
as per https://dev.twitter.com/discussions/24239
|
189 |
+
|
190 |
+
|
191 |
+
|
192 |
+
**New in v4.0.7**
|
193 |
+
|
194 |
+
- Resolved tweet not posting issue.
|
195 |
+
|
196 |
+
|
197 |
+
**New in v4.0.6**
|
198 |
+
|
199 |
+
- Changed how pages are navigated. Should not conflict with any of the plugin that interacts with twitter ever.
|
200 |
+
- For "Page not found", update the settings and then authorize with twitter.
|
201 |
+
- If you are not able to update anything or you are redirecting to your home page, reset the settings and try again.
|
202 |
+
- Code Cleanup.
|
203 |
+
|
204 |
+
|
205 |
+
**New in v4.0.5**
|
206 |
+
|
207 |
+
- Implemented Twitter API v1.1 as Twitter is retiring API v1 from 7th May.
|
208 |
+
- Handled conflict with BackWPup plugin.
|
209 |
+
- Some performance improvements with WPSuperCache plugin.
|
210 |
+
- Some design changes.
|
211 |
+
- Code Cleanup.
|
212 |
+
|
213 |
+
|
214 |
+
**New in v4.0.4**
|
215 |
+
|
216 |
+
- Resolved issue of tweet not posting automatically. Thanks to Daniel Lopez Gonzalez for helping me.
|
217 |
+
- Minor Fixes
|
218 |
+
|
219 |
+
|
220 |
+
**New in v4.0.3**
|
221 |
+
|
222 |
+
- Handled too many tweets when W3 Total Cache plugin is installed. Please check and let me know.
|
223 |
+
- Bug fixes
|
224 |
+
|
225 |
+
|
226 |
+
**New in v4.0.2**
|
227 |
+
|
228 |
+
- Removed the option to specify the consumer key and secret as twitter does not show the application from which its tweeted anymore.
|
229 |
+
- Most probably, the tweet not posting automatically issue is resolved. Please check and let me know.
|
230 |
+
- Bug fixes
|
231 |
+
|
232 |
+
|
233 |
+
**New in v4.0.1**
|
234 |
+
|
235 |
+
- Resolved issue of page getting blank after returning from twitter
|
236 |
+
- added pages to exclude post option
|
237 |
+
- Bug fixes
|
238 |
+
- updated the steps of creating twitter application check here http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
239 |
+
|
240 |
+
|
241 |
+
**New in v4.0.0**
|
242 |
+
|
243 |
+
- You can now change the application name. Change via Tweet Old Post to your specified name. Follow the Steps here,
|
244 |
+
http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
245 |
+
- Pages can now be included in tweets. Added an option to select what is to be tweeted (pages, posts, or both).
|
246 |
+
- Removed "." and used "-" when adding additional text, "." was causing grammatical mistakes if sentence was trimmed.
|
247 |
+
- Added option to specify number of posts that can be tweeted simultaneously. You can specify how many tweets you want at a time.
|
248 |
+
- Last but not the least, removed random time slot was causing lot of confusion.
|
249 |
+
|
250 |
+
|
251 |
+
|
252 |
+
**New in v3.3.3**
|
253 |
+
|
254 |
+
- Resolved permission issue of exclude post.
|
255 |
+
|
256 |
+
|
257 |
+
|
258 |
+
**New in v3.3.2**
|
259 |
+
|
260 |
+
- Resolved too many redirects issue
|
261 |
+
If its still not working try these steps
|
262 |
+
- Make sure "Tweet Old Post Admin URL (Current URL)" is showing your current URL.
|
263 |
+
- Click on "Update Tweet Old Post Options".
|
264 |
+
- Try to authorize again.
|
265 |
+
- Removed "_" from hashtags. Previously space in hashtag was replaced with "_". Now there will be no spaces or "_" in hashtags.
|
266 |
+
|
267 |
+
|
268 |
+
|
269 |
+
**New in v3.3.1**
|
270 |
+
|
271 |
+
- Changed logic for posting data to twitter.
|
272 |
+
- Resolved bit.ly issue.
|
273 |
+
|
274 |
+
|
275 |
+
|
276 |
+
**New in v3.3.0**
|
277 |
+
|
278 |
+
- Attempt to fix logs out issue (Tweet Old Post pushes out when any action is performed).
|
279 |
+
|
280 |
+
|
281 |
+
|
282 |
+
**New in v3.2.9**
|
283 |
+
|
284 |
+
- Option to reset setting. When something goes wrong, please reset the settings and setup again.
|
285 |
+
- For people still facing issues of conflict with Google Analytics Plugin, this version should work.
|
286 |
+
- Minor bug fixes.
|
287 |
+
|
288 |
+
|
289 |
+
|
290 |
+
**New in v3.2.8**
|
291 |
+
|
292 |
+
- Resolved conflict with Google Analytics Plugin.
|
293 |
+
- Changed the log file location to root of plugin folder.
|
294 |
+
- Maintained Tweet Cycle. Repeat only when all post have been tweeted.
|
295 |
+
- Made other optimizations and resolved some minor bugs.
|
296 |
+
|
297 |
+
|
298 |
+
|
299 |
+
**New in v3.2.7**
|
300 |
+
|
301 |
+
- Added logging for people who cant make it work can enable and check the log, or mail me the log file.
|
302 |
+
- Brought back the exclude post option.
|
303 |
+
- Made other optimizations and resolved some minor bugs.
|
304 |
+
- Check http://www.ajaymatharu.com/tweet-old-post-update-3-2-7/ for more detailed explanation.
|
305 |
+
|
306 |
+
|
307 |
+
|
308 |
+
**New in v3.2.6**
|
309 |
+
|
310 |
+
- removed exclude post due to security threat. Will work on it and bring it up back.
|
311 |
+
|
312 |
+
|
313 |
+
|
314 |
+
**New in v3.2.5**
|
315 |
+
|
316 |
+
- Resolved hashtag not posting issue.
|
317 |
+
- other bug fixes.
|
318 |
+
|
319 |
+
|
320 |
+
|
321 |
+
**New in v3.2.4**
|
322 |
+
|
323 |
+
- Bug fixes
|
324 |
+
|
325 |
+
|
326 |
+
|
327 |
+
**New in v3.2.3**
|
328 |
+
|
329 |
+
- Bug fixes
|
330 |
+
|
331 |
+
|
332 |
+
|
333 |
+
**New in v3.2.2**
|
334 |
+
|
335 |
+
- Resolved bit.ly issue
|
336 |
+
- new option for hashtags
|
337 |
+
- other bug fixes
|
338 |
+
|
339 |
+
|
340 |
+
|
341 |
+
**New in v3.2.1**
|
342 |
+
|
343 |
+
- Bug fixes
|
344 |
+
|
345 |
+
|
346 |
+
|
347 |
+
**New in v3.2**
|
348 |
+
|
349 |
+
- Bug fixes
|
350 |
+
- Option to choose to include link in post
|
351 |
+
- option to post only title or body or both title and body
|
352 |
+
- option to set additional text either at beginning or end of tweet
|
353 |
+
- option to pick hashtags from custom field
|
354 |
+
|
355 |
+
|
356 |
+
|
357 |
+
**New in v3.1.2**
|
358 |
+
|
359 |
+
- Resolved tweets not getting posted when categories are excluded.
|
360 |
+
- If you are not able to authorise your twitter account set you blog URL in Administration → Settings → General.
|
361 |
+
|
362 |
+
|
363 |
+
|
364 |
+
**New in v3.1**
|
365 |
+
|
366 |
+
- Resolved issue of plugin flooding twitter account with tweets.
|
367 |
+
- added provision to exclude some post from selected categories
|
368 |
+
|
369 |
+
|
370 |
+
|
371 |
+
**New in v3.0**
|
372 |
+
|
373 |
+
- added OAuth authentication
|
374 |
+
- user defined intervals
|
375 |
+
- may not work under php 4 requires php 5
|
376 |
+
|
377 |
+
|
378 |
+
|
379 |
+
**New in v2.0**
|
380 |
+
|
381 |
+
- added provision to select if you want to shorten the URL or not.
|
382 |
+
- Cleaned other options.
|
383 |
+
|
384 |
+
|
385 |
+
|
386 |
+
**New in v1.9**
|
387 |
+
|
388 |
+
- Removed PHP 4 support as it was creating problem for lot of people
|
389 |
+
|
390 |
+
|
391 |
+
|
392 |
+
**New in v1.8**
|
393 |
+
|
394 |
+
- Bug Fixes
|
395 |
+
- Provision to fetch tweet url from custom field
|
396 |
+
|
397 |
+
|
398 |
+
|
399 |
+
**New in v1.7**
|
400 |
+
|
401 |
+
- Removed api option from 1click.at not needed api key
|
402 |
+
|
403 |
+
|
404 |
+
|
405 |
+
**New in v1.6**
|
406 |
+
|
407 |
+
- Made the plugin PHP 4 compatible. Guys try it out and please let me know if that worked.
|
408 |
+
- Better error prompting. If your tweets are not appearing on twitter. Try "Tweet Now" button you'll see if there is any problem in tweeting.
|
409 |
+
- Added 1click.at shortning service you need to get the api key from http://theeasyapi.com/ you need to add your machine IP address in the server of http://theeasyapi.com/ for this api key to work.
|
410 |
+
|
411 |
+
|
412 |
+
|
413 |
+
**New in v1.5**
|
414 |
+
|
415 |
+
- Maximum age of post to be eligible for tweet - allows you to set Maximum age of the post to be eligible for tweet
|
416 |
+
- Added one more shortner service was looking for j.mp but they dont have the api yet.
|
417 |
+
|
418 |
+
|
419 |
+
|
420 |
+
**New in v1.4**
|
421 |
+
|
422 |
+
- Hashtags - allows you to set default hashtags for your tweets
|
423 |
+
|
424 |
+
|
425 |
+
|
426 |
+
**New in v1.3**
|
427 |
+
|
428 |
+
- URL Shortener Service - allows you to select which URL shortener service you want to use.
|
429 |
+
|
430 |
+
|
431 |
+
|
432 |
+
**New in v1.2**
|
433 |
+
|
434 |
+
- Tweet Prefix - Allows you to set prefix to the tweets.
|
435 |
+
- Add Data - Allows you to add post data to the tweets
|
436 |
+
- Tweet now - Button that will tweet at that moment without wanting you to wait for scheduled tweet
|
437 |
+
|
438 |
+
|
439 |
+
|
440 |
+
**v1.1**
|
441 |
+
|
442 |
+
- Twitter Username & Password - Using this twitter account credentials plugin will tweet.
|
443 |
+
- Minimum interval between tweets - allows you to determine how often the plugin will automatically choose and tweet a blog post for you.
|
444 |
+
- Randomness interval - This is a contributing factor in minimum interval so that posts are randomly chosen and tweeted from your blog.
|
445 |
+
- Minimum age of post to be eligible for tweet - This allows you to set how old your post should be in order to be eligible for the tweet.
|
446 |
+
- Categories to omit from tweets - This will protect posts from the selected categories from being tweeted.
|
447 |
+
|
448 |
+
|
449 |
+
== Other Notes ==
|
450 |
+
|
451 |
+
|
452 |
+
|
453 |
+
**New in v4.0.9**
|
454 |
+
|
455 |
+
- Resolved twitter connectivity issue, for users who were not able to connect in 4.0.8. Twitter has changed their policy
|
456 |
+
as per https://dev.twitter.com/discussions/24239
|
457 |
+
|
458 |
+
|
459 |
+
**New in v4.0.8**
|
460 |
+
|
461 |
+
- Resolved twitter connectivity issue. Twitter has changed their policy
|
462 |
+
as per https://dev.twitter.com/discussions/24239
|
463 |
+
|
464 |
+
|
465 |
+
**New in v4.0.7**
|
466 |
+
|
467 |
+
- Resolved tweet not posting issue.
|
468 |
+
|
469 |
+
|
470 |
+
**New in v4.0.6**
|
471 |
+
|
472 |
+
- Changed how pages are navigated. Should not conflict with any of the plugin that interacts with twitter ever.
|
473 |
+
- For "Page not found", update the settings and then authorize with twitter.
|
474 |
+
- If you are not able to update anything or you are redirecting to your home page, reset the settings and try again.
|
475 |
+
- Code Cleanup.
|
476 |
+
|
477 |
+
|
478 |
+
**New in v4.0.5**
|
479 |
+
|
480 |
+
- Implemented Twitter API v1.1 as Twitter is retiring API v1 from 7th May.
|
481 |
+
- Handled conflict with BackWPup plugin.
|
482 |
+
- Some performance improvements with WPSuperCache plugin.
|
483 |
+
- Some design changes.
|
484 |
+
- Code Cleanup.
|
485 |
+
|
486 |
+
|
487 |
+
**New in v4.0.4**
|
488 |
+
|
489 |
+
- Resolved issue of tweet not posting automatically . Thanks to Daniel Lopez Gonzalez for helping me.
|
490 |
+
- Minor Fixes
|
491 |
+
|
492 |
+
|
493 |
+
**New in v4.0.3**
|
494 |
+
|
495 |
+
- Handled too many tweets when W3 Total Cache plugin is installed. Please check and let me know.
|
496 |
+
- Bug fixes
|
497 |
+
|
498 |
+
|
499 |
+
**New in v4.0.2**
|
500 |
+
|
501 |
+
- Removed the option to specify the consumer key and secret as twitter does not show the application from which its tweeted anymore.
|
502 |
+
- Most probably, the tweet not posting automatically issue is resolved. Please check and let me know.
|
503 |
+
- Bug fixes
|
504 |
+
|
505 |
+
|
506 |
+
**New in v4.0.1**
|
507 |
+
|
508 |
+
- Resolved issue of page getting blank after returning from twitter
|
509 |
+
- added pages to exclude post option
|
510 |
+
- Bug fixes
|
511 |
+
- updated the steps of creating twitter application check here http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
512 |
+
|
513 |
+
|
514 |
+
**New in v4.0.0**
|
515 |
+
|
516 |
+
- You can now change the application name. Change via Tweet Old Post to your specified name. Follow the Steps here,
|
517 |
+
http://www.ajaymatharu.com/major-update-to-tweet-old-post/
|
518 |
+
- Pages can now be included in tweets. Added an option to select what is to be tweeted (pages, posts, or both).
|
519 |
+
- Removed "." and used "-" when adding additional text, "." was causing grammatical mistakes if sentence was trimmed.
|
520 |
+
- Added option to specify number of posts that can be tweeted simultaneously. You can specify how many tweets you want at a time.
|
521 |
+
- Last but not the least, removed random time slot was causing lot of confusion.
|
522 |
+
|
523 |
+
|
524 |
+
**New in v3.3.3**
|
525 |
+
|
526 |
+
- Resolved permission issue of exclude post.
|
527 |
+
|
528 |
+
|
529 |
+
**New in v3.3.2**
|
530 |
+
|
531 |
+
- Resolved too many redirects issue
|
532 |
+
If its still not working try these steps
|
533 |
+
- Make sure "Tweet Old Post Admin URL (Current URL)" is showing your current URL.
|
534 |
+
- Click on "Update Tweet Old Post Options".
|
535 |
+
- Try to authorize again.
|
536 |
+
- Removed "_" from hashtags. Previously space in hashtag was replaced with "_". Now there will be no spaces or "_" in hashtags.
|
537 |
+
|
538 |
+
|
539 |
+
**New in v3.3.1**
|
540 |
+
|
541 |
+
- Changed logic for posting data to twitter.
|
542 |
+
- Resolved bit.ly issue.
|
543 |
+
|
544 |
+
|
545 |
+
**New in v3.3.0**
|
546 |
+
|
547 |
+
- Attempt to fix logs out issue (Tweet Old Post pushes out when any action is performed).
|
548 |
+
|
549 |
+
|
550 |
+
**New in v3.2.9**
|
551 |
+
|
552 |
+
- Option to reset setting. When something goes wrong, please reset the settings and setup again.
|
553 |
+
- For people still facing issues of conflict with Google Analytics Plugin, this version should work.
|
554 |
+
- Minor bug fixes.
|
555 |
+
|
556 |
+
|
557 |
+
**New in v3.2.8**
|
558 |
+
|
559 |
+
- Resolved conflict with Google Analytics Plugin.
|
560 |
+
- Changed the log file location to root of plugin folder.
|
561 |
+
- Maintained Tweet Cycle. Repeat only when all post have been tweeted.
|
562 |
+
- Made other optimizations and resolved some minor bugs.
|
563 |
+
|
564 |
+
|
565 |
+
**New in v3.2.7**
|
566 |
+
|
567 |
+
- Added logging for people who cant make it work can enable and check the log, or mail me the log file.
|
568 |
+
- Brought back the exclude post option.
|
569 |
+
- Made other optimizations and resolved some minor bugs.
|
570 |
+
- Check http://www.ajaymatharu.com/tweet-old-post-update-3-2-7/ for more detailed explanation.
|
571 |
+
|
572 |
+
|
573 |
+
**New in v3.2.6**
|
574 |
+
|
575 |
+
- removed exclude post due to security threat. Will work on it and bring it up back.
|
576 |
+
|
577 |
+
|
578 |
+
**New in v3.2.5**
|
579 |
+
|
580 |
+
- Resolved hashtag not posting issue.
|
581 |
+
- other bug fixes.
|
582 |
+
|
583 |
+
|
584 |
+
**New in v3.2.4**
|
585 |
+
|
586 |
+
- Bug fixes
|
587 |
+
|
588 |
+
|
589 |
+
**New in v3.2.3**
|
590 |
+
|
591 |
+
- Bug fixes
|
592 |
+
|
593 |
+
|
594 |
+
**New in v3.2.2**
|
595 |
+
|
596 |
+
- Resolved bit.ly issue
|
597 |
+
- new option for hashtags
|
598 |
+
- other bug fixes
|
599 |
+
|
600 |
+
|
601 |
+
**New in v3.2.1**
|
602 |
+
|
603 |
+
- Bug fixes
|
604 |
+
|
605 |
+
|
606 |
+
**New in v3.2**
|
607 |
+
|
608 |
+
- Bug fixes
|
609 |
+
- Option to choose to include link in post
|
610 |
+
- option to post only title or body or both title and body
|
611 |
+
- option to set additional text either at beginning or end of tweet
|
612 |
+
- option to pick hashtags from custom field
|
613 |
+
|
614 |
+
|
615 |
+
**New in v3.1.2**
|
616 |
+
|
617 |
+
- Resolved tweets not getting posted when categories are excluded.
|
618 |
+
- If you are not able to authorise your twitter account set you blog URL in Administration → Settings → General.
|
619 |
+
|
620 |
+
|
621 |
+
**New in v3.1**
|
622 |
+
|
623 |
+
- Resolved issue of plugin flooding twitter account with tweets.
|
624 |
+
- added provision to exclude some post from selected categories
|
625 |
+
|
626 |
+
|
627 |
+
**New in v3.0**
|
628 |
+
|
629 |
+
- added OAuth authentication
|
630 |
+
- user defined intervals
|
631 |
+
- may not work under php 4 requires php 5
|
632 |
+
|
633 |
+
|
634 |
+
**New in v2.0**
|
635 |
+
|
636 |
+
- added provision to select if you want to shorten the URL or not.
|
637 |
+
- Cleaned other options.
|
638 |
+
|
639 |
+
|
640 |
+
**New in v1.9**
|
641 |
+
|
642 |
+
- Removed PHP 4 support as it was creating problem for lot of people
|
643 |
+
|
644 |
+
|
645 |
+
**New in v1.8**
|
646 |
+
|
647 |
+
- Bug Fixes
|
648 |
+
- Provision to fetch tweet url from custom field
|
649 |
+
|
650 |
+
|
651 |
+
**New in v1.7**
|
652 |
+
|
653 |
+
- Removed api option from 1click.at not needed api key
|
654 |
+
|
655 |
+
|
656 |
+
**New in v1.6**
|
657 |
+
|
658 |
+
- Made the plugin PHP 4 compatible. Guys try it out and please let me know if that worked.
|
659 |
+
- Better error prompting. If your tweets are not appearing on twitter. Try "Tweet Now" button you'll see if there is any problem in tweeting.
|
660 |
+
- Added 1click.at shortning service you need to get the api key from http://theeasyapi.com/ you need to add your machine IP address in the server of http://theeasyapi.com/ for this api key to work.
|
661 |
+
|
662 |
+
|
663 |
+
**New in v1.5**
|
664 |
+
|
665 |
+
- Maximum age of post to be eligible for tweet - allows you to set Maximum age of the post to be eligible for tweet
|
666 |
+
- Added one more shortner service was looking for j.mp but they dont have the api yet.
|
667 |
+
|
668 |
+
|
669 |
+
**New in v1.4**
|
670 |
+
|
671 |
+
- Hashtags - allows you to set default hashtags for your tweets
|
672 |
+
|
673 |
+
|
674 |
+
**New in v1.3**
|
675 |
+
|
676 |
+
- URL Shortener Service - allows you to select which URL shortener service you want to use.
|
677 |
+
|
678 |
+
|
679 |
+
**New in v1.2**
|
680 |
+
|
681 |
+
- Tweet Prefix - Allows you to set prefix to the tweets.
|
682 |
+
- Add Data - Allows you to add post data to the tweets
|
683 |
+
- Tweet now - Button that will tweet at that moment without wanting you to wait for scheduled tweet
|
684 |
+
|
685 |
+
|
686 |
+
**v1.1**
|
687 |
+
|
688 |
+
- Twitter Username & Password - Using this twitter account credentials plugin will tweet.
|
689 |
+
- Minimum interval between tweets - allows you to determine how often the plugin will automatically choose and tweet a blog post for you.
|
690 |
+
- Randomness interval - This is a contributing factor in minimum interval so that posts are randomly chosen and tweeted from your blog.
|
691 |
+
- Minimum age of post to be eligible for tweet - This allows you to set how old your post should be in order to be eligible for the tweet.
|
692 |
+
- Categories to omit from tweets - This will protect posts from the selected categories from being tweeted.
|
693 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tweet-old-post.php
CHANGED
@@ -1,26 +1,27 @@
|
|
1 |
<?php
|
2 |
# /*
|
3 |
-
# Plugin Name: Tweet
|
4 |
# Plugin URI: http://themeisle.com/plugins/tweet-old-post-lite/
|
5 |
-
# Description: Wordpress plugin that helps you to keeps your old posts alive by
|
6 |
# Author: ThemeIsle
|
7 |
-
# Version: 6.
|
8 |
# Author URI: http://themeisle.com/
|
9 |
# */
|
10 |
|
11 |
// Config Constants
|
12 |
-
define("
|
13 |
-
define("
|
14 |
-
define("
|
15 |
-
define("
|
16 |
-
define("
|
17 |
-
|
|
|
18 |
// Require core.
|
19 |
-
require_once(
|
20 |
// Require core.
|
21 |
-
require_once(
|
22 |
if (!class_exists('TAV_Remote_Notification_Client')) {
|
23 |
-
require(
|
24 |
}
|
25 |
if (!function_exists('topProImage'))
|
26 |
$notification = new TAV_Remote_Notification_Client( 37, 'a8be784b898fa2fb', 'http://themeisle.com?post_type=notification' );
|
@@ -29,7 +30,8 @@ else
|
|
29 |
|
30 |
// Clear scheduled tweets on plugin deactivation
|
31 |
register_deactivation_hook(__FILE__, array($CWP_TOP_Core, 'deactivationHook'));
|
|
|
32 |
// Reset all settings on plugin activation.
|
33 |
register_activation_hook(__FILE__, array($CWP_TOP_Core, 'resetAllOptions'));
|
34 |
|
35 |
-
|
1 |
<?php
|
2 |
# /*
|
3 |
+
# Plugin Name: Revive Old Post (Former Tweet Old Post)
|
4 |
# Plugin URI: http://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="http://themeisle.com/contact/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
|
6 |
# Author: ThemeIsle
|
7 |
+
# Version: 6.8
|
8 |
# Author URI: http://themeisle.com/
|
9 |
# */
|
10 |
|
11 |
// Config Constants
|
12 |
+
define("ROPPLUGINPATH", realpath(dirname(__FILE__) ));
|
13 |
+
define("ROPCSSFILE", plugins_url('css/style.css',__FILE__ ));
|
14 |
+
define("ROPCUSTOMDASHBOARDICON", plugins_url("css/custom_dashboard_icon.css", __FILE__));
|
15 |
+
define("ROPJSFILE", plugins_url('js/master.js',__FILE__ ));
|
16 |
+
define("ROPJSCOUNTDOWN", plugins_url('js/countdown.js',__FILE__ ));
|
17 |
+
define("ROPPLUGINBASENAME", plugin_basename(__FILE__));
|
18 |
+
define('ROP_TOP_FB_API_VERSION','v2.0');
|
19 |
// Require core.
|
20 |
+
require_once(ROPPLUGINPATH."/inc/core.php");
|
21 |
// Require core.
|
22 |
+
require_once(ROPPLUGINPATH."/inc/exclude-posts.php");
|
23 |
if (!class_exists('TAV_Remote_Notification_Client')) {
|
24 |
+
require( ROPPLUGINPATH.'/inc/class-remote-notification-client.php' );
|
25 |
}
|
26 |
if (!function_exists('topProImage'))
|
27 |
$notification = new TAV_Remote_Notification_Client( 37, 'a8be784b898fa2fb', 'http://themeisle.com?post_type=notification' );
|
30 |
|
31 |
// Clear scheduled tweets on plugin deactivation
|
32 |
register_deactivation_hook(__FILE__, array($CWP_TOP_Core, 'deactivationHook'));
|
33 |
+
|
34 |
// Reset all settings on plugin activation.
|
35 |
register_activation_hook(__FILE__, array($CWP_TOP_Core, 'resetAllOptions'));
|
36 |
|
37 |
+
add_action("admin_head", array($CWP_TOP_Core, 'rop_load_dashboard_icon'));
|