PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / 2.13
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets v2.13
3.9.5 3.9.6 4.0.0 4.0.1 4.1.0 trunk 2.12 2.13 2.14 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.3-beta-1.0 3.7.4 3.7.4-beta-1.0 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4
wp-all-import / controllers / controller / admin.php
wp-all-import / controllers / controller Last commit date
admin.php 13 years ago
admin.php
91 lines
1 <?php
2 /**
3 * Introduce special type for controllers which render pages inside admin area
4 *
5 * @author Pavel Kulbakin <p.kulbakin@gmail.com>
6 */
7 abstract class PMXI_Controller_Admin extends PMXI_Controller {
8 /**
9 * Admin page base url (request url without all get parameters but `page`)
10 * @var string
11 */
12 public $baseUrl;
13 /**
14 * Parameters which is left when baseUrl is detected
15 * @var array
16 */
17 public $baseUrlParamNames = array('page', 'pagenum', 'order', 'order_by', 'type', 's', 'f');
18 /**
19 * Whether controller is rendered inside wordpress page
20 * @var bool
21 */
22 public $isInline = false;
23 /**
24 * Constructor
25 */
26 public function __construct() {
27 $remove = array_diff(array_keys($_GET), $this->baseUrlParamNames);
28 if ($remove) {
29 $this->baseUrl = remove_query_arg($remove);
30 } else {
31 $this->baseUrl = $_SERVER['REQUEST_URI'];
32 }
33 parent::__construct();
34
35 // add special filter for url fields
36 $this->input->addFilter(create_function('$str', 'return "http://" == $str || "ftp://" == $str ? "" : $str;'));
37
38 // enqueue required sripts and styles
39 global $wp_styles;
40 if ( ! is_a($wp_styles, 'WP_Styles'))
41 $wp_styles = new WP_Styles();
42
43 wp_enqueue_style('jquery-ui', PMXI_Plugin::getInstance()->getRelativePath() . '/static/js/jquery/css/smoothness/jquery-ui.css');
44 wp_enqueue_style('jquery-tipsy', PMXI_Plugin::getInstance()->getRelativePath() . '/static/js/jquery/css/smoothness/jquery.tipsy.css');
45 wp_enqueue_style('pmxi-admin-style', PMXI_Plugin::getInstance()->getRelativePath() . '/static/css/admin.css');
46 wp_enqueue_style('pmxi-admin-style-ie', PMXI_Plugin::getInstance()->getRelativePath() . '/static/css/admin-ie.css');
47 $wp_styles->add_data('pmxi-admin-style-ie', 'conditional', 'lte IE 7');
48
49 $scheme_color = get_user_option('admin_color') and is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css') or $scheme_color = 'fresh';
50 if (is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css')) {
51 wp_enqueue_style('pmxi-admin-style-color', PMXI_Plugin::getInstance()->getRelativePath() . '/static/css/admin-colors-' . $scheme_color . '.css');
52 }
53
54 wp_enqueue_script('jquery-ui-datepicker', PMXI_Plugin::getInstance()->getRelativePath() . '/static/js/jquery/ui.datepicker.js', 'jquery-ui-core');
55 wp_enqueue_script('jquery-ui-autocomplete', PMXI_Plugin::getInstance()->getRelativePath() . '/static/js/jquery/ui.autocomplete.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'));
56 wp_enqueue_script('jquery-tipsy', PMXI_Plugin::getInstance()->getRelativePath() . '/static/js/jquery/jquery.tipsy.js', 'jquery');
57
58 wp_enqueue_script('pmxi-admin-script', PMXI_Plugin::getInstance()->getRelativePath() . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
59
60 }
61
62 /**
63 * @see Controller::render()
64 */
65 protected function render($viewPath = NULL)
66 {
67 // assume template file name depending on calling function
68 if (is_null($viewPath)) {
69 $trace = debug_backtrace();
70 $viewPath = str_replace('_', '/', preg_replace('%^' . preg_quote(PMXI_Plugin::PREFIX, '%') . '%', '', strtolower($trace[1]['class']))) . '/' . $trace[1]['function'];
71 }
72
73 // render contextual help automatically
74 $viewHelpPath = $viewPath;
75 // append file extension if not specified
76 if ( ! preg_match('%\.php$%', $viewHelpPath)) {
77 $viewHelpPath .= '.php';
78 }
79 $viewHelpPath = preg_replace('%\.php$%', '-help.php', $viewHelpPath);
80 $fileHelpPath = PMXI_Plugin::ROOT_DIR . '/views/' . $viewHelpPath;
81
82 if (is_file($fileHelpPath)) { // there is help file defined
83 ob_start();
84 include $fileHelpPath;
85 add_contextual_help(PMXI_Plugin::getInstance()->getAdminCurrentScreen()->id, ob_get_clean());
86 }
87
88 parent::render($viewPath);
89 }
90
91 }