more documentation for code in core

git-svn-id: file:///home/shish/svn/shimmie2/trunk@629 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-12-06 11:01:18 +00:00
parent 60e89ef893
commit db582a2d46
6 changed files with 49 additions and 11 deletions

View file

@ -1,4 +1,14 @@
<?php <?php
/*
* A basic chunk of page
* $header -- the block's title
* $body -- the content
* $section -- where the block should be placed. The default theme supports
* "main" and "left", other themes can add their own areas
* $position -- how far down the section the block should appear, higher
* numbers appear lower. The scale is 0-100 by convention,
* though any number or string will work.
*/
class Block { class Block {
var $header; var $header;
var $body; var $body;
@ -13,6 +23,11 @@ class Block {
} }
} }
/*
* A generic navigation block with a link to the main page. Used
* because "new NavBlock()" is easier than "new Block('Navigation', ..."
*/
class NavBlock extends Block { class NavBlock extends Block {
public function NavBlock() { public function NavBlock() {
$this->header = "Navigation"; $this->header = "Navigation";

View file

@ -1,12 +1,23 @@
<?php <?php
/*
* A class for easy access to the 'config' table, can always be accessed
* through "global $config;"
*/
class Config { class Config {
var $values = array(); var $values = array();
var $database = null; var $database = null;
/*
* Load the config table from a database
*/
public function Config($database) { public function Config($database) {
$this->database = $database; $this->database = $database;
$this->values = $this->database->db->GetAssoc("SELECT name, value FROM config"); $this->values = $this->database->db->GetAssoc("SELECT name, value FROM config");
} }
/*
* Save the current values as the new config table
*/
public function save($name=null) { public function save($name=null) {
if(is_null($name)) { if(is_null($name)) {
foreach($this->values as $name => $value) { foreach($this->values as $name => $value) {

View file

@ -2,7 +2,10 @@
$ADODB_CACHE_DIR="./data"; $ADODB_CACHE_DIR="./data";
require_once "lib/adodb/adodb.inc.php"; require_once "lib/adodb/adodb.inc.php";
class Querylet { // {{{ /* Querylet {{{
* A fragment of a query, used to build large search queries
*/
class Querylet {
var $sql; var $sql;
var $variables; var $variables;
@ -25,6 +28,9 @@ class Querylet { // {{{
} }
} // }}} } // }}}
/*
* A class for controlled database access, available through "global $database"
*/
class Database { class Database {
var $db; var $db;
var $extensions; var $extensions;

View file

@ -1,4 +1,7 @@
<?php <?php
/*
* A generic extension class, for subclassing
*/
class Extension { class Extension {
public function receive_event($event) {} public function receive_event($event) {}
} }

View file

@ -1,5 +1,9 @@
<?php <?php
/*
* An object representing an entry in the images table. As of 2.2, this no
* longer necessarily represents an image per se, but could be a video,
* sound file, or any other supported upload type.
*/
class Image { class Image {
var $id = null; var $id = null;
var $height, $width; var $height, $width;
@ -9,15 +13,11 @@ class Image {
var $posted; var $posted;
var $source; var $source;
public function Image($a=null) { public function Image($row=null) {
if(!is_null($a)) { if(!is_null($row)) {
$this->create_from_row($a); foreach($row as $name => $value) {
} $this->$name = $value; // hax
} }
private function create_from_row($row) {
foreach($row as $name => $value) {
$this->$name = $value; // hax
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
/*
* An object representing a row in the "users" table.
*/
class User { class User {
var $id; var $id;
var $name; var $name;