Changeset 1590987 for multisite-language-switcher
- Timestamp:
- 02/07/2017 02:08:29 PM (9 years ago)
- Location:
- multisite-language-switcher/trunk
- Files:
-
- 14 edited
-
MultisiteLanguageSwitcher.php (modified) (3 diffs)
-
css/index.php (modified) (1 diff)
-
flags/index.php (modified) (1 diff)
-
images/index.php (modified) (1 diff)
-
includes/MslsAdmin.php (modified) (27 diffs)
-
includes/MslsBlog.php (modified) (6 diffs)
-
includes/MslsBlogCollection.php (modified) (10 diffs)
-
includes/MslsOptions.php (modified) (2 diffs)
-
includes/MslsOptionsPost.php (modified) (1 diff)
-
js/index.php (modified) (1 diff)
-
languages/index.php (modified) (1 diff)
-
languages/multisite-language-switcher-it_IT.mo (modified) (previous)
-
languages/multisite-language-switcher-it_IT.po (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
multisite-language-switcher/trunk/MultisiteLanguageSwitcher.php
r1310963 r1590987 5 5 Plugin URI: http://msls.co/ 6 6 Description: A simple but powerful plugin that will help you to manage the relations of your contents in a multilingual multisite-installation. 7 Version: 1. 0.87 Version: 1.1 8 8 Author: Dennis Ploetner 9 9 Author URI: http://lloc.de/ … … 34 34 */ 35 35 if ( ! defined( 'MSLS_PLUGIN_VERSION' ) ) { 36 define( 'MSLS_PLUGIN_VERSION', '1. 0.8' );36 define( 'MSLS_PLUGIN_VERSION', '1.1' ); 37 37 38 38 if ( ! defined( 'MSLS_PLUGIN_PATH' ) ) { … … 58 58 public static function load( $class ) { 59 59 if ( 'Msls' == substr( $class, 0, 4 ) ) { 60 require_once dirname( __FILE__ ) . '/includes/' . $class . '.php';60 require_once dirname( __FILE__ ) . "/includes/{$class}.php"; 61 61 } 62 62 } -
multisite-language-switcher/trunk/css/index.php
r1303276 r1590987 1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); ?>1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); -
multisite-language-switcher/trunk/flags/index.php
r1303276 r1590987 1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); ?>1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); -
multisite-language-switcher/trunk/images/index.php
r1303276 r1590987 1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); ?>1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); -
multisite-language-switcher/trunk/includes/MslsAdmin.php
r1310963 r1590987 13 13 14 14 /** 15 * @var MslsOptions $options 16 */ 17 protected $options; 18 19 /** 20 * MslsAdmin constructor. 21 */ 22 public function __construct() { 23 $this->options = MslsOptions::instance(); 24 } 25 26 /** 15 27 * Init 16 28 * @return MslsAdmin … … 23 35 add_options_page( $title, $title, 'manage_options', __CLASS__, array( $obj, 'render' ) ); 24 36 25 add_action( 'admin_init', array( $obj, 'register' ) );37 add_action( 'admin_init', array( $obj, 'register' ) ); 26 38 add_action( 'admin_notices', array( $obj, 'has_problems' ) ); 27 39 … … 30 42 31 43 return $obj; 44 } 45 46 /** 47 * You can use every method of the decorated object 48 * 49 * @param string $method 50 * @param mixed $args 51 * 52 * @return mixed 53 */ 54 public function __call( $method, $args ) { 55 $parts = explode( '_', $method, 2 ); 56 if ( 2 == count( $parts ) ) { 57 switch( $parts[0] ) { 58 case 'rewrite': 59 return $this->render_rewrite( $parts[1] ); 60 break; 61 case 'text': 62 echo $this->render_input( $parts[1] ); 63 break; 64 } 65 } 32 66 } 33 67 … … 38 72 public function has_problems() { 39 73 $message = ''; 40 $options = MslsOptions::instance();74 $options = $this->options; 41 75 42 76 if ( 1 == count( $options->get_available_languages() ) ) { … … 46 80 esc_url( 'http://wordpress.org/plugins/wp-native-dashboard/' ) 47 81 ); 48 } 49 elseif ( $options->is_empty() ) { 82 } elseif ( $options->is_empty() ) { 50 83 $message = sprintf( 51 84 __( 'Multisite Language Switcher is almost ready. You must <a href="%s">complete the configuration process</a>.' ), … … 74 107 printf( 75 108 '<p class="submit"><input name="Submit" type="submit" class="button-primary" value="%s" /></p></form></div>', 76 ( MslsOptions::instance()->is_empty() ? __( 'Configure', 'multisite-language-switcher' ) : __( 'Update', 'multisite-language-switcher' ) )109 ( $this->options->is_empty() ? __( 'Configure', 'multisite-language-switcher' ) : __( 'Update', 'multisite-language-switcher' ) ) 77 110 ); 78 111 } … … 96 129 } 97 130 98 return (99 empty( $arr ) ?131 return ( 132 empty( $arr ) ? 100 133 '' : 101 134 sprintf( … … 113 146 register_setting( 'msls', 'msls', array( $this, 'validate' ) ); 114 147 115 add_settings_section( 'language_section', __( 'Language Settings', 'multisite-language-switcher' ), array( $this, 'language_section' ), __CLASS__ ); 116 add_settings_section( 'main_section', __( 'Main Settings', 'multisite-language-switcher' ), array( $this, 'main_section' ), __CLASS__ ); 117 add_settings_section( 'advanced_section', __( 'Advanced Settings', 'multisite-language-switcher' ), array( $this, 'advanced_section' ), __CLASS__ ); 148 add_settings_section( 'language_section', __( 'Language Settings', 'multisite-language-switcher' ), array( 149 $this, 150 'language_section' 151 ), __CLASS__ ); 152 add_settings_section( 'main_section', __( 'Main Settings', 'multisite-language-switcher' ), array( 153 $this, 154 'main_section' 155 ), __CLASS__ ); 156 add_settings_section( 'advanced_section', __( 'Advanced Settings', 'multisite-language-switcher' ), array( 157 $this, 158 'advanced_section' 159 ), __CLASS__ ); 160 161 global $wp_rewrite; 162 if ( $wp_rewrite->using_permalinks() ) { 163 add_settings_section( 'rewrites_section', __( 'Rewrites Settings', 'multisite-language-switcher' ), array( 164 $this, 165 'rewrites_section' 166 ), __CLASS__ ); 167 } 118 168 119 169 /** 120 170 * Lets you add your own settings section 121 171 * @since 1.0 172 * 122 173 * @param string $page 123 174 */ … … 130 181 */ 131 182 public function language_section() { 132 add_settings_field( 'blog_language', __( 'Blog Language', 'multisite-language-switcher' ), array( $this, 'blog_language' ), __CLASS__, 'language_section' ); 133 add_settings_field( 'admin_language', __( 'Admin Language', 'multisite-language-switcher' ), array( $this, 'admin_language' ), __CLASS__, 'language_section' ); 183 add_settings_field( 'blog_language', __( 'Blog Language', 'multisite-language-switcher' ), array( 184 $this, 185 'blog_language' 186 ), __CLASS__, 'language_section' ); 187 add_settings_field( 'admin_language', __( 'Admin Language', 'multisite-language-switcher' ), array( 188 $this, 189 'admin_language' 190 ), __CLASS__, 'language_section' ); 134 191 135 192 /** 136 193 * Lets you add your own field to the language section 137 194 * @since 1.0 195 * 138 196 * @param string $page 139 197 * @param string $section … … 147 205 */ 148 206 public function main_section() { 149 add_settings_field( 'display', __( 'Display', 'multisite-language-switcher' ), array( $this, 'display' ), __CLASS__, 'main_section' ); 150 add_settings_field( 'sort_by_description', __( 'Sort output by description', 'multisite-language-switcher' ), array( $this, 'sort_by_description' ), __CLASS__, 'main_section' ); 151 add_settings_field( 'output_current_blog', __( 'Display link to the current language', 'multisite-language-switcher' ), array( $this, 'output_current_blog' ), __CLASS__, 'main_section' ); 152 add_settings_field( 'only_with_translation', __( 'Show only links with a translation', 'multisite-language-switcher' ), array( $this, 'only_with_translation' ), __CLASS__, 'main_section' ); 153 add_settings_field( 'description', __( 'Description', 'multisite-language-switcher' ), array( $this, 'description' ), __CLASS__, 'main_section' ); 154 add_settings_field( 'before_output', __( 'Text/HTML before the list', 'multisite-language-switcher' ), array( $this, 'before_output' ), __CLASS__, 'main_section' ); 155 add_settings_field( 'after_output', __( 'Text/HTML after the list', 'multisite-language-switcher' ), array( $this, 'after_output' ), __CLASS__, 'main_section' ); 156 add_settings_field( 'before_item', __( 'Text/HTML before each item', 'multisite-language-switcher' ), array( $this, 'before_item' ), __CLASS__, 'main_section' ); 157 add_settings_field( 'after_item', __( 'Text/HTML after each item', 'multisite-language-switcher' ), array( $this, 'after_item' ), __CLASS__, 'main_section' ); 158 add_settings_field( 'content_filter', __( 'Add hint for available translations', 'multisite-language-switcher' ), array( $this, 'content_filter' ), __CLASS__, 'main_section' ); 159 add_settings_field( 'content_priority', __( 'Hint priority', 'multisite-language-switcher' ), array( $this, 'content_priority' ), __CLASS__, 'main_section' ); 207 add_settings_field( 'display', __( 'Display', 'multisite-language-switcher' ), array( 208 $this, 209 'display' 210 ), __CLASS__, 'main_section' ); 211 add_settings_field( 'sort_by_description', __( 'Sort output by description', 'multisite-language-switcher' ), array( 212 $this, 213 'sort_by_description' 214 ), __CLASS__, 'main_section' ); 215 add_settings_field( 'output_current_blog', __( 'Display link to the current language', 'multisite-language-switcher' ), array( 216 $this, 217 'output_current_blog' 218 ), __CLASS__, 'main_section' ); 219 add_settings_field( 'only_with_translation', __( 'Show only links with a translation', 'multisite-language-switcher' ), array( 220 $this, 221 'only_with_translation' 222 ), __CLASS__, 'main_section' ); 223 add_settings_field( 'description', __( 'Description', 'multisite-language-switcher' ), array( 224 $this, 225 'description' 226 ), __CLASS__, 'main_section' ); 227 add_settings_field( 'before_output', __( 'Text/HTML before the list', 'multisite-language-switcher' ), array( 228 $this, 229 'text_before_output' 230 ), __CLASS__, 'main_section' ); 231 add_settings_field( 'after_output', __( 'Text/HTML after the list', 'multisite-language-switcher' ), array( 232 $this, 233 'text_after_output' 234 ), __CLASS__, 'main_section' ); 235 add_settings_field( 'before_item', __( 'Text/HTML before each item', 'multisite-language-switcher' ), array( 236 $this, 237 'text_before_item' 238 ), __CLASS__, 'main_section' ); 239 add_settings_field( 'after_item', __( 'Text/HTML after each item', 'multisite-language-switcher' ), array( 240 $this, 241 'text_after_item' 242 ), __CLASS__, 'main_section' ); 243 add_settings_field( 'content_filter', __( 'Add hint for available translations', 'multisite-language-switcher' ), array( 244 $this, 245 'content_filter' 246 ), __CLASS__, 'main_section' ); 247 add_settings_field( 'content_priority', __( 'Hint priority', 'multisite-language-switcher' ), array( 248 $this, 249 'content_priority' 250 ), __CLASS__, 'main_section' ); 160 251 161 252 /** 162 253 * Lets you add your own field to the main section 163 254 * @since 1.0 255 * 164 256 * @param string $page 165 257 * @param string $section … … 173 265 */ 174 266 public function advanced_section() { 175 add_settings_field( 'activate_autocomplete', __( 'Activate experimental autocomplete inputs', 'multisite-language-switcher' ), array( $this, 'activate_autocomplete' ), __CLASS__, 'advanced_section' ); 176 add_settings_field( 'image_url', __( 'Custom URL for flag-images', 'multisite-language-switcher' ), array( $this, 'image_url' ), __CLASS__, 'advanced_section' ); 177 add_settings_field( 'reference_user', __( 'Reference user', 'multisite-language-switcher' ), array( $this, 'reference_user' ), __CLASS__, 'advanced_section' ); 178 add_settings_field( 'exclude_current_blog', __( 'Exclude this blog from output', 'multisite-language-switcher' ), array( $this, 'exclude_current_blog' ), __CLASS__, 'advanced_section' ); 267 add_settings_field( 'activate_autocomplete', __( 'Activate experimental autocomplete inputs', 'multisite-language-switcher' ), array( 268 $this, 269 'activate_autocomplete' 270 ), __CLASS__, 'advanced_section' ); 271 add_settings_field( 'image_url', __( 'Custom URL for flag-images', 'multisite-language-switcher' ), array( 272 $this, 273 'text_image_url' 274 ), __CLASS__, 'advanced_section' ); 275 add_settings_field( 'reference_user', __( 'Reference user', 'multisite-language-switcher' ), array( 276 $this, 277 'reference_user' 278 ), __CLASS__, 'advanced_section' ); 279 add_settings_field( 'exclude_current_blog', __( 'Exclude this blog from output', 'multisite-language-switcher' ), array( 280 $this, 281 'exclude_current_blog' 282 ), __CLASS__, 'advanced_section' ); 179 283 180 284 /** 181 285 * Lets you add your own field to the advanced section 182 286 * @since 1.0 287 * 183 288 * @param string $page 184 289 * @param string $section … … 188 293 189 294 /** 295 * Register the fields in the rewrites_section 296 * @since 1.1 297 * @codeCoverageIgnore 298 */ 299 public function rewrites_section() { 300 foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $key => $object ) { 301 $title = sprintf( __( '%s Slug', 'multisite-language-switcher' ), $object->label ); 302 add_settings_field( "rewrite_{$key}", $title, array( $this, "rewrite_{$key}" ), __CLASS__, 'rewrites_section' ); 303 } 304 305 /** 306 * Lets you add your own field to the rewrites section 307 * 308 * @param string $page 309 * @param string $section 310 */ 311 do_action( 'msls_admin_rewrites_section', __CLASS__, 'rewrites_section' ); 312 } 313 314 /** 190 315 * Shows the select-form-field 'blog_language' 191 316 */ … … 193 318 echo $this->render_select( 194 319 'blog_language', 195 MslsOptions::instance()->get_available_languages(),320 $this->options->get_available_languages(), 196 321 get_option( 'WPLANG', 'en_US' ) 197 322 ); … … 202 327 */ 203 328 public function admin_language() { 204 $options = MslsOptions::instance();329 $options = $this->options; 205 330 echo $this->render_select( 206 331 'admin_language', … … 217 342 'display', 218 343 MslsLink::get_types_description(), 219 MslsOptions::instance()->display344 $this->options->display 220 345 ); 221 346 } … … 231 356 } 232 357 233 echo $this->render_select( 'reference_user', $users, MslsOptions::instance()->reference_user );234 } 235 236 /** 237 * Activate autocomplete358 echo $this->render_select( 'reference_user', $users, $this->options->reference_user ); 359 } 360 361 /** 362 render 238 363 * 239 364 * You can decide if you want to activate the experimental autocomplete … … 291 416 public function description() { 292 417 echo $this->render_input( 'description', '40' ); 293 }294 295 /**296 * A String which will be placed before the output of the list297 */298 public function before_output() {299 echo $this->render_input( 'before_output' );300 }301 302 /**303 * A String which will be placed after the output of the list304 */305 public function after_output() {306 echo $this->render_input( 'after_output' );307 }308 309 /**310 * A String which will be placed before every item of the list311 */312 public function before_item() {313 echo $this->render_input( 'before_item' );314 }315 316 /**317 * A String which will be placed after every item of the list318 */319 public function after_item() {320 echo $this->render_input( 'after_item' );321 418 } 322 419 … … 336 433 */ 337 434 public function content_priority() { 338 $temp = array_merge( range( 1, 10 ), array( 20, 50, 100 ) ); 339 $arr = array_combine( $temp, $temp ); 340 $options = MslsOptions::instance(); 435 $temp = array_merge( range( 1, 10 ), array( 20, 50, 100 ) ); 436 $arr = array_combine( $temp, $temp ); 341 437 $selected = ( 342 empty( $options->content_priority ) ?438 empty( $this->options->content_priority ) ? 343 439 10 : 344 $ options->content_priority440 $this->options->content_priority 345 441 ); 346 442 … … 349 445 350 446 /** 351 * Alternative image-url 352 * @todo This is a value of a directory-url which should be more clear 353 */ 354 public function image_url() { 355 echo $this->render_input( 'image_url' ); 447 * Rewrites slugs for registered post types 448 * 449 * @param string $key 450 */ 451 public function render_rewrite( $key ) { 452 $rewrite = get_post_type_object( $key )->rewrite; 453 454 $value = ''; 455 if ( true === $rewrite ) { 456 $value = $key; 457 } 458 elseif ( ! empty( $rewrite['slug'] ) ) { 459 $value = $rewrite['slug']; 460 } 461 462 echo $this->render_input( "rewrite_{$key}", 30, $value, true ); 356 463 } 357 464 358 465 /** 359 466 * Render form-element (checkbox) 467 * 360 468 * @param string $key Name and ID of the form-element 469 * 361 470 * @return string 362 471 */ … … 365 474 '<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>', 366 475 $key, 367 checked( 1, MslsOptions::instance()->$key, false )476 checked( 1, $this->options->$key, false ) 368 477 ); 369 478 } … … 371 480 /** 372 481 * Render form-element (text-input) 482 * 373 483 * @param string $key Name and ID of the form-element 374 484 * @param string $size Size-attribute of the input-field 485 * @param string $default 486 * @param bool $readonly 487 * 375 488 * @return string 376 489 */ 377 public function render_input( $key, $size = '30' ) {490 public function render_input( $key, $size = '30', $default = '', $readonly = false ) { 378 491 return sprintf( 379 '<input id="%1$s" name="msls[%1$s]" value="%2$s" size="%3$s" />',492 '<input id="%1$s" name="msls[%1$s]" value="%2$s" size="%3$s"%4$s/>', 380 493 $key, 381 esc_attr( MslsOptions::instance()->$key ), 382 $size 494 esc_attr( ! empty( $this->options->$key ) ? $this->options->$key : $default ), 495 $size, 496 $readonly ? ' readonly="readonly"' : '' 383 497 ); 384 498 } … … 387 501 * Render form-element (select) 388 502 * @uses selected 503 * 389 504 * @param string $key Name and ID of the form-element 390 505 * @param array $arr Options as associative array 391 506 * @param string $selected Values which should be selected 507 * 392 508 * @return string 393 509 */ … … 413 529 /** 414 530 * Validates input before saving it 531 * 415 532 * @param array $arr Values of the submitted form 533 * 416 534 * @return array Validated input 417 535 */ … … 420 538 * Returns custom filtered input array 421 539 * @since 1.0 540 * 422 541 * @param array $arr 423 542 */ … … 425 544 426 545 $arr['display'] = ( 427 isset( $arr['display'] ) ?546 isset( $arr['display'] ) ? 428 547 (int) $arr['display'] : 429 548 0 … … 439 558 /** 440 559 * Filter which sets the global blog language 560 * 441 561 * @param array $arr 562 * 442 563 * @return array 443 564 */ … … 448 569 unset( $arr['blog_language'] ); 449 570 } 571 450 572 return $arr; 451 573 } -
multisite-language-switcher/trunk/includes/MslsBlog.php
r1303276 r1590987 8 8 /** 9 9 * Internal representation of a blog 10 * @property int $userblog_id 10 * @property int $userblog_id 11 11 * @package Msls 12 12 */ … … 33 33 /** 34 34 * Constructor 35 * @param StdClass $obj 35 * 36 * @param StdClass $obj 36 37 * @param string $description 37 38 */ … … 50 51 * 51 52 * The method return <em>null</em> if the requested member does not exists. 53 * 52 54 * @param string $key 55 * 53 56 * @return mixed|null 54 57 */ 55 58 final public function __get( $key ) { 56 return ( isset( $this->obj->$key ) ? $this->obj->$key : null );59 return ( isset( $this->obj->$key ) ? $this->obj->$key : null ); 57 60 } 58 61 59 62 /** 60 63 * Get the description stored in this object 61 * 64 * 62 65 * The method returns the stored language if the description is empty. 63 66 * @return string 64 67 */ 65 68 public function get_description() { 66 return (67 empty( $this->description ) ?69 return ( 70 empty( $this->description ) ? 68 71 $this->get_language() : 69 72 $this->description … … 73 76 /** 74 77 * Get the language stored in this object 75 * 76 * This method returns the string 'us' if there is an empty value in language. 78 * 79 * This method returns the string 'us' if there is an empty value in language. 77 80 * @return string 78 81 */ 79 82 public function get_language() { 80 return ( empty( $this->language ) ? 'us' : $this->language );83 return ( empty( $this->language ) ? 'us' : $this->language ); 81 84 } 82 85 83 86 /** 84 87 * Get the alpha2-part of the language-code 85 * 88 * 86 89 * This method returns the string 'en' if the language-code contains just 'us'. 87 90 * @return string … … 89 92 public function get_alpha2() { 90 93 $alpha2 = substr( $this->get_language(), 0, 2 ); 91 return( 'us' == $alpha2 ? 'en' : $alpha2 ); 94 95 return ( 'us' == $alpha2 ? 'en' : $alpha2 ); 92 96 } 93 97 94 98 /** 95 99 * Sort objects helper 100 * 96 101 * @param string $a 97 102 * @param string $b 98 * return int 103 * 104 * @return int 99 105 */ 100 106 public static function _cmp( $a, $b ) { … … 102 108 return 0; 103 109 } 104 return( $a < $b ? (-1) : 1 ); 110 111 return ( $a < $b ? ( - 1 ) : 1 ); 105 112 } 106 113 107 114 /** 108 115 * Sort objects by language 116 * 109 117 * @param MslsBlog $a 110 118 * @param MslsBlog $b 111 * return int 119 * 120 * @return int 112 121 */ 113 122 public static function language( MslsBlog $a, MslsBlog $b ) { 114 return ( self::_cmp( $a->get_language(), $b->get_language() ) );123 return ( self::_cmp( $a->get_language(), $b->get_language() ) ); 115 124 } 116 125 117 126 /** 118 127 * Sort objects by description 128 * 119 129 * @param MslsBlog $a 120 130 * @param MslsBlog $b 121 * return int 131 * 132 * @return int 122 133 */ 123 134 public static function description( MslsBlog $a, MslsBlog $b ) { 124 return ( self::_cmp( $a->get_description(), $b->get_description() ) );135 return ( self::_cmp( $a->get_description(), $b->get_description() ) ); 125 136 } 126 137 -
multisite-language-switcher/trunk/includes/MslsBlogCollection.php
r1303276 r1590987 120 120 121 121 /** 122 * Get the list of the blogs of the reference user122 * Gets the list of the blogs of the reference user 123 123 * The first available user of the blog will be used if there is no 124 124 * refrence user configured … … 148 148 149 149 /** 150 * Gets blog(s) by language 151 */ 152 public function get_blog_id( $language ) { 153 foreach ( $this->get_objects() as $blog ) { 154 if ( $language == $blog->get_language() ) { 155 return $blog->userblog_id; 156 } 157 } 158 159 return null; 160 } 161 162 /** 150 163 * Get the id of the current blog 151 164 * @return int … … 156 169 157 170 /** 158 * Check if current blog is in the collection171 * Checks if current blog is in the collection 159 172 * 160 173 * @return bool … … 165 178 166 179 /** 167 * Get current blog as object180 * Gets current blog as object 168 181 * @return MslsBlog|null 169 182 */ … … 177 190 178 191 /** 179 * Get an array with all blog-objects180 * @return array192 * Gets an array with all blog-objects 193 * @return MslsBlog[] 181 194 */ 182 195 public function get_objects() { … … 209 222 210 223 /** 211 * Get only blogs where the plugin is active224 * Gets only blogs where the plugin is active 212 225 * @return array 213 226 */ … … 225 238 226 239 /** 227 * Get an array of all - but not the current - blog-objects240 * Gets an array of all - but not the current - blog-objects 228 241 * @return array 229 242 */ … … 238 251 239 252 /** 240 * Get an array with filtered blog-objects253 * Gets an array with filtered blog-objects 241 254 * 242 255 * @param bool $filter … … 253 266 254 267 /** 255 * Get the registered users of the current blog268 * Gets the registered users of the current blog 256 269 * 257 270 * @param string $fields … … 272 285 273 286 /** 274 * Get or createan instance of MslsBlogCollection287 * Gets or creates an instance of MslsBlogCollection 275 288 * @todo Until PHP 5.2 is not longer the minimum for WordPress ... 276 289 * @return MslsBlogCollection -
multisite-language-switcher/trunk/includes/MslsOptions.php
r1308301 r1590987 276 276 277 277 /** 278 * Returns slug for a post type 279 * @param string $post_type 280 * 281 * @return string 282 */ 283 public function get_slug( $post_type ) { 284 $key = "rewrite_{$post_type}"; 285 286 error_log( $key ); 287 288 return isset( $this->$key ) ? $this->$key : ''; 289 } 290 291 /** 278 292 * Get flag url 279 293 * … … 360 374 361 375 global $wp_rewrite; 362 if ( is_subdomain_install() || ! $wp_rewrite->using_permalinks() ) {376 if ( ! is_subdomain_install() || ! $wp_rewrite->using_permalinks() ) { 363 377 return $url; 364 378 } -
multisite-language-switcher/trunk/includes/MslsOptionsPost.php
r1303276 r1590987 44 44 } 45 45 46 global $current_site; 47 $blog_id = MslsBlogCollection::instance()->get_blog_id( $language ); 48 if ( $current_site->blog_id != $blog_id ) { 49 $option = get_blog_option( $blog_id, 'msls' ); 50 //error_log( print_r( $option, true ) ); 51 } 52 46 53 return apply_filters( 'check_url', get_permalink( $post ), $this ); 47 54 } -
multisite-language-switcher/trunk/js/index.php
r1303276 r1590987 1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); ?>1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); -
multisite-language-switcher/trunk/languages/index.php
r1303276 r1590987 1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); ?>1 <?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) ); -
multisite-language-switcher/trunk/languages/multisite-language-switcher-it_IT.po
r1309868 r1590987 3 3 "Project-Id-Version: MSLS 0.9.9\n" 4 4 "Report-Msgid-Bugs-To: http://wordpress.org/tag/multisite-language-switcher\n" 5 "POT-Creation-Date: 201 5-12-16 11:30+0100\n"6 "PO-Revision-Date: 201 5-12-16 11:30+0100\n"5 "POT-Creation-Date: 2016-02-18 17:49+0100\n" 6 "PO-Revision-Date: 2016-02-18 17:49+0100\n" 7 7 "Last-Translator: Dennis Ploetner <dennis.ploetner@drivek.com>\n" 8 8 "Language-Team: Antonella Cucinelli <a.cucinelli@freely.de>\n" … … 33 33 msgstr "%s e %s" 34 34 35 #: ../MultisiteLanguageSwitcher.php:2 8535 #: ../MultisiteLanguageSwitcher.php:293 36 36 msgid "" 37 37 "The Multisite Language Switcher needs the activation of the multisite-" … … 79 79 80 80 # @ msls 81 #: ../includes/MslsAdminIcon.php:15 481 #: ../includes/MslsAdminIcon.php:150 82 82 #, php-format 83 83 msgid "Create a new translation in the %s-blog" … … 168 168 msgstr "Mostra solo link con traduzione" 169 169 170 # @ msls171 170 #: ../includes/MslsAdmin.php:153 171 msgid "x-default" 172 msgstr "x-default" 173 174 # @ msls 175 #: ../includes/MslsAdmin.php:154 172 176 msgid "Description" 173 177 msgstr "Descrizione" 174 178 175 179 # @ msls 176 #: ../includes/MslsAdmin.php:15 4180 #: ../includes/MslsAdmin.php:155 177 181 msgid "Text/HTML before the list" 178 182 msgstr "Testo/HTML davanti alla lista" 179 183 180 184 # @ msls 181 #: ../includes/MslsAdmin.php:15 5185 #: ../includes/MslsAdmin.php:156 182 186 msgid "Text/HTML after the list" 183 187 msgstr "Testo/HTML dietro alla lista" 184 188 185 189 # @ msls 186 #: ../includes/MslsAdmin.php:15 6190 #: ../includes/MslsAdmin.php:157 187 191 msgid "Text/HTML before each item" 188 192 msgstr "Testo/HTML davanti a ogni elemento" 189 193 190 194 # @ msls 191 #: ../includes/MslsAdmin.php:15 7195 #: ../includes/MslsAdmin.php:158 192 196 msgid "Text/HTML after each item" 193 197 msgstr "Testo/HTML dietro a ogni elemento" 194 198 195 199 # @ msls 196 #: ../includes/MslsAdmin.php:15 8200 #: ../includes/MslsAdmin.php:159 197 201 msgid "Add hint for available translations" 198 202 msgstr "Messaggio aggiuntivo se esiste una traduzione" 199 203 200 204 # @ msls 201 #: ../includes/MslsAdmin.php:1 59205 #: ../includes/MslsAdmin.php:160 202 206 msgid "Hint priority" 203 207 msgstr "Priorità del messaggio" 204 208 205 #: ../includes/MslsAdmin.php:17 5209 #: ../includes/MslsAdmin.php:176 206 210 msgid "Activate experimental autocomplete inputs" 207 211 msgstr "Rendere attivo gli autocomplete sperimentali" 208 212 209 213 # @ msls 210 #: ../includes/MslsAdmin.php:17 6214 #: ../includes/MslsAdmin.php:177 211 215 msgid "Custom URL for flag-images" 212 216 msgstr "URL alternativo per bandiere" 213 217 214 #: ../includes/MslsAdmin.php:17 7218 #: ../includes/MslsAdmin.php:178 215 219 msgid "Reference user" 216 220 msgstr "Utente di referenza" 217 221 218 222 # @ msls 219 #: ../includes/MslsAdmin.php:17 8223 #: ../includes/MslsAdmin.php:179 220 224 msgid "Exclude this blog from output" 221 225 msgstr "Escludi questo blog dall'output" … … 240 244 msgstr "Descrizione e bandiera" 241 245 242 #: ../includes/MslsOptions.php:3 27246 #: ../includes/MslsOptions.php:338 243 247 msgid "American English" 244 248 msgstr "Inglese americano" -
multisite-language-switcher/trunk/readme.txt
r1480876 r1590987 5 5 Tags: multilingual, multisite, language, switcher, international, localization, i18n 6 6 Requires at least: 3.6.1 7 Tested up to: 4. 68 Stable tag: 1. 0.87 Tested up to: 4.7 8 Stable tag: 1.1 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 91 91 92 92 == Changelog == 93 94 = 1.1 = 95 * Fix and enhancements for translated slugs 93 96 94 97 = 1.0.8 =
Note: See TracChangeset
for help on using the changeset viewer.