當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JInstallerHelper::detectType方法代碼示例

本文整理匯總了PHP中JInstallerHelper::detectType方法的典型用法代碼示例。如果您正苦於以下問題:PHP JInstallerHelper::detectType方法的具體用法?PHP JInstallerHelper::detectType怎麽用?PHP JInstallerHelper::detectType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JInstallerHelper的用法示例。


在下文中一共展示了JInstallerHelper::detectType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postflight

 function postflight($type, $parent)
 {
     if (version_compare(JVERSION, '3.0.0', '>')) {
         $messages = array();
         // Import required modules
         jimport('joomla.installer.installer');
         jimport('joomla.installer.helper');
         jimport('joomla.filesystem.file');
         //$db = JFactory::getDBO();
         //$query = "ALTER TABLE #__k2_items ADD FULLTEXT(extra_fields)";
         //$db->setQuery($query);
         //$db->query();
         // Get packages
         $p_dir = JPath::clean(JPATH_SITE . DS . 'components' . DS . 'com_jak2filter' . DS . 'packages');
         // Did you give us a valid directory?
         if (!is_dir($p_dir)) {
             $messages[] = JText::_('Package directory(Related modules, plugins) is missing');
         } else {
             $subpackages = JFolder::files($p_dir);
             $result = true;
             $installer = new JInstaller();
             if ($subpackages) {
                 $app = JFactory::getApplication();
                 $templateDir = 'templates/' . $app->getTemplate();
                 foreach ($subpackages as $zpackage) {
                     if (JFile::getExt($p_dir . DS . $zpackage) != "zip") {
                         continue;
                     }
                     $subpackage = JInstallerHelper::unpack($p_dir . DS . $zpackage);
                     if ($subpackage) {
                         $type = JInstallerHelper::detectType($subpackage['dir']);
                         if (!$type) {
                             $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::_($zpackage . " Not valid package") . '</span>';
                             $result = false;
                         }
                         if (!$installer->install($subpackage['dir'])) {
                             // There was an error installing the package
                             $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Error')) . '</span>';
                         } else {
                             $messages[] = '<img src="' . $templateDir . '/images/admin/tick.png" alt="" width="16" height="16" />&nbsp;<span style="color:#00FF00;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Success')) . '</span>';
                         }
                         if (!is_file($subpackage['packagefile'])) {
                             $subpackage['packagefile'] = $p_dir . DS . $subpackage['packagefile'];
                         }
                         if (is_dir($subpackage['extractdir'])) {
                             JFolder::delete($subpackage['extractdir']);
                         }
                         if (is_file($subpackage['packagefile'])) {
                             JFile::delete($subpackage['packagefile']);
                         }
                     }
                 }
             }
             JFolder::delete($p_dir);
         }
     }
 }
開發者ID:jamielaff,項目名稱:als_resourcing,代碼行數:57,代碼來源:script.jak2filter.php

示例2: com_install

 function com_install()
 {
     JAVoiceHelpers::Install_Db();
     $messages = array();
     // Import required modules
     jimport('joomla.installer.installer');
     jimport('joomla.installer.helper');
     jimport('joomla.filesystem.file');
     // Get packages
     $p_dir = JPath::clean(JPATH_SITE . '/components/com_javoice/packages');
     // Did you give us a valid directory?
     if (!is_dir($p_dir)) {
         $messages[] = JText::_('Package directory(Related modules, plugins) is missing');
     } else {
         $subpackages = JFolder::files($p_dir);
         $result = true;
         $installer = new JInstaller();
         if ($subpackages) {
             $app = JFactory::getApplication();
             $templateDir = 'templates/' . $app->getTemplate();
             foreach ($subpackages as $zpackage) {
                 if (JFile::getExt($p_dir . DS . $zpackage) != "zip") {
                     continue;
                 }
                 $subpackage = JInstallerHelper::unpack($p_dir . DS . $zpackage);
                 if ($subpackage) {
                     $type = JInstallerHelper::detectType($subpackage['dir']);
                     if (!$type) {
                         $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::_($zpackage . " Not valid package") . '</span>';
                         $result = false;
                     }
                     if (!$installer->install($subpackage['dir'])) {
                         // There was an error installing the package
                         $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Error')) . '</span>';
                     } else {
                         $messages[] = '<img src="' . $templateDir . '/images/admin/tick.png" alt="" width="16" height="16" />&nbsp;<span style="color:#00FF00;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Success')) . '</span>';
                     }
                     if (!is_file($subpackage['packagefile'])) {
                         $subpackage['packagefile'] = $p_dir . DS . $subpackage['packagefile'];
                     }
                     if (is_dir($subpackage['extractdir'])) {
                         JFolder::delete($subpackage['extractdir']);
                     }
                     if (is_file($subpackage['packagefile'])) {
                         JFile::delete($subpackage['packagefile']);
                     }
                 }
             }
         }
         JFolder::delete($p_dir);
     }
 }
開發者ID:jomsocial,項目名稱:JSVoice,代碼行數:52,代碼來源:install.javoice.php

示例3: getSRPURL

 public function getSRPURL($return = '')
 {
     $session = JFactory::getSession();
     $tempdir = $session->get('tempdir', '', 'liveupdate');
     jimport('joomla.installer.installer');
     jimport('joomla.installer.helper');
     jimport('joomla.filesystem.file');
     $instModelFile = JPATH_ADMINISTRATOR . '/components/com_akeeba/models/installer.php';
     if (!JFile::exists($instModelFile)) {
         return false;
     }
     require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/models/installer.php';
     $model = JModel::getInstance('Installer', 'AkeebaModel');
     $packageType = JInstallerHelper::detectType($tempdir);
     $name = $model->getExtensionName($tempdir);
     $url = 'index.php?option=com_akeeba&view=backup&tag=restorepoint&type=' . $packageType . '&name=' . urlencode($name['name']);
     switch ($type) {
         case 'module':
         case 'template':
             $url .= '&group=' . $name['client'];
             break;
         case 'plugin':
             $url .= '&group=' . $name['group'];
             break;
     }
     if (!empty($return)) {
         $url .= '&returnurl=' . urlencode($return);
     }
     return $url;
 }
開發者ID:srbsnkr,項目名稱:sellingonlinemadesimple,代碼行數:30,代碼來源:model.php

示例4: _getPackageFromFolder

 public function _getPackageFromFolder()
 {
     $p_dir = JRequest::getString('install_directory');
     $p_dir = JPath::clean($p_dir);
     // Did you give us a valid directory?
     if (!is_dir($p_dir)) {
         JError::raiseWarning('SOME_ERROR_CODE', JText::_('COM_REDSHOP_PLEASE_ENTER_A_PACKAGE_DIRECTORY'));
         return false;
     }
     // Detect the package type
     $type = JInstallerHelper::detectType($p_dir);
     // Did you give us a valid package?
     if (!$type) {
         JError::raiseWarning('SOME_ERROR_CODE', JText::_('COM_REDSHOP_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'));
         return false;
     }
     $package['packagefile'] = null;
     $package['extractdir'] = null;
     $package['dir'] = $p_dir;
     $package['type'] = $type;
     return $package;
 }
開發者ID:jaanusnurmoja,項目名稱:redjoomla,代碼行數:22,代碼來源:zip_import.php

示例5: getPackageFromFolder

/**
 * 取得zip的安裝包的相關信息
 * */
function getPackageFromFolder($p_dir)
{
    // 如果目錄不正確,出錯
    if (!is_dir($p_dir)) {
        JError::raiseWarning('SOME_ERROR_CODE', JText::_('Please enter a package directory'));
        return false;
    }
    // 取得包的類型
    $type = JInstallerHelper::detectType($p_dir);
    // 如果不能取得,出錯
    if (!$type) {
        JError::raiseWarning('SOME_ERROR_CODE', JText::_('Path does not have a valid package'));
        return false;
    }
    // 設置相關的包的信息
    $package['packagefile'] = null;
    $package['extractdir'] = null;
    $package['dir'] = $p_dir;
    $package['type'] = $type;
    return $package;
}
開發者ID:apachesep,項目名稱:joomla-weibo,代碼行數:24,代碼來源:install15.com_weibo.php

示例6: copyBaseFiles

 /**
  * Method to copy the extension's base files from the `<files>` tag(s) and the manifest file
  *
  * @return  void
  *
  * @since   3.4
  * @throws  RuntimeException
  */
 protected function copyBaseFiles()
 {
     $folder = (string) $this->getManifest()->files->attributes()->folder;
     $source = $this->parent->getPath('source');
     if ($folder) {
         $source .= '/' . $folder;
     }
     // Install all necessary files
     if (!count($this->getManifest()->files->children())) {
         throw new RuntimeException(JText::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES', JText::_('JLIB_INSTALLER_' . strtoupper($this->route))));
     }
     foreach ($this->getManifest()->files->children() as $child) {
         $file = $source . '/' . (string) $child;
         if (is_dir($file)) {
             // If it's actually a directory then fill it up
             $package = array();
             $package['dir'] = $file;
             $package['type'] = JInstallerHelper::detectType($file);
         } else {
             // If it's an archive
             $package = JInstallerHelper::unpack($file);
         }
         $tmpInstaller = new JInstaller();
         $installResult = $tmpInstaller->{$this->route}($package['dir']);
         if (!$installResult) {
             throw new RuntimeException(JText::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_ERROR_EXTENSION', JText::_('JLIB_INSTALLER_' . strtoupper($this->route)), basename($file)));
         }
         $this->results[] = array('name' => (string) $tmpInstaller->manifest->name, 'result' => $installResult);
     }
 }
開發者ID:Rai-Ka,項目名稱:joomla-cms,代碼行數:38,代碼來源:package.php

示例7: unpack

 /**
  * Unpacks a file and verifies it as a Joomla element package
  * Supports .gz .tar .tar.gz and .zip
  *
  * @static
  * @param string $p_filename The uploaded package filename or install directory
  * @return Array Two elements - extractdir and packagefile
  * @since 1.5
  */
 function unpack($p_filename)
 {
     // Path to the archive
     $archivename = $p_filename;
     // Temporary folder to extract the archive into
     $tmpdir = uniqid('install_');
     // Clean the paths to use for archive extraction
     $extractdir = JPath::clean(dirname($p_filename) . DS . $tmpdir);
     $archivename = JPath::clean($archivename);
     // do the unpacking of the archive
     $result = JArchive::extract($archivename, $extractdir);
     if ($result === false) {
         return false;
     }
     /*
      * Lets set the extraction directory and package file in the result array so we can
      * cleanup everything properly later on.
      */
     $retval['extractdir'] = $extractdir;
     $retval['packagefile'] = $archivename;
     /*
      * Try to find the correct install directory.  In case the package is inside a
      * subdirectory detect this and set the install directory to the correct path.
      *
      * List all the items in the installation directory.  If there is only one, and
      * it is a folder, then we will set that folder to be the installation folder.
      */
     $dirList = array_merge(JFolder::files($extractdir, ''), JFolder::folders($extractdir, ''));
     if (count($dirList) == 1) {
         if (JFolder::exists($extractdir . DS . $dirList[0])) {
             $extractdir = JPath::clean($extractdir . DS . $dirList[0]);
         }
     }
     /*
      * We have found the install directory so lets set it and then move on
      * to detecting the extension type.
      */
     $retval['dir'] = $extractdir;
     /*
      * Get the extension type and return the directory/type array on success or
      * false on fail.
      */
     if ($retval['type'] = JInstallerHelper::detectType($extractdir)) {
         return $retval;
     } else {
         return false;
     }
 }
開發者ID:jicheng17,項目名稱:comanova,代碼行數:57,代碼來源:helper.php

示例8: _getPackage

 /**
  * Get the install package or folder
  * @return Array $package
  */
 function _getPackage()
 {
     $config = JFactory::getConfig();
     jimport('joomla.filesystem.file');
     // set standard method
     $upload = true;
     $package = null;
     // Get the uploaded file information
     $file = JRequest::getVar('install', null, 'files', 'array');
     // get the file path information
     $path = JRequest::getString('install_input');
     if (!(bool) ini_get('file_uploads') || !is_array($file)) {
         $upload = false;
         // no path either!
         if (!$path) {
             JError::raiseWarning('SOME_ERROR_CODE', WFText::_('WARNINSTALLFILE'));
             return false;
         }
     }
     // Install failed
     if (!$file['tmp_name'] && !$file['name'] || ($file['error'] || $file['size'] < 1)) {
         $upload = false;
         if (!$path) {
             JError::raiseWarning('SOME_ERROR_CODE', WFText::_('WF_INSTALLER_NO_FILE'));
             return false;
         }
     }
     // uploaded file
     if ($upload && $file['tmp_name'] && $file['name']) {
         $dest = $config->getValue('config.tmp_path') . DS . $file['name'];
         $src = $file['tmp_name'];
         // upload file
         JFile::upload($src, $dest);
         // path to file
     } else {
         $dest = JPath::clean($path);
     }
     // Unpack the package file
     if (preg_match('/\\.(zip|tar|gz|gzip|tgz|tbz2|bz2|bzip2)/i', $dest)) {
         // Make sure that zlib is loaded so that the package can be unpacked
         if (!extension_loaded('zlib')) {
             JError::raiseWarning('SOME_ERROR_CODE', WFText::_('WARNINSTALLZLIB'));
             return false;
         }
         $package = JInstallerHelper::unpack($dest);
         // might be a directory
     } else {
         if (!is_dir($dest)) {
             JError::raiseWarning('SOME_ERROR_CODE', WFText::_('WF_INSTALLER_INVALID_SRC'));
             return false;
         }
         // Detect the package type
         $type = @JInstallerHelper::detectType($dest);
         $package = array('packagefile' => null, 'extractdir' => null, 'dir' => $dest, 'type' => $type);
     }
     $package['manifest'] = null;
     // set install method
     JRequest::setVar('install_method', 'install');
     return $package;
 }
開發者ID:srbsnkr,項目名稱:sellingonlinemadesimple,代碼行數:64,代碼來源:installer.php

示例9: install

 /**
  * Custom install method
  *
  * @access	public
  * @return	boolean	True on success
  * @since	1.5
  */
 function install()
 {
     // Get the extension manifest object
     $this->manifest = $this->parent->getManifest();
     /**
      * ---------------------------------------------------------------------------------------------
      * Manifest Document Setup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Set the extensions name
     $name = (string) $this->manifest->packagename;
     $name = JFilterInput::getInstance()->clean($name, 'cmd');
     $this->set('name', $name);
     // Get the component description
     $description = (string) $this->manifest->description;
     if ($description) {
         $this->parent->set('message', $description);
     } else {
         $this->parent->set('message', '');
     }
     // Set the installation path
     $group = (string) $this->manifest->packagename;
     if (!empty($group)) {
         // TODO: Remark this location
         $this->parent->setPath('extension_root', JPATH_ROOT . DS . 'libraries' . DS . implode(DS, explode('/', $group)));
     } else {
         $this->parent->abort(JText::_('Package') . ' ' . JText::_('Install') . ': ' . JText::_('No package file specified'));
         return false;
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Filesystem Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     // If the plugin directory does not exist, lets create it
     $created = false;
     if (!file_exists($this->parent->getPath('extension_root'))) {
         if (!($created = JFolder::create($this->parent->getPath('extension_root')))) {
             $this->parent->abort(JText::_('Package') . ' ' . JText::_('Install') . ': ' . JText::_('FAILED_TO_CREATE_DIRECTORY') . ': "' . $this->parent->getPath('extension_root') . '"');
             return false;
         }
     }
     /*
      * If we created the plugin directory and will want to remove it if we
      * have to roll back the installation, lets add it to the installation
      * step stack
      */
     if ($created) {
         $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_root')));
     }
     if ($folder = (string) $this->manifest->files->attributes()->folder) {
         $source = $this->parent->getPath('source') . DS . $folder;
     } else {
         $source = $this->parent->getPath('source');
     }
     // Install all necessary files
     if (count($this->manifest->files->children())) {
         foreach ($this->manifest->files->children() as $child) {
             $file = $source . DS . $child;
             jimport('joomla.installer.helper');
             if (is_dir($file)) {
                 // if its actually a directory then fill it up
                 $package = array();
                 $package['dir'] = $file;
                 $package['type'] = JInstallerHelper::detectType($file);
             } else {
                 // if its an archive
                 $package = JInstallerHelper::unpack($file);
             }
             $tmpInstaller = new JInstaller();
             if (!$tmpInstaller->install($package['dir'])) {
                 $this->parent->abort(JText::_('Package') . ' ' . JText::_('Install') . ': ' . JText::_('There was an error installing an extension:') . basename($file));
                 return false;
             }
         }
     } else {
         $this->parent->abort(JText::_('Package') . ' ' . JText::_('Install') . ': ' . JText::_('There were no files to install!') . print_r($this->manifest->files->children(), true));
         return false;
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Extension Registration
      * ---------------------------------------------------------------------------------------------
      */
     $row =& JTable::getInstance('extension');
     $row->name = $this->get('name');
     $row->type = 'package';
     $row->element = $this->get('element');
     $row->folder = '';
     // There is no folder for modules
     $row->enabled = 1;
     $row->protected = 0;
     $row->access = 1;
//.........這裏部分代碼省略.........
開發者ID:joebushi,項目名稱:joomla,代碼行數:101,代碼來源:package.php

示例10: install

 public function install()
 {
     // Anti-CSRF token check
     if ($this->csrfProtection) {
         $this->_csrfProtection();
     }
     /** @var AkeebaModelUpdates $model */
     $model = $this->getThisModel();
     // Get the downloaded package path
     $session = JFactory::getSession();
     $updatePackagePath = $session->get('downloadedPackage', null, 'com_akeeba.update');
     $installationDirectory = $session->get('installationDirectory', null, 'com_akeeba.update');
     // Registers FTP credentials from the session
     $needsFTP = $model->needsFTPCredentials();
     try {
         if (!is_dir($installationDirectory)) {
             throw new RuntimeException(JText::_('UPDATE_ERROR_CANTEXTRACT'));
         }
         jimport('joomla.installer.installer');
         jimport('joomla.installer.helper');
         $installer = JInstaller::getInstance();
         $packageType = JInstallerHelper::detectType($installationDirectory);
         if (!$packageType) {
             throw new RuntimeException(JText::_('COM_AKEEBA_UPDATE_ERR_WRONGPACKAGETYPE'));
         }
         if (!$installer->install($installationDirectory)) {
             $model->setState('name', $installer->get('name'));
             $model->setState('message', $installer->message);
             $model->setState('extmessage', $installer->get('extension_message'));
             throw new RuntimeException(JText::_('COM_AKEEBA_UPDATE_ERR_CANTINSTALLUPDATE'));
         }
         $model->setState('name', $installer->get('name'));
         $model->setState('message', $installer->message);
         $model->setState('extmessage', $installer->get('extension_message'));
     } catch (Exception $e) {
         // Remove the downloaded update file
         jimport('jooomla.filesystem.file');
         jimport('jooomla.filesystem.folder');
         if (is_file($updatePackagePath)) {
             if (!@unlink($updatePackagePath)) {
                 JFile::delete($updatePackagePath);
             }
         }
         if (is_dir($installationDirectory)) {
             JFolder::delete($installationDirectory);
         }
         // Clear the stale session information with Joomla! 1.x way
         $session->set('downloadedPackage', null, 'com_akeeba.update');
         $session->set('installationDirectory', null, 'com_akeeba.update');
         // ... and with Joomla! 2.x+ way
         if (method_exists($session, 'clear')) {
             $session->clear('downloadedPackage', 'com_akeeba.update');
             $session->clear('installationDirectory', 'com_akeeba.update');
         }
         // Redirect to the error page
         $url = 'index.php?option=' . $this->input->getCmd('option', '') . '&view=update';
         $this->setRedirect($url, $e->getMessage(), 'error');
         return true;
     }
     // Show the page where the user is informed the update installation is complete
     $this->display(false);
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:62,代碼來源:update.php

示例11: _getPackageFromFolder

 protected function _getPackageFromFolder()
 {
     // @TODO find a better way to filter the data
     $directory = KRequest::get('post.directory', 'path', $this->getModel()->getState()->directory);
     // Detect the package type
     $type = JInstallerHelper::detectType($directory);
     // Did you give us a valid package?
     if (!$type) {
         JError::raiseWarning(0, JText::_('Path does not have a valid package'));
         return false;
     }
     return array('packagefile' => null, 'extractdir' => null, 'dir' => $directory, 'type' => $type);
 }
開發者ID:JSWebdesign,項目名稱:intranet-platform,代碼行數:13,代碼來源:install.php

示例12: array

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
$app = JFactory::getApplication();
$plugins = array('search_otrsgateway', 'authentication_otrsgateway');
$db = JFactory::getDBO();
foreach ($plugins as $plugin) {
    $p_dir = $this->parent->getPath('source') . DS . 'plugins' . DS . $plugin;
    $package = array();
    $package['packagefile'] = null;
    $package['extractdir'] = null;
    $package['dir'] = $p_dir;
    $package['type'] = JInstallerHelper::detectType($p_dir);
    $installer = new JInstaller();
    // Install the package
    if (!$installer->install($package['dir'])) {
        // There was an error installing the package
        $msg = JText::sprintf('INSTALLEXT', JText::_($package['type']), JText::_('Error'));
        $app->enqueueMessage($msg);
        $result = false;
    } else {
        // Package installed sucessfully
        $msg = JText::sprintf('INSTALLEXT', JText::_($package['type']), JText::_('Success'));
        $app->enqueueMessage($msg);
        $result = true;
        // Enable the installed plugin
        $plgParts = explode("_", $plugin);
        $query = "UPDATE #__plugins SET published = 1 WHERE folder = '" . $plgParts[0] . "' AND element = '" . $plgParts[1] . "'";
開發者ID:noamk,項目名稱:OTRS-Joomla-Gateway,代碼行數:31,代碼來源:install.otrsgateway.php

示例13: _getPackageFromFolder

 function _getPackageFromFolder()
 {
     // Get the path to the package to install
     $p_dir = JRequest::getString('install_directory');
     $p_dir = JPath::clean($p_dir);
     // Did you give us a valid directory?
     if (!is_dir($p_dir)) {
         JError::raiseWarning(100, JText::_('COM_SEF_ENTER_PACKAGE_DIRECTORY'));
         return false;
     }
     // Detect the package type
     $type = JInstallerHelper::detectType($p_dir);
     // Did you give us a valid package?
     if (!$type || $type != 'sef_ext') {
         JError::raiseWarning(100, JText::_('COM_SEF_ERROR_NO_VALID_PACKAGE'));
         return false;
     }
     $package['packagefile'] = null;
     $package['extractdir'] = null;
     $package['dir'] = $p_dir;
     $package['type'] = $type;
     return $package;
 }
開發者ID:jmangarret,項目名稱:webtuagencia24,代碼行數:23,代碼來源:extension.php

示例14: fromDirectory

	function fromDirectory()
	{
		// Get the path to the package to install
		$p_dir = JRequest::getString('install_directory');
		$p_dir = JPath::clean( $p_dir );

		// Did you give us a valid directory?
		if (!is_dir($p_dir)) {
			if(version_compare(JVERSION, '1.6.0', 'ge')) {
				JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_ENTER_A_PACKAGE_DIRECTORY'));
			} else {
				JError::raiseWarning('SOME_ERROR_CODE', JText::_('Please enter a package directory'));
			}
			return false;
		}

		// Detect the package type
		$type = JInstallerHelper::detectType($p_dir);

		// Did you give us a valid package?
		if (!$type) {
			if(version_compare(JVERSION, '1.6.0', 'ge')) {
				JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'));
			} else {
				JError::raiseWarning('SOME_ERROR_CODE', JText::_('Path does not have a valid package'));
			}
			return false;
		}

		$package['packagefile'] = null;
		$package['extractdir'] = null;
		$package['dir'] = $p_dir;
		$package['type'] = $type;
		
		$session = JFactory::getSession();
		$session->set('package', $package, 'akeeba');

		return true;
	}
開發者ID:rkern21,項目名稱:videoeditor,代碼行數:39,代碼來源:installer.php

示例15: _getPackageFromFolder

 /**
  * Install an extension from a directory
  *
  * @static
  * @return boolean True on success
  * @since 1.0
  */
 function _getPackageFromFolder()
 {
     // Get the path to the package to install
     $p_dir = JRequest::getString('install_directory');
     $p_dir = JPath::clean($p_dir);
     // Did you give us a valid directory?
     if (!is_dir($p_dir)) {
         JError::raiseWarning('SOME_ERROR_CODE', JText::_('Please enter a package directory'));
         return false;
     }
     // Detect the package type
     $type = JInstallerHelper::detectType($p_dir);
     // Did you give us a valid package?
     if (!$type) {
         JError::raiseWarning('SOME_ERROR_CODE', JText::_('Path does not have a valid package'));
         return false;
     }
     $package['packagefile'] = null;
     $package['extractdir'] = null;
     $package['dir'] = $p_dir;
     $package['type'] = $type;
     return $package;
 }
開發者ID:realityking,項目名稱:rsgallery2,代碼行數:30,代碼來源:install.php


注:本文中的JInstallerHelper::detectType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。