Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Condo committed Aug 22, 2024
2 parents de1b087 + 3911b05 commit f29c113
Show file tree
Hide file tree
Showing 26 changed files with 264 additions and 186 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/.php_cs.cache
/public
/vendor
composer.lock
.phpunit.result.cache
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ QuinnInteractive\Seo\Analysis\MetaDescAnalysis:
meta_desc_too_long_threshold: 320
```
### Other Options
Other options can be found in the `private static` variables in the following files. They can be overridden in YAML in the usual way.

- PageHealthExtension.php
- PageSeoExtension.php
- SiteConfigSettingsExtension.php

## Assumptions

This module assumes that you make use of the default `Content` field provided by `\Page`. If a specific page does not then you can specify one or multiple fields that contain your content.
Expand Down Expand Up @@ -182,4 +190,4 @@ public function updateCollateContentFields($content) {

## Version

1.1.4
2.0.0
107 changes: 61 additions & 46 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,66 @@
{
"name": "quinninteractive/silverstripe-seo",
"description": "An all-in-one SEO module for SilverStripe",
"type": "silverstripe-vendormodule",
"keywords": ["silverstripe", "seo", "facebook", "twitter", "opengraph", "search", "optimization", "optimisation"],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Reece Alexander",
"homepage": "https://vulcandigital.co.nz",
"role": "author"
"name": "quinninteractive/silverstripe-seo",
"description": "An all-in-one SEO module for SilverStripe",
"type": "silverstripe-vendormodule",
"keywords": [
"silverstripe",
"seo",
"facebook",
"twitter",
"opengraph",
"search",
"optimization",
"optimisation"
],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Reece Alexander",
"homepage": "https://vulcandigital.co.nz",
"role": "author"
},
{
"name": "Fred Condo",
"homepage": "https://quinn.com",
"role": "maintainer"
},
{
"name": "Phil Quinn",
"homepage": "https://quinn.com",
"role": "maintainer"
}
],
"require": {
"php": "^8.1",
"jonom/silverstripe-text-target-length": "^2.0",
"kub-at/php-simple-html-dom-parser": "^1.9",
"silverstripe/cms": "^5",
"wilr/silverstripe-googlesitemaps": "^3.1"
},
{
"name": "Fred Condo",
"homepage": "https://quinn.com",
"role": "maintainer"
"require-dev": {
"phpunit/phpunit": "^9.5",
"rector/rector": "^1.2"
},
{
"name": "Phil Quinn",
"homepage": "https://quinn.com",
"role": "maintainer"
}
],
"require": {
"silverstripe/cms": "^4.1",
"jonom/silverstripe-text-target-length": "^2",
"wilr/silverstripe-googlesitemaps": "^2.1",
"kub-at/php-simple-html-dom-parser": "^1.7",
"axllent/silverstripe-trailing-slash": "^2.1"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "3.*"
},
"autoload": {
"psr-4": {
"QuinnInteractive\\Seo\\": "src/",
"QuinnInteractive\\Seo\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-develop": "2.x-dev"
"autoload": {
"psr-4": {
"QuinnInteractive\\Seo\\": "src/",
"QuinnInteractive\\Seo\\Tests\\": "tests/"
}
},
"expose": [
"dist"
]
},
"minimum-stability": "dev",
"prefer-stable": true
"extra": {
"branch-alias": {
"dev-develop": "3.x-dev"
},
"expose": [
"dist"
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"allow-plugins": {
"composer/installers": true,
"silverstripe/vendor-plugin": true
}
}
}
6 changes: 3 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<phpunit bootstrap="tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests</directory>
<directory>./tests</directory>
</testsuite>

<filter>
Expand All @@ -11,4 +11,4 @@
</exclude>
</whitelist>
</filter>
</phpunit>
</phpunit>
14 changes: 14 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withPhpSets(php81: true)
->withImportNames(importShortClasses: false)
->withTypeCoverageLevel(0);
2 changes: 1 addition & 1 deletion src/Analysis/Analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getContent()
$parser = $this->getRenderedHtmlDomParser();
$output = [];
foreach ($parser->find('p,h1,h2,h3,h4,h5') as $item) {
$output[] = strip_tags(html_entity_decode($item->innertext()));
$output[] = strip_tags(html_entity_decode((string) $item->innertext()));
}

$output = array_filter($output);
Expand Down
6 changes: 3 additions & 3 deletions src/Analysis/FocusKeywordContentAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/
class FocusKeywordContentAnalysis extends Analysis
{
const FOCUS_KEYWORD_NOT_FOUND = 0;
const FOCUS_KEYWORD_SUCCESS = 1;
const FOCUS_KEYWORD_UNSET = -1;
public const FOCUS_KEYWORD_NOT_FOUND = 0;
public const FOCUS_KEYWORD_SUCCESS = 1;
public const FOCUS_KEYWORD_UNSET = -1;

private static $hidden_levels = [
'default'
Expand Down
6 changes: 3 additions & 3 deletions src/Analysis/FocusKeywordUniqueAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/
class FocusKeywordUniqueAnalysis extends Analysis
{
const FOCUS_KEYWORD_INUSE = 0;
const FOCUS_KEYWORD_SUCCESS = 1;
const FOCUS_KEYWORD_UNSET = -1;
public const FOCUS_KEYWORD_INUSE = 0;
public const FOCUS_KEYWORD_SUCCESS = 1;
public const FOCUS_KEYWORD_UNSET = -1;

/**
* @return string
Expand Down
16 changes: 8 additions & 8 deletions src/Analysis/FocusKeywordUrlAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
*/
class FocusKeywordUrlAnalysis extends Analysis
{
const FOCUS_KEYWORD_IRRELEVANT = -2;
const FOCUS_KEYWORD_NOT_IN_URL = 0;
const FOCUS_KEYWORD_SUCCESS = 1;
const FOCUS_KEYWORD_UNSET = -1;
public const FOCUS_KEYWORD_IRRELEVANT = -2;
public const FOCUS_KEYWORD_NOT_IN_URL = 0;
public const FOCUS_KEYWORD_SUCCESS = 1;
public const FOCUS_KEYWORD_UNSET = -1;

private static $hidden_levels = [
'default'
Expand All @@ -38,19 +38,19 @@ public function responses()
{
return [
static::FOCUS_KEYWORD_IRRELEVANT => [
_t( __CLASS__ . '.FOCUS_KEYWORD_IRRELEVANT', 'The focus keyword is irrelevant on the home page; this message will not display'),
_t( self::class . '.FOCUS_KEYWORD_IRRELEVANT', 'The focus keyword is irrelevant on the home page; this message will not display'),
'default'
],
static::FOCUS_KEYWORD_UNSET => [
_t( __CLASS__ . '.FOCUS_KEYWORD_UNSET', 'The focus keyword has not been set; consider setting this to improve content analysis'),
_t( self::class . '.FOCUS_KEYWORD_UNSET', 'The focus keyword has not been set; consider setting this to improve content analysis'),
'default'
],
static::FOCUS_KEYWORD_NOT_IN_URL => [
_t( __CLASS__ . '.FOCUS_KEYWORD_NOT_IN_URL', 'The focus keyword is not in the url segment; consider changing this and if you do SilverStripe will automatically redirect your old URL!'),
_t( self::class . '.FOCUS_KEYWORD_NOT_IN_URL', 'The focus keyword is not in the url segment; consider changing this and if you do SilverStripe will automatically redirect your old URL!'),
'warning'
],
static::FOCUS_KEYWORD_SUCCESS => [
_t( __CLASS__ . '.FOCUS_KEYWORD_SUCCESS', 'The focus keyword is in the url segment; this is great!'),
_t( self::class . '.FOCUS_KEYWORD_SUCCESS', 'The focus keyword is in the url segment; this is great!'),
'success'
],
];
Expand Down
14 changes: 7 additions & 7 deletions src/Analysis/TitleAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*/
class TitleAnalysis extends Analysis
{
const TITLE_FOCUS_KEYWORD_POSITION = 4;
const TITLE_IS_HOME = -1;
const TITLE_NO_FOCUS_KEYWORD = 3; // only checked if the focus keyword has been defined
const TITLE_OK_BUT_SHORT = 1;
const TITLE_SUCCESS = 5;
const TITLE_TOO_LONG = 2;
const TITLE_TOO_SHORT = 0;
public const TITLE_FOCUS_KEYWORD_POSITION = 4;
public const TITLE_IS_HOME = -1;
public const TITLE_NO_FOCUS_KEYWORD = 3; // only checked if the focus keyword has been defined
public const TITLE_OK_BUT_SHORT = 1;
public const TITLE_SUCCESS = 5;
public const TITLE_TOO_LONG = 2;
public const TITLE_TOO_SHORT = 0;

/**
* @return array
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/WordCountAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/
class WordCountAnalysis extends Analysis
{
const WORD_COUNT_ABOVE_MIN = 1;
const WORD_COUNT_BELOW_MIN = 0;
public const WORD_COUNT_ABOVE_MIN = 1;
public const WORD_COUNT_BELOW_MIN = 0;

/**
* @return int
Expand Down
Loading

0 comments on commit f29c113

Please sign in to comment.