Template PHP Class Code Examples

This page contains top rated real world PHP examples of class Template extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: common.php Project: fallen90/diary-php
0
function get_all_posts()
{
    global $user;
    $tpl = get_post_tpl();
    $tpl_posts = "";
    $pst = new Post();
    $posts = $pst->get_all();
    if (count($posts) >= 1) {
        foreach ($posts as $key => $post) {
            $tmpl_posts = new Template(get_post_tpl());
            $cmts = new Comment($post['post_id']);
            $comments = $cmts->get_all();
            if ($comments->num_rows >= 1) {
                $tpl_comments = "";
                foreach ($comments as $comment) {
                    $comment['comment_timestamp'] = date('h:i A, F d, o', strtotime($comment['comment_timestamp']));
                    $tmpl_comments = new Template(get_comment_tpl());
                    $tpl_comments .= $tmpl_comments->inject($comment);
                }
                $post['comment_list'] = $tpl_comments;
                $post['comment_count'] = $comments->num_rows;
            } else {
                $post['comment_count'] = 0;
                $post['comment_list'] = '';
            }
            $post['current_user_id'] = $user['user_id'];
            $post['current_user_name'] = $user['user_name'];
            $post['post_timestamp'] = date('h:i A, F d, o', strtotime($post['post_timestamp']));
            $tpl_posts .= $tmpl_posts->inject($post);
            //\$tpl_posts .= sprintf($tpl, $user['user_name'],$user['user_fullname'],date('h:i A, F d, o', strtotime($post['post_timestamp'])),$post['post_body'], $post['post_id']);
        }
    }
    echo $tpl_posts;
}
Example #2
Show file File: exif_admin.php Project: spacequad/glfusion
0
function MG_adminEXIF()
{
    global $_TABLES, $_MG_CONF, $_CONF, $LANG_MG01, $LANG_MG04;
    $retval = '';
    $T = new Template($_MG_CONF['template_path'] . '/admin/');
    $T->set_file('admin', 'exif_tags.thtml');
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $T->set_block('admin', 'exifRow', 'eRow');
    $sql = "SELECT * FROM {$_TABLES['mg_exif_tags']}";
    $result = DB_query($sql);
    $nRows = DB_numRows($result);
    for ($i = 0; $i < $nRows; $i++) {
        $row = DB_fetchArray($result);
        $properties[] = $row['name'];
        $tag[$row['name']][] = $row['selected'];
    }
    $exifKeys = getExifKeys();
    $x = 0;
    foreach ($properties as $property) {
        $title = $exifKeys[$property][0];
        $T->set_var(array('exif_tag' => $title, 'selected' => $tag[$property][0] ? ' checked="checked"' : '', 'tag' => $property, 'rowcounter' => $x % 2));
        $T->parse('eRow', 'exifRow', true);
        $x++;
    }
    $T->set_var(array('lang_select' => $LANG_MG01['select'], 'lang_exiftag' => $LANG_MG01['exiftag'], 'lang_exif_admin_help' => $LANG_MG01['exif_admin_help'], 'lang_check_all' => $LANG_MG01['check_all'], 'lang_uncheck_all' => $LANG_MG01['uncheck_all'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 's_form_action' => $_MG_CONF['admin_url'] . 'exif_admin.php'));
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Example #3
Show file File: Search.php Project: PublicityPort/OpenCATS
0
 /**
  * Print a fatal error and die.
  *
  * @param string error message
  * @return void
  */
 protected function fatal($error)
 {
     $template = new Template();
     $template->assign('errorMessage', $error);
     $template->display('./Error.tpl');
     die;
 }
Example #4
Show file File: database.php Project: spacequad/glfusion
0
/**
*   Provide an interface to configure backups
*
*   @return string  HTML for configuration function
*/
function DBADMIN_configBackup()
{
    global $_CONF, $_TABLES, $_VARS, $LANG_DB_BACKUP, $LANG_ADMIN, $_IMAGE_TYPE;
    $tablenames = $_TABLES;
    $included = '';
    $excluded = '';
    $retval = '';
    $exclude_tables = @unserialize($_VARS['_dbback_exclude']);
    if (!is_array($exclude_tables)) {
        $exclude_tables = array();
    }
    $chk_gzip = isset($_VARS['_dbback_gzip']) && $_VARS['_dbback_gzip'] == 1 ? ' checked="checked" ' : '';
    $chk_allstructs = isset($_VARS['_dbback_allstructs']) && $_VARS['_dbback_allstructs'] == 1 ? ' checked="checked" ' : '';
    $max_files = isset($_VARS['_dbback_files']) ? (int) $_VARS['_dbback_files'] : 0;
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/database.php', 'text' => $LANG_DB_BACKUP['database_admin']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $T = new Template($_CONF['path_layout'] . 'admin/dbadmin');
    $T->set_file('page', 'dbbackupcfg.thtml');
    $T->set_var('start_block', COM_startBlock($LANG_DB_BACKUP['database_admin'], '', COM_getBlockTemplate('_admin_block', 'header')));
    $T->set_var('admin_menu', ADMIN_createMenu($menu_arr, $LANG_DB_BACKUP['config_instructions'], $_CONF['layout_url'] . '/images/icons/database.' . $_IMAGE_TYPE));
    $include_tables = array_diff($tablenames, $exclude_tables);
    foreach ($include_tables as $key => $name) {
        $included .= "<option value=\"{$name}\">{$name}</option>\n";
    }
    foreach ($exclude_tables as $key => $name) {
        $excluded .= "<option value=\"{$name}\">{$name}</option>\n";
    }
    $T->set_var(array('lang_tables_to_backup' => $LANG_DB_BACKUP['tables_to_backup'], 'lang_include' => $LANG_DB_BACKUP['include'], 'lang_exclude' => $LANG_DB_BACKUP['exclude'], 'lang_options' => $LANG_DB_BACKUP['options'], 'lang_struct_only' => $LANG_DB_BACKUP['struct_only'], 'lang_max_files' => $LANG_DB_BACKUP['max_files'], 'lang_disable_purge' => $LANG_DB_BACKUP['disable_purge'], 'lang_use_gzip' => $LANG_DB_BACKUP['use_gzip'], 'lang_save' => $LANG_ADMIN['save'], 'included_tables' => $included, 'excluded_tables' => $excluded, 'max_files' => $max_files, 'chk_gzip' => $chk_gzip, 'chk_allstructs' => $chk_allstructs));
    $T->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
    $T->parse('output', 'page');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Example #5
Show file File: PageType.php Project: pombredanne/tuleap
0
 function format($text)
 {
     include_once 'lib/Template.php';
     global $request;
     $tokens['page'] = $this->_page;
     $tokens['CONTENT'] = $this->_transform($text);
     $pagename = $this->_page->getName();
     // This is a XmlElement tree, which must be converted to PDF
     // We can make use of several pdf extensions. This one - fpdf
     // - is pure php and very easy, but looks quite ugly and has a
     // terrible interface, as terrible as most of the othes.
     // The closest to HTML is htmldoc which needs an external cgi
     // binary.
     // We use a custom HTML->PDF class converter from PHPWebthings
     // to be able to use templates for PDF.
     require_once 'lib/fpdf.php';
     require_once 'lib/pdf.php';
     $pdf = new PDF();
     $pdf->SetTitle($pagename);
     $pdf->SetAuthor($this->_page->get('author'));
     $pdf->SetCreator(WikiURL($pagename, false, 1));
     $pdf->AliasNbPages();
     $pdf->AddPage();
     //TODO: define fonts
     $pdf->SetFont('Times', '', 12);
     //$pdf->SetFont('Arial','B',16);
     // PDF pagelayout from a special template
     $template = new Template('pdf', $request, $tokens);
     $pdf->ConvertFromHTML($template);
     // specify filename, destination
     $pdf->Output($pagename . ".pdf", 'I');
     // I for stdin or D for download
     // Output([string name [, string dest]])
     return $pdf;
 }
Example #6
Show file File: enroll.php Project: spacequad/glfusion
0
function MG_enroll()
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG03;
    // let's make sure this user does not already have a member album
    if ($_MG_CONF['member_albums'] != 1) {
        echo COM_refresh($_MG_CONF['site_url'] . '/index.php');
        exit;
    }
    $sql = "SELECT album_id FROM {$_TABLES['mg_albums']} WHERE owner_id=" . (int) $_USER['uid'] . " AND album_parent=" . $_MG_CONF['member_album_root'];
    $result = DB_query($sql);
    $nRows = DB_numRows($result);
    if ($nRows > 0) {
        $display = MG_siteHeader();
        $display .= COM_showMessageText($LANG_MG03['existing_member_album'], '', true);
        $display .= MG_siteFooter();
        echo $display;
        exit;
    }
    $T = new Template(MG_getTemplatePath(0));
    $T->set_file('enroll', 'enroll.thtml');
    $T->set_var(array('s_form_action' => $_MG_CONF['site_url'] . '/enroll.php', 'lang_title' => $LANG_MG03['enroll_title'], 'lang_overview' => $LANG_MG03['overview'], 'lang_terms' => $LANG_MG03['terms'], 'lang_member_album_overview' => $LANG_MG03['member_album_overview'], 'lang_member_album_terms' => $LANG_MG03['member_album_terms'], 'lang_agree' => $LANG_MG03['agree'], 'lang_cancel' => $LANG_MG03['cancel']));
    $T->parse('output', 'enroll');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Example #7
Show file File: moderate.php Project: aidanreilly/documentation
0
function moderateComment($id, $action, $fullUser)
{
    global $dbConnectionInfo;
    $toReturn = "";
    $act = false;
    if ($action == "approved") {
        $act = true;
    }
    $cmt = new Comment($dbConnectionInfo, "", $fullUser);
    $return = $cmt->moderate($id, $action);
    $toReturn = $return['page'];
    if ($return['page'] != "" && $act && $return['oldState'] == 'new') {
        // notify users
        $user = new User($dbConnectionInfo);
        $usersToNotify = $user->getUsersToNotify($toReturn, $id);
        $cmtInfo = $cmt->getInfo($id);
        $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $cmtInfo['product'];
        $template = new Template("./templates/newComment.html");
        $confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $toReturn . "#" . $id, "text" => $cmtInfo['text'], "user" => $cmtInfo['name'], "productName" => $productTranslate));
        foreach ($usersToNotify as $key => $value) {
            $mail = new Mail();
            $subject = "[" . $productTranslate . "] " . Utils::translate('newCommentApproved');
            $subject .= " [" . $toReturn . "]";
            $mail->Subject($subject);
            $mail->To($value);
            $mail->From(__EMAIL__);
            $mail->Body($confirmationMsg);
            $mail->Send();
            //$toReturn = "\nSEND to ".$value."user email='".$userEmail."'";
        }
    }
    return $toReturn;
}
Example #8
Show file File: TemplateController.php Project: chenyongze/d-a-m
0
 /**
  * 新建模板
  * @author yongze
  */
 public function actionCreate($id)
 {
     $dsModel = $this->loadModel((int) $id, 'ds');
     $dbModel = $this->loadModel((int) $dsModel->database_id, 'db');
     $model = new Template('Create');
     $data = array();
     if (isset($_POST['Template'])) {
         if (isset($_POST['Template']['type'])) {
             $_POST['Template']['type'] = (int) $_POST['Template']['type'];
         }
         $model->attributes = $_POST['Template'];
         $model->dataset_id = (int) $dsModel->id;
         $model->dataset_name = $dsModel->name;
         if ($model->save()) {
             $this->addLog('template', $model->id, '添加新模板“' . $model->tpname . '”');
             Yii::app()->user->setFlash("success", "新建 <b>{$model->tpname}</b> 模板成功!");
         } else {
             $errorMsg = '';
             $errorErr = $model->getErrors();
             foreach ($errorErr as $value) {
                 $errorMsg .= "\t" . $value[0];
             }
             $errorMsg = trim($errorMsg, ',');
             Yii::app()->user->setFlash("error", $errorMsg);
         }
         $this->redirect(array('/Template/Index/' . $dsModel->id));
     }
     $data['dbModel'] = $dbModel;
     $data['dsModel'] = $dsModel;
     $data['model'] = $model;
     $data['datasetId'] = $id;
     $this->_getFieldsInfos($data['_txtfiled'], $id);
     $this->render('edit', $data);
 }
Example #9
Show file File: Language.php Project: avatar382/fablab_site
0
 /**
  * Construct a new Language instance
  *
  */
 public function __construct(Template $tpl = null)
 {
     if (is_null($tpl)) {
         $tpl = wire('templates')->get('language');
     }
     parent::__construct($tpl);
 }
Example #10
Show file File: Type.php Project: ceko/concrete5-1
0
 public function getPageTypePageTemplateDefaultPageObject(Template $template = null)
 {
     if (!$template) {
         $template = $this->getPageTypeDefaultPageTemplateObject();
     }
     $db = Loader::db();
     $cID = $db->GetOne('select cID from PageTypePageTemplateDefaultPages where ptID = ? and pTemplateID = ?', array($this->ptID, $template->getPageTemplateID()));
     if (!$cID) {
         // we create one.
         $dh = Loader::helper('date');
         $cDate = $dh->getOverridableNow();
         $data = array('pTemplateID' => $template->getPageTemplateID());
         $cobj = Collection::createCollection($data);
         $cID = $cobj->getCollectionID();
         $v2 = array($cID, 1, $this->getPageTypeID());
         $q2 = "insert into Pages (cID, cIsTemplate, ptID) values (?, ?, ?)";
         $r2 = $db->prepare($q2);
         $res2 = $db->execute($r2, $v2);
         $db->Execute('insert into PageTypePageTemplateDefaultPages (ptID, pTemplateID, cID) values (?, ?, ?)', array($this->ptID, $template->getPageTemplateID(), $cID));
     }
     $template = Page::getByID($cID, 'RECENT');
     if ($template->getCollectionInheritance() != 'OVERRIDE') {
         $template->setPermissionsToManualOverride();
     }
     return $template;
 }
Example #11
Show file File: edituser.php Project: spacequad/glfusion
0
function MG_editUser($uid)
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
    $retval = '';
    $active = 0;
    $quota = 0;
    $username = DB_getItem($_TABLES['users'], 'username', "uid=" . $uid);
    $result = DB_query("SELECT active,quota FROM {$_TABLES['mg_userprefs']} WHERE uid=" . $uid);
    $nRows = DB_numRows($result);
    if ($nRows > 0) {
        $row = DB_fetchArray($result);
        $active = $row['active'];
        $quota = $row['quota'] / 1048576;
    } else {
        $active = 1;
        $quota = $_MG_CONF['member_quota'] / 1048576;
    }
    $T = new Template($_MG_CONF['template_path'] . '/admin');
    $T->set_file('admin', 'useredit.thtml');
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $active_select = '<input type="checkbox" name="active" value="1" ' . ($active ? ' CHECKED' : '') . '/>';
    $T->set_var(array('s_form_action' => $_MG_CONF['admin_url'] . 'edituser.php', 'lang_user_edit' => $LANG_MG01['edit_user'], 'lang_username' => $LANG_MG01['username'], 'lang_active' => $LANG_MG01['active'], 'lang_quota' => $LANG_MG01['quota'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 'lang_unlimited' => $LANG_MG01['zero_unlimited'], 'uid' => $uid, 'active' => $active_select, 'quota' => $quota, 'username' => $username));
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Example #12
Show file File: view.inc.php Project: pragmatos/phpMVCAngular
0
 public static function GetPanel()
 {
     $tpl = new Template();
     $pages = Pages_Model::GetPages();
     $tpl->SetParam('pages', $pages);
     return $tpl->Fetch('templates/pages/pages-panel.tpl');
 }
Example #13
Show file File: lib-common.php Project: hostellerie/nexpro
0
/**
* Creates an HTML unordered list from the given array.
* It formats one list item per array element, using the list.thtml
* and listitem.thtml templates.
*
* @param    array   $listofitems    Items to list out
* @param    string  $classname      optional CSS class name for the list
* @return   string                  HTML unordered list of array items
*/
function COM_makeList($listofitems, $classname = '')
{
    global $_CONF;
    $list = new Template($_CONF['path_layout']);
    $list->set_file(array('list' => 'list.thtml', 'listitem' => 'listitem.thtml'));
    $list->set_var('xhtml', XHTML);
    $list->set_var('site_url', $_CONF['site_url']);
    $list->set_var('site_admin_url', $_CONF['site_admin_url']);
    $list->set_var('layout_url', $_CONF['layout_url']);
    if (empty($classname)) {
        $list->set_var('list_class', '');
        $list->set_var('list_class_name', '');
    } else {
        $list->set_var('list_class', 'class="' . $classname . '"');
        $list->set_var('list_class_name', $classname);
    }
    if (is_array($listofitems)) {
        foreach ($listofitems as $oneitem) {
            $list->set_var('list_item', $oneitem);
            $list->parse('list_items', 'listitem', true);
        }
    }
    $list->parse('newlist', 'list', true);
    return $list->finish($list->get_var('newlist'));
}
Example #14
Show file File: rss.php Project: spacequad/glfusion
0
function MG_editRSS()
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
    $retval = '';
    $T = new Template($_MG_CONF['template_path'] . '/admin');
    $T->set_file('admin', 'rssedit.thtml');
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $rss_full_select = '<input type="checkbox" name="rss_full_enabled" value="1" ' . ($_MG_CONF['rss_full_enabled'] ? ' checked="checked"' : '') . '/>';
    $rss_type_select = "<select name='rss_feed_type'>";
    $rss_type_select .= "<option value='RSS-2.0'" . ($_MG_CONF['rss_feed_type'] == "RSS-2.0" ? ' selected="selected"' : "") . ">RSS2.0</option>";
    $rss_type_select .= "<option value='RSS-1.0'" . ($_MG_CONF['rss_feed_type'] == "RSS-1.0" ? ' selected="selected"' : "") . ">RSS1.0</option>";
    $rss_type_select .= "<option value='RSS-0.91'" . ($_MG_CONF['rss_feed_type'] == "RSS-0.91" ? ' selected="selected"' : "") . ">RSS0.91</option>";
    $rss_type_select .= "<option value='PIE-0.1'" . ($_MG_CONF['rss_feed_type'] == "PIE-0.1" ? ' selected="selected"' : "") . ">PIE0.1</option>";
    $rss_type_select .= "<option value='ATOM-1.0'" . ($_MG_CONF['rss_feed_type'] == "ATOM-1.0" ? ' selected="selected"' : "") . ">ATOM</option>";
    $rss_type_select .= "<option value='ATOM-0.3'" . ($_MG_CONF['rss_feed_type'] == "ATOM-0.3" ? ' selected="selected"' : "") . ">ATOM0.3</option>";
    $rss_type_select .= "</select>";
    $hide_email_select = '<input type="checkbox" name="hide_email" value="1" ' . ($_MG_CONF['hide_author_email'] ? ' checked="checked"' : '') . '/>';
    $rss_ignore_empty_select = '<input type="checkbox" name="rss_ignore_empty" value="1" ' . ($_MG_CONF['rss_ignore_empty'] ? ' checked="checked"' : '') . '/>';
    $rss_anonymous_only_select = '<input type="checkbox" name="rss_anonymous_only" value="1" ' . ($_MG_CONF['rss_anonymous_only'] ? ' checked="checked"' : '') . '/>';
    $T->set_var(array('lang_rss_options' => $LANG_MG01['rss_options'], 'lang_rss_full' => $LANG_MG01['rss_full'], 'lang_rss_type' => $LANG_MG01['rss_type'], 'lang_rss_ignore_empty' => $LANG_MG01['rss_ignore_empty'], 'lang_rss_anonymous_only' => $LANG_MG01['rss_anonymous_only'], 'lang_rss_feed_name' => $LANG_MG01['rss_feed_name'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 'rss_full_select' => $rss_full_select, 'rss_type_select' => $rss_type_select, 'hide_email_select' => $hide_email_select, 'lang_hide_email' => $LANG_MG01['hide_email'], 'rss_ignore_empty_select' => $rss_ignore_empty_select, 'rss_anonymous_only_select' => $rss_anonymous_only_select, 'rss_feed_name' => $_MG_CONF['rss_feed_name'], 's_form_action' => $_MG_CONF['admin_url'] . 'rss.php'));
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Example #15
Show file File: Base.php Project: zonky2/core
0
 /**
  * {@inheritdoc}
  */
 public function parseValue($arrRowData, $strOutputFormat = 'text', $objSettings = null)
 {
     $arrResult = array('raw' => $arrRowData[$this->getColName()]);
     /** @var ISimple $objSettings */
     if ($objSettings && $objSettings->get('template')) {
         $strTemplate = $objSettings->get('template');
         $objTemplate = new Template($strTemplate);
         $this->prepareTemplate($objTemplate, $arrRowData, $objSettings);
         // Now the desired format.
         if ($strValue = $objTemplate->parse($strOutputFormat, false)) {
             $arrResult[$strOutputFormat] = $strValue;
         }
         // Text rendering is mandatory, try with the current setting,
         // upon exception, try again with the default settings, as the template name might have changed.
         // if this fails again, we are definately out of luck and bail the exception.
         try {
             $arrResult['text'] = $objTemplate->parse('text', true);
         } catch (\Exception $e) {
             $objSettingsFallback = $this->getDefaultRenderSettings()->setParent($objSettings->getParent());
             $objTemplate = new Template($objSettingsFallback->get('template'));
             $this->prepareTemplate($objTemplate, $arrRowData, $objSettingsFallback);
             $arrResult['text'] = $objTemplate->parse('text', true);
         }
     } else {
         // Text rendering is mandatory, therefore render using default render settings.
         $arrResult = $this->parseValue($arrRowData, 'text', $this->getDefaultRenderSettings());
     }
     // HOOK: apply additional formatters to attribute.
     $arrResult = $this->hookAdditionalFormatters($arrResult, $arrRowData, $strOutputFormat, $objSettings);
     return $arrResult;
 }
Example #16
Show file File: parser.addon_builder.php Project: thomasvandoren/teentix-site
0
 /**
  * Nested Processing Abstraction
  *
  * @access	public
  * @param	string
  * @return	string
  */
 public function nested_processing($parse_string)
 {
     $TMPL2 = ee()->functions->clone_object($this);
     while (is_int(strpos($parse_string, LD . 'exp:'))) {
         unset($TMPL, $GLOBALS['TMPL']);
         ee()->TMPL = $GLOBALS['TMPL'] = $TMPL = new Template();
         ee()->TMPL->start_microtime = $this->start_microtime;
         ee()->TMPL->template = $parse_string;
         ee()->TMPL->tag_data = array();
         ee()->TMPL->var_single = array();
         ee()->TMPL->var_cond = array();
         ee()->TMPL->var_pair = array();
         ee()->TMPL->plugins = $TMPL2->plugins;
         ee()->TMPL->modules = $TMPL2->modules;
         if (APP_VER < 2.0) {
             ee()->TMPL->parse_template();
             ee()->TMPL->class_handler();
         } else {
             ee()->TMPL->parse_tags();
             ee()->TMPL->process_tags();
         }
         ee()->TMPL->loop_count = 0;
         $parse_string = ee()->TMPL->template;
         $TMPL2->log = array_merge($TMPL2->log, ee()->TMPL->log);
     }
     foreach (get_object_vars($TMPL2) as $key => $value) {
         $this->{$key} = $value;
     }
     unset($TMPL2);
     ee()->TMPL = $GLOBALS['TMPL'] = $TMPL = $this;
     return $parse_string;
 }
Example #17
Show file File: mtdb.base.php Project: benvanstaveren/movabletype
0
 public function fetch_template_meta($type, $name, $blog_id, $global)
 {
     if ($type === 'identifier') {
         $col = 'template_identifier';
         $type_filter = "";
     } else {
         $col = 'template_name';
         $type_filter = "and template_type='{$type}'";
     }
     if (!isset($global)) {
         $blog_filter = "and template_blog_id in (" . $this->escape($blog_id) . ",0)";
     } elseif ($global) {
         $blog_filter = "and template_blog_id=0";
     } else {
         $blog_filter = "and template_blog_id=" . $this->escape($blog_id);
     }
     $tmpl_name = $this->escape($name);
     $where = "{$col} = '{$tmpl_name}'\n                  {$blog_filter}\n                  {$type_filter}\n                  order by\n                      template_blog_id desc";
     require_once 'class.mt_template.php';
     $tmpl = new Template();
     $tmpls = $tmpl->Find($where);
     if (empty($tmpls)) {
         $tmpl = null;
     } else {
         $tmpl = $tmpls[0];
     }
     return $tmpl;
 }
Example #18
Show file File: lib-user.php Project: hostellerie/nexpro
0
/**
* Inform a user their account has been activated.
*
* @param    string  $username   user's login name
* @param    string  $useremail  user's email address
* @return   boolean             true = success, false = an error occured
*
*/
function USER_sendActivationEmail($username, $useremail)
{
    global $_CONF, $_TABLES, $LANG04;
    if (file_exists($_CONF['path_data'] . 'activation_email.txt')) {
        $template = new Template($_CONF['path_data']);
        $template->set_file(array('mail' => 'activation_email.txt'));
        $template->set_var('xhtml', XHTML);
        $template->set_var('site_url', $_CONF['site_url']);
        $template->set_var('site_name', $_CONF['site_name']);
        $template->set_var('site_slogan', $_CONF['site_slogan']);
        $template->set_var('lang_text1', $LANG04[15]);
        $template->set_var('lang_text2', $LANG04[14]);
        $template->parse('output', 'mail');
        $mailtext = $template->get_var('output');
    } else {
        $mailtext = str_replace("<username>", $username, $LANG04[118]) . "\n\n";
        $mailtext .= $_CONF['site_url'] . "\n\n";
        $mailtext .= $LANG04[119] . "\n\n";
        $mailtext .= $_CONF['site_url'] . "/users.php?mode=getpassword\n\n";
        $mailtext .= $_CONF['site_name'] . "\n";
        $mailtext .= $_CONF['site_url'] . "\n";
    }
    $subject = $_CONF['site_name'] . ': ' . $LANG04[120];
    if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
        $mailfrom = $_CONF['noreply_mail'];
        $mailtext .= LB . LB . $LANG04[159];
    } else {
        $mailfrom = $_CONF['site_mail'];
    }
    return COM_mail($useremail, $subject, $mailtext, $mailfrom);
}
Example #19
Show file File: staticsortmedia.php Project: spacequad/glfusion
0
function MG_staticSortMediaOptions()
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG03, $LANG_MG01, $MG_albums, $album_jumpbox;
    $retval = '';
    $valid_albums = 0;
    $T = new Template($_MG_CONF['template_path'] . '/admin');
    $T->set_file('admin', 'staticsortmedia.thtml');
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    // build album list for starting point...
    $album_jumpbox = '<select name="startaid">';
    $album_jumpbox .= '<option value="0">------</option>';
    $valid_albums += $MG_albums[0]->buildJumpBox(0, 3);
    $album_jumpbox .= '</select>';
    // build sort fields select
    $sort_field = '<select name="sortfield">';
    $sort_field .= '<option value="0">' . $LANG_MG01['media_capture_time'] . '</option>';
    $sort_field .= '<option value="1">' . $LANG_MG01['media_upload_time'] . '</option>';
    $sort_field .= '<option value="2">' . $LANG_MG01['media_title'] . '</option>';
    $sort_field .= '<option value="3">' . $LANG_MG01['original_filename'] . '</option>';
    $sort_field .= '</select>';
    $T->set_var(array('s_form_action' => $_MG_CONF['admin_url'] . 'staticsortmedia.php', 'album_select' => $album_jumpbox, 'sort_field_select' => $sort_field, 'lang_starting_album' => $LANG_MG01['starting_album'], 'lang_sort_by' => $LANG_MG03['sort_by'], 'lang_sort_order' => $LANG_MG01['order'], 'lang_ascending' => $LANG_MG01['ascending'], 'lang_descending' => $LANG_MG01['descending'], 'lang_process_subs' => $LANG_MG01['process_subs'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_static_media_sort' => $LANG_MG01['static_sort_media']));
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Example #20
Show file File: TimetableFormatDaily.php Project: arhe/pwak
0
 /**
  * render 
  * 
  * @access public
  * @return void
  */
 public function render()
 {
     $this->setSelection();
     $header = array(array(), array('label' => I18N::formatDate(mktime(0, 0, 0, $this->month, $this->day, $this->year), I18N::DATE_LONG_TEXTUAL)));
     $rows = array();
     while ($e = $this->fetch()) {
         $hour = $e->thisHour();
         $minute = $e->thisMinute();
         if ($hour >= $this->timetable->firstHour && $hour <= $this->timetable->lastHour) {
             $row = array('hour' => $hour . ':' . $minute);
             if ($e->isSelected()) {
                 $cell = array('class' => 'timetable_calCell timetable_calCellBusy', 'busy' => 1);
             } elseif ($e->isEmpty()) {
                 $cell = array('class' => 'timetable_calCell timetable_calCellEmpty', 'busy' => 0);
             }
             if (!$e->isEmpty()) {
                 $cell['popup'] = '';
                 while ($entry = $e->getEntry()) {
                     $cell['events'][] = $entry;
                 }
             }
             $row['cells'][] = $cell;
             $rows[] = $row;
         }
     }
     $smarty = new Template();
     $smarty->assign('header', $header);
     $smarty->assign('rows', $rows);
 }
Example #21
Show file File: Sparkle.php Project: sourcestream/highcore-api
0
 /**
  * Deletes local template files
  *
  * @param Template $template
  * @return void
  */
 public function cleanupTemplate(Template $template)
 {
     $dir = $this->getTemplatePath($template);
     if (!File::deleteDirectory($dir)) {
         throw new \RuntimeException("Could not delete " . $dir);
     }
 }
Example #22
Show file File: OrderProducts.php Project: ralfhartmann/isotope_core
0
 /**
  * Generate the checkout step
  *
  * @return string
  */
 public function generate()
 {
     $objTemplate = new Template($this->objModule->iso_collectionTpl);
     $objOrder = Isotope::getCart()->getDraftOrder();
     $objOrder->addToTemplate($objTemplate, array('gallery' => $this->objModule->iso_gallery, 'sorting' => $objOrder->getItemsSortingCallable($this->objModule->iso_orderCollectionBy)));
     return $objTemplate->parse();
 }
Example #23
Show file File: class.msgtpl.php Project: kumarsivarajan/ctrl-dock
0
 function create($var, &$errors)
 {
     global $cfg;
     if (!$var['name']) {
         $errors['name'] = 'required';
     } elseif (!$errors && Template::getIdByName($var['name'])) {
         $errors['name'] = 'Name already in use';
     }
     if (!$var['copy_template']) {
         $errors['copy_template'] = 'required';
     } else {
         if (!$errors) {
             $template = new Template($var['copy_template'], $cfg->getId());
             if (!is_object($template) || !$template->getId()) {
                 $errors['copy_template'] = 'Unknown template';
             }
         }
     }
     $id = 0;
     if (!$errors && ($info = $template->getInfo())) {
         $sql = 'INSERT INTO ' . EMAIL_TEMPLATE_TABLE . ' SET updated=NOW(), created=NOW() ' . ',cfg_id=' . db_input($cfg->getId()) . ',name=' . db_input(Format::striptags($var['name'])) . ',notes=' . db_input('New template: copy of ' . $info['name']) . ',ticket_autoresp_subj=' . db_input(Format::striptags($info['ticket_autoresp_subj'])) . ',ticket_autoresp_body=' . db_input(Format::striptags($info['ticket_autoresp_body'])) . ',message_autoresp_subj=' . db_input(Format::striptags($info['message_autoresp_subj'])) . ',message_autoresp_body=' . db_input(Format::striptags($info['message_autoresp_body'])) . ',ticket_notice_subj=' . db_input(Format::striptags($info['ticket_notice_subj'])) . ',ticket_notice_body=' . db_input(Format::striptags($info['ticket_notice_body'])) . ',ticket_alert_subj=' . db_input(Format::striptags($info['ticket_alert_subj'])) . ',ticket_alert_body=' . db_input(Format::striptags($info['ticket_alert_body'])) . ',message_alert_subj=' . db_input(Format::striptags($info['message_alert_subj'])) . ',message_alert_body=' . db_input(Format::striptags($info['message_alert_body'])) . ',note_alert_subj=' . db_input(Format::striptags($info['note_alert_subj'])) . ',note_alert_body=' . db_input(Format::striptags($info['note_alert_body'])) . ',assigned_alert_subj=' . db_input(Format::striptags($info['assigned_alert_subj'])) . ',assigned_alert_body=' . db_input(Format::striptags($info['assigned_alert_body'])) . ',ticket_overdue_subj=' . db_input(Format::striptags($info['ticket_overdue_subj'])) . ',ticket_overdue_body=' . db_input(Format::striptags($info['ticket_overdue_body'])) . ',ticket_overlimit_subj=' . db_input(Format::striptags($info['ticket_overlimit_subj'])) . ',ticket_overlimit_body=' . db_input(Format::striptags($info['ticket_overlimit_body'])) . ',ticket_reply_subj=' . db_input(Format::striptags($info['ticket_reply_subj'])) . ',ticket_reply_body=' . db_input(Format::striptags($info['ticket_reply_body']));
         //echo $sql;
         if (!db_query($sql) || !($id = db_insert_id())) {
             $errors['err'] = 'Unable to create the template. Internal error occured';
         }
     }
     return $id;
 }
Example #24
Show file File: RouterListView.php Project: jne21/WBT
0
 static function get($data)
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $tpl = new Template($registry->get('template_path') . 'router.htm');
     $tpli = new Template($registry->get('template_path') . 'router_item.htm');
     $list = $data['list'];
     $cnt = count($data['list']);
     $listItems = '';
     foreach ($list as $line) {
         $listItems .= $tpli->apply(['id' => $line->id, 'name' => $line->name, 'url' => $line->url, 'controller' => $line->controller]);
     }
     return $tpl->apply(['count' => $cnt, 'items' => $listItems, 'site_root' => $application->siteRoot]);
 }
Example #25
Show file File: InheritanceTest.php Project: GerDner/luck-docker
0
 private function getDummyTemplates()
 {
     $master = new \Shopware\Models\Shop\Template();
     $master->setName('TestBare');
     $master->setTemplate('TestBare');
     $master->setVersion(3);
     $slave = new \Shopware\Models\Shop\Template();
     $slave->setName('TestResponsive');
     $slave->setTemplate('TestResponsive');
     $slave->setParent($master);
     $slave->setVersion(3);
     return $slave;
 }
Example #26
Show file File: TemplatesSeeder.php Project: sourcestream/highcore-api
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $highcore_project = Project::wherename('highcore')->first();
     DB::table('templates')->delete();
     $template = new Template(['name' => 'env', 'repository' => 'https://github.com/sourcestream/highcore-templates.git', 'refspec' => 'master']);
     $template->project()->associate($highcore_project)->save();
     $template = new Template(['name' => 'highcore', 'repository' => 'https://github.com/sourcestream/highcore-templates.git', 'refspec' => 'master']);
     $template->project()->associate($highcore_project)->save();
     $this->command->info('Templates table seeded!');
 }
Example #27
Show file File: functions.inc.php Project: squidjam/Piwigo
0
/**
 * Redirects to the given URL (HTML method).
 * once this function called, the execution doesn't go further
 * (presence of an exit() instruction.
 *
 * @param string $url
 * @param string $msg
 * @param integer $refresh_time
 * @return void
 */
function redirect_html($url, $msg = '', $refresh_time = 0)
{
    global $user, $template, $lang_info, $conf, $lang, $t2, $page, $debug;
    if (!isset($lang_info) || !isset($template)) {
        $user = build_user($conf['guest_id'], true);
        load_language('common.lang');
        trigger_notify('loading_lang');
        load_language('lang', PHPWG_ROOT_PATH . PWG_LOCAL_DIR, array('no_fallback' => true, 'local' => true));
        $template = new Template(PHPWG_ROOT_PATH . 'themes', get_default_theme());
    } elseif (defined('IN_ADMIN') and IN_ADMIN) {
        $template = new Template(PHPWG_ROOT_PATH . 'themes', get_default_theme());
    }
    if (empty($msg)) {
        $msg = nl2br(l10n('Redirection...'));
    }
    $refresh = $refresh_time;
    $url_link = $url;
    $title = 'redirection';
    $template->set_filenames(array('redirect' => 'redirect.tpl'));
    include PHPWG_ROOT_PATH . 'include/page_header.php';
    $template->set_filenames(array('redirect' => 'redirect.tpl'));
    $template->assign('REDIRECT_MSG', $msg);
    $template->parse('redirect');
    include PHPWG_ROOT_PATH . 'include/page_tail.php';
    exit;
}
Example #28
Show file File: template.php Project: chaipokoi/IUT-ProgServer
0
function template($file, $parameters, $parent = NULL)
{
    if (is_null($parent)) {
        $tpl = new Template($file, $parameters);
        $tpl->load();
        echo $tpl->getHTML();
    } else {
        $tpl = new Template($file, $parameters);
        $tpl->load();
        $child = $tpl->getHTML();
        $parameters["__CHILD__"] = $child;
        $tpl = new Template($parent, $parameters);
        $tpl->load();
        echo $tpl->getHTML();
    }
}
Frequently Used Methods