{"id":22662955,"url":"https://github.com/1franck/wp-plugme","last_synced_at":"2026-05-20T05:11:41.147Z","repository":{"id":67889648,"uuid":"65555656","full_name":"1franck/WP-Plugme","owner":"1franck","description":"Wordpress database driven plugin helper","archived":false,"fork":false,"pushed_at":"2017-03-29T19:40:11.000Z","size":955,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T09:13:43.232Z","etag":null,"topics":["wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1franck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-12T13:35:24.000Z","updated_at":"2016-11-10T05:47:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"b357d53a-b3d1-4913-94ad-f500162f0855","html_url":"https://github.com/1franck/WP-Plugme","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/1franck/WP-Plugme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1franck%2FWP-Plugme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1franck%2FWP-Plugme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1franck%2FWP-Plugme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1franck%2FWP-Plugme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1franck","download_url":"https://codeload.github.com/1franck/WP-Plugme/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1franck%2FWP-Plugme/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273010950,"owners_count":25030368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress","wordpress-plugin"],"created_at":"2024-12-09T12:16:38.687Z","updated_at":"2026-05-20T05:11:36.126Z","avatar_url":"https://github.com/1franck.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plugme\n\n**Plugme help you to quickly build Wordpress database driven plugin.**\n\n**Plugme is not a Wordpress plugin, it's a plugin helper for developer.**\n\nIn other words, Plugme let you build easily a table list and a form for navigating and managing your plugin data with the native visual style of Wordpress admin.\n\n\nHighlights:\n- easy to use\n- native look of wordpress\n- 12 form components including wordpress text editor (wp_editor), and wordpress media upload (wp_media)\n- list table support pagination, column sorting, search, and bulk actions\n- powerfull form validation\n- extends form control and validation by adding your own\n\n\nList of form controls type:\n- Input (html input for text, password, email, url, ...)\n- Textarea\n- Texteditor (wp_editor)\n- Checkbox\n- Radio\n- Select\n- Media uploading/selecting (wp_media)\n- Chosen (html select with jquery chosen)\n- Datepicker (jquery-ui)\n- Datetimepicker (jquery datetimepicker)\n- Slider (jquery-ui)\n- Advanced color picker\n\n\n## List table example:\n![Plugme form example](https://github.com/1Franck/plugme/blob/master/screenshot-list-table.png?raw=true)\n\n## Form example:\n![Plugme form example](https://github.com/1Franck/plugme/blob/master/screenshot-form.png?raw=true)\n\n## How it works\n\nCopy `/plugme` folder inside your plugin folder (ex: wp-content/plugins/mysuperplugin/plugme)\n\nNow that you are ready to use Plugme, you need to define a data source by extending class `plugme_data_source`. In your data source class, set your table name and your primary key name.\n\n@see example.data.source.php\n```php\n/**\n * Example of data source class\n */\nclass example_data_source extends plugme_data_source\n{\n    protected $table = 'plugme_example';\n    protected $table_primary_column = 'id';\n\n    // called after class construct\n    public function init() {}\n\n    // called before save() after sanitizing\n    public function pre_save($data)\n    {\n        if(!array_key_exists('enabled', $data)) $data['enabled'] = 0;\n\n        return $data;\n    }\n}\n```\n\nTo generate a html table list to naviguate through your table data, extends class `plugme_list_table`\n\n@see example.list.table.php\n```php\n/**\n * Example of html list table\n */\nclass example_list_table extends plugme_list_table\n{\n\n    /**\n     * list table settings\n     */\n    protected $default_orderby_column = 'name';\n    protected $search_column          = array('name', 'occupation');\n    protected $action_column          = 'name';\n\n    protected $options = array(\n        'singular'       =\u003e 'Person',\n        'plural'         =\u003e 'Persons',\n        'items_per_page' =\u003e 10,\n    );\n\n    protected $columns_header = array(\n        'cb'             =\u003e '\u003cinput type=\"checkbox\" /\u003e', //Render a checkbox instead of text\n        'name'           =\u003e 'Name',\n        'occupation'     =\u003e 'Occupation',\n        'gender'         =\u003e 'Gender',\n        'dateofbirth'    =\u003e 'Date of birth',\n        'email'          =\u003e 'Email',\n    );\n\n    protected $sortable_columns = array(\n        'name', \n        'gender',\n        'dateofbirth'\n    );\n\n    protected $bulk_actions = array(\n        'delete'    =\u003e 'Delete', // @see bulk_action_delete()\n    );\n\n    /**\n     * Set the sql query base to be used\n     */\n    protected function set_data_query()\n    {\n        return 'SELECT * FROM `'.$this-\u003edata_source-\u003etable.'`';\n    }\n\n    /**\n     * Custom bulk action\n     */\n    public function bulk_action_delete()\n    {\n        $data = $this-\u003eget_bulk_action_data();\n        if(!empty($data)) {\n            $this-\u003edata_source-\u003edelete($data);\n            echo '\n                \u003cdiv class=\"notice notice-success is-dismissible\" id=\"message\"\u003e\n                    \u003cp\u003eItems '.(is_array($data) ? implode(', ',$data) : $data).' deleted\u003c/p\u003e\n                    \u003cbutton class=\"notice-dismiss\" type=\"button\"\u003e\n                        \u003cspan class=\"screen-reader-text\"\u003eDismiss this notice.\u003c/span\u003e\n                    \u003c/button\u003e\n                \u003c/div\u003e';\n        }\n    }\n\n    /**\n     * Custom rendering for column email\n     \n     * @param  array $item  table row data\n     * @return string\n     */\n    public function column_email($item)\n    {\n        return '\u003ca href=\"mailto:'.$item['email'].'\"\u003e'.$item['email'].'\u003c/a\u003e';\n    }\n\n}\n```\n\nTo create a form with validation, extends class `plugme_form`\n\n@see example.form.php\n```php\n/**\n * Form generation and validation example\n */\nclass example_form extends plugme_form\n{\n    protected $form_fields = array(\n\n        'name' =\u003e array(\n            'type'        =\u003e 'input',\n            'label'       =\u003e 'Full name',\n            'description' =\u003e 'Example of description for \"text\" input element.',\n            'attrs'       =\u003e array(\n                'required'    =\u003e false,\n                'placeholder' =\u003e 'Full name',\n            ),\n            'validation' =\u003e array(\n                'if_not_empty', //conditonnal validator, if empty, other validators are skipped\n                'alpha' =\u003e array(\n                    'options' =\u003e array('space' =\u003e true, 'punc' =\u003e array('-', '.')),\n                    'msg'     =\u003e 'Enter a valid name'\n                ),\n        ),\n\n        'email' =\u003e array(\n            'type'        =\u003e 'input',\n            'label'       =\u003e 'Email',\n            'description' =\u003e 'Example of description for \"email\" input element.',\n            'attrs'       =\u003e array(\n                'required'    =\u003e true,\n                'placeholder' =\u003e 'example@email.com',\n                'type'        =\u003e 'email'\n            ),\n            'validation' =\u003e array(\n                'email' =\u003e array(\n                    'msg' =\u003e Enter a valid email address'\n                )\n            )\n        ),\n\n        // ...\n\n    );\n\n    /**\n     * Called right after constructor\n     */\n    public function init() {}\n\n    /**\n     * Manipulate form data before saving it to database\n     *\n     * @param  array $data\n     * @return array      \n     */\n    public function pre_save($data)\n    {\n        return $data;\n    }\n}\n```\n\nAnd finally, here a example of what might look your admin template. To make it more flexible, plugme doesn't do everything out of the box. This way, you can customize your plugin template page and integrate plugme anywhere more easily.\n\n@see adminpage.tpl.php\n```php\n\u003c?php \n\ninclude_once dirname(__FILE__).'/plugme/plugme.admin.php'; \ninclude_once dirname(__FILE__).'/example.data.source.php'; \ninclude_once dirname(__FILE__).'/example.list.table.php';\ninclude_once dirname(__FILE__).'/example.form.php'; \n\n$data_source = new example_data_source();\n\n$list_table  = new example_list_table($data_source);\n$form        = new example_form($data_source);\n\n\n$plugme = plugme_admin::getInstance();\n$plugme-\u003eregister_list_table($list_table);\n$plugme-\u003eregister_form($form);\n\n\n/**\n * Form submitted\n */\nif($plugme-\u003eis_form_submitted($_POST)) {\n\n    if($form-\u003evalidate($_POST)) {\n        $form_pass = true;\n        $item_saved = $form-\u003esave_data($_POST);\n        $form-\u003eflush_data();\n        // if after saving an item, you want to come back to the list table, \n        // you need to delete param action. If you want to add an item right after\n        // another one, comment this line\n        unset($_GET['action']);\n    }\n    else {\n        // repush data to the form so we can continue editing it\n        $form-\u003eset_data($_POST); \n    }\n}\n\n\n/**\n * Edit an item\n */\nif($plugme-\u003eis_editing_item()) {\n    $form-\u003eload_data_id($plugme-\u003eget_editing_id());\n}\n/**\n * Creating new item\n */\nelseif($plugme-\u003eis_creating_item()) {\n    $form-\u003ecreate_new_item();\n}\n\n\n?\u003e\n\n\u003cdiv class=\"wrap\"\u003e\n\n    \u003c?php if($plugme-\u003eis_editing_item() || $plugme-\u003eis_creating_item()) : ?\u003e\n\n        \u003c!-- FORM --\u003e\n        \u003ch1\u003e\n            \u003c?php\n                $item = $list_table-\u003eget_option('singular');\n                if($plugme-\u003eis_creating_item()) {\n                    echo __('New').' '.$item;\n                }\n                else {\n                    echo __('Edit').' '.$item .' '.$form-\u003eget_data($data_source-\u003etable_pk);\n                }\n            ?\u003e\n        \u003c/h1\u003e\n\n\n        \u003c?php if(isset($form_pass)): ?\u003e\n            \u003c!-- notice --\u003e\n            \u003cdiv class=\"notice notice-success is-dismissible\" id=\"message\"\u003e\n                \u003cp\u003e\u003c?php _e('Item saved').' (#'.$item_saved['id'].' - '.$item_saved['name'].')'; ?\u003e\u003c/p\u003e\n                \u003cbutton class=\"notice-dismiss\" type=\"button\"\u003e\n                    \u003cspan class=\"screen-reader-text\"\u003eDismiss this notice.\u003c/span\u003e\n                \u003c/button\u003e\n            \u003c/div\u003e\n\n        \u003c?php endif; ?\u003e\n\n        \u003cform id=\"person-form\" class=\"form-wrap\" method=\"post\" enctype=\"multipart/form-data\"\u003e\n\n            \u003c?php $form-\u003egenerate_form('person-form'); ?\u003e\n\n        \u003c/form\u003e\n\n    \u003c?php else : ?\u003e\n\n        \u003c!-- LIST TABLE --\u003e\n        \u003ch1\u003e\n            \u003c?php echo $list_table-\u003eget_option('plural'); ?\u003e\n            \u003ca class=\"page-title-action\" href=\"\u003c?php echo $plugme-\u003eget_new_item_link(); ?\u003e\"\u003e\n                \u003c?php _e('Add new'); ?\u003e\n            \u003c/a\u003e\n        \u003c/h1\u003e\n\n        \u003cform id=\"person-list-table\" method=\"post\"\u003e\n            \u003c?php\n                $list_table-\u003eprepare_items();\n                $list_table-\u003edisplay();\n            ?\u003e\n        \u003c/form\u003e\n\n    \u003c?php endif; ?\u003e\n\n\n\u003c/div\u003e\n```\n\nCopyright (c) 2016 François Lajoie Licensed under the MIT license (http://opensource.org/licenses/mit-license.php)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1franck%2Fwp-plugme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1franck%2Fwp-plugme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1franck%2Fwp-plugme/lists"}