WP Manifestindependent plugin directory
manifest / developer / jp-toolkit-html-helper

JP Toolkit HTML Helper for WordPress WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA

A helper for WordPress that provides a set of static methods for generating commonly used HTML and form tags

★ 0stars
25release downloads
v1.3.2latest · 5 years ago

Install

Download jp-toolkit-html-helper.zip From the v1.3.2 release on GitHub, Dec 18, 2020

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/jprieton/jp-toolkit-html-helper/releases/download/v1.3.2/jp-toolkit-html-helper.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A helper classes based on Laravel Forms, CodeIgniter HTML helper and Yii Framework BaseHtml helper that provides a set of static methods for generating commonly used HTML tags to use in WordPress themes and/or plugins.

Note: If your markup is nearly static, it's better to use HTML directly. There's no need to wrap absolutely everything in Html helper class.


Examples

Html class

The code for generating a tag looks like the following:

use JPToolkit\HtmlHelper\Html;

echo Html::tag( 'p', 'Lorem ipsum dolor sit amet', ['class' => 'text-justify'] );

The first argument is the tag name. The second one is the content to be enclosed between the start and end tags. The third one is an array of HTML attributes. In this array the key is the name of the attribute (such as class, href or target), and the value is its value. You can also use a query string to set the tag attributes.

The code above will generate the following HTML:

<p class="text-justify">Lorem ipsum dolor sit amet</p>

Form class

The code for generating a tag looks like the following:

use JPToolkit\HtmlHelper\Form;

$attributes   = [
    'name'  => 'username',
    'id'    => 'username',
    'value' => '',
    'type'  => 'text'
];
echo Form::input( $attributes );

The $attributes is an array of HTML attributes. In this array the key is the name of the attribute (such as class, value or id), and the value is its value. You can also use a query string to set the tag attributes.

The code above will generate the following HTML:

<input name="username" value="" type="text" id="username" />

Please read our Wiki for more detailed information, advanced usage and shorthands.


Installing

Manual

Recommended in most cases.

  1. Download the jp-toolkit-html-helper.zip file from GitHub
  2. In your WordPress admin click Plugin > Add New > Upload Plugin.
  3. Upload the ZIP file.
  4. Activate the plugin.

Via Composer

This plugin is also available as Composer package and can be installed via Composer from the root of your theme or plugin. Recommended when you want to bundle in your theme or plugin.

composer require jp-toolkit/html-helper

Note:

When is installed via Composer it is necessary to initialize the shortcodes and shorthands handlers, this code can be placed in your functions.php of your theme or the root file of your plugin.

use JPToolkit\HtmlHelper\Init as HtmlHelperInit;
new HtmlHelperInit();

This code is only required when is installed via Composer, if you do not want use these handlers you can skip this step.


Bug tracker?

Have a bug? Please create an issue on GitHub at https://github.com/jprieton/jp-toolkit-html-helper/issues

Releases

6 releases. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
v1.3.2 latest
Dec 18, 2020 5 years ago
jp-toolkit-html-helper.zip
11
Jul 29, 2020 6 years ago
jp-toolkit-html-helper.zip
9
May 15, 2020 6 years ago
jp-toolkit-html-helper.zip
5
May 12, 2020 6 years ago
tag only
—
Apr 19, 2020 6 years ago
tag only
—
Apr 18, 2020 6 years ago
tag only
—
A grade

Security

JP Toolkit HTML Helper for WordPress 1.3.2 · audited by WP Registry

No security issues found.

Audited release
1.3.2
Findings
none
Worst severity
—
Content hash
092f758874722be8a5110ddf…

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.