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


PHP ObjectConfig::unbox方法代码示例

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


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

示例1: render

    /**
     * Renders the reCAPTCHA widget.
     *
     * @param string  $error   The error message given by reCAPTCHA.
     * @param boolean $ssl     Determines is the request should be made over SSL.
     *
     * @return string - The HTML to be embedded in the user's form.
     */
    public function render($config = array())
    {
        $config = new Library\ObjectConfig($config);
        $params = $this->getObject('application.extensions')->users->params;
        $config->append(array('captcha' => array('public_key' => $params->get('recaptcha_public_key', null), 'api_server' => 'http://www.google.com/recaptcha/api', 'api_secure_server' => 'https://www.google.com/recaptcha/api', 'options' => array('theme' => 'clean', 'lang' => 'en')), 'error' => '', 'ssl' => false));
        $captcha = $config->captcha;
        $html = '';
        if ($public_key = $captcha->public_key) {
            if ($config->ssl) {
                $server = $captcha->api_secure_server;
            } else {
                $server = $captcha->api_server;
            }
            if ($config->error) {
                $config->error = '&error=' . $config->error;
            }
            // Use options if any.
            if (count($options = $captcha->options)) {
                $options = Library\ObjectConfig::unbox($options);
                $html .= '<script type="text/javascript">';
                $html .= 'var RecaptchaOptions = ' . json_encode($options);
                $html .= '</script> ';
            }
            $html .= '<script data-inline type="text/javascript" src="' . $server . '/challenge?k=' . $public_key . $config->error . '"></script>
	<noscript>
  		<iframe src="' . $server . '/noscript?k=' . $public_key . $config->error . '" height="300" width="500" frameborder="0"></iframe><br/>
  		<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
  		<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
	</noscript>';
        }
        return $html;
    }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:40,代码来源:captcha.php

示例2: __construct

 public function __construct(Library\ObjectConfig $config)
 {
     parent::__construct($config);
     if (isset($config->adapters)) {
         $this->_adapters = Library\ObjectConfig::unbox($config->adapters);
     }
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:7,代码来源:mimetype.php

示例3: _afterAdapterSelect

 protected function _afterAdapterSelect(Library\CommandContext $context)
 {
     //Get the data
     $rows = Library\ObjectConfig::unbox($context->result);
     if (is_array($rows)) {
         $children = array();
         $result = array();
         /*
          * Create the children array
          */
         foreach ($rows as $key => $row) {
             $path = array();
             $parent = $row['parent_id'];
             //Store node by parent
             if (!empty($parent) && isset($rows[$parent])) {
                 $children[$parent][] = $key;
             }
         }
         /*
          * Create the result array
          */
         foreach ($rows as $key => $row) {
             if (empty($row['parent_id'])) {
                 $result[$key] = $row;
                 if (isset($children[$key])) {
                     $this->_getChildren($rows, $children, $key, $result);
                 }
             }
         }
         /*
          * If we have not been able to match all children to their parents don't perform
          * the path enumeration for the children.
          */
         if (count($result) == count($rows)) {
             if ($context->limit) {
                 $result = array_slice($result, $context->offset, $context->limit, true);
             }
             /*
              * Create the paths of each node
              */
             foreach ($result as $key => $row) {
                 $path = array();
                 $parent = $row['parent_id'];
                 if (!empty($parent)) {
                     $table = $this->_table;
                     //Create node path
                     $path = $result[$parent]['path'];
                     $id = $result[$parent][$table->getIdentityColumn()];
                     $path[] = $id;
                 }
                 //Set the node path
                 $result[$key]['path'] = $path;
             }
         } else {
             $result = $rows;
         }
         $context->result = $result;
     }
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:59,代码来源:nestable.php

示例4: _initialize

 protected function _initialize(Library\ObjectConfig $config)
 {
     $size = Library\ObjectConfig::unbox($config->thumbnail_size);
     if (empty($size)) {
         $config->thumbnail_size = array('x' => 200, 'y' => 150);
     }
     parent::_initialize($config);
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:8,代码来源:thumbnail.php

示例5: __construct

 public function __construct(Library\ObjectConfig $config)
 {
     parent::__construct($config);
     if ($config->columns) {
         $this->_columns = Library\ObjectConfig::unbox($config->columns);
     }
     if ($config->table) {
         $this->_table = $config->table;
     }
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:10,代码来源:closure.php

示例6: __construct

 public function __construct(Library\ObjectConfig $config)
 {
     // Need to set strategy before parent::__construct, otherwise strategy won't be available in getMixableMethods().
     if ($config->strategy) {
         $identifier = clone $config->object_identifier;
         $identifier->path = array('database', 'behavior', 'orderable');
         $identifier->name = $config->strategy;
         $this->setStrategy($config->object_manager->getObject($identifier, Library\ObjectConfig::unbox($config)));
     }
     parent::__construct($config);
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:11,代码来源:orderable.php

示例7: groups

 public function groups($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('name' => '', 'row' => '', 'package' => '', 'model' => 'groups', 'label' => 'title', 'deselect' => ''))->append(array('selected' => ''))->append(array('filter' => array('sort' => 'title')));
     $identifier = 'com:products.model.' . ($config->model ? $config->model : Library\StringInflector::pluralize($config->package));
     $categories = $this->getObject($identifier)->setState(Library\ObjectConfig::unbox($config->filter))->getRowset();
     $options = $this->options(array('entity' => $categories, 'value' => 'id', 'label' => $config->label));
     if ($config->deselect) {
         array_unshift($options, $this->option(array('label' => '-- Select --', 'value' => '0')));
     }
     //Add the options to the config object
     $config->options = $options;
     return $this->optionlist($config);
 }
开发者ID:janssit,项目名称:www.technovit.be,代码行数:14,代码来源:listbox.php

示例8: categories

 public function categories($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('name' => 'categories_category_id', 'row' => '', 'uncategorised' => false, 'max_depth' => '9'))->append(array('selected' => $config->row->{$config->name}))->append(array('filter' => array('sort' => 'title', 'parent' => null, 'published' => null, 'table' => $config->row->getTable()->getBase())));
     $categories = $this->getObject('com:categories.model.categories')->setState(Library\ObjectConfig::unbox($config->filter))->getRowset();
     $iterator = new DatabaseIteratorNode($categories);
     $iterator->setMaxDepth($config->max_depth);
     $options = $this->options(array('entity' => $iterator, 'value' => 'id', 'label' => 'title'));
     if ($config->uncategorised) {
         array_unshift($options, $this->option(array('label' => $this->translate('Uncategorized'), 'value' => '0', 'id' => '0')));
     }
     //Add the options to the config object
     $config->options = $options;
     return parent::radiolist($config);
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:15,代码来源:radiolist.php

示例9: _actionMove

 protected function _actionMove(Library\CommandContext $context)
 {
     $entity = $this->getModel()->getRow();
     if (!$entity->isNew()) {
         $entity->setData(Library\ObjectConfig::unbox($context->request->data->toArray()));
         //Only throw an error if the action explicitly failed.
         if ($entity->move() === false) {
             $error = $entity->getStatusMessage();
             throw new Library\ControllerExceptionActionFailed($error ? $error : 'Move Action Failed');
         } else {
             $context->response->setStatus($entity->getStatus() === Library\Database::STATUS_CREATED ? self::STATUS_CREATED : self::STATUS_UNCHANGED);
         }
     } else {
         throw new Library\ControllerExceptionNotFound('Resource Not Found');
     }
     return $entity;
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:17,代码来源:abstract.php

示例10: validate

 public function validate($row)
 {
     $mimetypes = Library\ObjectConfig::unbox($row->getContainer()->parameters->allowed_mimetypes);
     if (is_array($mimetypes)) {
         $mimetype = $row->mimetype;
         if (empty($mimetype)) {
             if (is_uploaded_file($row->file) && $row->isImage()) {
                 $info = getimagesize($row->file);
                 $mimetype = $info ? $info['mime'] : false;
             } elseif ($row->file instanceof SplFileInfo) {
                 $mimetype = $this->getObject('com:files.mixin.mimetype')->getMimetype($row->file->getPathname());
             }
         }
         if ($mimetype && !in_array($mimetype, $mimetypes)) {
             return $this->_error(\JText::_('Invalid Mimetype'));
         }
     }
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:18,代码来源:mimetype.php

示例11: pages

 public function pages($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('deselect' => true, 'prompt' => '- Select -', 'disable' => array()));
     $options = array();
     if ($config->deselect) {
         $options[] = $this->option(array('text' => JText::_($config->prompt)));
     }
     $menus = $this->getObject('com:pages.model.menus')->getRowset();
     $pages = $this->getObject('com:pages.model.pages')->published(true)->getRowset();
     foreach ($menus as $menu) {
         $options[] = $this->option(array('text' => $menu->title, 'value' => '', 'disable' => true));
         foreach ($pages->find(array('pages_menu_id' => $menu->id)) as $page) {
             $options[] = $this->option(array('text' => str_repeat(str_repeat('&nbsp;', 4), $page->level) . $page->title, 'value' => $page->id, 'disable' => in_array($page->type, Library\ObjectConfig::unbox($config->disable))));
         }
     }
     $config->options = $options;
     return $this->optionlist($config);
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:19,代码来源:listbox.php

示例12: __construct

 public function __construct(Library\ObjectConfig $config)
 {
     parent::__construct($config);
     $this->_actions = Library\ObjectConfig::unbox($config->actions);
     $this->_title_column = Library\ObjectConfig::unbox($config->title_column);
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:6,代码来源:loggable.php

示例13: getEditorSettings

 public function getEditorSettings()
 {
     return Library\ObjectConfig::unbox($this->_editor_settings);
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:4,代码来源:html.php

示例14: getNodes

 /**
  * Method to read child nodes of a folder
  *
  * @param array $config
  */
 public static function getNodes($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('path' => null, 'type' => null, 'recurse' => false, 'fullpath' => false, 'filter' => null, 'map' => null, 'exclude' => array('.svn', '.git', 'CVS'), 'sort' => 'name', 'return_raw' => false));
     $exclude = Library\ObjectConfig::unbox($config->exclude);
     $filter = Library\ObjectConfig::unbox($config->filter);
     $map = Library\ObjectConfig::unbox($config->map);
     $recurse = $config->recurse;
     $results = array();
     foreach (new self($config->path) as $file) {
         if ($file->isDot() || in_array($file->getFilename(), $exclude)) {
             continue;
         }
         if ($file->isDir() && !$file->isDot() && $recurse) {
             $clone = clone $config;
             $clone->path = $file->getPathname();
             $clone->recurse = is_int($config->recurse) ? $config->recurse - 1 : $config->recurse;
             $clone->return_raw = true;
             $child_results = self::getNodes($clone);
         }
         if ($config->type) {
             $method = 'is' . ucfirst($config->type === 'files' ? 'file' : 'dir');
             if (!$file->{$method}()) {
                 continue;
             }
         }
         if ($filter) {
             if (is_callable($filter)) {
                 $ignore = call_user_func($filter, rawurldecode($file->getPathname())) === false;
             } else {
                 if (is_array($filter)) {
                     $ignore = !in_array(strtolower($file->getExtension()), $filter);
                 } else {
                     if (is_string($filter)) {
                         $ignore = !preg_match("/{$filter}/", $file->getFilename());
                     }
                 }
             }
             if ($ignore) {
                 continue;
             }
         }
         if (is_callable($map)) {
             $result = call_user_func($map, rawurldecode($file->getPathname()));
         } else {
             $result = $config->fullpath ? $file->getPathname() : $file->getFilename();
         }
         $results[] = array('path' => $result, 'modified' => $file->getMTime());
         if (!empty($child_results)) {
             $results = array_merge($results, $child_results);
         }
     }
     if ($config->sort === 'modified_on') {
         uasort($results, array('self', '_sortByDate'));
     } elseif ($config->sort === 'name') {
         uasort($results, array('self', '_sortByName'));
     }
     if ($config->return_raw === true) {
         return $results;
     }
     $return = array();
     foreach ($results as $result) {
         $return[] = $result['path'];
     }
     return $return;
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:71,代码来源:directory.php


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