Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ahmadawais/WP-OOP-Settings-API
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: mihdan/wp-oop-settings-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 20 commits
  • 10 files changed
  • 2 contributors

Commits on Feb 14, 2020

  1. Create composer.json

    Mikhail Kobzarev authored Feb 14, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c4287e2 View commit details
  2. Update composer.json

    Mikhail Kobzarev authored Feb 14, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    caae6c8 View commit details
  3. Update composer.json

    Mikhail Kobzarev authored Feb 14, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b5bbd6f View commit details
  4. Add Ahmad Awais to composer.json

    Mikhail Kobzarev committed Feb 14, 2020
    Copy the full SHA
    5528557 View commit details
  5. Update composer.json

    Mikhail Kobzarev authored Feb 14, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a1e19a2 View commit details
  6. Update project structure

    Mikhail Kobzarev committed Feb 14, 2020
    Copy the full SHA
    19f6ef0 View commit details
  7. Update namespace, psr-4 supports

    Mikhail Kobzarev committed Feb 14, 2020
    Copy the full SHA
    fad104c View commit details
  8. Update composer.json

    Mikhail Kobzarev committed Feb 14, 2020
    Copy the full SHA
    5778b7b View commit details
  9. Add plugin name, version, slug

    Mikhail Kobzarev committed Feb 14, 2020
    Copy the full SHA
    3ce1570 View commit details

Commits on Jul 20, 2020

  1. Copy the full SHA
    1e5d325 View commit details

Commits on Feb 7, 2021

  1. Copy the full SHA
    e11a6a1 View commit details

Commits on Mar 23, 2023

  1. WPCS Version

    mihdan authored Mar 23, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5f1c3d7 View commit details
  2. Update README.md

    mihdan authored Mar 23, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f90143f View commit details
  3. Update README.md

    mihdan authored Mar 23, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    334f9b5 View commit details
  4. Update README.md

    mihdan authored Mar 23, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4eadfd5 View commit details

Commits on Mar 24, 2023

  1. Create FUNDING.yml

    mihdan authored Mar 24, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d20a8ca View commit details
  2. Copy the full SHA
    c410a19 View commit details
  3. Copy the full SHA
    28e10e3 View commit details
  4. Copy the full SHA
    7b8773e View commit details
  5. Copy the full SHA
    37aeae8 View commit details
Showing with 1,612 additions and 968 deletions.
  1. +27 −0 .editorconfig
  2. +2 −0 .github/FUNDING.yml
  3. +8 −0 CHANGELOG.md
  4. +17 −47 README.md
  5. +0 −919 class-wp-osa.php
  6. +45 −0 composer.json
  7. +4 −2 { → examples}/wposa-init.php
  8. +43 −0 phpcs.xml
  9. +18 −0 psalm.xml
  10. +1,448 −0 src/WPOSA.php
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[{.jshintrc,*.json,*.yml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[phpcs.xml]
indent_style = space
indent_size = 4
insert_final_newline = false
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

custom: https://www.kobzarev.com/donate/
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

## 2.0.0
- The minimum supported version of PHP 7.4 is set
- Added WPCS config
- Added Psalm config
- Added hidden field
- Added getters/setters for constructor variables
64 changes: 17 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
<h1 align="center">
<img src="https://i.imgur.com/gVEqftv.jpg" />
![](https://i.imgur.com/gVEqftv.jpg)

WordPress OOP Settings API
# WordPress OOP Settings API

</h1>
[![Tweet for help](https://img.shields.io/twitter/follow/mihdan_dev.svg?style=social&label=Tweet%20@MrAhmadAwais)](https://twitter.com/mrahmadawais/) [![GitHub stars](https://img.shields.io/github/stars/ahmadawais/WP-OOP-Settings-API.svg?style=social&label=Stars)](https://github.com/ahmadawais/WP-OOP-Settings-API/stargazers) [![GitHub followers](https://img.shields.io/github/followers/ahmadawais.svg?style=social&label=Follow)](https://github.com/ahmadawais?tab=followers):point_up: Make sure you :star: and :eyes: this repository!

> Ever wanted to build custom settings inside your WordPress plugin or theme and didn't like the non-DRY approach for creating custom settings via WordPress API? Well, that's why and when I wrote this OOP Wrapper for WordPress Settings API. 🎊
[![Tweet for help](https://img.shields.io/twitter/follow/mrahmadawais.svg?style=social&label=Tweet%20@MrAhmadAwais)](https://twitter.com/mrahmadawais/) [![GitHub stars](https://img.shields.io/github/stars/ahmadawais/WP-OOP-Settings-API.svg?style=social&label=Stars)](https://github.com/ahmadawais/WP-OOP-Settings-API/stargazers) [![GitHub followers](https://img.shields.io/github/followers/ahmadawais.svg?style=social&label=Follow)](https://github.com/ahmadawais?tab=followers):point_up: Make sure you :star: and :eyes: this repository!
## Documentation

> Ever wanted to build custom settings inside your WordPress plugin or theme and didn't like the non-DRY approach for creating custom settings via WordPress API? Well, that's why and when I wrote this OOP Wrapper for WordPress Settings API. 🎊
#### Sidebar

![Screenshots](https://on.ahmda.ws/qPBC/c)
```php
$wposa->add_sidebar_card(
[
'id' => 'donate',
'title' => __( 'Enjoyed WPOSA?', 'wposa' ),
'desc' => __( '<p>Please leave us a <a href="https://wordpress.org/support/plugin/mihdan-index-now/reviews/#new-post" target="_blank" title="Rate &amp; review it">★★★★★</a> rating. We really appreciate your support</p>', 'wposa' ),
]
);
```

## Screenshots

@@ -40,52 +48,14 @@
- [ ] Tutorials
- [ ] Blog post
- [ ] Documentation
- [ ] Re-factor the code with WP Standards
- [x] Re-factor the code with WP Standards
- [ ] Re-factor the code into classes

![License](https://on.ahmda.ws/qNys/c)

## License
Release under GNU GPL v2.0


![Credits](https://on.ahmda.ws/qOxs/c)

## Credits

@AhmadAwais, @deviorobert, @MaedahBatool
AND @WordPress, @tareq1988, @royboy789, @twigpress.


---
![image](https://on.ahmda.ws/qP9p/c)
### 🙌 [WPCOUPLE PARTNERS](https://WPCouple.com/partners):
This open source project is maintained by the help of awesome businesses listed below. What? [Read more about it →](https://WPCouple.com/partners)

<table width='100%'>
<tr>
<td width='333.33'><a target='_blank' href='https://www.gravityforms.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtrE/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://kinsta.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mu5O/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://wpengine.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mto3/c' /></a></td>
</tr>
<tr>
<td width='333.33'><a target='_blank' href='https://www.sitelock.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtyZ/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://wp-rocket.me/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtrv/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://blogvault.net/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtph/c' /></a></td>
</tr>
<tr>
<td width='333.33'><a target='_blank' href='https://cridio.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtmy/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://wecobble.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtrW/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://www.cloudways.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mu0C/c' /></a></td>
</tr>
<tr>
<td width='333.33'><a target='_blank' href='https://www.cozmoslabs.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mu9W/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://wpgeodirectory.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtwv/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://www.wpsecurityauditlog.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtkh/c' /></a></td>
</tr>
<tr>
<td width='333.33'><a target='_blank' href='https://mythemeshop.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/n3ug/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://www.liquidweb.com/?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mtnt/c' /></a></td>
<td width='333.33'><a target='_blank' href='https://WPCouple.com/contact?utm_source=WPCouple&utm_medium=Partner'><img src='https://on.ahmda.ws/mu3F/c' /></a></td>
</tr>
</table>
AND @WordPress, @tareq1988, @royboy789, @twigpress, @mihdan
919 changes: 0 additions & 919 deletions class-wp-osa.php

This file was deleted.

45 changes: 45 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "mihdan/wp-oop-settings-api",
"description": "WP-OOP-Settings-API is a Settings API wrapper built with Object Oriented Programming practices.",
"type": "library",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Mikhail Kobzarev",
"email": "mikhail@kobzarev.com"
},
{
"name": "Ahmad Awais",
"email": "me@AhmadAwais.com"
}
],
"autoload": {
"psr-4": {
"Mihdan\\WPOSA\\": "src/"
}
},
"config": {
"platform": {
"php": "7.4"
}
},
"require": {
"php": ">=7.4",
"ext-json": "*"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.6",
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.3",
"php-coveralls/php-coveralls": "^v2.4",
"vimeo/psalm": "^4.20",
"humanmade/psalm-plugin-wordpress": "^2.0"
},
"scripts": {
"phpcs": "phpcs --standard=./phpcs.xml",
"phpcbf": "phpcbf --standard=./phpcs.xml",
"psalm": "psalm --config=./psalm.xml"
}
}
6 changes: 4 additions & 2 deletions wposa-init.php → examples/wposa-init.php
Original file line number Diff line number Diff line change
@@ -5,13 +5,15 @@
* Description: Settings API wrapper built with Object Oriented Programming practices.
* Author: mrahmadawais, WPTie, deviodigital
* Author URI: http://AhmadAwais.com/
* Version: 1.0.0
* Version: 1.0.4
* License: GPL2+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*
* @package WPOSA
*/

namespace Mihdan\WPOSA;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -24,7 +26,7 @@
*/
// Plugin version.
if ( ! defined( 'WPOSA_VERSION' ) ) {
define( 'WPOSA_VERSION', '1.0.0' );
define( 'WPOSA_VERSION', '1.0.4' );
}

if ( ! defined( 'WPOSA_NAME' ) ) {
43 changes: 43 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<ruleset name="WordPress Plugin Coding Standards">
<description>A custom set of code standard rules to check for WordPress plugins.</description>

<!-- What to scan -->
<file>.</file>
<exclude-pattern>*/\.github/*</exclude-pattern>
<exclude-pattern>*/examples/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>

<!-- How to scan -->
<arg value="sp"/><!-- Show sniff and progress -->
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
<arg name="extensions" value="php"/>
<arg name="parallel" value="12"/><!-- Enables parallel processing when available for faster results. -->
<arg name="cache" value=".phpcs.cache"/>

<config name="installed_paths" value="vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-paragonie,vendor/phpcompatibility/phpcompatibility-wp,vendor/wp-coding-standards/wpcs"/>
<config name="testVersion" value="7.4-"/>

<!-- Rules: Check PHP version compatibility -->
<rule ref="PHPCompatibility"/>
<rule ref="PHPCompatibilityWP"/>

<!-- Rules: WordPress Coding Standards -->
<config name="minimum_supported_wp_version" value="5.1"/>

<rule ref="WordPress">
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
<exclude name="WordPress.PHP.DisallowShortTernary.Found"/>
<exclude name="WordPress.PHP.YodaConditions" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="PEAR.NamingConventions.ValidClassName.Invalid" />
</rule>

<!-- Allow symbol `/` in hook names. -->
<rule ref="WordPress.NamingConventions.ValidHookName">
<properties>
<property name="additionalWordDelimiters" value="/" />
</properties>
</rule>
</ruleset>
18 changes: 18 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
<directory name="examples"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="PsalmWordPress\Plugin"/></plugins>
</psalm>
1,448 changes: 1,448 additions & 0 deletions src/WPOSA.php

Large diffs are not rendered by default.