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


PHP object::children方法代码示例

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


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

示例1: getParams

 /**
  * Render all parameters
  *
  * @access	public
  * @param	string	The name of the control, or the default text area if a setup file is not found
  * @return	array	Aarray of all parameters, each as array Any array of the label, the form element and the tooltip
  * @since	1.5
  */
 function getParams(&$control = null)
 {
     if (!isset($this->_xml)) {
         return false;
     }
     $results = array();
     foreach ($this->_xml->children() as $param) {
         $results[] = $this->getParam($param, $control);
     }
     return $results;
 }
开发者ID:rotoballer,项目名称:emily,代码行数:19,代码来源:gantryparameters.class.php

示例2: load

 /**
  * Loads raw xml (with different namespaces) into array. 
  * Keeps attributes without namespace or xml prefix.
  * 
  * @param object $xml SimpleXML object.
  * @return array $array XML array.
  * @see http://www.php.net/manual/en/ref.simplexml.php#52512
  */
 private function load($xml)
 {
     $fils = 0;
     $array = array();
     foreach ($this->namespaces as $uri => $prefix) {
         foreach ($xml->children($uri) as $key => $value) {
             $child = $this->load($value);
             // To deal with the attributes,
             // only works for attributes without a namespace, or in with xml namespace prefixes
             if (count($value->attributes()) > 0 || count($value->attributes("xml", TRUE)) > 0) {
                 $child["@attributes"] = $this->getAttributes($value);
             }
             // Also add the namespace when there is one
             if (!empty($uri)) {
                 $child["@namespace"] = $uri;
             }
             //Let see if the new child is not in the array
             if (!in_array($key, array_keys($array))) {
                 $array[$key] = NULL;
                 $array[$key][] = $child;
             } else {
                 //Add an element in an existing array
                 $array[$key][] = $child;
             }
             $fils++;
         }
     }
     # no container, returning value
     if ($fils == 0) {
         return array((string) $xml);
     }
     return $array;
 }
开发者ID:kennisnet,项目名称:phpOsoTestSchool,代码行数:41,代码来源:productieSoapServerSchool15.php

示例3: _process

 /**
  * Helper function
  *
  * @param  object $module
  * @param  object $element
  * @param  integer $level
  */
 protected static function _process($module, $element, $level = 0)
 {
     global $warp;
     if ($level == 0) {
         $element->attr('class', 'uk-subnav');
     } else {
         $element->addClass('level' . ($level + 1));
     }
     foreach ($element->children('li') as $li) {
         // is active ?
         if ($active = $li->attr('data-menu-active')) {
             $active = ' uk-active';
         }
         // is parent ?
         $ul = $li->children('ul');
         $parent = $ul->length ? ' uk-parent' : null;
         // set class in li
         $li->attr('class', sprintf('level%d' . $parent . $active, $level + 1, $li->attr('data-id')));
         // set class in a/span
         foreach ($li->children('a,span') as $child) {
             // set image
             if ($image = $li->attr('data-menu-image')) {
                 $child->prepend('<img src="' . $image . '" alt="' . $child->text() . '" /> ');
             }
             // set icon
             if ($icon = $li->attr('data-menu-icon')) {
                 $child->prepend('<i class="' . $icon . '"></i> ');
             }
         }
         // process submenu
         if ($ul->length) {
             self::_process($module, $ul->item(0), $level + 1);
         }
     }
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:42,代码来源:Subnav.php

示例4: specEnd

 /**
  * Callback called after a spec execution.
  *
  * @param object $log The log object of the whole spec.
  */
 public function specEnd($log = null)
 {
     $isOk = $log->passed() ? "ok" : "not ok";
     switch ($log->type()) {
         case 'skipped':
         case 'pending':
         case 'excluded':
             $prefix = "# {$log->type()} ";
             break;
         default:
             $prefix = '- ';
             break;
     }
     $message = $prefix . trim(implode(" ", $log->messages()));
     $this->_counter++;
     $this->write("{$isOk} {$this->_counter} {$message}\n");
     if ($exception = $log->exception()) {
         $this->write('# Exception: `' . get_class($exception) . '` Code(' . $exception->getCode() . '):' . "\n");
         $this->write('# Message: ' . $exception->getMessage() . "\n");
     } else {
         foreach ($log->children() as $log) {
             if ($log->passed()) {
                 continue;
             }
             $toString = function ($instance) {
                 return 'an instance of `' . get_class($instance) . '`';
             };
             foreach ($log->data() as $key => $value) {
                 $key = ucfirst($key);
                 $value = Text::toString($value, ['object' => ['method' => $toString]]);
                 $this->write("# {$key}: {$value}\n");
             }
         }
     }
 }
开发者ID:crysalead,项目名称:kahlan,代码行数:40,代码来源:Tap.php

示例5: getValueFromNode

 /**
  * Method to get a PHP native value for a SimpleXMLElement object. -- called recursively
  *
  * @param   object  $node  SimpleXMLElement object for which to get the native value.
  *
  * @return  mixed  Native value of the SimpleXMLElement object.
  *
  * @since   1.0
  */
 protected function getValueFromNode($node)
 {
     switch ($node['type']) {
         case 'integer':
             $value = (string) $node;
             return (int) $value;
             break;
         case 'string':
             return (string) $node;
             break;
         case 'boolean':
             $value = (string) $node;
             return (bool) $value;
             break;
         case 'double':
             $value = (string) $node;
             return (double) $value;
             break;
         case 'array':
             $value = array();
             foreach ($node->children() as $child) {
                 $value[(string) $child['name']] = $this->getValueFromNode($child);
             }
             break;
         default:
             $value = new stdClass();
             foreach ($node->children() as $child) {
                 $value->{$child}['name'] = $this->getValueFromNode($child);
             }
             break;
     }
     return $value;
 }
开发者ID:dioscouri,项目名称:f3-lib,代码行数:42,代码来源:Xml.php

示例6: count

 /**
  * Appends the given container to the notebook.
  *
  * @param  array   $page array(container, label)
  * @param  boolean $last Whether this page should be the last page or not
  * @return integer
  * @access private
  */
 function _addNotebookPage($page, $last = true)
 {
     // Add the container and the tab label.
     if ($last) {
         $this->notebook->append_page($page[0], $page[1]);
     } else {
         // Make this the second to last page.
         $position = count($this->notebook->children()) - 1;
         $this->notebook->insert_page($page[0], $page[1], $position);
         $this->notebook->show_all();
     }
 }
开发者ID:alexzita,项目名称:alex_blog,代码行数:20,代码来源:Gtk.php

示例7: store

 /**
  * Save the order to persistent storage
  *
  * @return mixed Order ID if successfully saved, otherwise false
  */
 public function store($data)
 {
     $id = time() . dechex(intval(time()));
     $guests = [];
     foreach ($this->guests() as $guest) {
         $guests[] = ['name' => $guest, 'checkedIn' => false];
     }
     $order = ['title' => $id, 'customerName' => $data['name'], 'customerPhone' => $data['phone'], 'customerEmail' => $data['email'], 'comments' => $data['comments'], 'date' => date('Y-m-d'), 'time' => date('g:ia'), 'total' => $this->total(), 'guests' => yaml::encode($guests)];
     try {
         $orderPage = $this->event->children()->find('orders')->children()->create($id, 'order', $order);
     } catch (Exception $e) {
         die($e->getMessage());
     }
     return $orderPage;
 }
开发者ID:evendev,项目名称:paintcrazy,代码行数:20,代码来源:CrazyEventOrder.php

示例8: getData

 /**
  * Récupère les informations d'une bière en parsant le DOM
  * @param  object $content
  * @return array
  */
 private function getData($content)
 {
     $data = array();
     $data[] = $content->find('h1', 0)->plaintext;
     $data[] = $content->children(5)->innertext;
     $detailLeft = $content->children(2)->children(0)->find('p');
     $detailRight = $content->children(2)->children(1)->find('p');
     foreach ($detailLeft as $item) {
         $data[] = $item->find('strong', 0)->innertext;
     }
     foreach ($detailRight as $item) {
         $data[] = $item->find('strong', 0)->innertext;
     }
     return $data;
 }
开发者ID:BeerPleaseApp,项目名称:beerplease_parser,代码行数:20,代码来源:ParseBeer.php

示例9: _process

 /**
  * Helper function
  *
  * @param  object $module
  * @param  object $element
  * @param  integer $level
  */
 protected static function _process($module, $element, $level = 0)
 {
     global $warp;
     // get warp config
     $config = $warp['config'];
     if ($level == 0) {
         $element->attr('class', 'uk-subnav');
     } else {
         $element->addClass('level' . ($level + 1));
     }
     foreach ($element->children('li') as $li) {
         // is active ?
         if ($active = $li->attr('data-menu-active')) {
             $active = ' uk-active';
         }
         // is parent ?
         $ul = $li->children('ul');
         $parent = $ul->length ? ' uk-parent' : null;
         // set class in li
         $li->attr('class', sprintf('level%d' . $parent . $active, $level + 1, $li->attr('data-id')));
         // add all options that have a name starting with 'data-'
         foreach ($config->get("menus." . $li->attr('data-id'), array()) as $key => $value) {
             if (strpos($key, 'data-') === 0) {
                 // add an attribute named like the option itself
                 $li->attr($key, $value);
             }
         }
         // set class in a/span
         foreach ($li->children('a,span') as $child) {
             // set image
             if ($image = $li->attr('data-menu-image')) {
                 $child->prepend('<img class="uk-responsive-height" src="' . $image . '" alt="' . $child->text() . '" /> ');
             }
             // set icon
             if ($icon = $li->attr('data-menu-icon')) {
                 $child->prepend('<i class="' . $icon . '"></i> ');
             }
             if ($subtitle = $li->attr('data-menu-subtitle')) {
                 $child->append('<div>' . $subtitle . '</div>');
             }
         }
         // process submenu
         if ($ul->length) {
             self::_process($module, $ul->item(0), $level + 1);
         }
     }
 }
开发者ID:ejailesb,项目名称:repo,代码行数:54,代码来源:Subnav.php

示例10: _parseTree

 /**
  * Parse an XML tree and pull results
  *
  * @param   object  $root
  * @return  array
  */
 private function _parseTree($root)
 {
     $records = array();
     foreach ($root->children() as $child) {
         if ($child->getName() == 'orcid-search-results') {
             foreach ($child->children() as $search_res) {
                 foreach ($search_res->children() as $profile) {
                     if ($profile->getName() == 'orcid-profile') {
                         $fields = array();
                         $this->_parseXml($profile, $fields);
                         array_push($records, $fields);
                     }
                 }
             }
         }
     }
     return $records;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:24,代码来源:orcid.php

示例11: parseTiming

 /**
  * Parse timing info
  * @param object $a_ref_id
  * @param object $a_parent_id
  * @param object $timing
  * @return 
  */
 protected function parseTiming($a_ref_id, $a_parent_id, $timing)
 {
     $type = (string) $timing['Type'];
     $visible = (string) $timing['Visible'];
     $changeable = (string) $timing['Changeable'];
     include_once './Services/Object/classes/class.ilObjectActivation.php';
     $crs_item = new ilObjectActivation();
     $crs_item->setTimingType($type);
     $crs_item->toggleVisible((bool) $visible);
     $crs_item->toggleChangeable((bool) $changeable);
     foreach ($timing->children() as $sub) {
         switch ((string) $sub->getName()) {
             case 'Start':
                 $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC);
                 $crs_item->setTimingStart($dt->get(IL_CAL_UNIX));
                 break;
             case 'End':
                 $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC);
                 $crs_item->setTimingEnd($dt->get(IL_CAL_UNIX));
                 break;
             case 'SuggestionStart':
                 $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC);
                 $crs_item->setSuggestionStart($dt->get(IL_CAL_UNIX));
                 break;
             case 'SuggestionEnd':
                 $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC);
                 $crs_item->setSuggestionEnd($dt->get(IL_CAL_UNIX));
                 break;
             case 'EarliestStart':
                 $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC);
                 $crs_item->setEarliestStart($dt->get(IL_CAL_UNIX));
                 break;
             case 'LatestEnd':
                 $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC);
                 $crs_item->setLatestEnd($dt->get(IL_CAL_UNIX));
                 break;
         }
     }
     if ($crs_item->getTimingStart()) {
         $crs_item->update($a_ref_id, $a_parent_id);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:49,代码来源:class.ilContainerXmlParser.php

示例12: _decodeValue

 /**
  * Method to get a PHP native value for a SimpleXMLElement object
  *
  * @param   object  $node  SimpleXMLElement object for which to get the native value.
  * @return  mixed  Native value of the SimpleXMLElement object.
  */
 protected static function _decodeValue($node)
 {
     switch ($node['type']) {
         case 'integer':
             $value = (string) $node;
             return (int) $value;
             break;
         case 'string':
             return (string) $node;
             break;
         case 'boolean':
             $value = (string) $node;
             return (bool) $value;
             break;
         case 'double':
             $value = (string) $node;
             return (double) $value;
             break;
         case 'array':
         default:
             $value = array();
             foreach ($node->children() as $child) {
                 $value[(string) $child['name']] = self::_decodeValue($child);
             }
             break;
     }
     return $value;
 }
开发者ID:nooku,项目名称:nooku-framework,代码行数:34,代码来源:xml.php

示例13: getFieldActions

 /**
  * Method to get the list of possible permission action names for the form field.
  *
  * @param   object  $element  The JXMLElement object representing the <field /> tag for the
  *                            form field object.
  *
  * @return  array   A list of permission action names from the form field element definition.
  *
  * @since   11.1
  */
 protected function getFieldActions($element)
 {
     // Initialise variables.
     $actions = array();
     // Initialise some field attributes.
     $section = $element['section'] ? (string) $element['section'] : '';
     $component = $element['component'] ? (string) $element['component'] : '';
     // Get the asset actions for the element.
     $elActions = JAccess::getActions($component, $section);
     // Iterate over the asset actions and add to the actions.
     foreach ($elActions as $item) {
         $actions[] = $item->name;
     }
     // Iterate over the children and add to the actions.
     foreach ($element->children() as $el) {
         if ($el->getName() == 'action') {
             $actions[] = (string) $el['name'];
         }
     }
     return $actions;
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:31,代码来源:rules.php

示例14: _getXMLComponents

/**
 * parse SimpleXMLElement instance components, create iCalcreator component and update
 *
 * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
 * @since  2.11.2 - 2012-01-15
 * @param  array  $iCal iCalcreator calendar instance
 * @param  object $component SimpleXMLElement
 * @return void
 */
function _getXMLComponents(&$iCal, &$component)
{
    $compName = $component->getName();
    $comp =& $iCal->newComponent($compName);
    $subComponents = array('valarm', 'standard', 'daylight');
    foreach ($component->children() as $compPart) {
        // properties and (opt) subComponents
        if (1 > $compPart->count()) {
            continue;
        }
        if (in_array($compPart->getName(), $subComponents)) {
            _getXMLComponents($comp, $compPart);
        } elseif ('properties' == $compPart->getName()) {
            foreach ($compPart->children() as $property) {
                // properties as single property
                _getXMLProperties($comp, $property);
            }
        }
    }
    // end foreach( $component->children() as $compPart )
}
开发者ID:cjvaz,项目名称:expressomail,代码行数:30,代码来源:iCalcreator.class.php

示例15: _toArray

 /**
  * Recursive method to toArray
  *
  * @param object $xml SimpleXMLElement object
  * @param array $parentData Parent array with data
  * @param string $ns Namespace of current child
  * @param array $namespaces List of namespaces in XML
  * @return void
  */
 protected static function _toArray($xml, &$parentData, $ns, $namespaces)
 {
     $data = array();
     foreach ($namespaces as $namespace) {
         foreach ($xml->attributes($namespace, true) as $key => $value) {
             if (!empty($namespace)) {
                 $key = $namespace . ':' . $key;
             }
             $data['@' . $key] = (string) $value;
         }
         foreach ($xml->children($namespace, true) as $child) {
             self::_toArray($child, $data, $namespace, $namespaces);
         }
     }
     $asString = trim((string) $xml);
     if (empty($data)) {
         $data = $asString;
     } elseif (!empty($asString)) {
         $data['@'] = $asString;
     }
     if (!empty($ns)) {
         $ns .= ':';
     }
     $name = $ns . $xml->getName();
     if (isset($parentData[$name])) {
         if (!is_array($parentData[$name]) || !isset($parentData[$name][0])) {
             $parentData[$name] = array($parentData[$name]);
         }
         $parentData[$name][] = $data;
     } else {
         $parentData[$name] = $data;
     }
 }
开发者ID:robotarmy,项目名称:Phog,代码行数:42,代码来源:xml.php


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