// **************************************************** showCamera ****************************************************
// * *
// * showCamera will display the video feed from an IP-based camera. It accepts the following parameters: *
// * url – this is the url of the camera (http://dockcam.jkshay.com, for example) *
// * port – this is the port on which the camera is listening *
// * user – this is the username used to access the camera *
// * I suggest creating a camera user with the username ‘guest’ *
// * password – this is the password for the user specified above *
// * I suggest creating a password ‘guest’ for the user specified above *
// * width – this is the width of the videostream *
// * refresh – the number of milliseconds between image refreshes for IE *
// * class – a CSS class attribute applied to the videostream to facilitate styling via CSS *
// * *
// * NOTE: The credentials necessary to view your camera WILL be available to anyone who views the page source *
// * DO NOT USE ADMINISTRATOR CREDENTIALS UNLESS YOU WANT PEOPLE TO MESS WITH YOUR CAMERA *
// * *
// ********************************************************************************************************************

function showCamera($parameters)
{
// Define accepted parameters and convert to PHP variables

extract(shortcode_atts(array(‘url’ => ‘http://192.168.2.5’, ‘port’ => ’80’, ‘user’ => ‘admin’, ‘password’ => ‘thuis01’, ‘width’ => ‘480’, ‘refresh’ => ‘1000’, ‘class’ => ‘alignleft’,), $parameters));

// Build string of HTML code to be returned by the function call
$results = “”;

// IE is unable to accept the videostream.cgi viewing method, so we need to deliver an alternate viewing method
// We do this by introducing a javascript that will reload static images at a predefined rate

// Check if the user is using Internet Explorer
$results = $results.”
“;

// Check if the user is NOT using IE
$results = $results.”
<![if !IE]>”;

// Insert the HTML tag to load the videostream
$results = $results.”
Live Feed“;

// Close the ‘User is NOT using IE IF block’
$results = $results.”
<![endif]>
“;

// Return function results
return $results;
}

// Register this function with the WordPress framework as a shortcode
add_shortcode(‘showCamera’, ‘showCamera’);