-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsoo_if_frontpage.php
44 lines (35 loc) · 1.03 KB
/
soo_if_frontpage.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
44
<?php
$plugin['version'] = '0.1.9';
$plugin['author'] = 'Jeff Soo';
$plugin['author_uri'] = 'http://ipsedixit.net/txp/';
$plugin['description'] = 'Check if page is a section front page';
$plugin['type'] = 0;
$plugin['allow_html_help'] = 1;
if (! defined('txpinterface')) {
global $compiler_cfg;
@include_once('config.php');
@include_once($compiler_cfg['path']);
}
# --- BEGIN PLUGIN CODE ---
if(class_exists('\Textpattern\Tag\Registry')) {
Txp::get('\Textpattern\Tag\Registry')
->register('soo_if_frontpage');
}
function soo_if_frontpage ($atts, $thing)
{
$atts = lAtts(array(
'section' => '',
'pg' => false,
), $atts);
global $s, $pg, $c, $q, $author, $month, $id, $p;
if (! $section = $atts['section']) {
$section = 'default';
}
return parse(EvalElse($thing,
($section == '*' || in_list($s, $section)) &&
(! $atts['pg'] || $pg < 2) &&
! ($c or $q or $author or $month or $id or $p)
));
}
# --- END PLUGIN CODE ---
?>