<?php
/*
* Unprotected pages
*
* Allows make any page unprotected in private gallery.
*
* @author Stephen Billard (sbillard)
*
* @Copyright 2019 by Stephen L Billard for use in {@link https://%GITHUB% netPhotoGraphics} and derivatives
*
* @pluginCategory tools
*
*/
$plugin_is_filter = 9 | FEATURE_PLUGIN;
$plugin_description = gettext('Allows make any page unprotected in private gallery.');
npgFilters::register('isUnprotectedPage', 'test_protection');
function test_protection($allow, $page) {
switch ($page) {
case 'pages':
global $_CMS_current_page;
return in_array($_CMS_current_page->getTitleLink(), array('predmluva', 'podekovani'));
case 'news':
return true;
break;
}
return $allow;
}
Can you crush to me how to show pages like in gallery setting - unprotected pages part? (have checkbox to check page in plugin setting)
After all, you will teach me to write in PHP through this exercises.
Please ask questions about this code--that is the way you learn. But try to do a little research before asking. For instance look up the functions used to see if you can understand what they do.
1. Yes, the box could be made a different size. The UL class "shortchecklist" is what controls this box. You could use a different class and properly define it. The horizontal slider only comes on if your titles are too large, so you could also shorten them.
(NOTE: I have updated the admin.css to give more room on this class--seems other uses can benefit.)
2. If lots of people want this to be official, it could be done. But if you are the only user....
Well, I got interested in this. I have fixed the display size issues and also implemented a new custom option type to simplify this kind of option. I also implemented "public" news categories. (Note that uncategorized news articles are public by default!)
All this means the plugin has a definite dependency on the netPhotoGraphics release, so I have decided to include it as a standard plugin. The name is now "publicCMS". The implementation is in the .07 development release.