Plugin Directory


Ignore:
Timestamp:
02/07/2017 02:08:29 PM (9 years ago)
Author:
realloc
Message:

Version 1.1

Location:
multisite-language-switcher/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • multisite-language-switcher/trunk/MultisiteLanguageSwitcher.php

    r1310963 r1590987  
    55Plugin URI: http://msls.co/
    66Description: 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.8
     7Version: 1.1
    88Author: Dennis Ploetner
    99Author URI: http://lloc.de/
     
    3434 */
    3535if ( ! defined( 'MSLS_PLUGIN_VERSION' ) ) {
    36     define( 'MSLS_PLUGIN_VERSION', '1.0.8' );
     36    define( 'MSLS_PLUGIN_VERSION', '1.1' );
    3737
    3838    if ( ! defined( 'MSLS_PLUGIN_PATH' ) ) {
     
    5858        public static function load( $class ) {
    5959            if ( 'Msls' == substr( $class, 0, 4 ) ) {
    60                 require_once dirname( __FILE__ ) . '/includes/' . $class . '.php';
     60                require_once dirname( __FILE__ ) . "/includes/{$class}.php";
    6161            }
    6262        }
  • 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  
    1313
    1414    /**
     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    /**
    1527     * Init
    1628     * @return MslsAdmin
     
    2335            add_options_page( $title, $title, 'manage_options', __CLASS__, array( $obj, 'render' ) );
    2436
    25             add_action( 'admin_init',    array( $obj, 'register' ) );
     37            add_action( 'admin_init', array( $obj, 'register' ) );
    2638            add_action( 'admin_notices', array( $obj, 'has_problems' ) );
    2739
     
    3042
    3143        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        }
    3266    }
    3367
     
    3872    public function has_problems() {
    3973        $message = '';
    40         $options = MslsOptions::instance();
     74        $options = $this->options;
    4175
    4276        if ( 1 == count( $options->get_available_languages() ) ) {
     
    4680                esc_url( 'http://wordpress.org/plugins/wp-native-dashboard/' )
    4781            );
    48         }
    49         elseif ( $options->is_empty() ) {
     82        } elseif ( $options->is_empty() ) {
    5083            $message = sprintf(
    5184                __( 'Multisite Language Switcher is almost ready. You must <a href="%s">complete the configuration process</a>.' ),
     
    74107        printf(
    75108            '<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' ) )
    77110        );
    78111    }
     
    96129        }
    97130
    98         return(
    99             empty( $arr ) ?
     131        return (
     132        empty( $arr ) ?
    100133            '' :
    101134            sprintf(
     
    113146        register_setting( 'msls', 'msls', array( $this, 'validate' ) );
    114147
    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        }
    118168
    119169        /**
    120170         * Lets you add your own settings section
    121171         * @since 1.0
     172         *
    122173         * @param string $page
    123174         */
     
    130181     */
    131182    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' );
    134191
    135192        /**
    136193         * Lets you add your own field to the language section
    137194         * @since 1.0
     195         *
    138196         * @param string $page
    139197         * @param string $section
     
    147205     */
    148206    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' );
    160251
    161252        /**
    162253         * Lets you add your own field to the main section
    163254         * @since 1.0
     255         *
    164256         * @param string $page
    165257         * @param string $section
     
    173265     */
    174266    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' );
    179283
    180284        /**
    181285         * Lets you add your own field to the advanced section
    182286         * @since 1.0
     287         *
    183288         * @param string $page
    184289         * @param string $section
     
    188293
    189294    /**
     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    /**
    190315     * Shows the select-form-field 'blog_language'
    191316     */
     
    193318        echo $this->render_select(
    194319            'blog_language',
    195             MslsOptions::instance()->get_available_languages(),
     320            $this->options->get_available_languages(),
    196321            get_option( 'WPLANG', 'en_US' )
    197322        );
     
    202327     */
    203328    public function admin_language() {
    204         $options = MslsOptions::instance();
     329        $options = $this->options;
    205330        echo $this->render_select(
    206331            'admin_language',
     
    217342            'display',
    218343            MslsLink::get_types_description(),
    219             MslsOptions::instance()->display
     344            $this->options->display
    220345        );
    221346    }
     
    231356        }
    232357
    233         echo $this->render_select( 'reference_user', $users, MslsOptions::instance()->reference_user );
    234     }
    235 
    236     /**
    237      * Activate autocomplete
     358        echo $this->render_select( 'reference_user', $users, $this->options->reference_user );
     359    }
     360
     361    /**
     362     render
    238363     *
    239364     * You can decide if you want to activate the experimental autocomplete
     
    291416    public function description() {
    292417        echo $this->render_input( 'description', '40' );
    293     }
    294 
    295     /**
    296      * A String which will be placed before the output of the list
    297      */
    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 list
    304      */
    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 list
    311      */
    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 list
    318      */
    319     public function after_item() {
    320         echo $this->render_input( 'after_item' );
    321418    }
    322419
     
    336433     */
    337434    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 );
    341437        $selected = (
    342             empty( $options->content_priority ) ?
     438        empty( $this->options->content_priority ) ?
    343439            10 :
    344             $options->content_priority
     440            $this->options->content_priority
    345441        );
    346442
     
    349445
    350446    /**
    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 );
    356463    }
    357464
    358465    /**
    359466     * Render form-element (checkbox)
     467     *
    360468     * @param string $key Name and ID of the form-element
     469     *
    361470     * @return string
    362471     */
     
    365474            '<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>',
    366475            $key,
    367             checked( 1, MslsOptions::instance()->$key, false )
     476            checked( 1, $this->options->$key, false )
    368477        );
    369478    }
     
    371480    /**
    372481     * Render form-element (text-input)
     482     *
    373483     * @param string $key Name and ID of the form-element
    374484     * @param string $size Size-attribute of the input-field
     485     * @param string $default
     486     * @param bool $readonly
     487     *
    375488     * @return string
    376489     */
    377     public function render_input( $key, $size = '30' ) {
     490    public function render_input( $key, $size = '30', $default = '', $readonly = false ) {
    378491        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/>',
    380493            $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"' : ''
    383497        );
    384498    }
     
    387501     * Render form-element (select)
    388502     * @uses selected
     503     *
    389504     * @param string $key Name and ID of the form-element
    390505     * @param array $arr Options as associative array
    391506     * @param string $selected Values which should be selected
     507     *
    392508     * @return string
    393509     */
     
    413529    /**
    414530     * Validates input before saving it
     531     *
    415532     * @param array $arr Values of the submitted form
     533     *
    416534     * @return array Validated input
    417535     */
     
    420538         * Returns custom filtered input array
    421539         * @since 1.0
     540         *
    422541         * @param array $arr
    423542         */
     
    425544
    426545        $arr['display'] = (
    427             isset( $arr['display'] ) ?
     546        isset( $arr['display'] ) ?
    428547            (int) $arr['display'] :
    429548            0
     
    439558    /**
    440559     * Filter which sets the global blog language
     560     *
    441561     * @param array $arr
     562     *
    442563     * @return array
    443564     */
     
    448569            unset( $arr['blog_language'] );
    449570        }
     571
    450572        return $arr;
    451573    }
  • multisite-language-switcher/trunk/includes/MslsBlog.php

    r1303276 r1590987  
    88/**
    99 * Internal representation of a blog
    10  * @property int $userblog_id 
     10 * @property int $userblog_id
    1111 * @package Msls
    1212 */
     
    3333    /**
    3434     * Constructor
    35      * @param StdClass $obj
     35     *
     36     * @param StdClass $obj
    3637     * @param string $description
    3738     */
     
    5051     *
    5152     * The method return <em>null</em> if the requested member does not exists.
     53     *
    5254     * @param string $key
     55     *
    5356     * @return mixed|null
    5457     */
    5558    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 );
    5760    }
    5861
    5962    /**
    6063     * Get the description stored in this object
    61      * 
     64     *
    6265     * The method returns the stored language if the description is empty.
    6366     * @return string
    6467     */
    6568    public function get_description() {
    66         return(
    67             empty( $this->description ) ?
     69        return (
     70        empty( $this->description ) ?
    6871            $this->get_language() :
    6972            $this->description
     
    7376    /**
    7477     * 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.
    7780     * @return string
    7881     */
    7982    public function get_language() {
    80         return( empty( $this->language ) ? 'us' : $this->language );
     83        return ( empty( $this->language ) ? 'us' : $this->language );
    8184    }
    8285
    8386    /**
    8487     * Get the alpha2-part of the language-code
    85      * 
     88     *
    8689     * This method returns the string 'en' if the language-code contains just 'us'.
    8790     * @return string
     
    8992    public function get_alpha2() {
    9093        $alpha2 = substr( $this->get_language(), 0, 2 );
    91         return( 'us' == $alpha2 ? 'en' : $alpha2 );
     94
     95        return ( 'us' == $alpha2 ? 'en' : $alpha2 );
    9296    }
    9397
    9498    /**
    9599     * Sort objects helper
     100     *
    96101     * @param string $a
    97102     * @param string $b
    98      * return int
     103     *
     104     * @return int
    99105     */
    100106    public static function _cmp( $a, $b ) {
     
    102108            return 0;
    103109        }
    104         return( $a < $b ? (-1) : 1 );
     110
     111        return ( $a < $b ? ( - 1 ) : 1 );
    105112    }
    106113
    107114    /**
    108115     * Sort objects by language
     116     *
    109117     * @param MslsBlog $a
    110118     * @param MslsBlog $b
    111      * return int
     119     *
     120     * @return int
    112121     */
    113122    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() ) );
    115124    }
    116125
    117126    /**
    118127     * Sort objects by description
     128     *
    119129     * @param MslsBlog $a
    120130     * @param MslsBlog $b
    121      * return int
     131     *
     132     * @return int
    122133     */
    123134    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() ) );
    125136    }
    126137
  • multisite-language-switcher/trunk/includes/MslsBlogCollection.php

    r1303276 r1590987  
    120120
    121121    /**
    122      * Get the list of the blogs of the reference user
     122     * Gets the list of the blogs of the reference user
    123123     * The first available user of the blog will be used if there is no
    124124     * refrence user configured
     
    148148
    149149    /**
     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    /**
    150163     * Get the id of the current blog
    151164     * @return int
     
    156169
    157170    /**
    158      * Check if current blog is in the collection
     171     * Checks if current blog is in the collection
    159172     *
    160173     * @return bool
     
    165178
    166179    /**
    167      * Get current blog as object
     180     * Gets current blog as object
    168181     * @return MslsBlog|null
    169182     */
     
    177190
    178191    /**
    179      * Get an array with all blog-objects
    180      * @return array
     192     * Gets an array with all blog-objects
     193     * @return MslsBlog[]
    181194     */
    182195    public function get_objects() {
     
    209222
    210223    /**
    211      * Get only blogs where the plugin is active
     224     * Gets only blogs where the plugin is active
    212225     * @return array
    213226     */
     
    225238
    226239    /**
    227      * Get an array of all - but not the current - blog-objects
     240     * Gets an array of all - but not the current - blog-objects
    228241     * @return array
    229242     */
     
    238251
    239252    /**
    240      * Get an array with filtered blog-objects
     253     * Gets an array with filtered blog-objects
    241254     *
    242255     * @param bool $filter
     
    253266
    254267    /**
    255      * Get the registered users of the current blog
     268     * Gets the registered users of the current blog
    256269     *
    257270     * @param string $fields
     
    272285
    273286    /**
    274      * Get or create an instance of MslsBlogCollection
     287     * Gets or creates an instance of MslsBlogCollection
    275288     * @todo Until PHP 5.2 is not longer the minimum for WordPress ...
    276289     * @return MslsBlogCollection
  • multisite-language-switcher/trunk/includes/MslsOptions.php

    r1308301 r1590987  
    276276
    277277    /**
     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    /**
    278292     * Get flag url
    279293     *
     
    360374
    361375        global $wp_rewrite;
    362         if ( is_subdomain_install() || ! $wp_rewrite->using_permalinks() ) {
     376        if ( ! is_subdomain_install() || ! $wp_rewrite->using_permalinks() ) {
    363377            return $url;
    364378        }
  • multisite-language-switcher/trunk/includes/MslsOptionsPost.php

    r1303276 r1590987  
    4444        }
    4545
     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
    4653        return apply_filters( 'check_url', get_permalink( $post ), $this );
    4754    }
  • 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  
    33"Project-Id-Version: MSLS 0.9.9\n"
    44"Report-Msgid-Bugs-To: http://wordpress.org/tag/multisite-language-switcher\n"
    5 "POT-Creation-Date: 2015-12-16 11:30+0100\n"
    6 "PO-Revision-Date: 2015-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"
    77"Last-Translator: Dennis Ploetner <dennis.ploetner@drivek.com>\n"
    88"Language-Team: Antonella Cucinelli <a.cucinelli@freely.de>\n"
     
    3333msgstr "%s e %s"
    3434
    35 #: ../MultisiteLanguageSwitcher.php:285
     35#: ../MultisiteLanguageSwitcher.php:293
    3636msgid ""
    3737"The Multisite Language Switcher needs the activation of the multisite-"
     
    7979
    8080# @ msls
    81 #: ../includes/MslsAdminIcon.php:154
     81#: ../includes/MslsAdminIcon.php:150
    8282#, php-format
    8383msgid "Create a new translation in the %s-blog"
     
    168168msgstr "Mostra solo link con traduzione"
    169169
    170 # @ msls
    171170#: ../includes/MslsAdmin.php:153
     171msgid "x-default"
     172msgstr "x-default"
     173
     174# @ msls
     175#: ../includes/MslsAdmin.php:154
    172176msgid "Description"
    173177msgstr "Descrizione"
    174178
    175179# @ msls
    176 #: ../includes/MslsAdmin.php:154
     180#: ../includes/MslsAdmin.php:155
    177181msgid "Text/HTML before the list"
    178182msgstr "Testo/HTML davanti alla lista"
    179183
    180184# @ msls
    181 #: ../includes/MslsAdmin.php:155
     185#: ../includes/MslsAdmin.php:156
    182186msgid "Text/HTML after the list"
    183187msgstr "Testo/HTML dietro alla lista"
    184188
    185189# @ msls
    186 #: ../includes/MslsAdmin.php:156
     190#: ../includes/MslsAdmin.php:157
    187191msgid "Text/HTML before each item"
    188192msgstr "Testo/HTML davanti a ogni elemento"
    189193
    190194# @ msls
    191 #: ../includes/MslsAdmin.php:157
     195#: ../includes/MslsAdmin.php:158
    192196msgid "Text/HTML after each item"
    193197msgstr "Testo/HTML dietro a ogni elemento"
    194198
    195199# @ msls
    196 #: ../includes/MslsAdmin.php:158
     200#: ../includes/MslsAdmin.php:159
    197201msgid "Add hint for available translations"
    198202msgstr "Messaggio aggiuntivo se esiste una traduzione"
    199203
    200204# @ msls
    201 #: ../includes/MslsAdmin.php:159
     205#: ../includes/MslsAdmin.php:160
    202206msgid "Hint priority"
    203207msgstr "Priorità del messaggio"
    204208
    205 #: ../includes/MslsAdmin.php:175
     209#: ../includes/MslsAdmin.php:176
    206210msgid "Activate experimental autocomplete inputs"
    207211msgstr "Rendere attivo gli autocomplete sperimentali"
    208212
    209213# @ msls
    210 #: ../includes/MslsAdmin.php:176
     214#: ../includes/MslsAdmin.php:177
    211215msgid "Custom URL for flag-images"
    212216msgstr "URL alternativo per bandiere"
    213217
    214 #: ../includes/MslsAdmin.php:177
     218#: ../includes/MslsAdmin.php:178
    215219msgid "Reference user"
    216220msgstr "Utente di referenza"
    217221
    218222# @ msls
    219 #: ../includes/MslsAdmin.php:178
     223#: ../includes/MslsAdmin.php:179
    220224msgid "Exclude this blog from output"
    221225msgstr "Escludi questo blog dall'output"
     
    240244msgstr "Descrizione e bandiera"
    241245
    242 #: ../includes/MslsOptions.php:327
     246#: ../includes/MslsOptions.php:338
    243247msgid "American English"
    244248msgstr "Inglese americano"
  • multisite-language-switcher/trunk/readme.txt

    r1480876 r1590987  
    55Tags: multilingual, multisite, language, switcher, international, localization, i18n
    66Requires at least: 3.6.1
    7 Tested up to: 4.6
    8 Stable tag: 1.0.8
     7Tested up to: 4.7
     8Stable tag: 1.1
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9191
    9292== Changelog ==
     93
     94= 1.1 =
     95* Fix and enhancements for translated slugs
    9396
    9497= 1.0.8 =
Note: See TracChangeset for help on using the changeset viewer.