diff --git a/.distignore b/.distignore index b3ee597..9069eba 100644 --- a/.distignore +++ b/.distignore @@ -29,7 +29,6 @@ bower.json bower_components .* - # Test related files phpunit.xml phpunit.xml.dist @@ -42,7 +41,6 @@ codeception.yml phpcs.xml phpcs.xml.dist - # IDE related files .idea *.iml @@ -61,7 +59,6 @@ phpcs.xml.dist *.zip /bin/ - # OS related files .DS_Store .DS_Store? @@ -71,7 +68,6 @@ phpcs.xml.dist ehthumbs.db Thumbs.db - # Action related files .wordpress-org @@ -80,8 +76,7 @@ Thumbs.db *.*.map # Build related files -/assets/js -/assets/css +src /src/js /src/css vendor diff --git a/Gruntfile.js b/Gruntfile.js index b0c0b5f..dc7787c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -90,4 +90,4 @@ module.exports = function( grunt ) { grunt.registerTask( 'i18n', [ 'addtextdomain', 'checktextdomain', 'makepot' ] ); grunt.registerTask( 'build', [ 'i18n' ] ); -}; \ No newline at end of file +}; diff --git a/assets/src/css/_form.scss b/assets/src/css/_form.scss new file mode 100644 index 0000000..4e0398b --- /dev/null +++ b/assets/src/css/_form.scss @@ -0,0 +1,59 @@ +#insertcodes-form{ + width: 100%; + .field-group{ + border-bottom: 1px solid #ddd; + display: flex; + flex-direction: row; + padding: 1rem; + gap: 0.313rem ; + .field-label{ + display: flex; + width: 100%; + max-width: 11.25rem; + } + label, + strong{ + align-self: center; + } + .field{ + width: 100%; + .description{ + margin-top: 0.313rem; + } + } + .field-submit-btn{ + width: 100%; + } + &.is-last-item{ + border-bottom: none; + a{ + align-self: center; + } + } + &.filed-section{ + flex-direction: column; + gap: 0.625rem; + background: #dddddd; + } + &.field-editor{ + flex-direction: column; + gap: 0.625rem; + .CodeMirror{ + border: 1px solid #ddd; + } + } + } + input[type=text], + input[type=email], + input[type=password], + input[type=number], + input[type=date], + input[type=datetime], + input[type=datetime-local], + input[type=month], + textarea { + width: 100%; + padding: 0.313rem 0.5rem; + border: 1px solid #ddd; + } +} diff --git a/src/css/admin.scss b/assets/src/css/insertcodes-admin.scss similarity index 75% rename from src/css/admin.scss rename to assets/src/css/insertcodes-admin.scss index b4e12ab..4f430fc 100644 --- a/src/css/admin.scss +++ b/assets/src/css/insertcodes-admin.scss @@ -1,21 +1,21 @@ @import "form"; // Page Layouts. -.insert-codes-container{ - .insert-codes__header{} - .insert-codes__body{ +.insertcodes-container{ + .insertcodes__header{} + .insertcodes__body{ display: flex; flex-wrap: nowrap; gap: 1.25rem; h3, h4, p{ margin: 0; } - .insert-codes__content{ + .insertcodes__content{ width: 70%; border: 1px solid #ddd; background: #fff; } - .insert-codes__aside{ + .insertcodes__aside{ width: 30%; .aside__item{ border: 1px solid #ddd; @@ -33,8 +33,8 @@ } @media (max-width: 782px) { flex-direction: column; - .insert-codes__content, - .insert-codes__aside{ + .insertcodes__content, + .insertcodes__aside{ width: 100%; } } diff --git a/assets/src/js/insertcodes-admin.js b/assets/src/js/insertcodes-admin.js new file mode 100644 index 0000000..1922d4c --- /dev/null +++ b/assets/src/js/insertcodes-admin.js @@ -0,0 +1,19 @@ +(function ($) { + 'use strict'; + $(window).on('load', function () { + $.ready.then(function () { + var defaultSettings = wp.codeEditor.defaultSettings ? _.clone(wp.codeEditor.defaultSettings) : {}; + + // HTML Editor. + var htmlSettings = _.extend({}, defaultSettings, { + codemirror: _.extend({}, defaultSettings.codemirror, { + mode: 'htmlmixed' + }) + }); + + wp.codeEditor.initialize($('#insertcodes_header'), htmlSettings); + wp.codeEditor.initialize($('#insertcodes_body'), htmlSettings); + wp.codeEditor.initialize($('#insertcodes_footer'), htmlSettings); + }); + }); +})(jQuery); diff --git a/includes/Admin/Admin.php b/includes/Admin/Admin.php index 39a9025..792d65e 100644 --- a/includes/Admin/Admin.php +++ b/includes/Admin/Admin.php @@ -2,7 +2,7 @@ namespace InsertCodes\Admin; -defined( 'ABSPATH' ) || exit; +defined( 'ABSPATH' ) || exit; // Exit if accessed directly. /** * Class Admin. @@ -99,8 +99,8 @@ public function enqueue_scripts( $hook ) { 'insert-codes_page_insert-codes-settings', ); - wp_register_style( 'insert-codes-admin', INSERT_CODES_URL . 'assets/dist/css/insert-codes-admin.css', array(), '1.0.0' ); - wp_register_script( 'insert-codes-admin', INSERT_CODES_URL . 'assets/dist/js/insert-codes-admin.js', array( 'jquery' ), '1.0.0', true ); + wp_register_style( 'insertcodes-admin', INSERTCODES_URL . 'assets/dist/css/insertcodes-admin.css', array(), INSERTCODES_VERSION ); + wp_register_script( 'insertcodes-admin', INSERTCODES_URL . 'assets/dist/js/insertcodes-admin.js', array( 'jquery' ), INSERTCODES_VERSION, true ); if ( 'toplevel_page_insert-codes' === $hook ) { $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); @@ -110,11 +110,11 @@ public function enqueue_scripts( $hook ) { return; } - wp_enqueue_script( 'insert-codes-admin' ); + wp_enqueue_script( 'insertcodes-admin' ); } if ( in_array( $hook, $screens, true ) ) { - wp_enqueue_style( 'insert-codes-admin' ); + wp_enqueue_style( 'insertcodes-admin' ); } } } diff --git a/includes/Admin/views/codes.php b/includes/Admin/views/codes.php index 3cd8487..3e7a57b 100644 --- a/includes/Admin/views/codes.php +++ b/includes/Admin/views/codes.php @@ -1,6 +1,6 @@ -
-
-
+
+
+


-
-
-
+
+
+

- +
- +

' ) ) ); ?>

- +
- +

' ) ) ); ?>

- +
- +

' ) ) ); ?>

- - + +
-
+

diff --git a/includes/Admin/views/settings.php b/includes/Admin/views/settings.php index 91adae0..77f02ff 100644 --- a/includes/Admin/views/settings.php +++ b/includes/Admin/views/settings.php @@ -9,18 +9,18 @@ defined( 'ABSPATH' ) || exit; // Exit if accessed directly. ?> -
-
-
+
+
+


-
-
-
+
+
+

@@ -28,30 +28,30 @@
- +
- +

' ) ) ); ?>

- +
- +

' ) ) ); ?>

- +
- +

' ) ) ); ?>

@@ -66,8 +66,8 @@
-
- - + +
-
+

diff --git a/includes/Controllers/Actions.php b/includes/Controllers/Actions.php index ebe47dc..165f30c 100644 --- a/includes/Controllers/Actions.php +++ b/includes/Controllers/Actions.php @@ -2,7 +2,7 @@ namespace InsertCodes\Controllers; -defined( 'ABSPATH' ) || exit; +defined( 'ABSPATH' ) || exit; // Exit if accessed directly. /** * Actions class. @@ -16,8 +16,8 @@ class Actions { * Constructor. */ public function __construct() { - add_action( 'admin_post_insert_codes_hbf_scripts', array( __CLASS__, 'handle_hbf_scripts' ) ); - add_action( 'admin_post_insert_codes_settings', array( __CLASS__, 'handle_settings' ) ); + add_action( 'admin_post_insertcodes_hbf_scripts', array( __CLASS__, 'handle_hbf_scripts' ) ); + add_action( 'admin_post_insertcodes_settings', array( __CLASS__, 'handle_settings' ) ); } /** @@ -27,18 +27,18 @@ public function __construct() { * @return void */ public static function handle_hbf_scripts() { - check_admin_referer( 'insert_codes_hbf_scripts' ); + check_admin_referer( 'insertcodes_hbf_scripts' ); - $header_scripts = isset( $_POST['insert_codes_header'] ) ? wp_kses( wp_unslash( $_POST['insert_codes_header'] ), insert_codes_get_allowed_html() ) : ''; - $body_scripts = isset( $_POST['insert_codes_body'] ) ? wp_kses( wp_unslash( $_POST['insert_codes_body'] ), insert_codes_get_allowed_html() ) : ''; - $footer_scripts = isset( $_POST['insert_codes_footer'] ) ? wp_kses( wp_unslash( $_POST['insert_codes_footer'] ), insert_codes_get_allowed_html() ) : ''; + $header_scripts = isset( $_POST['insertcodes_header'] ) ? wp_kses( wp_unslash( $_POST['insertcodes_header'] ), insertcodes_get_allowed_html() ) : ''; + $body_scripts = isset( $_POST['insertcodes_body'] ) ? wp_kses( wp_unslash( $_POST['insertcodes_body'] ), insertcodes_get_allowed_html() ) : ''; + $footer_scripts = isset( $_POST['insertcodes_footer'] ) ? wp_kses( wp_unslash( $_POST['insertcodes_footer'] ), insertcodes_get_allowed_html() ) : ''; // Updating options. - update_option( 'insert_codes_header', $header_scripts ); - update_option( 'insert_codes_body', $body_scripts ); - update_option( 'insert_codes_footer', $footer_scripts ); + update_option( 'insertcodes_header', $header_scripts ); + update_option( 'insertcodes_body', $body_scripts ); + update_option( 'insertcodes_footer', $footer_scripts ); - insert_codes()->add_flash_notice( __( 'Codes saved successfully.', 'insert-codes' ) ); + insertcodes()->add_flash_notice( __( 'Codes saved successfully.', 'insert-codes' ) ); wp_safe_redirect( wp_get_referer() ); exit(); } @@ -50,20 +50,20 @@ public static function handle_hbf_scripts() { * @return void */ public static function handle_settings() { - check_admin_referer( 'insert_codes_settings' ); + check_admin_referer( 'insertcodes_settings' ); - $headers_priority = isset( $_POST['insert_codes_header_priority'] ) ? intval( wp_unslash( $_POST['insert_codes_header_priority'] ) ) : intval( '10' ); - $body_priority = isset( $_POST['insert_codes_body_priority'] ) ? intval( wp_unslash( $_POST['insert_codes_body_priority'] ) ) : intval( '10' ); - $footers_priority = isset( $_POST['insert_codes_footer_priority'] ) ? intval( wp_unslash( $_POST['insert_codes_footer_priority'] ) ) : intval( '10' ); - $is_delete_data = isset( $_POST['insert_codes_delete_data'] ) ? sanitize_key( wp_unslash( $_POST['insert_codes_delete_data'] ) ) : ''; + $headers_priority = isset( $_POST['insertcodes_header_priority'] ) ? intval( wp_unslash( $_POST['insertcodes_header_priority'] ) ) : intval( '10' ); + $body_priority = isset( $_POST['insertcodes_body_priority'] ) ? intval( wp_unslash( $_POST['insertcodes_body_priority'] ) ) : intval( '10' ); + $footers_priority = isset( $_POST['insertcodes_footer_priority'] ) ? intval( wp_unslash( $_POST['insertcodes_footer_priority'] ) ) : intval( '10' ); + $is_delete_data = isset( $_POST['insertcodes_delete_data'] ) ? sanitize_key( wp_unslash( $_POST['insertcodes_delete_data'] ) ) : ''; // Updating options. - update_option( 'insert_codes_header_priority', $headers_priority ); - update_option( 'insert_codes_body_priority', $body_priority ); - update_option( 'insert_codes_footer_priority', $footers_priority ); - update_option( 'insert_codes_delete_data', $is_delete_data ); + update_option( 'insertcodes_header_priority', $headers_priority ); + update_option( 'insertcodes_body_priority', $body_priority ); + update_option( 'insertcodes_footer_priority', $footers_priority ); + update_option( 'insertcodes_delete_data', $is_delete_data ); - insert_codes()->add_flash_notice( __( 'Settings saved successfully.', 'insert-codes' ) ); + insertcodes()->add_flash_notice( __( 'Settings saved successfully.', 'insert-codes' ) ); wp_safe_redirect( wp_get_referer() ); exit(); } diff --git a/includes/Frontend/Frontend.php b/includes/Frontend/Frontend.php index 910296e..3a79bd9 100644 --- a/includes/Frontend/Frontend.php +++ b/includes/Frontend/Frontend.php @@ -26,13 +26,13 @@ public function __construct() { * @return void */ public function init() { - $header_priority = intval( get_option( 'insert_codes_header_priority' ) ); - $body_priority = intval( get_option( 'insert_codes_body_priority' ) ); - $footer_priority = intval( get_option( 'insert_codes_footer_priority' ) ); + $header_priority = absint( get_option( 'insertcodes_header_priority', 10 ) ); + $body_priority = absint( get_option( 'insertcodes_body_priority', 10 ) ); + $footer_priority = absint( get_option( 'insertcodes_footer_priority', 10 ) ); - add_action( 'wp_head', array( $this, 'insert_codes_into_head' ), $header_priority ); - add_action( 'wp_body_open', array( $this, 'insert_codes_into_body' ), $body_priority ); - add_action( 'wp_footer', array( $this, 'insert_codes_into_footer' ), $footer_priority ); + add_action( 'wp_head', array( $this, 'insert_into_head' ), $header_priority ); + add_action( 'wp_body_open', array( $this, 'insert_into_body' ), $body_priority ); + add_action( 'wp_footer', array( $this, 'insert_into_footer' ), $footer_priority ); } /** @@ -41,8 +41,8 @@ public function init() { * @since 1.0.0 * @return void */ - public function insert_codes_into_head() { - echo wp_kses( get_option( 'insert_codes_header' ), insert_codes_get_allowed_html() ); + public function insert_into_head() { + echo wp_kses( get_option( 'insertcodes_header' ), insertcodes_get_allowed_html() ); } /** @@ -52,8 +52,8 @@ public function insert_codes_into_head() { * @since 1.0.0 * @return void */ - public function insert_codes_into_body() { - echo wp_kses( get_option( 'insert_codes_body' ), insert_codes_get_allowed_html() ); + public function insert_into_body() { + echo wp_kses( get_option( 'insertcodes_body' ), insertcodes_get_allowed_html() ); } /** @@ -62,7 +62,7 @@ public function insert_codes_into_body() { * @since 1.0.0 * @return void */ - public function insert_codes_into_footer() { - echo wp_kses( get_option( 'insert_codes_footer' ), insert_codes_get_allowed_html() ); + public function insert_into_footer() { + echo wp_kses( get_option( 'insertcodes_footer' ), insertcodes_get_allowed_html() ); } } diff --git a/includes/Plugin.php b/includes/Plugin.php index 5ad693d..58bf0dc 100644 --- a/includes/Plugin.php +++ b/includes/Plugin.php @@ -75,11 +75,11 @@ public function __construct( $file, $version ) { * @return void */ private function define_constants() { - define( 'INSERT_CODES_VERSION', $this->version ); - define( 'INSERT_CODES_FILE', $this->file ); - define( 'INSERT_CODES_PATH', plugin_dir_path( $this->file ) ); - define( 'INSERT_CODES_URL', plugin_dir_url( $this->file ) ); - define( 'INSERT_CODES_ASSETS_URL', INSERT_CODES_URL . 'assets/' ); + define( 'INSERTCODES_VERSION', $this->version ); + define( 'INSERTCODES_FILE', $this->file ); + define( 'INSERTCODES_PATH', plugin_dir_path( $this->file ) ); + define( 'INSERTCODES_URL', plugin_dir_url( $this->file ) ); + define( 'INSERTCODES_ASSETS_URL', INSERTCODES_URL . 'assets/' ); } /** @@ -99,7 +99,7 @@ public function includes() { * @return void */ private function init_hooks() { - register_activation_hook( INSERT_CODES_FILE, array( $this, 'activate' ) ); + register_activation_hook( INSERTCODES_FILE, array( $this, 'activate' ) ); add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) ); add_action( 'admin_notices', array( $this, 'display_flash_notices' ), 12 ); add_action( 'init', array( $this, 'init' ), 0 ); @@ -112,10 +112,10 @@ private function init_hooks() { * @return void */ public function activate() { - update_option( 'insert_codes_version', INSERT_CODES_VERSION ); - update_option( 'insert_codes_header_priority', 10 ); - update_option( 'insert_codes_body_priority', 10 ); - update_option( 'insert_codes_footer_priority', 10 ); + update_option( 'insertcodes_version', INSERTCODES_VERSION ); + update_option( 'insertcodes_header_priority', 10 ); + update_option( 'insertcodes_body_priority', 10 ); + update_option( 'insertcodes_footer_priority', 10 ); } /** @@ -125,29 +125,7 @@ public function activate() { * @return void */ public function load_textdomain() { - load_plugin_textdomain( 'insert-codes', false, dirname( plugin_basename( INSERT_CODES_FILE ) ) . '/languages/' ); - } - - /** - * Check if the plugin is active. - * - * @param string $plugin The plugin slug or basename. - * - * @since 1.0.0 - * @return bool - */ - public function is_plugin_active( $plugin ) { - // Check if the $plugin is a basename or a slug. If it's a slug, convert it to a basename. - if ( false === strpos( $plugin, '/' ) ) { - $plugin = $plugin . '/' . $plugin . '.php'; - } - - $active_plugins = (array) get_option( 'active_plugins', array() ); - if ( is_multisite() ) { - $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); - } - - return in_array( $plugin, $active_plugins, true ) || array_key_exists( $plugin, $active_plugins ); + load_plugin_textdomain( 'insert-codes', false, dirname( plugin_basename( INSERTCODES_FILE ) ) . '/languages/' ); } /** @@ -161,7 +139,7 @@ public function is_plugin_active( $plugin ) { * @return void */ public function add_flash_notice( $notice = '', $type = 'success', $dismissible = true ) { - $notices = get_option( 'insert_codes_flash_notices', array() ); + $notices = get_option( 'insertcodes_flash_notices', array() ); $dismissible_text = ( $dismissible ) ? 'is-dismissible' : ''; // Add new notice. @@ -175,7 +153,7 @@ public function add_flash_notice( $notice = '', $type = 'success', $dismissible ); // Update the notices array. - update_option( 'insert_codes_flash_notices', $notices ); + update_option( 'insertcodes_flash_notices', $notices ); } /** @@ -185,7 +163,7 @@ public function add_flash_notice( $notice = '', $type = 'success', $dismissible * @return void */ public function display_flash_notices() { - $notices = get_option( 'insert_codes_flash_notices', array() ); + $notices = get_option( 'insertcodes_flash_notices', array() ); foreach ( $notices as $notice ) { printf( @@ -198,7 +176,7 @@ public function display_flash_notices() { // Reset options to prevent notices being displayed forever. if ( ! empty( $notices ) ) { - delete_option( 'insert_codes_flash_notices', array() ); + delete_option( 'insertcodes_flash_notices', array() ); } } @@ -209,8 +187,13 @@ public function display_flash_notices() { * @return void */ public function init() { - new Admin\Admin(); - new Controllers\Actions(); + // Load admin classes. + if ( is_admin() ) { + new Admin\Admin(); + new Controllers\Actions(); + } + + // Load frontend classes. new Frontend\Frontend(); } } diff --git a/includes/functions.php b/includes/functions.php index 7c1f23c..96dfae1 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1,6 +1,6 @@ array( 'type' => array(), diff --git a/insert-codes.php b/insert-codes.php index 455c5cf..0a3bbc9 100644 --- a/insert-codes.php +++ b/insert-codes.php @@ -1,16 +1,18 @@ %s. It is likely that " +"this was caused by a permissions problem." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:213 +msgid "" +"This WXR file (version %s) may not be supported by this version of the " +"importer. Please consider updating." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:238 +msgid "" +"Failed to import author %s. Their posts will be attributed to the current " +"user." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:264 +msgid "Assign Authors" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:265 +msgid "" +"To make it easier for you to edit and save the imported content, you may " +"want to reassign the author of the imported item to an existing user of " +"this site. For example, you may want to import all the entries as " +"admins entries." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:267 +msgid "" +"If a new user is created by WordPress, a new password will be randomly " +"generated and the new user’s role will be set as %s. Manually " +"changing the new user’s details will be necessary." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:277 +msgid "Import Attachments" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:280 +msgid "Download and import file attachments" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:284 +msgid "Submit" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:297 +msgid "Import author:" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:308 +msgid "or create new user with login name:" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:311 +msgid "as a new user:" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:319 +msgid "assign posts to an existing user:" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:321 +msgid "or assign posts to an existing user:" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:322 +msgid "- Select -" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:372 +msgid "" +"Failed to create new user for %s. Their posts will be attributed to the " +"current user." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:424 +msgid "Failed to import category %s" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:467 +msgid "Failed to import post tag %s" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:516 +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:738 +msgid "Failed to import %s %s" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:605 +msgid "Failed to import “%s”: Invalid post type %s" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:642 +msgid "%s “%s” already exists." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:704 +msgid "Failed to import %s “%s”" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:869 +msgid "Menu item skipped due to missing menu slug" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:876 +msgid "Menu item skipped due to invalid menu slug: %s" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:939 +msgid "Fetching attachments is not enabled" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:952 +msgid "Invalid file type" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:996 +msgid "Remote server did not respond" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1002 +msgid "Remote server returned error response %1$d %2$s" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1009 +msgid "Remote file is incorrect size" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1014 +msgid "Zero size file downloaded" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1020 +msgid "Remote file is too large, limit is %s" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1119 +msgid "Import WordPress" +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1126 +msgid "" +"A new version of this importer is available. Please update to version %s to " +"ensure compatibility with newer export files." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1141 +msgid "" +"Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import " +"the posts, pages, comments, custom fields, categories, and tags into this " +"site." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1142 +msgid "Choose a WXR (.xml) file to upload, then click Upload file and import." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1216 +msgid "" +"Import posts, pages, comments, custom fields, categories, and " +"tags from a WordPress export file." +msgstr "" + +#: vendor/lucatume/wp-browser/src/data/themedir1/internationalized-theme/functions.php:7 +msgid "This is a dummy theme" +msgstr "" + +#: vendor/wp-cli/core-command/src/Core_Command.php:749 +msgid "Wildcard DNS may not be configured correctly." +msgstr "" + +#: vendor/wp-cli/entity-command/src/Site_Command.php:157 +msgid "Uncategorized" +msgstr "" + +#: vendor/wp-cli/export-command/src/WP_Export_XML_Over_HTTP.php:20 +#: vendor/wp-cli/export-command/src/WP_Export_XML_Over_HTTP.php:25 +msgid "Export Error" +msgstr "" + +#: vendor/wp-cli/extension-command/src/WP_CLI/CommandWithUpgrade.php:770 +msgid " Try again" +msgstr "" + +#: vendor/wp-cli/extension-command/src/WP_CLI/CommandWithUpgrade.php:776 +msgid "API error. Try Again." +msgstr "" + +#: vendor/wp-cli/media-command/src/Media_Command.php:159 +msgid "image" +msgid_plural "images" +msgstr[0] "" +msgstr[1] "" + +#: vendor/wp-cli/wp-cli/php/utils-wp.php:247 +msgid "Inactive Widgets" +msgstr "" + +#: vendor/wp-cli/wp-cli/php/utils-wp.php:250 +msgid "Drag widgets here to remove them from the sidebar but keep their settings." +msgstr "" + #. Plugin Name of the plugin/theme msgid "Insert Codes - Headers And Footers Code Snippet" msgstr "" @@ -167,4 +420,18 @@ msgstr "" #. Author URI of the plugin/theme msgid "https://urldev.com" +msgstr "" + +#: vendor/wp-cli/core-command/src/Core_Command.php:491 +#: vendor/wp-cli/core-command/src/Core_Command.php:565 +#. translators: placeholder is blog name +#. translators: placeholder is user supplied title +msgctxt "Default network name" +msgid "%s Sites" +msgstr "" + +#: vendor/wp-cli/entity-command/src/Site_Command.php:160 +#. translators: Default category slug +msgctxt "Default category slug" +msgid "Uncategorized" msgstr "" \ No newline at end of file diff --git a/readme.txt b/readme.txt index 31c3149..cba9e7f 100644 --- a/readme.txt +++ b/readme.txt @@ -2,10 +2,10 @@ Contributors: urldev Tags: insert codes, insert headers and footers, insert header, insert footer, code snippet Requires at least: 5.0 -Tested up to: 6.5 -Requires PHP: 5.6 +Tested up to: 6.6 Stable tag: 1.0.0 -License: GPL-2.0-or-later +Requires PHP: 7.4 +License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Easily insert codes to the header, body, and footer sections of your WordPress website. @@ -80,9 +80,9 @@ A: The impact on performance is minimal as the plugin inserts the scripts direct For developers, this plugin provides hooks and filters to extend its functionality. Refer to the plugin documentation for more details. = Hooks & Filters = -* insert_codes_header_scripts: Filter the header scripts before they are output. -* insert_codes_body_scripts: Filter the body scripts before they are output. -* insert_codes_footer_scripts: Filter the footer scripts before they are output. +* insertcodes_header_scripts: Filter the header scripts before they are output. +* insertcodes_body_scripts: Filter the body scripts before they are output. +* insertcodes_footer_scripts: Filter the footer scripts before they are output. = License = This plugin is licensed under the GPLv2 or later. You are free to modify and distribute it under the terms of the license. diff --git a/src/css/_form.scss b/src/css/_form.scss index 272fe0c..4e0398b 100644 --- a/src/css/_form.scss +++ b/src/css/_form.scss @@ -1,4 +1,4 @@ -#insert-codes-form{ +#insertcodes-form{ width: 100%; .field-group{ border-bottom: 1px solid #ddd; diff --git a/src/css/insertcodes-admin.scss b/src/css/insertcodes-admin.scss new file mode 100644 index 0000000..4f430fc --- /dev/null +++ b/src/css/insertcodes-admin.scss @@ -0,0 +1,42 @@ +@import "form"; + +// Page Layouts. +.insertcodes-container{ + .insertcodes__header{} + .insertcodes__body{ + display: flex; + flex-wrap: nowrap; + gap: 1.25rem; + h3, h4, p{ + margin: 0; + } + .insertcodes__content{ + width: 70%; + border: 1px solid #ddd; + background: #fff; + } + .insertcodes__aside{ + width: 30%; + .aside__item{ + border: 1px solid #ddd; + background: #fff; + margin-bottom: 1rem; + } + .aside__item__header{ + border-bottom: 1px solid #ddd; + padding: 1rem; + background: #dddddd; + } + .aside__item__body{ + padding: 0 1rem; + } + } + @media (max-width: 782px) { + flex-direction: column; + .insertcodes__content, + .insertcodes__aside{ + width: 100%; + } + } + } +} diff --git a/src/js/admin.js b/src/js/admin.js deleted file mode 100644 index 5d2913e..0000000 --- a/src/js/admin.js +++ /dev/null @@ -1,41 +0,0 @@ -(function ($) { - 'use strict'; - - $(window).on('load', function () { - $.ready.then(function () { - - // wp.codeEditor.initialize($('[id="wpheaderandfooter_basics[wp_header_textarea]"]')); - // wp.codeEditor.initialize($('[id="wpheaderandfooter_basics[wp_body_textarea]"]')); - // wp.codeEditor.initialize($('[id="wpheaderandfooter_basics[wp_footer_textarea]"]')); - - var defaultSettings = wp.codeEditor.defaultSettings ? _.clone(wp.codeEditor.defaultSettings) : {}; - - // HTML Editor - var htmlSettings = _.extend({}, defaultSettings, { - codemirror: _.extend({}, defaultSettings.codemirror, { - mode: 'htmlmixed' - }) - }); - wp.codeEditor.initialize($('#insert_codes_header'), htmlSettings); - wp.codeEditor.initialize($('#insert_codes_body'), htmlSettings); - wp.codeEditor.initialize($('#insert_codes_footer'), htmlSettings); - - // PHP Editor - var phpSettings = _.extend({}, defaultSettings, { - codemirror: _.extend({}, defaultSettings.codemirror, { - mode: 'application/x-httpd-php' // Or use "php" instead. - }) - }); - // wp.codeEditor.initialize($('#ic_php_editor'), phpSettings); - - // JS Editor - var jsSettings = _.extend({}, defaultSettings, { - codemirror: _.extend({}, defaultSettings.codemirror, { - mode: 'javascript' - }) - }); - // wp.codeEditor.initialize($('#ic_js_editor'), jsSettings); - }); - }); - -})(jQuery); diff --git a/src/js/insertcodes-admin.js b/src/js/insertcodes-admin.js new file mode 100644 index 0000000..1922d4c --- /dev/null +++ b/src/js/insertcodes-admin.js @@ -0,0 +1,19 @@ +(function ($) { + 'use strict'; + $(window).on('load', function () { + $.ready.then(function () { + var defaultSettings = wp.codeEditor.defaultSettings ? _.clone(wp.codeEditor.defaultSettings) : {}; + + // HTML Editor. + var htmlSettings = _.extend({}, defaultSettings, { + codemirror: _.extend({}, defaultSettings.codemirror, { + mode: 'htmlmixed' + }) + }); + + wp.codeEditor.initialize($('#insertcodes_header'), htmlSettings); + wp.codeEditor.initialize($('#insertcodes_body'), htmlSettings); + wp.codeEditor.initialize($('#insertcodes_footer'), htmlSettings); + }); + }); +})(jQuery); diff --git a/uninstall.php b/uninstall.php index 32275fb..ebf7105 100644 --- a/uninstall.php +++ b/uninstall.php @@ -16,7 +16,7 @@ * @since 1.0.0 * @return void */ -function insert_codes_delete_options( $prefix ) { +function insertcodes_delete_options( $prefix ) { // Retrieve all options. $all_options = wp_load_alloptions(); @@ -28,11 +28,11 @@ function insert_codes_delete_options( $prefix ) { } } -if ( 'yes' === get_option( 'insert_codes_delete_data' ) ) { - $option_prefix = 'insert_codes_'; +if ( 'yes' === get_option( 'insertcodes_delete_data' ) ) { + $option_prefix = 'insertcodes_'; // Delete options for the main site. - insert_codes_delete_options( $option_prefix ); + insertcodes_delete_options( $option_prefix ); // Delete options in a multisite network. if ( is_multisite() ) { @@ -40,7 +40,7 @@ function insert_codes_delete_options( $prefix ) { foreach ( $sites as $site ) { switch_to_blog( $site->blog_id ); - insert_codes_delete_options( $option_prefix ); + insertcodes_delete_options( $option_prefix ); restore_current_blog(); } } diff --git a/webpack.config.js b/webpack.config.js index 33c33a3..77c2f9a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,8 +6,8 @@ module.exports = [ ...defaultConfig, entry: { ...defaultConfig.entry(), - 'css/insert-codes-admin': './src/css/admin.scss', - 'js/insert-codes-admin': './src/js/admin.js', + 'css/insertcodes-admin': './src/css/insertcodes-admin.scss', + 'js/insertcodes-admin': './src/js/insertcodes-admin.js', }, output: { ...defaultConfig.output,