/** * Output the icons for the field settings. * * @since 1.0 * @param arr $settings The field ID. * @return str */ function kbs_display_field_setting_icons($field_id) { $settings = kbs_get_field_settings($field_id); $mappings = kbs_get_mappings(); $output = array(); if ($settings) { if (!empty($settings['hide_label'])) { $output[] = '<i title="' . __('Label Hidden', 'kb-support') . '" class="fa fa-tag" aria-hidden="true"></i>'; } else { $output[] = ' '; } if (!empty($settings['required'])) { $output[] = '<i title="' . __('Required Field', 'kb-support') . '" class="fa fa-asterisk" aria-hidden="true"></i>'; } else { $output[] = ' '; } if (!empty($settings['placeholder'])) { $output[] = '<i title="' . sprintf(__('Placeholder: %s', 'kb-support'), stripslashes($settings['placeholder'])) . '" class="fa fa-info-circle" aria-hidden="true"></i>'; } else { $output[] = ' '; } if (!empty($settings['mapping'])) { $output[] = '<i title="' . sprintf(__('Maps to %s', 'kb-support'), stripslashes($mappings[$settings['mapping']])) . '" class="fa fa-map-marker" aria-hidden="true"></i>'; } else { $output[] = ' '; } } $output = apply_filters('kbs_field_setting_icons', $output, $field_id); return implode("\t", $output); }
/** * Load Admin Scripts * * Enqueues the required admin scripts. * * @since 1.0 * @global $post * @param str $hook Page hook * @return void */ function kbs_load_admin_scripts($hook) { if (!apply_filters('kbs_load_admin_scripts', kbs_is_admin_page(), $hook)) { return; } global $wp_version, $post; $js_dir = KBS_PLUGIN_URL . 'assets/js/'; // Use minified libraries if SCRIPT_DEBUG is turned off $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : ''; //'.min'; $admin_deps = array(); if (!kbs_is_admin_page($hook, 'edit') && !kbs_is_admin_page($hook, 'new')) { $admin_deps = array('jquery', 'inline-edit-post'); } else { $admin_deps = array('jquery'); } wp_register_script('kbs-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', $admin_deps, KBS_VERSION, false); wp_enqueue_script('kbs-admin-scripts'); $editing_field_type = false; if (isset($_GET['kbs-action']) && 'edit_form_field' == $_GET['kbs-action']) { $field_settings = kbs_get_field_settings($_GET['field_id']); if ($field_settings) { $editing_field_type = $field_settings['type']; } } wp_localize_script('kbs-admin-scripts', 'kbs_vars', array('ajax_loader' => KBS_PLUGIN_URL . 'assets/images/loading.gif', 'post_id' => isset($post->ID) ? $post->ID : null, 'post_type' => isset($_GET['post']) ? get_post_type($_GET['post']) : false, 'editing_ticket' => isset($_GET['action']) && 'edit' == $_GET['action'] && 'kbs_ticket' == get_post_type($_GET['post']) ? true : false, 'admin_url' => admin_url(), 'kbs_version' => KBS_VERSION, 'add_new_ticket' => sprintf(__('Add New %s', 'kb-support'), kbs_get_ticket_label_singular()), 'new_media_ui' => apply_filters('kbs_use_35_media_ui', 1), 'no_ticket_reply_content' => __('There is no content in your reply', 'kb-support'), 'ticket_confirm_close' => __('Are you sure you wish to close this ticket? Click OK to close, or Cancel to return.', 'kb-support'), 'ticket_reply_failed' => sprintf(__('Could not add %s Reply', 'kb-support'), kbs_get_ticket_label_singular()), 'no_note_content' => __('There is no content in your note', 'kb-support'), 'note_not_added' => __('Your note could not be added', 'kb-support'), 'type_to_search' => sprintf(__('Type to search %s', 'kb-support'), kbs_get_kb_label_plural()), 'search_placeholder' => sprintf(__('Type to search all %s', 'kb-support'), kbs_get_kb_label_plural()), 'editing_field_type' => $editing_field_type, 'field_label_missing' => __('Enter a Label for your field.', 'kb-support'), 'field_type_missing' => __('Select the field Type', 'kb-support'))); if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) { // Call for new media manager wp_enqueue_media(); } wp_register_style('kbs-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), KBS_VERSION, 'all'); wp_enqueue_style('kbs-font-awesome'); wp_register_script('jquery-chosen', $js_dir . 'chosen.jquery.js', array('jquery'), KBS_VERSION); wp_enqueue_script('jquery-chosen'); wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_script('jquery-ui-dialog'); wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); if ('post.php' == $hook || 'post-new.php' == $hook) { if (isset($_GET['post']) && 'kbs_ticket' == get_post_type($_GET['post'])) { wp_enqueue_script('jquery-ui-accordion'); } } }