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', ''); } /* * 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'); } if( !function_exists("bottom_of_every_post_yt")){ 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; } $title = ""; if(get_option('aklamatorYTSingleWidgetTitle') !== ''){ $title .= "

". get_option('aklamatorYTSingleWidgetTitle'). "

"; } /* append the text file contents to the end of `the_content` */ return $content . $title ."
" . "
"; } } class AklamatorYoutubeWidget { 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/"; if (is_admin()) { add_action("admin_menu", array( &$this, "adminMenu" )); add_action('admin_init', array( &$this, "setOptions" )); if (get_option('aklamatorYTApplicationID') !== '') { $this->api_data = $this->addNewWebsiteApi(); } } if (get_option('aklamatorYTSingleWidgetID') !== 'none') { if (get_option('aklamatorYTSingleWidgetID') == '') { if ($this->api_data->data[0]) { update_option('aklamatorYTSingleWidgetID', $this->api_data->data[0]->uniq_name); } } add_filter('the_content', 'bottom_of_every_post_yt'); } if (get_option('aklamatorYTPageWidgetID') !== 'none') { if (get_option('aklamatorYTPageWidgetID') == '') { if ($this->api_data->data[0]) { update_option('aklamatorYTPageWidgetID', $this->api_data->data[0]->uniq_name); } } add_filter('the_content', '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() { return $this->aklamator_url . 'registration/publisher?utm_source=wordpress&utm_medium=admin&e=' . urlencode(get_option('admin_email')) . '&pub=' . preg_replace('/^www\./','',$_SERVER['SERVER_NAME']). '&un=' . urlencode(wp_get_current_user()->display_name).'&domain='.site_url(); } 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 video or channel URL

Your Youtube video or channel URL

or choose from popular channel

Step 2:

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

>

" />
curlfailovao && get_option('aklamatorYTApplicationID') != ''): ?>

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

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 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 ); } 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_yt'] ) ) { $title = 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 = strip_tags( $instance['title_yt'] ); $widget_id = $instance['widget_id_yt']; if($widget_data->api_data->flag && !empty($widget_data->api_data->data)): ?>





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