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


PHP phpQuery::browserGet方法代码示例

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


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

示例1: testOverridePackageViewTemplate

 /** 
  * Gallery package is installed. Can we :
  * a. Override gallery/view.php in blocks/gallery.php, properly, as well as maintaining autoloaded items?
  * b. Override gallery/view.php in blocks/gallery/view.php. Add new autoload items to /blocks/gallery/ and ensure they are loaded
  * c. Setup a custom template in gallery/templates/custom_gallery_template.php, and maintain autoloaded items?
  * d. Setup a custom template directory at gallery/templates/custom_gallery_template/view.php, and load NEW autoloaded items?
  */
 public function testOverridePackageViewTemplate()
 {
     //assumes /gallery exists
     $p = Page::getByPath('/gallery');
     self::$_this = '';
     self::$_this->path = DIR_REL . '\\/packages\\/gallery/i';
     // a.
     touch(DIR_BASE . '/blocks/gallery.php');
     $blocks = $p->getBlocks('Main');
     $b = $blocks[0];
     $bv = new BlockViewTemplate($b);
     $this->assertEqual($bv->getTemplate(), DIR_BASE . '/blocks/gallery.php', 'Gallery Template Test - Block view override with gallery.php');
     phpQuery::browserGet(BASE_URL . DIR_REL . '/index.php/gallery', array('BlockOverrideTests', '_testGalleryHeaderItems'));
     $this->assertEqual(3, self::$_this->headerItem1Count + self::$_this->headerItem2Count, 'Gallery Header Test - Block view override with gallery.php');
     unlink(DIR_BASE . '/blocks/gallery.php');
     // b
     self::$_this = '';
     self::$_this->path = DIR_REL . '\\/blocks\\/gallery/i';
     mkdir(DIR_BASE . '/blocks/gallery');
     touch(DIR_BASE . '/blocks/gallery/view.php');
     touch(DIR_BASE . '/blocks/gallery/view.css');
     touch(DIR_BASE . '/blocks/gallery/view.js');
     $blocks = $p->getBlocks('Main');
     $b = $blocks[0];
     $bv = new BlockViewTemplate($b);
     $this->assertEqual($bv->getTemplate(), DIR_BASE . '/blocks/gallery/view.php', 'Gallery Template Test - Block view override with gallery/view.php');
     phpQuery::browserGet(BASE_URL . DIR_REL . '/index.php/gallery', array('BlockOverrideTests', '_testGalleryHeaderItems'));
     $this->assertEqual(2, self::$_this->headerItem1Count + self::$_this->headerItem2Count, 'Gallery Header Test - Block view override with gallery/view.php and local view.css, view.js');
     unlink(DIR_BASE . '/blocks/gallery/view.css');
     unlink(DIR_BASE . '/blocks/gallery/view.js');
     unlink(DIR_BASE . '/blocks/gallery/view.php');
     rmdir(DIR_BASE . '/blocks/gallery');
     // c
     self::$_this = '';
     self::$_this->path = DIR_REL . '\\/packages\\/gallery/i';
     mkdir(DIR_BASE . '/blocks/gallery');
     mkdir(DIR_BASE . '/blocks/gallery/templates');
     touch(DIR_BASE . '/blocks/gallery/templates/custom_gallery_template.php');
     $blocks = $p->getBlocks('Main');
     $b = $blocks[0];
     $b->setCustomTemplate('custom_gallery_template.php');
     $p = Page::getByPath('/gallery');
     $blocks = $p->getBlocks('Main');
     $b = $blocks[0];
     $bv = new BlockViewTemplate($b);
     $this->assertEqual($bv->getTemplate(), DIR_BASE . '/blocks/gallery/templates/custom_gallery_template.php', 'Gallery Template Test - Custom Template view override with gallery/templates/custom_gallery_template.php');
     phpQuery::browserGet(BASE_URL . DIR_REL . '/index.php/gallery', array('BlockOverrideTests', '_testGalleryHeaderItems'));
     $this->assertEqual(3, self::$_this->headerItem1Count + self::$_this->headerItem2Count, 'Gallery Header Test - Custom Template view override with gallery/templates/custom_gallery_template.php');
     unlink(DIR_BASE . '/blocks/gallery/templates/custom_gallery_template.php');
     rmdir(DIR_BASE . '/blocks/gallery/templates');
     rmdir(DIR_BASE . '/blocks/gallery');
     $b->setCustomTemplate(false);
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:60,代码来源:block_override_tests.php

示例2: testCustomTemplateInPackage

 function testCustomTemplateInPackage()
 {
     self::$_this->headerItem1Count = 0;
     self::$_this->headerItem2Count = 0;
     $p = Page::getByID(1);
     $blocks = $p->getBlocks('Header Nav');
     $b = $blocks[0];
     $b->setCustomTemplate('test_template.php');
     $p = Page::getByID(1);
     $blocks = $p->getBlocks('Header Nav');
     $b = $blocks[0];
     touch(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/test_template.php');
     $bvt = new BlockViewTemplate($b);
     $this->assertEqual($bvt->getTemplate(), DIR_PACKAGES . '/autonav_test_template/blocks/autonav/test_template.php', 'Test K - File');
     unlink(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/test_template.php');
     touch(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/templates/test_template.php');
     $bvt = new BlockViewTemplate($b);
     $this->assertEqual($bvt->getTemplate(), DIR_PACKAGES . '/autonav_test_template/blocks/autonav/templates/test_template.php', 'Test K - File in Templates');
     unlink(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/templates/test_template.php');
     $b->setCustomTemplate('test_template');
     $p = Page::getByID(1);
     $blocks = $p->getBlocks('Header Nav');
     $b = $blocks[0];
     mkdir(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/templates/test_template');
     touch(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/templates/test_template/view.php');
     $bvt = new BlockViewTemplate($b);
     $this->assertEqual($bvt->getTemplate(), DIR_PACKAGES . '/autonav_test_template/blocks/autonav/templates/test_template/view.php', 'Test K - File in Template Directory');
     unlink(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/templates/test_template/view.php');
     rmdir(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/templates/test_template');
     touch(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/test_template.php');
     $b->setCustomTemplate('test_template.php');
     self::$_this->btHandle = 'autonav';
     touch(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/view.css');
     touch(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/view.js');
     phpQuery::browserGet(BASE_URL . DIR_REL . '/index.php', array('TemplateCoreWebTests', '_testHeaderItems'));
     $this->assertEqual(2, self::$_this->headerItem1Count + self::$_this->headerItem2Count, 'Test L - Loading Packaged Template with Core Header Items autoloaded');
     unlink(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/test_template.php');
     unlink(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/view.css');
     unlink(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/view.js');
     $b->setCustomTemplate(false);
     self::$_this->btHandle = '';
     $b->setCustomTemplate('test_template.php');
     self::$_this->headerItem1Count = 0;
     self::$_this->headerItem2Count = 0;
     touch(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/test_template.php');
     mkdir(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/css');
     mkdir(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/js');
     touch(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/css/test1.css');
     touch(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/css/test2.css');
     touch(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/js/test2.js');
     touch(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/js/test9.js');
     self::$_this->btHandle = 'autonav';
     phpQuery::browserGet(BASE_URL . DIR_REL . '/index.php', array('TemplateCoreWebTests', '_testHeaderItemDirectories'));
     $this->assertEqual(4, self::$_this->headerItem1Count + self::$_this->headerItem2Count, 'Test L - Loading Packaged Template with Core Header Items autoloaded from directories');
     unlink(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/css/test1.css');
     unlink(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/css/test2.css');
     unlink(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/js/test2.js');
     unlink(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/js/test9.js');
     rmdir(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/css');
     rmdir(DIR_FILES_BLOCK_TYPES_CORE . '/autonav/js');
     unlink(DIR_PACKAGES . '/autonav_test_template/blocks/autonav/test_template.php');
     self::$_this->btHandle = '';
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:63,代码来源:template_tests.php

示例3: CallbackReference

        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');
        }
    }
}
//	if ( $result->whois() == $testResult )
//		print "Test '$testName' PASSED :)";
//	else {
//		print "Test '$testName' <strong>FAILED</strong> !!! ";
//		print "<pre>";
//		print_r($result->whois());
//		print "</pre>\n";
//	}
开发者ID:roma30,项目名称:monitoring,代码行数:31,代码来源:test_webbrowser.php


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