当前位置: 首页>>代码示例>>PHP>>正文


PHP JFolder::move方法代码示例

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


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

示例1: process

 public function process($limitstart = 0)
 {
     $folders = $this->getFolders();
     $target_folder = isset($folders[$limitstart]) ? $folders[$limitstart] : null;
     if (!$target_folder) {
         return true;
     }
     $path = str_replace(JPATH_SITE, '', $target_folder);
     // Check if the target folder exists
     if (!JFolder::exists($target_folder)) {
         $this->success = false;
         $this->log[] = JText::sprintf('COM_PFMIGRATOR_FOLDER_NOT_FOUND', $path);
         return false;
     }
     // Check if the destination folder exists
     if (JFolder::exists($target_folder . '3')) {
         if (!JFolder::delete($target_folder . '3')) {
             $this->success = false;
             $this->log[] = JText::sprintf('COM_PFMIGRATOR_FOLDER_EXISTS', $path . '3');
             return false;
         }
     }
     if (!JFolder::move($target_folder, $target_folder . '3')) {
         $this->success = false;
         $this->log[] = JText::sprintf('COM_PFMIGRATOR_FOLDER_RENAME_FAILED', $path);
         return false;
     }
     $this->log[] = JText::sprintf('COM_PFMIGRATOR_RENAME_FOLDER_SUCCESS', $path, $path . '3');
     return true;
 }
开发者ID:bellodox,项目名称:Migrator,代码行数:30,代码来源:renamefolders.php

示例2: test

 public function test(SimpleXMLElement $element, $value, $group = null, Registry $input = null, JForm $form = null)
 {
     $app = JFactory::getApplication();
     $newPath = trim($value);
     //	$input->set('params.datapath', $newPath);
     if (!preg_match('#' . $this->regex . '#', $newPath)) {
         return false;
     }
     $plugin = JPluginHelper::getPlugin('system', 'rjuserd');
     if ($plugin) {
         // Get plugin params
         $pluginParams = new JRegistry($plugin->params);
     }
     $oldPath = $pluginParams->get('datapath', false);
     //echo'<xmp>';var_dump($pluginParams,$element,$value,$group,$input,$form);jexit();
     if ($oldPath && $oldPath != $newPath) {
         jimport('joomla.filesystem.folder');
         if (JFolder::move(JPATH_ROOT . '/' . $oldPath, JPATH_ROOT . '/' . $newPath) !== true) {
             $app->enqueueMessage('Failed to move data from <u>' . $oldPath . '</u> to <u>' . $newPath . '</u>', 'error');
             return false;
         }
         $app->enqueueMessage('User data were moved from <u>' . $oldPath . '</u> to <u>' . $newPath . '</u>');
     }
     return true;
 }
开发者ID:ron4mac,项目名称:joomla_plg_rjuserd,代码行数:25,代码来源:rjuserdpath.php

示例3: install

 function install($adapter)
 {
     $installer = $this->installer;
     $installer->AddSQLFromFile('install.bids.inserts.sql');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     JFolder::move(JPATH_SITE . DS . 'components' . DS . 'com_bids' . DS . 'templates-dist', JPATH_SITE . DS . 'components' . DS . 'com_bids' . DS . 'templates');
     JFile::move(JPATH_SITE . DS . 'components' . DS . 'com_bids' . DS . 'options.php-dist', JPATH_SITE . DS . 'components' . DS . 'com_bids' . DS . 'options.php');
     JFolder::create(JPATH_SITE . DS . 'images' . DS . 'auctions');
     $installer->AddMenuItem("Auction Factory MENU", "List Auctions", "list-auctions", "index.php?option=com_bids&task=listauctions", 1);
     $installer->AddMenuItem("Auction Factory MENU", "Categories", "categories-auctions", "index.php?option=com_bids&task=listcats", 1);
     $installer->AddMenuItem("Auction Factory MENU", "Search", "search-auctions", "index.php?option=com_bids&task=search", 1);
     $installer->AddMenuItem("Auction Factory MENU", "New Auction", "post-offer", "index.php?option=com_bids&task=newauction", 2);
     $installer->AddMenuItem("Auction Factory MENU", "My Auctions", "my-auctions", "index.php?option=com_bids&task=myauctions", 2);
     $installer->AddMenuItem("Auction Factory MENU", "Watchlist", "watchlist", "index.php?option=com_bids&task=mywatchlist", 2);
     $installer->AddMenuItem("Auction Factory MENU", "My Bids", "my-bids", "index.php?option=com_bids&task=mybids", 2);
     $installer->AddMenuItem("Auction Factory MENU", "Profile", "profile-auctions", "index.php?option=com_bids&task=userdetails", 2);
     $installer->AddCBPlugin('Bids MyAuctions', 'My Auctions', 'bids.myauctions', 'getmyauctionsTab');
     $installer->AddCBPlugin('Bids MyBids', 'My Bids', 'bids.mybids', 'getmybidsTab');
     $installer->AddCBPlugin('Bids MyRatings', 'My Ratings', 'bids.myratings', 'getmyratingsTab');
     $installer->AddCBPlugin('Bids MySettings', 'My Settings', 'bids.mysettings', 'getmysettingsTab');
     $installer->AddCBPlugin('Bids MyTaskpad', 'My Taskpad', 'bids.mytaskpad', 'myTaskPad');
     $installer->AddCBPlugin('Bids MyWatchlist', 'My Watchlist', 'bids.mywatchlist', 'getmywatchlistTab');
     $installer->AddCBPlugin('Bids MyWonBids', 'My Won Bids', 'bids.mywonbids', 'getmywonbidsTab');
     $installer->AddMessage("Thank you for purchasing <strong>Auctions Factory</strong>");
     $installer->AddMessageFromFile('install.notes.txt');
     $installer->AddMessage("Please set up your <strong>Auctions Factory</strong> in the <a href='" . JURI::root() . "administrator/index.php?option=com_bids&task=settingsmanager'>admin panel</a></p>");
     $installer->AddMessage("Visit us at <a target='_blank' href='http://www.thefactory.ro'>thefactory.ro</a> to learn  about new versions and/or to give us feedback<br>");
     $installer->AddMessage("&copy; 2006-" . date('Y') . " thefactory.ro");
     $installer->insertDefaultCategory();
     $installer->install();
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:32,代码来源:install.bids.php

示例4: installLibrary

/**
 * @brief Instala la libreria de Amadeus en las librerias del Joomla.
 */
function installLibrary()
{
    if (isThereLibrary()) {
        $src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rotator' . DS . 'library' . DS . 'Amadeus';
        $dst = JPATH_SITE . DS . 'libraries' . DS . 'Amadeus';
        if (JFolder::exists($dst)) {
            JFolder::delete($dst);
        }
        JFolder::move($src, $dst);
    }
}
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:14,代码来源:install.rotator.php

示例5: _install

 function _install($file)
 {
     $AG_resourceType = JRequest::getVar('AG_resourceType');
     // Current resource type
     $config = JFactory::getConfig();
     $tmp_dest = $config->get('tmp_path');
     $resourceType = substr($AG_resourceType, 0, strlen($AG_resourceType) - 1);
     $file_type = "zip";
     if (isset($file) && !empty($file['name'])) {
         //Clean up filename to get rid of strange characters like spaces etc
         $filename = JFile::makeSafe($file['name']);
         $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
         $src = $file['tmp_name'];
         $dest = $tmp_dest . DIRECTORY_SEPARATOR . $filename;
         //First check if the file has the right extension
         if ($ext == $file_type) {
             if (JFile::upload($src, $dest)) {
                 if (JArchive::extract($tmp_dest . DIRECTORY_SEPARATOR . $filename, $tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType)) {
                     JFile::delete($tmp_dest . DIRECTORY_SEPARATOR . $filename);
                 }
                 // TEMPLATE DETAILS PARSING
                 if (JFIle::exists($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename) . DIRECTORY_SEPARATOR . 'details.xml')) {
                     $ag_resourceManager_xml =& JFactory::getXML($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename) . DIRECTORY_SEPARATOR . 'details.xml');
                     if (isset($ag_resourceManager_xml->type)) {
                         $ag_resourceManager_type = $ag_resourceManager_xml->type;
                     } else {
                         JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                         JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                         return;
                     }
                 } else {
                     JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                     JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                     return;
                 }
                 if ($ag_resourceManager_type && $ag_resourceManager_type == $resourceType) {
                     $result = JFolder::move($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename), JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename));
                     if ($result) {
                         JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_INSTALLED') . "&nbsp;" . $filename, 'message');
                     } else {
                         JFactory::getApplication()->enqueueMessage(JText::_('AG_CANNOT_MOVED_ITEM') . "&nbsp;" . $result, 'message');
                     }
                 } else {
                     JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                     JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                 }
             } else {
                 JFactory::getApplication()->enqueueMessage(JText::_('AG_CANNOT_UPLOAD_FILE_TO_TEMP_FOLDER_PLEASE_CHECK_PERMISSIONS'), 'error');
             }
         } else {
             JFactory::getApplication()->enqueueMessage(JText::_('AG_ONLY_ZIP_ARCHIVES_CAN_BE_INSTALLED'), 'error');
         }
     }
 }
开发者ID:elhui2,项目名称:admirorgallery,代码行数:54,代码来源:resourcemanager.php

示例6: postflight

 public function postflight($type, $parent)
 {
     //If type is install
     if ($type == 'install') {
         //Move library file to Joomla libraries and delete it from plugin
         JFolder::move(JPATH_SITE . '/plugins/api/easyblog/libraries/simpleschema', JPATH_SITE . '/libraries/simpleschema');
         JFolder::delete(JPATH_SITE . '/plugins/api/easyblog/libraries');
         //Move helper file to easyblog helpers and delete it from plugin
         JFile::move(JPATH_SITE . '/plugins/api/easyblog/components/com_easyblog/helpers/simpleschema.php', JPATH_SITE . '/components/com_easyblog/helpers/simpleschema.php');
         JFolder::delete(JPATH_SITE . '/plugins/api/easyblog/components');
     }
     return true;
 }
开发者ID:beingsane,项目名称:com_api-plugins,代码行数:13,代码来源:script.php

示例7: copyImagesDirectory

 /**
  * Sets the data in the destination database.
  *
  * @return	void
  * @since	1.2.0
  * @throws	Exception
  */
 protected function copyImagesDirectory()
 {
     $params = $this->getParams();
     if ($params->path != '') {
         $date = JFactory::getDate()->toFormat('%Y%m%d');
         $src = JPATH_SITE . DS . 'images';
         $dest = JPATH_SITE . DS . 'images-backup-' . $date;
         JFolder::move($src, $dest);
         $src = $params->path . DS . 'images';
         $dest = JPATH_SITE . DS . 'images';
         JFolder::copy($src, $dest);
     }
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:20,代码来源:migrate_files.php

示例8: download

 public function download($version)
 {
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT . '/administrator');
     $ajax = new Ejax();
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT . '/administrator');
     $storage = JPATH_ROOT . '/tmp/foundry';
     $storage = $this->getUniqueName($storage);
     // If folder doesn't exist, create them first.
     if (!JFolder::exists($storage)) {
         JFolder::create($storage);
     }
     $destination = $storage . '/foundry.zip';
     // Get foundry's version
     $versionFile = JPATH_ROOT . '/media/foundry/3.1/version';
     $localVersion = JFile::read($versionFile);
     // Remove newline from foundry's version
     $localVersion = trim($localVersion);
     $connector = EasyBlogHelper::getHelper('Connectors');
     $infoServer = EBLOG_UPDATER_SERVER . 'foundry/' . $localVersion . '/info';
     $connector->addUrl($infoServer);
     $connector->addQuery('apikey', EasyBlogHelper::getConfig()->get('apikey'));
     $connector->setMethod('POST');
     $connector->execute();
     $result = $connector->getResult($infoServer);
     if ($result == '#Foundry no updates' || $result == 'Invalid api key provided') {
         // @TODO: Show nothing to be updated in foundry.
     } else {
         // Write the zip file to the path.
         JFile::write($destination, $result);
         // Extract foundry zip.
         JArchive::extract($destination, $storage);
         // Rename the old foundry folder.
         $foundryPath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'foundry' . DIRECTORY_SEPARATOR . '3.1';
         // Try to delete the foundry path.
         $deleteState = JFolder::delete($foundryPath);
         if (!$deleteState) {
             $ajax->script('$("#result-holder").append("<div>' . JText::_('There was some error deleting the foundry framework due to permission issues.') . '</div>");');
         }
         // Move the new updated foundry to the correct path.
         $state = JFolder::move($storage . DIRECTORY_SEPARATOR . '3.1', $foundryPath);
         if (!$state) {
             $ajax->script('$("#result-holder").append("<div>' . JText::_('There was some error copying the foundry framework over to the media folder.') . '</div>");');
         }
     }
     $ajax->script('$("#bar-progress").css("width" , "10%");');
     $ajax->script('$("#bar-progress #progress-indicator").html("10%");');
     $ajax->script('$("#result-holder").append("<div>' . JText::_('Updating Foundry Framework') . '</div>");');
     $ajax->script('ejax.load( "updater", "updateEasyBlog" , "' . $version . '");');
     $ajax->send();
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:50,代码来源:view.ejax.php

示例9: onAfterK2Save

 function onAfterK2Save(&$item, $isNew)
 {
     jimport('joomla.filesystem.folder');
     JLoader::register('SigProHelper', JPATH_ADMINISTRATOR . '/components/com_sigpro/helper.php');
     $path = SigProHelper::getPath('k2');
     $folder = JRequest::getCmd('sigProFolder');
     if ($isNew && $folder && $folder != $item->id && JFolder::exists($path . '/' . $folder)) {
         JFolder::move($path . '/' . $folder, $path . '/' . $item->id);
     }
     if (JFolder::exists($path . '/' . $item->id) && $item->gallery == null) {
         $item->gallery = '{gallery}' . $item->id . '{/gallery}';
         $item->store();
     }
 }
开发者ID:SeventF,项目名称:ikea.com,代码行数:14,代码来源:jw_sigpro.php

示例10: _installFromPackage

 protected function _installFromPackage()
 {
     if (!$this->manifest) {
         return false;
     }
     $folders = $this->_getKoowaComponentDirectories();
     if ($this->install_method !== 'discover_install') {
         // new structure
         if (file_exists($this->package . '/koowa-component.xml')) {
             $map = array($this->package => JPATH_ROOT . '/' . $folders['code'], $this->package . '/resources/assets' => JPATH_ROOT . '/' . $folders['media']);
         } else {
             $map = array($this->package . '/' . $folders['code'] => JPATH_ROOT . '/' . $folders['code'], $this->package . '/' . $folders['media'] => JPATH_ROOT . '/' . $folders['media']);
         }
         foreach ($map as $from => $to) {
             $temp = $to . '_tmp';
             if (!JFolder::exists($from)) {
                 continue;
             }
             if (JFolder::exists($temp)) {
                 JFolder::delete($temp);
             }
             JFolder::copy($from, $temp);
             if (JFolder::exists($to)) {
                 JFolder::delete($to);
             }
             JFolder::move($temp, $to);
         }
     }
     $sql = JPATH_ROOT . '/' . $folders['code'] . '/resources/install/install.sql';
     if (JFile::exists($sql)) {
         $file = JFile::read($sql);
         $queries = JInstallerHelper::splitSql($file);
         $db = JFactory::getDbo();
         foreach ($queries as $query) {
             $query = trim($query);
             if ($query != '' && $query[0] != '#') {
                 $db->setQuery($query);
                 if (!$db->execute()) {
                     $this->setStatus(KDatabase::STATUS_FAILED);
                     $this->setStatusMessage('Unable to run the database queries during Koowa component install');
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:47,代码来源:koowa.php

示例11: postflight

 /**
  * Copying files
  *
  * @param   string                     $type   Installation type
  * @param   JInstallerAdapterComponent $parent Installation adapter
  *
  * @return bool False if something happens
  */
 public function postflight($type, $parent)
 {
     $installationPath = $parent->getParent()->getPath('source');
     jimport('joomla.filesystem.folder');
     // If the layout folder exists, let's delete them first
     if (JFolder::exists(JPATH_ROOT . '/layouts/libraries/neno')) {
         JFolder::delete(JPATH_ROOT . '/layouts/libraries/neno');
     }
     // Moving Layouts
     JFolder::move($installationPath . '/layouts', JPATH_ROOT . '/layouts/libraries/neno');
     // If the media folder exists, let's delete them first
     if (JFolder::exists(JPATH_ROOT . '/media/neno')) {
         JFolder::delete(JPATH_ROOT . '/media/neno');
     }
     // Moving media files
     JFolder::move($installationPath . '/media', JPATH_ROOT . '/media/neno');
     return true;
 }
开发者ID:andresmaeso,项目名称:neno,代码行数:26,代码来源:script.php

示例12: preflight

 function preflight($type, $parent)
 {
     // WAITING FOR JOOMLA 1.7.x FIX
     $app = JFactory::getApplication();
     $config = JFactory::getConfig();
     $tmp_path = $config->get('tmp_path');
     $tmp_dir = $app->cck_core_temp_var;
     $path = $tmp_path . '/' . $tmp_dir;
     $dest = JPATH_SITE . '/libraries/cck/rendering/variations';
     $protected = array('empty');
     if ($tmp_dir && JFolder::exists($path)) {
         $vars = JFolder::folders($path);
         foreach ($vars as $var) {
             if (!in_array($var, $protected)) {
                 JFolder::move($path . '/' . $var, $dest . '/' . $var);
             }
         }
         JFolder::delete($path);
     }
     // WAITING FOR JOOMLA 1.7.x FIX
 }
开发者ID:kolydart,项目名称:SEBLOD,代码行数:21,代码来源:script.php

示例13: sanatizePositionsConfig

 /**
  * Sanatize positions config file (after renaming or deleting a type)
  *
  * @param string $path Path to renderer
  * @param Type $type The type to sanatize
  * @param boolean $delete if set to true, type will be removed
  *
  * @since 2.0
  */
 public function sanatizePositionsConfig($path, $type, $delete = false)
 {
     // get renderer
     $renderer = $this->app->renderer->create('item')->addPath($path);
     // get group
     $group = $type->getApplication()->getGroup();
     // rename folder if special type
     if ($renderer->pathExists('item' . DIRECTORY_SEPARATOR . $type->id)) {
         $folder = $path . DIRECTORY_SEPARATOR . $renderer->getFolder() . DIRECTORY_SEPARATOR . 'item' . DIRECTORY_SEPARATOR;
         if ($delete) {
             JFolder::delete($folder . $type->id);
         } else {
             JFolder::move($folder . $type->id, $folder . $type->identifier);
         }
     }
     // get positions and config
     $config = $renderer->getConfig('item');
     $params = $config->get($group . '.' . $type->id . '.');
     if (!$delete) {
         $config->set($group . '.' . $type->identifier . '.', $params);
     }
     $config->remove($group . '.' . $type->id . '.');
     $renderer->saveConfig($config, $path . '/renderer/item/positions.config');
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:33,代码来源:type.php

示例14: items

 private function items($id)
 {
     $this->response->status = 'Processing Items';
     $step = 10;
     $session = JFactory::getSession();
     $db = JFactory::getDbo();
     if ($id == 0) {
         $query = $db->getQuery(true);
         $query->select('COUNT(*)')->from($db->quoteName('#__k2_v2_items'));
         $db->setQuery($query);
         $total = $db->loadResult();
         $session->set('k2.upgrade.items.total', $total);
         $session->set('k2.upgrade.items.processed', 0);
     }
     $query = $db->getQuery(true);
     $query->select('*')->from($db->quoteName('#__k2_v2_items'))->where($db->quoteName('id') . ' > ' . $id)->order($db->quoteName('id'));
     $db->setQuery($query, 0, $step);
     $items = $db->loadObjectList();
     foreach ($items as $item) {
         $query = $db->getQuery(true);
         $query->select($db->quoteName('id'))->from($db->quoteName('#__k2_items'))->where($db->quoteName('alias') . ' = ' . $db->quote($item->alias));
         $db->setQuery($query);
         if ($db->loadResult()) {
             $item->alias .= '-' . uniqid();
         }
         $data = array();
         $data['id'] = '';
         $data['title'] = $item->title;
         $data['alias'] = $item->alias;
         $data['state'] = $item->trash ? -1 : $item->published;
         $data['featured'] = $item->featured;
         $data['access'] = $item->access;
         $data['catid'] = $item->catid;
         if ($data['catid'] == 1) {
             $data['catid'] = 99999;
         }
         $data['introtext'] = $item->introtext;
         $data['fulltext'] = $item->fulltext;
         $data['ordering'] = $item->ordering;
         $data['featured_ordering'] = $item->featured_ordering;
         $data['created'] = $item->created;
         $data['created_by'] = $item->created_by;
         $data['created_by_alias'] = $item->created_by_alias;
         $data['modified'] = $item->modified;
         $data['modified_by'] = $item->modified_by ? $item->modified_by : $item->created_by;
         $data['publish_up'] = $item->publish_up;
         $data['publish_down'] = $item->publish_down;
         $data['metadata'] = array();
         $data['metadata']['description'] = $item->metadesc;
         $data['metadata']['keywords'] = $item->metakey;
         $data['metadata']['robots'] = '';
         $data['metadata']['author'] = '';
         $metadata = new JRegistry($item->metadata);
         $metadata = $metadata->toArray();
         foreach ($metadata as $key => $value) {
             if ($key == 'robots' || $key == 'author') {
                 $data['metadata'][$key] = $value;
             }
         }
         $data['language'] = $item->language;
         $model = K2Model::getInstance('Items');
         $model->setState('data', $data);
         if (!$model->save()) {
             $this->response->errors[] = $model->getError();
             $this->response->failed = 1;
             return;
         }
         $lastInsertedId = $model->getState('id');
         $image = new stdClass();
         $image->caption = $item->image_caption;
         $image->credits = $item->image_credits;
         $image->flag = JFile::exists(JPATH_SITE . '/media/k2/items/cache/' . md5('Image' . $item->id) . '_Generic.jpg') ? 1 : 0;
         $image = json_encode($image);
         $media = array();
         $mediaEntry = new stdClass();
         $mediaEntry->url = '';
         $mediaEntry->provider = '';
         $mediaEntry->id = '';
         $mediaEntry->embed = '';
         $mediaEntry->caption = $item->video_caption;
         $mediaEntry->credits = $item->video_credits;
         $mediaEntry->upload = '';
         if (!empty($item->video)) {
             if (substr($item->video, 0, 1) !== '{') {
                 $mediaEntry->embed = $item->video;
             } else {
                 if (strpos($item->video, 'remote}')) {
                     preg_match("#}(.*?){/#s", $item->video, $matches);
                     if (substr($matches[1], 0, 4) != 'http') {
                         $mediaEntry->upload = basename($matches[1]);
                         if (JFile::exists(JPATH_SITE . '/media/k2/videos/' . $mediaEntry->upload)) {
                             if (!JFolder::exists(JPATH_SITE . '/media/k2/media')) {
                                 JFolder::create(JPATH_SITE . '/media/k2/media');
                             }
                             if (!JFolder::exists(JPATH_SITE . '/media/k2/media/' . $item->id)) {
                                 JFolder::create(JPATH_SITE . '/media/k2/media/' . $item->id);
                             }
                             JFile::move(JPATH_SITE . '/media/k2/videos/' . $mediaEntry->upload, JPATH_SITE . '/media/k2/media/' . $item->id . '/' . $mediaEntry->upload);
                         }
                     } else {
//.........这里部分代码省略.........
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:101,代码来源:migrator.json.php

示例15: move

 /**
  * Copy a file.
  * @param string $files The relative file or comma seperated list of files
  * @param string $dest The relative path of the destination dir
  * @return string $error on failure
  */
 public function move($file, $destination)
 {
     $result = new WFFileSystemResult();
     $src = WFUtility::makePath($this->getBaseDir(), $file);
     $dest = WFUtility::makePath($this->getBaseDir(), WFUtility::makePath($destination, basename($file)));
     if ($src != $dest) {
         // src is a file
         if (is_file($src)) {
             $result->type = 'files';
             $result->state = JFile::move($src, $dest);
         } else {
             if (is_dir($src)) {
                 $result->type = 'folders';
                 $result->state = JFolder::move($src, $dest);
                 $result->path = $dest;
             }
         }
     }
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:26,代码来源:joomla.php


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