本文整理汇总了PHP中Nooku\Library\ObjectConfig::append方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectConfig::append方法的具体用法?PHP ObjectConfig::append怎么用?PHP ObjectConfig::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nooku\Library\ObjectConfig
的用法示例。
在下文中一共展示了ObjectConfig::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: _initialize
protected function _initialize(Library\ObjectConfig $config)
{
$language = \JFactory::getLanguage();
$settings = array('directionality' => $language->isRTL() ? 'rtl' : 'ltr', 'editor_selector' => 'editable', 'mode' => 'specific_textareas', 'skin' => 'nooku', 'theme' => 'advanced', 'inline_styles' => true, 'gecko_spellcheck' => true, 'entity_encoding' => 'raw', 'extended_valid_elements' => '', 'invalid_elements' => 'script,applet,iframe', 'relative_urls' => false, 'remove_script_host' => true, 'document_base_url' => $this->getObject('request')->getBaseUrl()->getPath() . '/sites/' . $this->getObject('application')->getSite(), 'theme_advanced_toolbar_location' => 'top', 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_source_editor_height' => '400', 'height' => '400', 'width' => '100%', 'theme_advanced_statusbar_location' => 'bottom', 'theme_advanced_resizing' => false, 'theme_advanced_resize_horizontal' => false, 'theme_advanced_path' => true, 'dialog_type' => 'modal', 'language' => substr($language->getTag(), 0, strpos($language->getTag(), '-')), 'theme_advanced_buttons1' => implode(',', array('bold', 'italic', 'strikethrough', 'underline', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 'link', 'unlink', '|', 'spellchecker', 'fullscreen', 'image', 'readmore', 'article', '|', 'advanced')), 'theme_advanced_buttons2' => implode(',', array('formatselect', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo')), 'theme_advanced_buttons3' => '', 'theme_advanced_buttons4' => '');
$config->append(array('codemirror' => true, 'codemirrorOptions' => array('stylesheet' => array($config->media_url . '/wysiwyg/codemirror/lib/codemirror.css'), 'path' => $config->media_url . '/wysiwyg/codemirror/'), 'editor_settings' => $settings));
parent::_initialize($config);
}
示例4: _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');
}
示例5: 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;
}
示例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;
}
示例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);
}
示例8: _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');
}
示例9: 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);
}
示例10: _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);
}
示例11: 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;
}
示例12: 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;
}
示例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;
}
示例14: 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);
}
示例15: _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);
}