Changeset 626094
- Timestamp:
- 11/16/2012 12:05:52 PM (12 years ago)
- Location:
- cubepoints/trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
cubepoints/trunk/cp_admin_add_points.php
r445086 r626094 59 59 }); 60 60 jQuery("#cp_add_points_user").autocomplete({ 61 url: "<?php echo bloginfo('url').'/wp-admin/admin-ajax.php'; ?>",61 url: ajaxurl, 62 62 extraParams: { action: 'cp_add_points_user_suggest' }, 63 63 matchSubset: 0, … … 91 91 } 92 92 this.cp_add_points_ajax_query = jQuery.ajax({ 93 url: "<?php echo bloginfo('url').'/wp-admin/admin-ajax.php'; ?>",93 url: ajaxurl, 94 94 data: { 'q': q, 'action': 'cp_add_points_user_query' }, 95 95 cache: false, … … 154 154 jQuery('#cp_add_points_loading').show(100); 155 155 this.cp_add_points_ajax_query = jQuery.ajax({ 156 url: "<?php echo bloginfo('url').'/wp-admin/admin-ajax.php'; ?>",156 url: ajaxurl, 157 157 type: "POST", 158 158 data: { 'id': id, 'points': points, 'description': description, 'action': 'cp_add_points_user_update' }, -
cubepoints/trunk/cp_admin_manage.php
r373336 r626094 71 71 72 72 jQuery.post( 73 '<?php echo bloginfo('url').'/wp-admin/admin-ajax.php'; ?>',73 ajaxurl, 74 74 { 75 75 action: 'cp_manage_form_submit', -
cubepoints/trunk/cp_widgets.php
r571698 r626094 4 4 */ 5 5 6 add_action('widgets_init', 'cp_widgets'); 7 8 function cp_widgets(){ 9 10 /** CubePoints Widget */ 11 class cp_pointsWidget extends WP_Widget { 12 13 // constructor 14 function cp_pointsWidget() { 15 parent::WP_Widget('cp_pointsWidget', 'CubePoints', array('description' => 'Display the points of the current logged in user.')); 16 } 17 18 // widget main 19 function widget($args, $instance) { 20 extract($args, EXTR_SKIP); 21 if (!(!is_user_logged_in()&&$instance['text_alt']=='')) { 6 /** CubePoints Points Widget declaration */ 7 class cp_pointsWidget extends WP_Widget { 8 9 // constructor 10 function cp_pointsWidget() { 11 parent::WP_Widget('cp_pointsWidget', 'CubePoints', array('description' => 'Display the points of the current logged in user.')); 12 } 13 14 // widget main 15 function widget($args, $instance) { 16 extract($args, EXTR_SKIP); 17 if (!(!is_user_logged_in() && $instance['text_alt']=='')) { 22 18 echo $before_widget; 23 19 $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); 24 20 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; 25 if(is_user_logged_in()) { 21 if (is_user_logged_in()) { 22 // Set default text, in case something messes up and resets the text to display to be null 23 if($instance['text'] == '') { 24 $instance['text'] = 'Points: %points%'; 25 } 26 26 $string = str_replace('%points%', '<span class="cp_points_display">'.cp_displayPoints(0,1,1).'</span>', $instance['text']); 27 } 28 else{ 27 } else { 29 28 $string = $instance['text_alt']; 30 29 } 30 31 //start output 32 do_action('cp_pointsWidget_before'); 33 if($instance['html']==''){ 31 34 ?> 32 <?php do_action('cp_pointsWidget_before'); ?> 33 <?php if($instance['html']==''){ ?> 34 <ul> 35 <li><?php echo $string; ?></li> 36 <?php do_action('cp_pointsWidget'); ?> 37 </ul> 35 <ul> 36 <li><?php echo $string; ?></li> 37 <?php do_action('cp_pointsWidget'); ?> 38 </ul> 38 39 <?php 39 40 } else { 40 41 echo str_replace('%text%',$string,$instance['html']); 41 42 } 42 ?> 43 <?php do_action('cp_pointsWidget_after'); ?> 44 <?php 43 do_action('cp_pointsWidget_after'); 45 44 echo $after_widget; 46 }47 }48 49 // widget settings update50 function update($new_instance, $old_instance) {51 $instance = $old_instance;52 $instance['title'] = strip_tags($new_instance['title']);53 $instance['text'] = trim($new_instance['text']);54 $instance['text_alt'] = trim($new_instance['text_alt']);55 $instance['html'] = trim($new_instance['html']);56 return $instance;57 }58 59 // widget settings form60 function form($instance) {61 $default = array( 'title' => __('My Points', 'cp') , 'text' => __('Points', 'cp') . ': %points%' , 'text_alt' => __('You need to be logged in to view your points.', 'cp'), 'advanced' => '' );62 $instance = wp_parse_args( (array) $instance, $default );63 64 $field = 'title';65 $field_id = $this->get_field_id($field);66 $field_name = $this->get_field_name($field);67 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Title', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>';68 69 $field = 'text';70 $field_id = $this->get_field_id($field);71 $field_name = $this->get_field_name($field);72 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Text', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>';73 74 echo "\r\n".'<small><strong>'.__('Note', 'cp').':</strong> '.__('%points% would be replaced with the points of the logged in user', 'cp').'</small><br /><br />';75 76 $field = 'text_alt';77 $field_id = $this->get_field_id($field);78 $field_name = $this->get_field_name($field);79 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Text if user not logged in', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>';80 81 echo "\r\n".'<small><strong>'.__('Note', 'cp').':</strong> '.__('Leave this field blank to hide the widget if no user is logged in', 'cp').'</small><br /><br />';82 83 $field = 'html';84 $field_id = $this->get_field_id($field);85 $field_name = $this->get_field_name($field);86 if ( !isset($instance[$field]) ) $instance[$field] = '';87 echo "\r\n".'<p><label for="'.$field_id.'">'.__('HTML Code (advanced)', 'cp').': <textarea class="widefat" id="'.$field_id.'" name="'.$field_name.'" >'.esc_attr( $instance[$field] ).'</textarea><label></p>';88 89 echo "\r\n".'<small><strong>'.__('Note', 'cp').':</strong> '.__('This field should be left blank for most users! You may use this field to customize the appearance of this widget.', 'cp').'<br /><br /><strong>'.__('Shortcode', 'cp').':</strong> %text%</small>';90 91 45 } 92 46 } 93 // register widget 47 48 // widget settings update 49 function update($new_instance, $old_instance) { 50 $instance = $old_instance; 51 $instance['title'] = strip_tags($new_instance['title']); 52 $instance['text'] = trim($new_instance['text']); 53 $instance['text_alt'] = trim($new_instance['text_alt']); 54 $instance['html'] = trim($new_instance['html']); 55 return $instance; 56 } 57 58 // widget settings form 59 function form($instance) { 60 $default = array( 'title' => __('My Points', 'cp') , 'text' => __('Points', 'cp') . ': %points%' , 'text_alt' => __('You need to be logged in to view your points.', 'cp'), 'advanced' => '' ); 61 $instance = wp_parse_args( (array) $instance, $default ); 62 63 $field = 'title'; 64 $field_id = $this->get_field_id($field); 65 $field_name = $this->get_field_name($field); 66 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Title', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 67 68 $field = 'text'; 69 $field_id = $this->get_field_id($field); 70 $field_name = $this->get_field_name($field); 71 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Text', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 72 73 echo "\r\n".'<small><strong>'.__('Note', 'cp').':</strong> '.__('%points% would be replaced with the points of the logged in user', 'cp').'</small><br /><br />'; 74 75 $field = 'text_alt'; 76 $field_id = $this->get_field_id($field); 77 $field_name = $this->get_field_name($field); 78 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Text if user not logged in', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 79 80 echo "\r\n".'<small><strong>'.__('Note', 'cp').':</strong> '.__('Leave this field blank to hide the widget if no user is logged in', 'cp').'</small><br /><br />'; 81 82 $field = 'html'; 83 $field_id = $this->get_field_id($field); 84 $field_name = $this->get_field_name($field); 85 if ( !isset($instance[$field]) ) $instance[$field] = ''; 86 echo "\r\n".'<p><label for="'.$field_id.'">'.__('HTML Code (advanced)', 'cp').': <textarea class="widefat" id="'.$field_id.'" name="'.$field_name.'" >'.esc_attr( $instance[$field] ).'</textarea><label></p>'; 87 88 echo "\r\n".'<small><strong>'.__('Note', 'cp').':</strong> '.__('This field should be left blank for most users! You may use this field to customize the appearance of this widget.', 'cp').'<br /><br /><strong>'.__('Shortcode', 'cp').':</strong> %text%</small>'; 89 } 90 } 91 92 /** CubePoints Top Users Widget */ 93 class cp_topUsersWidget extends WP_Widget { 94 95 // constructor 96 function cp_topUsersWidget() { 97 parent::WP_Widget('cp_topUsersWidget', 'CubePoints Top Users', array('description' => 'Use this widget to showcase the users with the most points.')); 98 } 99 100 // widget main 101 function widget($args, $instance) { 102 extract($args, EXTR_SKIP); 103 echo $before_widget; 104 $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); 105 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; 106 107 //set default values 108 if($instance['num'] == '' || $instance['num'] == 0) { $instance['num'] = 1; } 109 if($instance['text'] == '') { $instance['text'] = '%user% (%points%)';} 110 111 $top = cp_getAllPoints($instance['num'],get_option('cp_topfilter')); 112 do_action('cp_topUsersWidget_before'); 113 echo apply_filters('cp_topUsersWidget_before','<ul>'); 114 $line = apply_filters('cp_topUsersWidget_line','<li class="cp_topUsersWidget top_%place%" style="%style%">%string%</li>'); 115 $line = str_replace('%style%', $instance['style'], $line); 116 foreach($top as $x=>$y){ 117 $user = get_userdata($y['id']); 118 $string = str_replace('%string%', '', $instance['text']); 119 $string = str_replace('%string%',$string,$line); 120 $string = apply_filters('cp_displayUserInfo',$string,$y,$x+1); 121 echo $string; 122 } 123 echo apply_filters('cp_topUsersWidget_after','</ul>'); 124 do_action('cp_topUsersWidget_after'); 125 echo $after_widget; 126 } 127 128 // widget settings update 129 function update($new_instance, $old_instance) { 130 $instance = $old_instance; 131 $instance['title'] = strip_tags($new_instance['title']); 132 $instance['num'] = ((int) $new_instance['num'] > 0 ) ? (int) $new_instance['num'] : 1 ; 133 $instance['text'] = trim($new_instance['text']); 134 $instance['style'] = trim($new_instance['style']); 135 return $instance; 136 } 137 138 // widget settings form 139 function form($instance) { 140 $default = array( 'title' => __('Top Users', 'cp') , 'num' => 3 , 'text' => '%user% (%points%)', 'style' => 'list-style:none;' ); 141 $instance = wp_parse_args( (array) $instance, $default ); 142 143 $field = 'title'; 144 $field_id = $this->get_field_id($field); 145 $field_name = $this->get_field_name($field); 146 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Title', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 147 148 $field = 'num'; 149 $field_id = $this->get_field_id($field); 150 $field_name = $this->get_field_name($field); 151 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Number of top users to show', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 152 153 $field = 'text'; 154 $field_id = $this->get_field_id($field); 155 $field_name = $this->get_field_name($field); 156 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Text', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 157 158 echo "\r\n".'<small><strong>'.__('Shortcodes', 'cp') . ':</strong><br />'; 159 echo __('Number of points', 'cp') . ' - %points%' . '<br />'; 160 echo __('Points (number only)', 'cp') . ' - %npoints%' . '<br />'; 161 echo __('User display name', 'cp') . ' - %username%' . '<br />'; 162 echo __('User login ID', 'cp') . ' - %user%' . '<br />'; 163 echo __('User ID', 'cp') . ' - %userid%' . '<br />'; 164 echo __('User ranking', 'cp') . ' - %place%' . '<br />'; 165 echo __('Email MD5 hash', 'cp') . ' - %emailhash%' . '<br />'; 166 echo '<br /></small>'; 167 168 $field = 'style'; 169 $field_id = $this->get_field_id($field); 170 $field_name = $this->get_field_name($field); 171 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Style', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 172 echo "\r\n".'<small><strong>'.__('Note', 'cp') . ':</strong> '.__('This adds the following style to the list element. Shortcodes from above may be used here. The %emailhash% shortcode, for example, could be used to display gravatars.', 'cp').'</small><br />'; 173 } 174 } 175 176 add_action('widgets_init', 'cp_widgets'); 177 178 function cp_widgets(){ 179 // register points widget 94 180 register_widget("cp_pointsWidget"); 95 181 96 97 /** CubePoints Top Users Widget */ 98 class cp_topUsersWidget extends WP_Widget { 99 100 // constructor 101 function cp_topUsersWidget() { 102 parent::WP_Widget('cp_topUsersWidget', 'CubePoints Top Users', array('description' => 'Use this widget to showcase the users with the most points.')); 103 } 104 105 // widget main 106 function widget($args, $instance) { 107 extract($args, EXTR_SKIP); 108 echo $before_widget; 109 $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); 110 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; 111 $top = cp_getAllPoints($instance['num'],get_option('cp_topfilter')); 112 do_action('cp_topUsersWidget_before'); 113 echo apply_filters('cp_topUsersWidget_before','<ul>'); 114 $line = apply_filters('cp_topUsersWidget_line','<li class="cp_topUsersWidget top_%place%" style="%style%">%string%</li>'); 115 $line = str_replace('%style%', $instance['style'], $line); 116 foreach($top as $x=>$y){ 117 $user = get_userdata($y['id']); 118 $string = str_replace('%string%', '', $instance['text']); 119 $string = str_replace('%string%',$string,$line); 120 $string = apply_filters('cp_displayUserInfo',$string,$y,$x+1); 121 echo $string; 122 } 123 echo apply_filters('cp_topUsersWidget_after','</ul>'); 124 do_action('cp_topUsersWidget_after'); 125 echo $after_widget; 126 } 127 128 // widget settings update 129 function update($new_instance, $old_instance) { 130 $instance = $old_instance; 131 $instance['title'] = strip_tags($new_instance['title']); 132 $instance['num'] = ((int) $new_instance['num'] > 0 ) ? (int) $new_instance['num'] : 1 ; 133 $instance['text'] = trim($new_instance['text']); 134 $instance['style'] = trim($new_instance['style']); 135 return $instance; 136 } 137 138 // widget settings form 139 function form($instance) { 140 $default = array( 'title' => __('Top Users', 'cp') , 'num' => 3 , 'text' => '%user% (%points%)', 'style' => 'list-style:none;' ); 141 $instance = wp_parse_args( (array) $instance, $default ); 142 143 $field = 'title'; 144 $field_id = $this->get_field_id($field); 145 $field_name = $this->get_field_name($field); 146 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Title', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 147 148 $field = 'num'; 149 $field_id = $this->get_field_id($field); 150 $field_name = $this->get_field_name($field); 151 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Number of top users to show', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 152 153 $field = 'text'; 154 $field_id = $this->get_field_id($field); 155 $field_name = $this->get_field_name($field); 156 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Text', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 157 158 echo "\r\n".'<small><strong>'.__('Shortcodes', 'cp') . ':</strong><br />'; 159 echo __('Number of points', 'cp') . ' - %points%' . '<br />'; 160 echo __('Points (number only)', 'cp') . ' - %npoints%' . '<br />'; 161 echo __('User display name', 'cp') . ' - %username%' . '<br />'; 162 echo __('User login ID', 'cp') . ' - %user%' . '<br />'; 163 echo __('User ID', 'cp') . ' - %userid%' . '<br />'; 164 echo __('User ranking', 'cp') . ' - %place%' . '<br />'; 165 echo __('Email MD5 hash', 'cp') . ' - %emailhash%' . '<br />'; 166 echo '<br /></small>'; 167 168 $field = 'style'; 169 $field_id = $this->get_field_id($field); 170 $field_name = $this->get_field_name($field); 171 echo "\r\n".'<p><label for="'.$field_id.'">'.__('Style', 'cp').': <input type="text" class="widefat" id="'.$field_id.'" name="'.$field_name.'" value="'.esc_attr( $instance[$field] ).'" /><label></p>'; 172 echo "\r\n".'<small><strong>'.__('Note', 'cp') . ':</strong> '.__('This adds the following style to the list element. Shortcodes from above may be used here. The %emailhash% shortcode, for example, could be used to display gravatars.', 'cp').'</small><br />'; 173 } 174 } 175 // register widget 182 // register top users widget 176 183 register_widget("cp_topUsersWidget"); 177 184 -
cubepoints/trunk/cubepoints.php
r571698 r626094 4 4 Plugin URI: http://cubepoints.com 5 5 Description: CubePoints is a point management system designed for WordPress blogs. Users can earn points by posting comments on your site. To display user's points, just put <code><?php cp_displayPoints(); ?></code> in your template or activate the sidebar widget. 6 Version: 3. 1.16 Version: 3.2 7 7 Author: Jonathan Lau & Peter Zhang 8 8 Author URI: http://cubepoints.com … … 12 12 13 13 /** Define constants */ 14 define('CP_VER', '3. 1.1');14 define('CP_VER', '3.2'); 15 15 define('CP_DB', $wpdb->base_prefix . 'cp'); 16 16 define('CP_PATH', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__))); -
cubepoints/trunk/modules/backup.php
r445086 r626094 55 55 56 56 function cp_module_backup_data_add_admin_page(){ 57 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('Backup and Restore','cp'), __('Backup & Restore','cp'), 8, 'cp_modules_backup_admin', 'cp_modules_backup_admin');57 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('Backup and Restore','cp'), __('Backup & Restore','cp'), 'manage_options', 'cp_modules_backup_admin', 'cp_modules_backup_admin'); 58 58 } 59 59 add_action('cp_admin_pages','cp_module_backup_data_add_admin_page'); -
cubepoints/trunk/modules/custom_points.php
r373336 r626094 71 71 72 72 /* Add CubePoints comment action hook */ 73 add_action('cp_ newComment', 'cp_module_customp_newComment');73 add_action('cp_comment_add', 'cp_module_customp_newComment'); 74 74 function cp_module_customp_newComment($cid) { 75 75 if (is_user_logged_in()) { -
cubepoints/trunk/modules/donate/donate.js
r384401 r626094 1 function cp_module_donate_do(){ 2 jQuery.ajax({ 3 url: cp_donate.ajax_url, 4 type: "POST", 5 cache: false, 6 dataType: "json", 7 data: {action: "cp_module_donate_do", recipient: jQuery('#cp_recipient').val(), points: jQuery('#cp_points').val(), message: jQuery('#cp_message').val()}, 8 success: function(data){ 9 if(data.success==true){ 10 Boxy.alert(data.message); 11 thebox.hide(); 12 thebox.unload(); 13 jQuery('.cp_points_display').html(data.pointsd); 1 // Numeric only control handler 2 jQuery.fn.ForceNumericOnly = 3 function() 4 { 5 return this.each(function() 6 { 7 jQuery(this).keydown(function(e) 8 { 9 var key = e.charCode || e.keyCode || 0; 10 // allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY 11 return ( 12 key == 8 || 13 key == 9 || 14 key == 46 || 15 (key >= 37 && key <= 40) || 16 (key >= 48 && key <= 57) || 17 (key >= 96 && key <= 105)); 18 }); 19 }); 20 }; 21 22 function cp_module_donate(s){ 23 showDropdownSearch(s); 24 } 25 26 function showDropdownSearch(s){ 27 var html0 = '<div id="optionsearch">'+ 28 '<h3>' + cp_donate.title + '</h3>'+ 29 '<div class="textinput"><label for="cp_searchquery"> ' + cp_donate.searchText + ' <span id="optionsearchstatus">' + cp_donate.searchingText + '</span></label><input type="search" id="cp_searchquery" name="cp_searchquery" value="" placeholder="' + cp_donate.searchPlaceholder + '"></div>'+ 30 '<div id="searchoptionswrapper"><div id="searchnoresult">'+ cp_donate.nothingFound +'</div><table id="searchoptions" class="radioTable" cellpadding="0" cellspacing="0"><tbody></tbody></table></div>'+ 31 '</div>', 32 html1 = '<h3>' + cp_donate.title + '</h3>' + 33 '<div class="textinput"><label for="cp_donateAmount"> ' + cp_donate.amountToDonate + '</label><input type="search" id="cp_donateAmount" name="cp_donateAmount" value="" placeholder="' + cp_donate.donateAmountPlaceholder + '"></div>', 34 html2 = '<h3>' + cp_donate.title + '</h3>' + 35 '<div class="textinput"><label for="cp_donateComment"> ' + cp_donate.donateComment + '</label><input type="search" id="cp_donateComment" name="cp_donateComment" value="" placeholder="' + cp_donate.donateCommentPlaceholder + '"></div>', 36 html3 = '<h3>' + cp_donate.title + '</h3>' + 37 '<span id="cp_donateFeedback">Please wait...</span>'; 38 39 var donatePrompt = { 40 state0: { 41 html: html0, 42 buttons: { Cancel:false,Next:true }, 43 submit: function(e,v,m,f){ 44 if(v){ 45 if(f.selectedUser == undefined){ 46 var e = jQuery.Event("keydown"); 47 e.which = 13; 48 jQuery("#cp_searchquery").trigger(e); 49 return false; 50 } 51 jQuery.prompt.goToState('state1'); 52 return false; 53 } 14 54 } 15 else{ 16 Boxy.alert(data.message); 55 }, 56 state1: { 57 html: html1, 58 buttons: { Cancel:false,Next:true }, 59 submit: function(e,v,m,f){ 60 if(v){ 61 if(f.cp_donateAmount == ''){ 62 $imp.find('input').focus(); 63 return false; 64 } 65 jQuery.prompt.goToState('state2'); 66 return false; 67 } 68 } 69 }, 70 state2: { 71 html: html2, 72 buttons: { Cancel:false,Donate:true }, 73 submit: function(e,v,m,f){ 74 if(v){ 75 jQuery.ajax({ 76 url: cp_donate.ajax_url, 77 type: "POST", 78 cache: false, 79 dataType: "json", 80 data: {action: "cp_module_donate_do", recipient: f.selectedUser, points: f.cp_donateAmount, message: f.cp_donateComment}, 81 success: function(data){ 82 if(data.success==true){ 83 jQuery.prompt.getStateContent('state3').find('#cp_donateFeedback').text(data.message); 84 jQuery('.cp_points_display').html(data.pointsd); 85 return false; 86 } 87 else{ 88 jQuery.prompt.getStateContent('state3').find('#cp_donateFeedback').text(data.message); 89 return false; 90 } 91 } 92 }); 93 jQuery.prompt.goToState('state3'); 94 return false; 95 } 96 } 97 }, 98 state3: { 99 html: html3, 100 buttons: { Ok:true }, 101 submit: function(e,v,m,f){ 102 if(v){ 103 return true; 104 } 17 105 } 18 106 } 107 }; 108 109 var $imp = jQuery.prompt(donatePrompt); 110 111 if(cp_donate.logged_in != '1'){ 112 jQuery.prompt.getStateContent('state3').find('#cp_donateFeedback').text(cp_donate.notLoggedInText); 113 jQuery.prompt.goToState('state3'); 114 } 115 116 jQuery("#cp_donateAmount").ForceNumericOnly(); 117 118 var $so = jQuery('#searchoptions', $imp); 119 120 $so.on('click', 'tr', function(){ 121 jQuery('tr.checked', $so).removeClass('checked'); 122 jQuery(this).addClass('checked'); 123 jQuery(this).find('input').attr('checked', true); 19 124 }); 125 126 jQuery('#cp_searchquery', $imp).focus().keydown(function(event){ 127 var $i = jQuery(this), 128 query = $i.val(), 129 html = "", 130 counter = 0, 131 $sos = jQuery('#optionsearchstatus',$imp); 132 133 if(event.which == 13 || event.keyCode == 13 && jQuery.trim(query) !== ''){ 134 135 $sos.css('display','inline'); 136 137 var request = jQuery.ajax({ 138 url: cp_donate.ajax_url, 139 type: "POST", 140 data: {action: 'cp_donate_search', q: query} 141 }); 142 143 request.done(function(msg) { 144 jQuery(msg).each(function(i,user){ 145 var currval = user.id, 146 tval = null, 147 currtxt = user.ul; 148 html += '<tr class="row'+ (counter++ % 2) + (currval == tval? ' checked':'')+'">'+ 149 '<td class="td-radio"><input type="radio" name="selectedUser" id="selectedUser_'+ counter +'" value="'+ currval +'"'+ (currval == tval? ' checked':'') +'></td>'+ 150 '<td class="td-label"><label for="selectedUser_'+ counter +'">'+ currtxt +'</label></td>'+ 151 '</tr>'; 152 }); 153 $so.find('tbody').html(html); 154 $so.find('tr:eq(0)').addClass('checked').find('input').attr('checked',true); 155 if(counter == 0){ 156 jQuery('#searchnoresult',$imp).show(); 157 jQuery('#searchoptions',$imp).hide(); 158 } 159 else{ 160 jQuery('#searchnoresult',$imp).hide(); 161 jQuery('#searchoptions',$imp).show(); 162 } 163 jQuery('#searchoptionswrapper',$imp).slideDown('slow', function(){ 164 $sos.hide(); 165 }); 166 }); 167 168 request.fail(function(jqXHR, textStatus) { 169 jQuery.prompt.getStateContent('state3').find('#cp_donateFeedback').text(cp_donate.somethingWentWrongText); 170 jQuery.prompt.goToState('state3'); 171 }); 172 173 return false; 174 }// end if enter key 175 176 }); 177 178 if(s){ 179 jQuery.prompt.getStateContent('state0').find('#cp_searchquery').val(s); 180 var e = jQuery.Event("keydown"); 181 e.which = 13; 182 jQuery("#cp_searchquery").trigger(e); 183 } 184 185 return false; 20 186 } 21 function cp_module_donate(){22 confirmation = cp_donate.confirmation;23 thebox = new Boxy('<form name="cp_donate" id="cp_donate" method="post" onsubmit="Boxy.confirm(confirmation,function(){cp_module_donate_do();});return false;"><label for="cp_recipient">'+cp_donate.recipient+':</label><br /><input type="text" id="cp_recipient" name="cp_recipient" style="width:300px;" /><br /><br /><label for="cp_points">'+cp_donate.amount+':</label><br /><input type="text" id="cp_points" name="cp_points" style="width:300px;" /><br /><br /><label for="cp_message">'+cp_donate.message+':</label><br /><textarea id="cp_message" name="cp_message" style="width:300px;height:50px;"></textarea><br /><br /><input type="submit" value="'+cp_donate.donate_points+'" style="width:300px;" /></form>', {title: cp_donate.donate, modal: true});24 } -
cubepoints/trunk/modules/donate/donate.php
r445086 r626094 3 3 /** Donate Module */ 4 4 5 cp_module_register(__('Donate', 'cp') , 'donate' , '1. 1', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com' , __('This module allows your users to donate points to each other.', 'cp'), 1);5 cp_module_register(__('Donate', 'cp') , 'donate' , '1.2', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com' , __('This module allows your users to donate points to each other.', 'cp'), 1); 6 6 7 7 if(cp_module_activated('donate')){ 8 8 9 add_action( 'wp_ajax_cp_donate_search', 'cp_module_donate_ajax_search' ); 10 function cp_module_donate_ajax_search() { 11 12 header( "Content-Type: application/json" ); 13 14 if( $_REQUEST['q']=='' ){ 15 $response = json_encode( array() ); 16 echo $response; 17 exit; 18 } 19 20 global $wpdb; 21 $users = $wpdb->get_results('SELECT ID, user_login, first_name, last_name, md5(user_email) as email_hash FROM `' . $wpdb->prefix . 'users` 22 LEFT JOIN ( 23 SELECT 24 user_id, 25 meta_value as first_name 26 FROM `' . $wpdb->prefix . 'usermeta` 27 WHERE ( meta_key = \'first_name\' ) 28 ) AS A 29 ON id = A.user_id 30 LEFT JOIN ( 31 SELECT 32 user_id, 33 meta_value as last_name 34 FROM `' . $wpdb->prefix . 'usermeta` 35 WHERE ( meta_key = \'last_name\' ) 36 ) AS B 37 ON id = B.user_id 38 WHERE 39 user_login LIKE \''. $wpdb->escape($_REQUEST['q']) .'%\' 40 OR CONCAT_WS(\' \', first_name, last_name) LIKE \''. $wpdb->escape($_REQUEST['q']) .'%\' 41 OR CONCAT_WS(\' \', last_name, first_name) LIKE \''. $wpdb->escape($_REQUEST['q']) .'%\' 42 OR CONCAT_WS(\' \', first_name, last_name) LIKE \'% '. $wpdb->escape($_REQUEST['q']) .'%\' 43 OR CONCAT_WS(\' \', last_name, last_name) LIKE \'% '. $wpdb->escape($_REQUEST['q']) .'%\' 44 ORDER BY CASE 45 WHEN user_login LIKE \''. $wpdb->escape($_REQUEST['q']) .'%\' THEN 1 ELSE 2 END 46 LIMIT 30'); 47 $response = array(); 48 49 foreach($users as $u){ 50 $response[] = array( 51 'id' => $u->ID, 52 'ul' => $u->user_login, 53 'fn' => $u->first_name, 54 'ln' => $u->last_name, 55 'eh' => $u->email_hash 56 ); 57 } 58 $response = json_encode($response); 59 echo $response; 60 exit; 61 62 } 63 9 64 function cp_module_donate_scripts(){ 10 65 11 wp_register_script(' boxy',12 CP_PATH . ' assets/boxy/javascripts/jquery.boxy.js',66 wp_register_script('impromptu', 67 CP_PATH . 'modules/donate/jquery-impromptu.4.0.min.js', 13 68 array('jquery'), 14 ' 0.1.4' );69 '4.0' ); 15 70 16 wp_register_style(' boxy', CP_PATH . 'assets/boxy/stylesheets/boxy.css');71 wp_register_style('cp_donate', CP_PATH . 'modules/donate/donate.css'); 17 72 18 wp_enqueue_script(' boxy');19 wp_enqueue_style(' boxy');73 wp_enqueue_script('impromptu'); 74 wp_enqueue_style('cp_donate'); 20 75 21 76 } … … 27 82 $points = $_POST['points']; 28 83 $message = htmlentities(stripslashes($_POST['message']), ENT_QUOTES, 'UTF-8'); 29 $user = get_user databylogin($recipient);84 $user = get_user_by('id', $recipient); 30 85 31 86 if(!is_user_logged_in()){ … … 92 147 93 148 // Handle JS 94 95 wp_register_script('cp_donate_script', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)). 'donate.js', array('jquery')); 96 97 function cp_module_donate_script(){ 149 function cp_module_donate_script(){ 150 wp_register_script('cp_donate_script', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)). 'donate.js', array('jquery')); 98 151 wp_enqueue_script('cp_donate_script'); 152 wp_localize_script( 'cp_donate_script', 'cp_donate', array( 153 'logged_in' => is_user_logged_in() ? '1' : '0', 154 'ajax_url' => admin_url( 'admin-ajax.php' ), 155 'title' => __('Points Transfer', 'cp'), 156 'searchText' => __('Type a username and press Enter to search...', 'cp'), 157 'searchingText' => __('Searching, please wait...', 'cp'), 158 'searchPlaceholder' => __('Search...', 'cp'), 159 'nothingFound' => __('Nothing Found', 'cp'), 160 'amountToDonate' => __('Enter amount of points to transfer...', 'cp'), 161 'donateAmountPlaceholder' => __('Amount to transfer...', 'cp'), 162 'donateComment' => __('Leave feedback (to be displayed on recipient\'s profile)', 'cp'), 163 'donateCommentPlaceholder' => __('Enter a message...', 'cp'), 164 'notLoggedInText' => __('You must be logged in to make a transfer!', 'cp'), 165 'somethingWentWrongText' => _('Oops, something went wrong! Please try again later.', 'cp') 166 ) ); 99 167 } 100 168 101 169 add_action('init', 'cp_module_donate_script'); 102 103 wp_localize_script( 'cp_donate_script', 'cp_donate', array(104 ajax_url=>get_bloginfo('url').'/wp-admin/admin-ajax.php',105 confirmation=>__('Are you sure you want to donate points?', 'cp'),106 recipient=>__('Recipient', 'cp'),107 message=>__('Message', 'cp'),108 amount=>__('Amount', 'cp'),109 donate_points=>__('Donate Points', 'cp'),110 donate=>__('Donate Points', 'cp')111 ) );112 170 113 171 function cp_module_donate_widget(){ … … 134 192 } 135 193 if($data['message']!=''){ 136 echo ' <a href="javascript:void(0);" onclick=" Boxy.alert(\''.htmlspecialchars($data['message']).'\')">[' . __('Message', 'cp') . ']</a>';194 echo ' <a href="javascript:void(0);" onclick="jQuery.prompt(\'MESSAGE: '.htmlspecialchars($data['message']).'\')">[' . __('Message', 'cp') . ']</a>'; 137 195 } 138 196 } -
cubepoints/trunk/modules/my_points.php
r375874 r626094 4 4 5 5 cp_module_register(__('My Points', 'cp') , 'mypoints' , '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com' , __('Allow users to see a history of their point transactions.', 'cp'), 1); 6 7 function cp_module_mypoints_install(){8 //add_option('cp_module_mypoints_points', 5);9 }10 add_action('cp_module_mypoints_activate','cp_module_mypoints_install');11 6 12 7 if(cp_module_activated('mypoints')){ … … 16 11 17 12 function cp_module_mypoints_add_admin_page(){ 18 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('My Points','cp'), __('My Points','cp'), 0, 'cp_modules_mypoints_admin', 'cp_modules_mypoints_admin');13 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('My Points','cp'), __('My Points','cp'), 'read', 'cp_modules_mypoints_admin', 'cp_modules_mypoints_admin'); 19 14 } 20 15 add_action('cp_admin_pages','cp_module_mypoints_add_admin_page'); -
cubepoints/trunk/modules/paid_content.php
r445086 r626094 206 206 add_action('init', 'cp_module_pcontent_buy'); 207 207 function cp_module_pcontent_buy(){ 208 if( $_POST['cp_module_pcontent_pay']=='') return;208 if(!isset($_POST['cp_module_pcontent_pay'])) return; 209 209 $pcontent_enabled = (bool) get_post_meta($_POST['cp_module_pcontent_pay'],'cp_pcontent_points_enable', 1); 210 210 if(!$pcontent_enabled) return; -
cubepoints/trunk/modules/paypal/paypal.php
r571698 r626094 3 3 /** PayPal Top-up Module */ 4 4 5 cp_module_register(__('PayPal Top-up', 'cp') , 'paypal' , '1. 0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com' , __('Allow users to buy points using PayPal.', 'cp'), 1);5 cp_module_register(__('PayPal Top-up', 'cp') , 'paypal' , '1.2', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com' , __('Allow users to buy points using PayPal.', 'cp'), 1); 6 6 7 7 function cp_module_paypal_install(){ … … 58 58 59 59 function cp_module_paypal_add_admin_page(){ 60 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('PayPal Top-up','cp'), __('PayPal Top-up','cp'), 8, 'cp_modules_paypal_admin', 'cp_modules_paypal_admin');60 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('PayPal Top-up','cp'), __('PayPal Top-up','cp'), 'manage_options', 'cp_modules_paypal_admin', 'cp_modules_paypal_admin'); 61 61 } 62 62 add_action('cp_admin_pages','cp_module_paypal_add_admin_page'); … … 67 67 if ($_POST['cp_module_paypal_form_submit'] == 'Y') { 68 68 69 update_option('cp_module_paypal_account', $_POST['cp_module_paypal_account']);69 update_option('cp_module_paypal_account', trim($_POST['cp_module_paypal_account'])); 70 70 update_option('cp_module_paypal_sandbox', (bool)$_POST['cp_module_paypal_sandbox']); 71 71 update_option('cp_module_paypal_currency', $_POST['cp_module_paypal_currency']); 72 update_option('cp_module_paypal_item', $_POST['cp_module_paypal_item']);72 update_option('cp_module_paypal_item', trim($_POST['cp_module_paypal_item'])); 73 73 if(trim($_POST['cp_module_paypal_cancel'])==''){ $_POST['cp_module_paypal_cancel'] = get_bloginfo('url').'/?cp_module_paypal_return=0'; } 74 update_option('cp_module_paypal_cancel', $_POST['cp_module_paypal_cancel']);74 update_option('cp_module_paypal_cancel', trim($_POST['cp_module_paypal_cancel'])); 75 75 if(trim($_POST['cp_module_paypal_thankyou'])==''){ $_POST['cp_module_paypal_thankyou'] = get_bloginfo('url').'/?cp_module_paypal_return=1'; } 76 76 update_option('cp_module_paypal_thankyou', trim($_POST['cp_module_paypal_thankyou'])); 77 77 update_option('cp_module_paypal_price', ((float)$_POST['cp_module_paypal_price']<=0)?1:(float)$_POST['cp_module_paypal_price']); 78 78 update_option('cp_module_paypal_min', ((int)$_POST['cp_module_paypal_min']<=0)?1:(int)$_POST['cp_module_paypal_min']); 79 update_option('cp_module_paypal_form', stripslashes($_POST['cp_module_paypal_form']));79 update_option('cp_module_paypal_form', trim(stripslashes($_POST['cp_module_paypal_form']))); 80 80 81 81 … … 197 197 198 198 function cp_module_paypal_pay(){ 199 if( $_REQUEST['cp_module_paypal_pay']!=''){199 if(isset($_REQUEST['cp_module_paypal_pay']) && $_REQUEST['cp_module_paypal_pay']!=''){ 200 200 header("Cache-Control: no-cache, must-revalidate"); 201 201 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); … … 259 259 260 260 function cp_module_paypal_message(){ 261 if( $_REQUEST['cp_module_paypal_return']!=''){261 if(isset($_REQUEST['cp_module_paypal_return']) && $_REQUEST['cp_module_paypal_return']!=''){ 262 262 if($_REQUEST['cp_module_paypal_return']=='1'){ 263 263 cp_module_paypal_showMessage(__('Thank you for your purchase!', 'cp')); … … 294 294 295 295 function cp_module_paypal_ipn(){ 296 if($_GET['cp_module_paypal_ipn']!=''){ 297 // read the post from PayPal system and add 'cmd' 298 $req = 'cmd=_notify-validate'; 299 300 foreach ($_POST as $key => $value) { 301 $value = urlencode(stripslashes($value)); 302 $req .= "&$key=$value"; 303 } 304 305 if(get_option('cp_module_paypal_sandbox')){ 306 $loc = 'ssl://www.sandbox.paypal.com'; 307 } 308 else{ 309 $loc = 'ssl://www.paypal.com'; 310 } 311 312 // post back to PayPal system to validate 313 $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; 314 $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; 315 $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; 316 $fp = fsockopen ($loc, 443, $errno, $errstr, 30); 317 318 // assign posted variables to local variables 319 $item_name = $_POST['item_name']; 320 $item_number = $_POST['item_number']; 321 $payment_status = $_POST['payment_status']; 322 $payment_amount = $_POST['mc_gross']; 323 $payment_currency = $_POST['mc_currency']; 324 $txn_id = $_POST['txn_id']; 325 $receiver_email = $_POST['receiver_email']; 326 $payer_email = $_POST['payer_email']; 327 $custom = $_POST['custom']; 328 list($points,$uid)=explode('|',$custom); 329 330 if (!$fp) { 331 // HTTP ERROR 332 } else { 333 fputs ($fp, $header . $req); 334 while (!feof($fp)) { 335 $res = fgets ($fp, 1024); 336 if (strcmp ($res, "VERIFIED") == 0) { 337 // check the payment_status is Completed 338 if($payment_status!='Completed'){ die(); } 339 // check that txn_id has not been previously processed 340 global $wpdb; 341 $results = $wpdb->get_results('SELECT * FROM `'.CP_DB.'` WHERE `type`=\'paypal\''); 342 343 foreach($results as $result){ 344 $data = $result->data; 345 if($data['txn_id']==$txn_id){ die(); } 346 } 347 // check that receiver_email is your Primary PayPal email 348 if($receiver_email!=get_option('cp_module_paypal_account')){ die(); } 349 // check that payment_amount/payment_currency are correct 350 if($payment_currency!=get_option('cp_module_paypal_currency')){ die(); } 351 if((float)$payment_amount!=(float)cp_module_paypal_round_up(get_option('cp_module_paypal_price') * (int)$points, 2)){ die(); } 352 // process payment 353 cp_points('paypal', $uid, (int)$points, serialize(array('txn_id'=>$txn_id,'payer_email'=>$payer_email,'amt'=>$payment_amount))); 354 } 355 else if (strcmp ($res, "INVALID") == 0) { 356 // invalid paypal return 357 die(); 358 } 359 } 360 fclose ($fp); 361 } 362 exit(); 296 if(isset($_GET['cp_module_paypal_ipn']) && $_GET['cp_module_paypal_ipn']!=''){ 297 298 if(get_option('cp_module_paypal_sandbox')){ 299 $host = 'www.sandbox.paypal.com'; 300 } 301 else{ 302 $host = 'www.paypal.com'; 303 } 304 305 // read the post from PayPal system and add 'cmd' 306 $req = 'cmd=' . urlencode('_notify-validate'); 307 308 foreach ($_POST as $key => $value) { 309 $value = urlencode(stripslashes($value)); 310 $req .= "&$key=$value"; 311 } 312 313 $ch = curl_init(); 314 curl_setopt($ch, CURLOPT_URL, 'https://' . $host . '/cgi-bin/webscr'); 315 curl_setopt($ch, CURLOPT_HEADER, 0); 316 curl_setopt($ch, CURLOPT_POST, 1); 317 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 318 curl_setopt($ch, CURLOPT_POSTFIELDS, $req); 319 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 320 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 321 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: ' . $host)); 322 $res = curl_exec($ch); 323 curl_close($ch); 324 325 // assign posted variables to local variables 326 $item_name = $_POST['item_name']; 327 $item_number = $_POST['item_number']; 328 $payment_status = $_POST['payment_status']; 329 $payment_amount = $_POST['mc_gross']; 330 $payment_currency = $_POST['mc_currency']; 331 $txn_id = $_POST['txn_id']; 332 $receiver_email = $_POST['receiver_email']; 333 $payer_email = $_POST['payer_email']; 334 $custom = $_POST['custom']; 335 list($points,$uid)=explode('|',$custom); 336 337 if (strcmp ($res, "VERIFIED") == 0) { 338 // check the payment_status is Completed 339 if($payment_status!='Completed'){ 340 die(); 341 } 342 // check that txn_id has not been previously processed 343 global $wpdb; 344 $results = $wpdb->get_results('SELECT * FROM `'.CP_DB.'` WHERE `type`=\'paypal\''); 345 foreach($results as $result){ 346 $data = unserialize($result->data); 347 if($data['txn_id']==$txn_id){ 348 die(); 349 } 350 } 351 // check that receiver_email is your Primary PayPal email 352 if($receiver_email!=trim(get_option('cp_module_paypal_account'))){ 353 die(); 354 } 355 // check that payment_amount/payment_currency are correct 356 if($payment_currency!=get_option('cp_module_paypal_currency')){ 357 die(); 358 } 359 if((float)$payment_amount!=(float)cp_module_paypal_round_up(get_option('cp_module_paypal_price') * (int)$points, 2)){ 360 die(); 361 } 362 // process payment 363 cp_points('paypal', $uid, (int)$points, serialize(array('txn_id'=>$txn_id,'payer_email'=>$payer_email,'amt'=>$payment_amount))); 364 } 365 else if (strcmp ($res, "INVALID") == 0) { 366 // invalid IPN 367 die(); 368 } 369 exit(); 370 363 371 } 364 372 } -
cubepoints/trunk/modules/ranks.php
r373729 r626094 13 13 14 14 function cp_module_ranks_data_add_admin_page(){ 15 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('Ranks','cp'), __('Ranks','cp'), 8, 'cp_modules_ranks_admin', 'cp_modules_ranks_admin');15 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('Ranks','cp'), __('Ranks','cp'), 'manage_options', 'cp_modules_ranks_admin', 'cp_modules_ranks_admin'); 16 16 } 17 17 add_action('cp_admin_pages','cp_module_ranks_data_add_admin_page'); -
cubepoints/trunk/modules/reset.php
r445086 r626094 8 8 9 9 function cp_module_resetdata_add_admin_page(){ 10 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('Reset Data','cp'), __('Reset Data','cp'), 8, 'cp_modules_resetdata_admin', 'cp_modules_resetdata_admin');10 add_submenu_page('cp_admin_manage', 'CubePoints - ' .__('Reset Data','cp'), __('Reset Data','cp'), 'manage_options', 'cp_modules_resetdata_admin', 'cp_modules_resetdata_admin'); 11 11 } 12 12 add_action('cp_admin_pages','cp_module_resetdata_add_admin_page'); -
cubepoints/trunk/modules/youtube/youtube.php
r384401 r626094 94 94 add_shortcode('cp_youtube','cp_module_youtube_shortcode'); 95 95 96 // enqueue swfobject 97 wp_enqueue_script("swfobject"); 98 99 wp_register_script('cp_youtube_common', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)). 'cp_youtube.js', array('jquery')); 100 101 function cp_youtube_scripts(){ 96 function cp_module_youtube_scripts(){ 97 wp_enqueue_script("swfobject"); 98 wp_register_script('cp_youtube_common', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)). 'cp_youtube.js', array('jquery')); 102 99 wp_enqueue_script('cp_youtube_common'); 100 wp_localize_script( 'cp_youtube_common', 'cp_youtube', array( 101 'ajax_url' => (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] 102 ) ); 103 103 } 104 105 add_action('init', 'cp_youtube_scripts'); 106 107 // ajax handling 108 109 wp_localize_script( 'cp_youtube_common', 'cp_youtube', array( 110 'ajax_url' => (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] 111 ) ); 104 add_action('init', 'cp_module_youtube_scripts'); 112 105 113 106 /** YouTube Log Hook */ -
cubepoints/trunk/readme.txt
r571698 r626094 2 2 Contributors: lauweijie7715, petester 3 3 Donate link: http://cubepoints.com/donate/ 4 Tags: points, comments, post, admin, widget 4 Tags: points, comments, post, admin, widget, sidebar, paypal, gamification, rewards 5 5 Requires at least: 2.2 6 Tested up to: 3.4. 17 Stable tag: 3. 1.16 Tested up to: 3.4.2 7 Stable tag: 3.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 CubePoints is a point management system designed for WordPress blogs.11 CubePoints is a point management system for WordPress. 12 12 13 13 == Description == 14 14 15 CubePoints is a point management system designed for WordPress blogs. Users can earn points by posting comments creating posts, or even by logging in on your site. 16 17 Encourage your users to comment on your posts by offering them points which could be used to purchase items / upgrades / etc. Users will be awarded a certain number of points for each comment they make. 18 19 A lot of API is available for other plugins/systems to work with CubePoints. For more information, consult the documentation. 15 CubePoints is a point management system for sites running on WordPress. Users can earn virtual credits on your site by posting comments, creating posts, or even by logging in each day! Install CubePoints and watch your visitor interaction soar by offering them points which could be used to view certain posts, exchange for downloads or even real items! 16 17 CubePoints is modular! And this means that it can be easily extended to offer more ways for your users to earn and spend points. APIs are also available for other plugins to work with CubePoints. 18 19 > #### CubePoints Support Forum 20 > Please visit the [CubePoints Support Forum](http://cubepoints.com/forums) for additional help with using this plugin. You may also post feature requests, ideas and bug reports there. 20 21 21 22 == Installation == … … 49 50 == Upgrade Notice == 50 51 52 = 3.2 = 53 New "Limit Comment Points" module added. "Donate" module updated. Several bugfixes to the "PayPal Top-up" module, "Custom Points" module and CubePoints core. 54 51 55 = 3.1.1 = 52 56 Translations for 11 locales added. Problems with RTL support, "PayPal Top-up" module & "Comment Spam Control" module fixed. … … 83 87 84 88 == Changelog == 89 90 **Version 3.2** *(November 16th, 2012)* 91 92 + [Feature] New "Limit Comment Points" module added 93 + [Change] Donate module updated with a new frontend interface 94 + [Bugfix] Fixed a bug in the "Custom Points" module which prevented it from working 95 + [Bugfix] Several bugfixes and and optimisations to the "PayPal Top-up" module 96 + [Bugfix] Code that produce E_NOTICE errors fixed 97 + [Bugfix] Fixes the issue where ajax requests in the admin back-end (e.g. updating points) fails to run if the administration over SSL is forced 85 98 86 99 **Version 3.1.1** *(July 13th, 2012)*
Note: See TracChangeset
for help on using the changeset viewer.