Changeset 755014
- Timestamp:
- 08/12/2013 09:44:19 AM (13 years ago)
- Location:
- quick-localization/tags/0.0.8
- Files:
-
- 13 copied
-
. (copied) (copied from quick-localization/trunk)
-
LICENSE.TXT (copied) (copied from quick-localization/trunk/LICENSE.TXT)
-
images (copied) (copied from quick-localization/trunk/images)
-
import-languages (copied) (copied from quick-localization/trunk/import-languages)
-
index.php (copied) (copied from quick-localization/trunk/index.php) (2 diffs)
-
ql_admin.php (copied) (copied from quick-localization/trunk/ql_admin.php)
-
ql_class.php (copied) (copied from quick-localization/trunk/ql_class.php) (4 diffs)
-
ql_edit.php (copied) (copied from quick-localization/trunk/ql_edit.php) (8 diffs)
-
ql_export.php (copied) (copied from quick-localization/trunk/ql_export.php)
-
ql_import.php (copied) (copied from quick-localization/trunk/ql_import.php)
-
ql_settings.php (copied) (copied from quick-localization/trunk/ql_settings.php) (1 diff)
-
readme.txt (copied) (copied from quick-localization/trunk/readme.txt) (1 diff)
-
screenshot-1.png (copied) (copied from quick-localization/trunk/screenshot-1.png)
Legend:
- Unmodified
- Added
- Removed
-
quick-localization/tags/0.0.8/index.php
r755009 r755014 2 2 /* 3 3 * Plugin Name: Quick Localization (Quick Localisation) 4 * Version: 0.0. 74 * Version: 0.0.9 5 5 * Plugin URI: http://name.ly/plugins/ 6 6 * Description: Quick Localisation allows site admins to patch Wordpress translations of any theme and any plugin without leaving the control panel … … 22 22 23 23 global $ql_options; 24 // $ql_options are checked [and saved when needed] when creating $QLC but are not propaged; we load them globally here 24 25 $ql_options = get_option ( 'ql_options' ); 25 26 -
quick-localization/tags/0.0.8/ql_class.php
r542581 r755014 27 27 // 0.0.5 0.0.1 28 28 // 0.0.6 0.0.1 29 // 0.0.7 0.0.1 30 // 0.0.8 0.0.1 31 // 0.0.9 0.0.1 29 32 30 33 … … 62 65 63 66 $ql_options = get_option ( 'ql_options' ); 67 $saveaftercheck = false; 64 68 65 69 // here, in the future, we can check for previous versions, and if such, upgrade the table accordingly … … 68 72 $ql_options = array (); 69 73 $ql_options [ "version" ] = QL_VERSION; 74 add_option ( "ql_options", $ql_options ); 75 } 76 77 if ( ! isset ( $ql_options [ "warn_on_duplicates" ] ) ) { 70 78 $ql_options [ "warn_on_duplicates" ] = "yes"; 79 $saveaftercheck = true; 80 } 81 if ( ! isset ( $ql_options [ "default_order_by" ] ) ) { 71 82 $ql_options [ "default_order_by" ] = "id"; 72 add_option ( "ql_options", $ql_options ); 73 } 74 75 if ( isset ( $ql_options ['table'] ) && $ql_options ['table'] ) { 76 $this -> table = $ql_options ['table']; 83 $saveaftercheck = true; 84 } 85 if ( ! isset ( $ql_options [ "collect_draft_translations_fe" ] ) ) { 86 $ql_options [ "collect_draft_translations_fe" ] = "no"; 87 $saveaftercheck = true; 88 } 89 if ( ! isset ( $ql_options [ "collect_draft_translations_be" ] ) ) { 90 $ql_options [ "collect_draft_translations_be" ] = "no"; 91 $saveaftercheck = true; 92 } 93 if ( ! isset ( $ql_options [ "only_unknown" ] ) ) { 94 $ql_options [ "only_unknown" ] = "no"; 95 $saveaftercheck = true; 96 } 97 if ( ! isset ( $ql_options [ "footer_textarea" ] ) ) { 98 $ql_options [ "footer_textarea" ] = "no"; 99 $saveaftercheck = true; 100 } 101 if ( ! isset ( $ql_options [ "only_superadmins" ] ) ) { 102 $ql_options [ "only_superadmins" ] = "no"; 103 $saveaftercheck = true; 104 } 105 106 if ( $saveaftercheck ) { 107 update_option ( "ql_options", $ql_options ); 108 } 109 110 if ( isset ( $ql_options [ 'table' ] ) && $ql_options [ 'table' ] ) { 111 $this -> table = $ql_options [ 'table' ]; 77 112 } else { 78 113 $this -> createtable (); … … 124 159 global $wpdb; 125 160 $ql_options = get_option ( 'ql_options' ); 126 $table = $ql_options [ 'table'];161 $table = $ql_options [ 'table' ]; 127 162 if ( $table ) { 128 163 $wpdb -> query("DROP TABLE {$table} "); -
quick-localization/tags/0.0.8/ql_edit.php
r542581 r755014 1 1 <?php 2 3 4 5 define ( "QLC_BULK_EDIT_MAX_ITEMS", 50 ); 2 6 3 7 … … 7 11 } 8 12 9 function ql_print_main ( $domain = '', $order_by = '' ) {13 function ql_print_main ( $domain = '', $order_by = '', $pageset = null ) { 10 14 global $QLC; 11 15 … … 13 17 $warn_on_duplicates = "yes" == $ql_options [ 'warn_on_duplicates' ]; 14 18 19 $ql_all = $QLC -> get_from_db ( $domain, $order_by ); 20 $ql_all_ok = $ql_all && is_array ( $ql_all ); 21 22 if ( $ql_all_ok && ! $pageset ) { 23 $allow_bulk_edit = count ( $ql_all ) <= QLC_BULK_EDIT_MAX_ITEMS; 24 $input_disabled = $allow_bulk_edit ? '' : ' disabled'; 25 } else { 26 $allow_bulk_edit = true; 27 $input_disabled = ''; 28 } // end of if ( $ql_all_ok ) 29 30 if ( ! $allow_bulk_edit ) { 31 echo "<p>" . sprintf ( __ ( 'N.B. Bulk edit is only possible for up to %d items. Please use individual paged view first by clicking on the numbered links above or below.', "QL" ), QLC_BULK_EDIT_MAX_ITEMS ) . "</p>"; 32 } 33 15 34 ?> 16 35 <table width="70%" id="ql"> 17 36 <thead><tr><td></td><td><strong><?php _e ( "Old", "QL" ); ?></strong></td><td><strong><?php _e ( "New", "QL" ); ?></strong></td><td><strong><?php _e ( "Domain", "QL" ); ?></strong></td><td><strong><?php _e ( "Action(s)", "QL" ); ?></strong></td></tr></thead> 18 37 <?php 19 $ql_all = $QLC -> get_from_db ( $domain, $order_by );20 38 $x = 1; 21 if ( $ql_all && is_array ( $ql_all )) {39 if ( $ql_all_ok ) { 22 40 // work-around for PHP 5.2 not handling the "new" property correctly 23 41 $newfield = "new"; 24 foreach ( $ql_all as $row ) { 42 foreach ( $ql_all as $index => $row ) { 43 if ( $pageset ) { 44 if ( $index < ($pageset-1)*QLC_BULK_EDIT_MAX_ITEMS || $index >= $pageset*QLC_BULK_EDIT_MAX_ITEMS ) { 45 continue; 46 } 47 } 25 48 $is_draft_domain = $QLC -> is_draft_domain ( $row->domain ); 26 49 $undrafted_domain = $is_draft_domain ? $QLC -> undraft_domain ( $row -> domain ) : $row -> domain; 27 $draft_domain_message = $is_draft_domain ? "<br /><a onclick='document.getElementById(\"ql_domain_$x\").value=\"{$undrafted_domain}\";if(\"\"==document.getElementById(\"ql_new_$x\").value){document.getElementById(\"ql_new_$x\").value=document.getElementById(\"ql_old_$x\").value;}'>" . __ ( "Undraft", "QL" ) . "</a>" : "" ;50 $draft_domain_message = $is_draft_domain && $allow_bulk_edit ? "<br /><a onclick='document.getElementById(\"ql_domain_$x\").value=\"{$undrafted_domain}\";if(\"\"==document.getElementById(\"ql_new_$x\").value){document.getElementById(\"ql_new_$x\").value=document.getElementById(\"ql_old_$x\").value;}'>" . __ ( "Undraft", "QL" ) . "</a>" : "" ; 28 51 if ( $warn_on_duplicates ) { 29 52 $did = $QLC -> find_id ( $row->old, $row->domain ); … … 34 57 } 35 58 } 59 $ps = QLC_BULK_EDIT_MAX_ITEMS > 0 ? ceil ( ( $index + 1 ) / QLC_BULK_EDIT_MAX_ITEMS ) : null; 60 $empty_message = $allow_bulk_edit ? "<a onclick='ql_mark2delete($x);'>" . __ ( "Empty", "QL" ) . "</a> " . __ ( "(mark to delete)", "QL" ) : ( QLC_BULK_EDIT_MAX_ITEMS > 0 ? sprintf ( __ ( 'Switch to <a href="admin.php?page=ql-home' . ( $domain ? "&domain=" . urlencode ( $domain ) : "" ) . ( $order_by ? "&order_by=" . urlencode ( $order_by ) : "" ) . ( $ps ? "&pageset=" . $ps : "" ) . '#%d">page %d</a> to edit', "QL" ), $row->id, ceil ( ( $index + 1 ) / QLC_BULK_EDIT_MAX_ITEMS ) ) : "" ); 36 61 $oldi = esc_textarea ( $row -> old ); 37 62 $newi = esc_textarea ( $row -> $newfield ); … … 40 65 <tr> 41 66 <td><input type='hidden' value='{$row->id}' name='ql[$x][id]' id='ql_id_$x' /></td> 42 <td><a name='{$row->id}'></a><textarea style='width:90%;' size='50' name='ql[$x][old]' id='ql_old_$x' >{$oldi}</textarea></td>43 <td><textarea style='width:90%;' size='50' name='ql[$x][new]' id='ql_new_$x' >{$newi}</textarea></td>44 <td><input type='text' style='width:90%;' size='10' value='{$domaini}' name='ql[$x][domain]' id='ql_domain_$x' /></td>45 <td>{$duplicate_message}{$undrafted_duplicate_message} <a onclick='ql_mark2delete($x);'>" . __ ( "Empty", "QL" ) . "</a> " . __ ( "(mark to delete)", "QL" ) . "$draft_domain_message</td>67 <td><a name='{$row->id}'></a><textarea style='width:90%;' size='50' name='ql[$x][old]' id='ql_old_$x'" . $input_disabled . ">{$oldi}</textarea></td> 68 <td><textarea style='width:90%;' size='50' name='ql[$x][new]' id='ql_new_$x'" . $input_disabled . ">{$newi}</textarea></td> 69 <td><input type='text' style='width:90%;' size='10' value='{$domaini}' name='ql[$x][domain]' id='ql_domain_$x'" . $input_disabled . "/></td> 70 <td>{$duplicate_message}{$undrafted_duplicate_message}{$empty_message}{$draft_domain_message}</td> 46 71 </tr>"; 47 72 $x++; … … 93 118 $order_by = $order_by ? $order_by : "id"; 94 119 $order_by_url = null === $order_by ? "" : "&order_by=" . urlencode ( $order_by ); 120 $pageset = isset ( $_GET [ 'pageset' ] ) ? (int) $_GET [ 'pageset' ] : null; 121 $pageset_url = null === $pageset ? "" : "&pageset=" . $pageset; 95 122 96 123 if ( wp_verify_nonce ( $_POST [ 'qlenonce' ], 'qle' ) ) { … … 135 162 <p><?php _e ( "Filter by domain:", "QL" ); ?> 136 163 <?php 164 $row_count = 0; 137 165 $list_of_saved_domains = $QLC -> get_list_of_saved_domains (); 138 166 $filter_line = ""; … … 140 168 foreach ( $list_of_saved_domains as $row ) { 141 169 $filter_line .= " | "; 142 $filter_line .= $domain === $row->domain ? ( $row->domain ? $row->domain : "empty" ) : '<a href="admin.php?page=ql-home&domain=' . urlencode ( $row->domain ) . $order_by_url . '">' . ( $row->domain ? $row->domain : "empty" ) . '</a>';170 $filter_line .= $domain === $row->domain ? ( $row->domain ? $row->domain : "empty" ) : '<a href="admin.php?page=ql-home&domain=' . urlencode ( $row->domain ) . $order_by_url . $pageset_url . '">' . ( $row->domain ? $row->domain : "empty" ) . '</a>'; 143 171 $filter_line .= " (" . $row->count . ")"; 144 172 $all_count += $row->count; 173 if ( $domain === $row->domain ) { 174 $row_count = $row->count; 175 } 176 } 177 if ( ! $row_count && ! $domain ) { 178 $row_count = $all_count; 145 179 } 146 180 147 181 $filter_line = ( null === $domain ? __ ( 'All', "QL" ) : '<a href="admin.php?page=ql-home' . $order_by_url . '">' . __ ( 'All', "QL" ) . '</a>' ) . " (" . $all_count . ")" . $filter_line; 148 182 echo $filter_line; 149 ?> 150 <br /> 151 <?php _e ( "Sort by:", "QL" ); 152 echo " " . ( "id" == $order_by || ! $order_by ? __ ( 'Addition time', "QL" ) : '<a href="admin.php?page=ql-home' . $domain_url . '&order_by=id">' . __ ( 'Addition time', "QL" ) . '</a>' ); 153 echo " | " . ( "old" == $order_by ? __ ( 'Old', "QL" ) : '<a href="admin.php?page=ql-home' . $domain_url . '&order_by=old">' . __ ( 'Old', "QL" ) . '</a>' ); 154 echo " | " . ( "new" == $order_by ? __ ( 'New', "QL" ) : '<a href="admin.php?page=ql-home' . $domain_url . '&order_by=new">' . __ ( 'New', "QL" ) . '</a>' ); 183 // Pages 184 $number_of_pages = QLC_BULK_EDIT_MAX_ITEMS > 0 ? ceil ( $row_count / QLC_BULK_EDIT_MAX_ITEMS ) : 1 ; 185 if ( $number_of_pages > 1 ) { 186 echo "<br />"; 187 _e ( "Pages:", "QL" ); 188 echo " " . ( ! $pageset ? __ ( 'All', "QL" ) : '<a href="admin.php?page=ql-home' . $domain_url . $order_by_url . '">' . __ ( 'All', "QL" ) . '</a>' ); 189 for ( $index = 1; $index <= $number_of_pages; $index++ ) { 190 echo " | " . ( $pageset == $index ? $index : '<a href="admin.php?page=ql-home' . $domain_url . $order_by_url . '&pageset=' . $index . '">' . $index . '</a>' ); 191 } 192 } 193 // Sorting 194 echo "<br />"; 195 _e ( "Sort by:", "QL" ); 196 echo " " . ( "id" == $order_by || ! $order_by ? __ ( 'Addition time', "QL" ) : '<a href="admin.php?page=ql-home' . $domain_url . '&order_by=id' . $pageset_url . '">' . __ ( 'Addition time', "QL" ) . '</a>' ); 197 echo " | " . ( "old" == $order_by ? __ ( 'Old', "QL" ) : '<a href="admin.php?page=ql-home' . $domain_url . '&order_by=old' . $pageset_url . '">' . __ ( 'Old', "QL" ) . '</a>' ); 198 echo " | " . ( "new" == $order_by ? __ ( 'New', "QL" ) : '<a href="admin.php?page=ql-home' . $domain_url . '&order_by=new' . $pageset_url . '">' . __ ( 'New', "QL" ) . '</a>' ); 155 199 ?> 156 200 </p> 157 <?php ql_print_main ( $domain, $order_by ); ?>201 <?php ql_print_main ( $domain, $order_by, $pageset ); ?> 158 202 <p><a href="#" onclick="ql_one_more_row(); return false;"><?php _e ( "Add another one", "QL" ); ?></a></p> 159 203 -
quick-localization/tags/0.0.8/ql_settings.php
r700754 r755014 8 8 global $ql_options; 9 9 10 if ( wp_verify_nonce ( $_POST [ 'qlsnonce' ], 'qls' ) ) {10 if ( isset ( $_POST [ 'qlsnonce' ] ) && wp_verify_nonce ( $_POST [ 'qlsnonce' ], 'qls' ) ) { 11 11 if ( isset ( $_POST [ 'ql_save' ] ) ) { 12 12 // -
quick-localization/tags/0.0.8/readme.txt
r700754 r755014 76 76 == Changelog == 77 77 78 = 0.0.9 = 79 80 * Fixed warnings generated when WP_DEBUG is set to true 81 82 = 0.0.8 = 83 84 * Fixed bulk edit of many items, which did not work above some limit 85 * Added individual edit screens 86 78 87 = 0.0.7 = 79 88
Note: See TracChangeset
for help on using the changeset viewer.