| Current Path : /home/digilove/public_html/41423/ |
| Current File : //home/digilove/public_html/41423/Framework.tar |
Api.php 0000644 00000014360 15235523331 0005774 0 ustar 00 <?php
namespace Nextend\Framework;
use Exception;
use Joomla\CMS\Http\Http;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Misc\HttpClient;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Request\Request;
use Nextend\Framework\Url\Url;
class Api {
private static $api = 'https://api.nextendweb.com/v1/';
public static function getApiUrl() {
return self::$api;
}
public static function api($posts, $returnUrl = false) {
$api = self::getApiUrl();
//mhehm >>
if ($posts['action'] == 'asset')
{
//$api = 'https://joomlashare.ir/images/smartslider3/' . str_replace('http://smartslider3.com/','',$posts['asset']) . '.zip';
}
elseif ($posts['action'] == 'licensecheck')
{
return array('status' => 'OK', 'data' => '');
}
//<< mhehm
$posts_default = array(
'platform' => Platform::getName()
);
$posts_default['domain'] = parse_url(Url::getSiteUri(), PHP_URL_HOST);
$posts = $posts + $posts_default;
$posts['domain'] = 'localhost'; //mhehm
if ($returnUrl) {
return $api . '?' . http_build_query($posts, '', '&');
}
if (class_exists('Http')) {
$client = new Http();
try {
$response = $client->post($api, http_build_query($posts, '', '&'), array('Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8'), 5);
} catch (Exception $e) {
}
if (isset($response) && $response && $response->code == '200') {
if (isset($response->headers['Content-Type'])) {
$contentType = $response->headers['Content-Type'];
} else if (isset($response->headers['content-type'])) {
$contentType = $response->headers['content-type'];
}
if (is_array($contentType)) {
/**
* Joomla 4 headers stored as arrays
*/
$contentType = $contentType[0];
}
$data = $response->body;
}
}
if (!isset($data)) {
if (function_exists('curl_init') && function_exists('curl_exec')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($posts, '', '&'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_REFERER, Request::$SERVER->getVar('REQUEST_URI'));
$data = curl_exec($ch);
$errorNumber = curl_errno($ch);
if ($errorNumber == 60 || $errorNumber == 77) {
curl_setopt($ch, CURLOPT_CAINFO, HttpClient::getCacertPath());
$data = curl_exec($ch);
}
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
$error = curl_error($ch);
$curlErrorNumber = curl_errno($ch);
curl_close($ch);
if ($curlErrorNumber) {
Notification::error($curlErrorNumber . $error);
return array(
'status' => 'ERROR_HANDLED'
);
}
} else {
$opts = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($posts, '', '&')
)
);
$context = stream_context_create($opts);
$data = file_get_contents($api, false, $context);
if ($data === false) {
Notification::error(n2_('CURL disabled in your php.ini configuration. Please enable it!'));
return array(
'status' => 'ERROR_HANDLED'
);
}
$headers = self::parseHeaders($http_response_header);
if ($headers['status'] != '200') {
Notification::error(n2_('Unable to contact with the licensing server, please try again later!'));
return array(
'status' => 'ERROR_HANDLED'
);
}
if (isset($headers['content-type'])) {
$contentType = $headers['content-type'];
}
}
}
switch ($contentType) {
case 'text/html; charset=UTF-8':
Notification::error(sprintf('Unexpected response from the API.<br>Contact us (support@nextendweb.com) with the following log:') . '<br><textarea style="width: 100%;height:200px;font-size:8px;">' . Base64::encode($data) . '</textarea>');
return array(
'status' => 'ERROR_HANDLED'
);
break;
case 'application/json':
return json_decode($data, true);
}
return $data;
}
private static function parseHeaders(array $headers, $header = null) {
$output = array();
if ('HTTP' === substr($headers[0], 0, 4)) {
list(, $output['status'], $output['status_text']) = explode(' ', $headers[0]);
unset($headers[0]);
}
foreach ($headers as $v) {
$h = preg_split('/:\s*/', $v);
if (count($h) >= 2) {
$output[strtolower($h[0])] = $h[1];
}
}
if (null !== $header) {
if (isset($output[strtolower($header)])) {
return $output[strtolower($header)];
}
return null;
}
return $output;
}
} Cast.php 0000644 00000000446 15235523331 0006155 0 ustar 00 <?php
namespace Nextend\Framework;
class Cast {
/**
* @param $number
*
* @return string the JavaScript float representation of the string
*/
public static function floatToString($number) {
return json_encode(floatval($number));
}
} Framework.php 0000644 00000000662 15235523331 0007220 0 ustar 00 <?php
namespace Nextend\Framework;
use Nextend\Framework\Font\FontStorage;
use Nextend\Framework\Localization\Localization;
use Nextend\Framework\Pattern\SingletonTrait;
use Nextend\Framework\Style\StyleStorage;
class Framework {
use SingletonTrait;
protected function init() {
Localization::getInstance();
FontStorage::getInstance();
StyleStorage::getInstance();
}
} PageFlow.php 0000644 00000001151 15235523331 0006761 0 ustar 00 <?php
namespace Nextend\Framework;
class PageFlow {
public static function markApplicationEnd() {
Plugin::doAction('exit');
}
public static function exitApplication() {
self::markApplicationEnd();
exit;
}
public static function cleanOutputBuffers() {
$handlers = ob_list_handlers();
while (count($handlers) > 0 && $handlers[count($handlers) - 1] != 'ob_gzhandler' && $handlers[count($handlers) - 1] != 'zlib output compression') {
ob_end_clean();
$handlers = ob_list_handlers();
}
}
} Plugin.php 0000644 00000002770 15235523331 0006523 0 ustar 00 <?php
namespace Nextend\Framework;
class Plugin {
private static $classes = array();
/**
* @param $eventName
* @param callable $callable
*/
public static function addAction($eventName, $callable) {
if (!isset(self::$classes[$eventName])) self::$classes[$eventName] = array();
self::$classes[$eventName][] = $callable;
}
static function addFilter($eventName, $callable) {
if (!isset(self::$classes[$eventName])) self::$classes[$eventName] = array();
self::$classes[$eventName][] = $callable;
}
public static function applyFilters($eventName, $value, $args = array()) {
if (self::hasAction($eventName)) {
foreach (self::$classes[$eventName] as $callable) {
if (is_callable($callable)) {
$value = call_user_func_array($callable, array_merge(array($value), $args));
}
}
}
return $value;
}
public static function doAction($eventName, $args = array()) {
if (self::hasAction($eventName)) {
foreach (self::$classes[$eventName] as $callable) {
if (is_callable($callable)) {
call_user_func_array($callable, $args);
}
}
}
}
public static function hasAction($eventName) {
if (isset(self::$classes[$eventName])) {
return true;
}
return false;
}
} Sanitize.php 0000644 00000101053 15235523331 0007045 0 ustar 00 <?php
namespace Nextend\Framework;
use DOMDocument;
use Nextend\Framework\Platform\Platform;
global $allowedentitynames;
/**
* @var string[] $allowedentitynames Array of KSES allowed HTML entitity names.
* @since 1.0.0
*/
$allowedentitynames = is_array($allowedentitynames) ? $allowedentitynames : array(
'nbsp',
'iexcl',
'cent',
'pound',
'curren',
'yen',
'brvbar',
'sect',
'uml',
'copy',
'ordf',
'laquo',
'not',
'shy',
'reg',
'macr',
'deg',
'plusmn',
'acute',
'micro',
'para',
'middot',
'cedil',
'ordm',
'raquo',
'iquest',
'Agrave',
'Aacute',
'Acirc',
'Atilde',
'Auml',
'Aring',
'AElig',
'Ccedil',
'Egrave',
'Eacute',
'Ecirc',
'Euml',
'Igrave',
'Iacute',
'Icirc',
'Iuml',
'ETH',
'Ntilde',
'Ograve',
'Oacute',
'Ocirc',
'Otilde',
'Ouml',
'times',
'Oslash',
'Ugrave',
'Uacute',
'Ucirc',
'Uuml',
'Yacute',
'THORN',
'szlig',
'agrave',
'aacute',
'acirc',
'atilde',
'auml',
'aring',
'aelig',
'ccedil',
'egrave',
'eacute',
'ecirc',
'euml',
'igrave',
'iacute',
'icirc',
'iuml',
'eth',
'ntilde',
'ograve',
'oacute',
'ocirc',
'otilde',
'ouml',
'divide',
'oslash',
'ugrave',
'uacute',
'ucirc',
'uuml',
'yacute',
'thorn',
'yuml',
'quot',
'amp',
'lt',
'gt',
'apos',
'OElig',
'oelig',
'Scaron',
'scaron',
'Yuml',
'circ',
'tilde',
'ensp',
'emsp',
'thinsp',
'zwnj',
'zwj',
'lrm',
'rlm',
'ndash',
'mdash',
'lsquo',
'rsquo',
'sbquo',
'ldquo',
'rdquo',
'bdquo',
'dagger',
'Dagger',
'permil',
'lsaquo',
'rsaquo',
'euro',
'fnof',
'Alpha',
'Beta',
'Gamma',
'Delta',
'Epsilon',
'Zeta',
'Eta',
'Theta',
'Iota',
'Kappa',
'Lambda',
'Mu',
'Nu',
'Xi',
'Omicron',
'Pi',
'Rho',
'Sigma',
'Tau',
'Upsilon',
'Phi',
'Chi',
'Psi',
'Omega',
'alpha',
'beta',
'gamma',
'delta',
'epsilon',
'zeta',
'eta',
'theta',
'iota',
'kappa',
'lambda',
'mu',
'nu',
'xi',
'omicron',
'pi',
'rho',
'sigmaf',
'sigma',
'tau',
'upsilon',
'phi',
'chi',
'psi',
'omega',
'thetasym',
'upsih',
'piv',
'bull',
'hellip',
'prime',
'Prime',
'oline',
'frasl',
'weierp',
'image',
'real',
'trade',
'alefsym',
'larr',
'uarr',
'rarr',
'darr',
'harr',
'crarr',
'lArr',
'uArr',
'rArr',
'dArr',
'hArr',
'forall',
'part',
'exist',
'empty',
'nabla',
'isin',
'notin',
'ni',
'prod',
'sum',
'minus',
'lowast',
'radic',
'prop',
'infin',
'ang',
'and',
'or',
'cap',
'cup',
'int',
'sim',
'cong',
'asymp',
'ne',
'equiv',
'le',
'ge',
'sub',
'sup',
'nsub',
'sube',
'supe',
'oplus',
'otimes',
'perp',
'sdot',
'lceil',
'rceil',
'lfloor',
'rfloor',
'lang',
'rang',
'loz',
'spades',
'clubs',
'hearts',
'diams',
'sup1',
'sup2',
'sup3',
'frac14',
'frac12',
'frac34',
'there4',
);
class Sanitize {
public static $basicTags = array();
// Tags for admin page forms with text fields, on-offs, selects, textareas, etc..
public static $adminFormTags = array();
// Tags for the rest of the admin page layout.
public static $adminTemplateTags = array();
// Tags for CSS and JS codes.
public static $assetTags = array();
// Tags for html videos.
public static $videoTags = array();
private static function getCharset() {
return Platform::getCharset();
}
/**
* Checks for invalid UTF8 in a string.
*
* @param string $string The text which is to be checked.
* @param bool $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
*
* @return string The checked text.
* @since 2.8.0
*
* @staticvar bool $is_utf8
* @staticvar bool $utf8_pcre
*
*/
private static function check_invalid_utf8($string, $strip = false) {
$string = (string)$string;
if (0 === strlen($string)) {
return '';
}
// Store the site charset as a static to avoid multiple calls to get_option()
static $is_utf8 = null;
if (!isset($is_utf8)) {
$is_utf8 = in_array(self::getCharset(), array(
'utf8',
'utf-8',
'UTF8',
'UTF-8'
));
}
if (!$is_utf8) {
return $string;
}
// Check for support for utf8 in the installed PCRE library once and store the result in a static
static $utf8_pcre = null;
if (!isset($utf8_pcre)) {
$utf8_pcre = @preg_match('/^./u', 'a');
}
// We can't demand utf8 in the PCRE installation, so just return the string in those cases
if (!$utf8_pcre) {
return $string;
}
// preg_match fails when it encounters invalid UTF8 in $string
if (1 === @preg_match('/^./us', $string)) {
return $string;
}
// Attempt to strip the bad chars if requested (not recommended)
if ($strip && function_exists('iconv')) {
return iconv('utf-8', 'utf-8', $string);
}
return '';
}
/**
* Converts a number of special characters into their HTML entities.
*
* Specifically deals with: &, <, >, ", and '.
*
* $quote_style can be set to ENT_COMPAT to encode " to
* ", or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.
*
* @param string $string The text which is to be encoded.
* @param int|string $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
* both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES.
* Also compatible with old values; converting single quotes if set to 'single',
* double if set to 'double' or both if otherwise set.
* Default is ENT_NOQUOTES.
* @param string|bool $charset Optional. The character encoding of the string. Default is false.
* @param bool $double_encode Optional. Whether to encode existing html entities. Default is false.
*
* @return string The encoded text with HTML entities.
* @since 1.2.2
* @access private
*
* @staticvar string $_charset
*
*/
private static function _specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false) {
$string = (string)$string;
if (0 === strlen($string)) return '';
// Don't bother if there are no specialchars - saves some processing
if (!preg_match('/[&<>"\']/', $string)) return $string;
// Account for the previous behaviour of the function when the $quote_style is not an accepted value
if (empty($quote_style)) $quote_style = ENT_NOQUOTES; else if (!in_array($quote_style, array(
0,
2,
3,
'single',
'double'
), true)) $quote_style = ENT_QUOTES;
// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
if (!$charset) {
static $_charset = null;
if (!isset($_charset)) {
$_charset = self::getCharset();
}
$charset = $_charset;
}
if (in_array($charset, array(
'utf8',
'utf-8',
'UTF8'
))) $charset = 'UTF-8';
$_quote_style = $quote_style;
if ($quote_style === 'double') {
$quote_style = ENT_COMPAT;
$_quote_style = ENT_COMPAT;
} else if ($quote_style === 'single') {
$quote_style = ENT_NOQUOTES;
}
if (!$double_encode) {
// Guarantee every &entity; is valid, convert &garbage; into &garbage;
// This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
$string = self::kses_normalize_entities($string);
}
$string = @htmlspecialchars($string, $quote_style, $charset, $double_encode);
// Back-compat.
if ('single' === $_quote_style) $string = str_replace("'", ''', $string);
return $string;
}
/**
* Converts and fixes HTML entities.
*
* This function normalizes HTML entities. It will convert `AT&T` to the correct
* `AT&T`, `:` to `:`, `&#XYZZY;` to `&#XYZZY;` and so on.
*
* @param string $string Content to normalize entities
*
* @return string Content with normalized entities
* @since 1.0.0
*
*/
private static function kses_normalize_entities($string) {
// Disarm all entities by converting & to &
$string = str_replace('&', '&', $string);
// Change back the allowed entities in our entity whitelist
$string = preg_replace_callback('/&([A-Za-z]{2,8}[0-9]{0,2});/', array(
self::class,
'kses_named_entities'
), $string);
$string = preg_replace_callback('/&#(0*[0-9]{1,7});/', array(
self::class,
'kses_normalize_entities2'
), $string);
$string = preg_replace_callback('/&#[Xx](0*[0-9A-Fa-f]{1,6});/', array(
self::class,
'kses_normalize_entities3'
), $string);
return $string;
}
/**
* Callback for kses_normalize_entities() regular expression.
*
* This function only accepts valid named entity references, which are finite,
* case-sensitive, and highly scrutinized by HTML and XML validators.
*
* @param array $matches preg_replace_callback() matches array
*
* @return string Correctly encoded entity
* @since 3.0.0
*
* @global array $allowedentitynames
*
*/
public static function kses_named_entities($matches) {
global $allowedentitynames;
if (empty($matches[1])) return '';
$i = $matches[1];
return (!in_array($i, $allowedentitynames)) ? "&$i;" : "&$i;";
}
/**
* Callback for kses_normalize_entities() regular expression.
*
* This function helps kses_normalize_entities() to only accept 16-bit
* values and nothing more for `&#number;` entities.
*
* @access private
*
* @param array $matches preg_replace_callback() matches array
*
* @return string Correctly encoded entity
* @since 1.0.0
*
*/
public static function kses_normalize_entities2($matches) {
if (empty($matches[1])) return '';
$i = $matches[1];
if (self::valid_unicode($i)) {
$i = str_pad(ltrim($i, '0'), 3, '0', STR_PAD_LEFT);
$i = "&#$i;";
} else {
$i = "&#$i;";
}
return $i;
}
/**
* Callback for kses_normalize_entities() for regular expression.
*
* This function helps kses_normalize_entities() to only accept valid Unicode
* numeric entities in hex form.
*
* @access private
*
* @param array $matches preg_replace_callback() matches array
*
* @return string Correctly encoded entity
*/
public static function kses_normalize_entities3($matches) {
if (empty($matches[1])) return '';
$hexchars = $matches[1];
return (!self::valid_unicode(hexdec($hexchars))) ? "&#x$hexchars;" : '&#x' . ltrim($hexchars, '0') . ';';
}
/**
* Helper function to determine if a Unicode value is valid.
*
* @param int $i Unicode value
*
* @return bool True if the value was a valid Unicode number
*/
private static function valid_unicode($i) {
return ($i == 0x9 || $i == 0xa || $i == 0xd || ($i >= 0x20 && $i <= 0xd7ff) || ($i >= 0xe000 && $i <= 0xfffd) || ($i >= 0x10000 && $i <= 0x10ffff));
}
/**
* Escape single quotes, htmlspecialchar " < > &, and fix line endings.
*
* Escapes text strings for echoing in JS. It is intended to be used for inline JS
* (in a tag attribute, for example onclick="..."). Note that the strings have to
* be in single quotes. The {@see 'js_escape'} filter is also applied here.
*
* @param string $text The text to be escaped.
*
* @return string Escaped text.
* @since 2.8.0
*
*/
public static function esc_js($text) {
$safe_text = self::check_invalid_utf8($text);
$safe_text = self::_specialchars($safe_text, ENT_COMPAT);
$safe_text = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes($safe_text));
$safe_text = str_replace("\r", '', $safe_text);
$safe_text = str_replace("\n", '\\n', addslashes($safe_text));
return $safe_text;
}
/**
* Escaping for HTML blocks.
*
* @param string $text
*
* @return string
* @since 2.8.0
*
*/
public static function esc_html($text) {
$safe_text = self::check_invalid_utf8($text);
$safe_text = self::_specialchars($safe_text, ENT_QUOTES);
return $safe_text;
}
/**
* Escaping for HTML attributes.
*
* @param string $text
*
* @return string
* @since 2.8.0
*
*/
public static function esc_attr($text) {
$safe_text = self::check_invalid_utf8($text);
$safe_text = self::_specialchars($safe_text, ENT_QUOTES);
return $safe_text;
}
/**
* Escaping for textarea values.
*
* @param string $text
*
* @return string
* @since 3.1.0
*
*/
public static function esc_textarea($text) {
$safe_text = htmlspecialchars($text, ENT_QUOTES, self::getCharset());
return $safe_text;
}
public static function remove_closing_style_tag($text) {
$safe_text = self::check_invalid_utf8($text);
return preg_replace_callback('/<\/style.*?>/i', function () {
return '';
}, $safe_text);
}
public static function esc_css_value($text) {
$safe_text = self::check_invalid_utf8($text);
return preg_replace_callback('/[<>]/', function () {
return '';
}, $safe_text);
}
public static function esc_css_string($cssString) {
$output = '';
echo "\n\n";
$pairs = explode(';', trim($cssString));
foreach ($pairs as $pair) {
if (!empty($pair)) {
$keyValue = explode(':', trim($pair), 2);
if (count($keyValue) != 2) {
continue;
}
if (!preg_match('/^[a-zA-Z\-]+$/', $keyValue[0])) {
continue;
}
$output .= $keyValue[0] . ':' . self::esc_css_value(trim($keyValue[1])) . ';';
}
}
return $output;
}
public static function filter_allowed_html($input, $extraTags = '') {
return self::filter_attributes_on(strip_tags($input, '<a><span><sub><sup><em><i><var><cite><b><strong><small><bdo><br><img><picture><source><u><del><bdi><ins>' . $extraTags));
}
public static function remove_all_html($input) {
return strip_tags($input);
}
public static function filter_attributes_on($input) {
if (class_exists('DOMDocument')) {
if (function_exists('libxml_use_internal_errors')) {
libxml_use_internal_errors(true);
}
$dom = new DOMDocument();
$dom->loadHTML('<?xml encoding="utf-8" ?><!DOCTYPE html><html lang="en"><body>' . $input . '</body></html>');
if (function_exists('libxml_use_internal_errors')) {
libxml_use_internal_errors(false);
}
for ($els = $dom->getElementsByTagname('*'), $i = $els->length - 1; $i >= 0; $i--) {
for ($attrs = $els->item($i)->attributes, $ii = $attrs->length - 1; $ii >= 0; $ii--) {
if (substr($attrs->item($ii)->name, 0, 2) === 'on') {
$els->item($i)
->removeAttribute($attrs->item($ii)->name);
continue;
}
if ($attrs->item($ii)->name === 'href' && strpos($attrs->item($ii)->value, 'javascript:') !== false) {
$els->item($i)
->removeAttribute($attrs->item($ii)->name);
}
}
}
$output = '';
$body = $dom->getElementsByTagName('body');
if ($body && 0 < $body->length) {
$body = $body->item(0);
$childNodes = $body->childNodes;
if (!empty($childNodes)) {
foreach ($childNodes as $childNode) {
$output .= $dom->saveHTML($childNode);
}
}
}
return $output;
} else if (function_exists('wp_kses_post')) {
return wp_kses_post($input);
}
return $input;
}
public static function set_allowed_tags() {
if (N2JOOMLA || CUSTOM_TAGS) {
$_allowedposttags = array();
}
$wpAllowedposttags = array(
'address' => array(),
'a' => array(
'href' => true,
'rel' => true,
'rev' => true,
'name' => true,
'target' => true,
'download' => array(
'valueless' => 'y',
),
),
'abbr' => array(),
'acronym' => array(),
'area' => array(
'alt' => true,
'coords' => true,
'href' => true,
'nohref' => true,
'shape' => true,
'target' => true,
),
'article' => array(
'align' => true,
),
'aside' => array(
'align' => true,
),
'audio' => array(
'autoplay' => true,
'controls' => true,
'loop' => true,
'muted' => true,
'preload' => true,
'src' => true,
),
'b' => array(),
'bdi' => array(),
'bdo' => array(),
'big' => array(),
'blockquote' => array(
'cite' => true,
),
'br' => array(),
'button' => array(
'disabled' => true,
'name' => true,
'type' => true,
'value' => true,
),
'caption' => array(
'align' => true,
),
'cite' => array(),
'code' => array(),
'col' => array(
'align' => true,
'char' => true,
'charoff' => true,
'span' => true,
'valign' => true,
'width' => true,
),
'colgroup' => array(
'align' => true,
'char' => true,
'charoff' => true,
'span' => true,
'valign' => true,
'width' => true,
),
'del' => array(
'datetime' => true,
),
'dd' => array(),
'dfn' => array(),
'details' => array(
'align' => true,
'open' => true,
),
'div' => array(
'align' => true,
),
'dl' => array(),
'dt' => array(),
'em' => array(),
'fieldset' => array(),
'figure' => array(
'align' => true,
),
'figcaption' => array(
'align' => true,
),
'font' => array(
'color' => true,
'face' => true,
'size' => true,
),
'footer' => array(
'align' => true,
),
'h1' => array(
'align' => true,
),
'h2' => array(
'align' => true,
),
'h3' => array(
'align' => true,
),
'h4' => array(
'align' => true,
),
'h5' => array(
'align' => true,
),
'h6' => array(
'align' => true,
),
'header' => array(
'align' => true,
),
'hgroup' => array(
'align' => true,
),
'hr' => array(
'align' => true,
'noshade' => true,
'size' => true,
'width' => true,
),
'i' => array(),
'img' => array(
'alt' => true,
'align' => true,
'border' => true,
'height' => true,
'hspace' => true,
'loading' => true,
'longdesc' => true,
'vspace' => true,
'src' => true,
'usemap' => true,
'width' => true,
),
'ins' => array(
'datetime' => true,
'cite' => true,
),
'kbd' => array(),
'label' => array(
'for' => true,
),
'legend' => array(
'align' => true,
),
'li' => array(
'align' => true,
'value' => true,
),
'main' => array(
'align' => true,
),
'map' => array(
'name' => true,
),
'mark' => array(),
'menu' => array(
'type' => true,
),
'nav' => array(
'align' => true,
),
'object' => array(
'data' => array(
'required' => true,
'value_callback' => '_wp_kses_allow_pdf_objects',
),
'type' => array(
'required' => true,
'values' => array('application/pdf'),
),
),
'p' => array(
'align' => true,
),
'pre' => array(
'width' => true,
),
'q' => array(
'cite' => true,
),
'rb' => array(),
'rp' => array(),
'rt' => array(),
'rtc' => array(),
'ruby' => array(),
's' => array(),
'samp' => array(),
'span' => array(
'align' => true,
),
'section' => array(
'align' => true,
),
'small' => array(),
'strike' => array(),
'strong' => array(),
'sub' => array(),
'summary' => array(
'align' => true,
),
'sup' => array(),
'table' => array(
'align' => true,
'bgcolor' => true,
'border' => true,
'cellpadding' => true,
'cellspacing' => true,
'rules' => true,
'summary' => true,
'width' => true,
),
'tbody' => array(
'align' => true,
'char' => true,
'charoff' => true,
'valign' => true,
),
'td' => array(
'abbr' => true,
'align' => true,
'axis' => true,
'bgcolor' => true,
'char' => true,
'charoff' => true,
'colspan' => true,
'headers' => true,
'height' => true,
'nowrap' => true,
'rowspan' => true,
'scope' => true,
'valign' => true,
'width' => true,
),
'textarea' => array(
'cols' => true,
'rows' => true,
'disabled' => true,
'name' => true,
'readonly' => true,
),
'tfoot' => array(
'align' => true,
'char' => true,
'charoff' => true,
'valign' => true,
),
'th' => array(
'abbr' => true,
'align' => true,
'axis' => true,
'bgcolor' => true,
'char' => true,
'charoff' => true,
'colspan' => true,
'headers' => true,
'height' => true,
'nowrap' => true,
'rowspan' => true,
'scope' => true,
'valign' => true,
'width' => true,
),
'thead' => array(
'align' => true,
'char' => true,
'charoff' => true,
'valign' => true,
),
'title' => array(),
'tr' => array(
'align' => true,
'bgcolor' => true,
'char' => true,
'charoff' => true,
'valign' => true,
),
'track' => array(
'default' => true,
'kind' => true,
'label' => true,
'src' => true,
'srclang' => true,
),
'tt' => array(),
'u' => array(),
'ul' => array(
'type' => true,
),
'ol' => array(
'start' => true,
'type' => true,
'reversed' => true,
),
'var' => array(),
'video' => array(
'autoplay' => true,
'controls' => true,
'height' => true,
'loop' => true,
'muted' => true,
'playsinline' => true,
'poster' => true,
'preload' => true,
'src' => true,
'width' => true,
),
);
$wpAllowedposttags = array_map(function ($value) {
$global_attributes = array(
'aria-describedby' => true,
'aria-details' => true,
'aria-label' => true,
'aria-labelledby' => true,
'aria-hidden' => true,
'class' => true,
'data-*' => true,
'dir' => true,
'id' => true,
'lang' => true,
'style' => true,
'title' => true,
'role' => true,
'xml:lang' => true,
);
if (true === $value) {
$value = array();
}
if (is_array($value)) {
return array_merge($value, $global_attributes);
}
return $value;
}, $wpAllowedposttags);
self::$basicTags = array_merge_recursive($_allowedposttags, $wpAllowedposttags, array(
'div' => array(
'style' => true,
),
'script' => array(),
));
self::$adminTemplateTags = array_merge_recursive(self::$basicTags, array(
'svg' => array(
'xmlns' => true,
'width' => true,
'height' => true,
),
'path' => array(
'fill' => true,
'd' => true,
),
'a' => array(
'tabindex' => true,
'onclick' => true,
),
));
self::$adminFormTags = array_merge_recursive(self::$basicTags, array(
'input' => array(
'id' => true,
'name' => true,
'value' => true,
'type' => true,
'autocomplete' => true,
'style' => true,
),
'div' => array(
'aria-checked' => true,
'tabindex' => true,
),
'a' => array(
'tabindex' => true,
),
'select' => array(
'id' => true,
'name' => true,
'aria-labelledby' => true,
'autocomplete' => true,
'multiple' => true,
'size' => true,
),
'option' => array(
'value' => true,
'selected' => true,
),
'optgroup' => array(
'label' => true
),
'textarea' => array(
'autocomplete' => true,
),
));
self::$assetTags = array(
'style' => array(
'data-related' => true,
),
'link' => array(
'rel' => true,
'type' => true,
'href' => true,
'media' => true,
),
'script' => array(
'src' => true,
'defer' => true,
'async' => true,
),
);
self::$videoTags = array(
'video' => array(
'muted' => true,
'loop' => true,
'class' => true,
'style' => true,
'playsinline' => true,
'webkit-playsinline' => true,
'data-*' => true,
'preload' => true,
),
'source' => array(
'src' => true,
'type' => true,
)
);
}
public static function esc_js_filter($safe_text, $text) {
$safe_text = wp_check_invalid_utf8($text);
return $safe_text;
}
} Settings.php 0000644 00000003272 15235523331 0007063 0 ustar 00 <?php
namespace Nextend\Framework;
use Nextend\Framework\Model\Section;
class Settings {
private static $data;
public function __construct() {
$config = array(
'jquery' => 1,
'scriptattributes' => '',
'javascript-inline' => 'head',
'protocol-relative' => 1,
'force-english-backend' => 0,
'frontend-accessibility' => 1,
'curl' => 1,
'curl-clean-proxy' => 0,
'async-non-primary-css' => 0,
'icon-fa' => 1,
'header-preload' => 0
);
if (!defined('NEXTEND_INSTALL')) {
foreach (Section::getAll('system', 'global') as $data) {
$config[$data['referencekey']] = $data['value'];
}
}
self::$data = new Data\Data();
self::$data->loadArray($config);
}
public static function get($key, $default = '') {
return self::$data->get($key, $default);
}
public static function getAll() {
return self::$data->toArray();
}
public static function set($key, $value) {
self::$data->set($key, $value);
Section::set('system', 'global', $key, $value, 1, 1);
}
public static function setAll($data) {
if (is_array($data)) {
foreach ($data as $key => $value) {
if (self::$data->get($key, null) !== null) {
self::set($key, $value);
}
}
return true;
}
return false;
}
}
new Settings(); Visual/AbstractBlockVisual.php 0000644 00000000240 15235523331 0012420 0 ustar 00 <?php
namespace Nextend\Framework\Visual;
use Nextend\Framework\View\AbstractBlock;
abstract class AbstractBlockVisual extends AbstractBlock {
} Visual/ModelVisual.php 0000644 00000006026 15235523331 0010752 0 ustar 00 <?php
namespace Nextend\Framework\Visual;
use Nextend\Framework\Model\AbstractModel;
use Nextend\Framework\Model\ApplicationSection;
use Nextend\Framework\Model\StorageSectionManager;
class ModelVisual extends AbstractModel {
protected $type = '';
/** @var ApplicationSection */
protected $storage;
protected function init() {
$this->storage = StorageSectionManager::getStorage('system');
}
public function getType() {
return $this->type;
}
public function renderSetsForm() {
}
public function getSets() {
return $this->storage->getAll($this->type . 'set');
}
public function getSetByVisualId($visualId) {
$visual = $this->storage->getById($visualId, $this->type);
if (!empty($visual)) {
return array(
'setId' => $visual['referencekey'],
'visuals' => $this->getVisuals($visual['referencekey'])
);
}
return false;
}
public function createSet($name) {
$setId = $this->storage->add($this->type . 'set', '', $name);
$set = $this->storage->getById($setId, $this->type . 'set');
if (!empty($set) && $set['section'] == $this->type . 'set') {
return $set;
}
return false;
}
public function renameSet($setId, $name) {
$set = $this->storage->getById($setId, $this->type . 'set');
if (!empty($set) && $set['section'] == $this->type . 'set' && $set['editable']) {
if ($this->storage->setById($setId, $name)) {
$set['value'] = $name;
return $set;
}
}
return false;
}
public function deleteSet($setId) {
$set = $this->storage->getById($setId, $this->type . 'set');
if (!empty($set) && $set['section'] == $this->type . 'set' && $set['editable'] && $set['isSystem'] == 0) {
if ($this->storage->deleteById($setId)) {
return $set;
}
}
return false;
}
public function addVisual($setId, $visual) {
$visualId = $this->storage->add($this->type, $setId, $visual);
$visual = $this->storage->getById($visualId, $this->type);
if (!empty($visual) && $visual['section'] == $this->type) {
return $visual;
}
return false;
}
public function deleteVisual($id) {
$visual = $this->storage->getById($id, $this->type);
if (!empty($visual) && $visual['section'] == $this->type) {
$this->storage->deleteById($id);
return $visual;
}
return false;
}
public function changeVisual($id, $value) {
if ($this->storage->setById($id, $value)) {
return $this->storage->getById($id, $this->type);
}
return false;
}
public function getVisuals($setId) {
return $this->storage->getAll($this->type, $setId);
}
} View/AbstractBlock.php 0000644 00000001620 15235523331 0010706 0 ustar 00 <?php
namespace Nextend\Framework\View;
use Nextend\Framework\Pattern\GetPathTrait;
use Nextend\Framework\Pattern\MVCHelperTrait;
abstract class AbstractBlock {
use GetPathTrait;
use MVCHelperTrait;
/**
* AbstractBlock constructor.
*
* @param MVCHelperTrait $MVCHelper
*/
final public function __construct($MVCHelper) {
$this->setMVCHelper($MVCHelper);
$this->init();
}
protected function init() {
}
protected function renderTemplatePart($templateName) {
include self::getPath() . '/' . $templateName . '.php';
}
/**
* Returns the HTML code of the display method
*
* @return string
*/
public function toHTML() {
ob_start();
$this->display();
return ob_get_clean();
}
public abstract function display();
} View/AbstractLayout.php 0000644 00000003735 15235523331 0011142 0 ustar 00 <?php
namespace Nextend\Framework\View;
use Nextend\Framework\Pattern\GetPathTrait;
use Nextend\Framework\Pattern\MVCHelperTrait;
use Nextend\Framework\Sanitize;
abstract class AbstractLayout {
use GetPathTrait;
use MVCHelperTrait;
/** @var AbstractView */
protected $view;
/**
* @var AbstractBlock[]|string[]|array[]
*/
protected $contentBlocks = array();
protected $state = array();
/**
* AbstractLayout constructor.
*
* @param AbstractView $view
*
*/
public function __construct($view) {
$this->view = $view;
$this->setMVCHelper($view);
$this->getApplicationType()
->setLayout($this);
$this->enqueueAssets();
}
protected function enqueueAssets() {
$this->getApplicationType()
->enqueueAssets();
}
/**
* @param string $html contains already escaped data
*/
public function addContent($html) {
$this->contentBlocks[] = $html;
}
/**
* @param AbstractBlock $block contains already escaped data
*/
public function addContentBlock($block) {
$this->contentBlocks[] = $block;
}
public function displayContent() {
foreach ($this->contentBlocks as $content) {
if (is_string($content)) {
// PHPCS - Content already escaped
echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else if (is_array($content)) {
// PHPCS - Content already escaped
echo call_user_func_array($content[0], $content[1]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
$content->display();
}
}
}
public function setState($name, $value) {
$this->state[$name] = $value;
}
public abstract function render();
} View/AbstractView.php 0000644 00000002204 15235523331 0010565 0 ustar 00 <?php
namespace Nextend\Framework\View;
use Nextend\Framework\Controller\AbstractController;
use Nextend\Framework\Pattern\GetPathTrait;
use Nextend\Framework\Pattern\MVCHelperTrait;
abstract class AbstractView {
use GetPathTrait;
use MVCHelperTrait;
/** @var AbstractController */
protected $controller;
/** @var AbstractLayout */
protected $layout;
/**
* AbstractView constructor.
*
* @param AbstractController $controller
*
*/
public function __construct($controller) {
$this->controller = $controller;
$this->setMVCHelper($controller);
}
/**
* @param $templateName
*
* @return false|string output is a safe file, so nothing to escape.
*/
protected function render($templateName) {
ob_start();
include self::getPath() . '/Template/' . $templateName . '.php';
return ob_get_clean();
}
/**
* @return AbstractController
*/
public function getController() {
return $this->controller;
}
public abstract function display();
} View/AbstractViewAjax.php 0000644 00000001562 15235523331 0011377 0 ustar 00 <?php
namespace Nextend\Framework\View;
use Nextend\Framework\Controller\AbstractController;
use Nextend\Framework\Pattern\GetPathTrait;
use Nextend\Framework\Pattern\MVCHelperTrait;
abstract class AbstractViewAjax {
use GetPathTrait;
use MVCHelperTrait;
/** @var AbstractController */
protected $controller;
/**
* AbstractViewAjax constructor.
*
* @param AbstractController $controller
*
*/
public function __construct($controller) {
$this->controller = $controller;
$this->setMVCHelper($controller);
}
protected function render($templateName) {
ob_start();
include self::getPath() . '/Template/' . $templateName . '.php';
return ob_get_clean();
}
/**
* @return string
*/
public abstract function display();
} View/Html.php 0000644 00000025322 15235523331 0007101 0 ustar 00 <?php
namespace Nextend\Framework\View;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Settings;
class Html {
private static $closeSingleTags = true;
/**
* @var boolean whether to render special attributes value. Defaults to true. Can be set to false for HTML5.
* @since 1.1.13
*/
private static $renderSpecialAttributesValue = true;
/**
* Generates an HTML element.
*
* @param string $tag the tag name
* @param array $htmlOptions the element attributes. The values will be HTML-encoded using
* {@link encodeAttribute()}. If an 'encode' attribute is given and its value is false,
* the rest of the attribute values will NOT be HTML-encoded. Since version 1.1.5,
* attributes whose value is null will not be rendered.
* @param mixed $content the content to be enclosed between open and close element tags. It will not be
* HTML-encoded. If false, it means there is no body content.
* @param boolean $closeTag whether to generate the close tag.
*
* @return string the generated HTML element tag
*/
public static function tag($tag, $htmlOptions = array(), $content = "", $closeTag = true) {
$html = '<' . $tag . self::renderAttributes($htmlOptions);
if ($content === false) return $closeTag && self::$closeSingleTags ? $html . ' />' : $html . '>'; else
return $closeTag ? $html . '>' . $content . '</' . $tag . '>' : $html . '>' . $content;
}
/**
* Generates an open HTML element.
*
* @param string $tag the tag name
* @param array $htmlOptions the element attributes. The values will be HTML-encoded using
* {@link encodeAttribute()}.
* If an 'encode' attribute is given and its value is false,
* the rest of the attribute values will NOT be HTML-encoded.
* Since version 1.1.5, attributes whose value is null will not be rendered.
*
* @return string the generated HTML element tag
*/
public static function openTag($tag, $htmlOptions = array()) {
return '<' . $tag . self::renderAttributes($htmlOptions) . '>';
}
/**
* Generates a close HTML element.
*
* @param string $tag the tag name
*
* @return string the generated HTML element tag
*/
public static function closeTag($tag) {
return '</' . $tag . '>';
}
/**
* Generates an image tag.
*
* @param string $src the image URL
* @param string $alt the alternative text display
* @param array $htmlOptions additional HTML attributes (see {@link tag}).
*
* @return string the generated image tag
*/
public static function image($src, $alt = '', $htmlOptions = array()) {
$htmlOptions['src'] = $src;
$htmlOptions['alt'] = $alt;
return self::tag('img', $htmlOptions, false, false);
}
/**
* Renders the HTML tag attributes.
* Since version 1.1.5, attributes whose value is null will not be rendered.
* Special attributes, such as 'checked', 'disabled', 'readonly', will be rendered
* properly based on their corresponding boolean value.
*
* @param array $htmlOptions attributes to be rendered
*
* @return string the rendering result
*/
public static function renderAttributes($htmlOptions = array()) {
static $specialAttributes = array(
'autofocus' => 1,
'autoplay' => 1,
'controls' => 1,
'declare' => 1,
'default' => 1,
'disabled' => 1,
'ismap' => 1,
'loop' => 1,
'muted' => 1,
'playsinline' => 1,
'webkit-playsinline' => 1,
'nohref' => 1,
'noresize' => 1,
'novalidate' => 1,
'open' => 1,
'reversed' => 1,
'scoped' => 1,
'seamless' => 1,
'selected' => 1,
'typemustmatch' => 1,
'lazyload' => 1,
), $specialAttributesNoValue = array(
'defer' => 1,
'async' => 1
);
if (empty($htmlOptions)) {
return '';
}
if (isset($htmlOptions['style']) && empty($htmlOptions['style'])) {
unset($htmlOptions['style']);
}
$html = '';
if (isset($htmlOptions['encode'])) {
$raw = !$htmlOptions['encode'];
unset($htmlOptions['encode']);
} else
$raw = false;
foreach ($htmlOptions as $name => $value) {
if (isset($specialAttributes[$name])) {
if ($value) {
$html .= ' ' . $name;
if (self::$renderSpecialAttributesValue) $html .= '="' . $name . '"';
}
} else if (isset($specialAttributesNoValue[$name])) {
$html .= ' ' . $name;
} else if ($value !== null) $html .= ' ' . $name . '="' . ($raw ? $value : self::encodeAttribute($value)) . '"';
}
return $html;
}
/**
* @param $text
*
* @return string
*/
public static function encode($text) {
return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}
/**
* @param $text
*
* @return string
*/
public static function encodeAttribute($text) {
/**
* Do not encode: '
*/
return htmlspecialchars($text, ENT_COMPAT | ENT_HTML5, 'UTF-8');
}
public static function link($name, $url = '#', $htmlOptions = array()) {
$htmlOptions["href"] = $url;
$url = self::openTag("a", $htmlOptions);
if (isset($htmlOptions["encode"]) && $htmlOptions["encode"]) {
$url .= self::encode($name);
} else {
$url .= $name;
}
$url .= self::closeTag("a");
return $url;
}
/**
* Insert stylesheet
*
* @param string $script
* @param bool $file
* @param array $scriptOptions
*
* @return string
*/
public static function style($script, $file = false, $scriptOptions = array()) {
if ($file) {
$options = array(
"rel" => "stylesheet",
"type" => "text/css",
"href" => $script
);
$options = array_merge($options, $scriptOptions);
return self::tag('link', $options, false, false);
}
return self::tag("style", $scriptOptions, $script);
}
/**
* Insert script
*
* @param string $script
*
* @return string
*/
public static function script($script) {
return self::tag('script', array(
'encode' => false
), $script);
}
public static function scriptFile($script, $attributes = array()) {
return self::tag('script', array(
'src' => $script
) + self::getScriptAttributes() + $attributes, '');
}
private static function getScriptAttributes() {
static $attributes = null;
if (Platform::isAdmin()) {
return array();
}
if ($attributes === null) {
if (class_exists('\\Nextend\\Framework\\Settings', false)) {
$value = trim(html_entity_decode(strip_tags(Settings::get('scriptattributes', ''))));
$_attributes = explode(' ', str_replace(array(
'\'',
"\""
), "", str_replace(array(
"onload",
"onerror"
), "not-allowed", $value)));
if (!empty($value) && !empty($_attributes)) {
foreach ($_attributes as $attr) {
if (strpos($attr, '=') !== false) {
$atts = explode("=", $attr);
if (count($atts) <= 2) {
$attributes[$atts[0]] = $atts[1];
} else {
$attributes[$attr] = $attr;
}
} else {
$attributes[$attr] = $attr;
}
}
} else {
$attributes = array();
}
} else {
return array();
}
}
return $attributes;
}
/**
* @param array $array1
* @param array $array2 [optional]
* @param array $_ [optional]
*
* @return array the resulting array.
* @since 4.0
* @since 5.0
*/
public static function mergeAttributes($array1, $array2 = null, $_ = null) {
$arguments = func_get_args();
$target = array_shift($arguments);
foreach ($arguments as $array) {
if (isset($array['style'])) {
if (!isset($target['style'])) $target['style'] = '';
$target['style'] .= $array['style'];
unset($array['style']);
}
if (isset($array['class'])) {
if (empty($target['class'])) {
$target['class'] = $array['class'];
} else {
$target['class'] .= ' ' . $array['class'];
}
unset($array['class']);
}
$target = array_merge($target, $array);
}
return $target;
}
public static function addExcludeLazyLoadAttributes($target = array()) {
return self::mergeAttributes($target, self::getExcludeLazyLoadAttributes());
}
public static function getExcludeLazyLoadAttributes() {
static $attrs;
if ($attrs === null) {
$attrs = array(
'class' => 'skip-lazy',
'data-skip-lazy' => 1
);
if (defined('JETPACK__VERSION')) {
$attrs['class'] .= ' jetpack-lazy-image';
}
if (defined('PERFMATTERS_VERSION')) {
$attrs['class'] .= ' no-lazy';
}
}
return $attrs;
}
} Translation/AbstractTranslation.php 0000644 00000000341 15235523331 0013535 0 ustar 00 <?php
namespace Nextend\Framework\Translation;
abstract class AbstractTranslation {
public function _($text) {
return $text;
}
public function getLocale() {
return 'en_US';
}
} Translation/Translation.php 0000644 00000001150 15235523331 0012050 0 ustar 00 <?php
namespace Nextend\Framework\Translation;
use Nextend\Framework\Pattern\SingletonTrait;
class Translation {
use SingletonTrait;
/**
* @var AbstractTranslation
*/
private static $platformTranslation;
public function __construct() {
self::$platformTranslation = new Joomla\JoomlaTranslation();
}
public static function _($text) {
return self::$platformTranslation->_($text);
}
public static function getCurrentLocale() {
return self::$platformTranslation->getLocale();
}
}
Translation::getInstance(); Translation/Joomla/JoomlaTranslation.php 0000644 00000000476 15235523331 0014445 0 ustar 00 <?php
namespace Nextend\Framework\Translation\Joomla;
use Joomla\CMS\Factory;
use Nextend\Framework\Translation\AbstractTranslation;
class JoomlaTranslation extends AbstractTranslation {
public function getLocale() {
return Factory::getLanguage()
->getTag();
}
} Url/AbstractPlatformUrl.php 0000644 00000004324 15235523331 0011757 0 ustar 00 <?php
namespace Nextend\Framework\Url;
use Nextend\Framework\Filesystem\Filesystem;
abstract class AbstractPlatformUrl {
public $uris = array();
protected $siteUrl;
/**
* @var string It can be relative or absolute uri. It must not end with /
* @example https://asd.com/wordpress
* @example /wordpress
*/
protected $_baseuri;
protected $_currentbase = '';
protected $scheme = 'http';
public function getUris() {
return $this->uris;
}
protected function getUriByIndex($i, $protocol = true) {
if (!$protocol) {
return preg_replace('/^http:/', '', $this->uris[$i]);
}
return $this->uris[$i];
}
public function setBaseUri($uri) {
$this->_baseuri = $uri;
}
public function getSiteUri() {
return $this->siteUrl;
}
public function getBaseUri() {
return $this->_baseuri;
}
public function getFullUri() {
return $this->_baseuri;
}
public function pathToUri($path, $protocol = true) {
$from = array();
$to = array();
$basePath = Filesystem::getBasePath();
if ($basePath != '/' && $basePath != "\\") {
$from[] = $basePath;
$to[] = '';
}
$from[] = DIRECTORY_SEPARATOR;
$to[] = '/';
return ($protocol ? $this->_baseuri : preg_replace('/^http:/', '', $this->_baseuri)) . str_replace($from, $to, str_replace('/', DIRECTORY_SEPARATOR, $path));
}
public function ajaxUri($query = '') {
return $this->_baseuri;
}
public function fixrelative($uri) {
if (substr($uri, 0, 1) == '/' || strpos($uri, '://') !== false) return $uri;
return $this->_baseuri . $uri;
}
public function relativetoabsolute($uri) {
if (strpos($uri, '://') !== false) return $uri;
if (!empty($this->_baseuri) && strpos($uri, $this->_baseuri) === 0) {
$uri = substr($uri, strlen($this->_baseuri));
}
return $this->_currentbase . $uri;
}
public function addScheme($url) {
return $this->scheme . ':' . $url;
}
} Url/Url.php 0000644 00000003115 15235523331 0006563 0 ustar 00 <?php
namespace Nextend\Framework\Url;
use Nextend\Framework\Url\Joomla\JoomlaUrl;
use Nextend\Framework\Url\WordPress\WordPressUrl;
class Url {
/**
* @var AbstractPlatformUrl
*/
private static $platformUrl;
public function __construct() {
self::$platformUrl = new JoomlaUrl();
}
/**
* @return AbstractPlatformUrl
*/
public static function get() {
return self::$platformUrl;
}
public static function getUris() {
return self::$platformUrl->getUris();
}
public static function setBaseUri($uri) {
self::$platformUrl->setBaseUri($uri);
}
public static function getSiteUri() {
return self::$platformUrl->getSiteUri();
}
public static function getBaseUri() {
return self::$platformUrl->getBaseUri();
}
public static function getFullUri() {
return self::$platformUrl->getFullUri();
}
public static function pathToUri($path, $protocol = true) {
return self::$platformUrl->pathToUri($path, $protocol);
}
public static function ajaxUri($query = '') {
return self::$platformUrl->ajaxUri($query);
}
public static function fixrelative($uri) {
return self::$platformUrl->fixrelative($uri);
}
public static function relativetoabsolute($uri) {
return self::$platformUrl->relativetoabsolute($uri);
}
public static function addScheme($url) {
return self::$platformUrl->addScheme($url);
}
}
new Url(); Url/UrlHelper.php 0000644 00000022410 15235523331 0007722 0 ustar 00 <?php
namespace Nextend\Framework\Url;
use Nextend\Framework\Request\Request;
class UrlHelper {
/**
* Retrieves a modified URL query string.
*
* You can rebuild the URL and append query variables to the URL query by using this function.
* There are two ways to use this function; either a single key and value, or an associative array.
*
* Using a single key and value:
*
* add_query_arg( 'key', 'value', 'http://example.com' );
*
* Using an associative array:
*
* add_query_arg( array(
* 'key1' => 'value1',
* 'key2' => 'value2',
* ), 'http://example.com' );
*
* Omitting the URL from either use results in the current URL being used
* (the value of `$_SERVER['REQUEST_URI']`).
*
* Values are expected to be encoded appropriately with urlencode() or rawurlencode().
*
* Setting any query variable's value to boolean false removes the key (see remove_query_arg()).
*
* Important: The return value of add_query_arg() is not escaped by default. Output should be
* late-escaped with esc_url() or similar to help prevent vulnerability to cross-site scripting
* (XSS) attacks.
*
* @param string|array $key Either a query variable key, or an associative array of query variables.
* @param string $value Optional. Either a query variable value, or a URL to act upon.
* @param string $url Optional. A URL to act upon.
*
* @return string New URL query string (unescaped).
*
*/
public static function add_query_arg() {
$args = func_get_args();
if (is_array($args[0])) {
if (count($args) < 2 || false === $args[1]) {
$uri = Request::$SERVER->getVar('REQUEST_URI');
} else {
$uri = $args[1];
}
} else {
if (count($args) < 3 || false === $args[2]) {
$uri = Request::$SERVER->getVar('REQUEST_URI');
} else {
$uri = $args[2];
}
}
if ($frag = strstr($uri, '#')) {
$uri = substr($uri, 0, -strlen($frag));
} else {
$frag = '';
}
if (0 === stripos($uri, 'http://')) {
$protocol = 'http://';
$uri = substr($uri, 7);
} elseif (0 === stripos($uri, 'https://')) {
$protocol = 'https://';
$uri = substr($uri, 8);
} else {
$protocol = '';
}
if (strpos($uri, '?') !== false) {
list($base, $query) = explode('?', $uri, 2);
$base .= '?';
} elseif ($protocol || strpos($uri, '=') === false) {
$base = $uri . '?';
$query = '';
} else {
$base = '';
$query = $uri;
}
self::wp_parse_str($query, $qs);
$qs = self::urlencode_deep($qs); // this re-URL-encodes things that were already in the query string
if (is_array($args[0])) {
foreach ($args[0] as $k => $v) {
$qs[$k] = $v;
}
} else {
$qs[$args[0]] = $args[1];
}
foreach ($qs as $k => $v) {
if ($v === false) {
unset($qs[$k]);
}
}
$ret = self::build_query($qs);
$ret = trim($ret, '?');
$ret = preg_replace('#=(&|$)#', '$1', $ret);
$ret = $protocol . $base . $ret . $frag;
$ret = rtrim($ret, '?');
return $ret;
}
private static function wp_parse_str($string, &$array) {
parse_str($string, $array);
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
if (get_magic_quotes_gpc()) {
$array = self::stripslashes_deep($array);
}
}
}
static function urlencode_deep($value) {
return self::map_deep($value, 'urlencode');
}
/**
* Build URL query based on an associative and, or indexed array.
*
* This is a convenient function for easily building url queries. It sets the
* separator to '&' and uses _http_build_query() function.
*
* @param array $data URL-encode key/value pairs.
*
* @return string URL-encoded string.
* @link https://secure.php.net/manual/en/function.http-build-query.php for more on what
* http_build_query() does.
*
* @since 2.3.0
*
* @see _http_build_query() Used to build the query
*/
private static function build_query($data) {
return self::_http_build_query($data, null, '&', '', false);
}
/**
* From php.net (modified by Mark Jaquith to behave like the native PHP5 function).
*
* @param array|object $data An array or object of data. Converted to array.
* @param string $prefix Optional. Numeric index. If set, start parameter numbering with it.
* Default null.
* @param string $sep Optional. Argument separator; defaults to 'arg_separator.output'.
* Default null.
* @param string $key Optional. Used to prefix key name. Default empty.
* @param bool $urlencode Optional. Whether to use urlencode() in the result. Default true.
*
* @return string The query string.
* @since 3.2.0
* @access private
*
* @see https://secure.php.net/manual/en/function.http-build-query.php
*
*/
private static function _http_build_query($data, $prefix = null, $sep = null, $key = '', $urlencode = true) {
$ret = array();
foreach ((array)$data as $k => $v) {
if ($urlencode) {
$k = urlencode($k);
}
if (is_int($k) && $prefix != null) {
$k = $prefix . $k;
}
if (!empty($key)) {
$k = $key . '%5B' . $k . '%5D';
}
if ($v === null) {
continue;
} elseif ($v === false) {
$v = '0';
}
if (is_array($v) || is_object($v)) {
array_push($ret, self::_http_build_query($v, '', $sep, $k, $urlencode));
} elseif ($urlencode) {
array_push($ret, $k . '=' . urlencode($v));
} else {
array_push($ret, $k . '=' . $v);
}
}
if (null === $sep) {
$sep = ini_get('arg_separator.output');
}
return implode($sep, $ret);
}
/**
* Parses a string into variables to be stored in an array.
*
* Uses {@link https://secure.php.net/parse_str parse_str()} and stripslashes if
* {@link https://secure.php.net/magic_quotes magic_quotes_gpc} is on.
*
* @param string $string The string to be parsed.
* @param array $array Variables will be stored in this array.
*
* @since 2.2.1
*
*/
private static function parse_str($string, &$array) {
parse_str($string, $array);
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
if (get_magic_quotes_gpc()) {
$array = self::stripslashes_deep($array);
}
}
}
/**
* Navigates through an array, object, or scalar, and removes slashes from the values.
*
* @param mixed $value The value to be stripped.
*
* @return mixed Stripped value.
* @since 2.0.0
*
*/
private static function stripslashes_deep($value) {
return self::map_deep($value, array(
self::class,
'stripslashes_from_strings_only'
));
}
/**
* Callback function for `stripslashes_deep()` which strips slashes from strings.
*
* @param mixed $value The array or string to be stripped.
*
* @return mixed $value The stripped value.
* @since 4.4.0
*
*/
public static function stripslashes_from_strings_only($value) {
return is_string($value) ? stripslashes($value) : $value;
}
/**
* Maps a function to all non-iterable elements of an array or an object.
*
* This is similar to `array_walk_recursive()` but acts upon objects too.
*
* @param mixed $value The array, object, or scalar.
* @param callable $callback The function to map onto $value.
*
* @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
* @since 4.4.0
*
*/
private static function map_deep($value, $callback) {
if (is_array($value)) {
foreach ($value as $index => $item) {
$value[$index] = self::map_deep($item, $callback);
}
} elseif (is_object($value)) {
$object_vars = get_object_vars($value);
foreach ($object_vars as $property_name => $property_value) {
$value->$property_name = self::map_deep($property_value, $callback);
}
} else {
$value = call_user_func($callback, $value);
}
return $value;
}
} Url/Joomla/JoomlaUrl.php 0000644 00000001241 15235523331 0011144 0 ustar 00 <?php
namespace Nextend\Framework\Url\Joomla;
use Joomla\CMS\Uri\Uri;
use Nextend\Framework\Url\AbstractPlatformUrl;
class JoomlaUrl extends AbstractPlatformUrl {
private $fullUri;
function __construct() {
$this->siteUrl = Uri::root();
$this->fullUri = rtrim(Uri::root(), '/');
$this->_baseuri = rtrim(Uri::root(true), '/');
$this->_currentbase = $this->fullUri;
$this->scheme = parse_url($this->fullUri, PHP_URL_SCHEME);
}
public function getFullUri() {
return $this->fullUri;
}
public function ajaxUri($query = '') {
return Uri::current();
}
} Style/ControllerAjaxStyle.php 0000644 00000000474 15235523331 0012334 0 ustar 00 <?php
namespace Nextend\Framework\Style;
use Nextend\Framework\Controller\Admin\AdminVisualManagerAjaxController;
class ControllerAjaxStyle extends AdminVisualManagerAjaxController {
protected $type = 'style';
public function getModel() {
return new ModelStyle($this);
}
} Style/ModelCss.php 0000644 00000002332 15235523331 0010070 0 ustar 00 <?php
namespace Nextend\Framework\Style;
use Nextend\Framework\Model\AbstractModel;
use Nextend\Framework\Model\StorageSectionManager;
class ModelCss extends AbstractModel {
public $storage;
protected function init() {
$this->storage = StorageSectionManager::getStorage('system');
}
public function addVisual($type, $visual) {
$visualId = $this->storage->add($type, '', $visual);
$visual = $this->storage->getById($visualId, $type);
if (!empty($visual) && $visual['section'] == $type) {
return $visual;
}
return false;
}
public function deleteVisual($type, $id) {
$visual = $this->storage->getById($id, $type);
if (!empty($visual) && $visual['section'] == $type) {
$this->storage->deleteById($id);
return $visual;
}
return false;
}
public function changeVisual($type, $id, $value) {
if ($this->storage->setById($id, $value)) {
return $this->storage->getById($id, $type);
}
return false;
}
public function getVisuals($type) {
return $this->storage->getAll($type);
}
} Style/ModelStyle.php 0000644 00000005762 15235523331 0010452 0 ustar 00 <?php
namespace Nextend\Framework\Style;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Button;
use Nextend\Framework\Form\Element\MarginPadding;
use Nextend\Framework\Form\Element\MixedField;
use Nextend\Framework\Form\Element\Tab;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Element\Textarea;
use Nextend\Framework\Form\Element\Unit;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Visual\ModelVisual;
class ModelStyle extends ModelVisual {
protected $type = 'style';
public function renderForm() {
$form = new Form($this, 'n2-style-editor');
$table = new ContainerTable($form->getContainer(), 'style', n2_('Style settings'));
$table->setFieldsetPositionEnd();
new Button($table->getFieldsetLabel(), 'style-clear-tab', false, n2_('Clear tab'));
new Tab($table->getFieldsetLabel(), 'style-state');
$row1 = $table->createRow('style-row-1');
new Color($row1, 'backgroundcolor', n2_('Background color'), '000000FF', array(
'alpha' => true
));
new NumberAutoComplete($row1, 'opacity', n2_('Opacity'), '100', array(
'values' => array(
0,
50,
90,
100
),
'unit' => '%',
'wide' => 3
));
$padding = new MarginPadding($row1, 'padding', n2_('Padding'), '0|*|0|*|0|*|0|*|px');
for ($i = 1; $i < 5; $i++) {
new NumberAutoComplete($padding, 'padding-' . $i, false, '', array(
'values' => array(
0,
5,
10,
20,
30
),
'wide' => 3
));
}
new Unit($padding, 'padding-5', '', '', array(
'units' => array(
'px',
'em',
'%'
)
));
new MixedField\Border($row1, 'border', n2_('Border'), '0|*|solid|*|000000ff');
new NumberAutoComplete($row1, 'borderradius', n2_('Border radius'), '0', array(
'values' => array(
0,
3,
5,
10,
99
),
'unit' => 'px',
'wide' => 3
));
new MixedField\BoxShadow($row1, 'boxshadow', n2_('Box shadow'), '0|*|0|*|0|*|0|*|000000ff');
new Textarea($row1, 'extracss', 'CSS', '', array(
'width' => 200,
'height' => 26
));
$previewTable = new ContainerTable($form->getContainer(), 'style-preview', n2_('Preview'));
$previewTable->setFieldsetPositionEnd();
new Color($previewTable->getFieldsetLabel(), 'preview-background', false, 'ced3d5');
$form->render();
}
} Style/Style.php 0000644 00000005432 15235523331 0007463 0 ustar 00 <?php
namespace Nextend\Framework\Style;
use Nextend\Framework\Parser\Color;
use Nextend\Framework\Sanitize;
class Style {
/**
* @param string $tab
*
* @return string
*/
public function style($tab) {
$style = '';
$extra = '';
if (isset($tab['extra'])) {
$extra = $tab['extra'];
unset($tab['extra']);
}
foreach ($tab as $k => $v) {
$style .= $this->parse($k, $v);
}
$style .= $this->parse('extra', $extra);
return $style;
}
/**
* @param $property
* @param $value
*
* @return mixed
*/
public function parse($property, $value) {
$fn = 'parse' . $property;
return $this->$fn($value);
}
public function parseBackgroundColor($v) {
$hex = Color::hex82hex($v);
if ($hex[1] == 'ff') {
return 'background: #' . $hex[0] . ';';
}
$rgba = Color::hex2rgba($v);
return 'background: RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ');';
}
public function parseOpacity($v) {
return 'opacity:' . (intval($v) / 100) . ';';
}
public function parsePadding($v) {
$padding = array_map(array(
Sanitize::class,
'esc_css_value'
), explode('|*|', $v));
$unit = array_pop($padding);
$padding[] = '';
return 'padding:' . implode($unit . ' ', $padding) . ';';
}
public function parseBoxShadow($v) {
$boxShadow = array_map(array(
Sanitize::class,
'esc_css_value'
), explode('|*|', $v));
if ($boxShadow[0] == '0' && $boxShadow[1] == '0' && $boxShadow[2] == '0' && $boxShadow[3] == '0') {
return 'box-shadow: none;';
} else {
$rgba = Color::hex2rgba($boxShadow[4]);
return 'box-shadow: ' . $boxShadow[0] . 'px ' . $boxShadow[1] . 'px ' . $boxShadow[2] . 'px ' . $boxShadow[3] . 'px RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ');';
}
}
public function parseBorder($v) {
$border = array_map(array(
Sanitize::class,
'esc_css_value'
), explode('|*|', $v));
$rgba = Color::hex2rgba($border[2]);
return 'border: ' . $border[0] . 'px ' . $border[1] . ' RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ');';
}
public function parseBorderRadius($v) {
return 'border-radius:' . Sanitize::esc_css_value($v) . 'px;';
}
public function parseExtra($v) {
return Sanitize::esc_css_string($v);
}
} Style/StyleManager.php 0000644 00000000572 15235523331 0010756 0 ustar 00 <?php
namespace Nextend\Framework\Style;
use Nextend\Framework\Pattern\VisualManagerTrait;
use Nextend\Framework\Style\Block\StyleManager\BlockStyleManager;
class StyleManager {
use VisualManagerTrait;
public function display() {
$fontManagerBlock = new BlockStyleManager($this->MVCHelper);
$fontManagerBlock->display();
}
} Style/StyleParser.php 0000644 00000002540 15235523331 0010635 0 ustar 00 <?php
namespace Nextend\Framework\Style;
use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Model\Section;
class StyleParser {
/**
* @param $data
*
* @return string
*/
public static function parse($data) {
if (empty($data)) {
return '';
} else if (is_numeric($data)) {
/**
* Linked style
*/
$style = Section::getById($data, 'style');
if (!$style) {
/**
* Linked style not exists anymore
*/
return '';
}
if (is_string($style['value'])) {
/**
* Old format when value stored as Base64
*/
$decoded = $style['value'];
if ($decoded[0] != '{') {
$decoded = Base64::decode($decoded);
}
return $decoded;
}
/**
* Value stored as array
*/
$value = json_encode($style['value']);
if ($value == false) {
return '';
}
return $value;
} else if ($data[0] != '{') {
return Base64::decode($data);
}
return $data;
}
} Style/StyleStorage.php 0000644 00000004647 15235523331 0011017 0 ustar 00 <?php
namespace Nextend\Framework\Style;
use Nextend\Framework\Pattern\SingletonTrait;
use Nextend\Framework\Plugin;
class StyleStorage {
use SingletonTrait;
private $sets = array();
private $styles = array();
private $stylesBySet = array();
private $stylesById = array();
protected function init() {
Plugin::addAction('systemstyleset', array(
$this,
'styleSet'
));
Plugin::addAction('systemstyle', array(
$this,
'styles'
));
Plugin::addAction('style', array(
$this,
'style'
));
}
private function load() {
static $loaded;
if (!$loaded) {
Plugin::doAction('styleStorage', array(
&$this->sets,
&$this->styles
));
for ($i = 0; $i < count($this->styles); $i++) {
if (!isset($this->stylesBySet[$this->styles[$i]['referencekey']])) {
$this->stylesBySet[$this->styles[$i]['referencekey']] = array();
}
$this->stylesBySet[$this->styles[$i]['referencekey']][] = &$this->styles[$i];
$this->stylesById[$this->styles[$i]['id']] = &$this->styles[$i];
}
$loaded = true;
}
}
public function styleSet($referenceKey, &$sets) {
$this->load();
for ($i = count($this->sets) - 1; $i >= 0; $i--) {
$this->sets[$i]['isSystem'] = 1;
$this->sets[$i]['editable'] = 0;
array_unshift($sets, $this->sets[$i]);
}
}
public function styles($referenceKey, &$styles) {
$this->load();
if (isset($this->stylesBySet[$referenceKey])) {
$_styles = &$this->stylesBySet[$referenceKey];
for ($i = count($_styles) - 1; $i >= 0; $i--) {
$_styles[$i]['isSystem'] = 1;
$_styles[$i]['editable'] = 0;
array_unshift($styles, $_styles[$i]);
}
}
}
public function style($id, &$style) {
$this->load();
if (isset($this->stylesById[$id])) {
$this->stylesById[$id]['isSystem'] = 1;
$this->stylesById[$id]['editable'] = 0;
$style = $this->stylesById[$id];
}
}
} Style/StyleRenderer.php 0000644 00000017736 15235523331 0011164 0 ustar 00 <?php
namespace Nextend\Framework\Style;
use Nextend\Framework\Settings;
class StyleRenderer {
public static $pre = '';
/**
* @var Style
*/
public static $style;
public static $mode;
public static function render($style, $mode, $pre = '') {
self::$pre = $pre;
if (!empty($style)) {
$value = json_decode($style, true);
if ($value) {
$selector = 'n2-style-' . md5($style) . '-' . $mode;
return array(
$selector . ' ',
self::renderStyle($mode, $pre, $selector, $value['data'])
);
}
}
return false;
}
private static function renderStyle($mode, $pre, $selector, $tabs) {
$search = array(
'@pre',
'@selector'
);
$replace = array(
$pre,
'.' . $selector
);
$tabs[0] = array_merge(array(
'backgroundcolor' => 'ffffff00',
'opacity' => 100,
'padding' => '0|*|0|*|0|*|0|*|px',
'boxshadow' => '0|*|0|*|0|*|0|*|000000ff',
'border' => '0|*|solid|*|000000ff',
'borderradius' => '0',
'extra' => '',
), $tabs[0]);
foreach ($tabs as $k => $tab) {
$search[] = '@tab' . $k;
$replace[] = self::$style->style($tab);
}
$template = '';
foreach (self::$mode[$mode]['selectors'] as $s => $style) {
$key = array_search($style, $search);
if (is_numeric($key) && !empty($replace[$key])) {
$template .= $s . "{" . $style . "}";
}
}
return str_replace($search, $replace, $template);
}
}
$frontendAccessibility = intval(Settings::get('frontend-accessibility', 1));
StyleRenderer::$mode = array(
'0' => array(
'id' => '0',
'label' => n2_('Single'),
'tabs' => array(
n2_('Text')
),
'renderOptions' => array(
'combined' => false
),
'preview' => '<div class="{styleClassName}">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>',
'selectors' => array(
'@pre@selector' => '@tab'
)
),
'simple' => array(
'id' => 'simple',
'label' => n2_('Simple'),
'tabs' => array(
n2_('Normal')
),
'renderOptions' => array(
'combined' => true
),
'preview' => '<div class="{styleClassName}" style="width: 200px; height:100px;"></div>',
'selectors' => array(
'@pre@selector' => '@tab0'
)
),
'box' => array(
'id' => 'box',
'label' => n2_('Box'),
'tabs' => array(
n2_('Normal'),
n2_('Hover')
),
'renderOptions' => array(
'combined' => true
),
'preview' => '<div class="{styleClassName}" style="width: 200px; height:100px;"></div>',
'selectors' => array(
'@pre@selector' => '@tab0',
'@pre@selector:HOVER' => '@tab1'
)
),
'button' => array(
'id' => 'button',
'label' => n2_('Button'),
'tabs' => array(
n2_('Normal'),
n2_('Hover')
),
'renderOptions' => array(
'combined' => true
),
'preview' => '<div><a style="display:inline-block; margin:20px;" class="{styleClassName}" href="#" onclick="return false;">Button</a></div>',
'selectors' => $frontendAccessibility ? array(
'@pre@selector' => '@tab0',
'@pre@selector:Hover, @pre@selector:ACTIVE, @pre@selector:FOCUS' => '@tab1'
) : array(
'@pre@selector, @pre@selector:FOCUS' => '@tab0',
'@pre@selector:Hover, @pre@selector:ACTIVE' => '@tab1'
)
),
'heading' => array(
'id' => 'heading',
'label' => n2_('Heading'),
'tabs' => array(
n2_('Normal'),
n2_('Hover')
),
'renderOptions' => array(
'combined' => true
),
'preview' => '<div class="{styleClassName}">Heading</div>',
'selectors' => $frontendAccessibility ? array(
'@pre@selector' => '@tab0',
'@pre@selector:Hover, @pre@selector:ACTIVE, @pre@selector:FOCUS' => '@tab1'
) : array(
'@pre@selector, @pre@selector:FOCUS' => '@tab0',
'@pre@selector:Hover, @pre@selector:ACTIVE' => '@tab1'
)
),
'heading-active' => array(
'id' => 'heading-active',
'label' => n2_('Heading active'),
'tabs' => array(
n2_('Normal'),
n2_('Active')
),
'renderOptions' => array(
'combined' => true
),
'preview' => '<div class="{styleClassName}">Heading</div>',
'selectors' => array(
'@pre@selector' => '@tab0',
'@pre@selector.n2-active' => '@tab1'
)
),
'dot' => array(
'id' => 'dot',
'label' => n2_('Dot'),
'tabs' => array(
n2_('Normal'),
n2_('Active')
),
'renderOptions' => array(
'combined' => true
),
'preview' => '<div><div class="{styleClassName}" style="display: inline-block; margin: 3px;"></div><div class="{styleClassName} n2-active" style="display: inline-block; margin: 3px;"></div><div class="{styleClassName}" style="display: inline-block; margin: 3px;"></div></div>',
'selectors' => array(
'@pre@selector' => '@tab0',
'@pre@selector.n2-active, @pre@selector:HOVER, @pre@selector:FOCUS' => '@tab1'
)
),
'highlight' => array(
'id' => 'highlight',
'label' => n2_('Highlight'),
'tabs' => array(
n2_('Normal'),
n2_('Highlight'),
n2_('Hover')
),
'renderOptions' => array(
'combined' => true
),
'preview' => '<div class="{fontClassName}">' . n2_('Button') . '</div>',
'selectors' => $frontendAccessibility ? array(
'@pre@selector' => '@tab0',
'@pre@selector .n2-highlighted' => '@tab1',
'@pre@selector .n2-highlighted:HOVER, @pre@selector .n2-highlighted:ACTIVE, @pre@selector .n2-highlighted:FOCUS' => '@tab2'
) : array(
'@pre@selector' => '@tab0',
'@pre@selector .n2-highlighted, @pre@selector .n2-highlighted:FOCUS' => '@tab1',
'@pre@selector .n2-highlighted:HOVER, @pre@selector .n2-highlighted:ACTIVE' => '@tab2'
)
),
);
StyleRenderer::$style = new Style(); Style/Block/StyleManager/Index.php 0000644 00000001532 15235523331 0013054 0 ustar 00 <?php
namespace Nextend\Framework\Style\Block\StyleManager;
/**
* @var BlockStyleManager $this
*/
?>
<div id="n2-lightbox-style" class="n2_fullscreen_editor">
<div class="n2_fullscreen_editor__overlay"></div>
<div class="n2_fullscreen_editor__window">
<div class="n2_fullscreen_editor__nav_bar">
<div class="n2_fullscreen_editor__nav_bar_label">
<?php n2_e('Style manager'); ?>
</div>
<div class="n2_fullscreen_editor__nav_bar_actions">
<?php $this->displayTopBar(); ?>
</div>
</div>
<div class="n2_fullscreen_editor__content">
<div class="n2_fullscreen_editor__content_content n2_container_scrollable">
<?php $this->displayContent(); ?>
</div>
</div>
</div>
</div>