if( class_exists( $controller_name ) ) {
$controller = new $controller_name;
$action = $action_name;
if(method_exists($controller, $action)) {
$controller->$action();
} else {
Route::ErrorPage();
}
} else {
Route::ErrorPage();
}
;(function(window, document) {
const foreach = function(a, b) {
for( let i = 0; i < b.length; i++ ) if( void 0 !== a[b[i]] ) {
a[b[i]](); break;
}
};
window['Fullscreen'] = {
launch : function(a) {
foreach(a || document.documentElement, [
"requestFullscreen", "webkitRequestFullscreen", "mozRequestFullScreen", "msRequestFullscreen"
]);
},
cancel : function(a) {
foreach(a || document, [
"exitFullscreen", "webkitExitFullscreen", "mozCancelFullScreen", "msExitFullscreen"
]);
},
check : function() {
return Boolean(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement);
}
};
})(window, document);
document.body.style.display = Fullscreen.check() ? 'none' : 'block';
Array.isArray = function(obj) {
return /^\[object (NodeList|Array)\]$/.test(Object.prototype.toString.call(obj));
};
Document.prototype.addClass =
DocumentFragment.prototype.addClass =
NodeList.prototype.addClass =
Element.prototype.addClass = function(value) {
if( typeof value === "string" && value ) {
var j, current, clazz, finalValue;
var stripAndCollapse = function(v, a) {
var tokens = v.match(/[^\x20\t\r\n\f]+/g) || [];
return a ? tokens : tokens.join(" ");
}, classList = stripAndCollapse(value, true);
var list; Array.isArray(this) ? (list = this) : (list = [], list.push(this));
list.forEach(function(elem, i) {
// This expression is here for better compressibility (see addClass)
current = elem.nodeType === 1 && (" " + stripAndCollapse(elem.className) + " ");
if( current ) {
j = 0;
while( (clazz = classList[j++]) ) {
if( current.indexOf(" " + clazz + " ") < 0 ) {
current += clazz + " ";
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse(current);
if( finalValue !== elem.className ) {
elem.setAttribute("class", finalValue);
}
}
});
}
return this;
};
$dom = PHPQuery::newDocument($html);
$elems = $dom->find('.navigation > .pagination > *');
if( $elems->length ) {
$penult = $elems->length - ($elems->length > 2 ? 2 : 1);
var_dump($elems->eq($penult)->text());
}
document.addEventListener('DOMContentLoaded', function (e) {
var activeShape = [], map = document.getElementById('map');
document.addEventListener('click', function (e) {
if (e.target.dataset.action != 'region') return;
var path = map.querySelectorAll('[data-id="' + e.target.dataset.id + '"]');
activeShape.length && activeShape.forEach(function(item) {
item.setAttribute('class', item.getAttribute('class').replace(/\s*\bactive\b/ig, ''));
});
path.length && path.forEach(function(item) {
item.setAttribute('class', item.getAttribute('class') + ' active');
activeShape.push(item);
});
});
});
let userUrl = 'sss.sss.ru', phone_num_1, phone_num_2;
let arr = [{
site_id: "qwe",
url: [ "eee.eee.ru", "www.www.ru" ],
phone_num: "123456789",
source: "qwe",
ops: "velc"
}, {
site_id: "qwe_pc",
url: [ "sss.sss.ru", "aaa.aaa.ru" ],
phone_num: "1029384756",
source: "qwe",
ops: "mt"
}];
arr.forEach(function(item) {
item.url.indexOf(userUrl) > -1 && item.ops == "velc" && (phone_num = item.phone_num);
item.url.indexOf(userUrl) > -1 && item.ops == "mt" && (phone_num_2 = item.phone_num);
});
console.log(phone_num_1);
console.log(phone_num_2);
$file = 'file.png';
$exception = Array('jpg', 'gif', 'svg');
$extension = pathinfo( $file, PATHINFO_EXTENSION );
if( !in_array($extension, $exception) ) {
// Тут ваш код если файл не исключен
echo 'Тип расширения ' . $extension;
}
/* Fullscreen mode */
var launchFullscreen = function() {
var i, l = ['requestFullscreen','webkitRequestFullscreen','mozRequestFullScreen','msRequestFullscreen]', e = document.documentElement;
for( i = 0; i < l.length; i++ ) if( e[l[i]] !== undefined ) {
(e[l[i]])(); break;
}
}, checkFullscreen = function() {
return Boolean( document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement );
}, cancelFullscreen = function() {
var i, l = ['exitFullscreen','webkitExitFullscreen','mozCancelFullScreen','msExitFullscreen'];
for( i = 0; i < l.length; i++ ) if( document[l[i]] !== undefined ) {
(document[l[i]])(); break;
}
};