Skip to content

Instantly share code, notes, and snippets.

View ryanhellyer's full-sized avatar

Ryan Hellyer ryanhellyer

View GitHub Profile
@ryanhellyer
ryanhellyer / SharePulse.php
Last active August 29, 2015 14:05
Allow for addition of extra post-types by providing a filter on the get_posts() arguments.
--- <SharePulse.php>
+++ <SharePulse.php>
@@ -159,14 +159,16 @@
$options = $this->get_sp_options();
- $ids = get_posts(array(
- 'orderby' => 'comment_count',
- 'posts_per_page' => -1,
- 'cache_results' => false,
@ryanhellyer
ryanhellyer / simple-colorbox-settings
Created September 10, 2012 17:27
Simple Colorbox settings
<?php
define( 'SIMPLECOLORBOX_THEME', 5 ); // Can choose from 1, 2, 3, 4 or 5
define( 'SIMPLECOLORBOX_OPACITY', 0.6 ); // Background opacity (0 to 1)
define( 'SIMPLECOLORBOX_WIDTH', 90 ); // Colorbox width (0 to 100%)
define( 'SIMPLECOLORBOX_HEIGHT', 90 ); // Colorbox height (0 to 100%)
define( 'SIMPLECOLORBOX_SLIDESHOW', null ); // Colorbox width (0 to 100%)Setting this to null will remove the slideshow
?>
@ryanhellyer
ryanhellyer / Search_query_via_api
Created October 7, 2012 14:02
Search query via API
<form role="search" method="get" id="searchform" action="" >
<label class="screen-reader-text" for="s">Search for:</label>
<input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
@ryanhellyer
ryanhellyer / get_request_flaw
Created October 7, 2012 13:55
$_GET vulnerability
<form role="search" method="get" id="searchform" action="" >
<label class="screen-reader-text" for="s">Search for:</label>
<input type="text" value="<?php echo $_GET['s']; ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
@ryanhellyer
ryanhellyer / integer_option_update
Created October 7, 2012 14:03
Integer option update
<?php
$data = (int) $_POST['data'];
update_option( 'some_data', $data );
?>
@ryanhellyer
ryanhellyer / inappropriate_php_self
Created October 7, 2012 14:05
Inappropriate use of PHP_SELF in form
<form action="<?php echo $_SERVER['PHP_SELF']; ?>">
@ryanhellyer
ryanhellyer / sanitized_php_self_form
Created October 7, 2012 14:06
Sanitized php_self form
<form action="<?php echo esc_url( $_SERVER['PHP_SELF'] ); ?>">
@ryanhellyer
ryanhellyer / no_url_specd
Created October 7, 2012 14:07
No URL specified in form
<form action="">
@ryanhellyer
ryanhellyer / search_query
Created October 7, 2012 14:01
Search query
<form role="search" method="get" id="searchform" action="" >
<label class="screen-reader-text" for="s">Search for:</label>
<input type="text" value="<?php echo esc_attr( $_GET['s'] ); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
@ryanhellyer
ryanhellyer / raw_post_option_update
Created October 7, 2012 14:03
Raw post option update
<?php
$data = $_POST['data'];
update_option( 'some_data', $data );
?>