Ejemplo n.º 1
0
<?php

if (isset($page_title)) {
    if ($page_title == "") {
        print "<p>Введите слово!</p>";
    } else {
        $pageObj_arr = Tpage::getByTitle($page_title);
        if ($pageObj_arr == NULL) {
            print "<p>The word has not founded.</p>\n";
        } else {
            if (sizeof($pageObj_arr) > 1) {
                print "<p>There are founded " . sizeof($pageObj_arr) . " words.</p>\n";
            }
            if (is_array($pageObj_arr)) {
                foreach ($pageObj_arr as $pageObj) {
                    // вывод слова и ссылка на статью в Викисловаре
                    print "<p>Source page at " . TPage::getURL($pageObj->getPageTitle(), WIKT_LANG . ".wiktionary.org") . "</p>";
                    $lang_pos_arr = $pageObj->getLangPOS();
                    if (is_array($lang_pos_arr)) {
                        foreach ($lang_pos_arr as $langPOSObj) {
                            // вывод языковой принадлежности и части речи
                            print "<h3 title=\"TPage::TLangPOS::TLang->name\">" . $langPOSObj->getLang()->getName() . "</h3>\n" . "<p title=\"TPage::TLangPOS::TPOS->name\">Part of speach: <b>" . $langPOSObj->getPOS()->getName() . "</b></p>\n";
                            $meaning_arr = $langPOSObj->getMeaning();
                            $count_meaning = 1;
                            if (is_array($meaning_arr)) {
                                foreach ($meaning_arr as $meaningObj) {
                                    $meaning_id = $meaningObj->getID();
                                    // LABELS OF MEANING
                                    $labelMeaning_arr = $meaningObj->getLabelMeaning();
                                    $label_name_arr = array();
                                    if (is_array($labelMeaning_arr)) {
Ejemplo n.º 2
0
			</form>
		<section>
			<p id="outputtext">
			<?php 
//include "getbd.inc.php";
$div_word = new Splitter();
$div_word->txt = strip_tags($_GET['text']);
$word_arr = $div_word->DivideText($div_word->txt);
//************************
$i = 0;
//$mean[] = array();
foreach ($word_arr as $wordd) {
    $mean[$i] = new Word();
    $mean[$i]->name = $wordd;
    //--------------------------------------------
    $pageObj_arr = Tpage::getByTitle($wordd);
    if (is_array($pageObj_arr)) {
        foreach ($pageObj_arr as $pageObj) {
            $lang_pos_arr = $pageObj->getLangPOS();
            if (is_array($lang_pos_arr)) {
                foreach ($lang_pos_arr as $langPOSObj) {
                    $meaning_arr = $langPOSObj->getMeaning();
                    if (is_array($meaning_arr)) {
                        foreach ($meaning_arr as $meaningObj) {
                            $meaning_id = $meaningObj->getID();
                            // MEANING
                            //создание массива из значений слов
                            if (null !== $meaningObj->getWikiText()->getText()) {
                                $wikiText = $meaningObj->getWikiText()->getText();
                            }
                            $mean[$i]->me[] = $wikiText;