Example #1
0
 protected function setUp()
 {
     $this->config = new LfTest();
     $this->config->setPropValues("prod");
     $this->network = Livefyre::getNetwork($this->config->NETWORK_NAME, $this->config->NETWORK_KEY);
     $this->site = $this->network->getSite($this->config->SITE_ID, $this->config->SITE_KEY);
 }
 protected function setUp()
 {
     $this->config = new LfTest();
     $this->config->setPropValues("prod");
     $this->network = Livefyre::getNetwork($this->config->NETWORK_NAME, $this->config->NETWORK_KEY);
     $this->site = $this->network->getSite($this->config->SITE_ID, $this->config->SITE_KEY);
     $this->collection = $this->site->buildCommentsCollection($this->config->TITLE, $this->config->ARTICLE_ID, $this->config->URL);
 }
 public static function init_shortcode($atts = array())
 {
     if (!self::show_blog()) {
         return;
     }
     if (isset($atts['article_id'])) {
         $articleId = $atts['article_id'];
         $title = isset($pagename) ? $pagename : 'Comments (ID: ' . $atts['article_id'];
         global $wp;
         $url = add_query_arg($_SERVER['QUERY_STRING'], '', home_url($wp->request));
         $tags = array();
     } else {
         global $post;
         if (get_the_ID() !== false) {
             $articleId = apply_filters('livefyre_article_id', get_the_ID());
             $title = apply_filters('livefyre_collection_title', get_the_title(get_the_ID()));
             $url = apply_filters('livefyre_collection_url', get_permalink(get_the_ID()));
             $tags = array();
             $posttags = get_the_tags($post->ID);
             if ($posttags) {
                 foreach ($posttags as $tag) {
                     array_push($tags, $tag->name);
                 }
             }
         } else {
             return;
         }
     }
     Livefyre_Apps::init_auth();
     $network = get_option('livefyre_apps-livefyre_domain_name', 'livefyre.com');
     $network = $network == '' ? 'livefyre.com' : $network;
     $siteId = get_option('livefyre_apps-livefyre_site_id');
     $siteKey = get_option('livefyre_apps-livefyre_site_key');
     $network_key = get_option('livefyre_apps-livefyre_domain_key', '');
     $network = Livefyre::getNetwork($network, strlen($network_key) > 0 ? $network_key : null);
     $site = $network->getSite($siteId, $siteKey);
     $collectionMetaToken = $site->buildCollectionMetaToken($title, $articleId, $url, array("tags" => $tags, "type" => "liveblog"));
     $checksum = $site->buildChecksum($title, $url, $tags, 'liveblog');
     $strings = apply_filters('livefyre_custom_blog_strings', null);
     $livefyre_element = 'livefyre-blog-' . $articleId;
     return LFAPPS_View::render_partial('script', compact('siteId', 'siteKey', 'network', 'articleId', 'collectionMetaToken', 'checksum', 'strings', 'livefyre_element'), 'blog', true);
 }
 public static function generate_wp_user_token()
 {
     $current_user = wp_get_current_user();
     $network_key = get_option('livefyre_apps-livefyre_domain_key', '');
     $network = Livefyre::getNetwork(get_option('livefyre_apps-livefyre_domain_name', 'livefyre.com'), strlen($network_key) > 0 ? $network_key : null);
     return $network->buildUserAuthToken($current_user->ID . '', $current_user->display_name, 3600);
 }