本文整理汇总了PHP中KRequest::root方法的典型用法代码示例。如果您正苦于以下问题:PHP KRequest::root方法的具体用法?PHP KRequest::root怎么用?PHP KRequest::root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KRequest
的用法示例。
在下文中一共展示了KRequest::root方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initialize
/**
* Initializes the configuration for the object
*
* Called from {@link __construct()} as a first step of object instantiation.
*
* @param array Configuration settings
*/
protected function _initialize(KConfig $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' => true, 'remove_script_host' => false, 'document_base_url' => KRequest::root(), 'theme_advanced_toolbar_location' => 'top', 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_source_editor_height' => '550', 'height' => '550', '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('layout' => 'default', 'media_url' => KRequest::root() . '/media'))->append(array('codemirror' => true, 'codemirrorOptions' => array('stylesheet' => array($config->media_url . '/com_editors/codemirror/css/xmlcolors.css', $config->media_url . '/com_editors/codemirror/css/jscolors.css', $config->media_url . '/com_editors/codemirror/css/csscolors.css', $config->media_url . '/com_editors/css/codemirror.css'), 'path' => $config->media_url . '/com_editors/codemirror/js/'), 'editor_settings' => $settings));
parent::_initialize($config);
}
示例2: __get
public function __get($column)
{
if ($column == 'image_path') {
return $this->image ? KRequest::root() . '/joomlatools-files/docman-images/' . $this->image : null;
}
if ($column == 'icon') {
if (!is_object($this->params)) {
$this->params = json_decode($this->params);
}
$icon = $this->params->icon ? $this->params->icon : 'icon:folder.png';
return $icon;
}
if ($column == 'icon_path') {
$icon = $this->icon;
if (substr($icon, 0, 5) === 'icon:') {
$icon = '/joomlatools-files/docman-icons/' . substr($icon, 5);
} else {
$icon = '/media/com_docman/images/icons/' . $icon;
}
return KRequest::root() . $icon;
}
if ($column === 'description_summary') {
$description = $this->description;
$position = strpos($description, '<hr id="system-readmore" />');
if ($position !== false) {
return substr($description, 0, $position);
}
return $description;
}
if ($column === 'description_full') {
return str_replace('<hr id="system-readmore" />', '', $this->description);
}
return parent::__get($column);
}
示例3: image
/**
* Renders the html markup for the user avatar
*
* @author Stian Didriksen <stian@ninjaforge.com>
* @return string
*/
public function image($config = array())
{
$params = KFactory::get('admin::com.ninjaboard.model.settings')->getParams();
$prepend = KFactory::get('lib.joomla.application')->isAdmin() ? KRequest::root() . '/' : '';
$config = new KConfig($config);
$config->append(array('id' => KFactory::get('admin::com.ninjaboard.model.people')->getMe()->id, 'thumbnail' => 'large', 'class' => 'avatar', 'link' => 'person', 'type' => 'css'));
$person = KFactory::tmp('admin::com.ninjaboard.model.people')->id($config->id)->getItem();
$avatar_on = new DateTime($person->avatar_on);
$cache = (int) $avatar_on->format('U');
$config->append(array('avatarurl' => $prepend . JRoute::_('&option=com_ninjaboard&view=avatar&id=' . $config->id . '&thumbnail=' . $config->thumbnail . '&cache=' . $cache), 'profileurl' => $prepend . JRoute::_('&option=com_ninjaboard&view=person&id=' . $config->id)));
$attribs = array('class' => $config->class, 'href' => $config->profileurl);
$height = $params['avatar_settings'][$config->thumbnail . '_thumbnail_height'];
$width = $params['avatar_settings'][$config->thumbnail . '_thumbnail_width'];
///* @TODO Following is the <img /> version, likely going to be deprecated
if ($config->type == 'tag') {
$attribs['src'] = $config->avatarurl;
$attribs['height'] = $height;
$attribs['width'] = $width;
unset($attribs['href']);
$html = '<img ' . KHelperArray::toString($attribs) . ' />';
} else {
$style = 'background-image: url(' . $config->avatarurl . '); ';
$style .= 'height: ' . $height . 'px; ';
$style .= 'width: ' . $width . 'px;';
$attribs['style'] = $style;
$html = '<a ' . KHelperArray::toString($attribs) . '></a>';
}
return $html;
}
示例4: __construct
public function __construct($subject, $config = array())
{
// Turn off E_STRICT errors for now
error_reporting(error_reporting() & ~E_STRICT);
// Check if database type is MySQLi
if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
if (JFactory::getApplication()->getName() === 'administrator') {
$string = version_compare(JVERSION, '1.6', '<') ? 'mysqli' : 'MySQLi';
$link = JRoute::_('index.php?option=com_config');
$error = 'In order to use Joomlatools framework, your database type in Global Configuration should be set to <strong>%1$s</strong>. Please go to <a href="%2$s">Global Configuration</a> and in the \'Server\' tab change your Database Type to <strong>%1$s</strong>.';
JError::raiseWarning(0, sprintf(JText::_($error), $string, $link));
}
return;
}
// Set pcre.backtrack_limit to a larger value
// See: https://bugs.php.net/bug.php?id=40846
if (version_compare(PHP_VERSION, '5.3.6', '<=') && @ini_get('pcre.backtrack_limit') < 1000000) {
@ini_set('pcre.backtrack_limit', 1000000);
}
//Set constants
define('KDEBUG', JDEBUG);
//Set path definitions
define('JPATH_FILES', JPATH_ROOT);
define('JPATH_IMAGES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'images');
//Set exception handler
set_exception_handler(array($this, 'exceptionHandler'));
// Koowa : setup
require_once JPATH_LIBRARIES . '/koowa/koowa.php';
Koowa::getInstance(array('cache_prefix' => md5(JFactory::getApplication()->getCfg('secret')) . '-cache-koowa', 'cache_enabled' => false));
KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE)));
KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT)));
KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE)));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module'));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin'));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component'));
KServiceIdentifier::setApplication('site', JPATH_SITE);
KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR);
KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
KService::setAlias('translator', 'com:default.translator');
//Setup the request
if (JFactory::getApplication()->getName() !== 'site') {
KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
}
//Load the koowa plugins
JPluginHelper::importPlugin('koowa', null, true);
//Bugfix : Set offset accoording to user's timezone
if (!JFactory::getUser()->guest) {
if ($offset = JFactory::getUser()->getParam('timezone')) {
if (version_compare(JVERSION, '3.0', '>=')) {
JFactory::getConfig()->set('offset', $offset);
} else {
JFactory::getConfig()->setValue('config.offset', $offset);
}
}
}
// Load language files for the framework
KService::get('com:default.translator')->loadLanguageFiles();
parent::__construct($subject, $config);
}
示例5: __construct
public function __construct(KConfig $config)
{
parent::__construct($config);
if (!$config->template_url) {
$state = $this->getModel()->getState();
$config->template_url = KRequest::root() . ($state->application == 'admininistrator' ? '/administrator' : '') . '/templates';
}
// Set base url used by things like template thumbnails
$this->assign('templateurl', $config->template_url);
}
示例6: __construct
public function __construct($subject, $config = array())
{
// Check if Koowa is active
if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
JError::raiseWarning(0, JText::_("Koowa plugin requires MySQLi Database Driver. Please change your database configuration settings to 'mysqli'"));
return;
}
// Check for suhosin
if (in_array('suhosin', get_loaded_extensions())) {
//Attempt setting the whitelist value
@ini_set('suhosin.executor.include.whitelist', 'tmpl://, file://');
//Checking if the whitelist is ok
if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) {
JError::raiseWarning(0, sprintf(JText::_('Your server has Suhosin loaded. Please follow <a href="%s" target="_blank">this</a> tutorial.'), 'https://nooku.assembla.com/wiki/show/nooku-framework/Known_Issues'));
return;
}
}
//Set constants
define('KDEBUG', JDEBUG);
define('JPATH_IMAGES', JPATH_ROOT . '/images');
//Set exception handler
set_exception_handler(array($this, 'exceptionHandler'));
// Require the library loader
JLoader::import('libraries.koowa.koowa', JPATH_ROOT);
JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT);
//Setup the loader
KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath()));
KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES));
KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE));
KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT));
KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE));
//Setup the factory
KFactory::addAdapter(new KFactoryAdapterKoowa());
KFactory::addAdapter(new KFactoryAdapterJoomla());
KFactory::addAdapter(new KFactoryAdapterModule());
KFactory::addAdapter(new KFactoryAdapterPlugin());
KFactory::addAdapter(new KFactoryAdapterComponent());
//Setup the identifier application paths
KIdentifier::registerApplication('site', JPATH_SITE);
KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR);
//Setup the request
KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
//Set factory identifier aliasses
KFactory::map('lib.koowa.database.adapter.mysqli', 'admin::com.default.database.adapter.mysqli');
//Load the koowa plugins
JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher'));
//Bugfix : Set offset accoording to user's timezone
if (!KFactory::get('lib.joomla.user')->guest) {
if ($offset = KFactory::get('lib.joomla.user')->getParam('timezone')) {
KFactory::get('lib.joomla.config')->setValue('config.offset', $offset);
}
}
parent::__construct($subject, $config);
}
示例7: notify
public function notify(KCommandContext $context)
{
if ($context->result->status == KDatabase::STATUS_CREATED) {
$application = JFactory::getApplication();
// Send e-mail to the user.
$mail_from_email = $application->getCfg('mailfrom');
$mail_from_name = $application->getCfg('fromname');
$mail_site_name = $application->getCfg('sitename');
if ($mail_from_email == '' || $mail_from_name == '') {
$user = JFactory::getUser();
$mail_from_email = $user->email;
$mail_from_name = $user->name;
}
$subject = JText::_('NEW_USER_MESSAGE_SUBJECT');
$message = JText::sprintf('NEW_USER_MESSAGE', $context->result->name, $mail_site_name, KRequest::root(), $context->result->username, $context->result->password);
JUtility::sendMail($mail_from_email, $mail_from_name, $context->result->email, $subject, $message);
}
}
示例8: getList
public function getList()
{
//Removed by DC Oct 2010 to allow for multiple image pickers on one page
//if(!isset($this->_list))
//{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
// path to images directory
$identifier = $this->getIdentifier();
$path = $this->_state->folder;
$filter = '\\.png$|\\.gif$|\\.jpg$|\\.bmp$|\\.ico$';
$uripath = str_replace(JPATH_ROOT, KRequest::root(), $path);
//Added by DC Oct 2010 to allow for multiple image pickers on one page
$this->_images = array();
$root = basename($path);
if (!JFolder::exists($path)) {
JFolder::create($path);
}
$files = JFolder::files($path, $filter, true, true);
$this->_list = array();
$optgroup = $root;
if (is_array($files)) {
foreach ($files as $file) {
if (($f = basename(dirname($file))) !== $optgroup) {
if ($this->_state->optroup) {
$this->_list[] = JHTML::_('select.optgroup', $f);
}
}
$filepath = str_replace($root . '/', '', $f . '/');
$filename = basename($file);
$this->_list[$filename] = JHTML::_('select.option', $filepath . $filename, $filename);
$this->_images[$filename] = $uripath . '/' . $filepath . $filename;
if ($f !== $optgroup) {
$optgroup = $f;
}
}
}
ksort($this->_images);
ksort($this->_list);
//}
return $this->_list;
}
示例9: banner_names
/**
* Image names helper
* .
* @param array() | KConfig $config
*
* $config options
* name string column name of helper
* directory string image directory (relative to docroot)
* filetypes array allowd file type extensions
* deselect boolean show -select- option with 0 value
* preview boolean show preview directly below listbox
* selected string currently selected value
* attribs array associative array of listbox attributes
*
* see image_preview for image_preview options
*/
public function banner_names($config = array())
{
$config = new KConfig($config);
$config->append(array('name' => 'image_name', 'directory' => JPATH_IMAGES . '/banners', 'filetypes' => array('swf', 'gif', 'jpg', 'png'), 'deselect' => true, 'preview' => true, 'width' => '', 'height' => ''))->append(array('selected' => $config->{$config->name}))->append(array('attribs' => array('id' => $config->name, 'class' => 'inputbox')));
$root = KRequest::root() . str_replace(JPATH_ROOT, '', $config->directory);
$default = KRequest::root() . '/media/system/images/blank.png';
$name = $config->name;
if (in_array('swf', $config->filetypes->toArray())) {
JFactory::getDocument()->addScriptDeclaration("\n window.addEvent('domready', function(){\n var select = \$('{$name}'), image = \$('{$name}-preview'), flash = \$('{$name}-flash'), x = \$('{$name}-width'), y = \$('{$name}-height'),\n loadFlash = function() {\n new Swiff('{$root}/' + select.value, {\n id: flash.get('id')+'-movie',\n container: flash.get('id'),\n width: x.value || 150,\n height: y.value || 150\n });\n flash.setStyle('display', 'block');\n image.setStyle('display', 'none');\n },\n loadImage = function() {\n image.src = select.value ? ('{$root}/' + select.value) : '{$default}';\n image.setStyles({display: 'block', height: y.value.toInt(), width: x.value.toInt()});\n flash.setStyle('display', 'none');\n };\n \n \$\$(select, x, y).addEvent('change', function(){\n select.value.test('^(.+).swf\$') ? loadFlash() : loadImage();\n });\n \$('{$name}-update').addEvent('click', function(event){event.preventDefault()});\n });\n ");
} else {
JFactory::getDocument()->addScriptDeclaration("\n window.addEvent('domready', function(){\n \$('" . $config->name . "').addEvent('change', function(){\n var value = this.value ? ('" . $root . "/' + this.value) : '" . KRequest::root() . "/media/system/images/blank.png';\n \$('" . $config->name . "-preview').src = value;\n });\n });\n ");
}
if ($config->deselect) {
$options[] = $this->option(array('text' => '- ' . JText::_('Select') . ' -', 'value' => ''));
}
$files = array();
foreach (new DirectoryIterator($config->directory) as $file) {
if (in_array(pathinfo($file, PATHINFO_EXTENSION), $config->filetypes->toArray())) {
$files[] = (string) $file;
}
}
sort($files);
foreach ($files as $file) {
$options[] = $this->option(array('text' => (string) $file, 'value' => (string) $file));
}
$list = $this->optionlist(array('options' => $options, 'name' => $config->name, 'attribs' => $config->attribs, 'selected' => $config->selected));
if (in_array('swf', $config->filetypes->toArray())) {
$list .= ' <span>Banner size:</span> <label for="' . $config->name . '-width">' . JText::_('Width') . '</label>
<input class="inputbox" type="text" name="width"
id="' . $config->name . '-width" size="6"
value="' . $config->width . '" /> ' . '<label for="' . $config->name . '-height">' . JText::_('Height') . '</label>
<input class="inputbox" type="text" name="height"
id="' . $config->name . '-height" size="6"
value="' . $config->height . '" />' . "<button id=\"" . $config->name . "-update\">" . JText::_('update preview') . "</button>";
}
return $config->preview ? $list . '<br />' . $this->image_preview($config) : $list;
}
示例10: getView
/**
* Get the view object attached to the controller.
*
* @return LibBaseViewAbstract
*/
public function getView()
{
if (!$this->_view instanceof LibBaseViewAbstract) {
//Make sure we have a view identifier
if (!$this->_view instanceof KServiceIdentifier) {
$this->setView($this->_view);
}
//Create the view
$config = array('media_url' => KRequest::root() . '/media', 'base_url' => KRequest::url()->getUrl(KHttpUrl::BASE), 'state' => $this->getState());
if ($this->_request->has('layout')) {
$config['layout'] = $this->_request->get('layout');
}
$this->_view = $this->getService($this->_view, $config);
}
return $this->_view;
}
示例11: str_replace
?>
</h1>
</div>
<div class="row" style="margin-bottom: 20px;">
<div class="span5">
<?php
echo $business->description;
?>
</div>
<div class="span4">
<?php
if ($business->thumbnail) {
?>
<a rel="shadowbox[gallery]" href="<?php
echo KRequest::root() . str_replace(JPATH_ROOT, '', JPATH_IMAGES . '/businesses/' . $business->id . '.jpg');
?>
"><img style="border: 1px solid #DDDDDD;" src="<?php
echo $business->thumbnail;
?>
" ></a>
<?php
}
?>
</div>
</div>
<div class="row">
<div class="span5">
<table class="table">
<?php
示例12: __get
public function __get($column)
{
if ($column == 'image_path' && !isset($this->_data['image_path'])) {
return $this->image ? KRequest::root() . '/joomlatools-files/docman-images/' . $this->image : null;
}
if ($column == 'icon') {
if (!is_object($this->params)) {
$this->params = json_decode($this->params);
}
$icon = $this->params->icon ? $this->params->icon : 'icon:default.png';
return $icon;
}
if ($column == 'icon_path') {
$icon = $this->icon;
if (substr($icon, 0, 5) === 'icon:') {
$icon = '/joomlatools-files/docman-icons/' . substr($icon, 5);
} else {
$icon = '/media/com_docman/images/icons/' . $icon;
}
return KRequest::root() . $icon;
}
if ($column == 'storage' && !isset($this->_data['storage'])) {
return $this->getStorageInfo();
}
if (in_array($column, array('published', 'pending', 'expired'))) {
return $this->{'is' . ucfirst($column)}();
}
if ($column === 'status') {
return $this->isPublished() ? 'published' : ($this->isPending() ? 'pending' : 'expired');
}
if (in_array($column, array('size', 'mimetype', 'extension')) && $this->getStorageInfo()) {
return $this->storage->{$column};
}
if ($column == 'category') {
return $this->getService('com://admin/docman.model.categories')->id($this->docman_category_id)->getItem();
}
if ($column === 'description_summary') {
$description = $this->description;
$position = strpos($description, '<hr id="system-readmore" />');
if ($position !== false) {
return substr($description, 0, $position);
}
return $description;
}
if ($column === 'description_full') {
return str_replace('<hr id="system-readmore" />', '', $this->description);
}
return parent::__get($column);
}
示例13: thumbnail
public function thumbnail($config = array())
{
$config = new KConfig($config);
$config->append(array('images_root' => KRequest::root() . '/joomlatools-files/docman-images/', 'enable_automatic_thumbnail' => true, 'automatic_thumbnail' => false, 'automatic_thumbnail_text' => $this->translate('Automatically generate')));
//Don't cache automatic thumbnails
if (!$config->automatic_thumbnail) {
$config->automatic_thumbnail_image = false;
}
$value = $config->value;
if (!$value) {
$value = 'default.png';
}
if (substr($value, 0, 6) === 'image:') {
$value = substr($value, 6);
}
if ($config->enable_automatic_thumbnail) {
$html = '<div class="image-picker thumbnail-picker" style="margin-top: 5px">
<img
id="image-preview"
data-src="' . $value . '"
src="' . $config->images_root . $value . '"
onerror="this.src=\'media://com_docman/images/nothumbnail.png\';"
style="max-height:128px;max-width:128px;background:#EEE;margin:0"
/>
<div id="choose-thumbnail" class="dropdown btn-group" style="float:left;margin-left:5px">
<button class="btn choose-photo-button dropdown-toggle" id="profile_header_upload" type="button" data-toggle="dropdown"
style="float:none">
' . $this->translate('Change thumbnail') . '
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li id="automatic_thumbnail" class="dropdown-link">
<a href="#" class="dropdown-link" id="automatic_thumbnail">
<input style="display:none" type="checkbox" name="automatic_thumbnail" value="1"
' . ($config->automatic_thumbnail ? 'checked="checked"' : '') . '
/>
' . $this->translate('Automatically generate') . '
</a>
</li>
<li id="thumbnail-choose-existing" class="dropdown-link">
<div id="image-selector" class="image-selector">
' . $this->getTemplate()->renderHelper('modal.image', $config->toArray()) . '
</div>
</li>
<li class="divider"></li>
<li id="thumbnail-delete-image" class="pretty-link dropdown-link ">
<a href="#" class="dropdown-link btn" id="image-selector-clear">' . $this->translate('Clear') . '</a>
</li>
</ul>
<p class="help-inline automatic-enabled">' . $this->translate('Thumbnail is automatically generated.') . '</p>
<p class="help-inline automatic-unsupported-format">' . $this->translate('Automatically generated thumbnails are only supported on image files.') . '</p>
<p class="help-inline automatic-unsupported-location">' . $this->translate('Automatically generated thumbnails are only supported on local files') . '</p>
</div>
</div>';
} else {
$html = '<div class="image-picker thumbnail-picker" style="margin-top: 5px">
<img
id="image-preview"
data-src="' . $value . '"
src="' . $config->images_root . $value . '"
onerror="this.src=\'media://com_docman/images/nothumbnail.png\';"
style="max-height:128px;max-width:128px;background:#EEE;margin:0"
/>
<div id="choose-thumbnail" class="dropdown btn-group" style="float:left;margin-left:5px">
<button class="btn choose-photo-button dropdown-toggle" id="profile_header_upload" type="button" data-toggle="dropdown"
style="float:none">
' . $this->translate('Change thumbnail') . '
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li id="thumbnail-choose-existing" class="dropdown-link">
<div id="image-selector" class="image-selector">
' . $this->getTemplate()->renderHelper('modal.image', $config->toArray()) . '
</div>
</li>
<li class="divider"></li>
<li id="thumbnail-delete-image" class="pretty-link dropdown-link ">
<a href="#" class="dropdown-link btn" id="image-selector-clear">' . $this->translate('Clear') . '</a>
</li>
</ul>
</div>
</div>';
}
return $html;
}
示例14: defined
<?php
defined('KOOWA') or die('Restricted access');
?>
<script type="text/javascript">
jQuery(function($){
<?php
/* @route('view=post&tmpl=&format=json') fails on sites with SEF + URL suffixes turned on */
?>
var posts = $('.<?php
echo @id();
?>
'), url = '<?php
echo KRequest::root();
?>
/?option=com_ninjaboard&view=post&tmpl=&format=json', parts = [];
posts.click(function(event){
if($(event.target).hasClass('delete') && confirm(<?php
echo json_encode(@text("Are you sure you want to delete this post? This action cannot be undone."));
?>
)){
parts = event.currentTarget.id.split('-');
$(event.target).addClass('spinning');
event.preventDefault();
$.post(
url+'&id='+parts.pop(),
{
action: "delete",
示例15: _actionUpload
protected function _actionUpload()
{
if (!($destination = $this->getUploadDestination())) {
return;
}
jimport('joomla.filesystem.file');
$result = array();
$result['time'] = date('r');
$result['addr'] = substr_replace(gethostbyaddr($_SERVER['REMOTE_ADDR']), '******', 0, 6);
$result['agent'] = $_SERVER['HTTP_USER_AGENT'];
if (count($_GET)) {
$result['get'] = $_GET;
}
if (count($_POST)) {
$result['post'] = $_POST;
}
if (count($_FILES)) {
$result['files'] = $_FILES;
}
// Validation
$error = false;
if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name'])) {
$error = 'Invalid Upload';
}
// Processing
/**
* Its a demo, you would move or process the file like:
*
* move_uploaded_file($_FILES['Filedata']['tmp_name'], '../uploads/' . $_FILES['Filedata']['name']);
* $return['src'] = '/uploads/' . $_FILES['Filedata']['name'];
*
*/
$upload = $destination . $_FILES['Filedata']['name'];
$uploaddir = dirname(JPATH_ROOT . $destination . $_FILES['Filedata']['name']);
JFile::upload($_FILES['Filedata']['tmp_name'], $uploaddir . '/avatar.png');
KRequest::set('files.uploaded', dirname($upload) . '/avatar.png', 'string');
if ($error) {
$return = array('status' => '0', 'error' => $error);
} else {
$return = array('status' => '1', 'name' => $_FILES['Filedata']['name'], 'tmp_name' => $_FILES['Filedata']['tmp_name'], 'destination' => $destination, 'uploaded' => KRequest::root() . KRequest::get('files.uploaded', 'string'), 'test' => JPATH_ROOT . KRequest::get('files.uploaded', 'string'));
// Our processing, we get a hash value from the file
$return['hash'] = @md5_file(realpath(JPATH_ROOT . $destination . $_FILES['Filedata']['name']));
// ... and if available, we get image data
$info = @getimagesize(JPATH_ROOT . KRequest::get('files.uploaded', 'string'));
if ($info) {
$return['width'] = $info[0];
$return['height'] = $info[1];
$return['mime'] = $info['mime'];
}
}
// Output
/**
* Again, a demo case. We can switch here, for different showcases
* between different formats. You can also return plain data, like an URL
* or whatever you want.
*
* The Content-type headers are uncommented, since Flash doesn't care for them
* anyway. This way also the IFrame-based uploader sees the content.
*/
if (isset($_REQUEST['response']) && $_REQUEST['response'] == 'xml') {
// header('Content-type: text/xml');
// Really dirty, use DOM and CDATA section!
echo '<response>';
foreach ($return as $key => $value) {
echo "<{$key}><![CDATA[{$value}]]></{$key}>";
}
echo '</response>';
} else {
// header('Content-type: application/json');
echo json_encode($return);
}
//KFactory::get('lib.joomla.application')->close();
}