@@ -17,270 +17,270 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class Sensei_Shortcode_Teachers implements Sensei_Shortcode_Interface { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var WP_User_Query keeps a reference to the user query created |
|
| 22 | - */ |
|
| 23 | - protected $user_query; |
|
| 20 | + /** |
|
| 21 | + * @var WP_User_Query keeps a reference to the user query created |
|
| 22 | + */ |
|
| 23 | + protected $user_query; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var which user id's to include |
|
| 27 | - */ |
|
| 28 | - protected $include; |
|
| 25 | + /** |
|
| 26 | + * @var which user id's to include |
|
| 27 | + */ |
|
| 28 | + protected $include; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var which user id's to exclude |
|
| 32 | - */ |
|
| 33 | - protected $exclude; |
|
| 30 | + /** |
|
| 31 | + * @var which user id's to exclude |
|
| 32 | + */ |
|
| 33 | + protected $exclude; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Setup the shortcode object |
|
| 37 | - * |
|
| 38 | - * @since 1.9.0 |
|
| 39 | - * @param array $attributes |
|
| 40 | - * @param string $content |
|
| 41 | - * @param string $shortcode the shortcode that was called for this instance |
|
| 42 | - */ |
|
| 43 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 35 | + /** |
|
| 36 | + * Setup the shortcode object |
|
| 37 | + * |
|
| 38 | + * @since 1.9.0 |
|
| 39 | + * @param array $attributes |
|
| 40 | + * @param string $content |
|
| 41 | + * @param string $shortcode the shortcode that was called for this instance |
|
| 42 | + */ |
|
| 43 | + public function __construct( $attributes, $content, $shortcode ){ |
|
| 44 | 44 | |
| 45 | - $include = isset( $attributes['include'] ) ? explode( ',', $attributes['include'] ) : ''; |
|
| 46 | - $exclude = isset( $attributes['exclude'] ) ? explode( ',', $attributes['exclude'] ) : ''; |
|
| 45 | + $include = isset( $attributes['include'] ) ? explode( ',', $attributes['include'] ) : ''; |
|
| 46 | + $exclude = isset( $attributes['exclude'] ) ? explode( ',', $attributes['exclude'] ) : ''; |
|
| 47 | 47 | |
| 48 | - // convert teacher usernames given to the id |
|
| 49 | - $this->include = $this->convert_usernames_to_ids( $include ); |
|
| 50 | - $this->exclude = $this->convert_usernames_to_ids( $exclude ); |
|
| 48 | + // convert teacher usernames given to the id |
|
| 49 | + $this->include = $this->convert_usernames_to_ids( $include ); |
|
| 50 | + $this->exclude = $this->convert_usernames_to_ids( $exclude ); |
|
| 51 | 51 | |
| 52 | - $this->setup_teacher_query(); |
|
| 52 | + $this->setup_teacher_query(); |
|
| 53 | 53 | |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * |
|
| 58 | - * Setup the user query that will be used in the render method |
|
| 59 | - * |
|
| 60 | - * @since 1.9.0 |
|
| 61 | - */ |
|
| 62 | - protected function setup_teacher_query(){ |
|
| 56 | + /** |
|
| 57 | + * |
|
| 58 | + * Setup the user query that will be used in the render method |
|
| 59 | + * |
|
| 60 | + * @since 1.9.0 |
|
| 61 | + */ |
|
| 62 | + protected function setup_teacher_query(){ |
|
| 63 | 63 | |
| 64 | - $user_query_args = array( |
|
| 65 | - 'role' => 'teacher', |
|
| 66 | - ); |
|
| 64 | + $user_query_args = array( |
|
| 65 | + 'role' => 'teacher', |
|
| 66 | + ); |
|
| 67 | 67 | |
| 68 | - $this->user_query = new WP_User_Query( $user_query_args ); |
|
| 68 | + $this->user_query = new WP_User_Query( $user_query_args ); |
|
| 69 | 69 | |
| 70 | - }// end setup _course_query |
|
| 70 | + }// end setup _course_query |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Rendering the shortcode this class is responsible for. |
|
| 74 | - * |
|
| 75 | - * @return string $content |
|
| 76 | - */ |
|
| 77 | - public function render(){ |
|
| 72 | + /** |
|
| 73 | + * Rendering the shortcode this class is responsible for. |
|
| 74 | + * |
|
| 75 | + * @return string $content |
|
| 76 | + */ |
|
| 77 | + public function render(){ |
|
| 78 | 78 | |
| 79 | - $all_users = $this->user_query->get_results(); |
|
| 80 | - // if the user has specified more users add them as well. |
|
| 81 | - if( ! empty( $this->include ) ){ |
|
| 79 | + $all_users = $this->user_query->get_results(); |
|
| 80 | + // if the user has specified more users add them as well. |
|
| 81 | + if( ! empty( $this->include ) ){ |
|
| 82 | 82 | |
| 83 | - $included_users_query = new WP_User_Query( array( 'include' => $this->include ) ); |
|
| 84 | - $included_users = $included_users_query->get_results(); |
|
| 85 | - if( ! empty( $included_users ) ){ |
|
| 83 | + $included_users_query = new WP_User_Query( array( 'include' => $this->include ) ); |
|
| 84 | + $included_users = $included_users_query->get_results(); |
|
| 85 | + if( ! empty( $included_users ) ){ |
|
| 86 | 86 | |
| 87 | - $merged_users = array_merge( $all_users, $included_users ); |
|
| 88 | - $all_users = $this->users_unique( $merged_users ); |
|
| 89 | - $all_users = $this->users_sort( $all_users ); |
|
| 87 | + $merged_users = array_merge( $all_users, $included_users ); |
|
| 88 | + $all_users = $this->users_unique( $merged_users ); |
|
| 89 | + $all_users = $this->users_sort( $all_users ); |
|
| 90 | 90 | |
| 91 | - } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - } |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - // exclude the users not wanted |
|
| 96 | - if( ! empty( $this->exclude ) ){ |
|
| 95 | + // exclude the users not wanted |
|
| 96 | + if( ! empty( $this->exclude ) ){ |
|
| 97 | 97 | |
| 98 | - $all_users = $this->exclude_users( $all_users, $this->exclude ); |
|
| 98 | + $all_users = $this->exclude_users( $all_users, $this->exclude ); |
|
| 99 | 99 | |
| 100 | - } |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - if( ! count( $all_users )> 0 ){ |
|
| 103 | - return ''; |
|
| 104 | - } |
|
| 102 | + if( ! count( $all_users )> 0 ){ |
|
| 103 | + return ''; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | |
| 107 | - $users_output = ''; |
|
| 107 | + $users_output = ''; |
|
| 108 | 108 | |
| 109 | - foreach ( $all_users as $user ) { |
|
| 109 | + foreach ( $all_users as $user ) { |
|
| 110 | 110 | |
| 111 | - $user_display_name = $this->get_user_public_name( $user ); |
|
| 111 | + $user_display_name = $this->get_user_public_name( $user ); |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Sensei teachers shortcode list item filter |
|
| 115 | - * |
|
| 116 | - * @since 1.9.0 |
|
| 117 | - * |
|
| 118 | - * @param string $teacher_li the html for the teacher li |
|
| 119 | - * @param WP_User $user |
|
| 120 | - */ |
|
| 121 | - $users_output .= apply_filters( 'sensei_teachers_shortcode_list_item', '<li class="teacher"><a href="'. get_author_posts_url( $user->ID ) . '">'. $user_display_name . '<a/></li>', $user ); |
|
| 113 | + /** |
|
| 114 | + * Sensei teachers shortcode list item filter |
|
| 115 | + * |
|
| 116 | + * @since 1.9.0 |
|
| 117 | + * |
|
| 118 | + * @param string $teacher_li the html for the teacher li |
|
| 119 | + * @param WP_User $user |
|
| 120 | + */ |
|
| 121 | + $users_output .= apply_filters( 'sensei_teachers_shortcode_list_item', '<li class="teacher"><a href="'. get_author_posts_url( $user->ID ) . '">'. $user_display_name . '<a/></li>', $user ); |
|
| 122 | 122 | |
| 123 | - } |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return '<ul class="sensei-teachers">' . $users_output . '</ul>'; |
|
| 125 | + return '<ul class="sensei-teachers">' . $users_output . '</ul>'; |
|
| 126 | 126 | |
| 127 | - }// end render |
|
| 127 | + }// end render |
|
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * remove duplicate user objects from and array of users |
|
| 131 | - * |
|
| 132 | - * @since 1.9.0 |
|
| 133 | - * |
|
| 134 | - * @param array $users{ |
|
| 135 | - * @type WP_User |
|
| 136 | - * } |
|
| 137 | - * |
|
| 138 | - * @return array $unique_users { |
|
| 139 | - * @type WP_User |
|
| 140 | - * } |
|
| 141 | - */ |
|
| 142 | - public function users_unique( $users ){ |
|
| 129 | + /** |
|
| 130 | + * remove duplicate user objects from and array of users |
|
| 131 | + * |
|
| 132 | + * @since 1.9.0 |
|
| 133 | + * |
|
| 134 | + * @param array $users{ |
|
| 135 | + * @type WP_User |
|
| 136 | + * } |
|
| 137 | + * |
|
| 138 | + * @return array $unique_users { |
|
| 139 | + * @type WP_User |
|
| 140 | + * } |
|
| 141 | + */ |
|
| 142 | + public function users_unique( $users ){ |
|
| 143 | 143 | |
| 144 | - $array_unique_users_ids = array(); |
|
| 145 | - foreach( $users as $index => $user ){ |
|
| 144 | + $array_unique_users_ids = array(); |
|
| 145 | + foreach( $users as $index => $user ){ |
|
| 146 | 146 | |
| 147 | - if( in_array( $user->ID, $array_unique_users_ids) ){ |
|
| 147 | + if( in_array( $user->ID, $array_unique_users_ids) ){ |
|
| 148 | 148 | |
| 149 | - // exclude this user as it is already in the list |
|
| 150 | - unset( $users[ $index ] ); |
|
| 149 | + // exclude this user as it is already in the list |
|
| 150 | + unset( $users[ $index ] ); |
|
| 151 | 151 | |
| 152 | - }else{ |
|
| 152 | + }else{ |
|
| 153 | 153 | |
| 154 | - // add teh user to the list of users |
|
| 155 | - $array_unique_users_ids[] = $user->ID; |
|
| 154 | + // add teh user to the list of users |
|
| 155 | + $array_unique_users_ids[] = $user->ID; |
|
| 156 | 156 | |
| 157 | - } |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - } |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - return $users; |
|
| 161 | + return $users; |
|
| 162 | 162 | |
| 163 | - }// end users_unique |
|
| 163 | + }// end users_unique |
|
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * Exclude users based ont he ids given. |
|
| 167 | - * |
|
| 168 | - * @since 1.9.0 |
|
| 169 | - * |
|
| 170 | - * @param array $users |
|
| 171 | - * @param array $exclude_ids |
|
| 172 | - * @return array |
|
| 173 | - */ |
|
| 174 | - public function exclude_users( $users, $exclude_ids ){ |
|
| 165 | + /** |
|
| 166 | + * Exclude users based ont he ids given. |
|
| 167 | + * |
|
| 168 | + * @since 1.9.0 |
|
| 169 | + * |
|
| 170 | + * @param array $users |
|
| 171 | + * @param array $exclude_ids |
|
| 172 | + * @return array |
|
| 173 | + */ |
|
| 174 | + public function exclude_users( $users, $exclude_ids ){ |
|
| 175 | 175 | |
| 176 | - foreach( $users as $index => $user ){ |
|
| 176 | + foreach( $users as $index => $user ){ |
|
| 177 | 177 | |
| 178 | - if( in_array( $user->ID, $exclude_ids ) ){ |
|
| 178 | + if( in_array( $user->ID, $exclude_ids ) ){ |
|
| 179 | 179 | |
| 180 | - // remove the user from the list |
|
| 181 | - unset( $users[ $index ] ); |
|
| 180 | + // remove the user from the list |
|
| 181 | + unset( $users[ $index ] ); |
|
| 182 | 182 | |
| 183 | - } |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - } |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - return $users; |
|
| 187 | + return $users; |
|
| 188 | 188 | |
| 189 | - }// end exclude_users |
|
| 189 | + }// end exclude_users |
|
| 190 | 190 | |
| 191 | - /** |
|
| 192 | - * Convert mixed array of user id and user names to only be an array of user_ids |
|
| 193 | - * |
|
| 194 | - * @param array $users |
|
| 195 | - * @return array $users_ids |
|
| 196 | - */ |
|
| 197 | - public function convert_usernames_to_ids( $users ){ |
|
| 191 | + /** |
|
| 192 | + * Convert mixed array of user id and user names to only be an array of user_ids |
|
| 193 | + * |
|
| 194 | + * @param array $users |
|
| 195 | + * @return array $users_ids |
|
| 196 | + */ |
|
| 197 | + public function convert_usernames_to_ids( $users ){ |
|
| 198 | 198 | |
| 199 | - // backup |
|
| 200 | - $users_ids = array(); |
|
| 199 | + // backup |
|
| 200 | + $users_ids = array(); |
|
| 201 | 201 | |
| 202 | - if ( is_array($users) ) { |
|
| 202 | + if ( is_array($users) ) { |
|
| 203 | 203 | |
| 204 | - foreach ($users as $user_id_or_username) { |
|
| 204 | + foreach ($users as $user_id_or_username) { |
|
| 205 | 205 | |
| 206 | - if (!is_numeric($user_id_or_username)) { |
|
| 206 | + if (!is_numeric($user_id_or_username)) { |
|
| 207 | 207 | |
| 208 | - $user_name = $user_id_or_username; |
|
| 209 | - $user = get_user_by('login', $user_name); |
|
| 208 | + $user_name = $user_id_or_username; |
|
| 209 | + $user = get_user_by('login', $user_name); |
|
| 210 | 210 | |
| 211 | - if (is_a($user, 'WP_User')) { |
|
| 212 | - $users_ids[] = $user->ID; |
|
| 213 | - } |
|
| 211 | + if (is_a($user, 'WP_User')) { |
|
| 212 | + $users_ids[] = $user->ID; |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - } else { |
|
| 215 | + } else { |
|
| 216 | 216 | |
| 217 | - $user_id = $user_id_or_username; |
|
| 218 | - $users_ids[] = $user_id; |
|
| 217 | + $user_id = $user_id_or_username; |
|
| 218 | + $users_ids[] = $user_id; |
|
| 219 | 219 | |
| 220 | - } |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | - } |
|
| 223 | - } |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | 224 | |
| 225 | - return $users_ids; |
|
| 226 | - } |
|
| 225 | + return $users_ids; |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | - /** |
|
| 229 | - * Returns the first name and last name or the display name of a user. |
|
| 230 | - * |
|
| 231 | - * @since 1.9.0 |
|
| 232 | - * |
|
| 233 | - * @param $user |
|
| 234 | - * @return string $user_public_name |
|
| 235 | - */ |
|
| 236 | - public function get_user_public_name( $user ){ |
|
| 228 | + /** |
|
| 229 | + * Returns the first name and last name or the display name of a user. |
|
| 230 | + * |
|
| 231 | + * @since 1.9.0 |
|
| 232 | + * |
|
| 233 | + * @param $user |
|
| 234 | + * @return string $user_public_name |
|
| 235 | + */ |
|
| 236 | + public function get_user_public_name( $user ){ |
|
| 237 | 237 | |
| 238 | - if (!empty($user->first_name) && !empty($user->last_name)) { |
|
| 238 | + if (!empty($user->first_name) && !empty($user->last_name)) { |
|
| 239 | 239 | |
| 240 | - $user_public_name = $user->first_name . ' ' . $user->last_name; |
|
| 240 | + $user_public_name = $user->first_name . ' ' . $user->last_name; |
|
| 241 | 241 | |
| 242 | - } |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - else { |
|
| 244 | + else { |
|
| 245 | 245 | |
| 246 | - $user_public_name = $user->display_name; |
|
| 246 | + $user_public_name = $user->display_name; |
|
| 247 | 247 | |
| 248 | - } |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | - return $user_public_name; |
|
| 251 | - } |
|
| 250 | + return $user_public_name; |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | - /** |
|
| 254 | - * |
|
| 255 | - * Sort user objects by user display |
|
| 256 | - * |
|
| 257 | - * @since 1.9.0 |
|
| 258 | - * |
|
| 259 | - * @param $users |
|
| 260 | - * @return array $sorted_users |
|
| 261 | - */ |
|
| 262 | - public function users_sort( $users ){ |
|
| 253 | + /** |
|
| 254 | + * |
|
| 255 | + * Sort user objects by user display |
|
| 256 | + * |
|
| 257 | + * @since 1.9.0 |
|
| 258 | + * |
|
| 259 | + * @param $users |
|
| 260 | + * @return array $sorted_users |
|
| 261 | + */ |
|
| 262 | + public function users_sort( $users ){ |
|
| 263 | 263 | |
| 264 | - $sorted_users = $users; |
|
| 264 | + $sorted_users = $users; |
|
| 265 | 265 | |
| 266 | - uasort( $sorted_users, array( $this, 'custom_user_sort' ) ); |
|
| 266 | + uasort( $sorted_users, array( $this, 'custom_user_sort' ) ); |
|
| 267 | 267 | |
| 268 | - return $sorted_users; |
|
| 269 | - } |
|
| 268 | + return $sorted_users; |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * Used in the uasort function to sort users by title |
|
| 273 | - * |
|
| 274 | - * @since 1.9.0 |
|
| 275 | - * |
|
| 276 | - * @param $user_1 |
|
| 277 | - * @param $user_2 |
|
| 278 | - * @return int |
|
| 279 | - */ |
|
| 280 | - public function custom_user_sort($user_1, $user_2){ |
|
| 271 | + /** |
|
| 272 | + * Used in the uasort function to sort users by title |
|
| 273 | + * |
|
| 274 | + * @since 1.9.0 |
|
| 275 | + * |
|
| 276 | + * @param $user_1 |
|
| 277 | + * @param $user_2 |
|
| 278 | + * @return int |
|
| 279 | + */ |
|
| 280 | + public function custom_user_sort($user_1, $user_2){ |
|
| 281 | 281 | |
| 282 | - return strcasecmp( $this->get_user_public_name( $user_1 ), $this->get_user_public_name( $user_2 ) ); |
|
| 282 | + return strcasecmp( $this->get_user_public_name( $user_1 ), $this->get_user_public_name( $user_2 ) ); |
|
| 283 | 283 | |
| 284 | - }// end custom_user_sort |
|
| 284 | + }// end custom_user_sort |
|
| 285 | 285 | |
| 286 | 286 | }// end class |
| 287 | 287 | \ No newline at end of file |
@@ -24,135 +24,135 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class Sensei_Shortcode_Course_Categories implements Sensei_Shortcode_Interface { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var array list of taxonomy terms. |
|
| 29 | - */ |
|
| 30 | - protected $sensei_course_taxonomy_terms; |
|
| 27 | + /** |
|
| 28 | + * @var array list of taxonomy terms. |
|
| 29 | + */ |
|
| 30 | + protected $sensei_course_taxonomy_terms; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Setup the shortcode object |
|
| 34 | - * |
|
| 35 | - * @since 1.9.0 |
|
| 36 | - * @param array $attributes |
|
| 37 | - * @param string $content |
|
| 38 | - * @param string $shortcode the shortcode that was called for this instance |
|
| 39 | - */ |
|
| 40 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 32 | + /** |
|
| 33 | + * Setup the shortcode object |
|
| 34 | + * |
|
| 35 | + * @since 1.9.0 |
|
| 36 | + * @param array $attributes |
|
| 37 | + * @param string $content |
|
| 38 | + * @param string $shortcode the shortcode that was called for this instance |
|
| 39 | + */ |
|
| 40 | + public function __construct( $attributes, $content, $shortcode ){ |
|
| 41 | 41 | |
| 42 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'name'; |
|
| 43 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'ASC'; |
|
| 44 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '100'; |
|
| 45 | - $this->parent = isset( $attributes['parent'] ) ? $attributes['parent'] : ''; |
|
| 42 | + $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'name'; |
|
| 43 | + $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'ASC'; |
|
| 44 | + $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '100'; |
|
| 45 | + $this->parent = isset( $attributes['parent'] ) ? $attributes['parent'] : ''; |
|
| 46 | 46 | |
| 47 | - $include = isset( $attributes['include'] ) ? explode( ',' , $attributes['include'] ) : ''; |
|
| 48 | - $this->include = $this->generate_term_ids( $include ); |
|
| 47 | + $include = isset( $attributes['include'] ) ? explode( ',' , $attributes['include'] ) : ''; |
|
| 48 | + $this->include = $this->generate_term_ids( $include ); |
|
| 49 | 49 | |
| 50 | - $exclude = isset( $attributes['exclude'] ) ? explode( ',' , $attributes['exclude'] ) : ''; |
|
| 51 | - $this->exclude = $this->generate_term_ids( $exclude ); |
|
| 50 | + $exclude = isset( $attributes['exclude'] ) ? explode( ',' , $attributes['exclude'] ) : ''; |
|
| 51 | + $this->exclude = $this->generate_term_ids( $exclude ); |
|
| 52 | 52 | |
| 53 | - // make sure we handle string true/false values correctly with respective defaults |
|
| 54 | - $hide_empty = isset( $attributes['hide_empty'] ) ? $attributes['hide_empty'] : 'false'; |
|
| 55 | - $this->hide_empty = 'true' == $hide_empty ? true: false; |
|
| 53 | + // make sure we handle string true/false values correctly with respective defaults |
|
| 54 | + $hide_empty = isset( $attributes['hide_empty'] ) ? $attributes['hide_empty'] : 'false'; |
|
| 55 | + $this->hide_empty = 'true' == $hide_empty ? true: false; |
|
| 56 | 56 | |
| 57 | - $this->setup_course_categories(); |
|
| 57 | + $this->setup_course_categories(); |
|
| 58 | 58 | |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * create the messages query . |
|
| 63 | - * |
|
| 64 | - * @return mixed |
|
| 65 | - */ |
|
| 66 | - public function setup_course_categories(){ |
|
| 61 | + /** |
|
| 62 | + * create the messages query . |
|
| 63 | + * |
|
| 64 | + * @return mixed |
|
| 65 | + */ |
|
| 66 | + public function setup_course_categories(){ |
|
| 67 | 67 | |
| 68 | - $args = array( |
|
| 69 | - 'orderby' => $this->orderby, |
|
| 70 | - 'order' => $this->order, |
|
| 71 | - 'exclude' => $this->exclude, |
|
| 72 | - 'include' => $this->include, |
|
| 73 | - 'number' => $this->number, |
|
| 74 | - 'parent' => $this->parent, |
|
| 75 | - 'hide_empty' => $this->hide_empty, |
|
| 76 | - 'fields' => 'all', |
|
| 77 | - ); |
|
| 68 | + $args = array( |
|
| 69 | + 'orderby' => $this->orderby, |
|
| 70 | + 'order' => $this->order, |
|
| 71 | + 'exclude' => $this->exclude, |
|
| 72 | + 'include' => $this->include, |
|
| 73 | + 'number' => $this->number, |
|
| 74 | + 'parent' => $this->parent, |
|
| 75 | + 'hide_empty' => $this->hide_empty, |
|
| 76 | + 'fields' => 'all', |
|
| 77 | + ); |
|
| 78 | 78 | |
| 79 | - $this->sensei_course_taxonomy_terms = get_terms('course-category', $args); |
|
| 79 | + $this->sensei_course_taxonomy_terms = get_terms('course-category', $args); |
|
| 80 | 80 | |
| 81 | - } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Rendering the shortcode this class is responsible for. |
|
| 85 | - * |
|
| 86 | - * @return string $content |
|
| 87 | - */ |
|
| 88 | - public function render(){ |
|
| 83 | + /** |
|
| 84 | + * Rendering the shortcode this class is responsible for. |
|
| 85 | + * |
|
| 86 | + * @return string $content |
|
| 87 | + */ |
|
| 88 | + public function render(){ |
|
| 89 | 89 | |
| 90 | - if( empty( $this->sensei_course_taxonomy_terms ) ){ |
|
| 90 | + if( empty( $this->sensei_course_taxonomy_terms ) ){ |
|
| 91 | 91 | |
| 92 | - return __( 'No course categories found.', 'woothemes-sensei' ); |
|
| 92 | + return __( 'No course categories found.', 'woothemes-sensei' ); |
|
| 93 | 93 | |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - $terms_html = ''; |
|
| 96 | + $terms_html = ''; |
|
| 97 | 97 | |
| 98 | - //set the wp_query to the current messages query |
|
| 99 | - $terms_html .= '<ul class="sensei course-categories">'; |
|
| 100 | - foreach( $this->sensei_course_taxonomy_terms as $category ){ |
|
| 98 | + //set the wp_query to the current messages query |
|
| 99 | + $terms_html .= '<ul class="sensei course-categories">'; |
|
| 100 | + foreach( $this->sensei_course_taxonomy_terms as $category ){ |
|
| 101 | 101 | |
| 102 | - $category_link = '<a href="'. get_term_link( $category ) . '">' . $category->name . '</a>'; |
|
| 103 | - $terms_html .= '<li class="sensei course-category" >' . $category_link . '</li>'; |
|
| 102 | + $category_link = '<a href="'. get_term_link( $category ) . '">' . $category->name . '</a>'; |
|
| 103 | + $terms_html .= '<li class="sensei course-category" >' . $category_link . '</li>'; |
|
| 104 | 104 | |
| 105 | - } |
|
| 106 | - $terms_html .= '<ul>'; |
|
| 105 | + } |
|
| 106 | + $terms_html .= '<ul>'; |
|
| 107 | 107 | |
| 108 | - return $terms_html; |
|
| 108 | + return $terms_html; |
|
| 109 | 109 | |
| 110 | - }// end render |
|
| 110 | + }// end render |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * Convert an array of mixed ids, slugs or names to only the id's of those terms |
|
| 114 | - * |
|
| 115 | - * @since 1.9.0 |
|
| 116 | - * |
|
| 117 | - * @param array $category_ids |
|
| 118 | - * @return array |
|
| 119 | - */ |
|
| 120 | - public function generate_term_ids( $categories = array() ){ |
|
| 112 | + /** |
|
| 113 | + * Convert an array of mixed ids, slugs or names to only the id's of those terms |
|
| 114 | + * |
|
| 115 | + * @since 1.9.0 |
|
| 116 | + * |
|
| 117 | + * @param array $category_ids |
|
| 118 | + * @return array |
|
| 119 | + */ |
|
| 120 | + public function generate_term_ids( $categories = array() ){ |
|
| 121 | 121 | |
| 122 | - $cat_ids = array(); |
|
| 122 | + $cat_ids = array(); |
|
| 123 | 123 | |
| 124 | - if ( is_array($categories) ) { |
|
| 125 | - foreach ($categories as $cat) { |
|
| 124 | + if ( is_array($categories) ) { |
|
| 125 | + foreach ($categories as $cat) { |
|
| 126 | 126 | |
| 127 | - if (!is_numeric($cat)) { |
|
| 127 | + if (!is_numeric($cat)) { |
|
| 128 | 128 | |
| 129 | - // try the slug |
|
| 130 | - $term = get_term_by('slug', $cat, 'course-category'); |
|
| 129 | + // try the slug |
|
| 130 | + $term = get_term_by('slug', $cat, 'course-category'); |
|
| 131 | 131 | |
| 132 | - // if the slug didn't work try the name |
|
| 133 | - if (!$term) { |
|
| 132 | + // if the slug didn't work try the name |
|
| 133 | + if (!$term) { |
|
| 134 | 134 | |
| 135 | - $term = get_term_by('name', $cat, 'course-category'); |
|
| 135 | + $term = get_term_by('name', $cat, 'course-category'); |
|
| 136 | 136 | |
| 137 | - } |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - if ($term) { |
|
| 140 | - $cat_ids[] = $term->term_id; |
|
| 141 | - } |
|
| 139 | + if ($term) { |
|
| 140 | + $cat_ids[] = $term->term_id; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - } else { |
|
| 143 | + } else { |
|
| 144 | 144 | |
| 145 | - $cat_ids[] = $cat; |
|
| 145 | + $cat_ids[] = $cat; |
|
| 146 | 146 | |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - } |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - } |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - return $cat_ids; |
|
| 153 | + return $cat_ids; |
|
| 154 | 154 | |
| 155 | - }// end generate_term_ids |
|
| 155 | + }// end generate_term_ids |
|
| 156 | 156 | |
| 157 | 157 | }// end class |
| 158 | 158 | |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | 'order' => $order, |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | - // Handle search |
|
| 166 | - if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) { |
|
| 167 | - $args['search'] = esc_html( $_GET['s'] ); |
|
| 168 | - } |
|
| 165 | + // Handle search |
|
| 166 | + if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) { |
|
| 167 | + $args['search'] = esc_html( $_GET['s'] ); |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | 170 | switch ( $this->type ) { |
| 171 | 171 | case 'courses': |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | 224 | |
| 225 | - // Handle search |
|
| 226 | - if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) { |
|
| 227 | - $args['search'] = esc_html( $_GET['s'] ); |
|
| 228 | - } |
|
| 225 | + // Handle search |
|
| 226 | + if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) { |
|
| 227 | + $args['search'] = esc_html( $_GET['s'] ); |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | 230 | |
| 231 | 231 | // Start the csv with the column headings |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * Generates the overall array for a single item in the display |
| 264 | 264 | * @since 1.7.0 |
| 265 | 265 | * @param object $item The current item |
| 266 | - * @return array $column_data; |
|
| 266 | + * @return array $column_data; |
|
| 267 | 267 | */ |
| 268 | 268 | protected function get_row_data( $item ) { |
| 269 | 269 | |
@@ -422,8 +422,8 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | // Output the users data |
| 424 | 424 | if ( $this->csv_output ) { |
| 425 | - $user_name = Sensei()->learners->get_learner_full_name( $item->ID ); |
|
| 426 | - } |
|
| 425 | + $user_name = Sensei()->learners->get_learner_full_name( $item->ID ); |
|
| 426 | + } |
|
| 427 | 427 | else { |
| 428 | 428 | $url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $item->ID ), admin_url( 'admin.php' ) ); |
| 429 | 429 | $user_name = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . $item->display_name . '</a></strong>'; |
@@ -517,17 +517,17 @@ discard block |
||
| 517 | 517 | // This stops the full meta data of each user being loaded |
| 518 | 518 | $args['fields'] = array( 'ID', 'user_login', 'user_email', 'user_registered', 'display_name' ); |
| 519 | 519 | |
| 520 | - /** |
|
| 521 | - * Filter the WP_User_Query arguments |
|
| 522 | - * @since 1.6.0 |
|
| 523 | - * @param $args |
|
| 524 | - */ |
|
| 525 | - $args = apply_filters( 'sensei_analysis_overview_filter_users', $args ); |
|
| 520 | + /** |
|
| 521 | + * Filter the WP_User_Query arguments |
|
| 522 | + * @since 1.6.0 |
|
| 523 | + * @param $args |
|
| 524 | + */ |
|
| 525 | + $args = apply_filters( 'sensei_analysis_overview_filter_users', $args ); |
|
| 526 | 526 | $wp_user_search = new WP_User_Query( $args ); |
| 527 | - $learners = $wp_user_search->get_results(); |
|
| 527 | + $learners = $wp_user_search->get_results(); |
|
| 528 | 528 | $this->total_items = $wp_user_search->get_total(); |
| 529 | 529 | |
| 530 | - return $learners; |
|
| 530 | + return $learners; |
|
| 531 | 531 | |
| 532 | 532 | } // End get_learners() |
| 533 | 533 | |
@@ -79,17 +79,17 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // Load Learners JS |
| 81 | 81 | wp_enqueue_script( 'sensei-learners-general', |
| 82 | - Sensei()->plugin_url . 'assets/js/learners-general' . $suffix . '.js', |
|
| 83 | - array('jquery','select2','sensei-chosen-ajax' ), Sensei()->version, true ); |
|
| 82 | + Sensei()->plugin_url . 'assets/js/learners-general' . $suffix . '.js', |
|
| 83 | + array('jquery','select2','sensei-chosen-ajax' ), Sensei()->version, true ); |
|
| 84 | 84 | |
| 85 | 85 | $data = array( |
| 86 | 86 | 'remove_generic_confirm' => __( 'Are you sure you want to remove this user?', 'woothemes-sensei' ), |
| 87 | 87 | 'remove_from_lesson_confirm' => __( 'Are you sure you want to remove the user from this lesson?', 'woothemes-sensei' ), |
| 88 | 88 | 'remove_from_course_confirm' => __( 'Are you sure you want to remove the user from this course?', 'woothemes-sensei' ), |
| 89 | - 'remove_from_purchased_course_confirm' => __( 'Are you sure you want to remove the user from this course? This order associate with this will also be set to canceled.', 'woothemes-sensei' ), |
|
| 89 | + 'remove_from_purchased_course_confirm' => __( 'Are you sure you want to remove the user from this course? This order associate with this will also be set to canceled.', 'woothemes-sensei' ), |
|
| 90 | 90 | 'remove_user_from_post_nonce' => wp_create_nonce( 'remove_user_from_post_nonce' ), |
| 91 | - 'search_users_nonce' => wp_create_nonce( 'search-users' ), |
|
| 92 | - 'selectplaceholder'=> __( 'Select Learner', 'woothemes-sensei' ) |
|
| 91 | + 'search_users_nonce' => wp_create_nonce( 'search-users' ), |
|
| 92 | + 'selectplaceholder'=> __( 'Select Learner', 'woothemes-sensei' ) |
|
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | 95 | wp_localize_script( 'sensei-learners-general', 'woo_learners_general_data', $data ); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $user_id = intval( $action_data['user_id'] ); |
| 275 | 275 | $post_id = intval( $action_data['post_id'] ); |
| 276 | 276 | $post_type = sanitize_text_field( $action_data['post_type'] ); |
| 277 | - $order_id = sanitize_text_field( $action_data['order_id'] ); |
|
| 277 | + $order_id = sanitize_text_field( $action_data['order_id'] ); |
|
| 278 | 278 | |
| 279 | 279 | $user = get_userdata( $user_id ); |
| 280 | 280 | |
@@ -283,15 +283,15 @@ discard block |
||
| 283 | 283 | case 'course': |
| 284 | 284 | $removed = WooThemes_Sensei_Utils::sensei_remove_user_from_course( $post_id, $user_id ); |
| 285 | 285 | |
| 286 | - if( ! empty( $order_id ) && Sensei_WC::is_woocommerce_active() ){ |
|
| 286 | + if( ! empty( $order_id ) && Sensei_WC::is_woocommerce_active() ){ |
|
| 287 | 287 | |
| 288 | - $order = new WC_Order($order_id); |
|
| 288 | + $order = new WC_Order($order_id); |
|
| 289 | 289 | |
| 290 | - if (!empty($order)) { |
|
| 291 | - $order->update_status( 'cancelled' ); |
|
| 292 | - } |
|
| 290 | + if (!empty($order)) { |
|
| 291 | + $order->update_status( 'cancelled' ); |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | - } |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | 296 | break; |
| 297 | 297 | |
@@ -336,19 +336,19 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | if ( $users ) { |
| 338 | 338 | foreach ( $users as $user ) { |
| 339 | - $full_name = Sensei()->learners->get_learner_full_name( $user->ID ); |
|
| 339 | + $full_name = Sensei()->learners->get_learner_full_name( $user->ID ); |
|
| 340 | 340 | |
| 341 | - if( trim($user->display_name ) == trim( $full_name ) ){ |
|
| 341 | + if( trim($user->display_name ) == trim( $full_name ) ){ |
|
| 342 | 342 | |
| 343 | - $name = $full_name; |
|
| 343 | + $name = $full_name; |
|
| 344 | 344 | |
| 345 | - }else{ |
|
| 345 | + }else{ |
|
| 346 | 346 | |
| 347 | - $name = $full_name . ' ['. $user->display_name .']'; |
|
| 347 | + $name = $full_name . ' ['. $user->display_name .']'; |
|
| 348 | 348 | |
| 349 | - } |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | - $found_users[ $user->ID ] = $name . ' (#' . $user->ID . ' – ' . sanitize_email( $user->user_email ) . ')'; |
|
| 351 | + $found_users[ $user->ID ] = $name . ' (#' . $user->ID . ' – ' . sanitize_email( $user->user_email ) . ')'; |
|
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | break; |
| 393 | 393 | |
| 394 | 394 | case 'lesson': |
| 395 | - $lesson_id = absint( $_POST['add_lesson_id'] ); |
|
| 395 | + $lesson_id = absint( $_POST['add_lesson_id'] ); |
|
| 396 | 396 | $complete = false; |
| 397 | 397 | if( isset( $_POST['add_complete_lesson'] ) && 'yes' == $_POST['add_complete_lesson'] ) { |
| 398 | 398 | $complete = true; |
@@ -452,49 +452,49 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - /** |
|
| 456 | - * Return the full name and surname or the display name of the user. |
|
| 457 | - * |
|
| 458 | - * The user must have both name and surname otherwise display name will be returned. |
|
| 459 | - * |
|
| 460 | - * @since 1.8.0 |
|
| 461 | - * |
|
| 462 | - * @param int $user_id | bool false for an invalid $user_id |
|
| 463 | - * |
|
| 464 | - * @return string $full_name |
|
| 465 | - */ |
|
| 466 | - public function get_learner_full_name( $user_id ){ |
|
| 455 | + /** |
|
| 456 | + * Return the full name and surname or the display name of the user. |
|
| 457 | + * |
|
| 458 | + * The user must have both name and surname otherwise display name will be returned. |
|
| 459 | + * |
|
| 460 | + * @since 1.8.0 |
|
| 461 | + * |
|
| 462 | + * @param int $user_id | bool false for an invalid $user_id |
|
| 463 | + * |
|
| 464 | + * @return string $full_name |
|
| 465 | + */ |
|
| 466 | + public function get_learner_full_name( $user_id ){ |
|
| 467 | 467 | |
| 468 | - $full_name = ''; |
|
| 468 | + $full_name = ''; |
|
| 469 | 469 | |
| 470 | - if( empty( $user_id ) || ! ( 0 < intval( $user_id ) ) |
|
| 471 | - || !( get_userdata( $user_id ) ) ){ |
|
| 472 | - return false; |
|
| 473 | - } |
|
| 470 | + if( empty( $user_id ) || ! ( 0 < intval( $user_id ) ) |
|
| 471 | + || !( get_userdata( $user_id ) ) ){ |
|
| 472 | + return false; |
|
| 473 | + } |
|
| 474 | 474 | |
| 475 | - // get the user details |
|
| 476 | - $user = get_user_by( 'id', $user_id ); |
|
| 475 | + // get the user details |
|
| 476 | + $user = get_user_by( 'id', $user_id ); |
|
| 477 | 477 | |
| 478 | - if( ! empty( $user->first_name ) && ! empty( $user->last_name ) ){ |
|
| 478 | + if( ! empty( $user->first_name ) && ! empty( $user->last_name ) ){ |
|
| 479 | 479 | |
| 480 | - $full_name = trim( $user->first_name ) . ' ' . trim( $user->last_name ); |
|
| 480 | + $full_name = trim( $user->first_name ) . ' ' . trim( $user->last_name ); |
|
| 481 | 481 | |
| 482 | - }else{ |
|
| 482 | + }else{ |
|
| 483 | 483 | |
| 484 | - $full_name = $user->display_name; |
|
| 484 | + $full_name = $user->display_name; |
|
| 485 | 485 | |
| 486 | - } |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | - /** |
|
| 489 | - * Filter the user full name from the get_learner_full_name function. |
|
| 490 | - * |
|
| 491 | - * @since 1.8.0 |
|
| 492 | - * @param $full_name |
|
| 493 | - * @param $user_id |
|
| 494 | - */ |
|
| 495 | - return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id ); |
|
| 488 | + /** |
|
| 489 | + * Filter the user full name from the get_learner_full_name function. |
|
| 490 | + * |
|
| 491 | + * @since 1.8.0 |
|
| 492 | + * @param $full_name |
|
| 493 | + * @param $user_id |
|
| 494 | + */ |
|
| 495 | + return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id ); |
|
| 496 | 496 | |
| 497 | - } // end get_learner_full_name |
|
| 497 | + } // end get_learner_full_name |
|
| 498 | 498 | |
| 499 | 499 | } // End Class |
| 500 | 500 | |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Display output to the admin view |
| 44 | - * |
|
| 45 | - * This view is shown when grading a quiz for a single user in admin under grading |
|
| 46 | - * |
|
| 44 | + * |
|
| 45 | + * This view is shown when grading a quiz for a single user in admin under grading |
|
| 46 | + * |
|
| 47 | 47 | * @since 1.3.0 |
| 48 | 48 | * @return html |
| 49 | 49 | */ |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | $user_quiz_grade_total = 0; |
| 58 | 58 | $quiz_grade_total = 0; |
| 59 | 59 | $quiz_grade = 0; |
| 60 | - $lesson_id = $this->lesson_id; |
|
| 61 | - $user_id = $this->user_id; |
|
| 60 | + $lesson_id = $this->lesson_id; |
|
| 61 | + $user_id = $this->user_id; |
|
| 62 | 62 | |
| 63 | 63 | ?><form name="<?php esc_attr_e( 'quiz_' . $this->quiz_id ); ?>" action="" method="post"> |
| 64 | 64 | <?php wp_nonce_field( 'sensei_manual_grading', '_wp_sensei_manual_grading_nonce' ); ?> |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | <p class="user-answer"><?php |
| 207 | 207 | foreach ( $user_answer_content as $_user_answer ) { |
| 208 | 208 | |
| 209 | - if( 'multi-line' == Sensei()->question->get_question_type( $question->ID ) ){ |
|
| 209 | + if( 'multi-line' == Sensei()->question->get_question_type( $question->ID ) ){ |
|
| 210 | 210 | |
| 211 | - $_user_answer = htmlspecialchars_decode( nl2br( esc_html($_user_answer) ) ); |
|
| 211 | + $_user_answer = htmlspecialchars_decode( nl2br( esc_html($_user_answer) ) ); |
|
| 212 | 212 | |
| 213 | - } |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | 215 | echo apply_filters( 'sensei_answer_text', $_user_answer ) . "<br>"; |
| 216 | 216 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $grade = __( 'N/A', 'woothemes-sensei' ); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - $title = Sensei()->learners->get_learner_full_name( $item->user_id ); |
|
| 256 | + $title = Sensei()->learners->get_learner_full_name( $item->user_id ); |
|
| 257 | 257 | |
| 258 | 258 | // QuizID to be deprecated |
| 259 | 259 | $quiz_id = get_post_meta( $item->comment_post_ID, '_lesson_quiz', true ); |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function no_items() { |
| 305 | 305 | |
| 306 | - _e( 'No submissions found.', 'woothemes-sensei' ); |
|
| 306 | + _e( 'No submissions found.', 'woothemes-sensei' ); |
|
| 307 | 307 | |
| 308 | 308 | } // End no_items() |
| 309 | 309 | |
@@ -13,123 +13,123 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class Sensei_Autoloader { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @var path to the includes directory within Sensei. |
|
| 18 | - */ |
|
| 19 | - private $include_path = 'includes'; |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * @var array $class_file_map. List of classes mapped to their files |
|
| 23 | - */ |
|
| 24 | - private $class_file_map = array(); |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Constructor |
|
| 28 | - * @since 1.9.0 |
|
| 29 | - */ |
|
| 30 | - public function __construct(){ |
|
| 31 | - |
|
| 32 | - // make sure we do not override an existing autoload function |
|
| 33 | - if( function_exists('__autoload') ){ |
|
| 34 | - spl_autoload_register( '__autoload' ); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - // setup a relative path for the current autoload instance |
|
| 38 | - $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) ); |
|
| 39 | - |
|
| 40 | - //setup the class file map |
|
| 41 | - $this->initialize_class_file_map(); |
|
| 42 | - |
|
| 43 | - // add Sensei custom auto loader |
|
| 44 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 45 | - |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * Generate a list of Sensei class and map them the their respective |
|
| 50 | - * files within the includes directory |
|
| 51 | - * |
|
| 52 | - * @since 1.9.0 |
|
| 53 | - */ |
|
| 54 | - public function initialize_class_file_map(){ |
|
| 55 | - |
|
| 56 | - $this->class_file_map = array( |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Main Sensei class |
|
| 60 | - */ |
|
| 61 | - 'Sensei_Main' => 'class-sensei.php', |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Admin |
|
| 65 | - */ |
|
| 66 | - 'Sensei_Welcome'=> 'admin/class-sensei-welcome.php' , |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Shortcodes |
|
| 70 | - */ |
|
| 71 | - 'Sensei_Shortcode_Loader' => 'shortcodes/class-sensei-shortcode-loader.php', |
|
| 72 | - 'Sensei_Shortcode_Interface' => 'shortcodes/interface-sensei-shortcode.php', |
|
| 73 | - 'Sensei_Shortcode_Featured_Courses' => 'shortcodes/class-sensei-shortcode-featured-courses.php', |
|
| 74 | - 'Sensei_Shortcode_User_Courses' => 'shortcodes/class-sensei-shortcode-user-courses.php', |
|
| 75 | - 'Sensei_Shortcode_Courses' => 'shortcodes/class-sensei-shortcode-courses.php', |
|
| 76 | - 'Sensei_Shortcode_Teachers' => 'shortcodes/class-sensei-shortcode-teachers.php', |
|
| 77 | - 'Sensei_Shortcode_User_Messages' => 'shortcodes/class-sensei-shortcode-user-messages.php', |
|
| 78 | - 'Sensei_Shortcode_Course_Page' => 'shortcodes/class-sensei-shortcode-course-page.php', |
|
| 79 | - 'Sensei_Shortcode_Lesson_Page' => 'shortcodes/class-sensei-shortcode-lesson-page.php', |
|
| 80 | - 'Sensei_Shortcode_Course_Categories' => 'shortcodes/class-sensei-shortcode-course-categories.php', |
|
| 81 | - 'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php', |
|
| 82 | - 'Sensei_Legacy_Shortcodes' => 'shortcodes/class-sensei-legacy-shortcodes.php', |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * WooCommerce |
|
| 86 | - */ |
|
| 87 | - 'Sensei_WC' => 'class-sensei-wc.php', |
|
| 88 | - |
|
| 89 | - ); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Autoload all sensei files as the class names are used. |
|
| 94 | - */ |
|
| 95 | - public function autoload( $class ){ |
|
| 96 | - |
|
| 97 | - // only handle classes with the word `sensei` in it |
|
| 98 | - if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){ |
|
| 99 | - |
|
| 100 | - return; |
|
| 101 | - |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - // exit if we didn't provide mapping for this class |
|
| 105 | - if( isset( $this->class_file_map[ $class ] ) ){ |
|
| 106 | - |
|
| 107 | - $file_location = $this->include_path . $this->class_file_map[ $class ]; |
|
| 108 | - require_once( $file_location); |
|
| 109 | - return; |
|
| 110 | - |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - // check for file in the main includes directory |
|
| 114 | - $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php'; |
|
| 115 | - if( file_exists( $class_file_path ) ){ |
|
| 116 | - |
|
| 117 | - require_once( $class_file_path ); |
|
| 118 | - return; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - // lastly check legacy types |
|
| 122 | - $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes |
|
| 123 | - $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php'; |
|
| 124 | - if( file_exists( $legacy_class_file_path ) ){ |
|
| 125 | - |
|
| 126 | - require_once( $legacy_class_file_path ); |
|
| 127 | - return; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - return; |
|
| 16 | + /** |
|
| 17 | + * @var path to the includes directory within Sensei. |
|
| 18 | + */ |
|
| 19 | + private $include_path = 'includes'; |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * @var array $class_file_map. List of classes mapped to their files |
|
| 23 | + */ |
|
| 24 | + private $class_file_map = array(); |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Constructor |
|
| 28 | + * @since 1.9.0 |
|
| 29 | + */ |
|
| 30 | + public function __construct(){ |
|
| 31 | + |
|
| 32 | + // make sure we do not override an existing autoload function |
|
| 33 | + if( function_exists('__autoload') ){ |
|
| 34 | + spl_autoload_register( '__autoload' ); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + // setup a relative path for the current autoload instance |
|
| 38 | + $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) ); |
|
| 39 | + |
|
| 40 | + //setup the class file map |
|
| 41 | + $this->initialize_class_file_map(); |
|
| 42 | + |
|
| 43 | + // add Sensei custom auto loader |
|
| 44 | + spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 45 | + |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * Generate a list of Sensei class and map them the their respective |
|
| 50 | + * files within the includes directory |
|
| 51 | + * |
|
| 52 | + * @since 1.9.0 |
|
| 53 | + */ |
|
| 54 | + public function initialize_class_file_map(){ |
|
| 55 | + |
|
| 56 | + $this->class_file_map = array( |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Main Sensei class |
|
| 60 | + */ |
|
| 61 | + 'Sensei_Main' => 'class-sensei.php', |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Admin |
|
| 65 | + */ |
|
| 66 | + 'Sensei_Welcome'=> 'admin/class-sensei-welcome.php' , |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Shortcodes |
|
| 70 | + */ |
|
| 71 | + 'Sensei_Shortcode_Loader' => 'shortcodes/class-sensei-shortcode-loader.php', |
|
| 72 | + 'Sensei_Shortcode_Interface' => 'shortcodes/interface-sensei-shortcode.php', |
|
| 73 | + 'Sensei_Shortcode_Featured_Courses' => 'shortcodes/class-sensei-shortcode-featured-courses.php', |
|
| 74 | + 'Sensei_Shortcode_User_Courses' => 'shortcodes/class-sensei-shortcode-user-courses.php', |
|
| 75 | + 'Sensei_Shortcode_Courses' => 'shortcodes/class-sensei-shortcode-courses.php', |
|
| 76 | + 'Sensei_Shortcode_Teachers' => 'shortcodes/class-sensei-shortcode-teachers.php', |
|
| 77 | + 'Sensei_Shortcode_User_Messages' => 'shortcodes/class-sensei-shortcode-user-messages.php', |
|
| 78 | + 'Sensei_Shortcode_Course_Page' => 'shortcodes/class-sensei-shortcode-course-page.php', |
|
| 79 | + 'Sensei_Shortcode_Lesson_Page' => 'shortcodes/class-sensei-shortcode-lesson-page.php', |
|
| 80 | + 'Sensei_Shortcode_Course_Categories' => 'shortcodes/class-sensei-shortcode-course-categories.php', |
|
| 81 | + 'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php', |
|
| 82 | + 'Sensei_Legacy_Shortcodes' => 'shortcodes/class-sensei-legacy-shortcodes.php', |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * WooCommerce |
|
| 86 | + */ |
|
| 87 | + 'Sensei_WC' => 'class-sensei-wc.php', |
|
| 88 | + |
|
| 89 | + ); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Autoload all sensei files as the class names are used. |
|
| 94 | + */ |
|
| 95 | + public function autoload( $class ){ |
|
| 96 | + |
|
| 97 | + // only handle classes with the word `sensei` in it |
|
| 98 | + if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){ |
|
| 99 | + |
|
| 100 | + return; |
|
| 101 | + |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + // exit if we didn't provide mapping for this class |
|
| 105 | + if( isset( $this->class_file_map[ $class ] ) ){ |
|
| 106 | + |
|
| 107 | + $file_location = $this->include_path . $this->class_file_map[ $class ]; |
|
| 108 | + require_once( $file_location); |
|
| 109 | + return; |
|
| 110 | + |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + // check for file in the main includes directory |
|
| 114 | + $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php'; |
|
| 115 | + if( file_exists( $class_file_path ) ){ |
|
| 116 | + |
|
| 117 | + require_once( $class_file_path ); |
|
| 118 | + return; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + // lastly check legacy types |
|
| 122 | + $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes |
|
| 123 | + $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php'; |
|
| 124 | + if( file_exists( $legacy_class_file_path ) ){ |
|
| 125 | + |
|
| 126 | + require_once( $legacy_class_file_path ); |
|
| 127 | + return; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + return; |
|
| 131 | 131 | |
| 132 | - }// end autoload |
|
| 132 | + }// end autoload |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | new Sensei_Autoloader(); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | add_action( 'sensei_course_status_updated', array( $this, 'learner_completed_course' ), 10, 4 ); |
| 52 | 52 | add_action( 'sensei_course_status_updated', array( $this, 'teacher_completed_course' ), 10, 4 ); |
| 53 | 53 | add_action( 'sensei_user_course_start', array( $this, 'teacher_started_course' ), 10, 2 ); |
| 54 | - add_action( 'sensei_user_lesson_end', array( $this, 'teacher_completed_lesson' ), 10, 2 ); |
|
| 54 | + add_action( 'sensei_user_lesson_end', array( $this, 'teacher_completed_lesson' ), 10, 2 ); |
|
| 55 | 55 | add_action( 'sensei_user_quiz_submitted', array( $this, 'teacher_quiz_submitted' ), 10, 5 ); |
| 56 | 56 | add_action( 'sensei_new_private_message', array( $this, 'teacher_new_message' ), 10, 1 ); |
| 57 | 57 | add_action( 'sensei_private_message_reply', array( $this, 'new_message_reply' ), 10, 2 ); |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | $this->emails['learner-graded-quiz'] = include( 'emails/class-woothemes-sensei-email-learner-graded-quiz.php' ); |
| 69 | 69 | $this->emails['learner-completed-course'] = include( 'emails/class-woothemes-sensei-email-learner-completed-course.php' ); |
| 70 | 70 | $this->emails['teacher-completed-course'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-course.php' ); |
| 71 | - $this->emails['teacher-started-course'] = include( 'emails/class-woothemes-sensei-email-teacher-started-course.php' ); |
|
| 72 | - $this->emails['teacher-completed-lesson'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-lesson.php' ); |
|
| 73 | - $this->emails['teacher-quiz-submitted'] = include( 'emails/class-woothemes-sensei-email-teacher-quiz-submitted.php' ); |
|
| 71 | + $this->emails['teacher-started-course'] = include( 'emails/class-woothemes-sensei-email-teacher-started-course.php' ); |
|
| 72 | + $this->emails['teacher-completed-lesson'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-lesson.php' ); |
|
| 73 | + $this->emails['teacher-quiz-submitted'] = include( 'emails/class-woothemes-sensei-email-teacher-quiz-submitted.php' ); |
|
| 74 | 74 | $this->emails['teacher-new-message'] = include( 'emails/class-woothemes-sensei-email-teacher-new-message.php' ); |
| 75 | 75 | $this->emails['new-message-reply'] = include( 'emails/class-woothemes-sensei-email-new-message-reply.php' ); |
| 76 | 76 | $this->emails = apply_filters( 'sensei_email_classes', $this->emails ); |
@@ -177,20 +177,20 @@ discard block |
||
| 177 | 177 | add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
| 178 | 178 | add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
| 179 | 179 | |
| 180 | - // Send |
|
| 181 | - $send_email = true; |
|
| 180 | + // Send |
|
| 181 | + $send_email = true; |
|
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * Filter Sensei's ability to send out emails. |
|
| 185 | - * |
|
| 186 | - * @since 1.8.0 |
|
| 187 | - * @param bool $send_email default true |
|
| 188 | - */ |
|
| 189 | - if( apply_filters('sensei_send_emails', $send_email,$to, $subject, $message ) ){ |
|
| 183 | + /** |
|
| 184 | + * Filter Sensei's ability to send out emails. |
|
| 185 | + * |
|
| 186 | + * @since 1.8.0 |
|
| 187 | + * @param bool $send_email default true |
|
| 188 | + */ |
|
| 189 | + if( apply_filters('sensei_send_emails', $send_email,$to, $subject, $message ) ){ |
|
| 190 | 190 | |
| 191 | - wp_mail( $to, $subject, $message, $headers, $attachments ); |
|
| 191 | + wp_mail( $to, $subject, $message, $headers, $attachments ); |
|
| 192 | 192 | |
| 193 | - } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | // Unhook filters |
| 196 | 196 | remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
@@ -332,33 +332,33 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - /** |
|
| 336 | - * teacher_completed_lesson() |
|
| 337 | - * |
|
| 338 | - * Send email to teacher on student completing lesson |
|
| 339 | - * |
|
| 340 | - * @access public |
|
| 341 | - * @return void |
|
| 342 | - * @since 1.9.0 |
|
| 343 | - */ |
|
| 344 | - function teacher_completed_lesson( $learner_id = 0, $lesson_id = 0 ) { |
|
| 345 | - |
|
| 346 | - |
|
| 347 | - $send = false; |
|
| 348 | - |
|
| 349 | - if( isset( Sensei()->settings->settings[ 'email_teachers' ] ) ) { |
|
| 350 | - if( in_array( 'teacher-completed-lesson', (array) Sensei()->settings->settings[ 'email_teachers' ]) ) { |
|
| 351 | - $send = true; |
|
| 352 | - } |
|
| 353 | - } else { |
|
| 354 | - $send = true; |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - if( $send ) { |
|
| 358 | - $email = $this->emails['teacher-completed-lesson']; |
|
| 359 | - $email->trigger( $learner_id, $lesson_id ); |
|
| 360 | - } |
|
| 361 | - } |
|
| 335 | + /** |
|
| 336 | + * teacher_completed_lesson() |
|
| 337 | + * |
|
| 338 | + * Send email to teacher on student completing lesson |
|
| 339 | + * |
|
| 340 | + * @access public |
|
| 341 | + * @return void |
|
| 342 | + * @since 1.9.0 |
|
| 343 | + */ |
|
| 344 | + function teacher_completed_lesson( $learner_id = 0, $lesson_id = 0 ) { |
|
| 345 | + |
|
| 346 | + |
|
| 347 | + $send = false; |
|
| 348 | + |
|
| 349 | + if( isset( Sensei()->settings->settings[ 'email_teachers' ] ) ) { |
|
| 350 | + if( in_array( 'teacher-completed-lesson', (array) Sensei()->settings->settings[ 'email_teachers' ]) ) { |
|
| 351 | + $send = true; |
|
| 352 | + } |
|
| 353 | + } else { |
|
| 354 | + $send = true; |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + if( $send ) { |
|
| 358 | + $email = $this->emails['teacher-completed-lesson']; |
|
| 359 | + $email->trigger( $learner_id, $lesson_id ); |
|
| 360 | + } |
|
| 361 | + } |
|
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | 364 | * Send email to teacher on quiz submission |
@@ -84,90 +84,90 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * Setup the "course" post type, it's admin menu item and the appropriate labels and permissions. |
| 86 | 86 | * @since 1.0.0 |
| 87 | - * @uses Sensei() |
|
| 87 | + * @uses Sensei() |
|
| 88 | 88 | * @return void |
| 89 | 89 | */ |
| 90 | 90 | public function setup_course_post_type () { |
| 91 | 91 | |
| 92 | 92 | $args = array( |
| 93 | - 'labels' => $this->create_post_type_labels( 'course', $this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu'] ), |
|
| 94 | - 'public' => true, |
|
| 95 | - 'publicly_queryable' => true, |
|
| 96 | - 'show_ui' => true, |
|
| 97 | - 'show_in_menu' => true, |
|
| 98 | - 'show_in_admin_bar' => true, |
|
| 99 | - 'query_var' => true, |
|
| 100 | - 'rewrite' => array( |
|
| 101 | - 'slug' => esc_attr( apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url base', 'woothemes-sensei' ) ) ) , |
|
| 102 | - 'with_front' => true, |
|
| 103 | - 'feeds' => true, |
|
| 104 | - 'pages' => true |
|
| 105 | - ), |
|
| 106 | - 'map_meta_cap' => true, |
|
| 107 | - 'capability_type' => 'course', |
|
| 108 | - 'has_archive' => $this->get_course_post_type_archive_slug(), |
|
| 109 | - 'hierarchical' => false, |
|
| 110 | - 'menu_position' => 51, |
|
| 111 | - 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ) |
|
| 93 | + 'labels' => $this->create_post_type_labels( 'course', $this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu'] ), |
|
| 94 | + 'public' => true, |
|
| 95 | + 'publicly_queryable' => true, |
|
| 96 | + 'show_ui' => true, |
|
| 97 | + 'show_in_menu' => true, |
|
| 98 | + 'show_in_admin_bar' => true, |
|
| 99 | + 'query_var' => true, |
|
| 100 | + 'rewrite' => array( |
|
| 101 | + 'slug' => esc_attr( apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url base', 'woothemes-sensei' ) ) ) , |
|
| 102 | + 'with_front' => true, |
|
| 103 | + 'feeds' => true, |
|
| 104 | + 'pages' => true |
|
| 105 | + ), |
|
| 106 | + 'map_meta_cap' => true, |
|
| 107 | + 'capability_type' => 'course', |
|
| 108 | + 'has_archive' => $this->get_course_post_type_archive_slug(), |
|
| 109 | + 'hierarchical' => false, |
|
| 110 | + 'menu_position' => 51, |
|
| 111 | + 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ) |
|
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * Filter the arguments passed in when registering the Sensei Course post type. |
|
| 116 | - * |
|
| 117 | - * @since 1.9.0 |
|
| 118 | - * @param array $args |
|
| 119 | - */ |
|
| 114 | + /** |
|
| 115 | + * Filter the arguments passed in when registering the Sensei Course post type. |
|
| 116 | + * |
|
| 117 | + * @since 1.9.0 |
|
| 118 | + * @param array $args |
|
| 119 | + */ |
|
| 120 | 120 | register_post_type( 'course', apply_filters( 'sensei_register_post_type_course', $args ) ); |
| 121 | 121 | |
| 122 | 122 | } // End setup_course_post_type() |
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Figure out of the course post type has an archive and what it should be. |
|
| 126 | - * |
|
| 127 | - * This function should return 'courses' or the page_uri for the course page setting. |
|
| 128 | - * |
|
| 129 | - * For backward compatibility sake ( pre 1.9 )If the course page set in settings |
|
| 130 | - * still has any of the old shortcodes: [newcourses][featuredcourses][freecourses][paidcourses] the |
|
| 131 | - * page slug will not be returned. For any other pages without it the page URI will be returned. |
|
| 132 | - * |
|
| 133 | - * |
|
| 134 | - * @sine 1.9.0 |
|
| 135 | - * |
|
| 136 | - * |
|
| 137 | - * @return false|string |
|
| 138 | - */ |
|
| 139 | - public function get_course_post_type_archive_slug(){ |
|
| 124 | + /** |
|
| 125 | + * Figure out of the course post type has an archive and what it should be. |
|
| 126 | + * |
|
| 127 | + * This function should return 'courses' or the page_uri for the course page setting. |
|
| 128 | + * |
|
| 129 | + * For backward compatibility sake ( pre 1.9 )If the course page set in settings |
|
| 130 | + * still has any of the old shortcodes: [newcourses][featuredcourses][freecourses][paidcourses] the |
|
| 131 | + * page slug will not be returned. For any other pages without it the page URI will be returned. |
|
| 132 | + * |
|
| 133 | + * |
|
| 134 | + * @sine 1.9.0 |
|
| 135 | + * |
|
| 136 | + * |
|
| 137 | + * @return false|string |
|
| 138 | + */ |
|
| 139 | + public function get_course_post_type_archive_slug(){ |
|
| 140 | 140 | |
| 141 | - $settings_course_page = get_post( Sensei()->settings->get( 'course_page' ) ); |
|
| 141 | + $settings_course_page = get_post( Sensei()->settings->get( 'course_page' ) ); |
|
| 142 | 142 | |
| 143 | - // for a valid post that doesn't have any of the old short codes set the archive the same |
|
| 144 | - // as the page URI |
|
| 145 | - if( is_a( $settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes( $settings_course_page->post_content ) ){ |
|
| 143 | + // for a valid post that doesn't have any of the old short codes set the archive the same |
|
| 144 | + // as the page URI |
|
| 145 | + if( is_a( $settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes( $settings_course_page->post_content ) ){ |
|
| 146 | 146 | |
| 147 | - return get_page_uri( $settings_course_page->ID ); |
|
| 147 | + return get_page_uri( $settings_course_page->ID ); |
|
| 148 | 148 | |
| 149 | - }else{ |
|
| 149 | + }else{ |
|
| 150 | 150 | |
| 151 | - return 'courses'; |
|
| 151 | + return 'courses'; |
|
| 152 | 152 | |
| 153 | - } |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - }// end course_post_type_determine_archive |
|
| 155 | + }// end course_post_type_determine_archive |
|
| 156 | 156 | |
| 157 | - /** |
|
| 158 | - * Check if given content has any of these old shortcodes: |
|
| 159 | - * [newcourses][featuredcourses][freecourses][paidcourses] |
|
| 160 | - * |
|
| 161 | - * @since 1.9.0 |
|
| 162 | - */ |
|
| 163 | - public function has_old_shortcodes( $content ){ |
|
| 157 | + /** |
|
| 158 | + * Check if given content has any of these old shortcodes: |
|
| 159 | + * [newcourses][featuredcourses][freecourses][paidcourses] |
|
| 160 | + * |
|
| 161 | + * @since 1.9.0 |
|
| 162 | + */ |
|
| 163 | + public function has_old_shortcodes( $content ){ |
|
| 164 | 164 | |
| 165 | - return ( has_shortcode( $content, 'newcourses') |
|
| 166 | - || has_shortcode( $content, 'featuredcourses') |
|
| 167 | - || has_shortcode( $content, 'freecourses') |
|
| 168 | - || has_shortcode( $content, 'paidcourses') ); |
|
| 165 | + return ( has_shortcode( $content, 'newcourses') |
|
| 166 | + || has_shortcode( $content, 'featuredcourses') |
|
| 167 | + || has_shortcode( $content, 'freecourses') |
|
| 168 | + || has_shortcode( $content, 'paidcourses') ); |
|
| 169 | 169 | |
| 170 | - }// end has old shortcodes |
|
| 170 | + }// end has old shortcodes |
|
| 171 | 171 | |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -189,32 +189,32 @@ discard block |
||
| 189 | 189 | } // End If Statement |
| 190 | 190 | |
| 191 | 191 | $args = array( |
| 192 | - 'labels' => $this->create_post_type_labels( 'lesson', $this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu'] ), |
|
| 193 | - 'public' => true, |
|
| 194 | - 'publicly_queryable' => true, |
|
| 195 | - 'show_ui' => true, |
|
| 196 | - 'show_in_menu' => true, |
|
| 197 | - 'query_var' => true, |
|
| 198 | - 'rewrite' => array( |
|
| 199 | - 'slug' => esc_attr( apply_filters( 'sensei_lesson_slug', _x( 'lesson', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 200 | - 'with_front' => true, |
|
| 201 | - 'feeds' => true, |
|
| 202 | - 'pages' => true |
|
| 203 | - ), |
|
| 204 | - 'map_meta_cap' => true, |
|
| 205 | - 'capability_type' => 'lesson', |
|
| 206 | - 'has_archive' => true, |
|
| 207 | - 'hierarchical' => false, |
|
| 208 | - 'menu_position' => 52, |
|
| 209 | - 'supports' => $supports_array |
|
| 192 | + 'labels' => $this->create_post_type_labels( 'lesson', $this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu'] ), |
|
| 193 | + 'public' => true, |
|
| 194 | + 'publicly_queryable' => true, |
|
| 195 | + 'show_ui' => true, |
|
| 196 | + 'show_in_menu' => true, |
|
| 197 | + 'query_var' => true, |
|
| 198 | + 'rewrite' => array( |
|
| 199 | + 'slug' => esc_attr( apply_filters( 'sensei_lesson_slug', _x( 'lesson', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 200 | + 'with_front' => true, |
|
| 201 | + 'feeds' => true, |
|
| 202 | + 'pages' => true |
|
| 203 | + ), |
|
| 204 | + 'map_meta_cap' => true, |
|
| 205 | + 'capability_type' => 'lesson', |
|
| 206 | + 'has_archive' => true, |
|
| 207 | + 'hierarchical' => false, |
|
| 208 | + 'menu_position' => 52, |
|
| 209 | + 'supports' => $supports_array |
|
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | - /** |
|
| 213 | - * Filter the arguments passed in when registering the Sensei Lesson post type. |
|
| 214 | - * |
|
| 215 | - * @since 1.9.0 |
|
| 216 | - * @param array $args |
|
| 217 | - */ |
|
| 212 | + /** |
|
| 213 | + * Filter the arguments passed in when registering the Sensei Lesson post type. |
|
| 214 | + * |
|
| 215 | + * @since 1.9.0 |
|
| 216 | + * @param array $args |
|
| 217 | + */ |
|
| 218 | 218 | register_post_type( 'lesson', apply_filters( 'sensei_register_post_type_lesson', $args ) ); |
| 219 | 219 | |
| 220 | 220 | } // End setup_lesson_post_type() |
@@ -222,46 +222,46 @@ discard block |
||
| 222 | 222 | /** |
| 223 | 223 | * Setup the "quiz" post type, it's admin menu item and the appropriate labels and permissions. |
| 224 | 224 | * @since 1.0.0 |
| 225 | - * @uses Sensei() |
|
| 225 | + * @uses Sensei() |
|
| 226 | 226 | * @return void |
| 227 | 227 | */ |
| 228 | 228 | public function setup_quiz_post_type () { |
| 229 | 229 | |
| 230 | 230 | |
| 231 | 231 | $args = array( |
| 232 | - 'labels' => $this->create_post_type_labels( |
|
| 233 | - 'quiz', |
|
| 234 | - $this->labels['quiz']['singular'], |
|
| 235 | - $this->labels['quiz']['plural'], |
|
| 236 | - $this->labels['quiz']['menu'] |
|
| 237 | - ), |
|
| 238 | - 'public' => true, |
|
| 239 | - 'publicly_queryable' => true, |
|
| 240 | - 'show_ui' => true, |
|
| 241 | - 'show_in_menu' => false, |
|
| 242 | - 'show_in_nav_menus' => false, |
|
| 243 | - 'query_var' => true, |
|
| 244 | - 'exclude_from_search' => true, |
|
| 245 | - 'rewrite' => array( |
|
| 246 | - 'slug' => esc_attr( apply_filters( 'sensei_quiz_slug', _x( 'quiz', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 247 | - 'with_front' => true, |
|
| 248 | - 'feeds' => true, |
|
| 249 | - 'pages' => true |
|
| 250 | - ), |
|
| 251 | - 'map_meta_cap' => true, |
|
| 252 | - 'capability_type' => 'quiz', |
|
| 253 | - 'has_archive' => false, |
|
| 254 | - 'hierarchical' => false, |
|
| 255 | - 'menu_position' => 20, // Below "Pages" |
|
| 256 | - 'supports' => array( '' ) |
|
| 232 | + 'labels' => $this->create_post_type_labels( |
|
| 233 | + 'quiz', |
|
| 234 | + $this->labels['quiz']['singular'], |
|
| 235 | + $this->labels['quiz']['plural'], |
|
| 236 | + $this->labels['quiz']['menu'] |
|
| 237 | + ), |
|
| 238 | + 'public' => true, |
|
| 239 | + 'publicly_queryable' => true, |
|
| 240 | + 'show_ui' => true, |
|
| 241 | + 'show_in_menu' => false, |
|
| 242 | + 'show_in_nav_menus' => false, |
|
| 243 | + 'query_var' => true, |
|
| 244 | + 'exclude_from_search' => true, |
|
| 245 | + 'rewrite' => array( |
|
| 246 | + 'slug' => esc_attr( apply_filters( 'sensei_quiz_slug', _x( 'quiz', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 247 | + 'with_front' => true, |
|
| 248 | + 'feeds' => true, |
|
| 249 | + 'pages' => true |
|
| 250 | + ), |
|
| 251 | + 'map_meta_cap' => true, |
|
| 252 | + 'capability_type' => 'quiz', |
|
| 253 | + 'has_archive' => false, |
|
| 254 | + 'hierarchical' => false, |
|
| 255 | + 'menu_position' => 20, // Below "Pages" |
|
| 256 | + 'supports' => array( '' ) |
|
| 257 | 257 | ); |
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * Filter the arguments passed in when registering the Sensei Quiz post type. |
|
| 261 | - * |
|
| 262 | - * @since 1.9.0 |
|
| 263 | - * @param array $args |
|
| 264 | - */ |
|
| 259 | + /** |
|
| 260 | + * Filter the arguments passed in when registering the Sensei Quiz post type. |
|
| 261 | + * |
|
| 262 | + * @since 1.9.0 |
|
| 263 | + * @param array $args |
|
| 264 | + */ |
|
| 265 | 265 | register_post_type( 'quiz', apply_filters( 'sensei_register_post_type_quiz', $args ) ); |
| 266 | 266 | |
| 267 | 267 | } // End setup_quiz_post_type() |
@@ -275,34 +275,34 @@ discard block |
||
| 275 | 275 | public function setup_question_post_type () { |
| 276 | 276 | |
| 277 | 277 | $args = array( |
| 278 | - 'labels' => $this->create_post_type_labels( 'question', $this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu'] ), |
|
| 279 | - 'public' => false, |
|
| 280 | - 'publicly_queryable' => true, |
|
| 281 | - 'show_ui' => true, |
|
| 282 | - 'show_in_menu' => true, |
|
| 283 | - 'show_in_nav_menus' => false, |
|
| 284 | - 'query_var' => true, |
|
| 285 | - 'exclude_from_search' => true, |
|
| 286 | - 'rewrite' => array( |
|
| 287 | - 'slug' => esc_attr( apply_filters( 'sensei_question_slug', _x( 'question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 288 | - 'with_front' => true, |
|
| 289 | - 'feeds' => true, |
|
| 290 | - 'pages' => true |
|
| 291 | - ), |
|
| 292 | - 'map_meta_cap' => true, |
|
| 293 | - 'capability_type' => 'question', |
|
| 294 | - 'has_archive' => true, |
|
| 295 | - 'hierarchical' => false, |
|
| 296 | - 'menu_position' => 51, |
|
| 297 | - 'supports' => array( 'title' ) |
|
| 278 | + 'labels' => $this->create_post_type_labels( 'question', $this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu'] ), |
|
| 279 | + 'public' => false, |
|
| 280 | + 'publicly_queryable' => true, |
|
| 281 | + 'show_ui' => true, |
|
| 282 | + 'show_in_menu' => true, |
|
| 283 | + 'show_in_nav_menus' => false, |
|
| 284 | + 'query_var' => true, |
|
| 285 | + 'exclude_from_search' => true, |
|
| 286 | + 'rewrite' => array( |
|
| 287 | + 'slug' => esc_attr( apply_filters( 'sensei_question_slug', _x( 'question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 288 | + 'with_front' => true, |
|
| 289 | + 'feeds' => true, |
|
| 290 | + 'pages' => true |
|
| 291 | + ), |
|
| 292 | + 'map_meta_cap' => true, |
|
| 293 | + 'capability_type' => 'question', |
|
| 294 | + 'has_archive' => true, |
|
| 295 | + 'hierarchical' => false, |
|
| 296 | + 'menu_position' => 51, |
|
| 297 | + 'supports' => array( 'title' ) |
|
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | - /** |
|
| 301 | - * Filter the arguments passed in when registering the Sensei Question post type. |
|
| 302 | - * |
|
| 303 | - * @since 1.9.0 |
|
| 304 | - * @param array $args |
|
| 305 | - */ |
|
| 300 | + /** |
|
| 301 | + * Filter the arguments passed in when registering the Sensei Question post type. |
|
| 302 | + * |
|
| 303 | + * @since 1.9.0 |
|
| 304 | + * @param array $args |
|
| 305 | + */ |
|
| 306 | 306 | register_post_type( 'question', apply_filters('sensei_register_post_type_question', $args ) ); |
| 307 | 307 | |
| 308 | 308 | } // End setup_question_post_type() |
@@ -315,26 +315,26 @@ discard block |
||
| 315 | 315 | public function setup_multiple_question_post_type () { |
| 316 | 316 | |
| 317 | 317 | $args = array( |
| 318 | - 'labels' => $this->create_post_type_labels( 'multiple_question', $this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu'] ), |
|
| 319 | - 'public' => false, |
|
| 320 | - 'publicly_queryable' => false, |
|
| 321 | - 'show_ui' => false, |
|
| 322 | - 'show_in_menu' => false, |
|
| 323 | - 'show_in_nav_menus' => false, |
|
| 324 | - 'query_var' => false, |
|
| 325 | - 'exclude_from_search' => true, |
|
| 326 | - 'rewrite' => array( |
|
| 327 | - 'slug' => esc_attr( apply_filters( 'sensei_multiple_question_slug', _x( 'multiple_question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 328 | - 'with_front' => false, |
|
| 329 | - 'feeds' => false, |
|
| 330 | - 'pages' => false |
|
| 331 | - ), |
|
| 332 | - 'map_meta_cap' => true, |
|
| 333 | - 'capability_type' => 'question', |
|
| 334 | - 'has_archive' => false, |
|
| 335 | - 'hierarchical' => false, |
|
| 336 | - 'menu_position' => 51, |
|
| 337 | - 'supports' => array( 'title', 'custom-fields' ) |
|
| 318 | + 'labels' => $this->create_post_type_labels( 'multiple_question', $this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu'] ), |
|
| 319 | + 'public' => false, |
|
| 320 | + 'publicly_queryable' => false, |
|
| 321 | + 'show_ui' => false, |
|
| 322 | + 'show_in_menu' => false, |
|
| 323 | + 'show_in_nav_menus' => false, |
|
| 324 | + 'query_var' => false, |
|
| 325 | + 'exclude_from_search' => true, |
|
| 326 | + 'rewrite' => array( |
|
| 327 | + 'slug' => esc_attr( apply_filters( 'sensei_multiple_question_slug', _x( 'multiple_question', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 328 | + 'with_front' => false, |
|
| 329 | + 'feeds' => false, |
|
| 330 | + 'pages' => false |
|
| 331 | + ), |
|
| 332 | + 'map_meta_cap' => true, |
|
| 333 | + 'capability_type' => 'question', |
|
| 334 | + 'has_archive' => false, |
|
| 335 | + 'hierarchical' => false, |
|
| 336 | + 'menu_position' => 51, |
|
| 337 | + 'supports' => array( 'title', 'custom-fields' ) |
|
| 338 | 338 | ); |
| 339 | 339 | |
| 340 | 340 | register_post_type( 'multiple_question', $args ); |
@@ -351,34 +351,34 @@ discard block |
||
| 351 | 351 | if( ! isset( Sensei()->settings->settings['messages_disable'] ) || ! Sensei()->settings->settings['messages_disable'] ) { |
| 352 | 352 | |
| 353 | 353 | $args = array( |
| 354 | - 'labels' => $this->create_post_type_labels( 'sensei_message', $this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu'] ), |
|
| 355 | - 'public' => true, |
|
| 356 | - 'publicly_queryable' => true, |
|
| 357 | - 'show_ui' => true, |
|
| 358 | - 'show_in_menu' => 'sensei', |
|
| 359 | - 'show_in_nav_menus' => true, |
|
| 360 | - 'query_var' => true, |
|
| 361 | - 'exclude_from_search' => true, |
|
| 362 | - 'rewrite' => array( |
|
| 363 | - 'slug' => esc_attr( apply_filters( 'sensei_messages_slug', _x( 'messages', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 364 | - 'with_front' => false, |
|
| 365 | - 'feeds' => false, |
|
| 366 | - 'pages' => true |
|
| 367 | - ), |
|
| 368 | - 'map_meta_cap' => true, |
|
| 369 | - 'capability_type' => 'question', |
|
| 370 | - 'has_archive' => true, |
|
| 371 | - 'hierarchical' => false, |
|
| 372 | - 'menu_position' => 50, |
|
| 373 | - 'supports' => array( 'title', 'editor', 'comments' ), |
|
| 354 | + 'labels' => $this->create_post_type_labels( 'sensei_message', $this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu'] ), |
|
| 355 | + 'public' => true, |
|
| 356 | + 'publicly_queryable' => true, |
|
| 357 | + 'show_ui' => true, |
|
| 358 | + 'show_in_menu' => 'sensei', |
|
| 359 | + 'show_in_nav_menus' => true, |
|
| 360 | + 'query_var' => true, |
|
| 361 | + 'exclude_from_search' => true, |
|
| 362 | + 'rewrite' => array( |
|
| 363 | + 'slug' => esc_attr( apply_filters( 'sensei_messages_slug', _x( 'messages', 'post type single slug', 'woothemes-sensei' ) ) ) , |
|
| 364 | + 'with_front' => false, |
|
| 365 | + 'feeds' => false, |
|
| 366 | + 'pages' => true |
|
| 367 | + ), |
|
| 368 | + 'map_meta_cap' => true, |
|
| 369 | + 'capability_type' => 'question', |
|
| 370 | + 'has_archive' => true, |
|
| 371 | + 'hierarchical' => false, |
|
| 372 | + 'menu_position' => 50, |
|
| 373 | + 'supports' => array( 'title', 'editor', 'comments' ), |
|
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | - /** |
|
| 377 | - * Filter the arguments passed in when registering the Sensei sensei_message post type. |
|
| 378 | - * |
|
| 379 | - * @since 1.9.0 |
|
| 380 | - * @param array $args |
|
| 381 | - */ |
|
| 376 | + /** |
|
| 377 | + * Filter the arguments passed in when registering the Sensei sensei_message post type. |
|
| 378 | + * |
|
| 379 | + * @since 1.9.0 |
|
| 380 | + * @param array $args |
|
| 381 | + */ |
|
| 382 | 382 | register_post_type( 'sensei_message', apply_filters('sensei_register_post_type_sensei_message', $args ) ); |
| 383 | 383 | } |
| 384 | 384 | } // End setup_sensei_message_post_type() |
@@ -411,11 +411,11 @@ discard block |
||
| 411 | 411 | 'show_ui' => true, |
| 412 | 412 | 'query_var' => true, |
| 413 | 413 | 'show_in_nav_menus' => true, |
| 414 | - 'capabilities' => array( |
|
| 415 | - 'manage_terms' => 'manage_categories', |
|
| 416 | - 'edit_terms' => 'edit_courses', |
|
| 417 | - 'delete_terms' => 'manage_categories', |
|
| 418 | - 'assign_terms' => 'edit_courses',), |
|
| 414 | + 'capabilities' => array( |
|
| 415 | + 'manage_terms' => 'manage_categories', |
|
| 416 | + 'edit_terms' => 'edit_courses', |
|
| 417 | + 'delete_terms' => 'manage_categories', |
|
| 418 | + 'assign_terms' => 'edit_courses',), |
|
| 419 | 419 | 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_course_category_slug', _x( 'course-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
| 420 | 420 | ); |
| 421 | 421 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | 'show_ui' => true, /* TO DO - future releases */ |
| 452 | 452 | 'query_var' => true, |
| 453 | 453 | 'show_in_nav_menus' => false, |
| 454 | - 'public' => false, |
|
| 454 | + 'public' => false, |
|
| 455 | 455 | 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_quiz_type_slug', _x( 'quiz-type', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
| 456 | 456 | ); |
| 457 | 457 | |
@@ -523,11 +523,11 @@ discard block |
||
| 523 | 523 | 'query_var' => false, |
| 524 | 524 | 'show_in_nav_menus' => false, |
| 525 | 525 | 'show_admin_column' => true, |
| 526 | - 'capabilities' => array( |
|
| 527 | - 'manage_terms' => 'manage_categories', |
|
| 528 | - 'edit_terms' => 'edit_questions', |
|
| 529 | - 'delete_terms' => 'manage_categories', |
|
| 530 | - 'assign_terms' => 'edit_questions',), |
|
| 526 | + 'capabilities' => array( |
|
| 527 | + 'manage_terms' => 'manage_categories', |
|
| 528 | + 'edit_terms' => 'edit_questions', |
|
| 529 | + 'delete_terms' => 'manage_categories', |
|
| 530 | + 'assign_terms' => 'edit_questions',), |
|
| 531 | 531 | 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_question_category_slug', _x( 'question-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
| 532 | 532 | ); |
| 533 | 533 | |
@@ -561,11 +561,11 @@ discard block |
||
| 561 | 561 | 'show_ui' => true, |
| 562 | 562 | 'query_var' => true, |
| 563 | 563 | 'show_in_nav_menus' => true, |
| 564 | - 'capabilities' => array( |
|
| 565 | - 'manage_terms' => 'manage_categories', |
|
| 566 | - 'edit_terms' => 'edit_lessons', |
|
| 567 | - 'delete_terms' => 'manage_categories', |
|
| 568 | - 'assign_terms' => 'edit_lessons',), |
|
| 564 | + 'capabilities' => array( |
|
| 565 | + 'manage_terms' => 'manage_categories', |
|
| 566 | + 'edit_terms' => 'edit_lessons', |
|
| 567 | + 'delete_terms' => 'manage_categories', |
|
| 568 | + 'assign_terms' => 'edit_lessons',), |
|
| 569 | 569 | 'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_lesson_tag_slug', _x( 'lesson-tag', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) ) |
| 570 | 570 | ); |
| 571 | 571 | |
@@ -600,19 +600,19 @@ discard block |
||
| 600 | 600 | */ |
| 601 | 601 | private function create_post_type_labels ( $token, $singular, $plural, $menu ) { |
| 602 | 602 | $labels = array( |
| 603 | - 'name' => sprintf( _x( '%s', 'post type general name', 'woothemes-sensei' ), $plural ), |
|
| 604 | - 'singular_name' => sprintf( _x( '%s', 'post type singular name', 'woothemes-sensei' ), $singular ), |
|
| 605 | - 'add_new' => __( 'Add New', 'woothemes-sensei' ), |
|
| 606 | - 'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-sensei' ), $singular ), |
|
| 607 | - 'edit_item' => sprintf( __( 'Edit %s', 'woothemes-sensei' ), $singular ), |
|
| 608 | - 'new_item' => sprintf( __( 'New %s', 'woothemes-sensei' ), $singular ), |
|
| 609 | - 'all_items' => sprintf( __( 'All %s', 'woothemes-sensei' ), $plural ), |
|
| 610 | - 'view_item' => sprintf( __( 'View %s', 'woothemes-sensei' ), $singular ), |
|
| 611 | - 'search_items' => sprintf( __( 'Search %s', 'woothemes-sensei' ), $plural ), |
|
| 612 | - 'not_found' => sprintf( __( 'No %s found', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
| 613 | - 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
| 614 | - 'parent_item_colon' => '', |
|
| 615 | - 'menu_name' => sprintf( __( '%s', 'woothemes-sensei' ), $menu ) |
|
| 603 | + 'name' => sprintf( _x( '%s', 'post type general name', 'woothemes-sensei' ), $plural ), |
|
| 604 | + 'singular_name' => sprintf( _x( '%s', 'post type singular name', 'woothemes-sensei' ), $singular ), |
|
| 605 | + 'add_new' => __( 'Add New', 'woothemes-sensei' ), |
|
| 606 | + 'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-sensei' ), $singular ), |
|
| 607 | + 'edit_item' => sprintf( __( 'Edit %s', 'woothemes-sensei' ), $singular ), |
|
| 608 | + 'new_item' => sprintf( __( 'New %s', 'woothemes-sensei' ), $singular ), |
|
| 609 | + 'all_items' => sprintf( __( 'All %s', 'woothemes-sensei' ), $plural ), |
|
| 610 | + 'view_item' => sprintf( __( 'View %s', 'woothemes-sensei' ), $singular ), |
|
| 611 | + 'search_items' => sprintf( __( 'Search %s', 'woothemes-sensei' ), $plural ), |
|
| 612 | + 'not_found' => sprintf( __( 'No %s found', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
| 613 | + 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ), |
|
| 614 | + 'parent_item_colon' => '', |
|
| 615 | + 'menu_name' => sprintf( __( '%s', 'woothemes-sensei' ), $menu ) |
|
| 616 | 616 | ); |
| 617 | 617 | |
| 618 | 618 | return $labels; |