Plugin Directory

Changeset 2719005


Ignore:
Timestamp:
05/06/2022 05:26:24 AM (4 years ago)
Author:
dynomapper
Message:

Support for Wordpress 6.0. Added plugin icon.

Location:
dynomapper-content-import
Files:
1 added
4 edited
9 copied

Legend:

Unmodified
Added
Removed
  • dynomapper-content-import/tags/1.0.3/README.md

    r2716227 r2719005  
    2424## Changelog
    2525
     26### 1.0.3 ###
     27* Wordpress 6.0 support
     28
    2629### 1.0.2 ###
    2730* Fixed typo
  • dynomapper-content-import/tags/1.0.3/includes/dynomapper-content-import.php

    r2716223 r2719005  
    2121    private $viewsDir;
    2222    private $devMode;
     23    private $templateVars = [];
    2324
    2425    public function __construct($pluginId, $pluginName, $viewsDir, $devMode)
     
    5354    public function registerImporter()
    5455    {
     56        $this->handleRequest();
     57
    5558        register_importer(
    5659            $this->pluginId,
     
    6366    }
    6467
    65     public function initImporter()
    66     {
     68    private function handleRequest()
     69    {
     70        if (empty($_GET['import']) || $_GET['import'] != $this->pluginId) {
     71            return;
     72        }
     73
    6774        $this->importJwt();
     75
     76        $this->templateVars = [];
    6877
    6978        if (!empty($_GET['runImport']) && !empty($_GET['token'])) {
    7079            //validate import
    7180            $this->validateImport($_GET['token']);
     81            return;
     82        }
     83
     84        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
     85            check_admin_referer('content-import-credentials');
     86
     87            $clientId = isset($_POST['clientId']) ? sanitize_text_field($_POST['clientId']) : '';
     88            $clientSecret = isset($_POST['clientSecret']) ? sanitize_text_field($_POST['clientSecret']) : '';
     89            $authBaseUrl = isset($_POST['authBaseUrl']) ? sanitize_text_field($_POST['authBaseUrl']) : '';
     90
     91            update_option($this->pluginId . '.clientId', $clientId);
     92            update_option($this->pluginId . '.clientSecret', $clientSecret);
     93            update_option($this->pluginId . '.authBaseUrl', $authBaseUrl);
     94
     95            $this->templateVars['saved'] = true;
     96
     97            if (!empty($_POST['start'])) {
     98                $result = $this->redirectToAuthUrl($clientId, $clientSecret, $this->getAuthBaseUrl());
     99
     100                if (is_wp_error($result)) {
     101                    $this->templateVars['saveError'] = $result;
     102                }
     103            }
     104        }
     105    }
     106
     107    public function initImporter()
     108    {
     109        $this->importJwt();
     110
     111        if (!empty($_GET['runImport']) && !empty($_GET['token'])) {
     112            //validate import
     113            extract($this->templateVars);
     114            include $this->viewsDir . '/validate-import.php';
    72115            return;
    73116        }
     
    81124        }
    82125
    83         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    84             check_admin_referer('content-import-credentials');
    85 
    86             $clientId = isset($_POST['clientId']) ? sanitize_text_field($_POST['clientId']) : '';
    87             $clientSecret = isset($_POST['clientSecret']) ? sanitize_text_field($_POST['clientSecret']) : '';
    88             $authBaseUrl = isset($_POST['authBaseUrl']) ? sanitize_text_field($_POST['authBaseUrl']) : '';
    89 
    90             update_option($this->pluginId . '.clientId', $clientId);
    91             update_option($this->pluginId . '.clientSecret', $clientSecret);
    92             update_option($this->pluginId . '.authBaseUrl', $authBaseUrl);
    93 
    94             $saved = true;
    95 
    96             if (!empty($_POST['start'])) {
    97                 $result = $this->redirectToAuthUrl($clientId, $clientSecret, $this->getAuthBaseUrl());
    98 
    99                 if (is_wp_error($result)) {
    100                     $saveError = $result;
    101                 } else {
    102                     exit;
    103                 }
    104             }
    105         }
    106 
    107126        $clientIdValue = get_option($this->pluginId . '.clientId');
    108127        $clientSecretValue = get_option($this->pluginId . '.clientSecret');
     
    115134        }
    116135
     136        extract($this->templateVars);
    117137        include $this->viewsDir . '/import.php';
    118138    }
     
    168188        $clientIdValue = get_option($this->pluginId . '.clientId');
    169189        $clientSecretValue = get_option($this->pluginId . '.clientSecret');
    170         $authBaseUrlValue = $this->getAuthBaseUrl();
    171190
    172191        \Dynomapper\Firebase\JWT\JWT::$leeway = 30;
     
    194213            set_transient($this->pluginId . '.accessToken', $decoded->accessToken, 60);
    195214            wp_redirect('admin.php?import=' . $this->pluginId);
    196             exit;
    197         }
    198 
    199         include $this->viewsDir . '/validate-import.php';
     215            return;
     216        }
     217
     218        $this->templateVars['error'] = $error;
    200219    }
    201220
  • dynomapper-content-import/tags/1.0.3/readme.txt

    r2716231 r2719005  
    44Tags               dynomapper, structured content, import, mapping, sitemap, sitemapping
    55Requires at least: 5.0.0
    6 Tested up to:      5.9.3
    7 Stable tag:        1.0.2
     6Tested up to:      6.0.0
     7Stable tag:        1.0.3
    88License:           GPL-2.0+
    99Requires PHP:      7.0
     
    3636== Changelog ==
    3737
     38= 1.0.3 =
     39* Wordpress 6.0 support
     40
    3841= 1.0.2 =
    3942* Fixed typo
  • dynomapper-content-import/trunk/README.md

    r2716227 r2719005  
    2424## Changelog
    2525
     26### 1.0.3 ###
     27* Wordpress 6.0 support
     28
    2629### 1.0.2 ###
    2730* Fixed typo
  • dynomapper-content-import/trunk/includes/dynomapper-content-import.php

    r2716223 r2719005  
    2121    private $viewsDir;
    2222    private $devMode;
     23    private $templateVars = [];
    2324
    2425    public function __construct($pluginId, $pluginName, $viewsDir, $devMode)
     
    5354    public function registerImporter()
    5455    {
     56        $this->handleRequest();
     57
    5558        register_importer(
    5659            $this->pluginId,
     
    6366    }
    6467
    65     public function initImporter()
    66     {
     68    private function handleRequest()
     69    {
     70        if (empty($_GET['import']) || $_GET['import'] != $this->pluginId) {
     71            return;
     72        }
     73
    6774        $this->importJwt();
     75
     76        $this->templateVars = [];
    6877
    6978        if (!empty($_GET['runImport']) && !empty($_GET['token'])) {
    7079            //validate import
    7180            $this->validateImport($_GET['token']);
     81            return;
     82        }
     83
     84        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
     85            check_admin_referer('content-import-credentials');
     86
     87            $clientId = isset($_POST['clientId']) ? sanitize_text_field($_POST['clientId']) : '';
     88            $clientSecret = isset($_POST['clientSecret']) ? sanitize_text_field($_POST['clientSecret']) : '';
     89            $authBaseUrl = isset($_POST['authBaseUrl']) ? sanitize_text_field($_POST['authBaseUrl']) : '';
     90
     91            update_option($this->pluginId . '.clientId', $clientId);
     92            update_option($this->pluginId . '.clientSecret', $clientSecret);
     93            update_option($this->pluginId . '.authBaseUrl', $authBaseUrl);
     94
     95            $this->templateVars['saved'] = true;
     96
     97            if (!empty($_POST['start'])) {
     98                $result = $this->redirectToAuthUrl($clientId, $clientSecret, $this->getAuthBaseUrl());
     99
     100                if (is_wp_error($result)) {
     101                    $this->templateVars['saveError'] = $result;
     102                }
     103            }
     104        }
     105    }
     106
     107    public function initImporter()
     108    {
     109        $this->importJwt();
     110
     111        if (!empty($_GET['runImport']) && !empty($_GET['token'])) {
     112            //validate import
     113            extract($this->templateVars);
     114            include $this->viewsDir . '/validate-import.php';
    72115            return;
    73116        }
     
    81124        }
    82125
    83         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    84             check_admin_referer('content-import-credentials');
    85 
    86             $clientId = isset($_POST['clientId']) ? sanitize_text_field($_POST['clientId']) : '';
    87             $clientSecret = isset($_POST['clientSecret']) ? sanitize_text_field($_POST['clientSecret']) : '';
    88             $authBaseUrl = isset($_POST['authBaseUrl']) ? sanitize_text_field($_POST['authBaseUrl']) : '';
    89 
    90             update_option($this->pluginId . '.clientId', $clientId);
    91             update_option($this->pluginId . '.clientSecret', $clientSecret);
    92             update_option($this->pluginId . '.authBaseUrl', $authBaseUrl);
    93 
    94             $saved = true;
    95 
    96             if (!empty($_POST['start'])) {
    97                 $result = $this->redirectToAuthUrl($clientId, $clientSecret, $this->getAuthBaseUrl());
    98 
    99                 if (is_wp_error($result)) {
    100                     $saveError = $result;
    101                 } else {
    102                     exit;
    103                 }
    104             }
    105         }
    106 
    107126        $clientIdValue = get_option($this->pluginId . '.clientId');
    108127        $clientSecretValue = get_option($this->pluginId . '.clientSecret');
     
    115134        }
    116135
     136        extract($this->templateVars);
    117137        include $this->viewsDir . '/import.php';
    118138    }
     
    168188        $clientIdValue = get_option($this->pluginId . '.clientId');
    169189        $clientSecretValue = get_option($this->pluginId . '.clientSecret');
    170         $authBaseUrlValue = $this->getAuthBaseUrl();
    171190
    172191        \Dynomapper\Firebase\JWT\JWT::$leeway = 30;
     
    194213            set_transient($this->pluginId . '.accessToken', $decoded->accessToken, 60);
    195214            wp_redirect('admin.php?import=' . $this->pluginId);
    196             exit;
    197         }
    198 
    199         include $this->viewsDir . '/validate-import.php';
     215            return;
     216        }
     217
     218        $this->templateVars['error'] = $error;
    200219    }
    201220
  • dynomapper-content-import/trunk/readme.txt

    r2716231 r2719005  
    44Tags               dynomapper, structured content, import, mapping, sitemap, sitemapping
    55Requires at least: 5.0.0
    6 Tested up to:      5.9.3
    7 Stable tag:        1.0.2
     6Tested up to:      6.0.0
     7Stable tag:        1.0.3
    88License:           GPL-2.0+
    99Requires PHP:      7.0
     
    3636== Changelog ==
    3737
     38= 1.0.3 =
     39* Wordpress 6.0 support
     40
    3841= 1.0.2 =
    3942* Fixed typo
Note: See TracChangeset for help on using the changeset viewer.