{"id":23503732,"url":"https://github.com/patelutkarsh/wp-nonce-wrapper","last_synced_at":"2025-05-05T16:26:19.988Z","repository":{"id":57057002,"uuid":"50050321","full_name":"PatelUtkarsh/wp-nonce-wrapper","owner":"PatelUtkarsh","description":"Simplified usage of WordPress nonce ","archived":false,"fork":false,"pushed_at":"2021-10-13T14:26:13.000Z","size":34,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T17:56:20.162Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PatelUtkarsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-20T18:20:36.000Z","updated_at":"2021-10-13T14:26:16.000Z","dependencies_parsed_at":"2022-08-24T07:30:26.856Z","dependency_job_id":null,"html_url":"https://github.com/PatelUtkarsh/wp-nonce-wrapper","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatelUtkarsh%2Fwp-nonce-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatelUtkarsh%2Fwp-nonce-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatelUtkarsh%2Fwp-nonce-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatelUtkarsh%2Fwp-nonce-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatelUtkarsh","download_url":"https://codeload.github.com/PatelUtkarsh/wp-nonce-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252532911,"owners_count":21763494,"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","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":[],"created_at":"2024-12-25T08:31:04.131Z","updated_at":"2025-05-05T16:26:19.970Z","avatar_url":"https://github.com/PatelUtkarsh.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wp-nonce-wrapper\nUse WordPress Nonce an object oriented way \n\n[![Build Status](https://travis-ci.org/PatelUtkarsh/wp-nonce-wrapper.svg?branch=master)](https://travis-ci.org/PatelUtkarsh/wp-nonce-wrapper)\n\n## Installation:\n\n```\n\"spock/wp-nonce-wrapper\": \"0.4\"\n```\n\nto your composer.json file and run a `composer update`\n\nOr \n```\ncomposer require spock/wp-nonce-wrapper\n```\n\n## Usage:\n\nGet Nonce with expiry:\n```php\nuse spock\\helper\\Nonce_Wrapper;\n$nonce_obj = new Nonce_Wrapper('doing_some_form_job', 60*60); // 60 sec * 60 min = 1hr; Note: default is 1 day.\n$nonce = $nonce_obj-\u003ecreate_nonce();\n```\n\nVerify Nonce:\n\n```php\n$nonce = $_REQUEST['nonce'];\n$nonce_obj = new Nonce_Wrapper('doing_some_form_job');\nif ( $nonce_obj-\u003everify_nonce( $nonce ) )\n    //Verified Source \nelse \n    // Unknown Source\n```\n\nCreate nonce input field:\n\n```php\n//This will echo input field\n$nonce_obj-\u003ecreate_nonce_field();\n```\n\nCreate nonce url \n```php\n$url   = $nonce_obj-\u003ecreate_nonce_url( 'http://w.org' );\n```\n\nCheck user is coming from another admin page.\n \n ```php\n // This will check current url \n if ($nonce_obj-\u003echeck_admin_referral())\n    //doing it right\n else \n    //doing it wrong\n ```\n \n \n## Changelog\n\n### 0.4 ###\n* Remove php magic method usage\n* Refactor code\n* Improved documentation\n\n### 0.3 ###\n* Nonce expire control added\n* Added missing nonce function\n\n### 0.2 ###\n* Nonce field support \n* Nonce url support\n* Check user is coming from admin referral\n\n### 0.1 ###\n* Initial basic functionality\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatelutkarsh%2Fwp-nonce-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatelutkarsh%2Fwp-nonce-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatelutkarsh%2Fwp-nonce-wrapper/lists"}