| 1 |
<?php |
| 2 |
/** |
| 3 |
* Functions that can be directly used in the frontend |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* Echoes a list with image sources for a given post |
| 8 |
* |
| 9 |
* @global object $my_isc isc class |
| 10 |
* @param integer $post_id post id. |
| 11 |
*/ |
| 12 |
function isc_list( $post_id = 0 ) { |
| 13 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 14 |
echo \ISC\Image_Sources\Image_Sources::get_instance()->list_post_attachments_with_sources( $post_id ); |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Returns the source html of a given image |
| 19 |
* |
| 20 |
* @global object$my_isc isc class |
| 21 |
* @param integer $attachment_id id of the image. |
| 22 |
*/ |
| 23 |
function isc_image_source( $attachment_id = 0 ) { |
| 24 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 25 |
echo \ISC\Image_Sources\Renderer\Image_Source_String::get( $attachment_id ); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Return the source html of the featured image |
| 30 |
* |
| 31 |
* @param integer $post_id id of the post; will use current post if empty. |
| 32 |
* |
| 33 |
* @global object $post current post |
| 34 |
* @global object $my_isc isc class |
| 35 |
*/ |
| 36 |
function isc_thumbnail_source( int $post_id = 0 ) { |
| 37 |
global $post; |
| 38 |
|
| 39 |
if ( empty( $post_id ) && isset( $post->ID ) ) { |
| 40 |
$post_id = $post->ID; |
| 41 |
} |
| 42 |
|
| 43 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 44 |
echo \ISC\Image_Sources\Image_Sources::get_instance()->get_thumbnail_source_string( $post_id ); |
| 45 |
} |
| 46 |
|