Changeset 1163297
- Timestamp:
- 05/19/2015 11:46:23 AM (11 years ago)
- Location:
- awesome-support/trunk
- Files:
-
- 10 edited
-
awesome-support.php (modified) (3 diffs)
-
class-awesome-support.php (modified) (13 diffs)
-
includes/addons/custom-fields/class-custom-fields.php (modified) (1 diff)
-
includes/admin/class-admin.php (modified) (3 diffs)
-
includes/admin/settings/functions-settings.php (modified) (1 diff)
-
includes/class-notification.php (modified) (2 diffs)
-
includes/functions-post.php (modified) (3 diffs)
-
includes/functions-user.php (modified) (25 diffs)
-
readme.txt (modified) (4 diffs)
-
vendor/composer/ClassLoader.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
awesome-support/trunk/awesome-support.php
r1160923 r1163297 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.1. 713 * Version: 3.1.8 14 14 * Author: ThemeAvenue 15 15 * Author URI: http://themeavenue.net … … 29 29 *----------------------------------------------------------------------------*/ 30 30 31 define( 'WPAS_VERSION', '3.1. 7' );31 define( 'WPAS_VERSION', '3.1.8' ); 32 32 define( 'WPAS_DB_VERSION', '1' ); 33 33 define( 'WPAS_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) ); … … 68 68 */ 69 69 register_activation_hook( __FILE__, array( 'Awesome_Support', 'activate' ) ); 70 register_deactivation_hook( __FILE__, array( 'Awesome_Support', 'deactivate' ) );71 70 72 71 /** -
awesome-support/trunk/class-awesome-support.php
r1160923 r1163297 58 58 add_action( 'wp', array( $this, 'get_replies_object' ), 10, 0 ); // Generate the object used for the custom loop for displaying ticket replies 59 59 add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ), 10, 0 ); // Activate plugin when new blog is added 60 add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ), 9, 0 ); // Load the plugin textdomain60 add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ), 11, 0 ); // Load the plugin textdomain 61 61 add_action( 'init', array( $this, 'init' ), 11, 0 ); // Register main post type 62 62 add_action( 'admin_bar_menu', array( $this, 'toolbar_tickets_link' ), 999, 1 ); // Add a link to agent's tickets in the toolbar 63 add_action( 'wp_ print_styles',array( $this, 'enqueue_styles' ), 10, 0 ); // Load public-facing style sheets64 add_action( 'wp_ print_scripts',array( $this, 'enqueue_scripts' ), 10, 0 ); // Load public-facing JavaScripts63 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ), 10, 0 ); // Load public-facing style sheets 64 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 10, 0 ); // Load public-facing JavaScripts 65 65 add_action( 'template_redirect', array( $this, 'redirect_archive' ), 10, 0 ); 66 66 add_action( 'wpas_after_registration_fields', array( $this, 'terms_and_conditions_checkbox' ), 10, 3 ); // Add terms & conditions checkbox … … 193 193 * Redirect to the newly created ticket 194 194 */ 195 $submit = wpas_get_option( 'ticket_submit' ); 195 196 wpas_redirect( 'ticket_added_failed', add_query_arg( array( 'message' => 6 ), get_permalink( $submit ) ), $submit ); 196 197 exit; … … 235 236 $can_submit_empty = apply_filters( 'wpas_can_reply_be_empty', false ); 236 237 238 /** 239 * Get the parent ticket ID. 240 */ 241 $parent_id = intval( $_POST['ticket_id'] ); 242 237 243 if ( empty( $_POST['wpas_user_reply'] ) && false === $can_submit_empty ) { 238 244 wpas_redirect( 'reply_not_added', add_query_arg( array( 'message' => wpas_create_notification( __( 'You cannot submit an empty reply.', 'wpas' ) ) ), get_permalink( $parent_id ) ), $parent_id ); 239 245 exit; 240 246 } 241 242 $parent_id = intval( $_POST['ticket_id'] );243 247 244 248 /* Sanitize the data */ … … 274 278 * 275 279 * @since 3.0.2 276 * @param null|WP_User $user User to authenticate. 277 * @param string $username User login 278 * @param string $password User password 279 * @return object WP_User if authentication succeed, WP_Error on failure 280 * 281 * @param WP_User|WP_Error|null $user User to authenticate. 282 * @param string $username User login 283 * @param string $password User password 284 * 285 * @return object WP_User if authentication succeed, WP_Error on failure 280 286 */ 281 287 public function email_signon( $user, $username, $password ) { … … 290 296 * we don' touch it and let WordPress handle it. 291 297 */ 292 if ( ! is_wp_error( $user ) ) {298 if ( ! is_wp_error( $user ) ) { 293 299 return $user; 294 300 } … … 306 312 * the error is probably legitimate. 307 313 */ 308 if ( ! is_email( $username ) ) {314 if ( ! is_email( $username ) ) { 309 315 return $user; 310 316 } … … 317 323 * so let's just return it. 318 324 */ 319 if ( false === $user_data || ! is_a( $user_data, 'WP_User' ) ) {325 if ( false === $user_data || ! is_a( $user_data, 'WP_User' ) ) { 320 326 return $user; 321 327 } … … 408 414 } else { 409 415 self::single_activate(); 410 }411 412 }413 414 /**415 * Fired when the plugin is deactivated.416 *417 * @since 1.0.0418 * @param boolean $network_wide True if WPMU superadmin uses419 * "Network Deactivate" action, false if420 * WPMU is disabled or plugin is421 * deactivated on an individual blog.422 */423 public static function deactivate( $network_wide ) {424 425 if ( function_exists( 'is_multisite' ) && is_multisite() ) {426 427 if ( $network_wide ) {428 429 // Get all blog ids430 $blog_ids = self::get_blog_ids();431 432 foreach ( $blog_ids as $blog_id ) {433 434 switch_to_blog( $blog_id );435 self::single_deactivate();436 437 }438 439 restore_current_blog();440 441 } else {442 self::single_deactivate();443 }444 445 } else {446 self::single_deactivate();447 416 } 448 417 … … 616 585 617 586 /** 618 * Fired for each blog when the plugin is deactivated.619 *620 * @since 1.0.0621 */622 private static function single_deactivate() {623 // @TODO: Define deactivation functionality here624 }625 626 /**627 587 * Load the plugin text domain for translation. 628 588 * 589 * @return boolean True if the language file was loaded, false otherwise 629 590 * @since 1.0.0 630 591 */ … … 652 613 } 653 614 654 load_plugin_textdomain( 'wpas', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );615 $language = load_plugin_textdomain( 'wpas', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 655 616 656 617 /** … … 660 621 $locale = $backup; 661 622 } 623 624 return $language; 662 625 663 626 } … … 866 829 * 867 830 * @since 3.0.0 868 * @param string $name Template name869 * @param string $template Path to the template that was loaded870 * @param array $args Extra arguments passed when loading the template831 * 832 * @param string $name Template name 833 * 871 834 * @return boolean True if the modal is loaded, false otherwise 872 835 */ 873 public function terms_and_conditions_modal( $name , $template, $args) {836 public function terms_and_conditions_modal( $name ) { 874 837 875 838 if ( 'registration' !== $name ) { 876 839 return false; 877 840 } 878 879 global $post;880 841 881 842 $terms = wpas_get_option( 'terms_conditions', '' ); … … 990 951 * @return void 991 952 */ 992 public function credit( $name, $template, $args) {953 public function credit() { 993 954 echo '<p class="wpas-credit">Built with Awesome Support,<br> the most versatile <a href="https://wordpress.org/plugins/awesome-support/" target="_blank" title="The best support plugin for WordPress">WordPress Support Plugin</a></p>'; 994 955 } -
awesome-support/trunk/includes/addons/custom-fields/class-custom-fields.php
r1160923 r1163297 116 116 $option = array( 'name' => $name, 'args' => $arguments ); 117 117 118 $this->options[$name] = $option;118 $this->options[$name] = apply_filters( 'wpas_add_field', $option ); 119 119 120 120 } -
awesome-support/trunk/includes/admin/class-admin.php
r1160923 r1163297 213 213 214 214 /* Make sure this is the main query */ 215 if ( ! $query->is_main_query() ) {215 if ( ! $query->is_main_query() ) { 216 216 return false; 217 217 } 218 218 219 219 /* Make sure this is the admin screen */ 220 if ( ! is_admin() ) {220 if ( ! is_admin() ) { 221 221 return false; 222 222 } … … 228 228 229 229 /* If admins can see all tickets do nothing */ 230 if ( current_user_can( 'administrator' ) && true === boolval( wpas_get_option( 'admin_see_all' )) ) {230 if ( current_user_can( 'administrator' ) && true === (bool) wpas_get_option( 'admin_see_all' ) ) { 231 231 return false; 232 232 } 233 233 234 234 /* If agents can see all tickets do nothing */ 235 if ( current_user_can( 'edit_ticket' ) && ! current_user_can( 'administrator' ) && true === boolval( wpas_get_option( 'agent_see_all' )) ) {235 if ( current_user_can( 'edit_ticket' ) && ! current_user_can( 'administrator' ) && true === (bool) wpas_get_option( 'agent_see_all' ) ) { 236 236 return false; 237 237 } … … 239 239 global $current_user; 240 240 241 $query->set( 'meta_query', array( 242 array( 243 'key' => '_wpas_assignee', 244 'value' => $current_user->ID, 245 'compare' => '=', 246 ) ) 247 ); 241 $query->set( 'meta_key', '_wpas_assignee' ); 242 $query->set( 'meta_value', (int) $current_user->ID ); 248 243 249 244 return true; -
awesome-support/trunk/includes/admin/settings/functions-settings.php
r1114456 r1163297 38 38 39 39 /** 40 * List users.41 *42 * Returns a list of users based on the required43 * capability. If the capability is "all", all site44 * users are returned.45 *46 * @param string $cap Minimum capability the user must have to be added to the list47 * @return array A list of users48 * @since 3.0.049 */50 function wpas_list_users( $cap = 'all' ) {51 52 $list = array();53 54 /* List all users */55 $all_users = get_users();56 57 foreach( $all_users as $user ) {58 59 /* Exclude agents */60 if( 'all' == $cap || ( 'all' != $cap && $user->has_cap( $cap ) ) ) {61 62 $user_id = $user->ID;63 $user_name = $user->data->display_name;64 $list[$user_id] = $user_name;65 66 }67 68 }69 70 return apply_filters( 'wpas_users_list', $list );71 72 }73 74 /**75 40 * Get themes list. 76 41 * -
awesome-support/trunk/includes/class-notification.php
r1160923 r1163297 231 231 * predefined or customized by the user. 232 232 * 233 * @param string $case Type of notification234 * @param string$message Message to display235 * @param boolean $echo Whether to echo or return the notification233 * @param string $case Type of notification 234 * @param boolean|string $message Message to display 235 * @param boolean $echo Whether to echo or return the notification 236 236 * 237 237 * @return void|string Notification (with markup) … … 239 239 * @since 3.0.0 240 240 */ 241 function wpas_notification( $case, $message , $echo = true ) {241 function wpas_notification( $case, $message = '', $echo = true ) { 242 242 243 243 $notification = new WPAS_Notification( $case, $message ); -
awesome-support/trunk/includes/functions-post.php
r1160923 r1163297 733 733 } 734 734 735 $users = get_users( array( 'orderby' => 'wpas_random' ) ); // We use a unique and non-existing orderby parameter so that we can identify the query in pre_user_query 735 $users = get_transient( 'wpas_list_agents' ); 736 737 if ( false === $users ) { 738 $users = get_users( array( 'orderby' => 'wpas_random' ) ); // We use a unique and non-existing orderby parameter so that we can identify the query in pre_user_query 739 set_transient( 'wpas_list_agents', $users, 24 * 60 * 60 ); 740 } 741 736 742 $agent = array(); 737 743 … … 776 782 777 783 } 778 784 779 785 } 780 786 … … 808 814 809 815 if ( !user_can( $agent_id, 'edit_ticket' ) ) { 810 return new WP_Error( 'incorrect_agent', __( 'The chosen agent does not have the sufficient capa pbilities to be assigned a ticket', 'wpas' ) );816 return new WP_Error( 'incorrect_agent', __( 'The chosen agent does not have the sufficient capabilities to be assigned a ticket', 'wpas' ) ); 811 817 } 812 818 -
awesome-support/trunk/includes/functions-user.php
r1160923 r1163297 2 2 /** 3 3 * Register user account. 4 * 5 * @param array|bool $data User data 4 6 * 5 7 * @since 1.0.0 … … 14 16 15 17 if ( true !== $registration ) { 16 wp_redirect( add_query_arg( array( 'message' => wpas_create_notification( __( 'Registrations are currently not allowed.', 'wpas' ) ), get_permalink( $post->ID ) ) ) ); 18 wp_redirect( add_query_arg( array( 19 'message' => wpas_create_notification( __( 'Registrations are currently not allowed.', 'wpas' ) ), 20 get_permalink( $post->ID ) 21 ) ) ); 17 22 exit; 18 23 } … … 22 27 } 23 28 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;29 $email = isset( $data['email'] ) && ! empty( $data['email'] ) ? sanitize_email( $data['email'] ) : false; 30 $first_name = isset( $data['first_name'] ) && ! empty( $data['first_name'] ) ? sanitize_text_field( $data['first_name'] ) : false; 31 $last_name = isset( $data['last_name'] ) && ! empty( $data['last_name'] ) ? sanitize_text_field( $data['last_name'] ) : false; 32 $pwd = isset( $data['pwd'] ) && ! empty( $data['pwd'] ) ? $data['pwd'] : false; 28 33 29 34 /* Save the user information in session to pre populate the form in case of error. */ … … 44 49 do_action( 'wpas_pre_register_account', $data ); 45 50 46 if ( wpas_get_option( 'terms_conditions', false ) && !isset( $data['terms'] ) ) { 47 wp_redirect( add_query_arg( array( 'message' => wpas_create_notification( __( 'You did not accept the terms and conditions.', 'wpas' ) ), get_permalink( $post->ID ) ) ) ); 51 if ( wpas_get_option( 'terms_conditions', false ) && ! isset( $data['terms'] ) ) { 52 wp_redirect( add_query_arg( array( 53 'message' => wpas_create_notification( __( 'You did not accept the terms and conditions.', 'wpas' ) ), 54 get_permalink( $post->ID ) 55 ) ) ); 48 56 exit; 49 57 } … … 51 59 /* Make sure we have all the necessary data. */ 52 60 if ( false === ( $email || $first_name || $last_name || $pwd ) ) { 53 wp_redirect( add_query_arg( array( 'message' => wpas_create_notification( __( 'You didn\'t correctly fill all the fields.', 'wpas' ) ), get_permalink( $post->ID ) ) ) ); 61 wp_redirect( add_query_arg( array( 62 'message' => wpas_create_notification( __( 'You didn\'t correctly fill all the fields.', 'wpas' ) ), 63 get_permalink( $post->ID ) 64 ) ) ); 54 65 exit; 55 66 } … … 63 74 do { 64 75 $alt_username = sanitize_user( $username . $suffix ); 65 $user = get_user_by( 'login', $alt_username );66 $suffix ++;67 } while ( is_a( $user, 'WP_User' ));76 $user = get_user_by( 'login', $alt_username ); 77 $suffix ++; 78 } while ( is_a( $user, 'WP_User' ) ); 68 79 $username = $alt_username; 69 80 } … … 106 117 107 118 $error = $user_id->get_error_message(); 108 wp_redirect( add_query_arg( array( 'message' => wpas_create_notification( $error ), get_permalink( $post->ID ) ) ) ); 119 wp_redirect( add_query_arg( array( 120 'message' => wpas_create_notification( $error ), 121 get_permalink( $post->ID ) 122 ) ) ); 109 123 exit; 110 124 … … 126 140 127 141 if ( headers_sent() ) { 128 wp_redirect( add_query_arg( array( 'message' => wpas_create_notification( __( 'Your account has been created. Please log-in.', 'wpas' ) ), get_permalink( $post->ID ) ) ) ); 142 wp_redirect( add_query_arg( array( 143 'message' => wpas_create_notification( __( 'Your account has been created. Please log-in.', 'wpas' ) ), 144 get_permalink( $post->ID ) 145 ) ) ); 129 146 exit; 130 147 } 131 148 132 if ( ! is_user_logged_in() ) {149 if ( ! is_user_logged_in() ) { 133 150 134 151 /* Automatically log the user in */ 135 152 wp_set_current_user( $user_id, $email ); 136 153 wp_set_auth_cookie( $user_id ); 137 154 138 155 wp_redirect( get_permalink( $post->ID ) ); 139 156 exit; … … 153 170 * 154 171 * @since 3.0.0 172 * 155 173 * @param string $field Name of the field to get the value for 174 * 156 175 * @return string The sanitized field value if any, an empty string otherwise 157 176 */ 158 177 function wpas_get_registration_field_value( $field ) { 159 178 160 if ( isset( $_SESSION ) && isset( $_SESSION['wpas_registration_form'][$field] ) ) {161 return sanitize_text_field( $_SESSION['wpas_registration_form'][ $field] );179 if ( isset( $_SESSION ) && isset( $_SESSION['wpas_registration_form'][ $field ] ) ) { 180 return sanitize_text_field( $_SESSION['wpas_registration_form'][ $field ] ); 162 181 } else { 163 182 return ''; … … 181 200 if ( isset( $_POST['log'] ) ) { 182 201 183 $login = $_POST['log'];184 $pwd = isset( $_POST['pwd'] ) ? $_POST['pwd'] : '';185 202 $login = wp_signon(); 186 203 … … 189 206 wp_redirect( add_query_arg( array( 'message' => urlencode( base64_encode( json_encode( $error ) ) ) ), get_permalink( $post->ID ) ) ); 190 207 exit; 191 } elseif ( is_a( $login, 'WP_User' ) ) {208 } elseif ( is_a( $login, 'WP_User' ) ) { 192 209 wp_redirect( get_permalink( $post->ID ) ); 193 210 exit; … … 205 222 * 206 223 * @since 2.0.0 224 * 207 225 * @param integer $post_id ID of the post to display 226 * 208 227 * @return boolean 209 228 */ … … 211 230 212 231 /* Only logged in users can view */ 213 if ( ! is_user_logged_in() ) {232 if ( ! is_user_logged_in() ) { 214 233 return false; 215 234 } 216 235 217 if ( ! current_user_can( 'view_ticket' ) ) {236 if ( ! current_user_can( 'view_ticket' ) ) { 218 237 return false; 219 238 } … … 238 257 * 239 258 * @since 2.0.0 259 * 240 260 * @param boolean $admins_allowed Shall admins/agents be allowed to reply from the frontend 241 261 * @param integer $post_id ID of the ticket to check 262 * 242 263 * @return boolean True if the user can reply 243 264 */ … … 249 270 } 250 271 251 $admins_allowed = apply_filters( 'wpas_can_agent_reply_frontend', false); /* Allow admins to post through front-end. The filter overwrites the function parameter. */272 $admins_allowed = apply_filters( 'wpas_can_agent_reply_frontend', $admins_allowed ); /* Allow admins to post through front-end. The filter overwrites the function parameter. */ 252 273 $post = get_post( $post_id ); 253 274 $author_id = $post->post_author; 254 $reply = wpas_get_option( 'ticket_can_reply', 'author' );255 275 256 276 if ( is_user_logged_in() ) { … … 258 278 global $current_user; 259 279 260 if ( ! current_user_can( 'reply_ticket' ) ) {280 if ( ! current_user_can( 'reply_ticket' ) ) { 261 281 return false; 262 282 } 263 283 264 $usr_mail = $current_user->data->user_email; 265 $user_id = $current_user->data->ID; 284 $user_id = $current_user->data->ID; 266 285 267 286 /* If the current user is the author then yes */ 268 if ( $user_id == $author_id ) {287 if ( $user_id == $author_id ) { 269 288 return true; 270 289 } else { 271 290 272 if ( current_user_can( 'edit_ticket' ) && true === $admins_allowed ) {291 if ( current_user_can( 'edit_ticket' ) && true === $admins_allowed ) { 273 292 return true; 274 293 } else { … … 288 307 * 289 308 * @since 3.0.0 309 * 290 310 * @param string $role User role 311 * 291 312 * @return string Nicely formatted user role 292 313 */ … … 301 322 $role = str_replace( array( '-', '_' ), ' ', $role ); 302 323 303 /* Uppercase each first letter */304 324 return ucwords( $role ); 305 325 … … 311 331 312 332 return apply_filters( 'wpas_can_submit_ticket', $can ); 333 334 } 335 336 /** 337 * Get a list of users that belong to the plugin. 338 * 339 * @param array $args Arguments used to filter the users 340 * 341 * @return array An array of users objects 342 * @since 3.1.8 343 */ 344 function wpas_get_users( $args = array() ) { 345 346 $defaults = array( 347 'exclude' => array(), 348 'cap' => '', 349 'cap_exclude' => '', 350 ); 351 352 /* The array where we save all users we want to keep. */ 353 $list = array(); 354 355 /* Merge arguments. */ 356 $args = wp_parse_args( $args, $defaults ); 357 358 /* Get the hash of the arguments that's used for caching the result. */ 359 $hash = md5( serialize( $args ) ); 360 361 /* Check if we have a result already cached. */ 362 $result = get_transient( "wpas_list_users_$hash" ); 363 364 /* If there is a cached result we return it and don't run the expensive query. */ 365 if ( false !== $result ) { 366 return apply_filters( 'wpas_get_users', $result ); 367 } 368 369 /* Get all WordPress users */ 370 $all_users = get_users(); 371 372 /* Loop through the users list and filter them */ 373 foreach ( $all_users as $user ) { 374 375 /* Check for required capability */ 376 if ( ! empty( $cap ) ) { 377 if ( ! $user->has_cap( $args['cap'] ) ) { 378 continue; 379 } 380 } 381 382 /* Check for excluded capability */ 383 if ( ! empty( $cap_exclude ) ) { 384 if ( $user->has_cap( $args['cap_exclude'] ) ) { 385 continue; 386 } 387 } 388 389 /* Maybe exclude this user from the list */ 390 if ( in_array( $user->ID, (array) $args['exclude'] ) ) { 391 continue; 392 } 393 394 /* Now we add this user to our final list. */ 395 array_push( $list, $user ); 396 397 } 398 399 /* Let's cache the result so that we can avoid running this query too many times. */ 400 set_transient( "wpas_list_users_$hash", $list, apply_filters( 'wpas_list_users_cache_expiration', 60 * 60 * 24 ) ); 401 402 return apply_filters( 'wpas_get_users', $list ); 403 404 } 405 406 /** 407 * List users. 408 * 409 * Returns a list of users based on the required 410 * capability. If the capability is "all", all site 411 * users are returned. 412 * 413 * @param string $cap Minimum capability the user must have to be added to the list 414 * 415 * @return array A list of users 416 * @since 3.0.0 417 */ 418 function wpas_list_users( $cap = 'all' ) { 419 420 $list = array(); 421 422 /* List all users */ 423 $all_users = wpas_get_users( array( 'cap' => $cap ) ); 424 425 foreach ( $all_users as $user ) { 426 $user_id = $user->ID; 427 $user_name = $user->data->display_name; 428 $list[ $user_id ] = $user_name; 429 } 430 431 return apply_filters( 'wpas_users_list', $list ); 313 432 314 433 } … … 339 458 ); 340 459 341 extract( wp_parse_args( $args, $defaults ));460 $args = wp_parse_args( $args, $defaults ); 342 461 343 462 /* List all users */ 344 $all_users = get_users();463 $all_users = wpas_get_users( array( 'cap' => $args['cap'], 'cap_exclude' => $args['cap_exclude'], 'exclude' => $args['exclude'] ) ); 345 464 346 465 /** … … 352 471 $marker = false; 353 472 354 $options = ''; 355 $current_id = $current_user->ID; 356 $current_name = $current_user->data->user_nicename; 357 $current_sel = ( $current_id == $post->post_author ) ? "selected='selected'" : ''; 473 $options = ''; 358 474 359 475 /* The ticket is being created, use the current user by default */ 360 if ( ! empty( $selected) ) {361 $user = get_user_by( 'id', intval( $ selected) );476 if ( ! empty( $args['selected'] ) ) { 477 $user = get_user_by( 'id', intval( $args['selected'] ) ); 362 478 if ( false !== $user && ! is_wp_error( $user ) ) { 363 $marker = true;479 $marker = true; 364 480 $options .= "<option value='{$user->ID}' selected='selected'>{$user->data->display_name}</option>"; 365 481 } … … 368 484 foreach ( $all_users as $user ) { 369 485 370 /* Check for required capability */371 if ( !empty( $cap ) ) {372 if ( ! $user->has_cap( $cap ) ) {373 continue;374 }375 }376 377 /* Check for excluded capability */378 if ( !empty( $cap_exclude ) ) {379 if ( $user->has_cap( $cap_exclude ) ) {380 continue;381 }382 }383 384 /* Maybe exclude this user from the list */385 if ( in_array( $user->ID, (array) $exclude ) ) {386 continue;387 }388 389 486 /* This user was already added, skip it */ 390 if ( ! empty( $ selected ) && $user->ID === intval( $selected) ) {487 if ( ! empty( $args['selected'] ) && $user->ID === intval( $args['selected'] ) ) { 391 488 continue; 392 489 } … … 397 494 398 495 if ( false === $marker ) { 399 if ( false !== $ selected) {400 if ( ! empty( $selected) ) {401 if ( $ selected=== $user_id ) {496 if ( false !== $args['selected'] ) { 497 if ( ! empty( $args['selected'] ) ) { 498 if ( $args['selected'] === $user_id ) { 402 499 $selected_attr = 'selected="selected"'; 403 500 } … … 411 508 412 509 /* Set the marker as true to avoid selecting more than one user */ 413 if ( ! empty( $selected_attr ) ) {510 if ( ! empty( $selected_attr ) ) { 414 511 $marker = true; 415 512 } … … 421 518 422 519 /* In case there is no selected user yet we add the post author, or the currently logged user (most likely an admin) */ 423 if ( true === $a gent_fallback&& false === $marker ) {520 if ( true === $args['agent_fallback'] && false === $marker ) { 424 521 $fallback = $current_user; 425 522 $fb_selected = false === $marker ? 'selected="selected"' : ''; 426 $options .= "<option value='{$fallback->ID}' $fb_selected>{$fallback->data->display_name}</option>";427 } 428 429 $contents = wpas_dropdown( wp_parse_args( $args, $defaults ), $options ); 523 $options .= "<option value='{$fallback->ID}' $fb_selected>{$fallback->data->display_name}</option>"; 524 } 525 526 $contents = wpas_dropdown( wp_parse_args( $args, $defaults ), $options ); 430 527 431 528 return $contents; -
awesome-support/trunk/readme.txt
r1160923 r1163297 6 6 Requires at least: 3.5.1 7 7 Tested up to: 4.3 8 Stable tag: 3.1. 78 Stable tag: 3.1.8 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 14 14 == Description == 15 15 16 Awesome Support is the most advanced support plugin for WordPress. It is the result of two years of work, research, and improvement. Most of its features are an answer to user requests for a helpdesk and that's what makes it the best support plugin for WordPress. 17 16 18 https://www.youtube.com/watch?v=IdSOWQI3tWU 17 18 Awesome Support is the most advanced support plugin for WordPress. It is the result of two years of work, research, and improvement. Most of its features are an answer to user requests for a helpdesk and that's what makes it the best support plugin for WordPress.19 19 20 20 For support please visit the [official site](http://getawesomesupport.com). … … 153 153 == Changelog == 154 154 155 = 3.1.8 - 2015-05-19 = 156 157 * Features 158 * Ticket submission on front-end is now about 50% faster 159 * Significant performance improvement in the back-end 160 161 * Bugfixes: 162 * Fix the PHP warning on ticket submission 163 * Hide others tickets in admin if set this way in the settings 164 * Fix issue with translations not working on some sites 165 155 166 = 3.1.7 - 2015-05-15 = 156 167 … … 164 175 * Persian translation 165 176 * Romanian translation 166 177 167 178 * Bugfixes: 168 179 * Critical XSS vulnerability with custom information messages - props Anton Kulpinov -
awesome-support/trunk/vendor/composer/ClassLoader.php
r1114456 r1163297 352 352 if (0 === strpos($class, $prefix)) { 353 353 foreach ($this->prefixDirsPsr4[$prefix] as $dir) { 354 if ( file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {354 if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { 355 355 return $file; 356 356 } … … 362 362 // PSR-4 fallback dirs 363 363 foreach ($this->fallbackDirsPsr4 as $dir) { 364 if ( file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {364 if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { 365 365 return $file; 366 366 } … … 381 381 if (0 === strpos($class, $prefix)) { 382 382 foreach ($dirs as $dir) { 383 if ( file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {383 if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { 384 384 return $file; 385 385 } … … 391 391 // PSR-0 fallback dirs 392 392 foreach ($this->fallbackDirsPsr0 as $dir) { 393 if ( file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {393 if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { 394 394 return $file; 395 395 }
Note: See TracChangeset
for help on using the changeset viewer.