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


PHP Format::ObjectAsArray方法代码示例

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


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

示例1: json_decode

 function json_decode($arg, $assoc = FALSE)
 {
     global $services_json;
     if (!isset($services_json)) {
         $services_json = new Services_JSON();
     }
     $obj = $services_json->decode($arg);
     if ($assoc) {
         return Format::ObjectAsArray($obj);
     } else {
         return $obj;
     }
 }
开发者ID:Aetasiric,项目名称:Garden,代码行数:13,代码来源:functions.general.php

示例2: SetData

 /**
  * Assign a set of data to be displayed in the form elements.
  *
  * @param Ressource $Data A result resource or associative array containing data to be filled in
  */
 public function SetData($Data)
 {
     if (is_object($Data) === TRUE) {
         // If this is a result object (/garden/library/database/class.dataset.php)
         // retrieve it's values as arrays
         if ($Data instanceof DataSet) {
             $ResultSet = $Data->ResultArray();
             if (count($ResultSet) > 0) {
                 $this->_DataArray = $ResultSet[0];
             }
         } else {
             // Otherwise assume it is an object representation of a data row.
             $this->_DataArray = Format::ObjectAsArray($Data);
         }
     } else {
         if (is_array($Data)) {
             $this->_DataArray = $Data;
         }
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:25,代码来源:class.form.php

示例3: UpdateResponse

 public function UpdateResponse()
 {
     // Get the message, response, and transientkey
     $Messages = GetIncomingValue('Messages', '');
     $Response = GetIncomingValue('Response', '');
     $TransientKey = GetIncomingValue('TransientKey', '');
     // If the key validates
     $Session = Gdn::Session();
     if ($Session->ValidateTransientKey($TransientKey)) {
         // If messages wasn't empty
         if ($Messages != '') {
             // Unserialize them & save them if necessary
             $Messages = Format::Unserialize($Messages);
             if (is_array($Messages)) {
                 $MessageModel = new Gdn_MessageModel();
                 foreach ($Messages as $Message) {
                     // Check to see if it already exists, and if not, add it.
                     if (is_object($Message)) {
                         $Message = Format::ObjectAsArray($Message);
                     }
                     $Content = ArrayValue('Content', $Message, '');
                     if ($Content != '') {
                         $Data = $MessageModel->GetWhere(array('Content' => $Content));
                         if ($Data->NumRows() == 0) {
                             $MessageModel->Save(array('Content' => $Content, 'AllowDismiss' => ArrayValue('AllowDismiss', $Message, '1'), 'Enabled' => ArrayValue('Enabled', $Message, '1'), 'Application' => ArrayValue('Application', $Message, 'Garden'), 'Controller' => ArrayValue('Controller', $Message, 'Settings'), 'Method' => ArrayValue('Method', $Message, ''), 'AssetTarget' => ArrayValue('AssetTarget', $Message, 'Content'), 'CssClass' => ArrayValue('CssClass', $Message, '')));
                         }
                     }
                 }
             }
         }
         // Load the config file so we can save some info in it
         $Config = Gdn::Factory(Gdn::AliasConfig);
         $Config->Load(PATH_CONF . DS . 'config.php', 'Save');
         // If the response wasn't empty, save it in the config
         if ($Response != '') {
             $Config->Set('Garden.RequiredUpdates', $Response);
         }
         // Record the current update check time in the config.
         $Config->Set('Garden.UpdateCheckDate', time());
         $Config->Save();
     }
 }
开发者ID:jhampha,项目名称:Garden,代码行数:42,代码来源:utility.php

示例4: CleanErrorArguments

 function CleanErrorArguments(&$Var, $BlackList = array('configuration', 'config', 'database', 'password'))
 {
     if (is_array($Var)) {
         foreach ($Var as $Key => $Value) {
             if (in_array(strtolower($Key), $BlackList)) {
                 $Var[$Key] = 'SECURITY';
             } else {
                 if (is_object($Value)) {
                     $Value = Format::ObjectAsArray($Value);
                     $Var[$Key] = $Value;
                 }
                 if (is_array($Value)) {
                     CleanErrorArguments($Var[$Key], $BlackList);
                 }
             }
         }
     }
 }
开发者ID:jeastwood,项目名称:Garden,代码行数:18,代码来源:functions.error.php

示例5: Themes

 /**
  * Theme management screen.
  */
 public function Themes($ThemeFolder = '', $TransientKey = '')
 {
     $this->Title(Translate('Themes'));
     $this->Permission('Garden.Themes.Manage');
     $this->AddSideMenu('garden/settings/themes');
     $Session = Gdn::Session();
     $ThemeManager = new Gdn_ThemeManager();
     $this->AvailableThemes = $ThemeManager->AvailableThemes();
     $this->EnabledThemeFolder = $ThemeManager->EnabledTheme();
     $this->EnabledTheme = $ThemeManager->EnabledThemeInfo();
     $Name = array_keys($this->EnabledTheme);
     $Name = ArrayValue(0, $Name, 'undefined');
     $this->EnabledTheme = ArrayValue($Name, $this->EnabledTheme);
     $this->EnabledThemeName = ArrayValue('Name', $this->EnabledTheme, $Name);
     // Loop through all of the available themes and mark them if they have an update available
     // Retrieve the list of themes that require updates from the config file
     $RequiredUpdates = Format::Unserialize(Gdn::Config('Garden.RequiredUpdates', ''));
     if (is_array($RequiredUpdates)) {
         foreach ($RequiredUpdates as $UpdateInfo) {
             if (is_object($UpdateInfo)) {
                 $UpdateInfo = Format::ObjectAsArray($UpdateInfo);
             }
             $NewVersion = ArrayValue('Version', $UpdateInfo, '');
             $Name = ArrayValue('Name', $UpdateInfo, '');
             $Type = ArrayValue('Type', $UpdateInfo, '');
             foreach ($this->AvailableThemes as $Theme => $Info) {
                 $CurrentName = ArrayValue('Name', $Info, $Theme);
                 if ($CurrentName == $Name && $Type == 'Theme') {
                     $Info['NewVersion'] = $NewVersion;
                     $this->AvailableThemes[$Theme] = $Info;
                 }
             }
         }
     }
     if ($Session->ValidateTransientKey($TransientKey) && $ThemeFolder != '') {
         try {
             foreach ($this->AvailableThemes as $ThemeName => $ThemeInfo) {
                 if ($ThemeInfo['Folder'] == $ThemeFolder) {
                     $Session->SetPreference('PreviewTheme', '');
                     // Clear out the preview
                     $ThemeManager->EnableTheme($ThemeName);
                 }
             }
         } catch (Exception $e) {
             $this->Form->AddError(strip_tags($e->getMessage()));
         }
         if ($this->Form->ErrorCount() == 0) {
             Redirect('/settings/themes');
         }
     }
     $this->Render();
 }
开发者ID:jeastwood,项目名称:Garden,代码行数:55,代码来源:settings.php

示例6: Set

 /**
  * Adds values to the $this->_Sets collection. Allows for the inserting
  * and updating of values to the db.
  *
  * @param mixed $Field The name of the field to save value as. Alternately this can be an array
  * of $FieldName => $Value pairs, or even an object of $DataSet->Field
  * properties containing one rowset.
  * @param string $Value The value to be set in $Field. Ignored if $Field was an array or object.
  * @param boolean $EscapeString A boolean value indicating if the $Value(s) should be escaped or not.
  * @param boolean $CreateNewNamedParameter A boolean value indicating that if (a) a named parameter is being
  * created, and (b) that name already exists in $this->_NamedParameters
  * collection, then a new one should be created rather than overwriting the
  * existing one.
  */
 public function Set($Field, $Value = '', $EscapeString = TRUE, $CreateNewNamedParameter = TRUE)
 {
     $Field = Format::ObjectAsArray($Field);
     if (!is_array($Field)) {
         $Field = array($Field => $Value);
     }
     foreach ($Field as $f => $v) {
         if (!is_object($v)) {
             if (!is_array($v)) {
                 $v = array($v);
             }
             foreach ($v as $FunctionName => $Val) {
                 if ($EscapeString === FALSE) {
                     if (is_string($FunctionName) !== FALSE) {
                         $this->_Sets[$this->EscapeIdentifier($f)] = $FunctionName . '(' . $Val . ')';
                     } else {
                         $this->_Sets[$this->EscapeIdentifier($f)] = $Val;
                     }
                 } else {
                     $NamedParameter = $this->NamedParameter($f, $CreateNewNamedParameter);
                     $this->_NamedParameters[$NamedParameter] = $Val;
                     $this->_Sets[$this->EscapeIdentifier($f)] = is_string($FunctionName) !== FALSE ? $FunctionName . '(' . $NamedParameter . ')' : $NamedParameter;
                 }
             }
         }
     }
     return $this;
 }
开发者ID:edelbalso,项目名称:Garden,代码行数:42,代码来源:class.sqldriver.php

示例7: ResultArray

 /**
  * Returns an array of associative arrays containing the ResultSet data.
  *
  * @param string $FormatType The type of formatting to use on each of the result fields. Defaults to none.
  */
 public function ResultArray($FormatType = '')
 {
     if ($this->_PDOStatementFetched === TRUE) {
         if ($this->_ResultArrayFetched === FALSE) {
             foreach ($this->_ResultObject as $Object) {
                 $this->_ResultArray[] = Format::ObjectAsArray($Object);
             }
         }
     } else {
         $this->FetchAllRows(DATASET_TYPE_ARRAY);
     }
     $this->_ResultArrayFetched = TRUE;
     return Format::To($this->_ResultArray, $FormatType);
 }
开发者ID:Aetasiric,项目名称:Garden,代码行数:19,代码来源:class.dataset.php


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