本文整理汇总了PHP中phpQuery::plugin方法的典型用法代码示例。如果您正苦于以下问题:PHP phpQuery::plugin方法的具体用法?PHP phpQuery::plugin怎么用?PHP phpQuery::plugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpQuery
的用法示例。
在下文中一共展示了phpQuery::plugin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ndfasui8923
<?php
/**
* Automated google account login.
* Uses __config.php to keep login data.
*
* @package phpQuery.Plugins.Scripts
* @author Tobiasz Cudnik <tobiasz.cudnik/gmail.com>
*/
phpQuery::ajaxAllowHost('code.google.com', 'google.com', 'www.google.com', 'mail.google.com', 'docs.google.com', 'reader.google.com');
if (!function_exists('ndfasui8923')) {
function ndfasui8923($browser, $scope)
{
extract($scope);
$browser->WebBrowser()->find('#Email')->val($config['google_login'][0])->end()->find('#Passwd')->val($config['google_login'][1])->parents('form')->submit();
}
$ndfasui8923 = new Callback('ndfasui8923', new CallbackParam(), compact('config', 'self', 'return', 'params'));
}
phpQuery::plugin('WebBrowser');
$self->document->xhr = phpQuery::$plugins->browserGet('https://www.google.com/accounts/Login', $ndfasui8923);
//$self->document->xhr = phpQuery::$plugins->browserGet('https://www.google.com/accounts/Login', create_function('$browser', "
// \$browser
// ->WebBrowser()
// ->find('#Email')
// ->val('{$config['google_login'][0]}')->end()
// ->find('#Passwd')
// ->val('".str_replace("'", "\\'", $config['google_login'][1])."')
// ->parents('form')
// ->submit();"
//));
示例2:
<?php
//error_reporting(E_ALL);
require_once '../phpQuery/phpQuery.php';
phpQuery::$debug = true;
phpQuery::plugin('Scripts');
$testName = 'Scripts/example';
$doc = phpQuery::newDocumentFile('test.html');
$testResult = 10;
if ($doc->script('example', 'p')->length == $testResult) {
print "Test '{$testName}' PASSED :)";
} else {
print "Test '{$testName}' <strong>FAILED</strong> !!! ";
print "<pre>";
var_dump($doc->whois());
print "</pre>\n";
}
print "\n";
$testName = 'Scripts/gmail_login';
$testResult = 1;
$url = 'http://code.google.com/p/phpquery/w/edit/MultiDocumentSupport';
//phpQuery::ajaxAllowURL($url);
$editor = phpQuery::newDocument('<div/>')->script('google_login')->location($url);
if ($editor->find('textarea#content')->length == $testResult) {
print "Test '{$testName}' PASSED :)";
} else {
print "Test '{$testName}' <strong>FAILED</strong> !!! ";
print "<pre>";
var_dump($doc->whois());
print "</pre>\n";
}
示例3: plugin
/**
* Enter description here...
*
* @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
*/
public function plugin($class, $file = null)
{
phpQuery::plugin($class, $file);
return $this;
}
示例4: success2
$pq->WebBrowser('success2')->find('input[name=q]')->val('phpQuery')->parents('form')->submit();
}
/**
*
* @param $html phpQueryObject
* @return unknown_type
*/
function success2($pq)
{
print 'success2 callback';
print $pq->find('script')->remove()->end();
}
}
// Gmail login (not working...)
if (0) {
phpQuery::plugin("Scripts");
phpQuery::newDocument('<div/>')->script('google_login')->location('http://mail.google.com/')->toReference($pq);
if ($pq) {
print $pq->script('print_websafe');
}
}
// Gmail login v2 (not working...)
if (0) {
$browser = null;
$browserCallback = new CallbackReference($browser);
phpQuery::browserGet('http://mail.google.com/', $browserCallback);
if ($browser) {
$browser->WebBrowser($browserCallback)->find('#Email')->val('XXX@gmail.com')->end()->find('#Passwd')->val('XXX')->parents('form')->submit();
if ($browser) {
print $browser->script('print_websafe');
}