-
Notifications
You must be signed in to change notification settings - Fork 0
/
bw_block.inc
127 lines (106 loc) · 2.85 KB
/
bw_block.inc
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/* bw_block.inc
oik blocks functions for themes not developed with Artisteer
Note: These function have only been tried out with Twenty-Eleven and the default BuddyPress theme
They are here simply to support development when we have to revert to a non-Artisteer theme but still want to use
the [bw_block] and [bw_eblock] shortcode.
*/
/**
* Syntax [bw_block class="classes" title="title text" framed="y/n,t/f,1/0"]
* Future use parameters are
* prefix="art-"
* level="h3" - heading level for the block title
*/
function bw_block_( $atts ) {
bw_trace( $atts, __FUNCTION__, __LINE__, __FILE__, "atts" );
extract( shortcode_atts( array(
'prefix' => 'art-',
'level' => 'h3',
'title' => NULL,
'framed' => true,
'class' => NULL,
), $atts ) );
/* We can't pass the prefix or heading level yet */
/* the block is enclosed in a div which can be used to control the width and depth
We save the div_class just in case it's needed in the bw_eblock processing
Actually, this is a bit daft. Since it is possible to nest blocks within blocks
the saved value will be that of the most recently nested blocks. So if we wanted to be able to do something with
it we would need to manage a stack.
*/
$framed = bw_validate_torf( $framed );
global $div_class;
$div_class = $class;
sdiv( $class );
sblock_( $title, $framed );
return( bw_ret());
}
/**
* Syntax for [bw_eblock]
* There are no parameters. We use this shortcode to end a block
* Using this technique means we can nest blocks within blocks.
*/
function bw_eblock_( $atts ) {
eblock_();
return( bw_ret());
}
/**
* Future use function
*/
function bw_header_( $atts ) {
extract( shortcode_atts( array(
'prefix' => 'art-',
'level' => 'h3',
'title' => NULL,
'link' => NULL
), $atts ) );
blockheader_( $title );
return( bw_ret());
}
/**
* Create a block header if the title text is specified
*/
function blockheader_( $title=NULL, $link=NULL, $icon=NULL ) {
if ( $title ) {
sdiv( "blockheader");
h3( $title );
ediv();
}
}
/**
* draw the frame around the block header
*/
function blockframe_() {
}
/**
* draw the frame around the block content
*/
function blockcontentframe_() {
}
/**
* start a block
*/
function sblock_( $title=NULL, $framed=TRUE ) {
sdiv( "block" );
if ($framed )
{
blockframe_();
}
blockheader_( $title );
sdiv( "blockcontent" );
if ( $framed ) {
blockcontentframe_();
}
sdiv( "blockcontent-body ");
}
/**
* end an Artisteer style block
*/
function eblock_( $contentFunc = NULL ) {
if ( !is_null( $contentFunc ))
$contentFunc();
ediv(); // blockcontent-body
ediv(); // blockcontent
ediv(); // block
global $div_class;
ediv( $div_class );
}