Revision 1751
Added by Dietmar about 12 years ago
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_uppercase.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension uppercase |
|
4 |
* Converts String to uppercase |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('NAME', 'John Doe'); |
|
8 |
* Template: Username: {uppercase:NAME} |
|
9 |
* Result: Username: JOHN DOE |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_uppercase ( $param ) { |
|
14 |
return strtoupper( $param ); |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_current_datetime.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension current_datetime |
|
4 |
* Print Current Date and Time |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Template: Time: {current_datetime:} |
|
8 |
* Result: Time: 01.01.2009 - 12:46:00 |
|
9 |
* |
|
10 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
11 |
*/ |
|
12 |
function qx_current_datetime () { |
|
13 |
global $_CONFIG; |
|
14 |
|
|
15 |
$datetimeFormat = 'F j, Y H:i:s'; |
|
16 |
if ( !empty($_CONFIG['datetime_format']) ) { |
|
17 |
$datetimeFormat = $_CONFIG['datetime_format']; |
|
18 |
} |
|
19 |
return date( $datetimeFormat ); |
|
20 |
} |
|
21 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_nvl.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension nvl |
|
4 |
* Insert a default value if variable is empty |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('PREVIEW1', 'picture_21.gif'); |
|
8 |
* Template: <img src="{nvl:PREVIEW1,'not_available.gif'}"> / <img src="{nvl:PREVIEW2,'not_available.gif'}"> |
|
9 |
* Result: <img src="picture_21.gif"> / <img src="not_available.gif"> |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_nvl ( $param, $default ) { |
|
14 |
if (strlen($param)) { |
|
15 |
return ( $param ); |
|
16 |
} else { |
|
17 |
return ( $default ); |
|
18 |
} |
|
19 |
} |
|
20 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_mailtoencode.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension mailtoencode |
|
4 |
* Protects email address from being scanned by spam bots |
|
5 |
* and optionally builds full mailto: link |
|
6 |
* |
|
7 |
* Usage Example 1: |
|
8 |
* Content: $template->assign('AUTHOR', 'yourname@yourdomain.com' ); |
|
9 |
* Template: Author: {mailtoencode:AUTHOR} |
|
10 |
* Result: Author: <a href="mailto:yourname@yourdomain.com">yourname@yourdomain.com</a> |
|
11 |
* |
|
12 |
* Usage Example 2 (Email address only): |
|
13 |
* Template: Author: {mailtoencode:"yourname@yourdomain.com"} |
|
14 |
* Result: Author: <a href="mailto:yourname@yourdomain.com">yourname@yourdomain.com</a> |
|
15 |
* |
|
16 |
* Usage Example 3 (Email address and name): |
|
17 |
* Template: Author: {mailtoencode:"yourname@yourdomain.com","Your Name"} |
|
18 |
* Result: Author: <a href="mailto:yourname@yourdomain.com">Your Name</a> |
|
19 |
* |
|
20 |
* Usage Example 4 (Email address and name, encode set to true, and class name): |
|
21 |
* Template: Author: {mailtoencode:"yourname@yourdomain.com","Your Name",true,'white'} |
|
22 |
* Result: Author: <a href="mailto:yourname@yourdomain.com" class="white">Your Name</a> |
|
23 |
* |
|
24 |
* Usage Example 5 (Email address and name, encode set to true, class name and style defined): |
|
25 |
* Template: Author: {mailtoencode:"yourname@yourdomain.com","Your Name",true,'white','font-size:18px;'} |
|
26 |
* Result: Author: <a href="mailto:yourname@yourdomain.com" class="white" style="font-size:18px;">Your Name</a> |
|
27 |
* |
|
28 |
* Usage Example 6 (Email address and name, encode set to true, no class name and style defined): |
|
29 |
* Template: Author: {mailtoencode:"yourname@yourdomain.com","Your Name",true,'','font-size:18px;'} |
|
30 |
* Result: Author: <a href="mailto:yourname@yourdomain.com" style="font-size:18px;">Your Name</a> |
|
31 |
* |
|
32 |
* @author Andy Prevost andy@codeworxtech.com |
|
33 |
*/ |
|
34 |
|
|
35 |
if(!function_exists('str_split')){ |
|
36 |
function str_split($text, $split = 1){ |
|
37 |
$array = array(); |
|
38 |
for($i=0; $i < strlen($text); $i++){ |
|
39 |
$key = NULL; |
|
40 |
for ($j = 0; $j < $split; $j++){ |
|
41 |
$key .= $text[$i]; |
|
42 |
} |
|
43 |
array_push($array, $key); |
|
44 |
} |
|
45 |
return $array; |
|
46 |
} |
|
47 |
} |
|
48 |
|
|
49 |
function qx_mailtoencode ($emailAddy,$text='',$buildLink=true,$class='',$style='') { |
|
50 |
if ( $buildLink ) { |
|
51 |
// mailto: portion |
|
52 |
$obfuscatedMailTo = ''; |
|
53 |
$mailto = "mailto:"; |
|
54 |
$length = strlen($mailto); |
|
55 |
for ($i = 0; $i < $length; $i++) { |
|
56 |
$obfuscatedMailTo .= "&#" . ord($mailto[$i]); |
|
57 |
} |
|
58 |
// END - mailto: portion |
|
59 |
$emailLink = '<a href="'; |
|
60 |
$emailLink .= $obfuscatedMailTo; |
|
61 |
} |
|
62 |
$emailLink .= obfuscate($emailAddy); |
|
63 |
if ( $buildLink ) { |
|
64 |
$emailLink .= '"'; |
|
65 |
if ( trim($class) != '' ) { |
|
66 |
$emailLink .= ' class="' . $class . '"'; |
|
67 |
} |
|
68 |
if ( trim($style) != '' ) { |
|
69 |
$emailLink .= ' style="' . $style . '"'; |
|
70 |
} |
|
71 |
$emailLink .= '>'; |
|
72 |
if ( trim($text) != '' ) { |
|
73 |
$newText = trim($text); |
|
74 |
$newText = str_replace('@','@',$newText); |
|
75 |
$newText = str_replace('.','.',$newText); |
|
76 |
$emailLink .= $newText; |
|
77 |
} else { |
|
78 |
$newText = trim($emailAddy); |
|
79 |
$newText = str_replace('@','@',$newText); |
|
80 |
$newText = str_replace('.','.',$newText); |
|
81 |
$emailLink .= $newText; |
|
82 |
} |
|
83 |
$emailLink .= "</a>"; |
|
84 |
} |
|
85 |
return $emailLink; |
|
86 |
} |
|
87 |
|
|
88 |
function obfuscate($text) { // NOTE: Uses function str_split |
|
89 |
preg_match_all("/[-a-z0-9\._]+@[-a-z0-9\._]+\.[a-z]{2,4}/", $text, $emails); |
|
90 |
$patterns = array(); |
|
91 |
$replacements = array(); |
|
92 |
foreach($emails[0] as $email) { |
|
93 |
if(!in_array("/$email/", $patterns)) { |
|
94 |
$obfuscated = ''; |
|
95 |
foreach(str_split($email) as $char) { |
|
96 |
$obfuscated .= '&#'.ord($char).';'; |
|
97 |
} |
|
98 |
$patterns[] = "/$email/"; |
|
99 |
$replacements[] = $obfuscated; |
|
100 |
} |
|
101 |
} |
|
102 |
$text = preg_replace($patterns, $replacements, $text); |
|
103 |
return $text; |
|
104 |
} |
|
105 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_current_date.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension current_date |
|
4 |
* Print Current Date |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Template: Today: {current_date:} |
|
8 |
* Result: Today: 30.01.2003 |
|
9 |
* |
|
10 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
11 |
*/ |
|
12 |
function qx_current_date () { |
|
13 |
global $_CONFIG; |
|
14 |
|
|
15 |
$dateFormat = 'F j, Y'; |
|
16 |
if ( !empty($_CONFIG['date_format']) ) { |
|
17 |
$dateFormat = $_CONFIG['date_format']; |
|
18 |
} |
|
19 |
return date( $dateFormat ); |
|
20 |
} |
|
21 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_WB_TXT.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension WB_TXT |
|
4 |
* This function will replace the string with the value of WebsiteBaker CMS's $TEXT[] array |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* in Template use:{WB_TXT:"SAVE"} |
|
8 |
* returns the translated string |
|
9 |
* |
|
10 |
* @author WebsiteBaker Org e.V. |
|
11 |
* |
|
12 |
*/ |
|
13 |
function qx_WB_TXT ( $var ) { |
|
14 |
$LANG_ARRAY = $GLOBALS['TEXT']; |
|
15 |
$ret_val = isset($LANG_ARRAY[$var]) ? $LANG_ARRAY[$var] : ('<span style="color:#777">'.$var.'</span>'); |
|
16 |
return $ret_val; |
|
17 |
} |
|
18 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_codesnippetend.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension codesnippetend |
|
4 |
* required for the end of a code snippet |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Template: Code Snippet<br />{codesnippetend:} |
|
8 |
* |
|
9 |
* @author Andy Prevost andy@codeworxtech.com |
|
10 |
*/ |
|
11 |
function qx_codesnippetend () { |
|
12 |
return '</pre>'; |
|
13 |
} |
|
14 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_replace.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension replace |
|
4 |
* String Replace |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('PATH', $path_tranlated); // C:\Apache\htdocs\php\test.php |
|
8 |
* Template: Script Name: {replace:PATH,'\\','/'} |
|
9 |
* Result: Script Name: C:/Apache/htdocs/php/test.php |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_replace ( $param, $pattern, $replace ) { |
|
14 |
return str_replace( $pattern, $replace, $param ); |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_mailto.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension mailto |
|
4 |
* creates Mailto-Link from email address |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('CONTACT', 'philipp@criegern.de' ); |
|
8 |
* Template: Mail to Webmaster: {mailto:CONTACT} |
|
9 |
* Result: Mail to Webmaster: <a href="mailto:philipp@criegern.de">philipp@criegern.de</a> |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com |
|
12 |
*/ |
|
13 |
function qx_mailto ( $param,$name='',$encode=false ) { |
|
14 |
if ($encode === false) { |
|
15 |
if ( $name != '' ) { |
|
16 |
return '<a href="mailto:' . $param . '">' . $name . '</a>'; |
|
17 |
} else { |
|
18 |
return '<a href="mailto:' . $param . '">' . $param . '</a>'; |
|
19 |
} |
|
20 |
} else { |
|
21 |
$obfuscatedMailTo = ''; |
|
22 |
$mailto = "mailto:"; |
|
23 |
$length = strlen($mailto); |
|
24 |
for ($i = 0; $i < $length; $i++) { |
|
25 |
$obfuscatedMailTo .= "&#" . ord($mailto[$i]); |
|
26 |
} |
|
27 |
$mailto = $param; |
|
28 |
$length = strlen($mailto); |
|
29 |
$param = ''; |
|
30 |
for ($i = 0; $i < $length; $i++) { |
|
31 |
$param .= "&#" . ord($mailto[$i]); |
|
32 |
} |
|
33 |
if ( $name != '' ) { |
|
34 |
$mailto = $name; |
|
35 |
$length = strlen($mailto); |
|
36 |
$name = ''; |
|
37 |
for ($i = 0; $i < $length; $i++) { |
|
38 |
$name .= "&#" . ord($mailto[$i]); |
|
39 |
} |
|
40 |
return '<a href="' . $obfuscatedMailTo . ':' . $param . '">' . $name . '</a>'; |
|
41 |
} else { |
|
42 |
return '<a href="' . $obfuscatedMailTo . ':' . $param . '">' . $param . '</a>'; |
|
43 |
} |
|
44 |
|
|
45 |
} |
|
46 |
} |
|
47 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_current_time.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension current_time |
|
4 |
* Print Current Time |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Template: Time: {current_time:} |
|
8 |
* Result: Time: 12:46:00 |
|
9 |
* |
|
10 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
11 |
*/ |
|
12 |
function qx_current_time ($meridiem='A') { |
|
13 |
global $_CONFIG; |
|
14 |
|
|
15 |
$timeFormat = 'g:i:s ' . $meridiem; |
|
16 |
if ( !empty($_CONFIG['time_format']) ) { |
|
17 |
$timeFormat = $_CONFIG['time_format']; |
|
18 |
} |
|
19 |
return date( $timeFormat ); |
|
20 |
} |
|
21 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_vardump.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension vardump |
|
4 |
* Prints variable content for debug purpose |
|
5 |
* |
|
6 |
* Usage Example I: |
|
7 |
* Content: $template->assign('test', array( "name1", "value1", "name2", "value2" ) ); |
|
8 |
* |
|
9 |
* Template: DEBUG: {vardump:test} |
|
10 |
* |
|
11 |
* Result: DEBUG: Array |
|
12 |
* ( |
|
13 |
* [name1] => value1 |
|
14 |
* [name2] => value2 |
|
15 |
* ) |
|
16 |
* |
|
17 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
18 |
*/ |
|
19 |
function qx_vardump ( $param ) { |
|
20 |
return '<pre>' . print_r($param, true) . '</pre>'; |
|
21 |
} |
|
22 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_trim.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension trim |
|
4 |
* Removes leading and trailing Whitespaces and Line Feeds |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('LINK', ' Click Here '); |
|
8 |
* Template: <a href="/">{trim:LINK}</a> |
|
9 |
* Result: <a href="/">Click Here</a> |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_trim ( $param ) { |
|
14 |
return trim( $param ); |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_encode.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension encode |
|
4 |
* Encodes String (md5) |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('ID', 123); |
|
8 |
* Template: <a href="delete.php?id={encode:ID}">delete</a> |
|
9 |
* Result: <a href="delete.php?id=7B600B6476167773626A">delete</a> |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com |
|
12 |
*/ |
|
13 |
|
|
14 |
function qx_encode ( $param ) { |
|
15 |
return md5( $param ); |
|
16 |
} |
|
17 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_rawlang.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
function qx_rawlang($var) { |
|
4 |
$retval = '{'.$var.'}'; |
|
5 |
$arr = explode('_', $var); |
|
6 |
$var0 = array_shift($arr); |
|
7 |
while( sizeof($arr) > 0 ) { |
|
8 |
$var1 = implode('_', $arr); |
|
9 |
$retval = ( isset($GLOBALS[$var0][$var1]) ? $GLOBALS[$var0][$var1] : $retval ); |
|
10 |
$var0 .= '_'.array_shift($arr); |
|
11 |
} |
|
12 |
return rawurlencode ($retval); |
|
13 |
} |
|
14 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_specialchars.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension specialchars |
|
4 |
* Converts HTML Entities 2 Special Characters |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('NEXT', 'Next Page >>'); |
|
8 |
* Template: <a href="next.php">{specialchars:NEXT}</a> |
|
9 |
* Result: <a href="next.php">Next Page >></a> |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_specialchars ( $param ) { |
|
14 |
return htmlspecialchars( $param ); |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_htmlentities.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension htmlentities |
|
4 |
* Converts Special Characters to HTML Entities |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('NEXT', 'Next Page >>'); |
|
8 |
* Template: <a href="next.php">{htmlentities:NEXT}</a> |
|
9 |
* Result: <a href="next.php">Next Page >></a> |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_htmlentities ( $param ) { |
|
14 |
return htmlentities( $param ); |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_db_date.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension db_date |
|
4 |
* Convert Oracle Date (British Format) to Local Formatted Date |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('UPDATE', $result['LAST_UPDATE_DATE_TIME']); |
|
8 |
* Template: Last update: {db_date:UPDATE} |
|
9 |
* Result: Last update: 30.01.2003 |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_db_date ( $param ) { |
|
14 |
global $configuration; |
|
15 |
|
|
16 |
if (preg_match('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $param)) { |
|
17 |
return date( $configuration['date_format'], strtotime($param) ); |
|
18 |
} else { |
|
19 |
return 'Invalid date format!'; |
|
20 |
} |
|
21 |
} |
|
22 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_db_time.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension db_time |
|
4 |
* Convert Oracle Date (British Format) to Local Formatted Time |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('UPDATE', $result['LAST_UPDATE_DATE_TIME']); |
|
8 |
* Template: Last update: {db_time:UPDATE} |
|
9 |
* Result: Last update: 12:46:00 |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_db_time ( $param ) { |
|
14 |
global $configuration; |
|
15 |
|
|
16 |
if (preg_match('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $param)) { |
|
17 |
return date( $configuration['time_format'], strtotime($param) ); |
|
18 |
} else { |
|
19 |
return 'Invalid date format!'; |
|
20 |
} |
|
21 |
} |
|
22 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_globals.php | ||
---|---|---|
1 |
<?php |
|
2 |
function qx_globals($var) { |
|
3 |
$retval = '{'.$var.'}'; |
|
4 |
$retval = (array_key_exists ( $var, $GLOBALS ) ? $GLOBALS[$var] : $retval); |
|
5 |
return $retval; |
|
6 |
} |
|
7 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_regex.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension regex |
|
4 |
* Regular Expression String Replace |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('NAME', '*My Document*'); |
|
8 |
* Template: Document Name: {regex:NAME,'/[^a-z0-9]/i','_'} |
|
9 |
* Result: Document Name: _My_Document_ |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_regex ( $param, $pattern, $replace ) { |
|
14 |
return preg_replace( $pattern, $replace, $param ); |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_WB_HEADING.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension WB_HEADING |
|
4 |
* This function will replace the string with the value of WebsiteBaker CMS's $HEADING[] array |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* in Template use:{WB_HEADING:"GENERAL_SETTINGS"} |
|
8 |
* returns the translated string |
|
9 |
* |
|
10 |
* @author WebsiteBaker Org e.V. |
|
11 |
* |
|
12 |
*/ |
|
13 |
function qx_WB_HEADING ( $var ) { |
|
14 |
$LANG_ARRAY = $GLOBALS['HEADING']; |
|
15 |
$ret_val = isset($LANG_ARRAY[$var]) ? $LANG_ARRAY[$var] : ('<span style="color:#777">'.$var.'</span>'); |
|
16 |
return $ret_val; |
|
17 |
} |
|
18 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_hidemail.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension hidemail |
|
4 |
* Protects email address from being scanned by spam bots |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('AUTHOR', 'andy@codeworxtech.com' ); |
|
8 |
* Template: Author: {hidemail:AUTHOR} |
|
9 |
* Result Source: Author: andy@codeworxtech.com |
|
10 |
* Result Display: Author: andy@codeworxtech.com |
|
11 |
* |
|
12 |
* @author Andy Prevost andy@codeworxtech.com |
|
13 |
*/ |
|
14 |
function qx_hidemail ( $param ) { |
|
15 |
return str_replace('@', '@', str_replace('.', '.', $param)); |
|
16 |
} |
|
17 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/index.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* |
|
4 |
* @category Security |
|
5 |
* @package FolderProtectFile |
|
6 |
* @author WebsiteBaker Project |
|
7 |
* @copyright 2009-2011, Website Baker Org. e.V. |
|
8 |
* @link http://www.websitebaker2.org/ |
|
9 |
* @license http://www.gnu.org/licenses/gpl.html |
|
10 |
* @platform WebsiteBaker 2.8.x |
|
11 |
* @requirements PHP 5.2.2 and higher |
|
12 |
* @version $Id$ |
|
13 |
* @filesource $HeadURL$ |
|
14 |
* @lastmodified $Date$ |
|
15 |
* |
|
16 |
*/ |
|
17 |
|
|
18 |
header('HTTP/1.1 301 Moved Permanently'); |
|
19 |
header("Location: ../../../index.php"); |
|
20 |
|
|
21 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_session.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension session |
|
4 |
* Print Content of Session variables |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $_SESSION['userName'] = 'Philipp von Criegern'; |
|
8 |
* Template: Current User: {session:"userName"} |
|
9 |
* Result: Current User: Philipp von Criegern |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_session ( $param ) { |
|
14 |
return $_SESSION[$param]; |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_number.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension number |
|
4 |
* Format a number with grouped thousands |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('SUM', 2500000); |
|
8 |
* Template: Current balance: {number:SUM} |
|
9 |
* Result: Current balance: 2.500.000,00 |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_number ( $param ) { |
|
14 |
global $_CONFIG; |
|
15 |
|
|
16 |
$decimalChar = ','; |
|
17 |
if ( !empty($_CONFIG['decimal_char']) ) { |
|
18 |
$decimalChar = $_CONFIG['decimal_char']; |
|
19 |
} |
|
20 |
$decimalPlaces = 2; |
|
21 |
if ( !empty($_CONFIG['decimal_places']) ) { |
|
22 |
$decimalPlaces = $_CONFIG['decimal_places']; |
|
23 |
} |
|
24 |
$thousandsSep = '.'; |
|
25 |
if ( !empty($_CONFIG['thousands_sep']) ) { |
|
26 |
$thousandsSep = $_CONFIG['thousands_sep']; |
|
27 |
} |
|
28 |
|
|
29 |
return number_format( $param, $decimalChar, $decimalPlaces, $thousandsSep ); |
|
30 |
} |
|
31 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_options.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension options |
|
4 |
* Creates HTML DropDown Option list from an array |
|
5 |
* |
|
6 |
* Usage Example I: |
|
7 |
* Content: $template->assign('pick', array( "on", "off" ) ); |
|
8 |
* Template: Choose: <select name="onoff"> {options:pick} </select> |
|
9 |
* Result: Choose: <select name="onoff"> <option>on</option><option>off</option> </select> |
|
10 |
* |
|
11 |
* Usage Example II: |
|
12 |
* Content: $template->assign('color', array( "FF0000" => "Red", "00FF00" => "Green", "0000FF" => "Blue" ) ); |
|
13 |
* $template->assign('default', "00FF00" ); |
|
14 |
* Template: Color: <select name="col"> {options:color,default} </select> |
|
15 |
* Result: Color: <select name="col"> <option value="FF0000">Red</option><option value="00FF00" selected>Green</option><option value="0000FF">Blue</option> </select> |
|
16 |
* |
|
17 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
18 |
*/ |
|
19 |
function qx_options ( $param, $default = '_DEFAULT_' ) { |
|
20 |
$output = ''; |
|
21 |
if (is_array($param)) { |
|
22 |
$keyindex = 0; |
|
23 |
foreach ($param as $key => $value) { |
|
24 |
if ($key==$keyindex++ && is_numeric($key)) { |
|
25 |
$output .= '<option' . (($value == $default) ? ' selected="selected"' : '') . '>' . $value . '</option>'; |
|
26 |
} else { |
|
27 |
$output .= '<option value="' . $key . '"' . (($key == $default) ? ' selected="selected"' : '') . '>' . $value . '</option>'; |
|
28 |
} |
|
29 |
} |
|
30 |
} |
|
31 |
return $output; |
|
32 |
} |
|
33 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_truncate.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension truncate |
|
4 |
* Restricts a String to a specific number characters |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('TEASER', 'PHP 4.3.0RC1 has been released. This is the first release candidate'); |
|
8 |
* Template: News: {truncate:TEASER,50} ... [more] |
|
9 |
* Result: News: QuickSkin version 5.0 has been released. This is the first ... [more] |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_truncate ( $param, $size ) { |
|
14 |
return substr( $param, 0, $size ); |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_entity_decode.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension entity_decode |
|
4 |
* Convert all HTML entities to their applicable characters |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('MESSAGE', 'Nicht möglich!'); |
|
8 |
* Template: <a href="alert('{entity_decode:MESSAGE}');">Alert</a> |
|
9 |
* Result: <a href="alert('Nicht m?lich!');">Alert</a> |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_entity_decode ( $param ) { |
|
14 |
$param = strtr($param, array_flip(get_html_translation_table(HTML_ENTITIES))); |
|
15 |
$param = preg_replace("/&#([0-9]+);/me", "chr('\\1')", $param); |
|
16 |
return $param; |
|
17 |
} |
|
18 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_TXT.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension TXT |
|
4 |
* This function will replace the string with the value of language array of the module |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* in Template use:{TXT:"OPEN_FILE"} |
|
8 |
* returns the translated string |
|
9 |
* |
|
10 |
* |
|
11 |
* Important Note: |
|
12 |
* =============== |
|
13 |
* In order to use this function, you will need to follow the standard Naming Convention of WebsiteBaker CMS |
|
14 |
* It is: if your Module has the name "myModule", your language array needs to be named "$MOD_MYMODULE[]" |
|
15 |
* If you follow this rule, you can use this function (this extension) flawlessly |
|
16 |
* |
|
17 |
* @author WebsiteBaker Org e.V. |
|
18 |
* |
|
19 |
*/ |
|
20 |
function qx_TXT ( $var ) { |
|
21 |
|
|
22 |
$ret_val = ''; |
|
23 |
switch (TRUE) |
|
24 |
{ |
|
25 |
// retrieve the MODULE_NAME |
|
26 |
case isset($GLOBALS['tool']): $MODULE_NAME = $GLOBALS['tool']; break; // AdminTool |
|
27 |
case isset($GLOBALS['section']['module']): $MODULE_NAME = $GLOBALS['section']['module']; break; // PageType Module |
|
28 |
case isset($GLOBALS['module_dir']): $MODULE_NAME = $GLOBALS['module_dir']; break; // SnippetType Module |
|
29 |
default: $MODULE_NAME = FALSE; |
|
30 |
} |
|
31 |
|
|
32 |
if(!isset($MODULE_NAME)) |
|
33 |
{ |
|
34 |
$ret_val = 'A problem occured. <br />(QuickSkin Extension) qx_TXT issue.'; |
|
35 |
} |
|
36 |
else |
|
37 |
{ |
|
38 |
$MODULE_NAME = strtoupper($MODULE_NAME); |
|
39 |
$LANG_ARRAY = $GLOBALS['MOD_'.$MODULE_NAME]; |
|
40 |
$ret_val = isset($LANG_ARRAY[$var]) ? $LANG_ARRAY[$var] : ('<span style="color:#777">'.$var.'</span>'); |
|
41 |
} |
|
42 |
return $ret_val; |
|
43 |
} |
|
44 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_substr.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension substr |
|
4 |
* Insert specific part of a string |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('HEADLINE', 'My Title'); |
|
8 |
* Template: <font size=4>{substr:HEADLINE,0,1}</font>{substr:HEADLINE,1} |
|
9 |
* Result: <font size=4>M</font>y Title |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_substr ( $param, $lim0 = 0, $lim1 = 0 ) { |
|
14 |
if ($lim1) { |
|
15 |
return substr( $param, $lim0, $lim1 ); |
|
16 |
} else { |
|
17 |
return substr( $param, $lim0 ); |
|
18 |
} |
|
19 |
} |
|
20 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_count.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension count |
|
4 |
* count element of an array |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('list', array('a','b')); |
|
8 |
* Template: count: {count:list} |
|
9 |
* Result: count: 2 |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_count ( $param ) { |
|
14 |
$temp = count( $param ); |
|
15 |
return $temp; |
|
16 |
} |
|
17 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_codesnippetstart.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension codesnippetstart |
|
4 |
* required for the start of a code snippet |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Template: Code Snippet<br />{codesnippetstart:} |
|
8 |
* |
|
9 |
* @author Andy Prevost andy@codeworxtech.com |
|
10 |
*/ |
|
11 |
function qx_codesnippetstart ( $param='' ) { |
|
12 |
/* |
|
13 |
nogutter = no line numbers |
|
14 |
nocontrols = no menu at top |
|
15 |
collapse = = display nothing, menu at top will display '+ expand source' |
|
16 |
firstline[value] = starting number to start count |
|
17 |
showcolumns = shows "ruler" at top |
|
18 |
*/ |
|
19 |
if ( $param = '' ) { |
|
20 |
return '<pre name="code" class="php">'; |
|
21 |
} else { |
|
22 |
return '<pre name="code" class="php:' . $param . '">'; |
|
23 |
} |
|
24 |
} |
|
25 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_const.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
function qx_const($const) { |
|
4 |
$retval = '{'.$const.'}'; |
|
5 |
if(defined($const)) { |
|
6 |
$retval = constant($const); |
|
7 |
} |
|
8 |
return $retval; |
|
9 |
} |
|
10 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_header.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension header |
|
4 |
* Sends HTTP Header |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign( 'TITLE', 'SVG Template Demo:' ); |
|
8 |
* |
|
9 |
* Template: |
|
10 |
* {header:"Content-type: image/svg+xml"}<?xml version="1.0" ?> |
|
11 |
* <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> |
|
12 |
* <svg width="300px" height="150px" style="shape-rendering:optimizeQuality;text-rendering:optimizeQuality"> |
|
13 |
* <circle id="ball" cx="150" cy="75" r="50" style="fill:rgb(200,200,255)" /> |
|
14 |
* <text x="70" y="80" id="title" style="font-face:Courier;font-size:12pt">{TITLE}</text> |
|
15 |
* </svg> |
|
16 |
* |
|
17 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
18 |
*/ |
|
19 |
function qx_header ( $param ) { |
|
20 |
header($param); |
|
21 |
} |
|
22 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_config.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension config |
|
4 |
* Print Content of Configuration Parameters |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $_CONFIG['webmaster'] = 'philipp@criegern.de'; |
|
8 |
* Template: Please Contact Webmaster: {config:"webmaster"} |
|
9 |
* Result: Please Contact Webmaster: philipp@criegern.de |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_config ( $param ) { |
|
14 |
global $_CONFIG; |
|
15 |
|
|
16 |
return $_CONFIG[$param]; |
|
17 |
} |
|
18 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_dateformatgrid.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension dateformatgrid |
|
4 |
* Changes Dateformat |
|
5 |
* |
|
6 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
7 |
*/ |
|
8 |
function qx_dateformatgrid ( $param, $format = 'F j, Y' ) { |
|
9 |
list($month,$day,$year,$hour,$minute,$second) = split("[-:T\.]", $param); |
|
10 |
|
|
11 |
// handle empty values |
|
12 |
if (! $hour) { $hour = '00'; } |
|
13 |
if (! $minute) { $minute = '00'; } |
|
14 |
if (! $second) { $second = '00'; } |
|
15 |
|
|
16 |
return date( $format, mktime($hour, $minute, $second, $month, $day, $year)); |
|
17 |
} |
|
18 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_load_config.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension load_config |
|
4 |
* Reads an INI-Style configuration file into an array |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Configuration File (parameter.ini): |
|
8 |
* |
|
9 |
* PAGETITLE = Default Page Title |
|
10 |
* [colors] |
|
11 |
* BACKGROUND = #FFFFFF |
|
12 |
* TEXT = #000000 |
|
13 |
* |
|
14 |
* Template: |
|
15 |
* |
|
16 |
* {load_config:"parameter.ini","config"} |
|
17 |
* <title>{config.PAGETITLE}</title> |
|
18 |
* <body bgcolor="{config.colors.BACKGROUND}" text="{config.colors.TEXT}"> |
|
19 |
* |
|
20 |
* Result: |
|
21 |
* |
|
22 |
* <title>Default Page Title</title> |
|
23 |
* <body bgcolor="#FFFFFF" text="#000000"> |
|
24 |
* |
|
25 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
26 |
*/ |
|
27 |
function qx_load_config ( $filename, $name = 'config' ) { |
|
28 |
global $_top; |
|
29 |
|
|
30 |
$section = null; |
|
31 |
if (is_file($filename)) { |
|
32 |
$cfgfile = file($filename); |
|
33 |
if (is_array($cfgfile)) { |
|
34 |
foreach ($cfgfile as $line) { |
|
35 |
if (substr($line, 0, 1) != '#') { |
|
36 |
if (substr($line, 0, 1) == '[') { |
|
37 |
if ($rbr = strpos($line, ']')) { |
|
38 |
$section = substr($line, 1, $rbr -1); |
|
39 |
} |
|
40 |
} |
|
41 |
if ($tr = strpos($line, '=')) { |
|
42 |
$k = trim(substr($line, 0, $tr)); |
|
43 |
$v = trim(substr($line, $tr+1)); |
|
44 |
if (isset($section)) { |
|
45 |
$_top[$name][$section][$k] = $v; |
|
46 |
} else { |
|
47 |
$_top[$name][$k] = $v; |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
51 |
} |
|
52 |
} |
|
53 |
} |
|
54 |
} |
|
55 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_stringformat.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension stringformat |
|
4 |
* Inserts a formatted String |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('SUM', 25); |
|
8 |
* Template: Current balance: {stringformat:SUM,'$ %01.2f'} |
|
9 |
* Result: Current balance: $ 25.00 |
|
10 |
* |
|
11 |
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de |
|
12 |
*/ |
|
13 |
function qx_stringformat ( $param, $format ) { |
|
14 |
return sprintf( $format, $param ); |
|
15 |
} |
|
16 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_layoutfield.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension layoutfield |
|
4 |
* This function is to be used with WebsiteBakers Layout-Fields |
|
5 |
* Layout-Fields are mostly <textarea> fields, where the modules Frontend Template is specified |
|
6 |
* |
|
7 |
* Usage Example: |
|
8 |
* Content: $template->assign('loop_template', $settings['loop']); |
|
9 |
* Template: <textarea name="loop" rows="10" cols="1">{layoutfield:loop_template}</textarea> |
|
10 |
* |
|
11 |
* @author WebsiteBaker Org e.V. |
|
12 |
*/ |
|
13 |
function qx_layoutfield( $db_string ) { |
|
14 |
// Set raw html <'s and >'s to be replaced by friendly html code to be used in Layout Fields |
|
15 |
$raw = array('<', '>'); |
|
16 |
$friendly = array('<', '>'); |
|
17 |
|
|
18 |
return str_replace( $raw, $friendly, $db_string ); |
|
19 |
} |
|
20 | 0 |
branches/2.8.x/wb/include/quickSkin_alpha/_lib/qx/qx_urlencode.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* QuickSkin Extension urlencode |
|
4 |
* Inserts URL-encoded String |
|
5 |
* |
|
6 |
* Usage Example: |
|
7 |
* Content: $template->assign('PARAM', 'Delete User!'); |
|
8 |
* Template: go.php?param={urlencode:PARAM} |
Also available in: Unified diff
- remove Template Engine Quickskin, but don't delete by upgrade-script on your webspace
! see Revsion 1749 set pages field menu to default 1 by new install
+ add folder DOCS to Twig with changelog, authours and licence
please find the Twig Book as pdf, This is the documentation for Twig,