当前位置: 首页>>代码示例>>PHP>>正文


PHP phpQuery::newDocumentFileHTML方法代码示例

本文整理汇总了PHP中phpQuery::newDocumentFileHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP phpQuery::newDocumentFileHTML方法的具体用法?PHP phpQuery::newDocumentFileHTML怎么用?PHP phpQuery::newDocumentFileHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpQuery的用法示例。


在下文中一共展示了phpQuery::newDocumentFileHTML方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getManagerPage

 public function getManagerPage($errors = array())
 {
     $html = phpQuery::newDocumentFileHTML(MVBAPK_HTML_DIR . 'admin/manager-page.html');
     if ($_POST['submited']) {
         if (count($errors)) {
             $html['#notice-message > div:first']->removeClass('ui-state-highlight');
             $html['#notice-message > div:first']->addClass('ui-state-error');
             $html['#notice-message #message']->html(implode('<br/>', $errors));
         }
     } else {
         $html['#notice-message']->addClass('dialog');
     }
     //add list of styles
     $styles = $this->modelNode->getStyleList();
     if (is_array($styles)) {
         foreach ($styles as $id => $style) {
             $id = esc_attr($id);
             $label = esc_js($style['label']);
             $html['#style']->append("<option value='{$id}'>{$label}</option>");
         }
         reset($styles);
         $first = current($styles);
         $html['#current-style-display'] = $first['label'];
     }
     echo $html->htmlOuter();
 }
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:26,代码来源:view.php

示例2: finish

 public function finish()
 {
     phpQuery::newDocumentFileHTML($this->downloadUrl, $this->charset);
     $nodeCount = pq("#list2")->count();
     $articleList = pq("#list2 tr");
     echo "Start\n";
     for ($i = 0; $i < $this->loop; $i++) {
         echo '=';
     }
     echo "\n";
     $i = 0;
     foreach ($articleList as $tr) {
         $i++;
         if ($i <= 1) {
             # Filter the first node which has no meaning.
             continue;
         }
         $className = $tr->nodeValue;
         # This class order and its name.
         $classNameCombine = explode(' ', $className);
         $j = 0;
         $this->content[$i - 1]['chapterName'] = '';
         foreach ($classNameCombine as $k => $v) {
             # Put all class order and its name into $this->content array.
             $v = trim($v);
             if (empty($v)) {
                 continue;
             }
             $j++;
             if ($j == 1) {
                 $this->content[$i - 1]['chapterId'] = $v;
             } else {
                 $this->content[$i - 1]['chapterName'] .= $v . " ";
             }
         }
         $child = pq("td", $tr)->html();
         $trueContent = explode(' ', $child);
         $linkString = '';
         foreach ($trueContent as $k => $v) {
             $v = trim($v);
             if (empty($v)) {
                 continue;
             }
             if ($v == "<a") {
                 $linkString = $v . ' ' . $trueContent[$k + 1];
                 break;
             }
         }
         $urls = explode("\"", $linkString);
         $this->content[$i - 1]['link'] = $urls[1];
         //            $name = explode("<", $urls[2]);
         //            $name = substr($name[0], 1);
         //            $this->content[$i-1]['name'] = $name;
     }
     var_dump($this->content);
     for ($i = 0; $i < $this->loop; $i++) {
         echo '=';
     }
     echo "\nFinished! \n";
 }
开发者ID:niceforbear,项目名称:ohyeah,代码行数:60,代码来源:Ohyeah.php

示例3: openUrl

 static function openUrl($url = null)
 {
     if ($url) {
         phpQuery::newDocumentFileHTML($url);
     }
     return true;
 }
开发者ID:ayvanov,项目名称:housefitParser,代码行数:7,代码来源:housefit.php

示例4: getOffers

 public function getOffers()
 {
     $links = [];
     foreach ($this->pq->find('ul.a-pagination li a') as $pagerElem) {
         if (is_int($pagerElem['textContent'])) {
             continue;
         }
         $link = $pagerElem->attributes->getNamedItem('href')->value;
         if ($link == '#') {
             continue;
         }
         $links[] = $link;
     }
     $results = $this->getOffersFromPage();
     foreach ($links as $link) {
         $this->pq = phpQuery::newDocumentFileHTML($link);
         $results = array_merge($results, $this->getOffersFromPage());
     }
     return $results;
 }
开发者ID:meniam,项目名称:catalog-api,代码行数:20,代码来源:PriceParser.php

示例5: testpage

 /**
  * 测试采集内容
  */
 public function testpage()
 {
     header("Content-type: text/html; charset=utf-8");
     //列表地址
     $listurl = I('post.listurl');
     $listurl = str_replace('{$page}', 2, $listurl);
     $urlInfo = parse_url($listurl);
     //解析列表
     $listobj = $_POST['listobj'];
     //列表对象
     $listattr = I('post.listattr');
     //列表属性
     //采集列表
     Vendor('phpQuery.phpQuery', '', '.class.php');
     \phpQuery::newDocumentFile($listurl);
     $artlist = pq($listobj);
     foreach ($artlist as $li) {
         $pageurl = pq($li)->attr($listattr);
         if (stripos($pageurl, 'http') !== 0) {
             $pageurl = $urlInfo['scheme'] . '://' . $urlInfo['host'] . $pageurl;
         }
         //采集内容
         \phpQuery::$defaultCharset = I('post.langcode');
         \phpQuery::newDocumentFileHTML($pageurl);
         //获取字段
         $cate = I('post.cate');
         $cateArr = explode(',', $cate);
         $mid = $cateArr[1];
         $ModelField = DD('ModelField');
         $fieldlist = $ModelField->selFieldByMid($mid);
         foreach ($fieldlist as $key => $f) {
             if (isset($_POST[$f['fieldname'] . '_rule'])) {
                 $ruleJson = $_POST[$f['fieldname'] . '_rule'];
                 $ruleObj = json_decode($ruleJson);
                 if ($ruleObj->type == 0) {
                     $artlist = pq($ruleObj->obj);
                     echo $artlist->text() . '<br />';
                 }
             }
         }
         $artlist = pq($listobj);
         break;
     }
 }
开发者ID:liutongju,项目名称:photocms,代码行数:47,代码来源:AdminController.class.php

示例6: _

        print "<H4>" . _("Importing...") . "</H4>";
        print "Tmpfile " . $filename . "<br>";
        // DEBUG
        flush();
        break;
    default:
        die_nicely("Unknown action {$action}");
}
$fileType = $_POST["fileType"];
$history = $_POST["historyMode"];
$status = "";
$id_note = false;
switch ($fileType) {
    case "FM":
        // Parse it
        $html = phpQuery::newDocumentFileHTML($uploadfile, 'ISO-8859-1');
        if ($html['title']->text() != "FlightMemory - FlightData") {
            die_nicely(_("Sorry, the file {$uploadfile} does not appear contain FlightMemory FlightData."));
        }
        // Table with padded cells has the data
        $rows = pq('table[cellspacing=2] tr[valign=top]')->elements;
        break;
    case "CSV":
        if ($action == _("Upload") && substr($_FILES["userfile"]["name"], -4) != ".csv") {
            die_nicely(_("Sorry, the filename must end in '.csv'."));
        }
        $csvfile = fopen($uploadfile, "r");
        if (!$csvfile) {
            die_nicely(_("Unable to open CSV file."));
        }
        // Convert whole file into giant array
开发者ID:ezekieltech,项目名称:openflights,代码行数:31,代码来源:import.php

示例7: obtainHtml

 public function obtainHtml($caller_method, $template = null, $action = null, $add_html = array(), $partOnly = false)
 {
     //$caller_method = end(// explode('::',$caller_method));
     if (strpos($caller_method, 'show') === false) {
         $vcsl = $VCSL = $caller_method;
         $with_form = false;
     } else {
         $VCSL = substr($caller_method, strlen('show'));
         $vcsl = strtolower($VCSL);
         $with_form = in_array($vcsl, $this->formMethods);
     }
     $overwrite_template = Main::$OVERWRITE_LAYOUT_TEMPLATES;
     if (empty($template)) {
         // get default path
         $template_file = $this->templateFilePath($VCSL);
         $template = file_exists($template_file) ? \phpQuery::newDocumentFileHTML($template_file) : '';
     } else {
         if (file_exists($template)) {
             $template_file = $template;
             $template = \phpQuery::newDocumentFileHTML($template);
         } else {
             if (Main::hasNoHtmlTags($template)) {
                 $template_file = $template;
                 $template = '';
             } else {
                 // is an html snippet
                 $template = \phpQuery::newDocument($template);
                 $overwrite_template = false;
             }
         }
     }
     if (empty($template) or $overwrite_template) {
         if (empty($template_file)) {
             $template_file = $this->templateFilePath($VCSL);
         }
         $dom = \phpQuery::newDocumentFileHTML(Main::$MASTER_TEMPLATE);
         $dom['head']->append($this->getCSS($caller_method, 'html') . $this->getJS($caller_method, 'html'));
         foreach ($this->attributesTypes('\\SimplOn\\Datas\\File') as $fileData) {
             if ($fileData->{$vcsl}()) {
                 $enctype = ' enctype="multipart/form-data" ';
                 break;
             }
         }
         // create and fill file
         $html = '';
         if ($with_form) {
             $html .= '<form class="' . $this->htmlClasses($vcsl) . '" ' . ' action="' . htmlentities(@$action ?: $this->encodeURL(Main::$construct_params, 'process' . $VCSL)) . '" ' . ' method="post" ' . @$enctype . '><fieldset><legend>' . $VCSL . ' ' . $this->getClassName() . '</legend>';
         }
         $html .= '<div class="' . $this->htmlClasses() . '">';
         foreach ($this as $keydata => $data) {
             if ($data instanceof Data && $data->hasMethod($vcsl) && $data->{$vcsl}()) {
                 $html .= '<div class="' . $data->htmlClasses() . '">';
                 if ($with_form) {
                     $data_id = 'SimplOn_' . $data->instanceId();
                     $dompart = \phpQuery::newDocumentHTML($data->{$caller_method}());
                     // @todo: Document that class input is MANDATORY
                     $dompart['.reference']->attr('ref', $data_id);
                     $dompart['.input']->attr('id', $data_id);
                     $html .= $dompart;
                 } else {
                     $html .= $data->{$caller_method}();
                 }
                 $html .= '</div>';
             }
         }
         if ($with_form) {
             $html .= '<button type="submit">' . $VCSL . '</button>' . '<button class="SimplOn cancel-form">Cancel</button>' . '</div></fieldset></form>';
         } else {
             $html .= '</div>';
         }
         $dom['body'] = $html;
         // save file
         if (!empty($template_file)) {
             Main::createFile($template_file, $dom . '');
         }
     } else {
         // opens file
         $dom = $template;
     }
     /**
      * @todo change the way HTL is filled instead of cicle triugh the datas 
      * and filling the template cicle trough the template and run elment's 
      * or data's methods as required.
      */
     if ($with_form && $action) {
         $dom['form.SimplOn.Element.' . $this->getClassName()]->attr('action', $action);
     }
     foreach ($dom['.SimplOn.Data.SNL-' . $this->nestingLevel()] as $node) {
         $domNode = pq($node);
         $data = explode(' ', $domNode->attr('class'));
         if (!isset($data[4])) {
             $vladu = $domNode . '';
         }
         if ($data[4]) {
             $data = $this->{'O' . $data[4]}();
             if ($data instanceof Data && $data->hasMethod($caller_method)) {
                 $domNode->html($data->{$caller_method}($domNode) ?: '');
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:nOoiser,项目名称:SimplOnPHP,代码行数:101,代码来源:Element.php

示例8: pq

<?php

include 'header.php';
?>

<?php 
include 'nav.php';
?>

    <div class="container">

        <div class="row">
            <div class="col col-lg-12 center-block">
                <?php 
$html = 'http://www.dhmz.htnet.hr/prognoza/prognoze.php?id=pomorci';
$doc = phpQuery::newDocumentFileHTML($html);
$table = pq("p:contains('VRIJEME NA JADRANU')")->next('table');
$data = array();
foreach ($table['td'] as $td) {
    $data[] = pq($td)->text();
}
$data = array_chunk($data, 6);
?>
                <table class="table table-striped table-bordered" cellspacing="0" width="100%">
                    <thead>
                    <tr class="bg-info">
                        <?php 
foreach ($data[0] as $title) {
    echo '<th>' . $title . '</th>';
}
array_shift($data);
开发者ID:BlazOrazem,项目名称:litesails,代码行数:31,代码来源:sea.php

示例9: microtime

<?php

require 'phpQuery/phpQuery.php';
$time_start = microtime(true);
$total_page = 200;
$page = 1;
$header = array('', 'Rank', 'Team', 'Name', 'Point', 'Total');
echo "Page number, Time taken";
while ($page <= $total_page) {
    $doc = phpQuery::newDocumentFileHTML('http://fantasy.premierleague.com/my-leagues/303/standings/?ls-page=' . $page);
    foreach (pq('.ismStandingsTable tr') as $data) {
        foreach (pq('td', $data) as $key => $val) {
            if ($key == 2) {
                //print pq($val)->text();
            }
        }
    }
    $time_end = microtime(true);
    $execution_time = $time_end - $time_start;
    echo "\n" . $page . ", " . $execution_time;
    $page++;
}
开发者ID:hubdotcom,项目名称:nonblockingbro,代码行数:22,代码来源:p1-phpquery.php

示例10: getEntryByID

 public function getEntryByID($bID)
 {
     if (!$bID) {
         echo "No blog id set.";
     } else {
         if (!isset($this->Entries[$bID]) || !array_key_exists('fulltext', $this->Entries[$bID])) {
             $this->Entries[$bID]['url'] = $this->blogUrlBase . $bID;
             $blogEntryDom = \phpQuery::newDocumentFileHTML($this->Entries[$bID]['url'])->find('div.diary_flame');
             $this->Entries[$bID]['id'] = $bID;
             $this->Entries[$bID]['headline'] = trim(pq('div.area_footer>h1:first', $blogEntryDom)->text());
             $this->Entries[$bID]['tags'] = $this->_getTags(pq('div.diary_tag_body_w570', $blogEntryDom));
             $this->Entries[$bID]['fulltext'] = $this->_getFulltext($blogEntryDom);
             // Shorttext is not really needed
             //$this->Entries[$bID]['shorttext'] = trim(pq('div.area_footer>h1:first',$blogEntryDom)->text());
         }
         return $this->Entries[$bID];
     }
 }
开发者ID:petarfitzpatrick,项目名称:FinalFantasyAPI,代码行数:18,代码来源:API.php

示例11: pq

<?php

require_once 'phpquery.php';
$file = 'http://www.nod325.com/';
// <div class="entry">
phpQuery::newDocumentFileHTML($file);
$container = pq('.entry p:nth-of-type(3)');
echo $container->html();
// echo $sp=strip_tags($container);
开发者ID:limweb,项目名称:webappservice,代码行数:9,代码来源:index.php

示例12: array

    $statement->bindParam(":title", $content["variation"]["title"], \PDO::PARAM_STR);
    $statement->bindParam(":content", $content["variation"]["content"], \PDO::PARAM_STR);
    $statement->execute();
    $response = array('id' => (int) $pdo->lastInsertId());
    echo json_encode($response);
});
$app->get("/show/variation/:variation_id", function ($variationId) use($pdo) {
    // Load Variation Content;
    $statement = $pdo->prepare("\n      SELECT st.ElementID, v.Content\n      FROM variation AS v\n      INNER JOIN splittest AS st ON v.SplitTest_ID = st.ID\n      WHERE v.ID = :id\n    ");
    $statement->bindParam(":id", $variationId, \PDO::PARAM_INT);
    $statement->execute();
    $result = $statement->fetch();
    if (!$result) {
        throw new \Exception("Variation '" . $variationId . "' not found.");
    }
    $doc = phpQuery::newDocumentFileHTML(__DIR__ . "/templates/coolblue-static.html");
    $element = pq($result["ElementID"]);
    $element->html($result["Content"]);
    echo phpQuery::getDocument($doc->getDocumentID());
});
$app->get("/splittest", function () use($app, $twig, $pdo) {
    $app->request->get("");
});
$app->get("/external/:url", function ($url) {
    $style = '<link rel="stylesheet" href="/templates/lib/splittester/splittester.css" type="text/css"/>';
    $js = '<script src="/templates/lib/jquery-modal/jquery.modal.min.js"></script>';
    $js .= '<script src="/templates/lib/splittester/splittester.js"></script>';
    $client = new GuzzleHttp\Client([]);
    $response = $client->request('GET', $url);
    $contentBody = $response->getBody();
    $contentBody = preg_replace("/<head(.*?)>/", "<head\$1>{$style}", $contentBody);
开发者ID:behdadk,项目名称:hackathon,代码行数:31,代码来源:index.php


注:本文中的phpQuery::newDocumentFileHTML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。