本文整理汇总了PHP中JClientHelper类的典型用法代码示例。如果您正苦于以下问题:PHP JClientHelper类的具体用法?PHP JClientHelper怎么用?PHP JClientHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JClientHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
JToolBarHelper::title(JText::_('Template Manager'), 'thememanager');
JToolBarHelper::custom('edit', 'back.png', 'back_f2.png', 'Back', false, false);
require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'templates.php';
// Initialise some variables
$option = JRequest::getCmd('option');
$id = JRequest::getVar('id', '', 'method', 'int');
$template = TemplatesHelper::getTemplateName($id);
$client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
$tp = true;
$url = $client->id ? JURI::base() : JURI::root();
if (!$template) {
return JError::raiseWarning(500, JText::_('Template not specified'));
}
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
$this->assignRef('option', $option);
$this->assignRef('client', $client);
$this->assignRef('id', $id);
$this->assignRef('template', $template);
$this->assignRef('tp', $tp);
$this->assignRef('url', $url);
parent::display($tpl);
}
示例2: displayTask
/**
* Display a list of uninstalled extensions
*
* @return void
*/
public function displayTask()
{
$model = new Models\Manage();
$this->view->state = $model->getState();
$this->view->items = $model->getItems();
$this->view->pagination = $model->getPagination();
$this->view->form = $model->getForm();
// Check for errors.
if (count($errors = $model->getErrors())) {
App::abort(500, implode("\n", $errors));
}
//Check if there are no matching items
if (!count($this->view->items)) {
Notify::warning(Lang::txt('COM_INSTALLER_MSG_MANAGE_NOEXTENSION'));
}
$this->view->ftp = \JClientHelper::setCredentialsFromRequest('ftp');
$showMessage = false;
if (is_object($this->view->state)) {
$message1 = $this->view->state->get('message');
$message2 = $this->view->state->get('extension_message');
$showMessage = $message1 || $message2;
}
$this->view->showMessage = $showMessage;
// Include the component HTML helpers.
Html::addIncludePath(dirname(__DIR__) . '/helpers/html');
$this->view->display();
}
示例3: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a Error object.
*
* @since 3.6
*/
public function display($tpl = null)
{
$this->user = JFactory::getUser();
$this->bar = JToolbar::getInstance('toolbar');
$ftp = !JClientHelper::hasCredentials('ftp');
$images = $this->get('images');
$subfolders = $this->get('folders');
$folders = $this->getModel()->getFolders(COM_MEDIA_BASE);
$currentFolder = $this->getModel()->getCurrentFolder();
$state = $this->get('state');
$this->session = JFactory::getSession();
$this->config = JComponentHelper::getParams('com_media');
$this->state = $this->get('state');
$this->require_ftp = $ftp;
$this->images = $images;
$this->folders = $folders;
$this->current_folder = $currentFolder;
$this->subfolders = $subfolders;
$this->state = $state;
if ($this->state->folder === "") {
$this->state->folder = COM_MEDIA_BASEURL;
}
// Set the toolbar
$this->addToolbar();
parent::display($tpl);
}
示例4: display
/**
* Method to display the view.
*/
public function display($tpl = null)
{
$form = $this->get('Form');
$data = $this->get('Data');
$user = JFactory::getUser();
// Check for model errors.
if ($errors = $this->get('Errors')) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Bind the form to the data.
if ($form && $data) {
$form->bind($data);
}
// Get the params for com_users.
$usersParams = JComponentHelper::getParams('com_users');
// Get the params for com_media.
$mediaParams = JComponentHelper::getParams('com_media');
// Load settings for the FTP layer.
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$this->form =& $form;
$this->data =& $data;
$this->ftp =& $ftp;
$this->usersParams =& $usersParams;
$this->mediaParams =& $mediaParams;
$this->components = ConfigHelperComponent::getComponentsWithConfig();
ConfigHelperComponent::loadLanguageForComponents($this->components);
$this->userIsSuperAdmin = $user->authorise('core.admin');
$this->addToolbar();
parent::display($tpl);
}
示例5: saveParams
/**
* TuiyoParameter::saveParams()
*
* @param mixed $postParams
* @param mixed $key
* @param string $type
* @return
*/
public function saveParams($postParams, $key, $type = "system")
{
jimport('joomla.filesystem.file');
jimport('joomla.client.helper');
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
$ftp = JClientHelper::getCredentials('ftp');
$file = TUIYO_CONFIG . DS . strtolower($key) . ".ini";
if (JFile::exists($file)) {
JFile::write($file);
}
if (count($postParams)) {
$registry = new JRegistry();
$registry->loadArray($postParams);
$iniTxt = $registry->toString();
// Try to make the params file writeable
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) {
JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file writable'));
return false;
}
//Write the file
$return = JFile::write($file, $iniTxt);
// Try to make the params file unwriteable
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file unwritable'));
return false;
}
if (!$return) {
JError::raiseError(TUIYO_SERVER_ERROR, _("Could not save the template parameters"));
return false;
}
return $return;
}
}
示例6: display
function display($tpl = null)
{
$config = JComponentHelper::getParams('com_media');
$app = JFactory::getApplication();
$lang = JFactory::getLanguage();
$append = '';
$clave = JRequest::getVar('clave');
JHtml::_('behavior.framework', true);
JHtml::_('script', 'media/popup-imagemanager.js', true, true);
JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true);
if ($lang->isRTL()) {
JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true);
}
/*
* Display form for FTP credentials?
* Don't set them here, as there are other functions called before this one if there is any file write operation
*/
$ftp = !JClientHelper::hasCredentials('ftp');
$this->session = JFactory::getSession();
$this->config = $config;
$this->state = $this->get('state');
$this->folderList = $this->get('folderList');
$this->require_ftp = $ftp;
parent::display($tpl);
}
示例7: com_install
function com_install()
{
global $mainframe;
jimport('joomla.filesystem.folder');
// Initialize variables
jimport('joomla.client.helper');
$FTPOptions = JClientHelper::getCredentials('ftp');
$language =& JFactory::getLanguage();
$language->load('com_jce_imgmanager_ext', JPATH_SITE);
$cache = $mainframe->getCfg('tmp_path');
// Check for tmp folder
if (!JFolder::exists($cache)) {
// Create if does not exist
if (!JFolder::create($cache)) {
$mainframe->enqueueMessage(JText::_('NO CACHE DESC'), 'error');
}
}
// Check if folder exists and is writable or the FTP layer is enabled
if (JFolder::exists($cache) && (is_writable($cache) || $FTPOptions['enabled'] == 1)) {
$mainframe->enqueueMessage(JText::_('CACHE DESC'));
} else {
$mainframe->enqueueMessage(JText::_('NO CACHE DESC'), 'error');
}
// Check for GD
if (!function_exists('gd_info')) {
$mainframe->enqueueMessage(JText::_('NO GD DESC'), 'error');
} else {
$info = gd_info();
$mainframe->enqueueMessage(JText::_('GD DESC') . ' - ' . $info['GD Version']);
}
}
示例8: upload
/**
* Upload a file
* @param string $source File to upload
* @param string $destination Upload to here
* @return True on success
*/
public static function upload($source, $destination)
{
$err = null;
$ret = false;
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
// Load configurations.
$config = CFactory::getConfig();
// Make the filename safe
jimport('joomla.filesystem.file');
if (!isset($source['name'])) {
JError::raiseNotice(100, JText::_('COM_COMMUNITY_INVALID_FILE_REQUEST'));
return $ret;
}
$source['name'] = JFile::makeSafe($source['name']);
if (is_dir($destination)) {
jimport('joomla.filesystem.folder');
JFolder::create($destination, (int) octdec($config->get('folderpermissionsvideo')));
JFile::copy(JPATH_ROOT . '/components/com_community/index.html', $destination . '/index.html');
$destination = JPath::clean($destination . '/' . strtolower($source['name']));
}
if (JFile::exists($destination)) {
JError::raiseNotice(100, JText::_('COM_COMMUNITY_FILE_EXISTS'));
return $ret;
}
if (!JFile::upload($source['tmp_name'], $destination)) {
JError::raiseWarning(100, JText::_('COM_COMMUNITY_UNABLE_TO_UPLOAD_FILE'));
return $ret;
} else {
$ret = true;
return $ret;
}
}
示例9: display
function display($tpl = null)
{
global $mainframe;
$config =& JComponentHelper::getParams('com_media');
$app = JFactory::getApplication();
$append = '';
if ($app->getClientId() == 1) {
$append = 'administrator/';
}
JHTML::_('script', 'popup-imagemanager.js', $append . 'components/com_media/assets/');
JHTML::_('stylesheet', 'popup-imagemanager.css', $append . 'components/com_media/assets/');
if ($config->get('enable_flash', 1)) {
JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ ImageManager.refreshFrame(); }'));
}
/*
* Display form for FTP credentials?
* Don't set them here, as there are other functions called before this one if there is any file write operation
*/
jimport('joomla.client.helper');
$ftp = !JClientHelper::hasCredentials('ftp');
$this->assignRef('session', JFactory::getSession());
$this->assignRef('config', $config);
$this->assignRef('state', $this->get('state'));
$this->assignRef('folderList', $this->get('folderList'));
$this->assign('require_ftp', $ftp);
parent::display($tpl);
}
示例10: admin_postinstall_eaccelerator_action
/**
* Disables the unsupported eAccelerator caching method, replacing it with the
* "file" caching method.
*
* @return void
*
* @since 3.2
*/
function admin_postinstall_eaccelerator_action()
{
$prev = new JConfig();
$prev = JArrayHelper::fromObject($prev);
$data = array('cacheHandler' => 'file');
$data = array_merge($prev, $data);
$config = new Registry('config');
$config->loadArray($data);
jimport('joomla.filesystem.path');
jimport('joomla.filesystem.file');
// Set the configuration file path.
$file = JPATH_CONFIGURATION . '/configuration.php';
// Get the new FTP credentials.
$ftp = JClientHelper::getCredentials('ftp', true);
// Attempt to make the file writeable if using FTP.
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
}
// Attempt to write the configuration file as a PHP class named JConfig.
$configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
if (!JFile::write($file, $configuration)) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
return;
}
// Attempt to make the file unwriteable if using FTP.
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
}
}
示例11: com_install
function com_install()
{
$mainframe = JFactory::getApplication();
jimport('joomla.filesystem.folder');
// Initialize variables
jimport('joomla.client.helper');
$FTPOptions = JClientHelper::getCredentials('ftp');
$language = JFactory::getLanguage();
$language->load('com_jce_imgmanager_ext', JPATH_SITE);
$cache = $mainframe->getCfg('tmp_path');
// Check for tmp folder
if (!JFolder::exists($cache)) {
// Create if does not exist
if (!JFolder::create($cache)) {
$mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_CACHE_DESC'), 'error');
}
}
// Check if folder exists and is writable or the FTP layer is enabled
if (JFolder::exists($cache) && (is_writable($cache) || $FTPOptions['enabled'] == 1)) {
$mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_CACHE_DESC'));
} else {
$mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_CACHE_DESC'), 'error');
}
// Check for GD
if (!function_exists('gd_info')) {
$mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_GD_DESC'), 'error');
} else {
$info = gd_info();
$mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_GD_DESC') . ' - ' . $info['GD Version']);
}
// remove wideimage folder
if (JFolder::exists(dirname(__FILE) . '/classes/wideimage')) {
@JFolder::delete(dirname(__FILE) . '/classes/wideimage');
}
}
示例12: display
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/installer.php';
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = JRequest::getCmd('view', 'install');
$vFormat = $document->getType();
$lName = JRequest::getCmd('layout', 'default');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat)) {
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
// Get the model for the view.
$model = $this->getModel($vName);
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->assignRef('document', $document);
// Load the submenu.
InstallerHelper::addSubmenu($vName);
$view->display();
}
return $this;
}
示例13: display
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 2.5.4
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = JRequest::getCmd('view', 'default');
$vFormat = $document->getType();
$lName = JRequest::getCmd('layout', 'default');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat)) {
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
// Get the model for the view.
$model = $this->getModel($vName);
// Perform update source preference check and refresh update information
$model->applyUpdateSite();
$model->refreshUpdates();
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->assignRef('document', $document);
$view->display();
}
return $this;
}
示例14: create
/**
* create
*
* Creates and then Installs a Molajo Extension as per user instructions
*
* Note: was not able to use the create controller - the form submit of create.create did not find the folder/file
* Change the task to create and added the create method to the display controller
* JLoader::register('InstallerControllerCreate', MOLAJO_LIBRARY_COM_JFOOBARER.'/controllers/create.php');
* require_once MOLAJO_LIBRARY_COM_JFOOBARER.'/controllers/create.php';
*
* @return boolean result of install
*/
function create()
{
/** set ftp credentials, if used **/
JClientHelper::setCredentialsFromRequest('ftp');
/** component */
if ($this->getState('create.createtype') == 'component') {
return $this->_createComponent();
} else {
if ($this->getState('create.createtype') == 'module') {
return $this->_createModule();
} else {
if ($this->getState('create.createtype') == 'plugin') {
return $this->_createPlugin();
} else {
if ($this->getState('create.createtype') == 'layout') {
return $this->_createLayout();
} else {
if ($this->getState('create.createtype') == 'template') {
return $this->_createTemplate();
} else {
JFactory::getApplication()->enqueueMessage(JText::_('PLG_SYSTEM_CREATE_INVALID_EXTENSION_TYPE_FAILED') . ': ' . $this->getState('create.createtype'), 'error');
return false;
}
}
}
}
}
}
示例15: display
/**
* Display the view
*/
public function display($tpl = null)
{
JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css');
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->ftp = JClientHelper::setCredentialsFromRequest('ftp');
$this->tmpl = new StdClass();
$model = $this->getModel();
// Set CSS for codemirror
JFactory::getApplication()->setUserState('editor.source.syntax', 'css');
// New or edit
if (!$this->form->getValue('id') || $this->form->getValue('id') == 0) {
$this->form->setValue('source', null, '');
$this->form->setValue('type', null, 2);
$this->tmpl->suffixtype = JText::_('COM_PHOCAGALERY_WILL_BE_CREATED_FROM_TITLE');
} else {
$this->source = $model->getSource($this->form->getValue('id'), $this->form->getValue('filename'), $this->form->getValue('type'));
$this->form->setValue('source', null, $this->source->source);
$this->tmpl->suffixtype = '';
}
// Only help input form field - to display Main instead of 1 and Custom instead of 2
if ($this->form->getValue('type') == 1) {
$this->form->setValue('typeoutput', null, JText::_('COM_PHOCAGALLERY_MAIN_CSS'));
} else {
$this->form->setValue('typeoutput', null, JText::_('COM_PHOCAGALLERY_CUSTOM_CSS'));
}
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
parent::display($tpl);
}