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 | |
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' ); ?>" /> |
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 | |
function time_elapsed_string($ptime) | |
{ | |
$etime = time() - $ptime; | |
if ($etime < 1) | |
{ | |
return '0 seconds'; | |
} |
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 | |
/** | |
* Функция склонения числительных в русском языке | |
* | |
* @param int $number Число которое нужно просклонять | |
* @param array $titles Массив слов для склонения | |
* @return string | |
**/ | |
$titles = array('Сидит %d котик', 'Сидят %d котика', 'Сидит %d котиков'); | |
function declOfNum($number, $titles) |