function fetchElement() { $html = parent::fetchElement(); $fontSettings = N2Fonts::loadSettings(); $families = explode("\n", $fontSettings['preset-families']); sort($families); N2JS::addInline('new NextendElementAutocompleteSimple("' . $this->_id . '", ' . json_encode($families) . ');'); return $html; }
public function renderFontsConfigurationForm() { $values = N2Fonts::loadSettings(); $form = new N2Form($this->appType); $form->loadArray($values); $form->loadArray($values['plugins']->toArray()); $form->loadXMLFile(N2Loader::getPath('models', 'system') . '/forms/fonts.xml'); echo N2Html::openTag("form", array("id" => "nextend-config", "method" => "post", "action" => N2Request::getRequestUri())); $form->render('fonts'); echo N2Html::closeTag("form"); }
public static function loadSettings() { static $inited; if (!$inited) { $inited = true; self::$config = array('default-family' => n2_x('Montserrat,Arial', 'Default font'), 'preset-families' => n2_x("'Montserrat',Arial\n'Pacifico',Arial\n'Open Sans',Arial\n'Lato',Arial\n'Bevan',Arial\n'Oxygen',Arial\n'Pt Sans',Arial\n'Average',Arial\n'Roboto',Arial\n'Roboto Slab',Arial\n'Oswald',Arial\n'Droid Sans',Arial\n'Raleway',Arial\n'Lobster',Arial\n'Titillium Web',Arial\n'Cabin',Arial\n'Varela Round',Arial\n'Vollkorn',Arial\n'Quicksand',Arial\n'Source Sans Pro',Arial\n'Asap',Arial\n'Merriweather',Arial", 'Default font family list'), 'plugins' => array()); foreach (N2StorageSectionAdmin::getAll('system', 'fonts') as $data) { self::$config[$data['referencekey']] = $data['value']; } self::$config['plugins'] = new N2Data(self::$config['plugins'], true); } return self::$config; }
public function actionFonts() { if ($this->canDo('nextend_config')) { $fonts = N2Request::getVar('fonts', false); if ($fonts) { if ($this->validateToken()) { N2Fonts::storeSettings($fonts); N2Message::success(n2_('Saved.')); N2Request::redirect($this->appType->router->createUrl(array("settings/fonts"))); } else { $this->refresh(); } } $this->addView("../../inline/sidebar/settings", array("appObj" => $this), "sidebar"); $this->addView("fonts"); $this->render(); } }
function generateOptions(&$xml) { $html = ''; if (!$this->fixedMode) { $html .= '<option value="0" selected="selected">' . n2_('Choose') . '</option>'; } $this->skins = array(); $fontSettings = N2Fonts::loadSettings(); $families = explode("\n", $fontSettings['preset-families']); foreach ($families as $family) { $family = trim($family, "\t\n\r\v'\""); if (!empty($family)) { $html .= '<option value="' . $family . '">' . $family . '</option>'; $this->skins[$family] = array(); $this->skins[$family]['family'] = $family; } } return $html; }
function onFontManagerLoad($force = false) { static $loaded; if (!$loaded || $force) { $loaded = true; $settings = N2Fonts::loadSettings(); $parameters = $settings['plugins']; $parameters->fillDefault(self::getDefaults()); if ($parameters->get('google-enabled', 1)) { N2GoogleFonts::$enabled = 1; for ($i = 100; $i < 1000; $i += 100) { $this->addStyle($parameters, $i); $this->addStyle($parameters, $i . 'italic'); } if (empty(self::$styles)) { self::$styles[] = '400'; } $this->addSubset($parameters, 'latin'); $this->addSubset($parameters, 'latin-ext'); $this->addSubset($parameters, 'greek'); $this->addSubset($parameters, 'greek-ext'); $this->addSubset($parameters, 'cyrillic'); $this->addSubset($parameters, 'devanagari'); $this->addSubset($parameters, 'arabic'); $this->addSubset($parameters, 'khmer'); $this->addSubset($parameters, 'telugu'); $this->addSubset($parameters, 'vietnamese'); if (empty(self::$subsets)) { self::$subsets[] = 'latin'; } foreach (self::$subsets as $subset) { N2GoogleFonts::addSubset($subset); } N2Pluggable::addAction('fontFamily', array($this, 'onFontFamily')); } } }
/** * @author Roland Soos * @copyright (C) 2015 Nextendweb.com * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ defined('_JEXEC') or die('Restricted access'); /** * @var $model N2SystemFontModel */ $sets = $model->getSets(); N2FontRenderer::$sets[] = $sets[0]['id']; $fonts = array(); foreach (array_unique(N2FontRenderer::$sets) as $setId) { $fonts[$setId] = $model->getVisuals($setId); } $fontSettings = N2Fonts::loadSettings(); N2JS::addFirstCode("\r\n new NextendFontManager({\r\n setsIdentifier: '" . $model->type . "set',\r\n sets: " . json_encode($sets) . ",\r\n visuals: " . json_encode($fonts) . ",\r\n renderer: {\r\n pre: '" . N2FontRenderer::$pre . "',\r\n usedFonts: " . json_encode(N2FontRenderer::$fonts) . ",\r\n modes: " . json_encode(N2FontRenderer::$mode) . "\r\n },\r\n ajaxUrl: '" . $this->appType->router->createAjaxUrl(array('font/index')) . "',\r\n defaultFamily: " . json_encode($fontSettings['default-family']) . "\r\n });\r\n"); ?> <div class="n2-form-tab "> <div class="n2-heading-controls n2-content-box-title-bg"> <div class="n2-table n2-table-fixed"> <div class="n2-tr"> <div class="n2-td n2-h2"> <?php n2_e('Font settings'); ?> </div> <div class="n2-td n2-last n2-visual-editor-tabs"> <a href="#" class="n2-button n2-button-v n2-button-medium n2-button-grey n2-editor-clear-tab n2-h5 n2-uc"