class AddThisWidgetJsUrl in AddThis 7.4
@file Class to manage a WidgetJs url.
Hierarchy
- class \AddThisWidgetJsUrl
Expanded class hierarchy of AddThisWidgetJsUrl
File
- classes/
Util/ AddThisWidgetJsUrl.php, line 7 - Class to manage a WidgetJs url.
View source
class AddThisWidgetJsUrl {
protected $url;
protected $attributes = array();
/**
* Sepecify the url through the construct.
*/
public function __construct($url) {
$this->url = $url;
}
/**
* Add a attribute to the querystring.
*/
public function addAttribute($name, $value) {
$this->attributes[$name] = $value;
}
/**
* Remove a attribute from the querystring.
*/
public function removeAttribute($name) {
if (isset($attributes[$name])) {
unset($attributes[$name]);
}
}
/**
* Get the full url for the widgetjs.
*/
public function getFullUrl() {
$querystring_elements = array();
foreach ($this->attributes as $key => $value) {
if (!empty($value)) {
$querystring_elements[] = $key . '=' . $value;
}
}
$querystring = implode('&', $querystring_elements);
return $this->url . '#' . $querystring;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AddThisWidgetJsUrl:: |
protected | property | ||
AddThisWidgetJsUrl:: |
protected | property | ||
AddThisWidgetJsUrl:: |
public | function | Add a attribute to the querystring. | |
AddThisWidgetJsUrl:: |
public | function | Get the full url for the widgetjs. | |
AddThisWidgetJsUrl:: |
public | function | Remove a attribute from the querystring. | |
AddThisWidgetJsUrl:: |
public | function | Sepecify the url through the construct. |