This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Modification of `paginate_links()` Wordpress built-in function. | |
* Returns an array of objects describing links instead of generating HTML for links. | |
* @param array $args Same as `paginate_links()` arguments array. Exceptions: `classes` mapping for CSS classes; `type` is ignored | |
* @return array Returns an array of objects representing links that can be used to generate HTML | |
*/ | |
function paginate_links_array($args = '') { | |
$defaults = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Safely auto-link HTML content. | |
* Doesn't double-link existing content. | |
* Plus logging features | |
* @param string $html | |
* @return string | |
*/ | |
function safe_autolink($html) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Fix esc_url/clean_url. Instead of escaping `&` to numeric character entities, this filter encodes them as `&` | |
* Some browsers (such as Android Chrome 33.0.1750.170) don't parse `&` correctly inside `<script src="..."></script>` tags. | |
* Such browsers leave out or otherwise mangle query string parameters. | |
* For instance, for a URL like `//maps.googleapis.com/maps/api/js?key=xxxx&sensor=false` the `sensor` parameter is not being sent to the server correctly. | |
*/ | |
function lpowers_fix_url_entities($url, $original_url, $_context) { | |
$bad_entity = "&"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Quick-and-dirty class for managing WordPress options for a plugin. | |
* Include this class in your plugin. Create an instance and use as follows: | |
* | |
* Required Usage: | |
* | |
* // Create new instance | |
* $settings = new wordpress_settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Launch a new PHP process at the given URL | |
* @param string $url | |
*/ | |
public function spawn_request($url) { | |
$url_a = parse_url($url); | |
$port = isset($url_a["port"]) ? $url_a["port"] : 80; | |
$fp = fsockopen($url_a["host"], $port, $errno, $errstr, 30); | |
$output = "GET " . $url_a["path"] . "?" . $url_a["query"] . " HTTP/1.0\r\n"; | |
$output .= "Host: " . $url_a["host"] . "\r\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ignore everything in the root except the "wp-content" directory. | |
/* | |
!.gitignore | |
!wp-content/ | |
# Ignore everything in the "wp-content" directory, except the "plugins" and "themes" directories. | |
wp-content/* | |
!wp-content/plugins/ | |
!wp-content/themes/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* USAGE: | |
* - Search and replace the `CUSTOM_SITEMAP` string with a lowercase identifier name: e.g., "vehicles", "customer_profiles" | |
* - The `your_alternate_data_source()` function does not exist; it's simply a placeholder for your own function that returns some sort of data array. | |
* - Uses heredocs for inline XML: https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* USAGE: | |
* - Configure the return value of the `CUSTOM_SITEMAP_post_types` to required post type(s) - otherwise populates sitemap with all posts and pages | |
* - Search and replace the `CUSTOM_SITEMAP` string with a lowercase identifier name: e.g., "myseo", "vehicles", "customer_profiles", "postspage", etc. | |
* - Uses heredocs for inline XML: https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: CORSWP - CORS in WordPress | |
* Plugin URI: http://leepowers.co/ | |
* Description: Enable CORSWP in WordPress | |
* Version: 0.0.1 | |
* Author: Lee Powers | |
* Author URI: http://leepowers.co/ | |
* Text Domain: cors-in-wp |