Settings'; array_unshift($links, $settings_link); return $links; } } add_filter("plugin_action_links_".plugin_basename(__FILE__), 'aklamatorYT_plugin_settings_link' ); /* * Add rate and review link in plugin section */ if( !function_exists("aklamatorYT_plugin_meta_links")) { function aklamatorYT_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', 'aklamatorYT_plugin_meta_links', 10, 2); /* * Activation Hook */ register_activation_hook( __FILE__, 'set_up_options_aklamator_YT' ); function set_up_options_aklamatorYT(){ add_option('aklamatorYTChannelURL', ''); add_option('aklamatorYTApplicationID', ''); add_option('aklamatorYTPoweredBy', ''); add_option('aklamatorYTSingleWidgetID', ''); add_option('aklamatorYTPageWidgetID', ''); add_option('aklamatorYTSingleWidgetTitle', ''); add_option('aklamatorYTWidgets', ''); } /* * Uninstall Hook */ register_uninstall_hook(__FILE__, 'aklamatorYT_uninstall'); function aklamatorYT_uninstall() { delete_option('aklamatorYTChannelURL'); delete_option('aklamatorYTApplicationID'); delete_option('aklamatorYTPoweredBy'); delete_option('aklamatorYTSingleWidgetID'); delete_option('aklamatorYTPageWidgetID'); delete_option('aklamatorYTSingleWidgetTitle'); delete_option('aklamatorYTWidgets'); } class AklamatorYoutubeWidget { 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://127.0.0.1/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-youtube-your-blog' ) { if (get_option('aklamatorYTApplicationID') !== '') { $this->api_data = $this->addNewWebsiteApi(); } if (isset($this->api_data->flag) && $this->api_data->flag) { update_option('aklamatorYTWidgets', $this->api_data); } } } if (get_option('aklamatorYTSingleWidgetID') !== 'none') { if (get_option('aklamatorYTSingleWidgetID') == '') { if (isset($this->api_data->data[0])) { update_option('aklamatorYTSingleWidgetID', $this->api_data->data[0]->uniq_name); } } add_filter('the_content', array($this,'bottom_of_every_post_yt')); } if (get_option('aklamatorYTPageWidgetID') !== 'none') { if (get_option('aklamatorYTPageWidgetID') == '') { if (isset($this->api_data->data[0])) { update_option('aklamatorYTPageWidgetID', $this->api_data->data[0]->uniq_name); } } add_filter('the_content', array($this, 'bottom_of_every_post_yt')); } } function setOptions() { register_setting('aklamatorYT-options', 'aklamatorYTChannelURL'); register_setting('aklamatorYT-options', 'aklamatorYTApplicationID'); register_setting('aklamatorYT-options', 'aklamatorYTPoweredBy'); register_setting('aklamatorYT-options', 'aklamatorYTSingleWidgetID'); register_setting('aklamatorYT-options', 'aklamatorYTPageWidgetID'); register_setting('aklamatorYT-options', 'aklamatorYTSingleWidgetTitle'); } public function adminMenu() { add_menu_page('Aklamator - Youtube Your Blog', 'Aklamator YT', 'manage_options', 'aklamator-youtube-your-blog', array( $this, 'createAdminPage' ), content_url() . '/plugins/aklamator-youtube-your-blog/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=wpyoutube&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=youtube-your-blog&return_uri=' . admin_url("admin.php?page=aklamator-youtube-your-blog"); } function bottom_of_every_post_yt($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('aklamatorYTSingleWidgetID'); }elseif (is_page()) { $widget_id = get_option('aklamatorYTPageWidgetID'); }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('aklamatorYTSingleWidgetTitle') !== '') { $title .= "

" . get_option('aklamatorYTSingleWidgetTitle') . "

"; } /* append the text file contents to the end of `the_content` */ $return_content .= "$title
" . "
"; } return $return_content; } 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('aklamatorYTApplicationID'); $p['AklamatorYTChannelURL'] = get_option('aklamatorYTChannelURL'); $client = curl_init(); curl_setopt($client, CURLOPT_AUTOREFERER, TRUE); curl_setopt($client, CURLOPT_HEADER, 0); curl_setopt($client, CURLOPT_RETURNTRANSFER, true); curl_setopt($client, CURLOPT_URL, $service); if (!empty($p)) { curl_setopt($client, CURLOPT_POST, count($p)); curl_setopt($client, CURLOPT_POSTFIELDS, http_build_query($p)); } $data = curl_exec($client); if (curl_error($client)!= "") { $this->curlfailovao=1; } else { $this->curlfailovao=0; } curl_close($client); $data = json_decode($data); return $data; } public function createAdminPage() { $code = get_option('aklamatorYTApplicationID'); $channel_url = get_option('aklamatorYTChannelURL'); ?>

Aklamator Youtube Your Blog

Step 1: Paste your Youtube playlist, video or channel URL

Your Youtube playlist, video or channel URL

or choose from popular channel

api_data->error) || $code == '') : ?>

Step 2: Get your Aklamator Aplication ID

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

Step 3:      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, posts without images will not be shown in widgets. If you want to show them click on EDIT in table below!

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; ?> >

>

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

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_YT; public function __construct() { // widget actual processes parent::__construct( 'Aklamator_youtube_widget', // Base ID 'Aklamator Youtube Videos', // Name array( 'description' => __( 'Display Aklamator Widgets in Sidebar')) // Widget Description ); $this->widget_data_YT = get_option('aklamatorYTWidgets'); $this->aklamator_url = AklamatorYoutubeWidget::init()->aklamator_url; } function widget( $args, $instance ) { extract($args); //var_dump($instance); die(); $supertitle_html = ''; if ( ! empty( $instance['supertitle'] ) ) { $supertitle_html = isset($instance['supertitle']) ? sprintf( __( '%s', 'envirra' ), $instance['supertitle'] ) : ""; } $title_html = ''; if ( ! empty( $instance['title_yt'] ) ) { $title = isset($instance['title_yt']) ? apply_filters( 'widget_title', $instance['title_yt'], $instance, $this->id_base) : ""; $title_html = $supertitle_html.$title; } echo $before_widget; if ( $instance['title_yt'] ) echo $before_title . $title_html . $after_title; ?> show_widget(do_shortcode( $instance['widget_id_yt'] )); ?>
default ); $title = isset($instance['title_yt']) ? strip_tags( $instance['title_yt'] ) : ""; $widget_id = isset( $instance['widget_id_yt']) ? $instance['widget_id_yt'] : ""; if(!empty($this->widget_data_YT) || ($this->widget_data_YT->flag && !empty($this->widget_data_YT->data))): ?>





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