Exemplo n.º 1
0
 public function getInput()
 {
     if (!class_exists('Yjsg')) {
         return;
     }
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $yjsg = Yjsg::getInstance();
     // make sure is YJ template
     if ($yjsg->yjtmpl()) {
         $e_folder = basename(dirname(dirname(__FILE__)));
         $document = JFactory::getDocument();
         $document->addStyleSheet(JURI::root() . 'plugins/system/' . $e_folder . '/elements/css/yjsgplg.css');
         if (intval(JVERSION) < 3) {
             $document->addScript(JURI::root() . 'plugins/system/' . $e_folder . '/assets/src/libraries/jquery.min.js');
             $document->addScript(JURI::root() . 'plugins/system/' . $e_folder . '/assets/src/libraries/jquery-noconflict.js');
         }
         $document->addScript(JURI::root() . 'plugins/system/' . $e_folder . '/elements/src/yjsgplg.js');
         $document->addScriptDeclaration("\n\t\t\t\n\t\t\t\n\t\t\t\t\tvar yjsgPlgpath = '" . JURI::root() . "';\n\t\t\t\t\tvar updatingTemplate ='" . JText::_('YJSG_UPDATING_TXT') . "';\n\t\t\t\t\tvar restoringTemplate ='" . JText::_('YJSG_RESTORING_TXT') . "';\n\t\t\t");
     }
     $html = '<div class="update_template">';
     $html .= '<div class="update_msg"><i class="fa fa-refresh fa-spin"></i> ' . JText::_('YJSG_COMP_CHECK') . '</div>';
     $html .= '<a id="update" class="updatebuttons" href="#">' . JText::_('YJSG_UPDATE') . '</a>';
     $html .= '<a id="restore" class="updatebuttons" href="#">' . JText::_('YJSG_RESTORE') . '</a>';
     $html .= '<a id="cleanup" class="updatebuttons" href="#">' . JText::_('YJSG_CLEANUP') . '</a>';
     $html .= '</div>';
     if ($yjsg->yjtmpl()) {
         return $html;
     } else {
         return;
     }
 }
Exemplo n.º 2
0
 public function getInput()
 {
     $yjsg = Yjsg::getInstance();
     $app = JFactory::getApplication();
     $templateId = $app->input->get('id');
     $YjsgDbParams = json_decode($yjsg->getDbParams($templateId), true);
     $sidebars = false;
     $searchName1 = array('leftcolumn', 'rightcolumn', 'insetcolumn');
     if (in_array($this->element['name'], $searchName1)) {
         $sidebars = true;
     }
     $customchrome = $this->element['customchrome'];
     $gridgroup = $this->element['gridgroup'];
     $clabel = $this->element['clabel'];
     $cclass = $this->element['cclass'];
     $chromename = str_replace(array('jform[params]', '[', ']'), '', $this->name) . '_custom_chrome';
     $html = '';
     if ($this->element['customchrome']) {
         if (array_key_exists($chromename, $YjsgDbParams)) {
             $chromeDefault = $YjsgDbParams[$chromename];
         } else {
             $chromeDefault = $customchrome;
         }
         $html .= '<a href="#" class="openChrome" data-chromedefault="' . $customchrome . '" data-chromemodule="#' . $chromename . '">';
         $html .= '<i class="adminicons-chrome"></i>';
         $html .= '</a>';
         $html .= '<div class="chromesHolder"  data-toggle="popover" data-placement="bottom" data-original-title="' . JText::_('YJSG_MOD_CHROME') . '" data-content="' . JText::_('YJSG_MOD_CHROME_TIP') . '">';
         $html .= '<a href="#" data-thischrome="YJsgxhtml" class="seldefault">' . JText::_('YJSG_DEFAULT') . ' <i class="fa fa-check-square-o"></i></a>';
         $html .= '<a href="#" data-thischrome="YJsground">' . JText::_('YJSG_MOD_CHROME_ROUND_NAV') . ' <i class="fa fa-square-o"></i></a>';
         $html .= '<a href="#" data-thischrome="YJsgblank">' . JText::_('YJSG_MOD_CHROME_BLANK_NAV') . ' <i class="fa fa-square-o"></i></a>';
         if (!$sidebars) {
             $html .= '<a href="#" data-thischrome="YJsgtabs">' . JText::_('YJSG_MOD_CHROME_TABS') . ' <i class="fa fa-square-o"></i></a>';
             $html .= '<a href="#" data-thischrome="YJsgaccordion">' . JText::_('YJSG_MOD_CHROME_ACCORDION') . ' <i class="fa fa-square-o"></i></a>';
             $html .= '<a href="#" data-thischrome="YJsgslides">' . JText::_('YJSG_MOD_CHROME_SLIDES') . ' <i class="fa fa-square-o"></i></a>';
         }
         $html .= '<input type="hidden" class="defChromes" name="jform[params][' . $chromename . ']" id="' . $chromename . '"';
         $html .= ' data-default="' . $customchrome . '" value="' . $chromeDefault . '">';
         $html .= '</div>';
     }
     if ($clabel != 'insettop' && $clabel != 'insetbottom') {
         $html .= '<div class="yjsg_module">';
         $html .= '<label>' . $clabel . '</label>';
         $html .= '<input type="text" name="' . $this->name . '" id="' . $this->id . '"';
         $html .= ' value="' . $this->value . '" class="input-mini yjsg_' . $gridgroup . '_width" size="4">';
         $html .= '<div class="yjsgcheck">';
         $html .= '<label>';
         $html .= '<input type="checkbox" name="jform[params][yjsg_' . $gridgroup . '_width_locked][]" class="YJSG_checkbox yjsg_' . $gridgroup . '_width hidden">';
         $html .= '<i class="fa fa-unlock"></i>';
         $html .= '</label>';
         $html .= '</div>';
         $html .= '</div>';
     } else {
         $html .= '<div class="yjsg_module orange">';
         $html .= '<label>' . $clabel . '</label>';
         $html .= '</div>';
     }
     return $html;
 }
Exemplo n.º 3
0
 public function getInput()
 {
     if (!defined('YJSGRUN')) {
         echo '<h1 style="color:red;">' . JText::_('YJSG_PLUGIN_NOT_FOUND') . '</h1>';
         return;
     }
     $document = YjsgDochead::getDocument();
     $document->addJsInhead("var comp_dis ='" . JText::_('YJSG_COMPONENT_DISABLED') . "';");
     $yjsg = Yjsg::getInstance();
     $YjsgCurrentVersion = $yjsg->version;
     $YjsgHasUpdate = $yjsg->hasupdate;
     $YjsgLatestVersion = $yjsg->getUpdateVersion();
     $template_folder = basename(dirname(dirname(__FILE__)));
     $params_obj = $this->form->getValue('params');
     $params = new JRegistry();
     $params->loadObject($params_obj);
     $comp_dis = '<div id="option-resut">';
     if ($params->get('component_switch')) {
         $comp_dis .= JText::_('YJSG_COMPONENT_DISABLED');
     }
     $comp_dis .= '</div>';
     $yjsgManageLink = 'index.php?option=com_plugins&view=plugins&filter_folder=system&filter_search=Yjsg';
     $yjsgText = '' . JText::_('YJSG_INS_PUB') . " <strong>v" . $YjsgCurrentVersion . "</strong> " . JText::_('YJSG_INS_PUB2') . ' <a href="' . $yjsgManageLink . '">' . JText::_('YJSC_MAN_EXT') . '</a>';
     if ($YjsgHasUpdate == 1) {
         $updateclass = ' updateavailable';
     } else {
         $updateclass = '';
     }
     // yjsg
     $syshtml = '<div class="yj_system_check">';
     $syshtml .= '<div id="yjsgBox" class="systemBox' . $updateclass . '">';
     $syshtml .= '<h2 id="yjmmpTitle" class="systemBoxTitle yjsgtips" data-original-title="' . JText::_('YJSG_CHECK') . '" data-content="' . JText::_('YJSG_CHECK_TIP') . '">' . JText::_('YJSG_CHECK') . '</h2>';
     if ($YjsgHasUpdate == 1) {
         $syshtml .= '<div class="infoText"><span class="showIcon"></span> ';
         $syshtml .= JText::_('UPDATE_AVAILABLE_TEXT') . '<strong>' . $YjsgCurrentVersion . '</strong>';
         $syshtml .= JText::_('UPDATE_AVAILABLE_TEXT2') . '<strong>' . $YjsgLatestVersion . '</strong>';
         $syshtml .= '<a href="index.php?option=com_installer&amp;view=update">' . JText::_('UPDATE_AVAILABLE_TEXT3') . '</a>';
         $syshtml .= '</div>';
     } else {
         $syshtml .= '<div class="infoText"><span class="showIcon"></span>' . $yjsgText . '</div>';
     }
     $syshtml .= '</div>';
     $syshtml .= '<div  id="settmsgBox" class="systemBox hide">';
     $syshtml .= '<h2 id="yjjbpTitle" class="systemBoxTitle yjsgtips" data-original-title="' . JText::_('YJSG_SETT_MSG') . '" data-content="' . JText::_('YJSG_SETT_MSG_TIP') . '">' . JText::_('YJSG_SETT_MSG') . '</h2>';
     $syshtml .= '<div class="infoText"><span class="showIcon"></span>' . $comp_dis . '</div>';
     $syshtml .= '</div>';
     $syshtml .= '</div>';
     // close yj_system_check
     // Output
     echo $syshtml;
 }
Exemplo n.º 4
0
 /**
  * method to run after an install/update/uninstall method
  *
  * @return void
  */
 public function postflight($type, $parent)
 {
     $db = JFactory::getDbo();
     try {
         $q = $db->getQuery(true);
         $q->update('#__extensions');
         $q->set(array('enabled = 1', 'ordering = -5000'));
         $q->where("element = 'yjsg'");
         $q->where("type = 'plugin'", 'AND');
         $q->where("folder = 'system'", 'AND');
         $db->setQuery($q);
         method_exists($db, 'execute') ? $db->execute() : $db->query();
     } catch (Exception $e) {
         throw $e;
     }
     JLoader::register('Yjsg', JPATH_ROOT . '/plugins/system/yjsg/includes/yjsgcore/classes/yjsg.class.php', true);
     $this->yjsg = Yjsg::getInstance();
     $language = JFactory::getLanguage();
     $language->load('plg_system_yjsg', JPATH_ADMINISTRATOR);
     $yjsgTemplateName = Yjsg::getDefaultTemplate();
     $yjsgTemplateNameTxt = ucfirst(Yjsg::getDefaultTemplate());
     $defaultTemplate = JPATH_ROOT . '/templates/' . $yjsgTemplateName;
     $beforeCleanup = JPATH_ROOT . '/templates/' . $yjsgTemplateName . '-beforeCleanup';
     $extendFolder = JPATH_ROOT . '/plugins/system/yjsg/includes/yjsgcore/classes/extend/classes/';
     $indexContent = '';
     if (!JFolder::exists($beforeCleanup) && $this->yjsg->yjtmpl() && $this->yjsg->tmplVersion($yjsgTemplateName) == '1.0.16') {
         if (JFolder::copy($defaultTemplate, $beforeCleanup)) {
             $backedUpMsg = $yjsgTemplateNameTxt . JText::_('YJSG_INSTALLER_TMPL_BACKUP');
             JFactory::getApplication()->enqueueMessage($backedUpMsg);
         } else {
             $nobackupMsg = JText::_('YJSG_INSTALLER_TMPL_NO_BACKUP1') . $yjsgTemplateNameTxt . JText::_('YJSG_INSTALLER_TMPL_NO_BACKUP2');
             JError::raiseWarning(100, $nobackupMsg);
         }
     }
     if (JFolder::exists($extendFolder)) {
         JFolder::delete($extendFolder);
         JFolder::create($extendFolder);
         JFile::write($extendFolder . 'index.html', $indexContent);
     }
 }
Exemplo n.º 5
0
/*======================================================================*\
|| #################################################################### ||
|| # Package - Joomla Template based on YJSimpleGrid Framework          ||
|| # Copyright (C) 2010  Youjoomla.com. All Rights Reserved.            ||
|| # license - PHP files are licensed under  GNU/GPL V2                 ||
|| # license - CSS  - JS - IMAGE files  are Copyrighted material        ||
|| # bound by Proprietary License of Youjoomla.com                      ||
|| # for more information visit http://www.youjoomla.com/license.html   ||
|| # Redistribution and  modification of this software                  ||
|| # is bounded by its licenses                                         ||
|| # websites - http://www.youjoomla.com | http://www.yjsimplegrid.com  ||
|| #################################################################### ||
\*======================================================================*/
// No direct access.
defined('_JEXEC') or die;
$yjsg = Yjsg::getInstance();
$getapps = JFactory::getApplication();
$template = $getapps->getTemplate();
$menu_path = YJSGPATH . "legacy" . YJDS . "html" . YJDS . "mod_menu" . YJDS;
$menu_type = $params->get('yjsg_menu_module_type', 'default');
require $menu_path . "yjsg_menuswitch.php";
if (!empty($class_sfx)) {
    $class_sfx = ' ' . $class_sfx;
}
switch ($menu_type) {
    case "default":
        $menuclass = '';
        $type_selected = 'default';
        break;
    case "inline":
        $menuclass = ' inline';
Exemplo n.º 6
0
<?php

/**
 * @version		$Id: edit.php 21321 2011-05-11 01:05:59Z dextercowley $
 * @package		Joomla.Site
 * @subpackage	com_weblinks
 * @copyright	Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// no direct access
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
Yjsg::yjsgtooltip();
JHtml::_('behavior.formvalidation');
$this->form->reset(true);
// to reset the form xml loaded by the view
$this->form->loadFile(dirname(__FILE__) . YJDS . "edit.xml");
// to load in our own version of login.xml
// Create shortcut to parameters.
$params = $this->state->get('params');
?>

<script type="text/javascript">
	Joomla.submitbutton = function(task) {
		if (task == 'weblink.cancel' || document.formvalidator.isValid(document.id('adminForm'))) {
			<?php 
echo $this->form->getField('description')->save();
?>
			Joomla.submitform(task);
		}
		else {
Exemplo n.º 7
0
 /**
  * Method to get the field input markup for a media selector.
  * Use attributes to identify specific created_by and asset_id fields
  *
  * @return  string  The field input markup.
  *
  * @since   1.6
  */
 protected function getInput()
 {
     $asset = $this->asset;
     if ($asset == '') {
         $asset = JFactory::getApplication()->input->get('option');
     }
     if (!self::$initialised) {
         // Load the modal behavior script.
         JHtml::_('behavior.modal');
         // Include jQuery
         //JHtml::_('jquery.framework');
         // Build the script.
         $script = array();
         $script[] = '	function jInsertFieldValue(value, id) {';
         $script[] = '		var $ = jQuery.noConflict();';
         $script[] = '		var old_value = $("#" + id).val();';
         $script[] = '		if (old_value != value) {';
         $script[] = '			var $elem = $("#" + id);';
         $script[] = '			$elem.val(value);';
         $script[] = '			$elem.trigger("change");';
         $script[] = '			if (typeof($elem.get(0).onchange) === "function") {';
         $script[] = '				$elem.get(0).onchange();';
         $script[] = '			}';
         $script[] = '			jMediaRefreshPreview(id);';
         $script[] = '		}';
         $script[] = '	}';
         $script[] = '	function jMediaRefreshPreview(id) {';
         $script[] = '		var $ = jQuery.noConflict();';
         $script[] = '		var value = $("#" + id).val();';
         $script[] = '		var $img = $("#" + id + "_preview");';
         $script[] = '		if ($img.length) {';
         $script[] = '			if (value) {';
         $script[] = '				$img.attr("src", "' . JUri::root() . '" + value);';
         $script[] = '				$("#" + id + "_preview_empty").hide();';
         $script[] = '				$("#" + id + "_preview_img").show()';
         $script[] = '			} else { ';
         $script[] = '				$img.attr("src", "")';
         $script[] = '				$("#" + id + "_preview_empty").show();';
         $script[] = '				$("#" + id + "_preview_img").hide();';
         $script[] = '			} ';
         $script[] = '		} ';
         $script[] = '	}';
         $script[] = '	function jMediaRefreshPreviewTip(tip)';
         $script[] = '	{';
         $script[] = '		var $ = jQuery.noConflict();';
         $script[] = '		var $tip = $(tip);';
         $script[] = '		var $img = $tip.find("img.media-preview");';
         $script[] = '		$tip.find("div.tip").css("max-width", "none");';
         $script[] = '		var id = $img.attr("id");';
         $script[] = '		id = id.substring(0, id.length - "_preview".length);';
         $script[] = '		jMediaRefreshPreview(id);';
         $script[] = '		$tip.show();';
         $script[] = '	}';
         // Add the script to the document head.
         JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
         self::$initialised = true;
     }
     $html = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= !empty($this->class) ? ' class="yjsg-form-element ' . $this->class . '"' : ' class="yjsg-form-element"';
     $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
     // Initialize JavaScript field attributes.
     $attr .= !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
     // The text field.
     $html[] = '<div class="yjsg-form-group-addon">';
     // The Preview.
     $showPreview = true;
     $showAsTooltip = false;
     switch ($this->preview) {
         case 'no':
             // Deprecated parameter value
         // Deprecated parameter value
         case 'false':
         case 'none':
             $showPreview = false;
             break;
         case 'yes':
             // Deprecated parameter value
         // Deprecated parameter value
         case 'true':
         case 'show':
             break;
         case 'tooltip':
         default:
             $showAsTooltip = true;
             $options = array('onShow' => 'jMediaRefreshPreviewTip');
             JHtml::_('behavior.tooltip', '.hasTipPreview', $options);
             break;
     }
     if ($showPreview) {
         if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) {
             $src = JUri::root() . $this->value;
         } else {
             $src = '';
         }
         $width = $this->previewWidth;
         $height = $this->previewHeight;
         $style = '';
         $style .= $width > 0 ? 'max-width:' . $width . 'px;' : '';
         $style .= $height > 0 ? 'max-height:' . $height . 'px;' : '';
         $imgattr = array('id' => $this->id . '_preview', 'class' => 'media-preview', 'style' => $style);
         $img = JHtml::image($src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgattr);
         $previewImg = '<div id="' . $this->id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>';
         $previewImgEmpty = '<div id="' . $this->id . '_preview_empty"' . ($src ? ' style="display:none"' : '') . '>' . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>';
         if ($showAsTooltip) {
             $html[] = '<div class="media-preview yjsg-form-prepend">';
             $tooltip = $previewImgEmpty . $previewImg;
             $options = array('title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'), 'text' => '<i class="fa fa-eye"></i>', 'class' => 'hasTipPreview');
             $html[] = JHtml::tooltip($tooltip, $options);
             $html[] = '</div>';
         } else {
             $html[] = '<div class="media-preview">';
             $html[] = ' ' . $previewImgEmpty;
             $html[] = ' ' . $previewImg;
             $html[] = '</div>';
         }
     }
     $html[] = '	<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly"' . $attr . ' />';
     if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) {
         $folder = explode('/', $this->value);
         $folder = array_diff_assoc($folder, explode('/', JComponentHelper::getParams('com_media')->get('image_path', 'images')));
         array_pop($folder);
         $folder = implode('/', $folder);
     } elseif (file_exists(JPATH_ROOT . '/' . JComponentHelper::getParams('com_media')->get('image_path', 'images') . '/' . $this->directory)) {
         $folder = $this->directory;
     } else {
         $folder = '';
     }
     // The buttons.
     if ($this->disabled != true) {
         Yjsg::yjsgtooltip();
         $html[] = '<a class="modal yjsg-button yjsg-form-append" title="' . JText::_('JLIB_FORM_BUTTON_SELECT') . '" href="' . ($this->readonly ? '' : ($this->link ? $this->link : 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;asset=' . $asset . '&amp;author=' . $this->form->getValue($this->authorField)) . '&amp;fieldid=' . $this->id . '&amp;folder=' . $folder) . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">';
         $html[] = JText::_('JLIB_FORM_BUTTON_SELECT') . '</a>';
         $html[] = '<a class="yjsg-button hasTooltip yjsg-form-append" title="' . JText::_('JLIB_FORM_BUTTON_CLEAR') . '" href="#" onclick="';
         $html[] = 'jInsertFieldValue(\'\', \'' . $this->id . '\');';
         $html[] = 'return false;';
         $html[] = '">';
         $html[] = '<i class="fa fa-close"></i></a>';
         $html[] = '</div>';
     }
     return implode("\n", $html);
 }
Exemplo n.º 8
0
 function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     if ($this->yjsg->yjtmpl()) {
         //YJSG  mega menu
         if ($form->getName() == 'com_menus.item') {
             JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgmegamenu');
             $form->loadFile('yjsg_mega_menu_params', false);
         }
         // Yjsg module additional params
         if ($form->getName() == 'com_modules.module') {
             if ($data && $data->client_id != 0) {
                 return;
             }
             JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgmoduleoptions');
             $form->loadFile('yjsg_module_options', false);
             $this->addShortcodes();
             // Yjsg module additional params from template
             if (JFolder::exists(YJSGCUSTOMFOLDER . "yjsgmoduleoptions")) {
                 JForm::addFormPath(YJSGCUSTOMFOLDER . "yjsgmoduleoptions");
                 $form->loadFile('yjsg_module_options', false, false, true);
             }
         }
         // Module menu params
         if ($form->getName() == 'com_modules.module') {
             if ($data && $data->module != 'mod_menu') {
                 return;
             }
             $form->loadFile('yjsg_menu_module_options', false);
         }
         // Microdata article
         if ($form->getName() == 'com_content.article') {
             JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgmicrodata');
             $form->loadFile('yjsg_article_microdata', false);
             $this->addShortcodes();
         }
         // Microdata category
         if ($form->getName() == 'com_menus.item' && $data['type'] == 'component' && strstr($data['link'], 'com_content')) {
             if (!strstr($data['link'], 'view=category&layout=blog') && !strstr($data['link'], 'view=featured')) {
                 return;
             }
             JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgmicrodata');
             $form->loadFile('yjsg_category_microdata', false);
         }
         // Yjsg article
         if ($form->getName() == 'com_content.article') {
             JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgarticle');
             $form->loadFile('yjsg_article', false);
             // Yjsg article additional params from template
             if (JFolder::exists(YJSGCUSTOMFOLDER . "yjsgarticle")) {
                 JForm::addFormPath(YJSGCUSTOMFOLDER . "yjsgarticle");
                 $form->loadFile('yjsg_article', false, false, true);
             }
         }
     }
     // template form
     if ($this->run_plg == 1 && $this->templateView) {
         // Template defaults
         JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'xml');
         if ($this->yjsg->preplugin($this->edited_template)) {
             $form->loadFile('default-options-legacy', false, false, true);
         } else {
             $form->loadFile('default-options', false, false, true);
         }
         $file = JPATH_SITE . YJDS . "templates" . YJDS . $this->edited_template . YJDS . "template-settings.xml";
         $xml = JFactory::getXML($file, true);
         $form->load($xml, false, false, true);
         // load YjsgDochead class for template admin
         JLoader::register('YjsgDochead', YJSGPATH . 'includes/yjsgcore/classes/yjsg.dochead.class.php', true);
         $yjsgDoc = YjsgDochead::getDocument();
         if ($this->yjsg->hasUpdate() == 1) {
             $yjsgDoc->addJsInhead("var yjsgHasUpdate = 1;");
         } else {
             $yjsgDoc->addJsInhead("var yjsgHasUpdate = 0;");
         }
         //skip "reset to default" action for the following field types , they don't have default values
         $tpl_default = array();
         $skip_types = array('yjsgversion', 'yjsgtextblank', 'yjsgparamtitle', 'yjsgparamtitle2', 'yjhandler', 'yjsgtime', 'yjsgmultitext', 'yjsglogo', 'menuitem', 'yjsgcheck');
         $db_default = Yjsg::getDbParams($this->Int('id'));
         foreach ($form->getGroup('params') as $field) {
             if (!in_array(strtolower($field->type), $skip_types)) {
                 $tpl_default[$field->fieldname] = $field->value;
             }
         }
         $layout_file = YJSGTEMPLATEPATH . "css" . YJDS . "layout.css";
         $fontc = $this->edited_template . '_' . filesize($layout_file) . filemtime($layout_file);
         // from JHtml::_('behavior.keepalive');
         $config = JFactory::getConfig();
         $lifetime = $config->get('lifetime') * 60000;
         $refreshTime = $lifetime <= 60000 ? 30000 : $lifetime - 60000;
         // Refresh time is 1 minute less than the liftime assigned in the configuration.php file.
         // the longest refresh period is one hour to prevent integer overflow.
         if ($refreshTime > 3600000 || $refreshTime <= 0) {
             $refreshTime = 3600000;
         }
         // now we ready. add  yjsg admin head tags
         $yjsgDoc->addMeta('viewport', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no');
         $yjsgDoc->addCss(YJSGSITE_PLG_PATH . 'assets/bootstrap3/css/bootstrap.min.css');
         $yjsgDoc->addCss(YJSGSITE_PLG_PATH . 'admin/css/yjsg.css');
         $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'assets/src/libraries/jquery.min.js');
         $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'assets/bootstrap3/js/bootstrap.min.js');
         $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'assets/src/bootstrap-multiselect.js');
         $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'admin/src/yjsg.admin.plugins.js');
         $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'admin/src/yjsg.admin.js');
         $yjsgDoc->addJsInhead('var tplDefaults=' . json_encode($tpl_default) . ';var dbDefaults=' . $db_default . ';var fontc="' . $fontc . '";');
         $yjsgDoc->addJsInhead('var yjsglayout_array=' . YJSGLAYOUT . ';');
         $yjsgDoc->addJsInhead('var refreshTime=' . $refreshTime . ';');
     }
 }
Exemplo n.º 9
0
 /**
  * Load a template file -- first look in the templates folder for an override
  *
  * @param   string  $tpl  The name of the template source file; automatically searches the template paths and compiles as needed.
  *
  * @return  string  The output of the the template script.
  *
  * @since   12.2
  * @throws  Exception
  */
 public function loadTemplate($tpl = null)
 {
     // Clear prior output
     $this->_output = null;
     $template = JFactory::getApplication()->getTemplate();
     // Yjsg instance
     $yjsg = Yjsg::getInstance();
     $layout = $this->getLayout();
     $layoutTemplate = $this->getLayoutTemplate();
     // Create the template file name based on the layout
     $file = isset($tpl) ? $layout . '_' . $tpl : $layout;
     // Clean the file name
     $file = preg_replace('/[^A-Z0-9_\\.-]/i', '', $file);
     $tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\\.-]/i', '', $tpl) : $tpl;
     // Load the language file for the template
     $lang = JFactory::getLanguage();
     $lang->load('tpl_' . $template, JPATH_BASE, null, false, false) || $lang->load('tpl_' . $template, JPATH_THEMES . "/{$template}", null, false, false) || $lang->load('tpl_' . $template, JPATH_BASE, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template, JPATH_THEMES . "/{$template}", $lang->getDefault(), false, false);
     // Change the template folder if alternative layout is in different template
     if (isset($layoutTemplate) && $layoutTemplate != '_' && $layoutTemplate != $template) {
         $this->_path['template'] = str_replace($template, $layoutTemplate, $this->_path['template']);
     }
     //yjsg start
     $option = JFactory::getApplication()->input->getCmd('option');
     $folderName = $this->getName();
     if ($yjsg->preplugin() && JFactory::getApplication()->isSite()) {
         $yjsg_path = array(YJSGTEMPLATEPATH . 'html' . YJDS . $option . YJDS . $folderName, YJSGPATH . 'legacy' . YJDS . 'html' . YJDS . $option . YJDS . $folderName);
     } else {
         $yjsg_path = array(YJSGTEMPLATEPATH . 'html' . YJDS . $option . YJDS . $folderName, YJSGPATH . 'includes' . YJDS . 'html' . YJDS . $option . YJDS . $folderName);
     }
     foreach ($this->_path['template'] as $jpath) {
         if (!in_array($jpath, $yjsg_path)) {
             $yjsg_path[] = $jpath;
         }
     }
     $this->_path['template'] = $yjsg_path;
     //yjsg end
     // Load the template script
     jimport('joomla.filesystem.path');
     $filetofind = $this->_createFileName('template', array('name' => $file));
     $this->_template = JPath::find($this->_path['template'], $filetofind);
     // If alternate layout can't be found, fall back to default layout
     if ($this->_template == false) {
         $filetofind = $this->_createFileName('', array('name' => 'default' . (isset($tpl) ? '_' . $tpl : $tpl)));
         $this->_template = JPath::find($this->_path['template'], $filetofind);
     }
     if ($this->_template != false) {
         // Unset so as not to introduce into template scope
         unset($tpl);
         unset($file);
         // Never allow a 'this' property
         if (isset($this->this)) {
             unset($this->this);
         }
         // Start capturing output into a buffer
         ob_start();
         // Include the requested template filename in the local scope
         // (this will execute the view logic).
         include $this->_template;
         // Done with the requested template; get the buffer and
         // clear it.
         $this->_output = ob_get_contents();
         ob_end_clean();
         return $this->_output;
     } else {
         throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file), 500);
     }
 }
Exemplo n.º 10
0
 /**
  * Yjsg Instance
  *
  * @since 2.0.0
  */
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new Yjsg();
     }
     return self::$_instance;
 }
Exemplo n.º 11
0
Arquivo: edit.php Projeto: pionir/yjsg
Yjsg::yjsgtooltip();
if (version_compare(JVERSION, '3.0', 'ge')) {
    JHtml::_('behavior.modal', 'a.modal_jform_contenthistory');
}
$this->form->loadFile(dirname(__FILE__) . DIRECTORY_SEPARATOR . "article.xml");
// Create shortcut to parameters.
$params = $this->state->get('params');
//$images = json_decode($this->item->images);
//$urls = json_decode($this->item->urls);
// This checks if the editor config options have ever been saved. If they haven't they will fall back to the original settings.
$editoroptions = isset($params->show_publishing_options);
if (!$editoroptions) {
    $params->show_urls_images_frontend = '0';
}
// Yjsg article extra fields
$yjsg_article_options = Yjsg::tplParam('yjsg_article_options');
$user = JFactory::getUser();
$userGroups = $user->groups;
$showYjsgArticleOptions = false;
if (is_array($yjsg_article_options) && array_intersect($yjsg_article_options, $userGroups)) {
    $showYjsgArticleOptions = true;
}
if ($showYjsgArticleOptions) {
    $yjsgarticlefields = array();
    $yjsgarticle_category_fields = array();
    $attrib = $this->form->getFieldsets('attribs');
    foreach ($attrib as $yjsgextras) {
        if (isset($yjsgextras->yjsgextra) && $yjsgextras->yjsgextra == 'yjsgarticle') {
            $yjsgarticlefields[] = $yjsgextras;
        }
        if (isset($yjsgextras->yjsgcategory)) {
Exemplo n.º 12
0
 /**
  * Get the path to a layout for a module
  *
  * @param   string  $module  The name of the module
  * @param   string  $layout  The name of the module layout. If alternative layout, in the form template:filename.
  *
  * @return  string  The path to the module layout
  *
  * @since   11.1
  */
 public static function getLayoutPath($module, $layout = 'default')
 {
     $template = JFactory::getApplication()->getTemplate();
     $defaultLayout = $layout;
     // Yjsg instance
     $yjsg = Yjsg::getInstance();
     if (strpos($layout, ':') !== false) {
         // Get the template and file name from the string
         $temp = explode(':', $layout);
         $template = $temp[0] == '_' ? $template : $temp[0];
         $layout = $temp[1];
         $defaultLayout = $temp[1] ? $temp[1] : 'default';
     }
     // Build the template and base path for the layout
     $tPath = JPATH_THEMES . '/' . $template . '/html/' . $module . '/' . $layout . '.php';
     //yjsg start
     if (JFactory::getApplication()->isSite()) {
         if ($yjsg->preplugin()) {
             $yjsgPath = YJSGPATH . 'legacy' . YJDS . 'html' . YJDS . $module . YJDS . $layout . '.php';
         } else {
             $yjsgPath = YJSGPATH . 'includes' . YJDS . 'html' . YJDS . $module . YJDS . $layout . '.php';
         }
     }
     //yjsg end
     $bPath = JPATH_BASE . '/modules/' . $module . '/tmpl/' . $defaultLayout . '.php';
     $dPath = JPATH_BASE . '/modules/' . $module . '/tmpl/default.php';
     // If the template has a layout override use it
     if (file_exists($tPath)) {
         return $tPath;
     } elseif (isset($yjsgPath) && file_exists($yjsgPath)) {
         return $yjsgPath;
     } elseif (file_exists($bPath)) {
         return $bPath;
     } else {
         return $dPath;
     }
 }
Exemplo n.º 13
0
 /**
  * Return the pagination footer.
  *
  * @return  string   Pagination footer.
  *
  * @since   11.1
  */
 public function getListFooter()
 {
     $app = JFactory::getApplication();
     // Yjsg instance
     $yjsg = Yjsg::getInstance();
     $list = array();
     $list['prefix'] = $this->prefix;
     $list['limit'] = $this->limit;
     $list['limitstart'] = $this->limitstart;
     $list['total'] = $this->total;
     $list['limitfield'] = $this->getLimitBox();
     $list['pagescounter'] = $this->getPagesCounter();
     $list['pageslinks'] = $this->getPagesLinks();
     $chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/pagination.php';
     //yjsg start
     if (!file_exists($chromePath)) {
         if ($yjsg->preplugin()) {
             $chromePath = YJSGPATH . 'legacy' . YJDS . 'html' . YJDS . 'pagination.php';
         } else {
             $chromePath = YJSGPATH . 'includes' . YJDS . 'html' . YJDS . 'pagination.php';
         }
     }
     //yjsg end
     if (file_exists($chromePath)) {
         include_once $chromePath;
         if (function_exists('pagination_list_footer')) {
             return pagination_list_footer($list);
         }
     }
     return $this->_list_footer($list);
 }
Exemplo n.º 14
0
 public function getInput()
 {
     // process element properties
     $items = $this->element['items'];
     $default = explode('|', $this->element['default']);
     $values = is_array($this->value) ? $this->value : explode('|', $this->value);
     $size = $this->element['size'];
     $css_class = $this->element['class'];
     $labels = explode('|', $this->element['labels']);
     if ($this->element['customchrome']) {
         $cChrome = is_array($this->element['customchrome']) ? $this->element['customchrome'] : explode('|', $this->element['customchrome']);
     }
     $unique_id = $this->element['name'];
     $turnof = $this->element['turnof'];
     $turnoflabel = $this->element['turnoflabel'];
     if ($turnof == 1) {
         $disableme = 'disabled="disabled';
         $disabletext = '<div class="disabled_text">' . $turnoflabel . '</div>';
     } else {
         $disableme = '';
         $disabletext = '';
     }
     $chk_name = str_replace($this->element['name'], $this->element['name'] . '_locked', $this->name) . '[]';
     // create input text elements
     $div = array();
     $new_div = array();
     $yjsg = Yjsg::getInstance();
     $app = JFactory::getApplication();
     $templateId = $app->input->get('id');
     $YjsgDbParams = json_decode($yjsg->getDbParams($templateId), true);
     for ($i = 0; $i < $items; $i++) {
         $div[$i] = array();
         $div[$i][] = '<label for="' . $labels[$i] . '">' . $labels[$i] . '</label>';
         $div[$i][] = '<input type="text" id="' . $labels[$i] . '" class="input-mini ' . $unique_id . '" name="' . $this->name . '[]" value="' . (isset($values[$i]) ? $values[$i] : $default[$i]) . '" size="' . $size . '" ' . $disableme . '/>';
         if (array_key_exists($i + $items, $values)) {
             $checked = $values[$i + $items] == 1 ? 'checked="checked"' : '';
         } else {
             $checked = '';
         }
         $chormeName = strtolower($labels[$i]) . '_custom_chrome';
         if ($this->element['customchrome']) {
             if (array_key_exists($chormeName, $YjsgDbParams)) {
                 $chromeDefault = $YjsgDbParams[$chormeName];
             } else {
                 $chromeDefault = $cChrome[$i];
             }
         }
         if ($this->element['customchrome']) {
             $chromeInput[] = '<input type="hidden" class="defChromes" name="jform[params][' . $chormeName . ']" id="' . strtolower($labels[$i]) . '_custom_chrome" data-default="' . $cChrome[$i] . '" value="' . $chromeDefault . '" />';
             $chromeModule[] = $chormeName;
             $chromeDataDef[] = $cChrome[$i];
         }
         $div[$i][] = '<div class="yjsgcheck check ' . $unique_id . '">';
         $div[$i][] = '<label>';
         $div[$i][] = '<input type="checkbox" name="' . $chk_name . '" class="YJSG_checkbox ' . $unique_id . ' hidden" ' . $checked . ' />';
         $div[$i][] = '<i class="fa fa-unlock"></i>';
         $div[$i][] = '</label>';
         $div[$i][] = '</div>';
     }
     foreach ($div as $div_row => $div_value) {
         $new_div[] = '<div class="yjsg_moduleh groupname">';
         if ($this->element['customchrome']) {
             $new_div[] = '<a href="#" class="openChrome" data-chromedefault="' . $chromeDataDef[$div_row] . '" data-chromemodule="#' . $chromeModule[$div_row] . '">';
             $new_div[] = '<i class="adminicons-chrome"></i>';
             $new_div[] = '</a>';
             $new_div[] = '<div class="chromesHolder"  data-toggle="popover" data-placement="bottom" data-original-title="' . JText::_('YJSG_MOD_CHROME') . '" data-content="' . JText::_('YJSG_MOD_CHROME_TIP') . '">';
             $new_div[] = '<a href="#" data-thischrome="YJsgxhtml" class="seldefault">' . JText::_('YJSG_DEFAULT') . ' <i class="fa fa-check-square-o"></i></a>';
             $new_div[] = '<a href="#" data-thischrome="YJsground">' . JText::_('YJSG_MOD_CHROME_ROUND_NAV') . ' <i class="fa fa-square-o"></i></a>';
             $new_div[] = '<a href="#" data-thischrome="YJsgblank">' . JText::_('YJSG_MOD_CHROME_BLANK_NAV') . ' <i class="fa fa-square-o"></i></a>';
             $new_div[] = '<a href="#" data-thischrome="YJsgtabs">' . JText::_('YJSG_MOD_CHROME_TABS') . ' <i class="fa fa-square-o"></i></a>';
             $new_div[] = '<a href="#" data-thischrome="YJsgaccordion">' . JText::_('YJSG_MOD_CHROME_ACCORDION') . ' <i class="fa fa-square-o"></i></a>';
             $new_div[] = '<a href="#" data-thischrome="YJsgslides">' . JText::_('YJSG_MOD_CHROME_SLIDES') . ' <i class="fa fa-square-o"></i></a>';
             $new_div[] = $chromeInput[$div_row];
             $new_div[] = '</div>';
         }
         $new_div[] = '<div class="yjsg_module">';
         $new_div[] = implode("\n", $div_value);
         $new_div[] = '</div>';
         $new_div[] = '</div>';
     }
     $yjsglayoutarray = json_decode(YJSGLAYOUT);
     $setdivid = $unique_id;
     $divClass = ' class="yjsg_grid yjsg_grid_widths yjsgorder"';
     $dataPosition = '';
     if (strstr($this->element['name'], 'newgrid')) {
         $newGridCase = $this->element['name'];
         $newGridName = str_replace(array('yjsg_', '_width'), array('', ''), $this->element['name']);
     } else {
         $newGridName = 'fakeGrid';
         $newGridCase = 'fakeGrid';
     }
     $findZero = explode('|', $this->element['default']);
     $hasZero = false;
     if (in_array('0', $findZero)) {
         $hasZero = true;
     }
     switch ($unique_id) {
         case 'yjsg_1_width':
             $dataPosition = ' data-position="' . array_search('yjsg1', $yjsglayoutarray) . '"';
             $setdivid = str_replace(array('yjsg_', '_width'), array('yjsg', ''), $setdivid);
             break;
         case 'yjsg_header_width':
             $dataPosition = '';
             $setdivid = 'yjsg_headergrid';
             $divClass = ' class="yjsg_grid_widths"';
             break;
         case 'yjsg_bodytop_width':
             $dataPosition = '';
             $setdivid = 'yjsg_bodytop';
             $divClass = ' class="yjsg_grid_widths jmainbodygrid"';
             break;
         case 'yjsg_yjsgbodytbottom_width':
             $dataPosition = '';
             $setdivid = 'yjsg_bodybottom';
             $divClass = ' class="yjsg_grid_widths jmainbodygrid"';
             break;
         case 'yjsg_2_width':
             $dataPosition = ' data-position="' . array_search('yjsg2', $yjsglayoutarray) . '"';
             $setdivid = str_replace(array('yjsg_', '_width'), array('yjsg', ''), $setdivid);
             break;
         case 'yjsg_3_width':
             $dataPosition = ' data-position="' . array_search('yjsg3', $yjsglayoutarray) . '"';
             $setdivid = str_replace(array('yjsg_', '_width'), array('yjsg', ''), $setdivid);
             break;
         case 'yjsg_4_width':
             $dataPosition = ' data-position="' . array_search('yjsg4', $yjsglayoutarray) . '"';
             $setdivid = str_replace(array('yjsg_', '_width'), array('yjsg', ''), $setdivid);
             break;
         case 'yjsg_5_width':
             $dataPosition = ' data-position="' . array_search('yjsg5', $yjsglayoutarray) . '"';
             $setdivid = str_replace(array('yjsg_', '_width'), array('yjsg', ''), $setdivid);
             break;
         case 'yjsg_6_width':
             $dataPosition = ' data-position="' . array_search('yjsg6', $yjsglayoutarray) . '"';
             $setdivid = str_replace(array('yjsg_', '_width'), array('yjsg', ''), $setdivid);
             break;
         case 'yjsg_7_width':
             $dataPosition = ' data-position="' . array_search('yjsg7', $yjsglayoutarray) . '"';
             $setdivid = str_replace(array('yjsg_', '_width'), array('yjsg', ''), $setdivid);
             break;
         case $newGridCase:
             $dataPosition = ' data-position="' . array_search($newGridName, $yjsglayoutarray) . '"';
             $setdivid = str_replace(array('yjsg_', '_width'), array('', ''), $setdivid);
             break;
     }
     $output = '<div id="' . $setdivid . '"' . $dataPosition . $divClass . '>';
     //		$output.='<a href="javascript:;" class="opensettings" data-settings=".'.$setdivid.'_settings"><i class="fa fa-cog"></i></a>';
     //		$output.='<div class="'.$setdivid.'_settings settingpannel">';
     //		$output .='<ul class="adminformlist gridSetting">';
     //		$output .='</ul>';
     //		$output.='</div>';
     $output .= implode("\n", $new_div);
     $output .= '';
     $output .= '';
     $output .= '';
     $output .= '<a class="YJSG_reset-values btn btn-xs btn-primary" data-elementcss="' . $unique_id . '" href="javascript:;" data-resets="' . $this->element['default'] . '">' . Jtext::_('YJSG_RESET') . '</a>';
     $output .= '</div>';
     return $output;
 }