function wpmudev_chat_form_section_polling_content($form_section = 'global') { global $wpmudev_chat; if (wpmudev_chat_validate_config_file($wpmudev_chat->_chat_plugin_settings['config_file'])) { $_use_plugin_ajax = true; } else { $_use_plugin_ajax = false; } ?> <fieldset> <legend><?php _e('Chat Session Polling Content', $wpmudev_chat->translation_domain); ?> </legend> <p class="info"><?php _e('By default the chat sessions poll a special AJAX file located in the plugin directory (wpmudev-chat-ajax.php). Sometimes due to security issues on the server this is not allowed. In those cases set the polling type to WordPress.', $wpmudev_chat->translation_domain); ?> </p> <p class="info"><?php _e('<strong>The WordPress AJAX will be much slower and user more server resources than using the Plugin AJAX.</strong>', $wpmudev_chat->translation_domain); ?> </p> <?php if ($_use_plugin_ajax !== true) { ?> <p class="wpmudev-chat-error"><?php _e("The Chat Plugin directory must be writeable during activation in order to use the faster 'Plugin AJAX' option.", $wpmudev_chat->translation_domain); } ?> <table border="0" cellpadding="4" cellspacing="0"> <tr> <td class="chat-label-column chat-label-column-top"> <label for="chat_session_poll_type"><?php _e('Select Polling Source Type', $wpmudev_chat->translation_domain); ?> </label></td> <td class="chat-value-column"><?php ?> <select id="chat_session_poll_type" name="chat[session_poll_type]"> <?php if ($_use_plugin_ajax === true) { ?> <option value="plugin" <?php print $wpmudev_chat->get_option('session_poll_type', $form_section) == 'plugin' ? 'selected="selected"' : ''; ?> ><?php _e('Plugin AJAX', $wpmudev_chat->translation_domain); ?> </option><?php } ?> <option value="wordpress" <?php print $wpmudev_chat->get_option('session_poll_type', $form_section) == 'wordpress' ? 'selected="selected"' : ''; ?> ><?php _e('WordPress AJAX', $wpmudev_chat->translation_domain); ?> </option> </select> </td> <td class="chat-help-column"><?php echo wpmudev_chat_get_help_item('session_poll_type', 'tip'); ?> </td> </tr> <?php /* ?> <tr> <td class="chat-label-column"><label for="chat_session_static_file_path"><?php _e('Static Files Directory', $wpmudev_chat->translation_domain); ?></label></td> <td class="chat-value-column"> <input type="text" id="chat_session_static_file_path" name="chat[session_static_file_path]" value="<?php echo $wpmudev_chat->get_option('session_static_file_path', $form_section); ?>" /> <p class="description"><?php _e('This static file directory should be writable and accessible at all times from the chat plugin.', $wpmudev_chat->translation_domain); ?></p> </td> <td class="chat-help-column"><?php echo wpmudev_chat_get_help_item('session_static_file_path', 'tip'); ?></td> </tr> <?php */ ?> </table> </fieldset> <?php }
function set_chat_localized() { if ($this->get_option('session_poll_type', 'global') == "plugin") { if (wpmudev_chat_validate_config_file($this->_chat_plugin_settings['config_file'], 'ABSPATH') === true) { $this->chat_localized['settings']["ajax_url"] = plugins_url('/wpmudev-chat-ajax.php', __FILE__); } else { //$this->chat_localized['settings']["ajax_url"] = site_url()."/wp-admin/admin-ajax.php?xyz"; $this->chat_localized['settings']["ajax_url"] = admin_url('admin-ajax.php', 'relative'); } } else { //$this->chat_localized['settings']["ajax_url"] = site_url()."/wp-admin/admin-ajax.php?123"; $this->chat_localized['settings']["ajax_url"] = admin_url('admin-ajax.php', 'relative'); } $this->chat_localized['settings']['cookiepath'] = COOKIEPATH; $this->chat_localized['settings']['cookie_domain'] = COOKIE_DOMAIN; //$this->chat_localized['settings']['ABSPATH'] = base64_encode(ABSPATH); $this->chat_localized['settings']['REQUEST_URI'] = base64_encode($_SERVER['REQUEST_URI']); $this->chat_localized['settings']['is_admin'] = is_admin() ? true : false; //$this->chat_localized['settings']['soundManager-js'] = plugins_url('/js/soundmanager2-nodebug-jsmin.js', __FILE__); $this->chat_localized['settings']['soundManager-js'] = plugins_url('/js/buzz.min.js', __FILE__); //$this->chat_localized['settings']['cookie-js'] = plugins_url('/js/jquery-cookie.js', __FILE__); // Need to disable legacy setting. $this->chat_localized['settings']['box_resizable'] = false; $this->chat_localized['sessions'] = $this->chat_sessions; $this->chat_localized['user'] = $this->chat_user; $this->chat_localized['auth'] = $this->chat_auth; $this->chat_localized['auto_scroll']['disable'] = __('Disable auto scroll', $this->translation_domain); $this->chat_localized['auto_scroll']['enable'] = __('Enable auto scroll', $this->translation_domain); wp_localize_script('wpmudev-chat-js', 'wpmudev_chat_localized', $this->chat_localized); }