本文整理汇总了PHP中JObject::set方法的典型用法代码示例。如果您正苦于以下问题:PHP JObject::set方法的具体用法?PHP JObject::set怎么用?PHP JObject::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JObject
的用法示例。
在下文中一共展示了JObject::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* Method to get an array of data items.
*
* @return array An array of data items
*
* @since 12.2
*/
public function getItems()
{
jimport('joomla.filesystem.folder');
$items = array();
$files = JFolder::files(JDeveloperArchive::getArchiveDir());
$store = $this->getStoreId('getItems');
foreach ($files as $file) {
if (preg_match('/(^pkg_).*(.zip$)/', $file)) {
$item = new JObject();
$item->set('id', $file);
$item->set('name', $file);
$item->set('created', date("Y M d - H:i:s", filemtime(JDeveloperArchive::getArchiveDir() . DS . $file)));
$item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("pkg_", $item->name, $item->get("version", "1.0.0"));
$content = array();
if (!($zip = zip_open(JDeveloperArchive::getArchiveDir() . DS . $file))) {
throw new Exception("Failed to open {$file}");
}
while ($zip_entry = zip_read($zip)) {
if (preg_match('/.zip$/', zip_entry_name($zip_entry))) {
$content[] = zip_entry_name($zip_entry);
}
}
$item->set('content', implode('<br>', $content));
$items[] = $item;
}
}
// Add the items to the internal cache.
$this->cache['packages'] = $items;
return $this->cache['packages'];
}
示例2: onDisplay
/**
* Fired whenever a Joomla WYSIWYG Editor is displayed
* @param $name
* @return unknown_type
*/
function onDisplay($name)
{
$doc = JFactory::getDocument();
$doc->addStyleSheet(JURI::root(true) . '/plugins/editors-xtd/tienda/css/stylesheet.css');
$js = "\r\n\t\tfunction jSelectProducts(id, title, object) {\r\n\t\t\tvar layout = \$('product_layout').value;\r\n\t\t\tjInsertEditorText('{tiendaproduct id='+id+' layout='+layout+'}', '" . $name . "');\r\n\t\t\tdocument.getElementById('sbox-window').close();\r\n\t\t}";
$doc->addScriptDeclaration($js);
$form_id = JRequest::getVar('id');
$getContent = $this->_subject->getContent($name);
$link = 'index.php?option=com_tienda&task=elementproduct&tmpl=component&e_name=' . $name;
JHTML::_('behavior.modal');
$layout_html = '</a><select name="product_layout" id="product_layout">';
$layouts = array('View' => 'view', 'Add to Cart' => 'product_buy');
foreach ($layouts as $k => $l) {
$layout_html .= '<option value="' . $l . '">' . $k . '</option>';
}
$layout_html .= '</select>';
// Trick for showing extra html
$extrahtml = '{handler: \'iframe\', size: {x: 800, y: 500}}">' . JText::_('Tienda Product') . $layout_html . '<a style="display:none;';
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Tienda Product'));
$button->set('name', 'tiendaproduct');
$button->set('options', $extrahtml);
return $button;
}
示例3: onDisplay
/**
* Display the button
*
* @return array A four element array of (article_id, article_title, category_id, object)
*/
function onDisplay($name)
{
$app = JFactory::getApplication();
if (!$app->isAdmin()) {
return false;
}
$doc = JFactory::getDocument();
$doc->addStyleSheet(JURI::root() . 'plugins/editors-xtd/123rfbutton/assets/css/style.css');
$base_url = JURI::base();
if ($app->isAdmin()) {
$base_url = dirname($base_url);
}
// $current_url = 'index.php?'.$_SERVER['QUERY_STRING'];
$option = JRequest::getVar('option');
$view = JRequest::getVar('view', 'form');
$layout = JRequest::getVar('layout', 'edit', '');
if ($app->isAdmin()) {
$view = 'article';
} else {
if ($option != 'com_content') {
$view = 'form';
$layout = 'edit';
}
}
$url = '?option=com_ajax&plugin=123rf&format=html';
JHtml::_('behavior.modal');
$button = new JObject();
$button->class = 'btn';
$button->set('text', '123rf');
$button->set('link', $url);
$button->set('name', 'picture');
$button->set('modal', true);
$button->set('options', "{handler: 'iframe', size: {x: 1000, y: 600}, classWindow: 'ja123rf-window'}");
return $button;
}
示例4: addTag
function addTag()
{
$mainframe =& JFactory::getApplication();
$tag = JRequest::getString('tag');
$tag = str_replace('-', '', $tag);
$response = new JObject();
$response->set('name', $tag);
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'JSON.php';
$json = new Services_JSON();
if (empty($tag)) {
$response->set('msg', JText::_('You need to enter a tag!', true));
echo $json->encode($response);
$mainframe->close();
}
$db =& JFactory::getDBO();
$query = "SELECT COUNT(*) FROM #__k2_tags WHERE name=" . $db->Quote($tag);
$db->setQuery($query);
$result = $db->loadResult();
if ($result > 0) {
$response->set('msg', JText::_('Tag already exists!', true));
echo $json->encode($response);
$mainframe->close();
}
$row =& JTable::getInstance('K2Tag', 'Table');
$row->name = $tag;
$row->published = 1;
$row->store();
$cache =& JFactory::getCache('com_k2');
$cache->clean();
$response->set('id', $row->id);
$response->set('status', 'success');
$response->set('msg', JText::_('Tag added to available tags list!', true));
echo $json->encode($response);
$mainframe->close();
}
示例5: onDisplay
function onDisplay($name)
{
/*
* Javascript to insert the link
* View element calls jSelectArticle when an article is clicked
* jSelectArticle creates the link tag, sends it to the editor,
* and closes the select frame.
*/
$js = "\n\t\tfunction jSelectPerson(id, title, appid, apptitle, treeid) {\n\t\t\tvar tag = '{joaktree person|' + appid + '|' + id + '|extended}';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
JHtml::_('behavior.modal');
/*
* Use the built-in element view to select the article.
* Currently uses blank class.
*/
$link = 'index.php?option=com_joaktree&view=jt_persons&layout=element&select=1&tmpl=component&' . JSession::getFormToken() . '=1';
$button = new JObject();
$button->set('modal', true);
$button->class = 'btn';
$button->set('link', $link);
$button->set('text', JText::_('PLG_JOAKTREE_BUTTON_PERSONLINK'));
$button->set('name', 'person_link');
$button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
return $button;
}
示例6: render
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function render($name)
{
$mainframe =& JFactory::getApplication();
$button = new JObject();
if ($mainframe->isSite()) {
$enable_frontend = $this->params->enable_frontend;
if (!$enable_frontend) {
return $button;
}
}
JHTML::_('behavior.modal');
$document =& JFactory::getDocument();
$button_style = 'modulesanywhere';
if (!$this->params->button_icon) {
$button_style = 'blank blank_modulesanywhere';
}
$document->addStyleSheet(JURI::root(true) . '/plugins/editors-xtd/modulesanywhere/css/style.css');
$link = 'index.php?nn_qp=1' . '&folder=plugins.editors-xtd.modulesanywhere' . '&file=modulesanywhere.inc.php' . '&name=' . $name;
$text = JText::_(str_replace(' ', '_', $this->params->button_text));
if ($text == str_replace(' ', '_', $this->params->button_text)) {
$text = JText::_($this->params->button_text);
}
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', $text);
$button->set('name', $button_style);
$button->set('options', "{handler: 'iframe', size: {x:window.getSize().x-100, y: window.getSize().y-100}}");
return $button;
}
示例7: onDisplay
/**
* Display the button
*
* @return array A four element array of (article_id, article_title, category_id, object)
*/
function onDisplay($name)
{
/*
* Javascript to insert the link
* View element calls jSelectArticle when an article is clicked
* jSelectArticle creates the link tag, sends it to the editor,
* and closes the select frame.
*/
$js = "\n\t\tfunction jSelectArticle(id, title, catid, object) {\n\t\t\tvar tag = '<a href='+'\"index.php?option=com_content&view=article&catid='+catid+'&id='+id+'\">'+title+'</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
JHtml::_('behavior.modal');
/*
* Use the built-in element view to select the article.
* Currently uses blank class.
*/
$link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component';
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('PLG_ARTICLE_BUTTON_ARTICLE'));
$button->set('name', 'article');
$button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
return $button;
}
示例8: JObject
function _loadData()
{
global $mainframe;
// Lets load the content if it doesn't already exist
if (empty($this->_data)) {
// Lets load the content if it doesn't already exist
if (empty($this->_data)) {
$query = 'SELECT p.filename as filename' . ' FROM #__phocagallery AS p' . ' WHERE p.id = ' . (int) $this->_id;
$this->_db->setQuery($query);
$filename_object = $this->_db->loadObject();
//Get Folder settings and File resize settings
$path = PhocaGalleryHelper::getPathSet();
$file = new JObject();
//Create thumbnail if it doesn't exists but originalfile must exist
$orig_path = $path['orig_abs_ds'];
$refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryd&tmpl=component&cid[]=' . $this->_id;
//Creata thumbnails if not exist
PhocaGalleryHelper::getOrCreateThumbnail($orig_path, $filename_object->filename, $refresh_url, 1, 1, 1);
jimport('joomla.filesystem.file');
if (!isset($filename_object->filename)) {
$file->set('linkthumbnailpath', '');
} else {
$thumbnail_file = PhocaGalleryHelper::getThumbnailName($filename_object->filename, 'large');
$file->set('linkthumbnailpath', $thumbnail_file['rel']);
}
}
if (isset($file)) {
$this->_data = $file;
} else {
$this->_data = '';
}
return (bool) $this->_data;
}
return true;
}
示例9: onDisplay
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$params =& JComponentHelper::getParams('com_admirorgallery');
$doc =& JFactory::getDocument();
$doc->addStyleSheet(JURI::root() . 'administrator/components/com_admirorgallery/templates/default/css/add-trigger.css');
$doc->addScript(JURI::root() . 'plugins/content/AdmirorGallery/AG_jQuery.js');
$doc->addScriptDeclaration(" \n\t\tfunction buttonTestClick(txt) {\n\t\t if(!txt) return;\n\t\t jInsertEditorText(txt, '" . $name . "');\n\t\t}\n\t\t");
$template = $mainframe->getTemplate();
$app =& JFactory::getApplication();
$link = 'index.php?option=com_admirorgallery&view=button&tmpl=component&e_name=' . $name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
// modal dialog
$button->set('link', $link);
//link to open on click
$button->set('text', JText::_('Admiror Gallery'));
//button text
$button->set('name', 'admirorgallery');
//div class
$button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}");
//need to work
return $button;
}
示例10: onDisplay
function onDisplay($name)
{
$document = JFactory::getDocument();
if (version_compare(JVERSION, '3.0', 'lt')) {
$document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js');
} else {
JHtml::_('jquery.framework');
}
$document->addScript(JURI::root(true) . '/administrator/components/com_sigpro/js/fancybox/jquery.fancybox.pack.js?v=3.0.5');
$document->addStyleSheet(JURI::root(true) . '/administrator/components/com_sigpro/js/fancybox/jquery.fancybox.css?v=3.0.5');
$document->addStyleSheet(JURI::root(true) . '/administrator/components/com_sigpro/css/editor.css?v=3.0.5');
if (version_compare(JVERSION, '3.0', 'lt')) {
$option = JRequest::getCmd('option');
if ($option == 'com_virtuemart' || $option == 'com_tienda' || $option == 'com_k2') {
$document->addScript(JURI::root(true) . '/administrator/components/com_sigpro/js/jquery.noconflict.restore.js?v=3.0.5');
} else {
$document->addScript(JURI::root(true) . '/administrator/components/com_sigpro/js/jquery.noconflict.js?v=3.0.5');
}
}
$document->addScript(JURI::root(true) . '/administrator/components/com_sigpro/js/editor.js?v=3.0.5');
$button = new JObject();
$link = 'index.php?option=com_sigpro&tmpl=component&type=site&editorName=' . $name;
$application = JFactory::getApplication();
if ($application->isSite()) {
$link .= '&template=system';
}
$button->set('link', $link);
$button->set('text', JText::_('PLG_EDITORS-XTD_JW_SIGPRO_IMAGE_GALLERIES'));
$button->set('name', 'sigProEditorButton');
$button->set('onclick', 'SigProModal(this); return false;');
if (version_compare(JVERSION, '3.0', 'ge')) {
$button->class = 'btn';
}
return $button;
}
示例11: onDisplay
/**
* Display the button
*
* @return array A two element array of (imageName, textToInsert)
*/
function onDisplay($name)
{
$app =& JFactory::getApplication();
$params =& JComponentHelper::getParams('com_media');
$ranks = array('publisher', 'editor', 'author', 'registered');
$acl =& JFactory::getACL();
// TODO: Fix this ACL call
//for($i = 0; $i < $params->get('allowed_media_usergroup', 3); $i++)
//{
// $acl->addACL('com_media', 'popup', 'users', $ranks[$i]);
//}
// TODO: Fix this ACL call
//Make sure the user is authorized to view this page
$user =& JFactory::getUser();
if (!$user->authorize('com_media.popup')) {
//return;
}
$doc =& JFactory::getDocument();
$template = $app->getTemplate();
$link = 'index.php?option=com_media&view=images&tmpl=component&e_name=' . $name;
JHtml::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Image'));
$button->set('name', 'image');
$button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}");
return $button;
}
示例12: render
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function render($name)
{
$mainframe =& JFactory::getApplication();
$button = new JObject();
if ($mainframe->isSite()) {
$enable_frontend = $this->params->enable_frontend;
if (!$enable_frontend) {
return $button;
}
}
$this->params->tag_open = preg_replace('#[^a-z0-9-_]#s', '', $this->params->tag_open);
$this->params->tag_close = preg_replace('#[^a-z0-9-_]#s', '', $this->params->tag_close);
$this->params->tag_delimiter = $this->params->tag_delimiter == 'space' ? ' ' : '=';
$text = '{' . $this->params->tag_open . $this->params->tag_delimiter . JText::_('TBR_TITLE') . ' 1}\\n' . '<p>' . JText::_('TBR_TEXT') . '</p>\\n' . '<p>{' . $this->params->tag_open . $this->params->tag_delimiter . JText::_('TBR_TITLE') . ' 2}</p>\\n' . '<p>' . JText::_('TBR_TEXT') . '</p>\\n' . '<p>{/' . $this->params->tag_close . '}</p>';
$text = str_replace('\\\\n', '\\n', addslashes($text));
$text = str_replace('{', '{\'+\'', $text);
$document =& JFactory::getDocument();
$js = "\n\t\t\tfunction insertTabber(editor) {\n\t\t\t\tjInsertEditorText('" . $text . "', editor);\n\t\t\t}\n\t\t";
$document->addScriptDeclaration($js);
$button_style = 'tabber';
if (!$this->params->button_icon) {
$button_style = 'blank blank_tabber';
}
$document->addStyleSheet(JURI::root(true) . '/plugins/editors-xtd/tabber/css/style.css');
$text = JText::_(str_replace(' ', '_', $this->params->button_text));
if ($text == str_replace(' ', '_', $this->params->button_text)) {
$text = JText::_($this->params->button_text);
}
$button->set('modal', false);
$button->set('link', '#');
$button->set('onclick', 'insertTabber(\'' . $name . '\');return false;');
$button->set('text', $text);
$button->set('name', $button_style);
return $button;
}
示例13: onDisplay
function onDisplay($name)
{
$js = "\r\n\t\tfunction oziofunction(menu_id) {\r\n\t\t\tvar tag = '{oziogallery ' + menu_id + '}';\r\n\t\t\tjInsertEditorText(tag, '" . $name . "');\r\n\t\t\tSqueezeBox.close();\r\n\t\t}";
require_once JPATH_SITE . "/components/com_oziogallery3/oziogallery.inc";
$style = "";
$postfix = "";
if (!$GLOBALS["oziogallery3"]["registered"]) {
$style = ".button2-left .oziogallery a { color: #f03030; }";
$postfix = " (Unregistered)";
}
$document = JFactory::getDocument();
$document->addScriptDeclaration($js);
$document->addStyleSheet(JUri::root(true) . "/plugins/" . $this->_type . "/" . $this->_name . "/css/style.css");
$document->addStyleDeclaration($style);
JHtml::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->class = 'btn';
$application = JFactory::getApplication();
$prefix = 'administrator/';
if ($application->isAdmin()) {
$prefix = '';
}
$button->set('link', $prefix . 'index.php?option=com_oziogallery3&view=galleries&layout=modal&tmpl=component&function=oziofunction');
$button->set('text', JText::_('BTN_OZIOGALLERY_BUTTON_LABEL') . $postfix);
$button->set('name', 'camera');
$button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
return $button;
}
示例14: getActions
/**
* Получаем доступы для действий.
*
* @param int $categoryId Id категории.
* @param int $messageId Id сообщения.
*
* @return object
*/
public static function getActions($categoryId = 0, $messageId = 0)
{
// Определяем имя ассета (ресурса).
if (empty($messageId) && empty($categoryId)) {
$assetName = 'com_helloworld';
$section = 'component';
} elseif (empty($messageId)) {
$assetName = 'com_helloworld.category.' . (int) $categoryId;
$section = 'category';
} else {
$assetName = 'com_helloworld.message.' . (int) $messageId;
$section = 'message';
}
if (empty(self::$actions)) {
// Получаем список доступных действий для компонента.
$accessFile = JPATH_ADMINISTRATOR . '/components/com_helloworld/access.xml';
$actions = JAccess::getActionsFromFile($accessFile, "/access/section[@name='" . $section . "']/");
// Для сообщения и категорий добавляем действие core.admin.
if ($section == 'category' || $section == 'message') {
$adminAction = new stdClass();
$adminAction->name = 'core.admin';
array_push($actions, $adminAction);
}
self::$actions = new JObject();
foreach ($actions as $action) {
// Устанавливаем доступы пользователя для действий.
self::$actions->set($action->name, JFactory::getUser()->authorise($action->name, $assetName));
}
}
return self::$actions;
}
示例15: _loadSettings
/**
* Returns a singleton with all settings
*
* @return JObject - loads a singleton object with all settings
*/
private static function _loadSettings()
{
$db = JFactory::getDBO();
$settings = new JObject();
$query = ' SELECT st.title, st.value' . ' FROM #__matukio_settings AS st' . ' ORDER BY st.id';
$db->setQuery($query);
$data = $db->loadObjectList();
foreach ($data as $value) {
$settings->set($value->title, $value->value);
}
// Grab the settings from the menu and merge them in the object
$app = JFactory::getApplication();
$menu = $app->getMenu();
if (is_object($menu)) {
if ($item = $menu->getActive()) {
$menuParams = $menu->getParams($item->id);
foreach ($menuParams->toArray() as $key => $value) {
if ($key == 'show_page_heading') {
$key = 'show_page_title';
}
$settings->set($key, $value);
}
}
}
return $settings;
}