HEX
Server: Apache/2.4.65 (Debian)
System: Linux web6 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64
User: innocamp (1028)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/bookcc/public_html/wp-content/plugins/featured-galleries/includes/public-functions.php
<?php

function get_post_gallery_ids( $postID = null, $maxImages = -1, $method = 'array' ) {

	global $post;

	// CHECK TO SEE IF AN ID HAS BEEN PASSED. IF NOT, LOAD THE ID FROM $POST, IF POSSIBLE

	if ( $postID == null ) {

		// IF NO ID HAS BEEN PASSED, CHECK TO SEE IF WE ARE IN THE LOOP AND HAVE A $post. IF
		// WE DO, THEN LOAD THE POST ID FROM THE CURRENT POST. IF NOT, RETURN AN ERROR.

		if ( $post !== null ) {

			$postID = $post->ID;

		} else {

			return $method == 'array' ? ['Error, requires a valid postID'] : 'Error, requires a valid postID';

		}

	}

	// CHECK TO SEE IF WE ARE IN A PREVIEW. IF SO, LOAD THE TEMP METADATA. IF NOT, LOAD THE
	// PERM METADATA

	if ( is_preview( $postID ) ) {

		$galleryString = get_post_meta( $postID, 'fg_temp_metadata', 1 );

	} else {

		$galleryString = get_post_meta( $postID, 'fg_perm_metadata', 1 );

	}

	// BREAK THE STRING INTO AN ARRAY TO COUNT THE NUMBER OF IDS THAT WE HAVE. THIS IS
	// REQUIRED BECAUSE WE HAVE TO RESPECT THE $maxImages PARAMETER.

	if ( $galleryString == '' ) {

		$galleryArray = [];

	} else {

		if ( $maxImages == -1 ) {

			$galleryArray = explode(',', $galleryString);

		} else {

			$galleryArray = array_slice(explode(',', $galleryString), 0, $maxImages);

		}

	}

	// REBUILD THE $galleryString VARIABLE NOW THAT WE HAVE CUT DOWN THE NUMBER OF
	// IMAGES BASED ON $maxImages.

	$galleryString = implode(',', $galleryArray);

	// CHECK THE $method PARAMETER. IF IT IS SET TO 'string', RETURN THE GALLERY IDS AS
	// A COMMA DELIMITED STRING. OTHERWISE, RETURN THE GALLERY IDS AS AN ARRAY.

	if ( $method == 'string' || $maxImages == 'string' ) {

		return $galleryString;

	} else {

		// RETURN ARRAY

		return $galleryArray;

	}

}