Skip to content

Instantly share code, notes, and snippets.

@Arhey-
Arhey- / php.orStatement.php
Created May 18, 2015 17:13
$config = $config ?? $this->config ?? static::$defaultConfig;
function is(){
foreach(func_get_args() as $v){
if(!is_null($v)){
return $v;
}
}
}
$value = is(null,null,false,true,1);
@Arhey-
Arhey- / bitrix.fileMultiple.php
Last active March 9, 2016 22:24
<input file multiple for IBElement->add
//-------------------- [ ++multiple hack ] --------------------
if (isset($_FILES["PROPERTY_FILE_45_"])) {
$_REQUEST["PROPERTY"][45] = [];
for ($i = count($_FILES["PROPERTY_FILE_45_"]['tmp_name']) - 1; $i >= 0; $i--) {
$_FILES["PROPERTY_FILE_45_" . $i] = [];
$_REQUEST["PROPERTY"][45][$i] = '';
foreach ($_FILES["PROPERTY_FILE_45_"] as $key => $arr) {
$_FILES["PROPERTY_FILE_45_" . $i][$key] = $arr[$i];
}
}
@Arhey-
Arhey- / bitrix.catalog404fix.php
Last active September 18, 2018 11:04
Вместо "элемент не найден" выводить реальную 404
AddEventHandler('main', 'OnEpilog', '_Check404Error', 1);
function _Check404Error(){
if(defined('ERROR_404') && ERROR_404=='Y' || CHTTP::GetLastStatus() == "404 Not Found"){
GLOBAL $APPLICATION;
$APPLICATION->RestartBuffer();
require $_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH.'/header.php';
require $_SERVER['DOCUMENT_ROOT'].'/404.php';
require $_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH.'/footer.php';
}
}
/*
http://stackoverflow.com/questions/14973317/understanding-bootstraps-clearfix-function
*/
.clearfix {
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
$._data(document, "events").click.forEach(function(e,i){
console.log(i, e.selector)
})
@Arhey-
Arhey- / bitrix.dateFormat.php
Last active March 9, 2016 22:22
bitrix date format
<?
if(strlen($arItem["ACTIVE_FROM"])>0)
$arFields["DISPLAY_ACTIVE_FROM"] = CIBlockFormatProperties::DateFormat(
$arParams["ACTIVE_DATE_FORMAT"], // j F Y
MakeTimeStamp($arFields["ACTIVE_FROM"], // 16.12.2014 17:00:00
CSite::GetDateFormat())
);
else
$arFields["DISPLAY_ACTIVE_FROM"] = "";
var y = window.pageYOffset; // read only
// var y = window.pageYOffset || document.documentElement.scrollTop; // for IE<9
@Arhey-
Arhey- / css.infinite-spinning.css
Created December 15, 2014 10:23
ajax load animation, <!--[if gt IE 9]><!--> <link> <!--<![endif]-->
.bx-core-waitwindow:before {
content: " ";
background: url('/bitrix/templates/empty/css/../img/icons.png') -186px -284px;
position: absolute;
top: -12px;
left: -10px;
width: 64px;
height: 64px;
-webkit-animation: infinite-spinning 2s linear infinite;
-moz-animation: infinite-spinning 2s linear infinite;
function Get() {
var these = this;
location.search && location.search.substr(1).split('&').forEach(function (str) {
var para = str.split("=");
these[para[0]] = para[1];
});
Object.defineProperty(this, 'toString', {