Skip to content

Instantly share code, notes, and snippets.

View amorkovin's full-sized avatar

Андрей Морковин amorkovin

View GitHub Profile
@Neolot
Neolot / gist:3964380
Last active September 19, 2023 12:52
PHP Склонение числительных
<?php
/**
* Функция склонения числительных в русском языке
*
* @param int $number Число которое нужно просклонять
* @param array $titles Массив слов для склонения
* @return string
**/
$titles = array('Сидит %d котик', 'Сидят %d котика', 'Сидит %d котиков');
function declOfNum($number, $titles)
@jrobinsonc
jrobinsonc / time_elapsed_string.php
Created February 16, 2014 17:35
time elapsed string
<?php
function time_elapsed_string($ptime)
{
$etime = time() - $ptime;
if ($etime < 1)
{
return '0 seconds';
}
<?php
if ( isset( $_POST['submit_image_selector'] ) && isset( $_POST['image_attachment_id'] ) ) :
update_option( 'media_selector_attachment_id', absint( $_POST['image_attachment_id'] ) );
endif;
wp_enqueue_media();
?><form method='post'>
<div class='image-preview-wrapper'>
<img id='image-preview' src='<?php echo wp_get_attachment_url( get_option( 'media_selector_attachment_id' ) ); ?>' width='200'>
</div>
<input id="upload_image_button" type="button" class="button" value="<?php _e( 'Upload image' ); ?>" />