$punctuation = array(".", ",", "?", "!", ";", ":", "(", ")", "\"", "'"); $caption = str_replace($punctuation, "", $caption); //trim whitespace on start and end $caption = trim(strtolower($caption)); //Remove extraneous spacing $caption = preg_replace('/\\s+/', ' ', $caption); //Insert sanitized caption into DB $sql = "INSERT INTO youtubetag_1.captions (video_id, stime, etime, caption) VALUES (\$1, \$2, \$3, \$4)"; $result = pg_query_params($dbconn, $sql, array($id, $start, $end, $caption)); echo $id . " " . $caption; //Check if there are enough attempts to run aggregation algorithm $query = pg_query("SELECT * FROM youtubetag_1.captions WHERE video_id = '" . $id . "' AND stime = '" . $start . "'"); $number = pg_num_rows($query); if ($number == $check_threshold || $number > $check_threshold && ($number - $check_threshold) % $next_check_step == 0) { include 'video-get-bst-cap.php'; aggregate($id, $start, $end, $dbconn); //Check if the entirety of the video's transcription is complete $query = pg_query("SELECT * FROM youtubetag_1.subtitles WHERE video_id = '" . $id . "' AND stime = '" . $start . "' ORDER BY stime"); if (pg_num_rows($query) > 0) { $prev_etime = 0; $aggro_complete = TRUE; $row = pg_fetch_array($query); if ($row['stime'] == 0) { $prev_etime = $row['etime']; while ($row = pg_fetch_array($query)) { if ($row['stime'] != $prev_etime) { $aggro_complete = FALSE; } $prev_etime = $row['etime']; } }
<?php class ParentClass { function beamazing() { print "I'm so amazing I must be aggregated!\n"; } } class ChildClass { function simple() { print "I'm simple and unamazing :(((\n"; } } $obj = new ChildClass(); var_dump($obj); aggregate($obj, 'ParentClass'); var_dump($obj); $obj->beamazing();
/** * This is the class constructor of the YDXmlRpcServer class. */ function YDXmlRpcServer() { // Initialize YDRequest $this->YDRequest(); // Aggregate the functions from the IXR_IntrospectionServer class aggregate($this, 'IXR_IntrospectionServer'); IXR_IntrospectionServer::IXR_IntrospectionServer(); }