| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Juicer |
| 4 |
* Plugin URI: http://www.juicer.io |
| 5 |
* Description: Add and embed a social media feed to your site with a shortcode. |
| 6 |
* Version: 1.1 |
| 7 |
* Author: Ryan MacInnes |
| 8 |
* Author URI: http://www.goddamnyouryan.com |
| 9 |
* License: GPLv2 or later |
| 10 |
*/ |
| 11 |
|
| 12 |
/* |
| 13 |
This program is free software; you can redistribute it and/or |
| 14 |
modify it under the terms of the GNU General Public License |
| 15 |
as published by the Free Software Foundation; either version 2 |
| 16 |
of the License, or (at your option) any later version. |
| 17 |
|
| 18 |
This program is distributed in the hope that it will be useful, |
| 19 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
GNU General Public License for more details. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License |
| 24 |
along with this program; if not, write to the Free Software |
| 25 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 26 |
*/ |
| 27 |
|
| 28 |
|
| 29 |
class Juicer_Feed { |
| 30 |
|
| 31 |
public function render( $args ) { |
| 32 |
|
| 33 |
$defaults = array( |
| 34 |
'name' => 'error', |
| 35 |
'columns' => '3' |
| 36 |
); |
| 37 |
|
| 38 |
$args = wp_parse_args( (array) $args, $defaults); |
| 39 |
|
| 40 |
wp_enqueue_script( |
| 41 |
'juicerembed', |
| 42 |
'//assets.juicer.io/embed.js' |
| 43 |
); |
| 44 |
|
| 45 |
wp_enqueue_style( |
| 46 |
'juicerstyle', |
| 47 |
'//assets.juicer.io/embed.css' |
| 48 |
); |
| 49 |
?> |
| 50 |
<ul class="juicer-feed" data-columns="<?php echo $args['columns']; ?>" data-feed-id="<?php echo $args['name']; ?>"></ul> |
| 51 |
<?php |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
function juicer_feed( $args ) { |
| 56 |
$feed = new Juicer_Feed(); |
| 57 |
$feed ->render( $args ); |
| 58 |
} |
| 59 |
|
| 60 |
function juicer_shortcode( $args ) { |
| 61 |
extract( shortcode_atts( array( |
| 62 |
'name' => 'error', |
| 63 |
'columns' => '3' |
| 64 |
), $args ) ); |
| 65 |
|
| 66 |
$feed = new Juicer_Feed(); |
| 67 |
|
| 68 |
$feed->render( $args ); |
| 69 |
} |
| 70 |
|
| 71 |
add_shortcode( 'juicer', 'juicer_shortcode' ); |
| 72 |
?> |
| 73 |
|