本文整理汇总了PHP中AEPlatform::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP AEPlatform::getInstance方法的具体用法?PHP AEPlatform::getInstance怎么用?PHP AEPlatform::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AEPlatform
的用法示例。
在下文中一共展示了AEPlatform::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply
/**
* Handle the apply task which saves settings and shows the editor again
*
*/
public function apply()
{
// CSRF prevention
if (!JRequest::getVar(JUtility::getToken(), false, 'POST')) {
JError::raiseError('403', JText::_(version_compare(JVERSION, '1.6.0', 'ge') ? 'JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN' : 'Request Forbidden'));
}
// Get the var array from the request
$var = JRequest::getVar('var', array(), 'default', 'array');
// Make it into Akeeba Engine array format
$data = array();
foreach ($var as $key => $value) {
$data[$key] = $value;
}
// Forbid stupidly selecting the site's root as the output or temporary directory
if (array_key_exists('akeeba.basic.output_directory', $data)) {
$folder = $data['akeeba.basic.output_directory'];
$folder = AEUtilFilesystem::translateStockDirs($folder, true, true);
$check = AEUtilFilesystem::translateStockDirs('[SITEROOT]', true, true);
if ($check == $folder) {
JError::raiseWarning(503, JText::_('CONFIG_OUTDIR_ROOT'));
$data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]';
}
}
// Merge it
$config = AEFactory::getConfiguration();
$config->mergeArray($data, false, false);
// Save configuration
AEPlatform::getInstance()->save_configuration();
$this->setRedirect(JURI::base() . 'index.php?option=' . JRequest::getCmd('option') . '&view=config', JText::_('CONFIG_SAVE_OK'));
}
示例2: processPart
public function processPart($absolute_filename)
{
// Retrieve engine configuration data
$config = AEFactory::getConfiguration();
$address = trim($config->get('engine.postproc.email.address', ''));
$subject = $config->get('engine.postproc.email.subject', '0');
// Sanity checks
if (empty($address)) {
$this->setError('You have not set up a recipient\'s email address for the backup files');
return false;
}
// Send the file
$basename = basename($absolute_filename);
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Preparing to email {$basename} to {$address}");
if (empty($subject)) {
$subject = JText::_('AKEEBA_DEFAULT_EMAIL_SUBJECT');
}
$body = "Emailing {$basename}";
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Subject: {$subject}");
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Body: {$body}");
$result = AEPlatform::getInstance()->send_email($address, $subject, $body, $absolute_filename);
// Return the result
if ($result !== true) {
// An error occured
$this->setError($result);
// Notify that we failed
return false;
} else {
// Return success
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Email sent successfully");
return true;
}
}
示例3: _default
/**
* The default layout, shows a list of profiles
*
*/
function _default()
{
// Get reference to profiles model
$model =& $this->getModel('profiles');
// Load list of profiles
$profiles = $model->getProfilesList();
$this->assign('profiles', $profiles);
// Get profile ID
$profileid = AEPlatform::getInstance()->get_active_profile();
$this->assign('profileid', $profileid);
// Get profile name
$model->setId($profileid);
$profile_data = $model->getProfile();
$this->assign('profilename', $profile_data->description);
// Add toolbar buttons
JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JToolBarHelper::addNew();
if (version_compare(JVERSION, '1.6.0', 'ge')) {
JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'JLIB_HTML_BATCH_COPY', false);
} else {
JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'Copy', false);
}
JToolBarHelper::spacer();
JToolBarHelper::deleteList();
JToolBarHelper::spacer();
}
示例4: __construct
public function __construct()
{
$this->object = 'dir';
$this->subtype = 'inclusion';
$this->method = 'direct';
// FIXME This filter doesn't work very well on many live hosts. Disabled for now.
parent::__construct();
return;
if (empty($this->filter_name)) {
$this->filter_name = strtolower(basename(__FILE__, '.php'));
}
// Get the saved library path and compare it to the default
$jlibdir = AEPlatform::getInstance()->get_platform_configuration_option('jlibrariesdir', '');
if (empty($jlibdir)) {
if (defined('JPATH_LIBRARIES')) {
$jlibdir = JPATH_LIBRARIES;
} elseif (defined('JPATH_PLATFORM')) {
$jlibdir = JPATH_PLATFORM;
} else {
$jlibdir = false;
}
}
if ($jlibdir !== false) {
$jlibdir = AEUtilFilesystem::TranslateWinPath($jlibdir);
$defaultLibraries = AEUtilFilesystem::TranslateWinPath(JPATH_SITE . '/libraries');
if ($defaultLibraries != $jlibdir) {
// The path differs, add it here
$this->filter_data['JPATH_LIBRARIES'] = $jlibdir;
}
} else {
$this->filter_data = array();
}
parent::__construct();
}
示例5: getauth
/**
* Fetches the authentication token from Dropbox.com, after you've run the
* first step of the OAuth process.
*
* @return array
*/
public function getauth()
{
$keys = $this->_getKeys();
$api = new AEUtilDropbox();
$api->setAppKeys($keys);
$data = AEPlatform::getInstance()->get_flash_variable('dropbox.reqtoken', null);
$reqToken = unserialize(base64_decode($data));
$api->setReqToken($reqToken);
$token = null;
try {
$api->setSignatureMethod('HMAC-SHA1');
$api->getAccessToken();
$token = true;
} catch (Exception $e) {
$api->setSignatureMethod('PLAINTEXT');
}
if (is_null($token)) {
try {
$token = $api->getAccessToken();
} catch (Exception $e) {
return array('error' => 'Did not receive token from Dropbox', 'token' => $e->getMessage());
}
}
$token = $api->getToken();
return array('error' => '', 'token' => $token);
}
示例6: __construct
function __construct()
{
$useSVNSource = AEPlatform::getInstance()->get_platform_configuration_option('usesvnsource', 0);
// Determine the appropriate update URL based on whether we're on Core or Professional edition
AEPlatform::getInstance()->load_version_defines();
if (!$useSVNSource) {
$fname = 'http://nocdn.akeebabackup.com/updates/ab';
$fname .= AKEEBA_PRO == 1 ? 'pro' : 'core';
$fname .= '.ini';
} else {
$fname = 'http://www.akeebabackup.com/updates/ab';
$fname .= AKEEBA_PRO == 1 ? 'pro' : 'core';
$fname .= 'svn.ini';
}
$this->_updateURL = $fname;
$this->_extensionTitle = 'Akeeba Backup ' . (AKEEBA_PRO == 1 ? 'Professional' : 'Core');
$this->_requiresAuthorization = AKEEBA_PRO == 1;
$this->_currentVersion = AKEEBA_VERSION;
$this->_currentReleaseDate = AKEEBA_DATE;
parent::__construct();
$this->_downloadID = AEPlatform::getInstance()->get_platform_configuration_option('update_dlid', '');
if (AKEEBA_PRO) {
$this->_minStability = AEPlatform::getInstance()->get_platform_configuration_option('minstability', 'stable');
} else {
$this->_minStability = 'stable';
}
$this->_cacerts = dirname(__FILE__) . '/../akeeba/assets/cacert.pem';
if (substr($this->_currentVersion, 0, 3) == 'svn') {
$this->_versionStrategy = 'newest';
}
}
示例7: __construct
public function __construct()
{
$this->object = 'dir';
$this->subtype = 'content';
$this->method = 'direct';
$this->filter_name = 'PlatformSkipfiles';
if (AEFactory::getKettenrad()->getTag() == 'restorepoint') {
$this->enabled = false;
}
// We take advantage of the filter class magic to inject our custom filters
$configuration = AEFactory::getConfiguration();
$jreg = JFactory::getConfig();
if (version_compare(JVERSION, '3.0', 'ge')) {
$tmpdir = $jreg->get('tmp_path');
} else {
$tmpdir = $jreg->getValue('config.tmp_path');
}
// Get the site's root
if ($configuration->get('akeeba.platform.override_root', 0)) {
$root = $configuration->get('akeeba.platform.newroot', '[SITEROOT]');
} else {
$root = '[SITEROOT]';
}
$this->filter_data[$root] = array(self::treatDirectory($configuration->get('akeeba.basic.output_directory')), self::treatDirectory($tmpdir), 'tmp', self::treatDirectory(JPATH_CACHE), self::treatDirectory(JPATH_ADMINISTRATOR . '/cache'), self::treatDirectory(JPATH_ROOT . '/cache'), 'cache', 'administrator/cache', self::treatDirectory(JPATH_ROOT . '/installation'), 'installation', self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/cache'), self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/administrator/cache'), 'administrator/components/com_akeeba/backup', self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/components/libraries/cmslib/cache'), 'components/libraries/cmslib/cache', 'logs');
parent::__construct();
}
示例8: display
public function display($tpl = null)
{
// Add toolbar buttons
JToolBarHelper::title(JText::_('AKEEBA') . ': <small>' . JText::_('VIEWLOG') . '</small>', 'akeeba');
JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
$document = JFactory::getDocument();
$document->addStyleSheet(JURI::base() . '../media/com_akeeba/theme/akeebaui.css?' . AKEEBAMEDIATAG);
// Add live help
AkeebaHelperIncludes::addHelp();
// Get a list of log names
if (!class_exists('AkeebaModelLog')) {
JLoader::import('models.log', JPATH_COMPONENT_ADMINISTRATOR);
}
$model = new AkeebaModelLog();
$this->assign('logs', $model->getLogList());
$tag = JRequest::getCmd('tag', null);
if (empty($tag)) {
$tag = null;
}
$this->assign('tag', $tag);
// Get profile ID
$profileid = AEPlatform::getInstance()->get_active_profile();
$this->assign('profileid', $profileid);
// Get profile name
if (!class_exists('AkeebaModelProfiles')) {
JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
}
$model = new AkeebaModelProfiles();
$model->setId($profileid);
$profile_data = $model->getProfile();
$this->assign('profilename', $profile_data->description);
AkeebaHelperIncludes::includeMedia(false);
parent::display($tpl);
}
示例9: download
public function download()
{
AEPlatform::getInstance()->load_configuration(AEPlatform::getInstance()->get_active_profile());
$tag = JRequest::getCmd('tag', null);
$filename = AEUtilLogger::logName($tag);
@ob_end_clean();
// In case some braindead plugin spits its own HTML
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header("Content-Description: File Transfer");
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="Akeeba Backup Debug Log.txt"');
echo "WARNING: Do not copy and paste lines from this file!\r\n";
echo "You are supposed to ZIP and attach it in your support forum post.\r\n";
echo "If you fail to do so, your support request will receive minimal priority.\r\n";
echo "\r\n";
echo "--- START OF RAW LOG --\r\n";
@readfile($filename);
// The at sign is necessary to skip showing PHP errors if the file doesn't exist or isn't readable for some reason
echo "--- END OF RAW LOG ---\r\n";
flush();
JFactory::getApplication()->close();
}
示例10: onAdd
public function onAdd($tpl = null)
{
$media_folder = JURI::base() . '../media/com_akeeba/';
// Get a JSON representation of GUI data
$json = AkeebaHelperEscape::escapeJS(AEUtilInihelper::getJsonGuiDefinition(), '"\\');
$this->assignRef('json', $json);
// Get profile ID
$profileid = AEPlatform::getInstance()->get_active_profile();
$this->assign('profileid', $profileid);
// Get profile name
$profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
$this->assign('profilename', $profileName);
// Get the root URI for media files
$this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
// Are the settings secured?
if (AEPlatform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) {
$this->assign('securesettings', -1);
} elseif (!AEUtilSecuresettings::supportsEncryption()) {
$this->assign('securesettings', 0);
} else {
JLoader::import('joomla.filesystem.file');
$filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php';
if (JFile::exists($filename)) {
$this->assign('securesettings', 1);
} else {
$this->assign('securesettings', 0);
}
}
// Add live help
AkeebaHelperIncludes::addHelp('config');
}
示例11: __construct
/**
* Database object constructor
* @param array List of options used to configure the connection
*/
public function __construct($options = array())
{
// Get best matching Akeeba Backup driver instance
if (class_exists('JFactory')) {
$db = JFactory::getDBO();
switch ($db->name) {
case 'mysql':
$driver = 'mysql';
break;
case 'mysqli':
$driver = 'mysqli';
break;
case 'sqlsrv':
case 'mssql':
$driver = 'sqlsrv';
break;
case 'sqlazure':
$driver = 'sqlsrv';
break;
default:
$driver = '';
return;
// Brace yourself, this engine is going down crashing in flames.
break;
}
$options['connection'] = $db->getConnection();
$driver = 'AEDriver' . ucfirst($driver);
} else {
$driver = AEPlatform::getInstance()->get_default_database_driver(false);
}
$this->dbo = new $driver($options);
// Propagate errors
$this->propagateFromObject($this->dbo);
}
示例12: __construct
public function __construct()
{
// This is a directory inclusion filter.
$this->object = 'db';
$this->subtype = 'inclusion';
$this->method = 'direct';
$this->filter_name = 'PlatformSitedb';
// Add a new record for the core Joomla! database
// Get core database options
$options = AEPlatform::getInstance()->get_platform_database_options();
$host = $options['host'];
$port = NULL;
$socket = NULL;
$targetSlot = substr(strstr($host, ":"), 1);
if (!empty($targetSlot)) {
// Get the port number or socket name
if (is_numeric($targetSlot)) {
$port = $targetSlot;
} else {
$socket = $targetSlot;
}
// Extract the host name only
$host = substr($host, 0, strlen($host) - (strlen($targetSlot) + 1));
// This will take care of the following notation: ":3306"
if ($host == '') {
$host = 'localhost';
}
}
// This is the format of the database inclusion filters
$entry = array('host' => $host, 'port' => is_null($socket) ? is_null($port) ? '' : $port : $socket, 'username' => $options['user'], 'password' => $options['password'], 'database' => $options['database'], 'prefix' => $options['prefix'], 'dumpFile' => 'joomla.sql', 'driver' => AEPlatform::getInstance()->get_default_database_driver(true));
// We take advantage of the filter class magic to inject our custom filters
$configuration =& AEFactory::getConfiguration();
$this->filter_data['[SITEDB]'] = $entry;
parent::__construct();
}
示例13: import
public function import($file)
{
$directory = $this->getState('directory', '');
$directory = AEUtilFilesystem::translateStockDirs($directory);
// Find out how many parts there are
$multipart = 0;
$base = substr($file, 0, -4);
$ext = substr($file, -3);
$found = true;
$total_size = @filesize($directory . '/' . $file);
while ($found) {
$multipart++;
$newExtension = substr($ext, 0, 1) . sprintf('%02u', $multipart);
$newFile = $directory . '/' . $base . '.' . $newExtension;
$found = file_exists($newFile);
if ($found) {
$total_size += @filesize($newFile);
}
}
$filetime = @filemtime($directory . '/' . $file);
if (empty($filetime)) {
$filetime = time();
}
// Create a new backup record
$record = array('description' => JText::_('DISCOVER_LABEL_IMPORTEDDESCRIPTION'), 'comment' => '', 'backupstart' => date('Y-m-d H:i:s', $filetime), 'backupend' => date('Y-m-d H:i:s', $filetime + 1), 'status' => 'complete', 'origin' => 'backend', 'type' => 'full', 'profile_id' => 1, 'archivename' => $file, 'absolute_path' => $directory . '/' . $file, 'multipart' => $multipart, 'tag' => 'backend', 'filesexist' => 1, 'remote_filename' => '', 'total_size' => $total_size);
$id = null;
$id = AEPlatform::getInstance()->set_or_update_statistics($id, $record, $this);
}
示例14: onBrowse
public function onBrowse($tpl = null)
{
$model = $this->getModel();
$task = $model->getState('browse_task', 'normal');
// Add custom submenus
$toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config);
$toolbar->appendLink(JText::_('FILTERS_LABEL_NORMALVIEW'), JURI::base() . 'index.php?option=com_akeeba&view=dbef&task=normal', $task == 'normal');
$toolbar->appendLink(JText::_('FILTERS_LABEL_TABULARVIEW'), JURI::base() . 'index.php?option=com_akeeba&view=dbef&task=tabular', $task == 'tabular');
$media_folder = JURI::base() . '../media/com_akeeba/';
// Get the root URI for media files
$this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
// Get a JSON representation of the available roots
$model = $this->getModel();
$root_info = $model->get_roots();
$roots = array();
if (!empty($root_info)) {
// Loop all dir definitions
foreach ($root_info as $def) {
$roots[] = $def->value;
$options[] = JHTML::_('select.option', $def->value, $def->text);
}
}
$site_root = '[SITEDB]';
$attribs = 'onchange="akeeba_active_root_changed();"';
$this->assign('root_select', JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root'));
$this->assign('roots', $roots);
switch ($task) {
case 'normal':
default:
$this->setLayout('default');
// Get a JSON representation of the database data
$model = $this->getModel();
$json = json_encode($model->make_listing($site_root));
$this->assignRef('json', $json);
break;
case 'tabular':
$this->setLayout('tabular');
// Get a JSON representation of the tabular filter data
$model = $this->getModel();
$json = json_encode($model->get_filters($site_root));
$this->assignRef('json', $json);
break;
}
// Add live help
AkeebaHelperIncludes::addHelp('dbef');
// Get profile ID
$profileid = AEPlatform::getInstance()->get_active_profile();
$this->assign('profileid', $profileid);
// Get profile name
if (!class_exists('AkeebaModelProfiles')) {
JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
}
$model = new AkeebaModelProfiles();
$model->setId($profileid);
$profile_data = $model->getProfile();
$this->assign('profilename', $profile_data->description);
return true;
}
示例15: onEdit
public function onEdit($tpl = null)
{
$model = $this->getModel();
$id = $model->getId();
$record = AEPlatform::getInstance()->get_statistics($id);
$this->record = $record;
$this->record_id = $id;
$this->setLayout('comment');
}