Changeset 1052708
- Timestamp:
- 12/23/2014 03:16:48 PM (11 years ago)
- Location:
- usernoise/trunk/inc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
usernoise/trunk/inc/form.php
r972173 r1052708 23 23 </div> 24 24 <?php endif ?> 25 <?php $un_h->textarea('description', un_get_option(UN_FEEDBACK_TEXTAREA_PLACEHOLDER), array('id' => 'un-description', 'class' => 'text text-empty'))?>25 <?php $un_h->textarea('description', __(un_get_option(UN_FEEDBACK_TEXTAREA_PLACEHOLDER), 'usernoise'), array('id' => 'un-description', 'class' => 'text text-empty'))?> 26 26 <?php if (un_get_option(UN_FEEDBACK_FORM_SHOW_SUMMARY)): ?> 27 <?php $un_h->text_field('title', un_get_option(UN_FEEDBACK_SUMMARY_PLACEHOLDER), array('id' => 'un-title', 'class' => 'text text-empty'))?>27 <?php $un_h->text_field('title', __(un_get_option(UN_FEEDBACK_SUMMARY_PLACEHOLDER), 'usernoise'), array('id' => 'un-title', 'class' => 'text text-empty'))?> 28 28 <?php endif ?> 29 29 <?php if (un_get_option(UN_FEEDBACK_FORM_SHOW_EMAIL)): ?> -
usernoise/trunk/inc/model.php
r950056 r1052708 1 1 <?php 2 2 class UN_Model{ 3 3 4 4 public function __construct(){ 5 5 add_action('init', array($this, 'action_init')); … … 7 7 add_filter('un_feedback_post_type_params', array($this, 'filter_un_feedback_post_type_params')); 8 8 } 9 9 10 10 11 11 public function action_init(){ … … 15 15 $this->register_schema(); 16 16 } 17 17 18 18 function register_schema(){ 19 register_taxonomy(FEEDBACK_TYPE, FEEDBACK, 19 register_taxonomy(FEEDBACK_TYPE, FEEDBACK, 20 20 apply_filters('un_feedback_type_taxonomy_params', array( 21 21 'public' => false, … … 48 48 ))); 49 49 } 50 50 51 51 public function filter_un_feedback_post_type_params($params){ 52 52 $params['supports'] = array(null); 53 53 return $params; 54 54 } 55 55 56 56 public function validate_feedback_form($params){ 57 57 $errors = array(); … … 63 63 $email = trim(isset($params['email']) ? $params['email'] : ''); 64 64 $name = trim(isset($params['name']) ? $params['name'] : ''); 65 if (un_get_option(UN_FEEDBACK_FORM_SHOW_EMAIL) && empty($email) && !is_user_logged_in() || 65 if (un_get_option(UN_FEEDBACK_FORM_SHOW_EMAIL) && empty($email) && !is_user_logged_in() || 66 66 $email && !is_email($email)) 67 67 $errors []= __('Please enter a valid email address.', 'usernoise'); … … 70 70 return apply_filters('un_validate_feedback', $errors, $params); 71 71 } 72 72 73 73 public function create_feedback($params){ 74 74 global $un_settings; … … 98 98 $this->send_admin_message($id, $params); 99 99 } 100 100 101 101 public function send_admin_message($id, $params){ 102 102 if (!un_get_option(UN_ADMIN_NOTIFY_ON_FEEDBACK)) … … 109 109 $message = apply_filters('un_feedback_received_message', $message, $id, $params); 110 110 $message = apply_filters('un_admin_notification_message', $message, $id, $params); 111 $subject = apply_filters('un_admin_notification_subject', 112 sprintf(__('New %s submitted at %s'), __($type, 'usernoise'), get_bloginfo('name')));111 $subject = apply_filters('un_admin_notification_subject', 112 sprintf(__('New %s submitted at %s'), __($type, 'usernoise'), html_entity_decode(get_bloginfo('name'), ENT_QUOTES | ENT_HTML5))); 113 113 $to = apply_filters('un_admin_notification_email', get_option('admin_email')); 114 114 $headers = apply_filters('un_admin_notification_headers', array(), $id); … … 116 116 do_action('un_admin_notification_sent', $id, $params, $message); 117 117 } 118 118 119 119 public function action_parse_query($q){ 120 if (isset($q->query_vars['feedback_type_id']) && 120 if (isset($q->query_vars['feedback_type_id']) && 121 121 $q->query_vars['feedback_type_id']){ 122 122 if (empty($q->query_vars['tax_query'])){ … … 129 129 ); 130 130 } 131 if (isset($q->query_vars['feedback_type_slug']) && 131 if (isset($q->query_vars['feedback_type_slug']) && 132 132 $q->query_vars['feedback_type_slug']){ 133 133 if (empty($q->query_vars['tax_query'])){ … … 141 141 } 142 142 } 143 143 144 144 public function get_pending_feedback_count($args = array()){ 145 145 return count($this->get_pending_feedback($args)); 146 146 } 147 147 148 148 public function get_pending_feedback($args = array()){ 149 149 $defaults = array('post_type' => FEEDBACK, 'numberposts' => -1, 'post_status' => 'pending'); … … 151 151 return get_posts($args); 152 152 } 153 153 154 154 public function get_feedback_type($feedback){ 155 155 if (is_object($feedback)) … … 160 160 return null; 161 161 } 162 162 163 163 public function get_plural_feedback_type_label($type){ 164 164 $term = get_term_by('slug', $type, FEEDBACK_TYPE); -
usernoise/trunk/inc/template.php
r975147 r1052708 125 125 global $current_user; 126 126 if (!is_user_logged_in()) 127 return un_get_option(UN_FEEDBACK_EMAIL_PLACEHOLDER);127 return __(un_get_option(UN_FEEDBACK_EMAIL_PLACEHOLDER), 'usernoise'); 128 128 get_currentuserinfo(); 129 129 return $current_user->user_email; … … 132 132 global $current_user; 133 133 if (!is_user_logged_in()) 134 return un_get_option(UN_FEEDBACK_NAME_PLACEHOLDER);134 return __(un_get_option(UN_FEEDBACK_NAME_PLACEHOLDER), 'usernoise'); 135 135 get_currentuserinfo(); 136 136 return $current_user->display_name;
Note: See TracChangeset
for help on using the changeset viewer.