Esempio n. 1
0
if ($validFormSubmission) {
    if ($validVideoUrl) {
        // Print "please wait" message and preview image
        echo '<div id="preview" style="display:block"><h2><i class="fa fa-cog fa-spin"></i> ' . Wait_Message . '</h2>';
        echo '<p><img src="' . $vidInfo['thumb_preview'] . '" alt="preview image" style="width:160px" /></p>';
        echo '<p><b>' . $vidInfo['title'] . '</b></p>';
        echo '<h4 style="margin-bottom:15px;text-transform:uppercase;"><span class="label label-default">' . $converter->GetConvertedFileType() . '</span></h4>';
        echo '<div dir="ltr" id="progress-bar"><div id="progress_container"><div id="progress">0%</div></div></div>';
        echo '<div id="conversion-status">' . Downloading_Process_Message . '</div>';
        echo !Config::_CACHING_ENABLED ? '<div id="cancel_convert_button"><span title="' . strip_tags(Cancel_Conversion_Button_Text) . '" class="fa-stack fa-lg"><i class="fa fa-cog fa-stack-1x"></i><i class="fa fa-ban fa-stack-2x text-danger"></i></span></div>' : '';
        echo '</div><script type="text/javascript">$("#cancel_convert_button span").click(stopConversion).tooltip({placement:"bottom"});</script>';
        ob_end_flush();
        ob_flush();
        flush();
        // Main Program Execution
        $cachedFile = Config::_CACHING_ENABLED ? $converter->RetrieveCachedFile() : '';
        if (!empty($cachedFile)) {
            $progressIncrements = mt_rand(4, 8);
            $downloadPercent = 0;
            for ($i = 1; $i <= $progressIncrements; $i++) {
                $downloadPercent += floor(100 / $progressIncrements);
                echo '<script type="text/javascript">if (!conversionStopping) {var progressBar = document.getElementById("progress"); progressBar.style.width = progressBar.innerHTML = "' . $downloadPercent . '%";}</script>';
                flush();
                usleep(1500000 * (16 / $progressIncrements) * (100 / $progressIncrements / 100));
            }
            $fileNameParts = explode("/", $cachedFile);
            array_shift($fileNameParts);
            $convertedFileName = implode("/", $fileNameParts);
            $convertedFileNiceName = $converter->PrepareConvertedFileNameForDownload(end($fileNameParts));
            echo '<div id="conversionSuccess"></div>';
            echo '<script type="text/javascript">$(window).load(function(){ showConversionResult("' . $convertedFileName . '", "' . $convertedFileNiceName . '", "' . rawurlencode($vidInfo['title']) . '", 1); });</script>';