Changeset 1782143
- Timestamp:
- 12/06/2017 05:12:45 PM (8 years ago)
- Location:
- chatbro/trunk
- Files:
-
- 52 added
- 7 deleted
- 4 edited
-
backends (added)
-
backends/admin.php (added)
-
backends/permissions.php (added)
-
backends/settings.php (added)
-
backends/user.php (added)
-
backends/utils.php (added)
-
backends/version.php (added)
-
common (added)
-
common/admin (added)
-
common/admin/admin.php (added)
-
common/admin/exceptions.php (added)
-
common/admin/interfaces.php (added)
-
common/chat.php (added)
-
common/core (added)
-
common/core/backendable.php (added)
-
common/core/l10n (added)
-
common/core/l10n/functions.php (added)
-
common/core/l10n/interfaces.php (added)
-
common/core/l10n/l10n.php (added)
-
common/core/l10n/pomo (added)
-
common/core/l10n/pomo/entry.php (added)
-
common/core/l10n/pomo/mo.php (added)
-
common/core/l10n/pomo/streams.php (added)
-
common/core/l10n/pomo/translations.php (added)
-
common/core/version.php (added)
-
common/core/version.tmpl.php (added)
-
common/languages (added)
-
common/languages/chatbro-id_ID.mo (added)
-
common/languages/chatbro-it_IT.mo (added)
-
common/languages/chatbro-pt_BR.mo (added)
-
common/languages/chatbro-ru_RU.mo (added)
-
common/permissions (added)
-
common/permissions/interfaces.php (added)
-
common/permissions/permissions.php (added)
-
common/settings (added)
-
common/settings/exceptions.php (added)
-
common/settings/interfaces.php (added)
-
common/settings/setting.php (added)
-
common/settings/settings.php (added)
-
common/settings/settings_translations.php (added)
-
common/user (added)
-
common/user/interfaces.php (added)
-
common/user/user.php (added)
-
common/utils (added)
-
common/utils/exceptions.php (added)
-
common/utils/interfaces.php (added)
-
common/utils/utils.php (added)
-
css/chatbro.css (added)
-
css/chatbro.min.css (deleted)
-
deprecated.php (deleted)
-
index.php (modified) (2 diffs)
-
init.php (added)
-
js/chatbro.js (added)
-
js/chatbro.min.js (deleted)
-
languages (deleted)
-
plugin.php (deleted)
-
readme.txt (modified) (4 diffs)
-
shortcode.php (modified) (1 diff)
-
templater.php (deleted)
-
uninstall.php (added)
-
util.php (deleted)
-
widget.php (modified) (4 diffs)
-
wp_common.php (added)
Legend:
- Unmodified
- Added
- Removed
-
chatbro/trunk/index.php
r1752019 r1782143 2 2 /** 3 3 * @package ChatBro 4 * @version 2.3.04 * @version 3.0.0 5 5 */ 6 6 /* … … 8 8 Plugin URI: http://chatbro.com 9 9 Description: Live group chat for your community with social networks integration. Chat conversation is being syncronized with popular messengers. Love ChatBro? Spread the word! <a href="https://wordpress.org/support/view/plugin-reviews/chatbro">Click here to review the plugin!</a>. 10 Version: 2.3.010 Version: 3.0.0 11 11 Author: ChatBro 12 12 Author URI: http://chatbro.com 13 13 License: GPL3 14 14 Text Domain: chatbro 15 Domain Path: / languages/15 Domain Path: /common/languages/ 16 16 */ 17 17 18 18 defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); 19 define('CHATBRO_PLUGIN_VERSION', '2.2.10', true);20 19 21 require_once('util.php'); 22 require_once('deprecated.php'); 23 require_once('plugin.php'); 24 require_once('shortcode.php'); 25 require_once('templater.php'); 26 require_once('widget.php'); 20 require_once('init.php'); 21 CBroInit::init(); 27 22 28 ChatBroPlugin::get_instance(); 29 ChatBroShortCode::get_instance(); 30 31 add_action('plugins_loaded', array('ChatBroUtils', 'load_my_textdomain')); 32 add_action('plugins_loaded', array( 'ChatBroPluginTemplater', 'get_instance')); 33 add_action('widgets_init', array('ChatBroWidget', 'register')); 34 register_uninstall_hook(__FILE__, array('ChatBroPlugin', 'clenup_settings')); 35 register_activation_hook(__FILE__, array('ChatBroPlugin', 'on_activation')); 23 ?> -
chatbro/trunk/readme.txt
r1752012 r1782143 3 3 Tags: Chat, Telegram, Telegram chat, Chat Tool, Chat Widget, Free Live Chat, Group Chat, Live Chat, Online Live Chat, Plugin Chat, Web Chat, live chat widget, online support, wordpress live chat, chat software, chat services, live help, live chat help, chat widget, live support plugin, live chat support plugin 4 4 Requires at least: 3.5 5 Tested up to: 4. 8.26 Stable tag: 2.3.05 Tested up to: 4.9.1 6 Stable tag: 3.0.0 7 7 License: GPLv2 8 8 … … 33 33 == ChangeLog == 34 34 35 = 3.0.0 = 36 * New plugin core 37 35 38 = 2.3.0 = 36 39 * Updated chat embed code … … 55 58 56 59 = 2.2.4 = 57 * Fixed an issue where chat was always displaying to guests despite of "Display to guests" 58 setting value. 60 * Fixed an issue where chat was always displaying to guests despite of "Display to guests" setting value. 59 61 60 62 = 2.2.3 = 61 63 * Compatibility with most plugins that replaces Gravatar avatars with locally 62 stored ones.63 64 64 65 = 2.2.2 = … … 163 164 = 1.0.0 = 164 165 * Initial release 166 -
chatbro/trunk/shortcode.php
r1586694 r1782143 3 3 defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); 4 4 5 if (!class_exists("ChatBroShortCode")) { 6 class ChatBroShortCode { 7 private static $instance = null;5 require_once('common/settings/settings.php'); 6 require_once('common/user/user.php'); 7 require_once('common/chat.php'); 8 8 9 private function __construct() {10 add_shortcode('chatbro', array(&$this, 'render'));11 }9 if (!class_exists("CBroShortCode")) { 10 class CBroShortCode { 11 private static $instance = null; 12 12 13 public static function get_instance() {14 if (!self::$instance)15 self::$instance = new ChatBroShortCode();13 private function __construct() { 14 add_shortcode('chatbro', array(&$this, 'render')); 15 } 16 16 17 return self::$instance; 18 } 17 public static function get_instance() { 18 if (!self::$instance) 19 self::$instance = new CBroShortCode(); 19 20 20 public static function render($atts, $content = null) { 21 $a = shortcode_atts(array( 22 'static' => true, 23 'registered_only' => false 24 ), $atts); 21 return self::$instance; 22 } 23 24 public static function render($atts, $content = null) { 25 $a = shortcode_atts(array( 26 'static' => true, 27 'registered_only' => false 28 ), $atts); 29 30 if (!CBroSettings::get(CBroSettings::enable_shortcodes)) 31 return ""; 32 33 // If "registered_only" attribute is explicitly set in shortcode then it will be used or global display_to_guests_setting will be used 34 $registered_only = $atts && array_key_exists('registered_only', $atts) ? (strtolower($a['registered_only']) == 'true' || $a['registered_only'] == '1') : !CBroSettings::get(CBroWPSettingsBackend::display_to_guests); 35 $static = strtolower($a['static']) == 'true' || $a['static'] == '1'; 25 36 26 37 27 if (!ChatBroUtils::get_option(ChatBroPlugin::enable_shortcodes_setting))28 return "";38 if (!CBroUser::can_view() || ($registered_only && !CBroUser::is_logged_in())) 39 return ""; 29 40 30 // If "registered_only" attribute is explicitly set in shortcode then it will be used or global display_to_guests_setting will be used 31 $registered_only = $atts && array_key_exists('registered_only', $atts) ? (strtolower($a['registered_only']) == 'true' || $a['registered_only'] == '1') : !ChatBroUtils::get_option(ChatBroPlugin::display_to_guests_setting); 32 $static = strtolower($a['static']) == 'true' || $a['static'] == '1'; 33 $logged_in = is_user_logged_in(); 34 35 if ((!$logged_in && $registered_only) || ($logged_in && !current_user_can(ChatBroPlugin::cap_view))) 36 return ""; 37 38 $guid = strtolower(ChatBroUtils::get_option(ChatBroPlugin::guid_setting)); 39 $encoded_guid = md5($guid); 40 $container_id = $static ? "chatbro-{$encoded_guid}-" . rand(0, 99999) : null; 41 $code = $container_id ? "<div id=\"{$container_id}\"></div>" : ""; 42 43 return $code . ChatBroUtils::generate_chat_code($guid, $container_id, $static); 44 } 41 return $static ? CBroChat::get_static_chat_code() : CBroChat::generate_popup_chat_code(); 45 42 } 43 } 46 44 } 47 45 -
chatbro/trunk/widget.php
r1592647 r1782143 6 6 require_once(ABSPATH . '/wp-includes/formatting.php'); 7 7 8 if (!class_exists('ChatbroWidget')) { 9 class ChatBroWidget extends WP_Widget { 8 require_once('common/settings/settings.php'); 9 require_once('common/user/user.php'); 10 require_once('common/chat.php'); 11 12 13 if (!class_exists('CBroWidget')) { 14 class CBroWidget extends WP_Widget { 15 const dtg = CBroWPSettingsBackend::display_to_guests; 16 10 17 public function __construct() { 11 18 parent::__construct( … … 17 24 18 25 public static function register() { 19 register_widget('ChatBroWidget'); 26 register_widget('CBroWidget'); 27 } 28 29 private static function get_dtg($instance) { 30 $display_to_guests = !!CBroSettings::get(self::dtg); 31 32 if (isset($instance[self::dtg])) 33 $display_to_guests = !!$instance[self::dtg]; 34 35 return $display_to_guests; 20 36 } 21 37 22 38 public function widget($args, $instance) { 23 $display_to_guests = true;39 $display_to_guests = self::get_dtg($instance); 24 40 25 if (isset($instance[ChatBroPlugin::display_to_guests_setting])) 26 $display_to_guests = !!$instance[ChatBroPlugin::display_to_guests_setting]; 27 28 if (!ChatBroUtils::user_can_view($display_to_guests)) 41 if (!CBroUser::can_view() || ((!CBroUser::is_logged_in()) && (!$display_to_guests))) 29 42 return; 30 43 31 $guid = strtolower(ChatBroUtils::get_option(ChatBroPlugin::guid_setting));32 44 $container_id = 'chatbro-widget-' . rand(0, 99999); 33 45 34 46 ?> 35 47 <section id="<?php echo $container_id; ?>" class="widget"> 36 <?php echo C hatBroUtils::generate_chat_code($guid, $container_id, true); ?>48 <?php echo CBroChat::get_static_chat_code(); ?> 37 49 </section> 38 50 <?php … … 40 52 41 53 public function form($instance) { 42 $display_to_guests = true; 54 $display_to_guests = self::get_dtg($instance); 55 $dtg_id = $this->get_field_id(self::dtg); 56 $dtg_name = $this->get_field_name(self::dtg); 43 57 44 if (isset($instance[ChatBroPlugin::display_to_guests_setting]))45 $display_to_guests = !!$instance[ChatBroPlugin::display_to_guests_setting];46 47 $dtg_id = $this->get_field_id(ChatBroPlugin::display_to_guests_setting);48 $dtg_name = $this->get_field_name(ChatBroPlugin::display_to_guests_setting);49 58 ?> 50 59 <p> 51 <label for="<?php echo $d isplay_to_guests_id; ?>">60 <label for="<?php echo $dtg_id; ?>"> 52 61 <input type="checkbox" id="<?php echo $dtg_id; ?>" name="<?php echo $dtg_name; ?>" class="checkbox" <?php echo $display_to_guests ? 'checked' : ''; ?>> 53 62 <?php _e("Display chat to guests", "chatbro"); ?> … … 59 68 public function update($new_instance, $old_instance) { 60 69 $instance = array(); 61 $instance[ ChatBroPlugin::display_to_guests_setting] = isset($new_instance[ChatBroPlugin::display_to_guests_setting]) ? !!$new_instance[ChatBroPlugin::display_to_guests_setting] : false;70 $instance[self::dtg] = isset($new_instance[self::dtg]) ? !!$new_instance[self::dtg] : false; 62 71 return $instance; 63 72 }
Note: See TracChangeset
for help on using the changeset viewer.