-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader.php
More file actions
executable file
·167 lines (129 loc) · 4.5 KB
/
Copy pathloader.php
File metadata and controls
executable file
·167 lines (129 loc) · 4.5 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
/*
Plugin Name: Ultimate Directory
Plugin URI: https://github.com/Themekraft/directory
Description: Ultimate Directory
Version: 0.1
Author: Sven Lehnert
Author URI: https://profiles.wordpress.org/svenl77
License: GPLv2 or later
Network: false
Text Domain: tk_ud
Domain Path: /languages
*****************************************************************************
*
* This script is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
****************************************************************************
*/
class TK_Ultimate_Directory {
public function __construct() {
// Add an init hook to allow other plugins to hook into the init
$this->init_hook();
// Some constance needed to get files and templates and make them overwrite in the theme possible. tk_ud_INSTALL_PATH and tk_ud_INCLUDES_PATH
$this->load_constants();
// Load all needed files
add_action( 'init', array( $this, 'includes' ), 1 );
// Load the plugin translation files
add_action( 'init', array( $this, 'load_plugin_textdomain' ), 10, 1 );
// Admin js
add_action( 'admin_enqueue_scripts', array( $this, 'admin_js' ), 1, 1 );
// Front css
add_action( 'wp_enqueue_scripts', array( $this, 'front_js' ), 1002, 1 );
}
/**
* Defines TK_Ultimate_Directory action
*
* @package Ultimate Directory
* @since 0.1
*/
public function init_hook() {
do_action( 'tk_ud_init' );
}
/**
* Defines constants needed throughout the plugin.
*
* @package Ultimate Directory
* @since 0.1
*/
public function load_constants() {
if ( ! defined( 'TK_UD_INSTALL_PATH' ) ) {
define( 'TK_UD_INSTALL_PATH', dirname( __FILE__ ) . '/' );
}
if ( ! defined( 'TK_UD_INCLUDES_PATH' ) ) {
define( 'TK_UD_INCLUDES_PATH', TK_UD_INSTALL_PATH . 'includes/' );
}
if ( ! defined( 'TK_UD_TEMPLATES_PATH' ) ) {
define( 'TK_UD_TEMPLATES_PATH', TK_UD_INSTALL_PATH . 'templates/' );
}
}
/**
* Includes files needed by Ultimate Directory
*
* @package Ultimate Directory
* @since 0.1
*/
public function includes() {
require_once( TK_UD_INCLUDES_PATH . '/admin/tk-ud-metabox.php' );
require_once( TK_UD_INCLUDES_PATH . '/admin/tk-ud-admin.php' );
require_once( TK_UD_INCLUDES_PATH . '/ultimate-directory.php' );
require_once( TK_UD_INCLUDES_PATH . '/shortcodes.php' );
require_once( TK_UD_INCLUDES_PATH . '/search.php' );
}
/**
* Loads the textdomain for the plugin
*
* @package Ultimate Directory
* @since 0.1
*/
public function load_plugin_textdomain() {
load_plugin_textdomain( 'tk_ud', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Enqueue the needed JS for the admin screen
*
* @package Ultimate Directory
* @since 0.1
*
* @param $hook_suffix
*/
function admin_js( $hook_suffix ) {
global $post;
// if (
// ( isset( $post ) && $post->post_type == 'buddyforms' && isset( $_GET['action'] ) && $_GET['action'] == 'edit'
// || isset( $post ) && $post->post_type == 'buddyforms' && $hook_suffix == 'post-new.php' )
// //|| isset($_GET['post_type']) && $_GET['post_type'] == 'buddyforms'
// || $hook_suffix == 'buddyforms-page-bf-add_ons'
// || $hook_suffix == 'buddyforms-page-bf-settings'
// || $hook_suffix == 'buddyforms-page-bf-submissions'
// || $hook_suffix == 'buddyforms_page_buddyforms-pricing'
// ) {
wp_enqueue_script('jquery-ui-draggable');
wp_enqueue_script( 'admin', plugins_url( 'assets/admin/admin.js', __FILE__ ), array( 'jquery' ), '4.0.3' );
// }
}
/**
* Enqueue the needed JS for the front
*
* @package Ultimate Directory
* @since 0.1
*
*/
function front_js() {
wp_enqueue_script( 'multiple-select', plugins_url( 'assets/resources/multiple-select/multiple-select.js', __FILE__ ), array( 'jquery' ), '1.2.1' );
wp_enqueue_style( 'multiple-select', plugins_url( 'assets/resources/multiple-select/multiple-select.css', __FILE__ ) );
}
}
new TK_Ultimate_Directory;