Kimili Flash Embed Shortcode

Below, you’ll find a detailed guide on how to add the Kimili Flash Embed Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Kimili Flash Embed Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Kimili Flash Embed Plugin and the shortcodes it provides:

Plugin Icon
Kimili Flash Embed

"Kimili Flash Embed is a simple and flexible plugin for WordPress. It provides users with an easy and reliable way to embed Flash content into their posts and pages."

★★★✩✩ (16) Active Installs: 4000+ Tested with: 4.3.32 PHP Version: false
Included Shortcodes:
  • [kml_flashembed]

Kimili Flash Embed [kml_flashembed] Shortcode

The Kimili Flash Embed shortcode enables users to embed Flash content within their WordPress site. It processes attributes such as movie’s URL, height, width, Flash version, target class, and more. It dynamically generates the script tags, allowing for both static and dynamic publishing methods. It also supports alternative content for feeds. This shortcode ensures unique instances and provides customization options.

Shortcode: [kml_flashembed]

Parameters

Here is a list of all possible kml_flashembed shortcode parameters and attributes:

  • movie – Specifies the path to the flash movie file.
  • height – Sets the height of the flash embed.
  • width – Sets the width of the flash embed.
  • fversion – Specifies the flash version.
  • targetclass – Defines the CSS class of the flash embed target.
  • publishmethod – Determines if the flash embed is published dynamically or statically.
  • useexpressinstall – Indicates if the express install option is used.
  • xiswf – Specifies the url to the express install swf file.
  • fid – Defines the unique identifier for the flash movie.
  • target – Sets the unique identifier for the dynamic publishing target.
  • fvars – Specifies additional flash variables.
  • alttext – Defines the alternative text if the flash embed fails to load.

Examples and Usage

Basic example – Embedding a Flash movie with default settings

[kml_flashembed movie="your-movie.swf" /]

This shortcode will embed the Flash movie named “your-movie.swf” with the default settings defined in the Kimili Flash Embed plugin settings. The movie file should be located in the same directory as your WordPress installation.

Advanced examples

Embedding a Flash movie with custom dimensions and Flash version

[kml_flashembed movie="your-movie.swf" width="400" height="300" fversion="10.0.0" /]

This shortcode will embed the Flash movie named “your-movie.swf” with a width of 400 pixels, a height of 300 pixels, and requiring Flash version 10.0.0 or higher. The movie file should be located in the same directory as your WordPress installation.

Embedding a Flash movie with custom FlashVars

[kml_flashembed movie="your-movie.swf" fvars="var1=value1; var2=value2" /]

This shortcode will embed the Flash movie named “your-movie.swf” and pass two FlashVars to it: var1 with a value of “value1”, and var2 with a value of “value2”. The movie file should be located in the same directory as your WordPress installation.

PHP Function Code

In case you have difficulties debugging what causing issues with [kml_flashembed] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('kml_flashembed', array($this, 'processShortcode'));

Shortcode PHP function:

function processShortcode($atts, $altContent = null)
	{
		$r	= "";

		if (isset($atts['movie'])) {

			$atts['height']				= (isset($atts['height'])) ? $atts['height'] : get_option('kml_flashembed_height');
			$atts['width']				= (isset($atts['width'])) ? $atts['width'] : get_option('kml_flashembed_width');
			$atts['fversion']			= (isset($atts['fversion'])) ? $atts['fversion'] : get_option('kml_flashembed_version_major').'.'.get_option('kml_flashembed_version_minor').'.'.get_option('kml_flashembed_version_revision');
			$atts['targetclass']		= (isset($atts['targetclass'])) ? $atts['targetclass'] : get_option('kml_flashembed_target_class');
			$atts['publishmethod']		= (isset($atts['publishmethod'])) ? $atts['publishmethod'] : (get_option('kml_flashembed_publish_method') ? 'dynamic' : 'static');
			$atts['useexpressinstall']	= (isset($atts['useexpressinstall'])) ? $atts['useexpressinstall'] : 'false';
			$atts['xiswf']				= plugins_url('/kimili-flash-embed/lib/expressInstall.swf');

			$rand	= mt_rand();  // For making sure this instance is unique

			// Extract the filename minus the extension...
			$swfname	= (strrpos($atts['movie'], "/") === false) ?
									$atts['movie'] :
									substr($atts['movie'], strrpos($atts['movie'], "/") + 1, strlen($atts['movie']));
			$swfname	= (strrpos($swfname, ".") === false) ?
									$swfname :
									substr($swfname, 0, strrpos($swfname, "."));

			// set an ID for the movie if necessary
			if (!isset($atts['fid'])) {
				// ... to use as a default ID if an ID is not defined.
				$atts['fid']	= "fm_" . $swfname . "_" . $rand;
			}

			if (!isset($atts['target'])) {
				// ... and a target ID if need be for the dynamic publishing method
				$atts['target']	= "so_targ_" . $swfname . "_" . $rand;
			}

			// Parse out the fvars
			if (isset($atts['fvars'])) {
				$fvarpair_regex		= "/(?<!([$|\?]\{))\s*;\s*(?!\})/";
				// Untexturize ampersands.
				$atts['fvars']		= preg_replace('/&amp;/', '&', $atts['fvars']);
				$atts['fvars']		= preg_split($fvarpair_regex, $atts['fvars'], -1, PREG_SPLIT_NO_EMPTY);
			}

			// Convert any quasi-HTML in alttext back into tags
			$atts['alttext']		= (isset($atts['alttext'])) ? preg_replace("/{(.*?)}/i", "<$1>", $atts['alttext']) : $altContent;

			// Strip leading </p> and trailing <p> - detritius from the way the tags are parsed out of the RTE
			$patterns = array(
				"/^[\s\n\r]*<\/p>/i",
				"/<p>[\s\n\r]*$/i"
			);
			$atts['alttext'] = preg_replace($patterns, "", $atts['alttext']);

			// If we're not serving up a feed, generate the script tags
			if (is_feed()) {
				$r	= $this->buildObjectTag($atts);
			} else {
				if ($atts['publishmethod'] == 'static') {
					$r = $this->publishStatic($atts);
				} else {
					$r = $this->publishDynamic($atts);
				}
			}
		}

	 	return $r;
	}

Code file location:

kimili-flash-embed/kimili-flash-embed/kml_flashembed.php

Conclusion

Now that you’ve learned how to embed the Kimili Flash Embed Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *