Husani Oakley. Author Version: 1.0 */ //HOOKS add_action('admin_menu', 'wps_addPanelXHTMLbanner'); add_action('save_post', 'wps_createBanner'); add_action('save_post', 'wps_deleteBanner'); //http://digwp.com/2009/08/wordpress-page-navigation/#postsnavlink function wps_addPanelXHTMLbanner(){ global $post; $thePostID = $post->ID; if( function_exists( 'add_meta_box' )) { add_meta_box('wps_panel3', 'Policy Review Intelligence Banner System', 'wps_showBannerinfo', 'post', 'advanced', 'default'); } if(is_admin()){ add_action('admin_print_styles', 'wps_addbannerPanelCSS1'); } } function wps_addbannerPanelCSS1(){ $bannercss = WP_PLUGIN_URL . '/banner/bannerpanel.css'; wp_register_style('wps_bannercss', $bannercss); wp_enqueue_style( 'wps_bannercss'); } function wps_showBannerinfo(){ global $post; $thePostID = $post->ID; $bannerurl = "/home/policyreview/html/images/banners/".$thePostID; // Check to see if the file exists by trying to open it for read only if (is_dir($bannerurl)) { include ABSPATH . PLUGINDIR . "/banner/plupload.php"; echo '
Delete Banner
This banner has been already uploaded, to delete a banner select the banner checkbox and then click submit.
'; $im = 0; if ($bannerhandle = opendir($bannerurl)) { while (false !== ($bannerfile = readdir($bannerhandle))) { if ($bannerfile != "." && $bannerfile != ".." && $bannerfile != "") { $im++; echo '
'; echo ''.$bannerfile.'
'; } } closedir($bannerhandle); } echo '
'; } else { echo '
Do you want to add a banner?
'; //echo "The directory will located here: $bannerurl"; } } function wps_createBanner(){ global $post; $thePostID = $post->ID; $bannerurl = "/home/policyreview/html/images/banners/".$thePostID; if (isset($_POST['wpcreateBanner'])) { //print_r($_POST); if (!is_dir($bannerurl)) { $old = umask(0); mkdir($bannerurl, 0777); umask($old); } } } function wps_deleteBanner(){ global $post; $thePostID = $post->ID; $bannerurl = "/home/policyreview/html/images/banners/".$thePostID; foreach ($_POST as $k => $v) { if(strstr($k, 'image')){ unlink ($bannerurl."/".$v); } } } //return banner from post inside The Loop function the_banner($id){ $bannerechourl = "/home/policyreview/html/images/banners/".$id; if ($bannerechohandle = opendir($bannerechourl)) { while (false !== ($bannerechofile = readdir($bannerechohandle))) { if ($bannerechofile != "." && $bannerechofile != ".." && $bannerechofile != "") { $im++; echo ''.$bannerechofile.''; //echo 'http://www.policyreview.co.uk/images/banners/'.$id.'/'.$bannerechofile.''; } } closedir($bannerechohandle); } } //return banner from post inside The Loop function the_banner_switch($id){ $bannerechourl = "/home/policyreview/html/images/banners/".$id; if ($bannerechohandle = opendir($bannerechourl)) { while (false !== ($bannerechofile = readdir($bannerechohandle))) { if ($bannerechofile != "." && $bannerechofile != ".." && $bannerechofile != "") { $im++; echo ' white'; } } closedir($bannerechohandle); } } ?>
News Ticker
'; for($i = 0; ($rs=mysql_fetch_array($detail4ticker)); $i++) { $j = $i + 1; echo '
Ticker '.$j.': Link:
'; } echo '
New ticker: Link:
'; } function the_ticker(){ $hostname_piwordpress = "localhost"; $database_piwordpress = "piwordpress"; $username_piwordpress = "piwordpress"; $password_piwordpress = "d7Mm4a2JJs"; $piwordpress = mysql_connect($hostname_piwordpress, $username_piwordpress, $password_piwordpress); mysql_select_db($database_piwordpress, $piwordpress); mysql_query("SET NAMES UTF8"); mysql_query("SET CHARACTER SET 'UTF8'"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); $query_detail4ticker = "SELECT * FROM `wp_ticker`"; $detail4ticker = mysql_query($query_detail4ticker, $piwordpress) or die(mysql_error()); //echo '
'; $k = 0; for($i = 0; ($rs=mysql_fetch_array($detail4ticker)); $i++) { echo "tickers[$k] = '"; $build = ''.mysql_real_escape_string($rs['title']).''; //$build = mysql_real_escape_string($build); echo $build; $k++; echo "';"; } //echo '
'; } ?>'; echo '
NSA event code
'; echo ''; } function the_event(){ $hostname_piwordpress = "localhost"; $database_piwordpress = "piwordpress"; $username_piwordpress = "piwordpress"; $password_piwordpress = "d7Mm4a2JJs"; $piwordpress = mysql_connect($hostname_piwordpress, $username_piwordpress, $password_piwordpress); mysql_select_db($database_piwordpress, $piwordpress); mysql_query("SET NAMES UTF8"); mysql_query("SET CHARACTER SET 'UTF8'"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); $query_detail4event = "SELECT * FROM `wp_eventcode`"; $detail4event = mysql_query($query_detail4event, $piwordpress) or die(mysql_error()); $row_detail4event = mysql_fetch_assoc($detail4event); $code = $row_detail4event['code']; $hostname_nsadmin = "localhost"; $database_nsadmin = "nsadmindb"; $username_nsadmin = "nsa"; $password_nsadmin = "d7Mm4a2JJs"; $nsadmin = mysql_connect($hostname_nsadmin, $username_nsadmin, $password_nsadmin); mysql_select_db($database_nsadmin, $nsadmin); $query_detail4conferences = "SELECT * FROM `events` , `conferences` WHERE events.confid = '{$code}' AND conferences.id ='{$code}'"; $detail4conferences = mysql_query($query_detail4conferences, $nsadmin) or die(mysql_error()); $row_detail4conferences = mysql_fetch_assoc($detail4conferences); echo '
'; if(!empty($row_detail4conferences['strapline'])){ echo "
".$row_detail4conferences['strapline']."
"; } echo '
'.str_replace(":", ":
",$row_detail4conferences['title']).'
'; if(!empty($row_detail4conferences['subtitle'])){ echo "
".$row_detail4conferences['subtitle']."
"; } echo '
'.$row_detail4conferences['dateline'].'
'.$row_detail4conferences['location'].'
'; echo '
'; } ?> $v) { if(strstr($k,'title')){ $title = mysql_real_escape_string($_POST[$k]); $link = mysql_real_escape_string($_POST[str_replace('title','link',$k)]); $id = mysql_real_escape_string($_POST[str_replace('title','idwp_highlights',$k)]); $update_detail4frontpagehighlights = "UPDATE `wp_highlights` SET `title`='".$title."', `link`='".$link."', `date`='".date("F j, Y, g:i a")."' WHERE `idwp_highlights`='".$id."'"; $update4frontpagehighlights = mysql_query($update_detail4frontpagehighlights, $piwordpress) or die(mysql_error()); } } } //include XHTML for form inside panel function showfrontpagehighlightsinfo(){ $frontpagehighlightsCSS = WP_PLUGIN_URL . '/frontpagehighlights/frontpagehighlightspanel.css'; wp_register_style('wps_frontpagehighlightspanelcss', $frontpagehighlightsCSS); wp_enqueue_style( 'wps_frontpagehighlightspanelcss'); $hostname_piwordpress = "localhost"; $database_piwordpress = "piwordpress"; $username_piwordpress = "piwordpress"; $password_piwordpress = "d7Mm4a2JJs"; $piwordpress = mysql_connect($hostname_piwordpress, $username_piwordpress, $password_piwordpress); mysql_select_db($database_piwordpress, $piwordpress); mysql_query("SET NAMES UTF8"); mysql_query("SET CHARACTER SET 'UTF8'"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); $query_detail4frontpagehighlights = "SELECT * FROM `wp_highlights`"; $detail4frontpagehighlights = mysql_query($query_detail4frontpagehighlights, $piwordpress) or die(mysql_error()); echo '
Top policy must-reads
'; for($i = 0; ($rs=mysql_fetch_array($detail4frontpagehighlights)); $i++) { echo '
Highlight '.$rs['idwp_highlights'].': Link:
'; } echo '
'; } function the_frontpagehighlights(){//$before="", $after="", $display=true){ $hostname_piwordpress = "localhost"; $database_piwordpress = "piwordpress"; $username_piwordpress = "piwordpress"; $password_piwordpress = "d7Mm4a2JJs"; $piwordpress = mysql_connect($hostname_piwordpress, $username_piwordpress, $password_piwordpress); mysql_select_db($database_piwordpress, $piwordpress); mysql_query("SET NAMES UTF8"); mysql_query("SET CHARACTER SET 'UTF8'"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); $query_detail4frontpagehighlights = "SELECT * FROM `wp_highlights`"; $detail4frontpagehighlights = mysql_query($query_detail4frontpagehighlights, $piwordpress) or die(mysql_error()); //$row_detail4frontpagehighlights = mysql_fetch_assoc($detail4frontpagehighlights); echo '
Top policy must-reads
'; for($i = 0; ($rs=mysql_fetch_array($detail4frontpagehighlights)); $i++) { if ($i != '4'){ echo ''.$rs['title'].''; } else { echo ''.$rs['title'].''; } } echo '
'; } ?> $v) { if(strstr($k, 'image')){ unlink ($url."/".$v); } }*/ } //include XHTML for form inside panel function showfrontpagevideoinfo(){ $frontpagevideoCSS = WP_PLUGIN_URL . '/frontpagevideo/frontpagevideopanel.css'; wp_register_style('wps_frontpagevideopanelcss', $frontpagevideoCSS); wp_enqueue_style( 'wps_frontpagevideopanelcss'); $hostname_piwordpress = "localhost"; $database_piwordpress = "piwordpress"; $username_piwordpress = "piwordpress"; $password_piwordpress = "d7Mm4a2JJs"; $piwordpress = mysql_connect($hostname_piwordpress, $username_piwordpress, $password_piwordpress); mysql_select_db($database_piwordpress, $piwordpress); mysql_query("SET NAMES UTF8"); mysql_query("SET CHARACTER SET 'UTF8'"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); $query_detail4frontpagevideo = "SELECT * FROM `wp_frontpagevideo`"; $detail4frontpagevideo = mysql_query($query_detail4frontpagevideo, $piwordpress) or die(mysql_error()); $row_detail4frontpagevideo = mysql_fetch_assoc($detail4frontpagevideo); if (strstr($row_detail4frontpagevideo['link'],"live")){ $change = str_replace("http://www.policyreview.tv/live/","http://embed.policyreview.tv/embed_live/",$row_detail4frontpagevideo['link']); } if (strstr($row_detail4frontpagevideo['link'],"video")){ $change = str_replace("http://www.policyreview.tv/video/","http://embed.policyreview.tv/embed/",$row_detail4frontpagevideo['link']); } echo '
Front Page Video
Title:

Embed:


'; //
//echo '
'; } function the_frontpagevideo(){//$before="", $after="", $display=true){ $hostname_piwordpress = "localhost"; $database_piwordpress = "piwordpress"; $username_piwordpress = "piwordpress"; $password_piwordpress = "d7Mm4a2JJs"; $piwordpress = mysql_connect($hostname_piwordpress, $username_piwordpress, $password_piwordpress); mysql_select_db($database_piwordpress, $piwordpress); mysql_query("SET NAMES UTF8"); mysql_query("SET CHARACTER SET 'UTF8'"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); $query_detail4frontpagevideo = "SELECT * FROM `wp_frontpagevideo`"; $detail4frontpagevideo = mysql_query($query_detail4frontpagevideo, $piwordpress) or die(mysql_error()); $row_detail4frontpagevideo = mysql_fetch_assoc($detail4frontpagevideo); if (strstr($row_detail4frontpagevideo['link'],"live")){ $change = str_replace("http://www.policyreview.tv/live/","http://embed.policyreview.tv/embed_live/",$row_detail4frontpagevideo['link']); } if (strstr($row_detail4frontpagevideo['link'],"video")){ $change = str_replace("http://www.policyreview.tv/video/","http://embed.policyreview.tv/embed/",$row_detail4frontpagevideo['link']); } echo '
Latest policy video
'.$row_detail4frontpagevideo['title'].'
'; } ?>Husani Oakley. Author Version: 1.0 */ //HOOKS add_action('admin_menu', 'wps_addPanelXHTML'); add_action('save_post', 'wps_createGallery'); add_action('save_post', 'wps_deleteimage'); //http://digwp.com/2009/08/wordpress-page-navigation/#postsnavlink function wps_addPanelXHTML(){ global $post; $thePostID = $post->ID; if( function_exists( 'add_meta_box' )) { add_meta_box('wps_panel', 'Policy Review Intelligence Gallery System', 'wps_showExtrainfo', 'post', 'normal', 'high'); } if(is_admin()){ add_action('admin_print_styles', 'wps_addPanelCSS1'); } } function wps_addPanelCSS1(){ $css1 = WP_PLUGIN_URL . '/gallery/gallerypanel.css'; wp_register_style('wps_css1', $css1); wp_enqueue_style( 'wps_css1'); } function wps_showExtrainfo(){ global $post; $thePostID = $post->ID; $url = "/home/policyreview/html/images/gallery/".$thePostID; // Check to see if the file exists by trying to open it for read only if (is_dir($url)) { include ABSPATH . PLUGINDIR . "/gallery/plupload.php"; //include ABSPATH . PLUGINDIR . "/gallery/delete.php"; echo '
Delete Images
These files have been already uploaded, to delete an image select the image checkbox and then click submit.
'; $im = 0; if ($handle = opendir($url)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "") { $im++; echo '
'; echo ''.$file.'
'; } } closedir($handle); } echo '
'; } else { echo '
Do you want to add a gallery?
'; //echo "The directory will located here: $url"; } } function wps_createGallery(){ global $post; $thePostID = $post->ID; $url = "/home/policyreview/html/images/gallery/".$thePostID; /*print_r($url); exit; */ if (isset($_POST['wpcreateGallery'])) { //print_r($_POST); if (!is_dir($url)) { $old = umask(0); mkdir($url, 0777); umask($old); } } } function wps_deleteimage(){ global $post; $thePostID = $post->ID; $url = "/home/policyreview/html/images/gallery/".$thePostID; foreach ($_POST as $k => $v) { if(strstr($k, 'image')){ unlink ($url."/".$v); //echo $url."/".$v; //print_r($_POST); //print_r($url."/".$v); } } } ?>Husani Oakley. Author Version: 0.1 */ /* Copyright 2009 Husani Oakley (email : wordpressplugins@husani.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** HOOKS */ add_action('admin_menu', 'wps_addvideopanel'); add_action('save_post', 'wps_savevideoinfo'); /** FUNCTIONS FOR HOOKS */ //display xhtml for video embedder panel function wps_addvideopanel(){ if( function_exists( 'add_meta_box' )) { add_meta_box('wps_panel2', 'Policy Review Intelligence Video Embedder', 'wps_showvideoinfo', 'post', 'normal', 'high'); } //include css if admin if(is_admin()){ add_action('admin_print_styles', 'wps_addvideopanelCSS'); } } //include CSS for video panel function wps_addvideopanelCSS(){ $videocss = WP_PLUGIN_URL . '/videoembedder/videopanel.css'; wp_register_style('wps_videocss', $videocss); wp_enqueue_style( 'wps_videocss'); } //include XHTML for form inside panel function wps_showvideoinfo(){ global $post; $i = 0; $custom_fields = get_post_custom($post->ID); foreach ( $custom_fields as $k => $v ){ if (strstr($k,"video")){ $i++; $fieldarray[$k] = $value; $videoid = "video".$i; } } //sort the fields and results visually uksort( $fieldarray, 'strnatcmp'); echo 'All you have to do is drop the full url of the video in the field. This plugin will adapt the link automatically for display on the pages.
Supported links from: YouTube, Policy Review TV, Policy Review TV Live Events and Vimeo.

'; foreach ( $fieldarray as $k2 => $v2 ){ $meta = get_post_meta($post->ID, $k2, true); echo '
'; echo 'Video Embed '.str_replace("video","",$k2).':
'; echo '
'; //Youtube if (strstr($meta,"youtube")){ $change = str_replace("http://www.youtube.com/watch?v=","",$meta); echo ''; } //Vimeo if (strstr($meta,"vimeo")){ $change = str_replace("http://vimeo.com/","",$meta); echo ''; } //Policy Review if (strstr($meta,"policyreview")){ //direct embed (custom or normal) if ( (strstr($meta,"embed")) || (strstr($meta,"custom")) ){ echo ''; //normal prtv live link convert } else if (strstr($meta,"http://www.policyreview.tv/live/")){ $change = str_replace("http://www.policyreview.tv/live/","http://embed.policyreview.tv/embed_live/",$meta); echo ''; //normal prtv video link convert } else if (strstr($meta,"http://www.policyreview.tv/video/")){ $change = str_replace("http://www.policyreview.tv/video/","http://embed.policyreview.tv/embed/",$meta); echo ''; } } echo '
'; } echo '
'; if($i > 0){ //$videoid++; $i++; echo 'Video Embed '.$i++.': '; } else { echo 'Video Embed 1: '; } echo '
'; } //store video link in db as custom field function wps_savevideoinfo($post_id){ //delete all meta with video in it $custom_fields2 = get_post_custom($post_id); foreach ( $custom_fields2 as $k => $v ){ if (strstr($k,"video")){ delete_post_meta($post_id,$k); } } //this reorders the post values so that it is always starting from video1 $j = "0"; foreach ( $_POST as $k2 => $v2 ){ if( (strstr($k2,"video")) && ($v2 != "") ){ $j++; $videoid = "video".$j; update_post_meta($post_id,$videoid,$v2); } } } //return video from post inside The Loop function the_video($id){//$before="", $after="", $display=true){ $videoarray = get_post_custom($id); $vidCount = 0; $vidMax = 0; foreach ( $videoarray as $k1 => $v1 ){ if (strstr($k1,"video")){ $fieldarray[$k1] = $v1; $vidMax++; } } uksort( $fieldarray, 'strnatcmp'); foreach ( $fieldarray as $k => $v ){ //foreach ( $videoarray as $k => $v ){ if (strstr($k,"video")){ if($vidCount == 0){ echo '
'; } $vidCount++; $meta = get_post_meta($id, $k, true); echo '
'; //Youtube if (strstr($meta,"youtube")){ $change = str_replace("http://www.youtube.com/watch?v=","",$meta); echo ''; } //Vimeo if (strstr($meta,"vimeo")){ $change = str_replace("http://vimeo.com/","",$meta); echo ''; } //Policy Review if (strstr($meta,"policyreview")){ //direct embed (custom or normal) if (strstr($meta,"embed" )){ echo ''; } else if (strstr($meta,"custom")){ echo ''; //normal prtv live link convert } else if (strstr($meta,"http://www.policyreview.tv/live/")){ $change = str_replace("http://www.policyreview.tv/live/","http://embed.policyreview.tv/embed_live/",$meta); echo ''; //normal prtv video link convert } else if (strstr($meta,"http://www.policyreview.tv/video/")){ $change = str_replace("http://www.policyreview.tv/video/","http://embed.policyreview.tv/embed/",$meta); echo ''; } } echo '
'; if($vidCount == $vidMax){ echo '
'; } } } } //return (or display) subtitle from post with ID passed as argument /*function get_the_video($id, $before="", $after="", $display=true){ $video = $before . get_post_meta($id, "wps_video", true) . $after; if($display){ echo $video; } else { return $video; } }*/ ?> Page not found | Policy Review