function smarty_block_a($params, $contents, $smarty) { if ($contents !== NULL) { $stock = @$params['coorgStock']; unset($params['coorgStock']); $title = @$params['coorgTitle']; unset($params['coorgTitle']); $l = @$params['coorgLanguage']; unset($params['coorgLanguage']); $anchor = array_key_exists('coorgAnchor', $params) ? $params['coorgAnchor'] : null; unset($params['coorgAnchor']); $request = $params['request']; if ($request[0] != '#') { $urlParams = array($request); unset($params['request']); $urlParams = array_merge($urlParams, array_values($params)); $url = CoOrg::createURL($urlParams, $l ? $l : null, $anchor); } else { $url = $request; } $a = '<a href="'.htmlspecialchars($url).'"'. ($title ? ' title="'.$title.'"' : '').'>'; if ($stock) { $stockInfo = CoOrg::stocks($stock); $a .= '<img src="'.CoOrg::staticFile($stockInfo['img']).'" alt="'.$stockInfo['alt'].'" title="'.$stockInfo['title'].'"/>'; if ($stockInfo['text']) { $a .= $stockInfo['text']; } else if ($contents) { $a .= $contents; } } else { $a .= $contents; } $a .= '</a>'; return $a; } }
public function render() { if (! $this->_stock) { return '<input type="submit" name="'.$this->_name.'" value="'.$this->_label.'"'.$this->renderOptions().'/>'; } else { $stockInfo = CoOrg::stocks($this->_stock); $button = '<img src="'.CoOrg::staticFile($stockInfo['img']).'" alt="'.$stockInfo['alt'].'" title="'.$stockInfo['title'].'"/>'; return '<button type="submit" name="'.$name.'" value="_"'.$this->renderOptions().'>'.$button.'</button>'; } }
function smarty_block_button($params, $contents, $smarty) { if ($contents !== NULL) { $confirm = @$params['coorgConfirm']; unset($params['coorgConfirm']); if ($confirm) { $confirm = htmlspecialchars($confirm); $confirm = str_replace('\'', '\\\'', $confirm); } $form = '<form action="'.CoOrg::createURL(explode('/', $params['request'])). '" method="post" class="normal-post-url"'. ($confirm ? ' onsubmit="return confirm(\''.$confirm.'\');"' : ''). '>'; foreach ($params as $key => $value) { if (strpos($key, 'param_') === 0) { $name = substr($key, 6); $form .= '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'"/>'; } } $stock = @$params['coorgStock']; unset($params['coorgStock']); if ($stock) { $stockInfo = CoOrg::stocks($stock); $contents = '<img src="'.CoOrg::staticFile($stockInfo['img']).'" alt="'.$stockInfo['alt'].'" title="'.$stockInfo['title'].'"/>'; if ($stockInfo['text']) { $contents = $stockInfo['text']; } } $form .= '<button type="submit">'.$contents.'</button>'; $form .= '</form>'; return $form; } }