-
Notifications
You must be signed in to change notification settings - Fork 0
/
section.plugin.php
55 lines (46 loc) · 1.37 KB
/
section.plugin.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
45
46
47
48
49
50
51
52
53
54
55
<?php
class Section extends Plugin
{
const URL_SPACE = 'blog';
public function filter_default_rewrite_rules( $rules ) {
$rules[] = array(
'name' => 'display_multiple',
'parse_regex' => '%^' . self::URL_SPACE . '(/page/(?P<page>\d+))?/?$%i',
'build_str' => self::URL_SPACE . '(/page/{$page})',
'handler' => 'UserThemeHandler',
'action' => 'display_multiple',
'priority' => 5,
'description' => 'Create a section',
);
$rules[] = array(
'name' => 'display_single',
'parse_regex' => '%^' . self::URL_SPACE . '/(?P<slug>[^/]*)?/?$%i',
'build_str' => self::URL_SPACE . '/{$slug}',
'handler' => 'UserThemeHandler',
'action' => 'display_single',
'priority' => 2,
'description' => 'Display a entries from a section',
);
return $rules;
}
public function filter_theme_act_display_multiple( $handled, $theme ) {
$paramarray = array();
$paramarray['fallback'] = array(
'section.multiple'
);
$default_filters = array(
'content_type' => Post::type( 'entry' ),
);
$paramarray[ 'user_filters' ] = $default_filters;
$theme->act_display( $paramarray );
}
public function filter_theme_act_display_single( $handled, $theme ) {
$paramarray = array();
$paramarray['fallback'] = array(
'section.single'
);
$paramarray[ 'user_filters' ] = $default_filters;
$theme->act_display( $paramarray );
}
}
?>