Changeset 4033 for sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc/class-plugin.php
- Timestamp:
- 09/11/2016 08:08:22 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc/class-plugin.php
r4027 r4033 61 61 62 62 // Customizations for all sites. 63 $this->filter_date_options(); 64 } 65 66 /** 67 * Adds filters for all date options. 68 */ 69 private function filter_date_options() { 70 $options = new Filter\Options(); 71 72 $options->add_option( 73 ( new Filter\Option() ) 74 ->set_name( 'timezone_string' ) 75 ->set_callback( function() { 76 /* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14) 77 * or a valid timezone string (America/New_York). See https://secure.php.net/manual/timezones.php 78 * for all timezone strings supported by PHP. 79 */ 80 $offset_or_tz = _x( '0', 'default GMT offset or timezone string', 'rosetta' ); 81 if ( $offset_or_tz && ! is_numeric( $offset_or_tz ) && in_array( $offset_or_tz, timezone_identifiers_list() ) ) { 82 return $offset_or_tz; 83 } else { 84 return ''; 85 } 86 } ) 87 ->set_priority( 9 ) // Before `wp_timezone_override_offset()` 88 ); 89 90 $options->add_option( 91 ( new Filter\Option() ) 92 ->set_name( 'gmt_offset' ) 93 ->set_callback( function() { 94 /* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14) 95 * or a valid timezone string (America/New_York). See https://secure.php.net/manual/timezones.php 96 * for all timezone strings supported by PHP. 97 */ 98 $offset_or_tz = _x( '0', 'default GMT offset or timezone string', 'rosetta' ); 99 if ( $offset_or_tz && is_numeric( $offset_or_tz ) ) { 100 return $offset_or_tz; 101 } else { 102 return 0; 103 } 104 } ) 105 ->set_priority( 9 ) // Before `wp_timezone_override_offset()` 106 ); 107 108 $options->add_option( 109 ( new Filter\Option() ) 110 ->set_name( 'date_format' ) 111 ->set_callback( function() { 112 /* translators: default date format, see https://secure.php.net/date */ 113 return __( 'F j, Y', 'rosetta' ); 114 } ) 115 ); 116 117 $options->add_option( 118 ( new Filter\Option() ) 119 ->set_name( 'time_format' ) 120 ->set_callback( function() { 121 /* translators: default time format, see https://secure.php.net/date */ 122 return __( 'g:i a', 'rosetta' ); 123 } ) 124 ); 125 126 $options->add_option( 127 ( new Filter\Option() ) 128 ->set_name( 'start_of_week' ) 129 ->set_callback( function() { 130 /* translators: default start of the week. 0 = Sunday, 1 = Monday */ 131 return _x( '1', 'start of week', 'rosetta' ); 132 } ) 133 ); 134 135 $options->setup(); 63 136 } 64 137 }
Note: See TracChangeset
for help on using the changeset viewer.