Changeset 3013
- Timestamp:
- 04/26/2016 02:23:48 PM (8 years ago)
- Location:
- sites/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/public_html/gp-templates-new/consistency.php
r3007 r3013 28 28 Case Sensitive 29 29 </label> 30 <label>31 <input type="checkbox" name="search_fuzzy" value="1"<?php checked( $search_fuzzy ); ?>>32 Fuzzy Search (<em>term*</em>)33 </label>34 30 </p> 35 31 … … 41 37 42 38 } elseif ( $performed_search && $results ) { 43 if ( ! $search_fuzzy && $translations_unique ) { 44 $translations_unique_count = count( $translations_unique ); 45 if ( 1 === $translations_unique_count ) { 46 echo '<p class="notice">All originals have the same translations</p>'; 47 } else { 48 echo '<div class="notice wporg-notice-warning"><p>There are ' . $translations_unique_count . ' different translations. <a id="toggle-translations-unique" href="#show">View</a></p>'; 49 echo '<ul class="translations-unique hidden">'; 50 foreach ( $translations_unique as $translation ) { 51 printf( 52 '<li data-id="%s">%s</li>', 53 md5( $translation ), 54 str_replace( ' ', '<span class="space"> </span>', esc_translation( $translation ) ) 55 ); 56 } 57 echo '</ul>'; 58 echo '</div>'; 39 $translations_unique_count = count( $translations_unique ); 40 if ( 1 === $translations_unique_count ) { 41 echo '<p class="notice">All originals have the same translations</p>'; 42 } else { 43 echo '<div class="notice wporg-notice-warning"><p>There are ' . $translations_unique_count . ' different translations. <a id="toggle-translations-unique" href="#show">View</a></p>'; 44 echo '<ul class="translations-unique hidden">'; 45 foreach ( $translations_unique as $translation ) { 46 printf( 47 '<li data-id="%s">%s</li>', 48 md5( $translation ), 49 str_replace( ' ', '<span class="space"> </span>', esc_translation( $translation ) ) 50 ); 59 51 } 52 echo '</ul>'; 53 echo '</div>'; 60 54 } 61 55 … … 85 79 } 86 80 87 $search_link = '';88 if ( $search_fuzzy ) {89 $search_link = sprintf(90 ' | <a href="%s">Search</a>',91 esc_url( add_query_arg( [92 'search' => urlencode( $result->original_singular ),93 'search_fuzzy' => 0,94 'search_case_senstive' => 1,95 ] ) )96 );97 }98 99 81 printf( 100 82 '<tr><td>%s</td><td>%s</td></tr>', 101 83 sprintf( 102 84 '<div class="string">%s%s</div> 103 <div class="meta">Project: <a href="/projects/%s">%s</a> %s</div>',85 <div class="meta">Project: <a href="/projects/%s">%s</a></div>', 104 86 esc_translation( $result->original_singular ), 105 87 $original_context, 106 88 $result->project_path, 107 $project_name, 108 $search_link 89 $project_name 109 90 ), 110 91 sprintf( -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php
r3007 r3013 22 22 23 23 $search = $set = ''; 24 $search_fuzzy = false;25 24 $search_case_sensitive = true; 26 25 … … 40 39 } 41 40 42 if ( ! empty( $_REQUEST['search_fuzzy'] ) ) {43 $search_fuzzy = true;44 }45 46 41 $locale_is_rtl = false; 47 42 if ( $set ) { … … 57 52 'search' => $search, 58 53 'set' => $set, 59 'fuzzy' => $search_fuzzy,60 54 'case_sensitive' => $search_case_sensitive, 61 55 ] ); … … 110 104 } 111 105 112 if ( $args['fuzzy'] ) { 113 $search = $wpdb->prepare( "LIKE {$collation} %s", $wpdb->esc_like( $args['search'] ) . '%%' ); 114 } else { 115 $search = $wpdb->prepare( "= {$collation} %s", $args['search'] ); 116 } 106 $search = $wpdb->prepare( "= {$collation} %s", $args['search'] ); 117 107 118 108 $locale = $wpdb->prepare( '%s', $locale ); … … 133 123 t.id AS translation_id 134 124 FROM {$wpdb->gp_originals} AS o 135 JOIN 125 JOIN 136 126 {$wpdb->gp_projects} AS p ON p.id = o.project_id 137 JOIN 127 JOIN 138 128 {$wpdb->gp_translations} AS t ON o.id = t.original_id 139 129 JOIN … … 141 131 WHERE 142 132 p.active = 1 143 AND t.status = 'current' 133 AND t.status = 'current' 144 134 AND o.status = '+active' AND o.singular {$search} 145 135 AND ts.locale = {$locale} AND ts.slug = {$slug}
Note: See TracChangeset
for help on using the changeset viewer.