-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add Genesis Simple Love #64
Open
phpbits
wants to merge
8
commits into
osompress:develop
Choose a base branch
from
phpbits:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7e6ad5b
Add Admin Metabox for Love Button
phpbits a99c580
Love Metabox Styling
phpbits 380aa2a
Add Love Button Preview
phpbits f487fa0
Show Love Icon on Frontend
phpbits 50a65e2
JS Changes
phpbits fd0731c
Minify JS
phpbits 77eeec2
Fix Count Update onClick
phpbits b55a5de
Formatting issue and fixes from NicktheGeek
phpbits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** | ||
* Create ajax handle for checking cookies | ||
* and updating metadata | ||
* | ||
* @since 1.0.7 | ||
* @uses important genesis_simple_love ajax used. | ||
* @param nonce, post_id | ||
* @return json datatype | ||
*/ | ||
if( ! class_exists( 'Genesis_Simple_Share_AJAX' ) ){ | ||
class Genesis_Simple_Share_AJAX{ | ||
function __construct(){ | ||
add_action( 'wp_ajax_genesis_simple_love', array( $this, 'ajax_love' )); | ||
add_action( 'wp_ajax_nopriv_genesis_simple_love', array( $this, 'ajax_love' )); | ||
} | ||
|
||
function ajax_love() { | ||
$result = array(); | ||
$nonce = $_REQUEST['nonce']; | ||
$post_id = url_to_postid( $_REQUEST['data_url'] ); | ||
$loved = array(); | ||
|
||
if ( !wp_verify_nonce( $nonce, 'genesis_love' )) { | ||
exit( 'You don\'t have any power here!' ); | ||
} | ||
|
||
$handle = ''; | ||
if( isset( $_COOKIE['genesis_simple_love'] ) ){ | ||
$loved = @unserialize(base64_decode($_COOKIE['genesis_simple_love'])); | ||
} | ||
|
||
//get love | ||
if( isset( $_REQUEST['data'] ) && 'getCount' == $_REQUEST['data'] ){ | ||
echo '{"url":"'. $_REQUEST['data_url'] .'","count":"'. (int) get_post_meta($post_id, '_genesis_simple_love_', true) .'"}'; | ||
die(); | ||
} | ||
|
||
//save love | ||
if ( is_array( $loved ) && !in_array( $post_id, $loved ) ){ | ||
$loved[] = $post_id; | ||
$post_loved = (int) get_post_meta($post_id, '_genesis_simple_love_', true); | ||
$post_loved++; | ||
update_post_meta( $post_id, '_genesis_simple_love_', $post_loved ); | ||
|
||
$_COOKIE['genesis_simple_love'] = base64_encode(serialize($loved)); | ||
setcookie( 'genesis_simple_love', $_COOKIE['genesis_simple_love'] , time()+(10*365*24*60*60),'/' ); | ||
|
||
$result['type'] = 'success'; | ||
$result['message'] = apply_filters( 'genesis_simple_love_message', __('Thank You for loving this!', 'genesis-simple-share' ) ); | ||
$result['count'] = $post_loved; | ||
$result['id'] = $post_id; | ||
} else { | ||
$post_loved = (int) get_post_meta( $post_id, '_genesis_simple_love_', true ); | ||
$result['type'] = 'error'; | ||
$result['message'] = apply_filters( 'genesis_simple_loved', __( 'You already loved this. Thanks!', 'genesis-simple-share' ) ); | ||
$result['count'] = $post_loved; | ||
$result['id'] = $post_id; | ||
} | ||
|
||
echo $result = json_encode( $result ); | ||
die(); | ||
} | ||
} | ||
new Genesis_Simple_Share_AJAX(); | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
jQuery Sharrre Plugin | ||
=== | ||
Make your sharing widget! | ||
Sharrre is a jQuery plugin that allows you to create nice widgets sharing for Facebook, Twitter, Google Plus (with PHP script) and more. | ||
More information on [Sharrre] (http://sharrre.com/#demos) | ||
Usage | ||
=== | ||
$('#sharrre').sharrre({ | ||
share: { | ||
googlePlus: true, | ||
facebook: true, | ||
twitter: true | ||
}, | ||
url: 'http://sharrre.com' | ||
}); | ||
Example | ||
=== | ||
<div id="demo1" data-title="sharrre" data-url="http://sharrre.com" ></div> | ||
$(document).ready(function(){ | ||
$('#demo1').sharrre({ | ||
share: { | ||
googlePlus: true, | ||
facebook: true, | ||
twitter: true, | ||
delicious: true | ||
}, | ||
buttons: { | ||
googlePlus: {size: 'tall'}, | ||
facebook: {layout: 'box_count'}, | ||
twitter: {count: 'vertical'}, | ||
delicious: {size: 'tall'} | ||
}, | ||
hover: function(api, options){ | ||
$(api.element).find('.buttons').show(); | ||
}, | ||
hide: function(api, options){ | ||
$(api.element).find('.buttons').hide(); | ||
} | ||
}); | ||
}); | ||
See example on [official website] (http://sharrre.com/#demos) | ||
Dependencies | ||
=== | ||
jQuery 1.7 | ||
Author | ||
=== | ||
- [Julien Hany](http://hany.fr) | ||
- [Twitter (@_JulienH)](http://twitter.com/_JulienH) | ||
- [Google+](http://plus.google.com/111637545317893682325) | ||
jQuery Sharrre Plugin | ||
=== | ||
|
||
Make your sharing widget! | ||
Sharrre is a jQuery plugin that allows you to create nice widgets sharing for Facebook, Twitter, Google Plus (with PHP script) and more. | ||
More information on [Sharrre] (http://sharrre.com/#demos) | ||
|
||
Usage | ||
=== | ||
|
||
$('#sharrre').sharrre({ | ||
share: { | ||
googlePlus: true, | ||
facebook: true, | ||
twitter: true | ||
}, | ||
url: 'http://sharrre.com' | ||
}); | ||
|
||
Example | ||
=== | ||
|
||
<div id="demo1" data-title="sharrre" data-url="http://sharrre.com" ></div> | ||
$(document).ready(function(){ | ||
$('#demo1').sharrre({ | ||
share: { | ||
googlePlus: true, | ||
facebook: true, | ||
twitter: true, | ||
delicious: true | ||
}, | ||
buttons: { | ||
googlePlus: {size: 'tall'}, | ||
facebook: {layout: 'box_count'}, | ||
twitter: {count: 'vertical'}, | ||
delicious: {size: 'tall'} | ||
}, | ||
hover: function(api, options){ | ||
$(api.element).find('.buttons').show(); | ||
}, | ||
hide: function(api, options){ | ||
$(api.element).find('.buttons').hide(); | ||
} | ||
}); | ||
}); | ||
|
||
See example on [official website] (http://sharrre.com/#demos) | ||
|
||
|
||
Dependencies | ||
=== | ||
|
||
jQuery 1.7 | ||
|
||
Author | ||
=== | ||
|
||
- [Julien Hany](http://hany.fr) | ||
- [Twitter (@_JulienH)](http://twitter.com/_JulienH) | ||
- [Google+](http://plus.google.com/111637545317893682325) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
please document all functions/methods.