Source for file HTMLLink.class.php
Documentation is available at HTMLLink.class.php
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
* Including the base class for html-tags.
require_once( CLASSPATH. "html/ABSTHTMLTag.class.php" );
include_once( CLASSPATH. "html/JavaScript.class.php" );
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (c) 2004 Daniel Plücken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* @var string $str_parameter_add_on_mouseover
* @author Daniel Plücken <daniel@debakel.net>
* @param string $href The value of the href-attribute of this
* @param string $label The label of this anker.
* @param string $style_class
function HTMLLink( $href, $label, $style_class = "", $target = "" )
* Sets the value of the href-attribute of this link.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $string The value of the href-attribute of this anker.
{ $this->href = $string; }
* Sets the label of this link.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $string The value of the label of this anker.
{ $this->label = $string; }
* Sets the target of this link.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $string The value of the label of this anker.
* Sets the mouseup that should add to all anker, that is defined in a
* script. It will concatenate befor the instance specified mouseup.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $str_mouse_up The static value of "onMouseup"-Attribute.
static $str_stat_mouse_up = "";
if ( !empty( $str_mouse_up ) )
$str_stat_mouse_up = $str_mouse_up;
return $str_stat_mouse_up;
* Sets the parameter that should be add on each link by a javascript on
* mouseover. This is useful to carry a session-id through all scripts.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $str_mouse_up The static value of "onMouseup"-Attribute.
static $str_stat_parameter_add = "";
if ( !empty( $str_parameter_add ) )
$str_stat_parameter_add = $str_parameter_add;
return $str_stat_parameter_add;
* Adds a javascript that adds parameter to the hyper reference of this
* anker. This is useful for search engine optimated sites. For example you
* can add a session-id or parameter that should hide from search-spiders.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $withJSdeclaration
static $alreadyIncluded = false;
function addParameter( which_obj, str_param )
if ( which_obj.getAttribute( 'parameterAdded' ) != 'true' )
str_href = which_obj.getAttribute( 'href' );
which_obj.setAttribute( 'href', str_href + str_param );
which_obj.setAttribute( 'parameterAdded', 'true' );
if ( $withJSdeclaration === true )
* Adds a javascript that adds parameter to the hyper reference of this
* anker. This is useful for search engine optimated sites. For example you
* can add a session-id or parameter that should hide from search-spiders.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $str_parameter
* Returns a generated string based on the attributes of this HTML-Object.
* @author Daniel Plücken <daniel@debakel.net>
$GLOBALS["javascript_content"][]
!empty( $str_stat_mouse_up )
!empty( $str_stat_parameter_add )
if ( preg_match( "!^[^?&]!", $str_stat_parameter_add ) )
? "href=\"". $this->href. "\" "
. "onFocus=\"if(this.blur)this.blur()\""
? " name=\"". $this->name. "\""
? " id=\"". $this->id. "\""
? " onBlur=\"". $this->blur. "\""
. ( !empty( $this->click )
? " onClick=\"". $this->click. "\""
? " onMouseup=\"". $this->mouseup. "\""
? " target=\"". $this->target. "\""
} // END of class HTMLLink
|