本文整理汇总了PHP中JDeveloperLoader::import方法的典型用法代码示例。如果您正苦于以下问题:PHP JDeveloperLoader::import方法的具体用法?PHP JDeveloperLoader::import怎么用?PHP JDeveloperLoader::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDeveloperLoader
的用法示例。
在下文中一共展示了JDeveloperLoader::import方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* Method to get an array of data items.
*
* @return array An array of data items
*
* @since 12.2
*/
public function getItems()
{
JDeveloperLoader::import("archive");
$extension = JTable::getInstance("Extension", "JTable");
// Get a storage key.
$store = $this->getStoreId('getItems');
// Load the list items.
$items = parent::getItems();
// Add information
foreach ($items as $item) {
// Is Component already installed?
$item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("mod_", $item->name, $item->version);
$item->installed = JDeveloperInstall::isInstalled("module", "mod_" . $item->name);
if ($item->installed) {
$extension->load(array("name" => "mod_" . $item->name, "type" => "module"));
$item->enabled = (bool) $extension->enabled;
} else {
$item->enabled = false;
}
}
// If emtpy or an error, just return.
if (empty($items)) {
return array();
}
// Add the items to the internal cache.
$this->cache[$store] = $items;
return $this->cache[$store];
}
示例2: create
/**
* Create ZIP file of plugins
*
* @param array $ids The primary keys of the items
*/
public function create($ids = array())
{
// Initialize
$user = JFactory::getUser();
$app = JFactory::getApplication();
$this->setRedirect(JRoute::_('index.php?option=com_jdeveloper&view=plugin', false));
if (empty($ids)) {
$ids = $app->input->get('cid', array(), 'array');
}
// Check access
if (!$user->authorise('plugins.create', 'com_jdeveloper')) {
$this->setMessage(JText::_('COM_JDEVELOPER_ACTION_NOT_ALLOWED'), 'warning');
return;
}
// Load classes
JDeveloperLoader::import('archive');
JDeveloperLoader::import('template');
JDeveloperLoader::import('plugin', JDeveloperCREATE);
jimport('joomla.filesystem.folder');
// Create Plugin for each id
foreach ($ids as $id) {
$plugin = $this->getModel()->getItem($id);
$path = $plugin->createDir;
// Delete old archive if exists
JFile::exists($path . '.zip') ? JFile::delete($path . '.zip') : null;
// Create Plugin
try {
JDeveloperCreatePlugin::execute(array("item_id" => $id));
} catch (JDeveloperException $e) {
$this->setMessage($e->getMessage(), "error");
return;
}
// Create HTML files for each folder, zip the folder and delete the folder
JDeveloperArchive::html($path);
// Create ZIP archive and delete folder
JDeveloperArchive::zip($path);
JFolder::delete($path);
}
$this->setMessage(JText::sprintf('COM_JDEVELOPER_PLUGIN_MESSAGE_ZIP_CREATED', count($ids)));
}
示例3: defined
<?php
/**
* @package JDeveloper
* @subpackage Create.Plugin
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("plugin", JDeveloperCREATE);
/**
* Plugin Create Class
*
* @package JDeveloper
* @subpackage Create.Plugin
*/
class JDeveloperCreatePluginFolder extends JDeveloperCreatePlugin
{
/**
* Get the template object
*
* @return JDeveloperTemplate
*/
protected function getTemplate()
{
$this->templateFile = $this->item->folder . ".php";
return parent::getTemplate();
}
/**
* @see JDeveloperCreate
示例4: defined
<?php
/**
* @package JDeveloper
* @subpackage Create.Form
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("form", JDeveloperCREATE);
/**
* Form Create Class
*
* @package JDeveloper
* @subpackage Create.Form
*/
class JDeveloperCreateFormChild extends JDeveloperCreateForm
{
/**
* The template file
*
* @var string
*/
protected $templateFile = "form_child.xml";
/**
* @see JDeveloperCreate
*/
protected function initialize()
{
$this->template->addAreas(array("filter" => (bool) $this->item->filter, "validation" => (bool) $this->item->validation, "disabled" => (bool) $this->item->disabled, "readonly" => (bool) $this->item->readonly, "required" => (bool) $this->item->required, "list" => !empty($this->item->options)));
示例5: defined
<?php
/**
* @package JDeveloper
* @subpackage Controllers
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("controllers.list");
/**
* JDeveloper Forms Controller
*
* @package JDeveloper
* @subpackage Controllers
*/
class JDeveloperControllerForms extends JDeveloperControllerList
{
/**
* The URL view list variable.
*
* @var string
* @since 12.2
*/
protected $view_list = 'Forms';
/**
* Rebuild the nested set tree.
*
* @return bool False on failure or error, true on success.
*
示例6: _getSource
/**
* Get the template
*
* @param string $type The extension type (component, module, plugin, template)
* @param string $name The template name
* @param int $item_id The extension id (primary key of table shere item is stored)
*
* @return string The template
*/
private function _getSource($type, $name, $item_id)
{
JDeveloperLoader::import("create");
$input = JFactory::getApplication()->input;
$dir = JDeveloperCREATE . "/" . implode("/", explode(".", $type));
foreach (JFolder::files($dir, "php\$") as $file) {
$create = JDeveloperCreate::getInstance($type . "." . JFile::stripExt($file), array("item_id" => $item_id));
if ($create->templateFile == $name) {
return $create->getBuffer();
}
}
return "";
}
示例7: defined
<?php
/**
* @package JDeveloper
* @subpackage Create.Component
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("component", JDeveloperCREATE);
/**
* Table Create Class
*
* @package JDeveloper
* @subpackage Create.Component
*/
class JDeveloperCreateComponentAdminViewComponent extends JDeveloperCreateComponent
{
/**
* The template file
*
* @var string
*/
protected $templateFile = "admin.views.component.view.html.php";
/**
* Check whether file should be created or not
*
* @return boolean
*/
protected function condition()
示例8: defined
<?php
/**
* @package JDeveloper
* @subpackage Views
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("create");
$input = JFactory::getApplication()->input;
$id = $input->get("id", 0, "int");
if ($id) {
echo JHtml::_("code.form", JDeveloperCreate::getInstance("table.admin.form.singular", array("item_id" => $id))->getBuffer());
}
示例9: defined
<?php
/**
* @package JDeveloper
* @subpackage Models
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("models.admin");
/**
* JDeveloper Field Model
*
* @package JDeveloper
* @subpackage Models
*/
class JDeveloperModelField extends JDeveloperModelAdmin
{
/**
* Method to get a table object, load it if necessary.
*
* @param string $name The table name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $options Configuration array for model. Optional.
*
* @return JTable A JTable object
*
* @since 12.2
* @throws Exception
*/
示例10: defined
<?php
/**
* @package JDeveloper
* @subpackage Create.Template
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("template", JDeveloperCREATE);
/**
* Template Create Class
*
* @package JDeveloper
* @subpackage Create.Template
*/
class JDeveloperCreateTemplateHtml extends JDeveloperCreateTemplate
{
/**
* The template file
*
* @var string
*/
protected $templateFile = "index.php";
}
示例11: defined
<?php
/**
* @package JDeveloper
* @subpackage Models
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("models.extension");
/**
* JDeveloper Module Model
*
* @package JDeveloper
* @subpackage Models
*/
class JDeveloperModelModule extends JDeveloperModelExtension
{
/**
* Method to get a table object, load it if necessary.
*
* @param string $name The table name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $options Configuration array for model. Optional.
*
* @return JTable A JTable object
*
* @since 12.2
* @throws Exception
*/
示例12: create
/**
* Create component ids
*
* @param array $ids The component
*/
public function create($ids = array())
{
// Initialize
$user = JFactory::getUser();
$app = JFactory::getApplication();
$this->setRedirect(JRoute::_('index.php?option=com_jdeveloper&view=component', false));
if (empty($ids)) {
$ids = $app->input->get('cid', array(), 'array');
}
// Check access
if (!$user->authorise('components.create', 'com_jdeveloper')) {
$this->setMessage(JText::_('COM_JDEVELOPER_ACTION_NOT_ALLOWED'), 'warning');
return;
}
// Load classes
JDeveloperLoader::import('archive');
JDeveloperLoader::import('template');
JDeveloperLoader::import('component', JDeveloperCREATE);
JDeveloperLoader::import('table', JDeveloperCREATE);
jimport('joomla.filesystem.folder');
// Create component for each id
foreach ($ids as $id) {
$component = $this->getModel()->getItem($id);
$path = $component->createDir;
// Delete old archive if exists
JFile::exists($path . '.zip') ? JFile::delete($path . '.zip') : null;
// Create component
JDeveloperCreateComponent::execute("admin", array("item_id" => $id));
JDeveloperCreateTable::execute("admin", array("item_id" => $id));
// Create component for frontend
if ($component->get('site', 0)) {
JDeveloperCreateComponent::execute("site", array("item_id" => $id));
JDeveloperCreateTable::execute("site", array("item_id" => $id));
}
// Get language files content
$buffer = JDeveloperLanguage::getInstance("com_" . $component->name)->sort()->toINI();
$buffer_sys = JDeveloperLanguage::getInstance("com_" . $component->name . "_sys")->sort()->toINI();
// Write language files
foreach ($component->params["languages"] as $lang) {
JFile::write($component->createDir . "/admin/language/{$lang}.com_" . strtolower($component->name) . ".ini", $buffer);
JFile::write($component->createDir . "/admin/language/{$lang}.com_" . strtolower($component->name) . ".sys.ini", $buffer_sys);
$component->site ? JFile::write($component->createDir . "/site/language/{$lang}.com_" . strtolower($component->name) . ".ini", $buffer) : null;
}
// Create HTML files for each folder
JDeveloperArchive::html($path . '/admin');
(int) $component->get('site', 0) ? JDeveloperArchive::html($path . '/site') : null;
// Create ZIP archive and delete folder
JDeveloperArchive::zip($path);
JFolder::delete($path);
}
$this->setMessage(JText::sprintf('COM_JDEVELOPER_COMPONENT_CREATED', count($ids)));
}
示例13: defined
<?php
/**
* @package JDeveloper
* @subpackage Create.Library
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("library", JDeveloperCREATE);
/**
* Library Create Class
*
* @package JDeveloper
* @subpackage Create.Library
*/
class JDeveloperCreateLibraryManifest extends JDeveloperCreateLibrary
{
/**
* The template file
*
* @var string
*/
protected $templateFile = "library.xml";
protected function initialize()
{
$this->template->addPlaceHolders(array("author" => $this->item->get('author'), "author_email" => $this->item->get('author_email'), "author_url" => $this->item->get('author_url'), "copyright" => $this->item->get('copyright'), "creationdate" => date("M Y"), "licence" => $this->item->get('licence'), "languages" => $this->lang(), "version" => $this->item->get('version')));
return parent::initialize();
}
/**
示例14: defined
<?php
/**
* @package JDeveloper
* @subpackage Controllers
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("controllers.item");
/**
* JDeveloper Template Controller
*
* @package JDeveloper
* @subpackage Controllers
*/
class JDeveloperControllerTemplate extends JDeveloperControllerItem
{
}
示例15: defined
<?php
/**
* @package JDeveloper
* @subpackage Models
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
JDeveloperLoader::import("models.admin");
JDeveloperLoader::import("install");
/**
* JDeveloper Component Model
*
* @package JDeveloper
* @subpackage Models
*/
class JDeveloperModelComponent extends JDeveloperModelAdmin
{
/**
* Method to delete one or more records.
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*/
public function delete(&$pks)
{
// Delete tables which belong to the component
if ((int) JComponentHelper::getParams('com_jdeveloper')->get('delete_tables')) {