| 1 |
<?php |
| 2 |
|
| 3 |
namespace Photonic_Plugin\Options; |
| 4 |
|
| 5 |
abstract class Option_Tab { |
| 6 |
protected array $options; |
| 7 |
|
| 8 |
final public static function get_instance() { |
| 9 |
static $instances = array(); |
| 10 |
$called_class = get_called_class(); |
| 11 |
|
| 12 |
if (!isset($instances[$called_class])) { |
| 13 |
$instances[$called_class] = new $called_class(); |
| 14 |
} |
| 15 |
return $instances[$called_class]; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* @return array |
| 20 |
*/ |
| 21 |
public function get_options(): array { |
| 22 |
return $this->options; |
| 23 |
} |
| 24 |
|
| 25 |
public function title_styles(): array { |
| 26 |
return [ |
| 27 |
'regular' => "<img src='" . trailingslashit(PHOTONIC_URL) . 'include/images/title-regular.png' . "' />Normal title display using the HTML \"title\" attribute", |
| 28 |
'below' => "<img src='" . trailingslashit(PHOTONIC_URL) . 'include/images/title-below.png' . "' />Below the thumbnail (Doesn't work for Random Justified Gallery and Mosaic Layout)", |
| 29 |
'tooltip' => "<img src='" . trailingslashit(PHOTONIC_URL) . 'include/images/title-jq-tooltip.png' . "' />Using a JavaScript tooltip", |
| 30 |
'hover-slideup-show' => "<img src='" . trailingslashit(PHOTONIC_URL) . 'include/images/title-slideup.png' . "' />Slide up from bottom upon hover", |
| 31 |
'slideup-stick' => "<img src='" . trailingslashit(PHOTONIC_URL) . 'include/images/title-slideup.png' . "' />Cover the lower portion always", |
| 32 |
'none' => 'No title' |
| 33 |
]; |
| 34 |
} |
| 35 |
|
| 36 |
public function selection_range($min, $max): array { |
| 37 |
$ret = []; |
| 38 |
for ($i = $min; $i <= $max; $i++) { |
| 39 |
$ret[$i] = $i; |
| 40 |
} |
| 41 |
return $ret; |
| 42 |
} |
| 43 |
|
| 44 |
public function get_layout_engine_options(string $option_id, string $option_grouping): array { |
| 45 |
return [ |
| 46 |
'name' => "Layout processing engine", |
| 47 |
'desc' => "When possible, Photonic tries to use CSS to build the layouts. |
| 48 |
This has the advantage of being fast and can work well with lazy-loading and AJAX-based plugins, particularly if the loading mode (<em>Photonic → Settings → Generic Options → Advanced → Loading Mode</em>) is PHP. |
| 49 |
<br/><br/>The downside is that CSS-based rendering is occasionally incorrect, particularly if the source has incorrect sizes. |
| 50 |
If this is a frequent issue, you can default to a JS-generated layout (which is always more accurate). This can be managed individually for each gallery. |
| 51 |
<br/><br/>In case some of the images in a gallery have missing size metadata, the JS mode will be used, regardless of this selection. |
| 52 |
<br/><br/>Pick your default processor:", |
| 53 |
'id' => $option_id, |
| 54 |
'grouping' => $option_grouping, |
| 55 |
'type' => 'select', |
| 56 |
'options' => [ |
| 57 |
'css' => 'Use CSS unless overridden by a gallery individually', |
| 58 |
'js' => 'Use JS unless overridden by a gallery individually', |
| 59 |
] |
| 60 |
]; |
| 61 |
} |
| 62 |
} |
| 63 |
|