Skip to content

Commit

Permalink
Unified canonical variable names - #18153
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyuexrow committed Mar 11, 2021
1 parent f00a7b8 commit 0096ca0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions classes/structs/xrowmetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class xrowMetaData extends ezcBaseStruct
public $keywords = array();
public $description;
public $sitemap_use;
public $canonical;
public $canonical_url;

public function __construct( $title = false, $keywords = array(), $description = false, $priority = false, $change = false, $sitemap_use = false, $canonical = false)
public function __construct( $title = false, $keywords = array(), $description = false, $priority = false, $change = false, $sitemap_use = false, $canonical_url = false)
{
$this->title = $title;
$this->keywords = $keywords;
$this->description = $description;
$this->canonical = $canonical;
$this->canonical_url = $canonical_url;
$this->sitemap_use = $sitemap_use;
if ( empty( $priority ) )
{
Expand Down Expand Up @@ -59,7 +59,7 @@ function hasAttribute( $name )

function attributes()
{
return array('title','description','keywords','sitemap_use','canonical');
return array('title','description','keywords','sitemap_use','canonical_url');
}

function attribute( $name )
Expand All @@ -72,7 +72,7 @@ function attribute( $name )
*/
static public function __set_state( array $array )
{
return new xrowMetaData( $array['title'], $array['keywords'], $array['description'], $array['priority'], $array['change'], $array['canonical'] );
return new xrowMetaData( $array['title'], $array['keywords'], $array['description'], $array['priority'], $array['change'], $array['canonical_url'] );
}
}
?>
8 changes: 4 additions & 4 deletions datatypes/xrowmetadata/xrowmetadatatype.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute
$contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes', 'Description should be shorter as 155 characters.' ) );
return eZInputValidator::STATE_INVALID;
}
if ( !empty( $data['canonical']) && substr($data['canonical'], 0, 8) != "https://" )
if ( !empty( $data['canonical_url']) && substr($data['canonical_url'], 0, 8) != "https://" )
{
$contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes', 'Canonical url must use https protocol.' ) );
return eZInputValidator::STATE_INVALID;
Expand Down Expand Up @@ -236,7 +236,7 @@ function fetchMetaData( $attribute )
htmlspecialchars_decode( (string)$xml->priority, ENT_QUOTES ),
htmlspecialchars_decode( (string)$xml->change, ENT_QUOTES ),
htmlspecialchars_decode( (string)$xml->sitemap_use , ENT_QUOTES ),
htmlspecialchars_decode( (string)$xml->canonical , ENT_QUOTES ) );
htmlspecialchars_decode( (string)$xml->canonical_url , ENT_QUOTES ) );
return $meta;
}
catch ( Exception $e )
Expand All @@ -249,7 +249,7 @@ function fetchMetaData( $attribute )
*/
function fillMetaData( $array )
{
return new xrowMetaData( $array['title'], $array['keywords'], $array['description'], $array['priority'], $array['change'], $array['sitemap_use'], $array['canonical'] );
return new xrowMetaData( $array['title'], $array['keywords'], $array['description'], $array['priority'], $array['change'], $array['sitemap_use'], $array['canonical_url'] );
}
/*!
Returns the content.
Expand Down Expand Up @@ -335,7 +335,7 @@ function saveXML( $meta )
$xmldom->appendChild( $node );
$node = $xml->createElement( "description", htmlspecialchars( $meta->description, ENT_QUOTES, 'UTF-8' ) );
$xmldom->appendChild( $node );
$node = $xml->createElement( "canonical", htmlspecialchars( $meta->canonical, ENT_QUOTES, 'UTF-8' ) );
$node = $xml->createElement( "canonical_url", htmlspecialchars( $meta->canonical_url, ENT_QUOTES, 'UTF-8' ) );
$xmldom->appendChild( $node );
if (!empty( $meta->priority ) )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

<div class="element">
<label>{'Canonical Link (starts with protocol https)'|i18n( 'design/standard/class/datatype' )}:</label>
<input id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}_keywords" class="box ezcc-{$attribute.object.content_class.identifier} ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier}" type="url" name="{$attribute_base}_xrowmetadata_data_array_{$attribute.id}[canonical]" size="100" maxsize="1055" value="{$attribute.content.canonical|wash()}" />
<input id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}_keywords" class="box ezcc-{$attribute.object.content_class.identifier} ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier}" type="url" name="{$attribute_base}_xrowmetadata_data_array_{$attribute.id}[canonical_url]" size="100" maxsize="1055" value="{$attribute.content.canonical_url|wash()}" />
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<tr><th class="table_no_border">{'Title'|i18n( 'design/standard/content/datatype' )}:</th><td class="table_no_border">{$attribute.content.title|wash()}</td></tr>
<tr><th class="table_no_border">{'Description'|i18n( 'design/standard/content/datatype' )}:</th><td class="table_no_border">{$attribute.content.description|wash()}</td></tr>
<tr><th class="table_no_border">{'Keywords'|i18n( 'design/standard/content/datatype' )}:</th><td class="table_no_border">{$attribute.content.keywords|implode( ', ' )|wash()}</td></tr>
<tr><th class="table_no_border">{'Canonical Link'|i18n( 'design/standard/content/datatype' )}:</th><td class="table_no_border">{$attribute.content.canonical|wash()}</td></tr>
<tr><th class="table_no_border">{'Canonical Link'|i18n( 'design/standard/content/datatype' )}:</th><td class="table_no_border">{$attribute.content.canonical_url|wash()}</td></tr>

<tr><th class="table_no_border">{'Use in sitemap'|i18n( 'design/standard/content/datatype' )}:</th><td class="table_no_border">{if eq($attribute.content.sitemap_use,'1')}{'yes'|i18n( 'design/standard/class/datatype' )}{else}{'no'|i18n( 'design/standard/class/datatype' )}{/if}</td></tr>
<tr><th class="table_no_border">{'Change frequence'|i18n( 'design/standard/content/datatype' )}:</th><td class="table_no_border">{$attribute.content.change|wash()|i18n( 'design/standard/class/datatype' )}</td></tr>
Expand Down

0 comments on commit 0096ca0

Please sign in to comment.