-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathplugin.php
80 lines (56 loc) · 1.47 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
*
* Plugin Name: Polylang Conditional
* Plugin URI: http://joehana.com
*
* Description: Provides a Function and a Shortcode to check against the current active language.
* Version: 0.1.0
*
* Author: Joe Hana
* Author URI: http://joehana.com
* Author Email: [email protected]
*
* Text Domain: polylang-conditional
* Domain Path: /polylang-conditional/lang
*
* Github Plugin URI: joehana/polylang-conditional
*
*/
// check if Polylang is active
if( !class_exists( 'Polylang' ) )
return;
class Polylang_Conditionals {
private static $_instance;
/**
* Instantiate Class
*/
public static function instance() {
if( !self::$_instance )
self::$_instance = new self();
return self::$_instance;
}
/**
* Initializes the plugin.
*/
private function __construct() {
// include functions
@include( plugin_dir_path( __FILE__ ) . 'includes/functions.php' );
// include shortcode
@include( plugin_dir_path( __FILE__ ) . 'includes/shortcode.php' );
// Internationalize the text strings used.
add_action( 'plugins_loaded', array( $this, 'i18n' ), 2 );
}
/**
* Load textdomain for internationalization
*/
public function i18n() {
load_plugin_textdomain( 'polylang-conditionals', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
}
}
/**
* Call class
*
* @since 1.0.0
*/
Polylang_Conditionals::instance();