本文整理汇总了PHP中anewt_include函数的典型用法代码示例。如果您正苦于以下问题:PHP anewt_include函数的具体用法?PHP anewt_include怎么用?PHP anewt_include使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了anewt_include函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_connection
/**
* Setup a new database connection.
*
* This stores the connection configuration in the database pool.
* See the AnewtDatabaseConnection (and subclasses) documentation for the
* description of the settings array.
*
* \param $settings
* An associative array with connection settings. At least the \c type
* key must be provided to specify the database connection type. See
* AnewtDatabaseConnection for the possible values.
* \param $id
* The connection id to use for this connection (optional, defaults to
* <code>default</code>)
*
* \see AnewtDatabaseConnection
*/
public static function setup_connection($settings, $id = 'default')
{
assert('is_assoc_array($settings)');
assert('array_has_key($settings, "type"); // "type" key must be present in database settings array');
assert('is_string($id)');
/* A connection can be setup only once */
if (array_key_exists($id, AnewtDatabase::$connections)) {
throw new AnewtDatabaseException('Connection "%s" has been setup already.', $id);
}
/* Create an AnewtDatabaseConnection instance */
$connection_type = $settings['type'];
switch ($connection_type) {
case 'sqlite':
anewt_include('database/backend-sqlite');
$connection = new AnewtDatabaseConnectionSQLite($settings);
break;
case 'mysql':
anewt_include('database/backend-mysql');
$connection = new AnewtDatabaseConnectionMySQL($settings);
break;
case 'mysql-old':
anewt_include('database/backend-mysql-old');
$connection = new AnewtDatabaseConnectionMySQLOld($settings);
break;
case 'postgresql':
anewt_include('database/backend-postgresql');
$connection = new AnewtDatabaseConnectionPostgreSQL($settings);
break;
case 'memcache':
anewt_include('database/backend-memcache');
$connection = new AnewtDatabaseConnectionMemcache($settings);
break;
default:
throw new AnewtDatabaseException('Database type "%s" is not supported', $connection_type);
break;
}
/* Connect by default, unless instructed not to */
if (array_get_bool($settings, 'autoconnect', true)) {
$connection->connect();
}
/* Store the connection instance */
AnewtDatabase::$connections[$id] = $connection;
}
示例2: anewt_include
<?php
/*
* Anewt, Almost No Effort Web Toolkit, form module
*
* This code is copyrighted and distributed under the terms of the GNU LGPL.
* See the README file for more information.
*/
anewt_include('validator');
mkenum('ANEWT_FORM_METHOD_POST', 'ANEWT_FORM_METHOD_GET');
/**
* Basic form class.
*
* This class can be used to create an XHTML form. An AnewtForm instance holds
* a number of controls, fieldset or custom XHTML elements. Additionally, it has
* a few properties that influence its behaviour:
*
* - \c id property is the form id
* - \c method is either \c ANEWT_FORM_METHOD_GET or \c ANEWT_FORM_METHOD_POST
* - \c action is the URL the form will be posted to
*
* Usually an AnewtForm subclass is created. The constructor of this subclass
* adds controls to the form, and optionally the handle_valid() and
* handle_invalid() methods are overridden. Calling code then instantiates this
* subclass, fills it with values using fill() or autofill(), then processes the
* form using process().
*
* \todo Reference module documentation once it's written.
*/
class AnewtForm extends Container
{
示例3: anewt_include
<?php
/*
* Anewt, Almost No Effort Web Toolkit, form module
*
* This code is copyrighted and distributed under the terms of the GNU LGPL.
* See the README file for more information.
*/
anewt_include('form/controls/base');
anewt_include('form/controls/text');
anewt_include('form/controls/button');
anewt_include('form/controls/choice');
anewt_include('form/controls/fileupload');
示例4: dirname
<?php
require_once dirname(__FILE__) . '/../anewt.lib.php';
anewt_include('page');
class TestPage extends AnewtPage
{
function __construct()
{
parent::__construct();
$this->set('blocks', array('header', 'main', 'footer'));
}
function build_header()
{
return ax_fragment(array(ax_p('Header line 1'), ax_p('Header line 2')));
}
}
$p = new TestPage();
$p->title = 'Anewt Page test';
$p->default_block = 'main';
$p->add_stylesheet_href('1.css');
$p->add_stylesheet_href('2.css');
$p->add_stylesheet(ax_stylesheet_href('3.css'));
$p->add_stylesheet(ax_stylesheet_href_media('screen.css', 'screen'));
$p->add_stylesheet_href_media('print.css', 'print');
$p->add_javascript_content('function test() {alert("test");}');
$p->add_javascript_src('foo.js');
$p->append_to('main', ax_h1('Title'));
$p->append(ax_p('Test paragraph'));
$p->append(ax_p(ax_a_href('Click me!', 'javascript:test()')));
$p->append_to('footer', ax_p('This is the footer text'));
$p->flush();
示例5: anewt_include
<?php
/*
* Anewt, Almost No Effort Web Toolkit, core module
*
* This code is copyrighted and distributed under the terms of the GNU LGPL.
* See the README file for more information.
*/
anewt_include('core/exception');
anewt_include('core/constants');
anewt_include('core/string');
anewt_include('core/array');
anewt_include('core/datetime');
anewt_include('core/noquotes');
anewt_include('core/container');
anewt_include('core/redirect');
anewt_include('core/request');
anewt_include('core/url');
// anewt_include('core/aasprintf'); /* Disable for now */
示例6: anewt_include
<?php
/*
* Anewt, Almost No Effort Web Toolkit, gpc module
*
* This code is copyrighted and distributed under the terms of the GNU LGPL.
* See the README file for more information.
*/
anewt_include('gpc/gpc');
示例7: anewt_include
<?php
anewt_include('page');
anewt_include('database');
require 'utils.php';
require 'home.php';
require 'table.php';
require 'feeds.php';
require 'feed_items.php';
require 'feed_item_comments.php';
require 'feed_item_comment_counts.php';
require 'tags.php';
require 'tasks.php';
require 'jobs.php';
require 'job_logs.php';
require 'resources.php';
require 'errors.php';
class SsscrapeMonitor extends AnewtPage
{
public $interval = "1 DAY";
// default interval
public $pages = array(array('name' => 'home', 'class' => 'HomePage', 'descr' => 'Ssscrape monitor'), array('name' => 'feeds', 'class' => 'FeedTable', 'descr' => 'Basic statistics for feeds'), array('name' => 'items', 'class' => 'FeedItemTable', 'descr' => 'Information about feeds items'), array('name' => 'comments', 'class' => 'FeedItemCommentsTable', 'descr' => 'Information about comments', 'parent' => 'comments'), array('name' => 'commentCounts', 'class' => 'FeedItemCommentCountsTable', 'descr' => 'Basic statistics for comments', 'tab' => False, 'parent' => 'comments'), array('name' => 'tags', 'class' => 'TagsTable', 'descr' => 'Feed tags'), array('name' => 'tasks', 'class' => 'TasksTable', 'descr' => 'Periodic tasks'), array('name' => 'jobs', 'class' => 'JobsTable', 'descr' => 'Jobs in the job queue'), array('name' => 'jobLogs', 'class' => 'JobLogsTable', 'descr' => 'Jobs in the log table'), array('name' => 'resources', 'class' => 'ResourcesTable', 'descr' => 'Resources shared by jobs'), array('name' => 'errors', 'class' => 'ErrorsTable', 'descr' => 'Errors in job execution'));
function SsscrapeMonitor()
{
AnewtPage::AnewtPage();
/* Provide a list of blocks */
$this->set('blocks', array('header', 'content', 'footer'));
/* Set some default values */
$this->set('title', 'Ssscrape monitor');
$this->set('default-block', 'content');
$this->add_stylesheet_href('style.css');
示例8: anewt_include
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA+
*/
anewt_include('smarty');
/**
* Renderer for Smarty templates.
*/
class SmartyTemplateRenderer extends SmartyTemplate
{
/**
* Constructor for a new SmartyTemplateRenderer instance
*
* \param $basetemplate Template name (optional, default is null)
* \param $directories Directories to use (optional, see SmartyTemplate documentation for more information)
* \param $mode Default render mode (optional, default is null)
*
* \see SmartyTemplate
*/
function SmartyTemplateRenderer($basetemplate = null, $directories = null, $mode = null)
示例9: dirname
<?php
require_once dirname(__FILE__) . '/../anewt.lib.php';
anewt_include('calendar');
$calendar = new AnewtCalendar();
$event = new AnewtCalendarEvent('Title');
$event->date_start = AnewtDateTime::parse_string('2009-01-01 12:00');
$event->date_end = AnewtDateTime::parse_string('2009-01-01 14:00');
$event->summary = 'This is the summary';
$event->location = 'This is the location';
$event->url = 'http://example.org/foo';
$event->uid = 'abc1234567890';
$calendar->add_event($event);
$event = new AnewtCalendarEvent('Another event', AnewtDateTime::now());
$event->summary = "This is a multiline\nsummary";
$event->summary = "This is a multiline\ndescription";
$calendar->add_event($event);
$calendar->flush();
示例10: error_reporting
<?php
error_reporting(E_ALL | E_STRICT);
require_once '../anewt.lib.php';
anewt_include('sparkline');
anewt_include('sparkline/bar');
$sl =& new AnewtSparklineImageBar();
$sl->set('debug-resize-factor', 1);
$sl->set('debug-resize-factor', 4);
$sl->set('draw-zero-axis', true);
$sl->set('image-border', 1, 2);
$sl->set('bar-spacing', 1);
$sl->set('bar-width', 2);
//$sl->set('bar-height', 5);
$sl->set('value-scale', 1.2);
//$sl->set('max-value', 5);
//$sl->set('min-value', -5);
$values = range(-7, 7);
/* Random values */
for ($i = 0; $i < 30; $i++) {
$values[] = rand(-7, 7);
}
$sl->set('values', $values);
$sl->flush_png();
示例11: dirname
<?php
require_once dirname(__FILE__) . '/../anewt.lib.php';
anewt_include('page');
anewt_include('page/blank');
$bp = new AnewtBlankPage();
$bp->flush();
示例12: dirname
<?php
require_once dirname(__FILE__) . '/../../anewt.lib.php';
anewt_include('page');
anewt_include('renderer/grid');
$grid = new AnewtGridRenderer();
$column = new AnewtGridColumn('col-2', 'Second column', 2);
$grid->add_column($column);
$column = new AnewtGridColumn('somecol', 'First column', 1);
$cell_renderer = new AnewtGridCellRenderer('col-1a', 'Column 1a');
$cell_renderer->set('title', 'Column 1a');
$column->add_cell_renderer($cell_renderer);
$cell_renderer = new AnewtGridCellRenderer('col-1b', 'Column 1b');
$cell_renderer->set('title', 'Column 1b');
$column->add_cell_renderer($cell_renderer);
$grid->add_column($column);
$rows = array(array('col-1a' => 'r1c1a', 'col-1b' => 'r1c1b', 'col-2' => 'r1c2'), array('col-1a' => 'r2c1a', 'col-1b' => 'r2c1b', 'col-2' => 'r2c2'));
$grid->set_rows($rows);
$grid->add_row(array('col-1a' => 'r3c1a', 'col-2' => 'r3c2'));
$p = new AnewtPage();
$p->set('title', 'Anewt Grid Renderer');
$p->append($grid);
$p->flush();
示例13: error_reporting
<?php
error_reporting(E_ALL | E_STRICT);
require_once '../anewt.lib.php';
anewt_include('logging');
AnewtLog::init(false);
AnewtLog::add_handler(new AnewtLogHandlerDefault());
AnewtLog::add_handler(new AnewtLogHandlerFile('test.log'));
AnewtLog::add_handler(new AnewtLogHandlerFile('test-debug.log'), ANEWT_LOG_LEVEL_DEBUG);
AnewtLog::set_domain('a');
AnewtLog::error('An error occured.');
AnewtLog::set_domain('b');
AnewtLog::error('Error number %d', 3);
AnewtLog::reset_domain();
AnewtLog::debug('Debugging message: %d: %s', 4, 'dbg');
AnewtLog::set_domain('c');
AnewtLog::warning('This is a warning message without arguments');
AnewtLog::reset_domain();
AnewtLog::warning('This is a warning message: %d: %s', 2, 'test1');
AnewtLog::reset_domain();
AnewtLog::warning('This is a warning message: %d: %s', array(2, 'test2'));
AnewtLog::warning('This is warning with format characters but no values, %s %s %s');
示例14: error_reporting
<?php
error_reporting(E_ALL | E_STRICT);
require_once dirname(__FILE__) . '/../anewt.lib.php';
anewt_include('rss');
$channel = new AnewtRssChannel('Title', 'http://example.com', 'This is a test');
$channel->set('author', 'Anewt test');
$channel->set('build-date', AnewtDateTime::now());
$item = new AnewtRssItem('test', 'http://example.com/some-item');
$item->set('description', 'The description goes here.');
$item->set('guid', 'http://example.com/some-item');
$item->set('date', AnewtDateTime::now());
$channel->add_item($item);
$item = new AnewtRssItem('another test');
$item->set('description', 'The description goes here.');
$item->set('link', 'http://example.com/another-item');
$item->set('guid', 'http://example.com/another-item');
$item->set('date', AnewtDateTime::now());
$channel->add_item($item);
$channel->flush();
示例15: error_reporting
<?php
error_reporting(E_ALL);
require_once dirname(__FILE__) . '/../anewt.lib.php';
anewt_include('xml');
anewt_include('xml/abstractxmlparser');
function println($str)
{
echo $str, "\n";
}
function printfln()
{
$args = func_get_args();
$pattern = array_shift($args);
println(vsprintf($pattern, $args));
}
class TestParser extends AbstractXMLParser
{
function handle_p_data($data)
{
if (trim($data)) {
printfln('Data in a <p> tag: %s', $data);
}
}
function handle_b_data($data)
{
if (trim($data)) {
printfln('Data in a <b> tag: %s', $data);
}
}
function handle_data($data)