Giter Site home page Giter Site logo

eddysims / find-my-blocks Goto Github PK

View Code? Open in Web Editor NEW
23.0 7.0 9.0 3.33 MB

A tool to help you find what Gutenbergs blocks you have used on your WordPress website and where they are located.

Home Page: https://wordpress.org/plugins/find-my-blocks/

JavaScript 73.63% PHP 19.61% CSS 6.75%
hacktoberfest wordpress-plugin gutenbergs-blocks wordpress wordpress-blocks

find-my-blocks's Introduction

Find My Blocks - Locate WordPress Blocks

Find My Blocks is a WordPress plugin built to help (as it says in the name) find where you have used specific Gutenberg blocks on your WordPress website.

  • Search for core WordPress Blocks.
  • Search for third-party plugin Blocks.
  • Search for WordPress templates & template parts.
  • Search for custom templates.
  • Search for synced patterns (Reuseable blocks).
  • Ready for Full Site Editing themes & block-enabled themes.

Download stable version

You can read more on the official website or WordPress repository.

Contribute to development

To start developing on Find My Blocks you have to setup your local environment.

npm install
npm run dev

All files and scripts will be built into the /production/find-my-blocks folder. You should copy a symbolic link to your Local WP site. All changes will be reflected as you file changes.

npm run production

A production ready zip file will be created within /production/zip/.

Feature wishlist

  • Standardize & refactor filters so third-parties can add their own checkboxes.
  • Simplify how preferences is stored within localStorage and React useState().

Who is behind this?

Morgan Hvidt is the current developer for Find My Blocks. You can follow him on Twitter / X @morganhvidt or morganhvidt.com

A special thanks to Edeesims who originally created the Find My Blocks plugin.

find-my-blocks's People

Contributors

ajitbohra avatar cjyabraham avatar dependabot[bot] avatar dovy avatar drivingralle avatar eddysims avatar greglebarbar avatar morganhvidt avatar ponsfrilus avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

find-my-blocks's Issues

Make the menu overflow.

I have alot of blocks on my site. When I scroll and select one, I am to far down the page to see the pages that have that block.

It would be more user friendly if the menu had a scrollbar so that we dont scroll down the page.

no contact form for feedback...

First off thanks for this plugin (something that you should just be able to do with wordpress as standard!)

It might be worth you at least throwing up a contact form on the plugins site...

Why are you off wordpress.org?

Hi,

Very useful plugin, thanks for building it. Can you tell me why it is off WP.org? It looks like there's a possible security hole you need to patch?

Ben

Ignore Core Blocks

https://wordpress.org/support/topic/improvement-suggestion-ignore-core-blocks/

Hi, first please let me thank you for this really helpful plugin. I saw it mentioned on the WP Tavern and installed it immediately. Exactly what I needed.

I have one suggestion: it would be nice to have an option to ignore core blocks in the settings. I realize there is the ability to filter the view, but I am guessing that many people are not interested in their use of core blocks, but how and where they use non-core blocks.

Anyway, just a suggestion, thanks again for making this plugin available to us!

Cheers, Robert

Show regular names

Instead of showing the core/paragraph as the name in the navigation, can we show the proper block name.

Example:

Paragraph
core/paragraph
Found in 10 posts

Show regular names

It can be confusing to use the block names eg: core/button.

We should try to make the menu show the real names. eg Button

Console error

I'm seeing this console error on the find-my-blocks page in the control panel (v. 2.2.0 / WP 5.5), not sure if it matters but just in case:

find-my-blocks.js?ver=1597855137:589 You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.

I love the plugin, thank you!

Fix deployment issues

When deploying there are a few things that happen

  1. We update the description and changelog in the readme.txt to use content from other pages
  2. We update the version based on the tag.

Both of these are not happening very well right now. This should be fixed.

This should fail if the files to change to are not found

Expand to Reusable Blocks

Could you please make the interface for reviewing reusable blocks identical to the one for standard blocks? I believe it is necessary. There is a plugin for this purpose, but in my opinion, Find My Blocks has a much better user experience.

In addition, you can obtain a list of reusable blocks and their locations with a slightly more complicated MySQL procedure that I have written for my own needs. You can run it in Adminer or similar.

CREATE TEMPORARY TABLE results (post_id INT UNSIGNED, block_id INT UNSIGNED) ENGINE=MEMORY CHARSET=utf8mb4;
DROP PROCEDURE IF EXISTS extractor;

DELIMITER //

CREATE PROCEDURE extractor() BEGIN

  DECLARE row_content, string, the_rest, pattern TEXT CHARSET utf8;
  DECLARE row_id, row_block INT UNSIGNED;

  DECLARE done BOOLEAN DEFAULT FALSE;
  DECLARE result CURSOR FOR SELECT id, post_content FROM wp_posts WHERE post_content LIKE '%<!-- wp:block {%' AND post_type NOT IN ('revision', 'attachment', 'nav_menu_item');
  DECLARE CONTINUE HANDLER FOR NOT FOUND SET done := TRUE;

  SET pattern = '<!-- wp:block {"ref":';

  OPEN result;
  loop_posts: LOOP

    FETCH result INTO row_id, row_content;

    IF done THEN
      LEAVE loop_posts;
    END IF;

    SET string = row_content;

    BEGIN
    loop_string:LOOP

      IF CHAR_LENGTH(TRIM(string)) = 0 OR string IS NULL OR LOCATE(pattern, string) = 0 THEN
        LEAVE loop_string;
      END IF;

      SET string= SUBSTRING(string, LOCATE(pattern, string) + CHAR_LENGTH(pattern));
      SET @temp = REGEXP_SUBSTR(string, "^\\d+\\D");
      SET @temp = LEFT(@temp, CHAR_LENGTH(@temp) - 1);
      SET row_block = CAST(@temp AS UNSIGNED);

      INSERT INTO results VALUES (row_id, row_block);

    END LOOP loop_string;
    END;


  END LOOP loop_posts;

  CLOSE result;
END //

DELIMITER ;

CALL extractor();

# Just IDs, grouped and sorted
SELECT block_id AS reusable_block_id, COUNT(post_id) AS number_of_block_occurrences, COUNT(DISTINCT post_id) AS number_of_pages_with_block, GROUP_CONCAT(post_id ORDER BY post_id) AS list_of_post_ids FROM results GROUP BY block_id;

# Or all the data that we need for display: Post ID for a link, Post Title and Post Type, grouped and sorted
SELECT block_id, CONCAT('[', GROUP_CONCAT(JSON_ARRAY(post_id, posts.post_title, posts.post_type) ORDER BY post_id), ']') FROM results LEFT JOIN wp_posts as posts ON results.post_id = posts.id GROUP BY block_id LIMIT 10;

Update URL when a block is selected

It would be really handy if you could link directly to the list of pages for a particular block, like /wp-admin/tools.php?page=find-my-blocks&block=core/whatever.

Right now the URL stays /wp-admin/tools.php?page=find-my-blocks the entire time.

Switch for Reusable Blocks Admin menu entry

Would be good to enable this as a feature that can be turned on and off like showing core blocks. There are a couple of other plugins that have a richer where used feature set for reusable blocks and this creates duplicate admin entries and the one from FMB is not displayed.

results are not returned for pages that contain blocks with block style variations applied to them

Hi,

Thanks for making this.

I noticed that the plugin does not return any results pages/posts that contain core blocks have a Block Style Variation applied to them. Results for core blocks that did not have a block style variation applied to them were not returned.

If you'd like a test case:

  1. Install my plugin, cpl-blocks (or you could install a separate plugin like coblocks, or your own that has a block style variation applied; my example code is at https://gitlab.com/cpl/cpl-blocks/-/blob/master/src/block/button.js

  2. create a page or post that contains a block with a block style variation applied.

  3. use the plugin and make a search for a core block that has a block style variation applied to them.

Wrapp more strings in translation function

Hey Eddy!

Great plugin idea you realized here.
Started using it recently.

Would like to use it also for client projects that require a German translation. I have already suggested all the strings on WP.org that yet are translatable.

There are a few strings inside the PHP that are missing the functions to allow translation.
Also the strings inside the JS driven interface are not translatable.

Would love to see more string to be wrapped in the tools to make your plugin more usefull to more users because some people are not secure in working in english interfaces.

Greetings
derRALF

Sites that have a huge amount of posts it crashes

I'm of course not sure wether there is anything you can really easily do about this, but maybe with pagination processing them in chunks rather than all at once might be a cool idea.

When I change:

$posts = get_posts(
	array(
		'posts_per_page' => -1,
		'post_type'      => $post_type,
	)
);

to

$posts = get_posts(
	array(
		'posts_per_page' => 100,
		'post_type'      => $post_type,
	)
);

in inc/register_route.php it works.

And maybe having an error handler that tells you when the request didn't work might be a nice addition :) Currently the block rotation animation just keeps spinning endlessly

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.