Skip to content

Commit

Permalink
Merge pull request #40 from michelegiorgi/development
Browse files Browse the repository at this point in the history
release 1.5
  • Loading branch information
michelegiorgi authored Jan 8, 2022
2 parents 6145061 + 5d13fe3 commit 452df39
Show file tree
Hide file tree
Showing 173 changed files with 4,669 additions and 4,051 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ module.exports = {
node: true,
es6: true,
amd: true,
browser: true,
jquery: true
browser: true
},
parserOptions: {
ecmaFeatures: {
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ node_modules
npm-debug.log
yarn-error.log
package-lock.json
assets/config-local.json
languages/.po~
.nova
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2018-2021, Michele Giorgi
Copyright (C) 2018-2022, Michele Giorgi

GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If you are not a developer, please download the latest release of the Formality

## Requirements

* [WordPress](https://wordpress.org/) >= 5.7
* [WordPress](https://wordpress.org/) >= 5.8

## Plugin setup

Expand Down
4 changes: 2 additions & 2 deletions admin/class-formality-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private function load_dependencies() {

public function enqueue_assets() {
wp_enqueue_style( $this->formality . "-admin", plugin_dir_url(__DIR__) . 'dist/styles/formality-admin.css', array(), $this->version, 'all' );
wp_enqueue_script( $this->formality . "-admin", plugin_dir_url(__DIR__) . 'dist/scripts/formality-admin.js', array('jquery', 'wp-i18n'), $this->version, false );
wp_enqueue_script( $this->formality . "-admin", plugin_dir_url(__DIR__) . 'dist/scripts/formality-admin.js', array('wp-i18n'), $this->version, false );
wp_set_script_translations( $this->formality . "-admin", 'formality', plugin_dir_path( __DIR__ ) . 'languages' );
}

Expand Down Expand Up @@ -142,7 +142,7 @@ public function admin_header() {
<a href="<?php echo admin_url('post-new.php?post_type='.$typenow); ?>" class="page-title-action"><?php echo $labels->add_new; ?></a>
<?php $welcome = get_option('formality_welcome'); ?>
<a class="formality-welcome-toggle <?php echo $welcome ? 'close' : 'open'; ?>" href="<?php echo $plugin_tools->toggle_panel_link_url(); ?>"><span><?php _e('Hide panel', 'formality'); ?></span><span><?php _e('Show panel', 'formality'); ?></span></a>
<div class="welcome-panel<?php echo $welcome ? '' : ' hidden'; ?>">
<div class="welcome-old<?php echo $welcome ? '' : ' hidden'; ?>">
<a class="welcome-panel-close formality-welcome-toggle" href="<?php echo $plugin_tools->toggle_panel_link_url(false); ?>"><?php _e('Hide panel', 'formality'); ?></a>
<div class="welcome-panel-content">
<h2><?php _e('Welcome to Formality!', 'formality'); ?></h2>
Expand Down
23 changes: 14 additions & 9 deletions admin/class-formality-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public function get_allowed( $type = 'blocks' ) {
'_formality_logo' => 'string',
'_formality_logo_id' => 'integer',
'_formality_logo_height' => 'integer',
'_formality_border_radius' => 'integer',
'_formality_bg' => 'string',
'_formality_bg_id' => 'integer',
'_formality_bg_layout' => 'string',
Expand Down Expand Up @@ -189,6 +190,7 @@ public function count_templates() {
}

public function download_templates() {
update_option('formality_templates', 0, 'yes');
$disable_ssl = isset($_POST['disableSSL']) && $_POST['disableSSL']=="1";
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/image.php');
Expand All @@ -198,9 +200,14 @@ public function download_templates() {
$upload_dir = $upload['basedir'] . '/formality/templates';
if(! is_dir($upload_dir)) { wp_mkdir_p( $upload_dir ); }

$templates_file = wp_remote_get(plugin_dir_url(__DIR__) . "dist/images/templates.json");
if(is_array( $templates_file ) && ! is_wp_error( $templates_file ) && $templates_file['response']['code'] !== '404' ) {
$templates = json_decode($templates_file['body'], true);
$templates_path = plugin_dir_path(__DIR__) . "dist/images/templates.json";
ob_start();
include($templates_path);
$templates_file = ob_get_contents();
ob_end_clean();

if($templates_file) {
$templates = json_decode($templates_file, true);
$images = array();
if(is_array($templates)) {
foreach($templates as $template) {
Expand Down Expand Up @@ -242,25 +249,23 @@ public function download_templates() {
} else {
error_log('Formality - ' . $editor->get_error_message());
}
update_option( 'formality_templates', $count, 'yes');
update_option('formality_templates', $count, 'yes');
}
@unlink($temp);
}
}
}
$response['count'] = $count;
update_option( 'formality_templates', $count, 'yes');
update_option('formality_templates', $count, 'yes');
return $response;
}

public function unsplash_disable_ssl($ssl_verify, $url) {
if(substr($url, 0, 27) === 'https://source.unsplash.com') { return false; }
return true;
return substr($url, 0, 27) === 'https://source.unsplash.com' ? false : true;
}

public function prevent_classic_editor($can_edit, $post) {
if ('formality_form' === $post) return true;
return $can_edit;
return 'formality_form' === $post ? true : $can_edit;
}

public function remove_3rdparty_styles($screen) {
Expand Down
Empty file removed assets/fonts/.gitkeep
Empty file.
Binary file removed assets/fonts/MaterialIcons-Regular.ttf
Binary file not shown.
Binary file removed assets/fonts/MaterialIcons-Regular.woff
Binary file not shown.
Binary file removed assets/fonts/MaterialIcons-Regular.woff2
Binary file not shown.
Binary file removed assets/fonts/formality.eot
Binary file not shown.
1 change: 0 additions & 1 deletion assets/fonts/formality.json

This file was deleted.

21 changes: 21 additions & 0 deletions assets/fonts/formality.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/fonts/formality.ttf
Binary file not shown.
Binary file modified assets/fonts/formality.woff
Binary file not shown.
Binary file added assets/fonts/formality.woff2
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions assets/fonts/source/arrow_back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/arrow_downward.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/arrow_drop_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/arrow_drop_up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/arrow_forward.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/arrow_upward.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/cancel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/check_circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/cloud_upload.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/fonts/source/drag_indicator.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading

0 comments on commit 452df39

Please sign in to comment.