Esempio n. 1
0
 * 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('xhtml');
/* Some constants to ease coding */
mkenum('BOLD', 'BOLD_OPEN', 'BOLD_CLOSE', 'ITALIC', 'ITALIC_OPEN', 'ITALIC_CLOSE', 'STRONG', 'STRONG_OPEN', 'STRONG_CLOSE', 'EMPH', 'EMPH_OPEN', 'EMPH_CLOSE', 'SUPERSCRIPT', 'SUPERSCRIPT_OPEN', 'SUPERSCRIPT_CLOSE', 'SUBSCRIPT', 'SUBSCRIPT_OPEN', 'SUBSCRIPT_CLOSE', 'STRIKETHROUGH', 'STRIKETHROUGH_OPEN', 'STRIKETHROUGH_CLOSE');
/* Regular expressions. A few regular expresion snippets are defined, which can
 * be used later to contruct larger ones. */
/** Start of HTML tokens */
define('ANEWT_TEXTILE_PATTERN_NMSTART', '[_a-zA-Z]');
/** Trailing characters of HTML tokens */
define('ANEWT_TEXTILE_PATTERN_NMCHAR', '[_a-zA-Z0-9-]');
/** HTML identifiers are built using HTML tokens */
define('ANEWT_TEXTILE_PATTERN_IDENT', ANEWT_TEXTILE_PATTERN_NMSTART . ANEWT_TEXTILE_PATTERN_NMCHAR . '*');
/** Class attributes must be valid identifiers */
define('ANEWT_TEXTILE_PATTERN_CLASS', ANEWT_TEXTILE_PATTERN_IDENT);
/** ID attributes must be valid identifiers */
define('ANEWT_TEXTILE_PATTERN_ID', ANEWT_TEXTILE_PATTERN_IDENT);
/** Style declarations end at the first } character */
define('ANEWT_TEXTILE_PATTERN_STYLE', '[^}]+?:[^}]+');
// at least one : character
Esempio n. 2
0
<?php

/*
 * Anewt, Almost No Effort Web Toolkit, rss module
 *
 * This code is copyrighted and distributed under the terms of the GNU LGPL.
 * See the README file for more information.
 */
anewt_include('xml/dom');
mkenum('ANEWT_RSS_ELEMENT_STATUS_REQUIRED', 'ANEWT_RSS_ELEMENT_STATUS_OPTIONAL');
mkenum('ANEWT_RSS_ELEMENT_TYPE_STRING', 'ANEWT_RSS_ELEMENT_TYPE_CANONICAL_URL', 'ANEWT_RSS_ELEMENT_TYPE_INTEGER', 'ANEWT_RSS_ELEMENT_TYPE_DATE');
/**
 * RSS channel (feed).
 *
 * AnewtRssChannel instances handle a number of properties , which you can set
 * using regular AnewtContainer::set() method calls. These will end up as
 * elements of your RSS channel.
 *
 * The required properties are:
 *
 * - \c title
 * - \c link
 * - \c description
 *
 * The optional properties are:
 *
 * - \c language
 * - \c copyright
 * - \c editor
 * - \c webmaster
 * - \c date
Esempio n. 3
0
<?php

/*
 * Anewt, Almost No Effort Web Toolkit, urldispatcher module
 *
 * This code is copyrighted and distributed under the terms of the GNU LGPL.
 * See the README file for more information.
 */
mkenum('ANEWT_URL_DISPATCHER_ROUTE_TYPE_URL_PARTS', 'ANEWT_URL_DISPATCHER_ROUTE_TYPE_REGEX');
/**
 * HTTP exception.
 */
final class AnewtHTTPException extends AnewtException
{
    /**
     * Construct a new AnewtException.
     *
     * \param $status_code
     *   The HTTP status code for this error. This should be one of the \c
     *   HTTP_STATUS_* constants.
     * \param $fmt
     *   A sprintf-like format string (optional)
     * \param $args
     *   The arguments for the format string placeholders
     *
     * \see AnewtException
     */
    public function __construct($status_code, $fmt = null, $args = null)
    {
        $args = func_get_args();
        $status_code = array_shift($args);
Esempio n. 4
0
<?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
{
Esempio n. 5
0
 * 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('datetime');
/* Query types */
mkenum('ANEWT_DATABASE_SQL_QUERY_TYPE_SELECT', 'ANEWT_DATABASE_SQL_QUERY_TYPE_INSERT', 'ANEWT_DATABASE_SQL_QUERY_TYPE_UPDATE', 'ANEWT_DATABASE_SQL_QUERY_TYPE_DELETE', 'ANEWT_DATABASE_SQL_QUERY_TYPE_REPLACE', 'ANEWT_DATABASE_SQL_QUERY_TYPE_CREATE', 'ANEWT_DATABASE_SQL_QUERY_TYPE_ALTER', 'ANEWT_DATABASE_SQL_QUERY_TYPE_DROP', 'ANEWT_DATABASE_SQL_QUERY_TYPE_BEGIN', 'ANEWT_DATABASE_SQL_QUERY_TYPE_COMMIT', 'ANEWT_DATABASE_SQL_QUERY_TYPE_ROLLBACK', 'ANEWT_DATABASE_SQL_QUERY_TYPE_UNKNOWN');
/* Column types */
mkenum('ANEWT_DATABASE_TYPE_BOOLEAN', 'ANEWT_DATABASE_TYPE_INTEGER', 'ANEWT_DATABASE_TYPE_FLOAT', 'ANEWT_DATABASE_TYPE_STRING', 'ANEWT_DATABASE_TYPE_DATE', 'ANEWT_DATABASE_TYPE_TIME', 'ANEWT_DATABASE_TYPE_DATETIME', 'ANEWT_DATABASE_TYPE_TIMESTAMP', 'ANEWT_DATABASE_TYPE_RAW', 'ANEWT_DATABASE_TYPE_COLUMN', 'ANEWT_DATABASE_TYPE_TABLE');
/**
 * SQL Template class with mandatory type checking. This class implements the
 * type checking logic for SQL queries.
 */
class SQLTemplate
{
    var $db;
    /**< \private Database object instance reference */
    var $placeholders;
    /**< \private List of parameters (placeholders) */
    var $named_placeholders;
    /**< \private List of named parameters (placeholders) */
    var $named_mode = false;
    /**< \private are we using 'named mode' with named placeholders? */
    var $sql_template;