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


PHP is_object函数代码示例

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


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

示例1: validatePlugin

 /**
  * Validate the plugin
  *
  * Checks that the Model is an instance of ModelInterface
  *
  * @param  mixed $plugin
  * @throws InvalidPluginException
  * @return void
  */
 public function validatePlugin($plugin)
 {
     if ($plugin instanceof ModelInterface) {
         return;
     }
     throw new InvalidPluginException(sprintf('Plugin of type %s is invalid; must implement %s\\Model\\ModelInterface', is_object($plugin) ? get_class($plugin) : gettype($plugin), __NAMESPACE__));
 }
开发者ID:uthando-cms,项目名称:uthando-common,代码行数:16,代码来源:ModelManager.php

示例2: render

 /**
  * Iterates through elements of $each and renders child nodes
  *
  * @param array $each The array or SplObjectStorage to iterated over
  * @param string $as The name of the iteration variable
  * @param string $key The name of the variable to store the current array key
  * @param boolean $reverse If enabled, the iterator will start with the last element and proceed reversely
  * @return string Rendered string
  * @author Sebastian Kurfürst <sebastian@typo3.org>
  * @author Bastian Waidelich <bastian@typo3.org>
  * @author Robert Lemke <robert@typo3.org>
  * @api
  */
 public function render($each, $as, $key = '', $reverse = FALSE)
 {
     $output = '';
     if ($each === NULL) {
         return '';
     }
     if (is_object($each)) {
         if (!$each instanceof Traversable) {
             throw new Tx_Fluid_Core_ViewHelper_Exception('ForViewHelper only supports arrays and objects implementing Traversable interface', 1248728393);
         }
         $each = $this->convertToArray($each);
     }
     if ($reverse === TRUE) {
         $each = array_reverse($each);
     }
     $output = '';
     foreach ($each as $keyValue => $singleElement) {
         $this->templateVariableContainer->add($as, $singleElement);
         if ($key !== '') {
             $this->templateVariableContainer->add($key, $keyValue);
         }
         $output .= $this->renderChildren();
         $this->templateVariableContainer->remove($as);
         if ($key !== '') {
             $this->templateVariableContainer->remove($key);
         }
     }
     return $output;
 }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:42,代码来源:ForViewHelper.php

示例3: set

 /**
  * @param string $id
  * @param core_libs $this
  */
 function set($id, $lib = null)
 {
     if ($lib && is_object($lib) && !$lib instanceof Closure) {
         $this->_resolved($id, $lib);
     }
     return parent::set($id, $lib);
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:11,代码来源:libs.php

示例4: art_load_config

 function art_load_config()
 {
     static $moduleConfig;
     if (isset($moduleConfig[$GLOBALS["artdirname"]])) {
         return $moduleConfig[$GLOBALS["artdirname"]];
     }
     //load_functions("config");
     //$moduleConfig[$GLOBALS["artdirname"]] = mod_loadConfig($GLOBALS["artdirname"]);
     if (isset($GLOBALS["xoopsModule"]) && is_object($GLOBALS["xoopsModule"]) && $GLOBALS["xoopsModule"]->getVar("dirname", "n") == $GLOBALS["artdirname"]) {
         if (!empty($GLOBALS["xoopsModuleConfig"])) {
             $moduleConfig[$GLOBALS["artdirname"]] =& $GLOBALS["xoopsModuleConfig"];
         } else {
             return null;
         }
     } else {
         $module_handler =& xoops_gethandler('module');
         $module = $module_handler->getByDirname($GLOBALS["artdirname"]);
         $config_handler =& xoops_gethandler('config');
         $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid')));
         $configs =& $config_handler->getConfigs($criteria);
         foreach (array_keys($configs) as $i) {
             $moduleConfig[$GLOBALS["artdirname"]][$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
         }
         unset($configs);
     }
     if ($customConfig = @(include XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/include/plugin.php")) {
         $moduleConfig[$GLOBALS["artdirname"]] = array_merge($moduleConfig[$GLOBALS["artdirname"]], $customConfig);
     }
     return $moduleConfig[$GLOBALS["artdirname"]];
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:30,代码来源:functions.ini.php

示例5: ArtifactFile

 /**
  *  ArtifactFile - constructor.
  *
  *	@param	object	The Artifact object.
  *  @param	array	(all fields from artifact_file_user_vw) OR id from database.
  *  @return	boolean	success.
  */
 function ArtifactFile(&$Artifact, $data = false)
 {
     global $Language;
     $this->Error();
     //was Artifact legit?
     if (!$Artifact || !is_object($Artifact)) {
         $this->setError('ArtifactFile: ' . $Language->getText('tracker_common_file', 'invalid'));
         return false;
     }
     //did ArtifactType have an error?
     if ($Artifact->isError()) {
         $this->setError('ArtifactFile: ' . $Artifact->getErrorMessage());
         return false;
     }
     $this->Artifact = $Artifact;
     if ($data) {
         if (is_array($data)) {
             $this->data_array = $data;
             return true;
         } else {
             if (!$this->fetchData($data)) {
                 return false;
             } else {
                 return true;
             }
         }
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:35,代码来源:ArtifactFile.class.php

示例6: varToString

 private function varToString($var)
 {
     if (is_object($var)) {
         return sprintf('Object(%s)', get_class($var));
     }
     if (is_array($var)) {
         $a = array();
         foreach ($var as $k => $v) {
             $a[] = sprintf('%s => %s', $k, $this->varToString($v));
         }
         return sprintf("Array(%s)", implode(', ', $a));
     }
     if (is_resource($var)) {
         return sprintf('Resource(%s)', get_resource_type($var));
     }
     if (null === $var) {
         return 'null';
     }
     if (false === $var) {
         return 'false';
     }
     if (true === $var) {
         return 'true';
     }
     return (string) $var;
 }
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:26,代码来源:DoctrineDataCollector.php

示例7: prepare_remote_upgrade

 public function prepare_remote_upgrade($remoteMPID = 0)
 {
     $tp = new TaskPermission();
     if ($tp->canInstallPackages()) {
         $mri = MarketplaceRemoteItem::getByID($remoteMPID);
         if (!is_object($mri)) {
             $this->set('error', array(t('Invalid marketplace item ID.')));
             return;
         }
         $local = Package::getbyHandle($mri->getHandle());
         if (!is_object($local) || $local->isPackageInstalled() == false) {
             $this->set('error', array(Package::E_PACKAGE_NOT_FOUND));
             return;
         }
         $r = $mri->downloadUpdate();
         if ($r != false) {
             if (!is_array($r)) {
                 $this->set('error', array($r));
             } else {
                 $errors = Package::mapError($r);
                 $this->set('error', $errors);
             }
         } else {
             $this->redirect('/dashboard/extend/update', 'do_update', $mri->getHandle());
         }
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:27,代码来源:update.php

示例8: refine

 /**
  *
  */
 public function refine(&$pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options = null)
 {
     $o_log = isset($pa_options['log']) && is_object($pa_options['log']) ? $pa_options['log'] : null;
     // Set place hierarchy
     if ($vs_hierarchy = $pa_item['settings']['placeSplitter_placeHierarchy']) {
         $vn_hierarchy_id = caGetListItemID('place_hierarchies', $vs_hierarchy);
     } else {
         // Default to first place hierarchy
         $t_list = new ca_lists();
         $va_hierarchy_ids = $t_list->getItemsForList('place_hierarchies', array('idsOnly' => true));
         $vn_hierarchy_id = array_shift($va_hierarchy_ids);
     }
     if (!$vn_hierarchy_id) {
         if ($o_log) {
             $o_log->logError(_t('[placeSplitterRefinery] No place hierarchies are defined'));
         }
         return array();
     }
     $pa_options['hierarchyID'] = $vn_hierarchy_id;
     $t_place = new ca_places();
     if ($t_place->load(array('parent_id' => null, 'hierarchy_id' => $vn_hierarchy_id))) {
         $pa_options['defaultParentID'] = $t_place->getPrimaryKey();
     }
     return caGenericImportSplitter('placeSplitter', 'place', 'ca_places', $this, $pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options);
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:28,代码来源:placeSplitterRefinery.php

示例9: add

 /**
  * Ajouter un champ
  *
  * @param $type type de champ à ajouter (correspond au nom de l'objet réprésentant le champ)
  * @param $name nom du champ (doit être unique)
  * @param $value valeur par défaut
  *
  * @return obj (retourne l'objet représentant le champ créé)
  */
 public function add($type, $name = '', $value = '', $label = '')
 {
     if (is_object($type)) {
         if (isset($this->fields[$type->getName()])) {
             trigger_error('Un champ nommé « ' . $type->getName() . ' » existe déjà.', E_USER_ERROR);
         }
         $this->fields[$type->getName()] = $type;
     } else {
         if (empty($name)) {
             trigger_error('L\'argument name est nécessaire pour la création du champ.', E_USER_ERROR);
         }
         if (isset($this->fields[$name])) {
             trigger_error('Un champ nommé « ' . $name . ' » existe déjà.', E_USER_ERROR);
         } else {
             $field = 'Field_' . $type;
             if ($field == 'Field_SubmitButton') {
                 $o_Field = new $field($name);
             } else {
                 $o_Field = new $field($name, $value, $label);
             }
             $o_Field->setForm($this);
             $this->fields[$name] = $o_Field;
             return $o_Field;
         }
     }
 }
开发者ID:K-Phoen,项目名称:Form-Class,代码行数:35,代码来源:Form.class.php

示例10: process

 /**
  * Process
  *
  * @param mixed $value
  * @param array $options
  *
  * @return string|null
  */
 public function process($value, array $options = array())
 {
     if ($value === null) {
         return;
     }
     if (!class_exists('\\libphonenumber\\PhoneNumberUtil')) {
         throw new \RuntimeException('Library for phone checking not found');
     }
     if (is_object($value) || is_resource($value) || is_array($value)) {
         $this->throwException($options, 'error');
     }
     try {
         $phone = $this->getPhone($value, $options, $is_toll_free);
     } catch (\libphonenumber\NumberParseException $e) {
         $this->throwException($options, 'error');
     }
     $util = \libphonenumber\PhoneNumberUtil::getInstance();
     if (!$util->isValidNumber($phone)) {
         $this->throwException($options, 'error');
     }
     if ($is_toll_free) {
         return $phone->getNationalNumber();
     }
     return (string) $util->format($phone, $this->getDefaultPhoneFormat($options));
 }
开发者ID:apishka,项目名称:validator,代码行数:33,代码来源:Phone.php

示例11: isGranted

 protected function isGranted($attribute, $object, $user = null)
 {
     if (!$user) {
         $user = $this->tokenStorage->getToken()->getUser();
     }
     if (!is_object($user)) {
         return false;
     }
     if (in_array('ROLE_ADMINISTRATOR', $user->getRoles())) {
         return true;
     }
     if (!in_array('ROLE_USER', $user->getRoles())) {
         return false;
     }
     if (in_array($attribute, [self::ATTRIBUTE_VIEW, self::ATTRIBUTE_CREATE])) {
         return true;
     }
     /**
      * @var Subcontractor $object
      */
     if ($attribute == self::ATTRIBUTE_EDIT) {
         return $object->getCreatedBy() && $user->getId() == $object->getCreatedBy()->getId() || in_array('ROLE_SUBCONTRACTOR_MANAGER', $user->getRoles());
     }
     return false;
 }
开发者ID:mishki-svami,项目名称:pa-core,代码行数:25,代码来源:SubcontractorVoter.php

示例12: __construct

 /**
  * Creates a new validation value for a validation set.
  * 
  * @param string|IValidator $validator The validator to build be it a class name (fully qualified)
  *                                     or a dummy validator object.
  * @param mixed ...$params The parameters to the validator. To use a field from the validated
  *                         object, set these as ValidationKey objects.
  */
 public function __construct($validator)
 {
     if (is_object($validator)) {
         if (!$validator instanceof IValidator) {
             throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator'));
         } else {
             $this->validator = get_class($validator);
         }
     } elseif (is_string($validator)) {
         if (!is_subclass_of($validator, 'Flikore\\Validator\\Interfaces\\IValidator')) {
             throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator'));
         } else {
             $this->validator = $validator;
         }
     } else {
         throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator'));
     }
     $params = func_get_args();
     array_shift($params);
     foreach ($params as $arg) {
         if ($arg instanceof ValidationKey) {
             $this->fields[] = $arg->getKey();
         }
     }
     $this->args = $params;
 }
开发者ID:flikore,项目名称:validator,代码行数:34,代码来源:ValidationValue.php

示例13: import

 public function import(\SimpleXMLElement $sx)
 {
     $em = \Database::connection()->getEntityManager();
     $em->getClassMetadata('Concrete\\Core\\Entity\\Express\\Entity')->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator());
     if (isset($sx->expressentities)) {
         foreach ($sx->expressentities->entity as $entityNode) {
             $entity = $em->find('Concrete\\Core\\Entity\\Express\\Entity', (string) $entityNode['id']);
             if (!is_object($entity)) {
                 $entity = new Entity();
                 $entity->setId((string) $entityNode['id']);
             }
             $entity->setPluralHandle((string) $entityNode['plural_handle']);
             $entity->setHandle((string) $entityNode['handle']);
             $entity->setDescription((string) $entityNode['description']);
             $entity->setName((string) $entityNode['name']);
             if ((string) $entityNode['include_in_public_list'] == '') {
                 $entity->setIncludeInPublicList(false);
             }
             $entity->setHandle((string) $entityNode['handle']);
             $tree = ExpressEntryResults::get();
             $node = $tree->getNodeByDisplayPath((string) $entityNode['results-folder']);
             $node = \Concrete\Core\Tree\Node\Type\ExpressEntryResults::add((string) $entityNode['name'], $node);
             $entity->setEntityResultsNodeId($node->getTreeNodeID());
             $indexer = $entity->getAttributeKeyCategory()->getSearchIndexer();
             if (is_object($indexer)) {
                 $indexer->createRepository($entity->getAttributeKeyCategory());
             }
             $em->persist($entity);
         }
     }
     $em->flush();
     $em->getClassMetadata('Concrete\\Core\\Entity\\Express\\Entity')->setIdGenerator(new UuidGenerator());
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:33,代码来源:ImportExpressEntitiesRoutine.php

示例14: sectioned_page_output

 function sectioned_page_output()
 {
     wp_enqueue_script('sticky', WP_PLUGIN_URL . '/' . plugin_dir_path('msd-specialty-pages/msd-specialty-pages.php') . '/lib/js/jquery.sticky.js', array('jquery'), FALSE, TRUE);
     global $post, $subtitle_metabox, $sectioned_page_metabox, $nav_ids;
     $i = 0;
     $meta = $sectioned_page_metabox->the_meta();
     if (is_object($sectioned_page_metabox)) {
         while ($sectioned_page_metabox->have_fields('sections')) {
             $layout = $sectioned_page_metabox->get_the_value('layout');
             switch ($layout) {
                 case "three-boxes":
                     break;
                 default:
                     $sections[] = self::default_output($meta['sections'][$i], $i);
                     break;
             }
             $i++;
         }
         //close while
         print '<div class="sectioned-page-wrapper">';
         print implode("\n", $sections);
         print '</div>';
     }
     //clsoe if
 }
开发者ID:foxydot,项目名称:daretocare,代码行数:25,代码来源:sectioned.php

示例15: setUp

 public function setUp()
 {
     $this->array = array();
     // create an instance
     $this->instance = new ArrayFileStore($this->array);
     $this->assertTrue(is_object($this->instance));
 }
开发者ID:99designs,项目名称:cabinet,代码行数:7,代码来源:ArrayFileStoreTest.php


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