This commit is contained in:
2026-07-02 15:54:39 -06:00
commit 9883323161
17470 changed files with 4470592 additions and 0 deletions
@@ -0,0 +1,926 @@
<?php
/*
WPFront Notification Bar Plugin
Copyright (C) 2013, WPFront.com
Website: wpfront.com
Contact: syam@wpfront.com
WPFront Notification Bar Plugin is distributed under the GNU General Public License, Version 3,
June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace WPFront\Notification_Bar;
if (!defined('ABSPATH')) exit();
require_once("class-wpfront-notification-bar-entity.php");
require_once(dirname(__DIR__) . "/templates/template-wpfront-notification-bar-custom-css.php");
require_once(dirname(__DIR__) . "/templates/template-wpfront-notification-bar.php");
if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Controller')) {
/**
* Controller class of WPFront Notification Bar plugin
*
* @author Syam Mohan <syam@wpfront.com>
* @copyright 2013 WPFront.com
*/
class WPFront_Notification_Bar_Controller {
//Constants
const PREVIEW_MODE_NAME = 'wpfront-notification-bar-preview-mode';
//role consts
const ROLE_NOROLE = 'wpfront-notification-bar-role-_norole_';
const ROLE_GUEST = 'wpfront-notification-bar-role-_guest_';
//Variables
private $plugin_file;
private $main;
private $options;
private $markupLoaded;
/**
*
* @var string
*/
protected $min_file_suffix = null;
private $scriptLoaded;
private $enabled = null;
private $logs = array();
public function __construct($main, $options) {
$this->main = $main;
$this->options = $options;
$this->markupLoaded = false;
$this->min_file_suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
$this->init();
}
protected function init() {
$this->plugin_file = $this->main->get_plugin_file();
if(!function_exists('add_action')) {
return;
}
$this->check_preview_mode();
if (!is_admin()) {
add_action('template_redirect', array($this, 'set_landingpage_cookie'));
if ($this->options->css_enqueue_footer) {
add_action('wp_footer', array($this, 'enqueue_styles'));
} else {
add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
}
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
}
}
public function set_landingpage_cookie() {
if (headers_sent()) {
return;
}
if ($this->doing_ajax()) {
return;
}
//for landing page tracking
$cookie_name = $this->options->landingpage_cookie_name;
if (!isset($_COOKIE[$cookie_name]) && !is_admin() && $this->options->display_pages == 2 && $this->enabled()) {
setcookie($cookie_name, 1, 0, '/', '', false, true);
}
}
public function check_preview_mode() {
if ($this->options->preview_mode && isset($_GET[$this->get_preview_name()])) {
$this->set_preview_mode();
wp_redirect(home_url());
WPFront_Notification_Bar::Instance()->kill();
}
}
public function get_menu_slug() {
return WPFront_Notification_Bar::PLUGIN_SLUG;
}
//options page scripts
public function enqueue_options_scripts() {
wp_enqueue_media();
$this->enqueue_scripts();
wp_enqueue_script('postbox');
wp_enqueue_script('jquery');
wp_enqueue_style('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css', array(), '4.7.0');
$js = 'js/vue.global.min.js';
wp_enqueue_script('vue', plugins_url($js, $this->plugin_file), array('jquery'), '3.2.37');
wp_enqueue_script('element-plus', plugins_url("js/element-plus.min.js", $this->plugin_file), array('vue'), '2.2.6');
wp_enqueue_script('wpfront-notification-bar-options', plugins_url("js/options{$this->min_file_suffix}.js", $this->plugin_file), array('jquery','element-plus'), WPFront_Notification_Bar::VERSION);
}
//options page styles
public function enqueue_options_styles() {
$this->enqueue_styles();
wp_enqueue_style('element-plus', plugins_url("css/element-plus.min.css", $this->plugin_file), array(), '2.2.6');
$style = "css/options{$this->min_file_suffix}.css";
wp_enqueue_style('wpfront-notification-bar-options', plugins_url($style, $this->plugin_file), array('element-plus'), WPFront_Notification_Bar::VERSION);
}
//add scripts
public function enqueue_scripts() {
if ($this->options->debug_mode) {
add_action('wp_footer', array($this, 'write_debug_logs'), 99999);
if ($this->options->attach_on_shutdown) {
add_action('shutdown', array($this, 'write_debug_logs'), 99999);
}
}
if ($this->enabled() == false) {
return;
}
wp_enqueue_script('jquery');
if ($this->options->keep_closed || $this->options->set_max_views) {
wp_enqueue_script('js-cookie', plugins_url('jquery-plugins/js-cookie.min.js', $this->plugin_file), array(), '2.2.1');
}
wp_enqueue_script('wpfront-notification-bar', plugins_url("js/wpfront-notification-bar{$this->min_file_suffix}.js", $this->plugin_file), array('jquery'), WPFront_Notification_Bar::VERSION);
if ($this->options->position == 1) {
add_action('wp_body_open', array($this, 'write_markup'), $this->options->fixed_position ? 1 : 10);
add_action('wp_footer', array($this, 'write_markup'), $this->options->fixed_position ? 1 : 10); //Callback hook 'wp_body_open' only works from WordPress 5.2
} else {
add_action('wp_footer', array($this, 'write_markup'), $this->options->fixed_position ? 1 : 10);
}
if ($this->options->attach_on_shutdown) {
add_action('shutdown', array($this, 'write_markup'), $this->options->fixed_position ? 1 : 10);
}
$this->scriptLoaded = true;
}
//add styles
public function enqueue_styles() {
if ($this->enabled() == false) {
return;
}
wp_enqueue_style('wpfront-notification-bar', plugins_url("css/wpfront-notification-bar{$this->min_file_suffix}.css", $this->plugin_file), array(), WPFront_Notification_Bar::VERSION);
if ($this->options->dynamic_css_use_url) {
wp_enqueue_style('wpfront-notification-bar-custom', $this->custom_css_url(), array('wpfront-notification-bar'), WPFront_Notification_Bar::VERSION . '.' . $this->options->last_saved);
}
}
public function view() {
$view = new WPFront_Notification_Bar_Add_Edit_View($this);
$view->view();
}
protected function custom_css_url() {
return $this->main->custom_css_url();
}
public function get_html_id_suffix() {
return '';
}
//writes the html and script for the bar
public function write_markup() {
if (is_admin()) {
return;
}
if ($this->markupLoaded) {
return;
}
if (!$this->scriptLoaded) {
return;
}
if ($this->doing_ajax()) {
return;
}
if ($this->enabled()) {
$this->log('Writing HTML template.');
$template = new WPFront_Notification_Bar_Template($this->options, $this);
$template->write();
$json = json_encode(array(
'position' => $this->options->position,
'height' => $this->options->height,
'fixed_position' => $this->options->fixed_position,
'animate_delay' => $this->options->animate_delay,
'close_button' => $this->options->close_button,
'button_action_close_bar' => $this->options->button_action_close_bar,
'auto_close_after' => $this->options->auto_close_after,
'display_after' => $this->options->display_after,
'is_admin_bar_showing' => is_admin_bar_showing(),
'display_open_button' => $this->options->display_open_button,
'keep_closed' => $this->options->keep_closed,
'keep_closed_for' => $this->options->keep_closed_for,
'position_offset' => $this->options->position_offset,
'display_scroll' => $this->options->display_scroll,
'display_scroll_offset' => $this->options->display_scroll_offset,
'keep_closed_cookie' => $this->options->keep_closed_cookie_name,
'log' => $this->options->debug_mode,
'id_suffix' => $this->get_html_id_suffix(),
'log_prefix' => $this->get_log_prefix(),
'theme_sticky_selector' => $this->options->theme_sticky_selector,
'set_max_views' => $this->options->set_max_views,
'max_views' => $this->options->max_views,
'max_views_for' => $this->options->max_views_for,
'max_views_cookie' => $this->options->max_views_cookie_name
));
$this->write_load_script($json);
}
$this->markupLoaded = true;
}
private function write_load_script($json) {
$this->log('Writing JS load script.');
$this->write_debug_logs();
if ($this->options->debug_mode) {
$log_prefix = $this->get_log_prefix();
?>
<script type="text/javascript">
<?php echo "console.log('$log_prefix Starting JS scripts execution.');" ?>
</script>
<?php }
?>
<script type="text/javascript">
function __load_wpfront_notification_bar() {
if (typeof wpfront_notification_bar === "function") {
wpfront_notification_bar(<?php echo $json; ?>);
} else {
<?php
if ($this->options->debug_mode) {
echo "console.log('$log_prefix Waiting for JS function \"wpfront_notification_bar\".');";
}
?>
setTimeout(__load_wpfront_notification_bar, 100);
}
}
__load_wpfront_notification_bar();
</script>
<?php
}
public function write_debug_logs() {
if (empty($this->logs)) {
return;
}
if (!$this->options->debug_mode) {
return;
}
if ($this->doing_ajax()) {
return;
}
$now = current_time('mysql');
$now = strtotime($now);
$now_str = date('Y-m-d h:i:s a', $now);
$log_prefix = $this->get_log_prefix();
echo "<!-- '$log_prefix Page generated at $now_str. '-->";
echo '<script type="text/javascript">';
echo "console.log('$log_prefix Page generated at $now_str.');";
foreach ($this->logs as $message => $args) {
if (empty($args)) {
printf("console.log('$message');");
} else {
vprintf("console.log('$message');", $args);
}
}
echo '</script>';
$this->logs = array();
}
public function get_message_text($translate = false) {
$message = $this->options->message;
if($translate) {
$message = $this->get_wpml_string($message, 'Message Text');
}
$unfilter_html = defined('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML') && constant('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML');
$unfilter_html = apply_filters('wpfront_notification_bar_message_allow_unfiltered_html', $unfilter_html);
if (!$unfilter_html) {
add_filter('wp_kses_allowed_html', array($this, 'message_allowed_html'));
$message = wp_kses($message, wp_kses_allowed_html('post'));
remove_filter('wp_kses_allowed_html', array($this, 'message_allowed_html'));
}
$message = apply_filters('wpfront_notification_bar_message', $message);
if ($this->options->message_process_shortcode) {
$message = do_shortcode($message);
}
return $message;
}
public function message_allowed_html($allowedposttags) {
$allowedposttags['source'] = array('src' => true, 'type' => true);
return $allowedposttags;
}
public function get_button_text($translate = false) {
$text = $this->options->button_text;
if($translate) {
$text = $this->get_wpml_string($text, 'Button Text');
}
$unfilter_html = defined('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML') && constant('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML');
$unfilter_html = apply_filters('wpfront_notification_bar_button_text_allow_unfiltered_html', $unfilter_html);
if (!$unfilter_html) {
$text = wp_kses($text, wp_kses_allowed_html('post'));
}
$text = apply_filters('wpfront_notification_bar_button_text', $text);
if ($this->options->message_process_shortcode) {
$text = do_shortcode($text);
}
return $text;
}
protected function filter() {
if (is_admin()) {
$this->log('Running in wp-admin, ignoring filters.');
return true;
}
if ($this->options->filter_date_type === 'start_end') {
$result = $this->start_date_time();
if (!$result) {
return false;
}
}
switch ($this->options->display_roles) {
case 1:
break;
case 2:
if (!$this->is_user_logged_in()) {
$this->log('Filter: Display only for logged-in users. User is not logged-in, disabling notification.');
return false;
}
break;
case 3:
if ($this->is_user_logged_in()) {
$this->log('Filter: Display only for guest users. User is logged-in, disabling notification.');
return false;
}
break;
case 4:
global $current_user;
if (empty($current_user->roles)) {
$role = self::ROLE_GUEST;
if ($this->is_user_logged_in())
$role = self::ROLE_NOROLE;
if (!in_array($role, $this->options->include_roles)) {
$this->log('Filter: Display set for user roles. Current user role is not allowed, disabling notification.');
return false;
}
} else {
$display = false;
foreach ($current_user->roles as $role) {
if (in_array($role, $this->options->include_roles)) {
$display = true;
break;
}
}
if (!$display) {
$this->log('Filter: Display set for user roles. Current user role is not allowed, disabling notification.');
return false;
}
}
break;
}
switch ($this->options->display_pages) {
case 1:
return true;
case 2:
if (isset($_COOKIE[$this->options->landingpage_cookie_name])) {
$this->log('Filter: Display only on landing page. This is not the landing page, disabling notification.');
return false;
}
return true;
case 3:
case 4:
global $post;
if (empty($post)) {
$this->log('Filter: Global post object is empty.');
}
$ID = false;
if (is_home()) {
$ID = 'home';
} elseif (is_singular()) {
$ID = $post->ID;
}
if ($this->options->display_pages == 3) {
if ($ID !== false) {
if ($this->filter_pages_contains($this->options->include_pages, $ID, true) === false) {
$this->log('Filter: Display is set to include in pages. Current page ID is "%s", which is not included, disabling notification.', array($ID));
return false;
} else {
return true;
}
}
return false;
}
if ($this->options->display_pages == 4) {
if ($ID !== false) {
if ($this->filter_pages_contains($this->options->exclude_pages, $ID, true) === false) {
return true;
} else {
$this->log('Filter: Display is set to exclude in pages. Current page ID is "%s", which is excluded, disabling notification.', array($ID));
return false;
}
}
return true;
}
case 5:
if (isset($_SERVER['REQUEST_URI']) && !empty($this->options->filter_url_contains)) {
$v = strpos($_SERVER['REQUEST_URI'], $this->options->filter_url_contains);
if ($v === false) {
$this->log('Filter: Display is set based on text in URL. Current URL is "%s" and URL text is "%s", which is not found, disabling notification.', array($_SERVER['REQUEST_URI'], $this->options->filter_url_contains));
return false;
}
return true;
}
}
return true;
}
protected function start_date_time() {
$now = current_time('mysql');
$now = strtotime($now);
$now_str = date('Y-m-d h:i a', $now);
$now = strtotime($now_str);
$start_date = empty($this->options->start_date) ? null : strtotime($this->options->start_date);
if (!empty($start_date)) {
$start_date = date('Y-m-d', $start_date);
$start_time = empty($this->options->start_time) ? null : strtotime($this->options->start_time);
if (empty($start_time)) {
$start_time = '12:00 am';
} else {
$start_time = date('h:i a', $start_time);
}
$start_date_str = $start_date . ' ' . $start_time;
$start_date = strtotime($start_date_str);
if ($start_date > $now) {
$this->log('Filter: Start time is in future, disabling notification. Start time: %s[%s], Current time: %s[%s]', [$start_date, $start_date_str, $now, $now_str]);
return false;
}
}
$end_date = empty($this->options->end_date) ? null : strtotime($this->options->end_date);
if (!empty($end_date)) {
$end_date = date('Y-m-d', $end_date);
$end_time = empty($this->options->end_time) ? null : strtotime($this->options->end_time);
if (empty($end_time)) {
$end_time = '11:59 pm';
} else {
$end_time = date('h:i a', $end_time);
}
$end_date_str = $end_date . ' ' . $end_time;
$end_date = strtotime($end_date_str);
if ($end_date < $now) {
$this->log('Filter: End time is in past, disabling notification. End time: %s[%s], Current time: %s[%s]', [$end_date, $end_date_str, $now, $now_str]);
return false;
}
}
return true;
}
/**
* Returns whether user is logged in
*
* @return boolean
*/
protected function is_user_logged_in() {
$logged_in = is_user_logged_in();
if (!$logged_in && $this->options->wp_emember_integration && function_exists('wp_emember_is_member_logged_in')) {
$logged_in = call_user_func('wp_emember_is_member_logged_in'); //@phpstan-ignore-line
}
return $logged_in;
}
protected function enabled() {
if ($this->enabled !== null) {
return $this->enabled;
}
if ($this->options->enabled) {
$this->log('Notification bar is enabled.');
$this->enabled = apply_filters('wpfront_notification_bar_enabled', $this->filter(), $this->options);
return $this->enabled;
}
if ($this->is_preview_mode()) {
$this->log('Notification bar is running in preview mode.');
$this->enabled = apply_filters('wpfront_notification_bar_enabled', $this->filter(), $this->options);
return $this->enabled;
}
$this->log('Notification bar is not enabled.');
$this->enabled = apply_filters('wpfront_notification_bar_enabled', false, $this->options);
return $this->enabled;
}
/**
* Returns admin page footer text.
*
* @param string $text WordPress default.
* @return string
*/
public function admin_footer_text($text) {
return $this->main->admin_footer_text($text);
}
protected function doing_ajax() {
if (defined('DOING_AJAX') && DOING_AJAX) {
return TRUE;
}
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
return TRUE;
}
if (!empty($_SERVER['REQUEST_URI']) && strtolower($_SERVER['REQUEST_URI']) == '/wp-admin/async-upload.php') {
return TRUE;
}
if (function_exists('wp_doing_ajax') && wp_doing_ajax()) {
return TRUE;
}
if (function_exists('wp_is_json_request') && wp_is_json_request()) {
return TRUE;
}
if (function_exists('wp_is_jsonp_request') && wp_is_jsonp_request()) {
return TRUE;
}
if (function_exists('wp_is_xml_request') && wp_is_xml_request()) {
return TRUE;
}
if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
return TRUE;
}
if (defined('WP_CLI') && constant('WP_CLI')) {
return TRUE;
}
return FALSE;
}
/**
* Settings updated callback.
* Sets/Resets preview mode.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @param WPFront_Notification_Bar_Entity $entity
* @return void
*/
public function settings_updated($entity) {
if ($entity->preview_mode) {
$this->set_preview_mode();
} else {
$this->remove_preview_mode();
}
$this->register_wpml_string($entity->message, 'Message Text');
if($entity->display_button) {
$this->register_wpml_string($entity->button_text, 'Button Text');
}
if (function_exists('w3tc_flush_posts')) {
call_user_func('w3tc_flush_posts'); //@phpstan-ignore-line
}
}
/**
* WPML Registration
*
* @param string $message_text
* @param string $context
* @return void
*/
protected function register_wpml_string($value, $context) {
do_action('wpml_register_single_string', 'WPFront Notification Bar', $context . $this->get_html_id_suffix(), $value);
}
/**
* Returns wpml value
*
* @param string $value
* @param string $context
* @return string
*/
protected function get_wpml_string($value, $context) {
return apply_filters('wpml_translate_single_string', $value, 'WPFront Notification Bar', $context . $this->get_html_id_suffix());
}
public function get_filter_objects() {
$objects = array();
$objects['home'] = __('[Home Page]', 'wpfront-notification-bar');
$posts = get_posts(array('numberposts' => 50));
foreach ($posts as $post) {
$objects[$post->ID] = __('[Post]', 'wpfront-notification-bar') . ' ' . $post->post_title;
}
$pages = get_pages(array('number' => 50));
foreach ($pages as $page) {
$objects[$page->ID] = __('[Page]', 'wpfront-notification-bar') . ' ' . $page->post_title;
}
$taxonomies = get_taxonomies(['public' => true]);
$viewable_taxonomy = array();
foreach ($taxonomies as $taxonomy) {
if (function_exists('is_taxonomy_viewable') && !is_taxonomy_viewable($taxonomy)) {
continue;
}
$viewable_taxonomy[] = $taxonomy;
}
$taxonomies = [];
foreach ($viewable_taxonomy as $tax) {
$tax_object = get_taxonomy($tax);
$taxonomies[$tax_object->name] = $tax_object->label;
}
asort($taxonomies);
$taxonomies = array_keys($taxonomies);
foreach ($taxonomies as $tax) {
$terms = get_terms([
'taxonomy' => $tax,
'hide_empty' => false,
]);
if (!empty($terms)) {
foreach ($terms as $term) {
$taxonomy_name = $term->taxonomy;
$taxonomy = get_taxonomy($taxonomy_name);
$objects['t' . $term->term_id] = '[' . $taxonomy->label . ']' . ' ' . $term->name;
}
}
}
return $objects;
}
/**
* Checks whether post contains in filter
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*
* @param string $list
* @param string|int $key
* @param boolean $deep
* @return bool
*/
public function filter_pages_contains($list, $key, $deep = false) {
$exists = strpos(',' . $list . ',', ',' . $key . ',');
if ($exists !== false) {
return true;
}
if (!$deep || $key === 'home') {
return false;
}
$ids = explode(',', $list);
$term_ids = array();
foreach ($ids as $id) {
$id = trim($id);
if($key == $id) {
return true;
}
if (substr($id, 0, 1) === 't') {
$term_ids[] = intval(substr($id, 1));
}
}
$key = (int)$key;
if($key === 0) {
return false;
}
$post_terms = wp_get_post_terms($key, get_taxonomies(), array('fields' => 'ids'));
if(!is_array($post_terms)) {
$post_terms = array();
}
$actual_post_terms = array();
foreach ($post_terms as $post_term) {
do {
$term = get_term($post_term);
if($term instanceof \WP_Term) {
$actual_post_terms[] = $term->term_id;
$post_term = $term->parent;
} else {
$post_term = 0;
}
} while ($post_term > 0);
}
$result = array_intersect($term_ids, $actual_post_terms);
return !empty($result);
}
public function get_role_objects() {
$objects = array();
global $wp_roles;
$roles = $wp_roles->role_names;
foreach ($roles as $role_name => $role_display_name) {
$objects[$role_name] = $role_display_name;
}
ksort($objects);
return $objects;
}
/**
* Set preview mode cookie
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
*
* @return void
*/
protected function set_preview_mode() {
$preview_name = $this->get_preview_name();
@setcookie($preview_name, 1, 0, '/');
}
/**
* Remove preview mode cookie
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
*
* @return void
*/
protected function remove_preview_mode() {
@setcookie($this->get_preview_name(), '', time() - 3600, '/');
}
private function is_preview_mode() {
if ($this->options->preview_mode && isset($_COOKIE[$this->get_preview_name()])) {
$this->log('Preview mode is enabled.');
return true;
}
$this->log('Preview mode is not enabled.');
return false;
}
protected function log($message, $args = null) {
$log_prefix = $this->get_log_prefix();
$this->logs["$log_prefix $message"] = $args;
}
public function get_plugin_file() {
return $this->plugin_file;
}
public function get_options() {
return $this->options;
}
public function display_on_page_load() {
if (!$this->options->display_scroll && $this->options->display_after == 0 && $this->options->animate_delay == 0) {
return true;
}
return false;
}
/**
* Returns whether keep closed cookie is set
*
* @return boolean
*/
public function has_keep_closed_set() {
if ($this->options->keep_closed && isset($_COOKIE[$this->options->keep_closed_cookie_name])) {
return true;
}
return false;
}
/**
* Returns whether max views state reached.
*
* @return boolean
*/
public function has_max_views_reached() {
if ($this->options->set_max_views) {
$views = 0;
if(isset($_COOKIE[$this->options->max_views_cookie_name])) {
$views = intval($_COOKIE[$this->options->max_views_cookie_name]);
}
if($views >= $this->options->max_views) {
return true;
}
}
return false;
}
public function get_lang_domain() {
return $this->main->get_lang_domain();
}
public function get_entity_id() {
return '';
}
public function get_preview_name() {
$preview_id = $this->get_entity_id();
if(!empty($preview_id)) {
$preview_id = '-' . $preview_id;
}
return self::PREVIEW_MODE_NAME . $preview_id;
}
public function get_preview_url() {
return add_query_arg($this->get_preview_name(), '1', home_url());
}
protected function get_log_prefix() {
$entity_id = $this->get_entity_id();
if (!empty($entity_id)) {
return '[WPFront Notification Bar - ' . $entity_id . ']';
} else {
return '[WPFront Notification Bar]';
}
}
}
}
@@ -0,0 +1,455 @@
<?php
/*
WPFront Notification Bar Plugin
Copyright (C) 2013, WPFront.com
Website: wpfront.com
Contact: syam@wpfront.com
WPFront Notification Bar Plugin is distributed under the GNU General Public License, Version 3,
June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace WPFront\Notification_Bar;
if (!defined('ABSPATH')) exit();
use ErrorException;
require_once("class-wpfront-notification-bar-entity.php");
require_once("class-wpfront-notification-bar-controller.php");
require_once(dirname(__DIR__) . "/templates/template-wpfront-notification-bar-custom-css.php");
require_once(dirname(__DIR__) . "/templates/template-wpfront-notification-bar.php");
require_once(dirname(__DIR__) . "/templates/template-wpfront-notification-bar-add-edit.php");
if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar')) {
/**
* Main class of WPFront Notification Bar plugin
*
* @author Syam Mohan <syam@wpfront.com>
* @copyright 2013 WPFront.com
*/
class WPFront_Notification_Bar {
//Constants
const VERSION = '3.5.1.05102';
const OPTIONS_GROUP_NAME = 'wpfront-notification-bar-options-group';
const OPTION_NAME = 'wpfront-notification-bar-options';
const PLUGIN_SLUG = 'wpfront-notification-bar';
const PREVIEW_MODE_NAME = 'wpfront-notification-bar-preview-mode'; //TODO: remove
//role consts
const ROLE_NOROLE = 'wpfront-notification-bar-role-_norole_';
const ROLE_GUEST = 'wpfront-notification-bar-role-_guest_';
/**
* Plugin file relative path
*
* @var string
*/
protected $plugin_file;
/**
* Default settings capability
*
* @var string
*/
protected $cap = 'manage_options';
/**
* List of controller objects
*
* @var \WPFront\Notification_Bar\WPFront_Notification_Bar_Controller[]
*/
protected $controllers;
/**
* Holds current controller object
*
* @var \WPFront\Notification_Bar\WPFront_Notification_Bar_Controller|null
*/
protected $current_controller;
/**
* Singleton
*
* @var self
*/
protected static $instance = null;
/**
* Returns singleton instance
*
* @return WPFront_Notification_Bar
*/
public static function Instance() {
if (self::$instance === null) {
self::$instance = new WPFront_Notification_Bar();
self::$instance = apply_filters('wpfront_notification_bar_instance', self::$instance);
}
return self::$instance;
}
/**
* Init function
*
* @param string $plugin_file
* @return void
*/
public function init($plugin_file) {
$this->plugin_file = $plugin_file;
add_action('plugins_loaded', array($this, 'set_controllers'));
add_action('init', array($this, 'custom_css'));
if (is_admin()) {
if (defined('WPFRONT_NOTIFICATION_BAR_EDIT_CAPABILITY')) {
$this->cap = constant('WPFRONT_NOTIFICATION_BAR_EDIT_CAPABILITY');
}
$this->cap = apply_filters('wpfront_notification_bar_edit_capability', $this->cap);
add_filter('option_page_capability_' . self::OPTIONS_GROUP_NAME, array($this, 'option_page_capability_callback'), 10);
add_action('admin_init', array($this, 'admin_init'));
add_action('admin_menu', array($this, 'admin_menu'));
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
$this->add_activation_redirect();
}
}
/**
* Sets controllers
*
* @return void
*/
public function set_controllers() {
$this->controllers = $this->get_controllers();
$this->current_controller = null;
}
/**
* Returns the list of controllers.
* For free there will be only one.
*
* @return WPFront_Notification_Bar_Controller[]
*/
public function get_controllers() {
$options = new WPFront_Notification_Bar_Entity();
$options = $options->get();
return array(new WPFront_Notification_Bar_Controller($this, $options));
}
/**
* Attaches hooks for activation redirect functionality
*
* @return void
*/
protected function add_activation_redirect() {
add_action('activated_plugin', array($this, 'activated_plugin_callback'));
add_action('admin_init', array($this, 'admin_init_callback'), 999999);
}
/**
* Sets the activation redirect required flag in options table.
*
* @param string $plugin_file
* @return void
*/
public function activated_plugin_callback($plugin_file) {
if ($plugin_file !== $this->plugin_file) {
return;
}
if (is_network_admin() || isset($_GET['activate-multi'])) {
return;
}
$key = self::PLUGIN_SLUG . '-activation-redirect';
add_option($key, true);
}
/**
* Redirects if the activation redirect flag is set in options table.
*
* @return void
*/
public function admin_init_callback() {
$key = self::PLUGIN_SLUG . '-activation-redirect';
if (get_option($key, false)) {
delete_option($key);
if (is_network_admin() || isset($_GET['activate-multi'])) {
return;
}
wp_safe_redirect(menu_page_url(self::PLUGIN_SLUG, FALSE));
$this->kill();
}
}
/**
* Register settings call for options page.
*
* @return void
*/
public function admin_init() {
register_setting(self::OPTIONS_GROUP_NAME, self::OPTION_NAME);
}
/**
* Adds admin menu and attaches hooks for load and scripts.
*
* @return void
*/
public function admin_menu() {
$page_hook_suffix = add_options_page(__('WPFront Notification Bar', 'wpfront-notification-bar'), __('Notification Bar', 'wpfront-notification-bar'), $this->cap, self::PLUGIN_SLUG, array($this, 'view'));
add_action('load-' . $page_hook_suffix, array($this, 'load_view'));
add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_options_scripts'));
add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_options_styles'));
}
/**
* Load view function, sets current controller.
*
* @return void
*/
public function load_view() {
if (!current_user_can($this->cap)) {
wp_die(__('You do not have sufficient permissions to access this page.', 'wpfront-notification-bar'));
return;
}
add_filter('upload_mimes', array($this, 'custom_upload_filter' ));
$this->current_controller = $this->controllers[0];
if(isset($_POST['submit']) || isset($_POST['submit2'])){
check_admin_referer('wpfront-notification-bar-options-group-options');
$data = $_POST['wpfront-notification-bar-options'];
foreach($data as $key => $value) {
if($key == 'include_roles'){
$data[$key] = explode(',', $value);
}
}
$data = stripslashes_deep($data);
$data = (object)$data;
$options = new WPFront_Notification_Bar_Entity();
$options->set_values($data);
$options->save();
$this->current_controller->settings_updated($options);
$current_url = menu_page_url(self::PLUGIN_SLUG, false);
$current_url = $current_url . '&updated=true';
wp_safe_redirect($current_url);
$this->kill();
}
}
/**
* Custom upload filter to remove pdf mime type.
*
* @param array<string,string> $mime_types
* @return array<string,string>
*/
public function custom_upload_filter( $mime_types ) {
unset($mime_types['pdf']);
return $mime_types;
}
/**
* Enqueue's current controller scripts.
*
* @return void
*/
public function enqueue_options_scripts() {
if($this->current_controller !== null) {
$this->current_controller->enqueue_options_scripts();
}
}
/**
* Enqueue's current controller styles.
*
* @return void
*/
public function enqueue_options_styles() {
if($this->current_controller !== null) {
$this->current_controller->enqueue_options_styles();
}
}
/**
* Displays current controller settings.
*
* @return void
*/
public function view() {
if (!current_user_can($this->cap)) {
wp_die(__('You do not have sufficient permissions to access this page.', 'wpfront-notification-bar'));
return;
}
if($this->current_controller !== null) {
$this->current_controller->view();
}
add_filter('admin_footer_text', array($this, 'admin_footer_text'));
}
/**
* Add links to be displayed in Plugins page.
*
* @param string[] $links
* @param string $plugin_file Plugin file
* @return string[]
*/
public function plugin_action_links($links, $plugin_file) {
if ($plugin_file == $this->plugin_file) {
if (current_user_can($this->cap)) {
$settings_link = '<a id="wpfront-notification-bar-settings-link" href="' . menu_page_url(self::PLUGIN_SLUG, false) . '">' . __('Settings', 'wpfront-notification-bar') . '</a>';
array_unshift($links, $settings_link);
}
$url = 'https://wpfront.com/notification-bar-pro/';
$text = __('Upgrade', 'wpfront-notification-bar');
$a = sprintf('<a id="wpfront-notification-bar-upgrade-link" style="color:red;" target="_blank" href="%s">%s</a>', $url, $text);
array_unshift($links, $a);
}
return $links;
}
/**
* Returns the custom css URL.
*
* @return string
*/
public function custom_css_url() {
return plugins_url("css/wpfront-notification-bar-custom-css/", $this->plugin_file);
}
/**
* Prints custom css to output and exists.
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
*
* @return void
*/
public function custom_css() {
if (strpos($_SERVER['REQUEST_URI'], '/css/wpfront-notification-bar-custom-css/') === false) {
return;
}
@header('Content-Type: text/css; charset=UTF-8');
$e = strtotime('+1 year');
@header('Expires: ' . gmdate('D, d M Y H:i:s ', $e) . 'GMT');
@header('Cache-Control: public, max-age=' . $e);
if (isset($_GET['id'])) {
$id = $_GET['id'];
$controller = $this->controllers[$id];
$template = new WPFront_Notification_Bar_Custom_CSS_Template();
$template->write($controller, true);
$this->kill();
}
foreach ($this->controllers as $controller) {
$options = $controller->get_options();
if ($options->dynamic_css_use_url) {
$template = new WPFront_Notification_Bar_Custom_CSS_Template();
$template->write($controller);
}
}
$this->kill();
}
/**
* Returns admin page footer text.
*
* @param string $text WordPress default.
* @return string
*/
public function admin_footer_text($text) {
$upgrade_link = sprintf('<a href="%s" target="_blank" style="color:red;"><b>%s</b></a>', 'https://wpfront.com/notification-bar-pro/', __('Create Multiple Bars', 'wpfront-notification-bar'));
$troubleshootingLink = sprintf('<a href="%s" target="_blank">%s</a>', 'https://wpfront.com/wordpress-plugins/notification-bar-plugin/wpfront-notification-bar-troubleshooting/', __('Troubleshooting', 'wpfront-notification-bar'));
$settingsLink = sprintf('<a href="%s" target="_blank">%s</a>', 'https://wpfront.com/notification-bar-plugin-settings/', __('Settings Description', 'wpfront-notification-bar'));
$reviewLink = sprintf('<a href="%s" target="_blank">%s</a>', 'https://wordpress.org/support/plugin/' . self::PLUGIN_SLUG . '/reviews/', __('Write a Review', 'wpfront-notification-bar'));
return sprintf('%s | %s | %s | %s | %s', $upgrade_link, $troubleshootingLink, $settingsLink, $reviewLink, $text);
}
/**
* Returns current language domain value.
* Default - wpfront-notification-bar
* Overridden by WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN const.
*
* @return string
*/
public function get_lang_domain() {
if (defined('WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN')) {
return constant('WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN');
}
return 'wpfront-notification-bar';
}
/**
* Returns current plugin file.
*
* @return string
*/
public function get_plugin_file() {
return $this->plugin_file;
}
/**
* Returns current options page capability
*
* @return string
*/
public function option_page_capability_callback() {
return $this->cap;
}
/**
* Exit wrapper
*
* @return void
*/
public function kill() {
if(defined('WPFRONT_UNIT_TEST_MODE') && constant('WPFRONT_UNIT_TEST_MODE')) {
throw new ErrorException("exit");
}
exit;
}
}
}
if (file_exists(dirname(__DIR__) . '/pro/classes/class-wpfront-notification-bar-pro.php')) {
require_once dirname(__DIR__) . '/pro/classes/class-wpfront-notification-bar-pro.php';
}
@@ -0,0 +1,4 @@
<?php
// Silence is golden.
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
<?php
// Silence is golden.
@@ -0,0 +1,233 @@
#wpfront-notification-bar-options input.seconds,
#wpfront-notification-bar-options input.pixels
{
width: 40px;
}
#wpfront-notification-bar-options input.minutes
{
width: 50px;
}
#wpfront-notification-bar-options input.date,
#wpfront-notification-bar-options input.time
{
width: 100px;
}
#wpfront-notification-bar-options textarea
{
width: 100%;
}
#wpfront-notification-bar-options input.URL
{
width: 70%;
}
#wpfront-notification-bar-options table.form-table i.fa.fa-question-circle-o
{
opacity: 0.8;
font-size: 13px;
vertical-align: middle;
}
#wpfront-notification-bar-options table.form-table .color-selector-div
{
display: inline-block;
width: 120px;
}
#wpfront-notification-bar-options table.form-table .color-selector
{
vertical-align: middle;
}
#wpfront-notification-bar-options table.form-table .color-value
{
width: 80px;
height: 32px;
vertical-align: top;
}
#wpfront-notification-bar-options table.form-table div.pages-selection, #wpfront-notification-bar-options table.form-table div.roles-selection
{
width: 100%;
height: 150px;
background-color: #fff;
overflow: auto;
border: 1px solid #dfdfdf;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
#wpfront-notification-bar-options table.form-table div.page-div, #wpfront-notification-bar-options table.form-table div.role-div
{
float: left;
width: 32%;
min-width: 225px;
padding: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 300px;
}
#wpfront-notification-bar-options input.post-id-list
{
width: 100%;
}
.colorpicker input
{
min-height: 0px;
}
#wpfront-notification-bar-options #media-library-button
{
min-height: 0px;
height: 30px;
line-height: inherit;
vertical-align: inherit;
}
.wp-editor-container textarea.wp-editor-area
{
width: 100% !important;
}
.wpfront-notification-bar-editor
{
width: 70%;
}
#notification-bar-message-text {
height: 280px;
}
.notification-bar-schedule {
font-weight: bold !important;
}
#wpfront-schedule-crontable {
border-collapse: collapse;
margin-top: 10px;
table-layout: fixed;
width: 200px;
}
#wpfront-schedule-crontable th,
#wpfront-schedule-crontable td {
border-bottom: 1px solid gray;
padding: 10px 10px 10px 0;
width: 100px;
overflow: hidden;
}
.notification-bar-tooltip {
background: #ffffff;
border: 1px solid #888;
}
.notification-bar-tooltip {
padding: 10px 20px;
color: black;
border-radius: 5px;
box-shadow: 0 0 7px #888888;
max-width:350px;
opacity: 1;
font-family: inherit;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
}
#wpfront-notification-bar-options .free-to-pro ul {
list-style: inside !important;
font-weight: bold;
}
#wpfront-notification-bar-options .free-to-pro .discount-tip,
#wpfront-notification-bar-options .free-to-pro .discount-code,
#wpfront-notification-bar-options .free-to-pro .upgrade-button {
text-align: center;
}
#wpfront-notification-bar-options .free-to-pro .discount-tip {
color: red;
}
#wpfront-notification-bar-options .free-to-pro .discount-code,
#wpfront-notification-bar-options #postbox-side-2 .postbox-header .hndle {
font-weight: bold;
color: red;
}
#wpfront-notification-bar-options tr.wpfront-time-day-selector div {
height: 180px;
overflow-y:auto;
}
#wpfront-notification-bar-options div.see-more-schedules {
margin-top: 10px;
}
table.more_schedule_table {
margin: auto;
margin-top: 15px;
border-spacing: 0;
border-collapse: separate;
border: 1px solid grey;
}
table.more_schedule_table th,
table.more_schedule_table td {
border: 1px solid grey;
padding: 3px;
}
table.more_schedule_table td {
font-weight: normal;
color: black;
}
#wpfront-notification-bar-options input.color-selector-input {
vertical-align: top;
height: 32px;
width: 7em;
}
input[type="text"].el-input__inner {
border: 0;
box-shadow: none;
outline: 0;
}
.el-color-picker__panel .el-color-predefine__color-selector {
height: 18px;
}
.el-color-picker__panel .el-color-predefine__color-selector div {
border: 1px solid #e4e7ed;
}
.el-time-spinner__item {
margin-bottom: 0px;
}
.el-date-editor.el-input {
width: 20%;
--el-input-border-color: #8c8f94;
}
.el-popper {
max-width: 350px;
}
.tox-notifications-container, .tox-notification {
display: none !important;
}
@@ -0,0 +1 @@
#wpfront-notification-bar-options input.pixels,#wpfront-notification-bar-options input.seconds{width:40px}#wpfront-notification-bar-options input.minutes{width:50px}#wpfront-notification-bar-options input.date,#wpfront-notification-bar-options input.time{width:100px}#wpfront-notification-bar-options textarea{width:100%}#wpfront-notification-bar-options input.URL{width:70%}#wpfront-notification-bar-options table.form-table i.fa.fa-question-circle-o{opacity:.8;font-size:13px;vertical-align:middle}#wpfront-notification-bar-options table.form-table .color-selector-div{display:inline-block;width:120px}#wpfront-notification-bar-options table.form-table .color-selector{vertical-align:middle}#wpfront-notification-bar-options table.form-table .color-value{width:80px;height:32px;vertical-align:top}#wpfront-notification-bar-options table.form-table div.pages-selection,#wpfront-notification-bar-options table.form-table div.roles-selection{width:100%;height:150px;background-color:#fff;overflow:auto;border:1px solid #dfdfdf;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}#wpfront-notification-bar-options table.form-table div.page-div,#wpfront-notification-bar-options table.form-table div.role-div{float:left;width:32%;min-width:225px;padding:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:300px}#wpfront-notification-bar-options input.post-id-list{width:100%}.colorpicker input{min-height:0}#wpfront-notification-bar-options #media-library-button{min-height:0;height:30px;line-height:inherit;vertical-align:inherit}.wp-editor-container textarea.wp-editor-area{width:100%!important}.wpfront-notification-bar-editor{width:70%}#notification-bar-message-text{height:280px}.notification-bar-schedule{font-weight:700!important}#wpfront-schedule-crontable{border-collapse:collapse;margin-top:10px;table-layout:fixed;width:200px}#wpfront-schedule-crontable td,#wpfront-schedule-crontable th{border-bottom:1px solid gray;padding:10px 10px 10px 0;width:100px;overflow:hidden}.notification-bar-tooltip{background:#fff;border:1px solid #888}.notification-bar-tooltip{padding:10px 20px;color:#000;border-radius:5px;box-shadow:0 0 7px #888;max-width:350px;opacity:1;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit}#wpfront-notification-bar-options .free-to-pro ul{list-style:inside!important;font-weight:700}#wpfront-notification-bar-options .free-to-pro .discount-code,#wpfront-notification-bar-options .free-to-pro .discount-tip,#wpfront-notification-bar-options .free-to-pro .upgrade-button{text-align:center}#wpfront-notification-bar-options .free-to-pro .discount-tip{color:red}#wpfront-notification-bar-options #postbox-side-2 .postbox-header .hndle,#wpfront-notification-bar-options .free-to-pro .discount-code{font-weight:700;color:red}#wpfront-notification-bar-options tr.wpfront-time-day-selector div{height:180px;overflow-y:auto}#wpfront-notification-bar-options div.see-more-schedules{margin-top:10px}table.more_schedule_table{margin:auto;margin-top:15px;border-spacing:0;border-collapse:separate;border:1px solid grey}table.more_schedule_table td,table.more_schedule_table th{border:1px solid grey;padding:3px}table.more_schedule_table td{font-weight:400;color:#000}#wpfront-notification-bar-options input.color-selector-input{vertical-align:top;height:32px;width:7em}input[type=text].el-input__inner{border:0;box-shadow:none;outline:0}.el-color-picker__panel .el-color-predefine__color-selector{height:18px}.el-color-picker__panel .el-color-predefine__color-selector div{border:1px solid #e4e7ed}.el-time-spinner__item{margin-bottom:0}.el-date-editor.el-input{width:20%;--el-input-border-color:#8c8f94}.el-popper{max-width:350px}.tox-notification,.tox-notifications-container{display:none!important}
@@ -0,0 +1,20 @@
.tagify {
box-shadow: 0 0 0 transparent;
border-radius: 4px;
border: 1px solid #7e8993;
background-color: #fff;
color: #32373c;
}
div.wrap.wpfront-notification-bar table.wp-list-table.notification .column-enabled,
div.wrap.wpfront-notification-bar table.wp-list-table.notification .column-preview-mode,
div.wrap.wpfront-notification-bar table.wp-list-table.notification .column-debug-mode {
text-align: center;
}
div.wrap.wp-notification-bar-license table.form-table td.invalid,
div.wrap.wp-notification-bar-license table.form-table td.expired,
div.wrap.wp-notification-bar-license table.form-table td.item_name_mismatch,
div.wrap.wp-notification-bar-license table.form-table td.disabled {
color: red;
}
@@ -0,0 +1 @@
.tagify{box-shadow:0 0 0 transparent;border-radius:4px;border:1px solid #7e8993;background-color:#fff;color:#32373c}div.wrap.wpfront-notification-bar table.wp-list-table.notification .column-enabled,div.wrap.wpfront-notification-bar table.wp-list-table.notification .column-preview-mode,div.wrap.wpfront-notification-bar table.wp-list-table.notification .column-debug-mode{text-align:center}div.wrap.wp-notification-bar-license table.form-table td.invalid,div.wrap.wp-notification-bar-license table.form-table td.expired,div.wrap.wp-notification-bar-license table.form-table td.item_name_mismatch,div.wrap.wp-notification-bar-license table.form-table td.disabled{color:red}
@@ -0,0 +1,205 @@
.wpfront-notification-bar
{
visibility: hidden;
position: fixed;
overflow: hidden;
left: 0px;
right: 0px;
text-align: center;
color: #fff;
background-color: #000;
z-index: 99998;
}
.wpfront-bottom-shadow
{
-webkit-box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
box-shadow: 0px 5px 5px 0px rgba(0,0,0,0.75);
}
.wpfront-top-shadow
{
-webkit-box-shadow: 0px -5px 5px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 0px -5px 5px 0px rgba(0,0,0,0.75);
box-shadow: 0px -5px 5px 0px rgba(0,0,0,0.75);
}
.wpfront-notification-bar.wpfront-fixed
{
position: fixed;
z-index: 99998;
width: 100%;
display: flex;
align-content: center;
align-items: center;
justify-content: center;
flex-direction: row;
}
.wpfront-notification-bar.wpfront-fixed-position
{
z-index: 99999;
}
.wpfront-notification-bar.wpfront-fixed.load
{
visibility: visible;
position: relative;
}
.wpfront-notification-bar.top
{
top: 0px;
}
.wpfront-notification-bar.bottom
{
bottom: 0px;
}
.wpfront-notification-bar.keep-closed,
.wpfront-notification-bar.max-views-reached
{
display: none;
}
.wpfront-notification-bar div.wpfront-close
{
position: absolute;
top: 3px;
right: 5px;
cursor: pointer;
font-family: Arial, sans-serif;
font-weight: bold;
line-height: 0px;
font-size: 10px;
padding: 5px 2px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
.wpfront-notification-bar table, .wpfront-notification-bar tbody, .wpfront-notification-bar tr
{
margin: auto;
border: 0px;
padding: 0px;
background: inherit;
}
.wpfront-notification-bar td
{
background: inherit;
vertical-align: middle;
text-align: center;
border: 0px;
margin: 0px;
padding: 0;
line-height: 1em;
}
.wpfront-notification-bar div.wpfront-div
{
display:inline-block;
text-align: center;
vertical-align: middle;
padding: 5px 0px;
}
.wpfront-notification-bar-editor a.wpfront-button,
.wpfront-notification-bar a.wpfront-button
{
display: inline-block;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
white-space: nowrap;
font-size: 13px;
font-weight: bold;
text-align: center;
text-decoration: none;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
cursor: pointer;
padding: 5px 10px;
margin-left: 5px;
border-radius: 2px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
}
.wpfront-notification-bar-open-button
{
position: absolute;
right: 10px;
z-index: 99998;
border: 3px solid white;
width: 23px;
height: 30px;
cursor: pointer;
background-repeat: no-repeat;
border-radius: 2px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.wpfront-notification-bar-open-button.hidden
{
display: none;
}
.wpfront-notification-bar-open-button.top
{
top: 0px;
background-position: top center;
border-top: 0px;
-webkit-border-top-right-radius: 0px;
-webkit-border-top-left-radius: 0px;
-moz-border-radius-topright: 0px;
-moz-border-radius-topleft: 0px;
border-top-right-radius: 0px;
border-top-left-radius: 0px;
}
.wpfront-notification-bar-open-button.bottom
{
bottom: 0px;
background-position: bottom center;
border-bottom: 0px;
-webkit-border-bottom-right-radius: 0px;
-webkit-border-bottom-left-radius: 0px;
-moz-border-radius-bottomright: 0px;
-moz-border-radius-bottomleft: 0px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
}
.wpfront-notification-bar-spacer
{
position: relative;
z-index: 99998;
}
.wpfront-notification-bar-spacer.wpfront-fixed-position
{
z-index: 99999;
}
.wpfront-notification-bar-spacer.hidden
{
display: none;
}
div.wpfront-message p {
margin: 0;
}
@@ -0,0 +1 @@
.wpfront-notification-bar{visibility:hidden;position:fixed;overflow:hidden;left:0;right:0;text-align:center;color:#fff;background-color:#000;z-index:99998}.wpfront-bottom-shadow{-webkit-box-shadow:0 5px 5px 0 rgba(0,0,0,.75);-moz-box-shadow:0 5px 5px 0 rgba(0,0,0,.75);box-shadow:0 5px 5px 0 rgba(0,0,0,.75)}.wpfront-top-shadow{-webkit-box-shadow:0 -5px 5px 0 rgba(0,0,0,.75);-moz-box-shadow:0 -5px 5px 0 rgba(0,0,0,.75);box-shadow:0 -5px 5px 0 rgba(0,0,0,.75)}.wpfront-notification-bar.wpfront-fixed{position:fixed;z-index:99998;width:100%;display:flex;align-content:center;align-items:center;justify-content:center;flex-direction:row}.wpfront-notification-bar.wpfront-fixed-position{z-index:99999}.wpfront-notification-bar.wpfront-fixed.load{visibility:visible;position:relative}.wpfront-notification-bar.top{top:0}.wpfront-notification-bar.bottom{bottom:0}.wpfront-notification-bar.keep-closed,.wpfront-notification-bar.max-views-reached{display:none}.wpfront-notification-bar div.wpfront-close{position:absolute;top:3px;right:5px;cursor:pointer;font-family:Arial,sans-serif;font-weight:700;line-height:0;font-size:10px;padding:5px 2px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.wpfront-notification-bar table,.wpfront-notification-bar tbody,.wpfront-notification-bar tr{margin:auto;border:0;padding:0;background:inherit}.wpfront-notification-bar td{background:inherit;vertical-align:middle;text-align:center;border:0;margin:0;padding:0;line-height:1em}.wpfront-notification-bar div.wpfront-div{display:inline-block;text-align:center;vertical-align:middle;padding:5px 0}.wpfront-notification-bar a.wpfront-button,.wpfront-notification-bar-editor a.wpfront-button{display:inline-block;box-shadow:0 1px 2px rgba(0,0,0,.2);white-space:nowrap;font-size:13px;font-weight:700;text-align:center;text-decoration:none;text-shadow:0 1px 1px rgba(0,0,0,.3);cursor:pointer;padding:5px 10px;margin-left:5px;border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px}.wpfront-notification-bar-open-button{position:absolute;right:10px;z-index:99998;border:3px solid #fff;width:23px;height:30px;cursor:pointer;background-repeat:no-repeat;border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.wpfront-notification-bar-open-button.hidden{display:none}.wpfront-notification-bar-open-button.top{top:0;background-position:top center;border-top:0;-webkit-border-top-right-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:0;-moz-border-radius-topleft:0;border-top-right-radius:0;border-top-left-radius:0}.wpfront-notification-bar-open-button.bottom{bottom:0;background-position:bottom center;border-bottom:0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.wpfront-notification-bar-spacer{position:relative;z-index:99998}.wpfront-notification-bar-spacer.wpfront-fixed-position{z-index:99999}.wpfront-notification-bar-spacer.hidden{display:none}div.wpfront-message p{margin:0}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1,2 @@
<?php
// Silence is golden.
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

@@ -0,0 +1,172 @@
.colorpicker {
width: 356px;
height: 176px;
overflow: hidden;
position: absolute;
background: url(../images/colorpicker_background.png);
font-family: Arial, Helvetica, sans-serif;
display: none;
}
.colorpicker_color {
width: 150px;
height: 150px;
left: 14px;
top: 13px;
position: absolute;
background: #f00;
overflow: hidden;
cursor: crosshair;
}
.colorpicker_color div {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 150px;
background: url(../images/colorpicker_overlay.png);
}
.colorpicker_color div div {
position: absolute;
top: 0;
left: 0;
width: 11px;
height: 11px;
overflow: hidden;
background: url(../images/colorpicker_select.gif);
margin: -5px 0 0 -5px;
}
.colorpicker_hue {
position: absolute;
top: 13px;
left: 171px;
width: 35px;
height: 150px;
cursor: n-resize;
}
.colorpicker_hue div {
position: absolute;
width: 35px;
height: 9px;
overflow: hidden;
background: url(../images/colorpicker_indic.gif) left top;
margin: -4px 0 0 0;
left: 0px;
}
.colorpicker_new_color {
position: absolute;
width: 60px;
height: 30px;
left: 213px;
top: 13px;
background: #f00;
}
.colorpicker_current_color {
position: absolute;
width: 60px;
height: 30px;
left: 283px;
top: 13px;
background: #f00;
}
.colorpicker input {
background-color: transparent;
border: 1px solid transparent;
position: absolute;
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
color: #898989;
top: 4px;
right: 11px;
text-align: right;
margin: 0;
padding: 0;
height: 13px;
outline: none;
}
.colorpicker_hex {
position: absolute;
width: 72px;
height: 22px;
background: url(../images/colorpicker_hex.png) top;
left: 212px;
top: 142px;
}
.colorpicker_hex input {
right: 6px;
}
.colorpicker_field {
height: 22px;
width: 62px;
background-position: top;
position: absolute;
}
.colorpicker_field span {
position: absolute;
width: 12px;
height: 22px;
overflow: hidden;
top: 0;
right: 0;
cursor: n-resize;
}
.colorpicker_rgb_r {
background-image: url(../images/colorpicker_rgb_r.png);
top: 52px;
left: 212px;
}
.colorpicker_rgb_g {
background-image: url(../images/colorpicker_rgb_g.png);
top: 82px;
left: 212px;
}
.colorpicker_rgb_b {
background-image: url(../images/colorpicker_rgb_b.png);
top: 112px;
left: 212px;
}
.colorpicker_hsb_h {
background-image: url(../images/colorpicker_hsb_h.png);
top: 52px;
left: 282px;
}
.colorpicker_hsb_s {
background-image: url(../images/colorpicker_hsb_s.png);
top: 82px;
left: 282px;
}
.colorpicker_hsb_b {
background-image: url(../images/colorpicker_hsb_b.png);
top: 112px;
left: 282px;
}
.colorpicker_submit {
position: absolute;
width: 22px;
height: 22px;
background: url(../images/colorpicker_submit.png) top;
left: 322px;
top: 142px;
overflow: hidden;
}
.colorpicker_focus {
background-position: center;
}
.colorpicker_hex.colorpicker_focus {
background-position: bottom;
}
.colorpicker_submit.colorpicker_focus {
background-position: bottom;
}
.colorpicker_slider {
background-position: bottom;
}
.color-selector
{
display: inline-block;
width: 26px;
height: 26px;
background: url(../images/select2.png) center;
}
@@ -0,0 +1 @@
.colorpicker{width:356px;height:176px;overflow:hidden;position:absolute;background:url(../images/colorpicker_background.png);font-family:Arial,Helvetica,sans-serif;display:none}.colorpicker_color{width:150px;height:150px;left:14px;top:13px;position:absolute;background:red;overflow:hidden;cursor:crosshair}.colorpicker_color div{position:absolute;top:0;left:0;width:150px;height:150px;background:url(../images/colorpicker_overlay.png)}.colorpicker_color div div{position:absolute;top:0;left:0;width:11px;height:11px;overflow:hidden;background:url(../images/colorpicker_select.gif);margin:-5px 0 0 -5px}.colorpicker_hue{position:absolute;top:13px;left:171px;width:35px;height:150px;cursor:n-resize}.colorpicker_hue div{position:absolute;width:35px;height:9px;overflow:hidden;background:url(../images/colorpicker_indic.gif) left top;margin:-4px 0 0 0;left:0}.colorpicker_new_color{position:absolute;width:60px;height:30px;left:213px;top:13px;background:red}.colorpicker_current_color{position:absolute;width:60px;height:30px;left:283px;top:13px;background:red}.colorpicker input{background-color:transparent;border:1px solid transparent;position:absolute;font-size:10px;font-family:Arial,Helvetica,sans-serif;color:#898989;top:4px;right:11px;text-align:right;margin:0;padding:0;height:13px;outline:0}.colorpicker_hex{position:absolute;width:72px;height:22px;background:url(../images/colorpicker_hex.png) top;left:212px;top:142px}.colorpicker_hex input{right:6px}.colorpicker_field{height:22px;width:62px;background-position:top;position:absolute}.colorpicker_field span{position:absolute;width:12px;height:22px;overflow:hidden;top:0;right:0;cursor:n-resize}.colorpicker_rgb_r{background-image:url(../images/colorpicker_rgb_r.png);top:52px;left:212px}.colorpicker_rgb_g{background-image:url(../images/colorpicker_rgb_g.png);top:82px;left:212px}.colorpicker_rgb_b{background-image:url(../images/colorpicker_rgb_b.png);top:112px;left:212px}.colorpicker_hsb_h{background-image:url(../images/colorpicker_hsb_h.png);top:52px;left:282px}.colorpicker_hsb_s{background-image:url(../images/colorpicker_hsb_s.png);top:82px;left:282px}.colorpicker_hsb_b{background-image:url(../images/colorpicker_hsb_b.png);top:112px;left:282px}.colorpicker_submit{position:absolute;width:22px;height:22px;background:url(../images/colorpicker_submit.png) top;left:322px;top:142px;overflow:hidden}.colorpicker_focus{background-position:center}.colorpicker_hex.colorpicker_focus{background-position:bottom}.colorpicker_submit.colorpicker_focus{background-position:bottom}.colorpicker_slider{background-position:bottom}.color-selector{display:inline-block;width:26px;height:26px;background:url(../images/select2.png) center}
Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

@@ -0,0 +1,484 @@
/**
*
* Color picker
* Author: Stefan Petre www.eyecon.ro
*
* Dual licensed under the MIT and GPL licenses
*
*/
(function ($) {
var ColorPicker = function () {
var
ids = {},
inAction,
charMin = 65,
visible,
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
defaults = {
eventName: 'click',
onShow: function () {},
onBeforeShow: function(){},
onHide: function () {},
onChange: function () {},
onSubmit: function () {},
color: 'ff0000',
livePreview: true,
flat: false
},
fillRGBFields = function (hsb, cal) {
var rgb = HSBToRGB(hsb);
$(cal).data('colorpicker').fields
.eq(1).val(rgb.r).end()
.eq(2).val(rgb.g).end()
.eq(3).val(rgb.b).end();
},
fillHSBFields = function (hsb, cal) {
$(cal).data('colorpicker').fields
.eq(4).val(hsb.h).end()
.eq(5).val(hsb.s).end()
.eq(6).val(hsb.b).end();
},
fillHexFields = function (hsb, cal) {
$(cal).data('colorpicker').fields
.eq(0).val(HSBToHex(hsb)).end();
},
setSelector = function (hsb, cal) {
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
$(cal).data('colorpicker').selectorIndic.css({
left: parseInt(150 * hsb.s/100, 10),
top: parseInt(150 * (100-hsb.b)/100, 10)
});
},
setHue = function (hsb, cal) {
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
},
setCurrentColor = function (hsb, cal) {
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
setNewColor = function (hsb, cal) {
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
keyDown = function (ev) {
var pressedKey = ev.charCode || ev.keyCode || -1;
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
return false;
}
var cal = $(this).parent().parent();
if (cal.data('colorpicker').livePreview === true) {
change.apply(this);
}
},
change = function (ev) {
var cal = $(this).parent().parent(), col;
if (this.parentNode.className.indexOf('_hex') > 0) {
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
cal.data('colorpicker').color = col = fixHSB({
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
});
} else {
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
}));
}
if (ev) {
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
}
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
},
blur = function (ev) {
var cal = $(this).parent().parent();
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
},
focus = function () {
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
$(this).parent().addClass('colorpicker_focus');
},
downIncrement = function (ev) {
var field = $(this).parent().find('input').focus();
var current = {
el: $(this).parent().addClass('colorpicker_slider'),
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
y: ev.pageY,
field: field,
val: parseInt(field.val(), 10),
preview: $(this).parent().parent().data('colorpicker').livePreview
};
$(document).bind('mouseup', current, upIncrement);
$(document).bind('mousemove', current, moveIncrement);
},
moveIncrement = function (ev) {
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
if (ev.data.preview) {
change.apply(ev.data.field.get(0), [true]);
}
return false;
},
upIncrement = function (ev) {
change.apply(ev.data.field.get(0), [true]);
ev.data.el.removeClass('colorpicker_slider').find('input').focus();
$(document).unbind('mouseup', upIncrement);
$(document).unbind('mousemove', moveIncrement);
return false;
},
downHue = function (ev) {
var current = {
cal: $(this).parent(),
y: $(this).offset().top
};
current.preview = current.cal.data('colorpicker').livePreview;
$(document).bind('mouseup', current, upHue);
$(document).bind('mousemove', current, moveHue);
},
moveHue = function (ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields
.eq(4)
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upHue = function (ev) {
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
$(document).unbind('mouseup', upHue);
$(document).unbind('mousemove', moveHue);
return false;
},
downSelector = function (ev) {
var current = {
cal: $(this).parent(),
pos: $(this).offset()
};
current.preview = current.cal.data('colorpicker').livePreview;
$(document).bind('mouseup', current, upSelector);
$(document).bind('mousemove', current, moveSelector);
},
moveSelector = function (ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields
.eq(6)
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
.end()
.eq(5)
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upSelector = function (ev) {
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
$(document).unbind('mouseup', upSelector);
$(document).unbind('mousemove', moveSelector);
return false;
},
enterSubmit = function (ev) {
$(this).addClass('colorpicker_focus');
},
leaveSubmit = function (ev) {
$(this).removeClass('colorpicker_focus');
},
clickSubmit = function (ev) {
var cal = $(this).parent();
var col = cal.data('colorpicker').color;
cal.data('colorpicker').origColor = col;
setCurrentColor(col, cal.get(0));
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
},
show = function (ev) {
var cal = $('#' + $(this).data('colorpickerId'));
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
var pos = $(this).offset();
var viewPort = getViewport();
var top = pos.top + this.offsetHeight;
var left = pos.left;
if (top + 176 > viewPort.t + viewPort.h) {
top -= this.offsetHeight + 176;
}
if (left + 356 > viewPort.l + viewPort.w) {
left -= 356;
}
cal.css({left: left + 'px', top: top + 'px'});
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
cal.show();
}
$(document).bind('mousedown', {cal: cal}, hide);
return false;
},
hide = function (ev) {
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
ev.data.cal.hide();
}
$(document).unbind('mousedown', hide);
}
},
isChildOf = function(parentEl, el, container) {
if (parentEl == el) {
return true;
}
if (parentEl.contains) {
return parentEl.contains(el);
}
if ( parentEl.compareDocumentPosition ) {
return !!(parentEl.compareDocumentPosition(el) & 16);
}
var prEl = el.parentNode;
while(prEl && prEl != container) {
if (prEl == parentEl)
return true;
prEl = prEl.parentNode;
}
return false;
},
getViewport = function () {
var m = document.compatMode == 'CSS1Compat';
return {
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
};
},
fixHSB = function (hsb) {
return {
h: Math.min(360, Math.max(0, hsb.h)),
s: Math.min(100, Math.max(0, hsb.s)),
b: Math.min(100, Math.max(0, hsb.b))
};
},
fixRGB = function (rgb) {
return {
r: Math.min(255, Math.max(0, rgb.r)),
g: Math.min(255, Math.max(0, rgb.g)),
b: Math.min(255, Math.max(0, rgb.b))
};
},
fixHex = function (hex) {
var len = 6 - hex.length;
if (len > 0) {
var o = [];
for (var i=0; i<len; i++) {
o.push('0');
}
o.push(hex);
hex = o.join('');
}
return hex;
},
HexToRGB = function (hex) {
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
},
HexToHSB = function (hex) {
return RGBToHSB(HexToRGB(hex));
},
RGBToHSB = function (rgb) {
var hsb = {
h: 0,
s: 0,
b: 0
};
var min = Math.min(rgb.r, rgb.g, rgb.b);
var max = Math.max(rgb.r, rgb.g, rgb.b);
var delta = max - min;
hsb.b = max;
if (max != 0) {
}
hsb.s = max != 0 ? 255 * delta / max : 0;
if (hsb.s != 0) {
if (rgb.r == max) {
hsb.h = (rgb.g - rgb.b) / delta;
} else if (rgb.g == max) {
hsb.h = 2 + (rgb.b - rgb.r) / delta;
} else {
hsb.h = 4 + (rgb.r - rgb.g) / delta;
}
} else {
hsb.h = -1;
}
hsb.h *= 60;
if (hsb.h < 0) {
hsb.h += 360;
}
hsb.s *= 100/255;
hsb.b *= 100/255;
return hsb;
},
HSBToRGB = function (hsb) {
var rgb = {};
var h = Math.round(hsb.h);
var s = Math.round(hsb.s*255/100);
var v = Math.round(hsb.b*255/100);
if(s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255-s)*v/255;
var t3 = (t1-t2)*(h%60)/60;
if(h==360) h = 0;
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
else {rgb.r=0; rgb.g=0; rgb.b=0}
}
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
},
RGBToHex = function (rgb) {
var hex = [
rgb.r.toString(16),
rgb.g.toString(16),
rgb.b.toString(16)
];
$.each(hex, function (nr, val) {
if (val.length == 1) {
hex[nr] = '0' + val;
}
});
return hex.join('');
},
HSBToHex = function (hsb) {
return RGBToHex(HSBToRGB(hsb));
},
restoreOriginal = function () {
var cal = $(this).parent();
var col = cal.data('colorpicker').origColor;
cal.data('colorpicker').color = col;
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
};
return {
init: function (opt) {
opt = $.extend({}, defaults, opt||{});
if (typeof opt.color == 'string') {
opt.color = HexToHSB(opt.color);
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
opt.color = RGBToHSB(opt.color);
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
opt.color = fixHSB(opt.color);
} else {
return this;
}
return this.each(function () {
if (!$(this).data('colorpickerId')) {
var options = $.extend({}, opt);
options.origColor = opt.color;
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
$(this).data('colorpickerId', id);
var cal = $(tpl).attr('id', id);
if (options.flat) {
cal.appendTo(this).show();
} else {
cal.appendTo(document.body);
}
options.fields = cal
.find('input')
.bind('keyup', keyDown)
.bind('change', change)
.bind('blur', blur)
.bind('focus', focus);
cal
.find('span').bind('mousedown', downIncrement).end()
.find('>div.colorpicker_current_color').bind('click', restoreOriginal);
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
options.selectorIndic = options.selector.find('div div');
options.el = this;
options.hue = cal.find('div.colorpicker_hue div');
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
options.newColor = cal.find('div.colorpicker_new_color');
options.currentColor = cal.find('div.colorpicker_current_color');
cal.data('colorpicker', options);
cal.find('div.colorpicker_submit')
.bind('mouseenter', enterSubmit)
.bind('mouseleave', leaveSubmit)
.bind('click', clickSubmit);
fillRGBFields(options.color, cal.get(0));
fillHSBFields(options.color, cal.get(0));
fillHexFields(options.color, cal.get(0));
setHue(options.color, cal.get(0));
setSelector(options.color, cal.get(0));
setCurrentColor(options.color, cal.get(0));
setNewColor(options.color, cal.get(0));
if (options.flat) {
cal.css({
position: 'relative',
display: 'block'
});
} else {
$(this).bind(options.eventName, show);
}
}
});
},
showPicker: function() {
return this.each( function () {
if ($(this).data('colorpickerId')) {
show.apply(this);
}
});
},
hidePicker: function() {
return this.each( function () {
if ($(this).data('colorpickerId')) {
$('#' + $(this).data('colorpickerId')).hide();
}
});
},
setColor: function(col) {
if (typeof col == 'string') {
col = HexToHSB(col);
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
col = RGBToHSB(col);
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
col = fixHSB(col);
} else {
return this;
}
return this.each(function(){
if ($(this).data('colorpickerId')) {
var cal = $('#' + $(this).data('colorpickerId'));
cal.data('colorpicker').color = col;
cal.data('colorpicker').origColor = col;
fillRGBFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
setHue(col, cal.get(0));
setSelector(col, cal.get(0));
setCurrentColor(col, cal.get(0));
setNewColor(col, cal.get(0));
}
});
}
};
}();
$.fn.extend({
ColorPicker: ColorPicker.init,
ColorPickerHide: ColorPicker.hidePicker,
ColorPickerShow: ColorPicker.showPicker,
ColorPickerSetColor: ColorPicker.setColor
});
})(jQuery)
@@ -0,0 +1,19 @@
(function(c){var e=function(){var e=65,H={eventName:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},color:"ff0000",livePreview:!0,flat:!1},l=function(a,b){a=h(a);c(b).data("colorpicker").fields.eq(1).val(a.r).end().eq(2).val(a.g).end().eq(3).val(a.b).end()},r=function(a,b){c(b).data("colorpicker").fields.eq(4).val(a.h).end().eq(5).val(a.s).end().eq(6).val(a.b).end()},n=function(a,b){c(b).data("colorpicker").fields.eq(0).val(m(h(a))).end()},
t=function(a,b){c(b).data("colorpicker").selector.css("backgroundColor","#"+m(h({h:a.h,s:100,b:100})));c(b).data("colorpicker").selectorIndic.css({left:parseInt(150*a.s/100,10),top:parseInt(150*(100-a.b)/100,10)})},u=function(a,b){c(b).data("colorpicker").hue.css("top",parseInt(150-150*a.h/360,10))},w=function(a,b){c(b).data("colorpicker").currentColor.css("backgroundColor","#"+m(h(a)))},v=function(a,b){c(b).data("colorpicker").newColor.css("backgroundColor","#"+m(h(a)))},I=function(a){a=a.charCode||
a.keyCode||-1;if(a>e&&90>=a||32==a)return!1;!0===c(this).parent().parent().data("colorpicker").livePreview&&p.apply(this)},p=function(a){var b=c(this).parent().parent();if(0<this.parentNode.className.indexOf("_hex")){var d=b.data("colorpicker");var g=this.value,f=6-g.length;if(0<f){for(var k=[],e=0;e<f;e++)k.push("0");k.push(g);g=k.join("")}d.color=d=q(x(g))}else 0<this.parentNode.className.indexOf("_hsb")?b.data("colorpicker").color=d=y({h:parseInt(b.data("colorpicker").fields.eq(4).val(),10),s:parseInt(b.data("colorpicker").fields.eq(5).val(),
10),b:parseInt(b.data("colorpicker").fields.eq(6).val(),10)}):(d=b.data("colorpicker"),g=parseInt(b.data("colorpicker").fields.eq(1).val(),10),f=parseInt(b.data("colorpicker").fields.eq(2).val(),10),k=parseInt(b.data("colorpicker").fields.eq(3).val(),10),d.color=d=q({r:Math.min(255,Math.max(0,g)),g:Math.min(255,Math.max(0,f)),b:Math.min(255,Math.max(0,k))}));a&&(l(d,b.get(0)),n(d,b.get(0)),r(d,b.get(0)));t(d,b.get(0));u(d,b.get(0));v(d,b.get(0));b.data("colorpicker").onChange.apply(b,[d,m(h(d)),h(d)])},
J=function(a){c(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus")},K=function(){e=0<this.parentNode.className.indexOf("_hex")?70:65;c(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus");c(this).parent().addClass("colorpicker_focus")},L=function(a){var b=c(this).parent().find("input").focus();a={el:c(this).parent().addClass("colorpicker_slider"),max:0<this.parentNode.className.indexOf("_hsb_h")?360:0<this.parentNode.className.indexOf("_hsb")?
100:255,y:a.pageY,field:b,val:parseInt(b.val(),10),preview:c(this).parent().parent().data("colorpicker").livePreview};c(document).bind("mouseup",a,z);c(document).bind("mousemove",a,A)},A=function(a){a.data.field.val(Math.max(0,Math.min(a.data.max,parseInt(a.data.val+a.pageY-a.data.y,10))));a.data.preview&&p.apply(a.data.field.get(0),[!0]);return!1},z=function(a){p.apply(a.data.field.get(0),[!0]);a.data.el.removeClass("colorpicker_slider").find("input").focus();c(document).unbind("mouseup",z);c(document).unbind("mousemove",
A);return!1},M=function(a){a={cal:c(this).parent(),y:c(this).offset().top};a.preview=a.cal.data("colorpicker").livePreview;c(document).bind("mouseup",a,B);c(document).bind("mousemove",a,C)},C=function(a){p.apply(a.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360*(150-Math.max(0,Math.min(150,a.pageY-a.data.y)))/150,10)).get(0),[a.data.preview]);return!1},B=function(a){l(a.data.cal.data("colorpicker").color,a.data.cal.get(0));n(a.data.cal.data("colorpicker").color,a.data.cal.get(0));c(document).unbind("mouseup",
B);c(document).unbind("mousemove",C);return!1},N=function(a){a={cal:c(this).parent(),pos:c(this).offset()};a.preview=a.cal.data("colorpicker").livePreview;c(document).bind("mouseup",a,D);c(document).bind("mousemove",a,E)},E=function(a){p.apply(a.data.cal.data("colorpicker").fields.eq(6).val(parseInt(100*(150-Math.max(0,Math.min(150,a.pageY-a.data.pos.top)))/150,10)).end().eq(5).val(parseInt(100*Math.max(0,Math.min(150,a.pageX-a.data.pos.left))/150,10)).get(0),[a.data.preview]);return!1},D=function(a){l(a.data.cal.data("colorpicker").color,
a.data.cal.get(0));n(a.data.cal.data("colorpicker").color,a.data.cal.get(0));c(document).unbind("mouseup",D);c(document).unbind("mousemove",E);return!1},O=function(a){c(this).addClass("colorpicker_focus")},P=function(a){c(this).removeClass("colorpicker_focus")},Q=function(a){a=c(this).parent();var b=a.data("colorpicker").color;a.data("colorpicker").origColor=b;w(b,a.get(0));a.data("colorpicker").onSubmit(b,m(h(b)),h(b),a.data("colorpicker").el)},G=function(a){var b=c("#"+c(this).data("colorpickerId"));
b.data("colorpicker").onBeforeShow.apply(this,[b.get(0)]);var d=c(this).offset(),g="CSS1Compat"==document.compatMode;a=window.pageXOffset||(g?document.documentElement.scrollLeft:document.body.scrollLeft);var f=window.pageYOffset||(g?document.documentElement.scrollTop:document.body.scrollTop);var k=window.innerWidth||(g?document.documentElement.clientWidth:document.body.clientWidth);var e=d.top+this.offsetHeight;d=d.left;e+176>f+(window.innerHeight||(g?document.documentElement.clientHeight:document.body.clientHeight))&&
(e-=this.offsetHeight+176);d+356>a+k&&(d-=356);b.css({left:d+"px",top:e+"px"});0!=b.data("colorpicker").onShow.apply(this,[b.get(0)])&&b.show();c(document).bind("mousedown",{cal:b},F);return!1},F=function(a){R(a.data.cal.get(0),a.target,a.data.cal.get(0))||(0!=a.data.cal.data("colorpicker").onHide.apply(this,[a.data.cal.get(0)])&&a.data.cal.hide(),c(document).unbind("mousedown",F))},R=function(a,b,d){if(a==b)return!0;if(a.contains)return a.contains(b);if(a.compareDocumentPosition)return!!(a.compareDocumentPosition(b)&
16);for(b=b.parentNode;b&&b!=d;){if(b==a)return!0;b=b.parentNode}return!1},y=function(a){return{h:Math.min(360,Math.max(0,a.h)),s:Math.min(100,Math.max(0,a.s)),b:Math.min(100,Math.max(0,a.b))}},x=function(a){a=parseInt(-1<a.indexOf("#")?a.substring(1):a,16);return{r:a>>16,g:(a&65280)>>8,b:a&255}},q=function(a){var b={h:0,s:0,b:0},d=Math.max(a.r,a.g,a.b),c=d-Math.min(a.r,a.g,a.b);b.b=d;b.s=0!=d?255*c/d:0;b.h=0!=b.s?a.r==d?(a.g-a.b)/c:a.g==d?2+(a.b-a.r)/c:4+(a.r-a.g)/c:-1;b.h*=60;0>b.h&&(b.h+=360);
b.s*=100/255;b.b*=100/255;return b},h=function(a){var b,d;var c=Math.round(a.h);var f=Math.round(255*a.s/100);a=Math.round(255*a.b/100);if(0==f)c=b=d=a;else{f=(255-f)*a/255;var e=c%60*(a-f)/60;360==c&&(c=0);60>c?(c=a,d=f,b=f+e):120>c?(b=a,d=f,c=a-e):180>c?(b=a,c=f,d=f+e):240>c?(d=a,c=f,b=a-e):300>c?(d=a,b=f,c=f+e):360>c?(c=a,b=f,d=a-e):d=b=c=0}return{r:Math.round(c),g:Math.round(b),b:Math.round(d)}},m=function(a){var b=[a.r.toString(16),a.g.toString(16),a.b.toString(16)];c.each(b,function(a,c){1==
c.length&&(b[a]="0"+c)});return b.join("")},S=function(){var a=c(this).parent(),b=a.data("colorpicker").origColor;a.data("colorpicker").color=b;l(b,a.get(0));n(b,a.get(0));r(b,a.get(0));t(b,a.get(0));u(b,a.get(0));v(b,a.get(0))};return{init:function(a){a=c.extend({},H,a||{});if("string"==typeof a.color)a.color=q(x(a.color));else if(void 0!=a.color.r&&void 0!=a.color.g&&void 0!=a.color.b)a.color=q(a.color);else if(void 0!=a.color.h&&void 0!=a.color.s&&void 0!=a.color.b)a.color=y(a.color);else return this;
return this.each(function(){if(!c(this).data("colorpickerId")){var b=c.extend({},a);b.origColor=a.color;var d="collorpicker_"+parseInt(1E3*Math.random());c(this).data("colorpickerId",d);d=c('<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>').attr("id",
d);b.flat?d.appendTo(this).show():d.appendTo(document.body);b.fields=d.find("input").bind("keyup",I).bind("change",p).bind("blur",J).bind("focus",K);d.find("span").bind("mousedown",L).end().find(">div.colorpicker_current_color").bind("click",S);b.selector=d.find("div.colorpicker_color").bind("mousedown",N);b.selectorIndic=b.selector.find("div div");b.el=this;b.hue=d.find("div.colorpicker_hue div");d.find("div.colorpicker_hue").bind("mousedown",M);b.newColor=d.find("div.colorpicker_new_color");b.currentColor=
d.find("div.colorpicker_current_color");d.data("colorpicker",b);d.find("div.colorpicker_submit").bind("mouseenter",O).bind("mouseleave",P).bind("click",Q);l(b.color,d.get(0));r(b.color,d.get(0));n(b.color,d.get(0));u(b.color,d.get(0));t(b.color,d.get(0));w(b.color,d.get(0));v(b.color,d.get(0));b.flat?d.css({position:"relative",display:"block"}):c(this).bind(b.eventName,G)}})},showPicker:function(){return this.each(function(){c(this).data("colorpickerId")&&G.apply(this)})},hidePicker:function(){return this.each(function(){c(this).data("colorpickerId")&&
c("#"+c(this).data("colorpickerId")).hide()})},setColor:function(a){if("string"==typeof a)a=q(x(a));else if(void 0!=a.r&&void 0!=a.g&&void 0!=a.b)a=q(a);else if(void 0!=a.h&&void 0!=a.s&&void 0!=a.b)a=y(a);else return this;return this.each(function(){if(c(this).data("colorpickerId")){var b=c("#"+c(this).data("colorpickerId"));b.data("colorpicker").color=a;b.data("colorpicker").origColor=a;l(a,b.get(0));r(a,b.get(0));n(a,b.get(0));u(a,b.get(0));t(a,b.get(0));w(a,b.get(0));v(a,b.get(0))}})}}}();c.fn.extend({ColorPicker:e.init,
ColorPickerHide:e.hidePicker,ColorPickerShow:e.showPicker,ColorPickerSetColor:e.setColor})})(jQuery);
@@ -0,0 +1,2 @@
<?php
// Silence is golden.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
/**
* Original file: /npm/js-cookie@2.2.1/src/js.cookie.js
*/
!function(e){var n;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var t=window.Cookies,o=window.Cookies=e();o.noConflict=function(){return window.Cookies=t,o}}}(function(){function e(){for(var e=0,n={};e<arguments.length;e++){var t=arguments[e];for(var o in t)n[o]=t[o]}return n}function n(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function t(o){function r(){}function i(n,t,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},r.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var c=JSON.stringify(t);/^[\{\[]/.test(c)&&(t=c)}catch(e){}t=o.write?o.write(t,n):encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=encodeURIComponent(String(n)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var f="";for(var u in i)i[u]&&(f+="; "+u,!0!==i[u]&&(f+="="+i[u].split(";")[0]));return document.cookie=n+"="+t+f}}function c(e,t){if("undefined"!=typeof document){for(var r={},i=document.cookie?document.cookie.split("; "):[],c=0;c<i.length;c++){var f=i[c].split("="),u=f.slice(1).join("=");t||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var a=n(f[0]);if(u=(o.read||o)(u,a)||n(u),t)try{u=JSON.parse(u)}catch(e){}if(r[a]=u,e===a)break}catch(e){}}return e?r[e]:r}}return r.set=i,r.get=function(e){return c(e,!1)},r.getJSON=function(e){return c(e,!0)},r.remove=function(n,t){i(n,"",e(t,{expires:-1}))},r.defaults={},r.withConverter=t,r}(function(){})});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
.ui-timepicker-wrapper{background:#fff;border:1px solid #ddd;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);margin:0;max-height:150px;outline:none;overflow-y:auto;width:6.5em;z-index:10052}.ui-timepicker-wrapper.ui-timepicker-with-duration{width:13em}.ui-timepicker-wrapper.ui-timepicker-with-duration.ui-timepicker-step-30,.ui-timepicker-wrapper.ui-timepicker-with-duration.ui-timepicker-step-60{width:11em}.ui-timepicker-list{list-style:none;margin:0;padding:0}.ui-timepicker-duration{color:#888;margin-left:5px}.ui-timepicker-list:hover .ui-timepicker-duration{color:#888}.ui-timepicker-list li{color:#000;cursor:pointer;list-style:none;margin:0;padding:3px 0 3px 5px;white-space:nowrap}.ui-timepicker-list:hover .ui-timepicker-selected{background:#fff;color:#000}.ui-timepicker-list .ui-timepicker-selected:hover,.ui-timepicker-list li:hover,li.ui-timepicker-selected{background:#1980ec;color:#fff}.ui-timepicker-list li:hover .ui-timepicker-duration,li.ui-timepicker-selected .ui-timepicker-duration{color:#ccc}.ui-timepicker-list li.ui-timepicker-disabled,.ui-timepicker-list li.ui-timepicker-disabled:hover,.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled{color:#888;cursor:default}.ui-timepicker-list li.ui-timepicker-disabled:hover,.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled{background:#f2f2f2}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
<?php
// Silence is golden.
@@ -0,0 +1,347 @@
(function () {
window.init_wpfront_notifiction_bar_options = function (data, settings, is_pro) {
var $ = jQuery;
var app = Vue.createApp({
data() {
return data;
},
mounted() {
var $div = $('div.wrap.notification-bar-add-edit');
$(function () {
$div.find('.if-js-closed').removeClass('if-js-closed').addClass('closed');
postboxes.add_postbox_toggles('<?php echo $this->controller->get_menu_slug(); ?>');
});
this.minutestohours();
if (is_pro) {
this.tinymce();
if (data.editor == "visual") {
this.tinymceinit();
}
}
},
methods: {
tinymceinit() {
if (typeof tinymce !== 'undefined') {
tinymce.init({
body_id: "wpfront-notification-bar-editor",
body_class: "wpfront-notification-bar-editor wpfront-message",
selector: 'textarea#notification-bar-message-text',
height: '400',
plugins: 'code, lists, link, fullscreen, image, media, quickbars, hr',
quickbars_selection_toolbar: 'bold italic underline | formatselect | blockquote quicklink',
menubar: false,
media_live_embeds: true,
content_css: settings.content_css,
content_style: "body{ text-align: center; padding: 0; margin: 0; } p{ margin: 0; }",
toolbar1: 'undo redo | styleselect | fontselect fontsizeselect forecolor backcolor | numlist bullist | bold italic strikethrough blockquote underline lineheight hr | code',
toolbar2: 'alignleft aligncenter alignright | link unlink | outdent indent | uploadmedia image media',
fontsize_formats: settings.fontsize_formats,
font_formats: settings.font_formats,
setup: function (editor) {
var frame;
editor.ui.registry.addButton('uploadmedia', {
icon: 'upload',
tooltip: settings.tinymce_tooltip,
onAction: function () {
if (frame) {
frame.open();
return;
}
frame = wp.media({
title: settings.tinymce_title,
button: {
text: settings.tinymce_button_text,
},
multiple: false
});
frame.on('select', function () {
var attachment = frame.state().get('selection').first().toJSON();
var media_file;
if (attachment.type == 'image') {
media_file = '<img width="' + attachment.width + '" height="' + attachment.height + '"' + 'src="' + attachment.url + '">';
} else if (attachment.type == 'video') {
media_file = '<video width="320" height="240" controls>' + '<source src="' + attachment.url + '" type="video/mp4">' + '</video>';
} else {
media_file = '<a href="' + attachment.url + '">' + attachment.name + '</a>';
}
editor.execCommand('mceInsertContent', false, media_file);
});
frame.open();
}
});
}
});
} else {
var self = this;
setTimeout(function(){ self.tinymceinit() }, 100);
}
},
tinymce(){
},
mediaLibrary() {
var mediaLibrary = null;
if (mediaLibrary === null) {
mediaLibrary = wp.media.frames.file_frame = wp.media({
title: settings.choose_image,
multiple: false,
button: {
text: settings.select_image
}
}).on('select', function () {
var obj = mediaLibrary.state().get('selection').first().toJSON();
$('#reopen-button-image-url').val(obj.url);
});
}
mediaLibrary.open();
return false;
},
minutestohours() {
var duration = parseInt($('input[name="wpfront-notification-bar-options[schedule_duration]"]').val());
if (duration > 60) {
var hours = (duration / 60);
var comp_hours = Math.floor(hours);
var minutes = (hours - comp_hours) * 60;
var comp_minutes = Math.round(minutes);
var hours_minutes;
if (comp_minutes > 0) {
hours_minutes = settings.x_hours_minutes.replace("%1$d", comp_hours).replace("%2$d", comp_minutes);
} else {
hours_minutes = settings.x_hours.replace("%1$d", comp_hours);
}
$('#schedule_duration').replaceWith('<span id="schedule_duration" class="description">= ' + hours_minutes + '</span>');
} else {
$('#schedule_duration').replaceWith('<span id="schedule_duration" class="description"></span>');
}
},
schedules() {
var cronminutes = [];
var cronhours = [];
var cronmday = [];
var cronmon = [];
var cronwday = [];
var schedule_date = $('input[name="wpfront-notification-bar-options[schedule_start_date]"]').val();
var schedule_time = $('input[name="wpfront-notification-bar-options[schedule_start_time]"]').val();
var schedule_end_date = $('input[name="wpfront-notification-bar-options[schedule_end_date]"]').val();
var schedule_end_time = $('input[name="wpfront-notification-bar-options[schedule_end_time]"]').val();
var schedule_duration = $('input[name="wpfront-notification-bar-options[schedule_duration]"]').val();
if ('day' == $('input[name="wpfront-notification-bar-options[schedule]"]:checked').val()) {
$("input:checkbox[name='wpfront-day-minutes[]']:checked").each(function () {
cronminutes.push($(this).val());
});
$("input:checkbox[name='wpfront-day-hour[]']:checked").each(function () {
cronhours.push($(this).val());
});
cronmday.push('*');
cronmon.push('*');
cronwday.push('*');
}
if ('week' == $('input[name="wpfront-notification-bar-options[schedule]"]:checked').val()) {
$("input:checkbox[name='wpfront-day-minutes[]']:checked").each(function () {
cronminutes.push($(this).val());
});
$("input:checkbox[name='wpfront-day-hour[]']:checked").each(function () {
cronhours.push($(this).val());
});
cronmday.push('*');
cronmon.push('*');
$("input:checkbox[name='wpfront-week-days[]']:checked").each(function () {
cronwday.push($(this).val());
});
}
if ('mon' == $('input[name="wpfront-notification-bar-options[schedule]"]:checked').val()) {
$("input:checkbox[name='wpfront-day-minutes[]']:checked").each(function () {
cronminutes.push($(this).val());
});
$("input:checkbox[name='wpfront-day-hour[]']:checked").each(function () {
cronhours.push($(this).val());
});
$("input:checkbox[name='wpfront-month-days[]']:checked").each(function () {
cronmday.push($(this).val());
});
cronmon.push('*');
cronwday.push('*');
}
var data = {
action: 'notification_bar_cron_text',
cronminutes: cronminutes,
cronhours: cronhours,
cronmday: cronmday,
cronmon: cronmon,
cronwday: cronwday,
schedulestartdate: schedule_date,
schedulestarttime: schedule_time,
scheduleduration: schedule_duration,
scheduleenddate: schedule_end_date,
scheduleendtime: schedule_end_time
};
var loading = $("a.thickbox.more_schedules").attr("data-action");
$("#div_more_schedules_inside").text(loading);
$.post(ajaxurl, data, function (response) {
$('#notification-bar-schedule').replaceWith(response.data[0]);
$("#div_more_schedules_inside").replaceWith(response.data[1]);
});
}
},
});
app.component('HelpIcon', {
props: ['helpText'],
template: '<el-tooltip :content="helpText" raw-content="true" placement="right"><i class="tooltip fa fa-question-circle-o help-icon"></i></el-tooltip>'
});
app.component('ColorPicker', {
props: ['modelValue', 'name'],
template: $('#color-picker').html(),
});
app.component('PostsFilterSelection', {
props: ['modelValue', 'name'],
template: $('#posts-filter-selection').html(),
computed: {
selectedPosts: {
get() {
return this.modelValue.split(',');
},
set(values) {
this.$emit('update:modelValue', values.filter(e => e).join().trim());
}
}
}
});
app.component('DisplayRolesSettings', {
props: ['modelValue', 'name'],
template: $('#display-roles-settings').html(),
computed: {
selectedRoles: {
get() {
return this.modelValue;
},
set(values) {
this.$emit('update:modelValue', values);
}
}
}
});
app.component('DatePicker', {
props: ['modelValue', 'name'],
data: function () {
return { data: this.modelValue }
},
template: $('#date-picker').html(),
});
app.component('TimePicker', {
props: ['modelValue', 'name'],
data: function () {
return { data: this.modelValue }
},
template: $('#time-picker').html(),
});
app.component('ScheduleSelectionSettings', {
props: ['modelValue'],
template: $('#schedule-selection-settings').html(),
data() {
data.scheduleType = this.scheduledata();
return data;
},
methods: {
schedules() {
this.$parent.schedules();
},
scheduledata() {
$time_units = data.schedule.split(' ');
$minutes = $time_units[0].split(',');
$hours = $time_units[1].split(',');
$month_days = $time_units[2].split(',');
$month = $time_units[3].split(',');
$week_days = $time_units[4].split(',');
if (!isNaN($month_days[0]) || ($month_days[0] == "L")) {
$schedule_type = "mon";
}
if (!isNaN($week_days[0])) {
$schedule_type = "week";
}
if ($month_days[0] + $week_days[0] == '**') {
$schedule_type = 'day';
}
return $schedule_type;
}
},
computed: {
selectedMonthDays: {
get() {
$time_units = this.modelValue.split(' ');
$month_days = $time_units[2].split(',');
return $month_days;
},
set(values) {
this.$emit('input', values);
}
},
selectedWeekDays: {
get() {
$time_units = this.modelValue.split(' ');
$week_days = $time_units[4].split(',');
return $week_days;
},
set(values) {
this.$emit('input', values);
}
},
selectedHours: {
get() {
$time_units = this.modelValue.split(' ');
$hours = $time_units[1].split(',');
return $hours;
},
set(values) {
this.$emit('input', values);
}
},
selectedMinutes: {
get() {
$time_units = this.modelValue.split(' ');
$minutes = $time_units[0].split(',');
return $minutes;
},
set(values) {
this.$emit('input', values);
}
}
}
});
app.use(ElementPlus);
app.mount('#notification-bar-add-edit');
};
})();
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,354 @@
/*
WPFront Notification Bar Plugin
Copyright (C) 2013, WPFront.com
Website: wpfront.com
Contact: syam@wpfront.com
WPFront Notification Bar Plugin is distributed under the GNU General Public License, Version 3,
June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
*/
(function () {
//displays the notification bar
window.wpfront_notification_bar = function (data, process) {
var log = function (msg) {
if (data.log) {
console.log(data.log_prefix + ' ' + msg);
}
};
if (typeof jQuery === "undefined" || (data.keep_closed && typeof Cookies === "undefined") || (data.set_max_views && typeof Cookies === "undefined")) {
log('Waiting for ' + (typeof jQuery === "undefined" ? 'jQuery.' : 'Cookies.'));
setTimeout(function () {
wpfront_notification_bar(data, process);
}, 100);
return;
}
if (data.position == 2 && process !== true) {
jQuery(function () {
wpfront_notification_bar(data, true);
});
return;
}
var get_element_id = function (id) {
return id + data.id_suffix;
}
var $ = jQuery;
var keep_closed_cookie = data.keep_closed_cookie;
var bar_views = 0;
var max_views_cookie = data.max_views_cookie;
var spacer = $(get_element_id("#wpfront-notification-bar-spacer")).removeClass('hidden');
var bar = $(get_element_id("#wpfront-notification-bar"));
var open_button = $(get_element_id("#wpfront-notification-bar-open-button"));
//set the position
if (data.position == 1) {
log('Setting notification bar at top.');
var top = 0;
if (data.fixed_position && data.is_admin_bar_showing) {
top = $("html").css("margin-top");
if (top == "0px")
top = $("html").css("padding-top");
top = parseInt(top);
}
if (data.fixed_position) {
top += data.position_offset;
}
bar.css("top", top + "px");
open_button.css("top", top + "px");
spacer.css("top", data.position_offset + "px");
var $body = $("body")
var $firstChild = $body.children().first();
if ($firstChild.hasClass("wpfront-notification-bar-spacer")) {
while (true) {
var $next = $firstChild.next();
if ($next.hasClass("wpfront-notification-bar-spacer")) {
$firstChild = $next;
} else {
$firstChild.after(spacer);
break;
}
}
} else {
$body.prepend(spacer);
}
$(function () {
if ($body.children().first().hasClass("wpfront-notification-bar-spacer")) {
return;
}
if (data.fixed_position && !$body.children().first().is(spacer)) {
$body.prepend(spacer);
}
});
} else {
log('Setting notification bar at bottom.');
var $body = $("body");
if (!$body.children().last().is(spacer)) {
$body.append(spacer);
}
$(function () {
if (!$body.children().last().is(spacer)) {
$body.append(spacer);
}
});
}
var height = bar.height();
if (data.height > 0) {
height = data.height;
bar.find("table, tbody, tr").css("height", "100%");
}
bar.height(0).css({"position": (data.fixed_position ? "fixed" : "relative"), "visibility": "visible"});
open_button.css({"position": (data.fixed_position ? "fixed" : "absolute")});
//function to set bar height based on options
var closed = false;
var user_closed = false;
function setHeight(height, callback, userclosed) {
callback = callback || $.noop;
if (userclosed)
user_closed = true;
if (height == 0) {
if (closed)
return;
closed = true;
} else {
if (!closed)
return;
closed = false;
}
if (height == 0 && data.keep_closed && userclosed) {
if (data.keep_closed_for > 0)
Cookies.set(keep_closed_cookie, 1, {path: "/", expires: data.keep_closed_for, sameSite: "strict"});
else
Cookies.set(keep_closed_cookie, 1, {path: "/", sameSite: "strict"});
}
if (height !== 0 && data.set_max_views) {
bar_views = Cookies.get(max_views_cookie);
if (typeof bar_views === "undefined") {
bar_views = 0;
} else {
bar_views = parseInt(bar_views);
}
if (data.max_views_for > 0) {
Cookies.set(max_views_cookie, bar_views + 1, {path: "/", expires: data.max_views_for, sameSite: "strict"});
} else {
Cookies.set(max_views_cookie, bar_views + 1, {path: "/", sameSite: "strict"});
}
log('Setting view count to ' + (bar_views + 1) + '.');
}
var fn = callback;
callback = function () {
fn();
if (height > 0) {
//set height to auto if in case content wraps on resize
if (data.height == 0)
bar.height("auto");
if (data.display_open_button) {
log('Setting reopen button state to hidden.');
open_button.addClass('hidden');
}
closed = false;
}
if (height == 0 && data.display_open_button) {
log('Setting reopen button state to visible.');
open_button.removeClass('hidden');
}
if(height > 0){
bar.removeClass('hidden');
} else {
bar.addClass('hidden');
}
};
//set animation
if (height > 0)
log('Setting notification bar state to visible.');
else
log('Setting notification bar state to hidden.');
if (data.animate_delay > 0) {
bar.stop().show().animate({"height": height + "px"}, {
"duration": data.animate_delay * 1000,
"easing": "swing",
"complete": function () {
if (data.fixed_position) {
spacer.height(height);
}
handle_theme_sticky(height);
callback();
},
"step": function (progress) {
if (data.fixed_position) {
spacer.height(progress);
}
handle_theme_sticky(progress);
}
});
} else {
bar.height(height);
if (data.fixed_position) {
spacer.height(height);
}
handle_theme_sticky(height);
callback();
}
}
var theme_sticky_selector_position = null;
var theme_sticky_interval_id = 0;
var handle_theme_sticky_needed = data.fixed_position && data.theme_sticky_selector != "";
function handle_theme_sticky(recursive) {
if (!handle_theme_sticky_needed) {
return 0;
}
if (recursive !== true) {
clearInterval(theme_sticky_interval_id);
var intervalCount = 0;
theme_sticky_interval_id = setInterval(function () {
handle_theme_sticky(true);
intervalCount++;
if (intervalCount > 100) {
clearInterval(theme_sticky_interval_id);
return;
}
}, 10);
}
var $theme_sticky_selector = $(data.theme_sticky_selector);
if ($theme_sticky_selector.length == 0 || $theme_sticky_selector.css('position') !== 'fixed') {
return 0;
}
if (data.position == 1) {
if (theme_sticky_selector_position === null) {
theme_sticky_selector_position = $theme_sticky_selector.position().top;
}
if (bar.is(":visible")) {
$theme_sticky_selector.css("top", (bar.height() + bar.position().top) + "px");
} else {
$theme_sticky_selector.css("top", theme_sticky_selector_position + "px");
}
}
if (data.position == 2) {
if (theme_sticky_selector_position === null) {
theme_sticky_selector_position = $theme_sticky_selector.height() + parseFloat($theme_sticky_selector.css("bottom"));
}
if (bar.is(":visible")) {
$theme_sticky_selector.css("bottom", (bar.height() + parseFloat(bar.css("bottom"))) + "px");
} else {
$theme_sticky_selector.css("bottom", theme_sticky_selector_position + "px");
}
}
}
if (handle_theme_sticky_needed) {
$(window).on("scroll resize", function () {
handle_theme_sticky();
});
}
if (data.close_button) {
spacer.on('click', '.wpfront-close', function () {
setHeight(0, null, true);
});
}
//close button action
if (data.button_action_close_bar) {
spacer.on('click', '.wpfront-button', function () {
setHeight(0, null, true);
});
}
if (data.display_open_button) {
spacer.on('click', get_element_id('#wpfront-notification-bar-open-button'), function () {
setHeight(height);
});
}
if (data.keep_closed) {
if (Cookies.get(keep_closed_cookie)) {
log('Keep closed enabled and keep closed cookie exists. Hiding notification bar.');
setHeight(0, function(){
bar.removeClass('keep-closed');
});
return;
}
}
bar.removeClass('keep-closed');
if (data.set_max_views) {
bar_views = Cookies.get(max_views_cookie);
if (typeof bar_views === "undefined") {
bar_views = 0;
}
if (bar_views >= data.max_views) {
log('Reached max views, hiding notification bar.');
setHeight(0, function(){
bar.removeClass('max-views-reached');
});
return;
}
}
bar.removeClass('max-views-reached');
closed = true;
if (data.display_scroll) {
log('Display on scroll enabled. Hiding notification bar.');
setHeight(0);
$(window).on('scroll', function () {
if (user_closed)
return;
if ($(this).scrollTop() > data.display_scroll_offset) {
setHeight(height);
} else {
setHeight(0);
}
});
} else {
//set open after seconds and auto close seconds.
log('Setting notification bar open event after ' + data.display_after + ' second(s).');
setTimeout(function () {
setHeight(height, function () {
if (data.auto_close_after > 0) {
log('Setting notification bar auto close event after ' + data.auto_close_after + ' second(s).');
setTimeout(function () {
setHeight(0, null, true);
}, data.auto_close_after * 1000);
}
});
}, data.display_after * 1000);
}
};
})();
@@ -0,0 +1 @@
window.wpfront_notification_bar=function(i,t){var e=function(t){i.log&&console.log(i.log_prefix+" "+t)};if("undefined"==typeof jQuery||i.keep_closed&&"undefined"==typeof Cookies||i.set_max_views&&"undefined"==typeof Cookies)return e("Waiting for "+("undefined"==typeof jQuery?"jQuery.":"Cookies.")),void setTimeout((function(){wpfront_notification_bar(i,t)}),100);if(2!=i.position||!0===t){var o=function(t){return t+i.id_suffix},n=jQuery,s=i.keep_closed_cookie,a=0,r=i.max_views_cookie,c=n(o("#wpfront-notification-bar-spacer")).removeClass("hidden"),f=n(o("#wpfront-notification-bar")),p=n(o("#wpfront-notification-bar-open-button"));if(1==i.position){e("Setting notification bar at top.");var l=0;i.fixed_position&&i.is_admin_bar_showing&&("0px"==(l=n("html").css("margin-top"))&&(l=n("html").css("padding-top")),l=parseInt(l)),i.fixed_position&&(l+=i.position_offset),f.css("top",l+"px"),p.css("top",l+"px"),c.css("top",i.position_offset+"px");var d=(u=n("body")).children().first();if(d.hasClass("wpfront-notification-bar-spacer"))for(;;){var _=d.next();if(!_.hasClass("wpfront-notification-bar-spacer")){d.after(c);break}d=_}else u.prepend(c);n((function(){u.children().first().hasClass("wpfront-notification-bar-spacer")||i.fixed_position&&!u.children().first().is(c)&&u.prepend(c)}))}else{var u;e("Setting notification bar at bottom."),(u=n("body")).children().last().is(c)||u.append(c),n((function(){u.children().last().is(c)||u.append(c)}))}var h=f.height();i.height>0&&(h=i.height,f.find("table, tbody, tr").css("height","100%")),f.height(0).css({position:i.fixed_position?"fixed":"relative",visibility:"visible"}),p.css({position:i.fixed_position?"fixed":"absolute"});var b=!1,v=!1,g=null,m=0,x=i.fixed_position&&""!=i.theme_sticky_selector;if(x&&n(window).on("scroll resize",(function(){k()})),i.close_button&&c.on("click",".wpfront-close",(function(){w(0,null,!0)})),i.button_action_close_bar&&c.on("click",".wpfront-button",(function(){w(0,null,!0)})),i.display_open_button&&c.on("click",o("#wpfront-notification-bar-open-button"),(function(){w(h)})),i.keep_closed&&Cookies.get(s))return e("Keep closed enabled and keep closed cookie exists. Hiding notification bar."),void w(0,(function(){f.removeClass("keep-closed")}));if(f.removeClass("keep-closed"),i.set_max_views&&(void 0===(a=Cookies.get(r))&&(a=0),a>=i.max_views))return e("Reached max views, hiding notification bar."),void w(0,(function(){f.removeClass("max-views-reached")}));f.removeClass("max-views-reached"),b=!0,i.display_scroll?(e("Display on scroll enabled. Hiding notification bar."),w(0),n(window).on("scroll",(function(){v||(n(this).scrollTop()>i.display_scroll_offset?w(h):w(0))}))):(e("Setting notification bar open event after "+i.display_after+" second(s)."),setTimeout((function(){w(h,(function(){i.auto_close_after>0&&(e("Setting notification bar auto close event after "+i.auto_close_after+" second(s)."),setTimeout((function(){w(0,null,!0)}),1e3*i.auto_close_after))}))}),1e3*i.display_after))}else jQuery((function(){wpfront_notification_bar(i,!0)}));function w(t,o,l){if(o=o||n.noop,l&&(v=!0),0==t){if(b)return;b=!0}else{if(!b)return;b=!1}0==t&&i.keep_closed&&l&&(i.keep_closed_for>0?Cookies.set(s,1,{path:"/",expires:i.keep_closed_for,sameSite:"strict"}):Cookies.set(s,1,{path:"/",sameSite:"strict"})),0!==t&&i.set_max_views&&(a=void 0===(a=Cookies.get(r))?0:parseInt(a),i.max_views_for>0?Cookies.set(r,a+1,{path:"/",expires:i.max_views_for,sameSite:"strict"}):Cookies.set(r,a+1,{path:"/",sameSite:"strict"}),e("Setting view count to "+(a+1)+"."));var d=o;o=function(){d(),t>0&&(0==i.height&&f.height("auto"),i.display_open_button&&(e("Setting reopen button state to hidden."),p.addClass("hidden")),b=!1),0==t&&i.display_open_button&&(e("Setting reopen button state to visible."),p.removeClass("hidden")),t>0?f.removeClass("hidden"):f.addClass("hidden")},e(t>0?"Setting notification bar state to visible.":"Setting notification bar state to hidden."),i.animate_delay>0?f.stop().show().animate({height:t+"px"},{duration:1e3*i.animate_delay,easing:"swing",complete:function(){i.fixed_position&&c.height(t),k(t),o()},step:function(t){i.fixed_position&&c.height(t),k(t)}}):(f.height(t),i.fixed_position&&c.height(t),k(t),o())}function k(t){if(!x)return 0;if(!0!==t){clearInterval(m);var e=0;m=setInterval((function(){k(!0),++e>100&&clearInterval(m)}),10)}var o=n(i.theme_sticky_selector);if(0==o.length||"fixed"!==o.css("position"))return 0;1==i.position&&(null===g&&(g=o.position().top),f.is(":visible")?o.css("top",f.height()+f.position().top+"px"):o.css("top",g+"px")),2==i.position&&(null===g&&(g=o.height()+parseFloat(o.css("bottom"))),f.is(":visible")?o.css("bottom",f.height()+parseFloat(f.css("bottom"))+"px"):o.css("bottom",g+"px"))}};
@@ -0,0 +1,621 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
@@ -0,0 +1,333 @@
=== WPFront Notification Bar ===
Contributors: syammohanm
Donate link: http://wpfront.com/donate/
Tags: notification bar, wordpress notification bar, top bar, bottom bar, notification, bar, quick bar, fixed bar, sticky bar, message bar, message, floating bar, notice, sticky header, special offer, discount offer, offer, important, attention bar, highlight bar, popup bar, hellobar, heads up, heads up bar, headsup, headsupbar, popup, Toolbar
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.0
Stable tag: 3.5.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Easily lets you create a bar on top or bottom to display a notification.
== Description ==
Want to display a notification about a promotion or a news? WPFront Notification Bar plugin lets you do that easily.
[Upgrade to PRO](http://wpfront.com/notification-bar-pro/) to create multiple bars and to use advanced editor.
### Features
* Display a **message** with a **button** (optional).
* Processes **shortcodes**.
* Button will **open a URL** or **execute JavaScript**.
* **Position** the bar on **top** or **bottom**.
* Can be **fixed at position** (Sticky Bar).
* **Display on Scroll** option.
* Set **any height** you want.
* Set the number of **seconds before** the **bar appears**.
* Display a **close button** for the visitor.
* Set the number of **seconds before auto close**.
* **Colors** are fully **customizable**.
* Display a **Reopen Button**.
* **Select the pages/posts** you want to display the notification.
* **Select the user roles** you want to display the notification.
* Set **Start** and **End dates**.
* Hide in **Small Devices**.
Visit [WPFront Notification Bar Troubleshooting](https://wpfront.com/wordpress-plugins/notification-bar-plugin/wpfront-notification-bar-troubleshooting/) page for troubleshooting steps.
Visit [WPFront Notification Bar Settings](http://wpfront.com/notification-bar-plugin-settings/) page for detailed option descriptions.
== Installation ==
1. Click Plugins/Add New from the WordPress admin panel
1. Search for "WPFront Notification Bar" and install
-or-
1. Download the .zip package
1. Unzip into the subdirectory 'wpfront-notification-bar' within your local WordPress plugins directory
1. Refresh plugin page and activate plugin
1. Configure plugin using *settings* link under plugin name or by going to WPFront/Notification Bar
== Frequently Asked Questions ==
= WPFront Notification Bar and GDPR compliance? =
This plugin doesnt collect any personal information. For more information please visit [GDPR compliance](https://wpfront.com/wpfront-and-gdpr-compliance/).
= I dont want the plugin to be displayed on “wp-admin”, what should I do? =
Notification bar doesnt display on the wp-admin pages, except on the notification bar settings page. On the settings page it acts as a preview so that you can see the changes you make.
= How do I stop the bar from displaying for logged in users? =
The new version(1.3) allows you to filter the bar based on user roles. In this case you need to select the “Guest users” option.
== Screenshots ==
1. Settings page.
== Changelog ==
= 3.5.1 =
* Pdf files are not allowed to upload.
= 3.5.0 =
* Filter using URL text.
* Use WP Editor in PRO.
* PHP8.4 compatibility.
* Enqueue in footer defect fix.
* URL noopener defect fix.
* Multisite license issue fix.
= 3.4.2 =
* Bug fixes.
= 3.4.1 =
* Bug fixes.
= 3.4 =
* Bug fixes.
* Compatibility fixes.
* XSS fixes.
= 3.3.2 =
* Bug fixes.
* PHP & WP compatibility fixes.
= 3.3.1 =
* Bug fixes.
= 3.3.0 =
* New schedules UI.
* WPML compatibility fixes.
* Plugin conflict fixes.
* Bug fixes.
= 3.2.1 =
* Copy bars.
= 3.2.0 =
* Recurring schedule(PRO).
* New UI.
* Bug fixes.
= 3.1.0 =
* Max views configuration.
* Enqueue CSS in footer.
* Reopen button offset.
* Bug fixes.
= 3.0.0 =
* [Create multiple bars](http://wpfront.com/notification-bar-pro/)(PRO).
* TinyMCE editor.
* Custom capabilities(PRO).
= 2.3.0 =
* Custom capability bug fix.
* Keep closed bug fix.
= 2.2.0 =
* You can now change the capability checked by Notification Bar.
* Use **WPFRONT_NOTIFICATION_BAR_EDIT_CAPABILITY** constant to set your custom capability or use **wpfront_notification_bar_edit_capability** filter.
* You can now enable/disable notification bar based on any condition using **wpfront_notification_bar_enabled** filter.
= 2.1.0 =
* More XSS fixes. Please read [this link](https://wordpress.org/support/topic/v2-contain-breaking-changes/) before upgrading.
* Use **WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML** constant to get v1.x behavior on message & button text.
* Add **define('WPFRONT_NOTIFICATION_BAR_UNFILTERED_HTML', true);** to your wp-config.php to disable message sanitization.
* Another way is to use **wpfront_notification_bar_message_allow_unfiltered_html** and **wpfront_notification_bar_button_text_allow_unfiltered_html** filters.
* WPML compatibility fix. Use **WPFRONT_NOTIFICATION_BAR_LANG_DOMAIN** constant to change language domain.
= 2.0.0 =
* Breaking change added. Please read [this link](https://wordpress.org/support/topic/v2-contain-breaking-changes/) before upgrading.
* Breaking change: Message text no longer allow script tags.
* If you have script tags in your message text, use 'wpfront_notification_bar_message' filter to set your message.
* This change is needed as per 'WordPress Plugin Review Team'.
* More XSS fixes.
= 1.9.2 =
* XSS fix on the settings page.
= 1.9.1 =
* Compatibility fix.
= 1.9.0 =
* Reopen button image is now configurable.
* Add dynamic CSS through URL.
* Compatibility fixes.
* Bug fixes.
* PHP 8.0 fixes.
* SiteGround conflict fix.
= 1.8.1 =
* Description correction.
= 1.8 =
* Preview mode.
* Debug mode.
* Hide in small devices and windows.
* Change cookie names.
* Edit include/exclude post IDs manually.
* Edit colors manually.
* More rel attributes. Thanks to jetxpert.
* Accessibility and compatibility fixes.
* Filters 'wpfront_notification_bar_message' and 'wpfront_notification_bar_button_text' added.
* Bug fixes.
= 1.7.1 =
* Processes shortcode in button text.
* Notification bar menu is now under 'Settings' menu.
* PHP 7.2 compatibility fixes.
* Bug fixes.
= 1.7 =
* Start and End times.
= 1.6 =
* Processes shortcodes.
* Nofollow link option.
= 1.5.2 =
* WP eMember integration.
= 1.4.2 =
* Bug fixes.
* Serbo-Croatian translation. Thanks to Borisa Djuraskovic.
= 1.4.1 =
* Bug fixes.
* Hungarian translation. Thanks to Botfai Tibor.
= 1.4 =
* Display on Scroll option added.
* Date filters added.
= 1.3 =
* User roles filter added.
* New menu structure.
= 1.2.1 =
* Fixed an issue with mod_security.
* German language added. Thanks to Anders Lind.
= 1.2 =
* Keep closed for days.
* Change color of close button.
* Custom CSS option added.
= 1.1 =
* Filter pages option added.
* Reopen button added.
* Keep closed option added.
* Position offset added.
* WordPress 3.8 ready.
= 1.0.1 =
* A couple of bug fixes.
= 1.0 =
* Initial release
== Upgrade Notice ==
= 3.5.1 =
* Pdf files are not allowed to upload.
= 3.5.0 =
* New features and defect fixes.
= 3.4.2 =
* Bug fixes.
= 3.4.1 =
* Bug fixes.
= 3.4 =
* Compatibility & security fixes.
= 3.3.2 =
* Bug fixes.
= 3.3.1 =
* Bug fixes.
= 3.3.0 =
* New features, compatibility & bug fixes.
= 3.2.0 =
* Bug fixes.
= 3.1.0 =
* Bug fixes.
= 3.0.0 =
* TinyMCE editor.
= 2.3.0 =
* Bug fixes.
= 2.2.0 =
* New filters.
= 2.1.0 =
* XSS and compatibility fixes.
= 2.0.0 =
* Please read change log before upgrading.
= 1.9.2 =
* XSS fix on the settings page.
= 1.9.1 =
* Compatibility fix.
= 1.9.0 =
* Compatibility fixes.
= 1.8 =
* New features added.
= 1.7.1 =
* Bug fixes.
= 1.7 =
* Start and End times.
= 1.6 =
* Processes shortcodes.
= 1.5.2 =
* WP eMember integration.
= 1.4.2 =
* Bug fixes.
= 1.4.1 =
* A couple of bug fixes.
= 1.4 =
* Now you can set it to display on scroll.
* Date filters available now.
= 1.3 =
* Now you can filter by user roles.
= 1.2.1 =
* Fixed an issue with mod_security on "cookie" rule.
= 1.2 =
* Now you can keep it closed for days.
* Change the color of close button.
= 1.1 =
* This version is WordPress 3.8 ready.
* Now you can filter the pages.
* Option to keep the bar closed.
= 1.0.1 =
* Fixed an issue with CSS conflicting with some themes
= 1.0 =
* Initial release
@@ -0,0 +1,2 @@
<?php
// Silence is golden.
@@ -0,0 +1,230 @@
<?php
/*
WPFront Notification Bar Plugin
Copyright (C) 2013, WPFront.com
Website: wpfront.com
Contact: syam@wpfront.com
WPFront Notification Bar Plugin is distributed under the GNU General Public License, Version 3,
June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace WPFront\Notification_Bar;
if (!defined('ABSPATH')) exit();
if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Custom_Css_Template')) {
class WPFront_Notification_Bar_Custom_CSS_Template {
protected $controller;
protected $options;
public function write($controller, $force = false) {
$this->controller = $controller;
$this->options = $controller->get_options();
$enabled = $this->options->enabled;
$preview = $this->options->preview_mode;
if ($preview || $enabled || $force) {
$this->wpfront_notification_bar_css();
$this->div_wpfront_message_css();
$this->a_wpfront_button_css();
$this->open_button_css();
$this->table_css();
$this->div_wpfront_close_css();
$this->div_wpfront_close_hover_css();
$this->display_on_devices();
$this->hide_small_window();
$this->custom_css();
}
}
protected function wpfront_notification_bar_css() {
$id_suffix = $this->controller->get_html_id_suffix();
echo "#wpfront-notification-bar$id_suffix, #wpfront-notification-bar-editor";
?>
{
background: <?php echo $this->options->bar_from_color; ?>;
background: -moz-linear-gradient(top, <?php echo $this->options->bar_from_color; ?> 0%, <?php echo $this->options->bar_to_color; ?> 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,<?php echo $this->options->bar_from_color; ?>), color-stop(100%,<?php echo $this->options->bar_to_color; ?>));
background: -webkit-linear-gradient(top, <?php echo $this->options->bar_from_color; ?> 0%,<?php echo $this->options->bar_to_color; ?> 100%);
background: -o-linear-gradient(top, <?php echo $this->options->bar_from_color; ?> 0%,<?php echo $this->options->bar_to_color; ?> 100%);
background: -ms-linear-gradient(top, <?php echo $this->options->bar_from_color; ?> 0%,<?php echo $this->options->bar_to_color; ?> 100%);
background: linear-gradient(to bottom, <?php echo $this->options->bar_from_color; ?> 0%, <?php echo $this->options->bar_to_color; ?> 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='<?php echo $this->options->bar_from_color; ?>', endColorstr='<?php echo $this->options->bar_to_color; ?>',GradientType=0 );
background-repeat: no-repeat;
<?php if ($this->options->set_full_width_message) {
?>
flex-direction: column;
<?php
}
?>
}
<?php
}
protected function table_css() {
$id_suffix = $this->controller->get_html_id_suffix();
echo "#wpfront-notification-bar-table$id_suffix, .wpfront-notification-bar tbody, .wpfront-notification-bar tr";
?>
{
<?php if ($this->options->set_full_width_message) { ?>
width: 100%
<?php
}
?>
}
<?php
}
protected function div_wpfront_message_css() {
$id_suffix = $this->controller->get_html_id_suffix();
echo "#wpfront-notification-bar$id_suffix div.wpfront-message, #wpfront-notification-bar-editor.wpfront-message";
?>
{
color: <?php echo $this->options->message_color; ?>;
<?php if ($this->options->set_full_width_message) {
?>
width: 100%
<?php
}
?>
}
<?php
}
protected function a_wpfront_button_css() {
$id_suffix = $this->controller->get_html_id_suffix();
echo "#wpfront-notification-bar$id_suffix a.wpfront-button, #wpfront-notification-bar-editor a.wpfront-button";
?>
{
background: <?php echo $this->options->button_from_color; ?>;
background: -moz-linear-gradient(top, <?php echo $this->options->button_from_color; ?> 0%, <?php echo $this->options->button_to_color; ?> 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,<?php echo $this->options->button_from_color; ?>), color-stop(100%,<?php echo $this->options->button_to_color; ?>));
background: -webkit-linear-gradient(top, <?php echo $this->options->button_from_color; ?> 0%,<?php echo $this->options->button_to_color; ?> 100%);
background: -o-linear-gradient(top, <?php echo $this->options->button_from_color; ?> 0%,<?php echo $this->options->button_to_color; ?> 100%);
background: -ms-linear-gradient(top, <?php echo $this->options->button_from_color; ?> 0%,<?php echo $this->options->button_to_color; ?> 100%);
background: linear-gradient(to bottom, <?php echo $this->options->button_from_color; ?> 0%, <?php echo $this->options->button_to_color; ?> 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='<?php echo $this->options->button_from_color; ?>', endColorstr='<?php echo $this->options->button_to_color; ?>',GradientType=0 );
background-repeat: no-repeat;
color: <?php echo $this->options->button_text_color; ?>;
}
<?php
}
protected function open_button_css() {
$id_suffix = $this->controller->get_html_id_suffix();
echo "#wpfront-notification-bar-open-button$id_suffix";
?>
{
background-color: <?php echo $this->options->open_button_color; ?>;
right: <?php echo 10 + $this->options->reopen_button_offset; ?>px;
<?php
if (!empty($this->options->reopen_button_image_url)) {
echo "background-image: url({$this->options->reopen_button_image_url});";
}
?>
}
<?php
if (empty($this->options->reopen_button_image_url)) {
$url_top = plugins_url('images/arrow_down.png', $this->controller->get_plugin_file());
$url_bottom = plugins_url('images/arrow_up.png', $this->controller->get_plugin_file());
echo "#wpfront-notification-bar-open-button$id_suffix.top";
?>
{
background-image: url(<?php echo $url_top; ?>);
}
<?php
echo "#wpfront-notification-bar-open-button$id_suffix.bottom";
?>
{
background-image: url(<?php echo $url_bottom; ?>);
}
<?php
}
}
protected function div_wpfront_close_css() {
$id_suffix = $this->controller->get_html_id_suffix();
echo "#wpfront-notification-bar$id_suffix div.wpfront-close";
?>
{
border: 1px solid <?php echo $this->options->close_button_color; ?>;
background-color: <?php echo $this->options->close_button_color; ?>;
color: <?php echo $this->options->close_button_color_x; ?>;
}
<?php
}
protected function div_wpfront_close_hover_css() {
$id_suffix = $this->controller->get_html_id_suffix();
echo "#wpfront-notification-bar$id_suffix div.wpfront-close:hover";
?>
{
border: 1px solid <?php echo $this->options->close_button_color_hover; ?>;
background-color: <?php echo $this->options->close_button_color_hover; ?>;
}
<?php
}
protected function display_on_devices() {
switch ($this->options->hide_small_device) {
case 'small':
$this->display_on_small_device();
break;
case 'large':
$this->display_on_large_device();
break;
default:
$this->display_on_all_device();
break;
}
}
protected function display_on_all_device() {
$id_suffix = $this->controller->get_html_id_suffix();
echo " #wpfront-notification-bar-spacer$id_suffix { display:block; }";
}
protected function display_on_small_device() {
$id_suffix = $this->controller->get_html_id_suffix();
echo " #wpfront-notification-bar-spacer$id_suffix { display:none; }@media screen and (max-device-width:{$this->options->small_device_width}px) { #wpfront-notification-bar-spacer$id_suffix { display:block; } }";
}
protected function display_on_large_device() {
$id_suffix = $this->controller->get_html_id_suffix();
echo "@media screen and (max-device-width: {$this->options->small_device_width}px) { #wpfront-notification-bar-spacer$id_suffix { display:none; } }";
}
protected function hide_small_window() {
if ($this->options->hide_small_window) {
$id_suffix = $this->controller->get_html_id_suffix();
echo "@media screen and (max-width: {$this->options->small_window_width}px) { #wpfront-notification-bar-spacer$id_suffix { display:none; } }";
}
}
protected function custom_css() {
echo wp_strip_all_tags($this->options->custom_css, true);
}
}
}
@@ -0,0 +1,214 @@
<?php
/*
WPFront Notification Bar Plugin
Copyright (C) 2013, WPFront.com
Website: wpfront.com
Contact: syam@wpfront.com
WPFront Notification Bar Plugin is distributed under the GNU General Public License, Version 3,
June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace WPFront\Notification_Bar;
if (!defined('ABSPATH')) exit();
if (!class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar_Template')) {
/**
* Template for WPFront Notification Bar
*
* @author Syam Mohan <syam@wpfront.com>
* @copyright 2013 WPFront.com
*/
class WPFront_Notification_Bar_Template {
protected $controller;
protected $options;
public function __construct($options, $controller) {
$this->options = $options;
$this->controller = $controller;
}
public function write() {
$this->dynamic_css();
$this->display_button_js_script();
$this->display_bar();
}
protected function dynamic_css() {
if (!$this->options->dynamic_css_use_url) {
?>
<style type="text/css">
<?php
$template = new WPFront_Notification_Bar_Custom_CSS_Template();
$template->write($this->controller);
?>
</style>
<?php
}
}
protected function display_button_js_script() {
if ($this->options->display_button && $this->options->button_action == 2) {
$id_suffix = $this->controller->get_html_id_suffix();
$id_suffix = str_replace('-', "", $id_suffix);
$js = preg_replace('/<\/script\b[^>]*>/i', '', $this->options->button_action_javascript);
?>
<script type="text/javascript">
function wpfront_notification_bar_button_action_script<?php echo $id_suffix ?>() {
try {
<?php echo $js; ?>
} catch (err) {
}
}
</script>
<?php
}
}
protected function check_empty_id($id) {
if (!empty($id)) {
return '-' . $id;
}
return $id;
}
/**
* Returns bar CSS classes;
*
* @SuppressWarnings(PHPMD.ElseExpression)
*
* @return string
*/
protected function get_bar_css_classes() {
$bar_css = 'wpfront-notification-bar wpfront-fixed';
if($this->options->fixed_position) {
$bar_css .= ' wpfront-fixed-position';
}
if($this->controller->display_on_page_load()) {
$bar_css .= ' load';
}
if($this->options->position == 1) {
$bar_css .= ' top';
} else {
$bar_css .= ' bottom';
}
if($this->options->display_shadow) {
if($this->options->position == 1) {
$bar_css .= ' wpfront-bottom-shadow';
} else {
$bar_css .= ' wpfront-top-shadow';
}
}
if($this->controller->has_keep_closed_set()) {
$bar_css .= ' keep-closed';
}
if($this->controller->has_max_views_reached()) {
$bar_css .= ' max-views-reached';
}
$bar_css .= ' ' . $this->options->custom_class;
return $bar_css;
}
protected function display_bar() {
$id_suffix = $this->controller->get_html_id_suffix();
$bar_css = $this->get_bar_css_classes();
?>
<div id="wpfront-notification-bar-spacer<?php echo $id_suffix; ?>" class="wpfront-notification-bar-spacer <?php echo $this->options->fixed_position ? ' wpfront-fixed-position' : ''; ?> <?php echo $this->controller->display_on_page_load() ? ' ' : 'hidden'; ?>">
<div id="wpfront-notification-bar-open-button<?php echo $id_suffix; ?>" aria-label="reopen" role="button" class="wpfront-notification-bar-open-button hidden <?php echo $this->options->position == 1 ? 'top wpfront-bottom-shadow' : 'bottom wpfront-top-shadow'; ?>"></div>
<div id="wpfront-notification-bar<?php echo $id_suffix; ?>" class="<?php echo esc_attr($bar_css); ?>">
<?php if ($this->options->close_button) { ?>
<div aria-label="close" class="wpfront-close">X</div>
<?php } if (empty($this->controller->get_message_text())) {
?> &nbsp; <?php
}
?>
<?php
$table_present = apply_filters('wpfront_notification_bar_use_table_html', true);
if (!empty($this->options->display_button) || !empty($this->controller->get_message_text())) {
if ($table_present == true) {
?>
<table id="wpfront-notification-bar-table<?php echo $id_suffix; ?>" border="0" cellspacing="0" cellpadding="0" role="presentation">
<tr>
<td>
<?php } ?>
<div class="wpfront-message wpfront-div">
<?php echo __($this->controller->get_message_text(true), $this->controller->get_lang_domain()); ?>
</div>
<?php
if ($this->options->display_button) {
?>
<div class="wpfront-div">
<?php
$button_text = $this->controller->get_button_text(true);
?>
<?php
if ($this->options->button_action == 1) {
$rel = array();
if ($this->options->button_action_url_nofollow) {
$rel[] = 'nofollow';
}
if ($this->options->button_action_url_noreferrer) {
$rel[] = 'noreferrer';
}
if ($this->options->button_action_new_tab && $this->options->button_action_url_noopener) {
$rel[] = 'noopener';
}
$rel = implode(' ', $rel);
?>
<a class="wpfront-button" href="<?php echo __($this->options->button_action_url, $this->controller->get_lang_domain()); ?>" target="<?php echo $this->options->button_action_new_tab ? '_blank' : '_self'; ?>" <?php echo empty($rel) ? '' : "rel=\"$rel\""; ?>><?php echo __($button_text, $this->controller->get_lang_domain()); ?></a>
<?php
}
?>
<?php
if ($this->options->button_action == 2) {
$id_suffix = $this->controller->get_html_id_suffix();
$id_suffix = str_replace('-', "", $id_suffix);
?>
<a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script<?php echo $id_suffix ?>();"><?php echo __($button_text, $this->controller->get_lang_domain()); ?></a>
<?php } ?>
</div>
<?php } ?>
<?php if ($table_present == true) {
?>
</td>
</tr>
</table>
<?php } ?>
<?php } ?>
</div>
</div>
<?php
}
}
}
@@ -0,0 +1,50 @@
<?php
if (!defined('ABSPATH')) exit();
if (defined('WP_UNINSTALL_PLUGIN')) {
function wpfront_notification_bar_uninstall($is_pro)
{
\WPFront\Notification_Bar\WPFront_Notification_Bar_Entity::uninstall();
if ($is_pro) {
if (class_exists('\WPFront\Notification_Bar\Pro\WPFront_Notification_Bar_Entity_Pro')) {
\WPFront\Notification_Bar\Pro\WPFront_Notification_Bar_Entity_Pro::uninstall();
}
if (class_exists('\WPFront\Notification_Bar\Pro\WPFront_Notification_Bar_Settings_Entity')) {
\WPFront\Notification_Bar\Pro\WPFront_Notification_Bar_Settings_Entity::uninstall();
}
}
}
include_once dirname(__FILE__) . '/classes/class-wpfront-notification-bar-entity.php';
$is_pro = false;
if (file_exists(dirname(__FILE__) . '/pro/classes/class-wpfront-notification-bar-entity-pro.php')) {
include_once dirname(__FILE__) . '/pro/classes/class-wpfront-notification-bar-entity-pro.php';
$is_pro = true;
}
if (file_exists(dirname(__FILE__) . '/pro/classes/class-wpfront-notification-bar-settings-entity.php')) {
include_once dirname(__FILE__) . '/pro/classes/class-wpfront-notification-bar-settings-entity.php';
$is_pro = true;
}
if (is_multisite()) {
global $wpdb;
$blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
$current_blog_id = get_current_blog_id();
foreach ($blog_ids as $blog_id) {
switch_to_blog($blog_id);
wpfront_notification_bar_uninstall($is_pro);
}
switch_to_blog($current_blog_id);
} else {
wpfront_notification_bar_uninstall($is_pro);
}
wp_cache_flush();
}
@@ -0,0 +1,51 @@
<?php
/*
* Plugin Name: WPFront Notification Bar
* Plugin URI: http://wpfront.com/notification-bar-pro/
* Description: Easily lets you create a bar on top or bottom to display a notification.
* Version: 3.5.1
* Requires at least: 5.0
* Requires PHP: 7.0
* Author: Syam Mohan
* Author URI: http://wpfront.com
* License: GPL v3
* Text Domain: wpfront-notification-bar
*/
/*
WPFront Notification Bar Plugin
Copyright (C) 2013, WPFront.com
Website: wpfront.com
Contact: syam@wpfront.com
WPFront Notification Bar Plugin is distributed under the GNU General Public License, Version 3,
June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (!defined('ABSPATH')) exit();
if (class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar') || class_exists('WPFront_Notification_Bar')) {
return;
}
use WPFront\Notification_Bar\WPFront_Notification_Bar;
require_once("classes/class-wpfront-notification-bar.php");
if (!function_exists('add_action')) {
return;
}
WPFront_Notification_Bar::Instance()->init(plugin_basename(__FILE__));