Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/unaio/una
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Aug 30, 2023
2 parents 37eedbc + 4b23b5e commit 91ecfce
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ BxDolCmts.prototype.cmtInit = function()

$(document).ready(function() {
// init socket
if(oBxDolSockets && $this._sSocket)
if(window.oBxDolSockets !== undefined && $this._sSocket)
oBxDolSockets.subscribe($this._sSocket, $this._iObjId, 'comment_added', function(oData) {
$this.cmtUpdateCounterAs(oData);
$this.showLiveUpdateForSocket(oData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ BxDolScore.prototype.init = function()
{
var $this = this;
$(document).ready(function() {
if(oBxDolSockets && $this._sSocket)
if(window.oBxDolSockets !== undefined && $this._sSocket)
oBxDolSockets.subscribe($this._sSocket, $this._iObjId, 'voted', function(oData) {
$this.onVoteAs(oData);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ BxDolVote.prototype.init = function()
{
var $this = this;
$(document).ready(function() {
if(oBxDolSockets && $this._sSocket)
if(window.oBxDolSockets !== undefined && $this._sSocket)
oBxDolSockets.subscribe($this._sSocket, $this._iObjId, 'voted', function(oData) {
$this.onVoteAs(oData);
});
Expand Down
2 changes: 1 addition & 1 deletion upgrade/files/13.0.0-13.1.0.B1/files/plugins/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitfad78b73b9f3c29bbcafb6b9f0c1941c::getLoader();
return ComposerAutoloaderInit677a7075d813ab3f5b82fd6ba9462350::getLoader();
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitfad78b73b9f3c29bbcafb6b9f0c1941c
class ComposerAutoloaderInit677a7075d813ab3f5b82fd6ba9462350
{
private static $loader;

Expand All @@ -24,15 +24,15 @@ public static function getLoader()

require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInitfad78b73b9f3c29bbcafb6b9f0c1941c', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit677a7075d813ab3f5b82fd6ba9462350', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitfad78b73b9f3c29bbcafb6b9f0c1941c', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit677a7075d813ab3f5b82fd6ba9462350', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInitfad78b73b9f3c29bbcafb6b9f0c1941c::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit677a7075d813ab3f5b82fd6ba9462350::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
Expand All @@ -53,19 +53,19 @@ public static function getLoader()
$loader->register(true);

if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitfad78b73b9f3c29bbcafb6b9f0c1941c::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit677a7075d813ab3f5b82fd6ba9462350::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirefad78b73b9f3c29bbcafb6b9f0c1941c($fileIdentifier, $file);
composerRequire677a7075d813ab3f5b82fd6ba9462350($fileIdentifier, $file);
}

return $loader;
}
}

function composerRequirefad78b73b9f3c29bbcafb6b9f0c1941c($fileIdentifier, $file)
function composerRequire677a7075d813ab3f5b82fd6ba9462350($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInitfad78b73b9f3c29bbcafb6b9f0c1941c
class ComposerStaticInit677a7075d813ab3f5b82fd6ba9462350
{
public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
Expand Down Expand Up @@ -215,10 +215,10 @@ class ComposerStaticInitfad78b73b9f3c29bbcafb6b9f0c1941c
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitfad78b73b9f3c29bbcafb6b9f0c1941c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitfad78b73b9f3c29bbcafb6b9f0c1941c::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInitfad78b73b9f3c29bbcafb6b9f0c1941c::$prefixesPsr0;
$loader->classMap = ComposerStaticInitfad78b73b9f3c29bbcafb6b9f0c1941c::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit677a7075d813ab3f5b82fd6ba9462350::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit677a7075d813ab3f5b82fd6ba9462350::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit677a7075d813ab3f5b82fd6ba9462350::$prefixesPsr0;
$loader->classMap = ComposerStaticInit677a7075d813ab3f5b82fd6ba9462350::$classMap;

}, null, ClassLoader::class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'a59ed361e3cbfb4bedf459ceecf536c7baffe65a',
'reference' => '55fccd10f535d3936ea1fd589e67e16693319fe1',
'name' => 'unaio/una',
'dev' => true,
),
Expand Down Expand Up @@ -359,7 +359,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'a59ed361e3cbfb4bedf459ceecf536c7baffe65a',
'reference' => '55fccd10f535d3936ea1fd589e67e16693319fe1',
'dev_requirement' => false,
),
'wikimedia/less.php' => array(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<?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
* @{
*/

/**
* Menu representation.
* @see BxDolMenu
*/
class BxBaseMenuTagsCloud extends BxTemplMenu
{
protected $_iMenuItemsMin;
protected $_aItems;

public function __construct ($aObject, $oTemplate)
{
parent::__construct ($aObject, $oTemplate);

$this->_bDisplayAddons = true;
$this->_iMenuItemsMin = 10;
}

public function setKeywords($aKeywords, $oMetaObject, $mixedSection)
{
foreach ($aKeywords as $sKeyword => $iCount) {
$aItems[] = [
'class_add' => 'bx-psmi-show-' . $sKeyword . ' ',
'name' => 'show-' . $sKeyword,
'title' => htmlspecialchars_adv($sKeyword),
'link' => $oMetaObject->keywordsGetHashTagUrl($sKeyword, 0, $mixedSection),
'bx_if:onclick' => [
'condition' => false,
'content' => [
'onclick' => 'javascript:',
]
],
'attrs' => '',
'bx_if:image' => array (
'condition' => false,
'content' => [],
),
'bx_if:image_inline' => array (
'condition' => false,
'content' => [],
),
'bx_if:icon' => array (
'condition' => true,
'content' => array('icon' => 'hashtag'),
),
'bx_if:icon-a' => array (
'condition' => false,
'content' => [],
),
'bx_if:icon-html' => array (
'condition' => false,
'content' => [],
),
'bx_if:addon' => [
'condition' => true,
'content' => ['addon' => $iCount]
]
];
}

$this->_aItems = $aItems;
}

public function getMenuItems ()
{
$aItems = $this->_aItems;
if(empty($aItems) || !is_array($aItems))
return $aItems;

$iMaxNum = count($aItems);
if($iMaxNum <= $this->_iMenuItemsMin)
return $aItems;

$mixedCollpsed = $this->getUserChoiceCollapsed();
$bCollpsed = $mixedCollpsed === false || $mixedCollpsed == 1;

for($i = $this->_iMenuItemsMin; $i < $iMaxNum; $i++)
$aItems[$i]['class_add'] .= ' bx-mi-aux' . ($bCollpsed ? ' bx-mi-hidden' : '');

$aShowMoreLinks = [
'more' => ['title' => '_sys_show_more', 'icon' => 'chevron-down', 'class' => $bCollpsed ? '' : 'bx-mi-hidden'],
'less' => ['title' => '_sys_show_less', 'icon' => 'chevron-up', 'class' => !$bCollpsed ? '' : 'bx-mi-hidden']
];

foreach($aShowMoreLinks as $sLink => $aLink)
$aItems[] = array(
'class_add' => 'bx-psmi-show-' . $sLink . ' ' . $aLink['class'],
'name' => 'show-' . $sLink,
'title' => _t($aLink['title']),
'link' => 'javascript:void(0)',
'bx_if:onclick' => [
'condition' => false,
'content' => [
'onclick' => 'bx_menu_show_more_less(this, \'' . $this->_sObject . '\', \'.bx-menu-object-' . $this->_sObject . '\')',
]
],
'attrs' => '',
'bx_if:image' => [
'condition' => false,
'content' => ['icon_url' => ''],
],
'bx_if:image_inline' => [
'condition' => false,
'content' => ['image' => ''],
],
'bx_if:icon' => [
'condition' => true,
'content' => ['icon' => $aLink['icon']],
],
'bx_if:icon-html' => [
'condition' => false,
'content' => ['icon-a' => ''],
],
'bx_if:icon-a' => [
'condition' => false,
'content' => ['icon-a' => ''],
],
'bx_if:addon' => [
'condition' => false,
'content' => []
]
);

return $aItems;
}

protected function getMenuItemsRaw ()
{
$aItems = $this->_oQuery->getMenuItemsBy(array(
'type' => 'set_name',
'set_name' => $this->_aObject['set_name']
));

$aDuplicates = $this->_oQuery->getMenuItemsBy(array(
'type' => 'set_name_duplicates',
'set_name' => $this->_aObject['set_name']
));

$oProfile = BxDolProfile::getInstance();
if(!$oProfile)
return array();

$sModule = $oProfile->getModule();

$aResult = array();
foreach($aItems as $aItem) {
if(in_array($aItem['name'], $aDuplicates) && $aItem['module'] != $sModule)
continue;

$aResult[$aItem['name']] = $aItem;
}

return $aResult;
}

protected function _getMenuItem($a)
{
$mixedResult = parent::_getMenuItem($a);

if($mixedResult !== false && !empty($mixedResult['link']) && strpos($mixedResult['link'], 'javascript:') === false)
$mixedResult['link'] = bx_append_url_params($mixedResult['link'], [
'owner' => 1
]);

return $mixedResult;
}
}

/** @} */

0 comments on commit 91ecfce

Please sign in to comment.