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


PHP ConcatSep函数代码示例

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


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

示例1: buttonDropDown

 /**
  * Write a button drop down control.
  *
  * @param array $Links An array of arrays with the following keys:
  *  - Text: The text of the link.
  *  - Url: The url of the link.
  * @param string|array $CssClass The css class of the link. This can be a two-item array where the second element will be added to the buttons.
  * @param string $Label The text of the button.
  * @since 2.1
  */
 function buttonDropDown($Links, $CssClass = 'Button', $Label = false)
 {
     if (!is_array($Links) || count($Links) < 1) {
         return;
     }
     $ButtonClass = '';
     if (is_array($CssClass)) {
         list($CssClass, $ButtonClass) = $CssClass;
     }
     if (count($Links) < 2) {
         $Link = array_pop($Links);
         if (strpos(GetValue('CssClass', $Link, ''), 'Popup') !== false) {
             $CssClass .= ' Popup';
         }
         echo Anchor($Link['Text'], $Link['Url'], GetValue('ButtonCssClass', $Link, $CssClass));
     } else {
         // NavButton or Button?
         $ButtonClass = ConcatSep(' ', $ButtonClass, strpos($CssClass, 'NavButton') !== false ? 'NavButton' : 'Button');
         if (strpos($CssClass, 'Primary') !== false) {
             $ButtonClass .= ' Primary';
         }
         // Strip "Button" or "NavButton" off the group class.
         echo '<div class="ButtonGroup' . str_replace(array('NavButton', 'Button'), array('', ''), $CssClass) . '">';
         //            echo Anchor($Text, $Url, $ButtonClass);
         echo '<ul class="Dropdown MenuItems">';
         foreach ($Links as $Link) {
             echo wrap(Anchor($Link['Text'], $Link['Url'], val('CssClass', $Link, '')), 'li');
         }
         echo '</ul>';
         echo anchor($Label . ' ' . sprite('SpDropdownHandle'), '#', $ButtonClass . ' Handle');
         echo '</div>';
     }
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:43,代码来源:functions.render.php

示例2: Edit

 public function Edit($Reference = 0, $ParentID = '')
 {
     $Session = Gdn::Session();
     $Model = new SectionModel();
     $this->Form->SetModel($Model);
     if ($ParentID) {
         $this->Form->AddHidden('ParentID', $ParentID);
     }
     $Section = False;
     if ($Reference) {
         $Section = $Model->GetID($Reference);
         if (!IsContentOwner($Section, 'Candy.Sections.Edit')) {
             $Section = False;
         }
         if ($Section) {
             $this->Form->AddHidden('SectionID', $Section->SectionID);
             $this->Form->SetData($Section);
         }
     }
     if (!$Section) {
         $this->Permission('Candy.Sections.Add');
     }
     if ($this->Form->AuthenticatedPostBack()) {
         $this->Form->Save($Section);
         if ($this->Form->ErrorCount() == 0) {
             $this->InformMessage(T('Saved'), array('Sprite' => 'Check', 'CssClass' => 'Dismissable AutoDismiss'));
         }
     }
     $this->Title(ConcatSep(' - ', T('Section'), GetValue('Name', $Section)));
     $this->Render();
 }
开发者ID:unlight,项目名称:Candy,代码行数:31,代码来源:class.sectioncontroller.php

示例3: smarty_function_link

/**
 * Takes a route and prepends the web root (expects "/controller/action/params" as $Path).
 *
 * @param array The parameters passed into the function.
 * The parameters that can be passed to this function are as follows.
 * - <b>path</b>: The relative path for the url. There are some special paths that can be used to return "intelligent" links:
 *    - <b>signinout</b>: This will return a signin/signout url that will toggle depending on whether or not the user is already signed in. When this path is given the text is automaticall set.
 * - <b>withdomain</b>: Whether or not to add the domain to the url.
 * - <b>text</b>: Html text to be put inside an anchor. If this value is set then an html <a></a> is returned rather than just a url.
 * - <b>id, class, etc.></b>: When an anchor is generated then any other attributes are passed through and will be written in the resulting tag.
 * @param Smarty The smarty object rendering the template.
 * @return The url.
 */
function smarty_function_link($Params, &$Smarty)
{
    $Path = GetValue('path', $Params, '', TRUE);
    $WithDomain = GetValue('withdomain', $Params, FALSE, TRUE);
    $RemoveSyndication = GetValue('removeSyndication', $Params, FALSE, TRUE);
    $Text = GetValue('text', $Params, '', TRUE);
    $NoTag = GetValue('notag', $Params, FALSE, TRUE);
    $Class = GetValue('class', $Params, '', TRUE);
    $Session = Gdn::Session();
    $Authenticator = Gdn::Authenticator();
    // Use some logic to expan special urls.
    switch (strtolower($Path)) {
        case "signinout":
            // The destination is the signin/signout toggle link.
            if ($Session->IsValid()) {
                if (!$Text && !$NoTag) {
                    $Text = T('Sign Out');
                }
                $Path = $Authenticator->SignOutUrl();
                $Class = ConcatSep(' ', $Class, 'SignOut');
            } else {
                if (!$Text && !$NoTag) {
                    $Text = T('Sign In');
                }
                $Attribs = array();
                $Path = $Authenticator->SignInUrl('');
                if (Gdn::Config('Garden.SignIn.Popup')) {
                    $Class = ConcatSep(' ', $Class, 'SignInPopup');
                }
            }
            break;
    }
    $Url = Url($Path, $WithDomain, $RemoveSyndication);
    $Url = str_replace('{Session_TransientKey}', $Session->TransientKey(), $Url);
    if (!$Text) {
        $NoTag = TRUE;
    }
    if ($NoTag) {
        $Result = $Url;
    } else {
        $Result = '<a';
        // Add the standard attrbutes to the anchor.
        $ID = GetValue('id', $Params, '', TRUE);
        if ($ID) {
            $Result .= ' id="' . urlencode($ID) . '"';
        }
        $Result .= ' href="' . $Url . '"';
        if ($Class) {
            $Result .= ' class="' . urlencode($Class) . '"';
        }
        // Add anything that's left over.
        foreach ($Params as $Key => $Value) {
            $Result .= ' ' . $Key . '="' . urlencode($Value) . '"';
        }
        // Add the link text.
        $Result .= '>' . $Text . '</a>';
    }
    return $Result;
}
开发者ID:sipp11,项目名称:Garden,代码行数:72,代码来源:function.link.php

示例4: DiscussionsController_Tagged_Create

 /**
  * Load discussions for a specific tag.
  */
 public function DiscussionsController_Tagged_Create($Sender)
 {
     $Offset = GetValue('1', $Sender->RequestArgs, 'p1');
     list($Offset, $Limit) = OffsetLimit($Offset, Gdn::Config('Vanilla.Discussions.PerPage', 30));
     $Sender->Tag = GetValue('0', $Sender->RequestArgs, '');
     $Sender->Title(T('Tagged with ') . $Sender->Tag);
     $Sender->Head->Title($Sender->Head->Title());
     $Sender->CanonicalUrl(Url(ConcatSep('/', 'discussions/tagged/' . $Sender->Tag, PageNumber($Offset, $Limit, TRUE)), TRUE));
     if ($Sender->Head) {
         $Sender->AddJsFile('discussions.js');
         $Sender->AddJsFile('bookmark.js');
         $Sender->AddJsFile('js/library/jquery.menu.js');
         $Sender->AddJsFile('options.js');
         $Sender->Head->AddRss($Sender->SelfUrl . '/feed.rss', $Sender->Head->Title());
     }
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     // Add Modules
     $Sender->AddModule('NewDiscussionModule');
     $BookmarkedModule = new BookmarkedModule($Sender);
     $BookmarkedModule->GetData();
     $Sender->AddModule($BookmarkedModule);
     $Sender->SetData('Category', FALSE, TRUE);
     $DiscussionModel = new DiscussionModel();
     $Tag = $DiscussionModel->SQL->Select()->From('Tag')->Where('Name', $Sender->Tag)->Get()->FirstRow();
     $TagID = $Tag ? $Tag->TagID : 0;
     $CountDiscussions = $Tag ? $Tag->CountDiscussions : 0;
     $Sender->SetData('CountDiscussions', $CountDiscussions);
     $Sender->AnnounceData = FALSE;
     $Sender->SetData('Announcements', array(), TRUE);
     $DiscussionModel->FilterToTagID = $TagID;
     $Sender->DiscussionData = $DiscussionModel->Get($Offset, $Limit);
     $Sender->SetData('Discussions', $Sender->DiscussionData, TRUE);
     $Sender->SetJson('Loading', $Offset . ' to ' . $Limit);
     // Build a pager.
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->Pager = $PagerFactory->GetPager('Pager', $Sender);
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->Configure($Offset, $Limit, $CountDiscussions, 'discussions/tagged/' . $Sender->Tag . '/%1$s');
     // Deliver json data if necessary
     if ($Sender->DeliveryType() != DELIVERY_TYPE_ALL) {
         $Sender->SetJson('LessRow', $Sender->Pager->ToString('less'));
         $Sender->SetJson('MoreRow', $Sender->Pager->ToString('more'));
         $Sender->View = 'discussions';
     }
     // Set a definition of the user's current timezone from the db. jQuery
     // will pick this up, compare to the browser, and update the user's
     // timezone if necessary.
     $CurrentUser = Gdn::Session()->User;
     if (is_object($CurrentUser)) {
         $ClientHour = $CurrentUser->HourOffset + date('G', time());
         $Sender->AddDefinition('SetClientHour', $ClientHour);
     }
     // Render the controller
     $Sender->Render(PATH_PLUGINS . '/Tagging/views/taggeddiscussions.php');
 }
开发者ID:nickhx,项目名称:Garden,代码行数:60,代码来源:class.tagging.plugin.php

示例5: Index

 /**
  * Default all discussions view: chronological by most recent comment.
  * 
  * @since 2.0.0
  * @access public
  * 
  * @param int $Page Multiplied by PerPage option to determine offset.
  */
 public function Index($Page = '0')
 {
     // Determine offset from $Page
     list($Page, $Limit) = OffsetLimit($Page, Gdn::Config('Vanilla.Discussions.PerPage', 30));
     $this->CanonicalUrl(Url(ConcatSep('/', 'discussions', PageNumber($Page, $Limit, TRUE)), TRUE));
     // Validate $Page
     if (!is_numeric($Page) || $Page < 0) {
         $Page = 0;
     }
     // Setup head
     $this->Title(T('All Discussions'));
     if ($this->Head) {
         $this->Head->AddRss(Url('/discussions/feed.rss', TRUE), $this->Head->Title());
     }
     // Add modules
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('CategoriesModule');
     $BookmarkedModule = new BookmarkedModule($this);
     $BookmarkedModule->GetData();
     $this->AddModule($BookmarkedModule);
     // Set criteria & get discussions data
     $this->SetData('Category', FALSE, TRUE);
     $DiscussionModel = new DiscussionModel();
     $CountDiscussions = $DiscussionModel->GetCount();
     $this->SetData('CountDiscussions', $CountDiscussions);
     $this->AnnounceData = $Page == 0 ? $DiscussionModel->GetAnnouncements() : FALSE;
     $this->SetData('Announcements', $this->AnnounceData !== FALSE ? $this->AnnounceData : array(), TRUE);
     $this->DiscussionData = $DiscussionModel->Get($Page, $Limit);
     $this->SetData('Discussions', $this->DiscussionData, TRUE);
     $this->SetJson('Loading', $Page . ' to ' . $Limit);
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $this->EventArguments['PagerType'] = 'Pager';
     $this->FireEvent('BeforeBuildPager');
     $this->Pager = $PagerFactory->GetPager($this->EventArguments['PagerType'], $this);
     $this->Pager->ClientID = 'Pager';
     $this->Pager->Configure($Page, $Limit, $CountDiscussions, 'discussions/%1$s');
     $this->FireEvent('AfterBuildPager');
     // Deliver JSON data if necessary
     if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'discussions';
     }
     // Set a definition of the user's current timezone from the db. jQuery
     // will pick this up, compare to the browser, and update the user's
     // timezone if necessary.
     $CurrentUser = Gdn::Session()->User;
     if (is_object($CurrentUser)) {
         $ClientHour = $CurrentUser->HourOffset + date('G', time());
         $this->AddDefinition('SetClientHour', $ClientHour);
     }
     // Render default view (discussions/index.php)
     $this->Render();
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:63,代码来源:class.discussionscontroller.php

示例6: CheckMollom

 public function CheckMollom($RecordType, $Data)
 {
     $UserID = $this->UserID();
     if (!$UserID) {
         return FALSE;
     }
     $Mollom = self::Mollom();
     if (!$Mollom) {
         return FALSE;
     }
     $Result = $Mollom->checkContent(array('checks' => array('spam'), 'postTitle' => GetValue('Name', $Data), 'postBody' => ConcatSep("\n\n", GetValue('Body', $Data), GetValue('Story', $Data)), 'authorName' => $Data['Username'], 'authorEmail' => $Data['Email'], 'authorIp' => $Data['IPAddress']));
     return $Result['spamClassification'] == 'spam' ? true : false;
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:13,代码来源:class.mollom.plugin.php

示例7: Index

 public function Index($Offset = '0')
 {
     list($Offset, $Limit) = OffsetLimit($Offset, Gdn::Config('Vanilla.Discussions.PerPage', 30));
     $this->CanonicalUrl(Url(ConcatSep('/', 'discussions', PageNumber($Offset, $Limit, TRUE)), TRUE));
     $this->Title(T('All Discussions'));
     if ($this->Head) {
         $this->Head->AddRss($this->SelfUrl . '/feed.rss', $this->Head->Title());
     }
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     // Add Modules
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('CategoriesModule');
     $BookmarkedModule = new BookmarkedModule($this);
     $BookmarkedModule->GetData();
     $this->AddModule($BookmarkedModule);
     $this->SetData('Category', FALSE, TRUE);
     $DiscussionModel = new DiscussionModel();
     $CountDiscussions = $DiscussionModel->GetCount();
     $this->SetData('CountDiscussions', $CountDiscussions);
     $this->AnnounceData = $Offset == 0 ? $DiscussionModel->GetAnnouncements() : FALSE;
     $this->SetData('Announcements', $this->AnnounceData !== FALSE ? $this->AnnounceData : array(), TRUE);
     $this->DiscussionData = $DiscussionModel->Get($Offset, $Limit);
     $this->SetData('Discussions', $this->DiscussionData, TRUE);
     $this->SetJson('Loading', $Offset . ' to ' . $Limit);
     // Build a pager.
     $PagerFactory = new Gdn_PagerFactory();
     $this->Pager = $PagerFactory->GetPager('Pager', $this);
     $this->Pager->ClientID = 'Pager';
     $this->Pager->Configure($Offset, $Limit, $CountDiscussions, 'discussions/%1$s');
     // Deliver json data if necessary
     if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'discussions';
     }
     // Set a definition of the user's current timezone from the db. jQuery
     // will pick this up, compare to the browser, and update the user's
     // timezone if necessary.
     $CurrentUser = Gdn::Session()->User;
     if (is_object($CurrentUser)) {
         $ClientHour = $CurrentUser->HourOffset + date('G', time());
         $this->AddDefinition('SetClientHour', $ClientHour);
     }
     // Render the controller
     $this->Render();
 }
开发者ID:kerphi,项目名称:Garden,代码行数:48,代码来源:class.discussionscontroller.php

示例8: CountString

   function CountString($Number, $Url = '', $Options = array()) {
      if (is_string($Options))
         $Options = array('cssclass' => $Options);
      $Options = array_change_key_case($Options);
      $CssClass = GetValue('cssclass', $Options, '');

      if ($Number === NULL && $Url) {
         $CssClass = ConcatSep(' ', $CssClass, 'Popin TinyProgress');
         $Url = htmlspecialchars($Url);
         $Result = "<span class=\"$CssClass\" rel=\"$Url\"></span>";
      } elseif ($Number) {
         $Result = " <span class=\"Count\">$Number</span>";
      } else {
         $Result = '';
      }
      return $Result;
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:17,代码来源:functions.render.php

示例9: CheckAkismet

 public function CheckAkismet($RecordType, $Data)
 {
     $UserID = $this->UserID();
     if (!$UserID) {
         return FALSE;
     }
     $Akismet = self::Akismet();
     if (!$Akismet) {
         return FALSE;
     }
     $Akismet->setCommentAuthor($Data['Username']);
     $Akismet->setCommentAuthorEmail($Data['Email']);
     $Body = ConcatSep("\n\n", GetValue('Name', $Data), GetValue('Body', $Data), GetValue('Story', $Data));
     $Akismet->setCommentContent($Body);
     $Akismet->setUserIP($Data['IPAddress']);
     $Result = $Akismet->isCommentSpam();
     return $Result;
 }
开发者ID:nilsen,项目名称:addons,代码行数:18,代码来源:class.akismet.plugin.php

示例10: Update

 public function Update($Reference = '', $PostBackKey = '')
 {
     $this->Permission('Candy.Chunks.Edit');
     $Content = False;
     $Session = Gdn::Session();
     $this->AddJsFile('jquery.textpandable.js');
     $this->AddJsFile('editform.js');
     $this->Form->SetModel($this->ChunkModel);
     if ($Reference != '') {
         $Content = $this->ChunkModel->GetID($Reference);
         if ($Content) {
             $this->Form->AddHidden('ChunkID', $Content->ChunkID);
             $this->Editing = True;
             $this->Form->SetData($Content);
         }
     }
     $IsFormPostBack = $this->Form->AuthenticatedPostBack();
     $PostAuthenticatedByKey = $Session->ValidateTransientKey($PostBackKey) && $this->Form->IsPostBack();
     if ($IsFormPostBack || $PostAuthenticatedByKey) {
         if ($PostAuthenticatedByKey) {
             // AJAX, set form values.
             $this->Form->SetFormValue('ChunkID', $Content->ChunkID);
             $this->Form->SetFormValue('Body', GetPostValue('Body'));
         }
         $SavedID = $this->Form->Save($Content);
         if ($SavedID) {
             $Message = T('Saved');
             $this->InformMessage($Message, array('Sprite' => 'Check', 'CssClass' => 'Dismissable AutoDismiss'));
             if ($this->DeliveryType() == DELIVERY_TYPE_BOOL) {
                 //$this->SetData('Content', $Content);
                 //$this->SetData('NewBody', Gdn_Format::To($this->Form->GetFormValue('Body'), $Content->Format));
                 $this->SetJson('NewBody', Gdn_Format::To($this->Form->GetFormValue('Body'), $Content->Format));
             }
         }
     } else {
         $this->SetData('Content', $Content);
         $this->Form->SetData($Content);
     }
     $this->Title(ConcatSep(' - ', T('Chunk'), GetValue('Name', $Content)));
     $this->Render();
 }
开发者ID:unlight,项目名称:Candy,代码行数:41,代码来源:class.chunkcontroller.php

示例11: Base_BeforeCommentDisplay_Handler

 public function Base_BeforeCommentDisplay_Handler($Sender, $Args)
 {
     $QnA = GetValueR('Comment.QnA', $Args);
     if ($QnA && isset($Args['CssClass'])) {
         $Args['CssClass'] = ConcatSep(' ', $Args['CssClass'], "QnA-Item-{$QnA}");
     }
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:7,代码来源:class.qna.plugin.php

示例12: Configure


//.........这里部分代码省略.........
         try {
             $Connection = new PDO($ConnectionString, $DatabaseUser, $DatabasePassword);
         } catch (PDOException $Exception) {
             switch ($Exception->getCode()) {
                 case 1044:
                     $this->Form->AddError(T('The database user you specified does not have permission to access the database. Have you created the database yet? The database reported: <code>%s</code>'), strip_tags($Exception->getMessage()));
                     break;
                 case 1045:
                     $this->Form->AddError(T('Failed to connect to the database with the username and password you entered. Did you mistype them? The database reported: <code>%s</code>'), strip_tags($Exception->getMessage()));
                     break;
                 case 1049:
                     $this->Form->AddError(T('It appears as though the database you specified does not exist yet. Have you created it yet? Did you mistype the name? The database reported: <code>%s</code>'), strip_tags($Exception->getMessage()));
                     break;
                 case 2005:
                     $this->Form->AddError(T("Are you sure you've entered the correct database host name? Maybe you mistyped it? The database reported: <code>%s</code>"), strip_tags($Exception->getMessage()));
                     break;
                 default:
                     $this->Form->AddError(sprintf(T('ValidateConnection'), strip_tags($Exception->getMessage())));
                     break;
             }
         }
         $ConfigurationModel->Validation->ApplyRule('Garden.Title', 'Required');
         $ConfigurationFormValues = $this->Form->FormValues();
         if ($ConfigurationModel->Validate($ConfigurationFormValues) !== TRUE || $this->Form->ErrorCount() > 0) {
             // Apply the validation results to the form(s)
             $this->Form->SetValidationResults($ConfigurationModel->ValidationResults());
         } else {
             $Host = array_shift(explode(':', Gdn::Request()->RequestHost()));
             $Domain = Gdn::Request()->Domain();
             // Set up cookies now so that the user can be signed in.
             $ExistingSalt = C('Garden.Cookie.Salt', FALSE);
             $ConfigurationFormValues['Garden.Cookie.Salt'] = $ExistingSalt ? $ExistingSalt : RandomString(10);
             $ConfigurationFormValues['Garden.Cookie.Domain'] = '';
             // Don't set this to anything by default. # Tim - 2010-06-23
             // Additional default setup values.
             $ConfigurationFormValues['Garden.Registration.ConfirmEmail'] = TRUE;
             $ConfigurationFormValues['Garden.Email.SupportName'] = $ConfigurationFormValues['Garden.Title'];
             $ConfigurationModel->Save($ConfigurationFormValues, TRUE);
             // If changing locale, redefine locale sources:
             $NewLocale = 'en-CA';
             // $this->Form->GetFormValue('Garden.Locale', FALSE);
             if ($NewLocale !== FALSE && Gdn::Config('Garden.Locale') != $NewLocale) {
                 $ApplicationManager = new Gdn_ApplicationManager();
                 $Locale = Gdn::Locale();
                 $Locale->Set($NewLocale, $ApplicationManager->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders(), TRUE);
             }
             // Install db structure & basic data.
             $Database = Gdn::Database();
             $Database->Init();
             $Drop = FALSE;
             // Gdn::Config('Garden.Version') === FALSE ? TRUE : FALSE;
             $Explicit = FALSE;
             try {
                 include PATH_APPLICATIONS . DS . 'dashboard' . DS . 'settings' . DS . 'structure.php';
             } catch (Exception $ex) {
                 $this->Form->AddError($ex);
             }
             if ($this->Form->ErrorCount() > 0) {
                 return FALSE;
             }
             // Create the administrative user
             $UserModel = Gdn::UserModel();
             $UserModel->DefineSchema();
             $UsernameError = T('UsernameError', 'Username can only contain letters, numbers, underscores, and must be between 3 and 20 characters long.');
             $UserModel->Validation->ApplyRule('Name', 'Username', $UsernameError);
             $UserModel->Validation->ApplyRule('Name', 'Required', T('You must specify an admin username.'));
             $UserModel->Validation->ApplyRule('Password', 'Required', T('You must specify an admin password.'));
             $UserModel->Validation->ApplyRule('Password', 'Match');
             $UserModel->Validation->ApplyRule('Email', 'Email');
             if (!($AdminUserID = $UserModel->SaveAdminUser($ConfigurationFormValues))) {
                 $this->Form->SetValidationResults($UserModel->ValidationResults());
             } else {
                 // The user has been created successfully, so sign in now.
                 SaveToConfig('Garden.Installed', TRUE, array('Save' => FALSE));
                 Gdn::Session()->Start($AdminUserID, TRUE);
                 SaveToConfig('Garden.Installed', FALSE, array('Save' => FALSE));
             }
             if ($this->Form->ErrorCount() > 0) {
                 return FALSE;
             }
             // Assign some extra settings to the configuration file if everything succeeded.
             $ApplicationInfo = array();
             include CombinePaths(array(PATH_APPLICATIONS . DS . 'dashboard' . DS . 'settings' . DS . 'about.php'));
             // Detect rewrite abilities
             try {
                 $Query = ConcatSep('/', Gdn::Request()->Domain(), Gdn::Request()->WebRoot(), 'dashboard/setup');
                 $Results = ProxyHead($Query, array(), 3);
                 $CanRewrite = FALSE;
                 if (in_array(ArrayValue('StatusCode', $Results, 404), array(200, 302)) && ArrayValue('X-Garden-Version', $Results, 'None') != 'None') {
                     $CanRewrite = TRUE;
                 }
             } catch (Exception $e) {
                 // cURL and fsockopen arent supported... guess?
                 $CanRewrite = function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) ? TRUE : FALSE;
             }
             SaveToConfig(array('Garden.Version' => ArrayValue('Version', GetValue('Dashboard', $ApplicationInfo, array()), 'Undefined'), 'Garden.RewriteUrls' => $CanRewrite, 'Garden.CanProcessImages' => function_exists('gd_info'), 'EnabledPlugins.GettingStarted' => 'GettingStarted', 'EnabledPlugins.HtmLawed' => 'HtmLawed'));
         }
     }
     return $this->Form->ErrorCount() == 0 ? TRUE : FALSE;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:101,代码来源:class.setupcontroller.php

示例13: FetchViewLocation

 /**
  * Fetches the location of a view into a string and returns it. Returns
  * false on failure.
  *
  * @param string $View The name of the view to fetch. If not specified, it will use the value
  * of $this->View. If $this->View is not specified, it will use the value
  * of $this->RequestMethod (which is defined by the dispatcher class).
  * @param string $ControllerName The name of the controller that owns the view if it is not $this.
  *  - If the controller name is FALSE then the name of the current controller will be used.
  *  - If the controller name is an empty string then the view will be looked for in the base views folder.
  * @param string $ApplicationFolder The name of the application folder that contains the requested controller if it is not $this->ApplicationFolder.
  */
 public function FetchViewLocation($View = '', $ControllerName = FALSE, $ApplicationFolder = FALSE, $ThrowError = TRUE)
 {
     // Accept an explicitly defined view, or look to the method that was called on this controller
     if ($View == '') {
         $View = $this->View;
     }
     if ($View == '') {
         $View = $this->RequestMethod;
     }
     if ($ControllerName === FALSE) {
         $ControllerName = $this->ControllerName;
     }
     // Munge the controller folder onto the controller name if it is present.
     if ($this->ControllerFolder != '') {
         $ControllerName = $this->ControllerFolder . DS . $ControllerName;
     }
     if (StringEndsWith($ControllerName, 'controller', TRUE)) {
         $ControllerName = substr($ControllerName, 0, -10);
     }
     if (strtolower(substr($ControllerName, 0, 4)) == 'gdn_') {
         $ControllerName = substr($ControllerName, 4);
     }
     if (!$ApplicationFolder) {
         $ApplicationFolder = $this->ApplicationFolder;
     }
     //$ApplicationFolder = strtolower($ApplicationFolder);
     $ControllerName = strtolower($ControllerName);
     if (strpos($View, DS) === FALSE) {
         // keep explicit paths as they are.
         $View = strtolower($View);
     }
     // If this is a syndication request, append the method to the view
     if ($this->SyndicationMethod == SYNDICATION_ATOM) {
         $View .= '_atom';
     } else {
         if ($this->SyndicationMethod == SYNDICATION_RSS) {
             $View .= '_rss';
         }
     }
     $LocationName = ConcatSep('/', strtolower($ApplicationFolder), $ControllerName, $View);
     $ViewPath = ArrayValue($LocationName, $this->_ViewLocations, FALSE);
     if ($ViewPath === FALSE) {
         // Define the search paths differently depending on whether or not we are in a plugin or application.
         $ApplicationFolder = trim($ApplicationFolder, '/');
         if (StringBeginsWith($ApplicationFolder, 'plugins/')) {
             $KeyExplode = explode('/', $ApplicationFolder);
             $PluginName = array_pop($KeyExplode);
             $PluginInfo = Gdn::PluginManager()->GetPluginInfo($PluginName);
             $BasePath = GetValue('SearchPath', $PluginInfo);
             $ApplicationFolder = GetValue('Folder', $PluginInfo);
         } else {
             $BasePath = PATH_APPLICATIONS;
             $ApplicationFolder = strtolower($ApplicationFolder);
         }
         $SubPaths = array();
         // Define the subpath for the view.
         // The $ControllerName used to default to '' instead of FALSE.
         // This extra search is added for backwards-compatibility.
         if (strlen($ControllerName) > 0) {
             $SubPaths[] = "views/{$ControllerName}/{$View}";
         } else {
             $SubPaths[] = "views/{$View}";
             $SubPaths[] = "views/{$this->ControllerName}/{$View}";
         }
         // Views come from one of four places:
         $ViewPaths = array();
         foreach ($SubPaths as $SubPath) {
             // 1. An explicitly defined path to a view
             if (strpos($View, DS) !== FALSE) {
                 $ViewPaths[] = $View;
             }
             if ($this->Theme) {
                 // 2. Application-specific theme view. eg. /path/to/application/themes/theme_name/app_name/views/controller_name/
                 $ViewPaths[] = PATH_THEMES . "/{$this->Theme}/{$ApplicationFolder}/{$SubPath}.*";
                 // $ViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, $ApplicationFolder, 'views', $ControllerName, $View . '.*'));
                 // 3. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/controller_name/
                 $ViewPaths[] = PATH_THEMES . "/{$this->Theme}/{$SubPath}.*";
                 //$ViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, 'views', $ControllerName, $View . '.*'));
             }
             // 4. Application/plugin default. eg. /path/to/application/app_name/views/controller_name/
             $ViewPaths[] = "{$BasePath}/{$ApplicationFolder}/{$SubPath}.*";
             //$ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $ApplicationFolder, 'views', $ControllerName, $View . '.*'));
         }
         // Find the first file that matches the path.
         $ViewPath = FALSE;
         foreach ($ViewPaths as $Glob) {
             $Paths = SafeGlob($Glob);
             if (is_array($Paths) && count($Paths) > 0) {
//.........这里部分代码省略.........
开发者ID:ru4,项目名称:arabbnota,代码行数:101,代码来源:class.controller.php

示例14: ToString

 public function ToString($HighlightRoute = '')
 {
     if ($HighlightRoute == '') {
         $HighlightRoute = $this->_HighlightRoute;
     }
     if ($HighlightRoute == '') {
         $HighlightRoute = Gdn_Url::Request();
     }
     $HighlightUrl = Url($HighlightRoute);
     // Apply a sort to the items if given.
     if (is_array($this->Sort)) {
         $Sort = array_flip($this->Sort);
         foreach ($this->Items as $Group => &$Item) {
             if (isset($Sort[$Group])) {
                 $Item['Sort'] = $Sort[$Group];
             } else {
                 $Item['_Sort'] += count($Sort);
             }
             foreach ($Item['Links'] as $Url => &$Link) {
                 if (isset($Sort[$Url])) {
                     $Link['Sort'] = $Sort[$Url];
                 } elseif (isset($Sort[$Link['Text']])) {
                     $Link['Sort'] = $Sort[$Link['Text']];
                 } else {
                     $Link['_Sort'] += count($Sort);
                 }
             }
         }
     }
     // Sort the groups.
     $this->_Compare($this->Items);
     uasort($this->Items, array($this, '_Compare'));
     // Sort the items within the groups.
     foreach ($this->Items as &$Item) {
         $this->_Compare($Item['Links']);
         uasort($Item['Links'], array($this, '_Compare'));
         // Highlight the group.
         if (GetValue('Url', $Item) && Url($Item['Url']) == $HighlightUrl) {
             $Item['Attributes']['class'] = ConcatSep(' ', GetValue('class', $Item['Attributes']), 'Active');
         }
         // Hightlight the correct item in the group.
         foreach ($Item['Links'] as &$Link) {
             if (GetValue('Url', $Link) && Url($Link['Url']) == $HighlightUrl) {
                 $Link['Attributes']['class'] = ConcatSep(' ', GetValue('class', $Link['Attributes']), 'Active');
                 $Item['Attributes']['class'] = ConcatSep(' ', GetValue('class', $Item['Attributes']), 'Active');
             }
         }
     }
     return parent::ToString();
 }
开发者ID:Raz0r,项目名称:Garden,代码行数:50,代码来源:class.sidemenumodule.php

示例15: Bookmarked

 /**
  * Display discussions the user has bookmarked.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $Offset Number of discussions to skip.
  */
 public function Bookmarked($Page = '0')
 {
     $this->Permission('Garden.SignIn.Allow');
     Gdn_Theme::Section('DiscussionList');
     // Figure out which discussions layout to choose (Defined on "Homepage" settings page).
     $Layout = C('Vanilla.Discussions.Layout');
     switch ($Layout) {
         case 'table':
             if ($this->SyndicationMethod == SYNDICATION_NONE) {
                 $this->View = 'table';
             }
             break;
         default:
             $this->View = 'index';
             break;
     }
     // Determine offset from $Page
     list($Page, $Limit) = OffsetLimit($Page, C('Vanilla.Discussions.PerPage', 30));
     $this->CanonicalUrl(Url(ConcatSep('/', 'discussions', 'bookmarked', PageNumber($Page, $Limit, TRUE, FALSE)), TRUE));
     // Validate $Page
     if (!is_numeric($Page) || $Page < 0) {
         $Page = 0;
     }
     $DiscussionModel = new DiscussionModel();
     $Wheres = array('w.Bookmarked' => '1', 'w.UserID' => Gdn::Session()->UserID);
     $this->DiscussionData = $DiscussionModel->Get($Page, $Limit, $Wheres);
     $this->SetData('Discussions', $this->DiscussionData);
     $CountDiscussions = $DiscussionModel->GetCount($Wheres);
     $this->SetData('CountDiscussions', $CountDiscussions);
     $this->Category = FALSE;
     $this->SetJson('Loading', $Page . ' to ' . $Limit);
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $this->EventArguments['PagerType'] = 'Pager';
     $this->FireEvent('BeforeBuildBookmarkedPager');
     $this->Pager = $PagerFactory->GetPager($this->EventArguments['PagerType'], $this);
     $this->Pager->ClientID = 'Pager';
     $this->Pager->Configure($Page, $Limit, $CountDiscussions, 'discussions/bookmarked/%1$s');
     if (!$this->Data('_PagerUrl')) {
         $this->SetData('_PagerUrl', 'discussions/bookmarked/{Page}');
     }
     $this->SetData('_Page', $Page);
     $this->SetData('_Limit', $Limit);
     $this->FireEvent('AfterBuildBookmarkedPager');
     // Deliver JSON data if necessary
     if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'discussions';
     }
     // Add modules
     $this->AddModule('DiscussionFilterModule');
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('CategoriesModule');
     // Render default view (discussions/bookmarked.php)
     $this->SetData('Title', T('My Bookmarks'));
     $this->SetData('Breadcrumbs', array(array('Name' => T('My Bookmarks'), 'Url' => '/discussions/bookmarked')));
     $this->Render();
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:67,代码来源:class.discussionscontroller.php


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