PluginProbe
Image Source Control Lite – Show Image Credits and Captions / trunk
Image Source Control Lite – Show Image Credits and Captions vtrunk
3.12.0 3.11.0 trunk 1.1 1.1.1 1.1.2 1.1.2.1 1.1.3 1.10 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.2 1.2.0.1 1.2.0.2 1.2.0.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.4.1 1.3.5 All 110 releases
image-source-control-isc / includes / functions.php

functions.php in Image Source Control Lite – Show Image Credits and Captions trunk, at includes/functions.php

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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