Changeset 751697
- Timestamp:
- 08/05/2013 03:02:53 PM (13 years ago)
- Location:
- captain-up/trunk
- Files:
-
- 4 edited
-
README.md (modified) (2 diffs)
-
captainup.js (modified) (1 diff)
-
captainup.php (modified) (12 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
captain-up/trunk/README.md
r725144 r751697 83 83 You can add the Captain Up leaderboard widget or activity widget inside your posts using a shortcode: 84 84 85 * `[captain-leaderboard width="250px" height="400px" title="Leaderboard" ]` - adds the leaderboard widget. All attributes are optional. By default the width of the widget will be 300 pixels, the height 400 pixels and the title will be "Leaderboard".85 * `[captain-leaderboard width="250px" height="400px" title="Leaderboard" leaderboard="all-time-ranking"]` - adds the leaderboard widget. All attributes are optional. By default the width of the widget will be 300 pixels, the height 400 pixels and the title will be "Leaderboard". The leaderboard option selects the default leaderboard to show, can be either one of `"all-time-ranking"`, `"monthly-ranking"`, `"weekly-ranking"` or `"daily-ranking"`. 86 86 87 87 * `[captain-activity width="250px" height="400px" title="Activity Feed"]` - adds the activity widget. All attributes are optional. By default the width of the widget will be 300 pixels, the height 400 pixels and the title will be "Activity". … … 94 94 95 95 ## Changelog 96 97 ###### 1.4.0 98 99 * Support for WordPress 3.5.2 and 3.6.0 100 101 * You can now select the default leaderboard for the Leaderboard widget. There are four options: All Time, Monthly, Weekly and Daily. This can be set in the Widgets tab or inside the Shortcodes. 102 103 * Fixed an issue with Cloudflare's Rocket Loader. 96 104 97 105 ###### 1.3.1 -
captain-up/trunk/captainup.js
r673835 r751697 1 1 (function($, win) { 2 3 2 })(jQuery, window); -
captain-up/trunk/captainup.php
r725144 r751697 4 4 Plugin URI: http://www.captainup.com 5 5 Description: Add Game Mechanics to your site and increase your engagement and retention. 2 minutes install: Simply add your free Captain Up API Key and you are good to go. The plugin also adds widgets you can use to show leaderboards and activities within your site. 6 Version: 1. 3.16 Version: 1.4.0 7 7 Author: Captain Up Team 8 8 License: GPL2 … … 240 240 241 241 <div id='cptup-ready'></div> 242 <script type='text/javascript'>242 <script data-cfasync='false' type='text/javascript'> 243 243 window.captain = {up: function(fn) { captain.topics.push(fn) }, topics: []}; 244 244 captain.up({ … … 253 253 }); 254 254 </script> 255 <script type='text/javascript'>255 <script data-cfasync='false' type='text/javascript'> 256 256 (function() { 257 257 var cpt = document.createElement('script'); cpt.type = 'text/javascript'; cpt.async = true; … … 274 274 * ---------------------------------------*/ 275 275 276 /* 277 Plugin Name: Captain Up Widget 278 Plugin URI: http://captainup.com/ 279 Description: Captain Up Widget - Leaderboards and Activity Feed 280 Version: 1.0 281 */ 276 // Enqueue scripts to handle editing the Widgets options in 277 # the widgets admin panel tab. 278 function widgets_edit_script() { 279 wp_enqueue_script( 280 'cptup_widgets_edit', 281 plugins_url('/js/cptup_widgets_edit.js', __FILE__), 282 array('jquery') 283 ); 284 } 285 add_action('widgets_init', 'widgets_edit_script'); 286 287 282 288 class Captainup_Widget extends WP_Widget { 283 289 284 290 /** constructor */ 285 291 function __construct() { 286 parent::WP_Widget('cptup_widget', 'Captain up Widget', array(292 parent::WP_Widget('cptup_widget', 'Captain Up Widget', array( 287 293 'description' => 'Captain Up Leaderboards and Recent Activity' 288 294 )); … … 294 300 $type = $instance['type']; 295 301 $height = $instance['height']; 302 $default_leaderboard = $instance['default_leaderboard']; 296 303 297 304 echo $before_widget; 298 305 ?> 299 306 300 <div class='captain-<?php echo $type; ?>-widget' style='width: auto; height: <?php echo $height; ?>px; display: none;'>307 <div class='captain-<?php echo $type; ?>-widget' <?php if($type=='leaderboard') echo 'data-cpt-leaderboard='.$default_leaderboard ?> style='width: auto; height: <?php echo $height; ?>px; display: none;'> 301 308 </div> 302 309 … … 311 318 $instance['css'] = strip_tags($new_instance['css']); 312 319 $instance['height'] = strip_tags($new_instance['height']); 320 $instance['default_leaderboard'] = strip_tags($new_instance['default_leaderboard']); 313 321 return $instance; 314 322 } … … 323 331 if (!$css) $css = 'height: 300px; margin-top: 20px;'; 324 332 if (!$height) $height = '350'; 333 if (!$default_leaderboard) $default_leaderboard = 'monthly_ranking'; 325 334 326 335 ?> … … 330 339 <?php _e('Widget type'); ?> 331 340 </label> 332 <select id="<?php echo $this->get_field_id('type'); ?>" name="<?php echo $this->get_field_name('type'); ?>">341 <select id="<?php echo $this->get_field_id('type'); ?>" class="cpt-widget-type-select" name="<?php echo $this->get_field_name('type'); ?>"> 333 342 <option <?php if($type == "activity") { echo "selected"; }; ?> value="activity"> 334 343 Activity Widget … … 346 355 <input size="4" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo $height; ?>" />px 347 356 </p> 357 358 <p class='cpt-select-leaderboard-type'> 359 <label for="<?php echo $this->get_field_id('default_leaderboard'); ?>"> 360 <?php _e('Default view:') ?> 361 </label> 362 363 <select id="<?php echo $this->get_field_id('default_leaderboard'); ?>" name="<?php echo $this->get_field_name('default_leaderboard'); ?>"> 364 365 <option value="all-time-ranking" <?php if($default_leaderboard == 'all-time-ranking') echo 'selected'?>> 366 All Time 367 </option> 368 369 <option value="monthly-ranking" <?php if($default_leaderboard == 'monthly-ranking') echo 'selected'?>> 370 Monthly 371 </option> 372 373 <option value="weekly-ranking" <?php if($default_leaderboard == 'weekly-ranking') echo 'selected'?>> 374 Weekly 375 </option> 376 377 <option value="daily-ranking" <?php if($default_leaderboard == 'daily-ranking') echo 'selected'?>> 378 Daily 379 </option> 380 381 </select> 382 </p> 383 384 <script> 385 jQuery(function() { 386 // Run over all the Captain Up widgets and call the 387 // `toggle_leaderboard_option` on them. The function is 388 // defined under `cptup_widgets_edit.js`. We call it here as 389 // well as the widget form gets re-rendered every time it is 390 // saved. 391 jQuery('.cpt-widget-type-select').each(function(index, element) { 392 toggle_leaderboard_option(element); 393 }); 394 }); 395 </script> 348 396 349 397 <?php … … 359 407 360 408 // Leaderboard Widget Shortcode 361 // [captain-leaderboard width="300" height="400" title="Hello" ]409 // [captain-leaderboard width="300" height="400" title="Hello" leaderboard="all-time-ranking"] 362 410 // Options: 363 411 // - width - css attribute. by default 300px 364 412 // - height - css attribute. by default 500px 413 // - leaderboard - the default ranking view (all time, monthly, weekly, daily), 414 // by default set to the monthly leaderboard. 365 415 // - title - the title of the widget, by default 'Leaderboard' 366 // in the current locale language 416 // in the current locale language. 367 417 function captain_leaderboard_shortcode($atts) { 368 418 extract(shortcode_atts( 369 419 array( 370 'width' => '300px', 371 'height' => '500px', 372 'title' => false 420 'width' => '300', 421 'height' => '500', 422 'title' => false, 423 'leaderboard' => 'monthly-ranking' 373 424 ), $atts 374 425 )); 375 return "<div style='margin: 20px auto; width: $width ; height: $height;' class='captain-leaderboard-widget' data-cpt-title='$title'></div>";426 return "<div style='margin: 20px auto; width: $width"."px; height: $height"."px;' class='captain-leaderboard-widget' data-cpt-leaderboard='" . str_replace("-", "_", $leaderboard) . "' data-cpt-title='$title'></div>"; 376 427 } 377 428 add_shortcode('captain-leaderboard', 'captain_leaderboard_shortcode' ); … … 387 438 extract(shortcode_atts( 388 439 array( 389 'width' => '300 px',390 'height' => '500 px',440 'width' => '300', 441 'height' => '500', 391 442 'title' => false 392 443 ), $atts 393 444 )); 394 return "<div style='margin: 20px auto; width: $width ; height: $height;' class='captain-activity-widget' data-cpt-title='$title'></div>";445 return "<div style='margin: 20px auto; width: $width"."px; height: $height"."px;' class='captain-activity-widget' data-cpt-title='$title'></div>"; 395 446 } 396 447 add_shortcode('captain-activity', 'captain_activity_shortcode' ); … … 452 503 function captain_add_new_comment() { 453 504 ?> 454 <script type='text/javascript'>505 <script data-cfasync='false' type='text/javascript'> 455 506 window._cpt_wordpress_events = { 456 507 new_comment: true -
captain-up/trunk/readme.txt
r725144 r751697 3 3 Tags: game-mechanics,captainup,gamification,engagement,comments,widget,plugin,twitter,facebook,google 4 4 Requires at least: 3.0.1 5 Tested up to: 3. 5.15 Tested up to: 3.6.0 6 6 Stable tag: trunk 7 7 License: GPLv2 or later … … 18 18 You will need to associate your WordPress site with a free Captain Up account. If you don't have one yet - [sign up now](http://captainup.com/). 19 19 20 **NEW**: Localization support for French, German, Portuguese and Thai. Awesome shortcodes for adding the activity widget, the leaderboard widget and a sign up link inside your posts. Support for native WordPress comments.20 **NEW**: Localization support for over 10 languages. Awesome shortcodes for adding the activity widget, the leaderboard widget and a sign up link inside your posts. Support for native WordPress comments. Support for differnet default leaderboards. CloudFlare issue resolved. 21 21 22 22 **Features**: … … 38 38 You can add the Captain Up leaderboard widget or activity widget inside your posts using a shortcode: 39 39 40 * `[captain-leaderboard width="250px" height="400px" title="Leaderboard" ]` - adds the leaderboard widget. All attributes are optional. By default the width of the widget will be 300 pixels, the height 400 pixels and the title will be "Leaderboard".40 * `[captain-leaderboard width="250px" height="400px" title="Leaderboard" leaderboard="all-time-ranking"]` - adds the leaderboard widget. All attributes are optional. By default the width of the widget will be 300 pixels, the height 400 pixels and the title will be "Leaderboard". The leaderboard option selects the default leaderboard to show, can be either one of `"all-time-ranking"`, `"monthly-ranking"`, `"weekly-ranking"` or `"daily-ranking"`. 41 41 42 42 * `[captain-activity width="250px" height="400px" title="Activity Feed"]` - adds the activity widget. All attributes are optional. By default the width of the widget will be 300 pixels, the height 400 pixels and the title will be "Activity". … … 116 116 == Changelog == 117 117 118 = 1.4.0 = 119 120 * Support for WordPress 3.5.2 and 3.6.0 121 122 * You can now select the default leaderboard for the Leaderboard widget. There are four options: All Time, Monthly, Weekly and Daily. This can be set in the Widgets tab or inside the Shortcodes. 123 124 * Fixed an issue with Cloudflare's Rocket Loader. 125 118 126 = 1.3.1 = 119 127
Note: See TracChangeset
for help on using the changeset viewer.