• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_core_avatar_thumb_height函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bp_core_fetch_avatar


//.........这里部分代码省略.........
        $html_title = ' title="' . esc_attr($params['title']) . '"';
    }
    // Extra attributes
    $extra_attr = !empty($args['extra_attr']) ? ' ' . $args['extra_attr'] : '';
    // Set CSS ID and create html string.
    $html_css_id = '';
    /**
     * Filters the ID attribute to be applied to avatar.
     *
     * @since 2.2.0
     *
     * @param string $value  ID to be applied to avatar.
     * @param string $value  ID of avatar item being requested.
     * @param string $value  Avatar type being requested.
     * @param array  $params Array of parameters for the request.
     */
    $params['css_id'] = apply_filters('bp_core_css_id', $params['css_id'], $params['item_id'], $params['object'], $params);
    if (!empty($params['css_id'])) {
        $html_css_id = ' id="' . esc_attr($params['css_id']) . '"';
    }
    // Set image width
    if (false !== $params['width']) {
        // Width has been specified. No modification necessary.
    } elseif ('thumb' == $params['type']) {
        $params['width'] = bp_core_avatar_thumb_width();
    } else {
        $params['width'] = bp_core_avatar_full_width();
    }
    $html_width = ' width="' . $params['width'] . '"';
    // Set image height
    if (false !== $params['height']) {
        // Height has been specified. No modification necessary.
    } elseif ('thumb' == $params['type']) {
        $params['height'] = bp_core_avatar_thumb_height();
    } else {
        $params['height'] = bp_core_avatar_full_height();
    }
    $html_height = ' height="' . $params['height'] . '"';
    /**
     * Filters the classes to be applied to the avatar.
     *
     * @since 1.6.0
     *
     * @param array|string $value  Class(es) to be applied to the avatar.
     * @param string       $value  ID of the avatar item being requested.
     * @param string       $value  Avatar type being requested.
     * @param array        $params Array of parameters for the request.
     */
    $params['class'] = apply_filters('bp_core_avatar_class', $params['class'], $params['item_id'], $params['object'], $params);
    // Use an alias to leave the param unchanged
    $avatar_classes = $params['class'];
    if (!is_array($avatar_classes)) {
        $avatar_classes = explode(' ', $avatar_classes);
    }
    // merge classes
    $avatar_classes = array_merge($avatar_classes, array($params['object'] . '-' . $params['item_id'] . '-avatar', 'avatar-' . $params['width']));
    // Sanitize each class
    $avatar_classes = array_map('sanitize_html_class', $avatar_classes);
    // populate the class attribute
    $html_class = ' class="' . join(' ', $avatar_classes) . ' photo"';
    // Set img URL and DIR based on prepopulated constants
    $avatar_loc = new stdClass();
    $avatar_loc->path = trailingslashit(bp_core_avatar_upload_path());
    $avatar_loc->url = trailingslashit(bp_core_avatar_url());
    $avatar_loc->dir = trailingslashit($params['avatar_dir']);
    /**
开发者ID:toby-bushell,项目名称:triumph,代码行数:67,代码来源:bp-core-avatars.php


示例2: bp_activity_post_form_action

<form action="<?php 
bp_activity_post_form_action();
?>
" method="post" id="whats-new-form" name="whats-new-form" role="complementary">

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

	<div id="whats-new-avatar">
		<a href="<?php 
echo bp_loggedin_user_domain();
?>
">
			<?php 
bp_loggedin_user_avatar('width=' . bp_core_avatar_thumb_width() . '&height=' . bp_core_avatar_thumb_height());
?>
		</a>
	</div>

	<h5><?php 
if (bp_is_group()) {
    printf(__("What's new in %s, %s?", 'buddypress'), bp_get_group_name(), bp_get_user_firstname());
} else {
    printf(__("What's new, %s?", 'buddypress'), bp_get_user_firstname());
}
?>
</h5>

	<div id="whats-new-content">
		<div id="whats-new-textarea">
开发者ID:kosir,项目名称:thatcamp-org,代码行数:31,代码来源:post-form.php


示例3: bp_core_avatar_handle_crop

/**
 * Crop an uploaded avatar.
 *
 * $args has the following parameters:
 *  object - What component the avatar is for, e.g. "user"
 *  avatar_dir  The absolute path to the avatar
 *  item_id - Item ID
 *  original_file - The absolute path to the original avatar file
 *  crop_w - Crop width
 *  crop_h - Crop height
 *  crop_x - The horizontal starting point of the crop
 *  crop_y - The vertical starting point of the crop
 *
 * @param array $args {
 *     Array of function parameters.
 *     @type string $object Object type of the item whose avatar you're
 *           handling. 'user', 'group', 'blog', or custom. Default: 'user'.
 *     @type string $avatar_dir Subdirectory where avatar should be stored.
 *           Default: 'avatars'.
 *     @type bool|int $item_id ID of the item that the avatar belongs to.
 *     @type bool|string $original_file Absolute papth to the original avatar
 *           file.
 *     @type int $crop_w Crop width. Default: the global 'full' avatar width,
 *           as retrieved by bp_core_avatar_full_width().
 *     @type int $crop_h Crop height. Default: the global 'full' avatar height,
 *           as retrieved by bp_core_avatar_full_height().
 *     @type int $crop_x The horizontal starting point of the crop. Default: 0.
 *     @type int $crop_y The vertical starting point of the crop. Default: 0.
 * }
 * @return bool True on success, false on failure.
 */
function bp_core_avatar_handle_crop($args = '')
{
    $r = wp_parse_args($args, array('object' => 'user', 'avatar_dir' => 'avatars', 'item_id' => false, 'original_file' => false, 'crop_w' => bp_core_avatar_full_width(), 'crop_h' => bp_core_avatar_full_height(), 'crop_x' => 0, 'crop_y' => 0));
    /***
     * You may want to hook into this filter if you want to override this function.
     * Make sure you return false.
     */
    if (!apply_filters('bp_core_pre_avatar_handle_crop', true, $r)) {
        return true;
    }
    extract($r, EXTR_SKIP);
    if (empty($original_file)) {
        return false;
    }
    $original_file = bp_core_avatar_upload_path() . $original_file;
    if (!file_exists($original_file)) {
        return false;
    }
    if (empty($item_id)) {
        $avatar_folder_dir = apply_filters('bp_core_avatar_folder_dir', dirname($original_file), $item_id, $object, $avatar_dir);
    } else {
        $avatar_folder_dir = apply_filters('bp_core_avatar_folder_dir', bp_core_avatar_upload_path() . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir);
    }
    if (!file_exists($avatar_folder_dir)) {
        return false;
    }
    require_once ABSPATH . '/wp-admin/includes/image.php';
    require_once ABSPATH . '/wp-admin/includes/file.php';
    // Delete the existing avatar files for the object
    $existing_avatar = bp_core_fetch_avatar(array('object' => $object, 'item_id' => $item_id, 'html' => false));
    if (!empty($existing_avatar)) {
        // Check that the new avatar doesn't have the same name as the
        // old one before deleting
        $upload_dir = wp_upload_dir();
        $existing_avatar_path = str_replace($upload_dir['baseurl'], '', $existing_avatar);
        $new_avatar_path = str_replace($upload_dir['basedir'], '', $original_file);
        if ($existing_avatar_path !== $new_avatar_path) {
            bp_core_delete_existing_avatar(array('object' => $object, 'item_id' => $item_id, 'avatar_path' => $avatar_folder_dir));
        }
    }
    // Make sure we at least have a width and height for cropping
    if (empty($crop_w)) {
        $crop_w = bp_core_avatar_full_width();
    }
    if (empty($crop_h)) {
        $crop_h = bp_core_avatar_full_height();
    }
    // Get the file extension
    $data = @getimagesize($original_file);
    $ext = $data['mime'] == 'image/png' ? 'png' : 'jpg';
    // Set the full and thumb filenames
    $full_filename = wp_hash($original_file . time()) . '-bpfull.' . $ext;
    $thumb_filename = wp_hash($original_file . time()) . '-bpthumb.' . $ext;
    // Crop the image
    $full_cropped = wp_crop_image($original_file, (int) $crop_x, (int) $crop_y, (int) $crop_w, (int) $crop_h, bp_core_avatar_full_width(), bp_core_avatar_full_height(), false, $avatar_folder_dir . '/' . $full_filename);
    $thumb_cropped = wp_crop_image($original_file, (int) $crop_x, (int) $crop_y, (int) $crop_w, (int) $crop_h, bp_core_avatar_thumb_width(), bp_core_avatar_thumb_height(), false, $avatar_folder_dir . '/' . $thumb_filename);
    // Check for errors
    if (empty($full_cropped) || empty($thumb_cropped) || is_wp_error($full_cropped) || is_wp_error($thumb_cropped)) {
        return false;
    }
    // Remove the original
    @unlink($original_file);
    return true;
}
开发者ID:eresyyl,项目名称:mk,代码行数:95,代码来源:bp-core-avatars.php


示例4: crop

 /**
  * Crop the avatar.
  *
  * @since 2.3.0
  *
  * @see  BP_Attachment::crop for the list of parameters
  * @uses bp_core_fetch_avatar()
  * @uses bp_core_delete_existing_avatar()
  * @uses bp_core_avatar_full_width()
  * @uses bp_core_avatar_full_height()
  * @uses bp_core_avatar_dimension()
  * @uses BP_Attachment::crop
  *
  * @param array $args Array of arguments for the cropping.
  * @return array The cropped avatars (full and thumb).
  */
 public function crop($args = array())
 {
     // Bail if the original file is missing.
     if (empty($args['original_file'])) {
         return false;
     }
     /**
      * Original file is a relative path to the image
      * eg: /avatars/1/avatar.jpg
      */
     $relative_path = $args['original_file'];
     $absolute_path = $this->upload_path . $relative_path;
     // Bail if the avatar is not available.
     if (!file_exists($absolute_path)) {
         return false;
     }
     if (empty($args['item_id'])) {
         /** This filter is documented in bp-core/bp-core-avatars.php */
         $avatar_folder_dir = apply_filters('bp_core_avatar_folder_dir', dirname($absolute_path), $args['item_id'], $args['object'], $args['avatar_dir']);
     } else {
         /** This filter is documented in bp-core/bp-core-avatars.php */
         $avatar_folder_dir = apply_filters('bp_core_avatar_folder_dir', $this->upload_path . '/' . $args['avatar_dir'] . '/' . $args['item_id'], $args['item_id'], $args['object'], $args['avatar_dir']);
     }
     // Bail if the avatar folder is missing for this item_id.
     if (!file_exists($avatar_folder_dir)) {
         return false;
     }
     // Delete the existing avatar files for the object.
     $existing_avatar = bp_core_fetch_avatar(array('object' => $args['object'], 'item_id' => $args['item_id'], 'html' => false));
     /**
      * Check that the new avatar doesn't have the same name as the
      * old one before deleting
      */
     if (!empty($existing_avatar) && $existing_avatar !== $this->url . $relative_path) {
         bp_core_delete_existing_avatar(array('object' => $args['object'], 'item_id' => $args['item_id'], 'avatar_path' => $avatar_folder_dir));
     }
     // Make sure we at least have minimal data for cropping.
     if (empty($args['crop_w'])) {
         $args['crop_w'] = bp_core_avatar_full_width();
     }
     if (empty($args['crop_h'])) {
         $args['crop_h'] = bp_core_avatar_full_height();
     }
     // Get the file extension.
     $data = @getimagesize($absolute_path);
     $ext = $data['mime'] == 'image/png' ? 'png' : 'jpg';
     $args['original_file'] = $absolute_path;
     $args['src_abs'] = false;
     $avatar_types = array('full' => '', 'thumb' => '');
     foreach ($avatar_types as $key_type => $type) {
         if ('thumb' === $key_type) {
             $args['dst_w'] = bp_core_avatar_thumb_width();
             $args['dst_h'] = bp_core_avatar_thumb_height();
         } else {
             $args['dst_w'] = bp_core_avatar_full_width();
             $args['dst_h'] = bp_core_avatar_full_height();
         }
         $args['dst_file'] = $avatar_folder_dir . '/' . wp_hash($absolute_path . time()) . '-bp' . $key_type . '.' . $ext;
         $avatar_types[$key_type] = parent::crop($args);
     }
     // Remove the original.
     @unlink($absolute_path);
     // Return the full and thumb cropped avatars.
     return $avatar_types;
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:81,代码来源:class-bp-attachment-avatar.php


示例5: widget

    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        echo $before_widget;
        echo $before_title . $widget_name . $after_title;
        ?>

		<?php 
        if (bp_has_links('type=popular&per_page=' . $instance['max_links'] . '&max=' . $instance['max_links'])) {
            ?>
			<div class="item-options" id="links-list-options">
				<span class="ajax-loader" id="ajax-loader-links"></span>
				<a href="<?php 
            echo site_url() . '/' . bp_links_root_slug();
            ?>
" id="newest-links"><?php 
            _e("Newest", 'buddypress');
            ?>
</a> |
				<?php 
            if (bp_links_is_voting_enabled()) {
                ?>
				<a href="<?php 
                echo site_url() . '/' . bp_links_root_slug();
                ?>
" id="most-votes"><?php 
                _e("Votes", 'buddypress-links');
                ?>
</a> |
				<a href="<?php 
                echo site_url() . '/' . bp_links_root_slug();
                ?>
" id="high-votes"><?php 
                _e("Rating", 'buddypress-links');
                ?>
</a> |
				<a href="<?php 
                echo site_url() . '/' . bp_links_root_slug();
                ?>
" id="popular-links" class="selected"><?php 
                _e("Popular", 'buddypress');
                ?>
</a>
				<?php 
            } else {
                ?>
				<a href="<?php 
                echo site_url() . '/' . bp_links_root_slug();
                ?>
" id="active-links"><?php 
                _e("Active", 'buddypress');
                ?>
</a>
				<?php 
            }
            ?>
			</div>

			<ul id="links-list" class="item-list">
				<?php 
            while (bp_links()) {
                bp_the_link();
                ?>
					<li>
						<div class="item-avatar">
							<a href="<?php 
                bp_link_permalink();
                ?>
"><?php 
                bp_link_avatar(array('width' => bp_core_avatar_thumb_width(), 'height' => bp_core_avatar_thumb_height()));
                ?>
</a>
						</div>

						<div class="item">
							<div class="item-title"><a href="<?php 
                bp_link_permalink();
                ?>
" title="<?php 
                bp_link_name();
                ?>
"><?php 
                bp_link_name();
                ?>
</a></div>
							<?php 
                if (bp_links_is_voting_enabled()) {
                    ?>
							<div class="item-meta"><span class="activity"><?php 
                    printf(__('%+d rating', 'buddypress-links'), bp_get_link_vote_total());
                    ?>
</span></div>
							<?php 
                }
                ?>
						</div>
					</li>

				<?php 
//.........这里部分代码省略.........
开发者ID:Krl4,项目名称:buddypress-links,代码行数:101,代码来源:bp-links-widgets.php


示例6: bp_core_avatar_handle_crop

/**
 * Crop an uploaded avatar
 *
 * $args has the following parameters:
 *  object - What component the avatar is for, e.g. "user"
 *  avatar_dir  The absolute path to the avatar
 *  item_id - Item ID
 *  original_file - The absolute path to the original avatar file
 *  crop_w - Crop width
 *  crop_h - Crop height
 *  crop_x - The horizontal starting point of the crop
 *  crop_y - The vertical starting point of the crop
 *
 * @global object $bp BuddyPress global settings
 * @param mixed $args
 * @return bool Success/failure
 */
function bp_core_avatar_handle_crop($args = '')
{
    global $bp;
    $defaults = array('object' => 'user', 'avatar_dir' => 'avatars', 'item_id' => false, 'original_file' => false, 'crop_w' => bp_core_avatar_full_width(), 'crop_h' => bp_core_avatar_full_height(), 'crop_x' => 0, 'crop_y' => 0);
    $r = nxt_parse_args($args, $defaults);
    /***
     * You may want to hook into this filter if you want to override this function.
     * Make sure you return false.
     */
    if (!apply_filters('bp_core_pre_avatar_handle_crop', true, $r)) {
        return true;
    }
    extract($r, EXTR_SKIP);
    if (!$original_file) {
        return false;
    }
    $original_file = bp_core_avatar_upload_path() . $original_file;
    if (!file_exists($original_file)) {
        return false;
    }
    if (!$item_id) {
        $avatar_folder_dir = apply_filters('bp_core_avatar_folder_dir', dirname($original_file), $item_id, $object, $avatar_dir);
    } else {
        $avatar_folder_dir = apply_filters('bp_core_avatar_folder_dir', bp_core_avatar_upload_path() . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir);
    }
    if (!file_exists($avatar_folder_dir)) {
        return false;
    }
    require_once ABSPATH . '/nxt-admin/includes/image.php';
    require_once ABSPATH . '/nxt-admin/includes/file.php';
    // Delete the existing avatar files for the object
    bp_core_delete_existing_avatar(array('object' => $object, 'avatar_path' => $avatar_folder_dir));
    // Make sure we at least have a width and height for cropping
    if (!(int) $crop_w) {
        $crop_w = bp_core_avatar_full_width();
    }
    if (!(int) $crop_h) {
        $crop_h = bp_core_avatar_full_height();
    }
    // Set the full and thumb filenames
    $full_filename = nxt_hash($original_file . time()) . '-bpfull.jpg';
    $thumb_filename = nxt_hash($original_file . time()) . '-bpthumb.jpg';
    // Crop the image
    $full_cropped = nxt_crop_image($original_file, (int) $crop_x, (int) $crop_y, (int) $crop_w, (int) $crop_h, bp_core_avatar_full_width(), bp_core_avatar_full_height(), false, $avatar_folder_dir . '/' . $full_filename);
    $thumb_cropped = nxt_crop_image($original_file, (int) $crop_x, (int) $crop_y, (int) $crop_w, (int) $crop_h, bp_core_avatar_thumb_width(), bp_core_avatar_thumb_height(), false, $avatar_folder_dir . '/' . $thumb_filename);
    // Remove the original
    @unlink($original_file);
    return true;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:66,代码来源:bp-core-avatars.php


示例7: do_action

		<?php 
do_action('mpp_after_lightbox_media', $media);
?>
	
		
	</div>
	
	<div class="mpp-lightbox-activity-container">
		<div class="mpp-lightbox-media-uploader-meta mpp-clearfix">
			<div class="mpp-lightbox-media-uploader-avatar">
				<a href="<?php 
echo bp_core_get_user_domain(mpp_get_media_creator_id());
?>
">
					<?php 
echo bp_core_fetch_avatar(array('item_id' => mpp_get_media_creator_id(), 'object' => 'members', 'width' => bp_core_avatar_thumb_width(), 'height' => bp_core_avatar_thumb_height()));
?>
				</a>
			</div>
			<div class="mpp-lightbox-uploader-upload-details">
				<div class="mpp-lightbox-uploader-link">
					<?php 
echo bp_core_get_userlink(mpp_get_media_creator_id());
?>
				</div>
			</div>
		</div><!--end of the top row -->
		<div class="mpp-item-description mpp-media-description mpp-lightbox-media-description mpp-clearfix">
			<?php 
mpp_media_description();
?>
开发者ID:enboig,项目名称:mediapress,代码行数:31,代码来源:lightbox-comment.php


示例8: do_action

		<?php 
do_action('mpp_after_lightbox_media', $media);
?>
	
		
	</div>
	
	<div class="mpp-lightbox-activity-container">
		<div class="mpp-lightbox-media-uploader-meta mpp-clearfix">
			<div class="mpp-lightbox-media-uploader-avatar">
				<a href="<?php 
echo bp_core_get_user_domain(mpp_get_media_creator_id());
?>
">
					<?php 
echo bp_core_fetch_avatar(array('object' => 'members', 'width' => bp_core_avatar_thumb_width(), 'height' => bp_core_avatar_thumb_height()));
?>
				</a>
			</div>
			<div class="mpp-lightbox-uploader-upload-details">
				<div class="mpp-lightbox-uploader-link">
					<?php 
echo bp_core_get_userlink(mpp_get_media_creator_id());
?>
				</div>
			</div>
		</div><!--end of the top row -->
		<div class="mpp-item-description mpp-media-description mpp-lightbox-media-description mpp-clearfix">
			<?php 
mpp_media_description();
?>
开发者ID:markc,项目名称:mediapress,代码行数:31,代码来源:lightbox-comment.php


示例9: do_action

	<div class="inner-sidebar <?php 
do_action('wf_class_inner_sidebar');
?>
 inner-sidebar-mobile">


		<a id="close-buddypress-mobile-sidebar" class="close-panel-button" href="#">
			<i class="fa fa-times-circle"></i> Close menu
		</a>

		<?php 
if (bp_is_user()) {
    ?>
			<div id="user-sidebar-menu" class="widget">
				<?php 
    bp_displayed_user_avatar('width=' . bp_core_avatar_thumb_width() . '&height=' . bp_core_avatar_thumb_height());
    ?>
				<?php 
    $userLink = bp_get_displayed_user_link();
    ?>
				<strong><?php 
    echo bp_core_get_user_displayname(bp_displayed_user_id());
    ?>
</strong>
				<br>
			</div>
		<?php 
}
?>

		<?php 
开发者ID:WeFoster,项目名称:wefoster,代码行数:31,代码来源:buddypress-mobile-sidebar.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_core_avatar_thumb_width函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_core_avatar_handle_upload函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap