本文整理汇总了PHP中JoomFishManager类的典型用法代码示例。如果您正苦于以下问题:PHP JoomFishManager类的具体用法?PHP JoomFishManager怎么用?PHP JoomFishManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JoomFishManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jflanguagesType
function jflanguagesType()
{
$this->values = array();
if (ACYMAILING_J16 && file_exists(JPATH_SITE . DS . 'libraries' . DS . 'joomfish' . DS . 'manager.php') || !ACYMAILING_J16 && file_exists(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_joomfish' . DS . 'classes' . DS . 'JoomfishManager.class.php')) {
include_once JPATH_SITE . DS . 'components' . DS . 'com_joomfish' . DS . 'helpers' . DS . 'defines.php';
if (!ACYMAILING_J16) {
include_once JOOMFISH_ADMINPATH . DS . 'classes' . DS . 'JoomfishManager.class.php';
} else {
include_once JPATH_SITE . DS . 'libraries' . DS . 'joomfish' . DS . 'manager.php';
}
$jfManager = JoomFishManager::getInstance();
$langActive = $jfManager->getActiveLanguages();
$this->values[] = JHTML::_('select.option', '', JText::_('DEFAULT_LANGUAGE'));
foreach ($langActive as $oneLanguage) {
$this->values[] = JHTML::_('select.option', $oneLanguage->shortcode . ',' . $oneLanguage->id, $oneLanguage->name);
}
$this->found = true;
}
if (empty($this->values) && file_exists(JPATH_SITE . DS . 'components' . DS . 'com_falang' . DS . 'helpers' . DS . 'defines.php') && (include_once JPATH_SITE . DS . 'components' . DS . 'com_falang' . DS . 'helpers' . DS . 'defines.php')) {
JLoader::register('FalangManager', FALANG_ADMINPATH . '/classes/FalangManager.class.php');
$fManager = FalangManager::getInstance();
$langActive = $fManager->getActiveLanguages();
$this->values[] = JHTML::_('select.option', '', JText::_('DEFAULT_LANGUAGE'));
foreach ($langActive as $oneLanguage) {
$this->values[] = JHTML::_('select.option', $oneLanguage->lang_code . ',' . $oneLanguage->lang_id, $oneLanguage->title);
}
$this->found = true;
}
}
示例2: __construct
/**
* Constructor for the tasker
*
* @return joomfishTasker
*/
public function __construct()
{
parent::__construct();
$this->registerDefaultTask('show');
$this->act = JRequest::getVar('act', '');
$this->task = JRequest::getVar('task', '');
$this->cid = JRequest::getVar('cid', array(0));
if (!is_array($this->cid)) {
$this->cid = array(0);
}
$this->fileCode = JRequest::getVar('fileCode', '');
$this->_joomfishManager = JoomFishManager::getInstance();
$this->registerTask('show', 'showCElementConfig');
$this->registerTask('detail', 'showElementConfiguration');
$this->registerTask('remove', 'removeContentElement');
$this->registerTask('remove_install', 'removeContentElement');
$this->registerTask('installer', 'showContentElementsInstaller');
$this->registerTask('uploadfile', 'installContentElement');
// Populate data used by controller
global $mainframe;
$this->_catid = $mainframe->getUserStateFromRequest('selected_catid', 'catid', '');
$this->_select_language_id = $mainframe->getUserStateFromRequest('selected_lang', 'select_language_id', '-1');
$this->_language_id = JRequest::getVar('language_id', $this->_select_language_id);
$this->_select_language_id = $this->_select_language_id == -1 && $this->_language_id != -1 ? $this->_language_id : $this->_select_language_id;
// Populate common data used by view
// get the view
$this->view = $this->getView("elements");
// Assign data for view
$this->view->assignRef('catid', $this->_catid);
$this->view->assignRef('select_language_id', $this->_select_language_id);
$this->view->assignRef('task', $this->task);
$this->view->assignRef('act', $this->act);
}
示例3: getOptions
/**
* Method to get the field options for content languages.
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
$basicoptions = JHtml::_('contentlanguage.existing');
// set default
if (!isset($this->value) || empty($this->value) || $this->value == '*') {
$jfManager = JoomFishManager::getInstance();
$this->value = $jfManager->getDefaultLanguage();
}
return $basicoptions;
}
示例4: getComponentMapping
public static function getComponentMapping($modulParam)
{
$retVal = array();
$jfm = JoomFishManager::getInstance();
$contentElements = $jfm->getContentElements();
foreach ($contentElements as $element) {
$componentinfo = $element->getComponentInformation();
$retVal = array_merge($retVal, $componentinfo);
}
return $retVal;
}
示例5: jflanguagesType
function jflanguagesType()
{
$this->values = array();
if (@(include_once JPATH_SITE . DS . 'components' . DS . 'com_joomfish' . DS . 'helpers' . DS . 'defines.php')) {
include_once JOOMFISH_ADMINPATH . DS . 'classes' . DS . 'JoomfishManager.class.php';
$jfManager = JoomFishManager::getInstance();
$langActive = $jfManager->getActiveLanguages();
$this->values[] = JHTML::_('select.option', '', JText::_('DEFAULT_LANGUAGE'));
foreach ($langActive as $oneLanguage) {
$this->values[] = JHTML::_('select.option', $oneLanguage->shortcode . ',' . $oneLanguage->id, $oneLanguage->name);
}
}
}
示例6: jfGetOtherLanguages
function jfGetOtherLanguages()
{
// inspired by modules/mod_jflanguageselection
$jfManager = JoomFishManager::getInstance();
$jfrouter = JFRoute::getInstance();
$curLang = jfGetCurrentLanguage();
$languages = array();
foreach ($jfManager->getActiveLanguages(true) as $lang) {
if ($lang->lang_code != $curLang->lang_code) {
$code = $lang->getLanguageCode();
$languages[$code] = $jfrouter->rerouteCurrentUrl($code);
}
}
return $languages;
}
示例7: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
// Initialize some field attributes.
$client = (string) $this->element['client'];
if ($client != 'site' && $client != 'administrator') {
$client = 'site';
}
// set default
if (!isset($this->value) || empty($this->value) || $this->value == '*') {
$jfManager = JoomFishManager::getInstance();
$this->value = $jfManager->getDefaultLanguage();
}
// Merge any additional options in the XML definition.
$options = JLanguageHelper::createLanguageList($this->value, constant('JPATH_' . strtoupper($client)), true, true);
return $options;
}
示例8: onAfterInitialise
function onAfterInitialise()
{
$mainframe =& JFactory::getApplication();
JFactory::getConfig()->set('sef_suffix', 0);
// Store J! router for later use
$router =& $mainframe->getRouter();
$mainframe->set('mijosef.global.jrouter', $router);
// Activate MijoSEF router
$mijosef_router = new JRouterMijosef();
$router->attachParseRule(array($mijosef_router, 'parse'));
$router->attachBuildRule(array($mijosef_router, 'build'));
// Instantiate JoomFishManager before JFDatabase loading to prevent infinity loop...
if (Mijosef::get('utility')->JoomFishInstalled() && class_exists('JoomFishManager')) {
JoomFishManager::getInstance();
}
// Post varsa yönlendirme
$post = JRequest::get('post');
if (is_array($post) && !empty($post)) {
return;
}
// Ajax durumunda yönlendirme yapma
$tmpl = JRequest::getCmd('tmpl');
$format = JRequest::getCmd('format');
if ($tmpl == 'component' || $format == 'raw') {
return;
}
// www settings
$uri =& JFactory::getURI();
$host =& $uri->getHost();
$redirect = false;
$wwwredirect = $this->MijosefConfig->redirect_to_www;
if ($wwwredirect != 0) {
if ($wwwredirect == 1 && strpos($host, 'www') !== 0) {
$redirect = true;
$uri->setHost('www.' . $host);
} elseif ($wwwredirect == 2 && strpos($host, 'www') === 0) {
$redirect = true;
$uri->setHost(substr($host, 4, strlen($host)));
}
}
if ($redirect === true) {
$mainframe->redirect($uri->toString());
$mainframe->close();
}
}
示例9: getMenus
/**
* Get a list of the available menus.
*
* @return array An array of the available menus (from the menu types table).
* @since 1.6
*/
public static function getMenus()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.*, SUM(b.home) AS home');
$query->from('#__menu_types AS a');
$query->leftJoin('#__menu AS b ON b.menutype = a.menutype AND b.home != 0 AND (b.language=\'*\' OR b.language=\'' . JoomFishManager::getDefaultLanguage() . '\')');
$query->select('b.language');
$query->leftJoin('#__languages AS l ON l.lang_code = language');
$query->select('l.image');
$query->select('l.sef');
$query->select('l.title_native');
$query->where('(b.client_id = 0 OR b.client_id IS NULL)');
//sqlsrv change
$query->group('a.id, a.menutype, a.description, a.title, b.menutype,b.language,l.image,l.sef,l.title_native');
$db->setQuery($query);
$result = $db->loadObjectList();
return $result;
}
示例10: __construct
/**
* PHP 4 constructor for the tasker
*
* @return joomfishTasker
*/
function __construct()
{
parent::__construct();
$this->registerDefaultTask('showTranslate');
$this->act = JRequest::getVar('act', '');
$this->task = JRequest::getVar('task', '');
$this->cid = JRequest::getVar('cid', array(0));
if (!is_array($this->cid)) {
$this->cid = array(0);
}
$this->fileCode = JRequest::getVar('fileCode', '');
$this->_joomfishManager =& JoomFishManager::getInstance();
$this->registerTask('overview', 'showTranslate');
$this->registerTask('edit', 'editTranslation');
$this->registerTask('apply', 'saveTranslation');
$this->registerTask('save', 'saveTranslation');
$this->registerTask('publish', 'publishTranslation');
// NB the method will check on task
$this->registerTask('unpublish', 'publishTranslation');
$this->registerTask('remove', 'removeTranslation');
$this->registerTask('preview', 'previewTranslation');
$this->registerTask('orphans', 'showOrphanOverview');
$this->registerTask('orphandetail', 'showOrphanDetail');
$this->registerTask('removeorphan', 'removeOrphan');
// Populate data used by controller
global $mainframe;
$this->_catid = $mainframe->getUserStateFromRequest('selected_catid', 'catid', '');
$this->_select_language_id = $mainframe->getUserStateFromRequest('selected_lang', 'select_language_id', '-1');
$this->_language_id = JRequest::getVar('language_id', $this->_select_language_id);
$this->_select_language_id = $this->_select_language_id == -1 && $this->_language_id != -1 ? $this->_language_id : $this->_select_language_id;
// Populate common data used by view
// get the view
$this->view =& $this->getView("translate");
$model =& $this->getModel('translate');
$this->view->setModel($model, true);
// Assign data for view
$this->view->assignRef('catid', $this->_catid);
$this->view->assignRef('select_language_id', $this->_select_language_id);
$this->view->assignRef('task', $this->task);
$this->view->assignRef('act', $this->act);
}
示例11: JreviewsParseRoute
function JreviewsParseRoute($segments)
{
$vars = array();
# Load own uri to overcome Joomla encoding issues with Greek params
$uri = cmsFramework::_getUri();
// Fix for Joomfish. Remove the language segment from the url
if (class_exists('JoomFishManager')) {
$lang = JFactory::getLanguage();
$language = $lang->getTag();
$jfm = JoomFishManager::getInstance();
$lang_shortcode = $jfm->getLanguageCode($language);
if (strstr($uri, '/' . $lang_shortcode . '/')) {
$uri = str_replace('/' . $lang_shortcode . '/', '/', $uri);
}
}
$new_segments = cmsFramework::_parseSefRoute($uri);
if (end($new_segments) == 'index.php') {
$new_segments = $segments;
}
// Remove Joomla language segment from url
if (isset($_GET['language']) && $_GET['language'] != '' && strlen($new_segments[0]) == 2) {
$new_segments[0] = 'index.php';
}
# Fix for sef without mod rewrite. Without it the sort urls don't work.
// Remove the Itemid related segments when mod rewrite is disabled and Itemid exists
if ($new_segments[0] == 'index.php' && $new_segments[1] != 'component') {
foreach ($new_segments as $key => $segment) {
if (!in_array(str_replace(' ', '+', $segment), $segments) && !in_array(JreviewsStrReplaceOnce('-', ':', urlencode($segment)), $segments)) {
unset($new_segments[$key]);
}
}
}
if (count($new_segments) >= 3 && isset($new_segments[0]) && $new_segments[0] == 'index.php' && isset($new_segments[1]) && $new_segments[1] == 'component' && isset($new_segments[2]) && $new_segments[2] == 'jreviews') {
array_shift($new_segments);
array_shift($new_segments);
array_shift($new_segments);
}
$vars['url'] = implode('/', $new_segments);
return $vars;
}
示例12: getTranslateParams
public static function getTranslateParams($type = '', $original, $translation, $fieldname, $fields = null)
{
JoomFishManager::addIncludePath(JOOMFISH_LIBPATH . DS . 'translateparams', 'translateparams');
JoomFishManager::addIncludePath(JOOMFISH_LIBPATH . DS . 'contentelement' . DS . 'contentelements', 'translateparams');
$paramsclass = "TranslateParams_" . $type;
if (!class_exists($paramsclass)) {
// Search for the class file in the include paths.
jimport('joomla.filesystem.path');
if ($path = JPath::find(JoomFishManager::addIncludePath('', 'translateparams'), strtolower($type) . '.php')) {
include_once $path;
} else {
if ($path = JPath::find(JoomFishManager::addIncludePath('', 'translateparams'), $paramsclass . '.php')) {
include_once $path;
}
}
}
if (!class_exists($paramsclass)) {
jimport('joomfish.translateparams.translateparams');
$paramsclass = "TranslateParams";
}
return new $paramsclass($original, $translation, $fieldname, $fields);
}
示例13: _removeTranslation
/**
* Deletes the selected translations (only the translations of course)
* @return string message
*/
function _removeTranslation($catid, $cid)
{
$message = '';
$db = JFactory::getDBO();
foreach ($cid as $cid_row) {
list($translationid, $contentid, $language_id) = explode('|', $cid_row);
$jfManager = JoomFishManager::getInstance();
$contentElement = $jfManager->getContentElement($catid);
$contentTable = $contentElement->getTableName();
$contentid = intval($contentid);
$translationid = intval($translationid);
// safety check -- complete overkill but better to be safe than sorry
// get the translation details
JLoader::import('models.JFContent', JOOMFISH_ADMINPATH);
$translation = new jfContent($db);
$translation->load($translationid);
if (!isset($translation) || $translation->id == 0) {
$this->setState('message', JText::sprintf('NO_SUCH_TRANSLATION', $translationid));
continue;
}
// make sure translation matches the one we wanted
if ($contentid != $translation->reference_id) {
$this->setState('message', JText::_('Something dodgy going on here'));
continue;
}
$sql = "DELETE from #__jf_content WHERE reference_table='{$catid}' and language_id={$language_id} and reference_id={$contentid}";
$db->setQuery($sql);
$db->query();
if ($db->getErrorNum() != 0) {
$this->setError(JText::_('Something dodgy going on here'));
JError::raiseWarning(400, JTEXT::_('No valid table information: ') . $db->getErrorMsg());
continue;
} else {
$this->setState('message', JText::_('Translation successfully deleted'));
}
}
return $message;
}
示例14: _setupContentElementCache
/**
* Sets up ContentElement Cache - mainly used for data to determine primary key id for tablenames ( and for
* future use to allow tables to be dropped from translation even if contentelements are installed )
*/
function _setupContentElementCache()
{
$db =& JFactory::getDBO();
// Make usre table exists otherwise create it.
$db->setQuery("CREATE TABLE IF NOT EXISTS `#__jf_tableinfo` ( `id` int(11) NOT NULL auto_increment, `joomlatablename` varchar(100) NOT NULL default '', `tablepkID` varchar(100) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM");
$db->query();
// clear out existing data
$db->setQuery("DELETE FROM `#__jf_tableinfo`");
$db->query();
$joomfishManager =& JoomFishManager::getInstance();
$contentElements = $joomfishManager->getContentElements(true);
$sql = "INSERT INTO `#__jf_tableinfo` (joomlatablename,tablepkID) VALUES ";
$firstTime = true;
foreach ($contentElements as $contentElement) {
$tablename = $contentElement->getTableName();
$refId = $contentElement->getReferenceID();
$sql .= $firstTime ? "" : ",";
$sql .= " ('" . $tablename . "', '" . $refId . "')";
$firstTime = false;
}
$db->setQuery($sql);
$db->query();
}
示例15: _plgListingAfterSave
function _plgListingAfterSave(&$model)
{
// Limit running this for new/edited listings. Not deletion of images or other listing actions.
if ($this->c->name == 'listings' && in_array($this->c->action, array('_save'))) {
include_once PATH_ROOT . 'administrator' . DS . 'components' . DS . 'com_joomfish' . DS . 'models' . DS . 'ContentObject.php';
$lang =& JFactory::getLanguage();
$language = $lang->getTag();
$jfm =& JoomFishManager::getInstance();
$contentElement = $jfm->getContentElement('content');
$actContentObject = new ContentObject($jfm->getLanguageID($language), $contentElement);
$object = (object) $model->data['Listing'];
$actContentObject->loadFromContentID($object->id);
$actContentObject->copyContentToTranslation($object, $object);
$actContentObject->setPublished($this->autoPublishTranslation);
//Automatically publishes the translations
$actContentObject->store();
if ($jfm->getCfg("transcaching", 1)) {
// clean the cache!
$cache = $jfm->getCache($language);
$cache->clean();
}
}
}