Skip to content

Commit

Permalink
Bump version 1.2.0 add mesh links
Browse files Browse the repository at this point in the history
  • Loading branch information
gillesbourgeat committed Oct 6, 2019
1 parent 2c32128 commit 8676ee2
Show file tree
Hide file tree
Showing 16 changed files with 1,418 additions and 28 deletions.
1 change: 1 addition & 0 deletions Config/Update/1.2.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `better_seo_i18n` ADD `mesh_text_1` TEXT NOT NULL AFTER `h1`, ADD `mesh_url_1` TEXT NOT NULL AFTER `mesh_text_1`, ADD `mesh_text_2` TEXT NOT NULL AFTER `mesh_url_1`, ADD `mesh_url_2` TEXT NOT NULL AFTER `mesh_text_2`, ADD `mesh_text_3` TEXT NOT NULL AFTER `mesh_url_2`, ADD `mesh_url_3` TEXT NOT NULL AFTER `mesh_text_3`, ADD `mesh_text_4` TEXT NOT NULL AFTER `mesh_url_3`, ADD `mesh_url_4` TEXT NOT NULL AFTER `mesh_text_4`, ADD `mesh_text_5` TEXT NOT NULL AFTER `mesh_url_4`, ADD `mesh_url_5` TEXT NOT NULL AFTER `mesh_text_5`;
8 changes: 4 additions & 4 deletions Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
<fullnamespace>BetterSeo\BetterSeo</fullnamespace>
<descriptive locale="en_US">
<title>Set noindex, nofollow, h1, canonical tag on pages</title>
<title>Set noindex, nofollow, h1, canonical tag on pages, and manage mesh links</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Ajoute la balise noindex, nofollow, h1, canonical sur les pages</title>
<title>Ajoute la balise noindex, nofollow, h1, canonical sur les pages, plus gestion des liens maillés</title>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.1.0</version>
<version>1.2.0</version>
<authors>
<author>
<name>Nicolas Barbey</name>
Expand All @@ -26,7 +26,7 @@
</authors>
<type>classic</type>
<thelia>2.2.0</thelia>
<stability>other</stability>
<stability>rc</stability>
<mandatory>0</mandatory>
<hidden>0</hidden>
</module>
28 changes: 27 additions & 1 deletion Config/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,34 @@
<column name="nofollow" required="true" default="0" type="TINYINT" size="4" />
<column name="canonical_field" type="LONGVARCHAR" />
<column name="h1" type="LONGVARCHAR" />
<column name="mesh_text_1" type="LONGVARCHAR" />
<column name="mesh_url_1" type="LONGVARCHAR" />
<column name="mesh_text_2" type="LONGVARCHAR" />
<column name="mesh_url_2" type="LONGVARCHAR" />
<column name="mesh_text_3" type="LONGVARCHAR" />
<column name="mesh_url_3" type="LONGVARCHAR" />
<column name="mesh_text_4" type="LONGVARCHAR" />
<column name="mesh_url_4" type="LONGVARCHAR" />
<column name="mesh_text_5" type="LONGVARCHAR" />
<column name="mesh_url_5" type="LONGVARCHAR" />
<behavior name="i18n">
<parameter name="i18n_columns" value="noindex, nofollow, canonical_field, h1" />
<parameter name="i18n_columns"
value="noindex,
nofollow,
canonical_field,
h1,
mesh_text_1,
mesh_url_1,
mesh_text_2,
mesh_url_2,
mesh_text_3,
mesh_url_3,
mesh_text_4,
mesh_url_4,
mesh_text_5,
mesh_url_5
"
/>
</behavior>
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
Expand Down
10 changes: 10 additions & 0 deletions Config/thelia.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ CREATE TABLE `better_seo_i18n`
`nofollow` TINYINT(4) DEFAULT 0 NOT NULL,
`canonical_field` TEXT,
`h1` TEXT,
`mesh_text_1` TEXT,
`mesh_url_1` TEXT,
`mesh_text_2` TEXT,
`mesh_url_2` TEXT,
`mesh_text_3` TEXT,
`mesh_url_3` TEXT,
`mesh_text_4` TEXT,
`mesh_url_4` TEXT,
`mesh_text_5` TEXT,
`mesh_url_5` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `better_seo_i18n_FK_1`
FOREIGN KEY (`id`)
Expand Down
5 changes: 5 additions & 0 deletions Controller/BetterSeoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public function saveAction()
->setH1(null === $seoForm->get('h1')->getData() ? '' : $seoForm->get('h1')->getData())
->setCanonicalField($canonical);

for ($i = 1; $i <= 5; $i++) {
call_user_func([$objectSeo, 'setMeshUrl' . $i], $seoForm->get('mesh_url_' . $i)->getData());
call_user_func([$objectSeo, 'setMeshText' . $i], $seoForm->get('mesh_text_' . $i)->getData());
}

$objectSeo->save();

static $routes = [
Expand Down
33 changes: 33 additions & 0 deletions Form/BetterSeoForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,39 @@ protected function buildForm()
)
)
);

for ($i = 1; $i <= 5; $i++) {
$form->add(
'mesh_text_' . $i,
'text',
array(
'required' => false,
'label' => Translator::getInstance()->trans(
'text',
array(),
BetterSeo::DOMAIN_NAME
),
'label_attr' => array(
'for' => 'mesh_text_' . $i
)
)
)
->add(
'mesh_url_' . $i,
'url',
array(
'required' => false,
'label' => Translator::getInstance()->trans(
'url',
array(),
BetterSeo::DOMAIN_NAME
),
'label_attr' => array(
'for' => 'mesh_url_' . $i
)
)
);
}
}

public function getName()
Expand Down
2 changes: 1 addition & 1 deletion I18n/backOffice/default/en_US.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

'canonical.help' => 'Allows you to specify another page of your site as the referring url and avoid the duplicate content. Thus the page indicated will be prioritized for the search engines, and your current page will be considered as a second-rate URL in favor of the canonical URL. To contribute the canonical URL please put the complete URL (with HTTP or HTTPS as appropriate).',

'label.noindex' => 'Management of the meta robots noindex, nofollow, canonical and h1 tag',
'label.noindex' => 'Management of the meta robots noindex, nofollow, canonical, h1 tag and mesh links',
'canonical' => 'Canonical Url',
'h1' => 'H1',
);
8 changes: 7 additions & 1 deletion I18n/backOffice/default/fr_FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@

'canonical.help' => 'Permet d\'indiquer une autre page de votre site comme étant l\'url référente et éviter le duplicate content. Ainsi la page indiquée sera priorisée pour les moteurs de recherche, et votre page actuelle sera considérée comme une URL de second rang au profit de l\'URL canonique. Pour renseigner l\'URL canonique veuillez mettre l\'URL complète (avec HTTP ou HTTPS selon les cas).',

'label.noindex' => 'Gestion de la meta robots noindex, nofollow, canonical et de la balise H1 :',
'label.noindex' => 'Gestion de la meta robots noindex, nofollow, canonical, balise H1 et liens maillés :',
'canonical' => 'Url Canonique',
'h1' => 'H1',
'Link' => 'Lien',
'text' => 'texte',
'url' => 'url',
'Link text' => 'Texte du lien',
'Link URL' => 'URL du lien',
'Mesh links' => 'Liens maillés',
);
12 changes: 10 additions & 2 deletions Loop/BetterSeoLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public function buildModelCriteria()
->withColumn(BetterSeoI18nTableMap::CANONICAL_FIELD, 'canonical')
->withColumn(BetterSeoI18nTableMap::H1, 'h1');

for ($i = 1; $i <= 5; $i++) {
$query->withColumn(constant(BetterSeoI18nTableMap::class . '::MESH_TEXT_' . $i), 'mesh_text_' . $i);
$query->withColumn(constant(BetterSeoI18nTableMap::class . '::MESH_URL_' . $i), 'mesh_url_' . $i);
}

return $query;
}

Expand All @@ -68,10 +73,13 @@ public function parseResults(LoopResult $loopResult)
$loopResultRow->set('CANONICAL', $data->getVirtualColumn('canonical'));
$loopResultRow->set('H1', $data->getVirtualColumn('h1'));

for ($i = 1; $i <= 5; $i++) {
$loopResultRow->set('MESH_TEXT_' . $i, $data->getVirtualColumn('mesh_text_' . $i));
$loopResultRow->set('MESH_URL_' . $i, $data->getVirtualColumn('mesh_url_' . $i));
}

$loopResult->addRow($loopResultRow);
}
return $loopResult;
}


}
Loading

0 comments on commit 8676ee2

Please sign in to comment.