public function video() { $id = $this->input->get('id'); $data = $this->google->youtube->video($id); set_output('json', json_encode($data)); }
function patch_bug($p_old, $bug1, $patch) { $bug = array(); ///////////////////////////===================get bug to array $input_bug = strlen($bug1); for ($b = 0; $b <= $input_bug - 1; $b++) { $bug[] = substr($bug1, $b, 1); } //echo print_r($bug)."<br>"; ////////////////////////////////// for ($i = 0, $n = 1; $i <= count($patch) - 1; $i++, $n++) { if ($n != $p_old) { ///////////////////////////===================patch to array and chk $h = explode(",", $patch[$i]); $dh = array(); $oh = array(); //echo "<hr>p".$i."<br>"; for ($l = 0; $l <= strlen($h[1]) - 1; $l++) { $dh[] = substr($h[1], $l, 1); $oh[] = substr($h[2], $l, 1); } $th = $h[0]; /////////////////////////// //////////////////////////re bug $chk = array(); $op = ""; $bug_in = ""; for ($k = 0; $k <= $input_bug - 1; $k++) { //echo "$bug[$k],$dh[$k],$oh[$k]<br>"; if ($dh[$k] == "0") { $bug_in = $bug_in . "{$bug[$k]}"; $chk[$k] = 1; $op = $op . set_output($bug[$k], $oh[$k]); } else { if ($bug[$k] == "+" and $dh[$k] == "-") { $chk[$k] = 0; $op = ""; } else { $bug_in = $bug_in . "{$bug[$k]}"; $chk[$k] = 1; // ++ or -- $op = $op . set_output($bug[$k], $oh[$k]); } } } ///////////////////////////=================== if ($input_bug == array_sum($chk)) { $output[] = "{$n} {$bug_in} " . $h[2] . " {$op} {$th} " . array_sum($chk); } else { //$output[]="end"; } } } return $output; // end patch }