mirror of
https://github.com/e107inc/e107.git
synced 2025-08-19 04:41:53 +02:00
Issue #4783 Added new field for meta-news-title. New prefs added for SEO Title and Description character limits.
This commit is contained in:
@@ -39,7 +39,8 @@ class meta_admin extends e_admin_dispatcher
|
||||
|
||||
|
||||
protected $adminMenu = array(
|
||||
'main/meta' => array('caption' => LAN_MANAGE, 'perm' => '0', 'icon'=>'fas-cogs'),
|
||||
'main/meta' => array('caption' => LAN_MANAGE, 'perm' => '0', 'icon'=>'fas-list'),
|
||||
'main/prefs'=> array('caption' => "SEO", 'perm'=>'0', 'icon'=>'fas-cogs'),
|
||||
);
|
||||
|
||||
protected $adminMenuAliases = array(// 'main/edit' => 'main/list'
|
||||
@@ -58,6 +59,12 @@ class meta_admin_ui extends e_admin_ui
|
||||
protected $pluginTitle = METLAN_00;
|
||||
protected $pluginName = 'core';
|
||||
|
||||
protected $prefs = array(
|
||||
'seo_title_limit' => array('title'=>METLAN_8, 'type'=>'number', 'data'=>'int', 'help'=>'', 'writeParms'=>['size'=>'large']),
|
||||
'seo_description_limit' => array('title'=>METLAN_9, 'type'=>'number', 'data'=>'int', 'help'=>'', 'writeParms'=>['size'=>'large']),
|
||||
'meta_news_summary' => array('title'=>METLAN_3, 'type'=>'boolean', 'data'=>'int'),
|
||||
);
|
||||
|
||||
function init()
|
||||
{
|
||||
|
||||
@@ -91,7 +98,6 @@ class meta_admin_ui extends e_admin_ui
|
||||
}
|
||||
}
|
||||
|
||||
$cfg->set('meta_news_summary', varset($_POST['meta_news_summary']));
|
||||
$cfg->save(true, true, true);
|
||||
}
|
||||
|
||||
@@ -181,14 +187,7 @@ class meta_admin_ui extends e_admin_ui
|
||||
|
||||
$text .= "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>" . METLAN_3 . "</td>
|
||||
<td>
|
||||
<div class='auto-toggle-area autocheck'>" .
|
||||
$frm->checkbox('meta_news_summary', 1, varset($pref['meta_news_summary'])) . "
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>" .
|
||||
|
@@ -27,6 +27,32 @@ e107::css('inline', "
|
||||
|
||||
");
|
||||
|
||||
e107::js('footer-inline', '
|
||||
|
||||
$("#news-meta-title").focus(function() {
|
||||
|
||||
var title = $("#news-title").val() + " | " + "'.SITENAME.'";
|
||||
|
||||
if(!$(this).val())
|
||||
{
|
||||
$(this).val(title);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).attr("placeholder",title);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#news-title").on("input change focus", function()
|
||||
{
|
||||
var title = $("#news-title").val() + " | " + "'.SITENAME.'";
|
||||
$("#news-meta-title").attr("placeholder",title);
|
||||
|
||||
});
|
||||
|
||||
');
|
||||
|
||||
class news_admin extends e_admin_dispatcher
|
||||
{
|
||||
|
||||
@@ -409,10 +435,8 @@ class news_sub_form_ui extends e_admin_form_ui
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
define('NEWS_TITLE_META_LIMIT', 50);
|
||||
define('NEWS_DIZ_META_LIMIT',155);
|
||||
// Main News Area.
|
||||
|
||||
class news_admin_ui extends e_admin_ui
|
||||
@@ -453,8 +477,9 @@ class news_admin_ui extends e_admin_ui
|
||||
'news_body' => array('title' => "", 'type' => 'method', 'data'=>'str', 'tab'=>0, 'nolist'=>true, 'writeParms'=>'nolabel=1', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
'news_extended' => array('title' => "", 'type' => null, 'data'=>'str', 'tab'=>0, 'nolist'=>true, 'noedit'=>true, 'writeParms'=>'nolabel=1', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
|
||||
'news_meta_title' => array('title' => LAN_TITLE, 'type' => 'text', 'data'=>'safestr', 'filter'=>true, 'tab'=>1, 'inline'=>true, 'width' => 'auto', 'help'=>'', 'writeParms'=>['size'=>'xxlarge', 'placeholder'=>'', 'counter'=>0, 'maxlength'=> 255], 'nosort' => false),
|
||||
'news_meta_keywords' => array('title' => LAN_KEYWORDS, 'type' => 'tags', 'data'=>'safestr', 'filter'=>true, 'tab'=>1, 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
'news_meta_description' => array('title' => LAN_DESCRIPTION,'type' => 'textarea', 'data'=>'safestr','filter'=>true, 'tab'=>1, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'writeParms'=>array('size'=>'xxlarge', 'maxlength'=>155, 'rows'=>2)),
|
||||
'news_meta_description' => array('title' => LAN_DESCRIPTION,'type' => 'textarea', 'data'=>'safestr','filter'=>true, 'tab'=>1, 'width' => 'auto', 'thclass' => '', 'help'=>'', 'class' => null, 'nosort' => false, 'writeParms'=>array('size'=>'xxlarge', 'counter'=>0, 'maxlength'=>255, 'rows'=>2)),
|
||||
'news_meta_robots' => array('title' => LAN_ROBOTS, 'type' => 'dropdown', 'data'=>'safestr', 'tab'=>1, 'inline'=>true, 'readParms'=>array('type'=>'checkboxes'), 'writeParms'=>array('multiple'=>1), 'width' => 'auto', 'thclass' => 'left', 'class' => 'left', 'nosort' => false, 'batch'=>true, 'filter'=>true),
|
||||
|
||||
'news_sef' => array('title' => LAN_SEFURL, 'type' => 'text', 'batch'=>1, 'data'=>'str', 'tab'=>1, 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'writeParms'=>array('size'=>'xxlarge', 'show'=>1, 'sef'=>'news_title')),
|
||||
@@ -773,8 +798,9 @@ class news_admin_ui extends e_admin_ui
|
||||
'news_thumbnail',
|
||||
|
||||
'news_sef' ,
|
||||
'news_meta_keywords',
|
||||
'news_meta_title',
|
||||
'news_meta_description' ,
|
||||
'news_meta_keywords',
|
||||
'news_meta_robots' ,
|
||||
|
||||
|
||||
@@ -936,6 +962,44 @@ class news_admin_ui extends e_admin_ui
|
||||
|
||||
}
|
||||
|
||||
private function setSEOLimits()
|
||||
{
|
||||
$seoTitleLimit = (int) e107::pref('core', 'seo_title_limit', 50);
|
||||
$seoDescriptionLimit = (int) e107::pref('core', 'seo_description_limit', 155);
|
||||
|
||||
$this->fields['news_meta_title']['writeParms']['counter'] = $seoTitleLimit;
|
||||
$this->fields['news_meta_title']['help'] = e107::getParser()->lanVars(LAN_SEARCH_ENGINES_X_LIMIT, $seoTitleLimit);
|
||||
$this->fields['news_meta_description']['writeParms']['counter'] = $seoDescriptionLimit;
|
||||
$this->fields['news_meta_description']['help'] = e107::getParser()->lanVars(LAN_SEARCH_ENGINES_X_LIMIT, $seoDescriptionLimit);
|
||||
|
||||
}
|
||||
|
||||
function EditObserver()
|
||||
{
|
||||
parent::EditObserver();
|
||||
|
||||
$title = $this->getFieldVar('news_title'). ' | '.SITENAME;
|
||||
$placeholder = $this->getFieldVar('news_meta_title');
|
||||
|
||||
if(empty($placeholder))
|
||||
{
|
||||
$this->fields['news_meta_title']['writeParms']['placeholder'] = html_entity_decode($title);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->fields['news_meta_title']['writeParms']['placeholder'] = html_entity_decode($placeholder);
|
||||
}
|
||||
|
||||
$this->setSEOLimits();
|
||||
|
||||
}
|
||||
|
||||
function CreateObserver()
|
||||
{
|
||||
parent::CreateObserver();
|
||||
$this->setSEOLimits();
|
||||
}
|
||||
|
||||
|
||||
function saveSettings()
|
||||
{
|
||||
|
Reference in New Issue
Block a user