本文整理汇总了PHP中JoomFishManager::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JoomFishManager::getInstance方法的具体用法?PHP JoomFishManager::getInstance怎么用?PHP JoomFishManager::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JoomFishManager
的用法示例。
在下文中一共展示了JoomFishManager::getInstance方法的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: load
/**
* Loads the entire menu table into memory.
*
* @return array
*/
public function load()
{
// @Todo cache this
$jlanguage = JFactory::getConfig()->getValue('language');
if (isset(self::$_menuitems[$jlanguage])) {
$this->_items = self::$_menuitems[$jlanguage];
return;
}
// Initialise variables.
$db = JFactory::getDbo();
$app = JApplication::getInstance('site');
$query = $db->getQuery(true);
$query->select('m.id, m.menutype, m.title, m.alias, m.note, m.path AS route, m.link, m.type, m.level, m.language');
$query->select('m.browserNav, m.access, m.params, m.home, m.img, m.template_style_id, m.component_id, m.parent_id');
$query->select('e.element as component');
$query->from('#__menu AS m');
$query->leftJoin('#__extensions AS e ON m.component_id = e.extension_id');
$query->where('m.published = 1');
$query->where('m.parent_id > 0');
$query->where('m.client_id = 0');
$query->order('m.lft');
// Set the query
$db->setQuery($query);
if (!($this->_items = $db->loadObjectList('id'))) {
JError::raiseWarning(500, JText::sprintf('JERROR_LOADING_MENUS', $db->getErrorMsg()));
return false;
}
foreach ($this->_items as &$item) {
// Get parent information.
$parent_tree = array();
if (isset($this->_items[$item->parent_id])) {
$parent_tree = $this->_items[$item->parent_id]->tree;
}
// Create tree.
$parent_tree[] = $item->id;
$item->tree = $parent_tree;
// Create the query array.
$url = str_replace('index.php?', '', $item->link);
$url = str_replace('&', '&', $url);
parse_str($url, $item->query);
}
// @Todo move this to plugin
JFRoute::getInstance()->fixMenuItemRoutes($this->_items, null);
// throw away everything that is not * or default as the rest is there only for translations
$deflang = JoomFishManager::getInstance()->getDefaultLanguage();
foreach ($this->_items as &$item) {
if ($item->language != '*' && $item->language != $deflang) {
unset($this->_items[(string) $item->id]);
} else {
if ($item->language == $deflang) {
$item->language = '*';
// either this or override JRouterSite line 222 that has * hardcoded
}
}
}
self::$_menuitems[$jlanguage] = $this->_items;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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);
}
}
}
示例7: 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;
}
示例8: 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;
}
示例9: 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();
}
}
示例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: _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;
}
示例13: _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();
}
}
}
示例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: getInput
public function getInput()
{
if (JPath::find(JPATH_SITE . DS . 'components' . DS . 'com_joomfish' . DS . 'helpers', 'defines.php')) {
require_once JPATH_SITE . DS . 'components' . DS . 'com_joomfish' . DS . 'helpers' . DS . 'defines.php';
jimport('joomfish.manager');
} else {
JError::raiseNotice('no_jf_component', JText::_('Joom!Fish component not installed correctly. Plugin not executed'));
}
$jfm = JoomFishManager::getInstance();
$activeLanguages = $jfm->getLanguagesIndexedById();
$value = $this->value;
if (!is_array($value)) {
$default = "";
$value = array();
foreach ($activeLanguages as $key => $val) {
$value[$key] = $val->lang_id . "::" . $default . $val->sef;
}
}
$indexedvalues = array();
foreach ($value as $val) {
list($key, $val) = explode("::", $val, 2);
$indexedvalues[$key] = $val;
}
$html = "<fieldset style='clear:left'><table>";
$html .= "<tr style='font-weight:bold;'><td>" . JText::_('JFIELD_LANGUAGE_LABEL') . "</td><td>" . JText::_('JFIELD_LANGUAGE_LABEL') . "</td></tr>";
foreach ($activeLanguages as $key => $val) {
$html .= "<tr>";
$html .= '<td>' . $val->name . '</td><td>';
$prefix = array_key_exists($val->lang_id, $indexedvalues) ? $indexedvalues[$val->lang_id] : "lang-" . $val->sef;
$idprefix = $val->lang_id . "::" . $prefix;
$html .= "<input type='text' length='10' maxlength='50' id='sefprefix" . $val->lang_id . "' onblur='document.getElementById(\"hiddensefprefix" . $val->lang_id . "\").value=\"" . $val->lang_id . "::\"+this.value;' value='" . $prefix . "' />";
$html .= "<input type='hidden' id='hiddensefprefix" . $val->lang_id . "' name='" . $this->name . "[]' value='" . $idprefix . "' />";
$html .= "</td></tr>";
}
$html .= "</table></fieldset>";
return $html;
}