function add_to_admin_bar() { global $wp_admin_bar; if (!(defined('WDEB_IS_IN_EASY_MODE') && WDEB_IS_IN_EASY_MODE)) { $href = apply_filters('wdeb_easy_mode_init', WDEB_LANDING_PAGE . '?wdeb_on'); $title = __('Activate easy mode', 'wdeb'); } else { $data = new Wdeb_Options(); $auto_enter_roles = $data->get_option('auto_enter_role'); if (!$auto_enter_roles || !wdeb_current_user_can($auto_enter_roles)) { $href = apply_filters('wdeb_easy_mode_init', WDEB_LANDING_PAGE . '?wdeb_off'); $title = __('Exit easy mode', 'wdeb'); } else { return false; } // Not showing exit easy mode link if not applicable } $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'wdeb-my_sites-ttsb', 'title' => $title, 'href' => $href)); }
define('WDEB_PLUGIN_LOCATION', 'plugins', true); define('WDEB_PLUGIN_BASE_DIR', WP_PLUGIN_DIR, true); define('WDEB_PLUGIN_URL', str_replace('http://', @$_SERVER["HTTPS"] == 'on' ? 'https://' : 'http://', WP_PLUGIN_URL), true); $textdomain_handler = 'load_plugin_textdomain'; } else { // No textdomain is loaded because we can't determine the plugin location. // No point in trying to add textdomain to string and/or localizing it. wp_die(__('There was an issue determining where Post Voting plugin is installed. Please reinstall.')); } } } $textdomain_handler('wdeb', false, WDEB_PLUGIN_SELF_DIRNAME . '/languages/'); define('WDEB_LOGO_URL', WDEB_PLUGIN_URL . '/img/logo.png', true); define('WDEB_LANDING_PAGE', 'index.php', true); require_once WDEB_PLUGIN_BASE_DIR . '/lib/class_wdeb_installer.php'; Wdeb_Installer::check(); require_once WDEB_PLUGIN_BASE_DIR . '/lib/wdeb_callbacks.php'; require_once WDEB_PLUGIN_BASE_DIR . '/lib/class_wdeb_options.php'; Wdeb_Options::populate(); require_once WDEB_PLUGIN_BASE_DIR . '/lib/class_wdeb_plugins_handler.php'; Wdeb_PluginsHandler::init(); add_action('wp_logout', 'wdeb_reset_autostart'); if (is_admin()) { require_once WDEB_PLUGIN_BASE_DIR . '/lib/class_wdeb_admin_form_renderer.php'; require_once WDEB_PLUGIN_BASE_DIR . '/lib/class_wdeb_admin_pages.php'; require_once WDEB_PLUGIN_BASE_DIR . '/lib/class_wdeb_tooltips.php'; require_once WDEB_PLUGIN_BASE_DIR . '/lib/class_wdeb_wizard.php'; Wdeb_AdminPages::serve(); Wdeb_Tooltips::serve(); Wdeb_Wizard::serve(); }
function create_wizard_steps_box() { $opts = new Wdeb_Options(); $steps = $opts->get_option('wizard_steps', 'wdeb_wizard'); $steps = is_array($steps) ? $steps : array(); echo "<ul id='wdeb_steps'>"; $count = 1; foreach ($steps as $step) { echo '<li class="wdeb_step">' . '<h4>' . '<span class="wdeb_step_count">' . $count . '</span>' . ': ' . '<span class="wdeb_step_title">' . $step['title'] . '</span>' . '</h4>' . '<div class="wdeb_step_actions">' . '<a href="#" class="wdeb_step_delete">' . __('Delete', 'wdeb') . '</a>' . ' | ' . '<a href="#" class="wdeb_step_edit">' . __('Edit', 'wdeb') . '</a>' . '</div>' . '<input type="hidden" class="wdeb_step_url" name="wdeb_wizard[wizard_steps][' . $count . '][url]" value="' . esc_url($step['url']) . '" />' . '<input type="hidden" class="wdeb_step_title" name="wdeb_wizard[wizard_steps][' . $count . '][title]" value="' . htmlspecialchars($step['title'], ENT_QUOTES) . '" />' . '<input type="hidden" class="wdeb_step_help" name="wdeb_wizard[wizard_steps][' . $count . '][help]" value="' . htmlspecialchars($step['help'], ENT_QUOTES) . '" />' . "</li>\n"; $count++; } echo "</ul>"; if ($opts->get_option('wizard_enabled', 'wdeb_wizard')) { _e('<p>Drag and drop steps to sort them in the order you want.</p>', 'wdeb'); } else { _e('<p>Enable the Wizard, then drag and drop steps to sort them in the order you want.</p>', 'wdeb'); } }