Example #1
0
File: Yml.php Project: infrajs/yml
 public static function parse($data)
 {
     $gid = 0;
     $pid = 0;
     $groups = array();
     $poss = array();
     $conf = static::$conf;
     if (!$conf['name']) {
         throw new \Exception('В конфиге yml требуется указать name. Наименование компании без организационный формы');
     }
     if (!$conf['company']) {
         throw new \Exception('В конфиге yml требуется указать company, название компании с организационной формой ООО');
     }
     Xlsx::runPoss($data, function (&$pos) {
         $pos['Описание'] = Yml::tostr($pos['Описание']);
     });
     Xlsx::runGroups($data, function (&$group, $i, &$parent) use(&$gid, &$groups) {
         $group['id'] = ++$gid;
         if ($parent) {
             $group['parentId'] = $parent['id'];
         }
         $groups[] =& $group;
     });
     Xlsx::runPoss($data, function (&$pos, $i, &$group) use(&$pid, &$poss) {
         $pos['id'] = ++$pid;
         $pos['categoryId'] = $group['id'];
         $poss[] =& $pos;
     });
     $d = array("conf" => $conf, "support" => Access::$conf["admin"]["support"], "site" => View::getPath(), "poss" => $poss, "groups" => $groups);
     $html = Template::parse('-yml/yml.tpl', $d);
     return $html;
 }
Example #2
0
            }
            $link = $link . '?m=:producer.' . $val . '=1';
        } else {
            if ($md['search']) {
                $val = $md['search'];
                $link = $link . '?m=:search:' . $val;
            }
        }
    }
    if ($val) {
        $ans['title'] = $val;
    }
    unset($ans['md']);
    unset($ans['m']);
    $ans['external'] = '-catalog/seo.json';
    $ans['canonical'] = View::getPath() . $link;
    return Ans::ans($ans);
}
//Nostore::on():
if (isset($_GET['p'])) {
    $ans['page'] = (int) $_GET['p'];
    if ($ans['page'] < 1) {
        $ans['page'] = 1;
    }
} else {
    $ans['page'] = 1;
}
$args = array($md, $ans['page']);
$re = isset($_GET['re']);
if (!$re) {
    if ($ans['page'] != 1) {
Example #3
0
 public static function check(&$layer)
 {
     if (!empty($layer['seojsontpl'])) {
         $layer['seojson'] = Template::parse(array($layer['seojsontpl']), $layer);
     }
     if (empty($layer['seojson'])) {
         return;
     }
     $item = self::load($layer['seojson']);
     if (!$item) {
         return;
     }
     $html = View::html();
     if (!empty($item['image_src'])) {
         self::meta($html, $item, 'link', 'image_src');
         self::meta($html, $item, 'property', 'og:image', $item['image_src']);
         self::meta($html, $item, 'name', 'twitter:image', $item['image_src']);
         //self::meta($html, $item, 'itemprop', 'image', $item['image_src']);
     }
     if (empty($item['canonical'])) {
         $query = preg_replace('/^\\//', '', $_SERVER['REQUEST_URI']);
         $item['canonical'] = View::getPath() . $query;
     }
     if (!empty($item['canonical'])) {
         self::meta($html, $item, 'link', 'canonical');
         self::meta($html, $item, 'name', 'twitter:site', $item['canonical']);
         self::meta($html, $item, 'property', 'og:url', $item['canonical']);
         //self::meta($html, $item, 'property', 'business:contact_data:website', $item['canonical']);
     }
     if (!empty($item['description'])) {
         self::meta($html, $item, 'name', 'description');
         self::meta($html, $item, 'property', 'og:description', $item['description']);
         self::meta($html, $item, 'name', 'twitter:description', $item['description']);
     }
     self::meta($html, $item, 'name', 'keywords');
     if (!empty($item['title'])) {
         self::meta($html, $item, 'title', 'title');
         self::meta($html, $item, 'property', 'og:title', $item['title']);
         self::meta($html, $item, 'name', 'twitter:title', $item['title']);
     }
     if (!empty($item['site_name'])) {
         self::meta($html, $item, 'property', 'site_name');
         self::meta($html, $item, 'itemprop', 'name', $item['site_name']);
         self::meta($html, $item, 'property', 'og:site_name', $item['site_name']);
     }
     if (empty($item['properties']['og:type'])) {
         self::meta($html, $item, 'property', 'og:type', 'website');
     }
     if (!empty($item['properties'])) {
         foreach ($item['properties'] as $k => $v) {
             self::meta($html, $item['properties'], 'property', $k, $v);
         }
     }
     if (!empty($item['names'])) {
         foreach ($item['names'] as $k => $v) {
             self::meta($html, $item['names'], 'name', $k, $v);
         }
     }
     if (!empty($item['itemprops'])) {
         foreach ($item['itemprops'] as $k => $v) {
             self::meta($html, $item['itemprops'], 'itemprop', $k, $v);
         }
     }
     View::html($html, true);
 }
Example #4
0
        }
    } elseif (isset($_GET['gallery'])) {
        $src = Rubrics::find($dir, $id);
        $info = Rubrics::info($src);
        $ans['info'] = $info;
        return Ans::ret($ans);
    } elseif (isset($_GET['load'])) {
        if (!$res) {
            //@header("Status: 404 Not Found");
            //@header("HTTP/1.0 404 Not Found");
            @header('location: ' . View::getPath() . '?' . $type . '/' . $id);
            //Просто редирект на страницу со списокм всех файлов
        } else {
            //echo View::getPath().$dir.$res['file'];
            //exit;
            @header('location: ' . View::getPath() . $dir . $res['file']);
        }
        exit;
    } else {
        return Ans::err($res, 'id что?');
    }
} elseif (isset($_GET['list'])) {
    if (isset($_GET['lim'])) {
        $lim = $_GET['lim'];
    } else {
        $lim = '0,100';
    }
    $p = explode(',', $lim);
    if (sizeof($p) != 2) {
        return Ans::err($ans, 'Is wrong paramter lim');
    }