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


PHP UserStatus::getUserUpdatesURL方法代码示例

本文整理汇总了PHP中UserStatus::getUserUpdatesURL方法的典型用法代码示例。如果您正苦于以下问题:PHP UserStatus::getUserUpdatesURL方法的具体用法?PHP UserStatus::getUserUpdatesURL怎么用?PHP UserStatus::getUserUpdatesURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserStatus的用法示例。


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

示例1: execute


//.........这里部分代码省略.........
			if( ( $total % $per_page ) != 0 ) {
				$numofpages++;
			}
			if( $numofpages >= 9 && $page < $total ) {
				$numofpages = 9 + $page;
				if( $numofpages >= ( $total / $per_page ) ) {
					$numofpages = ( $total / $per_page ) + 1;
				}
			}

			for( $i = 1; $i <= $numofpages; $i++ ) {
				if( $i == $page ) {
					$output .= ( $i . ' ');
				} else {
					$output .= '<a href="' .
						SportsTeams::getFanUpdatesURL( $sport_id, $team_id ) .
						"&page=$i\">$i</a> ";
				}
			}

			if( ( $total - ( $per_page * $page ) ) > 0 ) {
				$output .= ' <a href="' .
					SportsTeams::getFanUpdatesURL( $sport_id, $team_id ) .
					'&page=' . ( $page + 1 ) . '">' . wfMsg( 'userstatus-next' ) .
					'</a>';
			}
			$output .= '</div><p>';
		}

		// Add CSS & JS
		if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) {
			$wgOut->addModuleStyles( 'ext.userStatus' );
			$wgOut->addModuleScripts( 'ext.userStatus' );
		} else {
			$wgOut->addExtensionStyle( $wgScriptPath . '/extensions/UserStatus/UserStatus.css' );
			$wgOut->addScriptFile( $wgScriptPath . '/extensions/UserStatus/UserStatus.js' );
		}

		// Registered users who are not blocked can add status updates when the
		// database is not locked
		if( $wgUser->isLoggedIn() && !$wgUser->isBlocked() && !wfReadOnly() ) {
			$output .= "<script>
				var __sport_id__ = {$sport_id};
				var __team_id__ = {$team_id};
				var __updates_show__ = \"{$updates_show}\";
				var __redirect_url__ = \"" . str_replace( '&amp;', '&', SportsTeams::getFanUpdatesURL( $sport_id, $team_id ) ) . "\";
			</script>";

			$output .= "<div class=\"user-status-form\">
			<span class=\"user-name-top\">{$wgUser->getName()}</span> <input type=\"text\" name=\"user_status_text\" id=\"user_status_text\" size=\"40\"/>
			<input type=\"button\" value=\"" . wfMsg( 'userstatus-btn-add' ) . '" class="site-button" onclick="add_status()" />
			</div>';
		}

		$output .= '<div class="user-status-container">';
		if( $messages ) {
			foreach ( $messages as $message ) {
				$user = Title::makeTitle( NS_USER, $message['user_name'] );
				$avatar = new wAvatar( $message['user_id'], 'm' );

				$messages_link = '<a href="' .
					UserStatus::getUserUpdatesURL( $message['user_name'] ) . '">' .
					wfMsg( 'userstatus-view-all-updates', $message['user_name'] ) .
					'</a>';
				$delete_link = '';
				// Allow the owner of the status update and privileged users to
				// delete it
				if(
					$wgUser->getName() == $message['user_name'] ||
					$wgUser->isAllowed( 'delete-status-updates' )
				)
				{
					$delete_link = "<span class=\"user-board-red\">
							<a href=\"javascript:void(0);\" onclick=\"javascript:delete_message({$message['id']})\">" .
						wfMsg( 'userstatus-delete' ) . '</a>
					</span>';
				}

				$message_text = preg_replace_callback(
					'/(<a[^>]*>)(.*?)(<\/a>)/i',
					array( 'UserStatus', 'cutLinkText' ),
					$message['text']
				);

				$output .= "<div class=\"user-status-row\">
					<a href=\"{$user->getFullURL()}\">{$avatar->getAvatarURL()}</a>
					<a href=\"{$user->getFullURL()}\"><b>{$message['user_name']}</b></a> {$message_text}
					<span class=\"user-status-date\">" .
						wfMsg( 'userstatus-ago', UserStatus::getTimeAgo( $message['timestamp'] ) ) .
					'</span>
				</div>';
			}
		} else {
			$output .= '<p>' . wfMsg( 'userstatus-no-updates' ) . '</p>';
		}

		$output .= '</div>';

		$wgOut->addHTML( $output );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:SpecialFanUpdates.php

示例2: displayStatusMessages

	/**
	 * Display the given amount of the given user's status messages.
	 *
	 * @param $user_id Integer: user ID whose status updates we want to display
	 * @param $sport_id Integer: sport ID for which we want to display updates
	 * @param $team_id Integer: sports team ID
	 * @param $count Integer: display this many messages
	 * @param $page Integer: page we're on; used for pagination
	 * @return String: HTML
	 */
	public function displayStatusMessages( $user_id, $sport_id = 0, $team_id = 0, $count = 10, $page = 0 ) {
		global $wgUser;

		$output = '';

		$messages = $this->getStatusMessages(
			$user_id,
			$sport_id,
			$team_id,
			$count,
			$page
		);
		$messages_count = count( $messages );
		$x = 1;

		$thought_link = SpecialPage::getTitleFor( 'ViewThought' );

		if( $messages ) {
			foreach ( $messages as $message ) {
				$user = Title::makeTitle( NS_USER, $message['user_name'] );
				$avatar = new wAvatar( $message['user_id'], 'm' );

				$messages_link = '<a href="' .
					UserStatus::getUserUpdatesURL( $message['user_name'] ) . '">' .
					wfMsg( 'userstatus-view-all-updates', $message['user_name'] ) .
				'</a>';
				$delete_link = '';

				$vote_count = wfMsgExt( 'userstatus-num-agree', 'parsemag', $message['plus_count'] );

				if (
					$wgUser->getName() == $message['user_name'] ||
					$wgUser->isAllowed( 'delete-status-updates' )
				)
				{
					$delete_link = "<span class=\"user-board-red\">
						<a href=\"javascript:void(0);\" onclick=\"javascript:delete_message({$message['id']})\">" .
						wfMsg( 'userstatus-delete-thought-text' ) . '</a>
					</span>';
				}

				$vote_link = '';
				if( $wgUser->isLoggedIn() && $wgUser->getName() != $message['user_name'] ) {
					if ( !$message['voted'] ) {
						$vote_link = "<a href=\"javascript:void(0);\" onclick=\"vote_status({$message['id']},1)\">[" .
							wfMsg( 'userstatus-agree' ) . ']</a>';
					} else {
						$vote_link = $vote_count;
					}
				}

				$view_thought_link = '<a href="' . $thought_link->getFullURL( 'id=' . $message['id'] ) .
					'">[' . wfMsg( 'userstatus-see-who-agrees' ) . ']</a>';

				$message_text = preg_replace_callback(
					'/(<a[^>]*>)(.*?)(<\/a>)/i',
					array( 'UserStatus', 'cutLinkText' ),
					$message['text']
				);

				if ( $x == 1 ) {
					$output .= '<div class="user-status-row-top">';
				} elseif ( $x < $messages_count ) {
					$output .= '<div class="user-status-row">';
				} else {
					$output .= '<div class="user-status-row-bottom">';
				}

				$output .= "

				<div class=\"user-status-logo\">
					<a href=\"{$user->getFullURL()}\">{$avatar->getAvatarURL()}</a>
				</div>

				<div class=\"user-status-message\">

					<a href=\"{$user->getFullURL()}\"><b>{$message['user_name']}</b></a> {$message_text}

					<div class=\"user-status-date\">" .
						wfMsg( 'userstatus-ago', self::getTimeAgo( $message['timestamp'] ) ) .
						"<span class=\"user-status-vote\" id=\"user-status-vote-{$message['id']}\">
							{$vote_link}
						</span>
						{$view_thought_link}
						<span class=\"user-status-links\">
							{$delete_link}
						</span>
					</div>

				</div>
//.........这里部分代码省略.........
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:UserStatusClass.php


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