136
|
1 |
<?php |
|
2 |
/* |
|
3 |
Plugin Name: WP-Cumulus |
|
4 |
Plugin URI: http://www.roytanck.com/2008/03/15/wp-cumulus-released |
|
5 |
Description: Flash based Tag Cloud for WordPress |
|
6 |
Version: 1.23 |
|
7 |
Author: Roy Tanck |
|
8 |
Author URI: http://www.roytanck.com |
|
9 |
|
|
10 |
Copyright 2009, Roy Tanck |
|
11 |
|
|
12 |
This program is free software: you can redistribute it and/or modify |
|
13 |
it under the terms of the GNU General Public License as published by |
|
14 |
the Free Software Foundation, either version 3 of the License, or |
|
15 |
(at your option) any later version. |
|
16 |
|
|
17 |
This program is distributed in the hope that it will be useful, |
|
18 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 |
GNU General Public License for more details. |
|
21 |
|
|
22 |
You should have received a copy of the GNU General Public License |
|
23 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24 |
*/ |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
// check for WP context |
|
30 |
if ( !defined('ABSPATH') ){ die(); } |
|
31 |
|
|
32 |
//initially set the options |
|
33 |
function wp_cumulus_install () { |
|
34 |
$newoptions = get_option('wpcumulus_options'); |
|
35 |
$newoptions['width'] = '100%'; |
|
36 |
$newoptions['height'] = '100%'; |
|
37 |
$newoptions['tcolor'] = '333333'; |
|
38 |
$newoptions['tcolor2'] = '333333'; |
|
39 |
$newoptions['hicolor'] = '333333'; |
|
40 |
$newoptions['bgcolor'] = 'ffffff'; |
|
41 |
$newoptions['speed'] = '100'; |
|
42 |
$newoptions['trans'] = 'false'; |
|
43 |
$newoptions['distr'] = 'true'; |
|
44 |
$newoptions['args'] = ''; |
|
45 |
$newoptions['compmode'] = 'false'; |
|
46 |
$newoptions['showwptags'] = 'true'; |
|
47 |
$newoptions['mode'] = 'tags'; |
|
48 |
add_option('wpcumulus_options', $newoptions); |
|
49 |
// widget options |
|
50 |
$widgetoptions = get_option('wpcumulus_widget'); |
|
51 |
$newoptions['width'] = '160'; |
|
52 |
$newoptions['height'] = '160'; |
|
53 |
$newoptions['tcolor'] = '333333'; |
|
54 |
$newoptions['tcolor2'] = '333333'; |
|
55 |
$newoptions['hicolor'] = '000000'; |
|
56 |
$newoptions['bgcolor'] = 'ffffff'; |
|
57 |
$newoptions['speed'] = '100'; |
|
58 |
$newoptions['trans'] = 'false'; |
|
59 |
$newoptions['distr'] = 'true'; |
|
60 |
$newoptions['args'] = ''; |
|
61 |
$newoptions['mode'] = 'tags'; |
|
62 |
add_option('wpcumulus_widget', $newoptions); |
|
63 |
} |
|
64 |
|
|
65 |
// add the admin page |
|
66 |
function wp_cumulus_add_pages() { |
|
67 |
add_options_page('WP Cumulus', 'WP Cumulus', 8, __FILE__, 'wp_cumulus_options'); |
|
68 |
} |
|
69 |
|
|
70 |
// replace tag in content with tag cloud (non-shortcode version for WP 2.3.x) |
|
71 |
function wp_cumulus_init($content){ |
|
72 |
if( strpos($content, '[WP-CUMULUS]') === false ){ |
|
73 |
return $content; |
|
74 |
} else { |
|
75 |
$code = wp_cumulus_createflashcode(false); |
|
76 |
$content = str_replace( '[WP-CUMULUS]', $code, $content ); |
|
77 |
return $content; |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
// template function |
|
82 |
function wp_cumulus_insert( $atts=NULL ){ |
|
83 |
echo wp_cumulus_createflashcode( false, $atts ); |
|
84 |
} |
|
85 |
|
|
86 |
// shortcode function |
|
87 |
function wp_cumulus_shortcode( $atts=NULL ){ |
|
88 |
return wp_cumulus_createflashcode( false, $atts ); |
|
89 |
} |
|
90 |
|
|
91 |
// piece together the flash code |
|
92 |
function wp_cumulus_createflashcode( $widget=false, $atts=NULL ){ |
|
93 |
// get the options |
|
94 |
if( $widget == true ){ |
|
95 |
$options = get_option('wpcumulus_widget'); |
|
96 |
$soname = "widget_so"; |
|
97 |
$divname = "wpcumuluswidgetcontent"; |
|
98 |
// get compatibility mode variable from the main options |
|
99 |
$mainoptions = get_option('wpcumulus_options'); |
|
100 |
$options['compmode'] = $mainoptions['compmode']; |
|
101 |
$options['showwptags'] = $mainoptions['showwptags']; |
|
102 |
} else if( $atts != NULL ){ |
|
103 |
$options = shortcode_atts( get_option('wpcumulus_options'), $atts ); |
|
104 |
$soname = "shortcode_so"; |
|
105 |
$divname = "wpcumuluscontent"; |
|
106 |
} else { |
|
107 |
$options = get_option('wpcumulus_options'); |
|
108 |
$soname = "so"; |
|
109 |
$divname = "wpcumuluscontent"; |
|
110 |
} |
|
111 |
// get the tag cloud... |
|
112 |
if( $options['mode'] != "cats" ){ |
|
113 |
ob_start(); |
|
114 |
wp_tag_cloud( $options['args'] ); |
|
115 |
$tagcloud = urlencode( str_replace( " ", " ", ob_get_clean() ) ); |
|
116 |
} |
|
117 |
// get categories |
|
118 |
if( $options['mode'] != "tags" ){ |
|
119 |
ob_start(); |
|
120 |
wp_list_categories('title_li=&show_count=1&hierarchical=0&style=none'); |
|
121 |
$cats = urlencode( ob_get_clean() ); |
|
122 |
} |
|
123 |
// get some paths |
|
124 |
if( function_exists('plugins_url') ){ |
|
125 |
// 2.6 or better |
|
126 |
$movie = plugins_url('wp-cumulus/tagcloud.swf'); |
|
127 |
$path = plugins_url('wp-cumulus/'); |
|
128 |
} else { |
|
129 |
// pre 2.6 |
|
130 |
$movie = get_bloginfo('wpurl') . "/wp-content/plugins/wp-cumulus/tagcloud.swf"; |
|
131 |
$path = get_bloginfo('wpurl')."/wp-content/plugins/wp-cumulus/"; |
|
132 |
} |
|
133 |
// add random seeds to so name and movie url to avoid collisions and force reloading (needed for IE) |
|
134 |
$soname .= rand(0,9999999); |
|
135 |
$movie .= '?r=' . rand(0,9999999); |
|
136 |
$divname .= rand(0,9999999); |
|
137 |
// write flash tag |
|
138 |
if( $options['compmode']!='true' ){ |
|
139 |
$flashtag = '<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->'; |
|
140 |
$flashtag .= '<script type="text/javascript" src="'.$path.'swfobject.js"></script>'; |
|
141 |
// ------------------------------------------------------------------------------------ |
|
142 |
$flashtag .= '<div id="'.$divname.'" style="position:absolute;z-index:0;">'; |
|
143 |
if( $options['showwptags'] == 'true' ){ $flashtag .= '<p>'; } else { $flashtag .= '<p style="display:none;">'; }; |
|
144 |
// alternate content |
|
145 |
if( $options['mode'] != "cats" ){ $flashtag .= urldecode($tagcloud); } |
|
146 |
if( $options['mode'] != "tags" ){ $flashtag .= urldecode($cats); } |
|
147 |
$flashtag .= '</p><!-- WP Cumulus Flash tag cloud by <a href="http://www.roytanck.com">Roy Tanck</a> and <a href="http://lukemorton.co.uk/">Luke Morton</a> requires <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better. --></div>'; |
|
148 |
$flashtag .= '<script type="text/javascript">'; |
|
149 |
$flashtag .= 'var '.$soname.' = new SWFObject("'.$movie.'", "tagcloudflash", "'.$options['width'].'", "'.$options['height'].'", "9", "#'.$options['bgcolor'].'");'; |
|
150 |
if( $options['trans'] == 'true' ){ |
|
151 |
$flashtag .= $soname.'.addParam("wmode", "transparent");'; |
|
152 |
} |
|
153 |
$flashtag .= $soname.'.addParam("allowScriptAccess", "always");'; |
|
154 |
$flashtag .= $soname.'.addVariable("tcolor", "0x'.$options['tcolor'].'");'; |
|
155 |
$flashtag .= $soname.'.addVariable("tcolor2", "0x' . ($options['tcolor2'] == "" ? $options['tcolor'] : $options['tcolor2']) . '");'; |
|
156 |
$flashtag .= $soname.'.addVariable("hicolor", "0x' . ($options['hicolor'] == "" ? $options['tcolor'] : $options['hicolor']) . '");'; |
|
157 |
$flashtag .= $soname.'.addVariable("tspeed", "'.$options['speed'].'");'; |
|
158 |
$flashtag .= $soname.'.addVariable("distr", "'.$options['distr'].'");'; |
|
159 |
$flashtag .= $soname.'.addVariable("mode", "'.$options['mode'].'");'; |
|
160 |
// put tags in flashvar |
|
161 |
if( $options['mode'] != "cats" ){ |
|
162 |
$flashtag .= $soname.'.addVariable("tagcloud", "'.urlencode('<tags>') . $tagcloud . urlencode('</tags>').'");'; |
|
163 |
} |
|
164 |
// put categories in flashvar |
|
165 |
if( $options['mode'] != "tags" ){ |
|
166 |
$flashtag .= $soname.'.addVariable("categories", "' . $cats . '");'; |
|
167 |
} |
|
168 |
$flashtag .= $soname.'.write("'.$divname.'");'; |
|
169 |
$flashtag .= '</script>'; |
|
170 |
} else { |
|
171 |
$flashtag = '<object type="application/x-shockwave-flash" data="'.$movie.'" width="'.$options['width'].'" height="'.$options['height'].'" wmode="opaque">'; |
|
172 |
$flashtag .= '<param name="movie" value="'.$movie.'" />'; |
|
173 |
$flashtag .= '<param name="bgcolor" value="#'.$options['bgcolor'].'" />'; |
|
174 |
$flashtag .= '<param name="AllowScriptAccess" value="always" />'; |
|
175 |
$flashtag .= '<param name="wmode" value="opaque" />'; |
|
176 |
if( $options['trans'] == 'true' ){ |
|
177 |
$flashtag .= '<param name="wmode" value="transparent" />'; |
|
178 |
} |
|
179 |
$flashtag .= '<param name="flashvars" value="'; |
|
180 |
$flashtag .= 'tcolor=0x'.$options['tcolor']; |
|
181 |
$flashtag .= '&tcolor2=0x'.$options['tcolor2']; |
|
182 |
$flashtag .= '&hicolor=0x'.$options['hicolor']; |
|
183 |
$flashtag .= '&tspeed='.$options['speed']; |
|
184 |
$flashtag .= '&distr='.$options['distr']; |
|
185 |
$flashtag .= '&mode='.$options['mode']; |
|
186 |
// put tags in flashvar |
|
187 |
if( $options['mode'] != "cats" ){ |
|
188 |
$flashtag .= '&tagcloud='.urlencode('<tags>') . $tagcloud . urlencode('</tags>'); |
|
189 |
} |
|
190 |
// put categories in flashvar |
|
191 |
if( $options['mode'] != "tags" ){ |
|
192 |
$flashtag .= '&categories=' . $cats; |
|
193 |
} |
|
194 |
$flashtag .= '" />'; |
|
195 |
// alternate content |
|
196 |
if( $options['mode'] != "cats" ){ $flashtag .= '<p>'.urldecode($tagcloud).'</p>'; } |
|
197 |
if( $options['mode'] != "tags" ){ $flashtag .= '<p>'.urldecode($cats).'</p>'; } |
|
198 |
$flashtag .= '<!-- WP-Cumulus by <a href="http://www.roytanck.com/">Roy Tanck</a> and <a href="http://lukemorton.co.uk/">Luke Morton</a> requires <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better. -->'; |
|
199 |
$flashtag .= '</object>'; |
|
200 |
} |
|
201 |
return $flashtag; |
|
202 |
} |
|
203 |
|
|
204 |
// options page |
|
205 |
function wp_cumulus_options() { |
|
206 |
$options = $newoptions = get_option('wpcumulus_options'); |
|
207 |
// if submitted, process results |
|
208 |
if ( $_POST["wpcumulus_submit"] ) { |
|
209 |
$newoptions['width'] = strip_tags(stripslashes($_POST["width"])); |
|
210 |
$newoptions['height'] = strip_tags(stripslashes($_POST["height"])); |
|
211 |
$newoptions['tcolor'] = strip_tags(stripslashes($_POST["tcolor"])); |
|
212 |
$newoptions['tcolor2'] = strip_tags(stripslashes($_POST["tcolor2"])); |
|
213 |
$newoptions['hicolor'] = strip_tags(stripslashes($_POST["hicolor"])); |
|
214 |
$newoptions['bgcolor'] = strip_tags(stripslashes($_POST["bgcolor"])); |
|
215 |
$newoptions['trans'] = strip_tags(stripslashes($_POST["trans"])); |
|
216 |
$newoptions['speed'] = strip_tags(stripslashes($_POST["speed"])); |
|
217 |
$newoptions['distr'] = strip_tags(stripslashes($_POST["distr"])); |
|
218 |
$newoptions['mode'] = strip_tags(stripslashes($_POST["mode"])); |
|
219 |
$newoptions['args'] = strip_tags(stripslashes($_POST["args"])); |
|
220 |
$newoptions['compmode'] = strip_tags(stripslashes($_POST["compmode"])); |
|
221 |
$newoptions['showwptags'] = strip_tags(stripslashes($_POST["showwptags"])); |
|
222 |
} |
|
223 |
// any changes? save! |
|
224 |
if ( $options != $newoptions ) { |
|
225 |
$options = $newoptions; |
|
226 |
update_option('wpcumulus_options', $options); |
|
227 |
} |
|
228 |
// options form |
|
229 |
echo '<form method="post">'; |
|
230 |
echo "<div class=\"wrap\"><h2>Display options</h2>"; |
|
231 |
echo '<table class="form-table">'; |
|
232 |
// width |
|
233 |
echo '<tr valign="top"><th scope="row">Width of the Flash tag cloud</th>'; |
|
234 |
echo '<td><input type="text" name="width" value="'.$options['width'].'" size="5"></input><br />Width in pixels (500 or more is recommended)</td></tr>'; |
|
235 |
// height |
|
236 |
echo '<tr valign="top"><th scope="row">Height of the Flash tag cloud</th>'; |
|
237 |
echo '<td><input type="text" name="height" value="'.$options['height'].'" size="5"></input><br />Height in pixels (ideally around 3/4 of the width)</td></tr>'; |
|
238 |
// text color |
|
239 |
echo '<tr valign="top"><th scope="row">Color of the tags</th>'; |
|
240 |
echo '<td><input type="text" name="tcolor" value="'.$options['tcolor'].'" size="8"></input> Optional second color for gradient: <input type="text" name="tcolor2" value="'.$options['tcolor2'].'" size="8"></input> Optional highlighl color: <input type="text" name="hicolor" value="'.$options['hicolor'].'" size="8"></input><br />These should be 6 character hex color values without the # prefix (000000 for black, ffffff for white)</td></tr>'; |
|
241 |
// background color |
|
242 |
echo '<tr valign="top"><th scope="row">Background color</th>'; |
|
243 |
echo '<td><input type="text" name="bgcolor" value="'.$options['bgcolor'].'" size="8"></input><br />6 character hex color value</td></tr>'; |
|
244 |
// transparent |
|
245 |
echo '<tr valign="top"><th scope="row">Use transparent mode</th>'; |
|
246 |
echo '<td><input type="checkbox" name="trans" value="true"'; |
|
247 |
if( $options['trans'] == "true" ){ echo ' checked="checked"'; } |
|
248 |
echo '></input><br />Switches on Flash\'s wmode-transparent setting</td></tr>'; |
|
249 |
// speed |
|
250 |
echo '<tr valign="top"><th scope="row">Rotation speed</th>'; |
|
251 |
echo '<td><input type="text" name="speed" value="'.$options['speed'].'" size="8"></input><br />Speed (percentage, default is 100)</td></tr>'; |
|
252 |
// distribution |
|
253 |
echo '<tr valign="top"><th scope="row">Distribute tags evenly on sphere</th>'; |
|
254 |
echo '<td><input type="checkbox" name="distr" value="true"'; |
|
255 |
if( $options['distr'] == "true" ){ echo ' checked="checked"'; } |
|
256 |
echo '></input><br />Places tags at equal intervals instead of random</td></tr>'; |
|
257 |
// end table |
|
258 |
echo '</table>'; |
|
259 |
// tags, cats? |
|
260 |
echo '<h3>Output options</h3>'; |
|
261 |
echo '<table class="form-table">'; |
|
262 |
echo '<tr valign="top"><th scope="row">Display:</th>'; |
|
263 |
echo '<td><input type="radio" name="mode" value="tags"'; |
|
264 |
if( $options['mode'] == 'tags' ){ echo ' checked="checked" '; } |
|
265 |
echo '></input> Tags<br /><input type="radio" name="mode" value="cats"'; |
|
266 |
if( $options['mode'] == 'cats' ){ echo ' checked="checked" '; } |
|
267 |
echo '></input> Categories<br /><input type="radio" name="mode" value="both"'; |
|
268 |
if( $options['mode'] == 'both' ){ echo ' checked="checked" '; } |
|
269 |
echo '></input> Both (you may want to consider lowering the number of tags , using the advanced options below)'; |
|
270 |
// end table |
|
271 |
echo '</table>'; |
|
272 |
// advanced options |
|
273 |
echo '<h3>Advanced options</h3><p>Please leave this setting empty unless you know what you\'re doing.</p>'; |
|
274 |
echo '<table class="form-table">'; |
|
275 |
// arguments |
|
276 |
echo '<tr valign="top"><th scope="row">wp_tag_cloud parameters</th>'; |
|
277 |
echo '<td><input type="text" name="args" value="'.$options['args'].'" size="60"></input><br />Parameter string for wp_tag_cloud (see the <a href="http://codex.wordpress.org/Template_Tags/wp_tag_cloud#Parameters" target="_blank">codex</a> for more details)<br /><br /><strong>Example uses</strong><br />number=20 - limit the number of tags to 20<br />smallest=5&largest=50 - specify custom font sizes<br /><br /><strong>Known issues</strong><ul><li>Currently, the \'units\', \'orderby\' and \'order\' parameters are not supported.</li><li>Setting \'format\' to anything but \'flat\' will cause the plugin to fail.</li></ul></td></tr>'; |
|
278 |
// compatibility mode |
|
279 |
echo '<tr valign="top"><th scope="row">Use compatibility mode?</th>'; |
|
280 |
echo '<td><input type="checkbox" name="compmode" value="true"'; |
|
281 |
if( $options['compmode'] == "true" ){ echo ' checked="checked"'; } |
|
282 |
echo '></input><br />Enabling this option switches the plugin to a different way of embedding Flash into the page. Use this if your page has markup errors or if you\'re having trouble getting WP-Cumulus to display correctly. This affects both the shortcode version and the widget.</td></tr>'; |
|
283 |
// show regular tag in alternate content? |
|
284 |
echo '<tr valign="top"><th scope="row">Show the regular HTML tag cloud?</th>'; |
|
285 |
echo '<td><input type="checkbox" name="showwptags" value="true"'; |
|
286 |
if( $options['showwptags'] == "true" ){ echo ' checked="checked"'; } |
|
287 |
echo '></input><br />Un-hides the regular HTML tag cloud that may appear for a second or so before it is replaced by the Flash one. Turn this on if SEO and/or non-flash users are a major concern for you. This option affects both the shortcode version and the widget.</td></tr>'; |
|
288 |
// close stuff |
|
289 |
echo '<input type="hidden" name="wpcumulus_submit" value="true"></input>'; |
|
290 |
echo '</table>'; |
|
291 |
echo '<p class="submit"><input type="submit" value="Update Options »"></input></p>'; |
|
292 |
echo "</div>"; |
|
293 |
echo '</form>'; |
|
294 |
|
|
295 |
} |
|
296 |
|
|
297 |
//uninstall all options |
|
298 |
function wp_cumulus_uninstall () { |
|
299 |
delete_option('cumulus_options'); |
|
300 |
delete_option('cumulus_widget'); |
|
301 |
} |
|
302 |
|
|
303 |
|
|
304 |
// widget |
|
305 |
function widget_init_wp_cumulus_widget() { |
|
306 |
// Check for required functions |
|
307 |
|
|
308 |
if (!function_exists('register_sidebar_widget')) |
|
309 |
return; |
|
310 |
|
|
311 |
function wp_cumulus_widget($args){ |
|
312 |
extract($args); |
|
313 |
$options = get_option('wpcumulus_widget'); |
|
314 |
?> |
|
315 |
<?php echo $before_widget; ?> |
|
316 |
<?php if( !empty($options['title']) ): ?> |
|
317 |
<?php echo $before_title . $options['title'] . $after_title; ?> |
|
318 |
<?php endif; ?> |
|
319 |
<?php |
|
320 |
if( !stristr( $_SERVER['PHP_SELF'], 'widgets.php' ) ){ |
|
321 |
echo wp_cumulus_createflashcode(true); |
|
322 |
} |
|
323 |
?> |
|
324 |
<?php echo $after_widget; ?> |
|
325 |
<?php |
|
326 |
} |
|
327 |
|
|
328 |
function wp_cumulus_widget_control() { |
|
329 |
$options = $newoptions = get_option('wpcumulus_widget'); |
|
330 |
if ( $_POST["wpcumulus_widget_submit"] ) { |
|
331 |
$newoptions['title'] = strip_tags(stripslashes($_POST["wpcumulus_widget_title"])); |
|
332 |
$newoptions['width'] = strip_tags(stripslashes($_POST["wpcumulus_widget_width"])); |
|
333 |
$newoptions['height'] = strip_tags(stripslashes($_POST["wpcumulus_widget_height"])); |
|
334 |
$newoptions['tcolor'] = strip_tags(stripslashes($_POST["wpcumulus_widget_tcolor"])); |
|
335 |
$newoptions['tcolor2'] = strip_tags(stripslashes($_POST["wpcumulus_widget_tcolor2"])); |
|
336 |
$newoptions['hicolor'] = strip_tags(stripslashes($_POST["wpcumulus_widget_hicolor"])); |
|
337 |
$newoptions['bgcolor'] = strip_tags(stripslashes($_POST["wpcumulus_widget_bgcolor"])); |
|
338 |
$newoptions['speed'] = strip_tags(stripslashes($_POST["wpcumulus_widget_speed"])); |
|
339 |
$newoptions['trans'] = strip_tags(stripslashes($_POST["wpcumulus_widget_trans"])); |
|
340 |
$newoptions['distr'] = strip_tags(stripslashes($_POST["wpcumulus_widget_distr"])); |
|
341 |
$newoptions['args'] = strip_tags(stripslashes($_POST["wpcumulus_widget_args"])); |
|
342 |
$newoptions['mode'] = strip_tags(stripslashes($_POST["wpcumulus_widget_mode"])); |
|
343 |
} |
|
344 |
if ( $options != $newoptions ) { |
|
345 |
$options = $newoptions; |
|
346 |
update_option('wpcumulus_widget', $options); |
|
347 |
} |
|
348 |
$title = attribute_escape($options['title']); |
|
349 |
$width = attribute_escape($options['width']); |
|
350 |
$height = attribute_escape($options['height']); |
|
351 |
$tcolor = attribute_escape($options['tcolor']); |
|
352 |
$tcolor2 = attribute_escape($options['tcolor2']); |
|
353 |
$hicolor = attribute_escape($options['hicolor']); |
|
354 |
$bgcolor = attribute_escape($options['bgcolor']); |
|
355 |
$speed = attribute_escape($options['speed']); |
|
356 |
$distr = attribute_escape($options['distr']); |
|
357 |
$trans = attribute_escape($options['trans']); |
|
358 |
$args = attribute_escape($options['args']); |
|
359 |
$mode = attribute_escape($options['mode']); |
|
360 |
?> |
|
361 |
<p><label for="wpcumulus_widget_title"><?php _e('Title:'); ?> <input class="widefat" id="wpcumulus_widget_title" name="wpcumulus_widget_title" type="text" value="<?php echo $title; ?>" /></label></p> |
|
362 |
<p><label for="wpcumulus_widget_width"><?php _e('Width:'); ?> <input class="widefat" id="wpcumulus_widget_width" name="wpcumulus_widget_width" type="text" value="<?php echo $width; ?>" /></label></p> |
|
363 |
<p><label for="wpcumulus_widget_height"><?php _e('Height:'); ?> <input class="widefat" id="wpcumulus_widget_height" name="wpcumulus_widget_height" type="text" value="<?php echo $height; ?>" /></label></p> |
|
364 |
<p><label for="wpcumulus_widget_tcolor"><?php _e('Tag color:'); ?> <input class="widefat" id="wpcumulus_widget_tcolor" name="wpcumulus_widget_tcolor" type="text" value="<?php echo $tcolor; ?>" /></label></p> |
|
365 |
<p><label for="wpcumulus_widget_tcolor2"><?php _e('Optional second color for gradient:'); ?> <input class="widefat" id="wpcumulus_widget_tcolor2" name="wpcumulus_widget_tcolor2" type="text" value="<?php echo $tcolor2; ?>" /></label></p> |
|
366 |
<p><label for="wpcumulus_widget_hicolor"><?php _e('Optional highlight color:'); ?> <input class="widefat" id="wpcumulus_widget_hicolor" name="wpcumulus_widget_hicolor" type="text" value="<?php echo $hicolor; ?>" /></label></p> |
|
367 |
<p><label for="wpcumulus_widget_bgcolor"><?php _e('Background color:'); ?> <input class="widefat" id="wpcumulus_widget_bgcolor" name="wpcumulus_widget_bgcolor" type="text" value="<?php echo $bgcolor; ?>" /></label></p> |
|
368 |
<p><label for="wpcumulus_widget_trans"><input class="checkbox" id="wpcumulus_widget_trans" name="wpcumulus_widget_trans" type="checkbox" value="true" <?php if( $trans == "true" ){ echo ' checked="checked"'; } ?> > Background transparency</label></p> |
|
369 |
<p><label for="wpcumulus_widget_speed"><?php _e('Speed:'); ?> <input class="widefat" id="wpcumulus_widget_speed" name="wpcumulus_widget_speed" type="text" value="<?php echo $speed; ?>" /></label></p> |
|
370 |
<p><label for="wpcumulus_widget_distr"><input class="checkbox" id="wpcumulus_widget_distr" name="wpcumulus_widget_distr" type="checkbox" value="true" <?php if( $distr == "true" ){ echo ' checked="checked"'; } ?> > Distribute evenly on sphere</label></p> |
|
371 |
<p> |
|
372 |
<input class="radio" id="wpcumulus_widget_mode" name="wpcumulus_widget_mode" type="radio" value="tags" <?php if( $mode == "tags" ){ echo ' checked="checked"'; } ?> > Tags<br /> |
|
373 |
<input class="radio" id="wpcumulus_widget_mode" name="wpcumulus_widget_mode" type="radio" value="cats" <?php if( $mode == "cats" ){ echo ' checked="checked"'; } ?> > Categories<br /> |
|
374 |
<input class="radio" id="wpcumulus_widget_mode" name="wpcumulus_widget_mode" type="radio" value="both" <?php if( $mode == "both" ){ echo ' checked="checked"'; } ?> > Both |
|
375 |
</p> |
|
376 |
<p><label for="wpcumulus_widget_args"><?php _e('wp_tag_cloud parameters:'); ?> <input class="widefat" id="wpcumulus_widget_args" name="wpcumulus_widget_args" type="text" value="<?php echo $args; ?>" /></label></p> |
|
377 |
<input type="hidden" id="wpcumulus_widget_submit" name="wpcumulus_widget_submit" value="1" /> |
|
378 |
<?php |
|
379 |
} |
|
380 |
|
|
381 |
register_sidebar_widget( "WP-Cumulus", "wp_cumulus_widget" ); |
|
382 |
register_widget_control( "WP-Cumulus", "wp_cumulus_widget_control" ); |
|
383 |
} |
|
384 |
|
|
385 |
// Delay plugin execution until sidebar is loaded |
|
386 |
add_action('widgets_init', 'widget_init_wp_cumulus_widget'); |
|
387 |
|
|
388 |
// add the actions |
|
389 |
add_action('admin_menu', 'wp_cumulus_add_pages'); |
|
390 |
register_activation_hook( __FILE__, 'wp_cumulus_install' ); |
|
391 |
register_deactivation_hook( __FILE__, 'wp_cumulus_uninstall' ); |
|
392 |
if( function_exists('add_shortcode') ){ |
|
393 |
add_shortcode('wp-cumulus', 'wp_cumulus_shortcode'); |
|
394 |
add_shortcode('WP-CUMULUS', 'wp_cumulus_shortcode'); |
|
395 |
} else { |
|
396 |
add_filter('the_content','wp_cumulus_init'); |
|
397 |
} |
|
398 |
|
|
399 |
?> |