コード例 #1
0
ファイル: setup-config.php プロジェクト: akalipetis/WordPress
" tabindex="-1"><?php 
    _e('WordPress');
    ?>
</a></p>
<?php 
}
// end function setup_config_display_header();
$language = '';
if (!empty($_REQUEST['language'])) {
    $language = preg_replace('/[^a-zA-Z_]/', '', $_REQUEST['language']);
} elseif (isset($GLOBALS['wp_local_package'])) {
    $language = $GLOBALS['wp_local_package'];
}
switch ($step) {
    case -1:
        if (wp_can_install_language_pack() && empty($language) && ($languages = wp_get_available_translations())) {
            setup_config_display_header('language-chooser');
            echo '<h1 class="screen-reader-text">Select a default language</h1>';
            echo '<form id="setup" method="post" action="?step=0">';
            wp_install_language_form($languages);
            echo '</form>';
            break;
        }
        // Deliberately fall through if we can't reach the translations API.
    // Deliberately fall through if we can't reach the translations API.
    case 0:
        if (!empty($language)) {
            $loaded_language = wp_download_language_pack($language);
            if ($loaded_language) {
                load_default_textdomain($loaded_language);
                $GLOBALS['wp_locale'] = new WP_Locale();
コード例 #2
0
ファイル: settings.php プロジェクト: Plego/toyoa
    _e('Language Settings');
    ?>
</h3>
			<table class="form-table">
				<tr>
					<th><label for="WPLANG"><?php 
    _e('Default Language');
    ?>
</label></th>
					<td>
						<?php 
    $lang = get_site_option('WPLANG');
    if (!in_array($lang, $languages)) {
        $lang = '';
    }
    wp_dropdown_languages(array('name' => 'WPLANG', 'id' => 'WPLANG', 'selected' => $lang, 'languages' => $languages, 'translations' => $translations, 'show_available_translations' => wp_can_install_language_pack()));
    ?>
					</td>
				</tr>
			</table>
			<?php 
}
?>

		<h3><?php 
_e('Menu Settings');
?>
</h3>
		<table id="menu" class="form-table">
			<tr>
				<th scope="row"><?php 
コード例 #3
0
    $languages[] = WPLANG;
}
if (!empty($languages) || !empty($translations)) {
    ?>
	<tr>
		<th width="33%" scope="row"><label for="WPLANG"><?php 
    _e('Site Language');
    ?>
</label></th>
		<td>
			<?php 
    $locale = get_locale();
    if (!in_array($locale, $languages)) {
        $locale = '';
    }
    wp_dropdown_languages(array('name' => 'WPLANG', 'id' => 'WPLANG', 'selected' => $locale, 'languages' => $languages, 'translations' => $translations, 'show_available_translations' => (!is_multisite() || is_super_admin()) && wp_can_install_language_pack()));
    // Add note about deprecated WPLANG constant.
    if (defined('WPLANG') && '' !== WPLANG && $locale !== WPLANG) {
        if (is_super_admin()) {
            ?>
					<p class="description">
						<strong><?php 
            _e('Note:');
            ?>
</strong> <?php 
            printf(__('The %s constant in your %s file is no longer needed.'), '<code>WPLANG</code>', '<code>wp-config.php</code>');
            ?>
					</p>
					<?php 
        }
        _deprecated_argument('define()', '4.0', sprintf(__('The %s constant in your %s file is no longer needed.'), 'WPLANG', 'wp-config.php'));
コード例 #4
0
ファイル: options.php プロジェクト: hadywisam/WordPress
         $_POST['date_format'] = $_POST['date_format_custom'];
     }
     if (!empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\\c\\u\\s\\t\\o\\m' == wp_unslash($_POST['time_format'])) {
         $_POST['time_format'] = $_POST['time_format_custom'];
     }
     // Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
     if (!empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string'])) {
         $_POST['gmt_offset'] = $_POST['timezone_string'];
         $_POST['gmt_offset'] = preg_replace('/UTC\\+?/', '', $_POST['gmt_offset']);
         $_POST['timezone_string'] = '';
     }
     // Handle translation install.
     if (!empty($_POST['WPLANG']) && (!is_multisite() || is_super_admin())) {
         // @todo: Skip if already installed
         require_once ABSPATH . 'wp-admin/includes/translation-install.php';
         if (wp_can_install_language_pack()) {
             $language = wp_download_language_pack($_POST['WPLANG']);
             if ($language) {
                 $_POST['WPLANG'] = $language;
             }
         }
     }
 }
 if ($options) {
     foreach ($options as $option) {
         if ($unregistered) {
             _deprecated_argument('options.php', '2.7', sprintf(__('The %s setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API'), '<code>' . $option . '</code>'));
         }
         $option = trim($option);
         $value = null;
         if (isset($_POST[$option])) {
コード例 #5
0
function bogo_tools_page()
{
    $message = "";
    if (isset($_GET['message'])) {
        if ('success' == $_GET['message']) {
            $message = __("Translation installed successfully.", 'bogo');
        } elseif ('failed' == $_GET['message']) {
            $message = __("Translation install failed.", 'bogo');
        }
    }
    $default_locale = bogo_get_default_locale();
    $available_locales = bogo_available_locales();
    ?>
<div class="wrap">

<h2><?php 
    echo esc_html(__('Bogo Tools', 'bogo'));
    ?>
</h2>

<?php 
    if (!empty($message)) {
        ?>
<div id="message" class="updated"><p><?php 
        echo esc_html($message);
        ?>
</p></div>
<?php 
    }
    ?>

<h3 class="title"><?php 
    echo esc_html(__('Available Languages', 'bogo'));
    ?>
</h3>

<table id="bogo-languages-table" class="widefat">
<thead>
	<tr><th></th><th><?php 
    echo esc_html(__('Language', 'bogo'));
    ?>
</th></tr>
</thead>
<tfoot>
	<tr><th></th><th><?php 
    echo esc_html(__('Language', 'bogo'));
    ?>
</th></tr>
</tfoot>
<tbody id="translations">
	<tr><th>1</th><td><p>
		<strong><?php 
    echo esc_html(bogo_get_language($default_locale));
    ?>
</strong>
		[<?php 
    echo esc_html($default_locale);
    ?>
]
		<br /><?php 
    echo esc_html(__('Site Default Language', 'bogo'));
    ?>
	</p></td></tr>

<?php 
    $count = 1;
    foreach ($available_locales as $locale) {
        if ($locale == $default_locale) {
            continue;
        }
        $count += 1;
        ?>
	<tr><th><?php 
        echo $count;
        ?>
</th><td><p>
		<strong><?php 
        echo esc_html(bogo_get_language($locale));
        ?>
</strong>
		[<?php 
        echo esc_html($locale);
        ?>
]
		<br /><?php 
        echo esc_html(__('Installed', 'bogo'));
        ?>
	</p></td></tr>
<?php 
    }
    $can_install = wp_can_install_language_pack();
    foreach (wp_get_available_translations() as $locale => $translation) {
        if (in_array($locale, $available_locales)) {
            continue;
        }
        $count += 1;
        $install_link = '';
        if ($can_install) {
            $install_link = menu_page_url('bogo-tools', false);
            $install_link = add_query_arg(array('action' => 'install_translation', 'locale' => $locale), $install_link);
            $install_link = wp_nonce_url($install_link, 'bogo-tools');
            $install_link = sprintf('<a href="%1$s" class="install">%2$s</a>', $install_link, esc_html(__('Install', 'bogo')));
        }
        ?>
	<tr><th><?php 
        echo $count;
        ?>
</th><td><p>
		<strong><?php 
        echo esc_html(bogo_get_language($locale));
        ?>
</strong>
		[<?php 
        echo esc_html($locale);
        ?>
]
		<?php 
        echo $install_link;
        ?>
	</p></td></tr>
<?php 
    }
    ?>

</tbody>
</table>

</div>
<?php 
}
コード例 #6
0
	<tr>
		<th width="33%" scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th>
		<td>
			<?php
			$locale = get_locale();
			if ( ! in_array( $locale, $languages ) ) {
				$locale = '';
			}

			wp_dropdown_languages( array(
				'name'         => 'WPLANG',
				'id'           => 'WPLANG',
				'selected'     => $locale,
				'languages'    => $languages,
				'translations' => $translations,
				'show_available_translations' => ( ! is_multisite() || is_super_admin() ) && wp_can_install_language_pack(),
			) );

			// Add note about deprecated WPLANG constant.
			if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) {
				if ( is_super_admin() ) {
					?>
					<p class="description">
						<strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %s constant in your %s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?>
					</p>
					<?php
				}
				_deprecated_argument( 'define()', '4.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
			}
			?>
		</td>
コード例 #7
0
				<tr>
					<th><label for="WPLANG"><?php _e( 'Default Language' ); ?></label></th>
					<td>
						<?php
						$lang = get_site_option( 'WPLANG' );
						if ( ! in_array( $lang, $languages ) ) {
							$lang = '';
						}

						wp_dropdown_languages( array(
							'name'         => 'WPLANG',
							'id'           => 'WPLANG',
							'selected'     => $lang,
							'languages'    => $languages,
							'translations' => $translations,
							'show_available_translations' => wp_can_install_language_pack(),
						) );
						?>
					</td>
				</tr>
			</table>
			<?php
		}
		?>

		<h3><?php _e( 'Menu Settings' ); ?></h3>
		<table id="menu" class="form-table">
			<tr>
				<th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
				<td>
			<?php
コード例 #8
0
 /**
  * Download the chosen fallback language on save and create the language dropdown similar to the default language dropdown
  */
 public function fallback_locale_field()
 {
     $languages = get_available_languages();
     $translations = wp_get_available_translations();
     $fallback_locale = $this->fallback_locale;
     // Handle translation install.
     if (!empty($fallback_locale) && !in_array($fallback_locale, $languages) && (!is_multisite() || is_super_admin())) {
         require_once ABSPATH . 'wp-admin/includes/translation-install.php';
         if (wp_can_install_language_pack()) {
             $language = wp_download_language_pack($fallback_locale);
             if ($language) {
                 $fallback_locale = $language;
             }
         }
     }
     wp_dropdown_languages(array('name' => 'fallback_locale', 'id' => 'fallback_locale', 'selected' => $fallback_locale, 'languages' => $languages, 'translations' => $translations, 'show_available_translations' => (!is_multisite() || is_super_admin()) && wp_can_install_language_pack()));
 }