-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 2.0.0 released and ready for test and deploy #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,15 @@ | |
* Plugin URI: https://github.com/deshack/pinit | ||
* Description: Handy plugin that adds Pinterest Follow Button, Pin Widget, Profile Widget and Board Widget to your WordPress site. | ||
* Author: deshack | ||
* Version: 1.0.1 | ||
* Version: 2.0.0 | ||
* Author URI: http://www.deshack.net | ||
* License: GPLv2 or later | ||
*/ | ||
|
||
/*=== SETUP | ||
*==============================*/ | ||
|
||
define( 'PINIT_VERSION', '1.0.1' ); | ||
define( 'PINIT_VERSION', '2.0.0' ); | ||
|
||
// Load text domain | ||
function pit_text_start() { | ||
|
@@ -27,7 +27,7 @@ function pit_text_start() { | |
* @since 1.0.1 Moved from wp_head to wp_footer | ||
*/ | ||
function pit_pinit_js() { | ||
echo '<script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>' . "\n"; | ||
echo '<script async defer data-pin-hover="true" data-pin-color="red" data-pin-tall="true" type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>' . "\n"; | ||
} | ||
add_action( 'wp_footer', 'pit_pinit_js', 9999 ); | ||
|
||
|
@@ -43,36 +43,56 @@ function pit_admin_scripts() { | |
/*=== SHORTCODES | ||
*==============================*/ | ||
|
||
function pit_follow_shortcode( $atts ) { | ||
$atts = extract( shortcode_atts( array( | ||
'url' => 'http://www.pinterest.com/pinterest/', | ||
'text' => 'Follow', | ||
), $atts ) ); | ||
|
||
return '<a data-pin-do="buttonFollow" href="' . $url . '">' . $text . '</a>'; | ||
} | ||
|
||
function pit_pin_shortcode( $atts ) { | ||
$atts = extract( shortcode_atts( array( | ||
'url' => 'http://www.pinterest.com/pin/99360735500167749/', | ||
'size' => 'small', | ||
), $atts ) ); | ||
|
||
return '<a data-pin-do="embedPin" href="' . $url . '"></a>'; | ||
if ($size == 'large' || $size == 'medium') { | ||
$width = 'data-pin-width="' . $size . '" '; | ||
} | ||
|
||
else { | ||
$width = ''; | ||
} | ||
|
||
|
||
return '<a data-pin-do="embedPin" ' . $width . 'href="' . $url . '"></a>'; | ||
} | ||
|
||
function pit_profile_shortcode( $atts ) { | ||
$atts = extract( shortcode_atts( array( | ||
'url' => 'http://www.pinterest.com/pinterest/', | ||
'imgWidth' => '92', | ||
'boxHeight' => '175', | ||
'boxWidth' => 'auto' | ||
'url' => 'https://www.pinterest.com/pinterest/', | ||
'imgwidth' => '80', | ||
'boxheight' => '400', | ||
'boxwidth' => '400', | ||
), $atts ) ); | ||
|
||
return '<a data-pin-do="embedUser" href="' . $url . '" data-pin-scale-width="' . $imgWidth . '" data-pin-scale-height="' . $boxHeight . '" data-pin-board-width="' . $boxWidth . '"></a>'; | ||
return '<a data-pin-do="embedUser" data-pin-board-width="' . $boxwidth . '" data-pin-scale-height="' . $boxheight . '" data-pin-scale-width="' . $imgwidth . '" href="' . $url . '"></a>'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just followed your codebase and moved some value before href for personal needing but it's good to me if you want use a |
||
} | ||
|
||
function pit_board_shortcode( $atts ) { | ||
$atts = extract( shortcode_atts( array( | ||
'url' => 'http://www.pinterest.com/pinterest/pin-pets/', | ||
'imgWidth' => '92', | ||
'boxHeight' => '175', | ||
'boxWidth' => 'auto' | ||
'url' => 'https://www.pinterest.com/pinterest/pin-tips/', | ||
'imgwidth' => '80', | ||
'boxheight' => '400', | ||
'boxwidth' => '400', | ||
), $atts ) ); | ||
|
||
return '<a data-pin-do="embedBoard" href="' . $url . '" data-pin-scale-width="' . $imgWidth . '" data-pin-scale-height="' . $boxHeight . '" data-pin-board-width="' . $boxWidth . '"></a>'; | ||
return '<a data-pin-do="embedBoard" data-pin-board-width="' . $boxwidth . '" data-pin-scale-height="' . $boxheight . '" data-pin-scale-width="' . $imgwidth . '" href="' . $url . '"></a>'; | ||
} | ||
|
||
add_shortcode( 'pit-follow', 'pit_follow_shortcode' ); | ||
add_shortcode( 'pit-pin', 'pit_pin_shortcode' ); | ||
add_shortcode( 'pit-profile', 'pit_profile_shortcode' ); | ||
add_shortcode( 'pit-board', 'pit_board_shortcode' ); | ||
|
@@ -101,7 +121,7 @@ function __construct() { | |
* @see WP_Widget::widget() | ||
* | ||
* @param array $args. Widget arguments. | ||
* @param rray $instance. Saved values from database. | ||
* @param array $instance. Saved values from database. | ||
*/ | ||
public function widget( $args, $instance ) { | ||
extract( $args ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use a ternary operator in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, good point. As I said here I just followed your codebase and made some copy/paste/mods but if you want improve it, I can only agree :)