本文整理汇总了PHP中phpQuery::newDocumentFileXML方法的典型用法代码示例。如果您正苦于以下问题:PHP phpQuery::newDocumentFileXML方法的具体用法?PHP phpQuery::newDocumentFileXML怎么用?PHP phpQuery::newDocumentFileXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpQuery
的用法示例。
在下文中一共展示了phpQuery::newDocumentFileXML方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadWP
public function loadWP()
{
if (file_exists($this->wpPath)) {
phpQuery::newDocumentFileXML($this->wpPath);
$itemArr = pq("channel item");
phpQuery::each($itemArr, "WordPress::parseWpItem");
} else {
$this->_error = "wordpress.xml文件不存在";
}
}
示例2: _load_events
/**
* Function called to retrieve the events owned by an organization, and store the info in the data array
*
* @return Returns a array of event objects indexed by their ids
*
* TODO: make the function take in start_date, end_date, and keyword for more specific event querying
*/
public function _load_events($start_date = null, $end_date = null, $keyword = null)
{
$events_obj = phpQuery::newDocumentFileXML($this->api_base_url . 'events/' . $this->data['id'] . '?key=' . $this->api_key());
$this->data['events_obj'] = $events_obj;
$this->data['number_of_events'] = $events_obj->find('number_of_results')->text();
foreach ($events_obj->find('event') as $node) {
$event = new PSU_OrgSync_Event($node);
$this->data['events'][$event->event_id] = $event;
}
//end foreach
return $this->data['events'];
}
示例3: collection
/**
* Get status records, parse new records
* and remove processed xml files
*
* @throws \Exception
*/
public function collection()
{
$finder = new Finder();
$finder->files()->in($this->source);
if ($finder->files()->count()) {
$parser = new Parser($finder, function ($file) use($filesystem) {
if (!\phpQuery::newDocumentFileXML($file)) {
throw new \Exception('Can not create php query object');
}
return (new Record())->setName(pq('task')->text())->setDate(pq('date')->text())->setDescription("<p>Status: " . pq('status')->text() . "</p>" . "<p>Command: " . pq('command')->text() . "</p>" . "<p>Error: " . pq('error')->text() . "</p>");
});
$this->cache->refresh($parser->collection());
}
return $this->cache->load();
}
示例4: loadWP
public function loadWP()
{
$fag = false;
if (file_exists($this->wpPath)) {
phpQuery::newDocumentFileXML($this->wpPath);
$itemArr = pq("channel item");
if ($itemArr->size() > 0) {
phpQuery::each($itemArr, "WordPress::parseWpItem");
$this->_error = "finish!";
$fag = true;
} else {
$this->_error = "not detected data!";
}
} else {
$this->_error = "wordpress.xml file is not exists!";
}
return $fag;
}
示例5: collection
/**
* Get status records, parse new records
* and remove processed xml files
*
* @throws \Exception
*/
public function collection(\Closure $on_remove_record = null)
{
$finder = new Finder();
$finder->files()->in($this->source);
if ($finder->files()->count()) {
$parser = new Parser($finder, function ($file) {
assert(\phpQuery::newDocumentFileXML($file), 'Can not create php query object');
$record = new Record();
$record->setName(pq('task')->text());
$record->setDate(pq('date')->text());
$record->setStatus(pq('status')->text());
$record->setNotice(pq('notice')->text());
$record->setError(pq('error')->text());
$record->setFatal(pq('fatal')->text());
$record->setLog(pq('log')->text());
return $record;
});
$this->cache->refresh($parser->collection(), $on_remove_record);
}
return $this->cache->load();
}
示例6: load
/**
* Load function called in the constructor to handle the loading of account objects
* based on what type of identifying information that we have.
*
* @param $identifier The unique identifier used to get an account from OrgSync
* @param $identifier_type The type of identifier being passed: account_id, email_address, username
*/
public function load($identifier, $identifier_type)
{
$callout_url = $this->api_base_url . 'accounts/';
switch ($identifier_type) {
case 'account_id':
$callout_url .= $identifier . '?';
break;
case 'email':
$callout_url .= 'search_by_email/?email=' . $identifier . '&';
break;
case 'username':
$callout_url .= 'search_by_username/?username=' . $identifier . '&';
break;
default:
//put the search query functionality in here in case someone decides to use it...
$callout_url .= 'search_by_custom_profile/?q=' . $identifier . '&';
break;
}
//end switch
$callout_url .= 'key=' . $this->api_key();
$this->account_obj = phpQuery::newDocumentFileXML($callout_url);
$this->data['account_id'] = pq('account_id')->text();
}
示例7: fromTemplate
/**
* Get xml model from xml template file
*
* @param $name
* @return \phpQueryObject
*/
public function fromTemplate($name)
{
$template = basename(__DIR__) . '/templates/' . $name . '.xml';
return \phpQuery::newDocumentFileXML($template);
}
示例8: load
/**
* Function to load info about a partiucular form submission. Currently
* the function only loads in the submission ID
*
* @param $submission_id The unique id of the submission of the form
*/
public function load($submission_id)
{
$this->submission_object = phpQuery::newDocumentFileXML($this->api_base_url . 'forms/view_submission/' . $submission_id . '?key=' . $this->api_key());
$this->data['submission_id'] = pq('submission_id')->text();
}
示例9: get_organizations_detail
/**
* Returns an associative array of all organizations containing detailed information.
*
* @return An associative array containing organizations with shot_name, long_name, category, and description
*/
public function get_organizations_detail()
{
$orgs_obj = phpQuery::newDocumentFileXML($this->api_base_url . 'organizations/?key=' . $this->api_key());
foreach ($orgs_obj->find('organization') as $node) {
$node = pq($node);
$orgs[$node->find('id')->text()] = array('short_name' => $node->find('short_name')->text(), 'long_name' => $node->find('long_name')->text(), 'category' => $node->find('group_type')->text(), 'description' => $node->find('description')->text());
}
//end foreach
return $orgs;
}
示例10: load
public function load($form_id)
{
$this->form_obj = phpQuery::newDocumentFileXML($this->api_base_url . 'forms/' . $form_id . '?key=' . $this->api_key());
$this->data['form_id'] = $form_id;
}
示例11: index
public function index()
{
set_time_limit(0);
import('Org.JAE.QueryList');
header("Content-type: text/html; charset=utf-8");
$page = 0;
$isend = false;
while (true) {
if ($isend) {
break;
}
if (page > 1000) {
break;
}
$offset = $page * 200;
$listurl = "http://app.wenwen.sogou.com/front/catquestions?category=18060544&limit=200&offset=" . $offset . "";
$page++;
$pagecontent = \phpQuery::newDocumentFileXML($listurl);
$results = pq('question')->find();
if (empty($results)) {
continue;
}
foreach ($results as $result) {
$id = pq($result)->attr('id');
$url = "http://app.wenwen.sogou.com/front/q?id=" . $id;
$iscollect = D('ClCollect')->findUrl($url);
if ($iscollect) {
continue;
}
$answercount = pq($result)->find("numOfAnswers")->text();
if (empty($answercount) || $answercount == 0) {
continue;
}
$content = \phpQuery::newDocumentFileXML($url);
$title = pq('title')->text();
if (empty($title)) {
continue;
}
$answers = pq('answer')->find();
if (empty($answers)) {
continue;
}
$data['question_title'] = $title;
$data['question_detail'] = $title;
$data['published_uid'] = 0;
$data['game_id'] = 7;
$data['anonymous'] = 1;
$data['is_recommend'] = 1;
$Question = D('AsQuestion');
$question_id = $Question->addQuestion($data);
if ($question_id) {
$best_answer = 0;
foreach ($answers as $answer) {
$content = pq($answer)->find('content')->text();
$adata['question_id'] = $question_id;
$adata['answer_content'] = $content;
$adata['anonymous'] = 1;
$answer_id = D('AsAnswer')->addAnswer($adata);
if ($best_answer == 0) {
$best_answer = $answer_id;
}
}
D('AsQuestion')->saveCollectAnswer($question_id, $best_answer);
}
$cdata['url'] = $url;
$cdata['site'] = "wenwen";
$cdata['page'] = $page;
D('ClCollect')->addCollect($cdata);
}
}
return;
}