本文整理汇总了PHP中JDeveloperLoader类的典型用法代码示例。如果您正苦于以下问题:PHP JDeveloperLoader类的具体用法?PHP JDeveloperLoader怎么用?PHP JDeveloperLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JDeveloperLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFields
/**
* Get fields from form file
*
* @param SimpleXMLElement $form Form file
*
* @return mixed Fields array on success, false otherwise
*/
public function getFields(SimpleXMLElement $form, $table = 0)
{
JDeveloperLoader::importHelper("field");
// Check if xml file contains form information
if ($form->getName() != "form") {
return false;
}
// Get fields
$fields = array();
foreach ($form->fieldset->children() as $_field) {
$field = array();
$field["id"] = 0;
$field["name"] = (string) $_field["name"];
$field["type"] = (string) $_field["type"];
$field["table"] = $table;
$field["label"] = (string) ucfirst($_field["name"]);
$field["dbtype"] = JDeveloperHelperField::getDbType((string) $_field["type"]);
$field["rule"] = isset($_field["validate"]) ? (string) $_field["validate"] : "";
$field["maxlength"] = isset($_field["size"]) ? (string) $_field["size"] : "10";
$field["params"] = array();
$field["params"]["class"] = isset($_field["class"]) ? (string) $_field["class"] : "inputbox";
$field["params"]["default"] = isset($_field["default"]) ? (string) $_field["default"] : "";
$field["params"]["filter"] = isset($_field["filter"]) ? (string) $_field["filter"] : "";
$field["params"]["readonly"] = isset($_field["readonly"]) ? "1" : "0";
$field["params"]["frontend_list"] = "1";
$field["params"]["frontend_item"] = "1";
$field["params"]["listfilter"] = "0";
$field["params"]["searchable"] = "0";
$field["params"]["sortable"] = "0";
$fields[] = $field;
}
return $fields;
}
示例2: 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];
}
示例3: 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)));
}
示例4: 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.
*
示例5: defined
<?php
/**
* @package JDeveloper
* @subpackage JDeveloper
*
* @copyright Copyright (C) 2014, Tilo-Lars Flasche. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
require_once JDeveloperLIB . "/loader.php";
require_once JPATH_COMPONENT_ADMINISTRATOR . "/config.php";
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
JDeveloperLoader::import("archive");
示例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 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
{
}
示例10: 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
*/
示例11: 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);
JDeveloperLoader::importHelper("table");
/**
* Component Create Class
*
* @package JDeveloper
* @subpackage Create.Component
*/
class JDeveloperCreateComponentAdminUpdate extends JDeveloperCreateComponent
{
protected function condition()
{
return !empty($this->tables);
}
public function initialize()
{
$buffer = array();
$model = $this->getModel("Field");
$db = JFactory::getDbo();
foreach ($this->tables as $table) {
if (in_array($table->dbname, $db->getTableList())) {
示例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 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)));
示例15: 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";
}