/** * 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); }
/** * Define the columns that should be displayed for the KBS Article post lists screen * * @since 0.1 * @param arr $columns An array of column name ⇒ label. The label is shown as the column header. * @return arr $columns Filtered array of column name => label to be shown as the column header. */ function kbs_set_kbs_kb_post_columns($columns) { $columns = array('cb' => '<input type="checkbox" />', 'title' => __('Title', 'kb-support'), 'date' => __('Date', 'kb-support'), 'categories' => __('Categories', 'kb-support'), 'tags' => __('Tags', 'kb-support'), 'author' => __('Author', 'kb-support'), 'views' => __('Views', 'kb-support'), 'linked' => sprintf(__('Linked %s', 'kb-support'), kbs_get_ticket_label_plural())); return apply_filters('kbs_kb_post_columns', $columns); }
/** * Ticket Notification Template Body * * @since 0.1 * @param int $ticket_id Ticket ID * @param arr $ticket_data Ticket Data * @return str $email_body Body of the email */ function kbs_get_ticket_notification_body_content($ticket_id = 0, $ticket_data = array()) { $user_info = maybe_unserialize($ticket_data['user_info']); if (isset($user_info['id']) && $user_info['id'] > 0) { $user_data = get_userdata($user_info['id']); $name = $user_data->display_name; } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { $name = $user_info['first_name'] . ' ' . $user_info['last_name']; } else { $name = $email; } $default_email_body = __('Hello', 'kb-support') . "\n\n" . sprintf(__('A Support %s has been received', 'kb-support'), kbs_get_ticket_label_plural()) . ".\n\n"; $default_email_body .= sprintf(__('%s sold:', 'kb-support'), kbs_get_ticket_label_plural()) . "\n\n"; $default_email_body .= $download_list . "\n\n"; $default_email_body .= __('Submitted by: ', 'kb-support') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n"; $default_email_body .= __('Thank you', 'kb-support'); $email = kbs_get_option('ticket_notification', false); $email = $email ? stripslashes($email) : $default_email_body; $email_body = kbs_email_template_tags($email, $ticket_data, $ticket_id, true); $email_body = kbs_do_email_tags($email, $ticket_id); $email_body = apply_filters('kbs_email_template_wpautop', true) ? wpautop($email_body) : $email_body; return apply_filters('kbs_ticket_notification', $email_body, $ticket_id, $ticket_data); }
/** * 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; }
/** * Render the agree to terms checkbox. * * @since 1.0 * @return str */ function kbs_render_agree_to_terms_field() { $agree_to_terms = kbs_get_option('show_agree_to_terms', false); $agree_text = kbs_get_option('agree_text', false); $label = kbs_get_option('agree_label', false); $terms_heading = kbs_get_option('agree_heading', sprintf(__('Terms and Conditions for Support %s', 'kb-support'), kbs_get_ticket_label_plural())); if (!$agree_to_terms || !$agree_text || !$label) { return; } $label_class = ''; $input_class = ''; $args = apply_filters('kbs_agree_to_terms_args', array('label_class' => '', 'input_class' => '')); if (!empty($args['label_class'])) { $label_class = ' ' . sanitize_html_class($args['label_class']); } if (!empty($args['input_class'])) { $input_class = ' class="' . sanitize_html_class($args['input_class']) . '"'; } ob_start(); ?> <p><input type="checkbox" name="kbs_agree_terms" id="kbs-agree-terms"<?php echo $input_class; ?> value="1" /> <a href="#TB_inline?width=600&height=550&inlineId=kbs-ticket-terms-conditions" title="<?php esc_attr_e($terms_heading, 'kb-support'); ?> " class="thickbox"<?php echo $label_class; ?> ><?php esc_attr_e($label, 'kb-support'); ?> </a></p> <div id="kbs-ticket-terms-conditions" class="kbs_hidden"> <?php do_action('kbs_before_terms'); ?> <?php echo wpautop(stripslashes($agree_text)); ?> <?php do_action('kbs_after_terms'); ?> </div> <?php echo ob_get_clean(); }