Commit 5b01225e authored by Isaque Melo's avatar Isaque Melo

#1 Use options(client id, secret) to api.php. Replaces cache to 1h

parent 1f153b4e
......@@ -2,9 +2,15 @@
require 'modules/facebook/index.php';
// Facebook
function get_facebook_shares( $data ) {
$access_token = '1855140564616229|32c79e113db5a2911aeed2c4ca330b3f';
$access_token = '693244528146031|ae2b14c2d4f31b3434212179ee5550d8';
function get_facebook_shares( $data ) {
if (!get_option( 'fb_app_id' ) || !get_option( 'fb_app_secret' )) {
return false;
}
// example
// $access_token = '1855140564616229|32c79e113db5a2911aeed2c4ca330b3f';
$access_token = get_option( 'fb_app_id' ). '|' . get_option( 'fb_app_secret' );
$post_id = $data['post_id'];
......
......@@ -116,10 +116,11 @@ function get_posts_ranking() {
array_push( $ids, $value->post_id );
}
wp_cache_add( $cache_key, $ids, 120 );
// stores in cache for 1 hour
wp_cache_add( $cache_key, $ids, 3600 );
}
var_dump($ids);
//var_dump($ids);
return $ids;
}
......
<?php
// in the fucture change namespace to facebook
namespace guaraci;
function need_share_update( $post_id ) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment