Skip to content

Commit

Permalink
Merge branch 'master' into ghi-11
Browse files Browse the repository at this point in the history
  • Loading branch information
lautarodragan authored Nov 27, 2018
2 parents 918e0a6 + 104162e commit 1706499
Show file tree
Hide file tree
Showing 12 changed files with 1,567 additions and 16 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ rules
screenshots
temp.text
vault.json
vendor
vendor
vendor/
*.zip
build

7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,4 @@ The Po.et WordPress plugin welcomes additions from developers. To ensure code is

To ensure your code is formatted the WordPress way, you can run the PHP code sniffer using the WordPress coding ruleset. There are various ways to install both PHPCS and the WordPress coding ruleset, but the easiest method is to install it globally using Composer. Assuming you have Composer and PHPCS installed and available from the command line, run the following from a terminal (assuming you are on Linux or a *nix derivative):

```
composer global require wp-coding-standards/wpcs
phpcs --config-set installed_paths ~/.composer/vendor/wp-coding-standards/wpc
```

It is also assumed you have Composer installed in your home directory, so you may need to adjust the `installed_paths` directive to match your Composer installation directory.
You can run PHP CodeSniffer with `composer run-script lint` and `composer run-script clean` to automatically fix the style errors if possible.
20 changes: 19 additions & 1 deletion admin/class-poet-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ public function register_setting() {
$this->plugin, // Page.
'poet_setting_section_id' // Section.
);
add_settings_field(
'backfill', // ID.
__( 'Backfill all posts' ), // Title.
array( $this, 'backfill_callback' ), // Callback.
$this->plugin, // Page.
'poet_setting_section_id' // Section.
);
}

/**
Expand Down Expand Up @@ -170,6 +177,9 @@ public function sanitize( $input ) {
if ( isset( $input['active'] ) ) {
$new_input['active'] = (int) $input['active'];
}
if ( isset( $input['backfill'] ) ) {
$new_input['backfill'] = (int) $input['backfill'];
}

return $new_input;
}
Expand Down Expand Up @@ -212,13 +222,21 @@ public function active_callback() {
echo '<input type="checkbox" id="active" name="poet_option[active]" ' . checked( 1, $checked, false ) . ' />';
}

/**
* Returns backfill checkbox input
*/
public function backfill_callback() {
$checked = isset( get_option( 'poet_option' )['backfill'] ) ? 1 : 0;
echo '<input type="checkbox" id="backfill" name="poet_option[backfill]" ' . checked( 1, $checked, false ) . ' />';
}


/**
* Registration of settings page in WordPress options menu
*/
public function add_options_page() {
add_options_page( __( 'Po.et' ),
add_options_page(
__( 'Po.et' ),
__( 'Po.et' ),
'manage_options',
$this->plugin,
Expand Down
26 changes: 26 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "poet/wordpress-plugin",
"description": "WordPress plugin for Po.et",
"keywords": [
"wordpress-plugin",
"wordpress"
],
"license": "GNU",
"type": "wordpress-plugin",
"require": {
"php": "^7.0.0"
},
"require-dev": {
"phpunit/phpunit": "6.0",
"squizlabs/php_codesniffer": "3.*",
"wp-coding-standards/wpcs": "1.2.0"
},
"scripts": {
"test": "phpunit",
"lint": "phpcs",
"clean": "phpcbf",
"wp-package": "zip -r poet.zip admin assets includes languages LICENSE poet.php public readme.txt"
},
"minimum-stability": "dev",
"prefer-stable": true
}
Loading

0 comments on commit 1706499

Please sign in to comment.