Here is a list of very simple plugins you can use with LocalFilesEditor. Just paste the snippet in Local Files Editor → Personal Plugin area and enable it at Plugin → Manager.
On thumbnails list, if you have severals items, you may want to display the navigation bar on the top in addition to the bottom one.
<?php /* Plugin Name: Navbar on top Version: 1.0 Author: Mistic Author URI: http://www.strangeplanet.fr */ add_event_handler('loc_end_index', 'top_navbar'); function top_navbar() { global $template; $template->set_prefilter('index', 'top_navbar_prefilter'); } function top_navbar_prefilter($content, &$smarty) { $search = '{if !empty($CATEGORIES)}{$CATEGORIES}{/if}'; $add = '{if !empty($navbar)}{include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'}{/if}'; return str_replace($search, $add.$search, $content); } ?>
<?php /* Plugin Name: Remove breadcrumb photocounter Version: 1.0 Author: barbichou */ add_event_handler('loc_end_index', 'no_breadcrumb_counter'); function no_breadcrumb_counter() { global $template; $titre = $template->get_template_vars('TITLE'); $pos = strrpos($titre,"["); if ($pos !== false) { $template->assign('TITLE', substr($titre, 0, $pos)); } } ?>
This plugins displays only the last album name in page title, not the full tree.
<?php /* Plugin Name: One level in page title Version: 1.0 Author: barbichou */ add_event_handler('loc_end_page_header', 'one_level_pagetitle'); function one_level_pagetitle() { global $template, $conf; $titre = $template->get_template_vars('PAGE_TITLE'); $pos = strrpos($titre, $conf['level_separator']); if ($pos!==false) { $template->assign('PAGE_TITLE', substr($titre, $pos+strlen($conf['level_separator']))); } } ?>
This plugin allows to give URL with a additional parameter witch will force the current theme. For exemple : http://mysite.com/picture.php?/246/category/186&temp_theme=Stripped will open this picture page with the theme Stripped whatever is the default theme. Only works for picture page.
<?php /* Plugin Name: Theme Switch From URL Version: 1.0 Author: Mistic Author URI: http://www.strangeplanet.fr */ add_event_handler('user_init', 'theme_controler_lite1'); add_event_handler('init', 'theme_controler_lite2'); function theme_controler_lite1() { global $user; if ( isset($_GET['temp_theme']) and file_exists(PHPWG_THEMES_PATH.$_GET['temp_theme']) ) { $user['theme'] = $_GET['temp_theme']; } } function theme_controler_lite2() { global $template; if ( isset($_GET['temp_theme']) and file_exists(PHPWG_THEMES_PATH.$_GET['temp_theme']) ) { $template->assign('TEMP_THEME', $_GET['temp_theme']); $template->set_prefilter('picture', 'theme_controler_lite_prefilter'); } } function theme_controler_lite_prefilter($content) { global $conf; if ($conf['question_mark_in_urls']==false) { $search = '#(action|href)="([^?"]*)"#'; $replace = '$1="$2?temp_theme={$TEMP_THEME}"'; } else { $search = '#(action|href)="([^"]*)"#'; $replace = '$1="$2&temp_theme={$TEMP_THEME}"'; } return preg_replace($search, $replace, $content); } ?>
This adds a simple button to smoothly scroll the page to the top, the links appears after 100px of scroll down.
<?php /* Plugin Name: Scroll To Top Version: 1.0 Author: Mistic Author URI: http://www.strangeplanet.fr */ add_event_handler('loc_end_page_header', 'scroll_to_top'); function scroll_to_top() { global $template; $template->set_prefilter('header', 'scroll_to_top_pref', 100); } function scroll_to_top_pref($content) { $search = '<body id="{$BODY_ID}">'; $scroll = ' {html_style}{literal} .scrollup { width:48px; height:48px; opacity:0.7; position:fixed; border-radius:24px; bottom:50px; right:50px; display:none; text-indent:-9999px; background: rgba(255,255,255,0.8) url("http://cdn4.iconfinder.com/data/icons/cc_mono_icon_set/blacks/48x48/round_and_up.png") no-repeat; z-index:1000; border:none !important; text-decoration:none !important; } .scrollup:hover { opacity:1; } {/literal}{/html_style} {footer_script}{literal} jQuery(window).scroll(function(){ if (jQuery(this).scrollTop() > 100) { jQuery(".scrollup").fadeIn(); } else { jQuery(".scrollup").fadeOut(); } }); jQuery(".scrollup").click(function(){ jQuery("html, body").animate({ scrollTop: 0 }, 600); return false; }); {/literal}{/footer_script} <a href="#" class="scrollup">Scroll</a>'; return str_replace($search, $search.$scroll, $content); } ?>
For Piwigo 2.5 and bellow
<?php /* Plugin Name: AddUserLanguage Version: 2.2 Description: Displays users language in user management panel Author: Eric Author URI: http://www.infernoweb.net */ /* Add language colomn in user management panel */ add_event_handler('loc_visible_user_list', 'personal_loc_visible_user_list'); function personal_loc_visible_user_list($visible_user_list) { global $template; $template->append('plugin_user_list_column_titles', l10n('Language')); $user_ids = array(); foreach ($visible_user_list as $i => $user) { $user_ids[$i] = $user['id']; } $user_nums = array_flip($user_ids); $languages = get_languages(); /* Sql request to fill the language fields */ if (!empty($user_ids)) { $query = ' SELECT DISTINCT user_id, language FROM '.USER_INFOS_TABLE.' WHERE user_id IN ('.implode(',', $user_ids).') ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { $visible_user_list[$user_nums[$row['user_id']]]['plugin_columns'][] = $languages[$row['language']];; } } return $visible_user_list; } ?>
<?php /* Plugin Name: Image on Guestbook Version: 1.0 Author: Mistic */ define('GB_IMAGE_ID', 77); define('GB_IMAGE_SIZE', IMG_SMALL); add_event_handler('loc_end_index', 'add_guestbook_image', EVENT_HANDLER_PRIORITY_NEUTRAL-10); function add_guestbook_image() { global $page, $template; if (@$page['section'] == 'guestbook') { $query = 'SELECT * FROM ' . IMAGES_TABLE . ' WHERE id = ' . GB_IMAGE_ID . ';'; $picture = pwg_db_fetch_assoc(pwg_query($query)); // -- Piwigo 2.5 $src_image = new SrcImage($picture); $derivatives = DerivativeImage::get_all($src_image); $selected_derivative = $derivatives[GB_IMAGE_SIZE]; $template->assign('gb_image', $selected_derivative); $template->set_prefilter('index', 'add_guestbook_image_prefilter'); // -- Piwigo 2.6 //$selected_derivative = DerivativeImage::get_one(GB_IMAGE_SIZE, $picture); //$template->assign('gb_image', $selected_derivative); //$template->set_prefilter('guestbook', 'add_guestbook_image_prefilter'); } } function add_guestbook_image_prefilter($content) { $search = '{if isset($comment_add)}'; $add = '<div style="text-align:center;"><img src="{$gb_image->get_url()}" {$gb_image->get_size_htm()}"></div>'; return str_replace($search, $add."\n".$search, $content); } ?>
<?php /* Plugin Name: Hide website field on comment form Version: 1.0 Author: plg */ add_event_handler('loc_end_picture', 'hide_website_in_comment'); function hide_website_in_comment() { global $template; $template->set_prefilter('picture', 'hide_website_in_comment_prefilter'); } function hide_website_in_comment_prefilter($content, &$smarty) { $pattern = '#<p><label for="website_url">.*WEBSITE_URL}"></p>#ms'; $replacement = ''; $content = preg_replace($pattern, $replacement, $content); return $content; } ?>
<?php /* Plugin Name: Hide albums in menubar on login page Version: 1.0 Author: plg */ add_event_handler('blockmanager_apply' , 'identification_hide_menubar_albums', EVENT_HANDLER_PRIORITY_NEUTRAL+10); function identification_hide_menubar_albums($menu_ref_arr) { if (script_basename() == 'identification') { $menu_ref_arr[0]->hide_block('mbCategories'); } }
This allows to define a particular number of photos per page for each album.
<?php /* Plugin Name: Custom photo number Version: 1.0 Author: ddtddt & Mistic */ add_event_handler('loc_begin_index', 'modifynbthumbnail'); global $customPhotoNumber; $customPhotoNumber = array( 1 => 5, // 5 photos per page for album #1 2 => 10, // 10 photos per page for album #2 ); function modifynbthumbnail() { global $page, $customPhotoNumber; if (!empty($page['category']['id']) && isset($customPhotoNumber[$page['category']['id']])) { $page['nb_image_page'] = $customPhotoNumber[$page['category']['id']]; } }
More to come…