コード例 #1
0
/**
 * Output the input fields for the blog creation form.
 *
 * @param string          $blogname   Optional. The default blog name (path or domain).
 * @param string          $blog_title Optional. The default blog title.
 * @param string|WP_Error $errors     Optional. The WP_Error object returned by a previous
 *                                    submission attempt.
 */
function bp_blogs_signup_blog($blogname = '', $blog_title = '', $errors = '')
{
    global $current_site;
    // Blog name
    if (!is_subdomain_install()) {
        echo '<label for="blogname">' . __('Site Name:', 'buddypress') . '</label>';
    } else {
        echo '<label for="blogname">' . __('Site Domain:', 'buddypress') . '</label>';
    }
    if ($errmsg = $errors->get_error_message('blogname')) {
        ?>

		<p class="error"><?php 
        echo $errmsg;
        ?>
</p>

	<?php 
    }
    if (!is_subdomain_install()) {
        echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span> <input name="blogname" type="text" id="blogname" value="' . $blogname . '" maxlength="63" /><br />';
    } else {
        echo '<input name="blogname" type="text" id="blogname" value="' . $blogname . '" maxlength="63" ' . bp_get_form_field_attributes('blogname') . '/> <span class="suffix_address">.' . bp_blogs_get_subdomain_base() . '</span><br />';
    }
    if (!is_user_logged_in()) {
        print '(<strong>' . __('Your address will be ', 'buddypress');
        if (!is_subdomain_install()) {
            print $current_site->domain . $current_site->path . __('blogname', 'buddypress');
        } else {
            print __('domain.', 'buddypress') . $current_site->domain . $current_site->path;
        }
        echo '.</strong> ' . __('Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)', 'buddypress') . '</p>';
    }
    // Blog Title
    ?>

	<label for="blog_title"><?php 
    _e('Site Title:', 'buddypress');
    ?>
</label>

	<?php 
    if ($errmsg = $errors->get_error_message('blog_title')) {
        ?>

		<p class="error"><?php 
        echo $errmsg;
        ?>
</p>

	<?php 
    }
    echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_html($blog_title, 1) . '" /></p>';
    ?>

	<p>
		<label for="blog_public_on"><?php 
    _e('Privacy:', 'buddypress');
    ?>
</label>
		<?php 
    _e('I would like my site to appear in search engines, and in public listings around this network.', 'buddypress');
    ?>

		<label class="checkbox" for="blog_public_on">
			<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php 
    if (!isset($_POST['blog_public']) || '1' == $_POST['blog_public']) {
        ?>
checked="checked"<?php 
    }
    ?>
 />
			<strong><?php 
    _e('Yes', 'buddypress');
    ?>
</strong>
		</label>
		<label class="checkbox" for="blog_public_off">
			<input type="radio" id="blog_public_off" name="blog_public" value="0" <?php 
    if (isset($_POST['blog_public']) && '0' == $_POST['blog_public']) {
        ?>
checked="checked"<?php 
    }
    ?>
 />
			<strong><?php 
    _e('No', 'buddypress');
    ?>
</strong>
		</label>
	</p>

	<?php 
    /**
     * Fires at the end of all of the default input fields for blog creation form.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param WP_Error $errors WP_Error object if any present.
     */
    do_action('signup_blogform', $errors);
}
コード例 #2
0
/**
 * Output the attributes for a form field.
 *
 * @since 2.2.0
 *
 * @param string $name       The field name to output attributes for.
 * @param array  $attributes Array of existing attributes to add.
 */
function bp_form_field_attributes($name = '', $attributes = array())
{
    echo bp_get_form_field_attributes($name, $attributes);
}
 /**
  * Get a sanitised and escaped string of the edit field's HTML elements and attributes.
  *
  * Must be used inside the {@link bp_profile_fields()} template loop.
  * This method was intended to be static but couldn't be because php.net/lsb/ requires PHP >= 5.3.
  *
  * @since 2.0.0
  *
  * @param array $properties Optional key/value array of attributes for this edit field.
  *
  * @return string
  */
 protected function get_edit_field_html_elements(array $properties = array())
 {
     $r = bp_parse_args($properties, array('id' => bp_get_the_profile_field_input_name(), 'name' => bp_get_the_profile_field_input_name()));
     if (bp_get_the_profile_field_is_required()) {
         $r['aria-required'] = 'true';
     }
     /**
      * Filters the edit html elements and attributes.
      *
      * @since 2.0.0
      *
      * @param array  $r     Array of parsed arguments.
      * @param string $value Class name for the current class instance.
      */
     $r = (array) apply_filters('bp_xprofile_field_edit_html_elements', $r, get_class($this));
     return bp_get_form_field_attributes(sanitize_key(bp_get_the_profile_field_name()), $r);
 }