function vf_add_vanilla_menu() { add_menu_page('Vanilla Forum', 'Vanilla Forum', 'manage_options', 'vf-admin-handle', 'vf_admin_page', plugins_url('VanillaForums/assets/transparent.png')); add_submenu_page('vf-admin-handle', 'Forum Administration', 'Forum Administration', 'manage_options', 'vf-admin-handle', 'vf_admin_page'); // Don't show the various forum pages unless the forum url has been properly defined. if (vf_get_option('url', '') != '') { add_submenu_page('vf-admin-handle', '<Embed> Vanilla', '<Embed> Vanilla', 'manage_options', 'vf-embed-handle', 'vf_embed_admin_page'); add_submenu_page('vf-admin-handle', 'Widgets', 'Widgets', 'manage_options', 'vf-widgets-handle', 'vf_widgets_admin_page'); // add_submenu_page('vf-admin-handle', 'Single Sign-on', 'Single Sign-on', 'manage_options', 'vf-sso-handle', 'vf_sso_admin_page'); } }
function vf_add_vanilla_menu() { add_menu_page('Vanilla Forum', 'Vanilla Forum', 'manage_options', 'vf-admin-handle', 'vf_admin_page', plugins_url('assets/transparent.png', __FILE__)); add_submenu_page('vf-admin-handle', 'Setup', 'Setup', 'manage_options', 'vf-admin-handle', 'vf_admin_page'); // Don't show the various forum pages unless the forum url has been properly defined. if (vf_get_option('url', '') != '') { add_submenu_page('vf-admin-handle', 'Forum Integration', 'Forum Integration', 'manage_options', 'vf-embed-handle', 'vf_embed_admin_page'); add_submenu_page('vf-admin-handle', 'Comment Integration', 'Comment Integration', 'manage_options', 'vf-comment-handle', 'vf_comment_admin_page'); add_submenu_page('vf-admin-handle', 'Widgets', 'Widgets', 'manage_options', 'vf-widgets-handle', 'vf_widgets_admin_page'); add_submenu_page('vf-admin-handle', 'Single Sign-on', 'Single Sign-on', 'manage_options', 'vf-sso-handle', 'vf_sso_admin_page'); } }
/** * Replace the page content with the vanilla embed code if viewing the page that * is supposed to contain the forum. * * @param string $content The content of the current page. */ function vf_embed_content($content) { global $post; if ($post->ID == vf_get_option('embed-post-id')) { $content = stripslashes(vf_get_option('embed-code')); } return $content; }
/** * Place the Vanilla Forum on the external domain redirect whitelist. */ function vf_allowed_redirect_hosts($allowed_hosts, $lp) { $path = str_replace(array('http://', 'https://'), array('', ''), vf_get_option('url')); $ix = strpos($path, '/'); if ($ix !== FALSE) { $path = substr($path, 0, $ix); } if (!in_array($path, $allowed_hosts)) { $allowed_hosts[] = $path; } return $allowed_hosts; }
/** * Removes all of the cookies associated with authentication. * * @since 2.5 */ function wp_clear_auth_cookie() { do_action('clear_auth_cookie'); $VanillaCookiePath = '/'; $VanillaCookieDomain = vf_get_option('vanilla_cookie_domain'); setcookie(AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN); setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN); setcookie(AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN); setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN); setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); // Old cookies setcookie(AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); setcookie(AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); // Even older cookies setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); // WordPress' new Vanilla SSO cookies setcookie(AUTH_COOKIE, ' ', time() - 31536000, $VanillaCookiePath, $VanillaCookieDomain); setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, $VanillaCookiePath, $VanillaCookieDomain); setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, $VanillaCookiePath, $VanillaCookieDomain); setcookie(USER_COOKIE, ' ', time() - 31536000, $VanillaCookiePath, $VanillaCookieDomain); setcookie(PASS_COOKIE, ' ', time() - 31536000, $VanillaCookiePath, $VanillaCookieDomain); // Destroy Vanilla's session cookie as well setcookie(VANILLA_COOKIE, ' ', time() - 31536000, $VanillaCookiePath, $VanillaCookieDomain); }
/** * Replace the page content with the vanilla embed code if viewing the page that * is supposed to contain the forum. * * @param string $content The content of the current page. */ function vf_embed_content($content) { global $post; if ($post->ID == vf_get_option('embed-post-id')) { $content = ''; if ($sso = vf_get_sso_string()) { // Add the sso string for automatic signin. $content = "<script type='text/javascript'>var vanilla_sso = '{$sso}';</script>"; } $content .= stripslashes(vf_get_option('embed-code')); vf_forum_embedded(true); } return $content; }
function vf_anchor($text, $destination, $url = '') { $prefix = substr($destination, 0, 7); if (!in_array($prefix, array('https:/', 'http://', 'mailto:'))) { $url = $url == '' ? vf_get_option('url') : $url; $destination = vf_combine_paths(array($url, $destination), '/'); } return '<a href="' . $destination . '">' . $text . '</a>'; }