public function embedcode() { global $jwp6_global; $jwp6_global['player_embed_count'] = array_key_exists('player_embed_count', $jwp6_global) ? $jwp6_global['player_embed_count'] + 1 : 0; // Make the code a little easier to read foreach ($this->media_params as $param => $value) { ${$param} = $value; } // MAIN MEDIA $file_url = null; // mediaid if (is_int($mediaid) || ctype_digit($mediaid)) { $media_post = get_post($mediaid); $file_url = JWP6_Plugin::url_from_post($media_post); } // file parameter overrules the mediaid if ($file) { $file_url = $file; } // playlistid if (!$playlist) { if (is_int($playlistid) || ctype_digit($playlistid)) { $playlist = JWP6_Plugin::playlist_object($playlistid); } else { $playlist = null; } } // If someone sets playlist and file, playlist has priority if ($file_url && $playlist) { unset($file_url); } // THUMBNAIL $image_url = null; // Direct image setting has priority if ($image) { if (is_int($image) || ctype_digit($image)) { $image_post = get_post($image); $image_url = $image_post->guid; } else { $image_url = $image; } } else { if ($mediaid) { $image_url = JWP6_Plugin::image_from_mediaid($mediaid); } } return $this->player->embedcode($jwp6_global['player_embed_count'], $file_url, $playlist, $image_url, $this->config_params); }