class Akismet_REST_API { /** * Register the REST API routes. */ public static function init() { if ( ! function_exists( 'register_rest_route' ) ) { // The REST API wasn't integrated into core until 4.4, and we support 4.0+ (for now). return false; } register_rest_route( 'akismet/v1', '/key', array( array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_key' ), ), array( 'methods' => WP_REST_Server::EDITABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'set_key' ), 'args' => array( 'key' => array( 'required' => true, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ), 'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ), ), ), ), array( 'methods' => WP_REST_Server::DELETABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'delete_key' ), ) ) ); register_rest_route( 'akismet/v1', '/settings/', array( array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_settings' ), ), array( 'methods' => WP_REST_Server::EDITABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'set_boolean_settings' ), 'args' => array( 'akismet_strictness' => array( 'required' => false, 'type' => 'boolean', 'description' => __( 'If true, Akismet will automatically discard the worst spam automatically rather than putting it in the spam folder.', 'akismet' ), ), 'akismet_show_user_comments_approved' => array( 'required' => false, 'type' => 'boolean', 'description' => __( 'If true, show the number of approved comments beside each comment author in the comments list page.', 'akismet' ), ), ), ) ) ); register_rest_route( 'akismet/v1', '/stats', array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_stats' ), 'args' => array( 'interval' => array( 'required' => false, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_interval' ), 'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ), 'default' => 'all', ), ), ) ); register_rest_route( 'akismet/v1', '/stats/(?P[\w+])', array( 'args' => array( 'interval' => array( 'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ), 'type' => 'string', ), ), array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_stats' ), ) ) ); register_rest_route( 'akismet/v1', '/alert', array( array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_alert' ), 'args' => array( 'key' => array( 'required' => false, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ), 'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ), ), ), ), array( 'methods' => WP_REST_Server::EDITABLE, 'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'set_alert' ), 'args' => array( 'key' => array( 'required' => false, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ), 'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ), ), ), ), array( 'methods' => WP_REST_Server::DELETABLE, 'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'delete_alert' ), 'args' => array( 'key' => array( 'required' => false, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ), 'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ), ), ), ) ) ); } /** * Get the current Akismet API key. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function get_key( $request = null ) { return rest_ensure_response( Akismet::get_api_key() ); } /** * Set the API key, if possible. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function set_key( $request ) { if ( defined( 'WPCOM_API_KEY' ) ) { return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be changed via the API.', 'akismet' ), array( 'status'=> 409 ) ) ); } $new_api_key = $request->get_param( 'key' ); if ( ! self::key_is_valid( $new_api_key ) ) { return rest_ensure_response( new WP_Error( 'invalid_key', __( 'The value provided is not a valid and registered API key.', 'akismet' ), array( 'status' => 400 ) ) ); } update_option( 'wordpress_api_key', $new_api_key ); return self::get_key(); } /** * Unset the API key, if possible. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function delete_key( $request ) { if ( defined( 'WPCOM_API_KEY' ) ) { return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be deleted.', 'akismet' ), array( 'status'=> 409 ) ) ); } delete_option( 'wordpress_api_key' ); return rest_ensure_response( true ); } /** * Get the Akismet settings. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function get_settings( $request = null ) { return rest_ensure_response( array( 'akismet_strictness' => ( get_option( 'akismet_strictness', '1' ) === '1' ), 'akismet_show_user_comments_approved' => ( get_option( 'akismet_show_user_comments_approved', '1' ) === '1' ), ) ); } /** * Update the Akismet settings. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function set_boolean_settings( $request ) { foreach ( array( 'akismet_strictness', 'akismet_show_user_comments_approved', ) as $setting_key ) { $setting_value = $request->get_param( $setting_key ); if ( is_null( $setting_value ) ) { // This setting was not specified. continue; } // From 4.7+, WP core will ensure that these are always boolean // values because they are registered with 'type' => 'boolean', // but we need to do this ourselves for prior versions. $setting_value = Akismet_REST_API::parse_boolean( $setting_value ); update_option( $setting_key, $setting_value ? '1' : '0' ); } return self::get_settings(); } /** * Parse a numeric or string boolean value into a boolean. * * @param mixed $value The value to convert into a boolean. * @return bool The converted value. */ public static function parse_boolean( $value ) { switch ( $value ) { case true: case 'true': case '1': case 1: return true; case false: case 'false': case '0': case 0: return false; default: return (bool) $value; } } /** * Get the Akismet stats for a given time period. * * Possible `interval` values: * - all * - 60-days * - 6-months * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function get_stats( $request ) { $api_key = Akismet::get_api_key(); $interval = $request->get_param( 'interval' ); $stat_totals = array(); $response = Akismet::http_post( Akismet::build_query( array( 'blog' => get_option( 'home' ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' ); if ( ! empty( $response[1] ) ) { $stat_totals[$interval] = json_decode( $response[1] ); } return rest_ensure_response( $stat_totals ); } /** * Get the current alert code and message. Alert codes are used to notify the site owner * if there's a problem, like a connection issue between their site and the Akismet API, * invalid requests being sent, etc. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function get_alert( $request ) { return rest_ensure_response( array( 'code' => get_option( 'akismet_alert_code' ), 'message' => get_option( 'akismet_alert_msg' ), ) ); } /** * Update the current alert code and message by triggering a call to the Akismet server. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function set_alert( $request ) { delete_option( 'akismet_alert_code' ); delete_option( 'akismet_alert_msg' ); // Make a request so the most recent alert code and message are retrieved. Akismet::verify_key( Akismet::get_api_key() ); return self::get_alert( $request ); } /** * Clear the current alert code and message. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function delete_alert( $request ) { delete_option( 'akismet_alert_code' ); delete_option( 'akismet_alert_msg' ); return self::get_alert( $request ); } private static function key_is_valid( $key ) { $response = Akismet::http_post( Akismet::build_query( array( 'key' => $key, 'blog' => get_option( 'home' ) ) ), 'verify-key' ); if ( $response[1] == 'valid' ) { return true; } return false; } public static function privileged_permission_callback() { return current_user_can( 'manage_options' ); } /** * For calls that Akismet.com makes to the site to clear outdated alert codes, use the API key for authorization. */ public static function remote_call_permission_callback( $request ) { $local_key = Akismet::get_api_key(); return $local_key && ( strtolower( $request->get_param( 'key' ) ) === strtolower( $local_key ) ); } public static function sanitize_interval( $interval, $request, $param ) { $interval = trim( $interval ); $valid_intervals = array( '60-days', '6-months', 'all', ); if ( ! in_array( $interval, $valid_intervals ) ) { $interval = 'all'; } return $interval; } public static function sanitize_key( $key, $request, $param ) { return trim( $key ); } } 5 Back to School Dad Hacks /** * Redux Framework is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * any later version. * * Redux Framework is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Redux Framework. If not, see . * * @package Redux Framework * @subpackage Spectrum Color Picker * @author Kevin Provance (kprovance) * @version 1.0.0 */ // Exit if accessed directly if( !defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if( !class_exists( 'ReduxFramework_color_rgba' ) ) { /** * Main ReduxFramework_color_rgba class * * @since 1.0.0 */ class ReduxFramework_color_rgba { /** * Class Constructor. Defines the args for the extions class * * @since 1.0.0 * @access public * @param array $field Field sections. * @param array $value Values. * @param array $parent Parent object. * @return void */ public function __construct( $field = array(), $value ='', $parent ) { // Set required variables $this->parent = $parent; $this->field = $field; $this->value = $value; $defaults = array( 'color' => '', 'alpha' => 1, 'rgba' => '' ); $this->value = wp_parse_args( $this->value, $defaults ); $this->field['options']['show_input'] = isset($this->field['options']['show_input']) ? $this->field['options']['show_input'] : true; $this->field['options']['show_initial'] = isset($this->field['options']['show_initial']) ? $this->field['options']['show_initial'] : false; $this->field['options']['show_alpha'] = isset($this->field['options']['show_alpha']) ? $this->field['options']['show_alpha'] : true; $this->field['options']['show_palette'] = isset($this->field['options']['show_palette']) ? $this->field['options']['show_palette'] : false; $this->field['options']['show_palette_only'] = isset($this->field['options']['show_palette_only']) ? $this->field['options']['show_palette_only'] : false; $this->field['options']['max_palette_size'] = isset($this->field['options']['max_palette_size']) ? $this->field['options']['max_palette_size'] : 10; $this->field['options']['show_selection_palette'] = isset($this->field['options']['show_selection_palette']) ? $this->field['options']['show_selection_palette'] : false; $this->field['options']['allow_empty'] = isset($this->field['options']['allow_empty']) ? $this->field['options']['allow_empty'] : true; $this->field['options']['clickout_fires_change'] = isset($this->field['options']['clickout_fires_change']) ? $this->field['options']['clickout_fires_change'] : false; $this->field['options']['choose_text'] = isset($this->field['options']['choose_text']) ? $this->field['options']['choose_text'] : 'Choose'; $this->field['options']['cancel_text'] = isset($this->field['options']['cancel_text']) ? $this->field['options']['cancel_text'] : 'Cancel'; $this->field['options']['show_buttons'] = isset($this->field['options']['show_buttons']) ? $this->field['options']['show_buttons'] : true; $this->field['options']['palette'] = isset($this->field['options']['palette']) ? $this->field['options']['palette'] : null; $this->field['options']['input_text'] = isset($this->field['options']['input_text']) ? $this->field['options']['input_text'] : 'Select Color'; // Convert empty array to null, if there. $this->field['options']['palette'] = empty($this->field['options']['palette']) ? null : $this->field['options']['palette']; $this->field['output_transparent'] = isset($this->field['output_transparent']) ? $this->field['output_transparent'] : false; } /** * Field Render Function. * * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { $field_id = $this->field['id']; // Color picker container echo '
'; // Colour picker layout $opt_name = $this->parent->args['opt_name']; if ('' == $this->value['color'] || 'transparent' == $this->value['color']) { $color = ''; } else { $color = Redux_Helpers::hex2rgba($this->value['color'], $this->value['alpha']); } if ($this->value['rgba'] == ''){ $this->value['rgba'] = Redux_Helpers::hex2rgba($this->value['color'], $this->value['alpha']); } echo ''; echo ''; // Hidden input for alpha channel echo ''; // Hidden input for rgba echo ''; echo '
'; } /** * Enqueue Function. * * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { // Set up min files for dev_mode = false. $min = Redux_Functions::isMin(); // Field dependent JS if (!wp_script_is ( 'redux-field-color-rgba-js' )) { wp_enqueue_script( 'redux-field-color-rgba-js', ReduxFramework::$_url . 'inc/fields/color_rgba/field_color_rgba' . Redux_Functions::isMin() . '.js', array('jquery', 'redux-spectrum-js'), time(), true ); } // Spectrum CSS if (!wp_style_is ( 'redux-spectrum-css' )) { wp_enqueue_style('redux-spectrum-css'); } if ($this->parent->args['dev_mode']) { if (!wp_style_is ( 'redux-field-color-rgba-css' )) { wp_enqueue_style( 'redux-field-color-rgba-css', ReduxFramework::$_url . 'inc/fields/color_rgba/field_color_rgba.css', array(), time(), 'all' ); } } } /** * getColorVal. Returns formatted color val in hex or rgba. * * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access private * @return string */ private function getColorVal(){ // No notices $color = ''; $alpha = 1; $rgba = ''; // Must be an array if (is_array($this->value)) { // Enum array to parse values foreach($this->value as $id => $val) { // Sanitize alpha if ($id == 'alpha') { $alpha = !empty($val) ? $val : 1; } elseif ($id == 'color') { $color = !empty($val) ? $val : ''; } elseif ($id == 'rgba') { $rgba = !empty($val) ? $val : ''; $rgba = Redux_Helpers::hex2rgba($color, $alpha); } } // Only build rgba output if alpha ia less than 1 if ( $alpha < 1 && $alpha <> '' ) { $color = $rgba; } } return $color; } /** * Output Function. * * Used to enqueue to the front-end * * @since 1.0.0 * @access public * @return void */ public function output() { if (!empty($this->value)) { $style = ''; $mode = ( isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'color' ); $color_val = $this->getColorVal(); $style .= $mode . ':' . $color_val . ';'; if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $css = Redux_Functions::parseCSS( $this->field['output'], $style, $color_val ); $this->parent->outputCSS .= $css; } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $css = Redux_Functions::parseCSS( $this->field['compiler'], $style, $color_val ); $this->parent->compilerCSS .= $css ; } } } } }

Follow me

5 Back to School DAD Hacks
August 4, 2015|Fatherhood

5 Back to School DAD Hacks

5 Back to School DAD Hacks

School time is here!!!

Here are 5 Ways You Can Rock Back to School… (This post contains affiliate links of products we like)

5 Back to School Dad Hacks

 

 

1.  Take Care of Your Wife

Alright men, lets be honest…most of us let our better half take care of most of the prep work involved in the start of a new school year.  Am I right?  (No? Ok, well man, kudos to you – you win Dad of the year!  Take the following advice for YOURSELF)

Want some brownie points?  Take my advise…Give your wife a:

“You Survived the Summer” present

My wife loves Etsy.  You really can’t go too wrong with an Etsy Gift card or a unique gift from there.  Or check out these gift ideas.

No present money left after school supplies?  That’s ok…it’s nothing that an at home date won’t fix.  Go to your local store and buy some of her favorite sweets – for my wife, it’s Blue Bell Ice Cream but it could be your wife’s favorite candy bar or candy.  Write a heart felt note telling her how much you appreciate all the work she’s done to take care of your family…in your own handwriting.  It doesn’t have to be poetry…just a few sentences expressing your love and appreciation.

Stumped?  Check out LifeHack’s 10 Ideas for Writing a Letter of Love.

After the kids are asleep, put a table cloth or sheet over the kitchen table, light a candle and put on some music…bring your wife in and have a mini date.  If you want to make those brownie points increase exponentially during dinner time, take on some of her normal duties – whatever they might be…do the dishes, put the kids to bed while she relaxes…you get the point.  Rack up those brownie points!

You Survived Summer

2. Back-to-School Break Outs

Steal your kids away at night so they can tell you all about school. Moms might not like this one too much but its so impactful that she’ll go for it. Put your kids to bed as usual and then 10 mins later (hopefully before they really fall asleep) wake them up and take them on a special get away. We have a RaceTrack near our home with a frozen yogurt bar so sometimes I’ll take them to get something special. As we down our late night treat, ask them questions about how school is going.

Have trouble thinking of what to ask?

Sign Up to receive Bearded Nom Nom’s “10 After School Starter Questions” via email:

OR – Take your kids on a night safari BEFORE bed. Grab a flash light and investigate the yard, search for bugs – let them lead! If you find anything interesting, sit down and talk about it…look up any specimens you find on Google. Or just simply go for a night stroll – they’ll love it!

3. Home Invasion

Plan a Home Invasion!

After a few weeks or two everyone is settling into a routine and things might be getting a little bit boring, so why not shake it up a little?  Try setting up one of the following for when the kids arrive home from school (if you can’t be there before they get home from school, have your wife or relative take your kids out while you setup):

Water Balloon War – Fill up some water balloons of two different colors (forget the old fashioned way, check THESE OUT) and put them in two different laundry baskets (bags or boxes can be used instead) and tell them to pick a side (color) and meet you in the backyard.  Be there ready and waiting!  Want to really make them laugh?  Use paint or your wife’s makeup (be gentle, they don’t really like their makeup messed with) to put on some war paint!  War it out and have a snack ready for afterward.  They’ll never forget it!

Nerf Gun Battle – It’s Daddy vs EVERYONE!  Same premise as the water balloon war but this time it’s nerf guns and there are only two teams – YOU vs everyone (mom included). To make it fair, we think Dad should get this bad boy:  Nerf CS-18 N-Strike Elite Rapidstrike

Again, think ahead and have a snack waiting when everyone is done.  It doesn’t have to be fancy – maybe just fruit snacks…or popcorn.

They are Ready

Scavenger Hunt – Plan out a scavenger hunt and have a treat for the whole family once the hunt is complete.  This could be a family movie night or their favorite dessert. There are so many different ways to do scavenger hunts for different age levels – check out the ideas we’ve rounded up.

4. 1st Day of School Daddy Breakfast

I don’t know how things go down in your house but on hurried mornings in our house, a Daddy Breakfast staple is DONUTS!  My kids love donuts and it’s a quick and easy buy in the mornings. Little effort – great reward!  ESPECIALLY if I pick up some chocolate milk to go with breakfast!  Yes, the bad for you kind.  But hey, if you’re health conscious – good for you…maybe you could make your own healthier version of donuts by using one of these cool things or by following this healthy recipe without that thing.

You don’t have to do donuts – my kids love biscuits & gravy, eggs and bacon OR you could do pancakes like Mickey over at YourModernDad does and REALLY win them over.

5. Start an Adventure

You hear it all the time – Reading is good for your kids…well, that’s because, it is.  While I admit, my wife does most of the reading to our kids and sometimes to me – it’s never too late for you to start an adventure through one of your favorite books with your kids.  Just 10 minutes of reading before bed will help your kids establish a good bed time routine when they’re starting back to school.

Here are a few of our favorites:

I know you’re SUPERDad but don’t attempt to do all 5 hacks at once!  Take it a week at a time and enjoy your kids – that’s what it’s all about!

Tell us what Dad Hack you’re going to try in the comments!

If you liked this post you will like these as well:

15 Fun Ways to Initiate Wrestling with Your Kids

The Lost Art of Wrestling with Your Kids

2 coments
Share

2 coments

  • August 28, 2015 at 12:11 pm

    Wow! Who raised you? Whoever did deserves a medal, pat on the back and maybe bonus pay! GREAT POST! Shared it on Twitter (new follower here) and StumbleUpon.
    Please make a note to stop by my blog on Tues eve 7pm EDT to share this? The Wonderful Wednesday Blog Hop starts each Tues night and my readers will go CRAZY over this ♥
    Now …. how to get my husband to read this … Hmmm.
    Sinea

    • August 29, 2015 at 4:20 am

      Well thanks! My wife and I take parenting our 4 children pretty seriously so we’ve done a lot of reading and learning from those who have walked this path before. The wrestling credit goes to my dad though. Some of my best memories. Thanks for letting me know about Tues. night – I’ll be there! How to get your husband to read it? Print it out and set it in front of the toilet with a note attached that says: special treat if you read this…with a wink…then give him his favorite dessert if he reads it. When all else fails, do what my wife does…read it to him in a non-expectant, passive way. And, regardless of the outcome, give him the dessert anyway.

  • Comments are closed.

    Maybe Something Good?
    About Bearded Nom Nom
    Encouraging fathers, beards, integrity...beards...fun...and more beards.
    My Wife Wrote a Book!
    Whatcha Think?