Dotclear

source: plugins/gallery/trunk/_prepend.php @ 2272

Revision 2272, 2.7 KB checked in by bruno, 14 years ago (diff)

Sanitized versions checking

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of Dotclear 2 Gallery plugin.
5#
6# Copyright (c) 2004-2008 Bruno Hondelatte, and contributors.
7# Many, many thanks to Olivier Meunier and the Dotclear Team.
8# Licensed under the GPL version 2.0 license.
9# See LICENSE file or
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11#
12# -- END LICENSE BLOCK ------------------------------------
13
14global $__autoload, $core;
15
16if (!$core->plugins->moduleExists('metadata')) return false;
17
18require (dirname(__FILE__).'/class.dc.rs.gallery.php');
19$GLOBALS['__autoload']['dcGallery'] = dirname(__FILE__).'/class.dc.gallery.php';
20$GLOBALS['__autoload']['dcRsGallery'] = dirname(__FILE__).'/class.dc.rs.gallery.php';
21$core->addBehavior('adminTemplateWidgetBeforeLoad',array('galleryConfigBehaviors','initWidgets'));
22
23
24class galleryConfigBehaviors {
25
26     public static function initWidgets ($template) {
27          $template->setPath(dirname(__FILE__).'/widgets',$template->getPath());
28     }
29}
30
31if (version_compare(DC_VERSION,'2.2-alpha','>=')) {
32     $core->blog->settings->addNamespace('gallery');
33     $gal_settings =& $core->blog->settings->gallery;
34} else {
35     $core->blog->settings->setNamespace('gallery');
36     $gal_settings =& $core->blog->settings;
37}
38
39/* URL Handlers for galleries lists, galleries and images */
40if ($gal_settings->gallery_enabled) {
41     $core->gallery = new dcGallery($core);
42     $core->url->register('gal',$core->blog->settings->gallery->gallery_gallery_url_prefix,'^'
43          .$core->blog->settings->gallery->gallery_gallery_url_prefix.'/(.+)$',array('urlGallery','gallery'));
44     $core->url->register('galleries',$core->blog->settings->gallery->gallery_galleries_url_prefix,'^'
45          .$core->blog->settings->gallery->gallery_galleries_url_prefix.'(.*)$',array('urlGallery','galleries'));
46     $core->url->register('galitem',$core->blog->settings->gallery->gallery_image_url_prefix,'^'
47          .$core->blog->settings->gallery->gallery_image_url_prefix.'/(.+)$',array('urlGallery','image'));
48     $core->url->register('galtheme','gallerytheme','^gallerytheme/(.+/.+)$',array('urlGalleryProxy','galtheme'));
49
50     $core->url->register('gallerypreview','gallerypreview','^gallerypreview/(.+)$',array('urlGallery','gallerypreview'));
51     $core->url->register('imagepreview','imagepreview','^imagepreview/(.+)$',array('urlGallery','imagepreview'));
52     /* RNot yes implemented
53     $core->url->register('images','images','^images/(.+)$',array('urlGallery','images'));
54     $core->url->register('browse','browse','^browser$',array('urlGallery','browse'));
55     */
56     $core->setPostType('gal','plugin.php?p=gallery&amp;m=gal&amp;id=%d',$core->url->getBase('gal').'/%s');
57     $core->setPostType('galitem','plugin.php?p=gallery&amp;m=item&amp;id=%d',$core->url->getBase('galitem').'/%s');
58}
59?>
Note: See TracBrowser for help on using the repository browser.

Sites map