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


PHP ChangeBasename函数代码示例

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


在下文中一共展示了ChangeBasename函数的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 != '') {
        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 
}
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:60,代码来源:helper_functions.php

示例2: Img

<?php

if (!defined('APPLICATION')) {
    exit;
}
// If the photo contains an http://, it is just an icon, don't show it here.
if ($this->User->Photo != '' && strtolower(substr($this->User->Photo, 0, 7)) != 'http://') {
    ?>
   <div class="Photo">
      <?php 
    echo Img('uploads/' . ChangeBasename($this->User->Photo, 'p%s'));
    ?>
   </div>
   <?php 
}
开发者ID:kerphi,项目名称:Garden,代码行数:15,代码来源:userphoto.php

示例3: 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

示例4: Save

 /**
  * Generic save procedure.
  */
 public function Save($FormPostValues, $Settings = FALSE)
 {
     // See if the user's related roles should be saved or not.
     $SaveRoles = ArrayValue('SaveRoles', $Settings);
     // Define the primary key in this model's table.
     $this->DefineSchema();
     // Add & apply any extra validation rules:
     if (array_key_exists('Email', $FormPostValues)) {
         $this->Validation->ApplyRule('Email', 'Email');
     }
     // Custom Rule: This will make sure that at least one role was selected if saving roles for this user.
     if ($SaveRoles) {
         $this->Validation->AddRule('OneOrMoreArrayItemRequired', 'function:ValidateOneOrMoreArrayItemRequired');
         // $this->Validation->AddValidationField('RoleID', $FormPostValues);
         $this->Validation->ApplyRule('RoleID', 'OneOrMoreArrayItemRequired');
     }
     // Make sure that the checkbox val for email is saved as the appropriate enum
     if (array_key_exists('ShowEmail', $FormPostValues)) {
         $FormPostValues['ShowEmail'] = ForceBool($FormPostValues['ShowEmail'], '0', '1', '0');
     }
     // Validate the form posted values
     $UserID = ArrayValue('UserID', $FormPostValues);
     $Insert = $UserID > 0 ? FALSE : TRUE;
     if ($Insert) {
         $this->AddInsertFields($FormPostValues);
     } else {
         $this->AddUpdateFields($FormPostValues);
     }
     $this->EventArguments['FormPostValues'] = $FormPostValues;
     $this->FireEvent('BeforeSaveValidation');
     $RecordRoleChange = TRUE;
     if ($this->Validate($FormPostValues, $Insert) === TRUE) {
         $Fields = $this->Validation->ValidationFields();
         // All fields on the form that need to be validated (including non-schema field rules defined above)
         $RoleIDs = ArrayValue('RoleID', $Fields, 0);
         $Username = ArrayValue('Name', $Fields);
         $Email = ArrayValue('Email', $Fields);
         $Fields = $this->Validation->SchemaValidationFields();
         // Only fields that are present in the schema
         // Remove the primary key from the fields collection before saving
         $Fields = RemoveKeyFromArray($Fields, $this->PrimaryKey);
         // Make sure to encrypt the password for saving...
         if (array_key_exists('Password', $Fields)) {
             $PasswordHash = new Gdn_PasswordHash();
             $Fields['Password'] = $PasswordHash->HashPassword($Fields['Password']);
         }
         $this->EventArguments['Fields'] = $Fields;
         $this->FireEvent('BeforeSave');
         // Check the validation results again in case something was added during the BeforeSave event.
         if (count($this->Validation->Results()) == 0) {
             // If the primary key exists in the validated fields and it is a
             // numeric value greater than zero, update the related database row.
             if ($UserID > 0) {
                 // If they are changing the username & email, make sure they aren't
                 // already being used (by someone other than this user)
                 if (ArrayValue('Name', $Fields, '') != '' || ArrayValue('Email', $Fields, '') != '') {
                     if (!$this->ValidateUniqueFields($Username, $Email, $UserID)) {
                         return FALSE;
                     }
                 }
                 $this->SQL->Put($this->Name, $Fields, array($this->PrimaryKey => $UserID));
                 // Record activity if the person changed his/her photo
                 $Photo = ArrayValue('Photo', $FormPostValues);
                 if ($Photo !== FALSE) {
                     AddActivity($UserID, 'PictureChange', '<img src="' . Asset('uploads/' . ChangeBasename($Photo, 't%s')) . '" alt="' . T('Thumbnail') . '" />');
                 }
             } else {
                 $RecordRoleChange = FALSE;
                 if (!$this->ValidateUniqueFields($Username, $Email)) {
                     return FALSE;
                 }
                 // Define the other required fields:
                 $Fields['Email'] = $Email;
                 // And insert the new user
                 $UserID = $this->_Insert($Fields);
                 // Make sure that the user is assigned to one or more roles:
                 $SaveRoles = TRUE;
                 // Report that the user was created
                 $Session = Gdn::Session();
                 AddActivity($UserID, 'JoinCreated', T('Welcome Aboard!'), $Session->UserID > 0 ? $Session->UserID : '');
             }
             // Now update the role settings if necessary
             if ($SaveRoles) {
                 // If no RoleIDs were provided, use the system defaults
                 if (!is_array($RoleIDs)) {
                     $RoleIDs = Gdn::Config('Garden.Registration.DefaultRoles');
                 }
                 $this->SaveRoles($UserID, $RoleIDs, $RecordRoleChange);
             }
             $this->EventArguments['UserID'] = $UserID;
             $this->FireEvent('AfterSave');
         } else {
             $UserID = FALSE;
         }
     } else {
         $UserID = FALSE;
     }
//.........这里部分代码省略.........
开发者ID:TiGR,项目名称:Garden,代码行数:101,代码来源:class.usermodel.php

示例5: 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'));
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:31,代码来源:thumbnail.php

示例6: 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 '';
      }
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:23,代码来源:functions.render.php

示例7: Comment


//.........这里部分代码省略.........
                 $this->SetJson('DraftID', $DraftID);
                 if ($Preview) {
                     // If this was a preview click, create a comment shell with the values for this comment
                     $this->Comment = new stdClass();
                     $this->Comment->InsertUserID = $Session->User->UserID;
                     $this->Comment->InsertName = $Session->User->Name;
                     $this->Comment->InsertPhoto = $Session->User->Photo;
                     $this->Comment->DateInserted = Gdn_Format::Date();
                     $this->Comment->Body = ArrayValue('Body', $FormValues, '');
                     $this->View = 'preview';
                 } elseif (!$Draft) {
                     // If the comment was not a draft
                     // If Editing a comment
                     if ($Editing) {
                         // Just reload the comment in question
                         $this->Offset = 1;
                         $Comments = $this->CommentModel->GetIDData($CommentID, array('Slave' => FALSE));
                         $this->SetData('Comments', $Comments);
                         $this->SetData('Discussion', $Discussion);
                         // Load the discussion
                         $this->ControllerName = 'discussion';
                         $this->View = 'comments';
                         // Also define the discussion url in case this request came from the post screen and needs to be redirected to the discussion
                         $this->SetJson('DiscussionUrl', DiscussionUrl($this->Discussion) . '#Comment_' . $CommentID);
                     } else {
                         // If the comment model isn't sorted by DateInserted or CommentID then we can't do any fancy loading of comments.
                         $OrderBy = GetValueR('0.0', $this->CommentModel->OrderBy());
                         //                     $Redirect = !in_array($OrderBy, array('c.DateInserted', 'c.CommentID'));
                         //							$DisplayNewCommentOnly = $this->Form->GetFormValue('DisplayNewCommentOnly');
                         //                     if (!$Redirect) {
                         //                        // Otherwise load all new comments that the user hasn't seen yet
                         //                        $LastCommentID = $this->Form->GetFormValue('LastCommentID');
                         //                        if (!is_numeric($LastCommentID))
                         //                           $LastCommentID = $CommentID - 1; // Failsafe back to this new comment if the lastcommentid was not defined properly
                         //
                         //                        // Don't reload the first comment if this new comment is the first one.
                         //                        $this->Offset = $LastCommentID == 0 ? 1 : $this->CommentModel->GetOffset($LastCommentID);
                         //                        // Do not load more than a single page of data...
                         //                        $Limit = C('Vanilla.Comments.PerPage', 30);
                         //
                         //                        // Redirect if the new new comment isn't on the same page.
                         //                        $Redirect |= !$DisplayNewCommentOnly && PageNumber($this->Offset, $Limit) != PageNumber($Discussion->CountComments - 1, $Limit);
                         //                     }
                         //                     if ($Redirect) {
                         //                        // The user posted a comment on a page other than the last one, so just redirect to the last page.
                         //                        $this->RedirectUrl = Gdn::Request()->Url("discussion/comment/$CommentID/#Comment_$CommentID", TRUE);
                         //                     } else {
                         //                        // Make sure to load all new comments since the page was last loaded by this user
                         //								if ($DisplayNewCommentOnly)
                         $this->Offset = $this->CommentModel->GetOffset($CommentID);
                         $Comments = $this->CommentModel->GetIDData($CommentID, array('Slave' => FALSE));
                         $this->SetData('Comments', $Comments);
                         $this->SetData('NewComments', TRUE);
                         $this->ClassName = 'DiscussionController';
                         $this->ControllerName = 'discussion';
                         $this->View = 'comments';
                         //                     }
                         // Make sure to set the user's discussion watch records
                         $CountComments = $this->CommentModel->GetCount($DiscussionID);
                         $Limit = is_object($this->Data('Comments')) ? $this->Data('Comments')->NumRows() : $Discussion->CountComments;
                         $Offset = $CountComments - $Limit;
                         $this->CommentModel->SetWatch($this->Discussion, $Limit, $Offset, $CountComments);
                     }
                 } else {
                     // If this was a draft save, notify the user about the save
                     $this->InformMessage(sprintf(T('Draft saved at %s'), Gdn_Format::Date()));
                 }
                 // And update the draft count
                 $UserModel = Gdn::UserModel();
                 $CountDrafts = $UserModel->GetAttribute($Session->UserID, 'CountDrafts', 0);
                 $this->SetJson('MyDrafts', T('My Drafts'));
                 $this->SetJson('CountDrafts', $CountDrafts);
             }
         }
     }
     // Include data for FireEvent
     if (property_exists($this, 'Discussion')) {
         $this->EventArguments['Discussion'] = $this->Discussion;
     }
     if (property_exists($this, 'Comment')) {
         $this->EventArguments['Comment'] = $this->Comment;
     }
     $this->FireEvent('BeforeCommentRender');
     if ($this->DeliveryType() == DELIVERY_TYPE_DATA) {
         $Comment = $this->Data('Comments')->FirstRow(DATASET_TYPE_ARRAY);
         if ($Comment) {
             $Photo = $Comment['InsertPhoto'];
             if (strpos($Photo, '//') === FALSE) {
                 $Photo = Gdn_Upload::Url(ChangeBasename($Photo, 'n%s'));
             }
             $Comment['InsertPhoto'] = $Photo;
         }
         $this->Data = array('Comment' => $Comment);
         $this->RenderData($this->Data);
     } else {
         require_once $this->FetchViewLocation('helper_functions', 'Discussion');
         // Render default view.
         $this->Render();
     }
 }
开发者ID:embo-hd,项目名称:vanilla,代码行数:101,代码来源:class.postcontroller.php

示例8: Thumbnail

 public function Thumbnail()
 {
     $this->Permission('Garden.SignIn.Allow');
     $this->AddJsFile('jquery.jcrop.pack.js');
     $this->AddJsFile('profile.js');
     $Session = Gdn::Session();
     if (!$Session->IsValid()) {
         $this->Form->AddError('You must be authenticated in order to use this form.');
     }
     $this->GetUserInfo();
     $this->Form->SetModel($this->UserModel);
     $this->Form->AddHidden('UserID', $this->User->UserID);
     if ($this->User->Photo == '') {
         $this->Form->AddError('You must first upload a picture before you can create a thumbnail.');
     }
     // Define the thumbnail size
     $this->ThumbSize = Gdn::Config('Garden.Thumbnail.Size', 32);
     // Define the source (profile sized) picture & dimensions.
     if (preg_match('`https?://`i', $this->User->Photo)) {
         $this->Form->AddError('You cannont edit the thumbnail of an externally linked profile picture.');
         $this->SourceSize = 0;
     } else {
         $Source = PATH_ROOT . '/uploads/' . ChangeBasename($this->User->Photo, 'p%s');
         $this->SourceSize = getimagesize($Source);
     }
     // Add some more hidden form fields for jcrop
     $this->Form->AddHidden('x', '0');
     $this->Form->AddHidden('y', '0');
     $this->Form->AddHidden('w', $this->ThumbSize);
     $this->Form->AddHidden('h', $this->ThumbSize);
     $this->Form->AddHidden('HeightSource', $this->SourceSize[1]);
     $this->Form->AddHidden('WidthSource', $this->SourceSize[0]);
     $this->Form->AddHidden('ThumbSize', $this->ThumbSize);
     if ($this->Form->AuthenticatedPostBack() === TRUE) {
         try {
             // Get the dimensions from the form
             // Get the source image
             $SourceImage = imagecreatefromjpeg($Source);
             // Create the new target image
             $TargetImage = imagecreatetruecolor($this->ThumbSize, $this->ThumbSize);
             // Fill the target thumbnail
             imagecopyresampled($TargetImage, $SourceImage, 0, 0, $this->Form->GetValue('x'), $this->Form->GetValue('y'), $this->ThumbSize, $this->ThumbSize, $this->Form->GetValue('w'), $this->Form->GetValue('h'));
             // Save the target thumbnail
             imagejpeg($TargetImage, PATH_ROOT . '/uploads/' . ChangeBasename($this->User->Photo, 'n%s'));
         } catch (Exception $ex) {
             $this->Form->AddError($ex->getMessage());
         }
         // If there were no problems, redirect back to the user account
         if ($this->Form->ErrorCount() == 0) {
             Redirect('dashboard/profile/' . Gdn_Format::Url($this->User->Name));
         }
     }
     $this->Render();
 }
开发者ID:TiGR,项目名称:Garden,代码行数:54,代码来源:class.profilecontroller.php

示例9: Link

   public static function Link($Path, $Text = FALSE, $Format = '<a href="%url" class="%class">%text</a>', $Options = array()) {
      $Session = Gdn::Session();
      $Class = GetValue('class', $Options, '');
      $WithDomain = GetValue('WithDomain', $Options);
      $Target = GetValue('Target', $Options, '');

      switch ($Path) {
         case 'activity':
            TouchValue('Permissions', $Options, 'Garden.Activity.View');
            break;
         case 'dashboard':
            $Path = 'dashboard/settings';
            TouchValue('Permissions', $Options, 'Garden.Settings.Manage');
            if (!$Text)
               $Text = T('Dashboard');
            break;
         case 'inbox':
            $Path = 'messages/inbox';
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text)
               $Text = T('Inbox');
            if ($Session->IsValid() && $Session->User->CountUnreadConversations) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Alert">'.$Session->User->CountUnreadConversations.'</span>';
            }
            break;
         case 'profile':
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text && $Session->IsValid())
               $Text = $Session->User->Name;
            if ($Session->IsValid() && $Session->User->CountNotifications) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Alert">'.$Session->User->CountNotifications.'</span>';
            }
            break;
         case 'user':
            $Path = 'profile';
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text && $Session->IsValid())
               $Text = $Session->User->Name;

            break;
         case 'photo':
            $Path = 'profile';
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text && $Session->IsValid()) {
               $IsFullPath = strtolower(substr($Session->User->Photo, 0, 7)) == 'http://' || strtolower(substr($Session->User->Photo, 0, 8)) == 'https://';
               $PhotoUrl = ($IsFullPath) ? $Session->User->Photo : Gdn_Upload::Url(ChangeBasename($Session->User->Photo, 'n%s'));
               $Text = Img($PhotoUrl, array('alt' => htmlspecialchars($Session->User->Name)));
            }

            break;
         case 'drafts':
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text)
               $Text = T('My Drafts');
            if ($Session->IsValid() && $Session->User->CountDrafts) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Alert">'.$Session->User->CountDrafts.'</span>';
            }
            break;
         case 'discussions/bookmarked':
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text)
               $Text = T('My Bookmarks');
            if ($Session->IsValid() && $Session->User->CountBookmarks) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Count">'.$Session->User->CountBookmarks.'</span>';
            }
            break;
         case 'discussions/mine':
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text)
               $Text = T('My Discussions');
            if ($Session->IsValid() && $Session->User->CountDiscussions) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Count">'.$Session->User->CountDiscussions.'</span>';
            }
            break;
         case 'signin':
         case 'signinout':
            // The destination is the signin/signout toggle link.
            if ($Session->IsValid()) {
               if(!$Text)
                  $Text = T('Sign Out');
               $Path =  SignOutUrl($Target);
               $Class = ConcatSep(' ', $Class, 'SignOut');
            } else {
               if(!$Text)
                  $Text = T('Sign In');
               $Attribs = array();

               $Path = SignInUrl($Target);
               if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE)
                  $Class = ConcatSep(' ', $Class, 'SignInPopup');
            }
            break;
      }

      if (GetValue('Permissions', $Options) && !$Session->CheckPermission($Options['Permissions']))
//.........这里部分代码省略.........
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:101,代码来源:class.theme.php

示例10: SetCalculatedFields

 public function SetCalculatedFields(&$User) {
    if ($v = GetValue('Attributes', $User))
       SetValue('Attributes', $User, @unserialize($v));
    if ($v = GetValue('Permissions', $User))
       SetValue('Permissions', $User, @unserialize($v));
    if ($v = GetValue('Preferences', $User))
       SetValue('Preferences', $User, @unserialize($v));
    if ($v = GetValue('Photo', $User)) {
       if (!preg_match('`^https?://`i', $v)) {
          $PhotoUrl = Gdn_Upload::Url(ChangeBasename($v, 'n%s'));
       } else {
          $PhotoUrl = $v;
       }
       
       SetValue('PhotoUrl', $User, $PhotoUrl);
    }
 }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:17,代码来源:class.usermodel.php

示例11: T

echo T('Original');
?>
</th>
         <td><?php 
echo T('Thumbnail');
?>
</td>
      </tr>
   </thead>
   <tbody>
      <tr>
         <th>
            <?php 
echo Img('uploads/' . ChangeBasename($this->User->Photo, 'p%s'), array('id' => 'cropbox'));
?>
</th>
         <td>
            <div style="<?php 
echo 'width:' . $this->ThumbSize . 'px;height:' . $this->ThumbSize . 'px;';
?>
overflow:hidden;">
               <?php 
echo Img('uploads/' . ChangeBasename($this->User->Photo, 'p%s'), array('id' => 'preview'));
?>
            </div>
         </td>
      </tr>
   </tbody>
</table>
<?php 
echo $this->Form->Close('Save');
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:31,代码来源:thumbnail.php

示例12: if

<?php if (!defined('APPLICATION')) exit();
if ($this->User->Photo != '') {
?>
   <div class="Photo">
      <?php
      if (strpos($this->User->Photo, 'http') === 0)
         echo Img($this->User->Photo);
      else
         echo Img(Gdn_Upload::Url(ChangeBasename($this->User->Photo, 'p%s')));
      ?>
   </div>
<?php
}
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:13,代码来源:userphoto.php

示例13: Base_BeforeAddCss_Handler

 public function Base_BeforeAddCss_Handler($Sender)
 {
     $WebRoot = Gdn::Request()->WebRoot();
     // Find all css file paths
     $CssToCache = array();
     foreach ($Sender->CssFiles() as $CssInfo) {
         $CssFile = $CssInfo['FileName'];
         if (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 = $Sender->ApplicationFolder;
             }
             // CSS comes from one of four places:
             $CssPaths = array();
             if ($Sender->Theme) {
                 // 1. Application-specific css. eg. root/themes/theme_name/app_name/design/
                 // $CssPaths[] = PATH_THEMES . DS . $Sender->Theme . DS . $AppFolder . DS . 'design' . DS . $CssGlob;
                 // 2. Theme-wide theme view. eg. root/themes/theme_name/design/
                 // a) Check to see if a customized version of the css is there.
                 if ($Sender->ThemeOptions) {
                     $Filenames = GetValueR('Styles.Value', $Sender->ThemeOptions);
                     if (is_string($Filenames) && $Filenames != '%s') {
                         $CssPaths[] = PATH_THEMES . DS . $Sender->Theme . DS . 'design' . DS . ChangeBasename($CssFile, $Filenames);
                     }
                 }
                 // b) Use the default filename.
                 $CssPaths[] = PATH_THEMES . DS . $Sender->Theme . DS . 'design' . DS . $CssFile;
             }
             // 3. 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;
             }
         }
         if ($CssPath !== FALSE) {
             $CssPath = substr($CssPath, strlen(PATH_ROOT) + 1);
             $CssPath = str_replace(DS, '/', $CssPath);
             $CssToCache[] = $CssPath;
         }
     }
     $CssToCache = array_unique($CssToCache);
     // And now search for/add all JS files
     $JsToCache = array();
     // Add the global js files
     $GlobalJS = array('jquery.js', 'jquery.livequery.js', 'jquery.form.js', 'jquery.popup.js', 'jquery.gardenhandleajaxform.js', 'global.js');
     foreach ($Sender->JsFiles() as $JsInfo) {
         $JsFile = $JsInfo['FileName'];
         // Ignore the JsFile if it is in the globaljs minify group (defined in plugins/Minifiy/min/groupsConfig.php).
         if (!in_array($JsFile, $GlobalJS)) {
             if (strpos($JsFile, '/') !== FALSE) {
                 // A direct path to the file was given.
                 $JsPaths = array(CombinePaths(array(PATH_ROOT, str_replace('/', DS, $JsFile)), DS));
             } else {
                 $AppFolder = $JsInfo['AppFolder'];
                 if ($AppFolder == '') {
                     $AppFolder = $Sender->ApplicationFolder;
                 }
                 // JS can come from a theme, an any of the application folder, or it can come from the global js folder:
                 $JsPaths = array();
                 if ($Sender->Theme) {
                     // 1. Application-specific js. eg. root/themes/theme_name/app_name/design/
                     $JsPaths[] = PATH_THEMES . DS . $Sender->Theme . DS . $AppFolder . DS . 'js' . DS . $JsFile;
                     // 2. Garden-wide theme view. eg. root/themes/theme_name/design/
                     $JsPaths[] = PATH_THEMES . DS . $Sender->Theme . DS . 'js' . DS . $JsFile;
                 }
                 // 3. This application folder
                 $JsPaths[] = PATH_APPLICATIONS . DS . $AppFolder . DS . 'js' . DS . $JsFile;
                 // 4. Global JS folder. eg. root/js/
                 $JsPaths[] = PATH_ROOT . DS . 'js' . DS . $JsFile;
                 // 5. Global JS library folder. eg. root/js/library/
                 $JsPaths[] = PATH_ROOT . DS . 'js' . DS . 'library' . DS . $JsFile;
             }
             // Find the first file that matches the path.
             $JsPath = FALSE;
             foreach ($JsPaths as $Glob) {
                 $Paths = SafeGlob($Glob);
                 if (is_array($Paths) && count($Paths) > 0) {
                     $JsPath = $Paths[0];
                     break;
                 }
             }
             if ($JsPath !== FALSE) {
                 $JsPath = str_replace(array(PATH_ROOT, DS), array('', '/'), $JsPath);
                 $JsPath = substr($JsPath, 0, 1) == '/' ? substr($JsPath, 1) : $JsPath;
                 $JsToCache[] = $JsPath;
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:kerphi,项目名称:Garden,代码行数:101,代码来源:class.minify.plugin.php

示例14: C

    $BannedPhoto = C('Garden.BannedPhoto', 'http://cdn.vanillaforums.com/images/banned_large.png');
    if ($BannedPhoto) {
        $Photo = Gdn_Upload::Url($BannedPhoto);
    }
}
if ($Photo) {
    ?>
   <div class="Photo PhotoWrap PhotoWrapLarge <?php 
    echo GetValue('_CssClass', $User);
    ?>
">
      <?php 
    if (StringBeginsWith($Photo, 'http')) {
        $Img = Img($Photo, array('class' => 'ProfilePhotoLarge'));
    } else {
        $Img = Img(Gdn_Upload::Url(ChangeBasename($Photo, 'p%s')), array('class' => 'ProfilePhotoLarge'));
    }
    if (!$User->Banned && (Gdn::Session()->UserID == $User->UserID || Gdn::Session()->CheckPermission('Garden.Users.Edit'))) {
        echo Anchor(Wrap(T('Change Picture')), '/profile/picture?userid=' . $User->UserID, 'ChangePicture');
    }
    echo $Img;
    ?>
   </div>
<?php 
} else {
    if ($User->UserID == Gdn::Session()->UserID || Gdn::Session()->CheckPermission('Garden.Users.Edit')) {
        ?>
   <div class="Photo"><?php 
        echo Anchor(T('Add a Profile Picture'), '/profile/picture?userid=' . $User->UserID, 'AddPicture BigButton');
        ?>
</div>
开发者ID:rnovino,项目名称:Garden,代码行数:31,代码来源:userphoto.php

示例15: array

 $Col = 0;
 $Classes = array('FirstCol', 'MiddleCol', 'LastCol');
 foreach ($this->data('ThemeInfo.Options.Styles') as $Key => $Options) {
     $Basename = val('Basename', $Options, '%s');
     if ($Col == 0) {
         echo '<tr>';
     }
     $Active = '';
     if ($this->data('ThemeOptions.Styles.Key') == $Key || !$this->data('ThemeOptions.Styles.Key') && $Basename == '%s') {
         $Active = ' Active';
     }
     $KeyID = str_replace(' ', '_', $Key);
     echo "<td id=\"{$KeyID}_td\" class=\"{$Classes[$Col]}{$Active}\">";
     echo '<h4>', t($Key), '</h4>';
     // Look for a screenshot for for the style.
     $Screenshot = SafeGlob(PATH_THEMES . DS . $this->data('ThemeFolder') . DS . 'design' . DS . ChangeBasename('screenshot.*', $Basename), array('gif', 'jpg', 'png'));
     if (is_array($Screenshot) && count($Screenshot) > 0) {
         $Screenshot = basename($Screenshot[0]);
         echo img('/themes/' . $this->data('ThemeFolder') . '/design/' . $Screenshot, array('alt' => t($Key), 'width' => '160'));
     }
     $Disabled = $Active ? ' Disabled' : '';
     echo '<div class="Buttons">', anchor(t('Select'), '?style=' . urlencode($Key), 'SmallButton SelectThemeStyle' . $Disabled, array('Key' => $Key)), '</div>';
     if (isset($Options['Description'])) {
         echo '<div class="Info2">', $Options['Description'], '</div>';
     }
     echo '</td>';
     $Col = ($Col + 1) % 3;
     if ($Col == 0) {
         echo '</tr>';
     }
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:31,代码来源:themeoptions.php


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