本文整理汇总了PHP中WebPage类的典型用法代码示例。如果您正苦于以下问题:PHP WebPage类的具体用法?PHP WebPage怎么用?PHP WebPage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Display
/**
* Get the HTML fragment corresponding to the HTML editor widget
* @param WebPage $oP The web page used for all the output
* @param Hash $aArgs Extra context arguments
* @return string The HTML fragment to be inserted into the page
*/
public function Display(WebPage $oPage, $aArgs = array())
{
$iId = $this->m_iId;
$sCode = $this->m_sAttCode . $this->m_sNameSuffix;
$sValue = $this->m_sValue;
$sHelpText = $this->m_sHelpText;
$sValidationField = $this->m_sValidationField;
$sHtmlValue = "<table><tr><td><textarea class=\"htmlEditor\" title=\"{$sHelpText}\" name=\"attr_{$this->m_sFieldPrefix}{$sCode}\" rows=\"10\" cols=\"10\" id=\"{$iId}\">{$sValue}</textarea></td><td>{$sValidationField}</td></tr></table>";
// Replace the text area with CKEditor
// To change the default settings of the editor,
// a) edit the file /js/ckeditor/config.js
// b) or override some of the configuration settings, using the second parameter of ckeditor()
$sLanguage = strtolower(trim(UserRights::GetUserLanguage()));
$oPage->add_ready_script("\$('#{$iId}').ckeditor(function() { /* callback code */ }, { language : '{$sLanguage}' , contentsLanguage : '{$sLanguage}', extraPlugins: 'disabler' });");
// Transform $iId into a CKEdit
// Please read...
// ValidateCKEditField triggers a timer... calling itself indefinitely
// This design was the quickest way to achieve the field validation (only checking if the field is blank)
// because the ckeditor does not fire events like "change" or "keyup", etc.
// See http://dev.ckeditor.com/ticket/900 => won't fix
// The most relevant solution would be to implement a plugin to CKEdit, and handle the internal events like: setData, insertHtml, insertElement, loadSnapshot, key, afterUndo, afterRedo
// Could also be bound to 'instanceReady.ckeditor'
$oPage->add_ready_script("\$('#{$iId}').bind('validate', function(evt, sFormId) { return ValidateCKEditField('{$iId}', '', {$this->m_sMandatory}, sFormId, '') } );\n");
$oPage->add_ready_script("\$('#{$iId}').bind('update', function() { BlockField('cke_{$iId}', \$('#{$iId}').attr('disabled')); } );\n");
return $sHtmlValue;
}
示例2: DisplayWelcomePopup
/**
* Displays a popup welcome message, once per session at maximum
* until the user unchecks the "Display welcome at startup"
* @param WebPage $oP The current web page for the display
* @return void
*/
function DisplayWelcomePopup(WebPage $oP)
{
if (!isset($_SESSION['welcome'])) {
// Check, only once per session, if the popup should be displayed...
// If the user did not already ask for hiding it forever
$bPopup = appUserPreferences::GetPref('welcome_popup', true);
if ($bPopup) {
$sTemplate = @file_get_contents('../application/templates/welcome_popup.html');
if ($sTemplate !== false) {
$oTemplate = new DisplayTemplate($sTemplate);
$oP->add("<div id=\"welcome_popup\">");
$oTemplate->Render($oP, array());
$oP->add("<p style=\"float:left\"><input type=\"checkbox\" checked id=\"display_welcome_popup\"/><label for=\"display_welcome_popup\"> " . Dict::S('UI:DisplayThisMessageAtStartup') . "</label></p>\n");
$oP->add("<p style=\"float:right\"><input type=\"button\" value=\"" . Dict::S('UI:Button:Ok') . "\" onClick=\"\$('#welcome_popup').dialog('close');\"/>\n");
$oP->add("</div>\n");
$sTitle = addslashes(Dict::S('UI:WelcomeMenu:Title'));
$oP->add_ready_script(<<<EOF
\t\$('#welcome_popup').dialog( { width:'80%', height: 'auto', title: '{$sTitle}', autoOpen: true, modal:true,
\t\t\t\t\t\t\t\t close: function() {
\t\t\t\t\t\t\t\t \tvar bDisplay = \$('#display_welcome_popup:checked').length;
\t\t\t\t\t\t\t\t \tSetUserPreference('welcome_popup', bDisplay, true);
\t\t\t\t\t\t\t\t }
\t\t\t\t\t\t\t\t });
\tif (\$('#welcome_popup').height() > (\$(window).height()-70))
\t{
\t\t\$('#welcome_popup').height(\$(window).height()-70);
\t}
EOF
);
$_SESSION['welcome'] = 'ok';
}
}
}
}
示例3: create
/**
* @test
*/
public function create()
{
$model = new WebPage();
$model->attributes = array('title' => 'test', 'name' => "test", 'description' => "description test", 'keywords' => "test");
$this->assertTrue($model->save());
$model = new WebPage();
$model->attributes = array('title' => 'testa', 'name' => "test");
$this->assertFalse($model->save());
$this->assertInstanceOf('WebPage', WebPage::model());
}
示例4: test_should_find_by_id_string
public function test_should_find_by_id_string()
{
$attributes = array('title' => 'UserMinds.com');
$UserMinds = $this->WebPage->create($attributes);
$FoundUserMinds = new WebPage((string) $UserMinds->getId());
$this->assertFalse($FoundUserMinds->isNewRecord());
$this->assertEqual($FoundUserMinds->getId(), $UserMinds->getId());
$FoundUserMinds = $UserMinds->find((string) $UserMinds->getId());
$this->assertFalse($FoundUserMinds->isNewRecord());
$this->assertEqual($FoundUserMinds->getId(), $UserMinds->getId());
}
示例5: __construct
/**
* @param string $url
* @param string $tmpDir
* @param string $viewportSize
* @param int $zoomFactor
* @param int $timeout
* @param int $delay
* @throws \Exception
*/
public function __construct($url, $tmpDir = '/tmp', $viewportSize = WebPage::SIZE_NETBOOK_15, $zoomFactor = 1, $timeout = 0, $delay = 0)
{
if (!is_dir($tmpDir) || !is_writable($tmpDir)) {
throw new \Exception("Destination dir '{$tmpDir}' must exist and be writable");
}
do {
$tmpFile = $tmpDir . '/' . uniqid() . '.png';
} while (file_exists($tmpFile));
$webPage = new WebPage($url);
$webPage->getShot($tmpFile, $viewportSize, $zoomFactor, $timeout, $delay);
$this->image = imagecreatefrompng($tmpFile);
unlink($tmpFile);
$this->sourceWidth = imagesx($this->image);
$this->sourceHeight = imagesy($this->image);
}
示例6: __construct
function __construct()
{
parent::WebPage('StackOverflow 5672167');
$nav = new Panel(0, 0, 600, 30);
$chat = new Panel(0, $nav->Bottom, 200, 500);
$content = new MarkupRegion('', $chat->Right, $chat->Top, 400, 350);
$rooms = new Panel($content->Left, $content->Bottom, 400, 150);
$footer = new Panel(0, $chat->Bottom, 600, 50);
$chat->BackColor = Color::LightGreen;
$content->BackColor = Color::Yellow;
$rooms->BackColor = Color::Orange;
$footer->BackColor = Color::Gray;
$this->Controls->AddRange($nav, $chat, $content, $rooms, $footer);
$sections = array('HOME', 'ABOUT', 'CONTACT', 'LOGIN');
foreach($sections as $section)
$nav->Controls->Add(new Link(null, $section, 0, 5))
->Click = new ServerEvent($this, 'LoadSection', $content, $section);
$nav->Controls->AllCSSMarginRight = '5px';
$nav->Controls->AllLayout = Layout::Relative;
$nav->CSSTextAlign = 'right';
//Comet (Listener), Bind to Yahoo Flickr API through YQL
$this->Controls->Add($listener = new Listener(
'http://query.yahooapis.com/v1/public/yql?q=select%20source%20from%20flickr.photos.sizes%20WHERE%20photo_id%20in%20(select%20id%20from%20flickr.photos.recent)%20and%20label%3D%22Thumbnail%22',
new ServerEvent($this, 'LoadImage', $chat)));
//Default Section
$this->LoadSection($content, URL::GetToken('section', 'HOME'));
}
示例7: basePageHref
function basePageHref($basePageCode, $image)
{
$basePage = WebPage::inst($basePageCode);
$sprites = CssSpritesManager::getDirSprite(CssSpritesManager::DIR_HEADER, $image, true);
$href = $basePage->getHref($sprites . $basePage->getName());
echo PsHtml::html2('li', array('class' => WebPages::getCurPage()->isMyBasePage($basePage) ? 'current' : null), $href);
}
示例8: __construct
function __construct()
{
parent::WebPage('Basic TinyMCE Example 1');
$this->Controls->Add($editor = new TinyMCE('Testing'));
$this->Controls->Add($button = new Button('Click Me', $editor->Right + 10))
->Click = new ServerEvent($this, 'SomeFunc', $editor);
}
示例9: CKEditorTest
function CKEditorTest()
{
parent::WebPage('CKEditor Example');
//Instantiate first CKEditor
$editor1 = new CKEditor('', 10, 40);
//Instantiate second CKEditor
$editor2 = new CKEditor('Text that is already entered', $editor1->Right + 10, 40, 300);
//Set the second CKEditor's Skin to Office theme
// $editor2->Skin = CKEditor::Office;
//Instantiate third CKEditor
$editor3 = new CKEditor('Text that is already entered', $editor2->Right + 50, 40);
//Set the third CKEditor's Skin to V2 theme
// $editor3->Skin = CKEditor::V2;
//Adds the 3 Editors to the WebPage
$this->Controls->AddRange($editor1, $editor2, $editor3);
/*For each of the above 3 editors we're going to add a ComboBox above
the editor that allows you to change the theme and a button that will switch
the CKEditor to the Basic/Advanced Toolbar*/
foreach ($this->Controls as $control) {
if ($control instanceof CKEditor) {
$this->Controls->Add($skins = new ComboBox($control->Left, 5, 150));
$skins->Items->AddRange(new Item('-- Select Theme --', null), CKEditor::Kama, CKEditor::Office, CKEditor::V2);
$skins->Change = new ServerEvent($this, 'ChangeSkin', $skins, $control);
//Button to switch to Basic Toolbar
$this->Controls->Add($basic = new Button('Basic', $skins->Right + 15, 5))->Click = new ServerEvent($control, 'SetToolbar', CKEditor::Basic);
//Button to switch to Advanced Toolbar
$this->Controls->Add(new Button('Advanced', $basic->Right + 10, 5))->Click = new ServerEvent($control, 'SetToolbar', CKEditor::Full);
$this->Controls->Add($ta = new TextArea('', $control->Left, $control->Bottom + 10, $control->Width))->Click = new ServerEvent($this, 'ShowText', $control, $ta);
}
}
}
示例10: __construct
public function __construct(Identifier $page)
{
if (!$page->of(WebPage::getIdentifier())) {
throw new \InvalidArgumentException(sprintf('RestartRequestOnPageException expects a web page identifier, %s given.', $page->getFullyQualifiedName()));
}
$this->page = $page;
parent::__construct('RestartRequestOnPageException');
}
示例11: SetHttpHeaders
public function SetHttpHeaders(WebPage $oPage)
{
// Integration within MS-Excel web queries + HTTPS + IIS:
// MS-IIS set these header values with no-cache... while Excel fails to do the job if using HTTPS
// Then the fix is to force the reset of header values Pragma and Cache-control
$oPage->add_header("Pragma:", true);
$oPage->add_header("Cache-control:", true);
}
示例12: __construct
public function __construct(Identifier $pageIdentifier, Identifier $loginPage)
{
Args::identifierOf($pageIdentifier, WebPage::getIdentifier(), 'pageIdentifier');
Args::identifierOf($loginPage, WebPage::getIdentifier(), 'loginPage');
$this->pageAuthIdentifier = $pageIdentifier;
$this->loginPageIdentifier = $loginPage;
PiconApplication::get()->getSecuritySettings()->setComponentNotAuthorisedListener(new DirectToPageComponentNotAuthorisedListener($loginPage));
}
示例13: __construct
public function __construct($title, $showCover = true, $hrefOrPageCode = null, array $smartyParams = array(), $jsParams = null)
{
$this->title = $title;
$this->cover = !!$showCover;
$this->href = is_numeric($hrefOrPageCode) ? WebPage::inst($hrefOrPageCode)->getUrl() : $hrefOrPageCode;
$this->smartyParams = $smartyParams;
$this->jsParams = $jsParams;
}
示例14: Save
function Save($editor)
{
$comment = $editor->Text;
$editor->Leave();
$this->Controls->Clear();
$this->Controls->Add(new MarkupRegion($comment, 0, 0, '100%', '100%'));
WebPage::That()->Controls->Add(new BlogComment())
->Layout = Layout::Relative;
}
示例15: HighlighterTest
function HighlighterTest()
{
parent::WebPage('Syntax Highlighter Example');
/*Instantiate new SyntaxHighlighter pointing to file code.txt,
using PHP, with a location of 0, 0, and a Size of null, null*/
$highlighter = new SyntaxHighlighter('code.txt', SyntaxHighlighter::PHP, 0, 0, null, null);
//Add SyntaxHighlighter to the WebPage
$this->Controls->Add($highlighter);
}