Changeset 1049994
- Timestamp:
- 12/20/2014 04:06:57 AM (11 years ago)
- Location:
- awesome-support/trunk
- Files:
-
- 10 edited
-
awesome-support.php (modified) (2 diffs)
-
class-awesome-support.php (modified) (2 diffs)
-
includes/addons/custom-fields/class-display.php (modified) (4 diffs)
-
includes/admin/class-admin.php (modified) (1 diff)
-
includes/class-notification.php (modified) (2 diffs)
-
includes/functions-general.php (modified) (1 diff)
-
includes/functions-post.php (modified) (1 diff)
-
includes/functions-user.php (modified) (5 diffs)
-
includes/shortcodes/shortcode-submit.php (modified) (1 diff)
-
includes/shortcodes/shortcode-tickets.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
awesome-support/trunk/awesome-support.php
r1048776 r1049994 11 11 * Plugin URI: http://getawesomesupport.com 12 12 * Description: Awesome Support is a great ticketing system that will help you improve your customer satisfaction by providing a unique customer support experience. 13 * Version: 3.0. 013 * Version: 3.0.1 14 14 * Author: ThemeAvenue 15 15 * Author URI: http://themeavenue.net … … 29 29 *----------------------------------------------------------------------------*/ 30 30 31 define( 'WPAS_VERSION', '3.0. 0' );31 define( 'WPAS_VERSION', '3.0.1' ); 32 32 define( 'WPAS_DB_VERSION', '1' ); 33 33 define( 'WPAS_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) ); -
awesome-support/trunk/class-awesome-support.php
r1048776 r1049994 30 30 */ 31 31 private function __construct() { 32 33 /**34 * Ticket post type slug.35 *36 * @since 1.0.037 * @var string38 */39 $this->slug = 'ticket';40 32 41 33 add_action( 'plugins_loaded', array( 'WPAS_Ticket_Post_Type', 'get_instance' ), 11 ); … … 107 99 */ 108 100 if ( isset( $_POST['wpas_registration'] ) ) { 109 add_action( 'wp', 'wpas_register_account' );101 add_action( 'wp', 'wpas_register_account', 10, 0 ); 110 102 } 111 103 -
awesome-support/trunk/includes/addons/custom-fields/class-display.php
r1048776 r1049994 91 91 global $post; 92 92 93 $field_id = 'wpas_' . $field['name']; 94 $label = wpas_get_field_title( $field ); 95 $current = get_the_terms( $post->ID, sanitize_text_field( $field['name'] ) ); 96 $terms = get_terms( sanitize_text_field( $field['name'] ), array( 'hide_empty' => 0 ) ); 97 $value = ''; 93 $field_id = 'wpas_' . $field['name']; 94 $label = wpas_get_field_title( $field ); 95 $current = get_the_terms( $post->ID, sanitize_text_field( $field['name'] ) ); 96 $terms = get_terms( sanitize_text_field( $field['name'] ), array( 'hide_empty' => 0 ) ); 97 $value = ''; 98 $ordered_terms = array(); 98 99 99 100 if ( is_array( $current ) ) { … … 109 110 return; 110 111 } 112 113 /** 114 * Re-order the terms hierarchically. 115 */ 116 wpas_sort_terms_hierarchicaly( $terms, $ordered_terms ); 111 117 ?> 112 118 … … 120 126 121 127 <?php 122 foreach ( $terms as $term ) { ?>123 <option value="<?php echo $term->slug; ?>" <?php if( $term->slug == $value ) { echo 'selected="selected"'; } ?>><?php echo $term->name; ?></option>124 <?php} ?>128 foreach ( $ordered_terms as $term ) { 129 wpas_hierarchical_taxonomy_dropdown_options( $term, $value ); 130 } ?> 125 131 126 132 </select> … … 189 195 190 196 } 197 198 /** 199 * Recursively sort an array of taxonomy terms hierarchically. Child categories will be 200 * placed under a 'children' member of their parent term. 201 * 202 * @since 3.0.1 203 * @param Array $cats taxonomy term objects to sort 204 * @param Array $into result array to put them in 205 * @param integer $parentId the current parent ID to put them in 206 * @link http://wordpress.stackexchange.com/a/99516/16176 207 */ 208 function wpas_sort_terms_hierarchicaly( Array &$cats, Array &$into, $parentId = 0 ) { 209 210 foreach ($cats as $i => $cat) { 211 if ($cat->parent == $parentId) { 212 $into[$cat->term_id] = $cat; 213 unset($cats[$i]); 214 } 215 } 216 217 foreach ($into as $topCat) { 218 $topCat->children = array(); 219 wpas_sort_terms_hierarchicaly( $cats, $topCat->children, $topCat->term_id ); 220 } 221 } 222 223 /** 224 * Recursively displays hierarchical options into a select dropdown. 225 * 226 * @since 3.0.1 227 * @param object $term The term to display 228 * @param string $value The value to compare against 229 * @return void 230 */ 231 function wpas_hierarchical_taxonomy_dropdown_options( $term, $value, $level = 1 ) { 232 233 $option = ''; 234 235 /* Add a visual indication that this is a child term */ 236 if ( 1 !== $level ) { 237 for ( $i = 1; $i < ( $level - 1 ); $i++ ) { 238 $option .= ' '; 239 } 240 $option .= '∟ '; 241 } 242 243 $option .= $term->name; 244 ?> 245 246 <option value="<?php echo $term->slug; ?>" <?php if( $term->slug == $value ) { echo 'selected="selected"'; } ?>><?php echo $option; ?></option> 247 248 <?php if ( isset( $term->children ) && !empty( $term->children ) ) { 249 ++$level; 250 foreach ( $term->children as $child ) { 251 wpas_hierarchical_taxonomy_dropdown_options( $child, $value, $level ); 252 } 253 } 254 255 } -
awesome-support/trunk/includes/admin/class-admin.php
r1048776 r1049994 64 64 require_once( WPAS_PATH . 'includes/admin/class-admin-titan.php' ); 65 65 require_once( WPAS_PATH . 'includes/admin/class-admin-help.php' ); 66 require_once( WPAS_PATH . 'includes/class-remote-notification-client.php' ); 66 67 if ( !class_exists( 'TAV_Remote_Notification_Client' ) ) { 68 require_once( WPAS_PATH . 'includes/class-remote-notification-client.php' ); 69 } 67 70 68 71 /* Load settings files */ -
awesome-support/trunk/includes/class-notification.php
r1048776 r1049994 117 117 if ( is_null( $this->message ) || false === $this->case ) { 118 118 return false; 119 } 120 121 return $this->template(); 119 } 120 121 ob_start(); 122 $this->template(); 123 $notification = ob_get_clean(); 124 125 return $notification; 122 126 123 127 } … … 239 243 240 244 if( true === $echo ) { 241 echo $notification->notify( $case, $message);245 echo $notification->notify(); 242 246 } 243 247 244 248 else { 245 return $notification->notify( $case, $message);249 return $notification->notify(); 246 250 } 247 251 -
awesome-support/trunk/includes/functions-general.php
r1048776 r1049994 13 13 14 14 /* Return option value if exists */ 15 if ( isset( $options[$option] ) ) { 16 return apply_filters( 'wpas_option_' . $option, $options[$option] ); 17 } 18 19 /* Otherwise return $default value */ 20 else { 21 return $default; 22 } 15 $value = isset( $options[$option] ) ? $options[$option] : $default; 16 17 return apply_filters( 'wpas_option_' . $option, $value ); 23 18 24 19 } -
awesome-support/trunk/includes/functions-post.php
r1048776 r1049994 94 94 95 95 /* Redirect to submit page */ 96 wp_redirect( add_query_arg( array( 'message' => urlencode( base64_encode( json_encode( $messages ) ) ) ), get_permalink( $submit) ) );96 wp_redirect( add_query_arg( array( 'message' => wpas_create_notification( $messages ), get_permalink( $submit ) ) ) ); 97 97 98 98 exit; -
awesome-support/trunk/includes/functions-user.php
r1048776 r1049994 6 6 * @return void 7 7 */ 8 function wpas_register_account( ) {8 function wpas_register_account( $data = false ) { 9 9 10 10 global $post; … … 18 18 } 19 19 20 $email = isset( $_POST['email'] ) && !empty( $_POST['email'] ) ? sanitize_email( $_POST['email'] ) : false; 21 $first_name = isset( $_POST['first_name'] ) && !empty( $_POST['first_name'] ) ? sanitize_text_field( $_POST['first_name'] ) : false; 22 $last_name = isset( $_POST['last_name'] ) && !empty( $_POST['last_name'] ) ? sanitize_text_field( $_POST['last_name'] ) : false; 23 $pwd = isset( $_POST['pwd'] ) && !empty( $_POST['pwd'] ) ? $_POST['pwd'] : false; 24 $pwd2 = isset( $_POST['pwd-validate'] ) && !empty( $_POST['pwd-validate'] ) ? $_POST['pwd-validate'] : false; 20 if ( false === $data ) { 21 $data = $_POST; 22 } 23 24 $email = isset( $data['email'] ) && !empty( $data['email'] ) ? sanitize_email( $data['email'] ) : false; 25 $first_name = isset( $data['first_name'] ) && !empty( $data['first_name'] ) ? sanitize_text_field( $data['first_name'] ) : false; 26 $last_name = isset( $data['last_name'] ) && !empty( $data['last_name'] ) ? sanitize_text_field( $data['last_name'] ) : false; 27 $pwd = isset( $data['pwd'] ) && !empty( $data['pwd'] ) ? $data['pwd'] : false; 28 $pwd2 = isset( $data['pwd-validate'] ) && !empty( $data['pwd-validate'] ) ? $data['pwd-validate'] : false; 25 29 26 30 /* Save the user information in session to pre populate the form in case of error. */ … … 31 35 ); 32 36 33 if ( wpas_get_option( 'terms_conditions', false ) && !isset( $_POST['terms'] ) ) { 37 /** 38 * wpas_pre_register_account hook 39 * 40 * This hook is triggered all the time 41 * even if the checks don't pass. 42 * 43 * @since 3.0.1 44 */ 45 do_action( 'wpas_pre_register_account', $data ); 46 47 if ( wpas_get_option( 'terms_conditions', false ) && !isset( $data['terms'] ) ) { 34 48 wp_redirect( add_query_arg( array( 'message' => wpas_create_notification( __( 'You did not accept the terms and conditions.', 'wpas' ) ), get_permalink( $post->ID ) ) ) ); 35 49 exit; … … 72 86 ); 73 87 88 /** 89 * wpas_register_account_before hook 90 * 91 * Fired right before the user is added to the database. 92 */ 93 do_action( 'wpas_register_account_before', $args ); 94 74 95 $user_id = wp_insert_user( apply_filters( 'wpas_user_registration_data', $args ) ); 75 96 76 97 if ( is_wp_error( $user_id ) ) { 98 99 /** 100 * wpas_register_account_before hook 101 * 102 * Fired right after a failed attempt to register a user. 103 * 104 * @since 3.0.1 105 */ 106 do_action( 'wpas_register_account_failed', $user_id, $args ); 77 107 78 108 $error = $user_id->get_error_message(); … … 81 111 82 112 } else { 113 114 /** 115 * wpas_register_account_before hook 116 * 117 * Fired right after the user is successfully added to the database. 118 * 119 * @since 3.0.1 120 */ 121 do_action( 'wpas_register_account_after', $user_id, $args ); 83 122 84 123 /* Delete the user information data from session. */ -
awesome-support/trunk/includes/shortcodes/shortcode-submit.php
r1048776 r1049994 24 24 */ 25 25 do_action( 'wpas_frontend_plugin_page_top', $post->ID, $post ); 26 27 if ( isset( $_GET['message'] ) ) {28 wpas_notification( 'decode', $_GET['message'] );29 }30 26 31 27 /* If user is not logged in we display the register form */ -
awesome-support/trunk/includes/shortcodes/shortcode-tickets.php
r1048776 r1049994 6 6 function wpas_sc_client_account() { 7 7 8 global $wpas_tickets, $current_user ;8 global $wpas_tickets, $current_user, $post; 9 9 10 10 /**
Note: See TracChangeset
for help on using the changeset viewer.