Example #1
0
/**
 * Retorna o diretório absoluto de uma imagem
 * @param string $filename
 * @return string
 */
function abs_source_images($filename = null)
{
    return abs_source(get_config()['upload']['imagens'] . '/' . $filename);
}
Example #2
0
 /**
  * Escreve as meta tags 
  */
 public static function displayHeader()
 {
     # Charset
     print "<meta charset=\"" . self::$Charset . "\">";
     # Viewport
     print "\n\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\" >\n";
     # Html5
     print "\n\n\t<!--[if lt IE 9]>";
     print "\n\t\t<script src=\"https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js\" charset=\"" . self::$Charset . "\" ></script>";
     print "\n\t\t<script src=\"https://oss.maxcdn.com/respond/1.4.2/respond.min.js\" charset=\"" . self::$Charset . "\" ></script>";
     print "\n\t<![endif]-->\n";
     # Meta Tags
     foreach (self::$SEO as $attr => $prop) {
         # Metatags
         if (is_array($prop)) {
             print "\n\t";
             foreach ($prop as $content => $value) {
                 print "<meta {$attr}=\"{$content}\" content=\"" . htmlspecialchars($value) . "\" />\n\t";
             }
         } else {
             if ($attr == 'icon' || $attr == 'shortcut' || $attr == 'shortcut icon') {
                 print "\n\t";
                 $type = strtolower(preg_replace('/^.*\\.(.*?)(\\?.*)?$/', '$1', $prop));
                 if ($type == 'ico') {
                     print "<link rel=\"shortcut icon\" href=\"{$prop}\" type=\"image/x-icon\" />\n\t";
                     print "<link rel=\"shortcut icon\" href=\"{$prop}\" type=\"image/vnd.microsoft.icon\" />\n\t";
                 }
             } else {
                 print "\n\t";
                 print "<{$attr}>" . htmlspecialchars($prop) . "</{$attr}>\n\t";
             }
         }
     }
     # Imagens
     if (count(self::$Imagens) > 0) {
         print "\n\t";
         print "<!-- OG Imagens -->\n\t";
         foreach (self::$Imagens as $values) {
             foreach ($values as $key => $value) {
                 if ($value != null) {
                     print "<meta property=\"{$key}\" content=\"" . htmlspecialchars($value) . "\" />\n\t";
                 }
             }
         }
     }
     # Vídeos
     if (count(self::$Videos) > 0) {
         print "\n\t";
         print "<!-- OG Vídeos -->\n\t";
         foreach (self::$Videos as $values) {
             foreach ($values as $key => $value) {
                 if ($value != null) {
                     print "<meta property=\"{$key}\" content=\"" . htmlspecialchars($value) . "\" />\n\t";
                 }
             }
             if (end(self::$Videos) !== $values) {
                 print "\n\t";
             }
         }
     }
     # Sounds
     if (count(self::$Sounds) > 0) {
         print "\n\t";
         print "<!-- OG Sound -->\n\t";
         foreach (self::$Sounds as $values) {
             foreach ($values as $key => $value) {
                 if ($value != null) {
                     print "<meta property=\"{$key}\" content=\"" . htmlspecialchars($value) . "\" />\n\t";
                 }
             }
         }
         print "\n\t";
     }
     # CSS
     if (count(self::$CSS) > 0) {
         print "\n\t";
         print "<!-- Folhas de estilo -->\n\t";
         foreach (self::$CSS as $css) {
             if (preg_match('/<style/i', $css['href'])) {
                 print preg_replace('/[\\n\\t]/', ' ', trim($css['href'])) . "\n\t";
             } else {
                 $file = str_replace(base_url(), abs_source(), $css['href']);
                 print "<link rel=\"stylesheet\" href=\"{$css['href']}\" media=\"{$css['media']}\" type=\"{$css['type']}\" />\n\t";
             }
         }
     }
 }