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


PHP ArrayValueI函数代码示例

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


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

示例1: _ValueAttribute

 /**
  * Creates a VALUE attribute for a form input and returns it in this format: [ value="VALUE"]
  *
  * @param string $FieldName The name of the field that contains the value in $this->_DataArray.
  * @param array $Attributes An associative array of attributes for the input. ie. maxlength, onclick,
  *    class, etc. If $Attributes contains a 'value' key, it will override the
  *    one automatically generated by $FieldName.
  * @return string
  */
 protected function _ValueAttribute($FieldName, $Attributes)
 {
     // Value from $Attributes overrides the datasource and the postback.
     return ' value="' . Gdn_Format::Form(ArrayValueI('value', $Attributes, $this->GetValue($FieldName))) . '"';
 }
开发者ID:bishopb,项目名称:vanilla,代码行数:14,代码来源:class.form.php

示例2: Chunk

 /**
  * Renders a chunk of text
  * 
  * @param mixed $Identify ChunckID.
  * @param mixed $Options type of chunk (Textarea [default], Text)
  * @return mixed $Result.
  */
 function Chunk($Identify, $Options = False)
 {
     static $ChunkModel;
     if (is_null($ChunkModel)) {
         $ChunkModel = new ChunkModel();
     }
     static $PermissionChunksEdit;
     if (is_null($PermissionChunksEdit)) {
         $PermissionChunksEdit = CheckPermission('Candy.Chunks.Edit');
     }
     $Data = $ChunkModel->GetID($Identify);
     if ($Data != False) {
         $String = Gdn_Format::To($Data->Body, $Data->Format);
         $Type = ArrayValueI('type', $Options, 'Textarea');
         $Class = ArrayValueI('class', $Options, '');
         if ($Type) {
             if ($PermissionChunksEdit) {
                 $Class .= ' Editable Editable' . $Type;
             }
             $String = Wrap($String, 'div', array('class' => trim($Class), 'id' => 'Chunk' . $Data->ChunkID));
         }
         return $String;
     }
 }
开发者ID:unlight,项目名称:Candy,代码行数:31,代码来源:bootstrap.php

示例3: RedirectTo

 private function RedirectTo()
 {
     $IncomingTarget = $this->Form->GetValue('Target', '');
     return $IncomingTarget == '' ? ArrayValueI('DefaultController', $this->Routes) : $IncomingTarget;
 }
开发者ID:robi-bobi,项目名称:Garden,代码行数:5,代码来源:entry.php

示例4: checkBoxList

 /**
  * Returns the XHTML for a list of checkboxes.
  *
  * @param string $FieldName Name of the field being posted with this input.
  *
  * @param mixed $DataSet Data to fill the checkbox list. Either an associative
  * array or a database dataset. ex: RoleID, Name from GDN_Role.
  *
  * @param mixed $ValueDataSet Values to be pre-checked in $DataSet. Either an associative array
  * or a database dataset. ex: RoleID from GDN_UserRole for a single user.
  *
  * @param array $Attributes An associative array of attributes for the select. Here is a list of
  * "special" attributes and their default values:
  * Attribute   Options                        Default
  * ------------------------------------------------------------------------
  * ValueField  The name of the field in       'value'
  *             $DataSet that contains the
  *             option values.
  * TextField   The name of the field in       'text'
  *             $DataSet that contains the
  *             option text.
  *
  * @return string
  */
 public function checkBoxList($FieldName, $DataSet, $ValueDataSet = null, $Attributes = false)
 {
     // Never display individual inline errors for these CheckBoxes
     $Attributes['InlineErrors'] = false;
     $Return = '';
     // If the form hasn't been posted back, use the provided $ValueDataSet
     if ($this->isPostBack() === false) {
         if ($ValueDataSet === null) {
             $CheckedValues = $this->getValue($FieldName);
         } else {
             $CheckedValues = $ValueDataSet;
             if (is_object($ValueDataSet)) {
                 $CheckedValues = array_column($ValueDataSet->resultArray(), $FieldName);
             }
         }
     } else {
         $CheckedValues = $this->getFormValue($FieldName, array());
     }
     $i = 1;
     if (is_object($DataSet)) {
         $ValueField = ArrayValueI('ValueField', $Attributes, 'value');
         $TextField = ArrayValueI('TextField', $Attributes, 'text');
         foreach ($DataSet->result() as $Data) {
             $Instance = $Attributes;
             $Instance = removeKeyFromArray($Instance, array('TextField', 'ValueField'));
             $Instance['value'] = $Data->{$ValueField};
             $Instance['id'] = $FieldName . $i;
             if (is_array($CheckedValues) && in_array($Data->{$ValueField}, $CheckedValues)) {
                 $Instance['checked'] = 'checked';
             }
             $Return .= '<li>' . $this->checkBox($FieldName . '[]', $Data->{$TextField}, $Instance) . "</li>\n";
             ++$i;
         }
     } elseif (is_array($DataSet)) {
         foreach ($DataSet as $Text => $ID) {
             // Set attributes for this instance
             $Instance = $Attributes;
             $Instance = removeKeyFromArray($Instance, array('TextField', 'ValueField'));
             $Instance['id'] = $FieldName . $i;
             if (is_array($ID)) {
                 $ValueField = arrayValueI('ValueField', $Attributes, 'value');
                 $TextField = arrayValueI('TextField', $Attributes, 'text');
                 $Text = val($TextField, $ID, '');
                 $ID = val($ValueField, $ID, '');
             } else {
                 if (is_numeric($Text)) {
                     $Text = $ID;
                 }
             }
             $Instance['value'] = $ID;
             if (is_array($CheckedValues) && in_array($ID, $CheckedValues)) {
                 $Instance['checked'] = 'checked';
             }
             $Return .= '<li>' . $this->checkBox($FieldName . '[]', $Text, $Instance) . "</li>\n";
             ++$i;
         }
     }
     return '<ul class="' . concatSep(' ', 'CheckBoxList', val('listclass', $Attributes)) . '">' . $Return . '</ul>';
 }
开发者ID:bryanjamesmiller,项目名称:vanilla,代码行数:83,代码来源:class.form.php

示例5: Gdn_Form_CheckBoxList_Override

 public function Gdn_Form_CheckBoxList_Override($Form)
 {
     // TODO: LOOK FOR EASYLISTSPLITTER 1.0.2 - JQUERY PLUGIN INSTEAD
     $FieldName =& $Form->EventArguments[0];
     $DataSet =& $Form->EventArguments[1];
     $ValueDataSet =& $Form->EventArguments[2];
     $Attributes =& $Form->EventArguments[3];
     if (!is_object($DataSet) || $DataSet->NumRows() <= 5) {
         return $Form->CheckBoxList($FieldName, $DataSet, $ValueDataSet, $Attributes);
     }
     $CountItems = $DataSet->NumRows();
     $ValueField = ArrayValueI('ValueField', $Attributes, 'value');
     $TextField = ArrayValueI('TextField', $Attributes, 'text');
     $CountColumns = GetValue('Columns', $Attributes, 4, True);
     if (GetIncomingValue('DeliveryType', DELIVERY_TYPE_ALL) != DELIVERY_TYPE_ALL) {
         $CountColumns -= 1;
     }
     if ($CountColumns <= 0) {
         $CountColumns = 1;
     }
     $DataArray = ConsolidateArrayValuesByKey($DataSet->ResultArray(), $TextField, $ValueField);
     $InColumn = floor($CountItems / $CountColumns);
     $OffsetCheckboxCount = $CountItems % $CountColumns;
     $Offset = 0;
     $Return = '';
     if (!$ValueDataSet) {
         $ValueDataSet = array();
     }
     while ($Offset < $CountItems) {
         $Length = $InColumn;
         if ($OffsetCheckboxCount > 0) {
             $OffsetCheckboxCount = $OffsetCheckboxCount - 1;
             $Length++;
         }
         $ColumnCheckboxArray = array_slice($DataArray, $Offset, $Length);
         $Offset += $Length;
         $Html = $Form->CheckBoxList($FieldName, $ColumnCheckboxArray, $ValueDataSet, $Attributes);
         $Html = preg_replace('/for\\="(' . $FieldName . '\\d+)".*?\\<input type\\="checkbox" id\\="(' . $FieldName . '\\d+)"/ies', 'self::CheckBoxLabelCallback("$0", "$1", "$2", "' . $FieldName . '")', $Html);
         $Return .= Wrap($Html, 'div', array('class' => 'MorfCheckBoxList Width1of' . $CountColumns));
         if ($Offset == $Length) {
             $Length = $InColumn;
         }
     }
     $Return = Wrap($Return, 'div');
     return $Return;
 }
开发者ID:unlight,项目名称:Morf,代码行数:46,代码来源:default.php

示例6: DisableApplication

   /**
    * Undocumented method.
    *
    * @param string $ApplicationName Undocumented variable.
    * @todo Document DisableApplication() method.
    */
   public function DisableApplication($ApplicationName) {
      // 1. Check to make sure that this application is allowed to be disabled
      $ApplicationInfo = ArrayValueI($ApplicationName, $this->AvailableApplications(), array());
      $ApplicationName = $ApplicationInfo['Index'];
      if (!ArrayValue('AllowDisable', $ApplicationInfo, TRUE))
         throw new Exception(sprintf(T('You cannot disable the %s application.'), $ApplicationName));

      // 2. Check to make sure that no other enabled applications rely on this one
      foreach ($this->EnabledApplications() as $CheckingName => $CheckingInfo) {
         $RequiredApplications = ArrayValue('RequiredApplications', $CheckingInfo, FALSE);
         if (is_array($RequiredApplications) && array_key_exists($ApplicationName, $RequiredApplications) === TRUE) {
            throw new Exception(sprintf(T('You cannot disable the %1$s application because the %2$s application requires it in order to function.'), $ApplicationName, $CheckingName));
         }
      }

      // 2. Disable it
      RemoveFromConfig('EnabledApplications'.'.'.$ApplicationName);

      // Clear the object caches.
      @unlink(PATH_LOCAL_CACHE.'/controller_map.ini');
      @unlink(PATH_LOCAL_CACHE.'/library_map.ini');

      // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
      $Locale = Gdn::Locale();
      $Locale->Set($Locale->Current(), $this->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders(), TRUE);
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:32,代码来源:class.applicationmanager.php

示例7: DisableApplication

 /**
  * Undocumented method.
  *
  * @param string $ApplicationName Undocumented variable.
  * @todo Document DisableApplication() method.
  */
 public function DisableApplication($ApplicationName)
 {
     // 1. Check to make sure that this application is allowed to be disabled
     $ApplicationInfo = ArrayValueI($ApplicationName, $this->AvailableApplications(), array());
     $ApplicationName = $ApplicationInfo['Index'];
     if (!ArrayValue('AllowDisable', $ApplicationInfo, TRUE)) {
         throw new Exception(sprintf(T('You cannot disable the %s application.'), $ApplicationName));
     }
     // 2. Check to make sure that no other enabled applications rely on this one
     foreach ($this->EnabledApplications() as $CheckingName => $CheckingInfo) {
         $RequiredApplications = ArrayValue('RequiredApplications', $CheckingInfo, FALSE);
         if (is_array($RequiredApplications) && array_key_exists($ApplicationName, $RequiredApplications) === TRUE) {
             throw new Exception(sprintf(T('You cannot disable the %1$s application because the %2$s application requires it in order to function.'), $ApplicationName, $CheckingName));
         }
     }
     // 2. Disable it
     RemoveFromConfig("EnabledApplications.{$ApplicationName}");
     // Clear the object caches.
     Gdn_Autoloader::SmartFree(Gdn_Autoloader::CONTEXT_APPLICATION, $ApplicationInfo);
     // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
     $Locale = Gdn::Locale();
     $Locale->Set($Locale->Current(), $this->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders(), TRUE);
     $this->EventArguments['AddonName'] = $ApplicationName;
     Gdn::PluginManager()->CallEventHandlers($this, 'ApplicationManager', 'AddonDisabled');
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:31,代码来源:class.applicationmanager.php

示例8: enableApplication

 /**
  * Enable an application.
  *
  * @param string $applicationName The name of the application to enable.
  * @return bool Returns true if the application was enabled or false otherwise.
  */
 public function enableApplication($applicationName)
 {
     $this->testApplication($applicationName);
     $ApplicationInfo = ArrayValueI($applicationName, $this->availableApplications(), array());
     $applicationName = $ApplicationInfo['Index'];
     $ApplicationFolder = val('Folder', $ApplicationInfo, '');
     SaveToConfig('EnabledApplications' . '.' . $applicationName, $ApplicationFolder);
     Logger::event('addon_enabled', Logger::NOTICE, 'The {addonName} application was enabled.', array('addonName' => $applicationName));
     // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, true);
     $Locale = Gdn::locale();
     $Locale->set($Locale->current(), $this->enabledApplicationFolders(), Gdn::pluginManager()->enabledPluginFolders(), true);
     $this->EventArguments['AddonName'] = $applicationName;
     Gdn::pluginManager()->callEventHandlers($this, 'ApplicationManager', 'AddonEnabled');
     return true;
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:21,代码来源:class.applicationmanager.php

示例9: AvailablePlugins

 /**
  * Looks through the plugins directory for valid plugins and returns them
  * as an associative array of "PluginName" => "Plugin Info Array". It also
  * adds "Folder", and "ClassName" definitions to the Plugin Info Array for
  * each plugin.
  */
 public function AvailablePlugins($GetPlugin = NULL, $ForceReindex = FALSE)
 {
     if (!is_array($this->_AvailablePlugins) || $ForceReindex) {
         $this->_AvailablePlugins = array();
         $this->_PluginsByClassName = array();
         $Info = array();
         $InverseRelation = array();
         if ($FolderHandle = opendir(PATH_PLUGINS)) {
             if ($FolderHandle === FALSE) {
                 return $Info;
             }
             // Loop through subfolders (ie. the actual plugin folders)
             while (($Item = readdir($FolderHandle)) !== FALSE) {
                 if (in_array($Item, array('.', '..'))) {
                     continue;
                 }
                 $PluginPaths = SafeGlob(PATH_PLUGINS . DS . $Item . DS . '*plugin.php');
                 $PluginPaths[] = PATH_PLUGINS . DS . $Item . DS . 'default.php';
                 foreach ($PluginPaths as $i => $PluginFile) {
                     $this->PluginAvailable($PluginFile);
                 }
             }
             closedir($FolderHandle);
         }
     }
     if (is_null($GetPlugin)) {
         return $this->_AvailablePlugins;
     } elseif (ArrayKeyExistsI($GetPlugin, $this->_AvailablePlugins)) {
         return ArrayValueI($GetPlugin, $this->_AvailablePlugins);
     } else {
         return FALSE;
     }
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:39,代码来源:class.pluginmanager.php

示例10: CategoryDropDown

 /**
  * Populates the dropdown list for searching in certain categories -direct copy pretty
  * much out of the core of vanilla
  *
  * @param string $FieldName
  * @param mixed $Options
  * @return mixed dropdown list
  */
 public function CategoryDropDown($FieldName = 'forums[]', $Options = FALSE)
 {
     $Form = new Gdn_Form();
     //get form object
     $Value = ArrayValueI('Value', $Options);
     // The selected category id
     $CategoryData = GetValue('CategoryData', $Options, CategoryModel::Categories());
     // Sanity check
     if (is_object($CategoryData)) {
         $CategoryData = (array) $CategoryData;
     } else {
         if (!is_array($CategoryData)) {
             $CategoryData = array();
         }
     }
     // Respect category permissions (remove categories that the user shouldn't see).
     $SafeCategoryData = array();
     foreach ($CategoryData as $CategoryID => $Category) {
         if ($Value != $CategoryID) {
             if ($Category['CategoryID'] < 0 || !$Category['PermsDiscussionsView']) {
                 continue;
             }
         }
         $SafeCategoryData[$CategoryID] = $Category;
     }
     // Opening select tag
     $Return = '<select';
     $Return .= ' multiple="multiple"';
     $Return .= ' id="SearchDropdown"';
     $Return .= ' name="' . $FieldName . '"';
     $Return .= ' size="4"';
     $Return .= ">\n";
     // Get value from attributes
     if ($Value === FALSE) {
         $Value = $Form->GetValue($FieldName);
         $Return .= '<option value="0" selected="selected">All</option>';
         $All = TRUE;
     } else {
         $Return .= '<option value="0">All</option>';
         $All = FALSE;
     }
     if (!is_array($Value)) {
         $Value = array($Value);
     }
     // Prevent default $Value from matching key of zero
     $HasValue = $Value !== array(FALSE) && $Value !== array('') ? TRUE : FALSE;
     // Start with null option?
     //$Return .= '<option value="0" selected="selected">All</option>';    //Put an "All" categories option
     // Show root categories as headings (ie. you can't post in them)?
     $DoHeadings = C('Vanilla.Categories.DoHeadings');
     // If making headings disabled and there was no default value for
     // selection, make sure to select the first non-disabled value, or the
     // browser will auto-select the first disabled option.
     $ForceCleanSelection = $DoHeadings && !$HasValue;
     // Write out the category options
     if (is_array($SafeCategoryData)) {
         foreach ($SafeCategoryData as $CategoryID => $Category) {
             $Depth = GetValue('Depth', $Category, 0);
             $Disabled = $Depth == 1 && $DoHeadings;
             $Selected = in_array($CategoryID, $Value) && $HasValue;
             if ($ForceCleanSelection && $Depth > 1) {
                 $Selected = TRUE;
                 $ForceCleanSelection = FALSE;
             }
             $Return .= '<option value="' . $CategoryID . '"';
             if ($Disabled) {
                 $Return .= ' disabled="disabled"';
             } else {
                 if ($Selected && $All == FALSE) {
                     $Return .= ' selected="selected"';
                 }
             }
             // only allow selection if NOT disabled
             $Name = GetValue('Name', $Category, 'Blank Category Name');
             if ($Depth > 1) {
                 $Name = str_pad($Name, strlen($Name) + $Depth - 1, ' ', STR_PAD_LEFT);
                 $Name = str_replace(' ', '&#160;', $Name);
             }
             $Return .= '>' . $Name . "</option>\n";
         }
     }
     return $Return . '</select>';
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:91,代码来源:class.sphinxsearchlite.plugin.php

示例11: enableApplication

 /**
  * Enable an application.
  *
  * @param string $applicationName The name of the application to enable.
  * @return bool Returns true if the application was enabled or false otherwise.
  */
 public function enableApplication($applicationName)
 {
     $this->testApplication($applicationName);
     $ApplicationInfo = ArrayValueI($applicationName, $this->availableApplications(), array());
     $applicationName = $ApplicationInfo['Index'];
     $ApplicationFolder = val('Folder', $ApplicationInfo, '');
     saveToConfig('EnabledApplications' . '.' . $applicationName, $ApplicationFolder);
     Logger::event('addon_enabled', Logger::NOTICE, 'The {addonName} application was enabled.', array('addonName' => $applicationName));
     $this->EventArguments['AddonName'] = $applicationName;
     Gdn::pluginManager()->callEventHandlers($this, 'ApplicationManager', 'AddonEnabled');
     return true;
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:18,代码来源:class.applicationmanager.php


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