Skip to content

Commit

Permalink
Merge pull request #11 from TukuToi/develop
Browse files Browse the repository at this point in the history
### 1.8.6
[Fixed] Missing Text Domains and some Comments for CPCS Review.
  • Loading branch information
smileBeda authored Jun 11, 2022
2 parents 11dd583 + bb9945f commit 56dbec9
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 69 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

## Changelog

### 1.8.6
[Fixed] Missing Text Domains and some Comments for CPCS Review.

### 1.8.5
[Fixed] Template ShortCode not parsing nested ShortCodes
[Fixed] funktion ShortCode wrongly passing arguments with '' apostrophes
Expand Down
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: templates, archives, design
Requires at least: 4.9.0
Requires PHP: 7.0.0
Tested up to: 4.9.99
Stable tag: 1.8.5
Stable tag: 1.8.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -15,6 +15,9 @@ TukuToi Template Builder allows you to create any kind of Template for your Word

== Changelog ==

= 1.8.6 =
[Fixed] Missing Text Domains and some Comments for CPCS Review.

= 1.8.5 =
[Fixed] Template ShortCode not parsing nested ShortCodes
[Fixed] funktion ShortCode wrongly passing arguments with '' apostrophes
Expand Down
10 changes: 5 additions & 5 deletions admin/class-tkt-template-builder-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ public function template_settings_metabox( $post, $metabox ) {
*/
foreach ( $post_types as $key => $object ) {
// Translators: s1 Is a Post Type Name.
$post_type_single_templates[ $object->name . '_singular_template' ] = sprintf( esc_html__( 'Single %s' ), $object->label );
$post_type_single_templates[ $object->name . '_singular_template' ] = sprintf( esc_html__( 'Single %s', 'tkt-template-builder' ), $object->label );
// Exclude Pages and Posts from Archives.
if ( false === $object->_builtin ) {
// Translators: s1 Is a Post Type Name.
$post_type_archive_templates[ $object->name . '_archive_template' ] = sprintf( esc_html__( '%s (Post Archives)' ), $object->label );
$post_type_archive_templates[ $object->name . '_archive_template' ] = sprintf( esc_html__( '%s (Post Archives)', 'tkt-template-builder' ), $object->label );
}
}
$templates = array_merge( $templates, $post_type_single_templates );
Expand All @@ -330,7 +330,7 @@ public function template_settings_metabox( $post, $metabox ) {
*/
foreach ( $taxonomies as $key => $object ) {
// Translators: s1 Is a Post Type Name.
$tax_archive_templates[ $object->name . '_tax_template' ] = sprintf( esc_html__( '%s (Taxonomy Archives)' ), $object->label );
$tax_archive_templates[ $object->name . '_tax_template' ] = sprintf( esc_html__( '%s (Taxonomy Archives)', 'tkt-template-builder' ), $object->label );
}
$templates = array_merge( $templates, $tax_archive_templates );
$templates = array_merge(
Expand Down Expand Up @@ -672,8 +672,8 @@ public function add_template_admin_list_columns( $columns ) {

$columns = array(
'cb' => $columns['cb'],
'title' => __( 'Title' ),
'assigned_to' => __( 'Assigned To' ),
'title' => __( 'Title', 'tkt-template-builder' ),
'assigned_to' => __( 'Assigned To', 'tkt-template-builder' ),
'parent_template' => __( 'Parent Template', 'tkt-template-builder' ),
'header' => __( 'Header', 'tkt-template-builder' ),
'footer' => __( 'Footer', 'tkt-template-builder' ),
Expand Down
12 changes: 6 additions & 6 deletions admin/class-tkt-template-builder-gui.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function alltemplates_options() {
add_filter(
'tkt_scs_shortcodes_fieldset_explanation',
function( $explanation ) {
$explanation = __( 'What template to insert' );
$explanation = __( 'What template to insert', 'tkt-template-builder' );
return $explanation;
}
);
Expand All @@ -105,7 +105,7 @@ public function allmenus_options() {
add_filter(
'tkt_scs_shortcodes_fieldset_explanation',
function( $explanation ) {
$explanation = __( 'What Menu to Show' );
$explanation = __( 'What Menu to Show', 'tkt-template-builder' );
return $explanation;
}
);
Expand All @@ -129,7 +129,7 @@ public function alllocations_options() {
add_filter(
'tkt_scs_shortcodes_fieldset_explanation',
function( $explanation ) {
$explanation = __( 'What Menu Location to use (Wins over Menu setting above, if set)' );
$explanation = __( 'What Menu Location to use (Wins over Menu setting above, if set)', 'tkt-template-builder' );
return $explanation;
}
);
Expand Down Expand Up @@ -157,7 +157,7 @@ public function allitemspacing_options() {
add_filter(
'tkt_scs_shortcodes_fieldset_explanation',
function( $explanation ) {
$explanation = __( 'Whether to preserve whitespace within the menu\'s HTML.' );
$explanation = __( 'Whether to preserve whitespace within the menu\'s HTML.', 'tkt-template-builder' );
return $explanation;
}
);
Expand Down Expand Up @@ -186,7 +186,7 @@ public function allsidebars_options() {
add_filter(
'tkt_scs_shortcodes_fieldset_explanation',
function( $explanation ) {
$explanation = __( 'What sidebar to include.' );
$explanation = __( 'What sidebar to include.', 'tkt-template-builder' );
return $explanation;
}
);
Expand Down Expand Up @@ -215,7 +215,7 @@ public function allwidgets_options() {
add_filter(
'tkt_scs_shortcodes_fieldset_explanation',
function( $explanation ) {
$explanation = __( 'What widget to include.' );
$explanation = __( 'What widget to include.', 'tkt-template-builder' );
return $explanation;
}
);
Expand Down
31 changes: 27 additions & 4 deletions common/class-tkt-shortcodes-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,24 @@ private function encode_iterators( $content ) {
$counts = preg_match_all( $expression, $content, $matches );

foreach ( $matches[0] as $index => $match ) {
// Encode the data to stop WP from trying to fix or parse it.
// The iterator shortcode will manage this on render.
$match_encoded = str_replace( $matches[1][ $index ], $this->base64_prefix . base64_encode( $matches[1][ $index ] ), $match );
/**
* Encode the data to stop WP from trying to fix or parse it.
* The iterator shortcode will manage this on render.
*
* Reviewers:
* This usage of base64_encode() is safe. We do not encode anything unknown.
* All data we encode here is basically the content of (or a) shortcode added by
* someone with manage_options rights in the CP Admin > TukuToi Template or else editors.
*
* No external data, no computed data, no obfuscated data is passed here.
* The reason we need to encode this is, WP has a nack of messing around with nested shortcodes.
* Like [shortcode attr="[shortcode]"] will result in a lot of stripped content.
* Or even [shortcode]<html>[shortcodes]<more html attr="[shortcode]">[shortcodes]</more html></html>[/shortcode] will result in the first level of shortcodes expanded and
* the rest stripped out either by do_shortcode() or the_content(). To avoid this, we base64 encode the parts we do want to expand/process only _later_.
*
* Note that this approach is battle tested by Toolset since at least 6 years.
*/
$match_encoded = str_replace( $matches[1][ $index ], $this->base64_prefix . base64_encode( $matches[1][ $index ] ), $match );// @codingStandardsIgnoreLine
$content = str_replace( $match, $match_encoded, $content );
}

Expand Down Expand Up @@ -297,7 +312,15 @@ private function decode_iterators( $content ) {
if ( 0 === strpos( $content, $this->base64_prefix ) ) {

$content = substr( $content, strlen( $this->base64_prefix ) );
$content = base64_decode( $content );
/**
* Decode the encoded content
*
* Reviewers:
* This is safe and intended.
*
* @see $this->encode_iterators() for comments.
*/
$content = base64_decode( $content );// @codingStandardsIgnoreLine

}

Expand Down
64 changes: 32 additions & 32 deletions includes/class-tkt-template-builder-declarations.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,37 +90,37 @@ private function declare_shortcodes() {

$shortcodes = array(
'template' => array(
'label' => esc_html__( 'Template', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Template', 'tkt-template-builder' ),
'type' => 'templating',
'inner' => false,
),
'navmenu' => array(
'label' => esc_html__( 'Navigation Menu', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Navigation Menu', 'tkt-template-builder' ),
'type' => 'templating',
'inner' => false,
),
'widget' => array(
'label' => esc_html__( 'Widget', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Widget', 'tkt-template-builder' ),
'type' => 'templating',
'inner' => false,
),
'sidebar' => array(
'label' => esc_html__( 'Sidebar', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Sidebar', 'tkt-template-builder' ),
'type' => 'templating',
'inner' => false,
),
'do_action' => array(
'label' => esc_html__( 'Do Action', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Do Action', 'tkt-template-builder' ),
'type' => 'hooks',
'inner' => true,
),
'add_filter' => array(
'label' => esc_html__( 'Add Filter', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Add Filter', 'tkt-template-builder' ),
'type' => 'hooks',
'inner' => true,
),
'funktion' => array(
'label' => esc_html__( 'Function', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Function', 'tkt-template-builder' ),
'type' => 'hooks',
'inner' => true,
),
Expand Down Expand Up @@ -148,8 +148,8 @@ private function declare_shortcodes() {
public function data_map( $map ) {

$shortcode_types = array(
'templating' => esc_html__( 'Templating', 'tkt-search-and-filter' ),
'hooks' => esc_html__( 'Hooks & Functions', 'tkt-search-and-filter' ),
'templating' => esc_html__( 'Templating', 'tkt-template-builder' ),
'hooks' => esc_html__( 'Hooks & Functions', 'tkt-template-builder' ),
);

return $$map;
Expand All @@ -174,94 +174,94 @@ private function sanitize_options() {

$sanitization_options = array(
'none' => array(
'label' => esc_html__( 'No Sanitization', 'tkt-search-and-filter' ),
'label' => esc_html__( 'No Sanitization', 'tkt-template-builder' ),
),
'email' => array(
'label' => esc_html__( 'Sanitize Email', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Sanitize Email', 'tkt-template-builder' ),
'callback' => 'sanitize_email',
),
'file_name' => array(
'label' => esc_html__( 'File Name', 'tkt-search-and-filter' ),
'label' => esc_html__( 'File Name', 'tkt-template-builder' ),
'callback' => 'sanitize_file_name',
),
'html_class' => array(
'label' => esc_html__( 'HTML Class', 'tkt-search-and-filter' ),
'label' => esc_html__( 'HTML Class', 'tkt-template-builder' ),
'callback' => 'sanitize_html_class',
),
'key' => array(
'label' => esc_html__( 'Key', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Key', 'tkt-template-builder' ),
'callback' => 'sanitize_key',
),
'meta' => array(
'label' => esc_html__( 'Meta', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Meta', 'tkt-template-builder' ),
'callback' => 'sanitize_meta',
),
'mime_type' => array(
'label' => esc_html__( 'Mime Type', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Mime Type', 'tkt-template-builder' ),
'callback' => 'sanitize_mime_type',
),
'option' => array(
'label' => esc_html__( 'Option', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Option', 'tkt-template-builder' ),
'callback' => 'sanitize_option',
),
'sql_orderby' => array(
'label' => esc_html__( 'SQL Orderby', 'tkt-search-and-filter' ),
'label' => esc_html__( 'SQL Orderby', 'tkt-template-builder' ),
'callback' => 'sanitize_sql_orderby',
),
'text_field' => array(
'label' => esc_html__( 'Text Field', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Text Field', 'tkt-template-builder' ),
'callback' => 'sanitize_text_field',
),
'textarea_field' => array(
'label' => esc_html__( 'Text Area', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Text Area', 'tkt-template-builder' ),
'callback' => 'sanitize_textarea_field',
),
'title' => array(
'label' => esc_html__( 'Title', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Title', 'tkt-template-builder' ),
'callback' => 'sanitize_title',
),
'title_for_query' => array(
'label' => esc_html__( 'Title for Query', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Title for Query', 'tkt-template-builder' ),
'callback' => 'sanitize_title_for_query',
),
'title_with_dashes' => array(
'label' => esc_html__( 'Title with Dashes', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Title with Dashes', 'tkt-template-builder' ),
'callback' => 'sanitize_title_with_dashes',
),
'user' => array(
'label' => esc_html__( 'User', 'tkt-search-and-filter' ),
'label' => esc_html__( 'User', 'tkt-template-builder' ),
'callback' => 'sanitize_user',
),
'url_raw' => array(
'label' => esc_html__( 'URL Raw', 'tkt-search-and-filter' ),
'label' => esc_html__( 'URL Raw', 'tkt-template-builder' ),
'callback' => 'esc_url_raw',
),
'post_kses' => array(
'label' => esc_html__( 'Post KSES', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Post KSES', 'tkt-template-builder' ),
'callback' => 'wp_filter_post_kses',
),
'nohtml_kses' => array(
'label' => esc_html__( 'NoHTML KSES', 'tkt-search-and-filter' ),
'label' => esc_html__( 'NoHTML KSES', 'tkt-template-builder' ),
'callback' => 'wp_filter_nohtml_kses',
),
'absint' => array(
'label' => esc_html__( 'Integer', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Integer', 'tkt-template-builder' ),
'callback' => 'absint',
),
'intval' => array(
'label' => esc_html__( 'Integer', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Integer', 'tkt-template-builder' ),
'callback' => 'intval',
),
'floatval' => array(
'label' => esc_html__( 'Float', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Float', 'tkt-template-builder' ),
'callback' => 'floatval',
),
'is_bool' => array(
'label' => esc_html__( 'Is Boolean', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Is Boolean', 'tkt-template-builder' ),
'callback' => 'is_bool',
),
'boolval' => array(
'label' => esc_html__( 'Boolean Value', 'tkt-search-and-filter' ),
'label' => esc_html__( 'Boolean Value', 'tkt-template-builder' ),
'callback' => 'boolval',
),
);
Expand Down
Loading

0 comments on commit 56dbec9

Please sign in to comment.