CoreFiles by mySites.guru
FileModel.php66 lines, 1,631 bytes, from Joomla_4.0.0-alpha2-Alpha-Full_Package.zip
Raw History Compare with 3.10.0-alpha9
md5
d82e931a7ac014a600b8b00506b6ae18
sha1
5e7d1a23973b8a0aea235f463a533d9ab6754165
sha256
40eb6d669b3216efc30e3d5484849f4d1b2b65c571ea49b5ccca213b39833a6d
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_media
 *
 * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Media\Administrator\Model;

defined('_JEXEC') or die;

use Joomla\CMS\MVC\Model\FormModel;
use Joomla\CMS\Plugin\PluginHelper;

/**
 * File Model
 *
 * @since  __DEPLOY_VERSION__
 */
class FileModel extends FormModel
{
	/**
	 * Method to get the record form.
	 *
	 * @param   array    $data      Data for the form.
	 * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
	 *
	 * @return  \Joomla\CMS\Form\Form|boolean  A Form object on success, false on failure
	 *
	 * @since   __DEPLOY_VERSION__
	 */
	public function getForm($data = array(), $loadData = true)
	{
		PluginHelper::importPlugin('media-action');

		// Get the form.
		$form = $this->loadForm('com_media.file', 'file', array('control' => 'jform', 'load_data' => $loadData));

		if (empty($form))
		{
			return false;
		}

		return $form;
	}

	/**
	 * Method to get the file information for the given path. Path must be
	 * in the format: adapter:path/to/file.extension
	 *
	 * @param   string  $path  The path to get the information from.
	 *
	 * @return  \stdClass  A object with file information
	 *
	 * @since   __DEPLOY_VERSION__
	 * @see     ApiModel::getFile()
	 */
	public function getFileInformation($path)
	{
		list($adapter, $path) = explode(':', $path, 2);

		return (new ApiModel)->getFile($adapter, $path, ['url' => true]);
	}
}

No other release has this exact content. See every version of this file.