|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* The file that defines the core plugin class |
|
5
|
|
|
* |
|
6
|
|
|
* A class definition that includes attributes and functions used across both the |
|
7
|
|
|
* public-facing side of the site and the dashboard. |
|
8
|
|
|
* |
|
9
|
|
|
* @since 1.0.0 |
|
10
|
|
|
* |
|
11
|
|
|
* @package Black_Studio_Touch_Dropdown_Menu |
|
12
|
|
|
* @subpackage Black_Studio_Touch_Dropdown_Menu/includes |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* The core plugin class. |
|
17
|
|
|
* |
|
18
|
|
|
* This is used to define internationalization, dashboard-specific hooks, and |
|
19
|
|
|
* public-facing site hooks. |
|
20
|
|
|
* |
|
21
|
|
|
* Also maintains the unique identifier of this plugin as well as the current |
|
22
|
|
|
* version of the plugin. |
|
23
|
|
|
* |
|
24
|
|
|
* @since 1.0.0 |
|
25
|
|
|
* @package Black_Studio_Touch_Dropdown_Menu |
|
26
|
|
|
* @subpackage Black_Studio_Touch_Dropdown_Menu/includes |
|
27
|
|
|
*/ |
|
28
|
|
|
|
|
29
|
|
|
class Black_Studio_Touch_Dropdown_Menu { |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* The unique identifier of this plugin. |
|
33
|
|
|
* |
|
34
|
|
|
* @since 1.0.0 |
|
35
|
|
|
* @access protected |
|
36
|
|
|
* @var string $plugin_name The string used to uniquely identify this plugin. |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $plugin_name; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* The current version of the plugin. |
|
42
|
|
|
* |
|
43
|
|
|
* @since 1.0.0 |
|
44
|
|
|
* @access protected |
|
45
|
|
|
* @var string $version The current version of the plugin. |
|
46
|
|
|
*/ |
|
47
|
|
|
protected $version; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Define the core functionality of the plugin. |
|
51
|
|
|
* |
|
52
|
|
|
* Set the plugin name and the plugin version that can be used throughout the plugin. |
|
53
|
|
|
* Load the dependencies, define the locale, and set the hooks for the Dashboard and |
|
54
|
|
|
* the public-facing side of the site. |
|
55
|
|
|
* |
|
56
|
|
|
* @since 1.0.0 |
|
57
|
|
|
*/ |
|
58
|
|
|
public function __construct() { |
|
59
|
|
|
|
|
60
|
|
|
$this->plugin_name = 'black-studio-touch-dropdown-menu'; |
|
61
|
|
|
$this->version = '1.0.1'; |
|
62
|
|
|
|
|
63
|
|
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
64
|
|
|
|
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* The name of the plugin used to uniquely identify it within the context of |
|
69
|
|
|
* WordPress and to define internationalization functionality. |
|
70
|
|
|
* |
|
71
|
|
|
* @since 1.0.0 |
|
72
|
|
|
* @return string The name of the plugin. |
|
73
|
|
|
*/ |
|
74
|
|
|
public function get_plugin_name() { |
|
75
|
|
|
return $this->plugin_name; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Retrieve the version number of the plugin. |
|
80
|
|
|
* |
|
81
|
|
|
* @since 1.0.0 |
|
82
|
|
|
* @return string The version number of the plugin. |
|
83
|
|
|
*/ |
|
84
|
|
|
public function get_version() { |
|
85
|
|
|
return $this->version; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Register the script for the public-facing side of the site. |
|
90
|
|
|
* |
|
91
|
|
|
* @since 1.0.0 |
|
92
|
|
|
*/ |
|
93
|
|
|
public function enqueue_scripts() { |
|
94
|
|
|
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
95
|
|
|
$default_selector = 'li:has(ul) > a'; |
|
96
|
|
|
$default_selector_leaf = 'li li li:not(:has(ul)) > a'; |
|
97
|
|
|
$default_force_ios5 = false; |
|
98
|
|
|
wp_enqueue_script( |
|
99
|
|
|
'black-studio-touch-dropdown-menu', |
|
100
|
|
|
plugins_url( 'js/black-studio-touch-dropdown-menu' . $suffix . '.js', dirname( __FILE__ ) ), |
|
101
|
|
|
array( 'jquery' ), |
|
102
|
|
|
$this->version |
|
103
|
|
|
); |
|
104
|
|
|
$params = array( |
|
105
|
|
|
'selector' => apply_filters( 'black_studio_touch_dropdown_menu_selector', $default_selector ), |
|
106
|
|
|
'selector_leaf' => apply_filters( 'black_studio_touch_dropdown_menu_selector_leaf', $default_selector_leaf ), |
|
107
|
|
|
'force_ios5' => apply_filters( 'black_studio_touch_dropdown_menu_force_ios5', $default_force_ios5 ) |
|
108
|
|
|
); |
|
109
|
|
|
wp_localize_script( 'black-studio-touch-dropdown-menu', 'black_studio_touch_dropdown_menu_params', $params ); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
} |