本文整理汇总了PHP中Lang::getTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::getTag方法的具体用法?PHP Lang::getTag怎么用?PHP Lang::getTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::getTag方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Method to get the lang tag
* @return string lang iso tag
*/
function &getLangTag()
{
if (is_null($this->lang_tag)) {
$this->lang_tag = Lang::getTag();
if (!Filesystem::exists(JPATH_BASE . '/help/' . $this->lang_tag)) {
$this->lang_tag = 'en-GB';
// use english as fallback
}
}
return $this->lang_tag;
}
示例2: onContentBeforeDisplay
/**
* @since 1.6
*/
public function onContentBeforeDisplay($context, &$row, &$params, $page = 0)
{
$view = Request::getCmd('view');
$print = Request::getBool('print');
if ($print) {
return false;
}
if ($params->get('show_item_navigation') && $context == 'com_content.article' && $view == 'article') {
$html = '';
$db = App::get('db');
$nullDate = $db->getNullDate();
$date = Date::of('now');
$now = $date->toSql();
$uid = $row->id;
$option = 'com_content';
$canPublish = User::authorise('core.edit.state', $option . '.article.' . $row->id);
// The following is needed as different menu items types utilise a different param to control ordering.
// For Blogs the `orderby_sec` param is the order controlling param.
// For Table and List views it is the `orderby` param.
$params_list = $params->toArray();
if (array_key_exists('orderby_sec', $params_list)) {
$order_method = $params->get('orderby_sec', '');
} else {
$order_method = $params->get('orderby', '');
}
// Additional check for invalid sort ordering.
if ($order_method == 'front') {
$order_method = '';
}
// Determine sort order.
switch ($order_method) {
case 'date':
$orderby = 'a.created';
break;
case 'rdate':
$orderby = 'a.created DESC';
break;
case 'alpha':
$orderby = 'a.title';
break;
case 'ralpha':
$orderby = 'a.title DESC';
break;
case 'hits':
$orderby = 'a.hits';
break;
case 'rhits':
$orderby = 'a.hits DESC';
break;
case 'order':
$orderby = 'a.ordering';
break;
case 'author':
$orderby = 'a.created_by_alias, u.name';
break;
case 'rauthor':
$orderby = 'a.created_by_alias DESC, u.name DESC';
break;
case 'front':
$orderby = 'f.ordering';
break;
default:
$orderby = 'a.ordering';
break;
}
$xwhere = ' AND (a.state = 1 OR a.state = -1)' . ' AND (publish_up = ' . $db->Quote($nullDate) . ' OR publish_up <= ' . $db->Quote($now) . ')' . ' AND (publish_down = ' . $db->Quote($nullDate) . ' OR publish_down >= ' . $db->Quote($now) . ')';
// Array of articles in same category correctly ordered.
$query = $db->getQuery(true);
//sqlsrv changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('cc.alias');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('cc.id');
$case_when1 .= $query->concatenate(array($c_id, 'cc.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select('a.id, a.language,' . $case_when . ',' . $case_when1);
$query->from('#__content AS a');
$query->leftJoin('#__categories AS cc ON cc.id = a.catid');
$query->where('a.catid = ' . (int) $row->catid . ' AND a.state = ' . (int) $row->state . ($canPublish ? '' : ' AND a.access = ' . (int) $row->access) . $xwhere);
$query->order($orderby);
if (\App::isSite() && \App::get('language.filter')) {
$query->where('a.language in (' . $db->quote(Lang::getTag()) . ',' . $db->quote('*') . ')');
}
$db->setQuery($query);
$list = $db->loadObjectList('id');
// This check needed if incorrect Itemid is given resulting in an incorrect result.
if (!is_array($list)) {
$list = array();
}
//.........这里部分代码省略.........
示例3: onAfterInitialise
public function onAfterInitialise()
{
$app = JFactory::getApplication();
$app->menu_associations = $this->params->get('menu_associations', 0);
if (App::isSite()) {
self::$tag = Lang::getTag();
$router = $app->getRouter();
// attach build rules for language SEF
$router->attachBuildRule(array($this, 'buildRule'));
// attach parse rules for language SEF
$router->attachParseRule(array($this, 'parseRule'));
// Adding custom site name
$languages = JLanguageHelper::getLanguages('lang_code');
if (isset($languages[self::$tag]) && $languages[self::$tag]->sitename) {
Config::set('sitename', $languages[self::$tag]->sitename);
}
}
}
示例4: getListQuery
/**
* Get the master query for retrieving a list of articles subject to the model state.
*
* @return JDatabaseQuery
* @since 1.6
*/
function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select($this->getState('list.select', 'a.id, a.title, a.alias, a.title_alias, a.introtext, a.language, ' . 'a.checked_out, a.checked_out_time, ' . 'a.catid, a.created, a.created_by, a.created_by_alias, ' . 'CASE WHEN a.modified = 0 THEN a.created ELSE a.modified END as modified, ' . 'a.modified_by, uam.name as modified_by_name,' . 'CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END as publish_up,' . 'a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, ' . 'a.hits, a.xreference, a.featured,' . ' ' . $query->length('a.fulltext') . ' AS readmore'));
// Process an Archived Article layout
if ($this->getState('filter.published') == 2) {
// If badcats is not null, this means that the article is inside an archived category
// In this case, the state is set to 2 to indicate Archived (even if the article state is Published)
$query->select($this->getState('list.select', 'CASE WHEN badcats.id is null THEN a.state ELSE 2 END AS state'));
} else {
// Process non-archived layout
// If badcats is not null, this means that the article is inside an unpublished category
// In this case, the state is set to 0 to indicate Unpublished (even if the article state is Published)
$query->select($this->getState('list.select', 'CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state'));
}
$query->from('#__content AS a');
// Join over the frontpage articles.
if ($this->context != 'com_content.featured') {
$query->join('LEFT', '#__content_frontpage AS fp ON fp.content_id = a.id');
}
// Join over the categories.
$query->select('c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias');
$query->join('LEFT', '#__categories AS c ON c.id = a.catid');
// Join over the users for the author and modified_by names.
$query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author");
$query->select("ua.email AS author_email");
$query->join('LEFT', '#__users AS ua ON ua.id = a.created_by');
$query->join('LEFT', '#__users AS uam ON uam.id = a.modified_by');
// Get contact id
$subQuery = $db->getQuery(true);
$subQuery->select('MAX(contact.id) AS id');
$subQuery->from('#__contact_details AS contact');
$subQuery->where('contact.published = 1');
$subQuery->where('contact.user_id = a.created_by');
// Filter by language
if ($this->getState('filter.language')) {
$subQuery->where('(contact.language in (' . $db->quote(Lang::getTag()) . ',' . $db->quote('*') . ') OR contact.language IS NULL)');
}
// [!] Hubzero - Removed contact_details table
//$query->select('(' . $subQuery . ') as contactid');
$query->select('(0) as contactid');
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias');
$query->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
// Join on voting table
$query->select('ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count');
$query->join('LEFT', '#__content_rating AS v ON a.id = v.content_id');
// Join to check for category published state in parent categories up the tree
$query->select('c.published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published');
$subquery = 'SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
$subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
$subquery .= 'WHERE parent.extension = ' . $db->quote('com_content');
if ($this->getState('filter.published') == 2) {
// Find any up-path categories that are archived
// If any up-path categories are archived, include all children in archived layout
$subquery .= ' AND parent.published = 2 GROUP BY cat.id ';
// Set effective state to archived if up-path category is archived
$publishedWhere = 'CASE WHEN badcats.id is null THEN a.state ELSE 2 END';
} else {
// Find any up-path categories that are not published
// If all categories are published, badcats.id will be null, and we just use the article state
$subquery .= ' AND parent.published != 1 GROUP BY cat.id ';
// Select state to unpublished if up-path category is unpublished
$publishedWhere = 'CASE WHEN badcats.id is null THEN a.state ELSE 0 END';
}
$query->join('LEFT OUTER', '(' . $subquery . ') AS badcats ON badcats.id = c.id');
// Filter by access level.
if ($access = $this->getState('filter.access')) {
$groups = implode(',', User::getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
$query->where('c.access IN (' . $groups . ')');
}
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published)) {
// Use article state if badcats.id is null, otherwise, force 0 for unpublished
$query->where($publishedWhere . ' = ' . (int) $published);
} elseif (is_array($published)) {
\Hubzero\Utility\Arr::toInteger($published);
$published = implode(',', $published);
// Use article state if badcats.id is null, otherwise, force 0 for unpublished
$query->where($publishedWhere . ' IN (' . $published . ')');
}
// Filter by featured state
$featured = $this->getState('filter.featured');
switch ($featured) {
case 'hide':
$query->where('a.featured = 0');
break;
case 'only':
$query->where('a.featured = 1');
//.........这里部分代码省略.........
示例5: pages
/**
* Get array of help pages for component
*
* @param string $component Component to get pages for
* @return array
*/
public static function pages($component)
{
$database = \App::get('db');
// Get component name from database
$database->setQuery("SELECT `name`\n\t\t\tFROM `#__extensions`\n\t\t\tWHERE `type`=" . $database->quote('component') . "\n\t\t\tAND `element`=" . $database->quote($component) . "\n\t\t\tAND `enabled`=1");
$name = $database->loadResult();
// Make sure we have a component
if ($name == '') {
$name = str_replace('com_', '', $component);
return array('name' => ucfirst($name), 'option' => $component, 'pages' => array());
}
// Path to help pages
$helpPagesPath = self::path($component) . DS . 'help' . DS . \Lang::getTag();
// Make sure directory exists
$pages = array();
if (is_dir($helpPagesPath)) {
// Get help pages for this component
$pages = \Filesystem::files($helpPagesPath, '.' . self::$ext);
}
$pages = array_map(function ($file) {
return ltrim($file, DS);
}, $pages);
// Return pages
return array('name' => $name, 'option' => $component, 'pages' => $pages);
}
示例6: getListQuery
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
* @since 1.6
*/
protected function getListQuery()
{
$user = User::getRoot();
$groups = implode(',', $user->getAuthorisedViewLevels());
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select required fields from the categories.
$query->select($this->getState('list.select', 'a.*'));
$query->from($db->quoteName('#__newsfeeds') . ' AS a');
$query->where('a.access IN (' . $groups . ')');
// Filter by category.
if ($categoryId = $this->getState('category.id')) {
$query->where('a.catid = ' . (int) $categoryId);
$query->join('LEFT', '#__categories AS c ON c.id = a.catid');
$query->where('c.access IN (' . $groups . ')');
}
// Filter by state
$state = $this->getState('filter.published');
if (is_numeric($state)) {
$query->where('a.published = ' . (int) $state);
}
// Filter by start and end dates.
$nullDate = $db->Quote($db->getNullDate());
$date = Date::of('now');
$nowDate = $db->Quote($date->format($db->getDateFormat()));
if ($this->getState('filter.publish_date')) {
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')');
$query->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
}
// Filter by language
if ($this->getState('filter.language')) {
$query->where('a.language in (' . $db->Quote(Lang::getTag()) . ',' . $db->Quote('*') . ')');
}
// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
return $query;
}
示例7: _load
/**
* Load login modules.
*
* Note that we load regardless of state or access level since access
* for public is the only thing that makes sense since users are not logged in
* and the module lets them log in.
* This is put in as a failsafe to avoid super user lock out caused by an unpublished
* login module or by a module set to have a viewing access level that is not Public.
*
* @param string $name The name of the module
* @return array
*/
protected static function _load($module)
{
static $clean;
if (isset($clean)) {
return $clean;
}
$lang = \Lang::getTag();
$clientId = (int) \App::get('client')->id;
$cache = \App::get('cache');
$cacheid = 'com_modules.' . md5(serialize(array($clientId, $lang)));
$loginmodule = array();
try {
$clean = $cache->get($cacheid);
} catch (\Exception $e) {
$clean = null;
}
if (!$clean) {
$db = \App::get('db');
$query = $db->getQuery(true);
$query->select('m.id, m.title, m.module, m.position, m.showtitle, m.params');
$query->from('#__modules AS m');
$query->where('m.module =' . $db->Quote($module) . ' AND m.client_id = 1');
$query->join('LEFT', '#__extensions AS e ON e.element = m.module AND e.client_id = m.client_id');
$query->where('e.enabled = 1');
// Filter by language
if (\App::isSite() && \App::get('language.filter')) {
$query->where('m.language IN (' . $db->Quote($lang) . ',' . $db->Quote('*') . ')');
}
$query->order('m.position, m.ordering');
// Set the query
$db->setQuery($query);
$modules = $db->loadObjectList();
if ($db->getErrorNum()) {
\App::abort(500, \Lang::txt('JLIB_APPLICATION_ERROR_MODULE_LOAD', $db->getErrorMsg()));
return $loginmodule;
}
// Return to simple indexing that matches the query order.
$loginmodule = $modules;
$cache->put($cacheid, $loginmodule, App::get('config')->get('cachetime', 15));
}
return $loginmodule;
}
示例8: onInit
/**
* Initialises the Editor.
*
* @return string JavaScript Initialization string
*/
public function onInit()
{
$mode = (int) $this->params->get('mode', 1);
$theme = array('simple', 'advanced', 'advanced');
$skin = $this->params->get('skin', '0');
switch ($skin) {
case '3':
$skin = 'skin : "o2k7", skin_variant : "black",';
break;
case '2':
$skin = 'skin : "o2k7", skin_variant : "silver",';
break;
case '1':
$skin = 'skin : "o2k7",';
break;
case '0':
default:
$skin = 'skin : "default",';
}
$entity_encoding = $this->params->def('entity_encoding', 'raw');
$langMode = $this->params->def('lang_mode', 0);
$langPrefix = $this->params->def('lang_code', 'en');
if ($langMode) {
$langPrefix = substr(Lang::getTag(), 0, strpos(Lang::getTag(), '-'));
}
$text_direction = 'ltr';
if ($language->isRTL()) {
$text_direction = 'rtl';
}
$use_content_css = $this->params->def('content_css', 1);
$content_css_custom = $this->params->def('content_css_custom', '');
// Lets get the default template for the site application
$db = App::get('db');
$query = $db->getQuery(true);
$query->select('template');
$query->from('#__template_styles');
$query->where('client_id=0 AND home=1');
$db->setQuery($query);
$template = $db->loadResult();
$content_css = '';
$templates_path = PATH_ROOT . '/templates';
// loading of css file for 'styles' dropdown
if ($content_css_custom) {
// If URL, just pass it to $content_css
if (strpos($content_css_custom, 'http') !== false) {
$content_css = 'content_css : "' . $content_css_custom . '",';
} else {
$content_css = 'content_css : "' . Request::root() . 'templates/' . $template . '/css/' . $content_css_custom . '",';
// Issue warning notice if the file is not found (but pass name to $content_css anyway to avoid TinyMCE error
if (!file_exists($templates_path . '/' . $template . '/css/' . $content_css_custom)) {
$msg = sprintf(Lang::txt('PLG_TINY_ERR_CUSTOMCSSFILENOTPRESENT'), $content_css_custom);
Notify::warning($msg);
}
}
} else {
// process when use_content_css is Yes and no custom file given
if ($use_content_css) {
// first check templates folder for default template
// if no editor.css file in templates folder, check system template folder
if (!file_exists($templates_path . '/' . $template . '/css/editor.css')) {
$template = 'system';
// if no editor.css file in system folder, show alert
if (!file_exists($templates_path . '/system/css/editor.css')) {
Notify::warning(Lang::txt('PLG_TINY_ERR_EDITORCSSFILENOTPRESENT'));
} else {
$content_css = 'content_css : "' . Request::root() . 'templates/system/css/editor.css",';
}
} else {
$content_css = 'content_css : "' . Request::root() . 'templates/' . $template . '/css/editor.css",';
}
}
}
$relative_urls = $this->params->def('relative_urls', '1');
if ($relative_urls) {
// relative
$relative_urls = "true";
} else {
// absolute
$relative_urls = "false";
}
$newlines = $this->params->def('newlines', 0);
if ($newlines) {
// br
$forcenewline = "force_br_newlines : true, force_p_newlines : false, forced_root_block : '',";
} else {
// p
$forcenewline = "force_br_newlines : false, force_p_newlines : true, forced_root_block : 'p',";
}
$invalid_elements = $this->params->def('invalid_elements', 'script,applet,iframe');
$extended_elements = $this->params->def('extended_elements', '');
// theme_advanced_* settings
$toolbar = $this->params->def('toolbar', 'top');
$toolbar_align = $this->params->def('toolbar_align', 'left');
$html_height = $this->params->def('html_height', '550');
$html_width = $this->params->def('html_width', '750');
//.........这里部分代码省略.........
示例9: _getLanguage
/**
* Get the language tag or a custom translation
*
* @return string
*
* @since 2.5
*/
private function _getLanguage()
{
$tag = explode('-', Lang::getTag());
$tag = $tag[0];
$available = array('en', 'pt', 'fr', 'de', 'nl', 'ru', 'es', 'tr');
if (in_array($tag, $available)) {
return "lang : '" . $tag . "',";
}
// If the default language is not available, let's search for a custom translation
if ($language->hasKey('PLG_RECAPTCHA_CUSTOM_LANG')) {
$custom[] = 'custom_translations : {';
$custom[] = "\t" . 'instructions_visual : "' . Lang::txt('PLG_RECAPTCHA_INSTRUCTIONS_VISUAL') . '",';
$custom[] = "\t" . 'instructions_audio : "' . Lang::txt('PLG_RECAPTCHA_INSTRUCTIONS_AUDIO') . '",';
$custom[] = "\t" . 'play_again : "' . Lang::txt('PLG_RECAPTCHA_PLAY_AGAIN') . '",';
$custom[] = "\t" . 'cant_hear_this : "' . Lang::txt('PLG_RECAPTCHA_CANT_HEAR_THIS') . '",';
$custom[] = "\t" . 'visual_challenge : "' . Lang::txt('PLG_RECAPTCHA_VISUAL_CHALLENGE') . '",';
$custom[] = "\t" . 'audio_challenge : "' . Lang::txt('PLG_RECAPTCHA_AUDIO_CHALLENGE') . '",';
$custom[] = "\t" . 'refresh_btn : "' . Lang::txt('PLG_RECAPTCHA_REFRESH_BTN') . '",';
$custom[] = "\t" . 'help_btn : "' . Lang::txt('PLG_RECAPTCHA_HELP_BTN') . '",';
$custom[] = "\t" . 'incorrect_try_again : "' . Lang::txt('PLG_RECAPTCHA_INCORRECT_TRY_AGAIN') . '",';
$custom[] = '},';
$custom[] = "lang : '" . $tag . "',";
return implode("\n", $custom);
}
// If nothing helps fall back to english
return '';
}
示例10: array
/**
* Method to get article data.
*
* @param integer The id of the article.
*
* @return mixed Menu item data object on success, false on failure.
*/
public function &getItem($pk = null)
{
// Initialise variables.
$pk = !empty($pk) ? $pk : (int) $this->getState('article.id');
if ($this->_item === null) {
$this->_item = array();
}
if (!isset($this->_item[$pk])) {
try {
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select($this->getState('item.select', 'a.id, a.asset_id, a.title, a.alias, a.title_alias, a.introtext, a.fulltext, ' . 'CASE WHEN badcats.id is null THEN a.state ELSE 0 END AS state, ' . 'a.mask, a.catid, a.created, a.created_by, a.created_by_alias, ' . 'CASE WHEN a.modified = 0 THEN a.created ELSE a.modified END as modified, ' . 'a.modified_by, a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, ' . 'a.images, a.urls, a.attribs, a.version, a.parentid, a.ordering, ' . 'a.metakey, a.metadesc, a.access, a.hits, a.metadata, a.featured, a.language, a.xreference'));
$query->from('#__content AS a');
// Join on category table.
$query->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access');
$query->join('LEFT', '#__categories AS c on c.id = a.catid');
// Join on user table.
$query->select('u.name AS author');
$query->join('LEFT', '#__users AS u on u.id = a.created_by');
// Get contact id
$subQuery = $db->getQuery(true);
$subQuery->select('MAX(contact.id) AS id');
$subQuery->from('#__contact_details AS contact');
$subQuery->where('contact.published = 1');
$subQuery->where('contact.user_id = a.created_by');
// Filter by language
if ($this->getState('filter.language')) {
$subQuery->where('(contact.language in (' . $db->quote(Lang::getTag()) . ',' . $db->quote('*') . ') OR contact.language IS NULL)');
}
// [!] Hubzero - Removed contact_details table
//$query->select('(' . $subQuery . ') as contactid');
$query->select('(0) as contactid');
// Filter by language
if ($this->getState('filter.language')) {
$query->where('a.language in (' . $db->quote(Lang::getTag()) . ',' . $db->quote('*') . ')');
}
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias');
$query->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
// Join on voting table
$query->select('ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count');
$query->join('LEFT', '#__content_rating AS v ON a.id = v.content_id');
$query->where('a.id = ' . (int) $pk);
if (!User::authorise('core.edit.state', 'com_content') && !User::authorise('core.edit', 'com_content')) {
// Filter by start and end dates.
$nullDate = $db->Quote($db->getNullDate());
$date = Date::of('now');
$nowDate = $db->Quote($date->toSql());
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')');
$query->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
}
// Join to check for category published state in parent categories up the tree
// If all categories are published, badcats.id will be null, and we just use the article state
$subquery = ' (SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
$subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
$subquery .= 'WHERE parent.extension = ' . $db->quote('com_content');
$subquery .= ' AND parent.published <= 0 GROUP BY cat.id)';
$query->join('LEFT OUTER', $subquery . ' AS badcats ON badcats.id = c.id');
// Filter by published state.
$published = $this->getState('filter.published');
$archived = $this->getState('filter.archived');
if (is_numeric($published)) {
$query->where('(a.state = ' . (int) $published . ' OR a.state =' . (int) $archived . ')');
}
$db->setQuery($query);
$data = $db->loadObject();
if ($error = $db->getErrorMsg()) {
throw new Exception($error);
}
if (empty($data)) {
return App::abort(404, Lang::txt('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'));
}
// Check for published state if filter set.
if ((is_numeric($published) || is_numeric($archived)) && ($data->state != $published && $data->state != $archived)) {
return App::abort(404, Lang::txt('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'));
}
// Convert parameter fields to objects.
$registry = new \Hubzero\Config\Registry($data->attribs);
$data->params = clone $this->getState('params');
$data->params->merge($registry);
$registry = new \Hubzero\Config\Registry($data->metadata);
$data->metadata = $registry;
// Technically guest could edit an article, but lets not check that to improve performance a little.
if (!User::isGuest()) {
$userId = User::get('id');
$asset = 'com_content.article.' . $data->id;
// Check general edit permission first.
if (User::authorise('core.edit', $asset)) {
$data->params->set('access-edit', true);
} elseif (!empty($userId) && User::authorise('core.edit.own', $asset)) {
// Check for a valid user and that they are the owner.
if ($userId == $data->created_by) {
$data->params->set('access-edit', true);
//.........这里部分代码省略.........
示例11: defined
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* HUBzero is a registered trademark of Purdue University.
*
* @package hubzero-cms
* @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/
defined('_HZEXEC_') or die;
Toolbar::title(Lang::txt('COM_OAIPMH_SETTINGS'), 'generic.png');
Toolbar::preferences('com_oaipmh', 500);
Toolbar::spacer();
Toolbar::help('oaipmh');
$this->css();
$lang = \Lang::getTag();
?>
<form action="<?php
echo Route::url('index.php?option=' . $this->option);
?>
" method="post" name="adminForm" id="item-form">
<input type="hidden" name="option" value="<?php
echo $this->option;
?>
" />
<input type="hidden" name="task" value="save" />
<input type="hidden" name="controller" value="<?php
echo $this->controller;
?>
" />
示例12: defined
* HUBzero is a registered trademark of Purdue University.
*
* @package hubzero-cms
* @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/
defined('_HZEXEC_') or die;
$canDo = \Components\Oaipmh\Helpers\Permissions::getActions('component');
Toolbar::title(Lang::txt('COM_OAIPMH_SETTINGS'), 'generic.png');
if ($canDo->get('core.admin')) {
Toolbar::preferences('com_oaipmh', 500);
Toolbar::spacer();
}
Toolbar::help('oaipmh');
$this->css();
$lang = Lang::getTag();
?>
<form action="<?php
echo Route::url('index.php?option=' . $this->option);
?>
" method="post" name="adminForm" id="item-form">
<input type="hidden" name="option" value="<?php
echo $this->option;
?>
" />
<input type="hidden" name="task" value="save" />
<input type="hidden" name="controller" value="<?php
echo $this->controller;
?>
" />