Esempio n. 1
1
 /**
  * Installs the blog
  *
  * {@internal Missing Long Description}}
  *
  * @since 2.1.0
  *
  * @param string $blog_title Blog title.
  * @param string $user_name User's username.
  * @param string $user_email User's email.
  * @param bool $public Whether blog is public.
  * @param string $deprecated Optional. Not used.
  * @param string $user_password Optional. User's chosen password. Will default to a random password.
  * @param string $language Optional. Language chosen.
  * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
  */
 function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '')
 {
     if (!empty($deprecated)) {
         _deprecated_argument(__FUNCTION__, '2.6');
     }
     wp_check_mysql_version();
     wp_cache_flush();
     make_db_current_silent();
     populate_options();
     populate_roles();
     update_option('blogname', $blog_title);
     update_option('admin_email', $user_email);
     update_option('blog_public', $public);
     if ($language) {
         update_option('WPLANG', $language);
     }
     $guessurl = wp_guess_url();
     update_option('siteurl', $guessurl);
     // If not a public blog, don't ping.
     if (!$public) {
         update_option('default_pingback_flag', 0);
     }
     /*
      * Create default user. If the user already exists, the user tables are
      * being shared among blogs. Just set the role in that case.
      */
     $user_id = username_exists($user_name);
     $user_password = trim($user_password);
     $email_password = false;
     if (!$user_id && empty($user_password)) {
         $user_password = wp_generate_password(12, false);
         $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
         $user_id = wp_create_user($user_name, $user_password, $user_email);
         update_user_option($user_id, 'default_password_nag', true, true);
         $email_password = true;
     } else {
         if (!$user_id) {
             // Password has been provided
             $message = '<em>' . __('Your chosen password.') . '</em>';
             $user_id = wp_create_user($user_name, $user_password, $user_email);
         } else {
             $message = __('User already exists. Password inherited.');
         }
     }
     $user = new WP_User($user_id);
     $user->set_role('administrator');
     wp_install_defaults($user_id);
     flush_rewrite_rules();
     wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
     wp_cache_flush();
     /**
      * Fires after a site is fully installed.
      *
      * @since 3.9.0
      *
      * @param WP_User $user The site owner.
      */
     do_action('wp_install', $user);
     return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
 }
Esempio n. 2
0
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
    global $wpdb;
    $base = '/';
    $domain = JQUERY_STAGING_PREFIX . 'jquery.com';
    wp_check_mysql_version();
    wp_cache_flush();
    make_db_current_silent();
    populate_options();
    populate_roles();
    $user_id = wp_create_user($user_name, trim($user_password), $user_email);
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    $guess_url = wp_guess_url();
    foreach ($wpdb->tables('ms_global') as $table => $prefixed_table) {
        $wpdb->{$table} = $prefixed_table;
    }
    install_network();
    populate_network(1, $domain, $user_email, 'jQuery Network', $base, false);
    update_site_option('site_admins', array($user->user_login));
    update_site_option('allowedthemes', array());
    $wpdb->insert($wpdb->blogs, array('site_id' => 1, 'domain' => $domain, 'path' => $base, 'registered' => current_time('mysql')));
    $blog_id = $wpdb->insert_id;
    update_user_meta($user_id, 'source_domain', $domain);
    update_user_meta($user_id, 'primary_blog', $blog_id);
    if (!($upload_path = get_option('upload_path'))) {
        $upload_path = substr(WP_CONTENT_DIR, strlen(ABSPATH)) . '/uploads';
        update_option('upload_path', $upload_path);
    }
    update_option('fileupload_url', get_option('siteurl') . '/' . $upload_path);
    jquery_install_remaining_sites($user);
    wp_new_blog_notification($blog_title, $guess_url, $user_id, $message = __('The password you chose during the install.'));
    wp_cache_flush();
    return array('url' => $guess_url, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
Esempio n. 3
0
 function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '')
 {
     global $wp_rewrite;
     wp_check_mysql_version();
     wp_cache_flush();
     make_db_current_silent();
     populate_options();
     populate_roles();
     update_option('blogname', $blog_title);
     update_option('admin_email', $user_email);
     update_option('blog_public', $public);
     $guessurl = wp_guess_url();
     update_option('siteurl', $guessurl);
     // If not a public blog, don't ping.
     if (!$public) {
         update_option('default_pingback_flag', 0);
     }
     // Create default user.  If the user already exists, the user tables are
     // being shared among blogs.  Just set the role in that case.
     $user_id = username_exists($user_name);
     if (!$user_id) {
         $random_password = wp_generate_password();
         $user_id = wp_create_user($user_name, $random_password, $user_email);
     } else {
         $random_password = __('User already exists.  Password inherited.');
     }
     $user = new WP_User($user_id);
     $user->set_role('administrator');
     wp_install_defaults($user_id);
     $wp_rewrite->flush_rules();
     wp_new_blog_notification($blog_title, $guessurl, $user_id, $random_password);
     wp_cache_flush();
     return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password);
 }
Esempio n. 4
0
 /**
  * Installs the blog
  *
  * {@internal Missing Long Description}}
  *
  * @since 2.1.0
  *
  * @param string $blog_title Blog title.
  * @param string $user_name User's username.
  * @param string $user_email User's email.
  * @param bool $public Whether blog is public.
  * @param null $deprecated Optional. Not used.
  * @param string $user_password Optional. User's chosen password. Will default to a random password.
  * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
  */
 function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
 {
     if (!empty($deprecated)) {
         _deprecated_argument(__FUNCTION__, '2.6');
     }
     wp_check_mysql_version();
     wp_cache_flush();
     make_db_current_silent();
     if (!is_file(ABSPATH . 'wp-admin/install.sql')) {
         //[ysd]如果有install.sql不设置默认options数据
         populate_options();
     } else {
         validate_active_plugins();
         //[ysd] 禁用 不可用的插件
     }
     populate_roles();
     update_option('blogname', $blog_title);
     update_option('admin_email', $user_email);
     update_option('blog_public', $public);
     $guessurl = isset($_SERVER['HTTP_APPNAME']) ? 'http://' . substr($_SERVER['HTTP_APPNAME'], 5) . '.1kapp.com' : wp_guess_url();
     //[ysd] 固定了guessurl
     update_option('siteurl', $guessurl);
     update_option('home', $guessurl);
     get_option('siteurl');
     // If not a public blog, don't ping.
     if (!$public) {
         update_option('default_pingback_flag', 0);
     }
     // Create default user. If the user already exists, the user tables are
     // being shared among blogs. Just set the role in that case.
     $user_id = username_exists($user_name);
     $user_password = trim($user_password);
     $email_password = false;
     if (!$user_id && empty($user_password)) {
         $user_password = wp_generate_password(12, false);
         $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
         $user_id = wp_create_user($user_name, $user_password, $user_email);
         update_user_option($user_id, 'default_password_nag', true, true);
         $email_password = true;
     } else {
         if (!$user_id) {
             // Password has been provided
             $message = '<em>' . __('Your chosen password.') . '</em>';
             $user_id = wp_create_user($user_name, $user_password, $user_email);
         } else {
             $message = __('User already exists. Password inherited.');
         }
     }
     $user = new WP_User($user_id);
     $user->set_role('administrator');
     if (!file_exists(ABSPATH . 'wp-admin/without_default')) {
         wp_install_defaults($user_id);
     }
     //[ysd],如果打包时设置了默认数据,才会设置默认数据
     flush_rewrite_rules();
     wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
     wp_cache_flush();
     return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
 }
Esempio n. 5
0
/**
 * Create WordPress options and set the default values.
 *
 * @since 1.5.0
 * @uses $wpdb
 * @uses $wp_db_version
 */
function populate_options()
{
    global $wpdb, $wp_db_version, $current_site;
    $guessurl = wp_guess_url();
    do_action('populate_options');
    if (ini_get('safe_mode')) {
        // Safe mode can break mkdir() so use a flat structure by default.
        $uploads_use_yearmonth_folders = 0;
    } else {
        $uploads_use_yearmonth_folders = 1;
    }
    $options = array('siteurl' => $guessurl, 'blogname' => __('My Site'), 'blogdescription' => __('Just another WordPress site'), 'users_can_register' => 0, 'admin_email' => '*****@*****.**', 'start_of_week' => 1, 'use_balanceTags' => 0, 'use_smilies' => 0, 'require_name_email' => 1, 'comments_notify' => 1, 'posts_per_rss' => 10, 'rss_use_excerpt' => 0, 'mailserver_url' => 'mail.example.com', 'mailserver_login' => '*****@*****.**', 'mailserver_pass' => 'password', 'mailserver_port' => 110, 'default_category' => 1, 'default_comment_status' => 'open', 'default_ping_status' => 'open', 'default_pingback_flag' => 1, 'default_post_edit_rows' => 10, 'posts_per_page' => 10, 'date_format' => __('F j, Y'), 'time_format' => __('g:i a'), 'links_updated_date_format' => __('F j, Y g:i a'), 'links_recently_updated_prepend' => '<em>', 'links_recently_updated_append' => '</em>', 'links_recently_updated_time' => 120, 'comment_moderation' => 0, 'moderation_notify' => 1, 'permalink_structure' => '', 'gzipcompression' => 0, 'hack_file' => 0, 'blog_charset' => 'UTF-8', 'moderation_keys' => '', 'active_plugins' => array(), 'home' => $guessurl, 'category_base' => '', 'ping_sites' => 'http://rpc.pingomatic.com/', 'advanced_edit' => 0, 'comment_max_links' => 2, 'gmt_offset' => date('Z') / 3600, 'default_email_category' => 1, 'recently_edited' => '', 'template' => WP_DEFAULT_THEME, 'stylesheet' => WP_DEFAULT_THEME, 'comment_whitelist' => 1, 'blacklist_keys' => '', 'comment_registration' => 0, 'rss_language' => 'en', 'html_type' => 'text/html', 'use_trackback' => 0, 'default_role' => 'subscriber', 'db_version' => $wp_db_version, 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, 'upload_path' => '', 'blog_public' => '1', 'default_link_category' => 2, 'show_on_front' => 'posts', 'tag_base' => '', 'show_avatars' => '1', 'avatar_rating' => 'G', 'upload_url_path' => '', 'thumbnail_size_w' => 150, 'thumbnail_size_h' => 150, 'thumbnail_crop' => 1, 'medium_size_w' => 300, 'medium_size_h' => 300, 'avatar_default' => 'mystery', 'enable_app' => 0, 'enable_xmlrpc' => 0, 'large_size_w' => 1024, 'large_size_h' => 1024, 'image_default_link_type' => 'file', 'image_default_size' => '', 'image_default_align' => '', 'close_comments_for_old_posts' => 0, 'close_comments_days_old' => 14, 'thread_comments' => 1, 'thread_comments_depth' => 5, 'page_comments' => 0, 'comments_per_page' => 50, 'default_comments_page' => 'newest', 'comment_order' => 'asc', 'sticky_posts' => array(), 'widget_categories' => array(), 'widget_text' => array(), 'widget_rss' => array(), 'timezone_string' => '', 'embed_autourls' => 1, 'embed_size_w' => '', 'embed_size_h' => 600, 'page_for_posts' => 0, 'page_on_front' => 0);
    // 3.0 multisite
    if (is_multisite()) {
        /* translators: blog tagline */
        $options['blogdescription'] = sprintf(__('Just another %s site'), $current_site->site_name);
        $options['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/';
    }
    // Set autoload to no for these options
    $fat_options = array('moderation_keys', 'recently_edited', 'blacklist_keys');
    $existing_options = $wpdb->get_col("SELECT option_name FROM {$wpdb->options}");
    $insert = '';
    foreach ($options as $option => $value) {
        if (in_array($option, $existing_options)) {
            continue;
        }
        if (in_array($option, $fat_options)) {
            $autoload = 'no';
        } else {
            $autoload = 'yes';
        }
        $option = $wpdb->escape($option);
        if (is_array($value)) {
            $value = serialize($value);
        }
        $value = $wpdb->escape($value);
        if (!empty($insert)) {
            $insert .= ', ';
        }
        $insert .= "('{$option}', '{$value}', '{$autoload}')";
    }
    if (!empty($insert)) {
        $wpdb->query("INSERT INTO {$wpdb->options} (option_name, option_value, autoload) VALUES " . $insert);
    }
    // in case it is set, but blank, update "home"
    if (!__get_option('home')) {
        update_option('home', $guessurl);
    }
    // Delete unused options
    $unusedoptions = array('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page');
    foreach ($unusedoptions as $option) {
        delete_option($option);
    }
    // delete obsolete magpie stuff
    $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?\$'");
}
Esempio n. 6
0
/**
 * This function overrides wp_install() in wp-admin/includes/upgrade.php
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
    if (!empty($deprecated)) {
        _deprecated_argument(__FUNCTION__, '2.6');
    }
    wp_check_mysql_version();
    wp_cache_flush();
    /* changes */
    require_once PDODIR . 'schema.php';
    make_db_sqlite();
    /* changes */
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    $guessurl = wp_guess_url();
    update_option('siteurl', $guessurl);
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    $user_id = username_exists($user_name);
    $user_password = trim($user_password);
    $email_password = false;
    if (!$user_id && empty($user_password)) {
        $user_password = wp_generate_password(12, false);
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
        $user_id = wp_create_user($user_name, $user_password, $user_email);
        update_user_option($user_id, 'default_password_nag', true, true);
        $email_password = true;
    } else {
        if (!$user_id) {
            $message = '<em>' . __('Your chosen password.') . '</em>';
            $user_id = wp_create_user($user_name, $user_password, $user_email);
        }
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    flush_rewrite_rules();
    wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
    wp_cache_flush();
    if (isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false || isset($_SERVER['SERVER_SIGNATURE']) && stripos($_SERVER['SERVER_SIGNATURE'], 'apache') !== false) {
        // Your server is Apache. Nothing to do more.
    } else {
        $server_message = sprintf('Your webserver doesn\'t seem to be Apache. So the database directory access restriction by the .htaccess file may not function. We strongly recommend that you should restrict the access to the directory %s in some other way.', FQDBDIR);
        echo '<div style="position: absolute; margin-top: 350px; width: 700px; border: .5px dashed rgb(0, 0, 0);"><p style="margin: 10px;">';
        echo $server_message;
        echo '</p></div>';
    }
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
 static function get_inline_exhibit($exhibit)
 {
     global $wp_query;
     if (!($guessurl = site_url())) {
         $guessurl = wp_guess_url();
     }
     $baseuri = $guessurl;
     $exhibituri = $baseuri . '/wp-content/plugins/datapress';
     $exhibitid = $exhibit->get('id');
     $postid = $wp_query->post->ID;
     $height = $exhibit->get('height');
     $exhibit_html = "<iframe src='{$exhibituri}/wp-exhibit-only.php?iframe&exhibitid={$exhibitid}&postid={$postid}&currentview=inline' width='100%' height='{$height}' scrolling='auto' frameborder='0'>\n                                      <p>Your browser does not support iframes.</p>\n                                      </iframe>";
     return $exhibit_html;
 }
Esempio n. 8
0
function thatcamp_newer_posts_link($link_text, $max_pages)
{
    $paged = thatcamp_get_paged();
    if (1 === $paged) {
        return;
    }
    $p = $paged - 1;
    if (false !== strpos(wp_guess_url(), '/page/')) {
        $url = preg_replace('|/page/[0-9]+/|', '/page/' . $p . '/', wp_guess_url());
    } else {
        $url = add_query_arg('paged', $p, wp_guess_url());
    }
    echo '<a href="' . $url . '">' . $link_text . '</a>';
}
/**
 * this function overrides the built in wordpress  variant
 * 
 * @param object $blog_title
 * @param object $user_name
 * @param object $user_email
 * @param object $public
 * @param object $deprecated [optional]
 * @return 
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '')
{
    global $wp_rewrite, $wpdb;
    //wp_check_mysql_version();
    wp_cache_flush();
    /**** changes start here ***/
    switch (DB_TYPE) {
        case 'sqlite':
            require PDODIR . '/driver_sqlite/schema.php';
            installdb();
            break;
        case 'mysql':
            make_db_current_silent();
            break;
    }
    /**** changes end ***/
    $wpdb->suppress_errors();
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    $guessurl = wp_guess_url();
    update_option('siteurl', $guessurl);
    // If not a public blog, don't ping.
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    // Create default user.  If the user already exists, the user tables are
    // being shared among blogs.  Just set the role in that case.
    $user_id = username_exists($user_name);
    if (!$user_id) {
        $random_password = wp_generate_password();
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.<br><br>���' . $random_password);
        $user_id = wp_create_user($user_name, $random_password, $user_email);
        update_usermeta($user_id, 'default_password_nag', true);
    } else {
        $random_password = '';
        $message = __('User already exists.  Password inherited.');
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    $wp_rewrite->flush_rules();
    wp_new_blog_notification($blog_title, $guessurl, $user_id, $random_password);
    wp_cache_flush();
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password, 'password_message' => $message);
}
 /**
  * Load script to your site
  *
  * @param string $load
  * @return string js code
  * @since 0.9.0
  * @author: Tambh
  *
  */
 public function jb_add_script(&$scripts)
 {
     if (!defined('SCRIPT_DEBUG')) {
         define('SCRIPT_DEBUG', $develop_src);
     }
     if (!($guessurl = site_url())) {
         $guessed_url = true;
         $guessurl = wp_guess_url();
     }
     $scripts->base_url = $guessurl;
     do_action('jb_load_script', $scripts);
     if (current_user_can('manage_options')) {
         do_action('jb_load_admin_script', $scripts);
     }
     do_action('jb_after_load_script', $scripts);
 }
/**
 * This function overrides wp_install() in wp-admin/includes/upgrade.php
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
    if (!empty($deprecated)) {
        _deprecated_argument(__FUNCTION__, '2.6');
    }
    wp_check_mysql_version();
    wp_cache_flush();
    /* changes */
    require_once PDODIR . 'schema.php';
    make_db_sqlite();
    /* changes */
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    $guessurl = wp_guess_url();
    update_option('siteurl', $guessurl);
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    $user_id = username_exists($user_name);
    $user_password = trim($user_password);
    $email_password = false;
    if (!$user_id && empty($user_password)) {
        $user_password = wp_generate_password(12, false);
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
        $user_id = wp_create_user($user_name, $user_password, $user_email);
        update_user_option($user_id, 'default_password_nag', true, true);
        $email_password = true;
    } else {
        if (!$user_id) {
            $message = '<em>' . __('Your chosen password.') . '</em>';
            $user_id = wp_create_user($user_name, $user_password, $user_email);
        }
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    flush_rewrite_rules();
    wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
    wp_cache_flush();
    if (isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false || isset($_SERVER['SERVER_SIGNATURE']) && stripos($_SERVER['SERVER_SIGNATURE'], 'apache') !== false) {
        // Your server is Apache. Nothing to do more.
    }
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
Esempio n. 12
0
function bootstrap_admin_wp_default_styles(&$styles)
{
    if (!($guessurl = site_url())) {
        $guessurl = wp_guess_url();
    }
    $styles->base_url = $guessurl;
    $styles->content_url = defined('WP_CONTENT_URL') ? WP_CONTENT_URL : '';
    $styles->default_version = get_bloginfo('version');
    $styles->text_direction = function_exists('is_rtl') && is_rtl() ? 'rtl' : 'ltr';
    $styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    $rtl_styles = array('wp-admin', 'ie', 'media', 'admin-bar', 'customize-controls', 'media-views', 'wp-color-picker');
    // Any rtl stylesheets that don't have a .min version
    $no_suffix = array('farbtastic');
    $styles->add('wp-admin', "/wp-admin/css/wp-admin{$suffix}.css");
    $styles->add('ie', "/wp-admin/css/ie{$suffix}.css");
    $styles->add_data('ie', 'conditional', 'lte IE 7');
    // Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
    $styles->add('colors', true, array('wp-admin', 'buttons'));
    // do not refer to these directly, the right one is queued by the above "meta" colors handle
    // $styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array('wp-admin', 'buttons') );
    // $styles->add( 'colors-classic', "/wp-admin/css/colors-classic$suffix.css", array('wp-admin', 'buttons') );
    $styles->add('media', "/wp-admin/css/media{$suffix}.css");
    $styles->add('install', "/wp-admin/css/install{$suffix}.css", array('buttons'));
    $styles->add('thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20121105');
    $styles->add('farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1');
    $styles->add('wp-color-picker', "/wp-admin/css/color-picker{$suffix}.css");
    $styles->add('jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.10');
    $styles->add('imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8');
    $styles->add('admin-bar', "/wp-includes/css/admin-bar{$suffix}.css");
    $styles->add('wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog{$suffix}.css");
    $styles->add('editor-buttons', "/wp-includes/css/editor{$suffix}.css");
    $styles->add('wp-pointer', "/wp-includes/css/wp-pointer{$suffix}.css");
    $styles->add('customize-controls', "/wp-admin/css/customize-controls{$suffix}.css", array('wp-admin', 'colors', 'ie'));
    $styles->add('media-views', "/wp-includes/css/media-views{$suffix}.css", array('buttons'));
    // $styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" );
    $styles->add('buttons', plugins_url('assets/css/buttons.css', __FILE__));
    foreach ($rtl_styles as $rtl_style) {
        $styles->add_data($rtl_style, 'rtl', true);
        if ($suffix && !in_array($rtl_style, $no_suffix)) {
            $styles->add_data($rtl_style, 'suffix', $suffix);
        }
    }
}
Esempio n. 13
0
 function htmlContent()
 {
     $kind = $this->get('kind');
     $uri = $this->get('uri');
     $sourcename = $this->get('sourcename');
     if ($kind == 'google-spreadsheet') {
         return "<link rel=\"exhibit/data\" type=\"application/jsonp\" href=\"{$uri}\" ex:converter=\"googleSpreadsheets\" alt=\"{$sourcename}\"/>";
     } else {
         if ($kind == 'application/json') {
             if ($this->get('data_location') == 'local') {
                 return "<link href=\"{$uri}\" type\"application/json\" rel=\"exhibit/data\" alt=\"{$sourcename}\" />";
             } else {
                 if (!($guessurl = site_url())) {
                     $guessurl = wp_guess_url();
                 }
                 $baseuri = $guessurl;
                 $exhibituri = $baseuri . '/wp-content/plugins/datapress';
                 $parrotbase = $exhibituri . '/proxy/parrot.php';
                 return "<link href=\"{$parrotbase}" . '?url=' . urlencode($uri) . "\" type=\"application/json\" rel=\"exhibit/data\" alt=\"{$sourcename}\" />";
             }
         }
     }
 }
/**
 * Add the "My Account" menu and all submenus.
 *
 * @since BuddyPress (1.6)
 * @todo Deprecate WP 3.2 Toolbar compatibility when we drop 3.2 support
 */
function bp_members_admin_bar_my_account_menu()
{
    global $bp, $wp_admin_bar;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        // Stored in the global so we can add menus easily later on
        $bp->my_account_menu_id = 'my-account-buddypress';
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'group' => true, 'title' => __('Edit My Profile', 'buddypress'), 'href' => bp_loggedin_user_domain(), 'meta' => array('class' => 'ab-sub-secondary')));
        // Show login and sign-up links
    } elseif (!empty($wp_admin_bar)) {
        add_filter('show_admin_bar', '__return_true');
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => wp_login_url(wp_guess_url())));
        // Sign up
        if (bp_get_signup_allowed()) {
            $wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
Esempio n. 15
0
 function get_bloginfo()
 {
     return wp_guess_url();
 }
/**
 * Defines cookie related WordPress constants
 *
 * Defines constants after multisite is loaded.
 * @since 3.0.0
 */
function wp_cookie_constants()
{
    /**
     * Used to guarantee unique hash cookies
     *
     * @since 1.5.0
     */
    if (!defined('COOKIEHASH')) {
        $siteurl = get_site_option('siteurl');
        if ($siteurl) {
            define('COOKIEHASH', md5($siteurl));
        } else {
            define('COOKIEHASH', md5(wp_guess_url()));
        }
    }
    /**
     * @since 2.0.0
     */
    if (!defined('USER_COOKIE')) {
        define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
    }
    /**
     * @since 2.0.0
     */
    if (!defined('PASS_COOKIE')) {
        define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
    }
    /**
     * @since 2.5.0
     */
    if (!defined('AUTH_COOKIE')) {
        define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
    }
    /**
     * @since 2.6.0
     */
    if (!defined('SECURE_AUTH_COOKIE')) {
        define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
    }
    /**
     * @since 2.6.0
     */
    if (!defined('LOGGED_IN_COOKIE')) {
        define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
    }
    /**
     * @since 2.3.0
     */
    if (!defined('TEST_COOKIE')) {
        define('TEST_COOKIE', 'wordpress_test_cookie');
    }
    /**
     * @since 1.2.0
     */
    if (!defined('COOKIEPATH')) {
        define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/'));
    }
    /**
     * @since 1.5.0
     */
    if (!defined('SITECOOKIEPATH')) {
        define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/'));
    }
    /**
     * @since 2.6.0
     */
    if (!defined('ADMIN_COOKIE_PATH')) {
        define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin');
    }
    /**
     * @since 2.6.0
     */
    if (!defined('PLUGINS_COOKIE_PATH')) {
        define('PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL));
    }
    /**
     * @since 2.0.0
     */
    if (!defined('COOKIE_DOMAIN')) {
        define('COOKIE_DOMAIN', false);
    }
}
 /**
  * Try to determine if a URL is pointing to internal content.
  *
  * @param $url
  * @param string $type front-matter, part, chapter, back-matter, ...
  * @param int $pos (optional) position of content, used when creating filenames like: chapter-001, chapter-002, ...
  *
  * @return bool|string
  */
 protected function fuzzyHrefMatch($url, $type, $pos)
 {
     if (!$pos) {
         return false;
     }
     $url = trim($url);
     $url = rtrim($url, '/');
     $last_part = explode('/', $url);
     $last_pos = count($last_part) - 1;
     $anchor = '';
     // Look for #anchors
     if ($last_pos > 0 && '#' == substr(trim($last_part[$last_pos]), 0, 1)) {
         $anchor = trim($last_part[$last_pos]);
         $last_part = trim($last_part[$last_pos - 1]);
     } elseif (false !== strpos($last_part[$last_pos], '#')) {
         list($last_part, $anchor) = explode('#', $last_part[$last_pos]);
         $anchor = trim("#{$anchor}");
         $last_part = trim($last_part);
     } else {
         $last_part = trim($last_part[$last_pos]);
     }
     if (!$last_part) {
         return false;
     }
     $lookup = \PressBooks\Book::getBookStructure();
     $lookup = $lookup['__export_lookup'];
     if (!isset($lookup[$last_part])) {
         return false;
     }
     $domain = parse_url($url);
     $domain = @$domain['host'];
     if ($domain) {
         $domain2 = parse_url(wp_guess_url());
         if ($domain != @$domain2['host']) {
             return false;
         }
     }
     // Seems legit...
     $new_type = $lookup[$last_part];
     $new_pos = 0;
     foreach ($lookup as $p => $t) {
         if ($t == $new_type) {
             ++$new_pos;
         }
         if ($p == $last_part) {
             break;
         }
     }
     $new_url = "{$new_type}-" . sprintf("%03s", $new_pos) . "-{$last_part}.{$this->filext}";
     if ($anchor) {
         $new_url .= $anchor;
     }
     return $new_url;
 }
Esempio n. 18
0
?>
>
			Yes, please hide WP Admin from the user when they aren't logged in.</label>
		<br />
		<br />
		<h3>WordPress Login URL</h3>
		<label> Change the WordPress Login URL? <?php 
echo wp_guess_url() . '/';
?>
			<input type="text" name="login_base" value="<?php 
echo $this->login_base;
?>
" />
			<br />
			<em>This will change it from <?php 
echo wp_guess_url();
?>
/wp-login.php to whatever you put in this box. If you leave it <strong>blank</strong>, it will be disabled.<br />
			Say if you put "<strong>login</strong>" into the box, your new login URL will be <?php 
echo home_url();
?>
/login/.</em></label>
		<?php 
global $auth_obj;
$url = home_url() . '/' . $this->login_base;
?>
		<p>Your current login URL is <code><a href="<?php 
echo $url;
?>
"><?php 
echo $url;
<?php

if (!($guessurl = site_url())) {
    $guessurl = wp_guess_url();
}
$baseuri = $guessurl;
$exhibituri = $baseuri . '/wp-content/plugins/datapress';
?>
<p><b>A <i>List Facet</i> lets you browse through buckets of items in you Exhibit data.</b></p>
<table>
	<tr>
	    <td><i>Facet Title</i></td>
	    <td><input id="exhibit-facet-list-label" type="text" size="30" /></td>
	    <td></td>
	</tr>
	<tr class="help">
	    <td colspan=3>
	    </td>
	<tr>
	    <td><i>Use Field</i></td>
	    <td><select id="exhibit-facet-list-field" class="allpropbox"></select></td>
	    <td></td>
	</tr>
    <tr>
		<td>Facet Location Relative to View</td>	
		<td>
		  <select id="exhibit-facet-list-location">
		    <option value="left">Left</option>
		    <option value="right">Right</option>
    		<option value="top">Top</option>
    		<option selected value="bottom">Bottom</option>
 * If neither set of conditions is true, initiate loading the setup process.
 */
if (file_exists(ABSPATH . 'wp-config.php')) {
    /** The config file resides in ABSPATH */
    require_once ABSPATH . 'wp-config.php';
} elseif (@file_exists(dirname(ABSPATH) . '/wp-config.php') && !@file_exists(dirname(ABSPATH) . '/wp-settings.php')) {
    /** The config file resides one level above ABSPATH but is not part of another install */
    require_once dirname(ABSPATH) . '/wp-config.php';
} else {
    // A config file doesn't exist
    define('WPINC', 'wp-includes');
    require_once ABSPATH . WPINC . '/load.php';
    // Standardize $_SERVER variables across setups.
    wp_fix_server_vars();
    require_once ABSPATH . WPINC . '/functions.php';
    $path = wp_guess_url() . '/wp-admin/setup-config.php';
    /*
     * We're going to redirect to setup-config.php. While this shouldn't result
     * in an infinite loop, that's a silly thing to assume, don't you think? If
     * we're traveling in circles, our last-ditch effort is "Need more help?"
     */
    if (false === strpos($_SERVER['REQUEST_URI'], 'setup-config')) {
        header('Location: ' . $path);
        exit;
    }
    define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
    require_once ABSPATH . WPINC . '/version.php';
    wp_check_php_mysql_versions();
    wp_load_translations_early();
    // Die with an error message
    $die = sprintf(__("There doesn't seem to be a %s file. I need this before we can get started."), '<code>wp-config.php</code>') . '</p>';
 /**
  * AJAX function for previewing a SlideDeck in an iframe
  *
  * @param int $_GET['slidedeck_id'] The ID of the SlideDeck to load
  * @param int $_GET['width'] The width of the preview window
  * @param int $_GET['height'] The height of the preview window
  * @param int $_GET['outer_width'] The width of the SlideDeck in the preview
  * window
  * @param int $_GET['outer_height'] The height of the SlideDeck in the
  * preview window
  *
  * @return the preview window as templated in views/preview-iframe.php
  */
 function ajax_preview_iframe()
 {
     global $wp_scripts, $wp_styles;
     $slidedeck_id = $_GET['slidedeck'];
     if (isset($_GET['width']) && is_numeric($_GET['width'])) {
         $width = $_GET['width'];
     }
     if (isset($_GET['height']) && is_numeric($_GET['height'])) {
         $height = $_GET['height'];
     }
     if (isset($_GET['outer_width']) && is_numeric($_GET['outer_width'])) {
         $outer_width = $_GET['outer_width'];
     }
     if (isset($_GET['outer_height']) && is_numeric($_GET['outer_height'])) {
         $outer_height = $_GET['outer_height'];
     }
     $start_slide = false;
     if (isset($_GET['start']) && is_numeric($_GET['start'])) {
         $start_slide = (int) $_GET['start'];
     }
     $slidedeck = $this->SlideDeck->get($slidedeck_id);
     /**
      * If there's no width or height specified, we should infer the 
      * width and height based on the outer width or outer height.
      */
     if (empty($width) || empty($height)) {
         $slidedeck_dimensions = $this->SlideDeck->get_dimensions($slidedeck);
         // $width_diff = $slidedeck_dimensions['outer_width'] - $slidedeck_dimensions['width'];
         // $height_diff = $slidedeck_dimensions['outer_height'] - $slidedeck_dimensions['height'];
         if (empty($width)) {
             $width = $outer_width;
         }
         if (empty($height)) {
             $height = $outer_height;
         }
         $slidedeck['options']['size'] = 'custom';
         $slidedeck['options']['width'] = $width;
         $slidedeck['options']['height'] = $height;
     }
     $lens = $this->Lens->get($slidedeck['lens']);
     // Is this a preview or an iframe=1 shortcode embed?
     $preview = false;
     if (isset($_GET['preview'])) {
         if ((int) $_GET['preview'] === 1) {
             $this->preview = $preview = true;
         }
     }
     // Is this a RESS shortcode embed?
     $ress = false;
     if (isset($_GET['slidedeck_unique_id'])) {
         if (!empty($_GET['slidedeck_unique_id'])) {
             $ress = true;
         }
     }
     // Kill caching if using W3TC when updating the preview
     if ($preview) {
         header("Cache-Control: no-cache, must-revalidate");
         header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
         if (!defined('DONOTCACHEOBJECT')) {
             define('DONOTCACHEOBJECT', true);
         }
         if (!defined('DONOTCACHEPAGE')) {
             define('DONOTCACHEPAGE', true);
         }
         if (!defined('DONOTCACHEDB')) {
             define('DONOTCACHEDB', true);
         }
     }
     $namespace = $this->namespace;
     if (isset($outer_width)) {
         $preview_scale_ratio = $outer_width / 347;
         $preview_font_size = intval(min($preview_scale_ratio * 1000, 1139)) / 1000;
     }
     $scripts = apply_filters("{$this->namespace}_iframe_scripts", array('jquery', 'jquery-easing', 'scrolling-js', 'slidedeck-library-js', 'slidedeck-public', 'jail'), $slidedeck);
     $content_url = defined('WP_CONTENT_URL') ? WP_CONTENT_URL : '';
     $base_url = !site_url() ? wp_guess_url() : site_url();
     include SLIDEDECK2_DIRNAME . '/views/preview-iframe.php';
     exit;
 }
Esempio n. 22
0
    /**
     * Adds a hidden "redirect_to" input field to the sidebar login form.
     *
     * @since BuddyPress (1.5)
     */
    function bp_dtheme_sidebar_login_redirect_to()
    {
        $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : wp_guess_url();
        $redirect_to = apply_filters('bp_no_access_redirect', $redirect_to);
        ?>

	<input type="hidden" name="redirect_to" value="<?php 
        echo esc_attr($redirect_to);
        ?>
" />

<?php 
    }
Esempio n. 23
0
/**
 * Redirects to the installer if WordPress is not installed.
 *
 * Dies with an error message when multisite is enabled.
 *
 * @access private
 * @since 3.0.0
 */
function wp_not_installed()
{
    if (is_multisite()) {
        if (!is_blog_installed() && !defined('WP_INSTALLING')) {
            wp_die(__('The site you have requested is not installed properly. Please contact the system administrator.'));
        }
    } elseif (!is_blog_installed() && false === strpos($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) {
        $link = wp_guess_url() . '/wp-admin/install.php';
        require ABSPATH . WPINC . '/kses.php';
        require ABSPATH . WPINC . '/pluggable.php';
        require ABSPATH . WPINC . '/formatting.php';
        wp_redirect($link);
        die;
    }
}
Esempio n. 24
0
/**
 * Create WordPress options and set the default values.
 *
 * @since 1.5.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 * @global int  $wp_db_version
 * @global int  $wp_current_db_version
 */
function populate_options()
{
    global $wpdb, $wp_db_version, $wp_current_db_version;
    $guessurl = wp_guess_url();
    /**
     * Fires before creating WordPress options and populating their default values.
     *
     * @since 2.6.0
     */
    do_action('populate_options');
    if (ini_get('safe_mode')) {
        // Safe mode can break mkdir() so use a flat structure by default.
        $uploads_use_yearmonth_folders = 0;
    } else {
        $uploads_use_yearmonth_folders = 1;
    }
    // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.
    $stylesheet = $template = WP_DEFAULT_THEME;
    $theme = wp_get_theme(WP_DEFAULT_THEME);
    if (!$theme->exists()) {
        $theme = WP_Theme::get_core_default_theme();
    }
    // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do.
    if ($theme) {
        $stylesheet = $theme->get_stylesheet();
        $template = $theme->get_template();
    }
    $timezone_string = '';
    $gmt_offset = 0;
    /* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
    	   or a valid timezone string (America/New_York). See http://us3.php.net/manual/en/timezones.php
    	   for all timezone strings supported by PHP.
    	*/
    $offset_or_tz = _x('0', 'default GMT offset or timezone string');
    if (is_numeric($offset_or_tz)) {
        $gmt_offset = $offset_or_tz;
    } elseif ($offset_or_tz && in_array($offset_or_tz, timezone_identifiers_list())) {
        $timezone_string = $offset_or_tz;
    }
    $options = array('siteurl' => $guessurl, 'home' => $guessurl, 'blogname' => __('My Site'), 'blogdescription' => __('Just another WordPress site'), 'users_can_register' => 0, 'admin_email' => '*****@*****.**', 'start_of_week' => _x('1', 'start of week'), 'use_balanceTags' => 0, 'use_smilies' => 1, 'require_name_email' => 1, 'comments_notify' => 1, 'posts_per_rss' => 10, 'rss_use_excerpt' => 0, 'mailserver_url' => 'mail.example.com', 'mailserver_login' => '*****@*****.**', 'mailserver_pass' => 'password', 'mailserver_port' => 110, 'default_category' => 1, 'default_comment_status' => 'closed', 'default_ping_status' => 'closed', 'default_pingback_flag' => 0, 'posts_per_page' => 10, 'date_format' => __('Y/m/d'), 'time_format' => __('H:i'), 'links_updated_date_format' => __('Y/m/d H:i'), 'comment_moderation' => 0, 'moderation_notify' => 1, 'permalink_structure' => '', 'hack_file' => 0, 'blog_charset' => 'UTF-8', 'moderation_keys' => '', 'active_plugins' => array(), 'category_base' => '', 'ping_sites' => 'http://rpc.pingomatic.com/', 'comment_max_links' => 2, 'gmt_offset' => $gmt_offset, 'default_email_category' => 1, 'recently_edited' => '', 'template' => $template, 'stylesheet' => $stylesheet, 'comment_whitelist' => 1, 'blacklist_keys' => '', 'comment_registration' => 0, 'html_type' => 'text/html', 'use_trackback' => 0, 'default_role' => 'subscriber', 'db_version' => $wp_db_version, 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, 'upload_path' => '', 'blog_public' => '1', 'default_link_category' => 2, 'show_on_front' => 'page', 'tag_base' => '', 'show_avatars' => '1', 'avatar_rating' => 'G', 'upload_url_path' => '', 'thumbnail_size_w' => 150, 'thumbnail_size_h' => 150, 'thumbnail_crop' => 1, 'medium_size_w' => 300, 'medium_size_h' => 300, 'avatar_default' => 'mystery', 'large_size_w' => 1024, 'large_size_h' => 1024, 'image_default_link_type' => 'none', 'image_default_size' => '', 'image_default_align' => '', 'close_comments_for_old_posts' => 0, 'close_comments_days_old' => 14, 'thread_comments' => 1, 'thread_comments_depth' => 5, 'page_comments' => 0, 'comments_per_page' => 50, 'default_comments_page' => 'newest', 'comment_order' => 'asc', 'sticky_posts' => array(), 'widget_categories' => array(), 'widget_text' => array(), 'widget_rss' => array(), 'uninstall_plugins' => array(), 'timezone_string' => $timezone_string, 'page_for_posts' => 0, 'page_on_front' => 2, 'default_post_format' => 0, 'link_manager_enabled' => 0, 'finished_splitting_shared_terms' => 1, 'site_icon' => 0, 'medium_large_size_w' => 768, 'medium_large_size_h' => 0);
    // 3.3
    if (!is_multisite()) {
        $options['initial_db_version'] = !empty($wp_current_db_version) && $wp_current_db_version < $wp_db_version ? $wp_current_db_version : $wp_db_version;
    }
    // 3.0 multisite
    if (is_multisite()) {
        /* translators: blog tagline */
        $options['blogdescription'] = sprintf(__('Just another %s site'), get_current_site()->site_name);
        $options['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/';
    }
    // Set autoload to no for these options
    $fat_options = array('moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins');
    $keys = "'" . implode("', '", array_keys($options)) . "'";
    $existing_options = $wpdb->get_col("SELECT option_name FROM {$wpdb->options} WHERE option_name in ( {$keys} )");
    $insert = '';
    foreach ($options as $option => $value) {
        if (in_array($option, $existing_options)) {
            continue;
        }
        if (in_array($option, $fat_options)) {
            $autoload = 'no';
        } else {
            $autoload = 'yes';
        }
        if (is_array($value)) {
            $value = serialize($value);
        }
        if (!empty($insert)) {
            $insert .= ', ';
        }
        $insert .= $wpdb->prepare("(%s, %s, %s)", $option, $value, $autoload);
    }
    if (!empty($insert)) {
        $wpdb->query("INSERT INTO {$wpdb->options} (option_name, option_value, autoload) VALUES " . $insert);
    }
    // In case it is set, but blank, update "home".
    if (!__get_option('home')) {
        update_option('home', $guessurl);
    }
    // Delete unused options.
    $unusedoptions = array('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'links_recently_updated_time', 'links_recently_updated_prepend', 'links_recently_updated_append', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', 'embed_autourls', 'default_post_edit_rows', 'gzipcompression', 'advanced_edit');
    foreach ($unusedoptions as $option) {
        delete_option($option);
    }
    // Delete obsolete magpie stuff.
    $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?\$'");
    /*
     * Deletes all expired transients. The multi-table delete syntax is used
     * to delete the transient record from table a, and the corresponding
     * transient_timeout record from table b.
     */
    $time = time();
    $sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\n\t\tWHERE a.option_name LIKE %s\n\t\tAND a.option_name NOT LIKE %s\n\t\tAND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )\n\t\tAND b.option_value < %d";
    $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_') . '%', $wpdb->esc_like('_transient_timeout_') . '%', $time));
    if (is_main_site() && is_main_network()) {
        $sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\n\t\t\tWHERE a.option_name LIKE %s\n\t\t\tAND a.option_name NOT LIKE %s\n\t\t\tAND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )\n\t\t\tAND b.option_value < %d";
        $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_site_transient_') . '%', $wpdb->esc_like('_site_transient_timeout_') . '%', $time));
    }
}
Esempio n. 25
0
    /**
     * Display the login widget.
     *
     * @see WP_Widget::widget() for description of parameters.
     *
     * @param array $args Widget arguments.
     * @param array $instance Widget settings, as saved by the user.
     */
    public function widget($args, $instance)
    {
        $title = isset($instance['title']) ? $instance['title'] : '';
        $title = apply_filters('widget_title', $title);
        echo $args['before_widget'];
        echo $args['before_title'] . esc_html($title) . $args['after_title'];
        ?>

		<?php 
        if (is_user_logged_in()) {
            ?>

			<?php 
            do_action('bp_before_login_widget_loggedin');
            ?>

			<div class="bp-login-widget-user-avatar">
				<a href="<?php 
            echo bp_loggedin_user_domain();
            ?>
">
					<?php 
            bp_loggedin_user_avatar('type=thumb&width=50&height=50');
            ?>
				</a>
			</div>

			<div class="bp-login-widget-user-links">
				<div class="bp-login-widget-user-link"><?php 
            echo bp_core_get_userlink(bp_loggedin_user_id());
            ?>
</div>
				<div class="bp-login-widget-user-logout"><a class="logout" href="<?php 
            echo wp_logout_url(wp_guess_url());
            ?>
"><?php 
            _e('Log Out', 'buddypress');
            ?>
</a></div>
			</div>

			<?php 
            do_action('bp_after_login_widget_loggedin');
            ?>

		<?php 
        } else {
            ?>

			<?php 
            do_action('bp_before_login_widget_loggedout');
            ?>

			<form name="bp-login-form" id="bp-login-widget-form" class="standard-form" action="<?php 
            echo esc_url(site_url('wp-login.php', 'login_post'));
            ?>
" method="post">
				<label for="bp-login-widget-user-login"><?php 
            _e('Username', 'buddypress');
            ?>
</label>
				<input type="text" name="log" id="bp-login-widget-user-login" class="input" value="" />

				<label for="bp-login-widget-user-pass"><?php 
            _e('Password', 'buddypress');
            ?>
</label>
				<input type="password" name="pwd" id="bp-login-widget-user-pass" class="input" value=""  />

				<div class="forgetmenot"><label><input name="rememberme" type="checkbox" id="bp-login-widget-rememberme" value="forever" /> <?php 
            _e('Remember Me', 'buddypress');
            ?>
</label></div>

				<input type="submit" name="wp-submit" id="bp-login-widget-submit" value="<?php 
            esc_attr_e('Log In', 'buddypress');
            ?>
" />

				<?php 
            if (bp_get_signup_allowed()) {
                ?>

					<span class="bp-login-widget-register-link"><?php 
                printf(__('<a href="%s" title="Register for a new account">Register</a>', 'buddypress'), bp_get_signup_page());
                ?>
</span>

				<?php 
            }
            ?>

			</form>

			<?php 
            do_action('bp_after_login_widget_loggedout');
            ?>

		<?php 
        }
        echo $args['after_widget'];
    }
/**
 * Assign default styles to $styles object.
 *
 * Nothing is returned, because the $styles parameter is passed by reference.
 * Meaning that whatever object is passed will be updated without having to
 * reassign the variable that was passed back to the same value. This saves
 * memory.
 *
 * Adding default styles is not the only task, it also assigns the base_url
 * property, the default version, and text direction for the object.
 *
 * @since 2.6.0
 *
 * @param object $styles
 */
function wp_default_styles(&$styles)
{
    // This checks to see if site_url() returns something and if it does not
    // then it assigns $guess_url to wp_guess_url(). Strange format, but it works.
    if (!($guessurl = site_url())) {
        $guessurl = wp_guess_url();
    }
    $styles->base_url = $guessurl;
    $styles->content_url = defined('WP_CONTENT_URL') ? WP_CONTENT_URL : '';
    $styles->default_version = get_bloginfo('version');
    $styles->text_direction = function_exists('is_rtl') && is_rtl() ? 'rtl' : 'ltr';
    $styles->default_dirs = array('/wp-admin/');
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
    $rtl_styles = array('wp-admin', 'global', 'colors', 'colors-fresh', 'colors-classic', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'nav-menu', 'farbtastic', 'admin-bar', 'wplink', 'theme-install');
    // Any rtl stylesheets that don't have a .dev version for ltr
    $no_suffix = array('farbtastic');
    $styles->add('wp-admin', "/wp-admin/css/wp-admin{$suffix}.css", array(), '20110214');
    $styles->add('ie', "/wp-admin/css/ie{$suffix}.css", array(), '20101102');
    $styles->add_data('ie', 'conditional', 'lte IE 7');
    // all colors stylesheets need to have the same query strings (cache manifest compat)
    $colors_version = '20110121';
    // Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
    $styles->add('colors', true, array(), $colors_version);
    // do not refer to these directly, the right one is queued by the above "meta" colors handle
    $styles->add('colors-fresh', "/wp-admin/css/colors-fresh{$suffix}.css", array(), $colors_version);
    $styles->add('colors-classic', "/wp-admin/css/colors-classic{$suffix}.css", array(), $colors_version);
    $styles->add('ms', "/wp-admin/css/ms{$suffix}.css", array(), '20101213');
    $styles->add('global', "/wp-admin/css/global{$suffix}.css", array(), '20110121');
    $styles->add('media', "/wp-admin/css/media{$suffix}.css", array(), '20110121');
    $styles->add('widgets', "/wp-admin/css/widgets{$suffix}.css", array(), '20110104');
    $styles->add('dashboard', "/wp-admin/css/dashboard{$suffix}.css", array(), '20110121');
    $styles->add('install', "/wp-admin/css/install{$suffix}.css", array(), '20110121');
    // Readme as well
    $styles->add('theme-editor', "/wp-admin/css/theme-editor{$suffix}.css", array(), '20101203');
    $styles->add('press-this', "/wp-admin/css/press-this{$suffix}.css", array(), '20110121');
    $styles->add('thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514');
    $styles->add('login', "/wp-admin/css/login{$suffix}.css", array(), '20110121');
    $styles->add('plugin-install', "/wp-admin/css/plugin-install{$suffix}.css", array(), '20101230');
    $styles->add('theme-install', "/wp-admin/css/theme-install{$suffix}.css", array(), '20101226');
    $styles->add('farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u');
    $styles->add('jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8');
    $styles->add('imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1');
    $styles->add('nav-menu', "/wp-admin/css/nav-menu{$suffix}.css", array(), '20100907');
    $styles->add('admin-bar', "/wp-includes/css/admin-bar{$suffix}.css", array(), '20110325');
    $styles->add('wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog{$suffix}.css", array(), '20101224');
    $styles->add('wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink{$suffix}.css", array(), '20101224');
    foreach ($rtl_styles as $rtl_style) {
        $styles->add_data($rtl_style, 'rtl', true);
        if ($suffix && !in_array($rtl_style, $no_suffix)) {
            $styles->add_data($rtl_style, 'suffix', $suffix);
        }
    }
}
Esempio n. 27
0
/**
 * Redirect to the installer if WordPress is not installed.
 *
 * Dies with an error message when Multisite is enabled.
 *
 * @since 3.0.0
 * @access private
 */
function wp_not_installed()
{
    if (is_multisite()) {
        if (!is_blog_installed() && !wp_installing()) {
            nocache_headers();
            wp_die(__('The site you have requested is not installed properly. Please contact the system administrator.'));
        }
    } elseif (!is_blog_installed() && !wp_installing()) {
        nocache_headers();
        require ABSPATH . WPINC . '/kses.php';
        require ABSPATH . WPINC . '/pluggable.php';
        require ABSPATH . WPINC . '/formatting.php';
        $link = wp_guess_url() . '/wp-admin/install.php';
        wp_redirect($link);
        die;
    }
}
Esempio n. 28
0
esc_html_e('Change the WordPress Login URL:', 'lockdown-wp-admin');
?>
			<?php 
echo wp_guess_url() . '/';
?>
			<input type="text" name="login_base" value="<?php 
echo $this->instance->application->getLoginBase();
?>
" />
			<br>
			<em>
				<?php 
echo esc_html(sprintf(__('This will change it from %s/wp-login.php to whatever you put in this box. If you leave it blank, it will be disabled.', 'lockdown-wp-admin'), wp_guess_url()));
?>
				<?php 
echo esc_html(sprintf(__('If you put \'login\' into the box, your new login URL will be %s/login/.', 'lockdown-wp-admin'), wp_guess_url()));
?>
			</em>
		</label>
		<?php 
$url = home_url() . '/' . $this->instance->application->getLoginBase();
?>
		<p>
			<?php 
echo esc_html_e('Your current login URL is', 'lockdown-wp-admin');
?>
			<code><a href="<?php 
echo $url;
?>
"><?php 
echo $url;
Esempio n. 29
0
/**
 * Assign default styles to $styles object.
 *
 * Nothing is returned, because the $styles parameter is passed by reference.
 * Meaning that whatever object is passed will be updated without having to
 * reassign the variable that was passed back to the same value. This saves
 * memory.
 *
 * Adding default styles is not the only task, it also assigns the base_url
 * property, the default version, and text direction for the object.
 *
 * @since 2.6.0
 *
 * @param WP_Styles $styles
 */
function wp_default_styles(&$styles)
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (!defined('SCRIPT_DEBUG')) {
        define('SCRIPT_DEBUG', false !== strpos($wp_version, '-src'));
    }
    if (!($guessurl = site_url())) {
        $guessurl = wp_guess_url();
    }
    $styles->base_url = $guessurl;
    $styles->content_url = defined('WP_CONTENT_URL') ? WP_CONTENT_URL : '';
    $styles->default_version = get_bloginfo('version');
    $styles->text_direction = function_exists('is_rtl') && is_rtl() ? 'rtl' : 'ltr';
    $styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
    $open_sans_font_url = '';
    /* translators: If there are characters in your language that are not supported
     * by Open Sans, translate this to 'off'. Do not translate into your own language.
     */
    if ('off' !== _x('on', 'Open Sans font: on or off')) {
        $subsets = 'latin,latin-ext';
        /* translators: To add an additional Open Sans character subset specific to your language,
         * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
         */
        $subset = _x('no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)');
        if ('cyrillic' == $subset) {
            $subsets .= ',cyrillic,cyrillic-ext';
        } elseif ('greek' == $subset) {
            $subsets .= ',greek,greek-ext';
        } elseif ('vietnamese' == $subset) {
            $subsets .= ',vietnamese';
        }
        // Hotlink Open Sans, for now
        $open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset={$subsets}";
    }
    // Register a stylesheet for the selected admin color scheme.
    $styles->add('colors', true, array('wp-admin', 'buttons', 'open-sans', 'dashicons'));
    $suffix = SCRIPT_DEBUG ? '' : '.min';
    // Admin CSS
    $styles->add('wp-admin', "/wp-admin/css/wp-admin{$suffix}.css", array('open-sans', 'dashicons'));
    $styles->add('login', "/wp-admin/css/login{$suffix}.css", array('buttons', 'open-sans', 'dashicons'));
    $styles->add('install', "/wp-admin/css/install{$suffix}.css", array('buttons', 'open-sans'));
    $styles->add('wp-color-picker', "/wp-admin/css/color-picker{$suffix}.css");
    $styles->add('customize-controls', "/wp-admin/css/customize-controls{$suffix}.css", array('wp-admin', 'colors', 'ie', 'imgareaselect'));
    $styles->add('customize-widgets', "/wp-admin/css/customize-widgets{$suffix}.css", array('wp-admin', 'colors'));
    $styles->add('customize-nav-menus', "/wp-admin/css/customize-nav-menus{$suffix}.css", array('wp-admin', 'colors'));
    $styles->add('press-this', "/wp-admin/css/press-this{$suffix}.css", array('open-sans', 'buttons'));
    $styles->add('ie', "/wp-admin/css/ie{$suffix}.css");
    $styles->add_data('ie', 'conditional', 'lte IE 7');
    // Common dependencies
    $styles->add('buttons', "/wp-includes/css/buttons{$suffix}.css");
    $styles->add('dashicons', "/wp-includes/css/dashicons{$suffix}.css");
    $styles->add('open-sans', $open_sans_font_url);
    // Includes CSS
    $styles->add('admin-bar', "/wp-includes/css/admin-bar{$suffix}.css", array('open-sans', 'dashicons'));
    $styles->add('wp-auth-check', "/wp-includes/css/wp-auth-check{$suffix}.css", array('dashicons'));
    $styles->add('editor-buttons', "/wp-includes/css/editor{$suffix}.css", array('dashicons'));
    $styles->add('media-views', "/wp-includes/css/media-views{$suffix}.css", array('buttons', 'dashicons', 'wp-mediaelement'));
    $styles->add('wp-pointer', "/wp-includes/css/wp-pointer{$suffix}.css", array('dashicons'));
    $styles->add('customize-preview', "/wp-includes/css/customize-preview{$suffix}.css");
    // External libraries and friends
    $styles->add('imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8');
    $styles->add('wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog{$suffix}.css", array('dashicons'));
    $styles->add('mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.17.0');
    $styles->add('wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.css", array('mediaelement'));
    $styles->add('thickbox', '/wp-includes/js/thickbox/thickbox.css', array('dashicons'));
    // Deprecated CSS
    $styles->add('media', "/wp-admin/css/deprecated-media{$suffix}.css");
    $styles->add('farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1');
    $styles->add('jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12');
    $styles->add('colors-fresh', false, array('wp-admin', 'buttons'));
    // Old handle.
    // RTL CSS
    $rtl_styles = array('wp-admin', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'ie', 'login', 'press-this', 'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer', 'wp-jquery-ui-dialog', 'media', 'farbtastic');
    foreach ($rtl_styles as $rtl_style) {
        $styles->add_data($rtl_style, 'rtl', 'replace');
        if ($suffix) {
            $styles->add_data($rtl_style, 'suffix', $suffix);
        }
    }
}
Esempio n. 30
0
				<a href="<?php 
    echo bp_loggedin_user_domain();
    ?>
" class="user-avtar">
					<?php 
    bp_loggedin_user_avatar('type=thumb&width=50&height=50');
    ?>
				</a>

				<div class="user-name">
					<strong><?php 
    echo bp_core_get_userlink(bp_loggedin_user_id());
    ?>
</strong>									   
					<a class="logout sidebar-logout" href="<?php 
    echo wp_logout_url(wp_guess_url());
    ?>
"><?php 
    _e('Log Out', 'bp-magic');
    ?>
</a>
				</div>

				<?php 
    do_action('bp_sidebar_me');
    ?>


			</div><!-- end of sidebar me -->   
	    </div> <!--end of user-info-login box -->
	<?php