本文整理汇总了PHP中Img函数的典型用法代码示例。如果您正苦于以下问题:PHP Img函数的具体用法?PHP Img怎么用?PHP Img使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Img函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InformNotifications
/**
* Grabs all new notifications and adds them to the sender's inform queue.
*
* This method gets called by dashboard's hooks file to display new
* notifications on every pageload.
*
* @since 2.0.18
* @access public
*
* @param Gdn_Controller $Sender The object calling this method.
*/
public static function InformNotifications($Sender)
{
$Session = Gdn::Session();
if (!$Session->IsValid()) {
return;
}
$ActivityModel = new ActivityModel();
// Get five pending notifications.
$Where = array('NotifyUserID' => Gdn::Session()->UserID, 'Notified' => ActivityModel::SENT_PENDING);
// If we're in the middle of a visit only get very recent notifications.
$Where['DateUpdated >'] = Gdn_Format::ToDateTime(strtotime('-5 minutes'));
$Activities = $ActivityModel->GetWhere($Where, 0, 5)->ResultArray();
$ActivityIDs = ConsolidateArrayValuesByKey($Activities, 'ActivityID');
$ActivityModel->SetNotified($ActivityIDs);
foreach ($Activities as $Activity) {
if ($Activity['Photo']) {
$UserPhoto = Anchor(Img($Activity['Photo'], array('class' => 'ProfilePhotoMedium')), $Activity['Url'], 'Icon');
} else {
$UserPhoto = '';
}
$Excerpt = Gdn_Format::Display($Activity['Story']);
$ActivityClass = ' Activity-' . $Activity['ActivityType'];
$Sender->InformMessage($UserPhoto . Wrap($Activity['Headline'], 'div', array('class' => 'Title')) . Wrap($Excerpt, 'div', array('class' => 'Excerpt')), 'Dismissable AutoDismiss' . $ActivityClass . ($UserPhoto == '' ? '' : ' HasIcon'));
}
}
示例2: WriteDiscussion
function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
$CssClass = 'Item';
$CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
$CssClass .= $Alt . ' ';
$CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
$CssClass .= $Discussion->Closed == '1' ? ' Closed' : '';
$CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
$CssClass .= $Discussion->CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
$Sender->EventArguments['Discussion'] =& $Discussion;
$Sender->FireEvent('BeforeDiscussionName');
$DiscussionName = Gdn_Format::Text($Discussion->Name);
if ($DiscussionName == '') {
$DiscussionName = T('Blank Discussion Topic');
}
static $FirstDiscussion = TRUE;
if (!$FirstDiscussion) {
$Sender->FireEvent('BetweenDiscussion');
} else {
$FirstDiscussion = FALSE;
}
?>
<li class="<?php
echo $CssClass;
?>
">
<?php
if ($Discussion->FirstPhoto != '') {
if (strtolower(substr($Discussion->FirstPhoto, 0, 7)) == 'http://' || strtolower(substr($Discussion->FirstPhoto, 0, 8)) == 'https://') {
$PhotoUrl = $Discussion->FirstPhoto;
} else {
$PhotoUrl = 'uploads/' . ChangeBasename($Discussion->FirstPhoto, 'n%s');
}
echo Img($PhotoUrl, array('alt' => $Discussion->FirstName));
}
?>
<div class="ItemContent Discussion">
<?php
echo Anchor($DiscussionName, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 && C('Vanilla.Comments.AutoOffset') ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
?>
<?php
$Sender->FireEvent('AfterDiscussionTitle');
?>
<div class="Meta">
<span class="Author"><?php
echo $Discussion->FirstName;
?>
</span>
<?php
echo '<span class="Counts' . ($Discussion->CountUnreadComments > 0 ? ' NewCounts' : '') . '">' . ($Discussion->CountUnreadComments > 0 ? $Discussion->CountUnreadComments . '/' : '') . $Discussion->CountComments . '</span>';
if ($Discussion->LastCommentID != '') {
echo '<span class="LastCommentBy">' . sprintf(T('Latest %1$s'), $Discussion->LastName) . '</span> ';
}
echo '<span class="LastCommentDate">' . Gdn_Format::Date($Discussion->FirstDate) . '</span> ';
?>
</div>
</div>
</li>
<?php
}
示例3: UserPhoto
function UserPhoto($User, $CssClass = '')
{
$CssClass = $CssClass == '' ? '' : ' class="' . $CssClass . '"';
if ($User->Photo != '') {
$PhotoUrl = strtolower(substr($User->Photo, 0, 7)) == 'http://' ? $User->Photo : 'uploads/n' . $User->Photo;
return '<a href="' . Url('/profile/' . $User->UserID . '/' . urlencode($User->Name)) . '"' . $CssClass . '>' . Img($PhotoUrl, array('alt' => urlencode($User->Name))) . '</a>';
} else {
return '';
}
}
示例4: PluginController_MembersListEnh_Create
public function PluginController_MembersListEnh_Create($Sender)
{
$Session = Gdn::Session();
if ($Sender->Menu && (CheckPermission('Plugins.MembersListEnh.GenView') || CheckPermission('Plugins.MembersListEnh.IPEmailView'))) {
$Sender->ClearCssFiles();
$Sender->AddCssFile('style.css');
$Sender->MasterView = 'default';
$Sender->Render('memtable', '', 'plugins/MembersListEnh');
} else {
echo Wrap(Anchor(Img('/plugins/MembersListEnh/design/AccessDenied.png', array('width' => '100%'), array('title' => T('You Have No Permission To View This Page Go Back'))), '/discussions', array('target' => '_self')), 'h1');
}
}
示例5: connectButton
public static function connectButton($Provider, $Options = array())
{
if (!is_array($Provider)) {
$Provider = self::getProvider($Provider);
}
$Url = htmlspecialchars(self::connectUrl($Provider));
$Data = $Provider;
$Target = Gdn::Request()->Get('Target');
if (!$Target) {
$Target = '/' . ltrim(Gdn::Request()->Path());
}
if (StringBeginsWith($Target, '/entry/signin')) {
$Target = '/';
}
$ConnectQuery = array('client_id' => $Provider['AuthenticationKey'], 'Target' => $Target);
$Data['Target'] = urlencode(Url('entry/jsconnect', TRUE) . '?' . http_build_query($ConnectQuery));
$Data['Redirect'] = $Data['target'] = $Data['redirect'] = $Data['Target'];
$SignInUrl = FormatString(GetValue('SignInUrl', $Provider, ''), $Data);
$RegisterUrl = FormatString(GetValue('RegisterUrl', $Provider, ''), $Data);
if ($RegisterUrl && !GetValue('NoRegister', $Options)) {
$RegisterLink = ' ' . Anchor(sprintf(T('Register with %s', 'Register'), $Provider['Name']), $RegisterUrl, 'Button RegisterLink');
} else {
$RegisterLink = '';
}
if (IsMobile()) {
$PopupWindow = '';
} else {
$PopupWindow = 'PopupWindow';
}
if (GetValue('NoConnectLabel', $Options)) {
$ConnectLabel = '';
} else {
$ConnectLabel = '<span class="Username"></span><div class="ConnectLabel TextColor">' . sprintf(T('Sign In with %s'), $Provider['Name']) . '</div>';
}
if (!C('Plugins.JsConnect.NoGuestCheck')) {
$Result = '<div style="display: none" class="JsConnect-Container ConnectButton Small UserInfo" rel="' . $Url . '">';
if (!GetValue('IsDefault', $Provider)) {
$Result .= '<div class="JsConnect-Guest">' . Anchor(sprintf(T('Sign In with %s'), $Provider['Name']), $SignInUrl, 'Button Primary SignInLink') . $RegisterLink . '</div>';
}
$Result .= '<div class="JsConnect-Connect"><a class="ConnectLink">' . Img('https://cd8ba0b44a15c10065fd-24461f391e20b7336331d5789078af53.ssl.cf1.rackcdn.com/images/usericon_50.png', array('class' => 'ProfilePhotoSmall UserPhoto')) . $ConnectLabel . '</a></div>';
$Result .= '</div>';
} else {
if (!GetValue('IsDefault', $Provider)) {
$Result = '<div class="JsConnect-Guest">' . Anchor(sprintf(T('Sign In with %s'), $Provider['Name']), $SignInUrl, 'Button Primary SignInLink') . $RegisterLink . '</div>';
}
}
return $Result;
}
示例6: writeConnection
function writeConnection($Row)
{
$c = Gdn::controller();
$Connected = val('Connected', $Row);
?>
<li id="<?php
echo "Provider_{$Row['ProviderKey']}";
?>
" class="Item">
<div class="Connection-Header">
<span class="IconWrap">
<?php
echo img(val('Icon', $Row, Asset('/applications/dashboard/design/images/connection-64.png')));
?>
</span>
<span class="Connection-Name">
<?php
echo val('Name', $Row, t('Unknown'));
if ($Connected) {
echo ' <span class="Gloss Connected">';
if ($Photo = valr('Profile.Photo', $Row)) {
echo ' ' . Img($Photo, array('class' => 'ProfilePhoto ProfilePhotoSmall'));
}
echo ' ' . htmlspecialchars(GetValueR('Profile.Name', $Row)) . '</span>';
}
?>
</span>
<span class="Connection-Connect">
<?php
echo ConnectButton($Row);
?>
</span>
</div>
<!-- <div class="Connection-Body">
<?php
// if (Debug()) {
// decho(val($Row['ProviderKey'], $c->User->Attributes), 'Attributes');
// }
?>
</div>-->
</li>
<?php
}
示例7: anchor
echo anchor($Name, userUrl($Session->User), 'Profile');
echo anchor(t('Sign Out'), SignOutUrl(), 'Leave');
}
?>
</div>
</div>
<div id="Body">
<div id="Panel">
<?php
$this->RenderAsset('Panel');
?>
</div>
<div id="Content"><?php
$this->RenderAsset('Content');
?>
</div>
</div>
<div id="Foot">
<?php
$this->RenderAsset('Foot');
echo '<div class="Version">Version ', APPLICATION_VERSION, '</div>';
echo wrap(Anchor(Img('/applications/dashboard/design/images/logo_footer.png', array('alt' => 'Vanilla Forums')), c('Garden.VanillaUrl')), 'div');
?>
</div>
</div>
<?php
$this->fireEvent('AfterBody');
?>
</body>
</html>
示例8: T
?>
</td>
<td><?php
echo T('Thumbnail');
?>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php
echo Img(Gdn_Upload::Url(ChangeBasename($this->User->Photo, 'p%s')), array('id' => 'cropbox'));
?>
</td>
<td>
<div style="<?php
echo 'width:' . $this->ThumbSize . 'px;height:' . $this->ThumbSize . 'px;';
?>
overflow:hidden;">
<?php
echo Img(Gdn_Upload::Url(ChangeBasename($this->User->Photo, 'p%s')), array('id' => 'preview'));
?>
</div>
</td>
</tr>
</tbody>
</table>
<?php
echo $this->Form->Close('Save', '', array('class' => 'Button Primary'));
示例9: Url
<td class="<?php
echo $ColClass;
?>
">
<?php
echo '<h4>';
echo $ThemeUrl != '' ? Url($ThemeName, $ThemeUrl) : $ThemeName;
if ($Version != '') {
$Info = sprintf(T('Version %s'), $Version);
}
if ($Author != '') {
$Info .= sprintf('by %s', $AuthorUrl != '' ? Anchor($Author, $AuthorUrl) : $Author);
}
echo '</h4>';
if ($PreviewImage) {
echo Anchor(Img('/themes/' . $ThemeFolder . '/' . $PreviewImage, array('alt' => $ThemeName, 'height' => '112', 'width' => '150')), 'dashboard/settings/previewtheme/' . $ThemeFolder, '', array('target' => '_top'));
}
echo '<div class="Buttons">';
echo Anchor('Apply', 'dashboard/settings/themes/' . $ThemeFolder . '/' . $Session->TransientKey(), 'SmallButton', array('target' => '_top'));
echo Anchor('Preview', 'dashboard/settings/previewtheme/' . $ThemeFolder, 'SmallButton', array('target' => '_top'));
echo '</div>';
$Description = ArrayValue('Description', $ThemeInfo);
if ($Description) {
echo '<em>' . $Description . '</em>';
}
$RequiredApplications = ArrayValue('RequiredApplications', $ThemeInfo, FALSE);
if (is_array($RequiredApplications)) {
echo '<dl>
<dt>' . T('Requires') . '</dt>
<dd>';
$i = 0;
示例10: UserPhoto
function UserPhoto($User, $Options = array()) {
$User = (object)$User;
if (is_string($Options))
$Options = array('LinkClass' => $Options);
$LinkClass = GetValue('LinkClass', $Options, 'ProfileLink');
$ImgClass = GetValue('ImageClass', $Options, 'ProfilePhotoBig');
$LinkClass = $LinkClass == '' ? '' : ' class="'.$LinkClass.'"';
if ($User->Photo) {
if (!preg_match('`^https?://`i', $User->Photo)) {
$PhotoUrl = Gdn_Upload::Url(ChangeBasename($User->Photo, 'n%s'));
} else {
$PhotoUrl = $User->Photo;
}
return '<a title="'.htmlspecialchars($User->Name).'" href="'.Url('/profile/'.$User->UserID.'/'.rawurlencode($User->Name)).'"'.$LinkClass.'>'
.Img($PhotoUrl, array('alt' => htmlspecialchars($User->Name), 'class' => $ImgClass))
.'</a>';
} else {
return '';
}
}
示例11: userPhoto
/**
* Takes a user object, and writes out an anchor of the user's icon to the user's profile.
*
* @param object|array $User A user object or array.
* @param array $Options
*/
function userPhoto($User, $Options = array())
{
if (is_string($Options)) {
$Options = array('LinkClass' => $Options);
}
if ($Px = GetValue('Px', $Options)) {
$User = UserBuilder($User, $Px);
} else {
$User = (object) $User;
}
$LinkClass = ConcatSep(' ', GetValue('LinkClass', $Options, ''), 'PhotoWrap');
$ImgClass = GetValue('ImageClass', $Options, 'ProfilePhoto');
$Size = GetValue('Size', $Options);
if ($Size) {
$LinkClass .= " PhotoWrap{$Size}";
$ImgClass .= " {$ImgClass}{$Size}";
} else {
$ImgClass .= " {$ImgClass}Medium";
// backwards compat
}
$FullUser = Gdn::UserModel()->GetID(GetValue('UserID', $User), DATASET_TYPE_ARRAY);
$UserCssClass = GetValue('_CssClass', $FullUser);
if ($UserCssClass) {
$LinkClass .= ' ' . $UserCssClass;
}
$LinkClass = $LinkClass == '' ? '' : ' class="' . $LinkClass . '"';
$Photo = GetValue('Photo', $User);
$Name = GetValue('Name', $User);
$Title = htmlspecialchars(GetValue('Title', $Options, $Name));
if ($FullUser && $FullUser['Banned']) {
$Photo = C('Garden.BannedPhoto', 'http://cdn.vanillaforums.com/images/banned_large.png');
$Title .= ' (' . T('Banned') . ')';
}
if (!$Photo && function_exists('UserPhotoDefaultUrl')) {
$Photo = UserPhotoDefaultUrl($User, $ImgClass);
}
if ($Photo) {
if (!isUrl($Photo)) {
$PhotoUrl = Gdn_Upload::Url(ChangeBasename($Photo, 'n%s'));
} else {
$PhotoUrl = $Photo;
}
$Href = Url(UserUrl($User));
return '<a title="' . $Title . '" href="' . $Href . '"' . $LinkClass . '>' . Img($PhotoUrl, array('alt' => $Name, 'class' => $ImgClass)) . '</a>';
} else {
return '';
}
}
示例12: StringIsNullOrEmpty
?>
<div class="Connect">
<h1><?php
echo StringIsNullOrEmpty($ConnectSource) ? T("Sign in") : sprintf(T('%s Connect'), $ConnectSource);
?>
</h1>
<div>
<?php
echo $this->Form->Open();
echo $this->Form->Errors();
if ($ConnectName || $ConnectPhoto) {
?>
<div class="MeBox">
<?php
if ($ConnectPhoto) {
echo '<span class="PhotoWrap">', Img($ConnectPhoto, array('alt' => T('Profile Picture'), 'class' => 'ProfilePhoto')), '</span>';
}
echo '<div class="WhoIs">';
if ($ConnectName && $ConnectSource) {
$NameFormat = T('You are connected as %s through %s.');
} elseif ($ConnectName) {
$NameFormat = T('You are connected as %s.');
} elseif ($ConnectSource) {
$NameFormat = T('You are connected through %2$s.');
} else {
$NameFormat = '';
}
$NameFormat = '%1$s';
echo sprintf($NameFormat, '<span class="Name">' . htmlspecialchars($ConnectName) . '</span>', '<span class="Source">' . htmlspecialchars($ConnectSource) . '</span>');
echo Wrap(T('ConnectCreateAccount', 'Add Info & Create Account'), 'h3');
echo '</div>';
示例13: foreach
$Col = 0;
foreach ($this->Data('AvailableThemes') as $ThemeName => $ThemeInfo) {
$ScreenName = GetValue('Name', $ThemeInfo, $ThemeName);
$ThemeFolder = GetValue('Folder', $ThemeInfo, '');
$Active = $ThemeFolder == $this->Data('EnabledThemeFolder');
$Version = GetValue('Version', $ThemeInfo, '');
$ThemeUrl = GetValue('Url', $ThemeInfo, '');
$Author = GetValue('Author', $ThemeInfo, '');
$AuthorUrl = GetValue('AuthorUrl', $ThemeInfo, '');
$NewVersion = GetValue('NewVersion', $ThemeInfo, '');
$Upgrade = $NewVersion != '' && version_compare($NewVersion, $Version, '>');
$PreviewUrl = GetValue('MobileScreenshotUrl', $ThemeInfo, FALSE);
$Description = GetValue('Description', $ThemeInfo);
$RequiredApplications = GetValue('RequiredApplications', $ThemeInfo, FALSE);
$ClassCurrentTheme = $EnabledThemeInfo['Index'] == $ThemeInfo['Index'] ? 'current-theme' : '';
$PreviewImageHtml = $PreviewUrl !== FALSE ? Anchor(Img($PreviewUrl, array('alt' => $ScreenName)), $PreviewUrl, '', array('class' => 'theme-image mfp-image')) : '<div class="theme-image"></div>';
$DescriptionHtml = $Description ? '<em class="theme-description">' . $Description . '</em>' : '';
$Col++;
if ($Col == 1) {
$ColClass = 'FirstCol';
echo '<tr>';
} elseif ($Col == 2) {
$ColClass = 'MiddleCol';
} else {
$ColClass = 'LastCol';
$Col = 0;
}
?>
<td class="themeblock <?php
echo $ClassCurrentTheme;
示例14: Wrap
echo Wrap(T('FaviconDescription', "Your site's favicon appears in your browser's title bar. It will be scaled to 16x16 pixels."), 'div', array('class' => 'Info'));
$Favicon = $this->Data('Favicon');
if ($Favicon) {
echo Wrap(Img(Gdn_Upload::Url($Favicon)), 'div');
echo Wrap(Anchor(T('Remove Favicon'), '/dashboard/settings/removefavicon/' . $Session->TransientKey(), 'SmallButton'), 'div', array('style' => 'padding: 10px 0;'));
echo Wrap(T('FaviconBrowse', 'Browse for a new favicon if you would like to change it:'), 'div', array('class' => 'Info'));
} else {
echo Wrap(T('FaviconDescription', "The shortcut icon that shows up in your browser's bookmark menu (16x16 px)."), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('Favicon', 'file');
?>
</li>
<li>
<?php
echo $this->Form->Label('Share Image', 'ShareImage');
echo Wrap(T('ShareImageDescription', "When someone shares a link from your site we try and grab an image from the page. If there isn't an image on the page then we'll use this image instead. The image should be at least 50×50, but we recommend 200×200."), 'div', array('class' => 'Info'));
$ShareImage = $this->Data('ShareImage');
if ($ShareImage) {
echo Wrap(Img(Gdn_Upload::Url($ShareImage), array('style' => 'max-width: 300px')), 'div');
echo Wrap(Anchor(T('Remove Image'), '/dashboard/settings/removeshareimage', 'SmallButton Hijack'), 'div', array('style' => 'padding: 10px 0;'));
echo Wrap(T('FaviconBrowse', 'Browse for a new favicon if you would like to change it:'), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('ShareImage', 'file');
?>
</li>
</ul>
</div>
</div>
<?php
echo '<div class="Buttons">' . $this->Form->Button('Save') . '</div>';
echo $this->Form->Close();
示例15: Image
/**
* Format a serialized string of image properties as html.
* @param string $Body a serialized array of image properties (Image, Thumbnail, Caption)
*/
public static function Image($Body)
{
if (is_string($Body)) {
$Image = @unserialize($Body);
if (!$Image) {
return Gdn_Format::Html($Body);
}
}
$Url = GetValue('Image', $Image);
$Caption = Gdn_Format::PlainText(GetValue('Caption', $Image));
return '<div class="ImageWrap">' . '<div class="Image">' . Img($Url, array('alt' => $Caption, 'title' => $Caption)) . '</div>' . '<div class="Caption">' . $Caption . '</div>' . '</div>';
}