Example #1
0
 public function messageViewer(MessageStack $stack)
 {
     $content = new StringBuffer();
     while (!$stack->isEmpty()) {
         $msg = $stack->pop();
         $content->append($msg->getMessage()->toString());
     }
     return $content;
 }
Example #2
0
 /**
  * Returns a buffered version of the printStackTrace method
  */
 public function getStackTrace()
 {
     $sb = new StringBuffer("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td colspan=\"2\">");
     $sb->append("<b>" . $this->classname . ": " . $this->getMessage() . "</b><br/>");
     foreach ($this->getTrace() as $value) {
         $value['line'] = !isset($value['line']) ? '' : $value['line'];
         $value['file'] = !isset($value['file']) ? '' : $value['file'];
         $sb->append("</td></tr><tr><td width=\"25\">&nbsp;</td><td>");
         $sb->append("\tat " . $value['class'] . $value['type'] . $value['function'] . " ( " . Japha::getQualified($value['file']) . ":" . $value['line'] . " )<br/>");
     }
     $sb->append("</tr></table>");
     return $sb;
 }
Example #3
0
 /**
  * Completely Hardcoded. Eww.
  *
  * Formats links to all of the possible control panel areas, taking into
  * account the level of the current user, and the permissions allowed with
  * respect to that level.
  *
  * @return String The control panel menu
  */
 function showPanel()
 {
     $c = new StringBuffer();
     $c->append("\n<ul>\n");
     $c->append($this->link('news&page=edit', $this->lang->message('showPanel', 'articles'), 1));
     $c->append($this->link('news&page=add', $this->lang->message('showPanel', 'articles:add'), 1));
     $c->append($this->link('category&page=add', $this->lang->message('showPanel', 'categories'), 3));
     $c->append($this->link('template&page=main', $this->lang->message('showPanel', 'template'), 3));
     $c->append($this->link('user&page=add', $this->lang->message('showPanel', 'users:add'), 2));
     $c->append($this->link('user&page=remove', $this->lang->message('showPanel', 'users:edit'), 3));
     $c->append($this->link('comments&page=viewPosts', $this->lang->message('showPanel', 'comments'), 2));
     $c->append($this->link('configuration&page=edit', $this->lang->message('showPanel', 'configuration'), 3));
     $c->append($this->link('user&page=edit', $this->lang->message('showPanel', 'profile'), 1));
     $c->append($this->link('logout', $this->lang->message('showPanel', 'logout'), 1));
     $c->append("\n</ul>\n");
     $replacer = $this->template->setMethod('panel');
     $replacer->addVariable('menu', $c->toString());
     return $this->template->createViewer($replacer);
 }
Example #4
0
 /**
  * Returns <tt>true</tt> if and only if this <tt>String</tt> represents
  * the same sequence of characters as the specified <tt>StringBuffer</tt>.
  *
  * @param   sb         the <tt>StringBuffer</tt> to compare to.
  * @return  <tt>true</tt> if and only if this <tt>String</tt> represents
  *          the same sequence of characters as the specified
  *          <tt>StringBuffer</tt>, otherwise <tt>false</tt>.
  * @since 1.4
  */
 public function contentEquals(StringBuffer $sb)
 {
     if ($this->count != $sb->length()) {
         return false;
     }
     $v1 = $this->value;
     $v2 = $sb->getValue();
     $i = $offset;
     $j = 0;
     $n = $count;
     while ($n-- != 0) {
         if ($v1[$i++] != $v2[$j++]) {
             return false;
         }
     }
     return true;
 }