Changeset 40947
- Timestamp:
- 04/16/08 11:59:48 (3 months ago)
- Files:
-
- acronyms/trunk/acronyms.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
acronyms/trunk/acronyms.php
r40864 r40947 176 176 } 177 177 178 /* string get_textdomain () 179 * 180 * returns the text domain to be used for internationalisation 181 */ 182 function get_textdomain () 183 { 184 return "Acronyms"; 185 } 186 178 187 /* void uninstall () 179 188 */ … … 190 199 function add_pages () 191 200 { 201 $domain = Acronyms::get_textdomain(); 202 192 203 // Add the Manage page 193 add_management_page( __( 'Manage Acronyms' ), __( 'Acronyms' ), "manage_options", __FILE__, array( 'Acronyms', 'manage_acronyms' ) ); 194 } 195 204 add_management_page( __( 'Manage Acronyms', $domain ), __( 'Acronyms', $domain ), "manage_options", __FILE__, array( 'Acronyms', 'manage_acronyms' ) ); 205 } 206 207 /** 208 * void management_handler () 209 * 210 * handles actions for adding, editing or deleting acronyms 211 * 212 */ 196 213 function management_handler () { 197 $title = __( 'Acronyms' ); 214 $domain = Acronyms::get_textdomain(); 215 load_plugin_textdomain( $domain, "/wp-content/plugins/your-plugin-directory/" ); 216 217 $title = __( 'Acronyms', $domain ); 198 218 $parent_file = 'edit.php?page=' . Acronyms::get_parent_url(); 199 219 … … 266 286 function manage_acronyms () 267 287 { 288 $domain = Acronyms::get_textdomain(); 289 268 290 // Set any error/notice messages based on the 'message' GET value 269 291 $message = $_GET['message']; 270 $messages[1] = __('Acronym added.' );271 $messages[2] = __('Acronym deleted.' );272 $messages[3] = __('Acronym updated.' );273 $messages[4] = __('Acronym not added.' );274 $messages[5] = __('Acronym not updated.' );275 $messages[6] = __('Acronyms deleted.' );292 $messages[1] = __('Acronym added.', $domain ); 293 $messages[2] = __('Acronym deleted.', $domain ); 294 $messages[3] = __('Acronym updated.', $domain ); 295 $messages[4] = __('Acronym not added.', $domain ); 296 $messages[5] = __('Acronym not updated.', $domain ); 297 $messages[6] = __('Acronyms deleted.', $domain ); 276 298 277 299 if ( isset( $message ) ) { ?> … … 298 320 <input type="hidden" name="page" value="<?php echo Acronyms::get_parent_url() ?>"/> 299 321 <h2><?php 300 _e('Manage Acronyms');301 if( 'edit' != $_GET['action'] ) echo ' (<a href="#addacronym">' . __('add new') . '</a>)'322 _e('Manage Acronyms', $domain ); 323 if( 'edit' != $_GET['action'] ) echo ' (<a href="#addacronym">' . __('add new', $domain ) . '</a>)' 302 324 ?></h2> 303 325 <p id="post-search"> 304 326 <input type="text" id="post-search-input" name="search" value="<?php echo attribute_escape( stripslashes( $_GET['s'] ) ); ?>" /> 305 <input type="submit" value="<?php _e( 'Search acronyms' ); ?>" class="button" />327 <input type="submit" value="<?php _e( 'Search acronyms', $domain ); ?>" class="button" /> 306 328 </p> 307 329 <br class="clear" /> 308 330 <?php 309 Acronyms::show_pagination_bar( $n, $p, $t, $o, true);310 Acronyms::show_acronym_list( $s, $n, $p, $o );311 Acronyms::show_pagination_bar( $n, $p, $t, $o);331 Acronyms::show_pagination_bar( $n, $p, $t, $o, true); 332 Acronyms::show_acronym_list( $s, $n, $p, $o ); 333 Acronyms::show_pagination_bar( $n, $p, $t, $o); 312 334 ?> 313 335 </form> … … 359 381 function show_acronym_list ( $s, $n, $p = '1', $o = 'acronym' ) 360 382 { 383 $domain = Acronyms::get_textdomain(); 384 361 385 // Sort the acronyms appropriately 362 386 $acronyms = get_option( 'acronym_acronyms' ); … … 371 395 <tr> 372 396 <th scope="col" class="check-column"><span class="acronym-tooltip" title="<?php _e( 'Select all acronyms' , $domain ) ?>"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></span></th> 373 <th scope="col"><?php _e( 'Acronym') ?></th>374 <th scope="col"><?php _e( 'Full') ?></th>397 <th scope="col"><?php _e( 'Acronym', $domain ) ?></th> 398 <th scope="col"><?php _e( 'Full', $domain ) ?></th> 375 399 </tr> 376 400 </thead> … … 404 428 function show_pagination_bar ( $n, $p, $t, $o, $filter = false) 405 429 { 430 $domain = Acronyms::get_textdomain(); 431 406 432 echo '<div class="tablenav">'; 407 433 // Display pagination links … … 419 445 420 446 <div class="alignleft"> 421 <input type="submit" value="<?php _e( 'Delete') ?>" name="delete-acronyms" class="button-secondary delete" />447 <input type="submit" value="<?php _e( 'Delete' ) ?>" name="delete-acronyms" class="button-secondary delete" /> 422 448 <?php 423 449 wp_nonce_field('delete-acronyms'); … … 428 454 echo '<option value="' . $option . '"'; 429 455 if ( $n == $option ) echo ' selected="selected" '; 430 echo '>Show ' . $option . ' acronyms per page</option>'; 456 echo '>' 457 printf( __( "Show %d acronyms per page", $domain ), $option ); 458 echo '</option>'; 431 459 } 432 460 ?> 433 461 </select> 434 462 <select name="o" id="o"> 435 <option value="acronym"<?php echo 'acronym' == $o ? ' selected="selected"' : '' ?>> Order by acronym</option>436 <option value="full"<?php echo 'full' == $o ? ' selected="selected"' : '' ?>> Order by full text</option>463 <option value="acronym"<?php echo 'acronym' == $o ? ' selected="selected"' : '' ?>><?php _e( 'Order by acronym', $domain ) ?></option> 464 <option value="full"<?php echo 'full' == $o ? ' selected="selected"' : '' ?>><?php _e( 'Order by full text', $domain ) ?></option> 437 465 </select> 438 466 <input type="submit" value="Filter" class="button-secondary" /> … … 453 481 function add_acronym_form ( $acronym = '', $fulltext = '' ) 454 482 { 483 $domain = Acronyms::get_textdomain(); 484 455 485 if ( ! empty($acronym) ) { 456 $heading = __( 'Edit Acronym');457 $submit_text = __( 'Edit Acronym');486 $heading = __( 'Edit Acronym', $domain ); 487 $submit_text = __( 'Edit Acronym', $domain ); 458 488 $form = '<form name="editacronym" id="editacronym" method="get" action="" class="validate">'; 459 489 $action = 'edit-acronym'; 460 490 $nonce_action = 'edit-acronym'; 461 } else { 462 $heading = __( 'Add Acronym');463 $submit_text = __( 'Add Acronym');491 } else { 492 $heading = __( 'Add Acronym', $domain ); 493 $submit_text = __( 'Add Acronym', $domain ); 464 494 $form = '<form name="addacronym" id="addacronym" method="get" action="" class="add:the-list: validate">'; 465 495 $action = 'add-acronym'; … … 476 506 <table class="form-table"> 477 507 <tr class="form-field form-required"> 478 <td><label for="acronym"><?php _e( 'Acronym') ?></label>: <input name="acronym" id="acronym" type="text" value="<?php echo attribute_escape($acronym); ?>" size="20" <?php if ( 'edit-acronym' == $action ) echo 'readonly="readonly"'; ?>/></td>479 <td><label for="fulltext"><?php _e( 'Full') ?></label>: <input name="fulltext" id="fulltext" type="text" value="<?php echo attribute_escape($fulltext); ?>" size="80" /></td>508 <td><label for="acronym"><?php _e( 'Acronym', $domain ) ?></label>: <input name="acronym" id="acronym" type="text" value="<?php echo attribute_escape( $acronym ); ?>" size="20" <?php if ( 'edit-acronym' == $action ) echo 'readonly="readonly"'; ?>/></td> 509 <td><label for="fulltext"><?php _e( 'Full', $domain ) ?></label>: <input name="fulltext" id="fulltext" type="text" value="<?php echo attribute_escape( $fulltext ); ?>" size="80" /></td> 480 510 </tr> 481 511 </table> … … 548 578 549 579 add_action( 'admin_init', array( 'Acronyms', 'management_handler' ) ); 580 register_activation_hook( __FILE__, array( 'Acronyms', 'install' ) ); 581 register_deactivation_hook( __FILE__, array( 'Acronyms', 'uninstall' ) ); 550 582 add_action( 'admin_head', array( 'Acronyms', 'manage_acronyms_js' ) ); 551 register_activation_hook(__FILE__, array( 'Acronyms', 'install' ) );552 register_deactivation_hook(__FILE__, array( 'Acronyms', 'uninstall' ) );553 583 if (1 == get_option( 'acronym_content' ) ) 554 584 add_filter( 'the_content', array( 'Acronyms', 'acronym_replace' ) );
