本文整理汇总了PHP中Style类的典型用法代码示例。如果您正苦于以下问题:PHP Style类的具体用法?PHP Style怎么用?PHP Style使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Style类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profileEdit
function profileEdit()
{
// Authorize user
$id = $_GET['id'];
if ($this->_user['is_authorized']) {
if (!($this->_user['id'] == $id)) {
$this->set('authorized', false);
die('You are not allowed to edit this profile!');
} else {
$this->set('authorized', true);
}
} else {
$this->set('authorized', false);
die('You are not allowed to edit this profile!');
}
// get all necessary user data
$user = new User();
$user->createFromID($id);
$email = $user->getEmail();
$language = $user->getDefaultLanguage();
$this->set('default_language', $language);
// notification_interval is rewritten if any POST data is present
$notification_interval = $user->getNotificationInterval();
$default_theme = $user->getDefaultTheme();
//if any POST data in - update profile
$style = new Style();
$styles_list = $style->getAll();
$this->set('styles', $styles_list);
$this->set('notification_interval', $notification_interval);
$this->set('default_theme', $default_theme);
$this->set('profile', $user);
$this->set('email', $email);
$this->set('page_title', "Edit User - " . $user->username);
}
示例2: style
public function style($src, $media = null)
{
$asset = new Style($src, $media);
if ($asset->isLess()) {
$asset->setPublicRoot($this->manager->getPublicRoot());
}
$this->styleAssets[] = $asset;
return $this;
}
示例3: testReadXml1
/**
* @covers Geissler\CSL\Style\Style::readXml
*/
public function testReadXml1()
{
$xml = '<style
xmlns="http://purl.org/net/xbiblio/csl"
class="note"
version="1.0">
<info>
<id />
<title />
<updated>2009-08-10T04:49:00+09:00</updated>
</info>
<locale lang="fr">
</locale>
<citation>
<layout>
<text value="Oops"/>
</layout>
</citation>
<bibliography
initialize-with=". ">
<layout>
<names variable="author">
<name />
</names>
</layout>
</bibliography>
</style>';
$this->assertInstanceOf($this->class, $this->object->readXml(new \SimpleXMLElement($xml)));
}
示例4: _tag
protected function _tag($code)
{
if ($this->tag === true) {
return Style::open() . $code . Style::close();
}
return $code;
}
示例5: validate_style_id
public function validate_style_id()
{
$errors = array();
if (!is_integer($this->style_id) || !Style::find($this->style_id)) {
$errors[] = "style does not exist";
}
return $errors;
}
示例6: __toString
function __toString()
{
// Skip empty text frames
// if ( $this->is_text_node() &&
// preg_replace("/\s/", "", $this->_node->data) === "" )
// return "";
$str = "<b>" . $this->_node->nodeName . ":</b><br/>";
//$str .= spl_object_hash($this->_node) . "<br/>";
$str .= "Id: " . $this->get_id() . "<br/>";
$str .= "Class: " . get_class($this) . "<br/>";
if ($this->is_text_node()) {
$tmp = htmlspecialchars($this->_node->nodeValue);
$str .= "<pre>'" . mb_substr($tmp, 0, 70) . (mb_strlen($tmp) > 70 ? "..." : "") . "'</pre>";
} elseif ($css_class = $this->_node->getAttribute("class")) {
$tmp = htmlspecialchars($css_class);
$str .= "CSS class: '{$css_class}'<br/>";
}
if ($this->_parent) {
$str .= "\nParent:" . $this->_parent->_node->nodeName . " (" . spl_object_hash($this->_parent->_node) . ") " . "<br/>";
}
if ($this->_prev_sibling) {
$str .= "Prev: " . $this->_prev_sibling->_node->nodeName . " (" . spl_object_hash($this->_prev_sibling->_node) . ") " . "<br/>";
}
if ($this->_next_sibling) {
$str .= "Next: " . $this->_next_sibling->_node->nodeName . " (" . spl_object_hash($this->_next_sibling->_node) . ") " . "<br/>";
}
$d = $this->get_decorator();
while ($d && $d != $d->get_decorator()) {
$str .= "Decorator: " . get_class($d) . "<br/>";
$d = $d->get_decorator();
}
$str .= "Position: " . pre_r($this->_position, true);
$str .= "\nContaining block: " . pre_r($this->_containing_block, true);
$str .= "\nMargin width: " . pre_r($this->get_margin_width(), true);
$str .= "\nMargin height: " . pre_r($this->get_margin_height(), true);
$str .= "\nStyle: <pre>" . $this->_style->__toString() . "</pre>";
if ($this->_decorator instanceof Block_Frame_Decorator) {
$str .= "Lines:<pre>";
foreach ($this->_decorator->get_line_boxes() as $line) {
foreach ($line->get_frames() as $frame) {
if ($frame instanceof Text_Frame_Decorator) {
$str .= "\ntext: ";
$str .= "'" . htmlspecialchars($frame->get_text()) . "'";
} else {
$str .= "\nBlock: " . $frame->get_node()->nodeName . " (" . spl_object_hash($frame->get_node()) . ")";
}
}
$str .= "\ny => " . $line->y . "\n" . "w => " . $line->w . "\n" . "h => " . $line->h . "\n" . "left => " . $line->left . "\n" . "right => " . $line->right . "\n";
}
$str .= "</pre>";
}
$str .= "\n";
if (php_sapi_name() === "cli") {
$str = strip_tags(str_replace(array("<br/>", "<b>", "</b>"), array("\n", "", ""), $str));
}
return $str;
}
示例7: createStyle
function createStyle($deck)
{
$style = new Style();
$this->css = $style->getStyle($deck->default_theme);
$deck_name = $this->sluggify($deck->title);
$css = ROOT . DS . 'tmp' . DS . $this->root_deck_name . DS . $deck_name . DS . 'default.css';
if (!file_exists($css)) {
$fp = fopen($css, "wb");
fwrite($fp, $this->css['css']);
fclose($fp);
} else {
unlink($css);
$fp = fopen($css, "wb");
fwrite($fp, $this->css['css']);
fclose($fp);
}
$this->common_resources[] = $deck_name . DS . 'default.css';
}
示例8: run
public function run()
{
$row = 0;
if (($handle = fopen(storage_path() . "/csvs/styles.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle)) !== FALSE) {
$row++;
if ($row > 1) {
try {
$style = new Style();
$style->style_name = $data[2];
// $beer->beer_id = $data[0];
$style->save();
} catch (Exception $e) {
}
}
}
fclose($handle);
}
}
示例9: setStyle
/**
* Sets the style
* @param String $paramStyle path of the style folder
*/
public static function setStyle($paramStyle)
{
try {
getDatabase()->query('TRUNCATE TABLE `style_data`');
Style::install(ROOT . "/themes/" . $paramStyle . "/info.xml");
} catch (Exception $e) {
throw $e;
}
getDatabase()->update("settings", array("value" => $paramStyle), "setting = 'website_style'");
}
示例10: PrintHtmlHeader
function PrintHtmlHeader($logout)
{
$style = new Style();
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >' . "\n";
echo ' <head>' . "\n";
echo ' <title>Shrew Gallery</title>' . "\n";
echo ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
echo '<style type="text/css">' . "\n";
echo $style->Generate();
echo '</style>' . "\n";
echo ' </head>' . "\n";
echo ' <body>' . "\n";
echo ' <div id="page">' . "\n";
if ($logout) {
echo ' <div id=logout><a href=index.php?want=logout >Déconnection</a></div>' . "\n";
}
echo ' <h1>Shrew gallery</h1>' . "\n";
}
示例11: Check
public static function Check()
{
if (empty(self::$Default)) {
self::$Default = CFG_STYLE_DEFAULT;
}
// TODO: Read user style from Database and use it
if (empty(self::$Style)) {
self::$Style = self::$Default;
}
}
示例12: run
public function run()
{
$settings = Style::getSettings();
//Reverse the Menu, we've right float
getMenu()->flip();
foreach ($settings as $setting => $value) {
if ($value != null) {
getDisplay()->setTemplateVariable($settings, $value);
}
}
}
示例13: run
public function run()
{
$tags = Style::model()->findStyleWeights($this->limit, $this->singer_id);
foreach ($tags as $tag => $options) {
//$color = '#'.dechex(rand(100, 255)).dechex(rand(0, 200)).dechex(rand(50, 100));
$text = CHtml::encode($tag);
//$id_hidden = CHtml::hiddenField('style_'.$options['id'], $options['id']);
//$content = $link.$id_hidden;
echo CHtml::tag('span', array('id' => $options['id'], 'style' => "font-size:{$options['weight']}pt; color: #2E3CA3; cursor: pointer;"), $text) . "\n";
}
}
示例14: pop
/**
* 从堆栈中弹出一个样式
* @param Style|null $style
* @return Style
* @throws \InvalidArgumentException
*/
public function pop(Style $style = null)
{
if (empty($this->styles)) {
return $this->emptyStyle;
}
if (null === $style) {
return array_pop($this->styles);
}
/**
* @var int $index
* @var Style $stackedStyle
*/
foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
if ($style->apply('') === $stackedStyle->apply('')) {
$this->styles = array_slice($this->styles, 0, $index);
return $stackedStyle;
}
}
throw new \InvalidArgumentException('Incorrectly nested style tag found.');
}
示例15: __toString
function __toString()
{
// Skip empty text frames
if ($this->_node->nodeName == "#text" && preg_replace("/\\s/", "", $this->_node->data) === "") {
return "";
}
$str = "<b>" . $this->_node->nodeName . ":</b><br/>";
$str .= (string) $this->_node . "<br/>";
$str .= "Id: " . $this->get_id() . "<br/>";
$str .= "Class: " . get_class($this) . "<br/>";
if ($this->_node->nodeName == "#text") {
$tmp = htmlspecialchars($this->_node->nodeValue);
$str .= "<pre>'" . mb_substr($tmp, 0, 70) . (mb_strlen($tmp) > 70 ? "..." : "") . "'</pre>";
}
if ($this->_parent) {
$str .= "\nParent:" . $this->_parent->_node->nodeName . " (" . (string) $this->_parent->_node . ") " . "<br/>";
}
if ($this->_prev_sibling) {
$str .= "Prev: " . $this->_prev_sibling->_node->nodeName . " (" . (string) $this->_prev_sibling->_node . ") " . "<br/>";
}
if ($this->_next_sibling) {
$str .= "Next: " . $this->_next_sibling->_node->nodeName . " (" . (string) $this->_next_sibling->_node . ") " . "<br/>";
}
$d = $this->get_decorator();
while ($d && $d != $d->get_decorator()) {
$str .= "Decorator: " . get_class($d) . "<br/>";
$d = $d->get_decorator();
}
$str .= "Position: " . pre_r($this->_position, true);
$str .= "\nContaining block: " . pre_r($this->_containing_block, true);
$str .= "\nMargin width: " . pre_r($this->get_margin_width(), true);
$str .= "\nMargin height: " . pre_r($this->get_margin_height(), true);
$str .= "\nStyle: <pre>" . $this->_style->__toString() . "</pre>";
if ($this->_decorator instanceof Block_Frame_Decorator) {
$str .= "Lines:<pre>";
foreach ($this->_decorator->get_lines() as $line) {
foreach ($line["frames"] as $frame) {
if ($frame instanceof Text_Frame_Decorator) {
$str .= "\ntext: ";
$str .= htmlspecialchars($frame->get_text());
} else {
$str .= "\nBlock: " . $frame->get_node()->nodeName . " (" . (string) $frame->get_node() . ")";
}
}
$str .= "\ny => " . $line["y"] . "\n" . "w => " . $line["w"] . "\n" . "h => " . $line["h"] . "\n";
}
$str .= "</pre>";
}
$str .= "\n";
if (php_sapi_name() == "cli") {
$str = strip_tags(str_replace(array("<br/>", "<b>", "</b>"), array("\n", "", ""), $str));
}
return $str;
}