Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
8dfb96a8
Commit
8dfb96a8
authored
Apr 12, 2022
by
Ruslan Karimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#8037. Скрытие ссылок на соц сети
parent
3d7b58f5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
29 deletions
+56
-29
common/models/Settings.php
common/models/Settings.php
+33
-0
common/modules/blog/views/post/_sidebar.php
common/modules/blog/views/post/_sidebar.php
+7
-7
common/modules/blog/views/post/_social.php
common/modules/blog/views/post/_social.php
+8
-13
common/modules/faq/views/faq/_sidebar.php
common/modules/faq/views/faq/_sidebar.php
+8
-9
No files found.
common/models/Settings.php
View file @
8dfb96a8
...
...
@@ -3,6 +3,7 @@
namespace
common\models
;
use
Yii
;
use
yii\helpers\ArrayHelper
;
/**
* This is the model class for table "settings".
...
...
@@ -18,6 +19,11 @@ use Yii;
*/
class
Settings
extends
\common\components\ActiveRecordModel
{
/**
* @var null|array
*/
public
static
$cachedSocialLinks
=
null
;
/**
* @inheritdoc
*/
...
...
@@ -75,4 +81,31 @@ class Settings extends \common\components\ActiveRecordModel
return
;
}
/**
* @param $codes
* @return array
*/
public
static
function
getMultipleValues
(
$codes
)
{
return
ArrayHelper
::
map
(
self
::
find
()
->
select
([
'code'
,
'value'
])
->
where
([
'code'
=>
$codes
,
'hidden'
=>
0
])
->
asArray
()
->
all
(),
'code'
,
'value'
);
}
/**
* @return array|null
*/
public
static
function
getSocialLinks
()
{
if
(
self
::
$cachedSocialLinks
===
null
)
{
self
::
$cachedSocialLinks
=
self
::
getMultipleValues
([
'social-link-google'
,
'social-link-twitter'
,
'social-link-fb'
,
'social-link-vk'
,
'social-link-instagram'
,
'social-link-youtube'
,
]);
}
return
self
::
$cachedSocialLinks
;
}
}
common/modules/blog/views/post/_sidebar.php
View file @
8dfb96a8
...
...
@@ -6,7 +6,7 @@ use common\modules\blog\models\Post;
use
common\modules\blog\models\PostTag
;
use
common\models\Settings
;
use
common\modules\languages\models\Languages
;
$socialLinks
=
Settings
::
getSocialLinks
();
?>
<div
class=
"col-md-4 col-xs-4 col-sm-12"
>
...
...
@@ -89,12 +89,12 @@ use common\modules\languages\models\Languages;
<!-- add 22.05.16 -->
<ul
class=
"article_short_social"
>
<li>
<?php
$s
=
Settings
::
getValue
(
'social-link-google'
);
if
(
$s
)
:
?>
<a
class=
"icon_social_btn icon_social_g"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-twitter'
);
if
(
$s
)
:
?>
<a
class=
"icon_social_btn icon_social_tw"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-fb'
);
if
(
$s
)
:
?>
<a
class=
"icon_social_btn icon_social_f"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-vk'
);
if
(
$s
)
:
?>
<a
class=
"icon_social_btn icon_social_b"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-instagram'
);
if
(
$s
)
:
?>
<a
class=
"icon_social_btn icon_social_inst"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-youtube'
);
if
(
$s
)
:
?>
<a
class=
"icon_social_btn icon_social_yt"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-google'
]))
:
?>
<a
class=
"icon_social_btn icon_social_g"
href=
"
<?=
$socialLinks
[
'social-link-google'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-twitter'
]))
:
?>
<a
class=
"icon_social_btn icon_social_tw"
href=
"
<?=
$socialLinks
[
'social-link-twitter'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-fb'
]))
:
?>
<a
class=
"icon_social_btn icon_social_f"
href=
"
<?=
$socialLinks
[
'social-link-fb'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-vk'
]))
:
?>
<a
class=
"icon_social_btn icon_social_b"
href=
"
<?=
$socialLinks
[
'social-link-vk'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-instagram'
]))
:
?>
<a
class=
"icon_social_btn icon_social_inst"
href=
"
<?=
$socialLinks
[
'social-link-instagram'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-youtube'
]))
:
?>
<a
class=
"icon_social_btn icon_social_yt"
href=
"
<?=
$socialLinks
[
'social-link-youtube'
]
?>
"
></a>
<?
endif
?>
</li>
</ul>
<!-- add 22.05.16 -->
...
...
common/modules/blog/views/post/_social.php
View file @
8dfb96a8
<?
use
common\models\Settings
;
$socialLinks
=
Settings
::
getSocialLinks
();
?>
<ul
class=
"article_short_social"
>
<li>
<?
/*
<a href="#" onclick="window.open('http://vkontakte.ru/share.php?url=<?=$link?>&title=<?=$title?>', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"><img src="/images/icon/sh_social_vk.png" height="30" width="30" alt=""></a>
<a href="#" onclick="window.open('http://www.facebook.com/share.php?u=<?=$title?>', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"><img src="/images/icon/sh_social_fb.png" height="30" width="30" alt=""></a>
<a href="#" onclick="window.open('http://twitter.com/timeline/home?status=<?=$title?>%20<?=$link?>', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"><img src="/images/icon/sh_social_tw.png" height="30" width="30" alt=""></a>
<a href="#" onclick="window.open('https://plus.google.com/share?url=<?=$link?>', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"><img src="/images/icon/sh_social_gp.png" height="30" width="30" alt=""></a>
<!-- <a href="#"><img src="/images/icon/sh_social_t.png" height="30" width="30" alt=""></a> -->
*/
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-google'
);
if
(
$s
)
:
?>
<a
onclick=
"window.open('
<?=
$s
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_g"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-twitter'
);
if
(
$s
)
:
?>
<a
onclick=
"window.open('
<?=
$s
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_tw"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-fb'
);
if
(
$s
)
:
?>
<a
onclick=
"window.open('
<?=
$s
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_f"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-vk'
);
if
(
$s
)
:
?>
<a
onclick=
"window.open('
<?=
$s
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_b"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-instagram'
);
if
(
$s
)
:
?>
<a
onclick=
"window.open('
<?=
$s
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_inst"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-youtube'
);
if
(
$s
)
:
?>
<a
onclick=
"window.open('
<?=
$s
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_yt"
href=
"
<?=
$s
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-google'
]))
:
?>
<a
onclick=
"window.open('
<?=
$socialLinks
[
'social-link-google'
]
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_g"
href=
"
<?=
$socialLinks
[
'social-link-google'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-twitter'
]))
:
?>
<a
onclick=
"window.open('
<?=
$socialLinks
[
'social-link-twitter'
]
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_tw"
href=
"
<?=
$socialLinks
[
'social-link-twitter'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-fb'
]))
:
?>
<a
onclick=
"window.open('
<?=
$socialLinks
[
'social-link-fb'
]
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_f"
href=
"
<?=
$socialLinks
[
'social-link-fb'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-vk'
]))
:
?>
<a
onclick=
"window.open('
<?=
$socialLinks
[
'social-link-vk'
]
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_b"
href=
"
<?=
$socialLinks
[
'social-link-vk'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-instagram'
]))
:
?>
<a
onclick=
"window.open('
<?=
$socialLinks
[
'social-link-instagram'
]
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_inst"
href=
"
<?=
$socialLinks
[
'social-link-instagram'
]
?>
"
></a>
<?
endif
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-youtube'
]))
:
?>
<a
onclick=
"window.open('
<?=
$socialLinks
[
'social-link-youtube'
]
?>
', 'Soc', 'screenX=100,screenY=100,height=500,width=500,location=no,toolbar=no,directories=no,menubar=no,status=no'); return false;"
class=
"icon_social_btn icon_social_yt"
href=
"
<?=
$socialLinks
[
'social-link-youtube'
]
?>
"
></a>
<?
endif
?>
</li>
</ul>
\ No newline at end of file
common/modules/faq/views/faq/_sidebar.php
View file @
8dfb96a8
...
...
@@ -4,8 +4,8 @@ use yii\helpers\Url;
use
common\modules\blog\models\Post
;
use
common\modules\blog\models\PostTag
;
use
common\models\Settings
;
use
common\models\Settings
;
$socialLinks
=
Settings
::
getSocialLinks
();
?>
<div
class=
"col-md-4 col-xs-4 col-sm-12"
>
...
...
@@ -69,13 +69,12 @@ use common\models\Settings;
<h2>
Все секреты в наших соц сетях!
</h2>
<div
class=
"sidebar_module_body"
>
<ul
class=
"sidebar_social"
>
<?php
$s
=
Settings
::
getValue
(
'social-link-fb'
);
if
(
$s
)
:
?>
<li><a
href=
"
<?=
$s
?>
"
class=
"sidebar_social_fb"
></a></li>
<?
endif
;
?>
<!-- <li><a href="#" class="sidebar_social_ok"></a></li> -->
<?php
$s
=
Settings
::
getValue
(
'social-link-twitter'
);
if
(
$s
)
:
?>
<li><a
href=
"
<?=
$s
?>
"
class=
"sidebar_social_tw"
></a></li>
<?
endif
;
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-google'
);
if
(
$s
)
:
?>
<li><a
href=
"
<?=
$s
?>
"
class=
"sidebar_social_gp"
></a></li>
<?
endif
;
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-youtube'
);
if
(
$s
)
:
?>
<li><a
href=
"
<?=
$s
?>
"
class=
"sidebar_social_yt"
></a></li>
<?
endif
;
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-vk'
);
if
(
$s
)
:
?>
<li><a
href=
"
<?=
$s
?>
"
class=
"sidebar_social_vk"
></a></li>
<?
endif
;
?>
<?php
$s
=
Settings
::
getValue
(
'social-link-instagram'
);
if
(
$s
)
:
?>
<li><a
href=
"
<?=
$s
?>
"
class=
"sidebar_social_inst"
></a></li>
<?
endif
;
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-fb'
]))
:
?>
<li><a
href=
"
<?=
$socialLinks
[
'social-link-fb'
]
?>
"
class=
"sidebar_social_fb"
></a></li>
<?
endif
;
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-twitter'
]))
:
?>
<li><a
href=
"
<?=
$socialLinks
[
'social-link-twitter'
]
?>
"
class=
"sidebar_social_tw"
></a></li>
<?
endif
;
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-google'
]))
:
?>
<li><a
href=
"
<?=
$socialLinks
[
'social-link-google'
]
?>
"
class=
"sidebar_social_gp"
></a></li>
<?
endif
;
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-youtube'
]))
:
?>
<li><a
href=
"
<?=
$socialLinks
[
'social-link-youtube'
]
?>
"
class=
"sidebar_social_yt"
></a></li>
<?
endif
;
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-vk'
]))
:
?>
<li><a
href=
"
<?=
$socialLinks
[
'social-link-vk'
]
?>
"
class=
"sidebar_social_vk"
></a></li>
<?
endif
;
?>
<?php
if
(
isset
(
$socialLinks
[
'social-link-instagram'
]))
:
?>
<li><a
href=
"
<?=
$socialLinks
[
'social-link-instagram'
]
?>
"
class=
"sidebar_social_inst"
></a></li>
<?
endif
;
?>
</ul>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment