mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Basic per-item search engine robots handling added to News and Pages.
This commit is contained in:
parent
e1504b91c0
commit
5cf54d07d2
@ -596,7 +596,8 @@ class page_admin_ui extends e_admin_ui
|
||||
'page_sef' => array('title'=> LAN_SEFURL, 'tab' => 1, 'type' => 'text', 'batch'=>true, 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'writeParms'=>'size=xxlarge&sef=page_title'),
|
||||
'page_metakeys' => array('title'=> LAN_KEYWORDS, 'tab' => 1, 'type' => 'tags', 'data'=>'str', 'width' => 'auto'),
|
||||
'page_metadscr' => array('title'=> CUSLAN_11, 'tab' => 1, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'writeParms'=>'size=xxlarge'),
|
||||
|
||||
'page_metarobots' => array('title' => LAN_ROBOTS, 'tab'=>1, 'type' => 'dropdown', 'data'=>'safestr', 'batch'=>true, 'inline'=>true, 'readParms'=>array('type'=>'checkboxes'), 'width' => 'auto', 'thclass' => 'left', 'class' => 'left', 'nosort' => false, 'batch'=>true, 'filter'=>true),
|
||||
|
||||
'page_order' => array('title'=> LAN_ORDER, 'tab' => 1, 'type' => 'number', 'width' => 'auto', 'inline'=>true),
|
||||
'page_fields' => array('title'=>'Custom Fields', 'tab'=>4, 'type'=>'hidden', 'data'=>'json', 'width'=>'auto'),
|
||||
|
||||
@ -641,6 +642,12 @@ class page_admin_ui extends e_admin_ui
|
||||
function init()
|
||||
{
|
||||
|
||||
$this->fields['page_metarobots']['writeParms']['optArray'] = e107::getSingleton('eResponse')->getRobotTypes();
|
||||
$this->fields['page_metarobots']['writeParms']['title'] = e107::getSingleton('eResponse')->getRobotDescriptions();
|
||||
$this->fields['page_metarobots']['writeParms']['multiple'] = 1;
|
||||
|
||||
|
||||
|
||||
$mode = $this->getMode();
|
||||
|
||||
$this->perPage = (int) e107::pref('core','admin_page_perpage', 10);
|
||||
|
@ -459,6 +459,8 @@ class news_admin_ui extends e_admin_ui
|
||||
|
||||
'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')),
|
||||
'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')),
|
||||
'news_ping' => array('title' => LAN_PING, 'type' => 'checkbox', 'tab'=>1, 'data'=>false, 'writeParms'=>'value=0', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
|
||||
@ -775,6 +777,7 @@ class news_admin_ui extends e_admin_ui
|
||||
'news_sef' ,
|
||||
'news_meta_keywords',
|
||||
'news_meta_description' ,
|
||||
'news_meta_robots' ,
|
||||
'news_ping',
|
||||
|
||||
'news_email_notify',
|
||||
@ -923,6 +926,11 @@ class news_admin_ui extends e_admin_ui
|
||||
$this->fields['news_category']['writeParms']['size'] = 'xlarge';
|
||||
$this->fields['news_render_type']['writeParms']['optArray'] = $this->news_renderTypes; // array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2","Featurebox");
|
||||
$this->fields['news_render_type']['writeParms']['multiple'] = 1;
|
||||
|
||||
$this->fields['news_meta_robots']['writeParms']['optArray'] = e107::getSingleton('eResponse')->getRobotTypes();
|
||||
$this->fields['news_meta_robots']['writeParms']['title'] = e107::getSingleton('eResponse')->getRobotDescriptions();
|
||||
$this->fields['news_meta_robots']['writeParms']['multiple'] = 1;
|
||||
//$this->fields['news_meta_robots']['writeParms']['default'] = 'blank';
|
||||
// $this->newspost = new admin_newspost;
|
||||
// $this->newspost->news_renderTypes = $this->news_renderTypes;
|
||||
// $this->newspost->observer();
|
||||
|
@ -306,6 +306,7 @@ CREATE TABLE news (
|
||||
news_extended longtext NOT NULL,
|
||||
news_meta_keywords varchar(255) NOT NULL default '',
|
||||
news_meta_description text NOT NULL,
|
||||
news_meta_robots varchar(255) NOT NULL default '',
|
||||
news_datestamp int(10) unsigned NOT NULL default '0',
|
||||
news_author int(10) unsigned NOT NULL default '0',
|
||||
news_category tinyint(3) unsigned NOT NULL default '0',
|
||||
@ -381,6 +382,7 @@ CREATE TABLE page (
|
||||
page_chapter int(10) unsigned NOT NULL default '0',
|
||||
page_metakeys varchar (250) NOT NULL default '',
|
||||
page_metadscr mediumtext,
|
||||
page_metarobots varchar (250) NOT NULL default '',
|
||||
page_text mediumtext,
|
||||
page_author int(10) unsigned NOT NULL default '0',
|
||||
page_datestamp int(10) unsigned NOT NULL default '0',
|
||||
|
@ -7383,6 +7383,13 @@ class e_admin_form_ui extends e_form
|
||||
$parms = vartrue($val['writeParms'], array());
|
||||
if(is_string($parms)) parse_str($parms, $parms);
|
||||
|
||||
//Basic batch support for dropdown with multiple values. (comma separated)
|
||||
if(!empty($val['writeParms']['multiple']) && $val['type'] === 'dropdown' && !empty($val['writeParms']['optArray']))
|
||||
{
|
||||
$val['type'] = 'comma';
|
||||
$parms = $val['writeParms']['optArray'];
|
||||
}
|
||||
|
||||
switch($val['type'])
|
||||
{
|
||||
|
||||
|
@ -3961,6 +3961,8 @@ class eResponse
|
||||
protected $_meta_name_only = array('keywords', 'viewport', 'robots'); // Keep FB happy.
|
||||
protected $_meta_property_only = array('article:section', 'article:tag'); // Keep FB happy.
|
||||
protected $_meta = array();
|
||||
protected $_meta_robot_types = array('noindex'=>'NoIndex', 'nofollow'=>'NoFollow','noarchive'=>'NoArchive','noimageindex'=>'NoImageIndex' );
|
||||
protected $_meta_robot_descriptions = array('noindex'=>LAN_ROBOTS_NOINDEX, 'nofollow'=>LAN_ROBOTS_NOFOLLOW,'noarchive'=>LAN_ROBOTS_NOARCHIVE,'noimageindex'=>LAN_ROBOTS_NOIMAGE );
|
||||
protected $_title_separator = ' » ';
|
||||
protected $_content_type = 'html';
|
||||
protected $_content_type_arr = array(
|
||||
@ -3980,6 +3982,16 @@ class eResponse
|
||||
'jsonRender' => false,
|
||||
);
|
||||
|
||||
public function getRobotTypes()
|
||||
{
|
||||
return $this->_meta_robot_types;
|
||||
}
|
||||
|
||||
public function getRobotDescriptions()
|
||||
{
|
||||
return $this->_meta_robot_descriptions;
|
||||
}
|
||||
|
||||
public function setParam($key, $value)
|
||||
{
|
||||
$this->_params[$key] = $value;
|
||||
@ -4368,6 +4380,7 @@ class eResponse
|
||||
|
||||
e107::getDebug()->log($this->_meta);
|
||||
|
||||
|
||||
foreach ($this->_meta as $attr)
|
||||
{
|
||||
$attrData .= '<meta';
|
||||
|
@ -3028,6 +3028,7 @@ class e_form
|
||||
{
|
||||
$name = (strpos($name, '[') === false) ? $name.'[]' : $name;
|
||||
if(!is_array($selected)) $selected = explode(",",$selected);
|
||||
|
||||
}
|
||||
|
||||
$text = $this->select_open($name, $options)."\n";
|
||||
@ -3316,6 +3317,15 @@ var_dump($select_options);*/
|
||||
$opts['disabled'] = in_array($value, $options['optDisabled']);
|
||||
}
|
||||
|
||||
if(is_array($options['title']) && !empty($options['title'][$value]))
|
||||
{
|
||||
$opts['data-title'] = $options['title'][$value];
|
||||
}
|
||||
else
|
||||
{
|
||||
$opts['data-title'] = '';
|
||||
}
|
||||
|
||||
$text .= $this->option($label, $value, $sel, $opts)."\n";
|
||||
}
|
||||
}
|
||||
|
@ -569,4 +569,10 @@ define("LAN_DOWNLOAD_COMPLETE", "Download Complete!");
|
||||
|
||||
define("LAN_UI_FILTER_SEARCH_IN_FIELD", "Search in Field");
|
||||
|
||||
define("LAN_ROBOTS", "Robots");
|
||||
define("LAN_ROBOTS_NOINDEX", "Prevent search engines from indexing this item.");
|
||||
define("LAN_ROBOTS_NOFOLLOW", "Prevent search engines from following links in this item.");
|
||||
define("LAN_ROBOTS_NOARCHIVE", "Prevent cached copies of this item from appearing in search results.");
|
||||
define("LAN_ROBOTS_NOIMAGE", "Prevent search engines from indexing images of this item.");
|
||||
|
||||
|
||||
|
@ -607,6 +607,12 @@ class news_front
|
||||
|
||||
if($type == 'news')
|
||||
{
|
||||
|
||||
if(!empty($news['news_meta_robots']))
|
||||
{
|
||||
e107::meta('robots', $news['news_meta_robots']);
|
||||
}
|
||||
|
||||
if($news['news_title'] && !defined('e_PAGETITLE'))
|
||||
{
|
||||
define('e_PAGETITLE', $news['news_title']);
|
||||
|
@ -88,7 +88,7 @@
|
||||
$(element).prop('selected', 'selected');
|
||||
}
|
||||
|
||||
$('ul', this.container).append('<li><a href="javascript:void(0);" style="padding:0;"><label style="margin:0;padding:3px 20px 3px 20px;width:100%;height:100%;cursor:pointer;"><input style="margin-bottom:5px;" type="checkbox" value="' + $(element).val() + '" /> ' + $(element).text() + '</label</a></li>');
|
||||
$('ul', this.container).append('<li><a href="javascript:void(0);" style="padding:0;" ><label data-tooltip-position="right" title="' + $(element).data('title') + '" style="margin:0;padding:3px 20px 3px 20px;width:100%;height:100%;cursor:pointer;"><input style="margin-bottom:5px;" type="checkbox" value="' + $(element).val() + '" /> ' + $(element).text() + '</label</a></li>');
|
||||
|
||||
var selected = $(element).prop('selected') || false;
|
||||
var checkbox = $('ul li input[value="' + $(element).val() + '"]', this.container);
|
||||
|
@ -95,13 +95,21 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
placement = 'top';
|
||||
}
|
||||
|
||||
// custom position defined in field-help container class
|
||||
var custPlace = $fieldHelp.attr('data-placement'); // ie top|left|bottom|right
|
||||
|
||||
if(custPlace !== undefined)
|
||||
{
|
||||
placement = custPlace;
|
||||
}
|
||||
|
||||
// custom position defined in selector tag.
|
||||
var pos = $(this).attr('data-tooltip-position');
|
||||
if(pos !== undefined)
|
||||
{
|
||||
placement = pos;
|
||||
}
|
||||
|
||||
|
||||
$fieldHelp.hide();
|
||||
|
||||
$this.tooltip({
|
||||
@ -568,6 +576,11 @@ $(document).ready(function()
|
||||
$(this).multiselect({ buttonClass: 'btn btn-default'} );
|
||||
}
|
||||
|
||||
|
||||
/* optionLabel: function(element) {
|
||||
return $(element).html() + '(' + $(element).val() + ')';
|
||||
}*/
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
5
page.php
5
page.php
@ -700,6 +700,11 @@ class pageClass
|
||||
e107::meta('keywords', eHelper::formatMetaKeys($this->page['page_metakeys']));
|
||||
}
|
||||
|
||||
if(!empty($this->page['page_metarobots']))
|
||||
{
|
||||
e107::meta('robots', $this->page['page_metarobots']);
|
||||
}
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
if($tp->isImage($this->page['menu_image']))
|
||||
|
Loading…
x
Reference in New Issue
Block a user