Storage::save PHP Method

save() protected method

protected save ( $arr )
    protected function save($arr)
    {
        $collection = $this->readCollection();
        $collection[self::VERSION]['jobs'][md5($arr['name'])] = $arr;
        if (is_array($arr['tubes'])) {
            foreach ($arr['tubes'] as $tubename => $val) {
                $collection[self::VERSION]['tubes'][$tubename][md5($arr['name'])] = '';
            }
        }
        $this->writeCollection($collection);
        return true;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * вывод html-карты сайта по шорт-коду [sitemap-html]
  */
 static function viewSitemap()
 {
     $sitemap = Storage::get(md5('mgPluginSitemapHtml'));
     if ($sitemap == null) {
         $pages = self::getPages();
         $catalog = self::getCatalog();
         $html = '
 <div class="sitemap-html">
  <h2 class="new-products-title">Карта сайта</h2>
 <ul class="js_listSiteMap">';
         foreach ($pages as $url => $title) {
             $partsUrl = URL::getSections($url);
             $priority = count($partsUrl);
             if (is_array($title)) {
                 $html .= '<li><a href="' . SITE . '/' . $url . '">' . $title[$url] . '<ul>';
                 foreach ($title as $suburl => $subtitle) {
                     if ($suburl != $url) {
                         $html .= '<li><a href="' . SITE . '/' . $suburl . '" title="' . $subtitle . '">' . $subtitle . '</a></li>';
                     }
                 }
                 $html .= '</ul></li>';
             } else {
                 $html .= '<li><a href="' . SITE . '/' . $url . '" title="' . $title . '">' . $title . '</a></li>';
                 if ($url == 'catalog') {
                     $html .= '<ul>' . $catalog . '</ul>';
                 }
             }
         }
         $sitemap = $html . '</ul></div>';
         Storage::save(md5('mgPluginSitemapHtml'), $sitemap);
     }
     return $sitemap;
 }
All Usage Examples Of Storage::save