当前位置: 首页>>代码示例>>PHP>>正文


PHP get_id_from_blogname函数代码示例

本文整理汇总了PHP中get_id_from_blogname函数的典型用法代码示例。如果您正苦于以下问题:PHP get_id_from_blogname函数的具体用法?PHP get_id_from_blogname怎么用?PHP get_id_from_blogname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_id_from_blogname函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_get_id_from_blogname_invalid_slug

 public function test_get_id_from_blogname_invalid_slug()
 {
     global $current_site;
     $original_network = $current_site;
     $current_site = get_network(self::$network_ids['wordpress.org/']);
     $result = get_id_from_blogname('bar');
     $current_site = $original_network;
     $this->assertEquals(null, $result);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:9,代码来源:getIdFromBlogname.php

示例2: test_created_site_details

 /**
  * Test the cache keys and database tables setup through the creation of a site.
  */
 function test_created_site_details()
 {
     global $wpdb;
     $blog_id = self::factory()->blog->create();
     $this->assertInternalType('int', $blog_id);
     $prefix = $wpdb->get_blog_prefix($blog_id);
     // $get_all = false, only retrieve details from the blogs table
     $details = get_blog_details($blog_id, false);
     // Combine domain and path for a site specific cache key.
     $key = md5($details->domain . $details->path);
     $this->assertEquals($details, wp_cache_get($blog_id . 'short', 'blog-details'));
     // get_id_from_blogname(), see #20950
     $this->assertEquals($blog_id, get_id_from_blogname($details->path));
     $this->assertEquals($blog_id, wp_cache_get('get_id_from_blogname_' . trim($details->path, '/'), 'blog-details'));
     // get_blogaddress_by_name()
     $this->assertEquals('http://' . $details->domain . $details->path, get_blogaddress_by_name(trim($details->path, '/')));
     // These are empty until get_blog_details() is called with $get_all = true
     $this->assertEquals(false, wp_cache_get($blog_id, 'blog-details'));
     $this->assertEquals(false, wp_cache_get($key, 'blog-lookup'));
     // $get_all = true, populate the full blog-details cache and the blog slug lookup cache
     $details = get_blog_details($blog_id, true);
     $this->assertEquals($details, wp_cache_get($blog_id, 'blog-details'));
     $this->assertEquals($details, wp_cache_get($key, 'blog-lookup'));
     // Check existence of each database table for the created site.
     foreach ($wpdb->tables('blog', false) as $table) {
         $suppress = $wpdb->suppress_errors();
         $table_fields = $wpdb->get_results("DESCRIBE {$prefix}{$table};");
         $wpdb->suppress_errors($suppress);
         // The table should exist.
         $this->assertNotEmpty($table_fields);
         // And the table should not be empty, unless commentmeta, termmeta, or links.
         $result = $wpdb->get_results("SELECT * FROM {$prefix}{$table} LIMIT 1");
         if ('commentmeta' == $table || 'termmeta' == $table || 'links' == $table) {
             $this->assertEmpty($result);
         } else {
             $this->assertNotEmpty($result);
         }
     }
     // update the blog count cache to use get_blog_count()
     wp_update_network_counts();
     $this->assertEquals(2, (int) get_blog_count());
 }
开发者ID:ntwb,项目名称:wordpress-travis,代码行数:45,代码来源:site.php

示例3: avoid_blog_page_permalink_collision

function avoid_blog_page_permalink_collision($data, $postarr)
{
    if (constant('VHOST') == 'yes') {
        return $data;
    }
    if ($data['post_type'] != 'page') {
        return $data;
    }
    if (!isset($data['post_name']) || $data['post_name'] == '') {
        return $data;
    }
    if (!is_main_blog()) {
        return $data;
    }
    $post_name = $data['post_name'];
    $c = 0;
    while ($c < 10 && get_id_from_blogname($post_name)) {
        $post_name .= mt_rand(1, 10);
        $c++;
    }
    if ($post_name != $data['post_name']) {
        $data['post_name'] = $post_name;
    }
    return $data;
}
开发者ID:joelglennwright,项目名称:agencypress,代码行数:25,代码来源:mu.php

示例4: create_site

 /**
  * Create site
  */
 function create_site($sitename, $sitetitle)
 {
     global $wpdb, $current_site, $current_user;
     get_currentuserinfo();
     $blog_id = '';
     $user_id = '';
     $base = '/';
     $tmp_domain = strtolower(esc_html($sitename));
     if (constant('VHOST') == 'yes') {
         $tmp_site_domain = $tmp_domain . '.' . $current_site->domain;
         $tmp_site_path = $base;
     } else {
         $tmp_site_domain = $current_site->domain;
         $tmp_site_path = $base . $tmp_domain . '/';
     }
     //------------------------------------------------------------------------------------
     // TO DO:
     // - Feed these from fields on the admin page to allow other admins to be created
     // - Add ability to create new admin users at the same time
     //------------------------------------------------------------------------------------
     $create_user_name = '';
     $create_user_email = $current_user->user_email;
     $create_user_pass = '';
     $create_site_name = $sitename;
     $create_site_title = $sitetitle;
     $user = get_user_by_email($create_user_email);
     if (!empty($user)) {
         // user exists
         $user_id = $user->ID;
     } else {
         // create user
         if ($create_user_pass == '' || $create_user_pass == strtolower('null')) {
             $create_user_pass = wp_generate_password();
         }
         $user_id = wpmu_create_user($create_user_name, $create_user_pass, $create_user_email);
         if (false == $user_id) {
             die('<p>' . __('There was an error creating a user', 'ns_cloner') . '</p>');
         } else {
             $this->log("User: {$create_user_name} created with Password: {$create_user_pass}");
         }
     }
     $site_id = get_id_from_blogname($create_site_name);
     if (!empty($site_id)) {
         // site exists
         // don't continue
         //die( '<p>' . __( 'That site already exists', 'ns_cloner' ) . '</p>' );
         // Clear the querystring and add the results
         wp_redirect(add_query_arg(array('error' => 'true', 'errormsg' => urlencode(__('That site already exists!', 'ns_cloner')), 'updated' => false, 'updatedmsg' => false), wp_get_referer()));
         die;
     } else {
         // create site and don't forget to make public:
         $meta['public'] = 1;
         $site_id = wpmu_create_blog($tmp_site_domain, $tmp_site_path, $create_site_title, $user_id, $meta, $current_site->id);
         if (!is_wp_error($site_id)) {
             //send email
             //wpmu_welcome_notification( $site_id, $user_id, $create_user_pass, esc_html( $create_site_title ), '' );
             $this->log('Site: ' . $tmp_site_domain . $tmp_site_path . ' created!');
             //assign target id for cloning and replacing
             $this->target_id = $site_id;
         } else {
             $this->log('Error creating site: ' . $tmp_site_domain . $tmp_site_path . ' - ' . $site_id->get_error_message());
         }
     }
 }
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:67,代码来源:ns-cloner.php

示例5: get_blog_details

function get_blog_details($id, $getall = true)
{
    global $wpdb;
    if (!is_numeric($id)) {
        $id = get_id_from_blogname($id);
    }
    $all = $getall == true ? '' : 'short';
    $details = wp_cache_get($id . $all, 'blog-details');
    if ($details) {
        if ($details == -1) {
            return false;
        } elseif (!is_object($details)) {
            // Clear old pre-serialized objects. Cache clients do better with that.
            wp_cache_delete($id . $all, 'blog-details');
        } else {
            return $details;
        }
    }
    $details = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d /* get_blog_details */", $id));
    if (!$details) {
        wp_cache_set($id . $all, -1, 'blog-details');
        return false;
    }
    if (!$getall) {
        wp_cache_add($id . $all, $details, 'blog-details');
        return $details;
    }
    $wpdb->suppress_errors();
    $details->blogname = get_blog_option($id, 'blogname');
    $details->siteurl = get_blog_option($id, 'siteurl');
    $details->post_count = get_blog_option($id, 'post_count');
    $wpdb->suppress_errors(false);
    $details = apply_filters('blog_details', $details);
    wp_cache_set($id . $all, $details, 'blog-details');
    $key = md5($details->domain . $details->path);
    wp_cache_set($key, $details, 'blog-lookup');
    return $details;
}
开发者ID:joelglennwright,项目名称:agencypress,代码行数:38,代码来源:wpmu-functions.php

示例6: get_blog_details

/**
 * Retrieve the details for a blog from the blogs table and blog options.
 *
 * @since MU
 *
 * @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against. Optional. If not specified the current blog ID is used.
 * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
 * @return object Blog details.
 */
function get_blog_details($fields = null, $get_all = true)
{
    global $wpdb;
    if (is_array($fields)) {
        if (isset($fields['blog_id'])) {
            $blog_id = $fields['blog_id'];
        } elseif (isset($fields['domain']) && isset($fields['path'])) {
            $key = md5($fields['domain'] . $fields['path']);
            $blog = wp_cache_get($key, 'blog-lookup');
            if (false !== $blog) {
                return $blog;
            }
            if (substr($fields['domain'], 0, 4) == 'www.') {
                $nowww = substr($fields['domain'], 4);
                $blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path']));
            } else {
                $blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $fields['domain'], $fields['path']));
            }
            if ($blog) {
                wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
                $blog_id = $blog->blog_id;
            } else {
                return false;
            }
        } elseif (isset($fields['domain']) && is_subdomain_install()) {
            $key = md5($fields['domain']);
            $blog = wp_cache_get($key, 'blog-lookup');
            if (false !== $blog) {
                return $blog;
            }
            if (substr($fields['domain'], 0, 4) == 'www.') {
                $nowww = substr($fields['domain'], 4);
                $blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain']));
            } else {
                $blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE domain = %s", $fields['domain']));
            }
            if ($blog) {
                wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
                $blog_id = $blog->blog_id;
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        if (!$fields) {
            $blog_id = get_current_blog_id();
        } elseif (!is_numeric($fields)) {
            $blog_id = get_id_from_blogname($fields);
        } else {
            $blog_id = $fields;
        }
    }
    $blog_id = (int) $blog_id;
    $all = $get_all == true ? '' : 'short';
    $details = wp_cache_get($blog_id . $all, 'blog-details');
    if ($details) {
        if (!is_object($details)) {
            if ($details == -1) {
                return false;
            } else {
                // Clear old pre-serialized objects. Cache clients do better with that.
                wp_cache_delete($blog_id . $all, 'blog-details');
                unset($details);
            }
        } else {
            return $details;
        }
    }
    // Try the other cache.
    if ($get_all) {
        $details = wp_cache_get($blog_id . 'short', 'blog-details');
    } else {
        $details = wp_cache_get($blog_id, 'blog-details');
        // If short was requested and full cache is set, we can return.
        if ($details) {
            if (!is_object($details)) {
                if ($details == -1) {
                    return false;
                } else {
                    // Clear old pre-serialized objects. Cache clients do better with that.
                    wp_cache_delete($blog_id, 'blog-details');
                    unset($details);
                }
            } else {
                return $details;
            }
        }
    }
    if (empty($details)) {
//.........这里部分代码省略.........
开发者ID:trinoamez,项目名称:WordpressPlatzi,代码行数:101,代码来源:ms-blogs.php

示例7: get_id_from_blogname

 /** RESTful endpoint for this multisite function.
  *
  * Get $_REQUEST options for this endpoint:
  *
  * u (optional) -- Username (if not logged in)
  * p (optional) -- Password (if not logged in)
  * name (required) blog name retrieve id for
  *
  * Returns blog_id or error
  */
 public function get_id_from_blogname()
 {
     global $json_api;
     $this->_verify_admin();
     extract($_REQUEST);
     if (!isset($blogname)) {
         $json_api->error(__("You must send the 'blogname' parameter."));
     }
     $blog_id = get_id_from_blogname($blogname);
     return array("blog_id" => $blog_id);
 }
开发者ID:vccabral,项目名称:wp-json-api,代码行数:21,代码来源:multisite.php

示例8: wp_idea_stream_root_slug_conflict_check

/**
 * Checks for rewrite conflicts, displays a warning if any
 *
 * @package WP Idea Stream
 * @subpackage admin/settings
 *
 * @since 2.0.0
 *
 * @param  string $slug the plugin's root slug
 * @uses   wp_idea_stream() to get plugin's main instance
 * @uses   get_posts() to look for a posts or a page having a post name like root slug
 * @uses   esc_url() to sanitize an url
 * @uses   get_edit_post_link() to get the edit link of the found post or page
 * @uses   bbp_get_root_slug() to get bbPress forums root slug
 * @uses   add_query_arg() to add query vars to an url
 * @uses   admin_url() to build a link inside the current blog's Administration
 * @uses   is_multisite() to check the WordPress config
 * @uses   get_id_from_blogname() to check if a blog exists having the same slug than the plugin's root slug
 * @uses   get_current_blog_id() to get the current blog ID
 * @uses   get_home_url() to get the blog's home page
 * @uses   is_super_admin() to check if the current user is a Super Administrator
 * @uses   network_admin_url() to build a link inside the network Administration
 * @uses   apply_filters() call 'wp_idea_stream_root_slug_conflict_check' to let plugins add their own warning messages
 * @return string HTML output
 */
function wp_idea_stream_root_slug_conflict_check($slug = 'ideastream')
{
    // Initialize attention
    $attention = array();
    /**
     * For pages and posts, problem can occur if the permalink setting is set to
     * '/%postname%/' In that case a post will be listed in post archive pages but the
     * single post may arrive on the IdeaStream Archive page.
     */
    if ('/%postname%/' == wp_idea_stream()->pretty_links) {
        // Check for posts having a post name == root IdeaStream slug
        $post = get_posts(array('name' => $slug, 'post_type' => array('post', 'page')));
        if (!empty($post)) {
            $post = $post[0];
            $conflict = sprintf(_x('this %s', 'ideastream settings root slug conflict', 'wp-idea-stream'), $post->post_type);
            $attention[] = '<strong><a href="' . esc_url(get_edit_post_link($post->ID)) . '">' . $conflict . '</strong>';
        }
    }
    /**
     * We need to check for bbPress forum's root prefix, if called the same way than
     * the root prefix of ideastream, then forums archive won't be reachable.
     */
    if (function_exists('bbp_get_root_slug') && $slug == bbp_get_root_slug()) {
        $conflict = _x('bbPress forum root slug', 'bbPress possible conflict', 'wp-idea-stream');
        $attention[] = '<strong><a href="' . esc_url(add_query_arg(array('page' => 'bbpress'), admin_url('options-general.php'))) . '">' . $conflict . '</strong>';
    }
    /**
     * Finally, in case of a multisite config, we need to check if a child blog is called
     * the same way than the ideastream root slug
     */
    if (is_multisite()) {
        $blog_id = (int) get_id_from_blogname($slug);
        $current_blog_id = (int) get_current_blog_id();
        $current_site = get_current_site();
        if (!empty($blog_id) && $blog_id != $current_blog_id && $current_site->blog_id == $current_blog_id) {
            $conflict = _x('child blog slug', 'Child blog possible conflict', 'wp-idea-stream');
            $blog_url = get_home_url($blog_id, '/');
            if (is_super_admin()) {
                $blog_url = add_query_arg(array('id' => $blog_id), network_admin_url('site-info.php'));
            }
            $attention[] = '<strong><a href="' . esc_url($blog_url) . '">' . $conflict . '</strong>';
        }
    }
    /**
     * Other plugins can come in there to draw attention ;)
     *
     * @param array  $attention list of slug conflicts
     * @param string $slug      the plugin's root slug
     */
    $attention = apply_filters('wp_idea_stream_root_slug_conflict_check', $attention, $slug);
    // Display warnings if needed
    if (!empty($attention)) {
        ?>

		<span class="attention"><?php 
        printf(esc_html__('Possible conflict with: %s', 'wp-idea-stream'), join(', ', $attention));
        ?>
</span>

		<?php 
    }
}
开发者ID:BoweFrankema,项目名称:wp-idea-stream,代码行数:87,代码来源:settings.php

示例9: getPosts

 /**
  * Get related posts
  *
  * @since 1.0
  * @author Modern Tribe
  * @param string $tags comma-separated list of tags.
  * @param int $count number of related posts to return.
  * @param string $blog the blog from which to fetch the related posts.
  * @param bool $only_display_related whether to display only related posts or others as well.
  * @param string $post_type the type of post to return.
  * @return array the related posts.
  */
 public function getPosts($tags = array(), $count = 5, $blog = false, $only_display_related = false, $post_type = 'post')
 {
     $post_id = get_the_ID();
     if (is_string($tags)) {
         $tags = explode(',', $tags);
     }
     if (isset(self::$cache[$post_id]) && true == false) {
         return self::$cache[$post_id];
     }
     if (count($tags) == 0 || $tags == false) {
         // get tag from current post.
         $posttags = get_the_tags(get_the_ID());
         // Abstract the list of slugs from the tags.
         if (is_array($posttags)) {
             foreach ($posttags as $k => $v) {
                 $tags[] = $v->slug;
             }
         }
     }
     if (count($tags) > 0) {
         if ($blog && !is_numeric($blog)) {
             $blog = get_id_from_blogname($blog);
         }
         if ($blog) {
             switch_to_blog($blog);
         }
         $exclude = array($post_id);
         if (is_array($tags)) {
             $tags = join(',', $tags);
         }
         $args = array('tag' => $tags, 'numberposts' => $count, 'exclude' => $exclude, 'post_type' => $post_type, 'orderby' => 'rand');
         // filter the args
         $args = apply_filters('tribe-related-posts-args', $args);
         $posts = get_posts($args);
         // If result count is not high enough, then find more unrelated posts to fill the extra slots
         if ($only_display_related == false && count($posts) < $count) {
             foreach ($posts as $post) {
                 $exclude[] = $post->ID;
             }
             $args = array('numberposts' => $count - count($posts), 'exclude' => $exclude, 'post_type' => $post_type, 'orderby' => 'rand');
             $args = apply_filters('tribe-related-posts-args-extra', $args);
             $posts = array_merge($posts, get_posts($args));
         }
         if ($blog) {
             restore_current_blog();
         }
         self::$cache[$post_id] = $posts;
     } else {
         self::$cache[$post_id] = array();
     }
     return self::$cache[$post_id];
 }
开发者ID:mpaskew,项目名称:isc-dev,代码行数:64,代码来源:tribe-related-posts.class.php

示例10: _get_attributes

 /**
  * Set the shortcode attributes to a class variable for access in other methods
  * @param array $atts the array of attributes to store
  * @return array the parsed list of attributes
  */
 function _get_attributes($atts = array())
 {
     global $blog_id;
     if (array_key_exists('blog', $atts)) {
         if (is_numeric($atts['blog'])) {
             $atts['blog_id'] = $atts['blog'];
         } else {
             $tmp = get_id_from_blogname($atts['blog']);
             if (is_numeric($tmp)) {
                 $atts['blog_id'] = $tmp;
             }
         }
     }
     if (array_key_exists('post_name', $atts)) {
         $tmp = $this->get_id_from_post_name($atts['post_name'], $atts['blog_id']);
         if (false !== $tmp) {
             $atts['id'] = $tmp;
         }
     }
     $this->shortcode_atts = shortcode_atts($this->defaults, $atts);
     $this->is_true($this->shortcode_atts['show_excerpt']);
     $this->is_true($this->shortcode_atts['show_image']);
     $this->is_true($this->shortcode_atts['show_title']);
     $this->is_true($this->shortcode_atts['show_author']);
     $this->is_true($this->shortcode_atts['show_date']);
     $this->is_true($this->shortcode_atts['show_comments']);
     $this->is_true($this->shortcode_atts['read_more']);
     $this->is_true($this->shortcode_atts['strip_html']);
     $this->is_true($this->shortcode_atts['exclude_current']);
     $this->is_true($this->shortcode_atts['shortcodes']);
     return $this->shortcode_atts;
 }
开发者ID:kivivuori,项目名称:jotain,代码行数:37,代码来源:class-post-content-shortcodes.php

示例11: get_blog_details

/**
 * Retrieve the details for a blog from the blogs table and blog options.
 *
 * @since 3.0.0
 * @param int|string|array $fields A blog ID, a blog name, or an array of fields to query against.
 * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
 * @return object Blog details.
 */
function get_blog_details($fields, $get_all = true)
{
    global $wpdb;
    if (is_array($fields)) {
        if (isset($fields['blog_id'])) {
            $blog_id = $fields['blog_id'];
        } elseif (isset($fields['domain']) && isset($fields['path'])) {
            $key = md5($fields['domain'] . $fields['path']);
            $blog = wp_cache_get($key, 'blog-lookup');
            if (false !== $blog) {
                return $blog;
            }
            $blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $fields['domain'], $fields['path']));
            if ($blog) {
                wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
                $blog_id = $blog->blog_id;
            } else {
                return false;
            }
        } elseif (isset($fields['domain']) && is_subdomain_install()) {
            $key = md5($fields['domain']);
            $blog = wp_cache_get($key, 'blog-lookup');
            if (false !== $blog) {
                return $blog;
            }
            $blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE domain = %s", $fields['domain']));
            if ($blog) {
                wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
                $blog_id = $blog->blog_id;
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        if (!is_numeric($fields)) {
            $blog_id = get_id_from_blogname($fields);
        } else {
            $blog_id = $fields;
        }
    }
    $blog_id = (int) $blog_id;
    $all = $get_all == true ? '' : 'short';
    $details = wp_cache_get($blog_id . $all, 'blog-details');
    if ($details) {
        if (!is_object($details)) {
            if ($details == -1) {
                return false;
            } else {
                // Clear old pre-serialized objects. Cache clients do better with that.
                wp_cache_delete($blog_id . $all, 'blog-details');
                unset($details);
            }
        } else {
            return $details;
        }
    }
    // Try the other cache.
    if ($get_all) {
        $details = wp_cache_get($blog_id . 'short', 'blog-details');
    } else {
        $details = wp_cache_get($blog_id, 'blog-details');
        // If short was requested and full cache is set, we can return.
        if ($details) {
            if (!is_object($details)) {
                if ($details == -1) {
                    return false;
                } else {
                    // Clear old pre-serialized objects. Cache clients do better with that.
                    wp_cache_delete($blog_id, 'blog-details');
                    unset($details);
                }
            } else {
                return $details;
            }
        }
    }
    if (empty($details)) {
        $details = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d /* get_blog_details */", $blog_id));
        if (!$details) {
            // Set the full cache.
            wp_cache_set($blog_id, -1, 'blog-details');
            return false;
        }
    }
    if (!$get_all) {
        wp_cache_set($blog_id . $all, $details, 'blog-details');
        return $details;
    }
    $details->blogname = get_blog_option($blog_id, 'blogname');
    $details->siteurl = get_blog_option($blog_id, 'siteurl');
//.........这里部分代码省略.........
开发者ID:beaucollins,项目名称:wp,代码行数:101,代码来源:ms-blogs.php

示例12: xtecweekblog_validate_name

/**
 * Validates xtecweekblog name.
 * 
 * @param int $post_id Post ID.
 * 
 * @return bool True if xtecweekblog name validates, false otherwise.
 */
function xtecweekblog_validate_name($post_id)
{
    if (!get_id_from_blogname(get_post_meta($post_id, '_xtecweekblog-name', true))) {
        return false;
    } else {
        return true;
    }
}
开发者ID:ignacioabejaro,项目名称:xtecblocs,代码行数:15,代码来源:xtec-weekblog2.php

示例13: get_template_directory

			<?php 
    }
    ?>
		</div> <!--end of article -->	
	</div>
	<?php 
    // comments
    include_once get_template_directory() . '/comments.php';
} else {
    if (function_exists('xtecweekblog_current_weekblog')) {
        global $post;
        $weekblog = xtecweekblog_current_weekblog();
        if (count($weekblog) > 0 && xtecweekblog_validate($weekblog->ID)) {
            $wb_name = get_post_meta($weekblog->ID, '_xtecweekblog-name', true);
            $wb_url = get_blogaddress_by_name($wb_name);
            $wb_id = get_id_from_blogname($wb_name);
            $wb_blog_title = get_bloginfo('title');
            $wb_description = get_post_meta($weekblog->ID, '_xtecweekblog-description', true);
            ?>
	
				<div id="weekblog-box" class="box">
					<span class="contentboxheadright"></span>
					<span class="contentboxheadleft"></span>
					<h2 class="contentboxheadfons">Bloc destacat</h2>
					<div id="bloc_destacat">
						<a href="<?php 
            echo $wb_url;
            ?>
" target="_blank" title="<?php 
            $wb_blog_title;
            ?>
开发者ID:ignacioabejaro,项目名称:xtecblocs,代码行数:31,代码来源:content.php

示例14: render_payment_submitted

 public static function render_payment_submitted($render_data = array(), $show_trial = false)
 {
     global $psts;
     // Try going stateless, or check the session
     if (empty($render_data)) {
         $render_data = array();
         $render_data['new_blog_details'] = ProSites_Helper_Session::session('new_blog_details');
     }
     if (!isset($render_data['upgraded_blog_details'])) {
         $render_data['upgraded_blog_details'] = ProSites_Helper_Session::session('upgraded_blog_details');
     }
     $content = '<div id="psts-payment-info-received">';
     $email = '';
     if (!is_user_logged_in()) {
         if (isset($render_data['new_blog_detail']) && isset($render_data['new_blog_details']['email'])) {
             $email = $render_data['new_blog_details']['email'];
         }
     } else {
         $user = wp_get_current_user();
         $email = $user->user_email;
     }
     /**
      * @todo: update $_SESSION for 'upgraded_blog_details'
      */
     // Get the blog id... try the session or get it from the database
     $upgrade_blog_id = isset($render_data['upgraded_blog_details']['blog_id']) ? $render_data['upgraded_blog_details']['blog_id'] : 0;
     $new_blog_id = isset($render_data['new_blog_details']['blog_id']) ? $render_data['new_blog_details']['blog_id'] : 0;
     $new_blog_name = isset($render_data['new_blog_details']['blogname']) ? $render_data['new_blog_details']['blogname'] : '';
     $blog_id = !empty($upgrade_blog_id) ? $upgrade_blog_id : !empty($new_blog_id) ? $new_blog_id : !empty($new_blog_name) ? get_id_from_blogname($new_blog_name) : 0;
     switch_to_blog($blog_id);
     $blog_admin_url = admin_url();
     restore_current_blog();
     $content .= '<h2>' . esc_html__('Finalizing your site...', 'psts') . '</h2>';
     if (!$show_trial) {
         $content .= '<p>' . esc_html__('Your payment is being processed and you should soon receive an email with your site details.', 'psts') . '</p>';
     } else {
         $content .= '<p>' . esc_html__('Your site trial has been setup and you should soon receive an email with your site details. Once your trial finishes you will be prompted to upgrade manually.', 'psts') . '</p>';
     }
     $username = '';
     $userpass = isset($render_data['new_blog_details']['user_pass']) ? $render_data['new_blog_details']['user_pass'] : '';
     if (isset($render_data['new_blog_details']['username'])) {
         $username = $render_data['new_blog_details']['username'];
     } else {
         $user = wp_get_current_user();
         $username = $user->user_login;
     }
     $content .= '<p><strong>' . esc_html__('Your login details are:', 'psts') . '</strong></p>';
     $content .= '<p>' . sprintf(esc_html__('Username: %s', 'psts'), $username);
     // Any passwords for existing users here will be wrong, so just don't display it.
     if (!empty($userpass)) {
         $content .= '<br />' . sprintf(esc_html__('Password: %s', 'psts'), $userpass);
     }
     $content .= '<br />' . esc_html__('Admin URL: ', 'psts') . '<a href="' . esc_url($blog_admin_url) . '">' . esc_html__($blog_admin_url) . '</a></p>';
     $content .= '<p>' . esc_html__('If you did not receive an email please try the following:', 'psts') . '</p>';
     $content .= '<ul>' . '<li>' . esc_html__('Wait a little bit longer.', 'psts') . '</li>' . '<li>' . esc_html__('Check your spam folder just in case it ended up in there.', 'psts') . '</li>' . '<li>' . esc_html__('Make sure that your email address is correct (' . $email . ')', 'psts') . '</li>' . '</ul>';
     $content .= '<p>' . esc_html__('If your email address is incorrect or you noticed a problem, please contact us to resolve the issue.', 'psts') . '</p>';
     if (!empty($blog_admin_url) && !is_user_logged_in()) {
         $content .= '<a class="button" href="' . esc_url($blog_admin_url) . '">' . esc_html__('Login Now', 'psts') . '</a>';
     }
     $content .= '</div>';
     ProSites_Helper_Session::unset_session('new_blog_details');
     ProSites_Helper_Session::unset_session('upgraded_blog_details');
     ProSites_Helper_Session::unset_session('activation_key');
     return $content;
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:65,代码来源:Gateway.php

示例15: formAddByUrl

 /**
  * Add Book by URL
  */
 static function formAddByUrl()
 {
     check_admin_referer('bulk-books');
     // Nonce auto-generated by WP_List_Table
     $catalog = new static();
     $user_id = $catalog->getUserId();
     // Set Redirect URL
     if (get_current_user_id() != $user_id) {
         $redirect_url = get_bloginfo('url') . '/wp-admin/index.php?page=pb_catalog&user_id=' . $user_id;
     } else {
         $redirect_url = get_bloginfo('url') . '/wp-admin/index.php?page=pb_catalog';
     }
     $url = parse_url(\PressBooks\Sanitize\canonicalize_url($_REQUEST['add_book_by_url']));
     $main = parse_url(network_site_url());
     if (strpos($url['host'], $main['host']) === false) {
         $_SESSION['pb_errors'][] = __('Invalid URL.', 'pressbooks');
         \PressBooks\Redirect\location($redirect_url);
     }
     if ($url['host'] == $main['host']) {
         // Get slug using the path
         $slug = str_replace($main['path'], '', $url['path']);
         $slug = trim($slug, '/');
         $slug = explode('/', $slug);
         $slug = $slug[0];
     } else {
         // Get slug using host
         $slug = str_replace($main['host'], '', $url['host']);
         $slug = trim($slug, '.');
         $slug = explode('.', $slug);
         $slug = $slug[0];
     }
     $book_id = get_id_from_blogname($slug);
     if (!$book_id) {
         $_SESSION['pb_errors'][] = __('No book found.', 'pressbooks');
         \PressBooks\Redirect\location($redirect_url);
     }
     //		if ( ! get_blog_option( $book_id, 'blog_public' ) ) {
     //			$_SESSION['pb_errors'][] = __( 'Book is not public', 'pressbooks' );
     //			\PressBooks\Redirect\location( $redirect_url );
     //		}
     $catalog->saveBook($book_id, array());
     $catalog->deleteCache();
     // Ok!
     $_SESSION['pb_notices'][] = __('Settings saved.');
     // Redirect back to form
     \PressBooks\Redirect\location($redirect_url);
 }
开发者ID:cumi,项目名称:pressbooks,代码行数:50,代码来源:class-pb-catalog.php


注:本文中的get_id_from_blogname函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。