diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-27 15:32:59 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-27 15:32:59 +0100 |
| commit | f07304f760323c088712e8efd82547c692cc421b (patch) | |
| tree | 2aecf0a49773511ab583abced6b5526942371ef6 /smartyplugins | |
| parent | 793ff1326286e7489abb4019ad53c154de4ef68f (diff) | |
| download | themes-f07304f760323c088712e8efd82547c692cc421b.tar.gz themes-f07304f760323c088712e8efd82547c692cc421b.tar.bz2 themes-f07304f760323c088712e8efd82547c692cc421b.zip | |
Trim old style block functions
Diffstat (limited to 'smartyplugins')
| -rw-r--r-- | smartyplugins/block.bitmodule.php | 44 | ||||
| -rw-r--r-- | smartyplugins/block.box.php | 48 | ||||
| -rw-r--r-- | smartyplugins/block.fieldset.php | 30 | ||||
| -rw-r--r-- | smartyplugins/block.form.php | 107 | ||||
| -rw-r--r-- | smartyplugins/block.forminput.php | 55 | ||||
| -rw-r--r-- | smartyplugins/block.jstab.php | 44 | ||||
| -rw-r--r-- | smartyplugins/block.jstabs.php | 51 | ||||
| -rw-r--r-- | smartyplugins/block.legend.php | 30 | ||||
| -rw-r--r-- | smartyplugins/block.navbar.php | 28 | ||||
| -rw-r--r-- | smartyplugins/block.repeat.php | 36 | ||||
| -rw-r--r-- | smartyplugins/block.sortlinks.php | 37 | ||||
| -rw-r--r-- | smartyplugins/block.tr.php | 22 |
12 files changed, 0 insertions, 532 deletions
diff --git a/smartyplugins/block.bitmodule.php b/smartyplugins/block.bitmodule.php deleted file mode 100644 index 0d2ae7a..0000000 --- a/smartyplugins/block.bitmodule.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ -// $Header$ -/** - * \brief Smarty {bitmodule}{/bitmodule} block handler - * - * To make a module it is enough to place something like following - * into corresponding mod-name.tpl file: - * \code - * {bitmodule name="module_name" title="Module title"} - * <!-- module Smarty/HTML code here --> - * {/bitmodule} - * \endcode - * - * This block may (can) use 2 Smarty templates: - * 1) module.tpl = usual template to generate module look-n-feel - * 2) module-error.tpl = to generate diagnostic error message about - * incorrect {bitmodule} parameters - -\Note -error was used only in case the name was not there. -I fixed that error case. -- mose - - */ -function smarty_block_bitmodule( $pParams, $pContent, &$gBitSmarty) { - $moduleTag = !empty( $pParams['tag'] ) ? $pParams['tag'] : 'div'; - $gBitSmarty->assign( 'moduleTag', $moduleTag ); - if( empty( $pContent )) { - return ''; - } else { - $pParams['data'] = $pContent; - } - - if( !empty( $pParams['name'] ) ) { - $pParams['name'] = preg_replace( "/[^a-zA-Z0-9\\-\\_]/", "", $pParams['name'] ); - } - $gBitSmarty->assign( 'modInfo', $pParams ); - return $gBitSmarty->fetch('bitpackage:themes/module.tpl'); -} -?> diff --git a/smartyplugins/block.box.php b/smartyplugins/block.box.php deleted file mode 100644 index df58638..0000000 --- a/smartyplugins/block.box.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty {box} block plugin - * - * Type: block - * Name: box - * Input: - * - title (optional) box title - * - class (optional) overrides the default class 'box' - * - biticon values (optional) see function.biticon.php for details - * - idiv (optional) name of class of div that surrounds icon (if not set, no div is created) - * @uses smarty_function_escape_special_chars() - * @todo somehow make the variable that is contained within $iselect global --> this will allow importing of outside variables not set in $_REQUEST - */ -function smarty_block_box($params, $pContent, &$gBitSmarty) { - if( empty( $pContent )) { - return ''; - } - $atts = ''; - foreach( $params as $key => $val ) { - switch( $key ) { - case 'title': - $gBitSmarty->assign( $key, tra( $val ) ); - break; - case 'class': - case 'iclass': - case 'ipackage': - case 'iname': - case 'iexplain': - case 'idiv': - $gBitSmarty->assign( $key,$val ); - break; - default: - $atts .= $key.'="'.$val.'" '; - break; - } - } - $gBitSmarty->assign( 'content',$pContent ); - $gBitSmarty->assign( 'atts',$atts ); - return $gBitSmarty->fetch( 'bitpackage:kernel/box.tpl' ); -} -?> diff --git a/smartyplugins/block.fieldset.php b/smartyplugins/block.fieldset.php deleted file mode 100644 index 642c075..0000000 --- a/smartyplugins/block.fieldset.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty {form} block plugin - * - * Type: block - * Name: form - * Input: - * - fieldset (optional) - text that appears in the legend - */ -function smarty_block_fieldset($params, $content, &$gBitSmarty) { - if( $content ) { - $attributes = ''; - $attributes .= !empty( $params['class'] ) ? ' class="'.$params['class'].'" ' : '' ; - $attributes .= !empty( $params['id'] ) ? ' id="'.$params['id'].'" ' : '' ; - $ret = '<fieldset '.$attributes.'>'; - if( !empty( $params['legend'] ) ) { - $ret .= '<legend>'.tra( $params['legend'] ).'</legend>'; - } - $ret .= $content; - $ret .= '</fieldset>'; - return $ret; - } -} -?> diff --git a/smartyplugins/block.form.php b/smartyplugins/block.form.php deleted file mode 100644 index 2a8eb68..0000000 --- a/smartyplugins/block.form.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty {form} block plugin - * - * Type: block - * Name: form - * Input: - * - ipackage (optional) - package where we should direct the form after submission - * - ifile (optional) - file that is targetted - * - ianchor (optional) - move to anchor after submitting - * if neither are set, SCRIPT_NAME is used as url - * - legend if set, it will generate a fieldset using the input as legend - * @uses smarty_function_escape_special_chars() - * @todo somehow make the variable that is contained within $iselect global --> this will allow importing of outside variables not set in $_REQUEST - */ -function smarty_block_form( $pParams, $pContent, &$gBitSmarty) { - global $gBitSystem, $gSniffer; - - if( $pContent ) { - if( !isset( $pParams['method'] ) ) { - $pParams['method'] = 'post'; - } - $atts = ''; - if( $gBitSystem->isLive() && isset( $pParams['secure'] ) && $pParams['secure'] ) { - // This is NEEDED to enforce HTTPS secure logins! - $url = 'https://' . $_SERVER['HTTP_HOST']; - } else { - $url = ''; - } - $onsubmit = ''; - - // services can add something to onsubmit - if( $gBitSmarty->getTemplateVars( 'serviceOnsubmit' ) ) { - $onsubmit .= $gBitSmarty->getTemplateVars( 'serviceOnsubmit' ).";"; - } - - foreach( $pParams as $key => $val ) { - switch( $key ) { - case 'ifile': - case 'ipackage': - if( $key == 'ipackage' ) { - if( $val == 'root' ) { - $url .= BIT_ROOT_URL; - } else { - $url .= constant( strtoupper( $val ).'_PKG_URL' ); - } - $url .= BitBase::getParameter( $pParams, 'ifile' ); - } - break; - case 'legend': - if( !empty( $val ) ) { - $legend = '<legend>'.tra( $val ).'</legend>'; - } - break; - // this is needed for backwards compatibility since we sometimes pass in a url - case 'action': - if( substr( $val, 0, 4 ) == 'http' ) { - if( isset( $pParams['secure'] ) && $pParams['secure'] && ( substr( $val, 0, 5 ) != 'https' )) { - $val = preg_replace( '/^http/', 'https', $val ); - } - $url = $val; - } else { - $url .= $val; - } - break; - case 'ianchor': - case 'secure': - break; - case 'onsubmit': - if( !empty( $val ) ) { - $onsubmit .= $val.";"; - } - break; - default: - if( !empty( $val ) ) { - $atts .= $key.'="'.$val.'" '; - } - break; - } - } - - if( empty( $url )) { - $url = $_SERVER['SCRIPT_NAME']; - } else if( $url == 'https://' . $_SERVER['HTTP_HOST'] ) { - $url .= $_SERVER['SCRIPT_NAME']; - } - - $onsub = ( !empty( $onsubmit ) ? ' onsubmit="'.$onsubmit.'"' : '' ); - $ret = '<form action="'.$url.( !empty( $pParams['ianchor'] ) ? '#'.$pParams['ianchor'] : '' ).'" '.$atts.$onsub.'>'; - $ret .= isset( $legend ) ? '<fieldset>'.$legend : ''; // adding the div makes it easier to be xhtml compliant - $ret .= $pContent; - $ret .= isset( $legend ) ? '</fieldset>' : ''; // close the open tags - $ret .= '</form>'; - return $ret; - } else { - global $gSmartyFormHorizontal; - // global var other plugin functions will pick up to add proper col-XX-YY styling for horizontal forms - $gSmartyFormHorizontal = ( !empty( $pParams['class'] ) && strpos( $pParams['class'], 'form-horizontal' ) !== FALSE ); - } -} -?> diff --git a/smartyplugins/block.forminput.php b/smartyplugins/block.forminput.php deleted file mode 100644 index ea37757..0000000 --- a/smartyplugins/block.forminput.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty {forminput} block plugin - * - * Type: block - * Name: forminput - */ -function smarty_block_forminput($params, $content, &$gBitSmarty) { - global $gSmartyFormHorizontal; - - // defaults - $attr = ""; - $class = ''; - if( $gSmartyFormHorizontal ) { - $class = 'col-sm-8'; - } - - if( !empty( $params['class'] ) ){ - $class .= ' '.trim( $params['class'] ); - if( $gSmartyFormHorizontal && (strpos( $params['class'], 'submit' ) !== FALSE || strpos( $params['class'], 'offset' ) !== FALSE) ) { - $class .= ' col-sm-offset-4'; - } - } - - $labelStart = ''; - $labelEnd = ''; - - if( !empty( $params['label'] ) ){ - if( $gSmartyFormHorizontal ) { - $class .= ' col-sm-offset-4'; - } - $class .= ' '.trim( $params['label'] ); - $labelStart = '<label>'; - $labelEnd = '</label>'; - } - - if( !empty( $params['id'] ) ){ - $attr .= 'id="'.trim( $params['id'] ).'" '; - } - - if( !empty( $params['style'] ) ){ - $attr .= 'style="'.trim( $params['style'] ).'" '; - } - - if( $content ) { - return '<div class="form-group '.$class.'" '.$attr.' >'.$labelStart.$content.$labelEnd.'</div>'; - } -} -?> diff --git a/smartyplugins/block.jstab.php b/smartyplugins/block.jstab.php deleted file mode 100644 index 75162f8..0000000 --- a/smartyplugins/block.jstab.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty {jstab} block plugin - * - * Type: block - * Name: jstab - * Input: - * Abstract: Used to enclose a set of tabs - */ - -function smarty_block_jstab( $pParams, $pContent, &$gBitSmarty, $pRepeat ) { - if( empty( $pRepeat ) ){ - global $jsTabLinks; - - $tClass = isset( $pParams['class'] ) ? ' class="'.$pParams['class'].'"' : ''; - $tStyle = isset( $pParams['style'] ) ? ' style="'.$pParams['style'].'"' : ''; - $tClick = isset( $pParams['onclick'] ) ? ' onclick="'.$pParams['onclick'].'"' : ''; - $tTitle = tra( isset( $pParams['title'] ) ? $pParams['title'] : 'No Title' ); - - $tabId = strtolower( isset( $pParams['id'] ) ? $pParams['id'] : 'tab'.preg_replace("/[^A-Za-z0-9]/", '', $tTitle) ); - - $tabString = '<li '.$tClick.' '.$tClass.' '.$tStyle.'><a href="#'.$tabId.'">' . $tTitle . '</a></li>'; - if( isset( $pParams['position'] ) ) { - array_splice( $jsTabLinks, $pParams['position'], 0, $tabString ); - } else { - $jsTabLinks[] = $tabString; - } - - $tabType = BitBase::getParameter( $pParams, 'tabtype', 'tab' ); - - $ret = '<div class="'.$tabType.'-pane" id="'.$tabId.'">'; - $ret .= $pContent; - $ret .= '</div>'; - - return $ret; - } -} -?> diff --git a/smartyplugins/block.jstabs.php b/smartyplugins/block.jstabs.php deleted file mode 100644 index afb5ddd..0000000 --- a/smartyplugins/block.jstabs.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty {jstabs} block plugin - * - * Type: block - * Name: jstabs - * Input: you can use {jstab tab=<tab number>} (staring with 0) to select a given tab - * or you can use the url to do so: page.php?jstab=<tab number> - * Abstract: Used to enclose a set of tabs - */ -function smarty_block_jstabs( $pParams, $pContent, &$gBitSmarty, $pRepeat ) { - global $gBitSystem, $jsTabLinks; - if( $pRepeat ){ - $jsTabLinks = array(); - } else { - extract( $pParams ); - - $tabId = !empty( $pParams['id'] ) ? $pParams['id'] : substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10); - - if( isset( $_REQUEST['jstab'] ) ) { - // make sure we aren't passed any evil shit - if( !isset( $tab ) && isset( $_REQUEST['jstab'] ) && preg_match( "!^\d+$!", $_REQUEST['jstab'] ) ) { - $tab = $_REQUEST['jstab']; - } - $setupJs = '$(\'#'.$tabId.' a[href="#profile"]\').tab(\'show\');'; - } else { - $setupJs = "$('#$tabId a:first').tab('show');"; - } - - $tabType = BitBase::getParameter( $pParams, 'tabtype', 'tab' ); - - $ret = '<ul class="nav nav-'.$tabType.'s" data-tab="'.$tabType.'" id="'.$tabId.'">'; - foreach( $jsTabLinks as $tabLink ) { - $ret .= $tabLink; - } - $ret .= '</ul><div class="tab-content">'.$pContent.'</div>'; - $ret .= '<script type="text/javascript">/*<![CDATA[*/ $(\'#'.$tabId.' a\').click(function (e) { e.preventDefault(); $(this).tab(\'show\'); }); '.$setupJs .'/*]]>*/</script> '; - - - $jsTabLinks = NULL; - - return $ret; - } -} -?> diff --git a/smartyplugins/block.legend.php b/smartyplugins/block.legend.php deleted file mode 100644 index e0a250e..0000000 --- a/smartyplugins/block.legend.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty {form} block plugin - * - * Type: block - * Name: form - * Input: - * - legend (optional) - text that appears in the legend - */ -function smarty_block_legend($params, $content, &$gBitSmarty) { - if( $content ) { - $attributes = ''; - $attributes .= !empty( $params['class'] ) ? ' class="'.$params['class'].'" ' : '' ; - $attributes .= !empty( $params['id'] ) ? ' id="'.$params['id'].'" ' : '' ; - $ret = '<fieldset '.$attributes.'>'; - if( !empty( $params['legend'] ) ) { - $ret .= '<legend>'.tra( $params['legend'] ).'</legend>'; - } - $ret .= $content; - $ret .= '</fieldset>'; - return $ret; - } -} -?> diff --git a/smartyplugins/block.navbar.php b/smartyplugins/block.navbar.php deleted file mode 100644 index e4c5e5f..0000000 --- a/smartyplugins/block.navbar.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty {navbar} block plugin - * - * Type: block - * Name: navbar - * Input: set of links that are used for navigation purposes - */ -function smarty_block_navbar($params, $content, &$gBitSmarty) { - $links = smarty_block_navbar_get_links( $content ); - $gBitSmarty->assign( 'links',$links ); - return $gBitSmarty->fetch( 'bitpackage:kernel/navbar.tpl' ); -} -function smarty_block_navbar_get_links( $content ) { - $links = array(); - if( preg_match_all( "/<a.*?href=\".*?\">.*?<\/a>/i",$content,$res ) ) { - $res = $res[0]; - $links = array_unique( $res ); - } - return $links; -} -?>
\ No newline at end of file diff --git a/smartyplugins/block.repeat.php b/smartyplugins/block.repeat.php deleted file mode 100644 index f11e69a..0000000 --- a/smartyplugins/block.repeat.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty plugin - * ------------------------------------------------------------- - * File: block.repeat.php - * Type: block - * Name: repeat - * Purpose: repeat a template block a given number of times - * Parameters: count [required] - number of times to repeat - * assign [optional] - variable to collect output - * Author: Scott Matthewman <scott@matthewman.net> - * ------------------------------------------------------------- - */ -function smarty_block_repeat( $params, $content, &$gBitSmarty ) { - if( !empty( $content ) ) { - $intCount = intval( $params['count'] ); - if( $intCount < 0 ) { - $gBitSmarty->trigger_error( "block: negative 'count' parameter" ); - return; - } - - $strRepeat = str_repeat( $content, $intCount ); - if( !empty( $params['assign'] ) ) { - $gBitSmarty->assign($params['assign'], $strRepeat ); - } else { - echo $strRepeat; - } - } -} -?> diff --git a/smartyplugins/block.sortlinks.php b/smartyplugins/block.sortlinks.php deleted file mode 100644 index 7713656..0000000 --- a/smartyplugins/block.sortlinks.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty plugin - * ------------------------------------------------------------- - * File: block.sortlinks.php - * Type: block - * Name: sortlinks - * ------------------------------------------------------------- - */ -function smarty_block_sortlinks($params, $content, &$gBitSmarty) -{ -if ($content) { - $links=spliti("\n",$content); - $links2=array(); - foreach ($links as $value) { - $splitted=preg_split("/[<>]/",$value,-1,PREG_SPLIT_NO_EMPTY); - $links2[$splitted[2]]=$value; - } - - if( isset( $params['order'] ) && $params['order']=='reverse' ) { - krsort( $links2 ); - } else { - ksort($links2); - } - - foreach($links2 as $value) { - echo $value; - } -} -} -?> diff --git a/smartyplugins/block.tr.php b/smartyplugins/block.tr.php deleted file mode 100644 index 92e713d..0000000 --- a/smartyplugins/block.tr.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * Smarty plugin - * @package Smarty - * @subpackage plugins - */ - -/** - * Smarty plugin - * ------------------------------------------------------------- - * File: block.translate.php - * Type: block - * Name: translate - * Purpose: translate a block of text - * ------------------------------------------------------------- - */ -//global $lang; -//include_once('lang/language.php'); -function smarty_block_tr( $pParams, $pContent, &$gBitSmarty ) { - echo( tra( $pContent ) ); -} -?> |
