本文整理汇总了PHP中Sobi::Trigger方法的典型用法代码示例。如果您正苦于以下问题:PHP Sobi::Trigger方法的具体用法?PHP Sobi::Trigger怎么用?PHP Sobi::Trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sobi
的用法示例。
在下文中一共展示了Sobi::Trigger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTitle
/**
* @param string $title
* @return string|void
*/
public function setTitle($title)
{
$title = Sobi::Txt($title, array('section' => $this->get('section.name')));
Sobi::Trigger('setTitle', $this->name(), array(&$title));
SPFactory::header()->setTitle($title);
$this->set($title, 'site_title');
}
示例2: translate
protected function translate()
{
$term = Sobi::Txt(SPRequest::cmd('term'));
Sobi::Trigger('Translate', 'Text', array(&$term));
SPFactory::mainframe()->cleanBuffer()->customHeader();
echo json_encode(array('translation' => $term));
exit;
}
示例3: setTitle
/**
* @param string $title
* @return string
*/
public function setTitle($title)
{
$name = $this->get('entry.name');
Sobi::Trigger('setTitle', $this->name(), array(&$title));
$title = Sobi::Txt($title, array('entry_name' => $name));
$this->set($name, 'entry_name');
$title = parent::setTitle($title);
return $title;
}
示例4: __construct
public function __construct($id = 0)
{
parent::__construct($id);
if (is_numeric($this->gid)) {
$this->gid = array($this->gid);
}
$this->spGroups();
/* include default visitor permissions */
$this->gid[] = 0;
$this->parentGids();
Sobi::Trigger('UserGroup', 'Appoint', array($id, &$this->gid));
}
示例5: view
private function view()
{
$type = $this->key('template_type', 'xslt');
if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
$type = 'php';
}
if ($type == 'xslt') {
$visitor = $this->get('visitor');
$current = $this->get('section');
$categories = $this->get('categories');
$entries = $this->get('entries');
$data = array();
$data['id'] = $current->get('id');
$data['section'] = array('_complex' => 1, '_data' => Sobi::Section(true), '_attributes' => array('id' => Sobi::Section(), 'lang' => Sobi::Lang(false)));
$data['name'] = array('_complex' => 1, '_data' => $this->get('listing_name'), '_attributes' => array('lang' => Sobi::Lang(false)));
if (Sobi::Cfg('category.show_desc')) {
$desc = $current->get('description');
if (Sobi::Cfg('category.parse_desc')) {
Sobi::Trigger('prepare', 'Content', array(&$desc, $current));
}
$data['description'] = array('_complex' => 1, '_cdata' => 1, '_data' => $desc, '_attributes' => array('lang' => Sobi::Lang(false)));
}
$data['meta'] = array('description' => $current->get('metaDesc'), 'keys' => $this->metaKeys($current), 'author' => $current->get('metaAuthor'), 'robots' => $current->get('metaRobots'));
$data['entries_in_line'] = $this->get('$eInLine');
$data['categories_in_line'] = $this->get('$cInLine');
$this->menu($data);
$this->alphaMenu($data);
$data['visitor'] = $this->visitorArray($visitor);
if (count($categories)) {
foreach ($categories as $category) {
if (is_numeric($category)) {
$category = SPFactory::Category($category);
}
$data['categories'][] = array('_complex' => 1, '_attributes' => array('id' => $category->get('id'), 'nid' => $category->get('nid')), '_data' => $this->category($category));
unset($category);
}
}
if (count($entries)) {
$this->loadNonStaticData($entries);
$manager = Sobi::Can('entry', 'edit', '*', Sobi::Section()) ? true : false;
foreach ($entries as $eid) {
$en = $this->entry($eid, $manager);
$data['entries'][] = array('_complex' => 1, '_attributes' => array('id' => $en['id']), '_data' => $en);
}
$this->navigation($data);
}
$this->_attr = $data;
}
// general listing trigger
Sobi::Trigger('Listing', ucfirst(__FUNCTION__), array(&$this->_attr));
// specific lisitng trigger
Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
}
示例6: setTitle
/**
* @param string $title
* @return void
*/
public function setTitle($title)
{
$name = $this->get('template_name');
if (!strlen($name)) {
$name = $this->get('file_name');
$title = Sobi::Txt($title, array('path' => $name));
} else {
$title = Sobi::Txt($title, array('template' => $name));
}
Sobi::Trigger('setTitle', $this->name(), array(&$title));
SPFactory::header()->setTitle($title);
$this->set($title, 'site_title');
}
示例7: setTitle
/**
* @param string $title
* @return string
*/
public function setTitle($title)
{
$name = $this->get('section.name');
if ($name) {
Sobi::Trigger('setTitle', $this->name(), array(&$title));
$title = $name;
//Sobi::Txt( $title, array( 'category_name' => $name ) );
$this->set($name, 'category_name');
$this->set($name, 'section_name');
$this->set($title, 'site_title');
}
$title = parent::setTitle($title);
return $title;
}
示例8: getSections
/**
*/
private function getSections()
{
try {
$sections = SPFactory::db()->select('*', 'spdb_object', array('oType' => 'section'), 'id')->loadObjectList();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('CANNOT_GET_SECTIONS_LIST', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
}
if (count($sections)) {
foreach ($sections as $section) {
if (Sobi::Can('section', 'access', $section->id, 'valid')) {
$s = SPFactory::Section($section->id);
$s->extend($section);
$this->_sections[] = $s;
}
}
Sobi::Trigger($this->name(), __FUNCTION__, array(&$this->_sections));
}
}
示例9: __construct
public function __construct($id = 0)
{
parent::__construct($id);
$this->gid[] = 0;
// this array is really a bad joke :(
foreach ($this->groups as $index => $value) {
if (is_string($index) && !is_numeric($index)) {
$this->gid[] = $value;
$this->usertype = $index;
} else {
$this->gid[] = $index;
$this->usertype = $value;
}
}
$this->spGroups();
/* include default visitor permissions */
$this->parentGids();
Sobi::Trigger('UserGroup', 'Appoint', array($id, &$this->gid));
}
示例10: display
/**
*
*/
public function display()
{
$this->_type = 'frontpage';
$type = $this->key('template_type', 'xslt');
if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
$type = 'php';
}
if ($type == 'xslt') {
$sections = $this->get('sections');
$data = array();
if (count($sections)) {
foreach ($sections as $section) {
$s = array('name' => array('_complex' => 1, '_data' => $section->get('name'), '_attributes' => array('lang' => Sobi::Lang(false))), 'description' => array('_complex' => 1, '_cdata' => 1, '_data' => $section->get('description'), '_attributes' => array('lang' => Sobi::Lang(false))), 'createdTime' => $section->get('createdTime'), 'meta' => array('description' => $section->get('metaDesc'), 'keys' => $this->metaKeys($section), 'author' => $section->get('metaAuthor'), 'robots' => $section->get('metaRobots')), 'owner' => $section->get('owner'), 'version' => $section->get('version'), 'validSince' => $section->get('validSince'), 'validUntil' => $section->get('validUntil'), 'url' => Sobi::Url(array('sid' => $section->get('id'))));
$data[] = array('_complex' => 1, '_data' => $s, '_attributes' => array('id' => $section->get('id'), 'nid' => $section->get('nid')));
}
}
$this->assign($data, 'sections');
Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
}
parent::display();
}
示例11: chooser
public function chooser()
{
$pid = $this->get('category.parent');
$path = null;
if (!$pid) {
$pid = SPRequest::sid();
}
$this->assign($pid, 'parent');
$id = $this->get('category.id');
$id = $id ? $id : $pid;
if ($id) {
$path = $this->parentPath($id);
}
$this->assign($path, 'parent_path');
$this->assign(Sobi::Url(array('task' => 'category.parents', 'out' => 'json', 'format' => 'raw'), true), 'parent_ajax_url');
/* @TODO */
$tpl = str_replace(implode('/', array('usr', 'templates', 'category')), 'views/tpl/', $this->_template . '.php');
Sobi::Trigger('Display', $this->name(), array(&$this));
include $tpl;
Sobi::Trigger('AfterDisplay', $this->name());
}
示例12: cachedView
public function cachedView($xml, $template, $cacheId, $config = array())
{
$this->_xml = $xml;
Sobi::Trigger('Start', ucfirst(__FUNCTION__), array(&$this->_xml));
$templatePackage = SPLoader::translateDirPath(Sobi::Cfg('section.template'), 'templates');
$templateOverride = SPRequest::cmd('sptpl');
if ($templateOverride) {
if (strstr($templateOverride, '.')) {
$templateOverride = str_replace('.', '/', $templateOverride);
}
$template = $templateOverride . '.xsl';
}
if (file_exists(Sobi::FixPath($templatePackage . '/' . $template))) {
$template = Sobi::FixPath($templatePackage . '/' . $template);
} else {
$type = SPFactory::db()->select('oType', 'spdb_object', array('id' => SPRequest::sid()))->loadResult();
$template = $templatePackage . '/' . $type . '/' . $template;
}
SPFactory::registry()->set('current_template', $templatePackage);
$this->_templatePath = $templatePackage;
$this->_template = str_replace('.xsl', null, $template);
$ini = array();
if (count($config)) {
foreach ($config as $file) {
$file = parse_ini_file($file, true);
foreach ($file as $section => $keys) {
if (isset($ini[$section])) {
$ini[$section] = array_merge($ini[$section], $keys);
} else {
$ini[$section] = $keys;
}
}
}
}
$this->setConfig($ini, SPRequest::task('get'));
$this->parseXml();
$this->validateData($cacheId);
Sobi::Trigger('After', ucfirst(__FUNCTION__), array(&$this->_xml));
}
示例13: TriggerPlugin
/**
* Triggering plugin action
*
* @param string $action
* @param string $subject
* @param mixed $params
* @return bool
*/
public static function TriggerPlugin($action, $subject = null, $params = array())
{
return Sobi::Trigger($action, $subject, $params);
}
示例14: foreach
/**
* @param array $cfg
* @param string $template
* @return $this
*/
public function &setConfig($cfg, $template)
{
$this->_config = $cfg;
if (isset($cfg[$template]) && count($cfg[$template])) {
foreach ($cfg[$template] as $k => $v) {
$this->_config[$k] = $v;
}
}
if (isset($this->_config['general']['css_files'])) {
$this->_config['general']['css_files'] = explode(',', $this->_config['general']['css_files']);
foreach ($this->_config['general']['css_files'] as $file) {
$this->loadCSSFile(trim($file));
}
}
if (isset($this->_config['general']['js_files'])) {
$this->_config['general']['js_files'] = explode(',', $this->_config['general']['js_files']);
foreach ($this->_config['general']['js_files'] as $file) {
if (trim($file)) {
$this->loadJsFile(trim($file));
}
}
}
if ($this->key('site_title')) {
$this->setTitle($this->key('site_title'));
}
if (isset($this->_config['hidden'])) {
foreach ($this->_config['hidden'] as $name => $defValue) {
$this->addHidden(SPRequest::string($name, $defValue), $name);
}
}
Sobi::Trigger('afterLoadConfig', $this->name(), array(&$this->_config));
return $this;
}
示例15: url
/**
* Creating URL from a array for the current CMS
* @param array $var
* @param bool $js
* @param bool $sef
* @param bool $live
* @param bool $forceItemId
* @return string
*/
public static function url($var = null, $js = false, $sef = true, $live = false, $forceItemId = false)
{
$url = self::baseUrl;
if ($var == 'current') {
return SPRequest::raw('REQUEST_URI', self::baseUrl, 'SERVER');
}
// don't remember why :(
// Nevertheless it is generating & in URL fro ImEx
// $sef = Sobi::Cfg( 'disable_sef_globally', false ) ? false : ( defined( 'SOBIPRO_ADM' ) && !( $forceItemId ) ? false : $sef );
$sef = Sobi::Cfg('disable_sef_globally', false) ? false : $sef;
Sobi::Trigger('Create', 'Url', array(&$var, $js));
if (is_array($var) && !empty($var)) {
if (isset($var['option'])) {
$url = str_replace('com_sobipro', $var['option'], $url);
unset($var['option']);
}
if (isset($var['sid']) && (!defined('SOBIPRO_ADM') || $forceItemId) || defined('SOBIPRO_ADM') && $sef && $live) {
if (!isset($var['Itemid']) || !$var['Itemid']) {
SPFactory::mainframe()->getItemid($var);
}
}
if (isset($var['title'])) {
if (Sobi::Cfg('url.title', true)) {
$var['title'] = trim(SPLang::urlSafe($var['title']));
$var['sid'] = $var['sid'] . ':' . $var['title'];
}
unset($var['title']);
}
if (isset($var['format']) && $var['format'] == 'raw' && $sef) {
unset($var['format']);
}
foreach ($var as $k => $v) {
if ($k == 'out') {
switch ($v) {
case 'html':
$var['tmpl'] = 'component';
unset($var['out']);
break;
case 'xml':
$var['tmpl'] = 'component';
$var['format'] = 'raw';
case 'raw':
$var['tmpl'] = 'component';
$var['format'] = 'raw';
break;
case 'json':
$var['out'] = 'json';
$var['format'] = 'raw';
$var['tmpl'] = 'component';
break;
}
}
}
foreach ($var as $k => $v) {
$url .= "&{$k}={$v}";
}
} elseif (is_string($var)) {
if (strstr($var, 'index.php?')) {
$url = null;
} else {
$url .= '&';
}
if (strstr($var, '=')) {
$var = str_replace('&', '&', $var);
$var = str_replace('&', '&', $var);
$url .= $var;
} else {
$url .= SOBI_TASK . '=';
$url .= $var;
}
} elseif (is_array($var)) {
}
if ($sef && !$live) {
$url = JRoute::_($url, false);
} else {
$url = preg_replace('/&(?![#]?[a-z0-9]+;)/i', '&', $url);
}
if ($live) {
/*
* SubDir Issues:
* when using SEF Joomla! router returns also the subdir
* and JURI::base returns the subdir too
* So if the URL should be SEF we have to remove the subdirectory once
* Otherwise it doesn't pass the JRoute::_ method so there is no subdir included
* */
if ($sef) {
$base = JURI::base(true);
$root = str_replace($base, null, Sobi::Cfg('live_site'));
$url = explode('/', $url);
$url = $url[count($url) - 1];
// if ( defined( 'SOBIPRO_ADM' ) ) {
//.........这里部分代码省略.........