Changeset 12053 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/autocomplete.php
- Timestamp:
- 09/05/2022 08:21:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/autocomplete.php
r12051 r12053 22 22 public function init() { 23 23 24 add_action( 'wp_ajax_autocomplete', array( $this, 'autocomplete_data_update' ) );25 add_action( "wp_ajax_nopriv_autocomplete",array( $this, 'autocomplete_data_update' ) );24 add_action( 'wp_ajax_autocomplete', array( $this, 'autocomplete_data_update' ) ); 25 add_action( 'wp_ajax_nopriv_autocomplete', array( $this, 'autocomplete_data_update' ) ); 26 26 27 27 // Enqueue scripts and styles. … … 37 37 public function scripts_and_styles() { 38 38 39 wp_enqueue_style( 'awesomplete-css', get_template_directory_uri() . '/stylesheets/awesomplete.css', array(), '20220905' ); 40 wp_enqueue_style( 'autocomplete-css', get_template_directory_uri() . '/stylesheets/autocomplete.css', array(), '20220905' ); 39 wp_enqueue_style( 40 'awesomplete-css', 41 get_template_directory_uri() . '/stylesheets/awesomplete.css', 42 array(), 43 filemtime( dirname( __DIR__ ) . '/stylesheets/awesomplete.css' ) 44 ); 45 wp_enqueue_style( 46 'autocomplete-css', 47 get_template_directory_uri() . '/stylesheets/autocomplete.css', 48 array(), 49 filemtime( dirname( __DIR__ ) . '/stylesheets/autocomplete.css' ) 50 ); 41 51 42 wp_register_script( 'awesomplete', get_template_directory_uri() . '/js/awesomplete.min.js', array(), '20220905', true ); 52 wp_register_script( 53 'awesomplete', 54 get_template_directory_uri() . '/js/awesomplete.min.js', 55 array(), 56 filemtime( dirname( __DIR__ ) . '/js/awesomplete.min.js' ), 57 true 58 ); 43 59 wp_enqueue_script( 'awesomplete' ); 44 60 45 61 wp_register_script( 'autocomplete', get_stylesheet_directory_uri() . '/js/autocomplete.js', array( 'awesomplete' ), filemtime( dirname( __DIR__ ) . '/js/autocomplete.js' ), true ); 46 wp_localize_script( 'autocomplete', 'autocomplete', array( 62 wp_localize_script( 63 'autocomplete', 64 'autocomplete', 65 array( 47 66 'ajaxurl' => admin_url( 'admin-ajax.php' ), 48 67 'nonce' => wp_create_nonce( 'autocomplete_nonce' ), … … 72 91 ); 73 92 74 if ( ! ( isset( $_POST['data'] ) && $_POST['data'] ) ) {93 if ( ! ( isset( $_POST['data'] ) && $_POST['data'] ) ) { 75 94 wp_send_json_error( $defaults ); 76 95 } … … 86 105 87 106 foreach ( $form_data['post_type'] as $key => $post_type ) { 88 if ( ! in_array( $post_type, $parser_post_types ) ) {107 if ( ! in_array( $post_type, $parser_post_types ) ) { 89 108 unset( $form_data['post_type'][ $key ] ); 90 109 } 91 110 } 92 111 93 $post_types = ! empty( $form_data['post_type'] ) ? $form_data['post_type'] : $parser_post_types;112 $post_types = ! empty( $form_data['post_type'] ) ? $form_data['post_type'] : $parser_post_types; 94 113 95 114 $args = array( … … 117 136 118 137 if ( $post->post_type == 'wp-parser-class' ) { 119 $title = 'class ' . $title . ' {}';138 $title = 'class ' . $title . ' {}'; 120 139 } 121 140 … … 124 143 } 125 144 126 wp_send_json_success ( $form_data );145 wp_send_json_success( $form_data ); 127 146 } 128 147
Note: See TracChangeset
for help on using the changeset viewer.