public function filter_manage_feedback_posts_columns($columns) { if (!un_get_option(UN_FEEDBACK_FORM_SHOW_TYPE)) { return $columns; } return array_merge(array_merge(array('cb' => $columns['cb']), apply_filters('un_feedback_columns', array('un-type' => __('Type', 'usernoise')))), array_slice($columns, 1)); }
public function send_admin_message($id, $params) { if (!un_get_option(UN_ADMIN_NOTIFY_ON_FEEDBACK)) { return; } $type = $params['type'] ? $params['type'] : __('feedback'); $message = sprintf(__('A new %s has been submitted. View it: <a href="%s">%s</a>.', 'usernoise'), $type, admin_url('post.php?action=edit&post=' . $id), admin_url('post.php?action=edit&post=' . $id)); $message = apply_filters('un_feedback_received_message', $message, $id, $params); $message = apply_filters('un_admin_notification_message', $message, $id, $params); $subject = apply_filters('un_admin_notification_subject', sprintf(__('New %s submitted at %s'), __($type, 'usernoise'), get_bloginfo('name'))); $to = apply_filters('un_admin_notification_email', get_option('admin_email')); $headers = apply_filters('un_admin_notification_headers', array('Content-type: text/html'), $id); wp_mail($to, $subject, $message, $headers); do_action('un_admin_notification_sent', $id, $params, $message); }
public function _init() { if (is_user_logged_in()) { wp_enqueue_style('usernoise-adminbar', usernoise_url('/css/admin-bar.css'), null, UN_VERSION); } if (!un_get_option(UN_ENABLED)) { return; } wp_enqueue_script('usernoise', usernoise_url('/js/usernoise.js'), array('jquery'), UN_VERSION); wp_enqueue_script('usernoise-button', usernoise_url('/js/button.js'), array('jquery', 'usernoise'), UN_VERSION); wp_enqueue_style('usernoise-button', usernoise_url('/css/button.css'), null, UN_VERSION); wp_enqueue_style('usernoise-form', usernoise_url('/css/form.css'), null, UN_VERSION); if (!un_get_option(UN_DISABLE_ICONS)) { wp_enqueue_style('font-awesome', usernoise_url('/vendor/font-awesome/css/font-awesome.css'), null, UN_VERSION); } wp_localize_script('usernoise', 'usernoiseButton', un_get_localization_array()); add_action('wp_footer', array($this, '_wp_footer')); }
public function form_submit() { global $un_model; if (isset($_REQUEST['title']) && $_REQUEST['title'] == un_get_option(UN_FEEDBACK_SUMMARY_PLACEHOLDER)) { $_REQUEST['title'] = ''; } if (isset($_REQUEST['description']) && $_REQUEST['description'] == un_get_option(UN_FEEDBACK_TEXTAREA_PLACEHOLDER)) { $_REQUEST['description'] = ''; } if (isset($_REQUEST['email']) && $_REQUEST['email'] == un_get_option(UN_FEEDBACK_EMAIL_PLACEHOLDER)) { $_REQUEST['email'] = ''; } if (isset($_REQUEST['name']) && $_REQUEST['name'] == un_get_option(UN_FEEDBACK_NAME_PLACEHOLDER)) { $_REQUEST['name'] = ''; } $errors = $un_model->validate_feedback_form(stripslashes_deep($_REQUEST)); if (empty($errors)) { $un_model->create_feedback(stripslashes_deep($_REQUEST)); echo json_encode(array('success' => true)); } else { echo json_encode(array('errors' => $errors)); } exit; }
function un_get_localization_array() { global $un_settings; return apply_filters('un_localization_array', array('text' => (un_get_option(UN_FEEDBACK_BUTTON_ICON) && !un_get_option(UN_DISABLE_ICONS) ? "<i class='" . un_get_option(UN_FEEDBACK_BUTTON_ICON) . "'></i>" : '') . un_get_option(UN_FEEDBACK_BUTTON_TEXT, __('Feedback', 'usernoise')), 'style' => sprintf("background-color: %s; color: %s", un_get_option(UN_FEEDBACK_BUTTON_COLOR), un_get_option(UN_FEEDBACK_BUTTON_TEXT_COLOR)), 'class' => implode(' ', un_button_class()), 'windowUrl' => un_ajax_url('load_window'), 'showButton' => apply_filters('un_show_button', un_get_option(UN_DISABLE_ON_MOBILES) ? !$un_settings->is_mobile() : true))); }
require usernoise_path('/inc/db-upgrade.php'); require usernoise_path('/inc/migrations.php'); require usernoise_path('/admin/notifications.php'); require usernoise_path('/inc/form.php'); require usernoise_path('/inc/shortcodes.php'); if (is_admin()) { require usernoise_path('/admin/admin-base.php'); require usernoise_path('/admin/editor-page.php'); require usernoise_path('/admin/menu.php'); require usernoise_path('/admin/feedback-list.php'); require usernoise_path('/admin/dashboard.php'); if (defined('DOING_AJAX') && un_get_option(UN_ENABLED, true)) { require usernoise_path('/inc/controller.php'); } } else { if (un_get_option(UN_ENABLED, true)) { require usernoise_path('/admin/admin-bar.php'); require usernoise_path('/inc/integration.php'); require usernoise_path('/inc/controller.php'); } } function un_get_feedback_capabilities() { return array('edit_un_feedback_items', 'edit_un_feedback', 'delete_un_feedback', 'publish_un_feedback', 'publish_un_feedback_items', 'edit_others_un_feedback_items', 'edit_published_un_feedback'); } function un_get_capable_roles() { return array('administrator', 'editor'); } function un_activation_hook() {
<a id="un-button" href="#" style="background-color: <?php echo un_get_option(UN_FEEDBACK_BUTTON_COLOR); ?> ; color: <?php echo un_get_option(UN_FEEDBACK_BUTTON_TEXT_COLOR); ?> " <?php un_button_class(); ?> > <?php un_feedback_button_text(); ?> </a>
<div id="un-thankyou" style="display: none;"> <h2><?php echo un_get_option(UN_THANKYOU_TITLE, __('Thank you', 'usernoise')); ?> </h2> <p> <?php echo un_get_option(UN_THANKYOU_TEXT, __('Your feedback has been received.', 'usernoise')); ?> </p> <a href="#" id="un-feedback-close"><img src="<?php echo usernoise_url('/images/ok.png'); ?> " id="thankyou-image" alt="Close"></a> </div>
public function _init() { if (current_user_can('manage_options') && !un_get_option(UN_ENABLED)) { add_action('admin_notices', array($this, '_notice_usernoise_disabled')); } }
<a id="window-close" href="#" title="<?php _e('Close', 'usernoise'); ?> "><?php _e('Close', 'usernoise'); ?> </a> <div id="viewport" class="clearfix"> <?php do_action('before_feedback_wrapper'); ?> <div id="un-feedback-wrapper"> <div id="un-feedback-form-wrapper"> <h2> <?php echo un_get_option(UN_FEEDBACK_FORM_TITLE, __('Feedback', 'usernoise')); ?> <?php if (current_user_can('edit_others_posts')) { ?> <a class="un-button-settings" id="un-button-settings" href="<?php echo admin_url('options-general.php?page=usernoise'); ?> "> <?php echo strtolower(__('Settings', 'usernoise')); ?> </a> <?php } ?>
function un_button_class() { if ($option = un_get_option(UN_FEEDBACK_BUTTON_POSITION)) { $classes[] = "un-" . $option; } if (empty($classes)) { $classes[] = 'un-left'; } if (un_get_option(UN_FEEDBACK_BUTTON_SHOW_BORDER)) { $classes[] = 'un-has-border'; } return apply_filters('un_button_class', $classes); }
function feedback_form($action) { global $un_h; ?> <form action="<?php echo esc_attr(un_ajax_url('feedback_form_submit')); ?> " method="post" class="un-feedback-form"> <?php if (un_get_option(UN_FEEDBACK_FORM_SHOW_TYPE)) { ?> <div class="un-types-wrapper"> <?php $tags = get_terms(FEEDBACK_TYPE, array('un_orderby_meta' => 'position', 'hide_empty' => false)); ?> <?php foreach ($tags as $tag) { ?> <a href="#" class="un-feedback-type" data-type="<?php echo $tag->slug; ?> "><?php if (!un_get_option(UN_DISABLE_ICONS)) { ?> <i class="<?php echo un_get_term_meta($tag->term_id, 'icon'); ?> "></i><?php } echo esc_html(__($tag->name, 'usernoise')); ?> </a> <?php } ?> <?php if (isset($tags[0])) { ?> <?php $slug = $tags[0]; ?> <?php $slug = $slug->slug; ?> <?php } else { ?> <?php $slug = null; ?> <?php } ?> <?php $un_h->hidden_field('type', $slug); ?> </div> <?php } ?> <?php $un_h->textarea('description', un_get_option(UN_FEEDBACK_TEXTAREA_PLACEHOLDER), array('id' => 'un-description', 'class' => 'text text-empty')); ?> <?php if (un_get_option(UN_FEEDBACK_FORM_SHOW_SUMMARY)) { ?> <?php $un_h->text_field('title', un_get_option(UN_FEEDBACK_SUMMARY_PLACEHOLDER), array('id' => 'un-title', 'class' => 'text text-empty')); ?> <?php } ?> <?php if (un_get_option(UN_FEEDBACK_FORM_SHOW_EMAIL)) { ?> <?php $un_h->text_field('email', un_get_option(UN_FEEDBACK_EMAIL_PLACEHOLDER), array('id' => 'un-email', 'class' => 'text text-empty')); ?> <?php } ?> <?php if (un_get_option(UN_FEEDBACK_FORM_SHOW_NAME)) { ?> <?php $un_h->text_field('name', un_get_option(UN_FEEDBACK_NAME_PLACEHOLDER), array('id' => 'un-name', 'class' => 'text text-empty')); ?> <?php } ?> <?php do_action('un_feedback_form_body'); ?> <input type="submit" class="un-submit" value="<?php echo esc_attr(un_submit_feedback_button_text()); ?> " id="un-feedback-submit"> <img src="<?php echo usernoise_url('/images/loader.gif'); ?> " id="un-feedback-loader" class="loader" style="display: none;"> <div class="un-feedback-errors-wrapper" style="display: none;"> <div class="un-errors"></div> </div> </form> <?php }