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
// Получить все css на странице, записать их веса и даты в localstorage | |
// по таймеру делать head-запрос, сверять. Если изменился - добавлять в адрес гет-параметр | |
!function(){function n(){ | |
var whitelistDomains = [ | |
'allpans.su', | |
]; | |
var timeout = 700; |
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 | |
/** | |
* Пример кэширования для Wordpress | |
*/ | |
function foo($args = array()){ | |
// Проверяем и извлекаем кэш | |
if (!@$args['skip_cache']){ | |
$cache_lifetime = 60*60*24; | |
$cache_key = ''.__FUNCTION__.'_'.md5(serialize($args)); // can add prefix |
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 () { | |
if (!window['hdden_makeRequest']) { | |
window['hdden_makeRequest'] = hdden_makeRequest; | |
} | |
function hdden_makeRequest(method, url, data, headers, async, responseType) { | |
return new Promise(function (resolve, reject) { |
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
if (!window['hdden_JSON_to_URLEncoded']) { | |
window['hdden_JSON_to_URLEncoded'] = hdden_JSON_to_URLEncoded; | |
} | |
function hdden_JSON_to_URLEncoded(element, key, list) { | |
var list = list || []; | |
if (typeof (element) == 'object') { | |
for (var idx in element) | |
hdden_JSON_to_URLEncoded(element[idx], key ? key + '[' + idx + ']' : idx, list); | |
} else { | |
list.push(key + '=' + encodeURIComponent(element)); |
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
// Define page_id | |
$page_ID = get_the_ID(); | |
// Define paginated posts | |
$page = get_query_var( 'page' ); | |
// Define custom query parameters | |
$args = array( | |
'post_type' => array( 'post', 'book', 'movie' ), // post types | |
'posts_per_page' => 5, |
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 | |
$rev_date = date_format(date_create($pans_review->post_date), 'd.m.Y г. H:i'); |
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 | |
$review_content = ''; | |
if (function_exists('kama_excerpt')){ | |
$review_content = kama_excerpt([ | |
'maxchar' => 271, | |
'text' => strip_tags($review->post_content), | |
]); | |
} else { | |
$review_content = wp_html_excerpt($review->post_content, 271, '...'); | |
} |
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 | |
foreach ($pans_reviews as $pans_review) { | |
global $post; | |
$post = $pans_review; | |
setup_postdata($pans_review); | |
get_template_part('template_parts/elements/review', 'loop-item', []); | |
wp_reset_postdata(); |
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('hdden_d')){ | |
function hdden_d($var, $onlyWithGet = true){ | |
if ($onlyWithGet && (!isset($_GET['deb']) || ($_GET['deb'] !== 'y') ) ){ | |
return false; | |
} | |
echo '<pre>'; | |
if (function_exists('esc_html')){ | |
echo esc_html(var_export($var, true)); |
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
/** | |
* Table of contents generator | |
*/ | |
// !function(){function e(){ | |
(function(){ | |
var beforeHTML = '<ul class="chapters">'; | |
var afterHTML = '</ul>'; | |
var glavs = 'h2'; | |
var li_classes = 'chapter'; |