|
1 <style> |
|
2 .dim { |
|
3 opacity: .5; |
|
4 } |
|
5 .button-secondary { |
|
6 margin-left: 10px; |
|
7 } |
|
8 .aktt-form { |
|
9 margin-bottom: 40px; |
|
10 } |
|
11 .aktt-upgrade-needed { |
|
12 background: #c5e0ef url(<?php echo esc_url(plugins_url('assets/img/bg-clouds.png', AKTT_FILE)); ?>) bottom center repeat-x; |
|
13 margin-top: 20px; |
|
14 padding: 15px 10px 5px; |
|
15 } |
|
16 .aktt-upgrade-needed h3, |
|
17 .aktt-upgrade-needed p { |
|
18 margin: 0; |
|
19 padding: 0 0 10px; |
|
20 } |
|
21 table.form-table { |
|
22 margin: 20px 0; |
|
23 } |
|
24 table.form-table .help { |
|
25 color: #999; |
|
26 } |
|
27 table.form-table h3 { |
|
28 margin-top: 0; |
|
29 } |
|
30 #aktt-account-list { |
|
31 border-top: 1px solid #ddd; |
|
32 margin: 0; |
|
33 visibility: hidden; |
|
34 } |
|
35 .aktt-account { |
|
36 border-bottom: 1px solid #ddd; |
|
37 color: #666; |
|
38 margin: 0; |
|
39 padding: 0; |
|
40 } |
|
41 .aktt-account-enabled.aktt-account-collapsed { |
|
42 color: #333; |
|
43 opacity: 1; |
|
44 } |
|
45 .aktt-account h3 { |
|
46 cursor: hand; |
|
47 cursor: pointer; |
|
48 line-height: 48px; |
|
49 margin: 0; |
|
50 padding: 0 0 0 58px; |
|
51 } |
|
52 .aktt-account-disabled-notice { |
|
53 color: #999; |
|
54 } |
|
55 .aktt-account-enabled .aktt-account-disabled-notice { |
|
56 display: none; |
|
57 } |
|
58 .aktt-none .aktt-account h3 { |
|
59 cursor: default; |
|
60 } |
|
61 .aktt-account .settings { |
|
62 display: none; |
|
63 padding-left: 58px; |
|
64 } |
|
65 .depends-on-create-posts { |
|
66 background: #eee; |
|
67 margin: 0 0 10px; |
|
68 padding: 10px 10px 0; |
|
69 } |
|
70 .depends-on-create-posts.dim { |
|
71 background: transparent; |
|
72 } |
|
73 .depends-on-create-posts h4, |
|
74 .depends-on-create-posts p { |
|
75 margin: 0 0 10px; |
|
76 padding: 0; |
|
77 } |
|
78 .depends-on-create-posts label.right { |
|
79 display: block; |
|
80 padding-left: 150px; |
|
81 } |
|
82 .depends-on-create-posts label.left { |
|
83 display: block; |
|
84 float: left; |
|
85 width: 150px; |
|
86 } |
|
87 table.form-table .depends-on-create-posts .help { |
|
88 color: #666; |
|
89 } |
|
90 .aktt-manual-update-request { |
|
91 vertical-align: middle; |
|
92 visibility: hidden; |
|
93 } |
|
94 .aktt-manual-update-running { |
|
95 margin-left: 10px; |
|
96 } |
|
97 </style> |
|
98 <div class="wrap" id="<?php echo AKTT::$prefix.'options_page'; ?>"> |
|
99 <?php screen_icon(); ?> |
|
100 <h2><?php _e('Twitter Tools', 'twitter-tools'); ?></h2> |
|
101 |
|
102 <?php |
|
103 if (AKTT::$enabled) { |
|
104 if ($upgrade_needed) { |
|
105 ?> |
|
106 <div class="aktt-upgrade-needed"> |
|
107 <h3><?php _e('Upgrade Needed!', 'twitter-tools'); ?></h3> |
|
108 <p><?php _e('Looks like you have upgraded from a previous version of Twitter Tools.', 'twitter-tools'); ?> |
|
109 <a href="<?php echo esc_url(admin_url('index.php?aktt_action=upgrade-3.0')); ?>" class="aktt-upgrade-3.0 button-secondary"><?php _e('Upgrade Your Tweets', 'twitter-tools'); ?></a></p> |
|
110 </div> |
|
111 <?php |
|
112 } |
|
113 |
|
114 ?> |
|
115 <form class="aktt-form" method="post" action="<?php echo esc_url(admin_url('options.php')); ?>"> |
|
116 <table class="form-table"> |
|
117 <?php |
|
118 foreach (AKTT::$settings as $setting) { |
|
119 ?> |
|
120 <tr valign="top"> |
|
121 <th scope="row"><?php echo $setting['label']; ?></th> |
|
122 <td> |
|
123 <?php |
|
124 $options = array(); |
|
125 foreach ($setting['options'] as $k => $v) { |
|
126 $name = 'aktt_v3_settings['.$setting['name'].']'; |
|
127 $id = $name.'-'.$k; |
|
128 ob_start(); |
|
129 ?> |
|
130 <label for="<?php echo esc_attr($id); ?>"> |
|
131 <input type="radio" name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($k); ?>" id="<?php echo esc_attr($id); ?>" <?php checked($k, AKTT::option($setting['name'])); ?> /> |
|
132 <?php echo $v; ?> |
|
133 </label> |
|
134 <?php |
|
135 $options[] = ob_get_clean(); |
|
136 } |
|
137 echo implode('<br />', $options); |
|
138 if (!empty($setting['help'])) { |
|
139 ?> |
|
140 <br /><span class="help"><?php echo esc_html($setting['help']); ?></span> |
|
141 <?php |
|
142 } |
|
143 ?> |
|
144 </td> |
|
145 </tr> |
|
146 <?php |
|
147 } |
|
148 ?> |
|
149 </table> |
|
150 |
|
151 <div id="aktt-accounts"> |
|
152 <table class="form-table"> |
|
153 <tr valign="top"> |
|
154 <th scope="row"> |
|
155 <h3><?php _e('Accounts', 'twitter-tools'); ?></h3> |
|
156 <?php printf(__('Manage Twitter accounts on your <a href="%s">Social settings page</a>.', 'twitter-tools'), admin_url('options-general.php?page=social.php')); ?> |
|
157 </th> |
|
158 <td> |
|
159 <ul id="aktt-account-list"> |
|
160 <?php |
|
161 if (empty(self::$accounts)) { |
|
162 ?> |
|
163 <li class="aktt-none"> |
|
164 <div class="aktt-account"> |
|
165 <h3 style="background: url(http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?d=mm&f=y&s=48) left top no-repeat;"><?php _e('(no accounts)', 'twitter-tools'); ?></h3> |
|
166 </div> |
|
167 </li> |
|
168 <?php |
|
169 } |
|
170 else { |
|
171 foreach (self::$accounts as $account) { |
|
172 include(AKTT_PATH.'/views/admin-account.php'); |
|
173 } |
|
174 } |
|
175 ?> |
|
176 </ul><!-- /aktt-account-list --> |
|
177 </td> |
|
178 </tr> |
|
179 </table> |
|
180 </div><!-- <?php echo self::$prefix.'accounts'; ?> --> |
|
181 |
|
182 <?php |
|
183 // Output the nonces, and hidden fields for the page |
|
184 settings_fields(AKTT::$menu_page_slug); |
|
185 ?> |
|
186 <input type="submit" class="button-primary" value="<?php _e('Save Settings', 'twitter-tools'); ?>" /> |
|
187 </form> |
|
188 |
|
189 <h3><?php _e('Download Tweets', 'twitter-tools'); ?></h3> |
|
190 <p> |
|
191 <?php _e('Tweets are downloaded automatically every 15 minutes. Can\'t wait?', 'twitter-tools'); ?> |
|
192 <a href="<?php echo esc_url(AKTT::get_manual_update_url()); ?>" class="aktt-manual-update button-secondary"><?php _e('Download Tweets Now', 'twitter-tools'); ?></a> |
|
193 <span class="aktt-manual-update-running"></span> |
|
194 <img alt="" class="aktt-manual-update-request" src="<?php echo admin_url('images/wpspin_light.gif'); ?>"> |
|
195 </p> |
|
196 |
|
197 <?php |
|
198 } |
|
199 ?> |
|
200 </div><!-- /wrap --> |
|
201 <script> |
|
202 function akttSetState(elem) { |
|
203 var $account = jQuery(elem); |
|
204 var $settings = $account.find('.settings'); |
|
205 var $enabled = $account.find('input.enabled'); |
|
206 var $createPosts = $account.find('input.create-posts'); |
|
207 // toggle enabled icon |
|
208 if ($enabled.is(':checked')) { |
|
209 $account.addClass('aktt-account-enabled'); |
|
210 } |
|
211 else { |
|
212 $account.removeClass('aktt-account-enabled'); |
|
213 } |
|
214 // toggle enabled/dimmed for enabled dependent fields |
|
215 if ($enabled.is(':checked')) { |
|
216 $account.find('.depends-on-enabled').removeClass('dim'); |
|
217 } |
|
218 else { |
|
219 $account.find('.depends-on-enabled').addClass('dim'); |
|
220 } |
|
221 // toggle enabled/dimmed for create blog posts dependent fields |
|
222 if ($createPosts.is(':checked')) { |
|
223 $account.find('.depends-on-create-posts').removeClass('dim'); |
|
224 } |
|
225 else { |
|
226 $account.find('.depends-on-create-posts').addClass('dim'); |
|
227 } |
|
228 } |
|
229 jQuery(function($) { |
|
230 // toggle settings |
|
231 $('.aktt-account').each(function() { |
|
232 var $account = $(this); |
|
233 akttSetState($account); |
|
234 $account.find('h3').click(function() { |
|
235 $account.find('.settings').slideToggle(function() { |
|
236 akttSetState($account); |
|
237 }); |
|
238 }).end().find('input[type="checkbox"].enabled, input[type="checkbox"].create-posts').change(function() { |
|
239 akttSetState($account); |
|
240 }); |
|
241 }); |
|
242 $('#aktt-account-list').css({ |
|
243 visibility: 'visible' |
|
244 }); |
|
245 $('.aktt-manual-update').click(function(e) { |
|
246 e.preventDefault(); |
|
247 var $this = $(this); |
|
248 var $request = $('.aktt-manual-update-request'); |
|
249 var $running = $('.aktt-manual-update-running'); |
|
250 $this.hide(); |
|
251 $running.html(''); |
|
252 $request.css({ visibility: 'visible' }); |
|
253 $.get( |
|
254 $this.attr('href'), |
|
255 { |
|
256 aktt_actions: 'manual_tweet_download' |
|
257 }, |
|
258 function (response) { |
|
259 $request.css({ visibility: 'hidden' }); |
|
260 $this.show(); |
|
261 $running.hide().html(response.msg).fadeIn(); |
|
262 }, |
|
263 'json' |
|
264 ); |
|
265 }); |
|
266 }); |
|
267 </script> |