Merge remote branch 'origin/master' into translation-staging

This commit is contained in:
TeamCity 2012-09-25 17:44:00 +12:00
commit a605fd3a57
9 changed files with 23 additions and 208 deletions

View File

@ -121,8 +121,6 @@ class RedirectorPage extends Page {
// Remove all metadata fields, does not apply for redirector pages // Remove all metadata fields, does not apply for redirector pages
$fields->removeByName('MetaTagsHeader'); $fields->removeByName('MetaTagsHeader');
$fields->removeByName('MetaTitle');
$fields->removeByName('MetaKeywords');
$fields->removeByName('MetaDescription'); $fields->removeByName('MetaDescription');
$fields->removeByName('ExtraMeta'); $fields->removeByName('ExtraMeta');

View File

@ -76,9 +76,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
"Title" => "Varchar(255)", "Title" => "Varchar(255)",
"MenuTitle" => "Varchar(100)", "MenuTitle" => "Varchar(100)",
"Content" => "HTMLText", "Content" => "HTMLText",
"MetaTitle" => "Varchar(255)",
"MetaDescription" => "Text", "MetaDescription" => "Text",
"MetaKeywords" => "Varchar(255)",
"ExtraMeta" => "HTMLText", "ExtraMeta" => "HTMLText",
"ShowInMenus" => "Boolean", "ShowInMenus" => "Boolean",
"ShowInSearch" => "Boolean", "ShowInSearch" => "Boolean",
@ -1268,18 +1266,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
public function MetaTags($includeTitle = true) { public function MetaTags($includeTitle = true) {
$tags = ""; $tags = "";
if($includeTitle === true || $includeTitle == 'true') { if($includeTitle === true || $includeTitle == 'true') {
$tags .= "<title>" . Convert::raw2xml(($this->MetaTitle) $tags .= "<title>" . $this->Title . "</title>\n";
? $this->MetaTitle
: $this->Title) . "</title>\n";
} }
$tags .= "<meta name=\"generator\" content=\"SilverStripe - http://silverstripe.org\" />\n"; $tags .= "<meta name=\"generator\" content=\"SilverStripe - http://silverstripe.org\" />\n";
$charset = ContentNegotiator::get_encoding(); $charset = ContentNegotiator::get_encoding();
$tags .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset=$charset\" />\n"; $tags .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset=$charset\" />\n";
if($this->MetaKeywords) {
$tags .= "<meta name=\"keywords\" content=\"" . Convert::raw2att($this->MetaKeywords) . "\" />\n";
}
if($this->MetaDescription) { if($this->MetaDescription) {
$tags .= "<meta name=\"description\" content=\"" . Convert::raw2att($this->MetaDescription) . "\" />\n"; $tags .= "<meta name=\"description\" content=\"" . Convert::raw2att($this->MetaDescription) . "\" />\n";
} }
@ -1852,11 +1845,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$htmlField = new HtmlEditorField("Content", _t('SiteTree.HTMLEDITORTITLE', "Content", 'HTML editor title')), $htmlField = new HtmlEditorField("Content", _t('SiteTree.HTMLEDITORTITLE', "Content", 'HTML editor title')),
ToggleCompositeField::create('Metadata', _t('SiteTree.MetadataToggle', 'Metadata'), ToggleCompositeField::create('Metadata', _t('SiteTree.MetadataToggle', 'Metadata'),
array( array(
$metaIntroField = new CompositeField(
$metaIntro = new LabelField("MetaIntro", $Title = "Metadata helps describe and categorise your site. By filling out the fields below it will help improve your site's ranking on search engines.")
),
$metaFieldTitle = new TextField("MetaTitle", $this->fieldLabel('MetaTitle')),
$metaFieldKeyword = new TextareaField("MetaKeywords", $this->fieldLabel('MetaKeywords'), 1),
$metaFieldDesc = new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')), $metaFieldDesc = new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')),
$metaFieldExtra = new TextareaField("ExtraMeta",$this->fieldLabel('ExtraMeta')) $metaFieldExtra = new TextareaField("ExtraMeta",$this->fieldLabel('ExtraMeta'))
) )
@ -1870,17 +1858,23 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
); );
$htmlField->addExtraClass('stacked'); $htmlField->addExtraClass('stacked');
$metaIntroField->addExtraClass('field');
$metaIntro->addExtraClass('help');
// Help text for MetaData on page content editor // Help text for MetaData on page content editor
$metaFieldTitle->setRightTitle(_t('SiteTree.METATITLEHELP', "Add the title of your page here")) $metaFieldDesc
->addExtraClass('help'); ->setRightTitle(
$metaFieldKeyword->setRightTitle(_t('SiteTree.METAKEYWORDHELP', "Add any keywords that are relevant to the page here. Separate keywords and phrases with a comma: keyword, keywords, keyword phrase")) _t(
->addExtraClass('help'); 'SiteTree.METADESCHELP',
$metaFieldDesc->setRightTitle(_t('SiteTree.METADESCHELP', "Add a description of your page here. Make sure you think about your keywords when writing your description")) "Search engines use this content for displaying search results (although it will not influence their ranking)."
->addExtraClass('help'); )
$metaFieldExtra->setRightTitle(_t('SiteTree.METAEXTRAHELP', "When adding custom meta tags they must be wrapped in an html tag. For example &lt;meta name=\"customName\" content=\"your custom content here\" /&gt;")) )
->addExtraClass('help'); ->addExtraClass('help');
$metaFieldExtra
->setRightTitle(
_t(
'SiteTree.METAEXTRAHELP',
"HTML tags for additional meta information. For example &lt;meta name=\"customName\" content=\"your custom content here\" /&gt;"
)
)
->addExtraClass('help');
// Conditional dependent pages tab // Conditional dependent pages tab
if($dependentPagesCount) $tabDependent->setTitle(_t('SiteTree.TABDEPENDENT', "Dependent pages") . " ($dependentPagesCount)"); if($dependentPagesCount) $tabDependent->setTitle(_t('SiteTree.TABDEPENDENT', "Dependent pages") . " ($dependentPagesCount)");
@ -2036,10 +2030,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$labels = parent::fieldLabels($includerelations); $labels = parent::fieldLabels($includerelations);
$labels['Title'] = _t('SiteTree.PAGETITLE', "Page name"); $labels['Title'] = _t('SiteTree.PAGETITLE', "Page name");
$labels['MenuTitle'] = _t('SiteTree.MENUTITLE', "Navigation label"); $labels['MenuTitle'] = _t('SiteTree.MENUTITLE', "Navigation label");
$labels['MetaIntro'] = _t('SiteTree.METAINTRO', "Metadata helps describe and categorise your site. By filling out the fields below it will help improve your site's ranking on search engines.");
$labels['MetaTitle'] = _t('SiteTree.METATITLE', "Meta Title");
$labels['MetaDescription'] = _t('SiteTree.METADESC', "Meta Description"); $labels['MetaDescription'] = _t('SiteTree.METADESC', "Meta Description");
$labels['MetaKeywords'] = _t('SiteTree.METAKEYWORDS', "Meta Keywords");
$labels['ExtraMeta'] = _t('SiteTree.METAEXTRA', "Custom Meta Tags"); $labels['ExtraMeta'] = _t('SiteTree.METAEXTRA', "Custom Meta Tags");
$labels['ClassName'] = _t('SiteTree.PAGETYPE', "Page type", 'Classname of a page object'); $labels['ClassName'] = _t('SiteTree.PAGETYPE', "Page type", 'Classname of a page object');
$labels['ParentType'] = _t('SiteTree.PARENTTYPE', "Page location"); $labels['ParentType'] = _t('SiteTree.PARENTTYPE', "Page location");

View File

@ -1,28 +0,0 @@
<?php
/**
* This is a system-generated PHP script that performs header management for the statically cached content given below.
*/
define('MAX_AGE', '**MAX_AGE**');
define('LAST_MODIFIED', '**LAST_MODIFIED**');
if(MAX_AGE > 0) {
header("Cache-Control: max-age=" . MAX_AGE);
header("Pragma:");
} else {
header("Cache-Control: no-cache, max-age=0, must-revalidate");
}
header("Expires: " . gmdate('D, d M Y H:i:s', time() + MAX_AGE) . ' GMT');
header("Last-modified: " . gmdate('D, d M Y H:i:s', strtotime(LAST_MODIFIED)) . ' GMT');
if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
if(strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= strtotime(LAST_MODIFIED)) {
header("Last-modified: " . gmdate('D, d M Y H:i:s', strtotime(LAST_MODIFIED)) . ' GMT', true, 304);
exit;
}
}
?>
**CONTENT**

View File

@ -1,20 +0,0 @@
<?php
/**
* This is a system-generated PHP script that performs header management for a 301 redirection.
*/
define('DESTINATION', '**DESTINATION**');
define('MAX_AGE', 3600);
if(MAX_AGE > 0) {
header("Cache-Control: max-age=" . MAX_AGE);
header("Pragma:");
} else {
header("Cache-Control: no-cache, max-age=0, must-revalidate");
}
header("Expires: " . gmdate('D, d M Y H:i:s', time() + MAX_AGE) . ' GMT');
header("Location: " . DESTINATION, true, 301);
?>

View File

@ -1,39 +0,0 @@
### SILVERSTRIPE START ###
RewriteEngine On
## CONFIG FOR DEV ENVIRONMENTS
# Cached content - **sitedir** subdirectory
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/**sitedir**/(.*)$
RewriteCond %{REQUEST_URI} /**sitedir**/(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/**sitedir**/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /**sitedir**/cache/%1.html [L]
# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/**sitedir**/?$
RewriteCond /**sitedir**/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /**sitedir**/cache/index.html [L]
## CONFIG FOR TEST/LIVE ENVIRONMENTS
# Cached content - live webserver
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} /(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/%1.html [L]
# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/index.html [L]

View File

@ -1,48 +0,0 @@
### SILVERSTRIPE START ###
RewriteEngine On
## CONFIG FOR DEV ENVIRONMENTS
# Cached content - **sitedir** subdirectory
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/**sitedir**/(.*)$
RewriteCond %{REQUEST_URI} /**sitedir**/(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/**sitedir**/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /**sitedir**/cache/%1.html [L]
# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/**sitedir**/?$
RewriteCond /**sitedir**/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /**sitedir**/cache/index.html [L]
## CONFIG FOR TEST/LIVE ENVIRONMENTS
# Cached content - live webserver
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} /(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/%1.html [L]
# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/index.html [L]
## DYNAMIC CONFIG
# Dynamic content
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L]
### SILVERSTRIPE END ###

View File

@ -1,39 +0,0 @@
### SILVERSTRIPE START ###
RewriteEngine On
## CONFIG FOR DEV ENVIRONMENTS
# Cached content - **sitedir** subdirectory
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/**sitedir**/(.*)$
RewriteCond %{REQUEST_URI} /**sitedir**/(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/**sitedir**/cache/%1.php -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /**sitedir**/cache/%1.php [L]
# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/**sitedir**/?$
RewriteCond /**sitedir**/cache/index.php -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /**sitedir**/cache/index.php [L]
## CONFIG FOR TEST/LIVE ENVIRONMENTS
# Cached content - live webserver
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} /(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}/cache/%1.php -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/%1.php [L]
# Cached content - homepage
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/cache/index.php -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /cache/index.php [L]

View File

@ -51,9 +51,9 @@ class CMSSiteTreeFilterTest extends SapphireTest {
$unchangedPage->doPublish(); $unchangedPage->doPublish();
$changedPage = $this->objFromFixture('Page', 'page2'); $changedPage = $this->objFromFixture('Page', 'page2');
$changedPage->MetaTitle = 'Original'; $changedPage->Title = 'Original';
$changedPage->publish('Stage', 'Live'); $changedPage->publish('Stage', 'Live');
$changedPage->MetaTitle = 'Changed'; $changedPage->Title = 'Changed';
$changedPage->write(); $changedPage->write();
$f = new CMSSiteTreeFilter_ChangedPages(); $f = new CMSSiteTreeFilter_ChangedPages();

View File

@ -136,17 +136,17 @@ class SiteTreeTest extends SapphireTest {
$this->logInWithPermission('ADMIN'); $this->logInWithPermission('ADMIN');
$obj = $this->objFromFixture('Page', 'about'); $obj = $this->objFromFixture('Page', 'about');
$obj->MetaTitle = "asdfasdf"; $obj->Title = "asdfasdf";
$obj->write(); $obj->write();
$this->assertTrue($obj->doPublish()); $this->assertTrue($obj->doPublish());
$this->assertEquals('asdfasdf', DB::query("SELECT \"MetaTitle\" FROM \"SiteTree_Live\" WHERE \"ID\" = '$obj->ID'")->value()); $this->assertEquals('asdfasdf', DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = '$obj->ID'")->value());
$obj->MetaTitle = null; $obj->Title = null;
$obj->write(); $obj->write();
$this->assertTrue($obj->doPublish()); $this->assertTrue($obj->doPublish());
$this->assertNull(DB::query("SELECT \"MetaTitle\" FROM \"SiteTree_Live\" WHERE \"ID\" = '$obj->ID'")->value()); $this->assertNull(DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = '$obj->ID'")->value());
} }