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


PHP Library\ObjectConfig类代码示例

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


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

示例1: _initialize

 protected function _initialize(Library\ObjectConfig $config)
 {
     $config->append(array('behaviors' => array('com:activities.controller.behavior.loggable', 'com:attachments.controller.behavior.attachable'), 'model' => 'com:categories.model.categories'));
     parent::_initialize($config);
     //Force the toolbars
     $config->toolbars = array('menubar', 'com:categories.controller.toolbar.category');
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:7,代码来源:category.php

示例2: upload

    /**
     * Builds the file upload control and initializes it's related javascript classes.
     * 
     * To enable maximum compliance with the current state of the file upload's accept attribute, specify both any MIME
     * types and any corresponding extension.
     * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#attr-input-accept
     * 
     * @param 	object 	An optional Library\ObjectConfig object with configuration options
     */
    public function upload($config = array())
    {
        $config = new Library\ObjectConfig($config);
        $config->append(array('container' => 'document.body'));
        if (!$config->allowed_extensions || !$config->allowed_mimetypes) {
            $container = $this->getObject('com:files.database.table.containers')->select(array('slug' => 'attachments-attachments'), Library\Database::FETCH_ROW);
            $config->append(array('allowed_extensions' => $container->parameters->allowed_extensions, 'allowed_mimetypes' => $container->parameters->allowed_mimetypes));
        }
        if ($config->container != 'document.body') {
            $config->container = '\'' . $config->container . '\'';
        }
        $extensions = json_encode($config->allowed_extensions->toArray());
        $html = <<<END
\t\t<script src="assets://attachments/js/attachments.upload.js" />
\t\t<script>
\t\twindow.addEvent('domready', function() {
\t\t\tnew Attachments.Upload({
\t\t\t\tcontainer: {$config->container},
\t\t\t    extensions: {$extensions}
\t\t\t});
\t\t});
\t\t</script>
END;
        $accept = array();
        foreach ($config->allowed_extensions->toArray() as $val) {
            $accept[] = '.' . $val;
        }
        $accept = array_merge($accept, $config->allowed_mimetypes->toArray());
        $html .= '<input type="file" name="attachments[]" accept="' . implode(', ', $accept) . '" />';
        return $html;
    }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:40,代码来源:attachment.php

示例3: 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 = '&amp;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

示例4: languages

    public function languages($config = array())
    {
        $config = new Library\ObjectConfig($config);
        $config->append(array('name' => 'language'));
        $result = '';
        $result = '
		    <script>
                window.addEvent(\'domready\', function() {
                    document.getElement(\'select[name=' . $config->name . ']\').addEvent(\'change\', function() {
                        window.location = this.value;
                    });
                });
            </script>
		';
        $options = array();
        $languages = $this->getObject('application.languages');
        $active = $languages->getActive();
        foreach ($languages as $language) {
            $route = $this->getTemplate()->getView()->getRoute('language=' . $language->slug);
            $options[] = $this->option(array('label' => $language->name, 'value' => $route));
            if ($language->iso_code == $active->iso_code) {
                $config->selected = $route;
            }
        }
        $config->options = $options;
        $result .= parent::optionlist($config);
        return $result;
    }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:28,代码来源:listbox.php

示例5: _initialize

 protected function _initialize(Library\ObjectConfig $config)
 {
     $config->append(array('model' => 'com:tags.model.tags'));
     parent::_initialize($config);
     //Force the toolbars
     $config->toolbars = array('menubar', 'com:tags.controller.toolbar.tag');
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:7,代码来源:tag.php

示例6: link

 public function link($config)
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('title' => '', 'current' => false, 'active' => false, 'offset' => 0, 'limit' => 0, 'rel' => '', 'attribs' => array()));
     $html = '<a class="btn ' . $config->rel . '" href="#">' . JText::_($config->title) . '</a>';
     return $html;
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:7,代码来源:paginator.php

示例7: groups

 public function groups($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('name' => 'role_id'));
     $config->options = $this->options(array('entity' => $this->getObject('com:users.model.roles')->sort('id')->getRowset(), 'label' => 'name'));
     return $this->radiolist($config);
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:7,代码来源:select.php

示例8: tags

 public function tags($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('model' => 'tags', 'value' => 'id', 'text' => 'title', 'prompt' => false));
     $config->text = 'title';
     $config->sort = 'title';
     return parent::_render($config);
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:8,代码来源:listbox.php

示例9: thumbnail

 public function thumbnail($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('align' => 'right', 'class' => 'thumbnail article__thumbnail'));
     $image = $config->row;
     $html = '<img class="' . $config->class . '" align="' . $config->align . '" src="' . $image->thumbnail . '" />';
     return $html;
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:8,代码来源:image.php

示例10: gravatar

 public function gravatar($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('email' => '', 'size' => '32', 'attribs' => array()));
     $source = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($config->email))) . "?s=" . $config->size;
     $html = '<img class="avatar" src="' . $source . '" />';
     return $html;
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:8,代码来源:image.php

示例11: _initialize

 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   Library\ObjectConfig $config Configuration options
  * @return  void
  */
 protected function _initialize(Library\ObjectConfig $config)
 {
     //Make asset paths absolute
     $base = $this->getObject('request')->getBaseUrl();
     $path = $this->getObject('request')->getBaseUrl()->getPath() . '/assets/';
     $config->append(array('priority' => self::PRIORITY_LOW, 'aliases' => array('"/assets/' => '"' . $path)));
     parent::_initialize($config);
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:16,代码来源:url.php

示例12: email

 public function email($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('identifier' => 'com:clients.model.emails', 'name' => 'id'));
     //@TODO : Fix - Forcing config option because of name collisions
     $config->text = 'email';
     $config->sort = 'email';
     return parent::_render($config);
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:9,代码来源:listbox.php

示例13: link

 /**
  * Render a page link
  *
  * @param   array   An optional array with configuration options
  * @return	string	Html
  */
 public function link($config)
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('title' => '', 'current' => false, 'active' => false, 'offset' => 0, 'limit' => 0, 'rel' => '', 'attribs' => array()));
     $route = $this->getTemplate()->getView()->getRoute('limit=' . $config->limit . '&offset=' . $config->offset);
     $rel = !empty($config->rel) ? 'rel="' . $config->rel . '"' : '';
     $html = '<a ' . $this->buildAttributes($config->attribs) . ' href="' . $route . '" ' . $rel . '>' . $this->translate($config->title) . '</a>';
     return $html;
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:15,代码来源:paginator.php

示例14: _initialize

 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   Library\ObjectConfig $config Configuration options
  * @return  void
  */
 protected function _initialize(Library\ObjectConfig $config)
 {
     //Make images paths absolute
     $base = $this->getObject('request')->getBaseUrl();
     $site = $this->getObject('application')->getSite();
     $path = $base->getPath() . '/files/' . $site . '/files/';
     $config->append(array('aliases' => array('files://' => $path, '"files/' => '"' . $path)));
     parent::_initialize($config);
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:17,代码来源:files.php

示例15: languages

 public function languages($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('value' => 'iso_code', 'label' => 'name', 'identifier' => 'com:languages.model.languages', 'filter' => array('application' => 'site', 'enabled' => 1)));
     $listbox = parent::_listbox($config);
     if (!$config->size) {
         $listbox = str_replace('size="1"', '', $listbox);
     }
     return $listbox;
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:10,代码来源:listbox.php


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