当前位置: 首页>>代码示例>>PHP>>正文


PHP JDom::getInstance方法代码示例

本文整理汇总了PHP中JDom::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JDom::getInstance方法的具体用法?PHP JDom::getInstance怎么用?PHP JDom::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDom的用法示例。


在下文中一共展示了JDom::getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 function build()
 {
     $dateFormat = $this->dateFormat;
     //JDate::toFormat() is deprecated. CONVERT Legacy Joomla Format
     //Minutes : ‰M > i
     $dateFormat = str_replace("%M", "i", $dateFormat);
     //remove the %
     $dateFormat = str_replace("%", "", $dateFormat);
     $formatedDate = $this->dataValue;
     if ($this->dataValue && $this->dataValue != "0000-00-00" && $this->dataValue != "00:00:00" && $this->dataValue != "0000-00-00 00:00:00") {
         jimport("joomla.utilities.date");
         $date = JFactory::getDate($this->dataValue);
         $formatedDate = $date->format($dateFormat);
         $config = JFactory::getConfig();
         // If a known filter is given use it.
         switch (strtoupper($this->filter)) {
             case 'SERVER_UTC':
                 // Convert a date to UTC based on the server timezone.
                 if (intval($this->dataValue)) {
                     // Get a date object based on the correct timezone.
                     $date = JFactory::getDate($this->dataValue, 'UTC');
                     $date->setTimezone(new DateTimeZone($config->get('offset')));
                     // Format the date string.
                     $formatedDate = $date->format($dateFormat, true);
                 }
                 break;
             case 'USER_UTC':
                 // Convert a date to UTC based on the user timezone.
                 if (intval($this->dataValue)) {
                     // Get a date object based on the correct timezone.
                     $date = JFactory::getDate($this->dataValue, 'UTC');
                     $user = JFactory::getUser();
                     $date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
                     // Format the date string.
                     $formatedDate = $date->format($dateFormat, true);
                 }
                 break;
         }
     } else {
         $formatedDate = "";
     }
     //Create the input
     $dom = JDom::getInstance('html.form.input.text', array_merge($this->options, array('dataValue' => $formatedDate, 'submitEventName' => null)));
     $dom->addClass('input-small');
     $htmlInput = $dom->output();
     //Create the icon
     $htmlIcon = JDom::_('html.icon', array('icon' => 'calendar'));
     //Create the button (suffix -btn is to trigger the calendar)
     $htmlButton = JDom::_('html.link.button', array('content' => $htmlIcon, 'domClass' => 'btn', 'domId' => $this->getInputId() . '-btn'));
     $html = '';
     $html .= '<div class="btn-group">';
     $html .= '<div class="input-append">' . LN;
     $html .= $htmlInput . LN;
     $html .= $htmlButton . LN;
     $html .= '</div>' . LN;
     $html .= '</div>';
     return $html;
 }
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:58,代码来源:calendar.php

示例2: buildIconsLib

 function buildIconsLib($library)
 {
     //Get the icons availability
     $icons = array();
     switch ($library) {
         case '':
             $icons = $this->getIcons();
             break;
         case 'icomoon':
             $jdom = JDom::getInstance('html.icon.icomoon');
             $icons = $jdom->getIcons();
             break;
         case 'glyphicon':
             $jdom = JDom::getInstance('html.icon.glyphicon');
             $icons = $jdom->getIcons();
             break;
     }
     if (empty($icons)) {
         return;
     }
     return $this->renderIcons($library, $icons);
 }
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:22,代码来源:icons.php

示例3: buildControl

 function buildControl()
 {
     $id = $this->getInputId();
     $html = '';
     //Create the input
     $dom = JDom::getInstance('html.form.input.text', array_merge($this->options, array()));
     $dom->addClass('input-mini');
     $htmlInput = $dom->output();
     //Create the color
     $htmlColor = JDom::_('html.fly.color', array_merge($this->options, array('width' => 12, 'height' => 12, 'selectors' => array('id' => $id . '-pick'))));
     //Create the icon
     $htmlIcon = JDom::_('html.icon', array('icon' => 'glyphicon-tint'));
     //Create the button (suffix -btn is to trigger the calendar)
     $htmlButton = JDom::_('html.link.button', array('content' => $htmlIcon, 'domClass' => 'btn', 'domId' => $id . '-btn'));
     $html = '';
     //Render the control
     if ($this->hidden) {
         $html .= $htmlInput . LN;
     }
     //Place the hidden input out of the control
     $html .= '<div class="btn-group">' . LN;
     $html .= '<div class="input-prepend input-append">' . LN;
     if (!$this->hidden) {
         //Prepend
         $html .= '<span class="add-on">#</span>';
         //Input mini
         $html .= $htmlInput . LN;
     }
     //Append
     $html .= '<span class="add-on">' . $htmlColor . '</span>' . LN;
     $html .= $htmlButton . LN;
     //Close the control
     $html .= '</div>' . LN;
     $html .= '</div>' . LN;
     return $html;
 }
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:36,代码来源:colorpicker.php

示例4: pathToUrl

 protected function pathToUrl($path, $raw = false)
 {
     $base = JDom::getInstance()->getPathSite();
     $uri = JDom::getInstance()->getUriJDomBase();
     $path = str_replace("\\", "/", $path);
     $base = str_replace("\\", "/", $base);
     $escaped = preg_replace("/\\//", "\\/", $base);
     $relUrl = $uri . preg_replace("/^" . $escaped . "/", "", $path);
     if ($raw) {
         return $relUrl;
     }
     return JURI::root(true) . $relUrl;
 }
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:13,代码来源:dom.php

示例5: dirname

JLoader::register('RtiprintModelThirdusergroups', JPATH_COMPONENT . DS . 'models' . DS . 'thirdusergroups.php');
JLoader::register('RtiprintModelThirdusergroup', JPATH_COMPONENT . DS . 'models' . DS . 'thirdusergroup.php');
JLoader::register('RtiprintModelThirdcategories', JPATH_COMPONENT . DS . 'models' . DS . 'thirdcategories.php');
JLoader::register('RtiprintModelThirdcategory', JPATH_COMPONENT . DS . 'models' . DS . 'thirdcategory.php');
JLoader::register('RtiprintModelThirdcontents', JPATH_COMPONENT . DS . 'models' . DS . 'thirdcontents.php');
JLoader::register('RtiprintModelThirdcontent', JPATH_COMPONENT . DS . 'models' . DS . 'thirdcontent.php');
// Handle cross compatibilities
require_once dirname(__FILE__) . DS . 'mvc.php';
// Load the component Dependencies
require_once dirname(__FILE__) . DS . 'helper.php';
// Always use the Javascript framework for UI
JHTML::_("behavior.framework");
// Configure paths
$lang = JFactory::getLanguage();
if ($app->isSite()) {
    $lang->load('com_rtiprint', JPATH_SITE);
    CkJController::addModelPath(JPATH_SITE_RTIPRINT . DS . 'models');
} else {
    $lang->load('com_rtiprint', JPATH_ADMINISTRATOR);
    CkJController::addModelPath(JPATH_ADMIN_RTIPRINT . DS . 'models');
}
// Set the table directory
JTable::addIncludePath(JPATH_ADMIN_RTIPRINT . DS . 'tables');
//Instance JDom
if (!isset($app->dom)) {
    jimport('jdom.dom');
    if (!class_exists('JDom')) {
        JError::raiseError(null, 'JDom plugin is required');
    }
    JDom::getInstance();
}
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:31,代码来源:loader.php

示例6: buildControlBootstrap

 function buildControlBootstrap()
 {
     $html = '';
     $id = $this->getInputId();
     //$idView = $this->getInputId('view');
     $idView = $id . '-view';
     //Optimized
     //Create hidden input (file)
     $htmlInputHidden = '<input type="file" id="<%DOM_ID%>" name="<%INPUT_NAME%>" ' . ' style="display:none;"' . ' value="<%VALUE%>"' . '/>' . LN;
     //Create a visible text field (stylable)
     $onFocus = 'jQuery(this).closest(\'div\').find(\'input[id=\\"' . $id . '\\"]\').trigger(\'click\');';
     $dom = JDom::getInstance('html.form.input.text', array('dataValue' => $this->dataValue, 'domId' => $idView, 'selectors' => array('onFocus' => $onFocus, 'readonly' => '')));
     $dom->addClass('input-large');
     //for cross compatibility (remove margin and float)
     $dom->addClass('inputfix');
     if ($this->hidden) {
         $dom->addStyle('display', 'none');
     }
     $htmlInputView = $dom->output();
     // Create the upload button
     $htmlIconBrowse = JDom::_('html.icon', array('icon' => 'icomoon-folder-open'));
     //Create the button to trigger the input
     $htmlButtonBrowse = JDom::_('html.link.button', array('content' => $htmlIconBrowse, 'domClass' => 'btn buttonfix', 'link_js' => 'jQuery(\'input[id=' . $id . ']\').trigger("click");'));
     // Original file input is hidden
     $html .= $htmlInputHidden;
     //Visible input
     $html .= $htmlInputView;
     //Browse button
     $html .= $htmlButtonBrowse;
     return $html;
 }
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:31,代码来源:default.php

示例7: getInput

 /**
  * Method to get the field input markup.
  *
  * @access	protected
  *
  * @return	string	The field input markup.
  *
  * @since	11.1
  */
 protected function getInput()
 {
     //When Bootstrap is used in native, modal picker is instancied with JDom
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         $dom = JDom::getInstance();
         $dom->set('extension', 'com_rtiprint');
         $html = JDom::_('html.form.input.select.modalpicker', array('dataKey' => $this->id, 'domName' => $this->name, 'dataValue' => $this->value, 'nullLabel' => $this->_nullLabel, 'title' => $this->_title, 'width' => $this->width, 'height' => $this->height, 'route' => array('option' => $this->_option, 'view' => $this->_view, 'layout' => 'modal', 'object' => $this->id), 'tasks' => $this->getTasks()));
         return $html;
     }
     // Legacy not using JDom
     JHtml::_('behavior.modal', 'a.modal');
     //Instance vars
     $labelKey = $this->_labelKey;
     $table = $this->_table;
     $label = JText::_($this->_nullLabel);
     // Build the script.
     $script = array();
     $script[] = '	function jSelectItem(id, title, object) {';
     $script[] = '		document.id(object + "_id").value = id;';
     $script[] = '		document.id(object + "_name").value = title;';
     $script[] = '		SqueezeBox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     $link = 'index.php?option=' . $this->_option . '&amp;view=' . $this->_view . '&amp;layout=modal&amp;tmpl=component&amp;object=' . $this->id;
     $title = $this->_title;
     if (empty($title)) {
         $title = $label;
     }
     $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
     // The current item display field.
     $html = array();
     $html[] = '<div class="fltlft">';
     $html[] = '  <input type="text" id="' . $this->id . '_name" value="' . $title . '" disabled="disabled" size="25" />';
     $html[] = '</div>';
     // The item select button.
     $html[] = '<div class="button2-left">';
     $html[] = '  <div class="blank">';
     $html[] = '	<a class="modal" title="' . $label . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: ' . $this->width . ', y: ' . $this->height . '}}">' . JText::_('JSELECT') . '</a>';
     $html[] = '  </div>';
     $html[] = '</div>';
     $scriptReset = "document.id('" . $this->id . "_id').value = '';";
     $scriptReset .= "document.id('" . $this->id . "_name').value = '" . htmlspecialchars($label, ENT_QUOTES, 'UTF-8') . "';";
     // The clear button.
     $html[] = '<div class="button2-left">';
     $html[] = '  <div class="blank">';
     $html[] = '	<a class="" title="' . htmlspecialchars(JText::_('JCLEAR'), ENT_QUOTES, 'UTF-8') . '"  onclick="' . htmlspecialchars($scriptReset, ENT_QUOTES, 'UTF-8') . '">' . JText::_('JCLEAR') . '</a>';
     $html[] = '  </div>';
     $html[] = '</div>';
     $tasks = $this->getTasks();
     if ($tasks && count($tasks)) {
         foreach ($tasks as $taskName => $task) {
             $label = isset($task['label']) ? JText::_($task['label']) : '';
             $desc = isset($task['description']) ? JText::_($task['description']) : $label;
             $jsCommand = isset($task['jsCommand']) ? $task['jsCommand'] : null;
             $icon = isset($task['icon']) ? $task['icon'] : $taskName;
             $html[] = '<div class="button2-left">';
             $html[] = '  <div class="blank">';
             $html[] = '	<a class="" title="' . $label . '" ' . ($jsCommand ? ' onclick="' . htmlspecialchars($jsCommand, ENT_QUOTES, 'UTF-8') . '"' : '') . '>' . JText::_($label) . '</a>';
             $html[] = '  </div>';
             $html[] = '</div>';
         }
     }
     // The active item id field.
     if (0 == (int) $this->value) {
         $value = '';
     } else {
         $value = (int) $this->value;
     }
     // class='required' for client side validation
     $class = '';
     if ($this->required) {
         $class = ' class="required modal-value"';
     }
     $html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
     return implode("\n", $html);
 }
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:87,代码来源:modal.php


注:本文中的JDom::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。