Skip to content

Commit

Permalink
Merge branch 'master' into release-1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
iMattPro committed Oct 16, 2017
2 parents 4fa625b + 5c89725 commit 9015022
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 8 deletions.
1 change: 1 addition & 0 deletions config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ services:
- '@config'
- '@template'
- '@user'
- '%core.php_ext%'
tags:
- { name: event.listener }
16 changes: 11 additions & 5 deletions event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,24 @@ class listener implements EventSubscriberInterface
/** @var \phpbb\user */
protected $user;

/** @var string PHP file extension */
protected $php_ext;

/**
* Constructor
*
* @param \phpbb\config\config $config Config object
* @param \phpbb\template\template $template Template object
* @param \phpbb\user $user User object
* @param \phpbb\config\config $config Config object
* @param \phpbb\template\template $template Template object
* @param \phpbb\user $user User object
* @param string $php_ext
* @access public
*/
public function __construct(\phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user)
public function __construct(\phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, $php_ext)
{
$this->config = $config;
$this->template = $template;
$this->user = $user;
$this->php_ext = $php_ext;
}

/**
Expand Down Expand Up @@ -69,6 +74,7 @@ public function set_lightbox_tpl_data()
'S_LIGHTBOX_GALLERY' => (int) $this->config['lightbox_gallery'],
'S_LIGHTBOX_SIGNATURES' => (int) $this->config['lightbox_signatures'],
'S_LIGHTBOX_IMG_TITLES' => (int) $this->config['lightbox_img_titles'],
'PHP_EXTENSION' => $this->php_ext,
));
}

Expand Down Expand Up @@ -122,7 +128,7 @@ public function select_gallery_mode($selected, $cfg_key = '')

foreach ($opt_ary as $opt_key => $opt_value)
{
$options .= '<option value="' . $opt_key . '"' . (($selected == $opt_key) ? ' selected="selected"' : '') . '>' . $this->user->lang($opt_value) . '</option>';
$options .= '<option value="' . $opt_key . '"' . ($selected == $opt_key ? ' selected="selected"' : '') . '>' . $this->user->lang($opt_value) . '</option>';
}

return $options;
Expand Down
2 changes: 2 additions & 0 deletions language/ar/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'التوصية تعتمد على إعدادات الصورة المُرفقة : %spx',
'LIGHTBOX_GALLERY' => 'السماح بالتنقل بين الصور ',
'LIGHTBOX_GALLERY_EXPLAIN' => 'السماح بسهولة التنقل بين جميع الصور المُصغرة في الصفحة بإستخدام تقنية النافذة المضيئة.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'تصغير صور التواقيع ',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'السماح بتصغير الصور الموجودة في تواقيع الأعضاء.',
'LIGHTBOX_IMG_TITLES' => 'إظهار أسماء الصور ',
Expand Down
2 changes: 2 additions & 0 deletions language/cs/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Doporučení založené na nastavení obrázkových příloh: %s px',
'LIGHTBOX_GALLERY' => 'Povolit režim galerie',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Umožňuje snadnou navigaci mezi obrázky na stránce prostřednictvím lightbox efektu.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Měnit velikost obrázků v podpisech',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Umožňuje změnu velikosti obrázků v podpisech.',
'LIGHTBOX_IMG_TITLES' => 'Zobrazovat názvy obrázků',
Expand Down
2 changes: 2 additions & 0 deletions language/de/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Empfehlung basierend auf den Bilderanhang-Einstellungen: %spx',
'LIGHTBOX_GALLERY' => 'Erlaube Galeriemodus',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Erlaubt einfach Navigation zwischen allen verkleinerten Bildern auf der Seite, unter Benutzung des Lightbox-Effekts.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Verkleinere Signaturbilder',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Erlaubt die Verkleinerung von Bildern, die in Signaturen benutzt werden.',
'LIGHTBOX_IMG_TITLES' => 'Zeige Bildernamen',
Expand Down
2 changes: 2 additions & 0 deletions language/es/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Recomendación sobre la base de la configuración de la imagen adjunta: %spx',
'LIGHTBOX_GALLERY' => 'Permitir el modo de galería',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Permite una fácil navegación entre todas las imágenes redimensionadas en la página utilizando el efecto de Lightbox.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Redimensionar imágenes de las firmas',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Permitir que las imágenes usadas en las firmas seán redimensionadas.',
'LIGHTBOX_IMG_TITLES' => 'Mostrar los nombres de archivo de las imágenes',
Expand Down
2 changes: 2 additions & 0 deletions language/it/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Raccomandazione sulla base di impostazioni per gli allegati di immagini: %spx',
'LIGHTBOX_GALLERY' => 'Attiva modalità galleria',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Permette la navigazione fra immagini ridimensionate nella stessa pagina con l’effetto Lightbox.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Ridimensiona immagini in firma',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Permette il ridimensionamento delle immagini inserite nella firma',
'LIGHTBOX_IMG_TITLES' => 'Mostra nomi file immagine',
Expand Down
2 changes: 2 additions & 0 deletions language/ja/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => '添付ファイルの設定に基づいて勧告: %spx',
'LIGHTBOX_GALLERY' => 'ギャラリーモードを許可',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Lightboxエフェクトを使用するページの全てのリサイズされた画像の間で簡単なナビゲーションを許可します。',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => '署名画像のリサイズ',
'LIGHTBOX_SIGNATURES_EXPLAIN' => '署名でリサイズされた画像の使用を許可します。',
'LIGHTBOX_IMG_TITLES' => '画像のファイル名を表示',
Expand Down
2 changes: 2 additions & 0 deletions language/nl/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Aanbeveling op basis van afbeelding bijlagen: %spx',
'LIGHTBOX_GALLERY' => 'Galerij mode toestaan',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Hiermee kan makkelijk genavigeerd worden tussen alle herschaalde afbeeldingen op de pagina door gebruik te maken van het Lightbox effect.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Herschaal afbeeldingen in onderschrift',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'De afbeeldingen die in het onderschrift worden gebruikt herschalen.',
'LIGHTBOX_IMG_TITLES' => 'Bestandsnamen weergeven',
Expand Down
2 changes: 2 additions & 0 deletions language/pl/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Zalecenie podstawie ustawień załączanego obrazka: %spx',
'LIGHTBOX_GALLERY' => 'Zezwól na tryb galerii',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Pozwala na łatwą nawigację pomiędzy wszystkimi obrazkami, które wymagają użycia efektu Lightbox.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Zmiana rozmiaru obrazków w sygnaturach',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Wykorzustuje Lightbox do zmiany rozmiaru obrazków w sygnaturach.',
'LIGHTBOX_IMG_TITLES' => 'Pokaż nazwy obrazków',
Expand Down
2 changes: 2 additions & 0 deletions language/pt_br/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Recommendation based on image attachment settings: %spx',
'LIGHTBOX_GALLERY' => 'Permite modo galeria',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Permite fácil navegação entre todas as imagens redimensionadas da página usando o efeito Lightbox.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Redimensiona imagens na assinatura',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Permite que imagens usadas em assinaturas sejam redimensionadas.',
'LIGHTBOX_IMG_TITLES' => 'Mostra o nome de arquivo da imagem',
Expand Down
2 changes: 2 additions & 0 deletions language/ru/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Рекомендация основана на настройках вложения изображения: %sпикс.',
'LIGHTBOX_GALLERY' => 'Включить режим галереи',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Включает простую навигацию по уменьшенным избражениям с использованием Lightbox-эффекта.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Уменьшать изображения в подписях',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Если опция включена, то изображения в подписях пользователей так же будут уменьшены средствами LightBox.',
'LIGHTBOX_IMG_TITLES' => 'Показывать имена файлов изображений',
Expand Down
2 changes: 2 additions & 0 deletions language/sv/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Rekommendation baserad på bildbilagor: %spx',
'LIGHTBOX_GALLERY' => 'Tillåt galleriläge',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Gör det enkelt att navigera mellan alla förminskade bilder på sidan.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Förminska signaturbilder',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Tillåt att bilder som används i signaturer blir föminskande.',
'LIGHTBOX_IMG_TITLES' => 'Visa bildernas filnamn',
Expand Down
2 changes: 2 additions & 0 deletions language/tr/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
'LIGHTBOX_MAX_WIDTH_EXPLAIN' => 'Bu genişliği aşan resimler yeniden boyutlandırılacaktır ve Lightbox efekti kullanarak büyütülecektir. Lightbox resim yeniden boyutlandırmayı kapatmak için bu değeri 0 olarak ayarlayın.',
'LIGHTBOX_GALLERY' => 'Galeri moduna izin ver',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Lightbox efekti kullanarak sayfadaki tüm yeniden boyutlandırılan resimler arasında kolay gezinmeye izin verir.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'İmza resimlerini yeniden boyutlandır',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'İmzalarda kullanılan resimleri yeniden boyutlandırmaya izin verir.',
'LIGHTBOX_IMG_TITLES' => 'Resim dosya adlarını göster',
Expand Down
2 changes: 2 additions & 0 deletions language/vi/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
'LIGHTBOX_MAX_WIDTH_APPEND' => 'Dựa trên cài đặt ảnh đính kèm: %spx',
'LIGHTBOX_GALLERY' => 'Bật chế độ Gallery',
'LIGHTBOX_GALLERY_EXPLAIN' => 'Dễ dàng chuyển ảnh qua lại trên trang nhờ sử dụng Lightbox effect.',
'LIGHTBOX_GALLERY_ALL' => 'All resized images on page',
'LIGHTBOX_GALLERY_POSTS' => 'All resized images per post',
'LIGHTBOX_SIGNATURES' => 'Bật thu nhỏ hình ảnh trong chữ ký',
'LIGHTBOX_SIGNATURES_EXPLAIN' => 'Thu nhỏ hình ảnh trong chữ ký.',
'LIGHTBOX_IMG_TITLES' => 'Hiển thị tên file ảnh',
Expand Down
1 change: 1 addition & 0 deletions styles/all/template/event/overall_footer_after.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
vseLightbox.lightboxGal = {{ S_LIGHTBOX_GALLERY }};
vseLightbox.lightboxSig = {{ S_LIGHTBOX_SIGNATURES }};
vseLightbox.imageTitles = {{ S_LIGHTBOX_IMG_TITLES }};
vseLightbox.downloadFile = 'download/file.{{ PHP_EXTENSION|escape("js") }}';
</script>
{% endif %}
2 changes: 1 addition & 1 deletion styles/all/template/event/overall_header_head_append.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% if LIGHTBOX_RESIZE_WIDTH %}
{% INCLUDECSS '@vse_lightbox/../template/lightbox/css/lightbox.min.css' %}
{% INCLUDECSS '@vse_lightbox/lightbox/css/lightbox.min.css' %}
{% endif %}
2 changes: 1 addition & 1 deletion styles/all/template/js/resizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
return $('<a/>').attr({
href: url,
'data-lightbox': galleryName + galIndex,
'data-title': (vseLightbox.imageTitles) ? ((url.indexOf('download/file.php') !== -1) ? $(this).attr('alt') : url.split('/').pop()) : ''
'data-title': (vseLightbox.imageTitles) ? ((url.indexOf(vseLightbox.downloadFile) !== -1) ? $(this).attr('alt') : url.split('/').pop()) : ''
});
}).borderHover();
}
Expand Down
16 changes: 15 additions & 1 deletion tests/event/listener_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class listener_test extends \phpbb_test_case
/** @var \phpbb\user|\PHPUnit_Framework_MockObject_MockObject */
protected $user;

/** @var string PHP file extension */
protected $php_ext;

public function setUp()
{
parent::setUp();
Expand All @@ -39,14 +42,16 @@ public function setUp()
));
$this->template = $this->getMockBuilder('\phpbb\template\template')
->getMock();
$this->php_ext = $phpEx;
}

protected function set_listener()
{
$this->listener = new \vse\lightbox\event\listener(
$this->config,
$this->template,
$this->user
$this->user,
$this->php_ext
);
}

Expand Down Expand Up @@ -77,54 +82,63 @@ public function set_lightbox_tpl_data_test_data()
'S_LIGHTBOX_GALLERY' => 2,
'S_LIGHTBOX_SIGNATURES' => 1,
'S_LIGHTBOX_IMG_TITLES' => 1,
'PHP_EXTENSION' => 'php',
)),
array(400, 1, 1, 1, array(
'LIGHTBOX_RESIZE_WIDTH' => 400,
'S_LIGHTBOX_GALLERY' => 1,
'S_LIGHTBOX_SIGNATURES' => 1,
'S_LIGHTBOX_IMG_TITLES' => 1,
'PHP_EXTENSION' => 'php',
)),
array(400, 0, 1, 1, array(
'LIGHTBOX_RESIZE_WIDTH' => 400,
'S_LIGHTBOX_GALLERY' => 0,
'S_LIGHTBOX_SIGNATURES' => 1,
'S_LIGHTBOX_IMG_TITLES' => 1,
'PHP_EXTENSION' => 'php',
)),
array(0, 1, 1, 1, array(
'LIGHTBOX_RESIZE_WIDTH' => 0,
'S_LIGHTBOX_GALLERY' => 1,
'S_LIGHTBOX_SIGNATURES' => 1,
'S_LIGHTBOX_IMG_TITLES' => 1,
'PHP_EXTENSION' => 'php',
)),
array(0, 0, 0, 0, array(
'LIGHTBOX_RESIZE_WIDTH' => 0,
'S_LIGHTBOX_GALLERY' => 0,
'S_LIGHTBOX_SIGNATURES' => 0,
'S_LIGHTBOX_IMG_TITLES' => 0,
'PHP_EXTENSION' => 'php',
)),
array(null, null, null, null, array(
'LIGHTBOX_RESIZE_WIDTH' => 0,
'S_LIGHTBOX_GALLERY' => 0,
'S_LIGHTBOX_SIGNATURES' => 0,
'S_LIGHTBOX_IMG_TITLES' => 0,
'PHP_EXTENSION' => 'php',
)),
array(400, null, null, null, array(
'LIGHTBOX_RESIZE_WIDTH' => 400,
'S_LIGHTBOX_GALLERY' => 0,
'S_LIGHTBOX_SIGNATURES' => 0,
'S_LIGHTBOX_IMG_TITLES' => 0,
'PHP_EXTENSION' => 'php',
)),
array(null, 1, 0, 1, array(
'LIGHTBOX_RESIZE_WIDTH' => 0,
'S_LIGHTBOX_GALLERY' => 1,
'S_LIGHTBOX_SIGNATURES' => 0,
'S_LIGHTBOX_IMG_TITLES' => 1,
'PHP_EXTENSION' => 'php',
)),
array(null, 1, 0, 0, array(
'LIGHTBOX_RESIZE_WIDTH' => 0,
'S_LIGHTBOX_GALLERY' => 1,
'S_LIGHTBOX_SIGNATURES' => 0,
'S_LIGHTBOX_IMG_TITLES' => 0,
'PHP_EXTENSION' => 'php',
)),
);
}
Expand Down

0 comments on commit 9015022

Please sign in to comment.