From b2b3fca4681105ff71c52c5e69925d2f775f6e0a Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Wed, 26 Jan 2022 13:58:38 -0500 Subject: [PATCH] Clean up legacy code --- api.php | 64 ----------------------- cogicon.ico | Bin 1150 -> 0 bytes gear.ico | Bin 1150 -> 0 bytes plugin.php | 29 ++-------- src/assets/cogicon.svg | 1 + src/assets/cogicon.tsx | 3 -- src/components/block-controls.tsx.ignore | 55 ------------------- src/edit.tsx | 2 +- src/index.tsx | 2 +- templates/options.php | 29 ---------- testing/dialog.html | 20 ------- tinymce/gear.ico | Bin 1150 -> 0 bytes webpack.config.js | 10 ++-- 13 files changed, 11 insertions(+), 204 deletions(-) delete mode 100755 api.php delete mode 100755 cogicon.ico delete mode 100755 gear.ico create mode 100644 src/assets/cogicon.svg delete mode 100644 src/assets/cogicon.tsx delete mode 100644 src/components/block-controls.tsx.ignore delete mode 100755 templates/options.php delete mode 100644 testing/dialog.html delete mode 100755 tinymce/gear.ico diff --git a/api.php b/api.php deleted file mode 100755 index d8d27c1..0000000 --- a/api.php +++ /dev/null @@ -1,64 +0,0 @@ - - - - -EOF; - } - - // Builds Cognito module embed script - public static function get_embed_script($key, $module) { - $base = self::$servicesBase; - return <<< EOF -
- - -
-EOF; - } -} - -?> \ No newline at end of file diff --git a/cogicon.ico b/cogicon.ico deleted file mode 100755 index 62b50ba6b9e6f2037e3a270a7dabef1d4ded8c47..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmZ{jOK4L;6ox12&P@?~EL`-JTDA3o6>L>R1wkp+rdp+^uYFz^80Pvvl8tO0Vi>4kNN zebm`MN%x*d>A{N__1pGDl;P>BWY1i3+-1F_{1SS5MG^C|yd$+7%9Ga7$3CseM`{W*&B(BxK=4bAPsd69s z=hA6Yr=K`?BkZbnSwFvn36fw6q*#CC<^-iPRUaF>i>?O0PQ&+q%H0-T7A&V zS|)94x%a!#ml5urcRVBO4@I)n_hgzlkM=Wz`VIOv@|QLv2V(iGnn4XvXK)>Tp{tL7 zQ8H!Kz$c(iA#W7qS=Jtqd*7a;Q~FEr75M!wK8(?!H?8fEz31Am z73uj~2m)TqJ6*cD@tD=Ky}co7>hklMnILb+Ou()IYVXAuzXJSTr$8@ahmnUEjDNs) z1-QW|cny{Td8gO{&N261v|yeEe1F=3+N%QNrD|U4Qrc^EuzY`K0N=|}p~BcEglE1G Uw;UE~TpY}PwZ^eutAy140|l}o*Z=?k diff --git a/gear.ico b/gear.ico deleted file mode 100755 index 316b1b4d81603de42d0ab829bdb4f142e7693918..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmb7CyKTcT6gf(j4dGNnflkO4FTS8@6bkj~z~3m8!DEFSSp z$PNPG^gg_Me2*kBWGYST<` zzfxa5;rUc6S)bRsYQ3Ce#d9C3CC%jA*3_1K>+jlH=lF(RJ#2|MU%Bs~jqgERY2q0r z#<4H)n~bOxC%LXIb3GCD_x!8-qptmj)^*DrQM)8Oe@9<95a!BvUO92g`_&AJiFh7y v=5n6m)LNfGw3+AqOWnwke_jFK??5*jv7ZB9pTK+%JRV2LS6(nr8fkw4ZohQo diff --git a/plugin.php b/plugin.php index 1ba38ba..57a38e8 100644 --- a/plugin.php +++ b/plugin.php @@ -69,19 +69,6 @@ if ( !class_exists('CognitoFormsPlugin') ) { public function admin_init() { if(!current_user_can('edit_posts') && !current_user_can('edit_pages')) return; - register_setting('cognito_plugin', 'cognito_api_key'); - register_setting('cognito_plugin', 'cognito_admin_key'); - register_setting('cognito_plugin', 'cognito_public_key'); - register_setting('cognito_plugin', 'cognito_organization'); - - // If the flag to delete options was passed-in, delete them - if (isset($_GET['cog_clear']) && $_GET['cog_clear'] == '1') { - delete_option('cognito_api_key'); - delete_option('cognito_admin_key'); - delete_option('cognito_public_key'); - delete_option('cognito_organization'); - } - // Initialize TinyMCE Plugin $this->tinymce_init(); } @@ -138,7 +125,7 @@ if ( !class_exists('CognitoFormsPlugin') ) { } // Set up TinyMCE buttons - public function mce_buttons($buttons) { + public function mce_buttons( $buttons ) { array_push($buttons, '|', 'cognito'); return $buttons; } @@ -151,22 +138,16 @@ if ( !class_exists('CognitoFormsPlugin') ) { // Initialize administration menu (left-bar) public function admin_menu() { - add_menu_page('Cognito Forms', 'Cognito Forms', 'manage_options', 'Cognito', array($this, 'main_page'), "data:image/svg+xml;base64," . base64_encode( '' ) ); - add_submenu_page('Cognito', 'Cognito Forms', 'View Forms', 'manage_options', 'Cognito', array($this, 'main_page')); - add_submenu_page('Cognito', 'Create Form', 'New Form', 'manage_options', 'CognitoCreateForm', array($this, 'main_page')); - add_submenu_page('Cognito', 'Templates', 'Templates', 'manage_options', 'CognitoTemplates', array($this, 'main_page')); - - add_options_page('Cognito Options', 'Cognito Forms', 'manage_options', 'CognitoOptions', array($this, 'options_page')); + add_menu_page( 'Cognito Forms', 'Cognito Forms', 'manage_options', 'Cognito', array( $this, 'main_page' ), "data:image/svg+xml;base64," . base64_encode( '' ) ); + add_submenu_page( 'Cognito', 'Cognito Forms', 'View Forms', 'manage_options', 'Cognito', array( $this, 'main_page' ) ); + add_submenu_page( 'Cognito', 'Create Form', 'New Form', 'manage_options', 'CognitoCreateForm', array( $this, 'main_page' ) ); + add_submenu_page( 'Cognito', 'Templates', 'Templates', 'manage_options', 'CognitoTemplates', array( $this, 'main_page' ) ); } // Entrypoint for Cognito Forms access public function main_page() { include 'templates/main.php'; } - - public function options_page() { - include 'templates/options.php'; - } } new CognitoFormsPlugin; diff --git a/src/assets/cogicon.svg b/src/assets/cogicon.svg new file mode 100644 index 0000000..7fa4932 --- /dev/null +++ b/src/assets/cogicon.svg @@ -0,0 +1 @@ + diff --git a/src/assets/cogicon.tsx b/src/assets/cogicon.tsx deleted file mode 100644 index 3296b59..0000000 --- a/src/assets/cogicon.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import * as React from 'react'; - -export default ; diff --git a/src/components/block-controls.tsx.ignore b/src/components/block-controls.tsx.ignore deleted file mode 100644 index 5144489..0000000 --- a/src/components/block-controls.tsx.ignore +++ /dev/null @@ -1,55 +0,0 @@ -/** - * WordPress dependencies - */ -import * as React from 'react'; -import { __ } from '@wordpress/i18n'; -import { - ToolbarButton, - PanelBody, - ToggleControl, - ToolbarGroup, -} from '@wordpress/components'; -import { BlockControls, InspectorControls } from '@wordpress/block-editor'; -import { edit } from '@wordpress/icons'; - -const EmbedControls = ( { - blockSupportsResponsive, - showEditButton, - themeSupportsResponsive, - allowResponsive, - getResponsiveHelp, - toggleResponsive, - switchBackToURLInput, -} ) => ( - <> - - - { showEditButton && ( - - ) } - - - { themeSupportsResponsive && blockSupportsResponsive && ( - - - - - - ) } - -); - -export default EmbedControls; diff --git a/src/edit.tsx b/src/edit.tsx index ade1e83..b965368 100644 --- a/src/edit.tsx +++ b/src/edit.tsx @@ -10,7 +10,7 @@ import { InspectorControls, } from '@wordpress/block-editor'; -import CogIcon from '@/assets/cogicon'; +import { ReactComponent as CogIcon } from '@/assets/cogicon.svg'; import SelectDialog from '@/components/select-dialog'; import PreviewForm from '@/components/preview-form'; import { BlockAttributes, EmbedMode } from '@/types'; diff --git a/src/index.tsx b/src/index.tsx index 46089e9..7e62005 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -12,7 +12,7 @@ import { BlockAttributes } from './types'; import Edit from './edit'; import Save from './save'; -import CogIcon from './assets/cogicon'; +import { ReactComponent as CogIcon } from './assets/cogicon.svg'; registerBlockType( 'cognito-forms/cognito-embed', { title: 'Cognito Forms', diff --git a/templates/options.php b/templates/options.php deleted file mode 100755 index d71e710..0000000 --- a/templates/options.php +++ /dev/null @@ -1,29 +0,0 @@ -

Cognito Forms

- -
- - - - - - - - - - - - - - - - - - - -
API Key
Admin API Key
Public API Key
Organization Code
- -

- -

- -
\ No newline at end of file diff --git a/testing/dialog.html b/testing/dialog.html deleted file mode 100644 index f6f1eaa..0000000 --- a/testing/dialog.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - Form Selection - - - - - - - - diff --git a/tinymce/gear.ico b/tinymce/gear.ico deleted file mode 100755 index 316b1b4d81603de42d0ab829bdb4f142e7693918..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmb7CyKTcT6gf(j4dGNnflkO4FTS8@6bkj~z~3m8!DEFSSp z$PNPG^gg_Me2*kBWGYST<` zzfxa5;rUc6S)bRsYQ3Ce#d9C3CC%jA*3_1K>+jlH=lF(RJ#2|MU%Bs~jqgERY2q0r z#<4H)n~bOxC%LXIb3GCD_x!8-qptmj)^*DrQM)8Oe@9<95a!BvUO92g`_&AJiFh7y v=5n6m)LNfGw3+AqOWnwke_jFK??5*jv7ZB9pTK+%JRV2LS6(nr8fkw4ZohQo diff --git a/webpack.config.js b/webpack.config.js index d9cf9b1..3267e38 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,13 +14,9 @@ module.exports = { }, { test: /\.svg$/, - exclude: /node_modules/, - use: { - loader: 'svg-react-loader', - options: { - jsx: true, - }, - }, + issuer: /\.tsx?$/, + use: [ '@svgr/webpack', 'url-loader' ], + type: 'javascript/auto', }, { test: /\.scss$/,