GithubHelp home page GithubHelp logo

xxsimoxx / vars Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 396 KB

With vars (a plugin for classicPress) you can define name-value associations from the admin.

License: GNU General Public License v2.0

PHP 93.30% JavaScript 4.83% CSS 0.17% Shell 1.70%
classicpress-plugin shortcode classicpress plugin

vars's Introduction

vars

With vars you can define name-value associations from the admin.

Then, in your content you can insert [vars]name[/vars] and get value displayed.

Useful if you have a value (a phone number, number of employees) in several pages that can change, so you can change this once from the admin.

It integrates into TinyMCE by adding a menu (compatible also with TinyMCE v.5).

You can choose which users can manage vars.

Look at the screenshots.

Shortcodes everywhere

There is also an option (that affects every shortcode in your site) to display shortcodes in areas where normally they are not.

  • single_post_title
  • the_title
  • widget_text
  • widget_title
  • bloginfo
  • get_post_metadata

Integration

Security menu

If running ClassicPress 1.1.0 or newer those settings are moved to the Security menu: choose which users can manage vars, what to do with vars when uninstalling and apply shortcodes everywhere

Functions

If you would like to use in your theme/plugin vars_do('name') and get value displayed.

Filters

There is a filter called vars_output

An example to capitalize the output.

function vars_output_upper( $string ) {
    return strtoupper( $string );
}
add_filter( 'vars_output', 'vars_output_upper' );

An example to use it to exec PHP code. Dangerous, don't do it. You have to open and close php tags in your string.

function vars_output_exec_php( $string ) {
    ob_start();
    eval( "?>" . $string ." " );
    $evalContent = ob_get_contents();
    ob_end_clean();
    return $evalContent;
}
add_filter( 'vars_output', 'vars_output_exec_php' );

Screenshots

Editing vars

TinyMCE button

Security settings

Privacy

To help us know the number of active installations of this plugin, we collect and store anonymized data when the plugin check in for updates. The date and unique plugin identifier are stored as plain text and the requesting URL is stored as a non-reversible hashed value. This data is stored for up to 28 days.

vars's People

Contributors

xxsimoxx avatar

Stargazers

 avatar

Watchers

 avatar

vars's Issues

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.