Skip to content

Commit

Permalink
Merge pull request #13 from Dexerto/muhammed/sc-11033/dexerto-site-re…
Browse files Browse the repository at this point in the history
…validate-post-update

feat: [sc-11033] [dexerto-site] Revalidate Post Update
  • Loading branch information
humet authored Apr 18, 2024
2 parents e221ddb + 3f95423 commit 9af8ef6
Show file tree
Hide file tree
Showing 13 changed files with 1,043 additions and 790 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/deploy-to-wp-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy to WordPress.org

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: mbstring, intl
tools: composer

- name: Install PHP dependencies
run: |
composer install --no-dev --optimize-autoloader
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: on-demand-revalidation
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 19 additions & 14 deletions on-demand-revalidation.php → class-ondemandrevalidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
*
* Plugin Name: On-Demand Revalidation
* Plugin URI: https://wordpress.org/plugins/on-demand-revalidation
* GitHub Plugin URI: https://github.com/gdidentity/on-demand-revalidation
* Description: Next.js On-Demand Revalidation on the post update, revalidate specific paths on the post update.
* Version: 1.1.3
* Author: GD IDENTITY
* Author URI: https://gdidentity.sk
* GitHub Plugin URI: https://github.com/dexerto/on-demand-revalidation
* Description: Next.js On-Demand Revalidation on the post update, revalidate specific paths, tags on the post update.
* Version: 1.2.0
* Author: Dexerto
* Author URI: https://dexerto.com
* Text Domain: on-demand-revalidation
* License: GPL-3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
* @package OnDemandRevalidation
*/

use OnDemandRevalidation\Admin\Settings;
Expand Down Expand Up @@ -51,9 +53,9 @@ public static function instance(): self {
if ( self::$instance->includes() ) {
self::$instance->settings();
self::$instance->revalidation();
self::$instance->pluginLinks();
self::$instance->plugin_links();

\OnDemandRevalidation\Helpers::preventWrongApiUrl();
\OnDemandRevalidation\Helpers::prevent_wrong_api_url();
}
}

Expand Down Expand Up @@ -114,7 +116,7 @@ public function __wakeup() {
private function setup_constants(): void {

if ( ! function_exists( 'get_plugin_data' ) ) {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}

// Plugin version.
Expand Down Expand Up @@ -160,7 +162,7 @@ private function includes(): bool {

// Bail if installed incorrectly.
if ( ! class_exists( '\OnDemandRevalidation\Admin\Settings' ) ) {
add_action( 'admin_notices', [ $this, 'missing_notice' ] );
add_action( 'admin_notices', array( $this, 'missing_notice' ) );
return false;
}
}
Expand Down Expand Up @@ -211,14 +213,17 @@ private function revalidation(): void {
*
* @since 0.0.1
*/
private function pluginLinks(): void {
private function plugin_links(): void {

// Setup Settings link.
add_filter('plugin_action_links_' . plugin_basename( __FILE__ ), function ( $links ) {
$links[] = '<a href="/wp-admin/admin.php?page=on-demand-revalidation">Settings</a>';
add_filter(
'plugin_action_links_' . plugin_basename( __FILE__ ),
function ( $links ) {
$links[] = '<a href="/wp-admin/admin.php?page=on-demand-revalidation">Settings</a>';

return $links;
});
return $links;
}
);
}
}

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
}
},
"require-dev": {
"automattic/vipwpcs": "^2.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"phpcompatibility/phpcompatibility-wp": "*"
"squizlabs/php_codesniffer": "^3.9",
"automattic/vipwpcs": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
},
"scripts": {
"phpcs": [
Expand Down
Loading

0 comments on commit 9af8ef6

Please sign in to comment.