/** * Enqueue scripts and styles * * @return void */ public static function admin_enqueue_scripts() { //wp_enqueue_style('select2', Utility::path( 'static/styles/fields/select2/select2.css', 'url' ), array(), '3.2'); wp_enqueue_style('select2', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css', array(), false); wp_enqueue_style('uisf-select-advanced', Utility::path('static/styles/fields/select-advanced.css', 'url'), array(), false); wp_register_script('select2', Utility::path('static/scripts/fields/select2/select2.js', 'url'), array(), false, true); //wp_register_script('select2', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/js/select2.js', array('jquery'), false, true); wp_enqueue_script('uisf-select-advanced', Utility::path('static/scripts/fields/select-advanced.js', 'url'), array('select2'), false, true); }
/** * */ public function display() { if (empty($this->fields)) { return; } $path = apply_filters('wplt:filter:template', Utility::path('static/views/filter.php', 'dir'), array($this->name, $this->map, $this->fields)); if (file_exists($path)) { echo "<div class=\"wplt-filter\" data-for=\"{$this->name}\">"; include $path; echo "</div>"; } }
/** * Enqueue scripts and styles * * @return void */ public static function admin_enqueue_scripts() { wp_register_style('jquery-ui-core', Utility::path("static/styles/fields/jqueryui/jquery.ui.core.css", 'url'), array(), '1.8.17'); wp_register_style('jquery-ui-theme', Utility::path("static/styles/fields/jqueryui/jquery.ui.theme.css", 'url'), array(), '1.8.17'); wp_register_style('jquery-ui-datepicker', Utility::path("static/styles/fields/jqueryui/jquery.ui.datepicker.css", 'url'), array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17'); wp_register_style('jquery-ui-slider', Utility::path("static/styles/fields/jqueryui/jquery.ui.slider.css", 'url'), array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17'); wp_enqueue_style('jquery-ui-timepicker', Utility::path("static/styles/fields/jqueryui/jquery-ui-timepicker-addon.min.css", 'url'), array('jquery-ui-datepicker', 'jquery-ui-slider'), '1.5.0'); wp_register_script('jquery-ui-timepicker', Utility::path("static/scripts/fields/jqueryui/jquery-ui-timepicker-addon.min.js", 'url'), array('jquery-ui-datepicker', 'jquery-ui-slider'), '1.5.0', true); /** * Localization * Use 1 minified JS file which contains all languages for simpilicity (in version < 4.4.2 we use separated JS files). * The language is set in Javascript * * Note: we use full locale (de-DE) and fallback to short locale (de) */ $locale = str_replace('_', '-', get_locale()); $locale_short = substr($locale, 0, 2); wp_register_script('jquery-ui-timepicker-i18n', Utility::path("static/scripts/fields/jqueryui/jquery-ui-timepicker-addon-i18n.min.js", 'url'), array('jquery-ui-timepicker'), '1.5.0', true); wp_enqueue_script('uisf-time', Utility::path('static/scripts/fields/time.js', 'url'), array('jquery-ui-timepicker-i18n'), false, true); wp_localize_script('uisf-time', 'uisf_timepicker', array('locale' => $locale, 'localeShort' => $locale_short)); }
/** * Enqueue scripts and styles * * @return void */ public static function admin_enqueue_scripts() { wp_register_style('jquery-ui-core', Utility::path("static/styles/fields/jqueryui/jquery.ui.core.css", 'url'), array(), '1.8.17'); wp_register_style('jquery-ui-theme', Utility::path("static/styles/fields/jqueryui/jquery.ui.theme.css", 'url'), array(), '1.8.17'); wp_register_style('jquery-ui-datepicker', Utility::path("static/styles/fields/jqueryui/jquery.ui.datepicker.css", 'url'), array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17'); wp_register_style('jquery-ui-slider', Utility::path("static/styles/fields/jqueryui/jquery.ui.slider.css", 'url'), array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17'); wp_enqueue_style('jquery-ui-timepicker', Utility::path("static/styles/fields/jqueryui/jquery-ui-timepicker-addon.min.css", 'url'), array('jquery-ui-datepicker', 'jquery-ui-slider'), '1.5.0'); wp_register_script('jquery-ui-timepicker', Utility::path("static/scripts/fields/jqueryui/jquery-ui-timepicker-addon.min.js", 'url'), array('jquery-ui-datepicker', 'jquery-ui-slider'), '1.5.0', true); /** * Localization * Use 1 minified JS file for timepicker which contains all languages for simpilicity (in version < 4.4.2 we use separated JS files). * The language is set in Javascript * * Note: we use full locale (de-DE) and fallback to short locale (de) */ $locale = str_replace('_', '-', get_locale()); $locale_short = substr($locale, 0, 2); wp_register_script('jquery-ui-timepicker-i18n', Utility::path("static/scripts/fields/jqueryui/jquery-ui-timepicker-addon-i18n.min.js", 'url'), array('jquery-ui-timepicker'), '1.5.0', true); $date_paths = array('jqueryui/datepicker-i18n/jquery.ui.datepicker-' . $locale . '.js'); if (strlen($locale) > 2) { // Also check alternate i18n filenames // (e.g. jquery.ui.datepicker-de.js instead of jquery.ui.datepicker-de-DE.js) $date_paths[] = 'jqueryui/datepicker-i18n/jquery.ui.datepicker-' . substr($locale, 0, 2) . '.js'; } $deps = array('jquery-ui-timepicker-i18n'); foreach ($date_paths as $date_path) { $path = Utility::path('static/scripts/fields/' . $date_path, 'dir'); if (file_exists($path)) { wp_register_script('jquery-ui-datepicker-i18n', Utility::path('static/scripts/fields/' . $date_path, 'url'), array('jquery-ui-datepicker'), '1.8.17', true); $deps[] = 'jquery-ui-datepicker-i18n'; break; } } wp_enqueue_script('rwmb-datetime', Utility::path('static/scripts/fields/datetime.js', 'url'), $deps, false, true); wp_localize_script('rwmb-datetime', 'uisf_datetimepicker', array('locale' => $locale, 'localeShort' => $locale_short)); }
/** * Enqueue scripts and styles * * @return void */ public static function admin_enqueue_scripts() { wp_register_style('jquery-ui-core', Utility::path("static/styles/fields/jqueryui/jquery.ui.core.css", 'url'), array(), '1.8.17'); wp_register_style('jquery-ui-theme', Utility::path("static/styles/fields/jqueryui/jquery.ui.theme.css", 'url'), array(), '1.8.17'); wp_enqueue_style('jquery-ui-datepicker', Utility::path("static/styles/fields/jqueryui/jquery.ui.datepicker.css", 'url'), array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17'); // Load localized scripts $locale = str_replace('_', '-', get_locale()); $file_paths = array('jqueryui/datepicker-i18n/jquery.ui.datepicker-' . $locale . '.js'); // Also check alternate i18n filename (e.g. jquery.ui.datepicker-de.js instead of jquery.ui.datepicker-de-DE.js) if (strlen($locale) > 2) { $file_paths[] = 'jqueryui/datepicker-i18n/jquery.ui.datepicker-' . substr($locale, 0, 2) . '.js'; } $deps = array('jquery-ui-datepicker'); foreach ($file_paths as $file_path) { $path = Utility::path('static/scripts/fields/' . $file_path, 'dir'); if (file_exists($path)) { $path = Utility::path('static/scripts/fields/' . $file_path, 'dir'); wp_register_script('jquery-ui-datepicker-i18n', Utility::path('static/scripts/fields/' . $file_path, 'url'), $deps, '1.8.17', true); $deps[] = 'jquery-ui-datepicker-i18n'; break; } } wp_enqueue_script('uisf-date', Utility::path('static/scripts/fields/date.js', 'url'), $deps, false, true); }
/** * REQUIRED. Set up a constructor that references the parent constructor. We * use the parent reference to set some default configs. * @param array $args */ public function __construct($args = array()) { if (function_exists('get_current_screen')) { $screen = get_current_screen(); } //Set parent defaults parent::__construct($args = wp_parse_args($args, array('singular' => '', 'plural' => '', 'ajax' => true, 'per_page' => 20, 'post_type' => isset($screen) && is_object($screen) ? $screen->id : false, 'screen' => isset($screen) && is_object($screen) ? $screen->id : false, 'post_status' => 'any', 'paged' => 1, 'orderby' => 'menu_order title', 'order' => 'asc', 'options' => array(), 'name' => false, 'extra' => array(), 'query' => array(), 'query2' => array()))); foreach ($args as $k => $v) { // May be setup value from Request if (isset($_REQUEST[$k])) { $args[$k] = $_REQUEST[$k]; } switch ($k) { case 'screen': // Do Nothing! break; case 'options': $this->options = wp_parse_args($args['options'], array('show_filter' => false, 'show_bulk_actions' => true, 'show_pagination' => true)); break; /* Filter Query ( Used by ajax requests ) */ /* Filter Query ( Used by ajax requests ) */ case 'query2': $this->query2 = $this->parse_query($v); break; /* Per Page */ /* Per Page */ case 'per_page': /** This filter is documented in wp-admin/includes/post.php */ $this->per_page = apply_filters('edit_posts_per_page', $v, isset($args['post_type']) ? $args['post_type'] : false); break; /* Set order params in $_GET (required to have working ordering) */ /* Set order params in $_GET (required to have working ordering) */ case 'order': case 'orderby': $_GET[$k] = $v; default: $this->{$k} = $v; break; } } if (!$this->name) { $this->name = $this->post_type . '_' . rand(1001, 9999); } wp_enqueue_style('list-table-ajax', Utility::path('static/styles/wp-list-table.css', 'url')); wp_enqueue_script('list-table-ajax', Utility::path('static/scripts/wp-list-table.js', 'url'), array('jquery')); wp_localize_script('list-table-ajax', '__wplt', array('spinner_url' => Utility::path('static/images/ajax-loader.gif', 'url'))); }
/** * Enqueue scripts and styles * * @return void */ public static function admin_enqueue_scripts() { wp_enqueue_style('uisf-select', Utility::path('static/styles/fields/select.css', 'url'), array(), false); }
/** * Enqueue scripts and styles * * @return void */ public static function admin_enqueue_scripts() { wp_enqueue_style('rwmb-checkbox', Utility::path('static/styles/fields/checkbox.css', 'url'), array(), false); }