Skip to content

Commit

Permalink
Merge pull request #180 from quantacms/aldo-dev
Browse files Browse the repository at this point in the history
Aldo dev
  • Loading branch information
Aldus83 committed Nov 1, 2018
2 parents 071a210 + 75b9c4b commit 393389a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
9 changes: 7 additions & 2 deletions engine/modules/core/environment/Environment.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,16 @@ class Environment extends DataContainer {
}

/**
* Hook function - will look for all modulename_function in all active modules.
* Hook function - will look for all modulename_function in all active modules
* and let the user alter the variables contained into &$vars.
*
* @param $function
* @param string $function
* The hook function name.
* @param array $vars
* An array of variables.
*
* @return bool
* Returns TRUE if any module was implementing the hook.
*/
public function hook($function, &$vars = array()) {
$env = &$this;
Expand Down
7 changes: 5 additions & 2 deletions engine/modules/core/node/node.qtags.inc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function qtag_ATTRIBUTE($env, $target, &$attributes) {
* @return string
* The rendered qtag.
*
* TODO: we should make Links an object oriented / class item.
* TODO: we should really make Link a class.
*/
function qtag_LINK($env, $target, &$attributes) {
$querystring = array();
Expand All @@ -167,6 +167,9 @@ function qtag_LINK($env, $target, &$attributes) {
$link_data = array();
$link_id = !empty($attributes['link_id']) ? $attributes['link_id'] : '';

// Add support for protocol (http, https etc.).
$protocol = !(empty($attributes['protocol'])) ? ($attributes['protocol'] . '://') : '';

$classes = array('link');

// Check if the target is a node or an external link.
Expand Down Expand Up @@ -242,7 +245,7 @@ function qtag_LINK($env, $target, &$attributes) {

$title = isset($attributes['title']) ? $attributes['title'] : $title_default;
// Create the link HTML.
$link = '<a ' . $id . ' ' . implode(' ', $link_data) . ' class="' . implode(' ', $classes) . '" ' . $link_title . ' href="' . $target . $query . '" ' . $link_target . '>' . $title . '</a>';
$link = '<a ' . $id . ' ' . implode(' ', $link_data) . ' class="' . implode(' ', $classes) . '" ' . $link_title . ' href="' . $protocol . $target . $query . '" ' . $link_target . '>' . $title . '</a>';
return $link;
}

Expand Down
1 change: 0 additions & 1 deletion engine/modules/core/qtags/qtags.hook.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
function qtags_page_complete($env, $vars) {
$html = transformCodeTags($env, $vars['page']->html);
$html = transformCodeTags($env, $html, array('runlast' => TRUE));

$vars['page']->html = $html;
}

Expand Down
2 changes: 1 addition & 1 deletion engine/modules/core/sitemap/sitemap.hook.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* An array of variables.
*/
function sitemap_boot($env, $vars) {
// TODO: object oriented, using templates, etc. etc.
// TODO: refactor with object oriented approach, using templates, etc. etc.
if ($env->getRequestedPath() == 'google_sitemap') {
header("Content-type: text/xml");

Expand Down

0 comments on commit 393389a

Please sign in to comment.