Exemple #1
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('url' => SL::url(SL::nodeUrl($this->_getVar('Node'))), 'style' => null, 'source' => 'tweetmeme');
     $this->vars = $blockParams;
     return parent::parse($html, $blockName);
 }
 /**
  * Redirects to given $url, after turning off $this->autoRender.
  * Script execution is halted after the redirect.
  *
  * @param mixed $url A string or array-based URL pointing to another location within the app, or an absolute URL
  * @param integer $status Optional HTTP status code (eg: 404)
  * @access public
  * @link http://book.cakephp.org/view/425/redirect
  */
 public function redirect($url, $status = null, $useReferer = true)
 {
     if ($useReferer) {
         $ref = SlSession::read('Routing.ref');
         if ($ref) {
             SlSession::delete('Routing.ref');
             if (Sl::url($ref) !== Sl::url()) {
                 $url = $ref;
             }
         }
     }
     // cyclic check
     if (Sl::url($url) === Sl::url()) {
         die('Infinite redirection loop detected.');
     }
     // code inspired from RequestHandlerComponent
     if ($this->RequestHandler->isAjax()) {
         foreach ($_POST as $key => $val) {
             unset($_POST[$key]);
         }
         echo Sl::requestAction($url, array('requested' => false));
         $this->_stop();
     }
     // show a human readable redirect message allowing debug output to be read
     if (headers_sent() || $this->output && Configure::read()) {
         $url = h(SL::url($url));
         if (empty($status)) {
             $status = 'null';
         }
         echo "<p style='background: #ff7; color: #000; padding: 1em;'>Redirect to <a href='{$url}'>{$url}</a> (code: {$status}) cancelled.</p>";
         while (ob_get_level()) {
             ob_end_flush();
         }
         $this->_stop();
     }
     parent::redirect(Sl::url($url, true), $status);
 }
Exemple #3
0
 public function parse($html, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('XFBML' => false, 'name' => 'recommendations', 'site' => SL::url(SL::nodeUrl($this->_getVar('Node'))), 'width' => 300, 'height' => 300, 'header' => false, 'colorscheme' => 'light', 'font' => 'tahoma', 'border_color' => '#fff');
     if (empty($blockParams['XFBML'])) {
         $blockParams['border_color'] = urlencode($blockParams['border_color']);
         $blockParams['site'] = urlencode($blockParams['site']);
         $blockParams['font'] = urlencode($blockParams['font']);
     }
     return parent::parse($html, $blockName, $blockParams);
 }