Alex Trofimov 11 лет назад
Родитель
Сommit
78fee0383c

+ 1 - 1
inc/classes/BxDolService.php

@@ -72,7 +72,7 @@ class BxDolService extends BxDol
         if (false === $a || !is_array($a))
             return '';
 
-        if (isset($a[$sReplaceIn]))
+        if (isset($a[$sReplaceIn]) && $aMarkers)
             $a[$sReplaceIn] = bx_replace_markers($a[$sReplaceIn], $aMarkers);
 
         return self::call($a['module'], $a['method'], isset($a['params']) ? $a['params'] : array(), isset($a['class']) ? $a['class'] : 'Module');

+ 2 - 1
modules/boonex/posts/install/sql/enable.sql

@@ -49,10 +49,11 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 ('bx_posts_view_entry', '_bx_posts_page_title_sys_view_entry', '_bx_posts_page_title_view_entry', 'bx_posts', 10, 2147483647, 1, 'view-post', '', '', '', '', 0, 1, 0, 'BxPostsPageEntry', 'modules/boonex/posts/classes/BxPostsPageEntry.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
-('bx_posts_view_entry', 3, 'bx_posts', '', '_bx_posts_page_block_title_entry_location', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"entity_location\";}', 0, 0, 1, 0),
 ('bx_posts_view_entry', 1, 'bx_posts', '', '_bx_posts_page_block_title_entry_text', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:17:\"entity_text_block\";}', 0, 0, 1, 0),
 ('bx_posts_view_entry', 2, 'bx_posts', '', '_bx_posts_page_block_title_entry_author', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:13:\"entity_author\";}', 0, 0, 1, 0),
 ('bx_posts_view_entry', 4, 'bx_posts', '', '_bx_posts_page_block_title_entry_all_actions', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:18:\"entity_all_actions\";}', 0, 0, 1, 0),
+('bx_posts_view_entry', 3, 'bx_posts', '', '_bx_posts_page_block_title_entry_location', 3, 2147483647, 'service', 'a:4:{s:6:\"module\";s:6:\"system\";s:6:\"method\";s:13:\"locations_map\";s:6:\"params\";a:2:{i:0;s:8:\"bx_posts\";i:1;s:4:\"{id}\";}s:5:\"class\";s:20:\"TemplServiceMetatags\";}', 0, 0, 1, 0),
+('bx_posts_view_entry', 3, 'bx_posts', '', '_bx_posts_page_block_title_entry_location', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"entity_location\";}', 0, 0, 0, 1),
 ('bx_posts_view_entry', 4, 'bx_posts', '', '_bx_posts_page_block_title_entry_actions', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:14:\"entity_actions\";}', 0, 0, 0, 1),
 ('bx_posts_view_entry', 4, 'bx_posts', '', '_bx_posts_page_block_title_entry_social_sharing', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:21:\"entity_social_sharing\";}', 0, 0, 0, 2),
 ('bx_posts_view_entry', 4, 'bx_posts', '', '_bx_posts_page_block_title_entry_attachments', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:18:\"entity_attachments\";}', 0, 0, 0, 3),

+ 15 - 0
template/css/metatags.css

@@ -6,3 +6,18 @@
     line-height:2rem;
     margin: 0 0.25rem 0 0;
 }
+
+.bx-metatags-locations-map {
+    position:relative;
+    height:144px;
+    background-position:center center;
+    background-repeat:no-repeat;
+}
+
+.bx-metatags-locations-map-string {
+    position:absolute;
+    bottom:0;
+    left:0;
+    text-shadow:1px 1px 0.125rem #fff;
+    background-color:rgba(255,255,255,0.7);
+}

+ 3 - 0
template/metatags_locations_map.html

@@ -0,0 +1,3 @@
+<div class="bx-metatags-locations-map bx-def-round-corners bx-def-color-bg-box" style="background-image:url(__map_img__);">
+    <div class="bx-metatags-locations-map-string bx-def-font-grayed bx-def-padding-sec bx-def-round-corners">__location_string__</div>
+</div>

+ 26 - 0
template/scripts/BxBaseServiceMetatags.php

@@ -69,6 +69,32 @@ class BxBaseServiceMetatags extends BxDol
         return BxDolTemplate::getInstance()->parseHtmlByName('metatags_keywords_cloud.html', $aVars);
     }
 
+    /**
+     * Get location map.
+     * @param $sObject metatgs object to get keywords cloud for
+     * @param $iId content id
+     * @return map HTML string
+     */
+    public function serviceLocationsMap ($sObject, $iId, $sMapSize = '1000x144', $sMapKey = '')
+    {
+        $o = BxDolMetatags::getObjectInstance($sObject);
+        $sLocationHtml = $o->locationsString($iId);
+        if (!$sLocationHtml)
+            return '';
+
+        $sLocationEncoded = rawurlencode(strip_tags($sLocationHtml));
+        $sProto = (0 == strncmp('https', BX_DOL_URL_ROOT, 5)) ? 'https' : 'http';
+        $iScale = isset($_COOKIE['devicePixelRatio']) && (int)$_COOKIE['devicePixelRatio'] >= 2 ? 2 : 1;
+        $sLang = BxDolLanguages::getInstance()->getCurrentLanguage();
+        $aVars = array (
+            'map_img' => $sProto . '://maps.googleapis.com/maps/api/staticmap?center=' . $sLocationEncoded . '&zoom=7&size=' . $sMapSize . '&maptype=roadmap&markers=size:small%7C' . $sLocationEncoded . '&scale=' . $iScale . '&language=' . $sLang  . ($sMapKey ? '&key=' . $sMapKey : ''),
+            'location_string' => $sLocationHtml,
+        );
+
+        $this->addCssJs();
+        return BxDolTemplate::getInstance()->parseHtmlByName('metatags_locations_map.html', $aVars);
+    }
+
     public function addCssJs()
     {
         $oTemplate = BxDolTemplate::getInstance();