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


PHP Gdn_Format::AlphaNumeric方法代码示例

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


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

示例1: Render

   /**
    * Render the given view.
    *
    * @param string $Path The path to the view's file.
    * @param Controller $Controller The controller that is rendering the view.
    */
   public function Render($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,
            'CountNotifications' => (int)GetValue('CountNotifications', $Session->User->CountNotifications, 0),
            'CountUnreadConversations' => (int)GetValue('CountUnreadConversations', $Session->User, 0),
            'SignedIn' => TRUE);
      } 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;
         }
      }
     
      $Controller->Data['BodyClass'] = GetValue('CssClass', $Controller->Data, '', TRUE);

      $Smarty->assign('Assets', (array)$Controller->Assets);
      $Smarty->assign('Path', Gdn::Request()->Path());

      // Assigign 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('CheckPermission', 'GetValue', 'SetValue', 'Url'));
      $Smarty->secure_dir = array($Path);
      $Smarty->display($Path);
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:60,代码来源:class.smarty.php

示例2: Render

 /**
  * Render the given view.
  *
  * @param string $Path The path to the view's file.
  * @param Controller $Controller The controller that is rendering the view.
  */
 public function Render($Path, $Controller)
 {
     $Smarty = $this->Smarty();
     // Get a friendly name for the controller.
     $ControllerName = get_class($Controller);
     if (preg_match('/^(?:Gdn_)?(.*?)(?:Controller)?$/', $ControllerName, $Matches)) {
         $ControllerName = $Matches[1];
     }
     $Smarty->assign('ControllerName', $ControllerName);
     // Get an ID for the body.
     $BodyIdentifier = strtolower($Controller->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::AlphaNumeric(strtolower($Controller->RequestMethod)));
     $Smarty->assign('BodyIdentifier', $BodyIdentifier);
     $Smarty->assign('Config', Gdn::Config());
     // Make sure that any datasets use arrays instead of objects.
     foreach ($Controller->Data as $Key => $Value) {
         if ($Value instanceof Gdn_DataSet) {
             $Value->DatasetType(DATASET_TYPE_ARRAY);
         }
     }
     $Smarty->assign($Controller->Data);
     $Smarty->assign('Controller', $Controller);
     $Smarty->display($Path);
 }
开发者ID:sheldon,项目名称:Garden,代码行数:29,代码来源:class.smarty.php

示例3: RenderMaster


//.........这里部分代码省略.........
                     $AppFolder = $JsInfo['AppFolder'];
                     if ($AppFolder == '') {
                         $AppFolder = $this->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 ($this->Theme) {
                         // 1. Application-specific js. eg. root/themes/theme_name/app_name/design/
                         $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . $AppFolder . DS . 'js' . DS . $JsFile;
                         // 2. Garden-wide theme view. eg. root/themes/theme_name/design/
                         $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'js' . DS . $JsFile;
                     }
                     // 3. The application or plugin folder.
                     if (StringBeginsWith(trim($AppFolder, '/'), 'plugins/')) {
                         $JsPaths[] = PATH_PLUGINS . strstr($AppFolder, '/') . "/js/{$JsFile}";
                         $JsPaths[] = PATH_PLUGINS . strstr($AppFolder, '/') . "/{$JsFile}";
                     } else {
                         $JsPaths[] = PATH_APPLICATIONS . "/{$AppFolder}/js/{$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) {
                     $JsSrc = str_replace(array(PATH_ROOT, DS), array('', '/'), $JsPath);
                     $Options = (array) $JsInfo['Options'];
                     $Options['path'] = $JsPath;
                     $Version = GetValue('Version', $JsInfo);
                     if ($Version) {
                         TouchValue('version', $Options, $Version);
                     }
                     $this->Head->AddScript($JsSrc, 'text/javascript', $Options);
                 }
             }
         }
         // Add the favicon
         $this->Head->SetFavIcon(C('Garden.FavIcon', Asset('themes/' . $this->Theme . '/design/favicon.png')));
         // Make sure the head module gets passed into the assets collection.
         $this->AddModule('Head');
     }
     // Master views come from one of four places:
     $MasterViewPaths = array();
     if (strpos($this->MasterView, '/') !== FALSE) {
         $MasterViewPaths[] = CombinePaths(array(PATH_ROOT, str_replace('/', DS, $this->MasterView) . '.master*'));
     } else {
         if ($this->Theme) {
             // 1. Application-specific theme view. eg. root/themes/theme_name/app_name/views/
             $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
             // 2. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/
             $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, 'views', $this->MasterView . '.master*'));
         }
         // 3. Application default. eg. root/app_name/views/
         $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
         // 4. Garden default. eg. root/dashboard/views/
         $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', $this->MasterView . '.master*'));
     }
     // Find the first file that matches the path.
     $MasterViewPath = FALSE;
     foreach ($MasterViewPaths as $Glob) {
         $Paths = SafeGlob($Glob);
         if (is_array($Paths) && count($Paths) > 0) {
             $MasterViewPath = $Paths[0];
             break;
         }
     }
     $this->EventArguments['MasterViewPath'] =& $MasterViewPath;
     $this->FireEvent('BeforeFetchMaster');
     if ($MasterViewPath === FALSE) {
         trigger_error(ErrorMessage("Could not find master view: {$this->MasterView}.master*", $this->ClassName, '_FetchController'), E_USER_ERROR);
     }
     /// A unique identifier that can be used in the body tag of the master view if needed.
     $ControllerName = $this->ClassName;
     // Strip "Controller" from the body identifier.
     if (substr($ControllerName, -10) == 'Controller') {
         $ControllerName = substr($ControllerName, 0, -10);
     }
     // Strip "Gdn_" from the body identifier.
     if (substr($ControllerName, 0, 4) == 'Gdn_') {
         $ControllerName = substr($ControllerName, 4);
     }
     $this->SetData('CssClass', $this->Application . ' ' . $ControllerName . ' ' . $this->RequestMethod . ' ' . $this->CssClass, TRUE);
     // Check to see if there is a handler for this particular extension.
     $ViewHandler = Gdn::Factory('ViewHandler' . strtolower(strrchr($MasterViewPath, '.')));
     if (is_null($ViewHandler)) {
         $BodyIdentifier = strtolower($this->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::AlphaNumeric(strtolower($this->RequestMethod)));
         include $MasterViewPath;
     } else {
         $ViewHandler->Render($MasterViewPath, $this);
     }
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:101,代码来源:class.controller.php

示例4: _Create

 /**
  * Creates the table defined with $this->Table() and $this->Column().
  */
 protected function _Create()
 {
     $PrimaryKey = array();
     $UniqueKey = array();
     $FullTextKey = array();
     $AllowFullText = TRUE;
     $Keys = '';
     $Sql = '';
     $ForceDatabaseEngine = C('Database.ForceStorageEngine');
     if ($ForceDatabaseEngine && !$this->_TableStorageEngine) {
         $this->_TableStorageEngine = $ForceDatabaseEngine;
         $AllowFullText = $this->_SupportsFulltext();
     }
     foreach ($this->_Columns as $ColumnName => $Column) {
         if ($Sql != '') {
             $Sql .= ',';
         }
         $Sql .= "\n" . $this->_DefineColumn($Column);
         $ColumnKeyTypes = (array) $Column->KeyType;
         foreach ($ColumnKeyTypes as $ColumnKeyType) {
             if ($ColumnKeyType == 'primary') {
                 $PrimaryKey[] = $ColumnName;
             } elseif ($ColumnKeyType == 'key') {
                 $Keys .= ",\nkey `" . Gdn_Format::AlphaNumeric('`FK_' . $this->_TableName . '_' . $ColumnName) . '` (`' . $ColumnName . '`)';
             } elseif ($ColumnKeyType == 'index') {
                 $Keys .= ",\nindex `" . Gdn_Format::AlphaNumeric('`IX_' . $this->_TableName . '_' . $ColumnName) . '` (`' . $ColumnName . '`)';
             } elseif ($ColumnKeyType == 'unique') {
                 $UniqueKey[] = $ColumnName;
             } elseif ($ColumnKeyType == 'fulltext' && $AllowFullText) {
                 $FullTextKey[] = $ColumnName;
             }
         }
     }
     // Build primary keys
     if (count($PrimaryKey) > 0) {
         $Keys .= ",\nprimary key (`" . implode('`, `', $PrimaryKey) . "`)";
     }
     // Build unique keys.
     if (count($UniqueKey) > 0) {
         $Keys .= ",\nunique index `" . Gdn_Format::AlphaNumeric('UX_' . $this->_TableName) . '` (`' . implode('`, `', $UniqueKey) . "`)";
     }
     // Build full text index.
     if (count($FullTextKey) > 0) {
         $Keys .= ",\nfulltext index `" . Gdn_Format::AlphaNumeric('TX_' . $this->_TableName) . '` (`' . implode('`, `', $FullTextKey) . "`)";
     }
     $Sql = 'create table `' . $this->_DatabasePrefix . $this->_TableName . '` (' . $Sql . $Keys . "\n)";
     // Check to see if there are any fulltext columns, otherwise use innodb.
     if (!$this->_TableStorageEngine) {
         $HasFulltext = FALSE;
         foreach ($this->_Columns as $Column) {
             $ColumnKeyTypes = (array) $Column->KeyType;
             array_map('strtolower', $ColumnKeyTypes);
             if (in_array('fulltext', $ColumnKeyTypes)) {
                 $HasFulltext = TRUE;
                 break;
             }
         }
         if ($HasFulltext) {
             $this->_TableStorageEngine = 'myisam';
         } else {
             $this->_TableStorageEngine = C('Database.DefaultStorageEngine', 'innodb');
         }
         if (!$this->HasEngine($this->_TableStorageEngine)) {
             $this->_TableStorageEngine = 'myisam';
         }
     }
     if ($this->_TableStorageEngine) {
         $Sql .= ' engine=' . $this->_TableStorageEngine;
     }
     if ($this->_CharacterEncoding !== FALSE && $this->_CharacterEncoding != '') {
         $Sql .= ' default character set ' . $this->_CharacterEncoding;
     }
     if (array_key_exists('Collate', $this->Database->ExtendedProperties)) {
         $Sql .= ' collate ' . $this->Database->ExtendedProperties['Collate'];
     }
     $Sql .= ';';
     $Result = $this->Query($Sql);
     $this->Reset();
     return $Result;
 }
开发者ID:Raz0r,项目名称:Garden,代码行数:83,代码来源:class.mysqlstructure.php

示例5: RenderMaster


//.........这里部分代码省略.........
                         // 1. Application-specific js. eg. root/themes/theme_name/app_name/design/
                         $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . $AppFolder . DS . 'js' . DS . $JsFile;
                         // 2. Garden-wide theme view. eg. root/themes/theme_name/design/
                         $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'js' . DS . $JsFile;
                     }
                     // 3. The application or plugin folder.
                     if (StringBeginsWith(trim($AppFolder, '/'), 'plugins/')) {
                         $JsPaths[] = PATH_PLUGINS . strstr($AppFolder, '/') . "/js/{$JsFile}";
                         $JsPaths[] = PATH_PLUGINS . strstr($AppFolder, '/') . "/{$JsFile}";
                     } else {
                         $JsPaths[] = PATH_APPLICATIONS . "/{$AppFolder}/js/{$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) {
                     $JsSrc = str_replace(array(PATH_ROOT, DS), array('', '/'), $JsPath);
                     $Options = (array) $JsInfo['Options'];
                     $Options['path'] = $JsPath;
                     $Version = GetValue('Version', $JsInfo);
                     if ($Version) {
                         TouchValue('version', $Options, $Version);
                     }
                     $this->Head->AddScript($JsSrc, 'text/javascript', $Options);
                 }
             }
         }
         // Add the favicon.
         $Favicon = C('Garden.FavIcon');
         if ($Favicon) {
             $this->Head->SetFavIcon(Gdn_Upload::Url($Favicon));
         }
         // Make sure the head module gets passed into the assets collection.
         $this->AddModule('Head');
     }
     // Master views come from one of four places:
     $MasterViewPaths = array();
     $MasterViewPath2 = ViewLocation($this->MasterView() . '.master', '', $this->ApplicationFolder);
     if (strpos($this->MasterView, '/') !== FALSE) {
         $MasterViewPaths[] = CombinePaths(array(PATH_ROOT, str_replace('/', DS, $this->MasterView) . '.master*'));
     } else {
         if ($this->Theme) {
             // 1. Application-specific theme view. eg. root/themes/theme_name/app_name/views/
             $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
             // 2. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/
             $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, 'views', $this->MasterView . '.master*'));
         }
         // 3. Application default. eg. root/app_name/views/
         $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
         // 4. Garden default. eg. root/dashboard/views/
         $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', $this->MasterView . '.master*'));
     }
     // Find the first file that matches the path.
     $MasterViewPath = FALSE;
     foreach ($MasterViewPaths as $Glob) {
         $Paths = SafeGlob($Glob);
         if (is_array($Paths) && count($Paths) > 0) {
             $MasterViewPath = $Paths[0];
             break;
         }
     }
     if ($MasterViewPath != $MasterViewPath2) {
         Trace("Master views differ. Controller: {$MasterViewPath}, ViewLocation(): {$MasterViewPath2}", TRACE_WARNING);
     }
     $this->EventArguments['MasterViewPath'] =& $MasterViewPath;
     $this->FireEvent('BeforeFetchMaster');
     if ($MasterViewPath === FALSE) {
         trigger_error(ErrorMessage("Could not find master view: {$this->MasterView}.master*", $this->ClassName, '_FetchController'), E_USER_ERROR);
     }
     /// A unique identifier that can be used in the body tag of the master view if needed.
     $ControllerName = $this->ClassName;
     // Strip "Controller" from the body identifier.
     if (substr($ControllerName, -10) == 'Controller') {
         $ControllerName = substr($ControllerName, 0, -10);
     }
     // Strip "Gdn_" from the body identifier.
     if (substr($ControllerName, 0, 4) == 'Gdn_') {
         $ControllerName = substr($ControllerName, 4);
     }
     $this->SetData('CssClass', $this->Application . ' ' . $ControllerName . ' ' . $this->RequestMethod . ' ' . $this->CssClass, TRUE);
     // Check to see if there is a handler for this particular extension.
     $ViewHandler = Gdn::Factory('ViewHandler' . strtolower(strrchr($MasterViewPath, '.')));
     if (is_null($ViewHandler)) {
         $BodyIdentifier = strtolower($this->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::AlphaNumeric(strtolower($this->RequestMethod)));
         include $MasterViewPath;
     } else {
         $ViewHandler->Render($MasterViewPath, $this);
     }
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:101,代码来源:class.controller.php

示例6: RenderMaster


//.........这里部分代码省略.........
                     $CssPath = str_replace(DS, '/', $CssPath);
                     $this->Head->AddCss($CssPath, 'screen');
                 }
             }
             // And now search for/add all JS files
             foreach ($this->_JsFiles as $JsInfo) {
                 $JsFile = $JsInfo['FileName'];
                 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 = $this->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 ($this->Theme) {
                         // 1. Application-specific js. eg. root/themes/theme_name/app_name/design/
                         $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . $AppFolder . DS . 'js' . DS . $JsFile;
                         // 2. Garden-wide theme view. eg. root/themes/theme_name/design/
                         $JsPaths[] = PATH_THEMES . DS . $this->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);
                     $this->Head->AddScript($JsPath);
                 }
             }
         }
         // Add the favicon
         $this->Head->SetFavIcon(C('Garden.FavIcon', Asset('themes/' . $this->Theme . '/design/favicon.png')));
         // Make sure the head module gets passed into the assets collection.
         $this->AddModule('Head');
     }
     // Master views come from one of four places:
     $MasterViewPaths = array();
     if (strpos($this->MasterView, '/') !== FALSE) {
         $MasterViewPaths[] = CombinePaths(array(PATH_ROOT, str_replace('/', DS, $this->MasterView) . '.master*'));
     } else {
         if ($this->Theme) {
             // 1. Application-specific theme view. eg. root/themes/theme_name/app_name/views/
             $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
             // 2. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/
             $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, 'views', $this->MasterView . '.master*'));
         }
         // 3. Application default. eg. root/app_name/views/
         $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
         // 4. Garden default. eg. root/dashboard/views/
         $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', $this->MasterView . '.master*'));
     }
     // Find the first file that matches the path.
     $MasterViewPath = FALSE;
     foreach ($MasterViewPaths as $Glob) {
         $Paths = SafeGlob($Glob);
         if (is_array($Paths) && count($Paths) > 0) {
             $MasterViewPath = $Paths[0];
             break;
         }
     }
     $this->EventArguments['MasterViewPath'] =& $MasterViewPath;
     $this->FireEvent('BeforeFetchMaster');
     if ($MasterViewPath === FALSE) {
         trigger_error(ErrorMessage("Could not find master view: {$this->MasterView}.master*", $this->ClassName, '_FetchController'), E_USER_ERROR);
     }
     /// A unique identifier that can be used in the body tag of the master view if needed.
     $ControllerName = $this->ClassName;
     // Strip "Controller" from the body identifier.
     if (substr($ControllerName, -10) == 'Controller') {
         $ControllerName = substr($ControllerName, 0, -10);
     }
     // Strip "Gdn_" from the body identifier.
     if (substr($ControllerName, 0, 4) == 'Gdn_') {
         $ControllerName = substr($ControllerName, 4);
     }
     $this->SetData('CssClass', $this->Application . ' ' . $ControllerName . ' ' . $this->RequestMethod . ' ' . $this->CssClass, TRUE);
     // Check to see if there is a handler for this particular extension.
     $ViewHandler = Gdn::Factory('ViewHandler' . strtolower(strrchr($MasterViewPath, '.')));
     if (is_null($ViewHandler)) {
         $BodyIdentifier = strtolower($this->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::AlphaNumeric(strtolower($this->RequestMethod)));
         include $MasterViewPath;
     } else {
         $ViewHandler->Render($MasterViewPath, $this);
     }
 }
开发者ID:sipp11,项目名称:Garden,代码行数:101,代码来源:class.controller.php

示例7: Init

 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) GetValue('CountNotifications', $Session->User, 0), 'CountUnreadConversations' => (int) GetValue('CountUnreadConversations', $Session->User, 0), 'SignedIn' => TRUE);
         $Photo = $Session->User->Photo;
         if ($Photo) {
             if (!preg_match('`^https?://`i', $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 = GetValue('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;
     $Smarty->assign('Assets', (array) $Controller->Assets);
     $Smarty->assign('Path', Gdn::Request()->Path());
     // Assigign 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('CheckPermission', 'MultiCheckPermission', 'GetValue', 'SetValue', 'Url', 'InSection', 'InCategory'));
     $Smarty->security_settings['MODIFIER_FUNCS'] = array_merge($Smarty->security_settings['MODIFIER_FUNCS'], array('sprintf'));
     $Smarty->secure_dir = array($Path);
 }
开发者ID:rnovino,项目名称:Garden,代码行数:66,代码来源:class.smarty.php

示例8: UserInfoModule_OnBasicInfo_Handler

 /**
  * Display custom fields on Profile.
  */
 public function UserInfoModule_OnBasicInfo_Handler($Sender)
 {
     try {
         // Get the custom fields
         $ProfileFields = Gdn::UserModel()->GetMeta($Sender->User->UserID, 'Profile.%', 'Profile.');
         // Import from CustomProfileFields if available
         if (!count($ProfileFields) && is_object($Sender->User) && C('Plugins.CustomProfileFields.SuggestedFields', FALSE)) {
             $ProfileFields = Gdn::UserModel()->GetAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             if ($ProfileFields) {
                 // Migrate to UserMeta & delete original
                 Gdn::UserModel()->SetMeta($Sender->User->UserID, $ProfileFields, 'Profile.');
                 Gdn::UserModel()->SaveAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             }
         }
         // Send them off for magic formatting
         $ProfileFields = $this->ParseSpecialFields($ProfileFields);
         // Get all field data, error check
         $AllFields = $this->GetProfileFields();
         if (!is_array($AllFields) || !is_array($ProfileFields)) {
             return;
         }
         // Display all non-hidden fields
         $ProfileFields = array_reverse($ProfileFields);
         foreach ($ProfileFields as $Name => $Value) {
             if (!$Value) {
                 continue;
             }
             if (!GetValue('OnProfile', $AllFields[$Name])) {
                 continue;
             }
             if (!in_array($Name, $this->MagicLabels)) {
                 $Value = Gdn_Format::Links(htmlspecialchars($Value));
             }
             echo ' <dt class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Name) . '">' . Gdn_Format::Text($AllFields[$Name]['Label']) . '</dt> ';
             echo ' <dd class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Name) . '">' . $Value . '</dd> ';
         }
     } catch (Exception $ex) {
         // No errors
     }
 }
开发者ID:bishopb,项目名称:vanilla,代码行数:43,代码来源:class.profileextender.plugin.php

示例9: _Create

 /**
  * Creates the table defined with $this->Table() and $this->Column().
  */
 protected function _Create()
 {
     $PrimaryKey = array();
     $UniqueKey = array();
     $FullTextKey = array();
     $Keys = '';
     $Sql = '';
     foreach ($this->_Columns as $ColumnName => $Column) {
         if ($Sql != '') {
             $Sql .= ',';
         }
         $Sql .= "\n" . $this->_DefineColumn($Column);
         $ColumnKeyTypes = (array) $Column->KeyType;
         foreach ($ColumnKeyTypes as $ColumnKeyType) {
             if ($ColumnKeyType == 'primary') {
                 $PrimaryKey[] = $ColumnName;
             } elseif ($ColumnKeyType == 'key') {
                 $Keys .= ",\nkey `" . Gdn_Format::AlphaNumeric('`FK_' . $this->_TableName . '_' . $ColumnName) . '` (`' . $ColumnName . '`)';
             } elseif ($ColumnKeyType == 'index') {
                 $Keys .= ",\nindex `" . Gdn_Format::AlphaNumeric('`IX_' . $this->_TableName . '_' . $ColumnName) . '` (`' . $ColumnName . '`)';
             } elseif ($ColumnKeyType == 'unique') {
                 $UniqueKey[] = $ColumnName;
             } elseif ($ColumnKeyType == 'fulltext') {
                 $FullTextKey[] = $ColumnName;
             }
         }
     }
     // Build primary keys
     if (count($PrimaryKey) > 0) {
         $Keys .= ",\nprimary key (`" . implode('`, `', $PrimaryKey) . "`)";
     }
     // Build unique keys.
     if (count($UniqueKey) > 0) {
         $Keys .= ",\nunique index `" . Gdn_Format::AlphaNumeric('UX_' . $this->_TableName) . '` (`' . implode('`, `', $UniqueKey) . "`)";
     }
     // Build full text index.
     if (count($FullTextKey) > 0) {
         $Keys .= ",\nfulltext index `" . Gdn_Format::AlphaNumeric('TX_' . $this->_TableName) . '` (`' . implode('`, `', $FullTextKey) . "`)";
     }
     $Sql = 'create table `' . $this->_DatabasePrefix . $this->_TableName . '` (' . $Sql . $Keys . "\n)";
     if (!is_null($this->_TableStorageEngine)) {
         $Sql .= ' ENGINE=' . $this->_TableStorageEngine;
     }
     if ($this->_CharacterEncoding !== FALSE && $this->_CharacterEncoding != '') {
         $Sql .= ' default character set ' . $this->_CharacterEncoding;
     }
     if (array_key_exists('Collate', $this->Database->ExtendedProperties)) {
         $Sql .= ' collate ' . $this->Database->ExtendedProperties['Collate'];
     }
     $Sql .= ';';
     $Result = $this->Query($Sql);
     $this->Reset();
     return $Result;
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:57,代码来源:class.mysql.structure.php

示例10: GetBodyIdentifier

 function GetBodyIdentifier(&$Controller)
 {
     $ControllerName = GetShortControllerName($Controller);
     $BodyIdentifier = $Controller->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::AlphaNumeric(strtolower($Controller->RequestMethod));
     return strtolower($BodyIdentifier);
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:6,代码来源:functions.misc.php

示例11: EscapeID

 /**
  * Returns the provided fieldname with non-alpha-numeric values stripped and
  * $this->IDPrefix prepended.
  *
  * @param string $FieldName
  * @param bool $ForceUniqueID
  * @return string
  */
 public function EscapeID($FieldName, $ForceUniqueID = TRUE)
 {
     $ID = $FieldName;
     if (substr($ID, -2) == '[]') {
         $ID = substr($ID, 0, -2);
     }
     $ID = $this->IDPrefix . Gdn_Format::AlphaNumeric(str_replace('.', '-dot-', $ID));
     $tmp = $ID;
     $i = 1;
     if ($ForceUniqueID === TRUE) {
         while (in_array($tmp, $this->_IDCollection)) {
             $tmp = $ID . $i;
             $i++;
         }
         $this->_IDCollection[] = $tmp;
     } else {
         // If not forcing unique (ie. getting the id for a label's "for" tag),
         // get the last used copy of the requested id.
         $Found = FALSE;
         while (in_array($tmp, $this->_IDCollection)) {
             $Found = TRUE;
             $tmp = $ID . $i;
             $i++;
         }
         if ($Found == TRUE && $i > 2) {
             $i = $i - 2;
             $tmp = $ID . $i;
         } else {
             $tmp = $ID;
         }
     }
     return $tmp;
 }
开发者ID:sipp11,项目名称:Garden,代码行数:41,代码来源:class.form.php

示例12: UserInfoModule_OnBasicInfo_Handler

 /**
  * Display custom fields on Profile.
  */
 public function UserInfoModule_OnBasicInfo_Handler($Sender)
 {
     try {
         // Get the custom fields
         $ProfileFields = Gdn::UserModel()->GetMeta($Sender->User->UserID, 'Profile.%', 'Profile.');
         // Import from CustomProfileFields if available
         if (!count($ProfileFields) && is_object($Sender->User) && C('Plugins.CustomProfileFields.SuggestedFields', FALSE)) {
             $ProfileFields = Gdn::UserModel()->GetAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             if ($ProfileFields) {
                 // Migrate to UserMeta & delete original
                 Gdn::UserModel()->SetMeta($Sender->User->UserID, $ProfileFields, 'Profile.');
                 Gdn::UserModel()->SaveAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             }
         }
         // Send them off for magic formatting
         $ProfileFields = $this->ParseSpecialFields($ProfileFields);
         // Get all field data, error check
         $AllFields = $this->GetProfileFields();
         if (!is_array($AllFields) || !is_array($ProfileFields)) {
             return;
         }
         // DateOfBirth is special case that core won't handle
         // Hack it in here instead
         if (C('ProfileExtender.Fields.DateOfBirth.OnProfile')) {
             // Do not use Gdn_Format::Date because it shifts to local timezone
             $ProfileFields['DateOfBirth'] = date(T('Birthday Format', 'F j, Y'), Gdn_Format::ToTimestamp($Sender->User->DateOfBirth));
             $AllFields['DateOfBirth'] = array('Label' => T('Birthday'), 'OnProfile' => TRUE);
         }
         // Display all non-hidden fields
         $ProfileFields = array_reverse($ProfileFields);
         foreach ($ProfileFields as $Name => $Value) {
             if (!$Value) {
                 continue;
             }
             if (!GetValue('OnProfile', $AllFields[$Name])) {
                 continue;
             }
             // Non-magic fields must be plain text, but we'll auto-link
             if (!in_array($Name, $this->MagicLabels)) {
                 $Value = Gdn_Format::Links(Gdn_Format::Text($Value));
             }
             echo ' <dt class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Name) . '">' . Gdn_Format::Text($AllFields[$Name]['Label']) . '</dt> ';
             echo ' <dd class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Name) . '">' . Gdn_Format::Html($Value) . '</dd> ';
         }
     } catch (Exception $ex) {
         // No errors
     }
 }
开发者ID:embo-hd,项目名称:vanilla,代码行数:51,代码来源:class.profileextender.plugin.php

示例13: foreach

    <h2>Debug Trace</h2>
    <table>
        <?php 
foreach ($this->data('Traces') as $Trace) {
    list($Message, $Type) = $Trace;
    $Var = 'Debug';
    if (!in_array($Type, array(TRACE_ERROR, TRACE_INFO, TRACE_NOTICE, TRACE_WARNING))) {
        $Var = $Type;
        $Type = TRACE_INFO;
    }
    ?>
            <tr>
                <td class="TagColumn">
                    <span
                        class="Tag Tag-<?php 
    echo Gdn_Format::AlphaNumeric($Type);
    ?>
"><?php 
    echo htmlspecialchars($Type);
    ?>
</span>
                </td>
                <td>
                    <?php 
    if (is_string($Message)) {
        if ($Var != 'Debug') {
            echo '<b>' . htmlspecialchars($Var) . '</b>: ';
        }
        echo nl2br(htmlspecialchars($Message));
    } elseif (is_a($Message, 'Exception')) {
        echo '<pre>';
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:trace.php

示例14: _FormatRoleCss

 private function _FormatRoleCss($RawRole)
 {
     return 'Role_' . str_replace(' ', '_', Gdn_Format::AlphaNumeric($RawRole));
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:4,代码来源:class.roletitle.plugin.php

示例15: cssClass

 /**
  * Add CSS class names to a row depending on other elements/values in that row.
  *
  * Used by category, discussion, and comment lists.
  *
  * @param array|object $Row
  * @return string The CSS classes to be inserted into the row.
  */
 function cssClass($Row, $InList = true)
 {
     static $Alt = false;
     $Row = (array) $Row;
     $CssClass = 'Item';
     $Session = Gdn::Session();
     // Alt rows
     if ($Alt) {
         $CssClass .= ' Alt';
     }
     $Alt = !$Alt;
     // Category list classes
     if (array_key_exists('UrlCode', $Row)) {
         $CssClass .= ' Category-' . Gdn_Format::AlphaNumeric($Row['UrlCode']);
     }
     if (GetValue('CssClass', $Row)) {
         $CssClass .= ' Item-' . $Row['CssClass'];
     }
     if (array_key_exists('Depth', $Row)) {
         $CssClass .= " Depth{$Row['Depth']} Depth-{$Row['Depth']}";
     }
     if (array_key_exists('Archive', $Row)) {
         $CssClass .= ' Archived';
     }
     // Discussion list classes.
     if ($InList) {
         $CssClass .= GetValue('Bookmarked', $Row) == '1' ? ' Bookmarked' : '';
         $Announce = GetValue('Announce', $Row);
         if ($Announce == 2) {
             $CssClass .= ' Announcement Announcement-Category';
         } elseif ($Announce) {
             $CssClass .= ' Announcement Announcement-Everywhere';
         }
         $CssClass .= GetValue('Closed', $Row) == '1' ? ' Closed' : '';
         $CssClass .= GetValue('InsertUserID', $Row) == $Session->UserID ? ' Mine' : '';
         $CssClass .= GetValue('Participated', $Row) == '1' ? ' Participated' : '';
         if (array_key_exists('CountUnreadComments', $Row) && $Session->IsValid()) {
             $CountUnreadComments = $Row['CountUnreadComments'];
             if ($CountUnreadComments === true) {
                 $CssClass .= ' New';
             } elseif ($CountUnreadComments == 0) {
                 $CssClass .= ' Read';
             } else {
                 $CssClass .= ' Unread';
             }
         } elseif (($IsRead = GetValue('Read', $Row, null)) !== null) {
             // Category list
             $CssClass .= $IsRead ? ' Read' : ' Unread';
         }
     }
     // Comment list classes
     if (array_key_exists('CommentID', $Row)) {
         $CssClass .= ' ItemComment';
     } elseif (array_key_exists('DiscussionID', $Row)) {
         $CssClass .= ' ItemDiscussion';
     }
     if (function_exists('IsMeAction')) {
         $CssClass .= IsMeAction($Row) ? ' MeAction' : '';
     }
     if ($_CssClss = GetValue('_CssClass', $Row)) {
         $CssClass .= ' ' . $_CssClss;
     }
     // Insert User classes.
     if ($UserID = GetValue('InsertUserID', $Row)) {
         $User = Gdn::UserModel()->GetID($UserID);
         if ($_CssClss = GetValue('_CssClass', $User)) {
             $CssClass .= ' ' . $_CssClss;
         }
     }
     return trim($CssClass);
 }
开发者ID:rensi4rn,项目名称:vanilla,代码行数:79,代码来源:functions.render.php


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