public function get_followers()
 {
     require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-social-media.php';
     $sm = new Social_Media();
     $data = [];
     if (isset($_GET['fb']) and $_GET['fb']) {
         $data['fb'] = $_GET['fb'];
         $data['fb_count'] = $sm->getFacebookCount($_GET['fb']);
     }
     if (isset($_GET['insta']) and $_GET['insta']) {
         $data['insta'] = $_GET['insta'];
         $data['insta_count'] = $sm->getInstagramCount($_GET['insta']);
     }
     if (isset($_GET['twitter']) and $_GET['twitter']) {
         $data['twitter'] = $_GET['twitter'];
         $data['twitter_count'] = $sm->getTwitterCount($_GET['twitter']);
     }
     wp_die(json_encode($data));
 }
 public function getTwitterCount($TWITTER_USERNAME)
 {
     if (!self::$CONNECTION) {
         self::$CONNECTION = $this->getConnectionWithAccessToken(self::$CONSUMER_KEY, self::$CONSUMER_SECRET, self::$ACCESS_TOKEN, self::$ACCESS_TOKEN_SECRET);
     }
     $data = self::$CONNECTION->get('users/show', array('screen_name' => $TWITTER_USERNAME));
     if (@$data->followers_count) {
         return $data->followers_count;
     } else {
         return 0;
     }
 }
Esempio n. 3
0
<?php

/**
 * Developed by Jay Gaha
 * http://jaygaha.com.np
 */
$type = isset($_GET['type']) ? $_GET['type'] : 0;
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
include 'includes/inc.php';
include "../master_admin/includes/classes/class.music_properties.php";
include "../master_admin/includes/classes/class.socialmedia.php";
$properties = new Music_Properties();
$social = new Social_Media();
$validType = array('company', 'artist');
if (!in_array($type, $validType) || $id == 0) {
    header("Location: home.php");
}
$data['type'] = $type;
$data['id'] = $id;
$data['rows'] = $properties->get_all_rows('social');
$data['exsocial'] = $social->get_all_rows($type, $id);
// echo "<pre>"; print_r($data);exit;
layout('form_social', $data);
<?php

/**
 * Developed by Jay Gaha
 * http://jaygaha.com.np
 */
include "includes/functions.php";
include "includes/classes/class.socialmedia.php";
$type = isset($_POST['type']) ? strtolower($_POST['type']) : 'company';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $social = new Social_Media();
    $id = $_POST['id'];
    //delete all the existing links before adding into table
    $deletes = $social->delete($type, $id);
    // echo "<pre>"; print_r($deletes);
    $socials = array_filter($_POST['social_media']);
    if (count($socials) > 0) {
        foreach ($socials as $key => $value) {
            $social_id = $key;
            $social_value = $value;
            $social->add(array('social_id' => $key, 'social_link' => $value, 'field' => $type, 'type_id' => $id));
        }
    }
}
/*
		echo "<pre>";
		print_r($_POST);
		print_r($_FILES); exit;*/
header('Location: ' . $type . '.php?act=added');