function _pluginMain($arg)
{
    global $site, $pattcontainer, $pattmedia, $pattsearch, $pattinfo, $pattthumb, $radio, $pattradio, $needswitch, $needinfo;
    parse_str($arg);
    $vk = new VkApi();
    $vk->app_id = "3795305";
    $vk->access_token = strPar("ACCSES_TOKEN");
    //Первая страница плагина
    if (@(!$url)) {
        $ret[] = Container("url=audio", "Мои аудиозаписи", "http://127.0.0.1/umsp/plugins/potter/audio.png");
        $ret[] = Container("url=audio_rec", "Рекомендуемые аудиозаписи", "http://127.0.0.1/umsp/plugins/potter/audio_rec.png");
        $ret[] = Container("url=video", "Мои видеозаписи", "http://127.0.0.1/umsp/plugins/potter/video.png");
        return $ret;
    }
    //Аудиозаписи
    if ($url == "audio") {
        $result = $vk->query("audio.get", array());
        foreach ($result->response as $key => $value) {
            $ret[] = Item(str_replace("https://", "http://", $value->url), substr($value->artist . " - " . $value->title, 0, 100) . ".mp3");
        }
        return $ret;
    }
    //Аудиозаписи - рекомендации
    if ($url == "audio_rec") {
        $result = $vk->query("audio.getRecommendations", array());
        foreach ($result->response as $key => $value) {
            $ret[] = Item(str_replace("https://", "http://", $value->url), substr($value->artist . " - " . $value->title, 0, 100) . ".mp3");
        }
        return $ret;
    }
    //Видеозаписи -> выбор качества
    if (substr($url, 0, 10) == "video_view") {
        $result = $vk->query("video.get", array("videos" => substr($url, 14, strlen($url))));
        foreach ($result->response[1]->files as $key => $value) {
            $ret[] = Item(str_replace("https://", "http://", $value), $key . " - " . $result->response[1]->title);
        }
        return $ret;
    }
    //Видеозаписи
    if ($url == "video") {
        $result = $vk->query("video.get", array());
        foreach ($result->response as $key => $value) {
            if ($key != 0 && @(!$value->files->external)) {
                $ret[] = Container("url=video_view/id=" . $value->owner_id . "_" . $value->vid, $value->title, "");
            }
        }
        return $ret;
    }
}
Exemplo n.º 2
0
echo "                  </tr>";
echo "                  <tr class=\"head\">\n";
/* 36 - Recursos dispon�veis apenas para formadores */
echo "                    <td align=left>" . RetornaFraseDaLista($lista_frases, 36) . "</td>\n";
echo "                  </tr>   \n";
$i = Item(RetornaFraseDaLista($lista_ferramentas, 35), RetornaFraseDaLista($lista_ferramentas, 36), $i);
$i = Item(RetornaFraseDaLista($lista_ferramentas, 37), RetornaFraseDaLista($lista_ferramentas, 38), $i);
$i = Item(RetornaFraseDaLista($lista_ferramentas, 39), RetornaFraseDaLista($lista_ferramentas, 40), $i);
echo "                  <tr class=\"head\">\n";
/* 36 - Recursos dispon�veis apenas para formadores */
echo "                    <td align=left>" . RetornaFraseDaLista($lista_ferramentas, 63) . "</td>\n";
echo "                  </tr>   \n";
$i = Item(RetornaFraseDaLista($lista_ferramentas, 64), RetornaFraseDaLista($lista_ferramentas, 65), $i);
$i = Item(RetornaFraseDaLista($lista_ferramentas, 66), RetornaFraseDaLista($lista_ferramentas, 67), $i);
$i = Item(RetornaFraseDaLista($lista_ferramentas, 68), RetornaFraseDaLista($lista_ferramentas, 69), $i);
$i = Item(RetornaFraseDaLista($lista_ferramentas, 70), RetornaFraseDaLista($lista_ferramentas, 71), $i);
echo "                  <tr class=\"head\">\n";
/* 38 - Autentica��o de acesso */
echo "                    <td align=left>" . RetornaFraseDaLista($lista_frases, 38) . "</td>\n";
echo "                  </tr>\n";
echo "                  <tr>\n";
/* 39 - O ambiente possui um esquema de autentica��o de acesso aos cursos. Para que formadores e alunos tenham acesso a um curso s�o necess�rios identifica��o pessoal e senha que lhes s�o solicitadas sempre que tentarem efetuar o acesso. Essas senhas s&atilde;o fornecidas a eles quando se cadastram no ambiente */
echo "                    <td align=left><p style=\"text-indent:15px;\">" . RetornaFraseDaLista($lista_frases, 39) . "</p></td>\n";
echo "                  </tr>\n";
echo "                  <tr class=\"head01\">\n";
/* 40 - O TelEduc � um software livre; voc� pode redistribu�-lo e/ou modific�-lo sob os termos da */
/* 41 - vers�o 2, como publicada pela */
echo "                    <td align=left>\n";
echo "                      <p style=\"text-indent:15px;\">" . RetornaFraseDaLista($lista_frases, 40) . " <a href=../cursos/aplic/estrutura/gpl.txt target=GNU-GPL>GNU General Public License</a> " . RetornaFraseDaLista($lista_frases, 41) . " <b><i>Free Software Foundation</i></b></p>\n";
echo "                    </td>\n";
echo "                  </tr>\n";
Exemplo n.º 3
0
 /**
  * Import a youtube video as submitted by a user through the contribution form
  *
  * This function relies on the import form output being in the
  * $_POST variable. The form should be validated before calling this.
  *
  * @return bool $success true if no error, false otherwise
  */
 private static function _importContributedSingle($item)
 {
     require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'import.php';
     require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'Google' . DIRECTORY_SEPARATOR . 'Client.php';
     require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'Google' . DIRECTORY_SEPARATOR . 'Service' . DIRECTORY_SEPARATOR . 'YouTube.php';
     $client = new Google_Client();
     $client->setApplicationName("Omeka_Youtube_Import");
     $client->setDeveloperKey(YoutubeImport_ImportHelper::$youtube_api_key);
     try {
         $service = new Google_Service_YouTube($client);
     } catch (Exception $e) {
         throw $e;
     }
     if (isset($_REQUEST['youtubeurl'])) {
         $url = $_REQUEST['youtubeurl'];
     } else {
         throw new UnexpectedValueException('URL of Youtube video was not set');
     }
     if (!isset($item)) {
         $item = Item();
     }
     try {
         $videoID = YoutubeImport_ImportHelper::ParseURL($url);
         $response = YoutubeImport_ImportHelper::GetVideo($videoID, $service, $item->collection_id, 'Contributor', get_option('contributedItemPublic') && $item->public == 1);
         $post = $response['post'];
         $files = $response['files'];
     } catch (Exception $e) {
         $item->delete();
         throw $e;
     }
     $post['collection_id'] = $item['collection_id'];
     $item->setPostData($post);
     if (!$item->save(false)) {
         throw new Exception($item->getErrors());
     }
     if (!empty($files) && !empty($item)) {
         if (!insert_files_for_item($item, 'Url', $files)) {
             throw new Exception("Error attaching files");
         }
     }
     return true;
 }