/** * method for getting title of page * @return string $title title of document */ public static function getTitle() { if (!empty(self::$title)) { return self::$title; } return html::specialEncode(conf::getMainIni('meta_title')); }
/** * Get HTML mail part from ID * @param string $title * @param string $body * @paramn string $template_path * @return string $html */ public function getEmailHtml($title, $body, $template_path = null) { $template = $this->getHtmlTemplate($template_path); if ($this->titleInBody) { $body = "# " . $title . PHP_EOL . PHP_EOL . $body; } $parser = new GithubMarkdown(); $body = $parser->parse($body); $subject = html::specialEncode($title); $str = str_replace(array('{title}', '{content}'), array($subject, $body), $template); return $str; }
/** * sets all <head></head> meta info. * Params should not be encoded * @param string $title html page title * @param string $description html page description and og description * @param string $keywords keywords * @param string $image image * @param string $type og type */ public static function setMetaAll($title, $description = '', $keywords = '', $image = '', $type = '', $author = '') { // title assets::setTitle(html::specialEncode($title)); self::setMetaAsStr('<meta property="og:title" content="' . html::specialEncode($title) . '" />' . "\n"); // description if (empty($description)) { $description = conf::getMainIni('meta_desc'); } $desc = strings::substr2($description, 255); $og_desc = html::specialEncode(strings::substr2($description, 320)); if (!empty($og_desc)) { self::setMetaAsStr('<meta property="og:description" content="' . $og_desc . '"/>' . "\n"); } if (!empty($desc)) { self::setMeta(array('description' => $desc)); } if (!empty($author)) { self::setMeta(array('author' => $author)); } // keywords if (empty($keywords)) { $keywords = conf::getMainIni('meta_meywords'); } if (!empty($keywords)) { self::setMeta(array('keywords' => $keywords)); } // image if (!empty($image)) { $server = conf::getSchemeWithServerName(); $image = $server . $image; } if (!empty($image)) { self::setMetaAsStr('<meta property="og:image" content="' . $image . '"/>' . "\n"); } // type if (!empty($type)) { self::setMetaAsStr('<meta property="og:type" content="' . $type . '"/>' . "\n"); } }
public function displayAll($rows) { $str = table::tableBegin(array('class' => 'uk-table uk-table-hover uk-table-striped uk-table-condensed')); foreach ($rows as $row) { $str .= table::trBegin(); $str .= table::td($row['username'], array('class' => 'uk-width-3-10')); $str .= table::td($row['email']); // Comment $dancer = q::select('dancer')->filter('user_id= ', $row['id'])->fetchSingle(); if (!empty($dancer)) { $str .= table::td(html::specialEncode($dancer['comment'])); } else { $str .= table::td(''); } $str .= table::trEnd(); } $str .= table::tableEnd(); echo $str; }
/** * * get feed string * @return string items in the feed */ public function getItems($rows) { $items = ''; foreach ($rows as $val) { $val = html::specialEncode($val); $items .= "<item>\n"; $items .= "<title>{$val['title']}</title>\n"; if (!isset($val['guid'])) { $items .= "<guid>{$val['url']}</guid>\n"; } else { $items .= "<guid>{$val['guid']}</guid>\n"; } $items .= "<link>{$val['url']}</link>\n"; $items .= "<description>{$val['abstract']}</description>\n"; $items .= "<pubDate>" . $this->timestampToPubdate($val['created']) . "</pubDate>\n"; $items .= "</item>"; } return $items; }
/** * Get a `<link rel="stylesheet" href="/link/to/css.css" .. </link>` * @param string $css path to CSS * @return string $css link */ public function getCssLink($css) { $css = \diversen\html::specialEncode($css); return '<link rel="stylesheet" href="' . $css . '" />"'; }