*/ /** * Smarty {alphabar} function plugin * * Type: function * Name: alphabar * Input: * - iskip (optional) array of chars that can be skipped * - iall (optional) if set to anything, it will include a link to all * - ifile (optional) set the file where the link should point (default is the current file) * - ipackage (optional) set the package the link should point to (default is the current package) * - * (optional) anything else that gets added to the pile of items is appended using &$key=$val * Example - {alphabar} */ function smarty_function_alphabar( $params, &$gBitSmarty ) { global $gBitSystem; extract( $params ); // work out what the url is $url = isset( $ifile ) ? ( isset( $ipackage ) ? ( $ipackage == 'root' ? BIT_ROOT_URL.$ifile : constant( strtoupper( $ipackage ).'_PKG_URL' ).$ifile ) : constant( strtoupper( $gBitSystem->getActivePackage() ).'_PKG_URL' ).$ifile ) : $_SERVER['SCRIPT_NAME']; $alphabar_params = [ 'ifile', 'ipackage', 'iall' ]; // append any other paramters that were passed in $url_params = ''; foreach( $params as $key => $val ) { if( !empty( $val ) && !in_array( $key, $alphabar_params ) ) { $url_params .= '&'.$key."=".$val; } } $ret = '
'; return $ret; }