<?php
function dateRange( $first, $last, $step = '+1 day', $format = 'Y/m/d' ) {
$dates = array();
$current = strtotime( $first );
$last = strtotime( $last );
while( $current <= $last ) {
$dates[] = date( $format, $current );
$current = strtotime( $step, $current );
}
return $dates;
}
?>
(function($) {
$.fn.extend({
check : function() {
return this.filter(":radio, :checkbox").attr("checked", true);
},
uncheck : function() {
return this.filter(":radio, :checkbox").removeAttr("checked");
}
});
}(jQuery));
<input onkeypress="return !isNaN(String.fromCharCode(event.charCode || event.keyCode))">
$.fn.showWhenScrolled=function(){
var self = this;
this.init = function(){
self.each(function(){
var self_top = $(this).offset().top;
var scroll_top = $(window).scrollTop();
var win_height = $(window).height();
var frame = $(this).find('iframe');
if(scroll_top > (self_top - win_height)){
if(!frame.attr('src')){
frame.attr({src:frame.attr('title')});
}
}
});
};
$(window).scroll(function(){
self.init();
}).resize(function(){
self.init();
});
self.init();
};
$('.youtube-container').showWhenScrolled();
<?
$out = '';
$fields = dibi::fetchAll("SHOW COLUMNS FROM web_application");
foreach ($fields as $field)
{
$out .= '"'.$field->Field.'";';
}
$out = rtrim($out, ';');
$out .= PHP_EOL;
foreach ($this->model->csvExport() as $index => $row)
{
foreach ($row as $r)
{
$out .='"'.$r.'";';
}
$out = rtrim($out, ';');
$out .= PHP_EOL;
}
$out = iconv('utf-8', 'windows-1250', $out);
$filename = 'application-export___' . date('YmdHis') . '.csv';
header('Content-Encoding: windows-1250');
header('Content-type: text/csv; charset=windows-1250');
header('Content-Disposition: attachment; filename=' . $filename);
//echo "\xEF\xBB\xBF"; // UTF-8 BOM
echo $out;
exit(0);
$this->view->setTemplateFile('modules/application/csv.php');
<?
function HumanReadableFilesize($size) {
// Adapted from: http://www.php.net/manual/en/function.filesize.php
$mod = 1024;
$units = explode(' ','B KB MB GB TB PB');
for ($i = 0; $size > $mod; $i++) {
$size /= $mod;
}
return round($size, 2) . ' ' . $units[$i];
}
function fsize($file) {
$a = array("B", "KB", "MB", "GB", "TB", "PB");
$pos = 0;
$size = filesize($file);
while ($size >= 1024) {$size /= 1024;$pos++;}
return round($size,2)." ".$a[$pos];
}
?>
<?
class zipuj_helper
{
protected $jmeno_zipu;
protected $root;
protected $zip;
public function __construct($root = ".", $jmeno_zipu = "zip.zip")
{
$this->root = $root;
$this->jmeno_zipu = $jmeno_zipu;
$this->zip = new ZipArchive();
$this->zip->open($this->jmeno_zipu, ZIPARCHIVE::CREATE);
$this->nactiAdr();
$this->uloz();
}
public function nactiAdr($cesta = "")
{
$hn = scandir($this->root.$cesta);
foreach ($hn as $file)
{
if ($file == "." || $file == "..")
{
continue;
}
if (is_dir($this->root.$cesta."/".$file))
{
$this->zip->addEmptyDir($cesta."/".$file);
$this->nactiAdr($cesta."/".$file);
}
else
{
$this->zip->addFile($this->root.$cesta."/".$file, $cesta."/".$file);
}
}
}
public function uloz()
{
$this->zip->close();
}
}
// use
$filename = 'prilohy__' . date('YmdHis') . '.zip';
$zalohuj = new zipuj_helper('./storage/application/', './storage/application-zip/' . $filename);
// stripslashes
String.prototype.stripslashes = function(){
return this.replace(/<.*?>/g, '');
};
String.prototype.htmlspecialchars = function(){
var str = this.replace(/&/g, '&');
str = str.replace(/</g, '<');
str = str.replace(/>/g, '>');
str = str.replace(/"/g, '"');
return str;
};
// htmlspecialchars
var str = '<b>my personal website:</b> ';
str += '<a href="http://www.jonasjohn.de/">jonasjohn.de</a>';
document.write("Original string (html): '" + str + "'<br/><br/>");
var str_no_html = str.stripslashes();
document.write("- String without HTML tags: '" + str_no_html + "'<br/>");
var str_hsc = str.htmlspecialchars();
document.write("- String with converted HTML tags: '" + str_hsc + "'");
znak kl.zkratka Alt+# HTML kód název
" ---------- Alt+34 " uvozovka/quote
# Ctrl+Alt+X Alt+35 mřížka/hash/sharp
$ Ctrl+Alt+ů Alt+36 dollar
& Ctrl+Alt+C Alt+38 & ampersand
' ---------- Alt+39 ' apostrof
* Ctrl+Alt+- Alt+42 hvězdička/asterisk
/ ---------- Alt+47 / lomítko/slash
: ---------- Alt+58 dvojtečka/colon
; ---------- Alt+59 středník/semicolon
< Ctrl+Alt+, Alt+60 < menší než/ less than
> Ctrl+Alt+. Alt+62 > větší než/ greater then
@ Ctrl+Alt+V Alt+64 zavináč/at
[ Ctrl+Alt+F Alt+91 levá hranatá závorka/left square bracket
\ Ctrl+Alt+Q Alt+92 obrácené/opačné lomítko/backslash/reverse solidus
] Ctrl+Alt+G Alt+93 pravá hranatá závorka/right square bracket
^ ---------- Alt+94 ˆ stříška/wedge
{ Ctrl+Alt+B Alt+123 levá složená závorka/left curly bracket
| Ctrl+Alt+W Alt+124 svislítko
} Ctrl+Alt+N Alt+125 pravá složená závorka/right curly bracket
~ Ctrl+Alt++ Alt+126 ˜ vlnovka/tilda/tilde
€ Ctrl+Alt+E Alt+0128 € znak eura
¦ ---------- Alt+0166 ¦ přerušené svislítko/broken bar
§ ---------- Alt+0167 § paragraf/section
¨ ---------- Alt+0168 ¨ přehláska/umlaut
© ---------- Alt+0169 © copyright
® ---------- Alt+0174 ® registred
° ---------- Alt+0176 ° stupeň/degre
± ---------- Alt+0177 ± plus mínus
µ ---------- Alt+0181 µ mikro,mí
ß Ctrl+Alt+§ Alt+0223 ß ostré s
ä ---------- Alt+0228 ä a s přehláskou
ë ---------- Alt+0235 ë e s přehláskou
ö ---------- Alt+0246 ö o s přehláskou
÷ Ctrl+Alt+ú Alt+0247 ÷ děleno/divide
ü ---------- Alt+0252 ü u s přehláskou
Π ---------- Alt+0928 Π velké pí
Σ ---------- Alt+0931 Σ velké sigma
Φ ---------- Alt+0934 Φ velké fí
Ω ---------- Alt+0937 Ω velké omega
α ---------- Alt+0945 α alfa
β ---------- Alt+0946 β beta
γ ---------- Alt+0947 γ gama
δ ---------- Alt+0948 δ delta
λ ---------- Alt+0955 λ lambda
π ---------- Alt+0960 π malé pí
ρ ---------- Alt+0961 ρ malé ró
σ ---------- Alt+0963 σ malé sigma
τ ---------- Alt+0964 τ malé tau
φ ---------- Alt+0966 φ malé fí
χ ---------- Alt+0967 χ malé chí
ψ ---------- Alt+0968 ψ malé psí
ω ---------- Alt+0969 ω malé omega