Changeset 2746019
- Timestamp:
- 06/21/2022 05:54:56 PM (4 years ago)
- Location:
- custom-ajax-search-results/trunk
- Files:
-
- 10 edited
-
casr.php (modified) (2 diffs)
-
includes/class-casr-register-settings.php (modified) (1 diff)
-
includes/class-casr-search-form.php (modified) (1 diff)
-
includes/class-casr-search-results.php (modified) (3 diffs)
-
includes/class-casr-settings-page.php (modified) (7 diffs)
-
includes/class-casr.php (modified) (2 diffs)
-
includes/reusable/casr-ajax-get-settings.php (modified) (1 diff)
-
includes/reusable/casr-content.php (modified) (1 diff)
-
languages/casr.pot (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
custom-ajax-search-results/trunk/casr.php
r2742539 r2746019 6 6 * Version: 1.0.0 7 7 * Author URI: https://linkedin.com/in/joaovpdls 8 * Text Domain: c asr8 * Text Domain: custom-ajax-search-results 9 9 * Domain Path: /languages 10 10 * License: GPLv2 or later … … 19 19 20 20 function casr_load_text_domain() { 21 load_plugin_textdomain( 'c asr', false, plugin_basename( __DIR__ ) . '/languages/' );21 load_plugin_textdomain( 'custom-ajax-search-results', false, plugin_basename( __DIR__ ) . '/languages/' ); 22 22 } 23 23 -
custom-ajax-search-results/trunk/includes/class-casr-register-settings.php
r2742539 r2746019 18 18 register_setting( 'casr_options_group', 'casr-placeholder', $args = array( 19 19 'type' => 'string', 20 'default' => __( 'Type here', 'c asr' ),20 'default' => __( 'Type here', 'custom-ajax-search-results' ), 21 21 'sanitize_callback' => 'sanitize_text_field', 22 22 ) ); 23 23 register_setting( 'casr_options_group', 'casr-search-button', $args = array( 24 24 'type' => 'string', 25 'default' => __( 'Search', 'c asr' ),25 'default' => __( 'Search', 'custom-ajax-search-results' ), 26 26 'sanitize_callback' => 'sanitize_text_field', 27 27 ) ); 28 28 register_setting( 'casr_options_group', 'casr-loading-text', $args = array( 29 29 'type' => 'string', 30 'default' => __( 'Loading...', 'c asr' ),30 'default' => __( 'Loading...', 'custom-ajax-search-results' ), 31 31 'sanitize_callback' => 'sanitize_text_field', 32 32 ) ); 33 33 register_setting( 'casr_options_group', 'casr-read-more-text', $args = array( 34 34 'type' => 'string', 35 'default' => __( 'Read more', 'c asr' ),35 'default' => __( 'Read more', 'custom-ajax-search-results' ), 36 36 'sanitize_callback' => 'sanitize_text_field', 37 37 ) ); -
custom-ajax-search-results/trunk/includes/class-casr-search-form.php
r2742539 r2746019 26 26 'loading_image' => $image_url ) ); 27 27 28 $placeholder = get_option( 'casr-placeholder', __( 'Type here', 'c asr' ) );29 $search_text = get_option( 'casr-search-button', __( 'Search', 'c asr' ) );30 $loading = get_option( 'casr-loading-text', __( 'Loading...', 'c asr' ) );28 $placeholder = get_option( 'casr-placeholder', __( 'Type here', 'custom-ajax-search-results' ) ); 29 $search_text = get_option( 'casr-search-button', __( 'Search', 'custom-ajax-search-results' ) ); 30 $loading = get_option( 'casr-loading-text', __( 'Loading...', 'custom-ajax-search-results' ) ); 31 31 32 32 $search_form = '<form id="casr-search-form" class="wp-block-search__inside-wrapper">'; -
custom-ajax-search-results/trunk/includes/class-casr-search-results.php
r2742539 r2746019 35 35 <?php include plugin_dir_path( __FILE__ ) . 'reusable/casr-content.php'; ?> 36 36 <?php if ( $casr_search->max_num_pages > 1 ) : 37 echo wp_kses( '<center id="casr-center"><button id="casr-load-more">', $arr ) . esc_html__( 'More posts', 'c asr' ) . wp_kses( '</button></center>', $arr );37 echo wp_kses( '<center id="casr-center"><button id="casr-load-more">', $arr ) . esc_html__( 'More posts', 'custom-ajax-search-results' ) . wp_kses( '</button></center>', $arr ); 38 38 endif; ?> 39 39 </div> … … 41 41 <?php 42 42 else: ?> 43 <h3><?php esc_html_e( 'Nothing found', 'c asr' ) ?></h3>44 <p><?php esc_html_e( 'Please, try again!', 'c asr' ) ?></p>43 <h3><?php esc_html_e( 'Nothing found', 'custom-ajax-search-results' ) ?></h3> 44 <p><?php esc_html_e( 'Please, try again!', 'custom-ajax-search-results' ) ?></p> 45 45 <?php 46 46 endif; ?> … … 69 69 include plugin_dir_path( __FILE__ ) . 'reusable/casr-content.php'; 70 70 if ( $page < $casr_search->max_num_pages ) : 71 echo wp_kses( '<center id="casr-center"><button id="casr-load-more">', $arr ) . esc_html__( 'More posts', 'c asr' ) . wp_kses( '</button></center>', $arr );71 echo wp_kses( '<center id="casr-center"><button id="casr-load-more">', $arr ) . esc_html__( 'More posts', 'custom-ajax-search-results' ) . wp_kses( '</button></center>', $arr ); 72 72 endif; 73 73 -
custom-ajax-search-results/trunk/includes/class-casr-settings-page.php
r2742539 r2746019 36 36 37 37 <nav class="nav-tab-wrapper"> 38 <a href="?page=<?php echo esc_html( $this->slug ); ?>" class="nav-tab <?php if( $tab === null ):?>nav-tab-active<?php endif; ?>"><?php esc_html_e( 'Search form', 'c asr' ) ?></a>39 <a href="?page=<?php echo esc_html( $this->slug ); ?>&tab=post-list" class="nav-tab <?php if( $tab === 'post-list' ):?>nav-tab-active<?php endif; ?>"><?php esc_html_e( 'Post list', 'c asr' ) ?></a>38 <a href="?page=<?php echo esc_html( $this->slug ); ?>" class="nav-tab <?php if( $tab === null ):?>nav-tab-active<?php endif; ?>"><?php esc_html_e( 'Search form', 'custom-ajax-search-results' ) ?></a> 39 <a href="?page=<?php echo esc_html( $this->slug ); ?>&tab=post-list" class="nav-tab <?php if( $tab === 'post-list' ):?>nav-tab-active<?php endif; ?>"><?php esc_html_e( 'Post list', 'custom-ajax-search-results' ) ?></a> 40 40 </nav> 41 41 … … 58 58 function casr_post_list_tab_form() { 59 59 ?> 60 <p><?php esc_html_e( 'On the section below, you can customize the content for the posts retrieved by user query', 'c asr' ) ?></p>60 <p><?php esc_html_e( 'On the section below, you can customize the content for the posts retrieved by user query', 'custom-ajax-search-results' ) ?></p> 61 61 <form method="post" action="options.php"> 62 62 <?php settings_fields( 'casr_second_options_group' ); ?> … … 64 64 <tr> 65 65 <td> 66 <label for="casr-post-title"><b><?php esc_html_e( 'Post title (with link)','c asr' ) ?></b></label>66 <label for="casr-post-title"><b><?php esc_html_e( 'Post title (with link)','custom-ajax-search-results' ) ?></b></label> 67 67 </td> 68 68 <td> … … 72 72 <tr> 73 73 <td> 74 <label for="casr-post-title-no-link"><b><?php esc_html_e( 'Post title (no link)','c asr' ) ?></b></label>74 <label for="casr-post-title-no-link"><b><?php esc_html_e( 'Post title (no link)','custom-ajax-search-results' ) ?></b></label> 75 75 </td> 76 76 <td> … … 80 80 <tr> 81 81 <td> 82 <label for="casr-excerpt"><b><?php esc_html_e( 'Excerpt','c asr' ) ?></b></label>82 <label for="casr-excerpt"><b><?php esc_html_e( 'Excerpt','custom-ajax-search-results' ) ?></b></label> 83 83 </td> 84 84 <td> … … 88 88 <tr> 89 89 <td> 90 <label for="casr-read-more-option"><b><?php esc_html_e( 'Read more link','c asr' ) ?></b></label>90 <label for="casr-read-more-option"><b><?php esc_html_e( 'Read more link','custom-ajax-search-results' ) ?></b></label> 91 91 </td> 92 92 <td> … … 110 110 <tr> 111 111 <td> 112 <label for="first_field_id"><b><?php esc_html_e( 'Search form placeholder', 'c asr' ) ?></b></label>112 <label for="first_field_id"><b><?php esc_html_e( 'Search form placeholder', 'custom-ajax-search-results' ) ?></b></label> 113 113 </td> 114 114 <td> 115 <input type = 'text' class="regular-text" id="first_field _id" name="casr-placeholder" value="<?php echo esc_attr( get_option( 'casr-placeholder' ) ); ?>">115 <input type = 'text' class="regular-text" id="first_field" name="casr-placeholder" value="<?php echo esc_attr( get_option( 'casr-placeholder' ) ); ?>"> 116 116 </td> 117 117 </tr> 118 118 <tr> 119 119 <td> 120 <label for = "second_field_id"><b><?php esc_html_e( 'Search button text', 'c asr' ) ?></b></label>120 <label for = "second_field_id"><b><?php esc_html_e( 'Search button text', 'custom-ajax-search-results' ) ?></b></label> 121 121 </td> 122 122 <td> 123 <input type = 'text' class="regular-text" id="second_field _id" name="casr-search-button" value="<?php echo esc_attr( get_option( 'casr-search-button' ) ); ?>">123 <input type = 'text' class="regular-text" id="second_field" name="casr-search-button" value="<?php echo esc_attr( get_option( 'casr-search-button' ) ); ?>"> 124 124 </td> 125 125 </tr> 126 126 <tr> 127 127 <td> 128 <label for = "third_field_id"><b><?php esc_html_e( 'Loading text', 'c asr' ) ?></b></label>128 <label for = "third_field_id"><b><?php esc_html_e( 'Loading text', 'custom-ajax-search-results' ) ?></b></label> 129 129 </td> 130 130 <td> 131 <input type = 'text' class="regular-text" id="third_field _id" name="casr-loading-text" value="<?php echo esc_attr( get_option( 'casr-loading-text' ) ); ?>">131 <input type = 'text' class="regular-text" id="third_field" name="casr-loading-text" value="<?php echo esc_attr( get_option( 'casr-loading-text' ) ); ?>"> 132 132 </td> 133 133 </tr> 134 134 <tr> 135 135 <td> 136 <label for = "third_field_id"><b><?php esc_html_e('Read more text', 'c asr') ?></b></label>136 <label for = "third_field_id"><b><?php esc_html_e('Read more text', 'custom-ajax-search-results') ?></b></label> 137 137 </td> 138 138 <td> 139 <input type = 'text' class="regular-text" id="fourth_field _id" name="casr-read-more-text" value="<?php echo esc_attr( get_option( 'casr-read-more-text' ) ); ?>">139 <input type = 'text' class="regular-text" id="fourth_field" name="casr-read-more-text" value="<?php echo esc_attr( get_option( 'casr-read-more-text' ) ); ?>"> 140 140 </td> 141 141 </tr> 142 142 </table> 143 143 144 <h2 style = "margin-top: 30px;"><?php esc_html_e( 'Content', 'c asr' ) ?></h2>145 <p><?php esc_html_e( 'Select the post types that you want to display in search results', 'c asr' ) ?></p>144 <h2 style = "margin-top: 30px;"><?php esc_html_e( 'Content', 'custom-ajax-search-results' ) ?></h2> 145 <p><?php esc_html_e( 'Select the post types that you want to display in search results', 'custom-ajax-search-results' ) ?></p> 146 146 147 147 <div style="display: flex; flex-direction: column; gap: 5px;"> 148 148 <div> 149 <input type="radio" name="casr-content-type" id="post" value="post" <?php if ( 'post' == get_option('casr-content-type') ) echo esc_html( 'checked="checked"' ); ?>/><label for="post"><?php esc_html_e( 'Posts', 'c asr') ?></label>149 <input type="radio" name="casr-content-type" id="post" value="post" <?php if ( 'post' == get_option('casr-content-type') ) echo esc_html( 'checked="checked"' ); ?>/><label for="post"><?php esc_html_e( 'Posts', 'custom-ajax-search-results') ?></label> 150 150 </div> 151 151 <div> 152 <input type="radio" name="casr-content-type" id="page" value="page" <?php if ( 'page' == get_option('casr-content-type') ) echo esc_html( 'checked="checked"' ); ?>/><label for="page"><?php esc_html_e( 'Pages', 'c asr' ) ?></label>152 <input type="radio" name="casr-content-type" id="page" value="page" <?php if ( 'page' == get_option('casr-content-type') ) echo esc_html( 'checked="checked"' ); ?>/><label for="page"><?php esc_html_e( 'Pages', 'custom-ajax-search-results' ) ?></label> 153 153 </div> 154 154 <div> 155 <input type="radio" name="casr-content-type" id="any" value="any" <?php if ( 'any' == get_option('casr-content-type') ) echo esc_html( 'checked="checked"' ); ?>/><label for="any"><?php esc_html_e( 'Show all', 'c asr' ) ?></label>155 <input type="radio" name="casr-content-type" id="any" value="any" <?php if ( 'any' == get_option('casr-content-type') ) echo esc_html( 'checked="checked"' ); ?>/><label for="any"><?php esc_html_e( 'Show all', 'custom-ajax-search-results' ) ?></label> 156 156 </div> 157 157 </div> 158 158 159 <div style="background-color: white; border: 1px solid black; border-radius: 15px; margin-top: 30px; padding: 20px;"><?php esc_html_e( 'Use the shortcode', 'c asr' ) ?> <em>[my-search-form]</em> <?php esc_html_e( 'to insert our custom search form anywhere you want', 'casr' ) ?>.</div>159 <div style="background-color: white; border: 1px solid black; border-radius: 15px; margin-top: 30px; padding: 20px;"><?php esc_html_e( 'Use the shortcode', 'custom-ajax-search-results' ) ?> <em>[my-search-form]</em> <?php esc_html_e( 'to insert our custom search form anywhere you want', 'custom-ajax-search-results' ) ?>.</div> 160 160 161 161 <?php submit_button(); ?> -
custom-ajax-search-results/trunk/includes/class-casr.php
r2742557 r2746019 13 13 * Plugin properties 14 14 */ 15 const VERSION = '1.0. 0';15 const VERSION = '1.0.1'; 16 16 const SLUG = 'custom-ajax-search-results'; 17 17 const PLUGIN_FILE = self::SLUG . '/casr.php'; … … 68 68 function casr_add_plugin_page_settings_link($links, $file) { 69 69 if ( $file == self::PLUGIN_FILE ) { 70 $settings_link = '<a href="' . admin_url( 'options-general.php?page=' ) . self::SLUG . '">' . esc_html__( 'Settings', 'c asr' ) . '</a>';70 $settings_link = '<a href="' . admin_url( 'options-general.php?page=' ) . self::SLUG . '">' . esc_html__( 'Settings', 'custom-ajax-search-results' ) . '</a>'; 71 71 array_unshift( $links, $settings_link ); 72 72 } -
custom-ajax-search-results/trunk/includes/reusable/casr-ajax-get-settings.php
r2742539 r2746019 5 5 $arr = array( 'center' => array( 'id' => array() ), 'button' => array( 'id' => array() ) ); 6 6 $default_posts_per_page = get_option( 'posts_per_page' ); 7 $read_more = get_option( 'casr-read-more-text', __( 'Read more', 'c asr' ) );7 $read_more = get_option( 'casr-read-more-text', __( 'Read more', 'custom-ajax-search-results' ) ); 8 8 $post_type = get_option( 'casr-content-type', 'any' ); 9 9 $post_title = get_option( 'casr-post-title' ); -
custom-ajax-search-results/trunk/includes/reusable/casr-content.php
r2742539 r2746019 7 7 $casr_search->the_post(); ?> 8 8 <div class="casr-post" id="post-<?php echo esc_html( $i ) ?>"> 9 <?php if( $i > 0 ): echo wp_kses_post( "<hr class='casr-hr'/>"); endif;9 <?php if( $i > 0 ): echo wp_kses_post( '<hr class="casr-hr"/>' ); endif; 10 10 11 11 if ( $post_title == 1 ): ?> 12 <h2><a href="<?php the_permalink(); ?>" target="_blank" rel="noopener nofollow"><?php the_title(); ?></a></h2>12 <h2><a href="<?php the_permalink(); ?>" target="_blank" rel="noopener nofollow"><?php the_title(); ?></a></h2> 13 13 <?php 14 14 else: ?> 15 <h2><?php the_title(); ?></h2>15 <h2><?php the_title(); ?></h2> 16 16 <?php endif; 17 17 18 18 if ( $post_excerpt == 1 ): 19 the_excerpt();19 the_excerpt(); 20 20 endif; 21 21 22 22 if ( $read_more_option == 1 ): ?> 23 <p class="casr-read-more"><a href="<?php the_permalink(); ?>" target="_blank" rel="noopener nofollow"><?php echo esc_html( $read_more ); ?></a></p>23 <p class="casr-read-more"><a href="<?php the_permalink(); ?>" target="_blank" rel="noopener nofollow"><?php echo esc_html( $read_more ); ?></a></p> 24 24 <?php endif; ?> 25 25 </div> -
custom-ajax-search-results/trunk/languages/casr.pot
r2742539 r2746019 1 # C .A.S.R.Pot1 # Custom Ajax Search Results Pot 2 2 # Copyright 2022 ... 3 # This file is distributed under the GNU General Public License v 3or later.3 # This file is distributed under the GNU General Public License v2 or later. 4 4 msgid "" 5 5 msgstr "" 6 "Project-Id-Version: C .A.S.R.Pot v1.0.0\n"7 "POT-Creation-Date: 2022- 24-05 15:25+0100\n"6 "Project-Id-Version: Custom Ajax Search Results Pot v1.0.0\n" 7 "POT-Creation-Date: 2022-06-21 14:35+0300\n" 8 8 "PO-Revision-Date: \n" 9 9 "Last-Translator: João Santos <[email protected]>\n" … … 23 23 "X-Poedit-Country: UNITED STATES\n" 24 24 "X-Poedit-Bookmarks: \n" 25 26 #: includes/class-casr-register-settings.php:20 27 #: includes/class-casr-search-form.php:28 28 msgid "Type here" 29 msgstr "" 30 31 #: includes/class-casr-register-settings.php:25 32 #: includes/class-casr-search-form.php:29 33 msgid "Search" 34 msgstr "" 35 36 #: includes/class-casr-register-settings.php:30 37 #: includes/class-casr-search-form.php:30 38 msgid "Loading..." 39 msgstr "" 40 41 #: includes/class-casr-register-settings.php:35 42 #: includes/reusable/casr-ajax-get-settings.php:7 43 msgid "Read more" 44 msgstr "" 45 46 #: includes/class-casr-search-results.php:37 47 #: includes/class-casr-search-results.php:71 48 msgid "More posts" 49 msgstr "" 50 51 #: includes/class-casr-search-results.php:43 52 msgid "Nothing found" 53 msgstr "" 54 55 #: includes/class-casr-search-results.php:44 56 msgid "Please, try again!" 57 msgstr "" 58 59 #: includes/class-casr-settings-page.php:38 60 msgid "Search form" 61 msgstr "" 62 63 #: includes/class-casr-settings-page.php:39 64 msgid "Post list" 65 msgstr "" 66 67 #: includes/class-casr-settings-page.php:60 68 msgid "" 69 "On the section below, " 70 "you can customize the " 71 "content for the posts " 72 "retrieved by user query" 73 msgstr "" 74 75 #: includes/class-casr-settings-page.php:66 76 msgid "" 77 "Post title (with link)" 78 msgstr "" 79 80 #: includes/class-casr-settings-page.php:74 81 msgid "" 82 "Post title (no link)" 83 msgstr "" 84 85 #: includes/class-casr-settings-page.php:82 86 msgid "Excerpt" 87 msgstr "" 88 89 #: includes/class-casr-settings-page.php:90 90 msgid "Read more link" 91 msgstr "" 92 93 #: includes/class-casr-settings-page.php:112 94 msgid "" 95 "Search form placeholder" 96 msgstr "" 97 98 #: includes/class-casr-settings-page.php:120 99 msgid "Search button text" 100 msgstr "" 101 102 #: includes/class-casr-settings-page.php:128 103 msgid "Loading text" 104 msgstr "" 105 106 #: includes/class-casr-settings-page.php:136 107 msgid "Read more text" 108 msgstr "" 109 110 #: includes/class-casr-settings-page.php:144 111 msgid "Content" 112 msgstr "" 113 114 #: includes/class-casr-settings-page.php:145 115 msgid "" 116 "Select the post types " 117 "that you want to display " 118 "in search results" 119 msgstr "" 120 121 #: includes/class-casr-settings-page.php:149 122 msgid "Posts" 123 msgstr "" 124 125 #: includes/class-casr-settings-page.php:152 126 msgid "Pages" 127 msgstr "" 128 129 #: includes/class-casr-settings-page.php:155 130 msgid "Show all" 131 msgstr "" 132 133 #: includes/class-casr-settings-page.php:159 134 msgid "Use the shortcode" 135 msgstr "" 136 137 #: includes/class-casr-settings-page.php:159 138 msgid "" 139 "to insert our custom " 140 "search form anywhere you " 141 "want" 142 msgstr "" 143 144 #: includes/class-casr.php:70 145 msgid "Settings" 146 msgstr "" 147 148 #. Name of the plugin 149 msgid "Custom AJAX Search Results (C.A.S.R.)" 150 msgstr "" 151 152 #. Description of the plugin 153 msgid "Insert a search bar with AJAX search results anywhere you want with a shortcode" 154 msgstr "" -
custom-ajax-search-results/trunk/readme.txt
r2742539 r2746019 25 25 4. Search results example 2 26 26 5. Nothing found 27 28 == Changelog == 29 = 1.0.1 = 30 * Fixed internationalization errors. 31 32 = 1.0.0 = 33 * Initial release. 34 35 == Upgrade Notice == 36 = 1.0.1 = 37 * Update for proper internationalization.
Note: See TracChangeset
for help on using the changeset viewer.