1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
Plugin Name: Multisite Language Switcher |
5
|
|
|
Plugin URI: http://msls.co/ |
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: 2.0.2 |
8
|
|
|
Author: Dennis Ploetner |
9
|
|
|
Author URI: http://lloc.de/ |
10
|
|
|
Text Domain: multisite-language-switcher |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
/* |
14
|
|
|
Copyright 2013 Dennis Ploetner (email : [email protected]) |
15
|
|
|
|
16
|
|
|
This program is free software; you can redistribute it and/or modify |
17
|
|
|
it under the terms of the GNU General Public License, version 2, as |
18
|
|
|
published by the Free Software Foundation. |
19
|
|
|
|
20
|
|
|
This program is distributed in the hope that it will be useful, |
21
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
22
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23
|
|
|
GNU General Public License for more details. |
24
|
|
|
|
25
|
|
|
You should have received a copy of the GNU General Public License |
26
|
|
|
along with this program; if not, write to the Free Software |
27
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
31
|
|
|
require __DIR__ . '/vendor/autoload.php'; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* MultisiteLanguageSwitcher |
36
|
|
|
* |
37
|
|
|
* @author Dennis Ploetner <[email protected]> |
38
|
|
|
*/ |
39
|
|
|
if ( ! defined( 'MSLS_PLUGIN_VERSION' ) ) { |
40
|
|
|
define( 'MSLS_PLUGIN_VERSION', '2.0.2' ); |
41
|
|
|
|
42
|
|
|
if ( ! defined( 'MSLS_PLUGIN_PATH' ) ) { |
43
|
|
|
define( 'MSLS_PLUGIN_PATH', plugin_basename( __FILE__ ) ); |
44
|
|
|
} |
45
|
|
|
if ( ! defined( 'MSLS_PLUGIN__FILE__' ) ) { |
46
|
|
|
define( 'MSLS_PLUGIN__FILE__', __FILE__ ); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
lloc\Msls\MslsPlugin::init(); |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get the output for using the links to the translations in your code |
53
|
|
|
* |
54
|
|
|
* @package Msls |
55
|
|
|
* |
56
|
|
|
* @param array $arr |
|
|
|
|
57
|
|
|
* |
58
|
|
|
* @return string |
59
|
|
|
*/ |
60
|
|
|
function get_the_msls( $attr ) { |
61
|
|
|
$arr = is_array( $attr ) ? $attr : []; |
62
|
|
|
$obj = apply_filters( 'msls_get_output', null ); |
63
|
|
|
|
64
|
|
|
return ! is_null( $obj ) ? strval( $obj->set_tags( $arr ) ) : ''; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
add_shortcode( 'sc_msls', 'get_the_msls' ); |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Output the links to the translations in your template |
71
|
|
|
* |
72
|
|
|
* You can call this function directly like that |
73
|
|
|
* |
74
|
|
|
* if ( function_exists ( 'the_msls' ) ) |
75
|
|
|
* the_msls(); |
76
|
|
|
* |
77
|
|
|
* or just use it as shortcode [sc_msls] |
78
|
|
|
* |
79
|
|
|
* @package Msls |
80
|
|
|
* @uses get_the_msls |
81
|
|
|
* |
82
|
|
|
* @param array $arr |
83
|
|
|
*/ |
84
|
|
|
function the_msls( array $arr = [] ) { |
85
|
|
|
echo get_the_msls( $arr ); |
|
|
|
|
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
} |
89
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.