Warning: Undefined array key "orderhash" in /home/labreunis/maxkuku.ru/docs/webmaster/index.php on line 177
Список полезных функций
(☞ຈل͜ຈ)☞ Главная  Статьи  Загрузчик Домой


Warning: Undefined variable $name in /home/labreunis/maxkuku.ru/docs/webmaster/index.php on line 209

Warning: Undefined array key "orderhash" in /home/labreunis/maxkuku.ru/docs/webmaster/index.php on line 224

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/labreunis/maxkuku.ru/docs/webmaster/index.php on line 224

Warning: Undefined variable $name in /home/labreunis/maxkuku.ru/docs/webmaster/index.php on line 224

Warning: Undefined variable $name in /home/labreunis/maxkuku.ru/docs/webmaster/index.php on line 294
Ok!
Ok!
302
if (strlen($youtube_id) > 11) { // rutube
        $result = file_get_contents('https://rutube.ru/api/video/' . $youtube_id . '/thumbnail/');
        // Will dump a beauty json :3
        $preview_url = json_decode($result, true);
        $preview_url_url = $preview_url['url'];
        echo '<div class="youtube" itemscope itemtype="http://schema.org/VideoObject" data-src="https://rutube.ru/play/embed/' . $youtube_id . '" id="' . $youtube_id . '" style="background-image: url(//i.ytimg.com/vi/' . $youtube_id . '/0.jpg);">
        <meta itemprop="name" content="' . $name . '"/>
        <meta itemprop="description" content="' . $descr . '"/>
        <meta itemprop="duration" content="PT' . $t[0] . 'M' . $t[1] . 'S">
        <meta itemprop="isFamilyFriendly" content="true">
        <meta itemprop="uploadDate" content="' . date("Y-m-d H:i:s", filemtime(__FILE__)) . '"/>
        <span itemprop="thumbnail" itemscope itemtype="http://schema.org/ImageObject"> 
        <img itemprop="contentUrl" src="' . $preview_url_url . '" style="width:580px;height:324px;" alt="' . $name . '"/>
        <meta itemprop="thumbnailUrl" content="' . $preview_url_url . '">
        <meta itemprop="width" content="580">
        <meta itemprop="height" content="324">
        </span>
        <div class="play"><a itemprop="url" href="https://rutube.ru/play/embed/' . $youtube_id . '"></a></div></div>';
    }
php, preview130Функция php для вставки видео Рутуб по кнопке с превью картинкой
286
$url = 'https://rutube.ru/api/video/' . $id;
$preview_src = 'https://rutube.ru/play/embed/' . $id . '/thumbnail/?redirect=1';	
rutube, preview9000Ссылка на видео rutube.ru и ссылка на превью
255
class Foo extends \stdClass
// to fix Deprecated: Creation of dynamic property
php, deprecation, dynamic650Исправление ошибки создания динамически свойства в php8.2
201
function send(onError, onSuccess, url, method = 'GET', data = null, headers = [], timeout = 60000) {
  let xhr;

  if (window.XMLHttpRequest) {
      // Chrome, Mozilla, Opera, Safari
      xhr = new XMLHttpRequest();
  }  else if (window.ActiveXObject) { 
      // Internet Explorer
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
  }

  xhr.open(method, url, true);


  headers.forEach((header) => {
      xhr.setRequestHeader(header.key, header.value);
  })
  

  xhr.timeout = timeout;

  xhr.onreadystatechange = function () {
      if (xhr.readyState === 4) {
      if(xhr.status >= 400) {
          onError(xhr.statusText)
      } else {
          onSuccess(xhr.responseText)
      }
      }
  }

  xhr.send(data);
}
xhr, request, XMLHttpRequest, JS12090XMLHttpRequest обернутый в функцию
104
width: expression(((document.documentElement.clientWidth || document.body.clientWidth) < 1050)? "1050px" : "100%");
expression, css690Применение expression в css
36
div.wpcf7 .screen-reader-response {
    color: black!important;
    background: white;
    padding: 3em;
    border: 1px solid rgba(1,1,1,.1);
    margin: 2em;
    box-sizing: border-box;
    width: 500px;
    position: absolute;
}
pre, php1004PRE php
19
К картинкам 
<img src="/img/eyes-l.jpg" srcset="/img/eyes-m.jpg 1x, /img/eyes.jpg 2x" alt="Глаза" height="375" width="500" data-p="/img/eyes.jpg">
<a href="#" rel="prefetch">Ссылка</a>
srcset, prefetch100srcset для изображений, предпросмотр для ссылок
17
if($arParams["PREVIEW_TRUNCATE_LEN"] > 0 && strlen($arItem["PREVIEW_TEXT"])>5)
            $arItem["PREVIEW_TEXT"] = $obParser->html_cut($arItem["PREVIEW_TEXT"], $arParams["PREVIEW_TRUNCATE_LEN"]);
truncate, bitrix, prewiew text400Функция Битрикс для обрезки превью текста, если обрезка автоматически не работает