Skip to content

Commit 556d0ee

Browse files
committed
Enhanced code editor supports
1 parent 3f80d23 commit 556d0ee

4 files changed

Lines changed: 78 additions & 8 deletions

File tree

includes/Admin/views/codes.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,22 @@
6767
<div class="insertcodes__aside aside__items">
6868
<div class="aside__item">
6969
<div class="aside__item__header">
70-
<h4><?php esc_html_e( 'Recommended Plugins', 'insert-codes' ); ?></h4>
70+
<h4><?php esc_html_e( 'Support & Rating', 'insert-codes' ); ?></h4>
7171
</div>
7272
<div class="aside__item__body">
7373
<ul>
74-
<li><a href="https://wordpress.org/plugins/autocomplete-orders-for-woocommerce/" target="_blank"><?php esc_html_e( 'Autocomplete Orders for WooCommerce', 'insert-codes' ); ?></a></li>
74+
<li>
75+
<p>
76+
<?php esc_html_e( 'If you need help, please visit the support forum.', 'insert-codes' ); ?>
77+
<a href="https://wordpress.org/support/plugin/insert-codes/" target="_blank"><?php esc_html_e( 'Get Support', 'insert-codes' ); ?></a>
78+
</p>
79+
</li>
80+
<li>
81+
<p>
82+
<?php esc_html_e( 'If you like the plugin, please rate it on WordPress.org.', 'insert-codes' ); ?>
83+
<a href="https://wordpress.org/plugins/insert-codes/" target="_blank"><?php esc_html_e( 'Give a Rating', 'insert-codes' ); ?></a>
84+
</p>
85+
</li>
7586
</ul>
7687
</div>
7788
</div>

includes/Admin/views/settings.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,22 @@
8686
<div class="insertcodes__aside aside__items">
8787
<div class="aside__item">
8888
<div class="aside__item__header">
89-
<h4><?php esc_html_e( 'Recommended Plugins', 'insert-codes' ); ?></h4>
89+
<h4><?php esc_html_e( 'Support & Rating', 'insert-codes' ); ?></h4>
9090
</div>
9191
<div class="aside__item__body">
9292
<ul>
93-
<li><a href="https://wordpress.org/plugins/autocomplete-orders-for-woocommerce/" target="_blank"><?php esc_html_e( 'Autocomplete Orders for WooCommerce', 'insert-codes' ); ?></a></li>
93+
<li>
94+
<p>
95+
<?php esc_html_e( 'If you need help, please visit the support forum.', 'insert-codes' ); ?>
96+
<a href="https://wordpress.org/support/plugin/insert-codes/" target="_blank"><?php esc_html_e( 'Get Support', 'insert-codes' ); ?></a>
97+
</p>
98+
</li>
99+
<li>
100+
<p>
101+
<?php esc_html_e( 'If you like the plugin, please rate it on WordPress.org.', 'insert-codes' ); ?>
102+
<a href="https://wordpress.org/plugins/insert-codes/" target="_blank"><?php esc_html_e( 'Give a Rating', 'insert-codes' ); ?></a>
103+
</p>
104+
</li>
94105
</ul>
95106
</div>
96107
</div>

includes/Frontend/Frontend.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public function init() {
3333
add_action( 'wp_head', array( $this, 'insert_into_head' ), $header_priority );
3434
add_action( 'wp_body_open', array( $this, 'insert_into_body' ), $body_priority );
3535
add_action( 'wp_footer', array( $this, 'insert_into_footer' ), $footer_priority );
36+
add_filter( 'safe_style_css', array( $this, 'safe_styles' ) );
37+
add_filter( 'pre_kses', array( $this, 'normalize_entities' ), PHP_INT_MAX );
3638
}
3739

3840
/**
@@ -65,4 +67,31 @@ public function insert_into_body() {
6567
public function insert_into_footer() {
6668
echo wp_kses( get_option( 'insertcodes_footer' ), insertcodes_get_allowed_html() );
6769
}
70+
71+
/**
72+
* Add allowed styles.
73+
*
74+
* @param array $styles Allowed styles.
75+
*
76+
* @since 1.0.0
77+
* @return array
78+
*/
79+
public function safe_styles( $styles ) {
80+
$styles[] = 'display';
81+
$styles[] = 'visibility';
82+
83+
return $styles;
84+
}
85+
86+
/**
87+
* Normalize entities.
88+
*
89+
* @param string $content Content.
90+
*
91+
* @since 1.0.0
92+
* @return string
93+
*/
94+
public function normalize_entities( $content ) {
95+
return html_entity_decode( $content );
96+
}
6897
}

includes/functions.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
function insertcodes_get_allowed_html() {
1212
return array(
1313
'script' => array(
14-
'type' => array(),
15-
'src' => array(),
16-
'async' => array(),
17-
'defer' => array(),
14+
'type' => array(),
15+
'src' => array(),
16+
'async' => array(),
17+
'defer' => array(),
18+
'data-account' => array(),
19+
'data-user' => array(),
20+
'id' => array(),
1821
),
1922
'noscript' => array(
2023
'type' => array(),
@@ -30,6 +33,7 @@ function insertcodes_get_allowed_html() {
3033
'scrolling' => array(),
3134
'style' => array(),
3235
'class' => array(),
36+
'id' => array(),
3337
),
3438
'meta' => array(
3539
'name' => array(),
@@ -43,6 +47,9 @@ function insertcodes_get_allowed_html() {
4347
'title' => array(),
4448
'rel' => array(),
4549
'target' => array(),
50+
'class' => array(),
51+
'id' => array(),
52+
'style' => array(),
4653
),
4754
'br' => array(),
4855
'em' => array(),
@@ -51,10 +58,22 @@ function insertcodes_get_allowed_html() {
5158
'div' => array(
5259
'class' => array(),
5360
'id' => array(),
61+
'style' => array(),
5462
),
5563
'span' => array(
5664
'class' => array(),
5765
'id' => array(),
66+
'style' => array(),
67+
),
68+
'img' => array(
69+
'src' => array(),
70+
'alt' => array(),
71+
'title' => array(),
72+
'width' => array(),
73+
'height' => array(),
74+
'class' => array(),
75+
'id' => array(),
76+
'style' => array(),
5877
),
5978
);
6079
}

0 commit comments

Comments
 (0)