Explorar o código

Ticket #532 - remove old Social Share engine.

AntonLV %!s(int64=9) %!d(string=hai) anos
pai
achega
a53aa90b19

+ 0 - 127
inc/classes/BxDolSocialSharing.php

@@ -1,127 +0,0 @@
-<?php defined('BX_DOL') or die('hack attempt');
-/**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup    UnaCore UNA Core
- * @{
- */
-
-/**
- * @page objects
- * @section social_sharing Social Sharing Buttons
- * @ref BxDolSocialSharing
- */
-
-/**
- * Social sharing buttons for any content
- *
- * It displays sharing buttons from popular social networks, like facebook, twitter, gogole plus, etc.
- *
- *
- * @section example Example of usage:
- *
- * @code
- * echo BxTemplSocialSharing::getInstance()->getCode($iId, $sModuleName, $sUrl, $sTitle);
- * @endcode
- *
- *
- * @section alerts Alerts:
- *
- * Type/unit: system
- * Action: social_sharing_display
- * Options:
- *      buttons - reference to buttons array
- *      markers - reference to variables for replacement
- *      override_output - override output string
- *
- */
-class BxDolSocialSharing extends BxDolFactory implements iBxDolSingleton
-{
-    protected $_oQuery;
-    protected $_aSocialButtons = array (); // active social buttons array
-
-    /**
-     * Constructor
-     */
-    protected function __construct()
-    {
-        parent::__construct();
-        $this->_oQuery = new BxDolSocialSharingQuery();
-        $this->_aSocialButtons = $this->_oQuery->getActiveButtons();
-    }
-
-    /**
-     * Get object instance
-     * @param $sObject object name
-     * @return object instance
-     */
-    static public function getInstance()
-    {
-        if (isset($GLOBALS['bxDolClasses']['BxDolSocialSharing']))
-            return $GLOBALS['bxDolClasses']['BxDolSocialSharing'];
-
-        $o = new BxTemplSocialSharing();
-
-        return ($GLOBALS['bxDolClasses']['BxDolSocialSharing'] = $o);
-    }
-
-    public function getCode ($sContentId, $sModuleName, $sUrl, $sTitle, $aCustomVars = false)
-    {
-        // overrided in template class
-    }
-
-    /**
-     * Replace provided markers in string.
-     * @param $s - string to replace markers in
-     * @param $a - markers array
-     * @return string with replaces markers
-     */
-    protected function _replaceMarkers ($mixed, $aMarkers)
-    {
-        if (empty($mixed) || empty($aMarkers) || !is_array($aMarkers))
-            return $mixed;
-        return bx_replace_markers($mixed, $aMarkers);
-    }
-
-    /**
-     * Get most facebook locale for provided language code.
-     * @param $sLang lang code
-     * @return locale string or empty string if no lacale is found
-     */
-    protected function _getLocaleFacebook ($sLang)
-    {
-        $aLocales = $this->_getLocalesFacebook();
-        if (!$aLocales || !isset($aLocales[$sLang]))
-            return '';
-        return $aLocales[$sLang];
-    }
-
-    /**
-     * Get facebook locales
-     * @return locales array, lang is array key and locale is array value
-     */
-    protected function _getLocalesFacebook ()
-    {
-        $oCache = $this->_oQuery->getDbCacheObject();
-        $sCacheKey = $this->_oQuery->genDbCacheKey('sys_social_sharing_locales_fb');
-        $aData = $oCache->getData($sCacheKey);
-        if (null === $aData) {
-            $sXML = bx_file_get_contents ('http://www.facebook.com/translations/FacebookLocales.xml');
-            if (!$sXML)
-                return false;
-            $xmlLocates = new SimpleXMLElement($sXML);
-            $aData = array ();
-            foreach ($xmlLocates->locale as $xmlLocale) {
-                $sLocale = (string)($xmlLocale->codes->code->standard->representation);
-                list ($sLang,) = explode('_', $sLocale);
-                if (!isset($aData[$sLang]))
-                    $aData[$sLang] = $sLocale;
-            }
-            $oCache->setData ($sCacheKey, $aData);
-        }
-        return $aData;
-    }
-}
-
-/** @} */

+ 0 - 28
inc/classes/BxDolSocialSharingQuery.php

@@ -1,28 +0,0 @@
-<?php defined('BX_DOL') or die('hack attempt');
-/**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup    UnaCore UNA Core
- * @{
- */
-
-/**
- * @see BxDolSocialSharing
- */
-class BxDolSocialSharingQuery extends BxDolDb
-{
-
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    public function getActiveButtons ()
-    {
-        return $this->fromCache('sys_objects_social_sharing', 'getAll', 'SELECT * FROM `sys_objects_social_sharing` WHERE `active` = 1 ORDER BY `order` ASC');
-    }
-
-}
-
-/** @} */

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
install/sql/system.sql


+ 0 - 1
modules/base/general/template/css/main.css

@@ -9,7 +9,6 @@
 .bx-base-general-entity-share .bx-favorite,
 .bx-base-general-entity-share .bx-report,
 .bx-base-general-entity-share .bx-tl-repost,
-.bx-base-general-entity-share .bx-social-sharing,
 .bx-base-general-entity-share .bx-menu-btns-hor.bx-menu-object-sys_social_sharing {
 	position: relative;
 	float: left;

+ 0 - 4
modules/boonex/english/data/langs/system/en.xml

@@ -2209,10 +2209,6 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_select"><![CDATA[Select]]></string>
 	<string name="_sys_send"><![CDATA[Send]]></string>
     <string name="_sys_search_placeholder"><![CDATA[Search...]]></string>
-    <string name="_sys_social_sharing_title_facebook"><![CDATA[Share in Facebook]]></string>
-    <string name="_sys_social_sharing_title_googleplus"><![CDATA[Share in Google Plus]]></string>
-    <string name="_sys_social_sharing_title_twitter"><![CDATA[Share in Twitter]]></string>
-    <string name="_sys_social_sharing_title_pinterest"><![CDATA[Share in Pinterest]]></string>
 	<string name="_sys_spam_detected"><![CDATA[Sorry, it looks like you are trying to submit spam]]></string>
 	<string name="_sys_spam_detected_contact"><![CDATA[Sorry, it looks like you are trying to submit spam, if you believe that it is not spam please submit false positive report here: {0}]]></string>
 	<string name="_sys_splash_btn_start"><![CDATA[Start]]></string>

+ 0 - 21
modules/boonex/ocean/data/template/system/scripts/BxTemplSocialSharing.php

@@ -1,21 +0,0 @@
-<?php defined('BX_DOL') or die('hack attempt');
-/**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup    UnaTemplate UNA Template Classes
- * @{
- */
-
-/**
- * @see BxDolSocialSharing
- */
-class BxTemplSocialSharing extends BxBaseSocialSharing
-{
-    function __construct($oTemplate = false)
-    {
-        parent::__construct($oTemplate);
-    }
-}
-
-/** @} */

+ 0 - 21
modules/boonex/protean/data/template/system/scripts/BxTemplSocialSharing.php

@@ -1,21 +0,0 @@
-<?php defined('BX_DOL') or die('hack attempt');
-/**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup    UnaTemplate UNA Template Classes
- * @{
- */
-
-/**
- * @see BxDolSocialSharing
- */
-class BxTemplSocialSharing extends BxBaseSocialSharing
-{
-    function __construct($oTemplate = false)
-    {
-        parent::__construct($oTemplate);
-    }
-}
-
-/** @} */

+ 0 - 4
modules/boonex/russian/data/langs/system/ru.xml

@@ -2207,10 +2207,6 @@
 	<string name="_sys_select"><![CDATA[Выбрать]]></string>
 	<string name="_sys_send"><![CDATA[Послать]]></string>
     <string name="_sys_search_placeholder"><![CDATA[Поиск...]]></string>
-    <string name="_sys_social_sharing_title_facebook"><![CDATA[Поделиться в Facebook]]></string>
-    <string name="_sys_social_sharing_title_googleplus"><![CDATA[Поделиться в Google Plus]]></string>
-    <string name="_sys_social_sharing_title_twitter"><![CDATA[Поделиться в Twitter]]></string>
-    <string name="_sys_social_sharing_title_pinterest"><![CDATA[Поделиться в Pinterest]]></string>
 	<string name="_sys_spam_detected"><![CDATA[Извините, кажется, Вы пытаетесь послать спам]]></string>
 	<string name="_sys_spam_detected_contact"><![CDATA[Извините, кажется, Вы пытаетесь послать спам. Если Вы уверены, что это не спам, пошлите нам уведомление: {0}]]></string>
 	<string name="_sys_splash_btn_start"><![CDATA[Начало]]></string>

+ 0 - 17
template/css/general.css

@@ -138,20 +138,3 @@
 #bx-footer-copyright {
     float:right;
 }
-
-/* --------------- social buttons */
-
-.bx-social-sharing-btn {
-    float:left;
-}
-
-.bx-social-sharing-btn a,
-.bx-social-sharing-btn .sys-icon {
-    text-decoration:none;
-    vertical-align:middle;
-}
-.bx-social-sharing-btn span {
-    font-size:1.5rem;
-    vertical-align:middle;
-    margin:0 0.2rem;
-}

+ 0 - 93
template/scripts/BxBaseSocialSharing.php

@@ -1,93 +0,0 @@
-<?php defined('BX_DOL') or die('hack attempt');
-/**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup    UnaBaseView UNA Base Representation Classes
- * @{
- */
-
-/**
- * @see BxDolSocialSharing
- */
-class BxBaseSocialSharing extends BxDolSocialSharing
-{
-    protected $_oTemplate;
-
-    /**
-     * Constructor
-     */
-    protected function __construct($oTemplate)
-    {
-        parent::__construct();
-        $this->_oTemplate = $oTemplate ? $oTemplate : BxDolTemplate::getInstance();
-    }
-
-    public function getCode ($sContentId, $sModuleName, $sUrl, $sTitle, $aCustomVars = false)
-    {
-        // define markers for replacments
-        $sLang = BxDolLanguages::getInstance()->getCurrentLanguage();
-        $aMarkers = array (
-            'id' => $sContentId,
-            'module' => $sModuleName,
-            'url' => $sUrl,
-            'url_encoded' => rawurlencode($sUrl),
-            'lang' => $sLang,
-            'locale' => $this->_getLocaleFacebook($sLang),
-            'title' => $sTitle,
-            'title_encoded' => rawurlencode($sTitle),
-        );
-
-        if (!empty($aCustomVars) && is_array($aCustomVars))
-            $aMarkers = array_merge($aMarkers, $aCustomVars);
-
-        // alert
-        $sOverrideOutput = null;
-        $oAlert = new BxDolAlerts('system', 'social_sharing_display', '', '', array (
-            'buttons' => &$this->_aSocialButtons,
-            'markers' => &$aMarkers,
-            'override_output' => &$sOverrideOutput,
-        ));
-        $oAlert->alert();
-
-        // return custom code if there is one
-        if ($sOverrideOutput)
-            return $sOverrideOutput;
-
-        // return empty string of there is no buttons
-        if (empty($this->_aSocialButtons))
-            return '';
-
-        // prepare buttons
-        $aButtons = array();
-        foreach ($this->_aSocialButtons as $aButton) {
-
-            switch ($aButton['type']) {
-                case 'html':
-                    $sButton = $this->_replaceMarkers($aButton['content'], $aMarkers);
-                    $sButton = $this->_oTemplate->parseHtmlByContent($sButton, array());
-                    break;
-                case 'service':
-                    $a = @unserialize($aButton['content']);
-                    if (false === $a || !is_array($a))
-                        break;
-                    $a = $this->_replaceMarkers($a, $aMarkers);
-                    $sButton = BxDolService::call($a['module'], $a['method'], isset($a['params']) ? $a['params'] : array(), isset($a['class']) ? $a['class'] : 'Module');
-                    break;
-            }
-
-            if (!isset($sButton) || preg_match('/{[A-Za-z0-9_]+}/', $sButton)) // if not all markers are replaced skip it
-                continue;
-            $aButtons[] = array ('button' => $sButton, 'object' => $aButton['object']);
-        }
-
-        // output
-        $aTemplateVars = array (
-            'bx_repeat:buttons' => $aButtons,
-        );
-        return $this->_oTemplate->parseHtmlByName('social_sharing.html', $aTemplateVars);
-    }
-
-}
-
-/** @} */

+ 0 - 7
template/social_sharing.html

@@ -1,7 +0,0 @@
-<div class="bx-social-sharing bx-def-margin-right-auto bx-clearfix">
-    <bx_repeat:buttons>
-        <div class="bx-social-sharing-btn bx-social-sharing-__object__ bx-def-margin-right-auto bx-def-margin-thd-topbottom">
-            __button__
-        </div>
-    </bx_repeat:buttons>
-</div>

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio