Settings'; array_unshift($links, $settings_link); return $links; } } add_filter("plugin_action_links_".plugin_basename(__FILE__), 'aklamatorinfeed_plugin_settings_link' ); /* * Add rate and review link in plugin section */ if( !function_exists("aklamatorinfeed_plugin_meta_links")) { function aklamatorINfeed_plugin_meta_links($links, $file) { $plugin = plugin_basename(__FILE__); // create link if ($file == $plugin) { return array_merge( $links, array('Please rate and review') ); } return $links; } } add_filter( 'plugin_row_meta', 'aklamatorinfeed_plugin_meta_links', 10, 2); /* * Activation Hook */ register_activation_hook( __FILE__, 'set_up_options_aklamator_infeed' ); function set_up_options_aklamatorinfeed(){ add_option('aklamatorinfeed_username', ''); add_option('aklamatorinfeed_profile_photo', ''); add_option('aklamatorinfeed_user_id', ''); add_option('aklamatorinfeed_access_token', ''); add_option('aklamatorinfeedApplicationID', ''); add_option('aklamatorinfeedPoweredBy', ''); add_option('aklamatorinfeedSingleWidgetID', ''); add_option('aklamatorinfeedPageWidgetID', ''); add_option('aklamatorinfeedSingleWidgetTitle', ''); add_option('aklamatorinfeedWidgets', ''); } /* * Uninstall Hook */ register_uninstall_hook(__FILE__, 'aklamatorinfeed_uninstall'); function aklamatorinfeed_uninstall() { delete_option('aklamatorinfeed_username'); delete_option('aklamatorinfeed_profile_photo'); delete_option('aklamatorinfeed_user_id'); delete_option('aklamatorinfeed_access_token'); delete_option('aklamatorinfeedApplicationID'); delete_option('aklamatorinfeedPoweredBy'); delete_option('aklamatorinfeedSingleWidgetID'); delete_option('aklamatorinfeedPageWidgetID'); delete_option('aklamatorinfeedSingleWidgetTitle'); delete_option('aklamatorinfeedWidgets'); } class AklamatorINfeedWidget { private static $instance = null; /** * Get singleton instance */ public static function init() { if (self::$instance == null) { self::$instance = new self(); } return self::$instance; } public $aklamator_url; public $api_data; public $popular_channels = array( array( 'name' => 'YouTube Spotlight', 'url' => 'https://www.youtube.com/user/youtube' ), array( 'name' => 'PewDiePie', 'url' => 'https://www.youtube.com/user/PewDiePie/' ), array( 'name' => 'EmiMusic', 'url' => 'https://www.youtube.com/user/emimusic' ), array( 'name' => 'FunToyzCollector', 'url' => 'https://www.youtube.com/user/disneycollectorbr' ) ); public function __construct() { $this->aklamator_url = "https://aklamator.com/"; // $this->aklamator_url = "http://192.168.5.60/aklamator/www/"; if (is_admin()) { add_action("admin_menu", array( &$this, "adminMenu" )); add_action('admin_init', array( &$this, "setOptions" )); } if (isset($_GET['page']) && $_GET['page'] == 'aklamator-infeed' ) { if (get_option('aklamatorinfeedApplicationID') !== '') { $this->api_data = $this->addNewWebsiteApi(); } if (isset($this->api_data->flag) && $this->api_data->flag) { update_option('aklamatorinfeedWidgets', $this->api_data); } } if (get_option('aklamatorinfeedSingleWidgetID') !== 'none') { if (get_option('aklamatorinfeedSingleWidgetID') == '') { if (isset($this->api_data->data)) { $selected = ""; foreach ($this->api_data->data as $item) { if ($item->title == 'Initial Instagram widget created') { $selected = $item->uniq_name; } } if ($selected != "") { update_option('aklamatorinfeedSingleWidgetID', $selected); } else { update_option('aklamatorinfeedSingleWidgetID', $this->api_data->data[0]->uniq_name); } } } add_filter('the_content', array($this, 'bottom_of_every_post_infeed')); } if (get_option('aklamatorinfeedPageWidgetID') !== 'none') { if (get_option('aklamatorinfeedPageWidgetID') == '') { if (isset($this->api_data->data)) { $selected = ""; foreach ($this->api_data->data as $item) { if ($item->title == 'Initial Instagram widget created') { $selected = $item->uniq_name; } } if ($selected != "") { update_option('aklamatorinfeedPageWidgetID', $selected); } else { update_option('aklamatorinfeedPageWidgetID', $this->api_data->data[0]->uniq_name); } } } add_filter('the_content', array($this, 'bottom_of_every_post_infeed')); } } function bottom_of_every_post_infeed($content){ /* we want to change `the_content` of posts, not pages and the text file must exist for this to work */ if (is_single()){ $widget_id = get_option('aklamatorinfeedSingleWidgetID'); }elseif (is_page()) { $widget_id = get_option('aklamatorinfeedPageWidgetID'); }else{ /* if `the_content` belongs to a page or our file is missing the result of this filter is no change to `the_content` */ return $content; } $return_content = $content; if (strlen($widget_id) >= 7) { $title = ""; if (get_option('aklamatorinfeedSingleWidgetTitle') !== '') { $title .= "

" . get_option('aklamatorinfeedSingleWidgetTitle') . "

"; } /* append the text file contents to the end of `the_content` */ $return_content .= $title . '
' . '
'; } return $return_content; } function getinfeedfeedforAklamator() { $empty = array(array( 'link' => '', 'created_time' => '', 'thumbnail_url' => '', 'caption' => '', 'username' => '', 'full_name' => '', )); $media = file_get_contents("http://instagram.com/{$this->username}/media"); if(strlen($media) < 1) return $empty; $json = json_decode($media); if(!isset($json->items) || count($json->items) == 0) return $empty; $results = array(); foreach( $json->items as $item ) { $results[] = array( 'link' => $item->link, 'created_time' => $item->created_time, 'thumbnail_url' => $item->images->standard_resolution->url, 'caption' => isset( $item->caption->text ) ? $item->caption->text : '', 'username' => $item->user->username, 'full_name' => $item->user->full_name, ); } return $results; } function setOptions() { register_setting('aklamatorinfeed-options', 'aklamatorinfeed_username'); register_setting('aklamatorinfeed-options', 'aklamatorinfeed_profile_photo'); register_setting('aklamatorinfeed-options', 'aklamatorinfeed_user_id'); register_setting('aklamatorinfeed-options', 'aklamatorinfeed_access_token'); register_setting('aklamatorinfeed-options', 'aklamatorinfeedApplicationID'); register_setting('aklamatorinfeed-options', 'aklamatorinfeedPoweredBy'); register_setting('aklamatorinfeed-options', 'aklamatorinfeedSingleWidgetID'); register_setting('aklamatorinfeed-options', 'aklamatorinfeedPageWidgetID'); register_setting('aklamatorinfeed-options', 'aklamatorinfeedSingleWidgetTitle'); } public function adminMenu() { add_menu_page('Aklamator - INfeed', 'Aklamator INfeed', 'manage_options', 'aklamator-infeed', array( $this, 'createAdminPage' ), content_url() . '/plugins/aklamator-infeed/images/aklamator-icon.png'); } public function getSignupUrl() { $user_info = wp_get_current_user(); return $this->aklamator_url . 'login/application_id?utm_source=wordpress&utm_medium=wpinfeed&e=' . urlencode(get_option('admin_email')) . '&pub=' . preg_replace('/^www\./','',$_SERVER['SERVER_NAME']). '&un=' . urlencode($user_info->user_login). '&fn=' . urlencode($user_info->user_firstname) . '&ln=' . urlencode($user_info->user_lastname) . '&pl=infeed&return_uri=' . admin_url("admin.php?page=aklamator-infeed"); } private function addNewWebsiteApi() { if (!is_callable('curl_init')) { return; } $service = $this->aklamator_url . "wp-authenticate/user"; $p['ip'] = $_SERVER['REMOTE_ADDR']; $p['domain'] = site_url(); $p['source'] = "wordpress"; $p['AklamatorApplicationID'] = get_option('aklamatorinfeedApplicationID'); $p['aklamatorinstagram_user_id'] = get_option('aklamatorinfeed_user_id'); $p['aklamatorinstagram_access_token'] = get_option('aklamatorinfeed_access_token'); $data = wp_remote_post( $service, array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $p, 'cookies' => array() ) ); $ret_info = new stdClass(); if(is_wp_error($data)) { $this->curlfailovao=1; } else { $this->curlfailovao=0; $ret_info = json_decode($data['body']); } return $ret_info; } public function createAdminPage() { $code = get_option('aklamatorinfeedApplicationID'); $user_id = get_option('aklamatorinfeed_user_id'); $access_token = get_option('aklamatorinfeed_access_token'); $username = ""; $profile_photo = ""; if (isset($_GET['instagram_username'])) { $username = $_GET['instagram_username']; } elseif (get_option('aklamatorinfeed_username') != "") { $username = get_option('aklamatorinfeed_username'); } if (isset($_GET['instagram_profile_photo'])) { $profile_photo = $_GET['instagram_profile_photo']; } elseif (get_option('aklamatorinfeed_profile_photo') != "") { $profile_photo = get_option('aklamatorinfeed_profile_photo'); } ?>

Aklamator INfeed plugin

Your Instagram profile

Your Instagram username

Step 1: Paste your Instagram user ID

Your Instagram user ID

Step 2: Paste your Instagram access token

Your Instagram access token

api_data->error)) : ?>

Step 3: Get your Aklamator Aplication ID

Or you can manually register or login and copy paste your Application ID

Step 4:      Paste your Aklamator Application ID

Your Aklamator Application ID

" maxlength="50" onchange="appIDChange(this.value)"/>

Required="Required"> Required I acknowledge there is a 'powered by aklamator' link on the widget.

Note *: By default, widget will show latest Instagram posts. If your Instagram is private, keep in mind that visitors can see thumbnail and title on widget, but If they click on post they will not be able to open it if they are not logged in/your followers.

api_data->flag) && $this->api_data->flag === false): ?>

api_data->error; ?>

api_data->flag): ?>

Options

Select widget to be shown on bottom of the each:

" maxlength="999" /> api_data->data; /* Add new item to the end of array */ $item_add = new stdClass(); $item_add->uniq_name = 'none'; $item_add->title = 'Do not show'; $widgets[] = $item_add; ?> >

>

Or go to Appearance>widgets, and drag and drop widget where you want.

" /> api_data->flag) || !$this->api_data->flag): ?>
<-- In order to proceed save changes
curlfailovao) && $this->curlfailovao && get_option('aklamatorinfeedApplicationID') != ''): ?>

Error communicating with Aklamator server, please refresh plugin page or try again later.

api_data->flag) || !$this->api_data->flag): ?>

Your Widgets

In order to add new widgets or change dimensions please login to aklamator

api_data->data as $item): ?>
Name Domain Settings Image size Column/row Created At
title; ?> domain_ids as $domain): ?> title; ?>
aklamator_url"."widget/edit/$item->id\" target='_blank' title='Click & Login to change'>$item->img_size px"; ?> aklamator_url"."widget/edit/$item->id\" target='_blank' title='Click & Login to change'>".$item->column_number ." x ". $item->row_number.""; ?>
aklamator_url"."widget/edit/$item->id\" target='_blank' title='Edit widget settings'>Edit"; ?>
date_created; ?>
Name Domain Settings Immg size Column/row Created At
'', 'title' => '', 'content' => '', ); public $aklamator_url; public $widget_data_infeed; public function __construct() { // widget actual processes parent::__construct( 'Aklamator_infeed_widget', // Base ID 'Aklamator INfeed', // Name array( 'description' => __( 'Display Aklamator Widgets in Sidebar')) // Widget Description ); $this->widget_data_infeed = get_option('aklamatorinfeedWidgets'); $this->aklamator_url = AklamatorINfeedWidget::init()->aklamator_url; } function widget( $args, $instance ) { extract($args); //var_dump($instance); die(); $supertitle_html = ''; if ( ! empty( $instance['supertitle'] ) ) { $supertitle_html = sprintf( __( '%s', 'envirra' ), $instance['supertitle'] ); } $title_html = ''; if ( ! empty( $instance['title_infeed'] ) ) { $title = apply_filters( 'widget_title', $instance['title_infeed'], $instance, $this->id_base); $title_html = $supertitle_html.$title; } echo $before_widget; if ( $instance['title_infeed'] ) echo $before_title . $title_html . $after_title; ?> show_widget(do_shortcode( $instance['widget_id_infeed'] )); ?>
default ); $title = isset($instance['title_infeed']) ? strip_tags( $instance['title_infeed'] ) : ""; $widget_id = isset($instance['widget_id_infeed']) ? $instance['widget_id_infeed'] : ""; if(!empty($this->widget_data_infeed) || ($this->widget_data_infeed->flag && !empty($this->widget_data_infeed->data))): ?>





Please make sure that you configured Aklamator plugin correctly Click here to configure Aklamator plugin