HEX
Server: nginx/1.24.0
System: Linux server 6.12.74+deb13+1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.74-2 (2026-03-08) x86_64
User: www (1001)
PHP: 8.5.2
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/claudiayancor.duckdns.org/wp-content/plugins/photonic/Core/Gallery.php
<?php

namespace Photonic_Plugin\Core;

use Photonic_Plugin\Layouts\Core_Layout;
use Photonic_Plugin\Layouts\Grid;
use Photonic_Plugin\Layouts\Slideshow;
use Photonic_Plugin\Modules\Core;
use Photonic_Plugin\Modules\Flickr;
use Photonic_Plugin\Modules\Google_Photos;
use Photonic_Plugin\Modules\Instagram;
use Photonic_Plugin\Modules\Native;
use Photonic_Plugin\Modules\SmugMug;
use Photonic_Plugin\Modules\Zenfolio;

class Gallery {
	private $attr;
	/** @var Core */
	private $module;

	/** @var Core_Layout */
	private $layout;

	public function __construct($attr) {
		$this->attr = $attr;
		$type = $this->attr['type'];

		$this->set_module($type);

		if ((!empty($attr['layout']) && in_array($type, ['flickr', 'smugmug', 'google', 'zenfolio', 'instagram'], true) && in_array($attr['layout'], ['strip-above', 'strip-below', 'strip-right', 'no-strip'], true)) ||
			(!empty($attr['style']) && 'default' === $type && in_array($attr['style'], ['strip-above', 'strip-below', 'strip-right', 'no-strip'], true))) {
			require_once PHOTONIC_PATH . '/Layouts/Slideshow.php';
			$this->layout = Slideshow::get_instance();
		}
		else {
			require_once PHOTONIC_PATH . '/Layouts/Grid.php';
			$this->layout = Grid::get_instance();
		}
	}

	private function set_module($type) {
		if ('flickr' === $type) {
			require_once PHOTONIC_PATH . "/Modules/Flickr.php";
			$this->module = Flickr::get_instance();
		}
		elseif ('smugmug' === $type || 'smug' === $type) {
			require_once PHOTONIC_PATH . "/Modules/SmugMug.php";
			$this->module = SmugMug::get_instance();
		}
		elseif ('google' === $type) {
			require_once PHOTONIC_PATH . "/Modules/Google_Photos.php";
			$this->module = Google_Photos::get_instance();
		}
		elseif ('instagram' === $type) {
			require_once PHOTONIC_PATH . "/Modules/Instagram.php";
			$this->module = Instagram::get_instance();
		}
		elseif ('zenfolio' === $type) {
			require_once PHOTONIC_PATH . "/Modules/Zenfolio.php";
			$this->module = Zenfolio::get_instance();
		}
		else {
			require_once PHOTONIC_PATH . "/Modules/Native.php";
			$this->module = Native::get_instance();
		}
	}

	/**
	 * Fetch the contents of a gallery. This first invokes the <code>get_gallery_images</code> method for each platform.
	 * Once the results are obtained, this method prints out the results.
	 *
	 * @return string
	 */
	public function get_contents() {
		$this->module->increment_gallery_index();
		$contents = $this->module->get_gallery_images($this->attr);
		if (is_array($contents)) {
			$output = '';
			foreach ($contents as $component) {
				if (method_exists($component, 'html')) {
					$output .= $component->html($this->module, $this->layout);
				}
				else {
					$output .= $component;
				}
			}
			return $this->finalize_markup($output);
		}
		return $contents;
	}

	public function get_helper_contents() {
		return $this->module->execute_helper($this->attr);
	}

	/**
	 * Wraps the output of a gallery in markup tags indicating that it is a Photonic gallery.
	 *
	 * @param $content
	 * @return string
	 */
	public function finalize_markup($content) {
		if ('popup' !== $this->attr['display']) {
			$additional_classes = '';
			if (!empty($this->attr['custom_classes'])) {
				$additional_classes = $this->attr['custom_classes'];
			}
			if (!empty($this->attr['alignment'])) {
				$additional_classes .= ' align' . $this->attr['alignment'];
			}
			$ret = "<div class='photonic-{$this->module->provider}-stream photonic-stream $additional_classes' id='photonic-{$this->module->provider}-stream-{$this->module->gallery_index}'>\n";
		}
		else {
			$popup_id = "id='photonic-{$this->module->provider}-panel-" . $this->attr['panel'] . "'";
			$ret = "<div class='photonic-{$this->module->provider}-panel photonic-panel' $popup_id>\n";
		}
		$ret .= $content . "\n";
		$ret .= "</div><!-- .photonic-stream or .photonic-panel -->\n";
		return $ret;
	}
}