public static function includePicture($name) { $asset = StaticAsset::getStaticAssetByName($name); if (swValidate('edit')) { echo "<a target='_top' class='edit' href='swcms/editstaticasset.php?name={$name}' class='edit'></a>"; } if ($asset) { echo "<img alt='" . $asset[1] . "' src='swcms/assets/" . $asset[2] . "'></img>"; } }
public function fromUrl($url, $env = null) { $info = pathinfo($url); if ($info['extension'] == 'css') { return CssAsset::fromUrl($url, $env); } if ($info['extension'] == 'js') { return JsAsset::fromUrl($url, $env); } return StaticAsset::fromUrl($url, $env); }
/** * Hijack the default rendering for inline scripts * * @return string */ public function render() { // handle inline differently if (isset($this->attributes['inline'])) { // we'll need some content if we're inline if (empty($this->attributes['inline'])) { throw new \Exception('No inline javascript content supplied'); } return $this->renderInternal(); } return parent::render(); }
<div id='logoff'> <a href="index.php?logoff=1"></a> </div> </div> <ul> <li><a href="view.php">view</a></li> <li><a href="edit.php" class='selected'>edit</a></li> </ul> </div> <div class="hline"></div> <div class="admin-content"><?php if ($name) { echo "<div class='admin-nav'>\n"; echo "<H2>Edit asset: <strong>{$name}</strong></H2>\n"; $records = StaticAsset::getAllStaticAssetsByName($name); if ($records) { echo "<h3>history:</h3>\n<table>\n"; $firsttime = true; foreach ($records as $StaticAsset) { echo "<tr><td class='label'>\n<a href='" . $_SERVER['PHP_SELF'] . "?name={$name}&init=" . $StaticAsset[0] . "'>" . $StaticAsset[2] . "</a></td>\n"; if ($firsttime) { $firsttime = false; echo "<td> </td>"; } else { echo "<td><a class='delete' href='" . $_SERVER['PHP_SELF'] . "?name={$name}&delete=" . $StaticAsset[0] . "'></a></td>"; } echo "</tr>\n"; } echo "</table>\n"; }
display: inline; color: #fff; } #logo { float:right; display: inline; } </style> </head> <body> <div id='big-wraper'> <div id='wraper'> <header> <div id='logo'> <?php StaticAsset::includePicture('logo'); ?> </div> <h1> <?php StaticField::includeText('title'); ?> </h1> </header> <nav> <article> <?php StaticField::includeText('listOfLinks'); ?> <ul> <?php