コード例 #1
0
ファイル: QPList.php プロジェクト: GitError404/favrskov.dk
            } elseif (is_array($li) || $li instanceof Traversable) {
                $q->append('<li><ul/></li>')->find('li:last > ul');
                $q = $this->listImpl($li, $type, $opts, $q);
                $q->parent();
            } else {
                $q->append('<li>' . $li . '</li>');
            }
        }
        return $q;
    }
    protected function isAssoc($array)
    {
        return count(array_diff_key($array, range(0, count($array) - 1))) != 0;
    }
}
QueryPathExtensionRegistry::extend('QPList');
interface TableAble
{
    public function getHeaders();
    public function getRows();
    public function size();
}
class QPTableData implements TableAble, IteratorAggregate
{
    protected $headers;
    protected $rows;
    protected $caption;
    protected $p = -1;
    public function setHeaders($array)
    {
        $this->headers = $array;
コード例 #2
0
ファイル: QPTPL.php プロジェクト: rabc/Candidatos-2010
     *
     * @param array $array
     *  The array to test.
     * @return Boolean
     *  TRUE if this is an associative array, FALSE otherwise.
     */
    public function isAssoc($array)
    {
        $i = 0;
        foreach ($array as $k => $v) {
            if ($k !== $i++) {
                return TRUE;
            }
        }
        // If we get here, all keys passed.
        return FALSE;
    }
    /**
     * Convert a function name to a CSS class selector (e.g. myFunc becomes '.myFunc').
     * @param string $mname
     *  Method name.
     * @return string
     *  CSS 3 Class Selector.
     */
    protected function method2class($mname)
    {
        return '.' . substr($mname, 3);
    }
}
QueryPathExtensionRegistry::extend('QPTPL');
コード例 #3
0
ファイル: QPDB.php プロジェクト: rabc/Candidatos-2010
     */
    public function columnBefore($columnName, $wrap = NULL)
    {
        return $this->addData($columnName, 'before', $wrap);
    }
    /**
     * Insert data from the given column(s) after each element in the QueryPath.
     *
     * This inserts data from the given columns after each element in the QueryPath
     * object. IF HTML/XML is given in the $wrap parameter, then the column data
     * will be wrapped in that markup before being inserted into the QueryPath.
     *
     * @param mixed $columnName
     *  Either a string or an array of strings. The value(s) here should match 
     *  one or more column headers from the current SQL {@link query}'s results.
     * @param string $wrap
     *  IF this is supplied, then the value or values retrieved from the database
     *  will be wrapped in this HTML/XML before being inserted into the QueryPath.
     * @see QueryPath::wrap()
     * @see QueryPath::after()
     * @see appendColumn()
     */
    public function columnAfter($columnName, $wrap = NULL)
    {
        return $this->addData($columnName, 'after', $wrap);
    }
}
// The define allows another class to extend this.
if (!defined('QPDB_OVERRIDE')) {
    QueryPathExtensionRegistry::extend('QPDB');
}
コード例 #4
0
 public function testExtend()
 {
     $this->assertFalse(QueryPathExtensionRegistry::hasExtension('StubExtensionThree'));
     QueryPathExtensionRegistry::extend('StubExtensionThree');
     $this->assertTrue(QueryPathExtensionRegistry::hasExtension('StubExtensionThree'));
 }