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


PHP is_array函数代码示例

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


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

示例1: __construct

 /**
  * @param mixed $in
  */
 public function __construct($in = null)
 {
     $fields = array('to', 'cc', 'bcc', 'message', 'body', 'subject');
     if (is_string($in)) {
         if (($pos = strpos($in, '?')) !== false) {
             parse_str(substr($in, $pos + 1), $this->args);
             $this->args['to'] = substr($in, 0, $pos);
         } else {
             $this->args['to'] = $in;
         }
     } elseif ($in instanceof Horde_Variables) {
         foreach ($fields as $val) {
             if (isset($in->{$val})) {
                 $this->args[$val] = $in->{$val};
             }
         }
     } elseif (is_array($in)) {
         $this->args = $in;
     }
     if (isset($this->args['to']) && strpos($this->args['to'], 'mailto:') === 0) {
         $mailto = @parse_url($this->args['to']);
         if (is_array($mailto)) {
             $this->args['to'] = isset($mailto['path']) ? $mailto['path'] : '';
             if (!empty($mailto['query'])) {
                 parse_str($mailto['query'], $vals);
                 foreach ($fields as $val) {
                     if (isset($vals[$val])) {
                         $this->args[$val] = $vals[$val];
                     }
                 }
             }
         }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:37,代码来源:Link.php

示例2: __construct

 /**
  * Constructs a book dialog
  * $action - GET or POST action to take.
  * $inclusions - NULL (in which case it does nothing), or an array of book IDs to include.
  * $exclusions - NULL (in which case it does nothing), or an array of book IDs to exclude.
  */
 public function __construct($header, $info_top, $info_bottom, $action, $inclusions, $exclusions)
 {
     $this->view = new Assets_View(__FILE__);
     $caller = $_SERVER["PHP_SELF"] . "?" . http_build_query(array());
     $this->view->view->caller = $caller;
     $this->view->view->header = $header;
     $this->view->view->info_top = $info_top;
     $this->view->view->info_bottom = $info_bottom;
     $this->view->view->action = $action;
     $database_books = Database_Books::getInstance();
     $book_ids = $database_books->getIDs();
     if (is_array($inclusions)) {
         $book_ids = $inclusions;
     }
     if (is_array($exclusions)) {
         $book_ids = array_diff($book_ids, $exclusions);
         $book_ids = array_values($book_ids);
     }
     foreach ($book_ids as $id) {
         $book_names[] = $database_books->getEnglishFromId($id);
     }
     $this->view->view->book_ids = $book_ids;
     $this->view->view->book_names = $book_names;
     $this->view->render("books2.php");
     Assets_Page::footer();
     die;
 }
开发者ID:alerque,项目名称:bibledit,代码行数:33,代码来源:books2.php

示例3: qqwb_env

function qqwb_env()
{
    $msgs = array();
    $files = array(ROOT_PATH . 'include/ext/qqwb/qqoauth.php', ROOT_PATH . 'include/ext/qqwb/oauth.php', ROOT_PATH . 'modules/qqwb.mod.php');
    foreach ($files as $f) {
        if (!is_file($f)) {
            $msgs[] = "文件<b>{$f}</b>不存在";
        }
    }
    $funcs = array('version_compare', array('fsockopen', 'pfsockopen'), 'preg_replace', array('iconv', 'mb_convert_encoding'), array("hash_hmac", "mhash"));
    foreach ($funcs as $func) {
        if (!is_array($func)) {
            if (!function_exists($func)) {
                $msgs[] = "函数<b>{$func}</b>不可用";
            }
        } else {
            $t = false;
            foreach ($func as $f) {
                if (function_exists($f)) {
                    $t = true;
                    break;
                }
            }
            if (!$t) {
                $msgs[] = "函数<b>" . implode(" , ", $func) . "</b>都不可用";
            }
        }
    }
    return $msgs;
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:30,代码来源:qqwb_env.func.php

示例4: getInput

 protected function getInput()
 {
     if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $this->params = $this->element->attributes();
     $this->db = JFactory::getDBO();
     $group = $this->get('group', 'categories');
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $parameters = NNParameters::getInstance();
     $params = $parameters->getPluginParams('nnframework');
     $this->max_list_count = $params->max_list_count;
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     if ($group == 'categories') {
         require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
         return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
     $attr = '';
     $attr .= ' size="' . (int) $size . '"';
     $attr .= $multiple ? ' multiple="multiple"' : '';
     return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:30,代码来源:virtuemart.php

示例5: processAssert

 /**
  * Assert that after deleting product success message.
  *
  * @param FixtureInterface|FixtureInterface[] $product
  * @param CatalogProductIndex $productPage
  * @return void
  */
 public function processAssert($product, CatalogProductIndex $productPage)
 {
     $products = is_array($product) ? $product : [$product];
     $deleteMessage = sprintf(self::SUCCESS_DELETE_MESSAGE, count($products));
     $actualMessage = $productPage->getMessagesBlock()->getSuccessMessage();
     \PHPUnit_Framework_Assert::assertEquals($deleteMessage, $actualMessage, 'Wrong success message is displayed.' . "\nExpected: " . $deleteMessage . "\nActual: " . $actualMessage);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:14,代码来源:AssertProductSuccessDeleteMessage.php

示例6: getSwarmUAIndex

 /** @return object */
 public static function getSwarmUAIndex()
 {
     // Lazy-init and cache
     if (self::$swarmUaIndex === null) {
         global $swarmInstallDir;
         // Convert from array with string values
         // to an object with boolean values
         $swarmUaIndex = new stdClass();
         $rawIndex = parse_ini_file("{$swarmInstallDir}/config/useragents.ini", true);
         foreach ($rawIndex as $uaID => $uaItem) {
             if (is_array($uaItem)) {
                 $uaItem2 = $uaItem;
                 foreach ($uaItem2 as $uaDataKey => $uaDataVal) {
                     if ($uaDataKey !== "displaytitle" && $uaDataKey !== "displayicon") {
                         $uaItem[$uaDataKey] = (bool) trim($uaDataVal);
                     } else {
                         $uaItem[$uaDataKey] = trim($uaDataVal);
                     }
                 }
                 if (!isset($uaItem["displaytitle"]) || !$uaItem["displaytitle"]) {
                     throw new SwarmException("User agent `{$uaID}` is missing a displaytitle property.");
                 }
                 if (!isset($uaItem["displayicon"]) || !$uaItem["displayicon"]) {
                     throw new SwarmException("User agent `{$uaID}` is missing a displayicon property.");
                 }
                 $swarmUaIndex->{$uaID} = (object) $uaItem;
             }
         }
         self::$swarmUaIndex = $swarmUaIndex;
     }
     return self::$swarmUaIndex;
 }
开发者ID:appendto,项目名称:testswarm,代码行数:33,代码来源:BrowserInfo.php

示例7: fetch_all

 public function fetch_all($cachenames, $lv)
 {
     global $_G;
     $data = array();
     if ($lv > 1 && !$cachenames) {
         $cachenames = $_G[_config][cache_list];
     }
     if (defined('DEBUG')) {
         $name = $this->obj->name;
         if (in_array($name, array('memcache', 'baichuan'))) {
             $_G['memory_debug']['get'] = array();
             if (is_array($cachenames)) {
                 $_G['memory_debug']['get'] = $cachenames;
             } else {
                 $_G['memory_debug']['get'][] = $key;
             }
         }
     }
     $data = $this->obj->get($cachenames);
     if ($data === false || $data === NULL) {
         $this->update($cachenames);
     }
     if (is_array($cachenames)) {
         foreach ($data as $k => $v) {
             if ($v === false) {
                 $data[$k] = $this->update($k);
             }
         }
     }
     return $data;
 }
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:31,代码来源:cache.class.php

示例8: openseadragon

 /**
  * Return a OpenSeadragon image viewer for the provided files.
  * 
  * @param File|array $files A File record or an array of File records.
  * @param int $width The width of the image viewer in pixels.
  * @param int $height The height of the image viewer in pixels.
  * @return string|null
  */
 public function openseadragon($files)
 {
     if (!is_array($files)) {
         $files = array($files);
     }
     // Filter out invalid images.
     $images = array();
     $imageNames = array();
     foreach ($files as $file) {
         // A valid image must be a File record.
         if (!$file instanceof File) {
             continue;
         }
         // A valid image must have a supported extension.
         $extension = pathinfo($file->original_filename, PATHINFO_EXTENSION);
         if (!in_array(strtolower($extension), $this->_supportedExtensions)) {
             continue;
         }
         $images[] = $file;
         $imageNames[explode(".", $file->filename)[0]] = openseadragon_dimensions($file, 'original');
     }
     // Return if there are no valid images.
     if (!$images) {
         return;
     }
     return $this->view->partial('common/openseadragon.php', array('images' => $images, 'imageNames' => $imageNames));
 }
开发者ID:UVicLibrary,项目名称:omeka-OpenSeadragon2,代码行数:35,代码来源:Openseadragon.php

示例9: apply

 /**
  * {@inheritdoc}
  */
 public function apply(DataSourceInterface $dataSource, $name, $data, array $options)
 {
     $expressionBuilder = $dataSource->getExpressionBuilder();
     if (is_array($data) && !isset($data['type'])) {
         $data['type'] = isset($options['type']) ? $options['type'] : self::TYPE_CONTAINS;
     }
     if (!is_array($data)) {
         $data = ['type' => self::TYPE_CONTAINS, 'value' => $data];
     }
     $fields = array_key_exists('fields', $options) ? $options['fields'] : [$name];
     $type = $data['type'];
     $value = array_key_exists('value', $data) ? $data['value'] : null;
     if (!in_array($type, [self::TYPE_NOT_EMPTY, self::TYPE_EMPTY], true) && '' === trim($value)) {
         return;
     }
     if (1 === count($fields)) {
         $dataSource->restrict($this->getExpression($expressionBuilder, $type, current($fields), $value));
         return;
     }
     $expressions = [];
     foreach ($fields as $field) {
         $expressions[] = $this->getExpression($expressionBuilder, $type, $field, $value);
     }
     $dataSource->restrict($expressionBuilder->orX(...$expressions));
 }
开发者ID:sylius,项目名称:grid,代码行数:28,代码来源:StringFilter.php

示例10: _getValidatorValue

 /**
  * Get value that should be validated.
  *
  * @param mixed $value
  * @return mixed
  */
 protected function _getValidatorValue($value)
 {
     if (is_array($value)) {
         $value = new \Magento\Framework\DataObject($value);
     }
     return $value;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Constraint.php

示例11: htmlList

 /**
  * Generates a 'List' element.
  *
  * @param array   $items   Array with the elements of the list
  * @param boolean $ordered Specifies ordered/unordered list; default unordered
  * @param array   $attribs Attributes for the ol/ul tag.
  * @return string The list XHTML.
  */
 public function htmlList(array $items, $ordered = false, $attribs = false, $escape = true)
 {
     if (!is_array($items)) {
         #require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('First param must be an array');
         $e->setView($this->view);
         throw $e;
     }
     $list = '';
     foreach ($items as $item) {
         if (!is_array($item)) {
             if ($escape) {
                 $item = $this->view->escape($item);
             }
             $list .= '<li>' . $item . '</li>' . self::EOL;
         } else {
             if (6 < strlen($list)) {
                 $list = substr($list, 0, strlen($list) - 6) . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
             } else {
                 $list .= '<li>' . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
             }
         }
     }
     if ($attribs) {
         $attribs = $this->_htmlAttribs($attribs);
     } else {
         $attribs = '';
     }
     $tag = 'ul';
     if ($ordered) {
         $tag = 'ol';
     }
     return '<' . $tag . $attribs . '>' . self::EOL . $list . '</' . $tag . '>' . self::EOL;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:42,代码来源:HtmlList.php

示例12: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $m = $this->getConfig('methods');
     if (@count($m) == 1) {
         $a = new Am_Paysystem_Action_Form(self::URL . $m[0] . '/event/');
     } else {
         $a = new Am_Paysystem_Action_HtmlTemplate_Micropayment($this->getDir(), 'micropayment-confirm.phtml');
         $methods = array();
         if (@count($m)) {
             $a->url = self::URL . $m[0] . '/event/';
             foreach ($m as $title) {
                 $methods[self::URL . $title . '/event/'] = $this->getConfig($title . '.title');
             }
         } else {
             foreach ($this->getConfig() as $k => $v) {
                 if (is_array($v) && !empty($v['title'])) {
                     $methods[self::URL . $k . '/event/'] = $v['title'];
                 }
             }
             $a->url = array_shift(array_keys($methods));
         }
         $a->methods = $methods;
     }
     $a->project = $this->getConfig('project');
     $a->amount = $invoice->first_total * 100;
     $a->freepaymentid = $invoice->public_id;
     $a->seal = md5("project={$a->project}&amount={$a->amount}&freepaymentid={$a->freepaymentid}" . $this->getConfig('key'));
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:29,代码来源:micropayment.php

示例13: convertDateMomentToPhp

 public static function convertDateMomentToPhp($format)
 {
     $tokens = ["M" => "n", "Mo" => "nS", "MM" => "m", "MMM" => "M", "MMMM" => "F", "D" => "j", "Do" => "jS", "DD" => "d", "DDD" => "z", "DDDo" => "zS", "DDDD" => "zS", "d" => "w", "do" => "wS", "dd" => "D", "ddd" => "D", "dddd" => "l", "e" => "w", "E" => "N", "w" => "W", "wo" => "WS", "ww" => "W", "W" => "W", "Wo" => "WS", "WW" => "W", "YY" => "y", "YYYY" => "Y", "gg" => "o", "gggg" => "o", "GG" => "o", "GGGG" => "o", "A" => "A", "a" => "a", "H" => "G", "HH" => "H", "h" => "g", "hh" => "h", "m" => "i", "mm" => "i", "s" => "s", "ss" => "s", "S" => "", "SS" => "", "SSS" => "", "z or zz" => "T", "Z" => "P", "ZZ" => "O", "X" => "U", "LT" => "g:i A", "L" => "m/d/Y", "l" => "n/j/Y", "LL" => "F jS Y", "ll" => "M j Y", "LLL" => "F js Y g:i A", "lll" => "M j Y g:i A", "LLLL" => "l, F jS Y g:i A", "llll" => "D, M j Y g:i A"];
     // find all tokens from string, using regular expression
     $regExp = "/(\\[[^\\[]*\\])|(\\\\)?(LT|LL?L?L?|l{1,4}|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/";
     $matches = array();
     preg_match_all($regExp, $format, $matches);
     //  if there is no match found then return the string as it is
     //  TODO: might return escaped string
     if (empty($matches) || is_array($matches) === false) {
         return $format;
     }
     //  to match with extracted tokens
     $momentTokens = array_keys($tokens);
     $phpMatches = array();
     //  ----------------------------------
     foreach ($matches[0] as $id => $match) {
         // if there is a matching php token in token list
         if (in_array($match, $momentTokens)) {
             // use the php token instead
             $string = $tokens[$match];
         } else {
             $string = $match;
         }
         $phpMatches[$id] = $string;
     }
     // join and return php specific tokens
     return implode("", $phpMatches);
 }
开发者ID:rocketyang,项目名称:hasscms-app,代码行数:29,代码来源:FormatConverter.php

示例14: getEndpointFromFields

 /**
  * @param array $fields
  * @return array|null
  */
 public static function getEndpointFromFields(array $fields)
 {
     $arEndpointList = null;
     $fieldsTmp = array();
     foreach ($fields as $moduleId => $arConnectorSettings) {
         if (is_numeric($moduleId)) {
             $moduleId = '';
         }
         foreach ($arConnectorSettings as $connectorCode => $arConnectorFields) {
             foreach ($arConnectorFields as $k => $arFields) {
                 if (isset($fieldsTmp[$moduleId][$connectorCode][$k]) && is_array($arFields)) {
                     $fieldsTmp[$moduleId][$connectorCode][$k] = array_merge($fieldsTmp[$moduleId][$connectorCode][$k], $arFields);
                 } else {
                     $fieldsTmp[$moduleId][$connectorCode][$k] = $arFields;
                 }
             }
         }
     }
     foreach ($fieldsTmp as $moduleId => $arConnectorSettings) {
         if (is_numeric($moduleId)) {
             $moduleId = '';
         }
         foreach ($arConnectorSettings as $connectorCode => $arConnectorFields) {
             foreach ($arConnectorFields as $arFields) {
                 $arEndpoint = array();
                 $arEndpoint['MODULE_ID'] = $moduleId;
                 $arEndpoint['CODE'] = $connectorCode;
                 $arEndpoint['FIELDS'] = $arFields;
                 $arEndpointList[] = $arEndpoint;
             }
         }
     }
     return $arEndpointList;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:38,代码来源:connectormanager.php

示例15: sanitizeUpload

 /**
  * 
  * Sanitizes a file-upload information array.  If no file has been 
  * uploaded, the information will be returned as null.
  * 
  * @param array $value An array of file-upload information.
  * 
  * @return mixed The sanitized upload information array, or null.
  * 
  */
 public function sanitizeUpload($value)
 {
     // if the value is not required, and is blank, sanitize to null
     $null = !$this->_filter->getRequire() && $this->_filter->validateBlank($value);
     if ($null) {
         return null;
     }
     // has to be an array
     if (!is_array($value)) {
         return null;
     }
     // presorted list of expected keys
     $expect = array('error', 'name', 'size', 'tmp_name', 'type');
     // remove unexpected keys
     foreach ($value as $key => $val) {
         if (!in_array($key, $expect)) {
             unset($value[$key]);
         }
     }
     // sort the list of remaining actual keys
     $actual = array_keys($value);
     sort($actual);
     // make sure the expected and actual keys match up
     if ($expect != $actual) {
         return null;
     }
     // if all the non-error values are empty, still null
     $empty = empty($value['name']) && empty($value['size']) && empty($value['tmp_name']) && empty($value['type']);
     if ($empty) {
         return null;
     }
     // everything looks ok, return as-is
     return $value;
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:44,代码来源:SanitizeUpload.php


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