Plugin Directory

Changeset 557228


Ignore:
Timestamp:
06/13/2012 11:45:09 AM (13 years ago)
Author:
hel.io
Message:

Added localization support and Russian translation.

Location:
smtp/trunk
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • smtp/trunk/readme.txt

    r543285 r557228  
    11=== SMTP ===
    2 Contributors: hel.io
     2Contributors: hel.io, kley
    33Donate link: http://hel.io/donate/
    44Tags: smtp, email, mail, wp_mail, mailer, phpmailer
    55Requires at least: 3.0
    6 Tested up to: 3.3.0
    7 Stable tag: 1.1
     6Tested up to: 3.3.2
     7Stable tag: 1.1.2
    88
    99Allows you to configure and use a SMTP server (such as Gmail) for sending emails.
     
    4747== Changelog ==
    4848
    49 = 1.0 =
    50 * Initial release.
     49= 1.1.2 =
     50* Added support for localization (thanks to [kley](http://wordpress.org/support/profile/klay))
     51* Added Russian translation (thanks to [kley](http://wordpress.org/support/profile/klay))
    5152
    5253= 1.1 =
    5354* The password field is of type password instead of text and does not display your saved password
    5455* Now storing encrypted passwords in the database (Make sure you re-enter your password if you are updating)
     56
     57= 1.0 =
     58* Initial release.
  • smtp/trunk/smtp.php

    r544066 r557228  
    22/*
    33Plugin Name: SMTP
    4 Version: 1.1.1
     4Version: 1.1.2
    55Plugin URI: http://hel.io/wordpress/smtp/
    66Description: Allows you to configure and use a SMTP server (such as Gmail) for sending emails.
    77Author: Sorin Iclanzan
    88Author URI: http://hel.io/
     9Text Domain: smtp
     10Domain Path: /language
    911*/
    1012
    1113// Key used for encrypting and decrypting passwords
    1214define( 'CRYPT_KEY', '-J5:2Yqd?Ri9wLjN' );
     15// Text domain
     16define( 'TEXT_DOMAIN', 'smtp' );
     17// Plugin basename
     18$plugin_basename = dirname( plugin_basename( __FILE__ ) );
     19
     20// Loads the plugin's translated strings.
     21add_action( 'plugins_loaded', 'smtp_init' );
     22function smtp_init() {
     23  global $plugin_basename;
     24  load_plugin_textdomain( TEXT_DOMAIN, false, $plugin_basename . '/language/' );
     25}
    1326
    1427// This is run when you activate the plugin, adding the default options to the database
    1528register_activation_hook(__FILE__,'smtp_activation');
    1629function smtp_activation() {
     30  global $plugin_basename;
    1731    // Check for compatibility
    1832    try {
    1933        // check mycrypt
    2034        if(!function_exists('mcrypt_encrypt')) {
    21             throw new Exception(__('Please enable \'php_mycrypt\' in PHP. It is needed to encrypt passwords.', 'smtp'));
     35            throw new Exception(__('Please enable \'php_mycrypt\' in PHP. It is needed to encrypt passwords.', TEXT_DOMAIN));
    2236        }
    2337    }
    2438    catch(Exception $e) {
    25         $plugin_basename = dirname(plugin_basename(__FILE__));
    2639        deactivate_plugins($plugin_basename.'/backup.php', true);
    2740        echo '<div id="message" class="error">' . $e->getMessage() . '</div>';
     
    4659add_action('admin_menu','smtp_menu');
    4760function smtp_menu() {
    48     add_options_page('SMTP Settings', 'SMTP', 'manage_options', 'smtp', 'smtp_options_page');
     61    add_options_page( __( 'SMTP Settings', TEXT_DOMAIN ), __( 'SMTP', TEXT_DOMAIN ) , 'manage_options', 'smtp', 'smtp_options_page');
    4962}
    5063
     
    5568        return $links;
    5669
    57     $settings_link = '<a href="options-general.php?page=smtp">Settings</a>';
     70    $settings_link = sprintf( '<a href="options-general.php?page=smtp">%s</a>', __( 'Settings', TEXT_DOMAIN ) );
    5871
    5972    array_unshift( $links, $settings_link );
     
    6982           
    7083            $to = $_POST['to'];
    71             $subject = 'SMTP Test';
    72             $message = 'If you received this email it means you have configured SMTP correctly on your Wordpress website.';
     84            $subject = __( 'SMTP Test', TEXT_DOMAIN );
     85            $message = __( 'If you received this email it means you have configured SMTP correctly on your Wordpress website.', TEXT_DOMAIN );
    7386   
    7487            // Send the test mail
     
    7992                ?>
    8093                <div id="message" class="updated fade">
    81                 <p><strong>Test Email Sent</strong></p>
    82                 <p>The test email was sent successfully!</p>
     94                <p><strong><?php _e( 'Test Email Sent', TEXT_DOMAIN ); ?></strong></p>
     95                <p><?php _e('The test email was sent successfully!', TEXT_DOMAIN ); ?></p>
    8396                </div>
    8497                <?php
     
    87100                ?>
    88101                <div id="message" class="error">
    89                 <p><strong>Send Error</strong></p>
    90                 <p>There was an error while trying to send the test email. Please check the connection details.</p>
     102                <p><strong><?php _e('Send Error', TEXT_DOMAIN ); ?></strong></p>
     103                <p><?php _e('There was an error while trying to send the test email. Please check the connection details.', TEXT_DOMAIN ); ?></p>
    91104                </div>
    92105                <?php
     
    96109    ?>
    97110    <div class="wrap">
    98         <h2>SMTP Settings</h2>
     111    <h2><?php _e('SMTP Settings', TEXT_DOMAIN ); ?></h2>
    99112       
    100113        <form action="options.php" method="post">
     
    102115            <?php do_settings_sections('smtp'); ?>
    103116            <p class="submit">
    104                 <input name="submit" type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
     117                <input name="submit" type="submit" class="button-primary" value="<?php _e('Save Changes', TEXT_DOMAIN ); ?>" />
    105118            </p>
    106119        </form>
    107120       
    108         <h3>Send a Test Email</h3>
    109         <p>Enter an email address below to send a test message.</p>
     121        <h3><?php _e('Send a Test Email', TEXT_DOMAIN ); ?></h3>
     122        <p><?php _e('Enter an email address below to send a test message.', TEXT_DOMAIN ); ?></p>
    110123        <form action="options-general.php?page=smtp" method="post">
    111124            <table class="optiontable form-table">
    112125                <tr valign="top">
    113                     <th scope="row"><label for="to">To:</label></th>
     126                    <th scope="row"><label for="to"><?php _e('To:', TEXT_DOMAIN ); ?></label></th>
    114127                    <td>
    115128                        <input name="to" type="text" id="to" value="" class="regular-text" />
     
    118131            </table>
    119132            <p class="submit">
    120                 <input type="submit" name="smtp_test" id="smtp_test" class="button-primary" value="Send" />
     133                <input type="submit" name="smtp_test" id="smtp_test" class="button-primary" value="<?php _e('Send', TEXT_DOMAIN ); ?>" />
    121134            </p>
    122135        </form>
     
    130143function smtp_admin_init(){
    131144    register_setting( 'smtp_options', 'smtp_options', 'smtp_options_validate' );
    132     add_settings_section('smtp_main', 'Settings', 'smtp_section', 'smtp');
    133     add_settings_field('host', 'Host', 'smtp_host', 'smtp', 'smtp_main');
    134     add_settings_field('encryption', 'Encryption', 'smtp_encryption', 'smtp', 'smtp_main');
    135     add_settings_field('username', 'Username', 'smtp_username', 'smtp', 'smtp_main');
    136     add_settings_field('password', 'Password', 'smtp_password', 'smtp', 'smtp_main');
     145    add_settings_section('smtp_main', __( 'Settings', TEXT_DOMAIN ), 'smtp_section', 'smtp');
     146    add_settings_field('host', __( 'Host', TEXT_DOMAIN ), 'smtp_host', 'smtp', 'smtp_main');
     147    add_settings_field('encryption', __( 'Encryption', TEXT_DOMAIN ), 'smtp_encryption', 'smtp', 'smtp_main');
     148    add_settings_field('username', __( 'Username', TEXT_DOMAIN ), 'smtp_username', 'smtp', 'smtp_main');
     149    add_settings_field('password', __('Password', TEXT_DOMAIN ), 'smtp_password', 'smtp', 'smtp_main');
    137150}
    138151
    139152function smtp_section() {
    140     echo '<p>Please enter your SMTP connection details.</p>';
     153    echo '<p>' . __( 'Please enter your SMTP connection details.', TEXT_DOMAIN ) . '</p>';
    141154}
    142155
     
    145158    echo "
    146159        <input id='host' name='smtp_options[host]' type='text' class='regular-text' value='{$options['host']}' />
    147         <label for='port'>Port</label>
     160        <label for='port'>" . __( 'Port', TEXT_DOMAIN ) . "</label>
    148161        <input id='port' name='smtp_options[port]' type='text' class='small-text' value='{$options['port']}' />
    149162    ";
     
    153166    $options = get_option('smtp_options');
    154167    echo "
    155         <label><input name='smtp_options[smtp_secure]' type='radio' class='tog' value='' ". checked('', $options['smtp_secure'], false) . " /> <span>None</span></label><br/>
    156         <label><input name='smtp_options[smtp_secure]' type='radio' class='tog' value='ssl' " . checked('ssl', $options['smtp_secure'], false) . " /> <span>SSL</span></label><br/>
    157         <label><input name='smtp_options[smtp_secure]' type='radio' class='tog' value='tls' " . checked('tls', $options['smtp_secure'], false) . " /> <span>TLS</span></label>
     168        <label><input name='smtp_options[smtp_secure]' type='radio' class='tog' value='' ". checked('', $options['smtp_secure'], false) . " /> <span>" . __( 'None', TEXT_DOMAIN ) . "</span></label><br/>
     169        <label><input name='smtp_options[smtp_secure]' type='radio' class='tog' value='ssl' " . checked('ssl', $options['smtp_secure'], false) . " /> <span>" . __( 'SSL', TEXT_DOMAIN ) . "</span></label><br/>
     170        <label><input name='smtp_options[smtp_secure]' type='radio' class='tog' value='tls' " . checked('tls', $options['smtp_secure'], false) . " /> <span>" . __( 'TLS', TEXT_DOMAIN ) . "</span></label>
    158171    ";
    159172}
Note: See TracChangeset for help on using the changeset viewer.