コード例 #1
0
function xanth_entry_view_entry($hook_primary_id, $hook_secondary_id, $arguments)
{
    $selected_entry = xEntry::get($arguments[0]);
    if ($selected_entry === NULL) {
        return NULL;
    } elseif ($selected_entry->published == FALSE && !xUser::check_current_user_access('view entry')) {
        return xSpecialPage::access_denied();
    }
    $content_format = new xContentFormat($selected_entry->content_format, '');
    $selected_entry->content = $content_format->apply_to($selected_entry->content);
    if (!empty($content_format->last_error)) {
        xanth_log(LOG_LEVEL_USER_MESSAGE, $content_format->last_error);
    }
    if ($selected_entry == NULL) {
        xanth_log(LOG_LEVEL_ERROR, 'Content not found', 'content');
    } else {
        $entry_ready_to_print = $selected_entry->render();
        return new xPageContent($selected_entry->title, $entry_ready_to_print, $selected_entry->description, $selected_entry->keywords);
    }
}
コード例 #2
0
 /**
  * List all box in an area.
  */
 function find($area = '')
 {
     $boxes = array();
     if (empty($area)) {
         $result = xanth_db_query("SELECT * FROM box");
     } else {
         $result = xanth_db_query("SELECT * FROM box WHERE area = '%s'", $area);
     }
     while ($row = xanth_db_fetch_array($result)) {
         $current_box = new xBox($row['name'], $row['title'], $row['content'], $row['content_format'], $row['is_user_defined'], $row['area']);
         if (!$current_box->user_defined) {
             //retrieve built-in box content
             $current_box->content = xanth_invoke_mono_hook(MONO_HOOK_CREATE_BOX_CONTENT, $current_box->name);
         } else {
             $content_format = new xContentFormat($row['content_format'], '');
             $current_box->content = $content_format->apply_to($current_box->content);
         }
         $boxes[] = $current_box;
     }
     return $boxes;
 }