本文整理汇总了PHP中JSNISFactory类的典型用法代码示例。如果您正苦于以下问题:PHP JSNISFactory类的具体用法?PHP JSNISFactory怎么用?PHP JSNISFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSNISFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installPluginTableByThemeName
function installPluginTableByThemeName($themeName)
{
jimport('joomla.filesystem.file');
$sqlFile = JPATH_PLUGINS . DS . $this->_pluginType . DS . $themeName . DS . $this->_installFile;
if (JFile::exists($sqlFile)) {
$objJNSUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$buffer = $objJNSUtils->readFileToString($sqlFile);
if ($buffer === false) {
return false;
}
jimport('joomla.installer.helper');
$queries = JInstallerHelper::splitSql($buffer);
if (count($queries) == 0) {
JError::raiseWarning(100, $sqlFile . JText::_(' not exits'));
return 0;
}
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$this->_db->setQuery($query);
if (!$this->_db->query()) {
JError::raiseWarning(100, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $this->_db->stderr(true));
return false;
}
}
}
return true;
} else {
JError::raiseWarning(100, $sqlFile . JText::_(' not exits'));
return false;
}
}
示例2: _addAssets
/**
* Add nesscessary JS & CSS files
*
* @return void
*/
private function _addAssets()
{
$objJSNMedia = JSNISFactory::getObj('classes.jsn_is_media');
!class_exists('JSNBaseHelper') or JSNBaseHelper::loadAssets();
$objJSNMedia->addStyleSheet(JURI::root(true) . '/administrator/components/com_imageshow/assets/css/imageshow.css');
$objJSNMedia->addScript(JURI::root(true) . '/administrator/components/com_imageshow/assets/js/joomlashine/imageshow.js');
}
示例3: addStyleSheet
/**
* Queue store script file to array
*
* @param string $path The path of file.
*
* @return void
*/
public function addStyleSheet($path)
{
$objUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$currentVersion = $objUtils->getVersion();
$path .= '?v=' . $currentVersion;
$this->_document->addStyleSheet($path);
}
示例4: updateThumbnailSize
function updateThumbnailSize($externalSourceId, $updateThumbnailSize = 144)
{
if (!$updateThumbnailSize || !$externalSourceId) {
return false;
}
$objJSNShowlist = JSNISFactory::getObj('classes.jsn_is_showlist');
$objJSNImages = JSNISFactory::getObj('classes.jsn_is_images');
$showlists = $objJSNShowlist->getListShowlistBySource($externalSourceId, 'picasa');
foreach ($showlists as $showlist) {
$images = $objJSNImages->getImagesByShowlistID($showlist->showlist_id);
if ($images) {
foreach ($images as $image) {
$patt = '/\\/s(\\d)*\\//';
$imageSmall = preg_replace($patt, '/s' . $updateThumbnailSize . '/', $image->image_small);
$query = 'UPDATE #__imageshow_images
SET image_small = ' . $this->_db->quote($imageSmall) . '
WHERE showlist_id =' . (int) $showlist->showlist_id . '
AND image_id = ' . $this->_db->quote($image->image_id) . '
LIMIT 1';
$this->_db->setQuery($query);
$this->_db->query();
}
}
}
}
示例5: restore
/**
* Restore database table data and/or files from backup.
*
* @param mixed $backup Either path to an existing file or a variable of $_FILES.
*
* @return void
*/
public function restore($backup)
{
global $objectLog;
$session = JFactory::getSession();
$objJSNRestore = JSNISFactory::getObj('classes.jsn_is_restore');
// Get Joomla config
$config = JFactory::getConfig();
// Initialize backup file
$config = array();
$config['file'] = $backup;
$config['compress'] = 1;
$config['path'] = JPATH_ROOT . DS . 'tmp' . DS;
$config['file_upload'] = JPATH_ROOT . DS . 'tmp' . DS . $backup['name'];
$result = $objJSNRestore->restore($config);
$requiredInstallData = $objJSNRestore->getListRequiredInstallData();
$requiredInstallData['backup_file'] = $backup;
$requiredInstallData['processText'] = JText::_('JSN_IMAGESHOW_PROCESS_TEXT', true);
$requiredInstallData['waitText'] = JText::_('JSN_IMAGESHOW_WAIT_TEXT', true);
if ($result) {
$objectLog->addLog(JFactory::getUser()->get('id'), JRequest::getURI(), $backup['name'], 'maintenance', 'restore');
$session->set('JSNISRestore', array('error' => false, 'extractFile' => $objJSNRestore->_extractFile, 'message' => JText::_('MAINTENANCE_BACKUP_RESTORE_SUCCESSFULL'), 'requiredSourcesNeedInstall' => $objJSNRestore->_requiredSourcesNeedInstall, 'requiredThemesNeedInstall' => $objJSNRestore->_requiredThemesNeedInstall, 'requiredInstallData' => $requiredInstallData));
} else {
$session->set('JSNISRestore', array('error' => true, 'extractFile' => $objJSNRestore->_extractFile, 'message' => $objJSNRestore->_msgError, 'requiredSourcesNeedInstall' => $objJSNRestore->_requiredSourcesNeedInstall, 'requiredThemesNeedInstall' => $objJSNRestore->_requiredThemesNeedInstall, 'requiredInstallData' => $requiredInstallData));
}
}
示例6: display
/**
* Display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
function display($tpl = null)
{
$document = JFactory::getDocument();
$document->setMimeEncoding('application/json');
$showcaseID = JRequest::getVar('showcase_id');
$objJSNShowcase = JSNISFactory::getObj('classes.jsn_is_showcase');
$objShowcaseTheme = JSNISFactory::getObj('classes.jsn_is_showcasetheme');
$themeProfile = $objShowcaseTheme->getThemeProfile($showcaseID);
if ($showcaseID > 0 && !is_null($themeProfile)) {
$showcaseData = $objJSNShowcase->getShowcaseByID($showcaseID);
} elseif ($showcaseID > 0 && is_null($themeProfile)) {
$theme = JRequest::getVar('theme');
$showcaseTable = JTable::getInstance('showcase', 'Table');
$showcaseTable->showcase_id = $showcaseID;
$showcaseTable->theme_name = $theme;
$showcaseData = $showcaseTable;
} else {
$theme = JRequest::getVar('theme');
$showcaseTable = JTable::getInstance('showcase', 'Table');
$showcaseTable->showcase_id = 0;
$showcaseTable->theme_name = $theme;
$showcaseData = $showcaseTable;
}
$objJSNUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$URL = dirname($objJSNUtils->overrideURL()) . '/';
$dataObj = $objJSNShowcase->getShowcase2JSON($showcaseData, $URL);
echo json_encode($dataObj);
jexit();
}
示例7: _installPackage
function _installPackage()
{
$installer = JSNISInstaller::getInstance();
if ($this->_packageExtract) {
$objJSNPlugins = JSNISFactory::getObj('classes.jsn_is_plugins');
$countSource = count($this->_listCurrentSources);
$currentSources = array();
if ($countSource) {
for ($i = 0; $i < $countSource; $i++) {
$item = $this->_listCurrentSources[$i];
$currentSources[$item->element] = $objJSNPlugins->getXmlFile($item);
}
}
if (!$installer->install($this->_packageExtract['dir'])) {
$this->_msgError = JText::_('INSTALLER_IMAGE_SOURCE_PACKAGE_UNSUCCESSFULLY_INSTALLED');
$this->_error = true;
return false;
}
$this->_upgradeSourceDB($currentSources, $installer);
if (!is_file($this->_packageExtract['packagefile'])) {
$config = JFactory::getConfig();
$package['packagefile'] = $config->getValue('config.tmp_path') . DS . $this->_packageExtract['packagefile'];
}
JInstallerHelper::cleanupInstall($this->_packageExtract['packagefile'], $this->_packageExtract['extractdir']);
}
}
示例8: display
function display($tpl = null)
{
global $mainframe, $option;
JHTML::script('jsn_is_imageshow.js', 'administrator/components/com_imageshow/assets/js/');
JHTML::stylesheet('imageshow.css', 'administrator/components/com_imageshow/assets/css/');
JHTML::stylesheet('mediamanager.css', 'administrator/components/com_imageshow/assets/css/');
$objJSNShowlist = JSNISFactory::getObj('classes.jsn_is_showlist');
$task = JRequest::getString('task');
if ($task != 'element' && $task != 'elements') {
$objJSNShowlist->checkShowlistLimition();
}
$list = array();
$model = $this->getModel();
$filterState = $mainframe->getUserStateFromRequest('com_imageshow.showlist.filter_state', 'filter_state', '', 'word');
$filterOrder = $mainframe->getUserStateFromRequest('com_imageshow.showlist.filter_order', 'filter_order', '', 'cmd');
$filterOrderDir = $mainframe->getUserStateFromRequest('com_imageshow.showlist.filter_order_Dir', 'filter_order_Dir', '', 'word');
$showlistTitle = $mainframe->getUserStateFromRequest('com_imageshow.showlist.showlist_stitle', 'showlist_stitle', '', 'string');
$showlistAccess = $mainframe->getUserStateFromRequest('com_imageshow.showlist.showlist_access', 'access', '', 'string');
$type = array(0 => array('value' => '', 'text' => '- Published -'), 1 => array('value' => 'P', 'text' => 'Yes'), 2 => array('value' => 'U', 'text' => 'No'));
$lists['type'] = JHTML::_('select.genericList', $type, 'filter_state', 'id="filter_state" class="inputbox" onchange="document.adminForm.submit( );"' . '', 'value', 'text', $filterState);
$lists['state'] = JHTML::_('grid.state', $filterState);
$lists['access'] = $model->accesslevel($showlistAccess);
$lists['showlistTitle'] = $showlistTitle;
$lists['order_Dir'] = $filterOrderDir;
$lists['order'] = $filterOrder;
$items =& $this->get('Data');
$total =& $this->get('Total');
$pagination =& $this->get('Pagination');
$this->assignRef('lists', $lists);
$this->assignRef('total', $total);
$this->assignRef('items', $items);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
示例9: createBackUpFileForMigrate
public function createBackUpFileForMigrate()
{
$session = JFactory::getSession();
$preVersion = (double) str_replace('.', '', $session->get('preversion', null, 'jsnimageshow'));
$version400 = (double) str_replace('.', '', '4.0.0');
//$preVersion = 313;
if (!$preVersion) {
return;
}
if ($preVersion < $version400) {
$objJSNISMaintenance = JSNISFactory::getObj('classes.jsn_is_maintenance313', null, 'database');
$xmlString = $objJSNISMaintenance->renderXMLData(true, true);
} else {
if ($preVersion >= $version400) {
$objJSNISData = JSNISFactory::getObj('classes.jsn_is_data');
$xmlString = $objJSNISData->executeBackup(true, true)->asXML();
}
}
$fileBackupName = 'jsn_imageshow_backup_db.xml';
$fileZipName = 'jsn_is_backup_for_migrate_' . $preVersion . '_' . date('YmdHis') . '.zip';
if (JFile::write(JPATH_ROOT . DS . 'tmp' . DS . $fileBackupName, $xmlString)) {
$config = JPATH_ROOT . DS . 'tmp' . DS . $fileZipName;
$zip = JSNISFactory::getObj('classes.jsn_is_archive', 'JSNISZIPFile', $config);
$zip->setOptions(array('inmemory' => 1, 'recurse' => 0, 'storepaths' => 0));
$zip->addFiles(JPATH_ROOT . DS . 'tmp' . DS . $fileBackupName);
$zip->createArchive();
$zip->writeArchiveFile();
$FileDelte = JPATH_ROOT . DS . 'tmp' . DS . $fileBackupName;
$session->set('jsn_is_backup_for_migrate', $fileZipName, 'jsnimageshow');
return true;
}
return false;
}
示例10: sampledata
function sampledata()
{
$sampleData = JRequest::getInt('sample_data');
$menuType = JRequest::getString('menutype');
$keepAllData = JRequest::getInt('keep_all_data');
$installMessage = JRequest::getInt('install_message');
$model = $this->getModel('cpanel');
$msg = '';
if ($keepAllData == 1) {
$model->clearData();
}
if ($installMessage == 1) {
$objJSNInstMessage = JSNISFactory::getObj('classes.jsn_is_installermessage');
$objJSNInstMessage->installMessage();
}
if ($sampleData == 1) {
$model->populateDatabase();
if ($menuType != '') {
$model->insertMenuSample($menuType);
}
$msg = JText::_('INSTALL SAMPLE DATA SUCCESSFULLY');
}
$link = 'index.php?option=com_imageshow';
$this->setRedirect($link, $msg);
}
示例11: display
function display($tpl = null)
{
global $mainframe, $option, $Itemid;
jimport('joomla.utilities.simplexml');
$showlistID = JRequest::getInt('showlist_id', 0);
if ($showlistID == 0) {
$menu =& JSite::getMenu();
$item = $menu->getActive();
$params =& $menu->getParams($item->id);
$showlistID = $params->get('showlist_id', 0);
}
$objUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$URL = $objUtils->overrideURL();
$objJSNShowlist = JSNISFactory::getObj('classes.jsn_is_showlist');
$showlistInfo = $objJSNShowlist->getShowListByID($showlistID, true);
if (count($showlistInfo) <= 0) {
header("HTTP/1.0 404 Not Found");
exit;
}
$objJSNShowlist->insertHitsShowlist($showlistID);
$objJSNJSON = JSNISFactory::getObj('classes.jsn_is_json');
$dataObj = $objJSNShowlist->getShowlist2JSON($URL, $showlistID);
echo $objJSNJSON->encode($dataObj);
jexit();
}
示例12: display
function display($tpl = null)
{
global $mainframe, $option;
jimport('joomla.utilities.simplexml');
$showCaseID = JRequest::getInt('showcase_id', 0);
if ($showCaseID == 0) {
$menu =& JSite::getMenu();
$item = $menu->getActive();
$params =& $menu->getParams($item->id);
$showcase_id = $params->get('showcase_id', 0);
} else {
$showcase_id = $showCaseID;
}
$objUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$URL = $objUtils->overrideURL();
$objJSNShowcase = JSNISFactory::getObj('classes.jsn_is_showcase');
$row = $objJSNShowcase->getShowCaseByID($showcase_id);
if (count($row) <= 0) {
header("HTTP/1.0 404 Not Found");
exit;
}
$objJSNJSON = JSNISFactory::getObj('classes.jsn_is_json');
$dataObj = $objJSNShowcase->getShowcase2JSON($row, $URL);
echo $objJSNJSON->encode($dataObj);
jexit();
}
示例13: deleteProfileSelect
function deleteProfileSelect($cid = array())
{
$result = false;
if (count($cid)) {
JArrayHelper::toInteger($cid);
$cids = implode(',', $cid);
$query = 'DELETE FROM #__imageshow_configuration' . ' WHERE configuration_id IN ( ' . $cids . ' )';
$this->_db->setQuery($query);
$this->_db->query();
$objJSNShowlist = JSNISFactory::getObj('classes.jsn_is_showlist');
$listShowlistID = $objJSNShowlist->getListShowlistID($cids);
if (count($listShowlistID)) {
foreach ($listShowlistID as $value) {
$values[] = $value[0];
}
$listID = implode(',', $values);
$query = 'UPDATE #__imageshow_showlist SET configuration_id = 0, showlist_source = 0 WHERE showlist_id IN ( ' . $listID . ' )';
$this->_db->setQuery($query);
$this->_db->query();
$query = 'DELETE FROM #__imageshow_images WHERE showlist_id IN ( ' . $listID . ' )';
$this->_db->setQuery($query);
$this->_db->query();
}
}
return true;
}
示例14: installMessage
function installMessage()
{
$db = JFactory::getDBO();
$lang = JFactory::getLanguage();
$currentlang = $lang->getTag();
$objectReadxmlDetail = new JSNISReadXmlDetails();
$infoXmlDetail = $objectReadxmlDetail->parserXMLDetails();
$langSupport = $infoXmlDetail['langs'];
$registry = new JRegistry();
$newStrings = array();
$path = null;
$realLang = null;
$queries = array();
if (array_key_exists($currentlang, $langSupport)) {
$path = JLanguage::getLanguagePath(JPATH_BASE, $currentlang);
$realLang = $currentlang;
} else {
$filepath = JPATH_ROOT . DS . 'administrator' . DS . 'language';
$foldersLang = $this->getFolder($filepath);
foreach ($foldersLang as $value) {
if (in_array($value, $langSupport) == true) {
$path = JLanguage::getLanguagePath(JPATH_BASE, $value);
$realLang = $value;
break;
}
}
}
$filename = $path . DS . $realLang . '.com_imageshow.ini';
$objJNSUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$content = $objJNSUtils->readFileToString($filename);
if ($content) {
$registry->loadString($content);
$newStrings = $registry->toArray();
if (count($newStrings)) {
if (count($infoXmlDetail['menu'])) {
$queries[] = 'TRUNCATE TABLE #__jsn_imageshow_messages';
foreach ($infoXmlDetail['menu'] as $value) {
$index = 1;
while (isset($newStrings['MESSAGE_' . $value . '_' . $index . '_PRIMARY'])) {
$queries[] = 'INSERT INTO #__jsn_imageshow_messages (msg_screen, published, ordering) VALUES (\'' . $value . '\', 1, ' . $index . ')';
$index++;
}
}
}
}
if (count($queries)) {
foreach ($queries as $query) {
$query = trim($query);
if ($query != '') {
$db->setQuery($query);
$db->query();
}
}
}
}
return true;
}
示例15: display
function display($tpl = null)
{
global $mainframe, $option;
$pageclassSFX = '';
$titleWillShow = '';
$app = JFactory::getApplication('site');
$input = $app->input;
$menu_params = $app->getParams('com_imageshow');
$menus = $app->getMenu();
$menu = $menus->getActive();
$jsnisID = JRequest::getInt('jsnisid', 0);
$showCaseID = $input->getInt('showcase_id', 0);
if ($jsnisID != 0) {
$pageclassSFX = $menu_params->get('pageclass_sfx');
$showPageTitle = $menu_params->get('show_page_heading');
$pageTitle = $menu_params->get('page_title');
if (!empty($showPageTitle)) {
if (!empty($pageTitle)) {
$titleWillShow = $pageTitle;
} else {
if (!empty($item->name)) {
$titleWillShow = $item->name;
}
}
}
}
$showListID = $input->getInt('showlist_id', 0);
$showBreadCrumbs = $input->getInt('show_breadcrumbs', 0);
$objJSNShow = JSNISFactory::getObj('classes.jsn_is_show');
$objUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$objJSNShowlist = JSNISFactory::getObj('classes.jsn_is_showlist');
$objJSNShowcase = JSNISFactory::getObj('classes.jsn_is_showcase');
$objJSNImages = JSNISFactory::getObj('classes.jsn_is_images');
$coreData = $objUtils->getComponentInfo();
$coreInfo = json_decode($coreData->manifest_cache);
$paramsCom = $mainframe->getParams('com_imageshow');
$randomNumber = $objUtils->randSTR(5);
$showlistInfo = $objJSNShowlist->getShowListByID($showListID);
if (count($showlistInfo) && $showBreadCrumbs) {
$pathway = $app->getPathway();
$pathway->addItem($showlistInfo['showlist_title']);
}
$articleAuth = $objJSNShow->getArticleAuth($showListID);
$row = $objJSNShowcase->getShowCaseByID($showCaseID);
$imagesData = $objJSNImages->getImagesByShowlistID($showlistInfo['showlist_id']);
$this->assignRef('titleWillShow', $titleWillShow);
$this->assignRef('showcaseInfo', $row);
$this->assignRef('randomNumber', $randomNumber);
$this->assignRef('imagesData', $imagesData);
$this->assignRef('showlistInfo', $showlistInfo);
$this->assignRef('articleAuth', $articleAuth);
$this->assignRef('pageclassSFX', $pageclassSFX);
$this->assignRef('objUtils', $objUtils);
$this->assignRef('Itemid', $menu->id);
$this->assignRef('coreInfo', $coreInfo);
parent::display($tpl);
}