Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/upgrade composer deps #34

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 0 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
'align_multiline_comment' => true,
'array_indentation' => true,
'no_superfluous_elseif' => true,
'single_blank_line_before_namespace' => true,
'blank_line_after_opening_tag' => true,
'no_blank_lines_after_phpdoc' => true,
'phpdoc_separation' => true,
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"type": "wordpress-plugin",
"require": {
"php": "^7.4|^8.0",
"johnbillion/extended-cpts": "^4.0",
"johnbillion/extended-cpts": "^5.0",
"yahnis-elsts/plugin-update-checker": "^5.0"
},
"require-dev": {
"10up/wp_mock": "~0.5",
"friendsofphp/php-cs-fixer": "^2.0",
"friendsofphp/php-cs-fixer": "^3.0",
"mockery/mockery": "^1.5",
"phpunit/phpunit": "~9.0",
"szepeviktor/phpstan-wordpress": "^1.1"
Expand All @@ -33,7 +33,7 @@
},
"scripts": {
"format": "./vendor/bin/php-cs-fixer fix",
"phpstan": "./vendor/bin/phpstan analyse --no-progress --memory-limit 500M",
"phpstan": "./vendor/bin/phpstan analyse --no-progress --memory-limit 1G",
"test": [
"@unit"
],
Expand Down
1,554 changes: 1,002 additions & 552 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'seopress' => OWC\PDC\Base\RestAPI\ItemFields\SeoPress::class,
'yoast' => OWC\PDC\Base\RestAPI\ItemFields\Yoast::class,
'hide_feedback_form' => OWC\PDC\Base\RestAPI\SharedFields\HideFeedbackForm::class,
'table_of_contents_is_active' => OWC\PDC\Base\RestAPI\ItemFields\TableOfContentsField::class
'table_of_contents_is_active' => OWC\PDC\Base\RestAPI\ItemFields\TableOfContentsField::class
],
],
'subthema' => [
Expand Down Expand Up @@ -60,7 +60,7 @@
'yoast' => OWC\PDC\Base\RestAPI\ItemFields\Yoast::class,
'date_modified' => OWC\PDC\Base\RestAPI\ItemFields\DateModified::class,
'hide_feedback_form' => OWC\PDC\Base\RestAPI\SharedFields\HideFeedbackForm::class,
'tiles' => OWC\PDC\Base\RestAPI\ThemaFields\TilesField::class
'tiles' => OWC\PDC\Base\RestAPI\ThemaFields\TilesField::class
],
],
],
Expand Down
13 changes: 6 additions & 7 deletions config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@
'label' => 'RWMB Metabox',
'version' => '4.14.0',
'file' => 'meta-box/meta-box.php'
],
[
], [
'type' => 'plugin',
'label' => 'Posts 2 Posts',
'version' => '1.6.6',
'file' => 'posts-to-posts/posts-to-posts.php',
'label' => 'RWMB Metabox',
'version' => '1.4.2',
'file' => 'meta-box-group/meta-box-group.php'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wellicht nog handig om deze toe te voegen hier: OpenWebconcept/plugin-openwob@13abf10

],
[
'type' => 'class',
'type' => 'function',
'label' => '<a href="https://github.com/johnbillion/extended-cpts" target="_blank">Extended CPT library</a>',
'name' => 'Extended_CPT'
'name' => 'register_extended_post_type'
],
]

Expand Down
4 changes: 2 additions & 2 deletions config/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@
'id' => 'setting_pdc_use_feedback_form',
'type' => 'checkbox',
],
'pdc_use_theme_tiles' => [
'pdc_use_theme_tiles' => [
'name' => __('Theme tiles', 'pdc-base'),
'desc' => __('Enable theme tiles.', 'pdc-base'),
'id' => 'setting_pdc_use_theme_tiles',
'type' => 'checkbox',
],
'pdc_use_table_of_contents' => [
'pdc_use_table_of_contents' => [
'name' => __('Table of contents', 'pdc-base'),
'desc' => __('Enable use of table of contents.', 'pdc-base'),
'id' => 'setting_pdc_use_table_of_contents',
Expand Down
12 changes: 6 additions & 6 deletions config/table_of_contents_metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
'autosave' => true,
'fields' => [
'table_of_contents' => [
[
'name' => __('Table of contents', 'pdc-base'),
'desc' => __('Use this option if you want to use a table of contents', 'pdc-base'),
'id' => 'pdc_use_table_of_contents',
'type' => 'checkbox',
]
[
'name' => __('Table of contents', 'pdc-base'),
'desc' => __('Use this option if you want to use a table of contents', 'pdc-base'),
'id' => 'pdc_use_table_of_contents',
'type' => 'checkbox',
]
],
]
]
Expand Down
2 changes: 1 addition & 1 deletion config/taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'back_to_items' => __('← Back to tags', 'pdc-base'),
],
'meta_box' => 'simple',
'show_in_rest' => true,
'show_in_rest' => true,
],
'names' => [
'singular' => __('Audience', 'pdc-base'),
Expand Down
18 changes: 9 additions & 9 deletions config/theme_tiles_metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
'fields' => [
'tiles' => [
'group' => [
'id' => 'pdc_tiles_group',
'type' => 'group',
'clone' => true,
'id' => 'pdc_tiles_group',
'type' => 'group',
'clone' => true,
'sort_clone' => true,
'add_button' => __('Add new tile', 'pdc-base'),
'fields' => [
'fields' => [
[
'id' => 'pdc_tile_title',
'id' => 'pdc_tile_title',
'name' => __('Title', 'pdc-base'),
'type' => 'text',
],
[
'id' => 'pdc_tile_url',
[
'id' => 'pdc_tile_url',
'name' => __('URL', 'pdc-base'),
'type' => 'url',
],
[
'id' => 'pdc_tile_icon',
[
'id' => 'pdc_tile_icon',
'name' => __('Icon', 'pdc-base'),
'type' => 'text',
],
Expand Down
4 changes: 2 additions & 2 deletions src/Base/Admin/AdminServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace OWC\PDC\Base\Admin;

use OWC\PDC\Base\Foundation\ServiceProvider;
use OWC\PDC\Base\Models\Item;
use WP_Post;
use WP_REST_Response;
use OWC\PDC\Base\Models\Item;
use OWC\PDC\Base\Foundation\ServiceProvider;

class AdminServiceProvider extends ServiceProvider
{
Expand Down
1 change: 1 addition & 0 deletions src/Base/Exceptions/PropertyNotExistsException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Exception when property is not found on object.
*/
Expand Down
1 change: 1 addition & 0 deletions src/Base/Foundation/Config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Config object to store, save and retrieve configurations.
*/
Expand Down
15 changes: 15 additions & 0 deletions src/Base/Foundation/DependencyChecker.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Checks if dependencies are valid.
*/
Expand Down Expand Up @@ -53,6 +54,10 @@ public function failed(): bool
case 'plugin':
$this->checkPlugin($dependency);

break;
case 'function':
$this->checkFunction($dependency);

break;
}
}
Expand Down Expand Up @@ -139,6 +144,16 @@ private function checkPlugin(array $dependency)
}
}

/**
* Checks if required function exists.
*/
private function checkFunction(array $dependency): void
{
if (! function_exists($dependency['name'])) {
$this->markFailed($dependency, __('Function does not exist:', 'pdc-base') . ' <b>' . $dependency['name'] . '</b>');
}
}

/**
* Checks the installed version of the plugin.
*/
Expand Down
1 change: 1 addition & 0 deletions src/Base/Foundation/Loader.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Provider which handles the hooks in the WordPress ecosystem.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Base/Metabox/Handlers/UPLResourceHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace OWC\PDC\Base\Metabox\Handlers;

use OWC\PDC\Base\Support\Traits\RequestUPL;
use WP_Post;
use WP_REST_Request;
use OWC\PDC\Base\Support\Traits\RequestUPL;

class UPLResourceHandler
{
Expand Down
18 changes: 9 additions & 9 deletions src/Base/Metabox/MetaboxServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace OWC\PDC\Base\Metabox;

use OWC\PDC\Base\Support\Traits\RequestUPL;
use OWC\PDC\Base\Metabox\Handlers\UPLNameHandler;
use OWC\PDC\Base\Metabox\Handlers\UPLResourceHandler;
use OWC\PDC\Base\Support\Traits\RequestUPL;

class MetaboxServiceProvider extends MetaboxBaseServiceProvider
{
Expand Down Expand Up @@ -41,13 +41,13 @@ public function registerMetaboxes(array $rwmbMetaboxes): array
$configMetaboxes = $this->getShowOnMetabox($configMetaboxes);
}

if ($this->plugin->settings->useThemeTiles()) {
$configMetaboxes = $this->getTilesMetabox($configMetaboxes);
}
if ($this->plugin->settings->useThemeTiles()) {
$configMetaboxes = $this->getTilesMetabox($configMetaboxes);
}

if ($this->plugin->settings->useTableOfContents()) {
$configMetaboxes = $this->getTableOfContentsMetabox($configMetaboxes);
}
if ($this->plugin->settings->useTableOfContents()) {
$configMetaboxes = $this->getTableOfContentsMetabox($configMetaboxes);
}

if ($this->plugin->settings->useFeedbackForm()) {
$configMetaboxes = $this->getFeedbackFormMetabox($configMetaboxes);
Expand Down Expand Up @@ -86,12 +86,12 @@ protected function getShowOnMetabox(array $configMetaboxes): array
return array_merge($configMetaboxes, $this->plugin->config->get('show_on_metabox'));
}

protected function getTilesMetabox(array $configMetaboxes): array
protected function getTilesMetabox(array $configMetaboxes): array
{
return array_merge($configMetaboxes, $this->plugin->config->get('theme_tiles_metabox'));
}

protected function getTableOfContentsMetabox(array $configMetaboxes): array
protected function getTableOfContentsMetabox(array $configMetaboxes): array
{
return array_merge($configMetaboxes, $this->plugin->config->get('table_of_contents_metabox'));
}
Expand Down
6 changes: 3 additions & 3 deletions src/Base/Models/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,14 @@ public function getEscapeElement(): bool
{
$value = $this->getMeta('escape_element_active', '0', true, '_owc_');

return boolval($value);
return boolval($value);
}

public function useTableOfContents(): bool
public function useTableOfContents(): bool
{
$value = $this->getMeta('pdc_use_table_of_contents', '0', true, '_owc_');

return boolval($value);
return boolval($value);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Base/Models/PortalLinkGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace OWC\PDC\Base\Models;

use OWC\PDC\Base\Settings\SettingsPageOptions;
use WP_Term;
use OWC\PDC\Base\Settings\SettingsPageOptions;

class PortalLinkGenerator
{
Expand Down
2 changes: 2 additions & 0 deletions src/Base/PostType/PostTypeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function registerPostTypes()
continue;
}

$postType = apply_filters('owc/pdc-base/before-register-extended-post-type', $postType, $postTypeName);

register_extended_post_type($postTypeName, $postType['args'], $postType['names']);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Base/PostType/PostTypes/PdcSubcategoryModel.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Model for the sub-category
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Base/Repositories/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
namespace OWC\PDC\Base\Repositories;

use Closure;
use OWC\PDC\Base\Exceptions\PropertyNotExistsException;
use OWC\PDC\Base\Support\CreatesFields;
use OWC\PDC\Base\Support\Traits\QueryHelpers;
use WP_Post;
use WP_Query;
use OWC\PDC\Base\Support\CreatesFields;
use OWC\PDC\Base\Support\Traits\QueryHelpers;
use OWC\PDC\Base\Exceptions\PropertyNotExistsException;

/**
* PDC item object with default quering and methods.
Expand Down
2 changes: 1 addition & 1 deletion src/Base/RestAPI/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace OWC\PDC\Base\RestAPI\Controllers;

use OWC\PDC\Base\Foundation\Plugin;
use WP_Query;
use WP_REST_Request;
use OWC\PDC\Base\Foundation\Plugin;

/**
* Controller which handels general quering, such as pagination.
Expand Down
6 changes: 3 additions & 3 deletions src/Base/RestAPI/Controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace OWC\PDC\Base\RestAPI\Controllers;

use OWC\PDC\Base\Repositories\Item;
use OWC\PDC\Base\Support\Traits\CheckPluginActive;
use OWC\PDC\Base\Support\Traits\QueryHelpers;
use WP_Error;
use WP_REST_Request;
use OWC\PDC\Base\Repositories\Item;
use OWC\PDC\Base\Support\Traits\QueryHelpers;
use OWC\PDC\Base\Support\Traits\CheckPluginActive;

/**
* Controller which handles the (requested) pdc-item(s).
Expand Down
18 changes: 9 additions & 9 deletions src/Base/RestAPI/Controllers/SubthemaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function getSubthemas(WP_REST_Request $request): array
$items->filterSource($request->get_param('source'));
}

if ($language = $request->get_param('language')) {
$items->filterLanguage((string) $language);
}
if ($language = $request->get_param('language')) {
$items->filterLanguage((string) $language);
}

$data = $items->all();
$query = $items->getQuery();
Expand All @@ -59,9 +59,9 @@ public function getSubthema(WP_REST_Request $request)
$thema->filterSource($request->get_param('source'));
}

if ($language = $request->get_param('language')) {
$thema->filterLanguage((string) $language);
}
if ($language = $request->get_param('language')) {
$thema->filterLanguage((string) $language);
}

$thema = $thema->find($id);

Expand Down Expand Up @@ -91,9 +91,9 @@ public function getSubthemeBySlug(WP_REST_Request $request)
$subtheme->filterSource($request->get_param('source'));
}

if ($language = $request->get_param('language')) {
$subtheme->filterLanguage((string) $language);
}
if ($language = $request->get_param('language')) {
$subtheme->filterLanguage((string) $language);
}

$subtheme = $subtheme->findBySlug($slug);

Expand Down
Loading