This file contains 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 | |
/** | |
* Remove standard image sizes so that these sizes are not | |
* created during the Media Upload process | |
* | |
* Tested with WP 3.2.1 | |
* | |
* Hooked to intermediate_image_sizes_advanced filter | |
* See wp_generate_attachment_metadata( $attachment_id, $file ) in wp-admin/includes/image.php | |
* |
This file contains 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 | |
if ( $includeDocs ) { | |
$ids = str_replace(' ','',$includeDocs); | |
$ids = explode(',', $ids); | |
$criteria = $modx->newQuery('modResource'); | |
$criteria->sortby('FIELD(modResource.id, '.implode(',',$ids).' )', 'ASC'); | |
$criteria->where(array( | |
'id:IN' => $ids | |
)); |
This file contains 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 | |
function array2csv(array &$array){ | |
if (count($array) == 0) { | |
return null; | |
} | |
ob_start(); | |
$df = fopen("php://output", 'w'); | |
fputcsv($df, array_keys(reset($array))); | |
foreach ($array as $row) { | |
fputcsv($df, $row); |
This file contains 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 | |
/* | |
* Принимаемые параметры: | |
* $from - email отправителя | |
* $fromName - имя отправителя | |
* $to - email получателя | |
* $replyTo - email Reply To | |
* $bccTo - email "скрытая копия" | |
* $template - чанк с шаблоном письма | |
* $subject - Тема письма |
This file contains 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
$.ajax({ | |
type: "GET", | |
url: $(this).attr('href'), | |
dataType: "html", | |
success: function (result) { | |
$('.loop').append(result); | |
FB.XFBML.parse(); // Facebook | |
twttr.widgets.load(); // Twitter | |
} | |
} |
This file contains 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
<!-- contactform.php --> | |
<div class="cf" id="cf"> | |
<form action="javascript:void(0);"> | |
<div><input type="text" name="name" placeholder="Name"/><span class="error"></span></div> | |
<div><input type="text" name="email" placeholder="Email"/><span class="error"></span></div> | |
<div><textarea name="message" placeholder="Message"></textarea><span class="error"></span></div> | |
<div><button type="submit">Submit</button> <span class="loader"></span></div> | |
</form> | |
</div> |
This file contains 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
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
This file contains 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
img.grayscale{ | |
filter: grayscale(100%); | |
-webkit-filter: grayscale(100%); /* For Webkit browsers */ | |
filter: gray; /* For IE 6 - 9 */ | |
-webkit-transition: all .6s ease; /* Fade to color for Chrome and Safari */ | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */ | |
} | |
img.grayscale:hover{ | |
filter: grayscale(0%); |
This file contains 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 | |
function getCounter() { | |
$starttime = 9; // Время начала рабочего периода | |
$endtime = 22; // Время конца рабочего периода | |
$offset = 0; // Временное смещение или часовой пояс, иногда нужно | |
$min = 5; // Начальное значение счетчика | |
$max = 315; // Максимальное значение счетчика | |
$hour = date('G') + $offset; | |
if ( $hour < $starttime ) $hour = $hour + 24; |