本文整理汇总了PHP中JoomlapackModelRegistry类的典型用法代码示例。如果您正苦于以下问题:PHP JoomlapackModelRegistry类的具体用法?PHP JoomlapackModelRegistry怎么用?PHP JoomlapackModelRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JoomlapackModelRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finalize
/**
* Finalises the archive by compressing it. Overrides parent's method
* @return boolean TRUE on success, FALSE on failure
*/
function finalize()
{
// Get gzip's binary location
$registry = JoomlapackModelRegistry::getInstance();
$gzip = escapeshellcmd($registry->get('gzipbinary'));
// Construct and run command line
$command = "{$gzip} " . escapeshellcmd($this->_tempFilename);
JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerTARGZ :: Calling gzip. The command line is:");
JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, $command);
$result = shell_exec($command);
// Normally, gzip should be silent as a fish. If anything was sput out,
// there must have been an error.
if (strlen(trim($result)) > 0) {
$errorMessage = "Error calling gzip: " . $result . " \n Command line was: \n " . $command . " \n Please check file permissions and examine the result message for any hints regarding the problem tar faced archiving your files.";
$this->setError($errorMessage);
return false;
}
// Now, unregister the temp file (which no longer exists), register the gzipped file as
// a new temp file and try to move it
JoomlapackCUBETempfiles::unregisterAndDeleteTempFile($this->_tempFilename);
$this->_tempFilename = JoomlapackCUBETempfiles::registerTempFile(basename($this->_archiveFilename));
copy($this->_tempFilename, $this->_archiveFilename);
JoomlapackCUBETempfiles::unregisterAndDeleteTempFile($this->_tempFilename);
// If no errors occured, return true
return true;
}
示例2: selectAlgorithm
/**
* Selects the algorithm to use based on the domain name
*
* @param string $domain The domain to return algorithm for
* @return string The algorithm to use
*/
function selectAlgorithm($domain)
{
if (!class_exists('JoomlapackModelregistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
switch ($domain) {
case "installer":
switch ($registry->get('BackupType')) {
case 'full':
return 'smart';
break;
default:
return '(null)';
break;
}
break;
case "PackDB":
return $registry->get('dbAlgorithm');
break;
case "Packing":
switch ($registry->get('BackupType')) {
case 'full':
return $registry->get('packAlgorithm');
break;
default:
return '(null)';
break;
}
break;
default:
return "(null)";
break;
}
}
示例3: display
function display()
{
$task = JRequest::getCmd('task', 'default');
switch ($task) {
case 'showcomment':
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option') . '&view=buadmin');
JoomlapackHelperUtils::addLiveHelp('buadmin');
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css');
jpimport('models.statistics', true);
$model =& JoomlapackModelStatistics::getInstance('Statistics', 'JoomlapackModel');
$model->setId(JRequest::getInt('id'));
$record =& $model->getStatistic();
$this->assignRef('record', $record);
JRequest::setVar('tpl', 'comment');
break;
case 'restore':
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
JRequest::setVar('tpl', 'restore');
$this->assign('password', JRequest::getVar('password'));
$this->assign('link', JRequest::getVar('linktarget'));
break;
default:
$registry =& JoomlapackModelRegistry::getInstance();
$easy = $registry->get('easymode', false);
if (!$easy) {
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
} else {
JToolBarHelper::title(JText::_('JOOMLAPACKEASY') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
}
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JToolBarHelper::deleteList();
JToolBarHelper::custom('deletefiles', 'delete.png', 'delete_f2.png', JText::_('STATS_LABEL_DELETEFILES'), true);
JToolBarHelper::save('download', JText::_('STATS_LOG_DOWNLOAD'));
if (!$easy) {
JToolBarHelper::editList('showcomment', JText::_('STATS_LOG_VIEWCOMMENT'));
if (JPSPECIALEDITION) {
JToolBarHelper::publish('restore', JText::_('STATS_LOG_RESTORE'));
}
}
JToolBarHelper::spacer();
if (!$easy) {
JoomlapackHelperUtils::addLiveHelp('buadmin');
} else {
JoomlapackHelperUtils::addLiveHelp('buadmineasy');
}
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css');
jpimport('models.statistics', true);
$model =& JoomlapackModelStatistics::getInstance('Statistics', 'JoomlapackModel');
$list =& $model->getStatisticsListWithMeta();
$this->assignRef('list', $list);
$this->assignRef('pagination', $model->getPagination());
$this->assign('easy', $easy);
break;
}
parent::display(JRequest::getVar('tpl'));
}
示例4: init
/**
* Implements the init method of JoomlapackFilter
*
*/
function init()
{
$jreg =& JFactory::getConfig();
$configuration =& JoomlapackModelRegistry::getInstance();
$this->_skipContainedDirectoriesFilter = array();
$temp = $this->_loadFilters();
if (DS == '\\') {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . $filter);
}
}
} else {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_skipContainedDirectoriesFilter[] = JPATH_SITE . DS . $filter;
}
}
}
// Add temporary and output directories
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($configuration->get('OutputDirectory')));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($configuration->getTemporaryDirectory()));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($jreg->getValue('config.tmp_path')));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_CACHE));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_ADMINISTRATOR . DS . 'cache'));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_ROOT . DS . 'cache'));
// Hack: add the same paths untranslated
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($configuration->get('OutputDirectory'));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($configuration->getTemporaryDirectory());
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($jreg->getValue('config.tmp_path'));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_CACHE);
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_ADMINISTRATOR . DS . 'cache');
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_ROOT . DS . 'cache');
}
示例5: display
function display()
{
// Decide what to do; delegate data loading to private methods
$task = JRequest::getCmd('task', 'display');
$layout = JRequest::getCmd('layout', 'default');
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('CRONMAN') . '</small></small>');
switch ($layout) {
case 'default_edit':
// Get the CRON configuration definition
if ($task == 'add') {
$definition = null;
$registry =& JoomlapackModelRegistry::getInstance();
$secret = $registry->get('secret_key');
$this->assign('secret', $secret);
} else {
$id = JRequest::getInt('id', 0);
$model =& $this->getModel('cronman');
$definition = $model->getConfiguration($id);
}
$this->assign('definition', $definition);
// Get some lists and pass them on
$model =& $this->getModel('cronman');
$postops = $model->getPostOpList();
$this->assign('postops', $postops);
// Add the buttons
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
break;
case 'default':
default:
$this->_default();
break;
}
// Load the util helper
$this->loadHelper('utils');
// Add a spacer, a help button and show the template
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('profiles');
// Load a list of profiles
$model =& $this->getModel('cronman');
jpimport('models.profiles', true);
$profilesmodel = new JoomlapackModelProfiles();
$profiles_objects = $profilesmodel->getProfilesList(true);
$profiles = array();
foreach ($profiles_objects as $profile) {
$id = $profile->id;
$profiles[(string) $id] = $profile->description;
}
unset($profiles_objects);
unset($profilesmodel);
$this->assign('profiles', $profiles);
// Add JoomlaPack CSS
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . '/components/com_joomlapack/assets/css/joomlapack.css');
// Show the view
parent::display();
}
示例6: agree
function agree()
{
$registry =& JoomlapackModelRegistry::getInstance();
$registry->set('nagscreen', true);
$registry->save();
$registry->reload();
$this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=cpanel');
parent::redirect();
}
示例7: WriteLog
/**
* Writes a line to the log, if the log level is high enough
*
* @param int|bool $level The log level (_JP_LOG_XX constants). Use FALSE to pause logging, TRUE to resume logging
* @param string $message The message to write to the log
*/
function WriteLog($level, $message)
{
static $configuredLoglevel;
static $site_root;
if (empty($site_root)) {
if (!class_exists('JoomlapackHelperUtils')) {
jpimport('helpers.utils', true);
}
$site_root = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE);
}
if (empty($configuredLoglevel) or $level === true) {
// Load the registry
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
// Fetch log level
$configuredLoglevel = $registry->get('logLevel');
}
if ($level === false) {
// Pause logging
$configuredLogLevel = false;
return;
}
// Catch paused logging
if ($configuredLoglevel === false) {
return;
}
if ($configuredLoglevel >= $level && $configuredLoglevel != 0) {
$logName = JoomlapackLogger::logName();
$message = str_replace(JPATH_SITE, "<root>", $message);
$message = str_replace($site_root, "<root>", $message);
// Fix 2.4 - Also replace the translated path on Windows machines
$message = str_replace("\n", ' \\n ', $message);
// Fix 1.1.1 - Handle (error) messages containing newlines (by nicholas)
switch ($level) {
case _JP_LOG_ERROR:
$string = "ERROR |";
break;
case _JP_LOG_WARNING:
$string = "WARNING |";
break;
case _JP_LOG_INFO:
$string = "INFO |";
break;
default:
$string = "DEBUG |";
break;
}
$string .= @strftime("%y%m%d %T") . "|{$message}\r\n";
$fp = @fopen($logName, "at");
if (!($fp === FALSE)) {
@fwrite($fp, $string);
@fclose($fp);
}
}
}
示例8: display
/**
* Displays the editor page
*
*/
function display()
{
// Make sure we're on easy mode; otherwise redirect to Control Panel
$registry =& JoomlapackModelRegistry::getInstance();
if (!$registry->get('easymode', false)) {
$this->setRedirect(JURI::base() . 'index.php?option=' . JRequest::getCmd('option') . '&view=cpanel');
$this->redirect();
}
parent::display();
}
示例9: deleteTempFiles
function deleteTempFiles()
{
$configuration =& JoomlapackModelRegistry::getInstance();
$tempFiles = JoomlapackCUBETables::UnserializeVar('CUBETempFiles', array());
foreach ($tempFiles as $fileName) {
$file = $configuration->getTemporaryDirectory() . DS . $fileName;
if (file_exists($file)) {
@unlink($file);
}
}
JoomlapackCUBETables::DeleteVar('CUBETempFiles');
}
示例10: display
function display()
{
$task = JRequest::getCmd('task', 'default');
$act = JRequest::getCmd('act', 'start');
// Set the toolbar title
JToolBarHelper::title(JText::_('JOOMLAPACK') . ':: <small><small>' . JText::_('BACKUP') . '</small></small>');
// Load the util helper
$this->loadHelper('utils');
switch ($task) {
case 'backup':
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
$this->assign('backupMethod', $registry->get('backupMethod'));
break;
case 'error':
$this->assign('errormessage', JRequest::getString('message'));
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
break;
case 'finised':
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('backup');
break;
default:
// Add some buttons
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('backup');
// Load model
$model =& $this->getModel('backup');
// Load the Status Helper
jpimport('helpers.status', true);
$helper =& JoomlapackHelperStatus::getInstance();
// Pass on data
$this->assign('haserrors', !$helper->status);
$this->assign('hasquirks', $helper->hasQuirks());
$this->assign('quirks', $helper->getQuirksCell(!$helper->status));
$this->assign('description', $model->getDescription());
$this->assign('comment', $model->getComment());
$this->assign('profile', $model->getProfileID());
$this->assign('profilelist', $model->getProfilesList());
break;
}
$css = JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css';
$document =& JFactory::getDocument();
$document->addStyleSheet($css);
parent::display(JRequest::getCmd('tpl', null));
}
示例11: getLogFilename
function getLogFilename()
{
// Make sure the registry model is loaded
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
// Get output directory
$registry =& JoomlapackModelRegistry::getInstance();
$outdir = $registry->get('OutputDirectory');
// Get log's file name
$logName = $outdir . DS . 'joomlapack.log';
// Tidy up the path to the file
jimport('joomla.filesystem.file');
return $logName;
}
示例12: _checkPermissions
/**
* Check that the user has sufficient permissions, or die in error
*
*/
function _checkPermissions()
{
jpimport('models.registry', true);
$registry =& JoomlapackModelRegistry::getInstance();
// Is frontend backup enabled?
$febEnabled = $registry->get('enableFrontend');
if (!$febEnabled) {
die('403 ' . JText::_('ERROR_NOT_ENABLED'));
}
// Is the key good?
$key = JRequest::getVar('key');
$validKey = $registry->get('secretWord');
if ($key != $validKey) {
die('403 ' . JText::_('ERROR_INVALID_KEY'));
}
}
示例13: troubleshooter
/**
* Applies the troubleshooter's suggestion and moves on to the backup page
*
*/
function troubleshooter()
{
$model =& $this->getModel('cpanel');
$registry =& JoomlapackModelRegistry::getInstance();
$nextStep = $model->nextSettingsMode();
if (is_null($nextStep)) {
// Oops! No further action to take, brother!
$this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=cpanel', JText::_('CPANEL_TROUBLESHOOTER_ERROR'), 'error');
return;
} else {
$registry->set('settingsmode', $nextStep);
$registry->save();
$registry->reload();
$this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=backup');
}
}
示例14: array
function &getFolders($folder)
{
// Was the breakflag set BEFORE starting? -- This workaround is required due to PHP5 defaulting to assigning variables by reference
$breakflag_before_process = $this->BREAKFLAG ? true : false;
// Reset break flag before continuing
$this->BREAKFLAG = false;
// Initialize variables
$arr = array();
$false = false;
if (!is_dir($folder)) {
return $false;
}
$counter = 0;
$registry =& JoomlapackModelRegistry::getInstance();
$maxCounter = $registry->get('mnMaxFragmentFiles', 50) * 2;
$cube =& JoomlapackCUBE::getInstance();
$allowBreakflag = $cube->operationCounter != 0 && !$breakflag_before_process;
$handle = @opendir($folder);
// If directory is not accessible, just return FALSE
if ($handle === FALSE) {
$cube =& JoomlapackCUBE::getInstance();
$cube->addWarning('Unreadable directory ' . $folder);
return $false;
}
while (($file = @readdir($handle)) !== false && !$this->BREAKFLAG) {
if ($file != '.' && $file != '..') {
// # Fix 2.4: Do not add DS if we are on the site's root and it's an empty string
$ds = $folder == '' || $folder == '/' || @substr($folder, -1) == '/' || @substr($folder, -1) == DS ? '' : DS;
$dir = $folder . $ds . $file;
$isDir = is_dir($dir);
if ($isDir) {
$data = JPISWINDOWS ? JoomlapackHelperUtils::TranslateWinPath($dir) : $dir;
if ($data) {
$arr[] = $data;
}
}
}
$counter++;
if ($counter >= $maxCounter) {
$this->BREAKFLAG = $allowBreakflag;
}
}
@closedir($handle);
return $arr;
}
示例15: init
/**
* Loads the file filters off the database and stores them in the _singleFileFilters array
*
*/
function init()
{
$configuration =& JoomlapackModelRegistry::getInstance();
$temp = $this->_loadFilters();
$this->_singleFileFilters = array();
if (DS == '\\') {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_singleFileFilters[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . $filter);
}
}
} else {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_singleFileFilters[] = JPATH_SITE . DS . $filter;
}
}
}
}