Exemple #1
0
 /**
  * Outputs the editing controls for a given entry
  *
  * @param int $id the ID of the entry to be edited
  * @return string HTML markup to display the editing form
  */
 public function display_admin()
 {
     try {
         $entry_id = isset($_POST['entry_id']) ? (int) $_POST['entry_id'] : NULL;
         // Load form values
         $this->get_entry_by_id($entry_id);
         // Create a new form object and set submission properties
         $form = new Form();
         $form->form_id = 'ecms-edit-form';
         // Set up hidden form values
         $form->page = $this->url0;
         $form->action = 'entry-write';
         $form->entry_id = $entry_id;
         // Make the entry values available to the form if they exist
         $form->entry = isset($this->entries[0]) ? $this->entries[0] : array();
         // Set up input information
         $form->input_arr = array(array('name' => 'title', 'class' => 'input-text', 'label' => 'Entry Title'), array('type' => 'textarea', 'name' => 'entry', 'class' => 'input-textarea', 'label' => 'Entry Body'), array('type' => 'textarea', 'class' => 'input-textarea', 'name' => 'excerpt', 'label' => 'Excerpt (Meta Description)'), array('type' => 'submit', 'class' => 'input-submit', 'name' => 'form-submit', 'value' => 'Save Entry'));
         return $form;
     } catch (Exception $e) {
         ECMS_Error::logException($e);
     }
 }
Exemple #2
0
    exit;
} else {
    if ($menu_page === FALSE) {
        require_once CMS_PATH . 'core/helper/class.missing.inc.php';
        $menu_page->page_name = 'Invalid URL';
        $menu_page->type = 'Missing';
    }
}
/*******************************************************************************
* Initialize the main content class and load entry data
*******************************************************************************/
// Create a new object for the correct page type
try {
    $main_content = new $menu_page->type($url_array);
} catch (Exception $e) {
    ECMS_Error::logException($e);
}
// Load the main entry
$entry = $main_content->display_public();
/*******************************************************************************
* Meta data for the site is created here
*******************************************************************************/
// Load the page title
$title = $main_content->get_page_title($menu_page);
// Load the meta description (must come after $main_content->display_public())
$meta_description = $main_content->get_page_description();
/*******************************************************************************
* Define an autoloader for entry classes
*******************************************************************************/
function __autoload($classname)
{