__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
/**
 * @copyright	Copyright (C) 2011 Simplify Your Web, Inc. All rights reserved.
 * @license		GNU General Public License version 3 or later; see LICENSE.txt
 */

namespace SYW\Library\Field;

defined('_JEXEC') or die ;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use SYW\Library\Plugin as SYWPlugin;

class SywfontpickerField extends FormField
{
	public $type = 'Sywfontpicker';
	
	protected $use_global;
	
	protected $support_webfonts;
	
	/**
	 * 
	 * @var string a possible help string that will replace the default one
	 */
	protected $help;
	
	protected function getFontTag($fontfamily)
	{
		return '<li><a class="dropdown-item standardfont_'.$this->id.'" style="font-family: '.htmlspecialchars($fontfamily).'" href="#" onclick="return false;">'.$fontfamily.'</a></li>';
	}
	
	protected function getSerifFontFamilies()
	{
		$html = '';
		
		$html .= self::getFontTag('serif');
		$html .= self::getFontTag('Georgia, serif');
		$html .= self::getFontTag('"Palatino Linotype", "Book Antiqua", Palatino, serif');
		$html .= self::getFontTag('"MS Serif", "New York", serif');
		$html .= self::getFontTag('"Times New Roman", Times, serif');
		
		return $html;
	}
	
	protected function getSansSerifFontFamilies()
	{
		$html = '';
		
		$html .= self::getFontTag('sans-serif');
		$html .= self::getFontTag('Arial, Helvetica, sans-serif');
		$html .= self::getFontTag('"Arial Black", Gadget, sans-serif');
		$html .= self::getFontTag('"Comic Sans MS", cursive, sans-serif');
		$html .= self::getFontTag('Impact, Charcoal, sans-serif');
		$html .= self::getFontTag('"Lucida Sans Unicode", "Lucida Grande", sans-serif');
		$html .= self::getFontTag('Tahoma, Geneva, sans-serif');
		$html .= self::getFontTag('"Trebuchet MS", Helvetica, sans-serif');
		$html .= self::getFontTag('"MS Sans Serif", Geneva, sans-serif');
		$html .= self::getFontTag('Verdana, Geneva, sans-serif');
		
		return $html;
	}
	
	protected function getMonospaceFontFamilies()
	{
		$html = '';
		
		$html .= self::getFontTag('monospace');
		$html .= self::getFontTag('"Courier New", Courier, monospace');
		$html .= self::getFontTag('"Lucida Console", Monaco, monospace');
		
		return $html;
	}
	
	protected function getCursiveFontFamilies()
	{
		$html = '';
		
		$html .= self::getFontTag('cursive');
		
		return $html;
	}
	
	protected function getFantasyFontFamilies()
	{
		$html = '';
		
		$html .= self::getFontTag('fantasy');
		
		return $html;
	}
	
	/**
	 * Method to get the field input markup.
	 *
	 */
	protected function getInput()
	{
		$wam = Factory::getApplication()->getDocument()->getWebAssetManager();
		
		$lang = Factory::getLanguage();
		$lang->load('lib_syw.sys', JPATH_SITE);
		
		HTMLHelper::_('bootstrap.tooltip', '.hasTooltip');
		HTMLHelper::_('bootstrap.dropdown', '.dropdown-toggle');
		
		//$wam->registerAndUseStyle('syw.font', 'syw/fonts.min.css', ['relative' => true, 'version' => 'auto']);
		
		$icon_svg = '<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 448 512" style="width: 1em; fill: currentcolor"><path d="M254 52.8C249.3 40.3 237.3 32 224 32s-25.3 8.3-30 20.8L57.8 416H32c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32h-1.8l18-48H303.8l18 48H320c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H390.2L254 52.8zM279.8 304H168.2L224 155.1 279.8 304z"/></svg>';
		
		$global_value = '';
		
		if ($this->use_global) {
			$component  = Factory::getApplication()->input->getCmd('option');
			if ($component == 'com_menus') { // we are in the context of a menu item
				$uri = new Uri($this->form->getData()->get('link'));
				$component = $uri->getVar('option', 'com_menus');
				
				$config_params = ComponentHelper::getParams($component);
				
				$config_value = $config_params->get($this->fieldname);
				
				if (!is_null($config_value)) {
					$global_value = $config_value;
				}
			}
		}
		
		$wam->addInlineScript('
			document.addEventListener("readystatechange", function(event) {
				if (event.target.readyState == "complete") {
			
					let input = document.getElementById("' . $this->id . '");
			
                    var standard_fonts = document.querySelectorAll(".standardfont_' . $this->id . '");
                    for (let i = 0; i < standard_fonts.length; i++) {
                        standard_fonts[i].addEventListener("click", function(event) {
                            let font_family = this.textContent;
                            input.value = font_family;
                            input.style.fontFamily = font_family;
							input.removeAttribute("disabled");
                        });
                    }
			
                    var web_fonts = document.querySelectorAll(".webfont_' . $this->id . '");
                    for (let i = 0; i < web_fonts.length; i++) {
                        web_fonts[i].addEventListener("click", function(event) {
                            let font_family = this.textContent;
                            input.value = font_family;
                            input.style.fontFamily = "inherit";
							input.removeAttribute("disabled");
                        });
                    }
			
                    document.getElementById("clear_' . $this->id . '").addEventListener("click", function(event) {
                        input.value = "";
			
						if (input.classList.contains("useGlobal")) {
							var textarea = document.createElement("textarea");
    						textarea.innerHTML = "' . Text::sprintf('JGLOBAL_USE_GLOBAL_VALUE', htmlspecialchars($global_value, ENT_QUOTES)) . '";
							input.setAttribute("placeholder", textarea.value);
							input.setAttribute("disabled", "disabled");
							input.style.fontFamily = "inherit";
						}
                    });
                }
			});
		');
		
		$disabled = '';
		$placeholder = '';
		if (empty($this->value) && $this->use_global) {
			$disabled = ' disabled';
			$placeholder = ' placeholder="' . Text::sprintf('JGLOBAL_USE_GLOBAL_VALUE', htmlspecialchars($global_value, ENT_QUOTES)) . '"';
		}
		
		$html = '<div class="input-group">';
		
		//$html .= '<span class="input-group-text"><i class="SYWicon-font" aria-hidden="true"></i></span>';
		$html .= '<span class="input-group-text">'.$icon_svg.'</span>';
		
		$html .= '<input id="'.$this->id.'" name="'.$this->name.'" class="form-control' . ($this->use_global ? ' useGlobal' : '') . '" type="text" value="'.htmlspecialchars($this->value).'" style="font-family:'.htmlspecialchars($this->value).'"'. $disabled . $placeholder .' />';
		
		$html .= '<button type="button" id="dropdownMenu'.$this->id.'" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent" aria-label="' . Text::_('LIB_SYW_FONTPICKER_SELECTFONT') . '"></button>';
		$html .= '<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenu'.$this->id.'" style="max-height: 200px; overflow-x: hidden; overflow-y: auto">';
		
		$html .= '<li><a class="dropdown-item webfont_'.$this->id.'" href="#" onclick="return false;">' . Text::_('LIB_SYW_FONTPICKER_WEBFONTFORMAT') . '</a></li>';
		
		$html .= '<li><h6 class="dropdown-header">Serif</h6></li>';
		$html .= self::getSerifFontFamilies();
		
		$html .= '<li><h6 class="dropdown-header">Sans-Serif</h6></li>';
		$html .= self::getSansSerifFontFamilies();
		
		$html .= '<li><h6 class="dropdown-header">Cursive</h6></li>';
		$html .= self::getCursiveFontFamilies();
		
		$html .= '<li><h6 class="dropdown-header">Fantasy</h6></li>';
		$html .= self::getFantasyFontFamilies();
		
		$html .= '<li><h6 class="dropdown-header">Monospace</h6></li>';
		$html .= self::getMonospaceFontFamilies();
		
		$html .= '</ul>';
		
		$html .= '<button id="clear_' . $this->id . '" type="button" class="btn btn-danger hasTooltip" title="' . Text::_('JCLEAR') . '" aria-label="' . Text::_('JCLEAR') . '"><i class="icon-remove" aria-hidden="true"></i></button>';
		
		$html .= '</div>';
		
		$html .= '<span class="help-block" style="font-size: .8rem">' . $this->help . '</span>';
		
		return $html;
	}
	
	public function setup(\SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);
		
		if ($return) {
			$this->use_global = ((string)$this->element['global'] == "true" || (string)$this->element['useglobal'] == "true") ? true : false;
			$this->support_webfonts = ((string)$this->element['webfonts'] == "true") ? true : false;
			$this->help = isset($this->element['help']) ? Text::_((string)$this->element['help']) : '';

			if (empty($this->help)) {
			    $help = Text::_('LIB_SYW_FONTPICKER_WEBFONTLINKHELP');

			    $webfont_service = $this->support_webfonts ? SYWPlugin::getWebfontService() : 'google';
    			if ($webfont_service === 'bunny') {
    			    $help .= '<br /><a href="https://fonts.bunny.net" target="_blank">' . Text::_('LIB_SYW_FONTPICKER_BUNNYFONTLINK') . '</a>';
    			} else {
                    $help .= '<br /><a href="https://fonts.google.com" target="_blank">' . Text::_('LIB_SYW_FONTPICKER_GOOGLEFONTLINK') . '</a>';
    			}

    			$this->help = $help;
			}
		}
		
		return $return;
	}
}
?>

Filemanager

Name Type Size Permission Actions
CustomfieldgroupslistField.php File 2.47 KB 0664
CustomfieldslistField.php File 3.77 KB 0664
DemotestField.php File 1.26 KB 0664
DynamicsingleselectField.php File 8.97 KB 0664
ExtensionauthorField.php File 1.08 KB 0664
ExtensionconnectField.php File 1.98 KB 0664
ExtensionlinkField.php File 5.96 KB 0664
ExtensionlinksField.php File 5.44 KB 0664
ExtensiontranslatorsField.php File 1.25 KB 0664
ExtensionversionField.php File 2.12 KB 0664
GdtestField.php File 3.34 KB 0664
GlobalgroupedlistField.php File 2.17 KB 0664
ImagelibraryselectField.php File 1.27 KB 0664
ImagelibrarytestField.php File 6.95 KB 0664
ImagelinkField.php File 2 KB 0664
ImageradioField.php File 6.68 KB 0664
ImagetypeselectField.php File 1.83 KB 0664
K2categoryField.php File 2.36 KB 0664
K2itemField.php File 3.93 KB 0664
K2messageField.php File 1.45 KB 0664
K2tagsField.php File 1.63 KB 0664
MessageField.php File 3.87 KB 0664
OrField.php File 627 B 0664
OverridestestField.php File 6.39 KB 0664
PhpextensiontestField.php File 1.78 KB 0664
PhpsettingtestField.php File 1.7 KB 0664
SubtitleField.php File 1.15 KB 0664
SywalignmentselectField.php File 4.46 KB 0664
SywcardinaltextField.php File 7.58 KB 0664
SywcolorpickerField.php File 14.45 KB 0664
SywextensionpresencetestField.php File 4.91 KB 0664
SywfontpickerField.php File 9.05 KB 0664
SywfontweightpickerField.php File 2.8 KB 0664
SywiconpickerField.php File 31.42 KB 0664
SywimagefileField.php File 3.58 KB 0664
SywimagefilepreviewField.php File 7.92 KB 0664
SywimagefilterpickerField.php File 4.53 KB 0664
SywimagepreviewField.php File 2.14 KB 0664
SywlayoutselectField.php File 2.93 KB 0664
SywloaderpickerField.php File 1.43 KB 0664
SywonlinehelpField.php File 2.26 KB 0664
SywprefixedtextField.php File 2.53 KB 0664
SywshadowselectField.php File 3.09 KB 0664
SywspacingselectField.php File 3.32 KB 0664
SywtransitionpickerField.php File 14.17 KB 0664
SywuniversaliconpickerField.php File 25.9 KB 0664
SywverbosetextField.php File 4.59 KB 0664
SywverbosetextunitsField.php File 5.99 KB 0664
TagsField.php File 2.29 KB 0664
TitleField.php File 2.03 KB 0664
ViewsField.php File 3.79 KB 0664
Filemanager