• I think this plugin has promise, but there are a lot of fundamental coding errors in it. I run in strict mode and made about 50 changes to get it to work. Not a criticism, we all do it occasionally.

    If this was on github I would simply do a pull request. I would list changes line by line, but had to add code so they would not line up to what you have locally.

    In essence, not counting unused functions and better use of public, protected and private properties and methods:

    1. Need to isset everything when you do conditionals. At least 20 of those.
    2. __construct is a magic method, which will be automatically called when the class is initialized. You don’t need the ImageCleanup() function at all.
    3. In the two classes with extend WP_List_table, you can’t call prepare_items() with parameters, as the original class does not have parameters. What I did was declare new properties to match those parameters, and then created a helper function:
      var $file;
      public function use_file( $file = null ) {
         $this->file = $file;
         $this->prepare_items();
      }

      Then in prepare_items() instead of referencing $file you reference $this->file. There might be a better way of doing this, but I think this works.

    In any case, thanks for the plugin, but plunking it on github would allow others to contribute.

    https://wordpress.org/plugins/image-cleanup/

  • The topic ‘Is there a github project for this?’ is closed to new replies.