-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from michelegiorgi/development
release 1.3
- Loading branch information
Showing
69 changed files
with
2,010 additions
and
1,465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* The admin-specific functionality of the plugin. | ||
* | ||
* @link https://formality.dev | ||
* @since 1.0.0 | ||
* @since 1.0 | ||
* @package Formality | ||
* @subpackage Formality/admin | ||
* @author Michele Giorgi <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* The editor-specific functionality of the plugin. | ||
* | ||
* @link https://formality.dev | ||
* @since 1.0.0 | ||
* @since 1.0 | ||
* @package Formality | ||
* @subpackage Formality/admin | ||
* @author Michele Giorgi <[email protected]> | ||
|
@@ -41,17 +41,28 @@ public function register_blocks() { | |
|
||
public function enqueue_scripts() { | ||
$upload = wp_upload_dir(); | ||
$formats = array(); | ||
$mimes = get_allowed_mime_types(); | ||
$maxsize = wp_max_upload_size() / 1048576; | ||
if(!empty($mimes)) { | ||
foreach ($mimes as $type => $mime) { | ||
$multiple = explode("|", $type); | ||
foreach ($multiple as $single) { | ||
$formats[] = $single; | ||
} | ||
} | ||
} | ||
wp_enqueue_script( $this->formality . "-editor", plugin_dir_url(__DIR__) . 'dist/scripts/formality-editor.js', array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor', 'wp-plugins', 'wp-edit-post' ), $this->version, false ); | ||
|
||
wp_localize_script( $this->formality . "-editor", 'formality', array( | ||
'plugin_url' => str_replace('admin/', '', plugin_dir_url( __FILE__ )), | ||
'templates_url' => $upload['baseurl'] . '/formality/templates', | ||
'templates_count' => get_option('formality_templates', 0), | ||
'admin_url' => get_admin_url(), | ||
'api' => esc_url_raw(rest_url()), | ||
'nonce' => wp_create_nonce('wp_rest'), | ||
'upload_formats' => $formats, | ||
'upload_max' => $maxsize | ||
)); | ||
|
||
wp_set_script_translations( $this->formality . "-editor", 'formality', plugin_dir_path( __DIR__ ) . 'languages' ); | ||
} | ||
|
||
|
@@ -122,6 +133,7 @@ public function get_allowed( $type = 'blocks' ) { | |
'formality/switch', | ||
'formality/multiple', | ||
'formality/rating', | ||
'formality/upload', | ||
'formality/step', | ||
'formality/message', | ||
'formality/media', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Build and send notifications. | ||
* | ||
* @link https://formality.dev | ||
* @since 1.0.0 | ||
* @since 1.0 | ||
* @package Formality | ||
* @subpackage Formality/admin | ||
* @author Michele Giorgi <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Results functions. | ||
* | ||
* @link https://formality.dev | ||
* @since 1.0.0 | ||
* @since 1.0 | ||
* @package Formality | ||
* @subpackage Formality/admin | ||
* @author Michele Giorgi <[email protected]> | ||
|
@@ -124,13 +124,21 @@ public function result_data($result_id = 0, $echo = true) { | |
public function field($result_id, $block, $index) { | ||
if(!isset($block["attrs"]['exclude'])) { | ||
$fieldname = "field_" . $block["attrs"]["uid"]; | ||
$type = str_replace("formality/","",$block['blockName']); | ||
$fieldvalue = get_post_meta( $result_id, $fieldname, true ); | ||
if(is_array($fieldvalue)) { | ||
$values = ""; | ||
foreach($fieldvalue as $subvalue){ | ||
$values .= $subvalue . '<br>'; | ||
} | ||
$fieldvalue = $values; | ||
} else if($type=="upload") { | ||
$ext = pathinfo($fieldvalue, PATHINFO_EXTENSION); | ||
if(in_array($ext, array('gif', 'png', 'bmp', 'jpg', 'jpeg', 'svg'))) { | ||
$fieldvalue = '<a target="_blank" href="' . $fieldvalue . '"><img style="max-width:100%; height:auto;" src="' . $fieldvalue . '" alt="" /></a>'; | ||
} else { | ||
$fieldvalue = '<a target="_blank" href="' . $fieldvalue . '">' . $fieldvalue . '</a>'; | ||
} | ||
} else { | ||
$fieldvalue = nl2br($fieldvalue); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Helper functions and tools of the plugin. | ||
* | ||
* @link https://formality.dev | ||
* @since 1.0.0 | ||
* @since 1.0 | ||
* @package Formality | ||
* @subpackage Formality/admin | ||
* @author Michele Giorgi <[email protected]> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.