This file contains hidden or 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 getBrowser() | |
{ | |
$u_agent = $_SERVER['HTTP_USER_AGENT']; | |
$bname = 'Unknown'; | |
$platform = 'Unknown'; | |
$version= ""; | |
//First get the platform? | |
if (preg_match('/linux/i', $u_agent)) { | |
$platform = 'linux'; |
This file contains hidden or 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
RewriteEngine On | |
RewriteRule ^single/([0-9]*)$ single.php?id=$1 [L] // first part is nice formatted - second part i actual link |
This file contains hidden or 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
// ............................................................ | |
// .for | |
.for(@i, @n) {.-each(@i)} | |
.for(@n) when (isnumber(@n)) {.for(1, @n)} | |
.for(@i, @n) when not (@i = @n) { | |
.for((@i + (@n - @i) / abs(@n - @i)), @n); | |
} | |
// ............................................................ |
This file contains hidden or 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
//Usage: creating custom menu in Wordpress panel with name as $menu_name value | |
// Next: calling right_custom_menu function where custom menu is needed as follows =>> if (function_exists(right_custom_menu())) right_custom_menu(); | |
function right_menu_position() { | |
register_nav_menu('nav_right',__( 'Prawe menu' )); | |
} | |
add_action( 'init', 'right_menu_position' ); | |
function right_custom_menu() { | |
$menu_name = 'nav_right'; // specify custom menu slug |
This file contains hidden or 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 | |
date_default_timezone_set('Europe/Warsaw'); | |
function dateToPolishFormat($format,$timestamp=null){ | |
$to_convert = array( | |
'l'=>array('dat'=>'N','str'=>array('Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Niedziela')), | |
'F'=>array('dat'=>'n','str'=>array('styczeń','luty','marzec','kwiecień','maj','czerwiec','lipiec','sierpień','wrzesień','październik','listopad','grudzień')), | |
'f'=>array('dat'=>'n','str'=>array('stycznia','lutego','marca','kwietnia','maja','czerwca','lipca','sierpnia','września','października','listopada','grudnia')) | |
); |
This file contains hidden or 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 custom_scripts() | |
{ | |
wp_deregister_script('jquery'); | |
wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js', array(), '1.0.0', false); | |
wp_enqueue_script('jquery-ui', '//code.jquery.com/ui/1.11.4/jquery-ui.js', array(), '1.0.0', true); | |
wp_enqueue_script('custom-script', get_template_directory_uri() . '/assets/js/script.js', array(), '1.0.0', true); | |
$map_pin_url = array( | |
'url' => get_template_directory_uri() . '/assets/img/map-pin.png', | |
); |
This file contains hidden or 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 file_size2($url){ | |
$size = filesize($url); | |
if($size >= 1073741824){ | |
$fileSize = round($size/1024/1024/1024,1) . 'GB'; | |
}elseif($size >= 1048576){ | |
$fileSize = round($size/1024/1024,1) . 'MB'; | |
}elseif($size >= 1024){ | |
$fileSize = round($size/1024,1) . 'KB'; | |
}else{ | |
$fileSize = $size . ' bytes'; |
NewerOlder