• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP JFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中JFile的典型用法代码示例。如果您正苦于以下问题:PHP JFile类的具体用法?PHP JFile怎么用?PHP JFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了JFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getInput

 public function getInput()
 {
     jimport('joomla.filesystem.file');
     $mainframe = JFactory::getApplication();
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php')) {
         $mainframe->enqueueMessage(JText::_('JM_PLEASE_INSTALL_JOOMLAMAILER'), 'error');
         $mainframe->redirect('index.php');
     }
     $listId = $this->form->getValue('listid', 'params');
     require_once JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php';
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $api = new joomlamailerMCAPI($MCapi);
     $interests = $api->listInterestGroupings($listId);
     $options = array();
     if ($interests) {
         foreach ($interests as $interest) {
             if ($interest['form_field'] != 'hidden') {
                 $groups = array();
                 foreach ($interest['groups'] as $ig) {
                     $groups[] = $ig['name'];
                 }
                 $groups = implode('####', $groups);
                 $options[] = array('id' => $interest['id'] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, 'name' => $interest['name']);
             }
         }
     }
     if (count($options)) {
         return JHtml::_('select.genericlist', $options, 'jform[params][interests][]', 'multiple="multiple"', 'id', 'name', $this->value, $this->id);
     } else {
         return JText::_('JM_NO_INTEREST_GROUPS');
     }
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:33,代码来源:interests.php


示例2: com_install

function com_install()
{
    $file = new JFile();
    $basePath = 'libraries' . DS . 'solr' . DS;
    $basePathClient = $basePath . 'client.php';
    $basePathQuery = $basePath . 'query.php';
    $dest = JPATH_LIBRARIES . DS . 'solr' . DS;
    $file->copy($basePathClient, $dest);
    $file->copy($basePathQuery, $dest);
}
开发者ID:BGCX261,项目名称:zonales-svn-to-git,代码行数:10,代码来源:install.eqzonales.php


示例3: display

 /**
  * Display
  *
  * @param   string  $tmpl  Template
  *
  * @return  void
  */
 public function display($tmpl = 'default')
 {
     $srcs = FabrikHelperHTML::framework();
     $app = JFactory::getApplication();
     $input = $app->input;
     FabrikHelperHTML::script($srcs);
     $model = $this->getModel();
     $usersConfig = JComponentHelper::getParams('com_fabrik');
     $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
     $visualization = $model->getVisualization();
     $pluginParams = $model->getPluginParams();
     $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikModel');
     $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization');
     $plugin->_row = $visualization;
     if ($visualization->published == 0) {
         return JError::raiseWarning(500, FText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED'));
     }
     // Plugin is basically a model
     $pluginTask = $input->get('plugintask', 'render', 'request');
     // @FIXME cant set params directly like this, but I think plugin model setParams() is not right
     $plugin->_params = $pluginParams;
     $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl);
     $plugin->{$pluginTask}($this);
     $this->plugin = $plugin;
     $viewName = $this->getName();
     $this->addTemplatePath($this->_basePath . '/plugins/' . $this->_name . '/' . $plugin->_name . '/tmpl/' . $tmpl);
     $root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE;
     $this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/visualization/' . $plugin->_name . '/' . $tmpl);
     $ab_css_file = JPATH_SITE . '/plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/template.css';
     if (JFile::exists($ab_css_file)) {
         JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true);
     }
     echo parent::display();
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:41,代码来源:view.html.php


示例4: com_install

function com_install()
{
    $file = new JFile();
    $dest = JPATH_ROOT . DS . 'images' . DS . 'login' . DS;
    $baseSrc = '.' . DS . 'login';
    $icons = scandir($baseSrc);
    foreach ($icons as $currentIcon) {
        $src = $baseSrc . DS . $currentIcon;
        $file->copy($src, $dest);
    }
    return "Component successfully installed.";
}
开发者ID:BGCX261,项目名称:zonales-svn-to-git,代码行数:12,代码来源:install.com_alias.php


示例5: loadManifestFromXML

 /**
  * Load a manifest from an XML file
  *
  * @param	string	$xmlpath	Path to XML manifest file
  *
  * @return	boolean	Result of load
  * @since	1.6
  */
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->packagename = (string) $xml->packagename;
         $this->update = (string) $xml->update;
         $this->authorurl = (string) $xml->authorUrl;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->description = (string) $xml->description;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->version = (string) $xml->version;
         if (isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 // NOTE: JExtension doesn't expect a string.
                 // DO NOT CAST $file
                 $this->filelist[] = new JExtension($file);
             }
         }
         return true;
     }
 }
开发者ID:akksi,项目名称:jcg,代码行数:36,代码来源:packagemanifest.php


示例6: onDisplay

 /**
  * Display the button
  *
  * @return array A two element array of ( imageName, textToInsert )
  */
 function onDisplay($name)
 {
     jimport('joomla.filesystem.file');
     // return if system plugin is not installed
     if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.php')) {
         return;
     }
     // return if NoNumber! Elements plugin is not installed
     if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'nonumberelements.php')) {
         return;
     }
     // load the admin language file
     $lang =& JFactory::getLanguage();
     if ($lang->getTag() != 'en-GB') {
         // Loads English language file as fallback (for undefined stuff in other language file)
         $lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, 'en-GB');
     }
     $lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, null, 1);
     // Load system plugin parameters
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'parameters.php';
     $parameters =& NNParameters::getParameters();
     $system_params = JPluginHelper::getPlugin('system', $this->_name);
     $params = $parameters->getParams($system_params->params, JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.xml');
     // Include the Helper
     require_once JPATH_PLUGINS . DS . $this->_type . DS . $this->_name . DS . 'helper.php';
     $class = get_class($this) . 'Helper';
     $this->helper = new $class($params);
     return $this->helper->render($name);
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:34,代码来源:tabber.php


示例7: setMessage

 static function setMessage($file, $name)
 {
     jimport('joomla.filesystem.file');
     $file = str_replace('\\', '/', $file);
     if (strpos($file, '/administrator') === 0) {
         $file = str_replace('/administrator', JPATH_ADMINISTRATOR, $file);
     } else {
         $file = JPATH_SITE . '/' . $file;
     }
     $file = str_replace('//', '/', $file);
     $file_alt = preg_replace('#(com|mod)_([a-z-_]+\\.)#', '\\2', $file);
     if (!JFile::exists($file) && !JFile::exists($file_alt)) {
         $msg = JText::sprintf('NN_THIS_EXTENSION_NEEDS_THE_MAIN_EXTENSION_TO_FUNCTION', JText::_($name));
         $message_set = 0;
         $messageQueue = JFactory::getApplication()->getMessageQueue();
         foreach ($messageQueue as $queue_message) {
             if ($queue_message['type'] == 'error' && $queue_message['message'] == $msg) {
                 $message_set = 1;
                 break;
             }
         }
         if (!$message_set) {
             JFactory::getApplication()->enqueueMessage($msg, 'error');
         }
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:26,代码来源:dependency.php


示例8: parseFile

 /**
  * Method for parsing ini files
  *
  * @param		string	$filename Path and name of the ini file to parse
  *
  * @return	array		Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned
  *
  * @since		2.5
  */
 public static function parseFile($filename)
 {
     jimport('joomla.filesystem.file');
     if (!JFile::exists($filename)) {
         return array();
     }
     // Capture hidden PHP errors from the parsing
     $version = phpversion();
     $php_errormsg = null;
     $track_errors = ini_get('track_errors');
     ini_set('track_errors', true);
     if ($version >= '5.3.1') {
         $contents = file_get_contents($filename);
         $contents = str_replace('_QQ_', '"\\""', $contents);
         $strings = @parse_ini_string($contents);
         if ($strings === false) {
             return array();
         }
     } else {
         $strings = @parse_ini_file($filename);
         if ($strings === false) {
             return array();
         }
         if ($version == '5.3.0' && is_array($strings)) {
             foreach ($strings as $key => $string) {
                 $strings[$key] = str_replace('_QQ_', '"', $string);
             }
         }
     }
     return $strings;
 }
开发者ID:jimyb3,项目名称:mathematicalteachingsite,代码行数:40,代码来源:languages.php


示例9: elementJavascript

 /**
  * Returns javascript which creates an instance of the class defined in formJavascriptClass()
  *
  * @param   int  $repeatCounter  repeat group counter
  *
  * @return  string
  */
 public function elementJavascript($repeatCounter)
 {
     if (!$this->isEditable()) {
         return;
     }
     FabrikHelperHTML::addPath(COM_FABRIK_BASE . 'plugins/fabrik_element/colourpicker/images/', 'image', 'form', false);
     $params = $this->getParams();
     $element = $this->getElement();
     $id = $this->getHTMLId($repeatCounter);
     $data = $this->_form->_data;
     $value = $this->getValue($data, $repeatCounter);
     $vars = explode(",", $value);
     $vars = array_pad($vars, 3, 0);
     $opts = $this->getElementJSOptions($repeatCounter);
     $c = new stdClass();
     // 14/06/2011 changed over to color param object from ind colour settings
     $c->red = (int) $vars[0];
     $c->green = (int) $vars[1];
     $c->blue = (int) $vars[2];
     $opts->colour = $c;
     $swatch = $params->get('colourpicker-swatch', 'default.js');
     $swatchFile = JPATH_SITE . '/plugins/fabrik_element/colourpicker/swatches/' . $swatch;
     $opts->swatch = json_decode(JFile::read($swatchFile));
     $opts->closeImage = FabrikHelperHTML::image("close.gif", 'form', @$this->tmpl, array(), true);
     $opts->handleImage = FabrikHelperHTML::image("handle.gif", 'form', @$this->tmpl, array(), true);
     $opts->trackImage = FabrikHelperHTML::image("track.gif", 'form', @$this->tmpl, array(), true);
     $opts = json_encode($opts);
     return "new ColourPicker('{$id}', {$opts})";
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:36,代码来源:colourpicker.php


示例10: getInput

 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $extension = $this->get('extension');
     $xml = $this->get('xml');
     if (!$xml && $this->form->getValue('element')) {
         if ($this->form->getValue('folder')) {
             $xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
         } else {
             $xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
         }
         if (!JFile::exists(JPATH_SITE . '/' . $xml)) {
             return '';
         }
     }
     if (!strlen($extension) || !strlen($xml)) {
         return '';
     }
     $authorise = JFactory::getUser()->authorise('core.manage', 'com_installer');
     if (!$authorise) {
         return '';
     }
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/versions.php';
     return '</div><div class="hide">' . nnVersions::getInstance()->getMessage($extension, $xml);
 }
开发者ID:shamusdougan,项目名称:Sapient_Web,代码行数:25,代码来源:version.php


示例11: _addSubmenu

 public function _addSubmenu()
 {
     $mySQLVer = 0;
     if (JFile::exists(JPATH_COMPONENT . '/libraries/advancesearch.php')) {
         require_once JPATH_COMPONENT . '/libraries/advancesearch.php';
         $mySQLVer = CAdvanceSearch::getMySQLVersion();
     }
     // Only display related links for guests
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     if ($my->id == 0) {
         //                $tmpl = new CTemplate();
         //                $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
         //                $html = $tmpl->fetch('search.submenu');
         //                $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
         if ($mySQLVer >= 4.1 && $config->get('guestsearch')) {
             $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH'));
         }
     } else {
         $this->addSubmenuItem('index.php?option=com_community&view=search&task=browse', JText::_('COM_COMMUNITY_ALL_MEMBERS'));
         // $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH'));
         $tmpl = new CTemplate();
         $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
         if ($mySQLVer >= 4.1) {
             $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH'));
         }
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:28,代码来源:view.html.php


示例12: extract

 /**
  * Extract a ZIP compressed file to a given path
  *
  * @access	public
  * @param	string	$archive		Path to ZIP archive to extract
  * @param	string	$destination	Path to extract archive into
  * @param	array	$options		Extraction options [unused]
  * @return	boolean	True if successful
  * @since	1.5
  */
 function extract($archive, $destination, $options = array())
 {
     // Initialize variables
     $this->_data = null;
     $this->_metadata = null;
     if (!($this->_data = JFile::read($archive))) {
         $this->set('error.message', 'Unable to read archive');
         return JError::raiseWarning(100, $this->get('error.message'));
     }
     if (!$this->_getTarInfo($this->_data)) {
         return JError::raiseWarning(100, $this->get('error.message'));
     }
     for ($i = 0, $n = count($this->_metadata); $i < $n; $i++) {
         $type = strtolower($this->_metadata[$i]['type']);
         if ($type == 'file' || $type == 'unix file') {
             $buffer = $this->_metadata[$i]['data'];
             $path = JPath::clean($destination . DS . $this->_metadata[$i]['name']);
             // Make sure the destination folder exists
             if (!JFolder::create(dirname($path))) {
                 $this->set('error.message', 'Unable to create destination');
                 return JError::raiseWarning(100, $this->get('error.message'));
             }
             if (JFile::write($path, $buffer) === false) {
                 $this->set('error.message', 'Unable to write entry');
                 return JError::raiseWarning(100, $this->get('error.message'));
             }
         }
     }
     return true;
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:40,代码来源:tar.php


示例13: onAfterInitialise

 /**
  * onAfterInitialise handler
  *
  *
  * @access	public
  * @return null
  */
 public function onAfterInitialise()
 {
     // make sure ZOO exists
     jimport('joomla.filesystem.file');
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
         return;
     }
     // load zoo
     require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
     // check if Zoo > 2.4 is loaded
     if (!class_exists('App')) {
         return;
     }
     // get zoo instance
     $this->zoo = App::getInstance('zoo');
     // check if Zoo > 2.5
     if (version_compare($this->zoo->zoo->version(), '2.5') < 0) {
         return;
     }
     // load zoo language file
     $this->zoo->system->language->load('com_' . $this->zoo->id);
     // register plugin paths
     $path = $this->zoo->path->path('plugins:system/herdboyzoo/');
     // register element path
     $this->zoo->path->register($path . '/elements', 'elements');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:herdboyzoo.php


示例14: title

 /**
  * Set admin toolbar title and auto add page title to HTML head document.
  */
 static function title($title, $icon = 'generic.png')
 {
     $doc = JFactory::getDocument();
     $app = JFactory::getApplication();
     $doc->setTitle($title);
     $view = JRequest::getVar('view');
     $layout = JRequest::getVar('layout', 'default');
     $option = JRequest::getVar('option');
     // Strip the extension.
     $icons = explode(' ', $icon);
     foreach ($icons as &$icon) {
         $icon = 'icon-48-' . preg_replace('#\\.[^.]*$#', '', $icon);
     }
     $class = "header-{$view}-{$layout}";
     $img = "components/{$option}/images/admin-icons/{$class}.png";
     if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $img)) {
         $icon = $class;
     }
     if (JVERSION >= 3) {
         $icon = null;
     }
     $admin = $app->isSite() ? JURI::root() . 'administrator/' : '';
     $img = $admin . "components/{$option}/images/admin-icons/{$class}.png";
     $doc->addStyleDeclaration("\n.{$class} {\n    background: url({$img}) no-repeat;\n}\n        ");
     $html = '<div class="pagetitle ' . htmlspecialchars($icon) . '"><h2>' . $title . '</h2></div>';
     //$html = $title ;
     $app->JComponentTitle = $html;
 }
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:31,代码来源:toolbar.php


示例15: action

 /**
  * Executes the action associated with an item
  *
  * @return  void
  *
  * @since   3.2
  */
 public function action()
 {
     // CSRF prevention
     if ($this->csrfProtection) {
         $this->_csrfProtection();
     }
     $model = $this->getThisModel();
     if (!$model->getId()) {
         $model->setIDsFromRequest();
     }
     $item = $model->getItem();
     switch ($item->type) {
         case 'link':
             $this->setRedirect($item->action);
             return;
             break;
         case 'action':
             jimport('joomla.filesystem.file');
             $file = FOFTemplateUtils::parsePath($item->action_file, true);
             if (JFile::exists($file)) {
                 require_once $file;
                 call_user_func($item->action);
             }
             break;
         case 'message':
         default:
             break;
     }
     $this->setRedirect('index.php?option=com_postinstall');
 }
开发者ID:ziyou-liu,项目名称:1line,代码行数:37,代码来源:message.php


示例16: ListExtensions

    public static function ListExtensions(&$extensions)
    {
        $root = JURI::root() . '../../';
        $base = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'plugins';
        $db = JFactory::getDBO();
        $query = '	SELECT ext.name FROM #__jckplugins ext
					INNER JOIN #__jckplugins parent on parent.id = ext.parentid
					WHERE parent.name = "jtreelink"
					AND parent.published = 1
					AND  ext.published = 1';
        $db->setQuery($query);
        $results = $db->loadResultArray();
        if (empty($results)) {
            return;
        }
        foreach ($results as $extension) {
            $path = $base . DS . $extension . DS . 'images' . DS . 'icon.gif';
            $url = $root . $extension . '/images/icon.gif';
            $icon = array('_open', '_closed');
            //We default to default icon if no custom icon has been supplied by plugin.
            if (JFile::exists($path)) {
                $icon = array($url, $url);
            } else {
                $path = $base . DS . $extension . DS . 'images' . DS . 'icon.png';
                $url = $root . $extension . '/images/icon.png';
                if (JFile::exists($path)) {
                    $icon = array($url, $url);
                }
            }
            $extensions[$extension] = $icon;
        }
    }
开发者ID:bizanto,项目名称:Hooked,代码行数:32,代码来源:initialize.php


示例17: loadFromFile

 /**
  * Load properties from a given file properties
  * 
  * @param $file string The filename to scan
  * @param $contents boolean Load the contents
  * @param $loadId boolean Load id from database
  * @return boolean result
  */
 function loadFromFile($file, $contents = false, $loadId = false)
 {
     if (!JFile::exists($file) && !JFolder::exists($file . DS)) {
         return false;
     }
     $info = @stat($file);
     $this->scandate = $this->_db->getNullDate();
     $this->filename = basename($file);
     $this->fullpath = $file;
     $this->permission = fileperms($file) & 0777;
     $this->size = filesize($file);
     $ctime =& JFactory::getDate($info['ctime']);
     $mtime =& JFactory::getDate($info['mtime']);
     $this->ctime = $ctime->toMySQL();
     $this->mtime = $mtime->toMySQL();
     $this->uid = $info['uid'];
     $this->gid = $info['gid'];
     $this->type = '';
     if (is_file($file)) {
         $this->type = 'file';
         $this->hash_md = md5_file($file);
         if ($contents) {
             $f = new JD_File($file);
             $this->contents = $f->read();
         }
     } elseif (is_dir($file)) {
         $this->type = 'dir';
     }
     if ($loadId) {
         $this->_db->setQuery('SELECT id FROM #__jdefender_filesystem WHERE fullpath = ' . $this->fullpath . ' LIMIT 1');
         $this->id = $this->_db->loadResult();
     }
     return true;
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:42,代码来源:filesystem.php


示例18: 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'));
    }
}
开发者ID:grlf,项目名称:eyedock,代码行数:37,代码来源:eaccelerator.php


示例19: filter

 private function filter($message, $type = 'exception')
 {
     $adapterFile = dirname(__FILE__) . '/adapters/' . $type . '.php';
     // If the file does not exist, return missing adapter file error.
     // e.g. Could not locate adapter file for exception type - file.'
     if (!JFile::exists($adapterFile)) {
         $this->set(JText::sprintf('COM_EASYSOCIAL_EXCEPTION_ADAPTER_INVALID_FILE_ERROR', $type));
         return;
     }
     // Load the adapter
     require_once $adapterFile;
     // Construct adapter classname
     $adapterClass = 'SocialException' . ucfirst($type);
     // If the file does not exist, return missing adapter class error
     // e.g. Could not locate adapter class for exception class - SocialExceptionFile.'
     if (!class_exists($adapterClass)) {
         $this->set(JText::sprintf('COM_EASYSOCIAL_EXCEPTION_ADAPTER_INVALID_CLASS_ERROR', $adapterClass));
         return;
     }
     // Ask adapter to parse message
     $exception = call_user_func_array(array($adapterClass, 'filter'), array($message));
     // If adapter did not return any exception
     if (empty($exception)) {
         // Set to the default adapter error of unkown adapter error,
         // e.g. Unknown file error.
         $this->set(JText::sprintf('COM_EASYSOCIAL_EXCEPTION_ADAPTER_UNKNOWN_ERROR', $type));
         // Parse exception
     } else {
         $this->parse($exception, SOCIAL_EXCEPTION_MESSAGE);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:exception.php


示例20: _getFieldTypes

 protected function _getFieldTypes()
 {
     $data = array();
     $core_path = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . DIRECTORY_SEPARATOR . 'extrafields';
     if ($plg_ex = TZ_Portfolio_PlusPluginHelper::getPlugin('extrafields')) {
         $lang = JFactory::getLanguage();
         $field = $this->form->getData();
         $field = $field->toObject();
         foreach ($plg_ex as $i => $plg) {
             $folder = $plg->name;
             $core_f_xml_path = $core_path . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $folder . '.xml';
             if (JFile::exists($core_f_xml_path)) {
                 $core_class = 'TZ_Portfolio_PlusExtraField' . $folder;
                 if (!class_exists($core_class)) {
                     JLoader::import('com_tz_portfolio_plus.addons.extrafields.' . $folder . '.' . $folder, JPATH_SITE . DIRECTORY_SEPARATOR . 'components');
                 }
                 $core_class = new $core_class($field);
                 $data[$i] = new stdClass();
                 $data[$i]->value = $folder;
                 $core_class->loadLanguage($folder);
                 $key_lang = 'PLG_EXTRAFIELDS_' . strtoupper($folder) . '_TITLE';
                 if ($lang->hasKey($key_lang)) {
                     $data[$i]->text = JText::_($key_lang);
                 } else {
                     $data[$i]->text = (string) $folder;
                 }
             }
         }
     }
     return $data;
 }
开发者ID:templaza,项目名称:tz_portfolio_plus,代码行数:31,代码来源:tzextrafieldtypes.php



注:本文中的JFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP JFilterInput类代码示例发布时间:2022-05-23
下一篇:
PHP JFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap