fix widgets style
This commit is contained in:
parent
9607d9d86d
commit
2d5d611e56
4 changed files with 299 additions and 267 deletions
140
CHANGELOG.md
140
CHANGELOG.md
|
@ -1,96 +1,96 @@
|
||||||
todo
|
todo
|
||||||
- Added public page of the list of know urls and in/visible status
|
- Added public page of the list of know urls and in/visible status
|
||||||
- Added passworded links
|
- Added passworded links
|
||||||
- fix widgets rendering
|
|
||||||
- move setting to config file
|
|
||||||
- fix dashboard rendering
|
|
||||||
- fix deprecated external service
|
- fix deprecated external service
|
||||||
|
|
||||||
2021.08.27
|
2021.08.28
|
||||||
- add dashboard icon
|
- add dashboard icon
|
||||||
- clean PSR-2 codding style and short array
|
- clean PSR-2 codding style and short array
|
||||||
- fix php 7.3+ and php 8.0.x compatibility
|
- fix php 7.3+ and php 8.0.x compatibility
|
||||||
- fix compatibility with Dotclear 2.19
|
- fix compatibility with Dotclear 2.19
|
||||||
- create readme file
|
- create readme file
|
||||||
|
- merge index file sub parts
|
||||||
|
- remove custom js
|
||||||
|
- fix widgets rendering
|
||||||
|
|
||||||
2011.04.01
|
2011.04.01
|
||||||
* Changed version numbering
|
- Changed version numbering
|
||||||
* Added service su.pr (stumbleUpon)
|
- Added service su.pr (stumbleUpon)
|
||||||
* Fixed wiki settings (thanks @ploum )
|
- Fixed wiki settings (thanks @ploum )
|
||||||
|
|
||||||
1.0 20110213
|
1.0 - 2011.02.13
|
||||||
* Added generic class to easlily access services
|
- Added generic class to easlily access services
|
||||||
* Changed generic service class (and class extend it)
|
- Changed generic service class (and class extend it)
|
||||||
* Fixed config of default service
|
- Fixed config of default service
|
||||||
* Fixed display of admin fake section
|
- Fixed display of admin fake section
|
||||||
* Added checkbox helpers on admin
|
- Added checkbox helpers on admin
|
||||||
|
|
||||||
0.6.1 20110130
|
0.6.1 - 2011.01.30
|
||||||
* Cleaned up script
|
- Cleaned up script
|
||||||
|
|
||||||
0.6 20110118 'prepare the soCial révolution'
|
0.6 - 2011.01.18
|
||||||
* Added default defined service (for all blogs of a multiblog)
|
- Added default defined service (for all blogs of a multiblog)
|
||||||
* Added configurable external service
|
- Added configurable external service
|
||||||
* Added goog.gl client service (first step)
|
- Added goog.gl client service (first step)
|
||||||
* Added default settings for third part plugins
|
- Added default settings for third part plugins
|
||||||
* Added behaviors after short link creation
|
- Added behaviors after short link creation
|
||||||
* Added attribute to disable URL shortining on template tag with 'active mode' (fixed bug on URL of POST form)
|
- Added attribute to disable URL shortining on template tag with 'active mode' (fixed bug on URL of POST form)
|
||||||
* Remove all messenger functions: this is to another plugin to do that
|
- Remove all messenger functions: this is to another plugin to do that
|
||||||
* Remove priority in plugin definition
|
- Remove priority in plugin definition
|
||||||
|
|
||||||
0.5 20100909
|
0.5 - 2010.09.09
|
||||||
* Removed old Twitter functions
|
- Removed old Twitter functions
|
||||||
* Added StatusNet small functions (Identica)
|
- Added StatusNet small functions (Identica)
|
||||||
* Required plugin Tac for Twitter ability
|
- Required plugin Tac for Twitter ability
|
||||||
* Added YOURLS client service
|
- Added YOURLS client service
|
||||||
|
|
||||||
0.4.2 20100809
|
0.4.2 - 2010.08.09
|
||||||
* Fixed bug on dcTwitter shorten service
|
- Fixed bug on dcTwitter shorten service
|
||||||
* Fixed bug on custom local link
|
- Fixed bug on custom local link
|
||||||
* Added category URL to active mode
|
- Added category URL to active mode
|
||||||
* Added priority to plugin definition
|
- Added priority to plugin definition
|
||||||
|
|
||||||
0.4.1 20100701
|
0.4.1 - 2010.07.01
|
||||||
* Fixed multiple bugs
|
- Fixed multiple bugs
|
||||||
|
|
||||||
0.4 20100628
|
0.4 - 2010.06.28
|
||||||
* Switched to DC 2.2
|
- Switched to DC 2.2
|
||||||
* Fixed no short urls on preview mode
|
- Fixed no short urls on preview mode
|
||||||
* Fixed lock hash of deleted urls
|
- Fixed lock hash of deleted urls
|
||||||
* Fixed hide new short url widget on kutrl pages
|
- Fixed hide new short url widget on kutrl pages
|
||||||
* Fixed typo
|
- Fixed typo
|
||||||
* Added active mode that shorten urls on default template values
|
- Added active mode that shorten urls on default template values
|
||||||
* Added special tweeter message for post (can include post title)
|
- Added special tweeter message for post (can include post title)
|
||||||
* Added kutrl special 404 page
|
- Added kutrl special 404 page
|
||||||
|
|
||||||
0.3.3 20100528
|
0.3.3 - 2010.05.28
|
||||||
* Fixed settings in tweeter class
|
- Fixed settings in tweeter class
|
||||||
* Renamed tweeter class
|
- Renamed tweeter class
|
||||||
|
|
||||||
0.3.2 20100525
|
0.3.2 - 2010.05.25
|
||||||
* FIxed minor bugs
|
- FIxed minor bugs
|
||||||
* Fixed DC 2.1.7
|
- Fixed DC 2.1.7
|
||||||
|
|
||||||
0.3 20100414
|
0.3 2010.04.14
|
||||||
* Added DC 2.2 compatibility (new settings)
|
- Added DC 2.2 compatibility (new settings)
|
||||||
* Added semi-custom hash on kUtRL service
|
- Added semi-custom hash on kUtRL service
|
||||||
* Added status update for Twitter/Identi.ca on new short link
|
- Added status update for Twitter/Identi.ca on new short link
|
||||||
* Added services error management (first step)
|
- Added services error management (first step)
|
||||||
* Added options to widgets
|
- Added options to widgets
|
||||||
* Upgraded bitly service to v3
|
- Upgraded bitly service to v3
|
||||||
* Changed admin design
|
- Changed admin design
|
||||||
|
|
||||||
0.2 20091223
|
0.2 - 2009.12.23
|
||||||
* Fixed public redirection with suffix
|
- Fixed public redirection with suffix
|
||||||
* Added short.to service
|
- Added short.to service
|
||||||
|
|
||||||
0.1.2 20091212
|
0.1.2 - 2009.12.12
|
||||||
* Added option to short url of new entry by default
|
- Added option to short url of new entry by default
|
||||||
* Fixed typo
|
- Fixed typo
|
||||||
|
|
||||||
0.1.1 20091212
|
0.1.1 - 2009.12.12
|
||||||
* Added option to display long url when unactive
|
- Added option to display long url when unactive
|
||||||
* Fixed support of kutrl in feeds
|
- Fixed support of kutrl in feeds
|
||||||
|
|
||||||
0.1 20091209
|
0.1 - 2009.12.09
|
||||||
* First lab release
|
- First lab release
|
|
@ -19,7 +19,7 @@ $this->registerModule(
|
||||||
'kUtRL',
|
'kUtRL',
|
||||||
'Use, create and serve short url on your blog',
|
'Use, create and serve short url on your blog',
|
||||||
'Jean-Christian Denis and contributors',
|
'Jean-Christian Denis and contributors',
|
||||||
'2021.08.27',
|
'2021.08.28',
|
||||||
[
|
[
|
||||||
'permissions' => 'admin',
|
'permissions' => 'admin',
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
|
|
420
_widgets.php
420
_widgets.php
|
@ -11,202 +11,234 @@
|
||||||
#
|
#
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')){return;}
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$core->addBehavior('initWidgets',array('widgetKutrl','adminShorten'));
|
$core->addBehavior('initWidgets', ['widgetKutrl', 'adminShorten']);
|
||||||
$core->addBehavior('initWidgets',array('widgetKutrl','adminRank'));
|
$core->addBehavior('initWidgets', ['widgetKutrl', 'adminRank']);
|
||||||
|
|
||||||
class widgetKutrl
|
class widgetKutrl
|
||||||
{
|
{
|
||||||
public static function adminShorten($w)
|
public static function adminShorten($w)
|
||||||
{
|
{
|
||||||
$w->create('shortenkutrl',__('Links shortener'),
|
$w
|
||||||
array('widgetKutrl','publicShorten')
|
->create(
|
||||||
);
|
'shortenkutrl',
|
||||||
$w->shortenkutrl->setting('title',
|
__('Links shortener'),
|
||||||
__('Title:'),__('Shorten link'),'text'
|
['widgetKutrl', 'publicShorten']
|
||||||
);
|
)
|
||||||
$w->shortenkutrl->setting('homeonly',
|
->addTitle(__('Shorten link'))
|
||||||
__('Home page only'),1,'check'
|
->addHomeOnly()
|
||||||
);
|
->addContentOnly()
|
||||||
}
|
->addClass()
|
||||||
|
->addOffline();
|
||||||
public static function adminRank($w)
|
}
|
||||||
{
|
|
||||||
$w->create('rankkutrl',__('Top of short links'),
|
|
||||||
array('widgetKutrl','publicRank')
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('title',
|
|
||||||
__('Title:'),__('Top of short links'),'text'
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('text',
|
|
||||||
__('Text: (Use wildcard %rank%, %hash%, %url%, %count%, %counttext%)'),'%rank% - %url% - %counttext%','text'
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('urllen',
|
|
||||||
__('URL length (if truncate)'),20,'text'
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('type',
|
|
||||||
__('Type:'),'all','combo',array(
|
|
||||||
__('All') => '-',
|
|
||||||
__('Mini URL') => 'localnormal',
|
|
||||||
__('Custom URL') => 'localcustom',
|
|
||||||
__('Semi-custom') => 'localmix'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('mixprefix',
|
|
||||||
__('Semi-custom prefix: (only if you want limit to a particular prefix)'),
|
|
||||||
'','text'
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('sortby',
|
|
||||||
__('Sort by:'),'kut_counter','combo',array(
|
|
||||||
__('Date') => 'kut_dt',
|
|
||||||
__('Rank') => 'kut_counter',
|
|
||||||
__('Hash') => 'kut_hash'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('sort',
|
|
||||||
__('Sort:'),'desc','combo',array(
|
|
||||||
__('Ascending') => 'asc',
|
|
||||||
__('Descending') => 'desc'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('limit',
|
|
||||||
__('Limit:'),'10','text'
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('hideempty',
|
|
||||||
__('Hide no followed links'),0,'check'
|
|
||||||
);
|
|
||||||
$w->rankkutrl->setting('homeonly',
|
|
||||||
__('Home page only'),1,'check'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function publicShorten($w)
|
|
||||||
{
|
|
||||||
global $core;
|
|
||||||
$s = $core->blog->settings->kUtRL;
|
|
||||||
|
|
||||||
if (!$s->kutrl_active
|
|
||||||
|| !$s->kutrl_srv_local_public
|
|
||||||
|| $w->homeonly && $core->url->type != 'default'
|
|
||||||
|| $core->url->type == 'kutrl') return;
|
|
||||||
|
|
||||||
$hmf = hmfKutrl::create();
|
|
||||||
$hmfp = hmfKutrl::protect($hmf);
|
|
||||||
|
|
||||||
return
|
|
||||||
'<div class="shortenkutrlwidget">'.
|
|
||||||
($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : '').
|
|
||||||
'<form name="shortenkutrlwidget" method="post" action="'.
|
|
||||||
$core->blog->url.$core->url->getBase('kutrl').'">'.
|
|
||||||
'<p><label>'.
|
|
||||||
__('Long link:').'<br />'.
|
|
||||||
form::field('longurl',20,255,'').
|
|
||||||
'</label></p>'.
|
|
||||||
'<p><label>'.
|
|
||||||
sprintf(__('Rewrite "%s" in next field to show that you are not a robot:'),$hmf).'<br />'.
|
|
||||||
form::field('hmf',20,255,'').
|
|
||||||
'</label></p>'.
|
|
||||||
'<p><input class="submit" type="submit" name="submiturl" value="'.__('Create').'" />'.
|
|
||||||
form::hidden('hmfp',$hmfp).
|
|
||||||
$core->formNonce().
|
|
||||||
'</p>'.
|
|
||||||
'</form>'.
|
|
||||||
'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function publicRank($w)
|
|
||||||
{
|
|
||||||
global $core;
|
|
||||||
$s = $core->blog->settings->kUtRL;
|
|
||||||
|
|
||||||
if (!$s->kutrl_active
|
|
||||||
|| $w->homeonly && $core->url->type != 'default') return;
|
|
||||||
|
|
||||||
$type = in_array($w->type,array('localnormal','localmix','localcustom')) ?
|
|
||||||
"AND kut_type ='".$w->type."' " :
|
|
||||||
"AND kut_type ".$core->con->in(array('localnormal','localmix','localcustom'))." ";
|
|
||||||
|
|
||||||
$hide = (boolean) $w->hideempty ? 'AND kut_counter > 0 ' : '';
|
|
||||||
|
|
||||||
$more = '';
|
|
||||||
if ($w->type == 'localmix' && '' != $w->mixprefix)
|
|
||||||
{
|
|
||||||
$more = "AND kut_hash LIKE '".$core->con->escape($w->mixprefix)."%' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
$order = ($w->sortby && in_array($w->sortby,array('kut_dt','kut_counter','kut_hash'))) ?
|
|
||||||
$w->sortby.' ' : 'kut_dt ';
|
|
||||||
|
|
||||||
$order .= $w->sort == 'desc' ? 'DESC' : 'ASC';
|
|
||||||
|
|
||||||
$limit = $core->con->limit(abs((integer) $w->limit));
|
|
||||||
|
|
||||||
$rs = $core->con->select(
|
|
||||||
'SELECT kut_counter, kut_hash '.
|
|
||||||
"FROM ".$core->prefix."kutrl ".
|
|
||||||
"WHERE blog_id='".$core->con->escape($core->blog->id)."' ".
|
|
||||||
"AND kut_service = 'local' ".
|
|
||||||
$type.$hide.$more.'ORDER BY '.$order.$limit
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($rs->isEmpty()) return;
|
|
||||||
|
|
||||||
$content = '';
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while($rs->fetch())
|
|
||||||
{
|
|
||||||
$i++;
|
|
||||||
$rank = '<span class="rankkutrl-rank">'.$i.'</span>';
|
|
||||||
|
|
||||||
$hash = $rs->kut_hash;
|
|
||||||
$url = $core->blog->url.$core->url->getBase('kutrl').'/'.$hash;
|
|
||||||
$cut_len = - abs((integer) $w->urllen);
|
|
||||||
|
|
||||||
if (strlen($url) > $cut_len)
|
|
||||||
{
|
|
||||||
$url = '...'.substr($url,$cut_len);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (strlen($hash) > $cut_len)
|
|
||||||
{
|
|
||||||
$url = '...'.substr($hash,$cut_len);
|
|
||||||
}
|
|
||||||
//*/
|
|
||||||
if ($rs->kut_counter == 0)
|
|
||||||
{
|
|
||||||
$counttext = __('never followed');
|
|
||||||
}
|
|
||||||
elseif ($rs->kut_counter == 1)
|
|
||||||
{
|
|
||||||
$counttext = __('followed one time');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$counttext = sprintf(__('followed %s times'),$rs->kut_counter);
|
|
||||||
}
|
|
||||||
|
|
||||||
$content .=
|
|
||||||
'<li><a href="'.
|
|
||||||
$core->blog->url.$core->url->getBase('kutrl').'/'.$rs->kut_hash.
|
|
||||||
'">'.
|
|
||||||
str_replace(
|
|
||||||
array('%rank%','%hash%','%url%','%count%','%counttext%'),
|
|
||||||
array($rank,$hash,$url,$rs->kut_counter,$counttext),
|
|
||||||
$w->text
|
|
||||||
).
|
|
||||||
'</a></li>';
|
|
||||||
|
|
||||||
}
|
public static function adminRank($w)
|
||||||
|
{
|
||||||
if (!$content) return;
|
$w
|
||||||
|
->create(
|
||||||
return
|
'rankkutrl',
|
||||||
'<div class="rankkutrlwidget">'.
|
__('Top of short links'),
|
||||||
($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : '').
|
['widgetKutrl', 'publicRank']
|
||||||
'<ul>'.$content.'</ul>'.
|
)
|
||||||
'</div>';
|
->addTitle(__('Top of short links'))
|
||||||
}
|
->setting(
|
||||||
}
|
'text',
|
||||||
?>
|
__('Text: (Use wildcard %rank%, %hash%, %url%, %count%, %counttext%)'),
|
||||||
|
'%rank% - %url% - %counttext%',
|
||||||
|
'text'
|
||||||
|
)
|
||||||
|
->setting(
|
||||||
|
'urllen',
|
||||||
|
__('URL length (if truncate)'),
|
||||||
|
20,
|
||||||
|
'text'
|
||||||
|
)
|
||||||
|
->setting(
|
||||||
|
'type',
|
||||||
|
__('Type:'),
|
||||||
|
'all',
|
||||||
|
'combo',[
|
||||||
|
__('All') => '-',
|
||||||
|
__('Mini URL') => 'localnormal',
|
||||||
|
__('Custom URL') => 'localcustom',
|
||||||
|
__('Semi-custom') => 'localmix'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->setting(
|
||||||
|
'mixprefix',
|
||||||
|
__('Semi-custom prefix: (only if you want limit to a particular prefix)'),
|
||||||
|
'',
|
||||||
|
'text'
|
||||||
|
)
|
||||||
|
->setting(
|
||||||
|
'sortby',
|
||||||
|
__('Sort by:'),
|
||||||
|
'kut_counter',
|
||||||
|
'combo',
|
||||||
|
[
|
||||||
|
__('Date') => 'kut_dt',
|
||||||
|
__('Rank') => 'kut_counter',
|
||||||
|
__('Hash') => 'kut_hash'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->setting(
|
||||||
|
'sort',
|
||||||
|
__('Sort:'),
|
||||||
|
'desc',
|
||||||
|
'combo',
|
||||||
|
[
|
||||||
|
__('Ascending') => 'asc',
|
||||||
|
__('Descending') => 'desc'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->setting(
|
||||||
|
'limit',
|
||||||
|
__('Limit:'),
|
||||||
|
'10',
|
||||||
|
'text'
|
||||||
|
)
|
||||||
|
->setting(
|
||||||
|
'hideempty',
|
||||||
|
__('Hide no followed links'),
|
||||||
|
0,
|
||||||
|
'check'
|
||||||
|
)
|
||||||
|
->addHomeOnly()
|
||||||
|
->addContentOnly()
|
||||||
|
->addClass()
|
||||||
|
->addOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function publicShorten($w)
|
||||||
|
{
|
||||||
|
global $core;
|
||||||
|
$s = $core->blog->settings->kUtRL;
|
||||||
|
|
||||||
|
if (!$s->kutrl_active
|
||||||
|
|| !$s->kutrl_srv_local_public
|
||||||
|
|| ($w->homeonly == 1 && !$core->url->isHome($core->url->type)) || ($w->homeonly == 2 && $core->url->isHome($core->url->type))
|
||||||
|
|| $core->url->type == 'kutrl') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$hmf = hmfKutrl::create();
|
||||||
|
$hmfp = hmfKutrl::protect($hmf);
|
||||||
|
|
||||||
|
return $w->renderDiv(
|
||||||
|
$w->content_only,
|
||||||
|
'shortenkutrlwidget ' . $w->class,
|
||||||
|
'',
|
||||||
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
||||||
|
'<form name="shortenkutrlwidget" method="post" action="' .
|
||||||
|
$core->blog->url . $core->url->getBase('kutrl') . '">' .
|
||||||
|
'<p><label>' .
|
||||||
|
__('Long link:') . '<br />' .
|
||||||
|
form::field('longurl', 20, 255, '') .
|
||||||
|
'</label></p>' .
|
||||||
|
'<p><label>' .
|
||||||
|
sprintf(__('Rewrite "%s" in next field to show that you are not a robot:'), $hmf) . '<br />' .
|
||||||
|
form::field('hmf',20,255,'') .
|
||||||
|
'</label></p>' .
|
||||||
|
'<p><input class="submit" type="submit" name="submiturl" value="' . __('Create') . '" />' .
|
||||||
|
form::hidden('hmfp',$hmfp) .
|
||||||
|
$core->formNonce() .
|
||||||
|
'</p>' .
|
||||||
|
'</form>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function publicRank($w)
|
||||||
|
{
|
||||||
|
global $core;
|
||||||
|
$s = $core->blog->settings->kUtRL;
|
||||||
|
|
||||||
|
if (!$s->kutrl_active
|
||||||
|
|| ($w->homeonly == 1 && !$core->url->isHome($core->url->type)) || ($w->homeonly == 2 && $core->url->isHome($core->url->type))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = in_array($w->type, ['localnormal', 'localmix', 'localcustom']) ?
|
||||||
|
"AND kut_type ='" . $w->type . "' " :
|
||||||
|
"AND kut_type " . $core->con->in(['localnormal', 'localmix', 'localcustom']) . " ";
|
||||||
|
|
||||||
|
$hide = (boolean) $w->hideempty ? 'AND kut_counter > 0 ' : '';
|
||||||
|
|
||||||
|
$more = '';
|
||||||
|
if ($w->type == 'localmix' && '' != $w->mixprefix) {
|
||||||
|
$more = "AND kut_hash LIKE '" . $core->con->escape($w->mixprefix) . "%' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = ($w->sortby && in_array($w->sortby, ['kut_dt', 'kut_counter', 'kut_hash'])) ?
|
||||||
|
$w->sortby : 'kut_dt';
|
||||||
|
|
||||||
|
$order .= $w->sort == 'desc' ? ' DESC' : ' ASC';
|
||||||
|
|
||||||
|
$limit = $core->con->limit(abs((integer) $w->limit));
|
||||||
|
|
||||||
|
$rs = $core->con->select(
|
||||||
|
'SELECT kut_counter, kut_hash ' .
|
||||||
|
"FROM " . $core->prefix . "kutrl " .
|
||||||
|
"WHERE blog_id='" . $core->con->escape($core->blog->id) . "' " .
|
||||||
|
"AND kut_service = 'local' " .
|
||||||
|
$type . $hide . $more . 'ORDER BY ' . $order . $limit
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($rs->isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = '';
|
||||||
|
$i = 0;
|
||||||
|
while($rs->fetch()) {
|
||||||
|
$i++;
|
||||||
|
$rank = '<span class="rankkutrl-rank">' . $i . '</span>';
|
||||||
|
|
||||||
|
$hash = $rs->kut_hash;
|
||||||
|
$url = $core->blog->url . $core->url->getBase('kutrl') . '/' . $hash;
|
||||||
|
$cut_len = - abs((integer) $w->urllen);
|
||||||
|
|
||||||
|
if (strlen($url) > $cut_len) {
|
||||||
|
$url = '...' . substr($url, $cut_len);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (strlen($hash) > $cut_len) {
|
||||||
|
$url = '...'.substr($hash, $cut_len);
|
||||||
|
}
|
||||||
|
//*/
|
||||||
|
if ($rs->kut_counter == 0) {
|
||||||
|
$counttext = __('never followed');
|
||||||
|
} elseif ($rs->kut_counter == 1) {
|
||||||
|
$counttext = __('followed one time');
|
||||||
|
} else {
|
||||||
|
$counttext = sprintf(__('followed %s times'), $rs->kut_counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
$content .=
|
||||||
|
'<li><a href="' .
|
||||||
|
$core->blog->url . $core->url->getBase('kutrl') . '/' . $rs->kut_hash .
|
||||||
|
'">' .
|
||||||
|
str_replace(
|
||||||
|
['%rank%', '%hash%', '%url%', '%count%', '%counttext%'],
|
||||||
|
[$rank, $hash, $url, $rs->kut_counter, $counttext],
|
||||||
|
$w->text
|
||||||
|
) .
|
||||||
|
'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($content)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $w->renderDiv(
|
||||||
|
$w->content_only,
|
||||||
|
'lastblogupdate ' . $w->class,
|
||||||
|
'',
|
||||||
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
||||||
|
sprintf('<ul>%s</ul>', $content)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -411,7 +411,7 @@ if ($part == 'service') {
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
'<h3>' . __('Services configuration') . '</h3>' .
|
'<h3>' . __('Services configuration') . '</h3>' .
|
||||||
'<p><a class="back" href="' . $p_url . '">' . __('Back to links list') . '</a></p>';
|
'<p><a class="back" href="' . $p_url . '">' . __('Back to links list') . '</a></p>' .
|
||||||
'<form id="service-form" method="post" action="' . $p_url . '">';
|
'<form id="service-form" method="post" action="' . $p_url . '">';
|
||||||
|
|
||||||
foreach(kutrl::getServices($core) as $service_id => $service) {
|
foreach(kutrl::getServices($core) as $service_id => $service) {
|
||||||
|
@ -429,7 +429,7 @@ if ($part == 'service') {
|
||||||
echo $o->error->toHTML();
|
echo $o->error->toHTML();
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
if (!empty($o->home)) {
|
if ($o->home != '') {
|
||||||
echo '<p><a title="' . __('homepage') . '" href="' . $o->home . '">' . sprintf(__('Learn more about %s.'), $o->name) . '</a></p>';
|
echo '<p><a title="' . __('homepage') . '" href="' . $o->home . '">' . sprintf(__('Learn more about %s.'), $o->name) . '</a></p>';
|
||||||
}
|
}
|
||||||
$o->settingsForm();
|
$o->settingsForm();
|
||||||
|
|
Loading…
Reference in a new issue