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


PHP Gdn_Upload::Url方法代码示例

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


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

示例1: 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) {
         $PhotoImage = 'n'.basename($Discussion->FirstPhoto);
         $PhotoUrl = Gdn_Upload::Url(dirname($Discussion->FirstPhoto).'/'.$PhotoImage);
         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->LastDate).'</span> ';
         ?>
      </div>
   </div>
</li>
<?php
}
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:49,代码来源:helper_functions.php

示例2: DoAttachment

    public function DoAttachment($bbcode, $action, $name, $default, $params, $content)
    {
        $Medias = $this->Media();
        $MediaID = $content;
        if (isset($Medias[$MediaID])) {
            $Media = $Medias[$MediaID];
            //         decho($Media, 'Media');
            $Src = htmlspecialchars(Gdn_Upload::Url(GetValue('Path', $Media)));
            $Name = htmlspecialchars(GetValue('Name', $Media));
            if (GetValue('ImageWidth', $Media)) {
                return <<<EOT
<div class="Attachment Image"><img src="{$Src}" alt="{$Name}" /></div>
EOT;
            } else {
                return Anchor($Name, $Src, 'Attachment File');
            }
        }
        return Anchor(T('Attachment not found.'), '#', 'Attachment NotFound');
    }
开发者ID:SatiricMan,项目名称:addons,代码行数:19,代码来源:class.nbbc.plugin.php

示例3: MediaThumbnail

function MediaThumbnail($Media, $Data = FALSE)
{
    $Media = (array) $Media;
    if (GetValue('ThumbPath', $Media)) {
        $Src = Gdn_Upload::Url(ltrim(GetValue('ThumbPath', $Media), '/'));
    } else {
        $Width = GetValue('ImageWidth', $Media);
        $Height = GetValue('ImageHeight', $Media);
        if (!$Width || !$Height) {
            $Height = MediaModel::ThumbnailHeight();
            if (!$Height) {
                $Height = 100;
            }
            SetValue('ThumbHeight', $Media, $Height);
            return DefaultMediaThumbnail($Media);
        }
        $RequiresThumbnail = FALSE;
        if (MediaModel::ThumbnailHeight() && $Height > MediaModel::ThumbnailHeight()) {
            $RequiresThumbnail = TRUE;
        } elseif (MediaModel::ThumbnailWidth() && $Width > MediaModel::ThumbnailWidth()) {
            $RequiresThumbnail = TRUE;
        }
        $Path = ltrim(GetValue('Path', $Media), '/');
        if ($RequiresThumbnail) {
            $Src = Url('/utility/thumbnail/' . GetValue('MediaID', $Media, 'x') . '/' . $Path, TRUE);
        } else {
            $Src = Gdn_Upload::Url($Path);
        }
    }
    if ($Data) {
        $Result = array('src' => $Src, 'width' => GetValue('ThumbWidth', $Media), 'height' => GetValue('ThumbHeight', $Media));
    } else {
        $Result = Img($Src, array('class' => 'ImageThumbnail', 'width' => GetValue('ThumbWidth', $Media), 'height' => GetValue('ThumbHeight', $Media)));
    }
    return $Result;
}
开发者ID:SatiricMan,项目名称:addons,代码行数:36,代码来源:fileupload_functions.php

示例4: Wrap

?>
</h1>
<?php 
echo $this->Form->Open(array('enctype' => 'multipart/form-data'));
echo $this->Form->Errors();
?>
<ul>
   <li>
      <?php 
echo $this->Form->Label('Banner Title', 'Garden.Title');
echo Wrap(T('The banner title appears on the top-left of every page. If a banner logo is uploaded, it will replace the banner title on user-facing forum pages.'), 'div', array('class' => 'Info'));
echo $this->Form->TextBox('Garden.Title');
?>
   </li>
   <li>
      <?php 
echo $this->Form->Label('Banner Logo', 'Garden.Logo');
$Logo = $this->Data('Logo');
if ($Logo) {
    echo Wrap(Img(Gdn_Upload::Url($Logo)), 'div');
    echo Wrap(Anchor(T('Remove Banner Logo'), '/dashboard/settings/removelogo/' . $Session->TransientKey(), 'SmallButton'), 'div', array('style' => 'padding: 10px 0;'));
    echo Wrap(T('Browse for a new banner logo if you would like to change it:'), 'div', array('class' => 'Info'));
} else {
    echo Wrap(T('The banner logo appears at the top of your forum.'), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('Logo', 'file');
?>
   </li>
</ul>
<?php 
echo $this->Form->Close('Save');
开发者ID:seedbank,项目名称:old-repo,代码行数:31,代码来源:banner.php

示例5: Comment

 /**
  * Create or update a comment.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $DiscussionID Unique ID to add the comment to. If blank, this method will throw an error.
  */
 public function Comment($DiscussionID = '')
 {
     // Get $DiscussionID from RequestArgs if valid
     if ($DiscussionID == '' && count($this->RequestArgs)) {
         if (is_numeric($this->RequestArgs[0])) {
             $DiscussionID = $this->RequestArgs[0];
         }
     }
     // If invalid $DiscussionID, get from form.
     $this->Form->SetModel($this->CommentModel);
     $DiscussionID = is_numeric($DiscussionID) ? $DiscussionID : $this->Form->GetFormValue('DiscussionID', 0);
     // Set discussion data
     $this->DiscussionID = $DiscussionID;
     $this->Discussion = $Discussion = $this->DiscussionModel->GetID($DiscussionID);
     // Is this an embedded comment being posted to a discussion that doesn't exist yet?
     $vanilla_type = $this->Form->GetFormValue('vanilla_type', '');
     $vanilla_url = $this->Form->GetFormValue('vanilla_url', '');
     $vanilla_category_id = $this->Form->GetFormValue('vanilla_category_id', '');
     $Attributes = array('ForeignUrl' => $vanilla_url);
     $vanilla_identifier = $this->Form->GetFormValue('vanilla_identifier', '');
     // Only allow vanilla identifiers of 32 chars or less - md5 if larger
     if (strlen($vanilla_identifier) > 32) {
         $Attributes['vanilla_identifier'] = $vanilla_identifier;
         $vanilla_identifier = md5($vanilla_identifier);
     }
     if (!$Discussion && $vanilla_url != '' && $vanilla_identifier != '') {
         $Discussion = $Discussion = $this->DiscussionModel->GetForeignID($vanilla_identifier, $vanilla_type);
         if ($Discussion) {
             $this->DiscussionID = $DiscussionID = $Discussion->DiscussionID;
             $this->Form->SetValue('DiscussionID', $DiscussionID);
         }
     }
     // If so, create it!
     if (!$Discussion && $vanilla_url != '' && $vanilla_identifier != '') {
         // Add these values back to the form if they exist!
         $this->Form->AddHidden('vanilla_identifier', $vanilla_identifier);
         $this->Form->AddHidden('vanilla_type', $vanilla_type);
         $this->Form->AddHidden('vanilla_url', $vanilla_url);
         $this->Form->AddHidden('vanilla_category_id', $vanilla_category_id);
         $PageInfo = FetchPageInfo($vanilla_url);
         if (!($Title = $this->Form->GetFormValue('Name'))) {
             $Title = GetValue('Title', $PageInfo, '');
             if ($Title == '') {
                 $Title = T('Undefined discussion subject.');
             }
         }
         $Description = GetValue('Description', $PageInfo, '');
         $Images = GetValue('Images', $PageInfo, array());
         $LinkText = T('EmbededDiscussionLinkText', 'Read the full story here');
         if (!$Description && count($Images) == 0) {
             $Body = FormatString('<p><a href="{Url}">{LinkText}</a></p>', array('Url' => $vanilla_url, 'LinkText' => $LinkText));
         } else {
             $Body = FormatString('
         <div class="EmbeddedContent">{Image}<strong>{Title}</strong>
            <p>{Excerpt}</p>
            <p><a href="{Url}">{LinkText}</a></p>
            <div class="ClearFix"></div>
         </div>', array('Title' => $Title, 'Excerpt' => $Description, 'Image' => count($Images) > 0 ? Img(GetValue(0, $Images), array('class' => 'LeftAlign')) : '', 'Url' => $vanilla_url, 'LinkText' => $LinkText));
         }
         if ($Body == '') {
             $Body = $vanilla_url;
         }
         if ($Body == '') {
             $Body = T('Undefined discussion body.');
         }
         // Validate the CategoryID for inserting.
         $Category = CategoryModel::Categories($vanilla_category_id);
         if (!$Category) {
             $vanilla_category_id = C('Vanilla.Embed.DefaultCategoryID', 0);
             if ($vanilla_category_id <= 0) {
                 // No default category defined, so grab the first non-root category and use that.
                 $vanilla_category_id = $this->DiscussionModel->SQL->Select('CategoryID')->From('Category')->Where('CategoryID >', 0)->Get()->FirstRow()->CategoryID;
                 // No categories in the db? default to 0
                 if (!$vanilla_category_id) {
                     $vanilla_category_id = 0;
                 }
             }
         } else {
             $vanilla_category_id = $Category['CategoryID'];
         }
         $EmbedUserID = C('Garden.Embed.UserID');
         if ($EmbedUserID) {
             $EmbedUser = Gdn::UserModel()->GetID($EmbedUserID);
         }
         if (!$EmbedUserID || !$EmbedUser) {
             $EmbedUserID = Gdn::UserModel()->GetSystemUserID();
         }
         $EmbeddedDiscussionData = array('InsertUserID' => $EmbedUserID, 'DateInserted' => Gdn_Format::ToDateTime(), 'DateUpdated' => Gdn_Format::ToDateTime(), 'CategoryID' => $vanilla_category_id, 'ForeignID' => $vanilla_identifier, 'Type' => $vanilla_type, 'Name' => $Title, 'Body' => $Body, 'Format' => 'Html', 'Attributes' => serialize($Attributes));
         $this->EventArguments['Discussion'] = $EmbeddedDiscussionData;
         $this->FireEvent('BeforeEmbedDiscussion');
         $DiscussionID = $this->DiscussionModel->SQL->Insert('Discussion', $EmbeddedDiscussionData);
         $ValidationResults = $this->DiscussionModel->ValidationResults();
//.........这里部分代码省略.........
开发者ID:embo-hd,项目名称:vanilla,代码行数:101,代码来源:class.postcontroller.php

示例6: init

 /**
  *
  *
  * @param $Path
  * @param $Controller
  */
 public function init($Path, $Controller)
 {
     $Smarty = $this->smarty();
     // Get a friendly name for the controller.
     $ControllerName = get_class($Controller);
     if (StringEndsWith($ControllerName, 'Controller', true)) {
         $ControllerName = substr($ControllerName, 0, -10);
     }
     // Get an ID for the body.
     $BodyIdentifier = strtolower($Controller->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::alphaNumeric(strtolower($Controller->RequestMethod)));
     $Smarty->assign('BodyID', $BodyIdentifier);
     //$Smarty->assign('Config', Gdn::Config());
     // Assign some information about the user.
     $Session = Gdn::session();
     if ($Session->isValid()) {
         $User = array('Name' => $Session->User->Name, 'Photo' => '', 'CountNotifications' => (int) val('CountNotifications', $Session->User, 0), 'CountUnreadConversations' => (int) val('CountUnreadConversations', $Session->User, 0), 'SignedIn' => true);
         $Photo = $Session->User->Photo;
         if ($Photo) {
             if (!IsUrl($Photo)) {
                 $Photo = Gdn_Upload::Url(ChangeBasename($Photo, 'n%s'));
             }
         } else {
             if (function_exists('UserPhotoDefaultUrl')) {
                 $Photo = UserPhotoDefaultUrl($Session->User, 'ProfilePhoto');
             } elseif ($ConfigPhoto = C('Garden.DefaultAvatar')) {
                 $Photo = Gdn_Upload::url($ConfigPhoto);
             } else {
                 $Photo = Asset('/applications/dashboard/design/images/defaulticon.png', true);
             }
         }
         $User['Photo'] = $Photo;
     } else {
         $User = false;
         /*array(
           'Name' => '',
           'CountNotifications' => 0,
           'SignedIn' => FALSE);*/
     }
     $Smarty->assign('User', $User);
     // Make sure that any datasets use arrays instead of objects.
     foreach ($Controller->Data as $Key => $Value) {
         if ($Value instanceof Gdn_DataSet) {
             $Controller->Data[$Key] = $Value->resultArray();
         } elseif ($Value instanceof stdClass) {
             $Controller->Data[$Key] = (array) $Value;
         }
     }
     $BodyClass = val('CssClass', $Controller->Data, '', true);
     $Sections = Gdn_Theme::section(null, 'get');
     if (is_array($Sections)) {
         foreach ($Sections as $Section) {
             $BodyClass .= ' Section-' . $Section;
         }
     }
     $Controller->Data['BodyClass'] = $BodyClass;
     // Set the current locale for themes to take advantage of.
     $Locale = Gdn::locale()->Locale;
     $CurrentLocale = array('Key' => $Locale, 'Lang' => str_replace('_', '-', $Locale));
     if (class_exists('Locale')) {
         $CurrentLocale['Language'] = Locale::getPrimaryLanguage($Locale);
         $CurrentLocale['Region'] = Locale::getRegion($Locale);
         $CurrentLocale['DisplayName'] = Locale::getDisplayName($Locale, $Locale);
         $CurrentLocale['DisplayLanguage'] = Locale::getDisplayLanguage($Locale, $Locale);
         $CurrentLocale['DisplayRegion'] = Locale::getDisplayRegion($Locale, $Locale);
     }
     $Smarty->assign('CurrentLocale', $CurrentLocale);
     $Smarty->assign('Assets', (array) $Controller->Assets);
     $Smarty->assign('Path', Gdn::request()->path());
     // Assign the controller data last so the controllers override any default data.
     $Smarty->assign($Controller->Data);
     $Smarty->Controller = $Controller;
     // for smarty plugins
     $Smarty->security = true;
     $Smarty->security_settings['IF_FUNCS'] = array_merge($Smarty->security_settings['IF_FUNCS'], array('Category', 'CheckPermission', 'InSection', 'InCategory', 'MultiCheckPermission', 'GetValue', 'SetValue', 'Url'));
     $Smarty->security_settings['MODIFIER_FUNCS'] = array_merge($Smarty->security_settings['MODIFIER_FUNCS'], array('sprintf'));
     $Smarty->secure_dir = array($Path);
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:83,代码来源:class.smarty.php

示例7: getIconUrl

 /**
  * Get path to icon.
  *
  * @return string Path to icon
  */
 public function getIconUrl()
 {
     $Icon = C('Garden.TouchIcon') ? Gdn_Upload::Url(C('Garden.TouchIcon')) : Asset(self::DEFAULT_PATH);
     return $Icon;
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:10,代码来源:class.touchicon.plugin.php

示例8: Wrap

echo Wrap(T('LogoDescription', 'The banner logo appears at the top of your site. Some themes may not display this logo.'), 'div', array('class' => 'Info'));
$Logo = $this->Data('Logo');
if ($Logo) {
    echo Wrap(Img(Gdn_Upload::Url($Logo)), 'div');
    echo Wrap(Anchor(T('Remove Banner Logo'), '/dashboard/settings/removelogo/' . $Session->TransientKey(), 'SmallButton'), 'div', array('style' => 'padding: 10px 0;'));
    echo Wrap(T('LogoBrowse', 'Browse for a new banner logo if you would like to change it:'), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('Logo', 'file');
?>
         </li>
         <li>
            <?php 
echo $this->Form->Label('Favicon', 'Favicon');
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>
      </ul>
   </div>
</div>
<?php 
echo '<div class="Buttons">' . $this->Form->Button('Save') . '</div>';
echo $this->Form->Close();
开发者ID:rnovino,项目名称:Garden,代码行数:31,代码来源:banner.php

示例9: JoinUserData

 /**
  * Add UserCategory modifiers
  *
  * Update &$Categories in memory by applying modifiers from UserCategory for
  * the currently logged-in user.
  *
  * @since 2.0.18
  * @access public
  * @param array &$Categories
  * @param bool $AddUserCategory
  */
 public static function JoinUserData(&$Categories, $AddUserCategory = TRUE)
 {
     $IDs = array_keys($Categories);
     $DoHeadings = C('Vanilla.Categories.DoHeadings');
     if ($AddUserCategory) {
         $SQL = clone Gdn::SQL();
         $SQL->Reset();
         if (Gdn::Session()->UserID) {
             $Key = 'UserCategory_' . Gdn::Session()->UserID;
             $UserData = Gdn::Cache()->Get($Key);
             if ($UserData === Gdn_Cache::CACHEOP_FAILURE) {
                 $UserData = $SQL->GetWhere('UserCategory', array('UserID' => Gdn::Session()->UserID))->ResultArray();
                 $UserData = Gdn_DataSet::Index($UserData, 'CategoryID');
                 Gdn::Cache()->Store($Key, $UserData);
             }
         } else {
             $UserData = array();
         }
         //         Gdn::Controller()->SetData('UserData', $UserData);
         foreach ($IDs as $ID) {
             $Category = $Categories[$ID];
             $DateMarkedRead = GetValue('DateMarkedRead', $Category);
             $Row = GetValue($ID, $UserData);
             if ($Row) {
                 $UserDateMarkedRead = $Row['DateMarkedRead'];
                 if (!$DateMarkedRead || $UserDateMarkedRead && Gdn_Format::ToTimestamp($UserDateMarkedRead) > Gdn_Format::ToTimestamp($DateMarkedRead)) {
                     $Categories[$ID]['DateMarkedRead'] = $UserDateMarkedRead;
                     $DateMarkedRead = $UserDateMarkedRead;
                 }
                 $Categories[$ID]['Unfollow'] = $Row['Unfollow'];
             } else {
                 $Categories[$ID]['Unfollow'] = FALSE;
             }
             // Calculate the following field.
             $Following = !((bool) GetValue('Archived', $Category) || (bool) GetValue('Unfollow', $Row, FALSE));
             $Categories[$ID]['Following'] = $Following;
             // Calculate the read field.
             if ($DoHeadings && $Category['Depth'] <= 1) {
                 $Categories[$ID]['Read'] = FALSE;
             } elseif ($DateMarkedRead) {
                 if (GetValue('LastDateInserted', $Category)) {
                     $Categories[$ID]['Read'] = Gdn_Format::ToTimestamp($DateMarkedRead) >= Gdn_Format::ToTimestamp($Category['LastDateInserted']);
                 } else {
                     $Categories[$ID]['Read'] = TRUE;
                 }
             } else {
                 $Categories[$ID]['Read'] = FALSE;
             }
         }
     }
     // Add permissions.
     $Session = Gdn::Session();
     foreach ($IDs as $CID) {
         $Category = $Categories[$CID];
         $Categories[$CID]['Url'] = Url($Category['Url'], '//');
         if ($Photo = val('Photo', $Category)) {
             $Categories[$CID]['PhotoUrl'] = Gdn_Upload::Url($Photo);
         }
         if ($Category['LastUrl']) {
             $Categories[$CID]['LastUrl'] = Url($Category['LastUrl'], '//');
         }
         $Categories[$CID]['PermsDiscussionsView'] = $Session->CheckPermission('Vanilla.Discussions.View', TRUE, 'Category', $Category['PermissionCategoryID']);
         $Categories[$CID]['PermsDiscussionsAdd'] = $Session->CheckPermission('Vanilla.Discussions.Add', TRUE, 'Category', $Category['PermissionCategoryID']);
         $Categories[$CID]['PermsDiscussionsEdit'] = $Session->CheckPermission('Vanilla.Discussions.Edit', TRUE, 'Category', $Category['PermissionCategoryID']);
         $Categories[$CID]['PermsCommentsAdd'] = $Session->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $Category['PermissionCategoryID']);
     }
 }
开发者ID:embo-hd,项目名称:vanilla,代码行数:78,代码来源:class.categorymodel.php

示例10: RenderMaster

 /**
  * Undocumented method.
  *
  * @todo Method RenderMaster() needs a description.
  */
 public function RenderMaster()
 {
     // Build the master view if necessary
     if (in_array($this->_DeliveryType, array(DELIVERY_TYPE_ALL))) {
         $this->MasterView = $this->MasterView();
         // Only get css & ui components if this is NOT a syndication request
         if ($this->SyndicationMethod == SYNDICATION_NONE && is_object($this->Head)) {
             //            if (ArrayHasValue($this->_CssFiles, 'style.css')) {
             //               $this->AddCssFile('custom.css');
             //
             //               // Add the theme option's css file.
             //               if ($this->Theme && $this->ThemeOptions) {
             //                  $Filenames = GetValueR('Styles.Value', $this->ThemeOptions);
             //                  if (is_string($Filenames) && $Filenames != '%s')
             //                     $this->_CssFiles[] = array('FileName' => ChangeBasename('custom.css', $Filenames), 'AppFolder' => FALSE, 'Options' => FALSE);
             //               }
             //            } elseif (ArrayHasValue($this->_CssFiles, 'admin.css')) {
             //               $this->AddCssFile('customadmin.css');
             //            }
             $this->EventArguments['CssFiles'] =& $this->_CssFiles;
             $this->FireEvent('BeforeAddCss');
             $ETag = AssetModel::ETag();
             $CombineAssets = C('Garden.CombineAssets');
             $ThemeType = IsMobile() ? 'mobile' : 'desktop';
             // And now search for/add all css files.
             foreach ($this->_CssFiles as $CssInfo) {
                 $CssFile = $CssInfo['FileName'];
                 // style.css and admin.css deserve some custom processing.
                 if (in_array($CssFile, array('style.css', 'admin.css'))) {
                     if (!$CombineAssets) {
                         // Grab all of the css files from the asset model.
                         $AssetModel = new AssetModel();
                         $CssFiles = $AssetModel->GetCssFiles($ThemeType, ucfirst(substr($CssFile, 0, -4)), $ETag);
                         foreach ($CssFiles as $Info) {
                             $this->Head->AddCss($Info[1], 'all', TRUE, $CssInfo);
                         }
                     } else {
                         $Basename = substr($CssFile, 0, -4);
                         $this->Head->AddCss(Url("/utility/css/{$ThemeType}/{$Basename}-{$ETag}.css", '//'), 'all', FALSE, $CssInfo['Options']);
                     }
                     continue;
                 }
                 if (StringBeginsWith($CssFile, 'http')) {
                     $this->Head->AddCss($CssFile, 'all', GetValue('AddVersion', $CssInfo, TRUE), $CssInfo['Options']);
                     continue;
                 } elseif (strpos($CssFile, '/') !== FALSE) {
                     // A direct path to the file was given.
                     $CssPaths = array(CombinePaths(array(PATH_ROOT, str_replace('/', DS, $CssFile))));
                 } else {
                     //                  $CssGlob = preg_replace('/(.*)(\.css)/', '\1*\2', $CssFile);
                     $AppFolder = $CssInfo['AppFolder'];
                     if ($AppFolder == '') {
                         $AppFolder = $this->ApplicationFolder;
                     }
                     // CSS comes from one of four places:
                     $CssPaths = array();
                     if ($this->Theme) {
                         // Use the default filename.
                         $CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'design' . DS . $CssFile;
                     }
                     // 3. Application or plugin.
                     if (StringBeginsWith($AppFolder, 'plugins/')) {
                         // The css is coming from a plugin.
                         $AppFolder = substr($AppFolder, strlen('plugins/'));
                         $CssPaths[] = PATH_PLUGINS . "/{$AppFolder}/design/{$CssFile}";
                         $CssPaths[] = PATH_PLUGINS . "/{$AppFolder}/{$CssFile}";
                     } elseif (in_array($AppFolder, array('static', 'resources'))) {
                         // This is a static css file.
                         $CssPaths[] = PATH_ROOT . "/resources/css/{$CssFile}";
                     } else {
                         // Application default. eg. root/applications/app_name/design/
                         $CssPaths[] = PATH_APPLICATIONS . DS . $AppFolder . DS . 'design' . DS . $CssFile;
                     }
                     // 4. Garden default. eg. root/applications/dashboard/design/
                     $CssPaths[] = PATH_APPLICATIONS . DS . 'dashboard' . DS . 'design' . DS . $CssFile;
                 }
                 // Find the first file that matches the path.
                 $CssPath = FALSE;
                 foreach ($CssPaths as $Glob) {
                     $Paths = SafeGlob($Glob);
                     if (is_array($Paths) && count($Paths) > 0) {
                         $CssPath = $Paths[0];
                         break;
                     }
                 }
                 // Check to see if there is a CSS cacher.
                 $CssCacher = Gdn::Factory('CssCacher');
                 if (!is_null($CssCacher)) {
                     $CssPath = $CssCacher->Get($CssPath, $AppFolder);
                 }
                 if ($CssPath !== FALSE) {
                     $CssPath = substr($CssPath, strlen(PATH_ROOT));
                     $CssPath = str_replace(DS, '/', $CssPath);
                     $this->Head->AddCss($CssPath, 'all', TRUE, $CssInfo['Options']);
                 }
//.........这里部分代码省略.........
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:101,代码来源:class.controller.php

示例11: Url

 public static function Url($Media)
 {
     static $UseDownloadUrl = NULL;
     if ($UseDownloadUrl === NULL) {
         $UseDownloadUrl = C('Plugins.FileUpload.UseDownloadUrl');
     }
     //      decho($Media);
     if (is_string($Media)) {
         $SubPath = $Media;
         if (method_exists('Gdn_Upload', 'Url')) {
             $Url = Gdn_Upload::Url("{$SubPath}");
         } else {
             $Url = "/uploads/{$SubPath}";
         }
     } elseif ($UseDownloadUrl) {
         $Url = '/discussion/download/' . GetValue('MediaID', $Media) . '/' . rawurlencode(GetValue('Name', $Media));
     } else {
         $SubPath = ltrim(GetValue('Path', $Media), '/');
         if (method_exists('Gdn_Upload', 'Url')) {
             $Url = Gdn_Upload::Url("{$SubPath}");
         } else {
             $Url = "/uploads/{$SubPath}";
         }
     }
     return $Url;
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:26,代码来源:class.mediamodel.php

示例12: CalculateData

 /**
  *
  *
  * @since 2.0.18
  * @access public
  * @param array $Data Dataset.
  */
 protected static function CalculateData(&$Data)
 {
     foreach ($Data as &$Category) {
         $Category['CountAllDiscussions'] = $Category['CountDiscussions'];
         $Category['CountAllComments'] = $Category['CountComments'];
         $Category['Url'] = self::CategoryUrl($Category, FALSE, '/');
         $Category['ChildIDs'] = array();
         if (GetValue('Photo', $Category)) {
             $Category['PhotoUrl'] = Gdn_Upload::Url($Category['Photo']);
         } else {
             $Category['PhotoUrl'] = '';
         }
         if ($Category['DisplayAs'] == 'Default') {
             if ($Category['Depth'] <= C('Vanilla.Categories.NavDepth', 0)) {
                 $Category['DisplayAs'] = 'Categories';
             } else {
                 $Category['DisplayAs'] = 'Discussions';
             }
         }
         if (!GetValue('CssClass', $Category)) {
             $Category['CssClass'] = 'Category-' . $Category['UrlCode'];
         }
         if (isset($Category['AllowedDiscussionTypes']) && is_string($Category['AllowedDiscussionTypes'])) {
             $Category['AllowedDiscussionTypes'] = unserialize($Category['AllowedDiscussionTypes']);
         }
     }
     $Keys = array_reverse(array_keys($Data));
     foreach ($Keys as $Key) {
         $Cat = $Data[$Key];
         $ParentID = $Cat['ParentCategoryID'];
         if (isset($Data[$ParentID]) && $ParentID != $Key) {
             $Data[$ParentID]['CountAllDiscussions'] += $Cat['CountAllDiscussions'];
             $Data[$ParentID]['CountAllComments'] += $Cat['CountAllComments'];
             array_unshift($Data[$ParentID]['ChildIDs'], $Key);
         }
     }
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:44,代码来源:class.categorymodel.php

示例13: Img

// Define the current profile picture
$Picture = '';
if ($this->User->Photo != '') {
    if (StringBeginsWith($this->User->Photo, 'http')) {
        $Picture = Img($this->User->Photo, array('class' => 'ProfilePhotoLarge'));
    } else {
        $Picture = Img(Gdn_Upload::Url(ChangeBasename($this->User->Photo, 'p%s')), array('class' => 'ProfilePhotoLarge'));
    }
}
// Define the current thumbnail icon
$Thumbnail = $this->User->Photo;
if (!$Thumbnail && function_exists('UserPhotoDefaultUrl')) {
    $Thumbnail = UserPhotoDefaultUrl($this->User);
}
if ($Thumbnail && !preg_match('`^https?://`i', $Thumbnail)) {
    $Thumbnail = Gdn_Upload::Url(ChangeBasename($Thumbnail, 'n%s'));
}
$Thumbnail = Img($Thumbnail, array('alt' => T('Thumbnail')));
?>
<div class="SmallPopup">
<h2 class="H"><?php 
echo $this->Data('Title');
?>
</h2>
<?php 
echo $this->Form->Open(array('enctype' => 'multipart/form-data'));
echo $this->Form->Errors();
?>
<ul>
   <?php 
if ($Picture != '') {
开发者ID:rnovino,项目名称:Garden,代码行数:31,代码来源:picture.php

示例14: Logo

 /**
  * Renders the banner logo, or just the banner title if the logo is not defined.
  */
 public static function Logo()
 {
     $Logo = C('Garden.Logo');
     if ($Logo) {
         $Logo = ltrim($Logo, '/');
         // Fix the logo path.
         if (StringBeginsWith($Logo, 'uploads/')) {
             $Logo = substr($Logo, strlen('uploads/'));
         }
     }
     $Title = C('Garden.Title', 'Title');
     echo $Logo ? Img(Gdn_Upload::Url($Logo), array('alt' => $Title)) : $Title;
 }
开发者ID:remobjects,项目名称:Garden,代码行数:16,代码来源:class.theme.php

示例15: array

      <?php 
echo $this->Form->Label('Description', 'Description');
echo $this->Form->TextBox('Description', array('MultiLine' => TRUE));
?>
   </li>
   <li>
      <?php 
echo $this->Form->Label('Css Class', 'CssClass');
echo $this->Form->TextBox('CssClass', array('MultiLine' => FALSE));
?>
   </li>
   <li>
      <?php 
echo $this->Form->Label('Photo', 'PhotoUpload');
if ($Photo = $this->Form->GetValue('Photo')) {
    echo Img(Gdn_Upload::Url($Photo));
    echo '<br />' . Anchor(T('Delete Photo'), CombinePaths(array('vanilla/settings/deletecategoryphoto', $this->Category->CategoryID, Gdn::Session()->TransientKey())), 'SmallButton Danger PopConfirm');
}
echo $this->Form->Input('PhotoUpload', 'file');
?>
   </li>
   <?php 
echo $this->Form->Simple($this->Data('_ExtendedFields', array()), array('Wrap' => array('', '')));
?>
   <?php 
if ($this->ShowCustomPoints) {
    ?>
   <li>
      <?php 
    echo $this->Form->Label('Display As', 'DisplayAs');
    echo $this->Form->DropDown('DisplayAs', array('Default' => 'Default', 'Categories' => 'Categories', 'Discussions' => 'Discussions'));
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:31,代码来源:addcategory.php


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