本文整理汇总了PHP中is_object函数的典型用法代码示例。如果您正苦于以下问题:PHP is_object函数的具体用法?PHP is_object怎么用?PHP is_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 <[email protected]>
* @author Bastian Waidelich <[email protected]>
* @author Robert Lemke <[email protected]>
* @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
示例16: create
/**
* Return the IMP_Imap instance for a given mailbox/identifier.
*
* @param string $id Mailbox/identifier.
*
* @return IMP_Imap IMP_Imap object.
*/
public function create($id = null)
{
global $registry, $session;
if (!is_null($id) && $registry->getAuth() !== false && ($base = $this->_injector->getInstance('IMP_Remote')->getRemoteById($id))) {
$id = strval($base);
} else {
$base = null;
$id = self::BASE_OB;
}
if (!isset($this->_instance[$id])) {
$ob = null;
try {
$ob = $session->get('imp', 'imap_ob/' . $id);
} catch (Exception $e) {
// This indicates an unserialize() error. This is fatal, so
// logout.
$failure = new Horde_Exception_AuthenticationFailure('Cached IMP session data has become invalid; expiring session.', Horde_Auth::REASON_SESSION);
$failure->application = 'imp';
throw $failure;
}
if (!is_object($ob)) {
$ob = is_null($base) ? new IMP_Imap($id) : new IMP_Imap_Remote($id);
}
/* Attach IMAP alert handler. */
if ($c_ob = $ob->client_ob) {
$c_ob->alerts_ob->attach($this);
}
$this->_instance[$id] = $ob;
}
return $this->_instance[$id];
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:38,代码来源:Imap.php
示例17: validateString
/**
* validate a string
*
* @param mixed $str the value to evaluate as a string
*
* @throws \InvalidArgumentException if the submitted data can not be converted to string
*
* @return string
*/
protected function validateString($str)
{
if (is_object($str) && method_exists($str, '__toString') || is_string($str)) {
return trim($str);
}
throw new InvalidArgumentException('The data received is not OR can not be converted into a string');
}
开发者ID:KorvinSzanto,项目名称:uri,代码行数:16,代码来源:ImmutableComponentTrait.php
示例18: MetaType
function MetaType($t, $len = -1)
{
if (is_object($t)) {
$fieldobj = $t;
$t = $fieldobj->type;
$len = $fieldobj->max_length;
}
switch (strtoupper($t)) {
case 'C':
if ($len <= $this->blobSize) {
return 'C';
}
case 'M':
return 'X';
case 'D':
return 'D';
case 'T':
return 'T';
case 'L':
return 'L';
case 'I':
return 'I';
default:
return 'N';
}
}
开发者ID:BackupTheBerlios,项目名称:dilps,代码行数:26,代码来源:adodb-vfp.inc.php
示例19: __construct
/**
* Class constructor
*/
function __construct($options = array())
{
//Initialise the array
$this->_pathway = array();
$menu =& JSite::getMenu();
if ($item = $menu->getActive()) {
$menus = $menu->getMenu();
$home = $menu->getDefault();
if (is_object($home) && $item->id != $home->id) {
foreach ($item->tree as $menupath) {
$url = '';
$link = $menu->getItem($menupath);
switch ($link->type) {
case 'menulink':
case 'url':
$url = $link->link;
break;
case 'separator':
$url = null;
break;
default:
$url = 'index.php?Itemid=' . $link->id;
}
$this->addItem($menus[$menupath]->name, $url);
}
// end foreach
}
}
// end if getActive
}
开发者ID:RangerWalt,项目名称:ecci,代码行数:33,代码来源:pathway.php
示例20: plgAcymailingContentplugin
function plgAcymailingContentplugin(&$subject, $config)
{
parent::__construct($subject, $config);
if (!isset($this->params)) {
$plugin = JPluginHelper::getPlugin('acymailing', 'contentplugin');
$this->params = new acyParameter($plugin->params);
}
$this->paramsContent = JComponentHelper::getParams('com_content');
JPluginHelper::importPlugin('content');
$this->dispatcherContent = JDispatcher::getInstance();
$excludedHandlers = array('plgContentEmailCloak', 'pluginImageShow');
$excludedNames = array('system' => array('SEOGenerator', 'SEOSimple'), 'content' => array('webeecomment', 'highslide', 'smartresizer', 'phocagallery'));
$excludedType = array_keys($excludedNames);
if (!ACYMAILING_J16) {
foreach ($this->dispatcherContent->_observers as $id => $observer) {
if (is_array($observer) and in_array($observer['handler'], $excludedHandlers)) {
$this->dispatcherContent->_observers[$id]['event'] = '';
} elseif (is_object($observer)) {
if (in_array($observer->_type, $excludedType) and in_array($observer->_name, $excludedNames[$observer->_type])) {
$this->dispatcherContent->_observers[$id] = null;
}
}
}
}
if (!class_exists('JSite')) {
include_once ACYMAILING_ROOT . 'includes' . DS . 'application.php';
}
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:28,代码来源:contentplugin.php
注:本文中的is_object函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论