array( 'href' => array(), 'title' => array() ), 'br' => array(), 'em' => array(), 'strong' => array() ); // +---------------------------------------------------------------------------+ // | WP hooks | // +---------------------------------------------------------------------------+ function __construct() { /* WP actions */ add_action( 'init', array(&$this, 'addscripts')); add_action( 'admin_init', array(&$this, 'register_options')); add_action( 'admin_menu', array(&$this, 'addpages')); add_action( 'plugins_loaded', array(&$this, 'set')); add_shortcode( 'aho', array(&$this, 'showall')); } function register_options() { // whitelist options register_setting( 'option-widget', 'admng' ); register_setting( 'option-widget', 'showlink' ); register_setting( 'option-widget', 'linktext' ); register_setting( 'option-widget', 'image_width'); register_setting( 'option-widget', 'image_height'); register_setting( 'option-widget', 'opacity'); register_setting( 'option-widget', 'setlimit' ); register_setting( 'option-widget', 'linkurl' ); register_setting( 'option-page', 'aho_imgalign' ); register_setting( 'option-page', 'imgdisplay' ); register_setting( 'option-page', 'imgmax' ); register_setting( 'option-page', 'sorder' ); register_setting( 'option-page', 'deldata' ); } function unregister_options() { // unset options unregister_setting( 'option-widget', 'admng' ); unregister_setting( 'option-widget', 'showlink' ); unregister_setting( 'option-widget', 'linktext' ); unregister_setting( 'option-widget', 'image_width'); unregister_setting( 'option-widget', 'image_height'); unregister_setting( 'option-widget', 'opacity'); unregister_setting( 'option-widget', 'setlimit' ); unregister_setting( 'option-widget', 'linkurl' ); unregister_setting( 'option-page', 'aho_imgalign' ); unregister_setting( 'option-page', 'imgmax' ); unregister_setting( 'option-page', 'sorder' ); unregister_setting( 'option-page', 'deldata' ); } function addscripts() { // include style sheet wp_enqueue_style('style_css', plugins_url('/as-heard-on/css/style.css') ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'grayscale', plugins_url('/as-heard-on/js/grayscale.js') ,array('jquery') ); $params = array('opacity_js' => get_option('opacity') ); wp_localize_script( 'grayscale', 'grayscale_vars', $params ); if ( is_admin() ) { wp_enqueue_script( 'display', plugins_url('/as-heard-on/js/display.js') ,array('jquery') ); wp_enqueue_script( 'slider', plugins_url('/as-heard-on/js/simple-slider.js') ,array('jquery') ); // Upload Button to Work wp_enqueue_script('thickbox'); wp_enqueue_style ('thickbox'); wp_enqueue_script('script', plugins_url('/js/upload-media.js', __FILE__), array('jquery'), '', true); } } // +---------------------------------------------------------------------------+ // | Create admin links | // +---------------------------------------------------------------------------+ function addpages() { // Create top-level menu and appropriate sub-level menus: add_menu_page('As Heard On', 'As Heard On', 'manage_options', 'setting_page', array($this, 'settings_pages'), 'dashicons-microphone'); } // +---------------------------------------------------------------------------+ // | Add Settings Link to Plugins Page | // +---------------------------------------------------------------------------+ function add_settings_link($links, $file) { static $plugin; if (!$plugin) $plugin = plugin_basename(__FILE__); if ($file == $plugin){ $settings_link = ''.__("Configure").''; $links[] = $settings_link; } return $links; } function set() { if (current_user_can('update_plugins')) add_filter('plugin_action_links', array(&$this, 'add_settings_link'), 10, 2 ); } // +---------------------------------------------------------------------------+ // | Plugin Settings Pages | // +---------------------------------------------------------------------------+ function settings_pages(){ global $saf_networks; ?>

As Heard On Settings

adminpage(); } elseif ( $active_tab == 'widget_options' ) { $this->widget_options(); } elseif ( $active_tab == 'full_page_options' ) { $this->page_options(); } ?>

Add New Podcast


displayForm();?>
For grayscale transition to work, album art must be uploaded to media library
(optional)
prefix . "aho"; $show_name = sanitize_text_field( $_POST['show_name'] ); $host_name = sanitize_text_field( $_POST['host_name'] ); $show_url = sanitize_text_field( $_POST['show_url'] ); $imgurl = sanitize_text_field( $_POST['imgurl'] ); $episode = sanitize_text_field( $_POST['episode'] ); $excerpt = wp_kses( $_POST['excerpt'], $this->allowed_html ); $storder = sanitize_text_field( $_POST['storder'] ); $insert = $wpdb->prepare( "INSERT INTO " . $table_name . " (show_name,host_name,show_url,imgurl,episode,excerpt,storder) " . "VALUES ('%s','%s','%s','%s','%d','%s','%s')", $show_name, $host_name, $show_url, $imgurl, $episode, $excerpt, $storder ); $results = $wpdb->query( $insert ); } // +---------------------------------------------------------------------------+ // | Create table on activation | // +---------------------------------------------------------------------------+ function activate () { global $wpdb; $table_name = $wpdb->prefix . "aho"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { if ( $wpdb->supports_collation() ) { if ( ! empty($wpdb->charset) ) $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; if ( ! empty($wpdb->collate) ) $charset_collate .= " COLLATE $wpdb->collate"; } $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . "( testid int( 15 ) NOT NULL AUTO_INCREMENT , show_name text, host_name text, show_url text, episode text, imgurl text, excerpt text, storder INT( 5 ) NOT NULL, PRIMARY KEY ( `testid` ) ) ".$charset_collate.";"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); $insert = "INSERT INTO " . $table_name . " (show_name,host_name,show_url,episode,imgurl) " . "VALUES ('Your Website Engineer','Dustin Hartzler','http://YourWebsiteEngineer.com','001','http://YourWebsiteEngineer.com/wp-content/podcasts/YWE.png')"; $results = $wpdb->query( $insert ); // insert default settings into wp_options $toptions = $wpdb->prefix ."options"; $defset = "INSERT INTO ".$toptions. "(option_name, option_value) " . "VALUES ('sfs_admng', 'update_plugins'),('sfs_deldata', ''),". "('sfs_linktext', 'Read More'),('sfs_linkurl', ''),('sfs_setlimit', '1'),". "('sfs_showlink', ''),('sfs_imgalign','right'),('sfs_sorder', 'testid DESC')"; $dodef = $wpdb->query( $defset ); } // update version in options table delete_option("ppg_version"); add_option("ppg_version", "0.5"); } /* update item in DB */ function aho_editdo($testid){ global $wpdb; $table_name = $wpdb->prefix . "aho"; $testid = $testid; $show_name = sanitize_text_field( $_POST['show_name'] ); $host_name = sanitize_text_field( $_POST['host_name'] ); $show_url = sanitize_text_field( $_POST['show_url'] ); $imgurl = sanitize_text_field( $_POST['imgurl'] ); $episode = sanitize_text_field( $_POST['episode'] ); $excerpt = wp_kses( $_POST['excerpt'], $this->allowed_html ); $storder = sanitize_text_field( $_POST['storder'] ); $wpdb->query("UPDATE " . $table_name . " SET show_name = '$show_name', ". " host_name = '$host_name', ". " show_url = '$show_url', ". " imgurl = '$imgurl', ". " episode = '$episode', ". " excerpt = '$excerpt', ". " storder = '$storder' ". " WHERE testid = '$testid'"); } /* delete testimonials from DB */ function removetst($testid) { global $wpdb; $table_name = $wpdb->prefix . "aho"; $insert = $wpdb->prepare( "DELETE FROM " . $table_name . " WHERE testid = '%d'", absint( $testid ) ); $results = $wpdb->query( $insert ); } /* admin page display */ function adminpage() { global $wpdb; ?>
insertnew(); ?>

.

newform(); } elseif ($_REQUEST['mode']=='ahorem') { $this->removetst($_REQUEST['testid']); ?>

.

aho_edit($_REQUEST['testid']); //exit; } elseif (isset($_REQUEST['editdo'])) { $this->aho_editdo($_REQUEST['testid']); ?>

.

showlist(); // show podcasts $this->newform(); // show form to add new podcast } else { ?>
showlist(); // show podcasts $this->newform(); // show form to add new podcast ?>

As Heard On Plugin is © Copyright , Dustin Hartzler and distributed under the GNU General Public License. If you find this plugin useful, please consider a donation.

Widget Settings Updated

Need help? documentation  |  support page

'; ?>
Show link in sidebar to full page of previous interviews
Text for sidebar aho-button (Read More, View All, etc)
Page link for sidebar aho-button
(use shortcode [aho])
Image Width
Image Height
How fast to transition from B&W to Color
Number of podcasts to show in sidebar

Page Settings Updated

Need help? documentation  |  support page

'; ?>
Sort podcasts on page by Order entered, oldest first Order entered, oldest first
Order entered, newest first Order entered, newest first
User defined sort order User defined sort order
Align Artwork on Left or Right of Description Left Right Left Right Left Right
Display Images or Images and Summary Images Images & Summary Images Images & Summary Images Images & Summary
Maximum height (in pixels) for image (if left blank images will show full size)
Remove table when deactivating plugin (this will result in all data being deleted!) (this will result in all data being deleted!)

prefix . "aho"; $aholists = $wpdb->get_results("SELECT testid,show_name,host_name,show_url,imgurl,episode FROM $table_name"); foreach ($aholists as $aholist) { echo '
'; echo ''; echo 'Edit'; echo ' | '; echo 'Delete'; echo '
'; echo 'Show Name: '; echo stripslashes($aholist->show_name); if ($aholist->host_name != '') { echo '
Host Name: '.stripslashes($aholist->host_name).''; if ($aholist->show_url != '') { echo '
Show URL: '.stripslashes($aholist->show_url).' '; if ($aholist->episode !=''){ echo '
Episode: '.stripslashes($aholist->episode).''; } } } echo '
'; } echo '
'; } /* edit podcast form */ function aho_edit($testid){ global $wpdb; $table_name = $wpdb->prefix . "aho"; $getaho = $wpdb->get_row("SELECT testid, show_name, host_name, show_url, imgurl, episode, excerpt, storder FROM $table_name WHERE testid = $testid"); ?>

Edit Podcast

';?> '; ?>'; ?>
For grayscale transition to work, album art must be uploaded to media library
(optional)
Preview'; echo '
'; echo ''; echo 'Show Name: '; echo stripslashes($getaho->show_name); if ($getaho->host_name != '') { echo '
Host Name: '.stripslashes($getaho->host_name).''; if ($getaho->show_url != '') { echo '
Show URL: '.stripslashes($getaho->show_url).' '; if ($getaho->episode !=''){ echo '
Episode: '.stripslashes($getaho->episode).''; } if ($getaho->excerpt !=''){ echo '
Show Recap: '.stripslashes($getaho->excerpt).''; } } } echo '
'; echo ''; echo '
'; } // +---------------------------------------------------------------------------+ // | Show podcasts on page with shortcode [aho] | // +---------------------------------------------------------------------------+ /* show page of all podcast artwork */ function showall() { global $wpdb; $imgalign = get_option('aho_imgalign'); if ($imgalign == '') { $imgalign = 'alignright'; } else { $imgalign = get_option('aho_imgalign'); } $sorder = (get_option('sorder')); if ($sorder != 'testid ASC' AND $sorder != 'testid DESC' AND $sorder != 'storder ASC') { $sorder2 = 'testid ASC'; } else { $sorder2 = $sorder; } $table_name = $wpdb->prefix . "aho"; $tstpage = $wpdb->get_results("SELECT testid, show_name, host_name, show_url, imgurl, episode, excerpt, storder FROM $table_name WHERE imgurl !='' ORDER BY $sorder2"); $retvalo = ''; $retvalo .= ''; $retvalo .= '
'; $retvalo .= '
'; foreach ($tstpage as $tstpage2) { $imgdisplay = get_option('imgdisplay'); if ($imgdisplay == 'displaysummary'){ if ($tstpage2->imgurl != '') { // don't show podcasts without album art. if ($tstpage2->imgurl != '') { // check for image $imgmax = get_option('imgmax'); if ($imgmax == '') { $sfiheight = ''; } else { $sfiheight = ' width="'.get_option('imgmax').'"'; } $retvalo .= ''.stripslashes($tstpage2->show_name).''; } if ($tstpage2->show_name != '') { if ($tstpage2->show_url != '') { $retvalo .= 'Show Name: '.stripslashes($tstpage2->show_name).'
'; } else { $retvalo .= stripslashes($tstpage2->show_name).''; } if ($tstpage2->host_name != ''){ $retvalo .= 'Host Name: '.$tstpage2->host_name.'
'; } else { } if ($tstpage2->episode != ''){ $retvalo .= 'Episode: ' .$tstpage2->episode. '
'; } else { } if ($tstpage2->excerpt != ''){ $retvalo .= 'Show Recap: ' .$tstpage2->excerpt. '
'; } else { } } else { $retvalo .= stripslashes($tstpage2->clientname).''; } $retvalo .= '

'; } } else { if ($tstpage2->imgurl != '') { // don't show podcasts without album art. if ($tstpage2->imgurl != '') { // check for image $imgmax = get_option('imgmax'); if ($imgmax == '') { $sfiheight = ''; } else { $sfiheight = ' width="'.get_option('imgmax').'"'; } $retvalo .= ''.stripslashes($tstpage2->show_name).''; // $retvalo .= '
'; } //$retvalo .= '
'; } } } $retvalo .= '
'; return $retvalo; } // +---------------------------------------------------------------------------+ // | Uninstall plugin | // +---------------------------------------------------------------------------+ function deactivate () { global $wpdb; $table_name = $wpdb->prefix . "aho"; $aho_deldata = get_option('aho_deldata'); if ($aho_deldata == 'yes') { $wpdb->query("DROP TABLE {$table_name}"); delete_option("aho_showlink"); delete_option("aho_linktext"); delete_option("aho_linkurl"); delete_option("aho_deldata"); delete_option("aho_setlimit"); delete_option("aho_admng"); delete_option("aho_sorder"); delete_option("aho_imgalign"); delete_option("aho_imgmax"); } delete_option("aho_version"); } } } if(class_exists('AsHeardOn')) { // Installation and uninstallation hooks register_activation_hook(__FILE__, array('AsHeardOn', 'activate')); register_deactivation_hook(__FILE__, array('AsHeardOn', 'deactivate')); // instantiate the plugin class $wp_plugin_template = new AsHeardOn(); } // +---------------------------------------------------------------------------+ // | Widget for podcast(s) in sidebar | // +---------------------------------------------------------------------------+ ### Class: WP-Testimonials Widget class AHO_Widget extends WP_Widget { // Constructor function aho_widget() { $widget_ops = array('description' => __('Displays random podcast in your sidebar', 'wp-podcast')); $this->WP_Widget('podcasts', __('As Heard On'), $widget_ops); } // Display Widget function widget($args, $instance) { extract($args); $title = esc_attr($instance['title']); echo $before_widget.$before_title.$title.$after_title; $this->onerandom(); echo $after_widget; } // When Widget Control Form Is Posted function update($new_instance, $old_instance) { if (!isset($new_instance['submit'])) { return false; } $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); return $instance; } // Display Widget Control Form function form($instance) { global $wpdb; $instance = wp_parse_args((array) $instance, array('title' => __('Hear Me On Other Shows', 'wp-podcast'))); $title = esc_attr($instance['title']); ?> prefix . "aho"; if (get_option('setlimit') == '') { $setlimit = 1; } else { $setlimit = get_option('setlimit'); } $randone = $wpdb->get_results("SELECT show_name, show_url, episode, imgurl FROM $table_name WHERE show_url !='' order by RAND() LIMIT $setlimit"); echo '
'; foreach ($randone as $randone2) { echo '
'; echo ''; echo '
'; } // end loop $showlink = get_option('showlink'); $linktext = get_option('linktext'); $linkurl = get_option('linkurl'); if (($showlink == 'yes') && ($linkurl !='')) { if ($linktext == '') { $linkdisplay = 'Read More'; } else { $linkdisplay = $linktext; } echo '
'.$linkdisplay.'
'; } echo '
'; echo '
'; } } // +---------------------------------------------------------------------------+ // | Function: Init WP-Testimonials Widget | // +---------------------------------------------------------------------------+ add_action('widgets_init', 'widget_aho_init'); function widget_aho_init() { register_widget('aho_widget'); }