Exemple #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;
}
/**
 * Get the settings sections for each tab
 * Uses a static to avoid running the filters on every request to this function
 *
 * @since	1.0
 * @return	arr		Array of tabs and sections
 */
function kbs_get_registered_settings_sections()
{
    static $sections = false;
    if (false !== $sections) {
        return $sections;
    }
    $sections = array('general' => apply_filters('kbs_settings_sections_general', array('main' => __('General Settings', 'kb-support'), 'pages' => __('Pages', 'kb-support'))), 'tickets' => apply_filters('kbs_settings_sections_tickets', array('main' => sprintf(__('General %s Settings', 'kb-support'), kbs_get_ticket_label_singular()), 'submit' => __('Submission Settings', 'kb-support'), 'sla' => __('Service Levels', 'kb-support'))), 'kb_articles' => apply_filters('kbs_settings_sections_kb_articles', array('main' => sprintf(__('General %s Settings', 'kb-support'), kbs_get_kb_label_singular()))), 'emails' => apply_filters('kbs_settings_sections_emails', array('main' => __('Emails', 'kb-support'), 'ticket_received' => sprintf(__('%s Received', 'kb-support'), kbs_get_ticket_label_singular()), 'ticket_notifications' => sprintf(__('%s Notifications', 'kb-support'), kbs_get_ticket_label_singular()))), 'styles' => apply_filters('kbs_settings_sections_styles', array('main' => __('Styles', 'kb-support'))), 'extensions' => apply_filters('kbs_settings_sections_extensions', array('main' => __('Main', 'kb-support'))), 'licenses' => apply_filters('kbs_settings_sections_licenses', array()), 'misc' => apply_filters('kbs_settings_sections_misc', array('main' => __('Misc Settings', 'kb-support'), 'recaptcha' => __('Google reCaptcha', 'kb-support'), 'site_terms' => __('Terms and Conditions', 'kb-support'))));
    $sections = apply_filters('kbs_settings_sections', $sections);
    return $sections;
}
/**
 * Returns all possible form fields types.
 *
 * @since	1.0
 * @param
 * @return	arr
 */
function kbs_get_field_types()
{
    $field_types = array('checkbox' => __('Checkbox', 'kb-support'), 'checkbox_list' => __('Checkbox List', 'kb-support'), 'date_field' => __('Date Field', 'kb-support'), 'email' => __('Email Field', 'kb-support'), 'file_upload' => __('File Upload', 'kb-support'), 'hidden' => __('Hidden Field', 'kb-support'), 'kb_category_dropdown' => sprintf(__('%s Select List', 'kb-support'), kbs_get_kb_label_singular()), 'number' => __('Number Field', 'kb-support'), 'radio' => __('Radio Buttons', 'kb-support'), 'recaptcha' => __('Google reCaptcha', 'kb-support'), 'rich_editor' => __('Rich Text Editor', 'kb-support'), 'select' => __('Select List', 'kb-support'), 'terms_agree' => __('Terms Agreement', 'kb-support'), 'text' => __('Text Field', 'kb-support'), 'textarea' => __('Textarea', 'kb-support'), 'ticket_category_dropdown' => sprintf(__('%s Categories', 'kb-support'), kbs_get_ticket_label_singular()), 'url' => __('URL Field', 'kb-support'));
    if (kbs_get_option('file_uploads', 0) < 1) {
        unset($field_types['file_uploads']);
    }
    if (!kbs_get_option('recaptcha_site_key', false)) {
        unset($field_types['recaptcha']);
    }
    /**
     * Filter the field types to allow for custom fields to be added.
     *
     * @since	1.0
     * @param	$field_types
     */
    $field_types = apply_filters('kbs_field_types', $field_types);
    asort($field_types);
    return $field_types;
}