pre 1.0
This commit is contained in:
parent
c43db02457
commit
9fd4603892
4 changed files with 78 additions and 43 deletions
|
@ -174,6 +174,7 @@ class Keyring_500px_Reactions extends Keyring_Reactions_Base {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
// temporarily hack
|
||||
$baseurl = sprintf( "https://api.500px.com/v1/photos/%s?", $silo_id );
|
||||
$params = array(
|
||||
|
@ -197,6 +198,7 @@ class Keyring_500px_Reactions extends Keyring_Reactions_Base {
|
|||
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
function Keyring_Flickr_Reactions() {
|
||||
|
||||
class Keyring_Flickr_Reactions extends Keyring_Reactions_Base {
|
||||
const SLUG = 'flickr_reactions';
|
||||
const LABEL = 'Flickr - comments and favorites';
|
||||
const SLUG = 'flickr_reactions';
|
||||
const LABEL = 'Flickr - comments and favorites';
|
||||
const KEYRING_SERVICE = 'Keyring_Service_Flickr';
|
||||
const KEYRING_NAME = 'flickr';
|
||||
const REQUESTS_PER_LOAD = 3; // How many remote requests should be made before reloading the page?
|
||||
const NUM_PER_REQUEST = 50; // Number of images per request to ask for
|
||||
const KEYRING_NAME = 'flickr';
|
||||
const REQUESTS_PER_LOAD = 3; // How many remote requests should be made before reloading the page?
|
||||
const NUM_PER_REQUEST = 50; // Number of images per request to ask for
|
||||
|
||||
const SILONAME = 'flickr.com';
|
||||
const SILONAME = 'flickr.com';
|
||||
|
||||
function __construct() {
|
||||
$this->methods = array (
|
||||
|
@ -83,16 +83,16 @@ class Keyring_Flickr_Reactions extends Keyring_Reactions_Base {
|
|||
$author_url = 'https://www.flickr.com/people/' . $element->nsid;
|
||||
|
||||
$c = array (
|
||||
'comment_author' => $name,
|
||||
'comment_author_url' => $author_url,
|
||||
'comment_author' => $name,
|
||||
'comment_author_url' => $author_url,
|
||||
'comment_author_email' => $email,
|
||||
'comment_post_ID' => $post_id,
|
||||
'comment_type' => $type,
|
||||
'comment_date' => date("Y-m-d H:i:s", $element->favedate ),
|
||||
'comment_date_gmt' => date("Y-m-d H:i:s", $element->favedate ),
|
||||
'comment_agent' => get_class($this),
|
||||
'comment_approved' => $auto,
|
||||
'comment_content' => sprintf( $tpl, $author_url, $name ),
|
||||
'comment_post_ID' => $post_id,
|
||||
'comment_type' => $type,
|
||||
'comment_date' => date("Y-m-d H:i:s", $element->favedate ),
|
||||
'comment_date_gmt' => date("Y-m-d H:i:s", $element->favedate ),
|
||||
'comment_agent' => get_class($this),
|
||||
'comment_approved' => $auto,
|
||||
'comment_content' => sprintf( $tpl, $author_url, $name ),
|
||||
);
|
||||
|
||||
$this->insert_comment ( $post_id, $c, $element, $avatar);
|
||||
|
@ -113,11 +113,11 @@ class Keyring_Flickr_Reactions extends Keyring_Reactions_Base {
|
|||
|
||||
while (!$finished) {
|
||||
$params = array(
|
||||
'method' => 'flickr.photos.getFavorites',
|
||||
'api_key' => $this->service->key,
|
||||
'photo_id' => $silo_id,
|
||||
'per_page' => self::NUM_PER_REQUEST,
|
||||
'page' => $page,
|
||||
'method' => 'flickr.photos.getFavorites',
|
||||
'api_key' => $this->service->key,
|
||||
'photo_id' => $silo_id,
|
||||
'per_page' => self::NUM_PER_REQUEST,
|
||||
'page' => $page,
|
||||
);
|
||||
|
||||
$url = $baseurl . http_build_query( $params );
|
||||
|
@ -144,8 +144,27 @@ class Keyring_Flickr_Reactions extends Keyring_Reactions_Base {
|
|||
* COMMENTS
|
||||
*/
|
||||
function get_comments ( $post_id, $silo_id ) {
|
||||
$results = $this->query_comments( $silo_id );
|
||||
/*
|
||||
// <!-- TEMP
|
||||
$lat = get_post_meta($post_id, 'geo_latitude', true);
|
||||
$lon = get_post_meta($post_id, 'geo_longitude', true);
|
||||
if (!empty($lat) && !empty($lon)) {
|
||||
$baseurl = "https://api.flickr.com/services/rest/?";
|
||||
$params = array(
|
||||
'method' => 'flickr.photos.geo.setLocation',
|
||||
'api_key' => $this->service->key,
|
||||
'photo_id' => $silo_id,
|
||||
'lat' => $lat,
|
||||
'lon' => $lon,
|
||||
);
|
||||
$url = $baseurl . http_build_query( $params );
|
||||
Keyring_Util::Debug(sprintf(__('setting geodata for #%s lat: %s long: %s'), $post_id, $lat, $lon));
|
||||
$this->service->request( $url, array( 'method' => $this->request_method, 'timeout' => 10 ) );
|
||||
}
|
||||
// -->
|
||||
*/
|
||||
|
||||
$results = $this->query_comments( $silo_id );
|
||||
if ($results && is_array($results) && !empty($results)) {
|
||||
|
||||
$auto = ( $this->get_option( 'auto_approve' ) == 1 ) ? 1 : 0;
|
||||
|
@ -164,16 +183,16 @@ class Keyring_Flickr_Reactions extends Keyring_Reactions_Base {
|
|||
$author_url = 'https://www.flickr.com/people/' . $element->author;
|
||||
|
||||
$c = array (
|
||||
'comment_author' => $name,
|
||||
'comment_author_url' => $author_url,
|
||||
'comment_author' => $name,
|
||||
'comment_author_url' => $author_url,
|
||||
'comment_author_email' => $email,
|
||||
'comment_post_ID' => $post_id,
|
||||
'comment_type' => $type,
|
||||
'comment_date' => date("Y-m-d H:i:s", $element->datecreate ),
|
||||
'comment_date_gmt' => date("Y-m-d H:i:s", $element->datecreate ),
|
||||
'comment_agent' => get_class($this),
|
||||
'comment_approved' => $auto,
|
||||
'comment_content' => $element->_content
|
||||
'comment_post_ID' => $post_id,
|
||||
'comment_type' => $type,
|
||||
'comment_date' => date("Y-m-d H:i:s", $element->datecreate ),
|
||||
'comment_date_gmt' => date("Y-m-d H:i:s", $element->datecreate ),
|
||||
'comment_agent' => get_class($this),
|
||||
'comment_approved' => $auto,
|
||||
'comment_content' => $element->_content
|
||||
);
|
||||
|
||||
if ( $comment_id = $this->insert_comment ( $post_id, $c, $element, $avatar))
|
||||
|
@ -194,9 +213,9 @@ class Keyring_Flickr_Reactions extends Keyring_Reactions_Base {
|
|||
// Flickr does not seem to support paged comment requests; easier for me...
|
||||
// https://www.flickr.com/services/api/flickr.photos.comments.getList.htm
|
||||
$params = array(
|
||||
'method' => 'flickr.photos.comments.getList',
|
||||
'api_key' => $this->service->key,
|
||||
'photo_id' => $silo_id,
|
||||
'method' => 'flickr.photos.comments.getList',
|
||||
'api_key' => $this->service->key,
|
||||
'photo_id' => $silo_id,
|
||||
);
|
||||
|
||||
$url = $baseurl . http_build_query( $params );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: Keyring Reactions Importer
|
||||
Plugin URI: https://github.com/petermolnar/keyring-reactions-importer
|
||||
Description: A recations (comments, favs, etc. ) importer based on Keyring
|
||||
Version: 0.2
|
||||
Version: 1.0
|
||||
Author: Peter Molnar <hello@petermolnar.eu>
|
||||
Author URI: http://petermolnar.eu/
|
||||
License: GPLv3
|
||||
|
|
32
readme.txt
32
readme.txt
|
@ -2,8 +2,8 @@
|
|||
Contributors: cadeyrn
|
||||
Tags: instagram, facebook, flickr, 500px, backfeed, indieweb, comments, likes, favorites
|
||||
Requires at least: 3.0
|
||||
Tested up to: 4.1
|
||||
Stable tag: 0.3
|
||||
Tested up to: 4.2.1
|
||||
Stable tag: 1.0
|
||||
License: GPLv3
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
@ -13,18 +13,25 @@ A social reactions ( comments, like, favs, etc. ) importer.
|
|||
|
||||
A [backfeed](http://indiewebcamp.com/backfeed) plugin to have all the reaction from all the social networks you have a copy of your post at.
|
||||
|
||||
= How it works =
|
||||
* it checks the `syndication_urls` post meta field populated either by the [Syndication Links](https://wordpress.org/plugins/syndication-links/) plugin or by hand (one syndicated url per line)
|
||||
* based on the activated and available importers it will fire up scheduled jobs to import reactions for each and every post we have the syndication link for the [silo](http://indiewebcamp.com/silo) available
|
||||
|
||||
= Required plugins =
|
||||
* [Keyring](https://wordpress.org/plugins/keyring)
|
||||
* note: to use 500px, you'll need a [not-yet-merged addition to Keyring for 500px](https://github.com/petermolnar/keyring/blob/master/includes/services/extended/500px.php)
|
||||
|
||||
[Keyring](https://wordpress.org/plugins/keyring/) is a dependency; the plugin will not function without it!
|
||||
|
||||
= How it works =
|
||||
The plugin checks the `syndication_urls` post meta field populated either by the [Syndication Links](https://wordpress.org/plugins/syndication-links/) plugin or by hand: one syndicated url per line.
|
||||
|
||||
= Recommended plugins =
|
||||
* [Syndication Links](https://wordpress.org/plugins/syndication-links/)
|
||||
For example, it should look like:
|
||||
|
||||
`https://www.facebook.com/your-facebook-user/posts/facebook-post-id
|
||||
https://www.flickr.com/photos/your-flickr-user/flickr-post-id`
|
||||
|
||||
In case the auto-import is enabled it will fire up scheduled cron job once every day ( not changeable currently ) for each network auto-import is enabled on. The job will query X ( depending on the service it's querying ) posts per request, then fire up a new cron in the background until all posts are processed.
|
||||
|
||||
= Known issues =
|
||||
* due to the nature of the plugin it's highly recommended to use [system cron](https://support.hostgator.com/articles/specialized-help/technical/wordpress/how-to-replace-wordpress-cron-with-a-real-cron-job) for WordPress instead of the built-in version
|
||||
* the plugin can be heavy on load; in this case please consider limiting the import date range on the settings page.
|
||||
|
||||
= Currently supported networks =
|
||||
|
||||
|
@ -33,7 +40,9 @@ A [backfeed](http://indiewebcamp.com/backfeed) plugin to have all the reaction f
|
|||
* [Facebook](https://facebook.com/) - comments, likes
|
||||
* [Instagram](https://instagram.com) - comments, likes
|
||||
|
||||
The plugin uses the brilliant [Keyring](https://wordpress.org/plugins/keyring/) for handling networks and us based on [Keyring Social Importers](https://wordpress.org/plugins/keyring-social-importers/); both from [Beau Lebens](http://dentedreality.com.au/).
|
||||
|
||||
= Credit =
|
||||
Countless thanks for the [Keyring Social Importers](https://wordpress.org/plugins/keyring-social-importers/) and the Keyring plugin from [Beau Lebens](http://dentedreality.com.au/).
|
||||
|
||||
== Installation ==
|
||||
|
||||
|
@ -44,6 +53,11 @@ The plugin uses the brilliant [Keyring](https://wordpress.org/plugins/keyring/)
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0 =
|
||||
*2015-05-01*
|
||||
|
||||
* initial stable release
|
||||
|
||||
= 0.3 =
|
||||
*2015-04-16*
|
||||
|
||||
|
|
Loading…
Reference in a new issue