These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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: 1.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 | require __DIR__. '/vendor/autoload.php'; |
||
31 | |||
32 | /** |
||
33 | * MultisiteLanguageSwitcher |
||
34 | * |
||
35 | * @author Dennis Ploetner <[email protected]> |
||
36 | */ |
||
37 | if ( ! defined( 'MSLS_PLUGIN_VERSION' ) ) { |
||
38 | define( 'MSLS_PLUGIN_VERSION', '1.2' ); |
||
39 | |||
40 | if ( ! defined( 'MSLS_PLUGIN_PATH' ) ) { |
||
41 | define( 'MSLS_PLUGIN_PATH', plugin_basename( __FILE__ ) ); |
||
42 | } |
||
43 | if ( ! defined( 'MSLS_PLUGIN__FILE__' ) ) { |
||
44 | define( 'MSLS_PLUGIN__FILE__', __FILE__ ); |
||
45 | } |
||
46 | |||
47 | lloc\Msls\MslsPlugin::init(); |
||
48 | |||
49 | /** |
||
50 | * Get the output for using the links to the translations in your code |
||
51 | * |
||
52 | * @package Msls |
||
53 | * |
||
54 | * @param array $arr |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | function get_the_msls( array $arr = [] ) { |
||
59 | $obj = apply_filters( 'msls_get_output', null ); |
||
60 | |||
61 | return ! is_null( $obj ) ? strval( $obj->set_tags( $arr ) ) : ''; |
||
62 | } |
||
63 | |||
64 | add_shortcode( 'sc_msls', 'get_the_msls' ); |
||
65 | |||
66 | /** |
||
67 | * Output the links to the translations in your template |
||
68 | * |
||
69 | * You can call this function directly like that |
||
70 | * |
||
71 | * if ( function_exists ( 'the_msls' ) ) |
||
72 | * the_msls(); |
||
73 | * |
||
74 | * or just use it as shortcode [sc_msls] |
||
75 | * |
||
76 | * @package Msls |
||
77 | * @uses get_the_msls |
||
78 | * |
||
79 | * @param array $arr |
||
80 | */ |
||
81 | function the_msls( array $arr = [] ) { |
||
82 | echo get_the_msls( $arr ); |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
83 | } |
||
84 | |||
85 | } |
||
86 |