-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews_manager_auto_open.php
43 lines (38 loc) · 1.27 KB
/
news_manager_auto_open.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/*
Plugin: News Manager Auto-open Post Options
Requires: GetSimple CMS 3.1+, News Manager plugin
To enable auto-open only when creating new posts, add this to your site's gsconfig.php file:
define('NMAUTOOPEN','new');
To enable auto-open only when editing existing posts:
define('NMAUTOOPEN','edit');
To disable auto-open without deactivating the plugin:
define('NMAUTOOPEN',0);
*/
# get correct id for plugin
$thisfile = basename(__FILE__, '.php');
# register plugin
register_plugin(
$thisfile,
'News Manager Auto-open Post Options',
'0.2',
'Carlos Navarro',
'http://www.cyberiada.org/cnb/',
'Automatically open the post options when editing News Manager posts'
);
add_action('footer', 'nmautoopen_footer_include');
function nmautoopen_footer_include() {
if (basename($_SERVER['PHP_SELF']) == 'load.php' && isset($_GET['id']) && $_GET['id'] == 'news_manager' && isset($_GET['edit'])) {
$nmautoopen = defined('NMAUTOOPEN') ? trim(NMAUTOOPEN) : true;
if ($nmautoopen && ($nmautoopen !== 'new' || empty($_GET['edit'])) && ($nmautoopen !== 'edit' || !empty($_GET['edit']))) {
?>
<script type="text/javascript">
$(function() {
$("#metadata_window").slideToggle('fast');
$("#metadata_toggle").toggleClass('current');
});
</script>
<?php
}
}
}