Coder Social home page Coder Social logo

ucf / wp-shortcode-interface Goto Github PK

View Code? Open in Web Editor NEW
0.0 8.0 0.0 138 KB

Creates a shortcode interface that provides a form for inserting and updating shortcodes.

PHP 46.79% JavaScript 6.14% TypeScript 43.99% SCSS 3.08%
wordpress-plugin wordpress ucf-cm

wp-shortcode-interface's Introduction

WP Shortcode Interface

Creates a form that provides the available parameters for defined shortcodes.

Description

Provides an interface for inserting shortcodes into the WordPress WYSIWYG editor. Developers can write supported hooks into their plugins to make their shortcodes available within the interface.

Installation

Manual Installation

  1. Upload the plugin files (unzipped) to the /wp-content/plugins directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the "Plugins" screen in WordPress

WP CLI Installation

  1. $ wp plugin install --activate https://github.com/UCF/WP-Shortcode-Interface/archive/master.zip. See WP-CLI Docs for more command options.

Changelog

0.2.3

Enhancements:

  • Added composer file.

0.2.2

Enhancements:

  • Added Github updater support
  • Added minimum required PHP version

0.2.1

Bug Fixes:

  • Fixed the generated url for a spinner icon used in the admin interface that could cause internal redirect problems.

0.2.0

Enhancements:

  • Added ability to assign a shortcode to a group for better organization within the shortcode select dropdown

0.1.0

  • Initial prerelease

Upgrade Notice

n/a

Installation Requirements

n/a

Development & Contributing

NOTE: this plugin's readme.md file is automatically generated. Please only make modifications to the readme.txt file, and make sure the gulp readme command has been run before committing readme changes.

wp-shortcode-interface's People

Contributors

cjg89 avatar jmbarne3 avatar mcatech avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-shortcode-interface's Issues

Update packages

Plugin needs to be updated to use gulp 4; other packages should be brought up to date to make future development sprints easier to get started with.

Create Function for Registering Shortcode Configs

To prevent total breakage when the wp_scif_add_shortcode filter is called by an another plugin, instead create a function for adding shortcodes. This function can then validate the incoming configuration and verify it won't break anything, and then add a filter.

Field sanitization

Values from attribute fields in the shortcode interface should be sanitized before being passed pack to TinyMCE to avoid the creation of invalid shortcodes and/or attributes.

For example, when editing the "class" attribute of a button shortcode, if I add a value of " data-bad-attr="something" ", the following is inserted into the WYSIWYG editor:

[button class="" data-bad-attr="something" ""][/button]

Shortcode interface - shortcode options of type 'checkbox' are added to all shortcodes

Whenever I add a new shortcode using the shortcode interface, fields from other shortcodes will populate into the generated shortcode if the field type is 'checkbox'.

For example, between two available shortcodes:
[foo] with text field name, and
[bar] with checkbox field is_enabled,
If I insert the shortcode [foo] into the wysiwyg, the resulting shortcode looks like:
[foo name="..." is_enabled="false"].

Normalize field options/fix undefined index notices

Ideally, instead of $this->fields being assigned the raw fields array passed to it, the assigned fields array should be normalized and assigned a set of default supported key/value pairs, e.g.

public function __construct( $args ) {
  ...
  $this->fields = $this->normalize_fields( $args['fields'] );
  ...
}

...

public function normalize_fields( $fields ) {
  $normalized = array();
  foreach ( $fields as $field ) {
    $normalized[] = array_merge( array( 'name' => '', 'desc' => '', ... ), $field );
  }
  return $normalized;
}

Doing this would help suppress undefined index notices caused on lines such as this one, where $field['required'] may not have been set in the original fields array passed to the constructor.

Inserted shortcodes don't have closing tags

A shortcode added to the wysiwyg editor from the shortcode interface does not have a closing tag; only the opening tag is inserted. We should always add closing tags to ensure that both self-closing and non-self-closing tags are compatible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.