This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** @var string $timeZone */ | |
$timeZone = 'Europe/Moscow'; | |
/** @var bool $displayErrors */ | |
$displayErrors = false; | |
/** @var array $mailConfig */ | |
$mailConfig = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ajax ({ // объект(!) | |
url, // url | |
type = 'GET', // *GET|POST | |
data = {}, // document.getElementById('formId') | FormData obj | serialized string | json | {} | |
dataType = 'json', // output format: *'json' | 'html' | 'formData' (FormData obj, return json from the backend!) | |
contentType = null, // Content-Type header string | |
before = () => {}, | |
success = (response) => {}, | |
error = (response, status) => {}, | |
after = () => {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* getDominantColor | |
* Получение доминантного цвета. Функция требует наличия библиотеки GD. | |
* | |
* @param string $fname полный путь к файлу относительно сервера | |
* @param bool $skipBlackAndWhite пропускать чисто белый и чисто чёрный тона | |
* @return array | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('mb_ord')) { | |
function mb_ord($string) | |
{ | |
if (extension_loaded('mbstring') === true) { | |
mb_language('Neutral'); | |
mb_internal_encoding('UTF-8'); | |
mb_detect_order(array('UTF-8', 'ISO-8859-15', 'ISO-8859-1', 'ASCII')); | |
$result = unpack('N', mb_convert_encoding($string, 'UCS-4BE', 'UTF-8')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function icontrim($str) | |
{ | |
$out = ''; | |
$split = 1; | |
$arr = []; | |
$excludes = [ | |
8211, // – shord dash | |
8212, // — long dash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="resultStats"> | |
<div class="resultMarquee">Прокручиваемый контент</div> | |
<div class="resultMarquee">Прокручиваемый контент</div> /* повторять много раз, если не умещается */ | |
</div> | |
<style> | |
.resultStats { | |
position: relative; | |
white-space: nowrap; | |
overflow: hidden; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); | |
foreach ($list as $item) { | |
$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true); | |
$fields = []; | |
foreach($item->jcfields as $jcfield) | |
{ | |
$fields[$jcfield->name] = $jcfield; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* getCacheSquaredImages square image cropping function | |
* | |
* (array) $imagesList unassociated array of images with relative paths from the site root folder | |
* (string) $pathCache image cache folder path relative to the root folder of the site | |
* (int) $sliderSquareSize image full square size | |
* (int) $thumbSqaureSize image thumbnail square size | |
* | |
* retunt (array) unassociated array, where each element is an array with relative folders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getReadingTime($content) | |
{ | |
$wordsPerMinuten = 200; // ru: слов в минуту | |
$secondsPerImage = 5; // ru: секунд на изображение | |
preg_match_all("~<img~i", $content, $resImgs); | |
$imgsTime = count($resImgs[0]) * $secondsPerImage; | |
$words = count(explode(' ', strip_tags(str_replace(["\n", '><'], ' ', $content)))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
// matches | |
if (!Element.prototype.matches) { | |
Element.prototype.matches = Element.prototype.matchesSelector || | |
Element.prototype.webkitMatchesSelector || | |
Element.prototype.mozMatchesSelector || | |
Element.prototype.msMatchesSelector; | |
} |
NewerOlder