Giter Site home page Giter Site logo

yeswework / fabrica-reusable-block-instances Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 2.0 1.29 MB

WordPress 5 plugin which shows you how many times, and where, a Reusable Block has been used.

Home Page: https://wordpress.org/plugins/fabrica-reusable-block-instances/

PHP 79.17% CSS 3.32% JavaScript 17.51%

fabrica-reusable-block-instances's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fabrica-reusable-block-instances's Issues

We should sanitize the block id before using it in sql.

I know it's not a sqli issue, as we're previously verifying that is_numeric( $_GET['block_instances'] ) but just for code sniffing and explicitness, probably would be worth either casting as an (int) or passing through intval() inline here where we're using it:

$where .= ' AND post_content LIKE \'%<!-- wp:block {"ref":' . $_GET['block_instances'] . '}%\' ';

suggestion: add `post_name` (aka slug) as a column option

I'm likely to be an edge case, but I've been rendering blocks on the fly in my templates, via simple function:

function renderBlockById($id) {
  // get reusable gutenberg block:
  $gblock = get_post($id);
  return apply_filters('the_content', $gblock->post_content);
}

In the interests of more readable code, I'd prefer to be passing the 'slug' of a block into this function, but the only place I can get them is from the database itself. Any chance it could be added as an optional column?

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.