本文整理汇总了PHP中gantry_import函数的典型用法代码示例。如果您正苦于以下问题:PHP gantry_import函数的具体用法?PHP gantry_import怎么用?PHP gantry_import使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gantry_import函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
global $gantry;
gantry_import('core.gantrydiagnostic');
$diagnose = new GantryDiagnostic();
$errors = $diagnose->checks();
$output = "";
if (count($errors) > 0) {
$klass = "errors";
$output = implode("", $errors);
} else {
$klass = "success";
$output = "Diagnostic checks successfully passed.";
}
$output .= '<br/><a href="'.JURI::base(true).'?option=com_admin&tmpl=gantry-ajax-admin&model=diagnostics&template='.$gantry->templateName.'">Download Diagnostic Info</a>';
return "
<div id='diagnostic' class='".$klass."'>
<div id='diagnostic-bar' class='g-title'>".JText::_('DIAGNOSTICS')." - ". ucfirst($klass) ." <span class='arrow'></span></div>
<div id='diagnostic-desc' class='g-inner'>
".$output."
</div>
</div>";
}
示例2: display
function display($tpl = null)
{
/** @var $gantry Gantry */
global $gantry;
$language = JFactory::getLanguage();
$language->load('com_templates');
$this->item = $this->get('Item');
JHtml::_('behavior.framework', true);
require_once JPATH_LIBRARIES . "/gantry/gantry.php";
gantry_import('core.config.gantryform');
GantryForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR);
GantryForm::addFormPath($gantry->templatePath);
GantryForm::addFieldPath($gantry->gantryPath . '/admin/forms/fields');
GantryForm::addFieldPath($gantry->templatePath . '/fields');
GantryForm::addFieldPath($gantry->templatePath . '/admin/forms/fields');
GantryForm::addGroupPath($gantry->gantryPath . '/admin/forms/groups');
GantryForm::addGroupPath($gantry->templatePath . '/admin/forms/groups');
$this->state = $this->get('State');
$this->form = $this->get('Form');
$this->override = $this->get('Override');
$this->gantryForm = $this->get('GantryForm');
$this->activeTab = isset($_COOKIE['gantry-admin-tab']) ? $_COOKIE['gantry-admin-tab'] + 1 : 1;
$this->tabs = $this->getTabs($this->gantryForm);
$this->assignmentCount = $this->getAssignmentCount($this->item->id);
$model = $this->getModel();
$model->checkForGantryUpdate();
//$this->addToolbar();
JToolBarHelper::title('');
ob_start();
parent::display($tpl);
$buffer = ob_get_clean();
echo $buffer;
}
示例3: init
function init(&$gantry)
{
gantry_import("core.utilities.gantryxml");
$this->xml = new GantryXML();
$this->xml->loadFile($gantry->templatePath . '/templateDetails.xml');
$this->positions =& $this->_getPositions();
$this->params = $this->_getParams($gantry);
}
示例4: fetchElement
/**
* @global gantry used to access the core Gantry class
* @param $name
* @param $value
* @param $node
* @param $control_name
* @return void
*/
function fetchElement($name, $value, &$node, $control_name)
{
global $gantry;
$output = "";
$document =& JFactory::getDocument();
$arrayList = "'" . implode("', '", explode(",", str_replace(" ", "", $node->attributes('default')))) . "'";
if (!defined('GANTRY_ADMIN')) {
include_once dirname(dirname(__FILE__)) . '/../gantry.php';
gantry_import('core.gantrybrowser');
$browser = new GantryBrowser();
$gantry_created_dirs = array($gantry->custom_dir, $gantry->custom_menuitemparams_dir);
$this->template = end(explode(DS, $gantry->templatePath));
gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry.css');
if ($browser->name == 'ie' && $browser->version == '7' && file_exists($gantry->gantryPath . DS . 'admin' . DS . 'widgets' . DS . 'gantry-ie7.css')) {
gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry-ie7.css');
}
gantry_addScript($gantry->gantryUrl . '/admin/widgets/gantry.js');
gantry_addInlineScript("var GantrySlideList = [" . $arrayList . "];var AdminURI = '" . JURI::base() . "';var UnallowedParams = ['" . implode("', '", $gantry->dontsetinmenuitem) . '\'];');
gantry_addInlineScript($this->gantryLang());
// fixes Firefox < 3.7 input line-height issue
if ($browser->name == 'firefox' && $browser->version < '3.7' || $browser->name == 'ie' && $browser->version > '6') {
$css = ".text-short, .text-medium, .text-long, .text-color {padding-top: 4px;height:19px;}";
gantry_addInlineStyle($css);
}
if ($browser->name == 'ie' && $browser->shortversion == '7') {
$css = "\n\t\t\t\t\t.g-surround, .g-inner, .g-surround > div {zoom: 1;position: relative;}\n\t\t\t\t\t.text-short, .text-medium, .text-long, .text-color {border:0 !important;}\n\t\t\t\t\t.selectbox {z-index:500;position:relative;}\n\t\t\t\t\t.group-fusionmenu, .group-splitmenu {position:relative;margin-top:0 !important;zoom:1;}\n\t\t\t\t\t.scroller .inner {position:relative;}\n\t\t\t\t\t.moor-hexLabel {display:inline-block;zoom:1;float:left;}\n\t\t\t\t\t.moor-hexLabel input {float:left;}\n\t\t\t\t";
gantry_addInlineStyle($css);
}
//create dirs needed by gantry
foreach ($gantry_created_dirs as $dir) {
if (is_readable(dirname($dir)) && is_writeable(dirname($dir)) && !JFolder::exists($dir)) {
JFolder::create($dir);
}
}
if (version_compare(JVERSION, '1.5.14', '<=')) {
$tmpscripts = array();
foreach ($document->_scripts as $script => $type) {
if ($script != $gantry->baseUrl . 'media/system/js/mootools.js') {
$tmpscripts[$script] = $type;
} else {
$tmpscripts[$gantry->gantryUrl . '/js/mootools-1.1.2.js'] = $type;
}
}
$document->_scripts = $tmpscripts;
}
$this->checkAjaxTool();
define('GANTRY_ADMIN', 1);
}
if (file_exists($gantry->templatePath . "/gantry.scripts.php") && is_readable($gantry->templatePath . "/gantry.scripts.php")) {
include_once $gantry->templatePath . "/gantry.scripts.php";
if (function_exists('gantry_params_init')) {
gantry_params_init();
}
}
$this->_parent->addElementPath($gantry->templatePath . DS . 'elements');
$this->_parent->addElementPath($gantry->templatePath . DS . 'admin/elements');
}
示例5: _dateFormat
function _dateFormat($instance)
{
gantry_import('core.utilities.gantrydate');
global $gantry;
$now = new GantryDate();
$formats = str_replace("%", "\$", $instance['format']);
$gantry->addInlineScript("dateFormat.i18n = {" . $this->_dateLanguage() . "};var dateFeature = new Date().format('{$formats}');\n");
$js = "\n\t\t\t\tvar dates = \$\$('.date-block .date');\n\t\t\t\tif (dates.length) {\n\t\t\t\t\tdates.each(function(date) {\n\t\t\t\t\t\tdate.set('text', dateFeature);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\n";
return $js;
}
示例6: getInput
public function getInput()
{
/** @var $gantry Gantry */
global $gantry;
$name = (string) $this->element['name'];
$class = $this->element['class'] ? 'class="' . $this->element['class'] . '"' : 'class="inputbox"';
$mode = $this->element['mode'];
if (!isset($mode)) {
$mode = 'dropdown';
}
$options = array();
if (!array_key_exists($name, $gantry->presets)) {
return 'Unable to find the preset information';
}
foreach ($gantry->presets[$name] as $preset_name => $preset_value) {
$val = $preset_name;
$text = $preset_value['name'];
if (!array_key_exists('disabled', $preset_value)) {
$preset_value['disabled'] = 'false';
}
$options[] = GantryHtmlSelect::option((string) $val, JText::_(trim((string) $text)), 'value', 'text', (string) $preset_value['disabled'] == 'true');
}
if (!defined('GANTRY_PRESET')) {
gantry_import('core.gantryjson');
$template_path_parts = explode('/', $gantry->templatePath);
$this->template = end($template_path_parts);
$gantry->addScript($gantry->gantryUrl . '/admin/widgets/preset/js/preset.js');
$gantry->addScript($gantry->gantryUrl . '/admin/widgets/preset/js/preset-saver.js');
$gantry->addInlineScript('var Presets = {};var PresetsKeys = {};');
if (isset($gantry->customPresets[$name])) {
$gantry->addInlineScript('var CustomPresets = ' . GantryJSON::encode($gantry->customPresets[$name]) . ';');
} else {
$gantry->addInlineScript('var CustomPresets = {};');
}
define('GANTRY_PRESET', 1);
}
$this->presets = $gantry->originalPresets[$name];
$gantry->addInlineScript($this->populatePresets((string) $this->element['name']));
if ($mode == 'dropdown') {
include_once 'selectbox.php';
$gantry->addDomReadyScript("PresetDropdown.init('" . $name . "');");
$selectbox = new JElementSelectBox();
$node->addAttribute('preset', true);
return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
} else {
$gantry->addDomReadyScript("Scroller.init('" . $name . "');");
return $this->scrollerLayout($this->element);
}
}
示例7: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
global $gantry;
$class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="inputbox"' );
$mode = $node->attributes('mode');
if (!isset($mode)) $mode = 'dropdown';
$options = array();
if (!array_key_exists($name,$gantry->presets)) {
return JText::_('Unable to find the preset information');
}
foreach ($gantry->presets[$name] as $preset_name => $preset_value)
{
$val = $preset_name;
$text = $preset_value['name'];
$options[] = JHTML::_('select.option', $val, JText::_($text));
}
if (!defined('GANTRY_PRESET')) {
gantry_import('core.gantryjson');
$this->template = end(explode(DS, $gantry->templatePath));
gantry_addScript($gantry->gantryUrl.'/admin/widgets/preset/js/preset.js');
gantry_addScript($gantry->gantryUrl.'/admin/widgets/preset/js/preset-saver.js');
gantry_addInlineScript('var Presets = {};var PresetsKeys = {};');
if (isset($gantry->customPresets[$name])) {
gantry_addInlineScript('var CustomPresets = '.GantryJSON::encode($gantry->customPresets[$name]).';');
}
define('GANTRY_PRESET', 1);
}
$this->presets = $gantry->originalPresets[$name];
gantry_addInlineScript($this->populatePresets($name));
if ($mode == 'dropdown') {
include_once('selectbox.php');
gantry_addInlineScript("window.addEvent('domready', PresetDropdown.init.bind(PresetDropdown, '$name'));");
$selectbox = new JElementSelectBox;
$node->addAttribute('preset', true);
return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
} else {
gantry_addInlineScript("window.addEvent('domready', Scroller.init.bind(Scroller, '$name'));");
return $this->scrollerLayout($name, $value, $node, $control_name);
}
}
示例8: render
function render($position = "")
{
global $gantry;
if ($gantry->browser->platform != 'iphone' && $gantry->browser->platform != 'ipad' && $gantry->browser->platform != 'android') {
return false;
}
gantry_import('facets.menu.gantrymenu');
$params = $gantry->getParams($this->_feature_name, true);
$module_params = '';
foreach ($params as $param_name => $param_value) {
$module_params .= $param_name . "=" . $param_value['value'] . "\n";
}
$passing_params = new JParameter($module_params);
$gantrymenu = GantryMenu::getInstance($passing_params);
return $gantrymenu->render($passing_params);
}
示例9: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
global $gantry;
gantry_import('core.gantrydiagnostic');
$diagnose = new GantryDiagnostic();
$errors = $diagnose->checks();
$output = "";
if (count($errors) > 0) {
$klass = "errors";
$output = implode("", $errors);
} else {
$klass = "success";
$output = "Diagnostic checks successfully passed.";
}
return "\n\t\t<div id='diagnostic' class='" . $klass . "'>\n\t\t\t<div id='diagnostic-bar' class='g-title'>" . JText::_('DIAGNOSTICS') . " - " . ucfirst($klass) . " <span class='arrow'></span></div>\n\t\t\t<div id='diagnostic-desc' class='g-inner'>\n\t\t\t" . $output . "\n\t\t\t</div>\n\t\t</div>";
}
示例10: gantry_addStyle
function gantry_addStyle($file)
{
gantry_import('core.gantrybrowser');
$browser = new GantryBrowser();
$document =& JFactory::getDocument();
$filename = basename($file);
$relative_path = dirname($file);
// For local url path get the local path based on checks
$file_path = gantry_getFilePath($file);
$url_file_checks = $browser->getChecks($file_path, true);
foreach ($url_file_checks as $url_file) {
$full_path = realpath($url_file);
if ($full_path !== false && file_exists($full_path)) {
$document->addStyleSheet($relative_path . '/' . basename($full_path));
}
}
}
示例11: getInput
public function getInput()
{
global $gantry;
gantry_import('core.gantrydiagnostic');
$diagnose = new GantryDiagnostic();
$errors = $diagnose->runChecks();
$output = "";
if (count($errors) > 0) {
$klass = "errors";
$title = "Something Wrong :(";
$output = implode("", $errors);
} else {
$klass = "success";
$title = "Good!";
$output = "Congratulations! All the diagnostic test have passed successfully. There are no show-stopper issues. You can however still download the ";
}
//$output .= '<a href="'.$gantry->baseUrl.'?option=com_admin&tmpl=gantry-ajax-admin&model=diagnostics&template='.$gantry->templateName.'">Diagnostic Status Information archive</a>.';
return "\n\t\t<div id='diagnostic' class='" . $klass . "'>\n\t\t\t<div id='diagnostic-bar' class='h2bar'>Diagnostics: <span>" . $title . "</span></div>\n\t\t\t<div id='diagnostic-desc' class='g-inner'>\n\t\t\t" . $output . "\n\t\t\t</div>\n\t\t</div>";
}
示例12: render
function render($position)
{
/** @var $gantry Gantry */
global $gantry;
JHTML::_('behavior.framework', true);
if ($gantry->browser->platform != 'iphone' && $gantry->browser->platform != 'ipad' && $gantry->browser->platform != 'android') {
return false;
}
gantry_import('facets.menu.gantrymenu');
$params = $gantry->getParams($this->_feature_name, true);
$module_params = '';
foreach ($params as $param_name => $param_value) {
$module_params .= $param_name . "=" . $param_value['value'] . "\n";
}
$passing_params = new GantryRegistry();
$passing_params->loadString($module_params, 'INI');
$gantrymenu = new GantryMenu($passing_params);
return $gantrymenu->render($passing_params);
}
示例13: init
function init(&$gantry)
{
gantry_import("core.utilities.gantrysimplexmlelement");
$this->xml = new GantrySimpleXMLElement($gantry->templatePath . '/templateDetails.xml', null, true);
if ($this->xml === false) {
// TODO: figure out way to return error properly
echo "Unable to find templateDetails.xml file";
}
$this->positions =& $this->_getPositions();
$tmp_options = get_option($gantry->templateName . '-template-options');
if ($tmp_options !== false) {
foreach ($tmp_options as $option_name => $option_value) {
$this->_addTemplateSettings($option_name, $option_value);
}
}
$this->params = $this->_getParams($gantry);
$this->template_info = $this->_getTemplateInfo();
$this->widget_styles = $this->_getWidgetStyles();
}
示例14: get_version_update_info
function get_version_update_info()
{
$buffer = '';
gantry_import('core.gantryupdates');
$gantry_updates = GantryUpdates::getInstance();
$currentVersion = $gantry_updates->getCurrentVersion();
$latest_version = $gantry_updates->getLatestVersion();
if (version_compare($latest_version, $currentVersion, '>')) {
$klass = "update";
$upd = JText::sprintf('COM_GANTRY_VERSION_UPDATE_OUTOFDATE', $latest_version, 'index.php?option=com_installer&view=update');
} else {
$klass = "noupdate";
jimport('joomla.utilities.date');
$nextupdate = new JDate($gantry_updates->getLastUpdated() + 24 * 60 * 60);
$upd = JText::sprintf('COM_GANTRY_VERSION_UPDATE_CURRENT', JHTML::_('date', $gantry_updates->getLastUpdated() + 24 * 60 * 60, JText::_('DATE_FORMAT_LC2'), true));
}
$buffer .= "\n <div id='updater' class='" . $klass . "'>\n <div id='updater-bar' class='h2bar'>Gantry <span>v" . $currentVersion . "</span></div>\n <div id='updater-desc'>" . $upd . "</div>\n </div>";
return $buffer;
}
示例15: form
function form($instance)
{
gantry_import('core.config.gantryform');
global $gantry;
$defaults = $this->_defaults;
$gantry->addScript('mootools.js');
$instance = wp_parse_args((array) $instance, $defaults);
foreach ($instance as $variable => $value) {
${$variable} = GantryWidget::_cleanOutputVariable($variable, $value);
$instance[$variable] = ${$variable};
}
$this->_values = $instance;
$form = GantryForm::getInstance($this, $this->short_name, $this->short_name);
$form->bind($this->_values);
ob_start();
$fieldSets = $form->getFieldsets();
foreach ($fieldSets as $name => $fieldSet) {
?>
<fieldset class="panelform">
<?php
foreach ($form->getFieldset($name) as $field) {
?>
<div class="field-wrapper">
<?php
echo $field->label;
?>
<?php
echo $field->input;
?>
</div>
<?php
}
?>
</fieldset>
<?php
}
echo ob_get_clean();
}