Пример #1
0
 /**
  * Obtain an associative array of comment statuses
  * @param bool $refresh Whether to force a refresh of the cached values
  * @return array An array mapping comment statuses names to interger values
  */
 public static function list_comment_statuses($refresh = false)
 {
     if ($refresh || empty(self::$comment_status_list)) {
         self::$comment_status_list = DB::get_keyvalue('SELECT id, name FROM {commentstatus};');
     }
     self::$comment_status_list = Plugins::filter('list_comment_statuses', self::$comment_status_list);
     return self::$comment_status_list;
 }
Пример #2
0
	/**
	 * Find the types of objects associated with this Term.
	 *
	 * @return Array of objects, keyed by object id, values are type names
	 */
	public function object_types()
	{
		$results = DB::get_keyvalue( "SELECT terms.object_id, types.name FROM {object_terms} terms, {object_types} types WHERE terms.object_type_id = types.id and term_id = ?", array( $this->id ) );
		return $results;
	}
Пример #3
0
 /**
  * Execute and return key-value pairs from this query
  * @return array The results array of QueryRecords or the specified class
  */
 public function keyvalue()
 {
     return DB::get_keyvalue($this->get(), $this->params());
 }
Пример #4
0
 /**
  * Get an associative array of token ids and their name.
  *
  * @return array an array in the form id => name
  */
 private static function cache_tokens()
 {
     if (ACL::$token_cache == null) {
         ACL::$token_cache = DB::get_keyvalue('SELECT id, name FROM {tokens}');
     }
     return ACL::$token_cache;
 }
Пример #5
0
    /**
     * List the stored revisions of this post by date and user id
     * @return array
     */
    public function list_revisions()
    {
        $sql = <<<LIST_REVISIONS
SELECT DISTINCT
change_date, user_id
FROM {revisions}
WHERE post_id = :post_id;
LIST_REVISIONS;
        return DB::get_keyvalue($sql, array('post_id' => $this->id));
    }
Пример #6
0
 /**
  * Retrieve current scope data from the database based on the requested area
  *
  * @param string $area The area for which a scope may be applied
  * @return array An array of scope data
  */
 public function get_scopes($area)
 {
     $scopes = DB::get_keyvalue('SELECT s.id, s.criteria FROM {scopes} s INNER JOIN {blocks_areas} ba ON ba.scope_id = s.id WHERE ba.area = ? ORDER BY s.priority ASC', array($area));
     foreach ($scopes as $key => $value) {
         $scopes[$key] = unserialize($value);
     }
     Plugins::act('get_scopes', $scopes);
     return $scopes;
 }