'no', 'border' => 'no', 'container' => 'iframe', 'height' => 'auto', 'scrolling' => 'no', 'upl' => '', 'width' => '100%' ), $atts)); // address switch ($address) { case 'yes': case 'no': { break; } default: { $address = 'no'; } } // border switch ($border) { case 'yes': case 'no': { break; } default: { $border = 'no'; } } // container switch ($container) { case 'iframe': { break; } default: { $container = 'iframe'; } } // height switch ($height) { case 'auto': { break; } default: { if (!preg_match('/^-?[0-9]{1,5}(cm|em|ex|in|mm|pc|pt|px|%)$/', $height)) { $height = 'auto'; } } } // scrolling switch ($scrolling) { case 'yes': case 'no': { break; } default: { $scrolling = 'no'; } } // upl if (substr($upl, 0, 1) == '/') { $upl = substr($upl, 1); } if (substr($upl, -1, 1) == '/') { $upl = substr($upl, 0, strlen($upl) - 1); } $upl = 'http://app.amithings.com' . '/' . $upl; // width switch ($width) { case 'auto': { break; } default: { if (!preg_match('/^-?[0-9]{1,5}(cm|em|ex|in|mm|pc|pt|px|%)$/', $width)) { $width = '100%'; } } } switch ($container) { case 'iframe': { wp_enqueue_style( 'amithings-style', plugins_url( 'assets/css/amithings.css', __FILE__ ), FALSE, FALSE, FALSE ); wp_enqueue_script( 'postmessage-script', plugins_url( 'assets/js/postmessage.min.js', __FILE__ ) ); wp_enqueue_script( 'amithings-script', plugins_url( 'assets/js/amithings.js', __FILE__ ) ); $html = ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= '
'; break; } } return($html); } } add_shortcode('amithings', 'amithings_shortcode'); ?>