The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
| <?php | |
| function prefix_check_direct_download_link(){ | |
| $request = $_SERVER['REQUEST_URI']; | |
| $parts = explode('&', $request); | |
| // $parts[0] would be ?download_file=<product_id> | |
| // We are assuming here... because that's how WooCommerce currently has the URL structured. | |
| // A more full-proof way would be to use regex |
| <?php // Simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. ?> | |
| <html> | |
| <head> | |
| <title>DNSBL Lookup Tool - IP Blacklist Check Script</title> | |
| </head> | |
| <body> | |
| <h2>IP Blacklist Check Script</h2> | |
| <form action="" method="get"> | |
| <input type="text" value="" name="ip"/> | |
| <input type="submit" value="LOOKUP"/> |
| #!/bin/bash | |
| # This is a simple script that copies files and directories to a folder, and then zips up that folder. | |
| # You can think of it as sort of a low level deployment script, at least thats what I use it for; | |
| # To quickly create a zip using only the files needed for the production version of a WordPress plugin which I then upload to CodeCanyon. | |
| # Feel free to extend and modify for your particular use-case. | |
| # Instructions: | |
| # From your command line, navigate to location of script and then execute it using command: | |
| # sh prepare.sh |
| <?php | |
| function nf_filter_redirect_url( $action_settings, $form_id, $action_id, $form_settings ) { | |
| if( $form_id !== <id> ){ | |
| return $action_settings; | |
| } | |
| // more conditions can be added as needed | |
| // doc: https://developer.ninjaforms.com/codex/submission-processing-hooks/ |
| <?php | |
| // Outputs an easy to read call trace | |
| // Credit: https://www.php.net/manual/en/function.debug-backtrace.php#112238 | |
| function generateCallTrace() | |
| { | |
| $e = new Exception(); | |
| $trace = explode("\n", $e->getTraceAsString()); | |
| // reverse array to make steps line up chronologically |
| <?php | |
| /* | |
| Plugin Name: Import Users From CSV | |
| Description: Imports users from a CSV file | |
| Version: 1.0.0 | |
| Author: Uriahs Victor | |
| Author URI: https://uriahsvictor.com | |
| License: GPL v2 | |
| */ |
| #!/bin/bash | |
| php path/to/makepot.php wp-plugin /path/to/your/plugin pluginname.pot | |
| #php path/to/makepot.php wp-theme /path/to/your/theme themename.pot |
| <?php | |
| /* | |
| Usecase: | |
| You might have an important task within your plugin/theme that requires WP CRON working flawlessly. If a user website has little traffic, WP CRON is turned off via wp_config.php, or there is an issue with WP CRON; your scheduled task will not fire. | |
| The code below allows you to set a value in minutes after which a notice(or whatever else you might want to happen) would appear in the user admin dashboard. | |
| Users can permanently dismiss the notice. |