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


PHP AttributeType::getIsSingleValue方法代码示例

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


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

示例1: SchemaAttributes


//.........这里部分代码省略.........
                     $new_attr->addAlias($attr->getName());
                     $new_attr->removeAlias($alias_attr_name);
                     $new_attr_key = strtolower($alias_attr_name);
                     $attrs[$new_attr_key] = $new_attr;
                 }
             }
         }
         # go back and add any inherited descriptions from parent attributes (ie, cn inherits name)
         foreach ($attrs as $key => $attr) {
             $sup_attr_name = $attr->getSupAttribute();
             $sup_attr = null;
             if (trim($sup_attr_name)) {
                 /* This loop really should traverse infinite levels of inheritance (SUP) for attributeTypes,
                    but just in case we get carried away, stop at 100. This shouldn't happen, but for
                    some weird reason, we have had someone report that it has happened. Oh well.*/
                 $i = 0;
                 while ($i++ < 100) {
                     if (isset($attrs_oid[$sup_attr_name])) {
                         $attr->setSupAttribute($attrs_oid[$sup_attr_name]->getName());
                         $sup_attr_name = $attr->getSupAttribute();
                     }
                     if (!isset($attrs[strtolower($sup_attr_name)])) {
                         pla_error(sprintf('Schema error: attributeType "%s" inherits from "%s", but attributeType "%s" does not exist.', $attr->getName(), $sup_attr_name, $sup_attr_name));
                         return;
                     }
                     $sup_attr = $attrs[strtolower($sup_attr_name)];
                     $sup_attr_name = $sup_attr->getSupAttribute();
                     # Does this superior attributeType not have a superior attributeType?
                     if (is_null($sup_attr_name) || strlen(trim($sup_attr_name)) == 0) {
                         /* Since this attribute's superior attribute does not have another superior
                            attribute, clone its properties for this attribute. Then, replace
                            those cloned values with those that can be explicitly set by the child
                            attribute attr). Save those few properties which the child can set here:*/
                         $tmp_name = $attr->getName();
                         $tmp_oid = $attr->getOID();
                         $tmp_sup = $attr->getSupAttribute();
                         $tmp_aliases = $attr->getAliases();
                         $tmp_single_val = $attr->getIsSingleValue();
                         /* clone the SUP attributeType and populate those values
                            that were set by the child attributeType */
                         # clone is a PHP5 function and must be used.
                         if (function_exists('clone')) {
                             $attr = clone $sup_attr;
                         } else {
                             $attr = $sup_attr;
                         }
                         $attr->setOID($tmp_oid);
                         $attr->setName($tmp_name);
                         $attr->setSupAttribute($tmp_sup);
                         $attr->setAliases($tmp_aliases);
                         /* only overwrite the SINGLE-VALUE property if the child explicitly sets it
                            (note: All LDAP attributes default to multi-value if not explicitly set SINGLE-VALUE) */
                         if ($tmp_single_val) {
                             $attr->setIsSingleValue(true);
                         }
                         /* replace this attribute in the attrs array now that we have populated
                         		 new values therein */
                         $attrs[$key] = $attr;
                         # very important: break out after we are done with this attribute
                         $sup_attr_name = null;
                         $sup_attr = null;
                         break;
                     }
                 }
             }
         }
         ksort($attrs);
         # Add the used in and required_by values.
         $schema_object_classes = $this->SchemaObjectClasses();
         if (!is_array($schema_object_classes)) {
             return array();
         }
         foreach ($schema_object_classes as $object_class) {
             $must_attrs = $object_class->getMustAttrNames($schema_object_classes);
             $may_attrs = $object_class->getMayAttrNames($schema_object_classes);
             $oclass_attrs = array_unique(array_merge($must_attrs, $may_attrs));
             # Add Used In.
             foreach ($oclass_attrs as $attr_name) {
                 if (isset($attrs[strtolower($attr_name)])) {
                     $attrs[strtolower($attr_name)]->addUsedInObjectClass($object_class->getName());
                 } else {
                     #echo "Warning, attr not set: $attr_name<br />";
                 }
             }
             # Add Required By.
             foreach ($must_attrs as $attr_name) {
                 if (isset($attrs[strtolower($attr_name)])) {
                     $attrs[strtolower($attr_name)]->addRequiredByObjectClass($object_class->getName());
                 } else {
                     #echo "Warning, attr not set: $attr_name<br />";
                 }
             }
         }
         $return = $attrs;
         # cache the schema to prevent multiple schema fetches from LDAP server
         set_cached_item($this->server_id, 'schema', 'attributes', $return);
     }
     debug_log('%s::SchemaAttributes(): Returning (%s)', 25, get_class($this), $return);
     return $return;
 }
开发者ID:azeckoski,项目名称:az-php-sandbox,代码行数:101,代码来源:server_functions.php

示例2: SchemaAttributes


//.........这里部分代码省略.........
				if (trim($sup_attr_name)) {

					/* This loop really should traverse infinite levels of inheritance (SUP) for attributeTypes,
					 * but just in case we get carried away, stop at 100. This shouldn't happen, but for
					 * some weird reason, we have had someone report that it has happened. Oh well.*/
					$i = 0;
					while ($i++<100 /** 100 == INFINITY ;) */) {

						if (isset($attrs_oid[$sup_attr_name])) {
							$attr->setSupAttribute($attrs_oid[$sup_attr_name]->getName());
							$sup_attr_name = $attr->getSupAttribute();
						}

						if (! isset($attrs[strtolower($sup_attr_name)])){
							error(sprintf('Schema error: attributeType "%s" inherits from "%s", but attributeType "%s" does not exist.',
								$attr->getName(),$sup_attr_name,$sup_attr_name),'error','index.php');
							return;
						}

						$sup_attr = $attrs[strtolower($sup_attr_name)];
						$sup_attr_name = $sup_attr->getSupAttribute();

						# Does this superior attributeType not have a superior attributeType?
						if (is_null($sup_attr_name) || strlen(trim($sup_attr_name)) == 0) {

							/* Since this attribute's superior attribute does not have another superior
							 * attribute, clone its properties for this attribute. Then, replace
							 * those cloned values with those that can be explicitly set by the child
							 * attribute attr). Save those few properties which the child can set here:*/
							$tmp_name = $attr->getName(false);
							$tmp_oid = $attr->getOID();
							$tmp_sup = $attr->getSupAttribute();
							$tmp_aliases = $attr->getAliases();
							$tmp_single_val = $attr->getIsSingleValue();
							$tmp_desc = $attr->getDescription();

							/* clone the SUP attributeType and populate those values
							 * that were set by the child attributeType */
							$attr = clone $sup_attr;

							$attr->setOID($tmp_oid);
							$attr->setName($tmp_name);
							$attr->setSupAttribute($tmp_sup);
							$attr->setAliases($tmp_aliases);
							$attr->setDescription($tmp_desc);

							/* only overwrite the SINGLE-VALUE property if the child explicitly sets it
							 * (note: All LDAP attributes default to multi-value if not explicitly set SINGLE-VALUE) */
							if ($tmp_single_val)
								$attr->setIsSingleValue(true);

							/* replace this attribute in the attrs array now that we have populated
								 new values therein */
							$attrs[$key] = $attr;

							# very important: break out after we are done with this attribute
							$sup_attr_name = null;
							$sup_attr = null;
							break;
						}
					}
				}
			}

			ksort($attrs);
开发者ID:rhertzog,项目名称:lcs,代码行数:66,代码来源:ds_ldap.php


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