Example #1
0
/**
 * Updated bulk messages
 *
 * @since	0.1
 * @param	arr		$bulk_messages	Post updated messages
 * @param	arr		$bulk_counts	Post counts
 * @return	arr		$bulk_messages	New post updated messages
 */
function kbs_bulk_updated_messages($bulk_messages, $bulk_counts)
{
    $ticket_singular = kbs_get_ticket_label_singular();
    $ticket_plural = kbs_get_ticket_label_plural();
    $article_singular = kbs_get_kb_label_singular();
    $article_plural = kbs_get_kb_label_plural();
    $bulk_messages['kbs_ticket'] = array('updated' => sprintf(_n('%1$s %2$s updated.', '%1$s %3$s updated.', $bulk_counts['updated'], 'kb-support'), $bulk_counts['updated'], $ticket_singular, $ticket_plural), 'locked' => sprintf(_n('%1$s %2$s not updated, somebody is editing it.', '%1$s %3$s not updated, somebody is editing them.', $bulk_counts['locked'], 'kb-support'), $bulk_counts['locked'], $ticket_singular, $ticket_plural), 'deleted' => sprintf(_n('%1$s %2$s permanently deleted.', '%1$s %3$s permanently deleted.', $bulk_counts['deleted'], 'kb-support'), $bulk_counts['deleted'], $ticket_singular, $ticket_plural), 'trashed' => sprintf(_n('%1$s %2$s moved to the Trash.', '%1$s %3$s moved to the Trash.', $bulk_counts['trashed'], 'kb-support'), $bulk_counts['trashed'], $ticket_singular, $ticket_plural), 'untrashed' => sprintf(_n('%1$s %2$s restored from the Trash.', '%1$s %3$s restored from the Trash.', $bulk_counts['untrashed'], 'kb-support'), $bulk_counts['untrashed'], $ticket_singular, $ticket_plural));
    $bulk_messages['kbs_kb'] = array('updated' => sprintf(_n('%1$s %2$s updated.', '%1$s %3$s updated.', $bulk_counts['updated'], 'kb-support'), $bulk_counts['updated'], $article_singular, $article_plural), 'locked' => sprintf(_n('%1$s %2$s not updated, somebody is editing it.', '%1$s %3$s not updated, somebody is editing them.', $bulk_counts['locked'], 'kb-support'), $bulk_counts['locked'], $article_singular, $article_plural), 'deleted' => sprintf(_n('%1$s %2$s permanently deleted.', '%1$s %3$s permanently deleted.', $bulk_counts['deleted'], 'kb-support'), $bulk_counts['deleted'], $article_singular, $article_plural), 'trashed' => sprintf(_n('%1$s %2$s moved to the Trash.', '%1$s %3$s moved to the Trash.', $bulk_counts['trashed'], 'kb-support'), $bulk_counts['trashed'], $article_singular, $article_plural), 'untrashed' => sprintf(_n('%1$s %2$s restored from the Trash.', '%1$s %3$s restored from the Trash.', $bulk_counts['untrashed'], 'kb-support'), $bulk_counts['untrashed'], $article_singular, $article_plural));
    return $bulk_messages;
}
/**
 * Retrieve settings tabs
 *
 * @since	1.0
 * @return	arr		$tabs
 */
function kbs_get_settings_tabs()
{
    $settings = kbs_get_registered_settings();
    $tabs = array();
    $tabs['general'] = __('General', 'kb-support');
    $tabs['tickets'] = sprintf(__('%s', 'kb-support'), kbs_get_ticket_label_plural());
    $tabs['kb_articles'] = sprintf(__('%s', 'kb-support'), kbs_get_kb_label_plural());
    $tabs['emails'] = __('Emails', 'kb-support');
    $tabs['styles'] = __('Styles', 'kb-support');
    if (!empty($settings['extensions'])) {
        $tabs['extensions'] = __('Extensions', 'kb-support');
    }
    if (!empty($settings['licenses'])) {
        $tabs['licenses'] = __('Licenses', 'kb-support');
    }
    $tabs['misc'] = __('Misc', 'kb-support');
    return apply_filters('kbs_settings_tabs', $tabs);
}
Example #3
0
/**
 * 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');
        }
    }
}