Settings'; array_unshift($links, $settings_link); return $links; } } add_filter("plugin_action_links_".plugin_basename(__FILE__), 'aklamatorTwitchFV_plugin_settings_link' ); /* * Add rate and review link in plugin section */ if( !function_exists("aklamatorTwitchFV_plugin_meta_links")) { function aklamatorTwitchFV_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', 'aklamatorTwitchFV_plugin_meta_links', 10, 2); /* * Activation Hook */ register_activation_hook( __FILE__, 'set_up_options_aklamator_FV' ); function set_up_options_aklamatorTwitchFV(){ add_option('aklamatorTwitchFVChannel', ''); add_option('aklamatorTwitchFVApplicationID', ''); add_option('aklamatorTwitchFVPoweredBy', ''); add_option('aklamatorTwitchFVSingleWidgetID', ''); add_option('aklamatorTwitchFVPageWidgetID', ''); add_option('aklamatorTwitchFVSingleWidgetTitle', ''); add_option('aklamatorTwitchFVShowOrDontShow'); add_option('aklamatorTwitchFVPhotoURL'); } /* * Uninstall Hook */ register_uninstall_hook(__FILE__, 'aklamatorTwitchFV_uninstall'); function aklamatorTwitchFV_uninstall() { delete_option('aklamatorTwitchFVChannel'); delete_option('aklamatorTwitchFVApplicationID'); delete_option('aklamatorTwitchFVPoweredBy'); delete_option('aklamatorTwitchFVSingleWidgetID'); delete_option('aklamatorTwitchFVPageWidgetID'); delete_option('aklamatorTwitchFVSingleWidgetTitle'); delete_option('aklamatorTwitchFVShowOrDontShow'); delete_option('aklamatorTwitchFVPhotoURL'); } new AklamatorTwitchFVWidget(); class AklamatorTwitchFVWidget { 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() { //CHANGE $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-twitch-videofloat' ) { if (get_option('aklamatorTwitchFVApplicationID') !== '') { $this->api_data = $this->addNewWebsiteApi_float(); } } } if (get_option('aklamatorTwitchFVSingleWidgetID') == '') { if (isset($this->api_data->data[0])) { update_option('aklamatorTwitchFVSingleWidgetID', $this->api_data->data[0]->uniq_name); } } add_action('wp_footer', array($this, 'bottom_of_every_post_FV')); // } } function setOptions() { register_setting('aklamatorTwitchFV-options', 'aklamatorTwitchFVApplicationID'); register_setting('aklamatorTwitchFV-options', 'aklamatorTwitchFVPoweredBy'); register_setting('aklamatorTwitchFV-options', 'aklamatorTwitchFVSingleWidgetID'); register_setting('aklamatorTwitchFV-options', 'aklamatorTwitchFVPageWidgetID'); register_setting('aklamatorTwitchFV-options', 'aklamatorTwitchFVSingleWidgetTitle'); register_setting('aklamatorTwitchFV-options', 'aklamatorTwitchFVShowOrDontShow'); register_setting('aklamatorTwitchFV-options', 'aklamatorTwitchFVPhotoURL'); register_setting('aklamatorTwitchFV-options', 'aklamatorTwitchFVChannel'); } public function adminMenu() { add_menu_page('Aklamator - Twitch Float Video', 'Aklamator VF Twitch', 'manage_options', 'aklamator-twitch-videofloat', array( $this, 'createAdminPage' ), content_url() . '/plugins/aklamator-twitch-videofloat/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=wpfloat&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=twitch_float&return_uri=' . admin_url("admin.php?page=aklamator-twitch-videofloat"); } private function addNewWebsiteApi_float() { if (!is_callable('curl_init')) { return; } $service = $this->aklamator_url."wp-authenticate/twitch/videofloat"; $p['ip'] = $_SERVER['REMOTE_ADDR']; $p['domain'] = site_url(); $p['source'] = "wordpress"; $p['AklamatorApplicationID'] = get_option('aklamatorTwitchFVApplicationID'); $p['aklamatorTwitchFVChannel'] = get_option('aklamatorTwitchFVChannel'); $p['AklamatorTwitchFVPhotoURL'] = get_option('aklamatorTwitchFVPhotoURL'); $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; } function bottom_of_every_post_FV(){ $widget_id = get_option('aklamatorTwitchFVSingleWidgetID'); $return_content = ""; if (strlen($widget_id) >= 7) { $return_content .= ' '; $return_content .= '
'; $return_content .= ''; $return_content .= '
| Name | Domain | Settings | Image size | Column/row | Created At |
|---|---|---|---|---|---|
| title; ?> |
domain_ids as $domain): ?>
title; ?> |
aklamator_url"."TwitchFV/add_new/$item->id\" target='_blank' title='Click & Login to change'>$item->img_size px"; ?> |
aklamator_url"."TwitchFV/add_new/$item->id\" target='_blank' title='Click & Login to change'>".$item->column_number ." x ". $item->row_number.""; ?>
aklamator_url"."TwitchFV/add_new/$item->id\" target='_blank' title='Edit widget settings'>Edit"; ?>
|
date_created; ?> | |
| Name | Domain | Settings | Image size | Column/row | Created At |