Changeset 1403599
- Timestamp:
- 04/25/2016 07:50:05 AM (10 years ago)
- Location:
- techxplorers-anime-list/trunk
- Files:
-
- 1 added
- 4 edited
-
admin/class-txp-anime-list-admin.php (modified) (4 diffs)
-
admin/class-txp-util-array.php (added)
-
admin/partials/txp-anime-list-admin-display.php (modified) (1 diff)
-
public/js/txp-anime-list-public.js (modified) (2 diffs)
-
txp-anime-list.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
techxplorers-anime-list/trunk/admin/class-txp-anime-list-admin.php
r1370047 r1403599 167 167 // Display alternate titles. 168 168 $valid['alttitles'] = ( isset( $input['alttitles'] ) && ! empty( $input['alttitles'] ) ) ? 1 : 0; 169 170 // Sort title list alphabetically. 171 $valid['sort'] = ( isset( $input['sort'] ) && ! empty( $input['sort'] ) ) ? 1 : 0; 169 172 170 173 // Hummingbird username. … … 340 343 public function get_hummingbird_data( $username ) { 341 344 345 $records = array(); 346 342 347 // @codingStandardsIgnoreStart 343 348 // Ignore the warning about wp_remote_get and using vip_safe_wp_remote_get() instead. … … 347 352 348 353 if ( is_array( $response ) && ! is_wp_error( $response ) ) { 349 return json_decode( wp_remote_retrieve_body( $response ) ); 350 } 351 352 return array(); 354 $records = json_decode( wp_remote_retrieve_body( $response ) ); 355 } 356 357 // Put a custom element to sort by title if necessary. 358 foreach ( $records as $record ) { 359 $record->txp_title = $record->anime->title; 360 } 361 362 return $records; 353 363 } 354 364 … … 389 399 // Get the data from Hummingbird. 390 400 $records = $this->get_hummingbird_data( $options['username'] ); 401 402 // Sort the list of titles if required 403 if ( isset( $options['sort'] ) && ! empty( $options['sort'] ) ) { 404 require_once __DIR__ . '/class-txp-util-array.php'; 405 406 $records = Txp_Utils_Array::sort_array_by_element( $records, 'txp_title' ); 407 } 391 408 392 409 // Build the HTML. -
techxplorers-anime-list/trunk/admin/partials/txp-anime-list-admin-display.php
r1370047 r1403599 95 95 </fieldset> 96 96 </li> 97 <li> 98 <!-- Sort titles alphabetically --> 99 <fieldset> 100 <legend class="screen-reader-text"><span><?php esc_html_e( 'Sort title list alphabetically.', $this->plugin_name ); ?></span></legend> 101 <label for="<?php echo esc_html( $this->plugin_name ); ?>-sort"> 102 <input type="checkbox" 103 id="<?php echo esc_html( $this->plugin_name ); ?>-sort" 104 name="<?php echo esc_html( $this->plugin_name ); ?>[sort]" 105 value="1" <?php checked( $options['sort'], 1 ); ?>/> 106 <span><?php esc_html_e( 'Sort anime list alphabetically, by canonical title.', $this->plugin_name ); ?></span> 107 </label> 108 </fieldset> 109 </li> 97 110 </ul> 98 111 </div> -
techxplorers-anime-list/trunk/public/js/txp-anime-list-public.js
r1370047 r1403599 3 3 4 4 $( '.widget_txp-anime-list' ).ready( function() { 5 console.log( 'Yay!' );6 console.log(txp_anime_list);7 5 8 6 $.ajax({ … … 35 33 $( '.txp-anime-list-load' ).hide(); 36 34 } 37 console.log( response );38 35 } 39 36 }); -
techxplorers-anime-list/trunk/txp-anime-list.php
r1370047 r1403599 11 11 * Plugin URI: https://techxplorer.com/projects/txp-anime-list/ 12 12 * Description: Display a list of anime titles on your site via a shortcode or widget. 13 * Version: 1. 1.013 * Version: 1.2.0 14 14 * Author: techxplorer 15 15 * Author URI: https://techxplorer.com
Note: See TracChangeset
for help on using the changeset viewer.